From 1d840c0d8bc992ec19f0cfc5dca4e02f70ad602c Mon Sep 17 00:00:00 2001 From: Norbert Herrmann <n.herrmann@physi.uni-heidelberg.de> Date: Mon, 4 Jan 2021 17:43:34 +0100 Subject: [PATCH] formatting... --- core/data/tof/CbmTofTracklet.h | 2 +- core/data/tof/CbmTofTrackletParam.h | 6 +- macro/beamtime/pl_ext_SUT.C | 45 +- macro/beamtime/pl_ext_dXdY.C | 10 +- macro/beamtime/pl_ext_over.C | 4 +- macro/beamtime/pl_ext_trk.C | 22 +- reco/detectors/tof/CbmTofExtendTracks.cxx | 1610 +++++++++++---------- reco/detectors/tof/CbmTofExtendTracks.h | 127 +- reco/detectors/tof/CbmTofFindTracks.cxx | 68 +- reco/detectors/tof/CbmTofFindTracks.h | 12 +- 10 files changed, 996 insertions(+), 910 deletions(-) diff --git a/core/data/tof/CbmTofTracklet.h b/core/data/tof/CbmTofTracklet.h index 8e7c3e6544..23261fdaa9 100644 --- a/core/data/tof/CbmTofTracklet.h +++ b/core/data/tof/CbmTofTracklet.h @@ -69,7 +69,7 @@ public: } Int_t GetTofHitIndex(Int_t ind) const { return fTofHit[ind]; } - inline void SetTofHitIndex(Int_t ind, Int_t i) { fTofHit[ind]=i; } + inline void SetTofHitIndex(Int_t ind, Int_t i) { fTofHit[ind] = i; } CbmTofHit* GetTofHitPointer(Int_t ind) { return &fhit[ind]; } Int_t GetTofDetIndex(Int_t ind) const { return fTofDet[ind]; } diff --git a/core/data/tof/CbmTofTrackletParam.h b/core/data/tof/CbmTofTrackletParam.h index f3dda7e1b8..8933ba8524 100644 --- a/core/data/tof/CbmTofTrackletParam.h +++ b/core/data/tof/CbmTofTrackletParam.h @@ -148,9 +148,9 @@ public: private: Double_t fX, fY, fZ, fT; // X, Y, Z coordinates in [cm] - Double_t fTx, fTy, fTt; // Slopes: tx=dx/dz, ty=dy/dz - Double_t fQp; // Q/p: Q is a charge (+/-1), p is momentum in [GeV/c] - Double_t fLz; // tracklength in z - direction + Double_t fTx, fTy, fTt; // Slopes: tx=dx/dz, ty=dy/dz + Double_t fQp; // Q/p: Q is a charge (+/-1), p is momentum in [GeV/c] + Double_t fLz; // tracklength in z - direction Double_t fChiSq; /* Covariance matrix. * Upper triangle symmetric matrix. diff --git a/macro/beamtime/pl_ext_SUT.C b/macro/beamtime/pl_ext_SUT.C index 971b5f5f36..60df355514 100644 --- a/macro/beamtime/pl_ext_SUT.C +++ b/macro/beamtime/pl_ext_SUT.C @@ -1,4 +1,4 @@ -void pl_ext_SUT(Double_t dThr=0., Double_t MinEff=0.) { +void pl_ext_SUT(Double_t dThr = 0., Double_t MinEff = 0.) { // TCanvas *can = new TCanvas("can22","can22"); // can->Divide(2,2); TCanvas* can = new TCanvas("can", "can", 50, 0, 800, 800); @@ -14,8 +14,8 @@ void pl_ext_SUT(Double_t dThr=0., Double_t MinEff=0.) { TH1* h; TH1* h1; TH2* h2; - TH2* h2f; // found hits - TH2* h2m; // missed hits + TH2* h2f; // found hits + TH2* h2m; // missed hits TH3* h3; TString hname = ""; Double_t Nall, eff; @@ -25,7 +25,7 @@ void pl_ext_SUT(Double_t dThr=0., Double_t MinEff=0.) { can->cd(1); gROOT->cd(); hname = Form("hExtSutXY_Found"); - h2f = (TH2*) gROOT->FindObjectAny(hname); + h2f = (TH2*) gROOT->FindObjectAny(hname); if (h2f != NULL) { h2f->Draw("colz"); //gPad->SetLogz(); @@ -37,7 +37,7 @@ void pl_ext_SUT(Double_t dThr=0., Double_t MinEff=0.) { can->cd(2); gROOT->cd(); hname = Form("hExtSutXY_Missed"); - h2m = (TH2*) gROOT->FindObjectAny(hname); + h2m = (TH2*) gROOT->FindObjectAny(hname); if (h2m != NULL) { h2m->Draw("colz"); //gPad->SetLogz(); @@ -45,9 +45,9 @@ void pl_ext_SUT(Double_t dThr=0., Double_t MinEff=0.) { } else { cout << hname << " not found" << endl; } - + can->cd(3); - if(1) { + if (1) { if (h2f != NULL) { TH2* h2acc = (TH2*) h2f->Clone(Form("hAccSUT")); //h2acc->Divide(h2,h2,1.,1.,"B"); @@ -66,19 +66,18 @@ void pl_ext_SUT(Double_t dThr=0., Double_t MinEff=0.) { if (h2m != NULL) { Double_t Nmis = h2m->GetEntries(); Double_t NmisI = h2m->Integral(); - TH2* h2missed = (TH2*) h2m->Clone(Form("Missed_acc")); + TH2* h2missed = (TH2*) h2m->Clone(Form("Missed_acc")); h2missed->Multiply(h2m, h2acc, 1., 1., "B"); Double_t NmisaI = h2missed->Integral(); - eff = 1. - NmisaI / (Nall + NmisaI); - cout << "Efficiency of Sut: all " << Nall << ", mis " - << Nmis << ", " << NmisI << ", " << NmisaI << " -> " - << Form("%6.3f", eff) << endl; + eff = 1. - NmisaI / (Nall + NmisaI); + cout << "Efficiency of Sut: all " << Nall << ", mis " << Nmis << ", " + << NmisI << ", " << NmisaI << " -> " << Form("%6.3f", eff) << endl; - hname = Form("Efficiency"); + hname = Form("Efficiency"); TH2* h2eff = (TH2*) gROOT->FindObjectAny(hname); if (NULL != h2eff) h2eff->Delete(); - h2eff = (TH2*) h2f->Clone(hname); - hname = Form("Total"); + h2eff = (TH2*) h2f->Clone(hname); + hname = Form("Total"); TH2* h2tot = (TH2*) gROOT->FindObjectAny(hname); if (NULL != h2tot) h2tot->Delete(); h2tot = (TH2*) h2m->Clone(hname); @@ -91,9 +90,9 @@ void pl_ext_SUT(Double_t dThr=0., Double_t MinEff=0.) { h2eff->GetZaxis()->SetRangeUser(MinEff, 1.); h2eff->Draw("colz"); gPad->Update(); - h2eff->Draw("colz"); - } - } + h2eff->Draw("colz"); + } + } } can->cd(4); gROOT->cd(); @@ -108,7 +107,7 @@ void pl_ext_SUT(Double_t dThr=0., Double_t MinEff=0.) { } else { cout << hname << " not found" << endl; } - + can->cd(5); gROOT->cd(); hname = Form("hExtSutXY_DY"); @@ -118,7 +117,7 @@ void pl_ext_SUT(Double_t dThr=0., Double_t MinEff=0.) { //h3->Draw("colz"); //gPad->SetLogz(); can->cd(8); - h3->ProjectionZ()->Draw(""); + h3->ProjectionZ()->Draw(""); } else { cout << hname << " not found" << endl; } @@ -132,11 +131,11 @@ void pl_ext_SUT(Double_t dThr=0., Double_t MinEff=0.) { //h3->Draw("colz"); //gPad->SetLogz(); can->cd(9); - h3->ProjectionZ()->Draw(""); + h3->ProjectionZ()->Draw(""); } else { cout << hname << " not found" << endl; } - - + + can->SaveAs("pl_ext_SUT.pdf"); } diff --git a/macro/beamtime/pl_ext_dXdY.C b/macro/beamtime/pl_ext_dXdY.C index 2d7ff1a3d8..b50322c0a9 100644 --- a/macro/beamtime/pl_ext_dXdY.C +++ b/macro/beamtime/pl_ext_dXdY.C @@ -1,4 +1,4 @@ -void pl_ext_dXdY(Int_t iLev=0, Int_t NSt=12) { +void pl_ext_dXdY(Int_t iLev = 0, Int_t NSt = 12) { // TCanvas *can = new TCanvas("can22","can22"); // can->Divide(2,2); TCanvas* can = new TCanvas("can", "can", 50, 0, 1200, 800); @@ -18,12 +18,12 @@ void pl_ext_dXdY(Int_t iLev=0, Int_t NSt=12) { // if (h!=NULL) h->Delete(); - Int_t iPad=0; - for (Int_t iSt=0; iSt<NSt; iSt++) { - iPad++; + Int_t iPad = 0; + for (Int_t iSt = 0; iSt < NSt; iSt++) { + iPad++; can->cd(iPad); gROOT->cd(); - hname = Form("hTrkPosCor%d_St%d",iLev,iSt); + hname = Form("hTrkPosCor%d_St%d", iLev, iSt); h2 = (TH2*) gROOT->FindObjectAny(hname); if (h2 != NULL) { h2->Draw("colz"); diff --git a/macro/beamtime/pl_ext_over.C b/macro/beamtime/pl_ext_over.C index 8f3afb2374..65dd7ded6b 100644 --- a/macro/beamtime/pl_ext_over.C +++ b/macro/beamtime/pl_ext_over.C @@ -113,7 +113,7 @@ void pl_ext_over() { } else { cout << hname << " not found" << endl; } - + can->cd(9); gROOT->cd(); hname = Form("hExt_TrkSizChiSq1"); @@ -137,6 +137,6 @@ void pl_ext_over() { } else { cout << hname << " not found" << endl; } - + can->SaveAs("pl_ext_over.pdf"); } diff --git a/macro/beamtime/pl_ext_trk.C b/macro/beamtime/pl_ext_trk.C index 3adb126e99..afdc8b8d7b 100644 --- a/macro/beamtime/pl_ext_trk.C +++ b/macro/beamtime/pl_ext_trk.C @@ -1,4 +1,4 @@ -void pl_ext_trk(Int_t iLev=1) { +void pl_ext_trk(Int_t iLev = 1) { // TCanvas *can = new TCanvas("can22","can22"); // can->Divide(2,2); TCanvas* can = new TCanvas("can", "can", 50, 0, 800, 800); @@ -20,7 +20,7 @@ void pl_ext_trk(Int_t iLev=1) { can->cd(1); gROOT->cd(); - hname = Form("hTrkStationDX%d",iLev); + hname = Form("hTrkStationDX%d", iLev); h2 = (TH2*) gROOT->FindObjectAny(hname); if (h2 != NULL) { h2->Draw("colz"); @@ -32,7 +32,7 @@ void pl_ext_trk(Int_t iLev=1) { can->cd(2); gROOT->cd(); - hname = Form("hTrkStationDY%d",iLev); + hname = Form("hTrkStationDY%d", iLev); h2 = (TH2*) gROOT->FindObjectAny(hname); if (h2 != NULL) { h2->Draw("colz"); @@ -44,7 +44,7 @@ void pl_ext_trk(Int_t iLev=1) { can->cd(3); gROOT->cd(); - hname = Form("hTrkStationDT%d",iLev); + hname = Form("hTrkStationDT%d", iLev); h2 = (TH2*) gROOT->FindObjectAny(hname); if (h2 != NULL) { h2->Draw("colz"); @@ -56,7 +56,7 @@ void pl_ext_trk(Int_t iLev=1) { can->cd(4); gROOT->cd(); - hname = Form("hTrkStationNHits%d",iLev); + hname = Form("hTrkStationNHits%d", iLev); h2 = (TH2*) gROOT->FindObjectAny(hname); if (h2 != NULL) { h2->Draw("colz"); @@ -68,7 +68,7 @@ void pl_ext_trk(Int_t iLev=1) { can->cd(5); gROOT->cd(); - hname = Form("hTrkPullDX%d",iLev); + hname = Form("hTrkPullDX%d", iLev); h2 = (TH2*) gROOT->FindObjectAny(hname); if (h2 != NULL) { h2->Draw("colz"); @@ -80,7 +80,7 @@ void pl_ext_trk(Int_t iLev=1) { can->cd(6); gROOT->cd(); - hname = Form("hTrkPullDY%d",iLev); + hname = Form("hTrkPullDY%d", iLev); h2 = (TH2*) gROOT->FindObjectAny(hname); if (h2 != NULL) { h2->Draw("colz"); @@ -92,7 +92,7 @@ void pl_ext_trk(Int_t iLev=1) { can->cd(7); gROOT->cd(); - hname = Form("hTrkPullDT%d",iLev); + hname = Form("hTrkPullDT%d", iLev); h2 = (TH2*) gROOT->FindObjectAny(hname); if (h2 != NULL) { h2->Draw("colz"); @@ -104,7 +104,7 @@ void pl_ext_trk(Int_t iLev=1) { can->cd(8); gROOT->cd(); - hname = Form("hExt_TrkSizVel%d",iLev); + hname = Form("hExt_TrkSizVel%d", iLev); h2 = (TH2*) gROOT->FindObjectAny(hname); if (h2 != NULL) { h2->Draw("colz"); @@ -113,7 +113,7 @@ void pl_ext_trk(Int_t iLev=1) { } else { cout << hname << " not found" << endl; } - + can->cd(9); gROOT->cd(); hname = Form("hExt_Xoff"); @@ -146,7 +146,7 @@ void pl_ext_trk(Int_t iLev=1) { can->cd(12); gROOT->cd(); - hname = Form("hExt_TrkSizChiSq%d",iLev); + hname = Form("hExt_TrkSizChiSq%d", iLev); h2 = (TH2*) gROOT->FindObjectAny(hname); if (h2 != NULL) { h2->Draw("colz"); diff --git a/reco/detectors/tof/CbmTofExtendTracks.cxx b/reco/detectors/tof/CbmTofExtendTracks.cxx index f5b6512f8a..4188c78360 100644 --- a/reco/detectors/tof/CbmTofExtendTracks.cxx +++ b/reco/detectors/tof/CbmTofExtendTracks.cxx @@ -59,8 +59,8 @@ using std::vector; const Int_t NDefSetup = 100; static LKFMinuit fMinuit; -static Int_t fiTS=0; -static Double_t dSUT_z=0.; +static Int_t fiTS = 0; +static Double_t dSUT_z = 0.; ClassImp(CbmTofExtendTracks); @@ -104,11 +104,11 @@ CbmTofExtendTracks::CbmTofExtendTracks(const char* name, , fvAllHitPointer() , fvTrkCalHits() , fvTrkPar() - , fvToff() + , fvToff() , fvXoff() , fvYoff() , fvZoff() - , fvTsig() + , fvTsig() , fvXsig() , fvYsig() , fvZsig() @@ -200,11 +200,11 @@ InitStatus CbmTofExtendTracks::Init() { if (!fTofHitArrayIn) { fTofHitArrayIn = (TClonesArray*) ioman->GetObject("TofHit"); if (!fTofHitArrayIn) { - LOG(fatal) << "-W- CbmTofExtendTracks::Init: No TofHit array!"; + LOG(fatal) << "-W- CbmTofExtendTracks::Init: No TofHit array!"; return kERROR; } - }else{ - LOG(info) << "-I- CbmTofExtendTracks::Init: TofCalHit array!"; + } else { + LOG(info) << "-I- CbmTofExtendTracks::Init: TofCalHit array!"; } // Get TOF Track Array @@ -236,22 +236,30 @@ InitStatus CbmTofExtendTracks::Init() { } if (kFALSE == InitParameters()) return kFATAL; - + CreateHistograms(); fMinuit.Initialize(); - + LOG(info) << "CbmTofExtendTracks initialized"; return kSUCCESS; } // ------------------------------------------------------------------------- /************************************************************************************/ Bool_t CbmTofExtendTracks::LoadCalParameter() { - UInt_t NSt=fMapStationZ.size(); - fvToff.resize(NSt);for(uint i=0; i<NSt;i++)fvToff[i]=0.; - fvXoff.resize(NSt);for(uint i=0; i<NSt;i++)fvXoff[i]=0.; - fvYoff.resize(NSt);for(uint i=0; i<NSt;i++)fvYoff[i]=0.; - fvZoff.resize(NSt);for(uint i=0; i<NSt;i++)fvZoff[i]=0.; + UInt_t NSt = fMapStationZ.size(); + fvToff.resize(NSt); + for (uint i = 0; i < NSt; i++) + fvToff[i] = 0.; + fvXoff.resize(NSt); + for (uint i = 0; i < NSt; i++) + fvXoff[i] = 0.; + fvYoff.resize(NSt); + for (uint i = 0; i < NSt; i++) + fvYoff[i] = 0.; + fvZoff.resize(NSt); + for (uint i = 0; i < NSt; i++) + fvZoff[i] = 0.; if (fCalParFileName.IsNull()) return kTRUE; TDirectory* oldir = gDirectory; @@ -270,65 +278,65 @@ Bool_t CbmTofExtendTracks::LoadCalParameter() { TH1D* fhx = (TH1D*) gDirectory->FindObjectAny(Form("hExt_Xoff")); TH1D* fhy = (TH1D*) gDirectory->FindObjectAny(Form("hExt_Yoff")); TH1D* fhz = (TH1D*) gDirectory->FindObjectAny(Form("hExt_Zoff")); - + TH1D* fhts = (TH1D*) gDirectory->FindObjectAny(Form("hExt_Tsig")); TH1D* fhxs = (TH1D*) gDirectory->FindObjectAny(Form("hExt_Xsig")); TH1D* fhys = (TH1D*) gDirectory->FindObjectAny(Form("hExt_Ysig")); TH1D* fhzs = (TH1D*) gDirectory->FindObjectAny(Form("hExt_Zsig")); - + gDirectory->cd(oldir->GetPath()); - if(NULL != fht){ - fhExt_Toff=(TH1D*)fht->Clone(); - for (UInt_t iSt=0; iSt<NSt; iSt++) { - fvToff[iSt]=fhExt_Toff->GetBinContent(iSt+1); + if (NULL != fht) { + fhExt_Toff = (TH1D*) fht->Clone(); + for (UInt_t iSt = 0; iSt < NSt; iSt++) { + fvToff[iSt] = fhExt_Toff->GetBinContent(iSt + 1); } } - if(NULL != fhx){ - fhExt_Xoff=(TH1D*)fhx->Clone(); - for (UInt_t iSt=0; iSt<NSt; iSt++) { - fvXoff[iSt]=fhExt_Xoff->GetBinContent(iSt+1); + if (NULL != fhx) { + fhExt_Xoff = (TH1D*) fhx->Clone(); + for (UInt_t iSt = 0; iSt < NSt; iSt++) { + fvXoff[iSt] = fhExt_Xoff->GetBinContent(iSt + 1); } - } - if(NULL != fhy){ - fhExt_Yoff=(TH1D*)fhy->Clone(); - for (UInt_t iSt=0; iSt<NSt; iSt++) { - fvYoff[iSt]=fhExt_Yoff->GetBinContent(iSt+1); + } + if (NULL != fhy) { + fhExt_Yoff = (TH1D*) fhy->Clone(); + for (UInt_t iSt = 0; iSt < NSt; iSt++) { + fvYoff[iSt] = fhExt_Yoff->GetBinContent(iSt + 1); } - } - if(NULL != fhz){ - fhExt_Zoff=(TH1D*)fhz->Clone(); - for (UInt_t iSt=0; iSt<NSt; iSt++) { - fvZoff[iSt]=fhExt_Zoff->GetBinContent(iSt+1); + } + if (NULL != fhz) { + fhExt_Zoff = (TH1D*) fhz->Clone(); + for (UInt_t iSt = 0; iSt < NSt; iSt++) { + fvZoff[iSt] = fhExt_Zoff->GetBinContent(iSt + 1); } } - - if(NULL != fhts){ - fhExt_Tsig=(TH1D*)fhts->Clone(); - for (UInt_t iSt=0; iSt<NSt; iSt++) { - fvTsig[iSt]=fhExt_Tsig->GetBinContent(iSt+1); + + if (NULL != fhts) { + fhExt_Tsig = (TH1D*) fhts->Clone(); + for (UInt_t iSt = 0; iSt < NSt; iSt++) { + fvTsig[iSt] = fhExt_Tsig->GetBinContent(iSt + 1); } } - if(NULL != fhxs){ - fhExt_Xsig=(TH1D*)fhxs->Clone(); - for (UInt_t iSt=0; iSt<NSt; iSt++) { - fvXsig[iSt]=fhExt_Xsig->GetBinContent(iSt+1); + if (NULL != fhxs) { + fhExt_Xsig = (TH1D*) fhxs->Clone(); + for (UInt_t iSt = 0; iSt < NSt; iSt++) { + fvXsig[iSt] = fhExt_Xsig->GetBinContent(iSt + 1); } - } - if(NULL != fhys){ - fhExt_Ysig=(TH1D*)fhys->Clone(); - for (UInt_t iSt=0; iSt<NSt; iSt++) { - fvYsig[iSt]=fhExt_Ysig->GetBinContent(iSt+1); + } + if (NULL != fhys) { + fhExt_Ysig = (TH1D*) fhys->Clone(); + for (UInt_t iSt = 0; iSt < NSt; iSt++) { + fvYsig[iSt] = fhExt_Ysig->GetBinContent(iSt + 1); } - } - if(NULL != fhzs){ - fhExt_Zsig=(TH1D*)fhzs->Clone(); - for (UInt_t iSt=0; iSt<NSt; iSt++) { - fvZsig[iSt]=fhExt_Zsig->GetBinContent(iSt+1); + } + if (NULL != fhzs) { + fhExt_Zsig = (TH1D*) fhzs->Clone(); + for (UInt_t iSt = 0; iSt < NSt; iSt++) { + fvZsig[iSt] = fhExt_Zsig->GetBinContent(iSt + 1); } } - - + + fCalParFile->Close(); return kTRUE; @@ -341,48 +349,48 @@ void CbmTofExtendTracks::SetParContainers() { FairRunAna* ana = FairRunAna::Instance(); FairRuntimeDb* rtdb = ana->GetRuntimeDb(); */ - } // ------------------------------------------------------------------------- Bool_t CbmTofExtendTracks::UpdateCalHistos() { - while (fiCorMode>0) { - Int_t iCorMode=fiCorMode%10; - fiCorMode /= 10; - Int_t iLev=fiCorSrc/10; - LOG(info) << "UpdateCalHist on level "<<iLev - <<" from src "<<fiCorSrc<<" in mode "<<iCorMode; + while (fiCorMode > 0) { + Int_t iCorMode = fiCorMode % 10; + fiCorMode /= 10; + Int_t iLev = fiCorSrc / 10; + LOG(info) << "UpdateCalHist on level " << iLev << " from src " << fiCorSrc + << " in mode " << iCorMode; switch (iCorMode) { - case 0: { // T - TH2* hCorDT=NULL; - if(fiCorSrc%10 == 0 ) hCorDT=fhTrkStationDT[iLev]; - else hCorDT=fhTrkPullDT[iLev]; - if ( NULL != hCorDT ) { + case 0: { // T + TH2* hCorDT = NULL; + if (fiCorSrc % 10 == 0) + hCorDT = fhTrkStationDT[iLev]; + else + hCorDT = fhTrkPullDT[iLev]; + if (NULL != hCorDT) { Double_t nx = hCorDT->GetNbinsX(); if (NULL == fhExt_Toff) { - fhExt_Toff=new TH1D("hExt_Toff",";station;Toff (ns)",nx,0,nx); - LOG(warn)<<"Created "<<fhExt_Toff->GetName(); + fhExt_Toff = new TH1D("hExt_Toff", ";station;Toff (ns)", nx, 0, nx); + LOG(warn) << "Created " << fhExt_Toff->GetName(); } if (NULL == fhExt_Tsig) { - fhExt_Tsig=new TH1D("hExt_Tsig",";station;Tsig (ns)",nx,0,nx); - LOG(warn)<<"Created "<<fhExt_Tsig->GetName(); - } + fhExt_Tsig = new TH1D("hExt_Tsig", ";station;Tsig (ns)", nx, 0, nx); + LOG(warn) << "Created " << fhExt_Tsig->GetName(); + } for (Int_t ix = 0; ix < nx; ix++) { Double_t dVal = fhExt_Toff->GetBinContent(ix + 1); - TH1D* hpy = - hCorDT->ProjectionY( - Form("%s_py%d",hCorDT->GetName(),ix),ix+1,ix+1,""); + TH1D* hpy = hCorDT->ProjectionY( + Form("%s_py%d", hCorDT->GetName(), ix), ix + 1, ix + 1, ""); Double_t dFMean = 0.; - LOG(warn)<<"TOff Entries for station " << ix - << ": " << hpy->GetEntries(); + LOG(warn) << "TOff Entries for station " << ix << ": " + << hpy->GetEntries(); if (hpy->GetEntries() > 100) { - Int_t iBmax = hpy->GetMaximumBin(); - TAxis* xaxis = hpy->GetXaxis(); - Double_t dMean = - xaxis->GetBinCenter(iBmax); //X-value of bin with maximal content + Int_t iBmax = hpy->GetMaximumBin(); + TAxis* xaxis = hpy->GetXaxis(); + Double_t dMean = xaxis->GetBinCenter( + iBmax); //X-value of bin with maximal content Double_t dLim = 1. * hpy->GetRMS(); //Double_t dLim = 5. * hpy->GetBinWidth(1); - if(dLim > 0.) { + if (dLim > 0.) { //TF1 * f = new TF1 ("f","gaus"); //f->SetParLimits(2,dMean - dLim, dMean + dLim); //f->SetParLimits(3,0.,dLim); @@ -390,20 +398,18 @@ Bool_t CbmTofExtendTracks::UpdateCalHistos() { // hpy->Fit(f,"B"); hpy->Fit("gaus", "SQM", "", dMean - dLim, dMean + dLim); Int_t iFitStatus = fRes; - //LOG(warn)<<Form("TRes 0x%08x ",(UInt_t)iFitStatus); - + //LOG(warn)<<Form("TRes 0x%08x ",(UInt_t)iFitStatus); + if (iFitStatus != -1) { dFMean = fRes->Parameter(1); dVal -= dFMean; - fhExt_Tsig->SetBinContent(ix + 1, fRes->Parameter(2)); - } else - dVal-=dMean; + fhExt_Tsig->SetBinContent(ix + 1, fRes->Parameter(2)); + } else + dVal -= dMean; LOG(warn) << "Update hExt_Toff Ind " << ix << ": Old " - << fhExt_Toff->GetBinContent(ix + 1) - << ", FitMean " - << dFMean << " => " << dVal - << ", width "<< fhExt_Tsig->GetBinContent(ix + 1); - + << fhExt_Toff->GetBinContent(ix + 1) << ", FitMean " + << dFMean << " => " << dVal << ", width " + << fhExt_Tsig->GetBinContent(ix + 1); } } else { LOG(warn) << "Update hExt_Toff " << ix @@ -412,57 +418,56 @@ Bool_t CbmTofExtendTracks::UpdateCalHistos() { fhExt_Toff->SetBinContent(ix + 1, dVal); } } - } - break; - case 1: { // X - TH2* hCorDX=NULL; - if(fiCorSrc%10 == 0 ) hCorDX=fhTrkStationDX[iLev]; - else hCorDX=fhTrkPullDX[iLev]; - if ( NULL != hCorDX ) { + } break; + case 1: { // X + TH2* hCorDX = NULL; + if (fiCorSrc % 10 == 0) + hCorDX = fhTrkStationDX[iLev]; + else + hCorDX = fhTrkPullDX[iLev]; + if (NULL != hCorDX) { Double_t nx = hCorDX->GetNbinsX(); if (NULL == fhExt_Xoff) { - fhExt_Xoff=new TH1D("hExt_Xoff",";station;Xoff (cm)",nx,0,nx); - LOG(warn)<<"Created "<<fhExt_Xoff->GetName(); - } + fhExt_Xoff = new TH1D("hExt_Xoff", ";station;Xoff (cm)", nx, 0, nx); + LOG(warn) << "Created " << fhExt_Xoff->GetName(); + } if (NULL == fhExt_Xsig) { - fhExt_Xsig=new TH1D("hExt_Xsig",";station;Xsig (cm)",nx,0,nx); - LOG(warn)<<"Created "<<fhExt_Xsig->GetName(); - } + fhExt_Xsig = new TH1D("hExt_Xsig", ";station;Xsig (cm)", nx, 0, nx); + LOG(warn) << "Created " << fhExt_Xsig->GetName(); + } for (Int_t ix = 0; ix < nx; ix++) { Double_t dVal = fhExt_Xoff->GetBinContent(ix + 1); - TH1D* hpy = - hCorDX->ProjectionY( - Form("%s_py%d",hCorDX->GetName(),ix),ix+1,ix+1,""); + TH1D* hpy = hCorDX->ProjectionY( + Form("%s_py%d", hCorDX->GetName(), ix), ix + 1, ix + 1, ""); Double_t dFMean = 0.; - LOG(warn)<<"XOff Entries for station " << ix - << ": " << hpy->GetEntries(); + LOG(warn) << "XOff Entries for station " << ix << ": " + << hpy->GetEntries(); if (hpy->GetEntries() > 100) { - Int_t iBmax = hpy->GetMaximumBin(); - TAxis* xaxis = hpy->GetXaxis(); - Double_t dMean = - xaxis->GetBinCenter(iBmax); //X-value of bin with maximal content + Int_t iBmax = hpy->GetMaximumBin(); + TAxis* xaxis = hpy->GetXaxis(); + Double_t dMean = xaxis->GetBinCenter( + iBmax); //X-value of bin with maximal content //Double_t dLim = 1. * hpy->GetRMS(); Double_t dLim = 5. * hpy->GetBinWidth(1); - if(dLim > 0.) { + if (dLim > 0.) { //TF1 * f = new TF1 ("f","gaus"); //f->SetParLimits(2,dMean - dLim, dMean + dLim); //f->SetParLimits(3,0.,dLim); TFitResultPtr fRes = - // hpy->Fit(f,"B"); + // hpy->Fit(f,"B"); hpy->Fit("gaus", "SQM", "", dMean - dLim, dMean + dLim); Int_t iFitStatus = fRes; - //LOG(warn)<<Form("XRes 0x%08x ",(UInt_t)iFitStatus); + //LOG(warn)<<Form("XRes 0x%08x ",(UInt_t)iFitStatus); if (iFitStatus != -1) { // check validity of fit dFMean = fRes->Parameter(1); dVal -= dFMean; - fhExt_Xsig->SetBinContent(ix + 1, fRes->Parameter(2)); - }else - dVal-=dMean; + fhExt_Xsig->SetBinContent(ix + 1, fRes->Parameter(2)); + } else + dVal -= dMean; LOG(warn) << "Update hExt_Xoff Ind " << ix << ": Old " - << fhExt_Xoff->GetBinContent(ix + 1) - << ", FitMean " - << dFMean << " => " << dVal - << ", width "<< fhExt_Xsig->GetBinContent(ix + 1); + << fhExt_Xoff->GetBinContent(ix + 1) << ", FitMean " + << dFMean << " => " << dVal << ", width " + << fhExt_Xsig->GetBinContent(ix + 1); } } else { LOG(warn) << "Update hExt_Xoff " << ix @@ -470,61 +475,60 @@ Bool_t CbmTofExtendTracks::UpdateCalHistos() { } fhExt_Xoff->SetBinContent(ix + 1, dVal); } - } - } - break; - case 2: { // Y - TH2* hCorDY=NULL; - if(fiCorSrc%10 == 0 ) hCorDY=fhTrkStationDY[iLev]; - else hCorDY=fhTrkPullDY[iLev]; - if ( NULL != hCorDY ) { + } + } break; + case 2: { // Y + TH2* hCorDY = NULL; + if (fiCorSrc % 10 == 0) + hCorDY = fhTrkStationDY[iLev]; + else + hCorDY = fhTrkPullDY[iLev]; + if (NULL != hCorDY) { Double_t nx = hCorDY->GetNbinsX(); if (NULL == fhExt_Yoff) { - fhExt_Yoff=new TH1D("hExt_Yoff",";station;Yoff (cm)",nx,0,nx); - LOG(warn)<<"Created "<<fhExt_Yoff->GetName(); + fhExt_Yoff = new TH1D("hExt_Yoff", ";station;Yoff (cm)", nx, 0, nx); + LOG(warn) << "Created " << fhExt_Yoff->GetName(); } if (NULL == fhExt_Ysig) { - fhExt_Ysig=new TH1D("hExt_Ysig",";station;Ysig (cm)",nx,0,nx); - LOG(warn)<<"Created "<<fhExt_Ysig->GetName(); - } + fhExt_Ysig = new TH1D("hExt_Ysig", ";station;Ysig (cm)", nx, 0, nx); + LOG(warn) << "Created " << fhExt_Ysig->GetName(); + } for (Int_t ix = 0; ix < nx; ix++) { Double_t dVal = fhExt_Yoff->GetBinContent(ix + 1); - TH1D* hpy = - hCorDY->ProjectionY( - Form("%s_py%d",hCorDY->GetName(),ix),ix+1,ix+1,""); + TH1D* hpy = hCorDY->ProjectionY( + Form("%s_py%d", hCorDY->GetName(), ix), ix + 1, ix + 1, ""); Double_t dFMean = 0.; - LOG(warn)<<"YOff Entries for station " << ix - << ": " << hpy->GetEntries(); + LOG(warn) << "YOff Entries for station " << ix << ": " + << hpy->GetEntries(); if (hpy->GetEntries() > 100) { - Int_t iBmax = hpy->GetMaximumBin(); - TAxis* xaxis = hpy->GetXaxis(); - Double_t dMean = - xaxis->GetBinCenter(iBmax); //X-value of bin with maximal content + Int_t iBmax = hpy->GetMaximumBin(); + TAxis* xaxis = hpy->GetXaxis(); + Double_t dMean = xaxis->GetBinCenter( + iBmax); //X-value of bin with maximal content //Double_t dLim = 1. * hpy->GetRMS(); Double_t dLim = 5. * hpy->GetBinWidth(1); - if(dLim > 0.) { + if (dLim > 0.) { //TF1 * f = new TF1 ("f","gaus"); //f->SetParLimits(2,dMean - dLim, dMean + dLim); //f->SetParLimits(3,0.,dLim); // hpy->Draw(""); - LOG(warn)<<"Fit gaus with "<<dMean<<", "<<dLim; + LOG(warn) << "Fit gaus with " << dMean << ", " << dLim; TFitResultPtr fRes = - // hpy->Fit(f,"B"); + // hpy->Fit(f,"B"); hpy->Fit("gaus", "SQM", "", dMean - dLim, dMean + dLim); Int_t iFitStatus = fRes; //LOG(warn)<<Form("YRes 0x%08x ",iFitStatus); if (iFitStatus != -1) { // check validity of fit dFMean = fRes->Parameter(1); dVal -= dFMean; - fhExt_Ysig->SetBinContent(ix + 1, fRes->Parameter(2)); - }else - dVal-=dMean; - + fhExt_Ysig->SetBinContent(ix + 1, fRes->Parameter(2)); + } else + dVal -= dMean; + LOG(warn) << "Update hExt_Yoff Ind " << ix << ": Old " - << fhExt_Yoff->GetBinContent(ix + 1) - << ", FitMean " - << dFMean << " => " << dVal - << ", width "<< fhExt_Ysig->GetBinContent(ix + 1); + << fhExt_Yoff->GetBinContent(ix + 1) << ", FitMean " + << dFMean << " => " << dVal << ", width " + << fhExt_Ysig->GetBinContent(ix + 1); } } else { LOG(warn) << "Update hExt_Yoff " << ix @@ -532,12 +536,10 @@ Bool_t CbmTofExtendTracks::UpdateCalHistos() { } fhExt_Yoff->SetBinContent(ix + 1, dVal); } - } - } - break; - default: - LOG(info)<<"Correction Mode not implemented"; - } // switch end + } + } break; + default: LOG(info) << "Correction Mode not implemented"; + } // switch end } return kTRUE; } @@ -547,12 +549,12 @@ Bool_t CbmTofExtendTracks::WriteHistos() { TDirectory* oldir = gDirectory; TFile* fHist = new TFile(fCalOutFileName, "RECREATE"); fHist->cd(); - - if( NULL != fhExt_Toff) fhExt_Toff->Write(); - if( NULL != fhExt_Xoff) fhExt_Xoff->Write(); - if( NULL != fhExt_Yoff) fhExt_Yoff->Write(); - if( NULL != fhExt_Zoff) fhExt_Zoff->Write(); - + + if (NULL != fhExt_Toff) fhExt_Toff->Write(); + if (NULL != fhExt_Xoff) fhExt_Xoff->Write(); + if (NULL != fhExt_Yoff) fhExt_Yoff->Write(); + if (NULL != fhExt_Zoff) fhExt_Zoff->Write(); + gDirectory->cd(oldir->GetPath()); fHist->Close(); return kTRUE; @@ -567,8 +569,8 @@ void CbmTofExtendTracks::Exec(Option_t* opt) { LOG(fatal) << "Analysis needs EventsColl "; // ExecExtend(opt); } else { - LOG(info) << "ExtExec TS " << fiTS - << " with " << fEventsColl->GetEntriesFast() << " evts"; + LOG(info) << "ExtExec TS " << fiTS << " with " + << fEventsColl->GetEntriesFast() << " evts"; fiTS++; for (Int_t iEvent = 0; iEvent < fEventsColl->GetEntriesFast(); iEvent++) { CbmEvent* tEvent = dynamic_cast<CbmEvent*>(fEventsColl->At(iEvent)); @@ -601,11 +603,11 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { fvMuchHitIndex.clear(); fvRichHitIndex.clear(); - LOG(info)<<"Ev "<<fiEvent<<" has hits " - <<" Tof: "<< tEvent->GetNofData(ECbmDataType::kTofHit) - <<" Sts: "<< tEvent->GetNofData(ECbmDataType::kStsHit) - <<" Much: "<< tEvent->GetNofData(ECbmDataType::kMuchPixelHit) - <<" Rich: "<< tEvent->GetNofData(ECbmDataType::kRichHit); + LOG(info) << "Ev " << fiEvent << " has hits " + << " Tof: " << tEvent->GetNofData(ECbmDataType::kTofHit) + << " Sts: " << tEvent->GetNofData(ECbmDataType::kStsHit) + << " Much: " << tEvent->GetNofData(ECbmDataType::kMuchPixelHit) + << " Rich: " << tEvent->GetNofData(ECbmDataType::kRichHit); // cleanup /* @@ -619,7 +621,7 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { fvAllHitPointer.clear(); UInt_t iNbAllStations = fMapStationZ.size(); fvAllHitPointer.resize(iNbAllStations); - + if (tEvent->GetNofData(ECbmDataType::kTofHit) > 0) { // init to 1 tracking station iNbTofStations = 1; @@ -637,7 +639,7 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { iHitIndex, tHit->GetZ(), fvTofStationZ.size(), - iNbAllStations); + iNbAllStations); Int_t iStZ = (Int_t)(tHit->GetZ()); itMapStationZ = fMapStationZ.find(iStZ); @@ -696,8 +698,8 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { if (fiEvent < NDefSetup) { if (itMapStationZ == fMapStationZ.end()) { LOG(debug) << "Insert new tracking station " - << Int_t(ECbmModuleId::kTof) * 100 + iSt - << " at z=" << iStZ; + << Int_t(ECbmModuleId::kTof) * 100 + iSt + << " at z=" << iStZ; fMapStationZ[iStZ] = Int_t(ECbmModuleId::kTof) * 100 + iSt; itMapStationZ = fMapStationZ.begin(); Int_t iStId = Int_t(ECbmModuleId::kTof) * 100; @@ -711,24 +713,23 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { } } } else { // Define Setup end - // sort hits into stations - if (itMapStationZ != fMapStationZ.end()) { - Int_t iAllSt=(itMapStationZ->second)%100; - /* TOF recalibration disabled + // sort hits into stations + if (itMapStationZ != fMapStationZ.end()) { + Int_t iAllSt = (itMapStationZ->second) % 100; + /* TOF recalibration disabled pHit->SetX(pHit->GetX() + fvXoff[iAllSt]); pHit->SetY(pHit->GetY() + fvYoff[iAllSt]); pHit->SetZ(pHit->GetZ() + fvZoff[iAllSt]); pHit->SetTime(pHit->GetTime() + fvToff[iAllSt]); */ - //CbmTofHit* pHit = new CbmTofHit(*tHit); // copy construction - // apply recalibration if necessary - fvAllHitPointer[iAllSt].push_back( dynamic_cast<CbmPixelHit*>(tHit) ); - //LOG(info)<<"TpHit: "<<pHit->ToString(); - - } + //CbmTofHit* pHit = new CbmTofHit(*tHit); // copy construction + // apply recalibration if necessary + fvAllHitPointer[iAllSt].push_back(dynamic_cast<CbmPixelHit*>(tHit)); + //LOG(info)<<"TpHit: "<<pHit->ToString(); + } } - } // TofHit loop end - } // TofHit condition end + } // TofHit loop end + } // TofHit condition end if (tEvent->GetNofData(ECbmDataType::kStsHit) > 0) { @@ -741,11 +742,12 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { iHit++) { Int_t iHitIndex = static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kStsHit, iHit)); - CbmPixelHit* tHit = dynamic_cast<CbmPixelHit*>(fStsHitArrayIn->At(iHitIndex)); + CbmPixelHit* tHit = + dynamic_cast<CbmPixelHit*>(fStsHitArrayIn->At(iHitIndex)); Int_t iStZ = (Int_t)(tHit->GetZ()); itMapStationZ = fMapStationZ.find(iStZ); - + UInt_t iSt = 0; for (; iSt < fvStsStationZ.size(); iSt++) { if (iSt == 0 && fvStsHitIndex[iSt].size() == 1) { @@ -793,13 +795,13 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { if (fiEvent < NDefSetup) { if (itMapStationZ == fMapStationZ.end()) { LOG(debug) << "Insert new tracking station " - << Int_t(ECbmModuleId::kSts) * 100 + iSt - << " at z=" << iStZ; + << Int_t(ECbmModuleId::kSts) * 100 + iSt + << " at z=" << iStZ; fMapStationZ[iStZ] = Int_t(ECbmModuleId::kSts) * 100 + iSt; itMapStationZ = fMapStationZ.begin(); Int_t iStId = Int_t(ECbmModuleId::kSts) * 100; for (; itMapStationZ != fMapStationZ.end(); ++itMapStationZ) { - Int_t iSysId = itMapStationZ->second / 100; + Int_t iSysId = itMapStationZ->second / 100; if (iSysId == Int_t(ECbmModuleId::kSts)) { itMapStationZ->second = iStId++; } @@ -807,21 +809,21 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { << itMapStationZ->second; } } - } else { // Define Setup end - // sort hits into stations + } else { // Define Setup end + // sort hits into stations if (itMapStationZ != fMapStationZ.end()) { - Int_t iAllSt=(itMapStationZ->second)%100; - UInt_t iH=fvAllHitPointer[iAllSt].size(); - fvAllHitPointer[iAllSt].push_back( dynamic_cast<CbmPixelHit*>(tHit) ); - CbmPixelHit* pHit =fvAllHitPointer[iAllSt][iH]; + Int_t iAllSt = (itMapStationZ->second) % 100; + UInt_t iH = fvAllHitPointer[iAllSt].size(); + fvAllHitPointer[iAllSt].push_back(dynamic_cast<CbmPixelHit*>(tHit)); + CbmPixelHit* pHit = fvAllHitPointer[iAllSt][iH]; pHit->SetX(pHit->GetX() + fvXoff[iAllSt]); pHit->SetY(pHit->GetY() + fvYoff[iAllSt]); pHit->SetZ(pHit->GetZ() + fvZoff[iAllSt]); - pHit->SetTime(pHit->GetTime() + fvToff[iAllSt]); + pHit->SetTime(pHit->GetTime() + fvToff[iAllSt]); } } - } // Sts Hit loop end - } //Sts condition end + } // Sts Hit loop end + } //Sts condition end if (tEvent->GetNofData(ECbmDataType::kMuchPixelHit) > 0) { // init to 1 tracking station @@ -832,11 +834,12 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { iHit++) { Int_t iHitIndex = static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kMuchPixelHit, iHit)); - CbmPixelHit* tHit = dynamic_cast<CbmPixelHit*>(fMuchHitArrayIn->At(iHitIndex)); + CbmPixelHit* tHit = + dynamic_cast<CbmPixelHit*>(fMuchHitArrayIn->At(iHitIndex)); Int_t iStZ = (Int_t)(tHit->GetZ()); - itMapStationZ = fMapStationZ.find(iStZ); - + itMapStationZ = fMapStationZ.find(iStZ); + UInt_t iSt = 0; for (; iSt < fvMuchStationZ.size(); iSt++) { if (iSt == 0 && fvMuchHitIndex[iSt].size() == 1) { @@ -844,10 +847,10 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { fvMuchHitIndex[iSt].resize(1); fvMuchHitIndex[iSt][0] = iHitIndex; LOG(info) << Form("Ev %d, init MuchSt %d at z %8.1f from Ind %d", - fiEvent, - iSt, - fvMuchStationZ[iSt], - iHitIndex); + fiEvent, + iSt, + fvMuchStationZ[iSt], + iHitIndex); break; } else { if (TMath::Abs(fvMuchStationZ[iSt] - tHit->GetZ()) @@ -885,8 +888,8 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { if (fiEvent < NDefSetup) { if (itMapStationZ == fMapStationZ.end()) { LOG(debug) << "Insert new tracking station " - << Int_t(ECbmModuleId::kMuch) * 100 + iSt - << " at z=" << iStZ; + << Int_t(ECbmModuleId::kMuch) * 100 + iSt + << " at z=" << iStZ; fMapStationZ[iStZ] = Int_t(ECbmModuleId::kMuch) * 100 + iSt; itMapStationZ = fMapStationZ.begin(); Int_t iStId = Int_t(ECbmModuleId::kMuch) * 100; @@ -899,38 +902,39 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { << itMapStationZ->second; } } - } else { // Define Setup end - // sort hits into stations + } else { // Define Setup end + // sort hits into stations if (itMapStationZ != fMapStationZ.end()) { - Int_t iAllSt=(itMapStationZ->second)%100; - UInt_t iH=fvAllHitPointer[iAllSt].size(); - fvAllHitPointer[iAllSt].push_back( dynamic_cast<CbmPixelHit*>(tHit) ); - CbmPixelHit* pHit =fvAllHitPointer[iAllSt][iH]; - Double_t Xin=pHit->GetX(); + Int_t iAllSt = (itMapStationZ->second) % 100; + UInt_t iH = fvAllHitPointer[iAllSt].size(); + fvAllHitPointer[iAllSt].push_back(dynamic_cast<CbmPixelHit*>(tHit)); + CbmPixelHit* pHit = fvAllHitPointer[iAllSt][iH]; + Double_t Xin = pHit->GetX(); pHit->SetX(pHit->GetX() + fvXoff[iAllSt]); - Double_t Xout=pHit->GetX(); + Double_t Xout = pHit->GetX(); // LOG(info) << "CalMuchX in "<<Xin<<", out "<<Xout<<", diff: "<<Xout-Xin; - if(fvXoff[iAllSt] != 0. ) assert(Xin != Xout); - + if (fvXoff[iAllSt] != 0.) assert(Xin != Xout); + pHit->SetY(pHit->GetY() + fvYoff[iAllSt]); pHit->SetZ(pHit->GetZ() + fvZoff[iAllSt]); - pHit->SetTime(pHit->GetTime() + fvToff[iAllSt]); + pHit->SetTime(pHit->GetTime() + fvToff[iAllSt]); //assign errors - const TVector3 MuchHitError={0.5,0.5,0.5}; + const TVector3 MuchHitError = {0.5, 0.5, 0.5}; pHit->SetPositionError(MuchHitError); - assert(iAllSt == fMapStationZ[(Int_t)(pHit->GetZ())]%100); - - LOG(info) << Form("Proc ev %d, MuchIn St %d, H %d, MpHit: ", - fiEvent, iAllSt, iH) << tHit->ToString(); - + assert(iAllSt == fMapStationZ[(Int_t)(pHit->GetZ())] % 100); + + LOG(info) << Form( + "Proc ev %d, MuchIn St %d, H %d, MpHit: ", fiEvent, iAllSt, iH) + << tHit->ToString(); + //delete(pHit); } else { LOG(warn) << "Undefined station for Much "; } - } - } // MuchHit loop end - } // Much Hit condition end + } + } // MuchHit loop end + } // Much Hit condition end if (tEvent->GetNofData(ECbmDataType::kRichHit) > 0) { // init to 1 tracking station @@ -941,11 +945,12 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { iHit++) { Int_t iHitIndex = static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kRichHit, iHit)); - CbmPixelHit* tHit = dynamic_cast<CbmPixelHit*>(fRichHitArrayIn->At(iHitIndex)); + CbmPixelHit* tHit = + dynamic_cast<CbmPixelHit*>(fRichHitArrayIn->At(iHitIndex)); Int_t iStZ = (Int_t)(tHit->GetZ()); itMapStationZ = fMapStationZ.find(iStZ); - + UInt_t iSt = 0; for (; iSt < fvRichStationZ.size(); iSt++) { if (iSt == 0 && fvRichHitIndex[iSt].size() == 1) { @@ -994,8 +999,8 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { if (fiEvent < NDefSetup) { if (itMapStationZ == fMapStationZ.end()) { LOG(debug) << "Insert new tracking station " - << Int_t(ECbmModuleId::kRich) * 100 + iSt - << " at z=" << iStZ; + << Int_t(ECbmModuleId::kRich) * 100 + iSt + << " at z=" << iStZ; fMapStationZ[iStZ] = Int_t(ECbmModuleId::kRich) * 100 + iSt; itMapStationZ = fMapStationZ.begin(); Int_t iStId = Int_t(ECbmModuleId::kRich) * 100; @@ -1008,26 +1013,26 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { << itMapStationZ->second; } } - } else { // Define Setup end - // sort hits into stations + } else { // Define Setup end + // sort hits into stations if (itMapStationZ != fMapStationZ.end()) { - Int_t iAllSt=(itMapStationZ->second)%100; + Int_t iAllSt = (itMapStationZ->second) % 100; //CbmPixelHit* pHit = new CbmPixelHit(*tHit); // copy construction // apply recalibration if necessary - UInt_t iH=fvAllHitPointer[iAllSt].size(); - fvAllHitPointer[iAllSt].push_back( dynamic_cast<CbmPixelHit*>(tHit) ); - CbmPixelHit* pHit =fvAllHitPointer[iAllSt][iH]; + UInt_t iH = fvAllHitPointer[iAllSt].size(); + fvAllHitPointer[iAllSt].push_back(dynamic_cast<CbmPixelHit*>(tHit)); + CbmPixelHit* pHit = fvAllHitPointer[iAllSt][iH]; pHit->SetX(pHit->GetX() + fvXoff[iAllSt]); pHit->SetY(pHit->GetY() + fvYoff[iAllSt]); pHit->SetZ(pHit->GetZ() + fvZoff[iAllSt]); - pHit->SetTime(pHit->GetTime() + fvToff[iAllSt]); + pHit->SetTime(pHit->GetTime() + fvToff[iAllSt]); //LOG(info)<<"RpHit: "<<pHit->ToString(); //delete(pHit); - } + } } - } //RichHit loop end - } // Rich condition end + } //RichHit loop end + } // Rich condition end /* LOG(info) << Form( "Ev %d, found %d Tof, %d Sts, %d Much, %d Rich - stations, %d tracks", @@ -1041,62 +1046,63 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { LOG(info) << "Station Multipliplicities:"; for(UInt_t iSt=0; iSt<fvAllHitPointer.size();iSt++) LOG(info)<<" "<<iSt<<": "<<fvAllHitPointer[iSt].size(); - */ - + */ + // loop on tof tracklet - Int_t iNTrks=tEvent->GetNofData(ECbmDataType::kTofTrack); - if( iNTrks<0 ) iNTrks=0; + Int_t iNTrks = tEvent->GetNofData(ECbmDataType::kTofTrack); + if (iNTrks < 0) iNTrks = 0; fvTrkCalHits.clear(); fvTrkCalHits.resize(iNTrks); fvTrkPar.clear(); - for (Int_t iTr=0; iTr<iNTrks; iTr++) { + for (Int_t iTr = 0; iTr < iNTrks; iTr++) { Int_t iTrkIndex = - static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kTofTrack, iTr)); - CbmTofTracklet* pTrk = dynamic_cast<CbmTofTracklet*>(fTofTrackArrayIn->At(iTrkIndex)); + static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kTofTrack, iTr)); + CbmTofTracklet* pTrk = + dynamic_cast<CbmTofTracklet*>(fTofTrackArrayIn->At(iTrkIndex)); //CbmTofTrackletParam* pTrkPar=new CbmTofTrackletParam(*pTrk->GetTrackParameter()); - //fvTrkPar.push_back(pTrkPar); - fvTrkPar.push_back((CbmTofTrackletParam*)(pTrk->GetTrackParameter())); - - Int_t iNHits=pTrk->GetNofHits(); - fvTrkCalHits[iTr].resize(0); - for (Int_t iHit=0; iHit<iNHits; iHit++){ - Int_t iHitInd = pTrk->GetTofHitIndex(iHit); - CbmTofHit* pHitIn = dynamic_cast<CbmTofHit*>(fTofHitArrayIn->At(iHitInd)); + //fvTrkPar.push_back(pTrkPar); + fvTrkPar.push_back((CbmTofTrackletParam*) (pTrk->GetTrackParameter())); + + Int_t iNHits = pTrk->GetNofHits(); + fvTrkCalHits[iTr].resize(0); + for (Int_t iHit = 0; iHit < iNHits; iHit++) { + Int_t iHitInd = pTrk->GetTofHitIndex(iHit); + CbmTofHit* pHitIn = dynamic_cast<CbmTofHit*>(fTofHitArrayIn->At(iHitInd)); //CbmTofHit* pHit = new CbmTofHit(*pHitIn); // copy construction // apply recalibration if necessary - fvTrkCalHits[iTr].push_back( dynamic_cast<CbmPixelHit*>(pHitIn) ); - - LOG(debug)<<Form("Added PixHit %d, ind %d: x %6.3f, y %6.3f, z %6.3f, t %9.2f " - ", dx %6.3f, dy %6.3f, dz %6.3f ", - iHit, pTrk->GetTofHitIndex(iHit), - (fvTrkCalHits[iTr][iHit])->GetX(), - (fvTrkCalHits[iTr][iHit])->GetY(), - (fvTrkCalHits[iTr][iHit])->GetZ(), - (fvTrkCalHits[iTr][iHit])->GetTime(), - (fvTrkCalHits[iTr][iHit])->GetDx(), - (fvTrkCalHits[iTr][iHit])->GetDy(), - (fvTrkCalHits[iTr][iHit])->GetDz() - ); - + fvTrkCalHits[iTr].push_back(dynamic_cast<CbmPixelHit*>(pHitIn)); + + LOG(debug) << Form( + "Added PixHit %d, ind %d: x %6.3f, y %6.3f, z %6.3f, t %9.2f " + ", dx %6.3f, dy %6.3f, dz %6.3f ", + iHit, + pTrk->GetTofHitIndex(iHit), + (fvTrkCalHits[iTr][iHit])->GetX(), + (fvTrkCalHits[iTr][iHit])->GetY(), + (fvTrkCalHits[iTr][iHit])->GetZ(), + (fvTrkCalHits[iTr][iHit])->GetTime(), + (fvTrkCalHits[iTr][iHit])->GetDx(), + (fvTrkCalHits[iTr][iHit])->GetDy(), + (fvTrkCalHits[iTr][iHit])->GetDz()); } - Line3Dfit(fvTrkCalHits[iTr],fvTrkPar[iTr]); - fvTrkPar[iTr]->SetTt(pTrk->GetTt()); - fvTrkPar[iTr]->SetT(pTrk->GetT0()); - - // compare to input - LOG(debug)<<"CompareTrk "<<iTr - <<Form(": DTx %10.8f, DTy %10.8f", - pTrk->GetTrackTx()-fvTrkPar[iTr]->GetTx(), - pTrk->GetTrackTy()-fvTrkPar[iTr]->GetTy()); - } // Tracklet loop end - if (fiEvent>NDefSetup) { - Int_t iAddStations=fiAddStations; - while(iAddStations>0) { - Int_t iAddNextStation=iAddStations%100; - iAddStations/=100; - TrkAddStation(iAddNextStation); + Line3Dfit(fvTrkCalHits[iTr], fvTrkPar[iTr]); + fvTrkPar[iTr]->SetTt(pTrk->GetTt()); + fvTrkPar[iTr]->SetT(pTrk->GetT0()); + + // compare to input + LOG(debug) << "CompareTrk " << iTr + << Form(": DTx %10.8f, DTy %10.8f", + pTrk->GetTrackTx() - fvTrkPar[iTr]->GetTx(), + pTrk->GetTrackTy() - fvTrkPar[iTr]->GetTy()); + } // Tracklet loop end + if (fiEvent > NDefSetup) { + Int_t iAddStations = fiAddStations; + while (iAddStations > 0) { + Int_t iAddNextStation = iAddStations % 100; + iAddStations /= 100; + TrkAddStation(iAddNextStation); } - + //FindVertex(); FillHistograms(tEvent); //assert(fiEvent<1); @@ -1109,9 +1115,9 @@ void CbmTofExtendTracks::ExecExtend(Option_t* /*opt*/, CbmEvent* tEvent) { void CbmTofExtendTracks::Finish() { UpdateCalHistos(); - + // save everything in output file - + FairRootManager* ioman = FairRootManager::Instance(); TList* tList = gROOT->GetList(); @@ -1124,7 +1130,7 @@ void CbmTofExtendTracks::Finish() { } WriteHistos(); - + LOG(info) << Form(" CbmTofExtendTracks::Finished "); } // ------------------------------------------------------------------------- @@ -1137,7 +1143,7 @@ void CbmTofExtendTracks::CreateHistograms() { ->cd(); // <= To prevent histos from being sucked in by the param file of the TRootManager ! // define histos here - // Correlation with Tof Tracklets + // Correlation with Tof Tracklets // fhMulCorTrkTof = new TH2F("hMulCorTrkTof", @@ -1214,22 +1220,24 @@ void CbmTofExtendTracks::CreateHistograms() { 10); - // Correlation with extended tracks + // Correlation with extended tracks // Book Histos for all tracking stations found in fMap LOG(info) << "Book histos for the following stations: "; - Int_t iStNum=0; + Int_t iStNum = 0; itMapStationZ = fMapStationZ.begin(); for (; itMapStationZ != fMapStationZ.end(); ++itMapStationZ) { - Int_t iSysId = itMapStationZ->second / 100; - itMapStationZ->second = iSysId*100 + iStNum++; - LOG(info)<< Form(" station %2d, z %3d, Id %4d ", - iStNum, itMapStationZ->first,itMapStationZ->second); - } + Int_t iSysId = itMapStationZ->second / 100; + itMapStationZ->second = iSysId * 100 + iStNum++; + LOG(info) << Form(" station %2d, z %3d, Id %4d ", + iStNum, + itMapStationZ->first, + itMapStationZ->second); + } UInt_t NSt = fMapStationZ.size(); - - Int_t NLev=2; + + Int_t NLev = 2; //if (fiAddStations > 0 ) NLev=2; - + fhTrkStationDX.resize(NLev); fhTrkStationDY.resize(NLev); fhTrkStationDZ.resize(NLev); @@ -1241,169 +1249,192 @@ void CbmTofExtendTracks::CreateHistograms() { fhTrkPullDT.resize(NLev); fhExt_TrkSizVel.resize(NLev); fhExt_TrkSizChiSq.resize(NLev); - - for(Int_t iLev=0; iLev<NLev; iLev++){ - fhExt_TrkSizVel[iLev] = - new TH2F(Form("hExt_TrkSizVel%d",iLev),";TrkSize;v (cm/ns)",15,0,15,100,0.,50.); - fhExt_TrkSizChiSq[iLev] = - new TH2F(Form("hExt_TrkSizChiSq%d",iLev),";TrkSize;#chi^2",15,0,15,50,0.,5.); - - fhTrkStationDX[iLev] = new TH2F(Form("hTrkStationDX%d",iLev), - Form("TrkStationDX; StationNr ; #DeltaX (cm)"), - NSt, - 0, - NSt, - 100, - -10., - 10.); - fhTrkStationDY[iLev] = new TH2F(Form("hTrkStationDY%d",iLev), - Form("TrkStationDY; StationNr ; #DeltaY (cm)"), - NSt, - 0, - NSt, - 100, - -10., - 10.); - fhTrkStationDZ[iLev] = new TH2F(Form("hTrkStationDZ%d",iLev), - Form("TrkStationDZ; StationNr ; #DeltaZ (cm)"), - NSt, - 0, - NSt, - 100, - -20., - 20.); - fhTrkStationDT[iLev] = new TH2F(Form("hTrkStationDT%d",iLev), - Form("TrkStationDT; StationNr ; #DeltaT (ns)"), - NSt, - 0, - NSt, - 100, - -50., - 50.); - fhTrkStationNHits[iLev] = new TH2F(Form("hTrkStationNHits%d",iLev), - Form("TrkStationNHits; StationNr ; Number of Hits"), - NSt, - 0, - NSt, - 100, - 0., - 100.); - - fhTrkPullDX[iLev] = new TH2F(Form("hTrkPullDX%d",iLev), - Form("TrkPullDX; StationNr ; #DeltaX (cm)"), - NSt, - 0, - NSt, - 100, - -10., - 10.); - fhTrkPullDY[iLev] = new TH2F(Form("hTrkPullDY%d",iLev), - Form("TrkPullDY; StationNr ; #DeltaY (cm)"), - NSt, - 0, - NSt, - 100, - -10., - 10.); - fhTrkPullDT[iLev] = new TH2F(Form("hTrkPullDT%d",iLev), - Form("TrkPullDT; StationNr ; #DeltaT (ns)"), - NSt, - 0, - NSt, - 100, - -50., - 50.); - + + for (Int_t iLev = 0; iLev < NLev; iLev++) { + fhExt_TrkSizVel[iLev] = new TH2F(Form("hExt_TrkSizVel%d", iLev), + ";TrkSize;v (cm/ns)", + 15, + 0, + 15, + 100, + 0., + 50.); + fhExt_TrkSizChiSq[iLev] = new TH2F(Form("hExt_TrkSizChiSq%d", iLev), + ";TrkSize;#chi^2", + 15, + 0, + 15, + 50, + 0., + 5.); + + fhTrkStationDX[iLev] = + new TH2F(Form("hTrkStationDX%d", iLev), + Form("TrkStationDX; StationNr ; #DeltaX (cm)"), + NSt, + 0, + NSt, + 100, + -10., + 10.); + fhTrkStationDY[iLev] = + new TH2F(Form("hTrkStationDY%d", iLev), + Form("TrkStationDY; StationNr ; #DeltaY (cm)"), + NSt, + 0, + NSt, + 100, + -10., + 10.); + fhTrkStationDZ[iLev] = + new TH2F(Form("hTrkStationDZ%d", iLev), + Form("TrkStationDZ; StationNr ; #DeltaZ (cm)"), + NSt, + 0, + NSt, + 100, + -20., + 20.); + fhTrkStationDT[iLev] = + new TH2F(Form("hTrkStationDT%d", iLev), + Form("TrkStationDT; StationNr ; #DeltaT (ns)"), + NSt, + 0, + NSt, + 100, + -50., + 50.); + fhTrkStationNHits[iLev] = + new TH2F(Form("hTrkStationNHits%d", iLev), + Form("TrkStationNHits; StationNr ; Number of Hits"), + NSt, + 0, + NSt, + 100, + 0., + 100.); + + fhTrkPullDX[iLev] = new TH2F(Form("hTrkPullDX%d", iLev), + Form("TrkPullDX; StationNr ; #DeltaX (cm)"), + NSt, + 0, + NSt, + 100, + -10., + 10.); + fhTrkPullDY[iLev] = new TH2F(Form("hTrkPullDY%d", iLev), + Form("TrkPullDY; StationNr ; #DeltaY (cm)"), + NSt, + 0, + NSt, + 100, + -10., + 10.); + fhTrkPullDT[iLev] = new TH2F(Form("hTrkPullDT%d", iLev), + Form("TrkPullDT; StationNr ; #DeltaT (ns)"), + NSt, + 0, + NSt, + 100, + -50., + 50.); + fhTrkStationDXDY[iLev].resize(NSt); - for(UInt_t iSt=0; iSt<NSt;iSt++){ - fhTrkStationDXDY[iLev][iSt]= new TH2F(Form("hTrkPosCor%d_St%d",iLev,iSt), - Form("Lev%d-St%d position correlation ; " - "#DeltaX (cm); #DeltaY (cm)",iLev,iSt), - 100, - -10, - 10, - 100, - -10, - 10); + for (UInt_t iSt = 0; iSt < NSt; iSt++) { + fhTrkStationDXDY[iLev][iSt] = + new TH2F(Form("hTrkPosCor%d_St%d", iLev, iSt), + Form("Lev%d-St%d position correlation ; " + "#DeltaX (cm); #DeltaY (cm)", + iLev, + iSt), + 100, + -10, + 10, + 100, + -10, + 10); } } if (fiStationUT > -1) { - // histos for Station Under Test - itMapStationZ = fMapStationZ.begin(); - for (Int_t iSt=0; iSt<fiStationUT; iSt++) itMapStationZ++; - dSUT_z=itMapStationZ->first; - LOG(info)<<"Create SUT histos for station " - << fiStationUT << " at distance "<<dSUT_z; - const Double_t dSUT_RefDx=0.15; - const Double_t dSUT_RefDy=0.3; - const Double_t dNbinX=100; - const Double_t dNbinY=100; - const Double_t dNbinZ=50; - - Double_t dSUT_dx=dSUT_RefDx*dSUT_z; - Double_t dSUT_dy=dSUT_RefDy*dSUT_z; - fhExtSutXY_Found = - new TH2F("hExtSutXY_Found", - Form("StationUnderTest %d found hits ; X (cm); Y (cm)",fiStationUT), - dNbinX, - -dSUT_dx, - dSUT_dx, - dNbinY, - -dSUT_dy, - dSUT_dy); - fhExtSutXY_Missed = - new TH2F("hExtSutXY_Missed", - Form("StationUnderTest %d missed hits ; X (cm); Y (cm)",fiStationUT), - dNbinX, - -dSUT_dx, - dSUT_dx, - dNbinY, - -dSUT_dy, - dSUT_dy); - fhExtSutXY_DX = - new TH3F("hExtSutXY_DX", - Form("StationUnderTest %d #DeltaX ; X (cm); Y (cm); #DeltaX (cm)",fiStationUT), - dNbinX, - -dSUT_dx, - dSUT_dx, - dNbinY, - -dSUT_dy, - dSUT_dy, - dNbinZ, - -10., - 10. ); - fhExtSutXY_DY = - new TH3F("hExtSutXY_DY", - Form("StationUnderTest %d #DeltaY ; X (cm); Y (cm); #DeltaY (cm)",fiStationUT), - dNbinX, - -dSUT_dx, - dSUT_dx, - dNbinY, - -dSUT_dy, - dSUT_dy, - dNbinZ, - -10., - 10. ); - fhExtSutXY_DT = - new TH3F("hExtSutXY_DT", - Form("StationUnderTest %d #DeltaT ; X (cm); Y (cm); #DeltaT (ns)",fiStationUT), - dNbinX, - -dSUT_dx, - dSUT_dx, - dNbinY, - -dSUT_dy, - dSUT_dy, - dNbinZ, - -50., - 50.); - } // StationUT end + // histos for Station Under Test + itMapStationZ = fMapStationZ.begin(); + for (Int_t iSt = 0; iSt < fiStationUT; iSt++) + itMapStationZ++; + dSUT_z = itMapStationZ->first; + LOG(info) << "Create SUT histos for station " << fiStationUT + << " at distance " << dSUT_z; + const Double_t dSUT_RefDx = 0.15; + const Double_t dSUT_RefDy = 0.3; + const Double_t dNbinX = 100; + const Double_t dNbinY = 100; + const Double_t dNbinZ = 50; + + Double_t dSUT_dx = dSUT_RefDx * dSUT_z; + Double_t dSUT_dy = dSUT_RefDy * dSUT_z; + fhExtSutXY_Found = new TH2F( + "hExtSutXY_Found", + Form("StationUnderTest %d found hits ; X (cm); Y (cm)", fiStationUT), + dNbinX, + -dSUT_dx, + dSUT_dx, + dNbinY, + -dSUT_dy, + dSUT_dy); + fhExtSutXY_Missed = new TH2F( + "hExtSutXY_Missed", + Form("StationUnderTest %d missed hits ; X (cm); Y (cm)", fiStationUT), + dNbinX, + -dSUT_dx, + dSUT_dx, + dNbinY, + -dSUT_dy, + dSUT_dy); + fhExtSutXY_DX = new TH3F( + "hExtSutXY_DX", + Form("StationUnderTest %d #DeltaX ; X (cm); Y (cm); #DeltaX (cm)", + fiStationUT), + dNbinX, + -dSUT_dx, + dSUT_dx, + dNbinY, + -dSUT_dy, + dSUT_dy, + dNbinZ, + -10., + 10.); + fhExtSutXY_DY = new TH3F( + "hExtSutXY_DY", + Form("StationUnderTest %d #DeltaY ; X (cm); Y (cm); #DeltaY (cm)", + fiStationUT), + dNbinX, + -dSUT_dx, + dSUT_dx, + dNbinY, + -dSUT_dy, + dSUT_dy, + dNbinZ, + -10., + 10.); + fhExtSutXY_DT = new TH3F( + "hExtSutXY_DT", + Form("StationUnderTest %d #DeltaT ; X (cm); Y (cm); #DeltaT (ns)", + fiStationUT), + dNbinX, + -dSUT_dx, + dSUT_dx, + dNbinY, + -dSUT_dy, + dSUT_dy, + dNbinZ, + -50., + 50.); + } // StationUT end gDirectory->cd( oldir ->GetPath()); // <= To prevent histos from being sucked in by the param file of the TRootManager! LoadCalParameter(); - } void CbmTofExtendTracks::FindVertex() { @@ -1444,22 +1475,22 @@ void CbmTofExtendTracks::FindVertex() { void CbmTofExtendTracks::FillHistograms(CbmEvent* tEvent) { // event selection: limit number of hits per added station - Int_t iAddStations=fiAddStations; - while(iAddStations>0) { - Int_t iAddNextStation=iAddStations%100; - iAddStations/=100; - if( (Int_t)fvAllHitPointer[iAddNextStation].size() > fiCutStationMaxHitMul ) - return; - } - - // limit track multiplicity - Int_t NTrkTof=tEvent->GetNofData(ECbmDataType::kTofTrack); - if( NTrkTof > fiNTrkTofMax ) return; - - Int_t iLev=0; - // + Int_t iAddStations = fiAddStations; + while (iAddStations > 0) { + Int_t iAddNextStation = iAddStations % 100; + iAddStations /= 100; + if ((Int_t) fvAllHitPointer[iAddNextStation].size() > fiCutStationMaxHitMul) + return; + } + + // limit track multiplicity + Int_t NTrkTof = tEvent->GetNofData(ECbmDataType::kTofTrack); + if (NTrkTof > fiNTrkTofMax) return; + + Int_t iLev = 0; + // fhMulCorTrkTof->Fill(tEvent->GetNofData(ECbmDataType::kTofTrack), - tEvent->GetNofData(ECbmDataType::kTofHit)); + tEvent->GetNofData(ECbmDataType::kTofHit)); fhMulCorTrkSts->Fill(tEvent->GetNofData(ECbmDataType::kTofTrack), tEvent->GetNofData(ECbmDataType::kStsHit)); @@ -1473,14 +1504,14 @@ void CbmTofExtendTracks::FillHistograms(CbmEvent* tEvent) { // correlation with TOF Tracklets for (Int_t iTr = 0; iTr < NTrkTof; iTr++) { - Int_t iTrkIndex = - static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kTofTrack, iTr)); - CbmTofTracklet* tTrk = - dynamic_cast<CbmTofTracklet*>(fTofTrackArrayIn->At(iTrkIndex)); + Int_t iTrkIndex = + static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kTofTrack, iTr)); + CbmTofTracklet* tTrk = + dynamic_cast<CbmTofTracklet*>(fTofTrackArrayIn->At(iTrkIndex)); + + // tTrk->PrintInfo(); - // tTrk->PrintInfo(); - - if( tTrk->GetNofHits()<fiTrkHitsMin ) continue; + if (tTrk->GetNofHits() < fiTrkHitsMin) continue; // correlation with all TofHits for (UInt_t iSt = 0; iSt < fvTofHitIndex.size(); iSt++) { @@ -1496,25 +1527,29 @@ void CbmTofExtendTracks::FillHistograms(CbmEvent* tEvent) { fvTofHitIndex.size()); assert(tHit); } - Int_t iTrSt=fMapStationZ[(Int_t)(tHit->GetZ())]%100; - if ( iTrSt < 0 || iTrSt >= (Int_t)fMapStationZ.size()) { - LOG(error) << "Invalid station index " << iTrSt; + Int_t iTrSt = fMapStationZ[(Int_t)(tHit->GetZ())] % 100; + if (iTrSt < 0 || iTrSt >= (Int_t) fMapStationZ.size()) { + LOG(error) << "Invalid station index " << iTrSt; continue; } - - Double_t dDX=tHit->GetX() + fvXoff[iTrSt] - tTrk->GetFitX(tHit->GetZ()); - if( TMath::Abs( dDX ) > fdTrkCutDX ) continue; - Double_t dDY=tHit->GetY() + fvYoff[iTrSt] - tTrk->GetFitY(tHit->GetZ()); - if( TMath::Abs( dDY ) > fdTrkCutDY ) continue; - Double_t dDT=tHit->GetTime() + fvToff[iTrSt] - tTrk->GetFitT(tHit->GetZ()); - if( TMath::Abs( dDT ) > fdTrkCutDT ) continue; - - fhPosCorTrkTof->Fill(dDX, dDY); - // fill tracking station histos - fhTrkStationDX[iLev]->Fill(iTrSt,dDX); - fhTrkStationDY[iLev]->Fill(iTrSt,dDY); - fhTrkStationDT[iLev]->Fill(iTrSt,dDT); - fhTrkStationNHits[iLev]->Fill(iTrSt,(Double_t)fvTofHitIndex[iSt].size()); + + Double_t dDX = + tHit->GetX() + fvXoff[iTrSt] - tTrk->GetFitX(tHit->GetZ()); + if (TMath::Abs(dDX) > fdTrkCutDX) continue; + Double_t dDY = + tHit->GetY() + fvYoff[iTrSt] - tTrk->GetFitY(tHit->GetZ()); + if (TMath::Abs(dDY) > fdTrkCutDY) continue; + Double_t dDT = + tHit->GetTime() + fvToff[iTrSt] - tTrk->GetFitT(tHit->GetZ()); + if (TMath::Abs(dDT) > fdTrkCutDT) continue; + + fhPosCorTrkTof->Fill(dDX, dDY); + // fill tracking station histos + fhTrkStationDX[iLev]->Fill(iTrSt, dDX); + fhTrkStationDY[iLev]->Fill(iTrSt, dDY); + fhTrkStationDT[iLev]->Fill(iTrSt, dDT); + fhTrkStationNHits[iLev]->Fill(iTrSt, + (Double_t) fvTofHitIndex[iSt].size()); } } // Tof Station loop end @@ -1532,21 +1567,25 @@ void CbmTofExtendTracks::FillHistograms(CbmEvent* tEvent) { fvStsHitIndex.size()); assert(tHit); } - Int_t iTrSt=fMapStationZ[(Int_t)(tHit->GetZ())]%100; - - Double_t dDX=tHit->GetX() + fvXoff[iTrSt] - tTrk->GetFitX(tHit->GetZ()); - if( TMath::Abs( dDX ) > fdTrkCutDX ) continue; - Double_t dDY=tHit->GetY() + fvYoff[iTrSt] - tTrk->GetFitY(tHit->GetZ()); - if( TMath::Abs( dDY ) > fdTrkCutDY ) continue; - Double_t dDT=tHit->GetTime() + fvToff[iTrSt] - tTrk->GetFitT(tHit->GetZ()); - if( TMath::Abs( dDT ) > fdTrkCutDT ) continue; - - fhPosCorTrkSts->Fill(dDX, dDY); - // fill tracking station histos - fhTrkStationDX[iLev]->Fill(iTrSt,dDX); - fhTrkStationDY[iLev]->Fill(iTrSt,dDY); - fhTrkStationDT[iLev]->Fill(iTrSt,dDT); - fhTrkStationNHits[iLev]->Fill(iTrSt,(Double_t)fvStsHitIndex[iSt].size()); + Int_t iTrSt = fMapStationZ[(Int_t)(tHit->GetZ())] % 100; + + Double_t dDX = + tHit->GetX() + fvXoff[iTrSt] - tTrk->GetFitX(tHit->GetZ()); + if (TMath::Abs(dDX) > fdTrkCutDX) continue; + Double_t dDY = + tHit->GetY() + fvYoff[iTrSt] - tTrk->GetFitY(tHit->GetZ()); + if (TMath::Abs(dDY) > fdTrkCutDY) continue; + Double_t dDT = + tHit->GetTime() + fvToff[iTrSt] - tTrk->GetFitT(tHit->GetZ()); + if (TMath::Abs(dDT) > fdTrkCutDT) continue; + + fhPosCorTrkSts->Fill(dDX, dDY); + // fill tracking station histos + fhTrkStationDX[iLev]->Fill(iTrSt, dDX); + fhTrkStationDY[iLev]->Fill(iTrSt, dDY); + fhTrkStationDT[iLev]->Fill(iTrSt, dDT); + fhTrkStationNHits[iLev]->Fill(iTrSt, + (Double_t) fvStsHitIndex[iSt].size()); } } // Sts Station loop end @@ -1564,17 +1603,21 @@ void CbmTofExtendTracks::FillHistograms(CbmEvent* tEvent) { fvMuchHitIndex.size()); assert(tHit); } - Int_t iTrSt=fMapStationZ[(Int_t)(tHit->GetZ())]%100; - - LOG(info) << Form("Proc ev %d, Trk %d, St %d, iLe%d MtHit: ", - fiEvent, iTr, iTrSt, iLev) << tHit->ToString(); - - Double_t dDX=tHit->GetX() + fvXoff[iTrSt] - tTrk->GetFitX(tHit->GetZ()); - if( TMath::Abs( dDX ) > fdTrkCutDX ) continue; - Double_t dDY=tHit->GetY() + fvYoff[iTrSt] - tTrk->GetFitY(tHit->GetZ()); - if( TMath::Abs( dDY ) > fdTrkCutDY ) continue; - Double_t dDT=tHit->GetTime() + fvToff[iTrSt] - tTrk->GetFitT(tHit->GetZ()); - if( TMath::Abs( dDT ) > fdTrkCutDT ) continue; + Int_t iTrSt = fMapStationZ[(Int_t)(tHit->GetZ())] % 100; + + LOG(info) << Form( + "Proc ev %d, Trk %d, St %d, iLe%d MtHit: ", fiEvent, iTr, iTrSt, iLev) + << tHit->ToString(); + + Double_t dDX = + tHit->GetX() + fvXoff[iTrSt] - tTrk->GetFitX(tHit->GetZ()); + if (TMath::Abs(dDX) > fdTrkCutDX) continue; + Double_t dDY = + tHit->GetY() + fvYoff[iTrSt] - tTrk->GetFitY(tHit->GetZ()); + if (TMath::Abs(dDY) > fdTrkCutDY) continue; + Double_t dDT = + tHit->GetTime() + fvToff[iTrSt] - tTrk->GetFitT(tHit->GetZ()); + if (TMath::Abs(dDT) > fdTrkCutDT) continue; /* LOG(info)<<"Got MuchCorI Tr "<<iTr <<", St "<<iTrSt @@ -1583,15 +1626,22 @@ void CbmTofExtendTracks::FillHistograms(CbmEvent* tEvent) { <<", dx " << dDX <<", dy " << dDY; */ - LOG(info) << Form("Proc ev %d, Trk %d, St %d, iLe%d, DX %6.3f, dY %6.3f, MtHit: ", - fiEvent, iTr, iTrSt, iLev, dDX, dDY) << tHit->ToString(); - - fhPosCorTrkMuch->Fill(dDX, dDY); - // fill tracking station histos - fhTrkStationDX[iLev]->Fill(iTrSt,dDX); - fhTrkStationDY[iLev]->Fill(iTrSt,dDY); - fhTrkStationDT[iLev]->Fill(iTrSt,dDT); - fhTrkStationNHits[iLev]->Fill(iTrSt,(Double_t)fvMuchHitIndex[iSt].size()); + LOG(info) << Form( + "Proc ev %d, Trk %d, St %d, iLe%d, DX %6.3f, dY %6.3f, MtHit: ", + fiEvent, + iTr, + iTrSt, + iLev, + dDX, + dDY) << tHit->ToString(); + + fhPosCorTrkMuch->Fill(dDX, dDY); + // fill tracking station histos + fhTrkStationDX[iLev]->Fill(iTrSt, dDX); + fhTrkStationDY[iLev]->Fill(iTrSt, dDY); + fhTrkStationDT[iLev]->Fill(iTrSt, dDT); + fhTrkStationNHits[iLev]->Fill(iTrSt, + (Double_t) fvMuchHitIndex[iSt].size()); } } // Much Station loop end @@ -1609,166 +1659,185 @@ void CbmTofExtendTracks::FillHistograms(CbmEvent* tEvent) { fvRichHitIndex.size()); assert(tHit); } - Int_t iTrSt=fMapStationZ[(Int_t)(tHit->GetZ())]%100; - - Double_t dDX=tHit->GetX() + fvXoff[iTrSt] - tTrk->GetFitX(tHit->GetZ()); - if( TMath::Abs( dDX ) > fdTrkCutDX ) continue; - Double_t dDY=tHit->GetY() + fvYoff[iTrSt] - tTrk->GetFitY(tHit->GetZ()); - if( TMath::Abs( dDY ) > fdTrkCutDY ) continue; - Double_t dDT=tHit->GetTime() + fvToff[iTrSt] - tTrk->GetFitT(tHit->GetZ()); - if( TMath::Abs( dDT ) > fdTrkCutDT ) continue; - - fhPosCorTrkRich->Fill(dDX, dDY); - // fill tracking station histos - fhTrkStationDX[iLev]->Fill(iTrSt,dDX); - fhTrkStationDY[iLev]->Fill(iTrSt,dDY); - fhTrkStationDT[iLev]->Fill(iTrSt,dDT); - fhTrkStationNHits[iLev]->Fill(iTrSt,(Double_t)fvRichHitIndex[iSt].size()); + Int_t iTrSt = fMapStationZ[(Int_t)(tHit->GetZ())] % 100; + + Double_t dDX = + tHit->GetX() + fvXoff[iTrSt] - tTrk->GetFitX(tHit->GetZ()); + if (TMath::Abs(dDX) > fdTrkCutDX) continue; + Double_t dDY = + tHit->GetY() + fvYoff[iTrSt] - tTrk->GetFitY(tHit->GetZ()); + if (TMath::Abs(dDY) > fdTrkCutDY) continue; + Double_t dDT = + tHit->GetTime() + fvToff[iTrSt] - tTrk->GetFitT(tHit->GetZ()); + if (TMath::Abs(dDT) > fdTrkCutDT) continue; + + fhPosCorTrkRich->Fill(dDX, dDY); + // fill tracking station histos + fhTrkStationDX[iLev]->Fill(iTrSt, dDX); + fhTrkStationDY[iLev]->Fill(iTrSt, dDY); + fhTrkStationDT[iLev]->Fill(iTrSt, dDT); + fhTrkStationNHits[iLev]->Fill(iTrSt, + (Double_t) fvRichHitIndex[iSt].size()); } } // Rich Station loop end - + } // TOF Tracklet loop end - iLev=1; + iLev = 1; // Fully assembled tracks - UInt_t NSt=fMapStationZ.size(); - UInt_t NTrk=fvTrkPar.size(); - if(NTrkTof<0) NTrkTof=0; - assert ( NTrk == (UInt_t)NTrkTof); - - for(UInt_t iTr=0; iTr<NTrk; iTr++){ + UInt_t NSt = fMapStationZ.size(); + UInt_t NTrk = fvTrkPar.size(); + if (NTrkTof < 0) NTrkTof = 0; + assert(NTrk == (UInt_t) NTrkTof); + + for (UInt_t iTr = 0; iTr < NTrk; iTr++) { //select tracks - // minimal number of TOF hits - Int_t NTofHits=0; - for (UInt_t iH=0; iH<fvTrkCalHits[iTr].size(); iH++){ - if ( fMapStationZ[(Int_t)(fvTrkCalHits[iTr][iH]->GetZ())]/100 - == Int_t(ECbmModuleId::kTof) ) NTofHits++; - } - if( NTofHits<fiTrkHitsMin ) continue; - // contain requested stations - if(fiReqStations > -1) { - Int_t iReqStations=fiReqStations; - Int_t iHit=(Int_t)fvTrkCalHits[iTr].size()-1; - Int_t iReqStation=0; - while(iReqStations > 0) { - iReqStation=iReqStations%100; - iHit=(Int_t)fvTrkCalHits[iTr].size()-1; -// LOG(info)<<"Check tr "<<iTr<<" for station "<<iReqStation -// <<" starting from hit "<<iHit<<" in station " -// <<fMapStationZ[(Int_t)(fvTrkCalHits[iTr][iHit]->GetZ())]%100; - iReqStations /= 100; - for ( ; iHit>0; iHit--) - if( iReqStation == - fMapStationZ[(Int_t)(fvTrkCalHits[iTr][iHit]->GetZ())]%100 ) { -// if (iReqStations ==0 ) -// LOG(info)<<"Check tr "<<iTr<<" accepted for analysis"; - break; - } -// LOG(info)<<"Check last Hit "<<iHit<<", ReqSt "<<iReqStations -// <<"("<<fiReqStations<<") "; - if(iReqStation!=0 && iHit==0) break; // station not found -// LOG(info)<<"CheckI with "<<iReqStations<<","<<iHit; - } -// LOG(info)<<"CheckII with "<<iReqStations<<","<<iHit; - if(iReqStation!=0 && iHit==0) continue; //skip this track - } - - LOG(info)<<"CheckIII accepted tr "<<iTr<<" with "<<fiReqStations; - for (UInt_t iHit=0; iHit<fvTrkCalHits[iTr].size(); iHit++) { - LOG(info)<<" Hit "<<iHit<<", station " - <<fMapStationZ[(Int_t)(fvTrkCalHits[iTr][iHit]->GetZ())]%100; - } - - fhExt_TrkSizChiSq[iLev]->Fill( - (Double_t) fvTrkCalHits[iTr].size(),fvTrkPar[iTr]->GetChiSq()); - - fhExt_TrkSizVel[iLev]->Fill( - (Double_t) fvTrkCalHits[iTr].size(), 1./(fvTrkPar[iTr]->GetTt())); - - // Pulls - CbmTofTrackletParam* tTrkPar=fvTrkPar[iTr]; - Bool_t bSUT_Found=kFALSE; - for (UInt_t iHit=0; iHit<fvTrkCalHits[iTr].size(); iHit++) { - CbmPixelHit* tHit=fvTrkCalHits[iTr][iHit]; - Int_t iTrSt=fMapStationZ[(Int_t)(tHit->GetZ())]%100; - - Double_t dDX=tHit->GetX() - GetFitX(tHit->GetZ(),tTrkPar); - Double_t dDY=tHit->GetY() - GetFitY(tHit->GetZ(),tTrkPar); - Double_t dDT=tHit->GetTime() - GetFitT(tHit->GetZ(),tTrkPar); - - if( TMath::Abs( dDX ) > fdTrkCutDX ) continue; - if( TMath::Abs( dDY ) > fdTrkCutDY ) continue; - if( TMath::Abs( dDT ) > fdTrkCutDT ) continue; - - fhTrkPullDX[iLev]->Fill(iTrSt,dDX); - fhTrkPullDY[iLev]->Fill(iTrSt,dDY); - fhTrkPullDT[iLev]->Fill(iTrSt,dDT); - - if (iTrSt==fiStationUT) { // hit in SUT - bSUT_Found=kTRUE; - fhExtSutXY_Found->Fill(tHit->GetX(),tHit->GetY()); - fhExtSutXY_DX->Fill(tHit->GetX(),tHit->GetY(),dDX); - fhExtSutXY_DY->Fill(tHit->GetX(),tHit->GetY(),dDY); - fhExtSutXY_DT->Fill(tHit->GetX(),tHit->GetY(),dDT); + // minimal number of TOF hits + Int_t NTofHits = 0; + for (UInt_t iH = 0; iH < fvTrkCalHits[iTr].size(); iH++) { + if (fMapStationZ[(Int_t)(fvTrkCalHits[iTr][iH]->GetZ())] / 100 + == Int_t(ECbmModuleId::kTof)) + NTofHits++; + } + if (NTofHits < fiTrkHitsMin) continue; + // contain requested stations + if (fiReqStations > -1) { + Int_t iReqStations = fiReqStations; + Int_t iHit = (Int_t) fvTrkCalHits[iTr].size() - 1; + Int_t iReqStation = 0; + while (iReqStations > 0) { + iReqStation = iReqStations % 100; + iHit = (Int_t) fvTrkCalHits[iTr].size() - 1; + // LOG(info)<<"Check tr "<<iTr<<" for station "<<iReqStation + // <<" starting from hit "<<iHit<<" in station " + // <<fMapStationZ[(Int_t)(fvTrkCalHits[iTr][iHit]->GetZ())]%100; + iReqStations /= 100; + for (; iHit > 0; iHit--) + if (iReqStation + == fMapStationZ[(Int_t)(fvTrkCalHits[iTr][iHit]->GetZ())] % 100) { + // if (iReqStations ==0 ) + // LOG(info)<<"Check tr "<<iTr<<" accepted for analysis"; + break; + } + // LOG(info)<<"Check last Hit "<<iHit<<", ReqSt "<<iReqStations + // <<"("<<fiReqStations<<") "; + if (iReqStation != 0 && iHit == 0) break; // station not found + // LOG(info)<<"CheckI with "<<iReqStations<<","<<iHit; } - + // LOG(info)<<"CheckII with "<<iReqStations<<","<<iHit; + if (iReqStation != 0 && iHit == 0) continue; //skip this track + } + + LOG(info) << "CheckIII accepted tr " << iTr << " with " << fiReqStations; + for (UInt_t iHit = 0; iHit < fvTrkCalHits[iTr].size(); iHit++) { + LOG(info) << " Hit " << iHit << ", station " + << fMapStationZ[(Int_t)(fvTrkCalHits[iTr][iHit]->GetZ())] % 100; + } + + fhExt_TrkSizChiSq[iLev]->Fill((Double_t) fvTrkCalHits[iTr].size(), + fvTrkPar[iTr]->GetChiSq()); + + fhExt_TrkSizVel[iLev]->Fill((Double_t) fvTrkCalHits[iTr].size(), + 1. / (fvTrkPar[iTr]->GetTt())); + + // Pulls + CbmTofTrackletParam* tTrkPar = fvTrkPar[iTr]; + Bool_t bSUT_Found = kFALSE; + for (UInt_t iHit = 0; iHit < fvTrkCalHits[iTr].size(); iHit++) { + CbmPixelHit* tHit = fvTrkCalHits[iTr][iHit]; + Int_t iTrSt = fMapStationZ[(Int_t)(tHit->GetZ())] % 100; + + Double_t dDX = tHit->GetX() - GetFitX(tHit->GetZ(), tTrkPar); + Double_t dDY = tHit->GetY() - GetFitY(tHit->GetZ(), tTrkPar); + Double_t dDT = tHit->GetTime() - GetFitT(tHit->GetZ(), tTrkPar); + + if (TMath::Abs(dDX) > fdTrkCutDX) continue; + if (TMath::Abs(dDY) > fdTrkCutDY) continue; + if (TMath::Abs(dDT) > fdTrkCutDT) continue; + + fhTrkPullDX[iLev]->Fill(iTrSt, dDX); + fhTrkPullDY[iLev]->Fill(iTrSt, dDY); + fhTrkPullDT[iLev]->Fill(iTrSt, dDT); + + if (iTrSt == fiStationUT) { // hit in SUT + bSUT_Found = kTRUE; + fhExtSutXY_Found->Fill(tHit->GetX(), tHit->GetY()); + fhExtSutXY_DX->Fill(tHit->GetX(), tHit->GetY(), dDX); + fhExtSutXY_DY->Fill(tHit->GetX(), tHit->GetY(), dDY); + fhExtSutXY_DT->Fill(tHit->GetX(), tHit->GetY(), dDT); + } + // pulls against original tracklets Int_t iTrkInd = static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kTofTrack, iTr)); CbmTofTracklet* pTrk = - dynamic_cast<CbmTofTracklet*>(fTofTrackArrayIn->At(iTrkInd)); - dDX=tHit->GetX() - pTrk->GetFitX(tHit->GetZ()); - dDY=tHit->GetY() - pTrk->GetFitY(tHit->GetZ()); - dDT=tHit->GetTime() - pTrk->GetFitT(tHit->GetZ()); - fhTrkPullDX[0]->Fill(iTrSt,dDX); - fhTrkPullDY[0]->Fill(iTrSt,dDY); - fhTrkPullDT[0]->Fill(iTrSt,dDT); - fhTrkStationDXDY[0][iTrSt]->Fill(dDX,dDY); - LOG(info) << Form("Proc ev %d, Trk %d, St %d, Lev%d, DX %6.3f, dY %6.3f, MtHit: ", - fiEvent, iTr, iTrSt, 0, dDX, dDY)<< tHit->ToString(); - } // fvTrkCalHits loop end - - if(bSUT_Found==kFALSE) { - fhExtSutXY_Missed->Fill(GetFitX(dSUT_z,tTrkPar), GetFitY(dSUT_z,tTrkPar)); - } - - //Deviations to all hits in all stations - for (UInt_t iSt=0; iSt<NSt; iSt++) { - for (UInt_t iHit=0; iHit<fvAllHitPointer[iSt].size(); iHit++) { - CbmPixelHit* tHit=fvAllHitPointer[iSt][iHit]; - /* + dynamic_cast<CbmTofTracklet*>(fTofTrackArrayIn->At(iTrkInd)); + dDX = tHit->GetX() - pTrk->GetFitX(tHit->GetZ()); + dDY = tHit->GetY() - pTrk->GetFitY(tHit->GetZ()); + dDT = tHit->GetTime() - pTrk->GetFitT(tHit->GetZ()); + fhTrkPullDX[0]->Fill(iTrSt, dDX); + fhTrkPullDY[0]->Fill(iTrSt, dDY); + fhTrkPullDT[0]->Fill(iTrSt, dDT); + fhTrkStationDXDY[0][iTrSt]->Fill(dDX, dDY); + LOG(info) << Form( + "Proc ev %d, Trk %d, St %d, Lev%d, DX %6.3f, dY %6.3f, MtHit: ", + fiEvent, + iTr, + iTrSt, + 0, + dDX, + dDY) << tHit->ToString(); + } // fvTrkCalHits loop end + + if (bSUT_Found == kFALSE) { + fhExtSutXY_Missed->Fill(GetFitX(dSUT_z, tTrkPar), + GetFitY(dSUT_z, tTrkPar)); + } + + //Deviations to all hits in all stations + for (UInt_t iSt = 0; iSt < NSt; iSt++) { + for (UInt_t iHit = 0; iHit < fvAllHitPointer[iSt].size(); iHit++) { + CbmPixelHit* tHit = fvAllHitPointer[iSt][iHit]; + /* LOG(info)<<"Got AllHit for Tr "<<iTr <<", St "<<iSt <<", StZ "<<fMapStationZ[(Int_t)(tHit->GetZ())]%100 <<", Hit "<< iHit <<", poi "<< tHit; LOG(info)<<"tHit: "<<tHit->ToString(); */ - assert((Int_t)iSt == fMapStationZ[(Int_t)(tHit->GetZ())]%100); - - Double_t dDX=tHit->GetX() - GetFitX(tHit->GetZ(),tTrkPar); - if( TMath::Abs( dDX ) > fdTrkCutDX ) continue; - Double_t dDY=tHit->GetY() - GetFitY(tHit->GetZ(),tTrkPar); - if( TMath::Abs( dDY ) > fdTrkCutDY ) continue; - Double_t dDT=tHit->GetTime() - GetFitT(tHit->GetZ(),tTrkPar); - if( TMath::Abs( dDT ) > fdTrkCutDT ) continue; - - LOG(info) << Form("Proc ev %d, Trk %d, St %d, Lev%d, DX %6.3f, dY %6.3f, MtHit: ", - fiEvent, iTr, iSt, iLev, dDX, dDY)<< tHit->ToString(); - - // fill tracking station histos - fhTrkStationDX[iLev]->Fill(iSt,dDX); - fhTrkStationDY[iLev]->Fill(iSt,dDY); - fhTrkStationDT[iLev]->Fill(iSt,dDT); - fhTrkStationNHits[iLev]->Fill(iSt,(Double_t)fvAllHitPointer[iSt].size()); - fhTrkStationDXDY[iLev][iSt]->Fill(dDX,dDY); - } - } - } // loop on extended tracks end - + assert((Int_t) iSt == fMapStationZ[(Int_t)(tHit->GetZ())] % 100); + + Double_t dDX = tHit->GetX() - GetFitX(tHit->GetZ(), tTrkPar); + if (TMath::Abs(dDX) > fdTrkCutDX) continue; + Double_t dDY = tHit->GetY() - GetFitY(tHit->GetZ(), tTrkPar); + if (TMath::Abs(dDY) > fdTrkCutDY) continue; + Double_t dDT = tHit->GetTime() - GetFitT(tHit->GetZ(), tTrkPar); + if (TMath::Abs(dDT) > fdTrkCutDT) continue; + + LOG(info) << Form( + "Proc ev %d, Trk %d, St %d, Lev%d, DX %6.3f, dY %6.3f, MtHit: ", + fiEvent, + iTr, + iSt, + iLev, + dDX, + dDY) << tHit->ToString(); + + // fill tracking station histos + fhTrkStationDX[iLev]->Fill(iSt, dDX); + fhTrkStationDY[iLev]->Fill(iSt, dDY); + fhTrkStationDT[iLev]->Fill(iSt, dDT); + fhTrkStationNHits[iLev]->Fill(iSt, + (Double_t) fvAllHitPointer[iSt].size()); + fhTrkStationDXDY[iLev][iSt]->Fill(dDX, dDY); + } + } + } // loop on extended tracks end + } // FillHist end -void CbmTofExtendTracks::Line3Dfit(std::vector<CbmPixelHit*> pHits, - CbmTofTrackletParam* pTrkPar) { +void CbmTofExtendTracks::Line3Dfit(std::vector<CbmPixelHit*> pHits, + CbmTofTrackletParam* pTrkPar) { TGraph2DErrors* gr = new TGraph2DErrors(); // Fill the 2D graph // generate graph with the 3d points @@ -1783,12 +1852,11 @@ void CbmTofExtendTracks::Line3Dfit(std::vector<CbmPixelHit*> pHits, dy = pHits[N]->GetDy(); dz = pHits[N]->GetDz(); //FIXME gr->SetPointError(N, dx, dy, dz); - LOG(debug) << "Line3Dfit add N = " << N - << ",\t" << x << ",\t" << y << ",\t" << z << ",\t" << dx << ",\t" - << dy << ",\t" << dz; + LOG(debug) << "Line3Dfit add N = " << N << ",\t" << x << ",\t" << y << ",\t" + << z << ",\t" << dx << ",\t" << dy << ",\t" << dz; } // fit the graph now - + Double_t pStart[4] = {0., 0., 0., 0.}; pStart[0] = pTrkPar->GetX(); pStart[1] = pTrkPar->GetTx(); @@ -1796,36 +1864,42 @@ void CbmTofExtendTracks::Line3Dfit(std::vector<CbmPixelHit*> pHits, pStart[3] = pTrkPar->GetTy(); LOG(debug) << "Line3Dfit init: X0 " << pStart[0] << ", TX " << pStart[1] << ", Y0 " << pStart[2] << ", TY " << pStart[3]; - + fMinuit.DoFit(gr, pStart); //gr->Draw("err p0"); gr->Delete(); Double_t* dRes; dRes = fMinuit.GetParFit(); - LOG(debug) << "Line3Dfit result("<<pHits.size()<<") " - << gMinuit->fCstatu << " : X0 " - << Form (" %7.4f, TX %7.4f, Y0 %7.4f, TY %7.4f, Chi2DoF %7.4f ", - dRes[0], dRes[1], dRes[2], dRes[3],fMinuit.GetChi2DoF()); + LOG(debug) << "Line3Dfit result(" << pHits.size() << ") " << gMinuit->fCstatu + << " : X0 " + << Form(" %7.4f, TX %7.4f, Y0 %7.4f, TY %7.4f, Chi2DoF %7.4f ", + dRes[0], + dRes[1], + dRes[2], + dRes[3], + fMinuit.GetChi2DoF()); pTrkPar->SetX(dRes[0]); pTrkPar->SetY(dRes[2]); pTrkPar->SetZ(0.); pTrkPar->SetTx(dRes[1]); pTrkPar->SetTy(dRes[3]); - pTrkPar->SetQp(1.); - pTrkPar->SetChiSq(fMinuit.GetChi2DoF()); // / (Double_t)pHits.size()); - + pTrkPar->SetQp(1.); + pTrkPar->SetChiSq(fMinuit.GetChi2DoF()); // / (Double_t)pHits.size()); } -Double_t CbmTofExtendTracks::GetFitX(Double_t dZ, CbmTofTrackletParam* fTrkPar) { +Double_t CbmTofExtendTracks::GetFitX(Double_t dZ, + CbmTofTrackletParam* fTrkPar) { return fTrkPar->GetX() + fTrkPar->GetTx() * (dZ - fTrkPar->GetZ()); } -Double_t CbmTofExtendTracks::GetFitY(Double_t dZ, CbmTofTrackletParam* fTrkPar) { +Double_t CbmTofExtendTracks::GetFitY(Double_t dZ, + CbmTofTrackletParam* fTrkPar) { return fTrkPar->GetY() + fTrkPar->GetTy() * (dZ - fTrkPar->GetZ()); } -Double_t CbmTofExtendTracks::GetFitT(Double_t dZ, CbmTofTrackletParam* fTrkPar) { +Double_t CbmTofExtendTracks::GetFitT(Double_t dZ, + CbmTofTrackletParam* fTrkPar) { return fTrkPar->GetT() + fTrkPar->GetTt() * (dZ - fTrkPar->GetZ()) * TMath::Sqrt(1. + fTrkPar->GetTx() * fTrkPar->GetTx() @@ -1833,91 +1907,97 @@ Double_t CbmTofExtendTracks::GetFitT(Double_t dZ, CbmTofTrackletParam* fTrkPar) } void CbmTofExtendTracks::TrkAddStation(Int_t iStation) { - - LOG(debug)<<"Add "<< fvAllHitPointer[iStation].size() - << " hits from station "<<iStation<<" to " - << fvTrkPar.size() << " tracks "; - - const Int_t NCand=100; + + LOG(debug) << "Add " << fvAllHitPointer[iStation].size() + << " hits from station " << iStation << " to " << fvTrkPar.size() + << " tracks "; + + const Int_t NCand = 100; // tbd: get matching width from histos !! - Double_t tSIGX=1.; - Double_t tSIGY=1.; - Double_t tSIGT=1000.; - UInt_t NTr=fvTrkPar.size(); - Double_t MatchChi2Min[NCand]={NCand*fdChi2Max}; - Int_t MatchHit[NCand]={NCand*-1}; - Int_t MatchTrk[NCand]={NCand*-1}; + Double_t tSIGX = 1.; + Double_t tSIGY = 1.; + Double_t tSIGT = 1000.; + UInt_t NTr = fvTrkPar.size(); + Double_t MatchChi2Min[NCand] = {NCand * fdChi2Max}; + Int_t MatchHit[NCand] = {NCand * -1}; + Int_t MatchTrk[NCand] = {NCand * -1}; // find list of best matches for each track, max NCand - Int_t iMatch=0; - for (UInt_t iTr=0; iTr<NTr; iTr++){ - for (UInt_t iHit=0; iHit<fvAllHitPointer[iStation].size(); iHit++) { - CbmPixelHit* tHit=fvAllHitPointer[iStation][iHit]; - LOG(debug)<<" Hit "<<iHit<<": X "<<tHit->GetX() - <<", Y "<<tHit->GetY() - <<", Z "<<tHit->GetZ() - <<", T "<<tHit->GetTime(); - Double_t MatchChi2= - TMath::Power((tHit->GetX()+fvXoff[iStation] - - GetFitX(tHit->GetZ(),fvTrkPar[iTr]))/tSIGX,2) + - TMath::Power((tHit->GetY()+fvYoff[iStation] - - GetFitY(tHit->GetZ(),fvTrkPar[iTr]))/tSIGY,2); - TMath::Power((tHit->GetTime()+fvToff[iStation] - - GetFitT(tHit->GetZ(),fvTrkPar[iTr]))/tSIGT,2); - MatchChi2 /= 3.; - LOG(debug)<<"Match Tr "<<iTr<<", Hit "<<iHit<<": "<<MatchChi2; - if( MatchChi2 < fdChi2Max ) { - Int_t iCand=0; - for (; iCand<iMatch+1; iCand++) { - if( MatchChi2 < MatchChi2Min[iCand] ) { - LOG(debug)<<"Better Match found for iTr "<<iTr<<" Chi2 "<<MatchChi2; - for(Int_t i=iMatch-1; i>=iCand; i--) { - MatchChi2Min[i+1]=MatchChi2Min[i]; - MatchHit[i+1]=MatchHit[i]; - MatchTrk[i+1]=MatchTrk[i]; - } - MatchChi2Min[iCand]=MatchChi2; - MatchHit[iCand]=(Int_t)iHit; - MatchTrk[iCand]=(Int_t)iTr; - break; - } - } // end candidate loop - iMatch++; - if(iMatch==NCand) iMatch--; // cutoff - LOG(debug)<<"New Match "<<iMatch<<" stored as candidate " - <<iCand<<" for Tr "<<iTr<<" with hit "<<iHit; - } - } // station hit loop end - } // track loop end - + Int_t iMatch = 0; + for (UInt_t iTr = 0; iTr < NTr; iTr++) { + for (UInt_t iHit = 0; iHit < fvAllHitPointer[iStation].size(); iHit++) { + CbmPixelHit* tHit = fvAllHitPointer[iStation][iHit]; + LOG(debug) << " Hit " << iHit << ": X " << tHit->GetX() << ", Y " + << tHit->GetY() << ", Z " << tHit->GetZ() << ", T " + << tHit->GetTime(); + Double_t MatchChi2 = + TMath::Power((tHit->GetX() + fvXoff[iStation] + - GetFitX(tHit->GetZ(), fvTrkPar[iTr])) + / tSIGX, + 2) + + TMath::Power((tHit->GetY() + fvYoff[iStation] + - GetFitY(tHit->GetZ(), fvTrkPar[iTr])) + / tSIGY, + 2); + TMath::Power((tHit->GetTime() + fvToff[iStation] + - GetFitT(tHit->GetZ(), fvTrkPar[iTr])) + / tSIGT, + 2); + MatchChi2 /= 3.; + LOG(debug) << "Match Tr " << iTr << ", Hit " << iHit << ": " << MatchChi2; + if (MatchChi2 < fdChi2Max) { + Int_t iCand = 0; + for (; iCand < iMatch + 1; iCand++) { + if (MatchChi2 < MatchChi2Min[iCand]) { + LOG(debug) << "Better Match found for iTr " << iTr << " Chi2 " + << MatchChi2; + for (Int_t i = iMatch - 1; i >= iCand; i--) { + MatchChi2Min[i + 1] = MatchChi2Min[i]; + MatchHit[i + 1] = MatchHit[i]; + MatchTrk[i + 1] = MatchTrk[i]; + } + MatchChi2Min[iCand] = MatchChi2; + MatchHit[iCand] = (Int_t) iHit; + MatchTrk[iCand] = (Int_t) iTr; + break; + } + } // end candidate loop + iMatch++; + if (iMatch == NCand) iMatch--; // cutoff + LOG(debug) << "New Match " << iMatch << " stored as candidate " << iCand + << " for Tr " << iTr << " with hit " << iHit; + } + } // station hit loop end + } // track loop end + // append best matches to track - for (Int_t iCand=0; iCand<iMatch; iCand++){ - if( MatchHit[iCand]>-1) { - CbmPixelHit* tHit=fvAllHitPointer[iStation][MatchHit[iCand]]; - /* + for (Int_t iCand = 0; iCand < iMatch; iCand++) { + if (MatchHit[iCand] > -1) { + CbmPixelHit* tHit = fvAllHitPointer[iStation][MatchHit[iCand]]; + /* LOG(info)<<"Add hit "<<MatchHit[iCand] <<", station "<<fMapStationZ[(Int_t)(tHit->GetZ())]%100 <<" to track "<<MatchTrk[iCand] <<" with chi2 "<<MatchChi2Min[iCand]; */ //LOG(info)<<"MatHit: "<<tHit->ToString(); - - fvTrkCalHits[MatchTrk[iCand]].push_back( dynamic_cast<CbmPixelHit*>(tHit) ); - // prevent match with other tracks - for(Int_t i=iCand+1; i<iMatch; i++) { - if( MatchHit[i]==MatchHit[iCand] || - MatchTrk[i]==MatchTrk[iCand] ) MatchHit[i]=-1; - } + + fvTrkCalHits[MatchTrk[iCand]].push_back(dynamic_cast<CbmPixelHit*>(tHit)); + // prevent match with other tracks + for (Int_t i = iCand + 1; i < iMatch; i++) { + if (MatchHit[i] == MatchHit[iCand] || MatchTrk[i] == MatchTrk[iCand]) + MatchHit[i] = -1; + } // refit track, update TrkPar - fvTrkPar[MatchTrk[iCand]]->SetX(0.); - fvTrkPar[MatchTrk[iCand]]->SetY(0.); - - Line3Dfit(fvTrkCalHits[MatchTrk[iCand]],fvTrkPar[MatchTrk[iCand]]); - // Inspect pulls (debugging) - /* + fvTrkPar[MatchTrk[iCand]]->SetX(0.); + fvTrkPar[MatchTrk[iCand]]->SetY(0.); + + Line3Dfit(fvTrkCalHits[MatchTrk[iCand]], fvTrkPar[MatchTrk[iCand]]); + // Inspect pulls (debugging) + /* Double_t dDX=tHit->GetX() - GetFitX(tHit->GetZ(),fvTrkPar[MatchTrk[iCand]]); Double_t dDY=tHit->GetY() - GetFitY(tHit->GetZ(),fvTrkPar[MatchTrk[iCand]]); LOG(info)<<"MatchPulls X "<<dDX<<", Y "<<dDY; */ - } - } // end of loop on match candidates + } + } // end of loop on match candidates } \ No newline at end of file diff --git a/reco/detectors/tof/CbmTofExtendTracks.h b/reco/detectors/tof/CbmTofExtendTracks.h index 82b6019a7c..279f9b5370 100644 --- a/reco/detectors/tof/CbmTofExtendTracks.h +++ b/reco/detectors/tof/CbmTofExtendTracks.h @@ -86,39 +86,39 @@ public: virtual void FindVertex(); virtual void FillHistograms(CbmEvent* tEvent = NULL); - - - virtual void Line3Dfit(std::vector<CbmPixelHit*>, CbmTofTrackletParam *); - Double_t GetFitX(Double_t, CbmTofTrackletParam*); - Double_t GetFitY(Double_t, CbmTofTrackletParam*); - Double_t GetFitT(Double_t, CbmTofTrackletParam*); - + + + virtual void Line3Dfit(std::vector<CbmPixelHit*>, CbmTofTrackletParam*); + Double_t GetFitX(Double_t, CbmTofTrackletParam*); + Double_t GetFitY(Double_t, CbmTofTrackletParam*); + Double_t GetFitT(Double_t, CbmTofTrackletParam*); + virtual void TrkAddStation(Int_t iStation); - + /** Accessors **/ CbmTofTrackFinder* GetFinder() { return fFinder; }; CbmTofTrackFitter* GetFitter() { return fFitter; }; - inline void SetTrkHitsMin(Int_t i) {fiTrkHitsMin=i;}; - inline void SetCutDX(Double_t val) {fdTrkCutDX=val;}; - inline void SetCutDY(Double_t val) {fdTrkCutDY=val;}; - inline void SetCutDT(Double_t val) {fdTrkCutDT=val;}; - inline void SetChi2Max(Double_t val) {fdChi2Max=val;}; - inline void SetCorSrc(Int_t i) {fiCorSrc=i;}; - inline void SetCorMode(Int_t i) {fiCorMode=i;}; - inline void SetAddStations(Int_t i) {fiAddStations=i;}; - inline void SetReqStations(Int_t i) {fiReqStations=i;}; - inline void SetStationUT(Int_t i) {fiStationUT=i;}; - inline void SetCutStationMaxHitMul(Int_t i) {fiCutStationMaxHitMul=i;}; - inline void SetNTrkTofMax(Int_t i) {fiNTrkTofMax=i;}; - + inline void SetTrkHitsMin(Int_t i) { fiTrkHitsMin = i; }; + inline void SetCutDX(Double_t val) { fdTrkCutDX = val; }; + inline void SetCutDY(Double_t val) { fdTrkCutDY = val; }; + inline void SetCutDT(Double_t val) { fdTrkCutDT = val; }; + inline void SetChi2Max(Double_t val) { fdChi2Max = val; }; + inline void SetCorSrc(Int_t i) { fiCorSrc = i; }; + inline void SetCorMode(Int_t i) { fiCorMode = i; }; + inline void SetAddStations(Int_t i) { fiAddStations = i; }; + inline void SetReqStations(Int_t i) { fiReqStations = i; }; + inline void SetStationUT(Int_t i) { fiStationUT = i; }; + inline void SetCutStationMaxHitMul(Int_t i) { fiCutStationMaxHitMul = i; }; + inline void SetNTrkTofMax(Int_t i) { fiNTrkTofMax = i; }; + inline void SetCalParFileName(TString CalParFileName) { fCalParFileName = CalParFileName; } inline void SetCalOutFileName(TString CalOutFileName) { fCalOutFileName = CalOutFileName; } - + /** Set concrete track finder **/ void UseFinder(CbmTofTrackFinder* finder) { fFinder = finder; }; void UseFitter(CbmTofTrackFitter* fitter) { fFitter = fitter; }; @@ -144,33 +144,34 @@ private: TClonesArray* fTofTrackArrayIn; // Input array of CbmTofTracks TClonesArray* fTrackArrayOut; // Output array of CbmTofTracks in CbmEvent mode - std::vector<std::vector <Int_t>> fvTofHitIndex; // Index of hit in TS - std::vector<Int_t> fvTofTrackIndex; // Index of track in TS - std::vector<std::vector <Int_t>> fvStsHitIndex; // Index of hit in TS - std::vector<std::vector <Int_t>> fvMuchHitIndex; // Index of hit in TS - std::vector<std::vector <Int_t>> fvRichHitIndex; // Index of hit in TS - std::vector<Double_t> fvTofStationZ; // Z position of Tof stations - std::vector<Double_t> fvStsStationZ; // Z position of Tof stations - std::vector<Double_t> fvMuchStationZ; // Z position of Tof stations - std::vector<Double_t> fvRichStationZ; // Z position of Tof stations - - std::vector<std::vector<CbmPixelHit*>> fvAllHitPointer; // Pointer to hits in TS + std::vector<std::vector<Int_t>> fvTofHitIndex; // Index of hit in TS + std::vector<Int_t> fvTofTrackIndex; // Index of track in TS + std::vector<std::vector<Int_t>> fvStsHitIndex; // Index of hit in TS + std::vector<std::vector<Int_t>> fvMuchHitIndex; // Index of hit in TS + std::vector<std::vector<Int_t>> fvRichHitIndex; // Index of hit in TS + std::vector<Double_t> fvTofStationZ; // Z position of Tof stations + std::vector<Double_t> fvStsStationZ; // Z position of Tof stations + std::vector<Double_t> fvMuchStationZ; // Z position of Tof stations + std::vector<Double_t> fvRichStationZ; // Z position of Tof stations + + std::vector<std::vector<CbmPixelHit*>> + fvAllHitPointer; // Pointer to hits in TS std::vector<std::vector<CbmPixelHit*>> fvTrkCalHits; std::vector<CbmTofTrackletParam*> fvTrkPar; - + std::map<Int_t, Int_t> fMapStationZ; std::map<Int_t, Int_t>::iterator itMapStationZ; - std::vector<Double_t> fvToff; // station correction parameter - std::vector<Double_t> fvXoff; // station correction parameter - std::vector<Double_t> fvYoff; // station correction parameter - std::vector<Double_t> fvZoff; // station correction parameter - - std::vector<Double_t> fvTsig; // station matching parameter - std::vector<Double_t> fvXsig; // station matching parameter - std::vector<Double_t> fvYsig; // station matching parameter - std::vector<Double_t> fvZsig; // station matching parameter - + std::vector<Double_t> fvToff; // station correction parameter + std::vector<Double_t> fvXoff; // station correction parameter + std::vector<Double_t> fvYoff; // station correction parameter + std::vector<Double_t> fvZoff; // station correction parameter + + std::vector<Double_t> fvTsig; // station matching parameter + std::vector<Double_t> fvXsig; // station matching parameter + std::vector<Double_t> fvYsig; // station matching parameter + std::vector<Double_t> fvZsig; // station matching parameter + CbmTofExtendTracks(const CbmTofExtendTracks&); CbmTofExtendTracks& operator=(const CbmTofExtendTracks&); @@ -195,30 +196,30 @@ private: std::vector<TH2*> fhTrkPullDX; std::vector<TH2*> fhTrkPullDY; std::vector<TH2*> fhTrkPullDT; - + TH1* fhExt_Toff; TH1* fhExt_Xoff; TH1* fhExt_Yoff; TH1* fhExt_Zoff; - + TH1* fhExt_Tsig; TH1* fhExt_Xsig; TH1* fhExt_Ysig; TH1* fhExt_Zsig; - + std::vector<TH2*> fhExt_TrkSizVel; std::vector<TH2*> fhExt_TrkSizChiSq; - + TH1* fhVTXNorm; TH2* fhVTX_XY0; TH2* fhVTX_DT0_Norm; - TH2* fhExtSutXY_Found; - TH2* fhExtSutXY_Missed; - TH3* fhExtSutXY_DX; - TH3* fhExtSutXY_DY; - TH3* fhExtSutXY_DT; - + TH2* fhExtSutXY_Found; + TH2* fhExtSutXY_Missed; + TH3* fhExtSutXY_DX; + TH3* fhExtSutXY_DY; + TH3* fhExtSutXY_DT; + Bool_t LoadCalParameter(); Bool_t WriteHistos(); Bool_t UpdateCalHistos(); @@ -237,15 +238,15 @@ private: Double_t fdTrkCutDX; Double_t fdTrkCutDY; Double_t fdTrkCutDT; - Double_t fdChi2Max; // Max accepted matching chi2 - Int_t fiCorSrc; // correction source (0 - all hits, 1 pulls) - Int_t fiCorMode; // correction update mode - Int_t fiAddStations; // extend tracks (station number *100) - Int_t fiReqStations; // request station for track (station number *100) - Int_t fiStationUT; // station under test - Int_t fiCutStationMaxHitMul; //max hit multiplicity for any station - Int_t fiNTrkTofMax; // maximum number of TofTracks per event - Int_t fiEvent; // Number of processed events + Double_t fdChi2Max; // Max accepted matching chi2 + Int_t fiCorSrc; // correction source (0 - all hits, 1 pulls) + Int_t fiCorMode; // correction update mode + Int_t fiAddStations; // extend tracks (station number *100) + Int_t fiReqStations; // request station for track (station number *100) + Int_t fiStationUT; // station under test + Int_t fiCutStationMaxHitMul; //max hit multiplicity for any station + Int_t fiNTrkTofMax; // maximum number of TofTracks per event + Int_t fiEvent; // Number of processed events // ToF geometry variables ClassDef(CbmTofExtendTracks, 1); diff --git a/reco/detectors/tof/CbmTofFindTracks.cxx b/reco/detectors/tof/CbmTofFindTracks.cxx index 6f3ea3c4e8..0a5d316101 100644 --- a/reco/detectors/tof/CbmTofFindTracks.cxx +++ b/reco/detectors/tof/CbmTofFindTracks.cxx @@ -265,15 +265,12 @@ InitStatus CbmTofFindTracks::Init() { //fTrackArray->BypassStreamer(kTRUE); //needed? //ioman->Register("TofTracks", "TOF", fTrackArray, kFALSE); //FIXME if (fEventsColl) { - fTrackArrayOut = new TClonesArray("CbmTofTracklet", 100); + fTrackArrayOut = new TClonesArray("CbmTofTracklet", 100); fTofHitArrayOut = new TClonesArray("CbmTofHit", 100); - ioman->Register( - "TofTracks", "TOF", fTrackArrayOut, kTRUE); - ioman->Register( - "TofCalHit", "TOF", fTofHitArrayOut, kTRUE); + ioman->Register("TofTracks", "TOF", fTrackArrayOut, kTRUE); + ioman->Register("TofCalHit", "TOF", fTofHitArrayOut, kTRUE); } else { - ioman->Register( - "TofTracks", "TOF", fTrackArray, kTRUE); + ioman->Register("TofTracks", "TOF", fTrackArray, kTRUE); cout << "-I- CbmTofFindTracks::Init:TofTrack array registered" << endl; ioman->Register("TofCalHit", "TOF", fTofHitArray, kFALSE); @@ -344,11 +341,19 @@ InitStatus CbmTofFindTracks::Init() { // ------------------------------------------------------------------------- /************************************************************************************/ Bool_t CbmTofFindTracks::LoadCalParameter() { - UInt_t NSt=fMapRpcIdParInd.size(); - fvToff.resize(NSt);for(uint i=0; i<NSt;i++)fvToff[i]=0.; - fvXoff.resize(NSt);for(uint i=0; i<NSt;i++)fvXoff[i]=0.; - fvYoff.resize(NSt);for(uint i=0; i<NSt;i++)fvYoff[i]=0.; - fvZoff.resize(NSt);for(uint i=0; i<NSt;i++)fvZoff[i]=0.; + UInt_t NSt = fMapRpcIdParInd.size(); + fvToff.resize(NSt); + for (uint i = 0; i < NSt; i++) + fvToff[i] = 0.; + fvXoff.resize(NSt); + for (uint i = 0; i < NSt; i++) + fvXoff[i] = 0.; + fvYoff.resize(NSt); + for (uint i = 0; i < NSt; i++) + fvYoff[i] = 0.; + fvZoff.resize(NSt); + for (uint i = 0; i < NSt; i++) + fvZoff[i] = 0.; if (fCalParFileName.IsNull()) return kTRUE; @@ -378,8 +383,8 @@ Bool_t CbmTofFindTracks::LoadCalParameter() { << " not found. "; } else { fhPullT_Smt_Off = (TH1D*) fhtmp->Clone(); - for (UInt_t iSt=0; iSt<NSt; iSt++) - fvToff[iSt]=fhPullT_Smt_Off->GetBinContent(iSt+1); + for (UInt_t iSt = 0; iSt < NSt; iSt++) + fvToff[iSt] = fhPullT_Smt_Off->GetBinContent(iSt + 1); } if (NULL == fhtmpX) { @@ -387,8 +392,8 @@ Bool_t CbmTofFindTracks::LoadCalParameter() { << " not found. "; } else { fhPullX_Smt_Off = (TH1D*) fhtmpX->Clone(); - for (UInt_t iSt=0; iSt<NSt; iSt++) - fvXoff[iSt]=fhPullX_Smt_Off->GetBinContent(iSt+1); + for (UInt_t iSt = 0; iSt < NSt; iSt++) + fvXoff[iSt] = fhPullX_Smt_Off->GetBinContent(iSt + 1); } if (NULL == fhtmpY) { @@ -396,8 +401,8 @@ Bool_t CbmTofFindTracks::LoadCalParameter() { << " not found. "; } else { fhPullY_Smt_Off = (TH1D*) fhtmpY->Clone(); - for (UInt_t iSt=0; iSt<NSt; iSt++) - fvYoff[iSt]=fhPullY_Smt_Off->GetBinContent(iSt+1); + for (UInt_t iSt = 0; iSt < NSt; iSt++) + fvYoff[iSt] = fhPullY_Smt_Off->GetBinContent(iSt + 1); } if (NULL == fhtmpZ) { @@ -405,8 +410,8 @@ Bool_t CbmTofFindTracks::LoadCalParameter() { << " not found. "; } else { fhPullZ_Smt_Off = (TH1D*) fhtmpZ->Clone(); - for (UInt_t iSt=0; iSt<NSt; iSt++) - fvZoff[iSt]=fhPullZ_Smt_Off->GetBinContent(iSt+1); + for (UInt_t iSt = 0; iSt < NSt; iSt++) + fvZoff[iSt] = fhPullZ_Smt_Off->GetBinContent(iSt + 1); } if (NULL == fhtmpW) { @@ -852,7 +857,7 @@ Bool_t CbmTofFindTracks::WriteHistos() { Double_t dVal = fhPullY_Smt_Off->GetBinContent(ix + 1); //dVal -= htmp1D->GetBinContent(ix + 1); // Fit gaussian - TH1D* hpy = fhPullY_Smt->ProjectionY("_py", ix + 1, ix + 1); + TH1D* hpy = fhPullY_Smt->ProjectionY("_py", ix + 1, ix + 1); if (hpy->GetEntries() > 100.) { Double_t dFMean = hpy->GetBinCenter(hpy->GetMaximumBin()); Double_t dFLim = 2.; // CAUTION, fixed numeric value @@ -863,10 +868,10 @@ Bool_t CbmTofFindTracks::WriteHistos() { dVal -= fRes->Parameter(1); Double_t dRMS = fRes->Parameter(2); LOG(debug) << "PeakFit at " << dFMean << ", lim " << dFLim - << " : mean " << fRes->Parameter(1) << ", width " - << dRMS; + << " : mean " << fRes->Parameter(1) << ", width " + << dRMS; if (fRpcAddr[ix] - != fiBeamCounter) // don't correct beam counter position + != fiBeamCounter) // don't correct beam counter position fhPullY_Smt_Off->SetBinContent(ix + 1, dVal); dRMS = TMath::Abs(hpy->GetRMS()); @@ -1075,8 +1080,8 @@ void CbmTofFindTracks::Exec(Option_t* opt) { fTofHitArray = (TClonesArray*) fTofHitArrayIn; ExecFind(opt); } else { - Int_t iNbTrks = 0; - Int_t iNbCalHits=0; + Int_t iNbTrks = 0; + Int_t iNbCalHits = 0; fTrackArrayOut->Delete(); //Clear("C"); fTofHitArrayOut->Delete(); //Clear("C"); for (Int_t iEvent = 0; iEvent < fEventsColl->GetEntriesFast(); iEvent++) { @@ -1103,18 +1108,19 @@ void CbmTofFindTracks::Exec(Option_t* opt) { for (Int_t iTrk = 0; iTrk < fTrackArray->GetEntries(); iTrk++) { CbmTofTracklet* pTrk = (CbmTofTracklet*) fTrackArray->At(iTrk); new ((*fTrackArrayOut)[iNbTrks]) CbmTofTracklet(*pTrk); - pTrk=(CbmTofTracklet*) fTrackArrayOut->At(iNbTrks); - for(Int_t iHit=0; iHit<pTrk->GetNofHits(); iHit++)//update to original index + pTrk = (CbmTofTracklet*) fTrackArrayOut->At(iNbTrks); + for (Int_t iHit = 0; iHit < pTrk->GetNofHits(); + iHit++) //update to original index { - pTrk->SetTofHitIndex(iHit, fTofHitIndexArray[ pTrk->GetTofHitIndex(iHit) ] ); + pTrk->SetTofHitIndex(iHit, + fTofHitIndexArray[pTrk->GetTofHitIndex(iHit)]); } tEvent->AddData(ECbmDataType::kTofTrack, iNbTrks); iNbTrks++; } // Update TofHitArrayIn for (Int_t iHit = 0; iHit < fTofHitArray->GetEntriesFast(); iHit++) { - CbmTofHit* tHit = - dynamic_cast<CbmTofHit*>(fTofHitArray->At(iHit)); + CbmTofHit* tHit = dynamic_cast<CbmTofHit*>(fTofHitArray->At(iHit)); new ((*fTofHitArrayOut)[iNbCalHits++]) CbmTofHit(*tHit); } diff --git a/reco/detectors/tof/CbmTofFindTracks.h b/reco/detectors/tof/CbmTofFindTracks.h index 25292eac1c..2730e14dd7 100644 --- a/reco/detectors/tof/CbmTofFindTracks.h +++ b/reco/detectors/tof/CbmTofFindTracks.h @@ -192,8 +192,8 @@ private: TClonesArray* fTofMatchArrayIn; // Input array of TOF hit matches TClonesArray* fTofHitArray; // Output array of recalibrated TOF hits std::vector<Int_t> fTofHitIndexArray; // Index of hit in TS - TClonesArray* fTofHitArrayOut; // Output array of recalibrated TOF hits - TClonesArray* fTrackArray; // Output array of CbmTofTracks + TClonesArray* fTofHitArrayOut; // Output array of recalibrated TOF hits + TClonesArray* fTrackArray; // Output array of CbmTofTracks TClonesArray* fTrackArrayOut; // Output array of CbmTofTracks in CbmEvent mode TClonesArray* fTofUHitArray; // Output array of unused TOF hits @@ -210,10 +210,10 @@ private: std::map<Int_t, Int_t> fMapStationRpcId; std::map<Int_t, Int_t> fMapRpcIdParInd; - std::vector<Double_t> fvToff; // station correction parameter - std::vector<Double_t> fvXoff; // station correction parameter - std::vector<Double_t> fvYoff; // station correction parameter - std::vector<Double_t> fvZoff; // station correction parameter + std::vector<Double_t> fvToff; // station correction parameter + std::vector<Double_t> fvXoff; // station correction parameter + std::vector<Double_t> fvYoff; // station correction parameter + std::vector<Double_t> fvZoff; // station correction parameter CbmTofFindTracks(const CbmTofFindTracks&); CbmTofFindTracks& operator=(const CbmTofFindTracks&); -- GitLab