20 #include "CbmTofHit.h"
28 #include "FairLogger.h"
29 #include "FairRootManager.h"
30 #include "FairRunAna.h"
31 #include "FairRuntimeDb.h"
33 #include "TClonesArray.h"
34 #include "TDirectory.h"
37 #include "TFitResult.h"
38 #include "TGeoManager.h"
77 , fTofCalibrator(NULL)
79 , fTofHitArrayIn(NULL)
80 , fTofMatchArrayIn(NULL)
83 , fTrackArrayOut(nullptr)
89 , fInspectEvent(kTRUE)
97 , fhAllHitsStation(NULL)
98 , fhAllHitsSmTypes(NULL)
99 , fhUsedHitsStation(NULL)
100 , fhTrackingTimeNhits(NULL)
101 , fhTrklMulNhits(NULL)
102 , fhTrklMulMaxMM(NULL)
105 , fhTrklZ0xHMul(NULL)
106 , fhTrklZ0yHMul(NULL)
110 , fhTrklVelHMul(NULL)
113 , fhTrklDT0SmMis(NULL)
114 , fhTrklDT0StMis2(NULL)
127 , vhXY_MissedStation()
137 , fhVTX_DT0_Norm(NULL)
138 , fOutHstFileName(
"")
143 , fhPullT_Smt_Off(NULL)
145 , fhPullX_Smt_Off(NULL)
147 , fhPullY_Smt_Off(NULL)
149 , fhPullZ_Smt_Off(NULL)
150 , fhPullT_Smt_Width(NULL)
151 , fhPullX_Smt_Width(NULL)
152 , fhPullY_Smt_Width(NULL)
153 , fhPullZ_Smt_Width(NULL)
155 , fhTOff_Smt_Off(NULL)
156 , fhDeltaTt_Smt(NULL)
160 , fiStationMaxHMul(1000)
183 , fdBeamMomentumLab(0.)
184 , fbRemoveSignalPropagationTime(kFALSE)
185 , fiBeamMaxHMul(1000)
205 cout <<
"-W- CbmTofFindTracks::Init: No track finder selected!" << endl;
211 cout <<
"-W- CbmTofFindTracks::Init: No track fitter selected!" << endl;
214 cout << Form(
"-D- CbmTofFindTracks::Init: track fitter at 0x%p",
fFitter)
220 FairRootManager* ioman = FairRootManager::Instance();
222 cout <<
"-E- CbmTofFindTracks::Init: "
223 <<
"RootManager not instantiated!" << endl;
229 fEventsColl =
dynamic_cast<TClonesArray*
>(ioman->GetObject(
"Event"));
231 fEventsColl =
dynamic_cast<TClonesArray*
>(ioman->GetObject(
"CbmEvent"));
233 LOG(info) <<
"CbmEvent not found in input file, assume eventwise input";
241 LOG(fatal) <<
"-W- CbmTofFindTracks::Init: No TofHit array!";
248 LOG(fatal) <<
"CbmTofFindTracks::Init: No TofDigiMatch array!";
253 fTrackArray =
new TClonesArray(
"CbmTofTracklet", 100);
264 cout <<
"-I- CbmTofFindTracks::Init:TofTrack array registered" << endl;
273 LOG(info) <<
"CbmTofFindTracks::Init: Hst Output filename = "
282 Bool_t bBeamCounter = kFALSE;
289 "Init found RpcInd %d at Addr 0x%08x, ModType %d, ModId %d, RpcId %d ",
314 LOG(info) <<
"Set CbmTofCalibrator::R0Lim to 2.";
318 LOG(info) << Form(
"BeamCounter to be used in tracking: 0x%08x",
330 LOG(error) <<
"CbmTofFindTracks::LoadCalParameter: "
335 LOG(info) <<
"CbmTofFindTracks::LoadCalParameter: "
338 TH1D* fhtmp = (TH1D*) gDirectory->FindObjectAny(Form(
"hPullT_Smt_Off"));
339 TH1D* fhtmpX = (TH1D*) gDirectory->FindObjectAny(Form(
"hPullX_Smt_Off"));
340 TH1D* fhtmpY = (TH1D*) gDirectory->FindObjectAny(Form(
"hPullY_Smt_Off"));
341 TH1D* fhtmpZ = (TH1D*) gDirectory->FindObjectAny(Form(
"hPullZ_Smt_Off"));
342 TH1D* fhtmpW = (TH1D*) gDirectory->FindObjectAny(Form(
"hPullT_Smt_Width"));
343 TH1D* fhtmpWX = (TH1D*) gDirectory->FindObjectAny(Form(
"hPullX_Smt_Width"));
344 TH1D* fhtmpWY = (TH1D*) gDirectory->FindObjectAny(Form(
"hPullY_Smt_Width"));
345 TH1D* fhtmpWZ = (TH1D*) gDirectory->FindObjectAny(Form(
"hPullZ_Smt_Width"));
350 LOG(info) << Form(
"CbmTofFindTracks::LoadCalParameter: hPullT_Smt_Off")
356 if (NULL == fhtmpX) {
357 LOG(info) << Form(
"CbmTofFindTracks::LoadCalParameter: hPullX_Smt_Off")
363 if (NULL == fhtmpY) {
364 LOG(info) << Form(
"CbmTofFindTracks::LoadCalParameter: hPullY_Smt_Off")
370 if (NULL == fhtmpZ) {
371 LOG(info) << Form(
"CbmTofFindTracks::LoadCalParameter: hPullZ_Smt_Off")
377 if (NULL == fhtmpW) {
378 LOG(info) << Form(
"CbmTofFindTracks::LoadCalParameter: hPullT_Smt_Width")
384 if (NULL == fhtmpWX) {
385 LOG(info) << Form(
"CbmTofFindTracks::LoadCalParameter: hPullX_Smt_Width")
391 if (NULL == fhtmpWY) {
392 LOG(info) << Form(
"CbmTofFindTracks::LoadCalParameter: hPullY_Smt_Width")
398 if (NULL == fhtmpWZ) {
399 LOG(info) << Form(
"CbmTofFindTracks::LoadCalParameter: hPullZ_Smt_Width")
411 new TH1F(Form(
"hPullT_Smt_Off"),
412 Form(
"Tracklet PullT vs RpcInd ; RpcInd ; #DeltaT (ns)"),
419 for (Int_t iDet = 0; iDet < nSmt; iDet++) {
420 std::map<Int_t, Int_t>::iterator it;
423 if (it->second == iDet)
break;
425 LOG(debug1) << Form(
" iDet %d -> iUniqueId ? 0x%08x, 0x%08x ",
429 Int_t iUniqueId = it->first;
438 LOG(info) << Form(
"Initialize det 0x%08x at %d, z=%f with TOff %6.2f",
449 new TH1F(Form(
"hPullT_Smt_Width"),
450 Form(
"Tracklet ResiT Width vs RpcInd ; RpcInd ; RMS(T) (ns)"),
456 for (Int_t iDet = 0; iDet < nSmt; iDet++) {
461 LOG(info) <<
"CbmTofFindTracks::LoadCalParameter: fhPullT_Smt_Off at "
466 new TH1F(Form(
"hPullX_Smt_Off"),
467 Form(
"Tracklet ResiX vs RpcInd ; RpcInd ; #DeltaX (cm)"),
473 new TH1F(Form(
"hPullX_Smt_Width"),
474 Form(
"Tracklet ResiX Width vs RpcInd ; RpcInd ; RMS(X) (cm)"),
479 for (Int_t iDet = 0; iDet < nSmt; iDet++) {
486 new TH1F(Form(
"hPullY_Smt_Off"),
487 Form(
"Tracklet ResiY vs RpcInd ; RpcInd ; #DeltaY (cm)"),
493 new TH1F(Form(
"hPullY_Smt_Width"),
494 Form(
"Tracklet ResiY Width vs RpcInd ; RpcInd ; RMS(Y) (cm)"),
499 for (Int_t iDet = 0; iDet < nSmt; iDet++) {
506 new TH1F(Form(
"hPullZ_Smt_Off"),
507 Form(
"Tracklet ResiZ vs RpcInd ; RpcInd ; #DeltaZ (cm)"),
513 new TH1F(Form(
"hPullZ_Smt_Width"),
514 Form(
"Tracklet ResiZ Width vs RpcInd ; RpcInd ; RMS(Z) (cm)"),
519 for (Int_t iDet = 0; iDet < nSmt; iDet++) {
529 Bool_t isSimulation = kFALSE;
531 if (
k12b > iGeoVersion) {
532 LOG(error) <<
"CbmTofFindTracks::InitParameters => Only compatible with "
533 "geometries after v12b !!!";
537 LOG(info) <<
"CbmTofFindTracks::InitParameters: GeoVersion " << iGeoVersion;
539 switch (iGeoVersion) {
543 LOG(error) <<
"CbmTofFindTracks::InitParameters: Invalid Detector ID "
550 LOG(info) <<
"Create DigiPar ";
557 FairRunAna* ana = FairRunAna::Instance();
558 FairRuntimeDb* rtdb = ana->GetRuntimeDb();
562 rtdb->getContainer(
"FairBaseParSet");
566 rtdb->getContainer(
"CbmGeoTofPar");
570 LOG(info) <<
" CbmTofFindTracks::SetParContainers found "
580 LOG(info) << Form(
"CbmTofFindTracks::WriteHistos: %s, mode = %d",
585 TDirectory* oldir = gDirectory;
588 const Double_t RMSmin = 0.03;
593 TH1D* htmp1D = htmp->ProjectionX();
595 TH1D* hTOff1D = hTOff->ProjectionX();
597 Double_t nx = htmp1D->GetNbinsX();
598 for (Int_t ix = 1; ix < nx; ix++) {
606 fhTOff_HMul2->ProjectionY(Form(
"_py%d", ix), ix + 1, ix + 1,
"");
607 Double_t dFMean = 0.;
608 if (hTOff1DY->GetEntries() > 100) {
610 Int_t iBmax = hTOff1DY->GetMaximumBin();
611 TAxis* xaxis = hTOff1DY->GetXaxis();
613 xaxis->GetBinCenter(iBmax);
614 Double_t dLim = 1000.;
616 hTOff1DY->Fit(
"gaus",
"S",
"", dMean - dLim, dMean + dLim);
617 dFMean = fRes->Parameter(1);
620 LOG(info) <<
"Init TOff " << ix <<
": Old "
622 << hTOff1D->GetBinContent(ix + 1) <<
", FitMean " << dFMean
633 TH1D* htmp1D = htmp->ProjectionX();
635 TH1D* hTOff1D = hTOff->ProjectionX();
638 Double_t nx = htmp1D->GetNbinsX();
639 for (Int_t ix = 0; ix < nx; ix++) {
641 dVal -= htmp1D->GetBinContent(ix + 1);
643 LOG(debug1) <<
"Update hPullT_Smt_Off " << ix <<
": "
645 << htmp1D->GetBinContent(ix + 1) <<
" + "
646 << hTOff1D->GetBinContent(ix + 1) <<
" -> " << dVal;
651 <<
"CbmTofFindTracks::WriteHistos: fhPullT_Smt_Off not found ";
660 TH1D* htmp1D = htmp->ProjectionX();
662 TH1D* hTOff1D = hTOff->ProjectionX();
665 Double_t nx = htmp1D->GetNbinsX();
666 for (Int_t ix = 0; ix < nx; ix++) {
668 dVal -= hTOff1D->GetBinContent(ix + 1);
670 fhTOff_Smt->ProjectionY(Form(
"_py%d", ix), ix + 1, ix + 1,
"");
671 Double_t dFMean = 0.;
672 if (hTOff1DY->GetEntries() > 100) {
674 Int_t iBmax = hTOff1DY->GetMaximumBin();
675 TAxis* xaxis = hTOff1DY->GetXaxis();
677 xaxis->GetBinCenter(iBmax);
678 Double_t dLim = 1.5 * hTOff1DY->GetRMS();
680 hTOff1DY->Fit(
"gaus",
"S",
"", dMean - dLim, dMean + dLim);
681 Int_t iFitStatus = fRes;
682 if (iFitStatus == 0) {
683 dFMean = fRes->Parameter(1);
685 hTOff1D->GetBinContent(ix + 1);
688 LOG(info) <<
"Update hPullT_Smt_Off Ind " << ix <<
": Old "
690 << htmp1D->GetBinContent(ix + 1) <<
", Dev@Peak "
691 << hTOff1D->GetBinContent(ix + 1) <<
", FitMean "
692 << dFMean <<
" -> " << dVal;
694 LOG(debug1) <<
"Update hPullT_Smt_Off " << ix
695 <<
": insufficient counts: " << hTOff1DY->GetEntries();
701 <<
"CbmTofFindTracks::WriteHistos: fhPullT_Smt_Off not found ";
708 TH1D* htmp1D = htmp->ProjectionX();
711 Double_t nx = htmp1D->GetNbinsX();
712 for (Int_t ix = 0; ix < nx; ix++) {
713 TH1D* hpy =
fhPullT_Smt->ProjectionY(
"_py", ix + 1, ix + 1);
714 if (hpy->GetEntries() > 100.) {
715 Int_t iBmax = hpy->GetMaximumBin();
716 TAxis* xaxis = hpy->GetXaxis();
718 xaxis->GetBinCenter(iBmax);
719 Double_t dRMS = TMath::Abs(hpy->GetRMS());
720 Double_t dLim = 1.5 * dRMS;
722 hpy->Fit(
"gaus",
"S",
"", dMean - dLim, dMean + dLim);
723 Double_t dFMean = fRes->Parameter(1);
727 TF1* fg = hpy->GetFunction(
"gaus");
728 Double_t dFMeanError = fg->GetParError(1);
729 LOG(info) <<
"Update hPullT_Smt_Off3 Ind " << ix <<
": "
731 << dFMean <<
", Err " << dFMeanError <<
" -> " << dVal
732 <<
", Width " << dRMS <<
", Chi2 " << fg->GetChisquare();
733 if (dFMeanError < 0.05) {
734 if (dRMS < RMSmin) dRMS = RMSmin;
742 LOG(debug1) <<
"Update hPullT_Smt_Off " << ix
743 <<
": insufficient counts: " << hpy->GetEntries();
748 <<
"CbmTofFindTracks::WriteHistos: fhPullT_Smt_Off not found ";
757 TH1D* htmp1D = htmp->ProjectionX();
760 Double_t nx = htmp1D->GetNbinsX();
761 for (Int_t ix = 0; ix < nx; ix++) {
763 dVal -= htmp1D->GetBinContent(ix + 1);
767 if (dVal > 3.) dVal = 3.;
771 TH1D* hpy =
fhPullX_Smt->ProjectionY(
"_py", ix + 1, ix + 1);
772 if (hpy->GetEntries() > 100.) {
773 Double_t dRMS = TMath::Abs(hpy->GetRMS());
778 LOG(info) <<
"Update hPullX_Smt_Off " << ix <<
": "
780 << htmp1D->GetBinContent(ix + 1) <<
" -> " << dVal
781 <<
", Width " << dRMS;
786 <<
"CbmTofFindTracks::WriteHistos: fhPullX_Smt_Off not found ";
795 TH1D* htmp1D = htmp->ProjectionX();
798 Double_t nx = htmp1D->GetNbinsX();
799 for (Int_t ix = 0; ix < nx; ix++) {
801 dVal -= htmp1D->GetBinContent(ix + 1);
805 TH1D* hpy =
fhPullY_Smt->ProjectionY(
"_py", ix + 1, ix + 1);
806 if (hpy->GetEntries() > 100.) {
807 Double_t dRMS = TMath::Abs(hpy->GetRMS());
812 LOG(debug1) <<
"Update hPullY_Smt_Off " << ix <<
": "
814 << htmp1D->GetBinContent(ix + 1) <<
" -> " << dVal
815 <<
", Width " << dRMS;
820 <<
"CbmTofFindTracks::WriteHistos: fhPullY_Smt_Off not found ";
830 TH1D* htmp1D = htmp->ProjectionX();
833 Double_t nx = htmp1D->GetNbinsX();
834 for (Int_t ix = 0; ix < nx; ix++) {
836 dVal -= htmp1D->GetBinContent(ix + 1);
839 TH1D* hpy =
fhPullZ_Smt->ProjectionY(
"_py", ix + 1, ix + 1);
840 if (hpy->GetEntries() > 100.) {
841 Double_t dRMS = TMath::Abs(hpy->GetRMS());
843 LOG(debug1) <<
"Update hPullZ_Smt_Off " << ix <<
": "
845 << htmp1D->GetBinContent(ix + 1) <<
" -> " << dVal
846 <<
", Width " << dRMS;
847 if (dRMS < 1.5) dRMS = 1.5;
853 <<
"CbmTofFindTracks::WriteHistos: fhPullZ_Smt_Off not found ";
860 for (Int_t iStation = 0;
864 fhPullT_Smt->ProjectionY(
"_py", iStation + 1, iStation + 1);
866 fhPullX_Smt->ProjectionY(
"_py", iStation + 1, iStation + 1);
868 fhPullY_Smt->ProjectionY(
"_py", iStation + 1, iStation + 1);
870 fhPullZ_Smt->ProjectionY(
"_py", iStation + 1, iStation + 1);
872 if (hResidualT->GetEntries() > 100.) {
873 Double_t dRMS = TMath::Abs(hResidualT->GetRMS());
875 if (dRMS < RMSmin) dRMS = RMSmin;
881 if (hResidualX->GetEntries() > 100.) {
882 Double_t dRMS = TMath::Abs(hResidualX->GetRMS());
890 if (hResidualY->GetEntries() > 100.) {
891 Double_t dRMS = TMath::Abs(hResidualY->GetRMS());
899 if (hResidualZ->GetEntries() > 100.) {
900 Double_t dRMS = TMath::Abs(hResidualZ->GetRMS());
902 if (dRMS < 1.5) dRMS = 1.5;
920 TString hname = Form(
"hPull%s_Station_%d",
"TB", iSt);
921 TH1* h1 = (TH1*) gROOT->FindObjectAny(hname);
922 if (h1->GetEntries() > 100) {
923 Double_t dFMean = h1->GetMean();
924 Double_t dFLim = 2.5 * h1->GetRMS();
926 h1->Fit(
"gaus",
"S",
"", dFMean - dFLim, dFMean + dFLim);
927 Double_t dDOff = fRes->Parameter(1);
928 Double_t dSig = fRes->Parameter(2);
932 LOG(info) <<
"Update hPullT_Smt_OffP Ind " << iSt <<
", Ind " << iRpcInd
934 <<
" - " << dDOff <<
" -> " << dVal <<
", Width " << dSig;
940 LOG(info) <<
"CbmTofFindTracks::WriteHistos: Too few entries in histo "
950 for (Int_t iStation = 0;
954 fhPullT_Smt->ProjectionY(
"_py", iStation + 1, iStation + 1);
956 fhPullX_Smt->ProjectionY(
"_py", iStation + 1, iStation + 1);
958 fhPullY_Smt->ProjectionY(
"_py", iStation + 1, iStation + 1);
960 fhPullZ_Smt->ProjectionY(
"_py", iStation + 1, iStation + 1);
961 if (hResidualT->GetEntries() > 100.) {
962 Double_t dRMS = TMath::Abs(hResidualT->GetRMS());
963 if (dRMS < RMSmin) dRMS = RMSmin;
967 if (hResidualX->GetEntries() > 100.) {
968 Double_t dRMS = TMath::Abs(hResidualX->GetRMS());
973 if (hResidualY->GetEntries() > 100.) {
974 Double_t dRMS = TMath::Abs(hResidualY->GetRMS());
979 if (hResidualZ->GetEntries() > 100.) {
980 Double_t dRMS = TMath::Abs(hResidualZ->GetRMS());
981 if (dRMS < 0.1) dRMS = 0.1;
982 if (dRMS > 1.0) dRMS = 1.;
996 gDirectory->cd(oldir->GetPath());
1012 for (Int_t iEvent = 0; iEvent <
fEventsColl->GetEntriesFast(); iEvent++) {
1014 LOG(debug) <<
"Process event " << iEvent <<
" with "
1025 new ((*fTofHitArray)[iNbHits++])
CbmTofHit(*tHit);
1031 for (Int_t iTrk = 0; iTrk <
fTrackArray->GetEntries(); iTrk++) {
1049 for (Int_t iHit = 0; iHit <
fTofHitArray->GetEntries(); iHit++) {
1053 Double_t dSIGX =
GetSigX(iDetId);
1054 if (dSIGX == 0.) dSIGX =
fSIGX;
1055 Double_t dSIGY =
GetSigY(iDetId);
1056 if (dSIGY == 0.) dSIGY =
fSIGY;
1057 Double_t dSIGZ =
GetSigZ(iDetId);
1058 if (dSIGZ == 0.) dSIGZ =
fSIGZ;
1059 TVector3 hitPosErr(dSIGX, dSIGY, dSIGZ);
1062 Double_t dSIGT =
GetSigT(iDetId);
1063 if (dSIGT == 0.) dSIGT =
fSIGT;
1068 if ((iDetId & 0x0000F00F) == 0x00005006)
1071 Double_t dTargetTimeOffset =
1074 + TMath::Power(0.938271998, 2.))
1075 / TMath::Ccgs() * 1.0e09;
1079 TVector3 hitPos(0., 0., 0.);
1083 TVector3 hitPosErr0(1., 1., 1.);
1096 Double_t dSignalPropagationTime =
1107 Double_t dTcor = 0.;
1108 if ((iDetId & 0x0000F00F)
1116 Double_t dXcor = (Double_t)
fhPullX_Smt_Off->GetBinContent(iRpcInd + 1);
1120 Double_t dYcor = (Double_t)
fhPullY_Smt_Off->GetBinContent(iRpcInd + 1);
1124 Double_t dZcor = (Double_t)
fhPullZ_Smt_Off->GetBinContent(iRpcInd + 1);
1133 "Exec found Hit %02d, addr 0x%08x, sta %02d, HM %02d, X %6.2f(%3.2f) Y "
1134 "%6.2f(%3.2f) Z %6.2f(%3.2f) T %6.2f(%3.2f) (%6.2f)",
1150 LOG(debug) << Form(
"CbmTofFindTracks::Exec NStationsFired %d > %d Min ?",
1170 + (
fStop.GetNanoSec() -
fStart.GetNanoSec()) / 1e9;
1172 LOG(debug) << Form(
"CbmTofFindTracks::Exec found %d Tracklets in %f sec",
1192 LOG(info) << Form(
" CbmTofFindTracks::Finished ");
1207 " CbmTofFindTracks::CreateHistograms for %d counters, %d stations ",
1212 Form(
"hTrklMul"), Form(
"Tracklet Multiplicity; MulTracklet"), 100, 0, 100);
1215 Form(
"Reconstructed Hits; Station #"),
1220 Form(
"hAllHitsSmTypes"), Form(
"Reconstructed Hits; SmType #"), 10, 0, 10);
1223 new TH1F(Form(
"hUsedHitsStation"),
1224 Form(
"Used (HMul>2) / Reconstructed Hits; Station #"),
1230 Form(
"Tracklet Chi; HMul_{Tracklet}; #chi"),
1239 Form(
"Tracking Time; NHits; #Deltat (s)"),
1248 Form(
"Tracklet Multiplicity; NHits; NTracklet"),
1257 Form(
"Tracklet Multiplicity; TMulMax; TMulMax-1"),
1265 Form(
"Tracklet Multiplicities; TMul3; TMul4; TMul5"),
1277 new TH2F(Form(
"hTrklHMul"),
1278 Form(
"Tracklet Hit - Multiplicity; HMul_{Tracklet}; Mul_{HMul}"),
1286 new TH2F(Form(
"hTrklZ0xHMul"),
1287 Form(
"Tracklet Z0x vs. Hit - Multiplicity; HMul_{Tracklet}; Z0x"),
1295 new TH2F(Form(
"hTrklZ0yHMul"),
1296 Form(
"Tracklet Z0y vs. Hit - Multiplicity; HMul_{Tracklet}; Z0y"),
1305 new TH2F(Form(
"hTrklTxHMul"),
1306 Form(
"Tracklet Tx vs. Hit - Multiplicity; HMul_{Tracklet}; Tx"),
1315 new TH2F(Form(
"hTrklTyHMul"),
1316 Form(
"Tracklet Ty vs. Hit - Multiplicity; HMul_{Tracklet}; Ty"),
1323 Double_t TTMAX = 0.2;
1325 new TH2F(Form(
"hTrklTtHMul"),
1326 Form(
"Tracklet Tt vs. Hit - Multiplicity; HMul_{Tracklet}; Tt"),
1334 Form(
"hTrklVelHMul"),
1335 Form(
"Tracklet Vel vs. Hit - Multiplicity; HMul_{Tracklet}; v (cm/ns)"),
1343 new TH2F(Form(
"hTrklT0HMul"),
1344 Form(
"Tracklet T0 vs. Hit - Multiplicity; HMul_{Tracklet}; T0"),
1355 "Tracklet #DeltaT0 vs. Trkl - Multiplicity; Mul_{Tracklet}; #Delta(T0)"),
1363 Form(
"hTrklDT0SmMis"),
1364 Form(
"Tracklet DeltaT0 vs. Trkl - ID; SmType_{missed}; #Delta(T0)"),
1372 Form(
"hTrklDT0SmMis2"),
1373 Form(
"Tracklet DeltaT0 vs. Station - ID; St2_{missed}; #Delta(T0)"),
1381 Double_t X0MAX = 40.;
1383 new TH2F(Form(
"hTrklXY0_0"),
1384 Form(
"Tracklet XY at z=0 for hmulmax ; x (cm); y (cm)"),
1392 new TH2F(Form(
"hTrklXY0_1"),
1393 Form(
"Tracklet XY at z=0 for hmulmax-1 ; x (cm); y (cm)"),
1401 new TH2F(Form(
"hTrklXY0_2"),
1402 Form(
"Tracklet XY at z=0 for hmulmax-2 ; x (cm); y (cm)"),
1410 Double_t DT0MAX = 5.;
1413 new TH2F(Form(
"hPullT_Smt"),
1414 Form(
"Tracklet ResiT vs RpcInd ; RpcInd ; #DeltaT (ns)"),
1421 Double_t DX0MAX = 5.;
1423 new TH2F(Form(
"hPullX_Smt"),
1424 Form(
"Tracklet ResiX vs RpcInd ; RpcInd ; #DeltaX (cm)"),
1431 Double_t DY0MAX = 5.;
1433 new TH2F(Form(
"hPullY_Smt"),
1434 Form(
"Tracklet ResiY vs RpcInd ; RpcInd ; #DeltaY (cm)"),
1441 Double_t DZ0MAX = 20.;
1443 new TH2F(Form(
"hPullZ_Smt"),
1444 Form(
"Tracklet ResiZ vs RpcInd ; RpcInd ; #DeltaZ (cm)"),
1453 Form(
"Tracklet TOff; RpcInd ; TOff (ns)"),
1461 Form(
"Tracklet TOff(HMul2); RpcInd ; TOff (ns)"),
1469 Double_t DTTMAX = 0.09;
1471 Form(
"Tracklet DeltaTt; RpcInd ; #DeltaTt (ns/cm)"),
1498 vhPullX[iSt] =
new TH1F(Form(
"hPullX_Station_%d", iSt),
1499 Form(
"hResiX_Station_%d; #DeltaX (cm)", iSt),
1503 vhPullY[iSt] =
new TH1F(Form(
"hPullY_Station_%d", iSt),
1504 Form(
"hResiY_Station_%d; #DeltaY (cm)", iSt),
1508 vhPullZ[iSt] =
new TH1F(Form(
"hPullZ_Station_%d", iSt),
1509 Form(
"hResiZ_Station_%d; #DeltaZ (cm)", iSt),
1513 vhPullT[iSt] =
new TH1F(Form(
"hPullT_Station_%d", iSt),
1514 Form(
"hResiT_Station_%d; #DeltaT (ns)", iSt),
1518 vhPullTB[iSt] =
new TH1F(Form(
"hPullTB_Station_%d", iSt),
1519 Form(
"hResiTB_Station_%d; #DeltaT (ns)", iSt),
1523 const Double_t TOTmax = 50.;
1525 new TH2F(Form(
"hResidualTBWalk_Station_%d", iSt),
1526 Form(
"hResidualTBWalk_Station_%d; #DeltaT (ns)", iSt),
1534 new TH2F(Form(
"hResidualYWalk_Station_%d", iSt),
1535 Form(
"hResidualYWalk_Station_%d; #DeltaT (ns)", iSt),
1542 Double_t XSIZ = 16.;
1546 LOG(fatal) <<
"Geometry for station " << iSt <<
", Rpc "
1552 new TH2F(Form(
"hXY_AllTracks_%d", iSt),
1553 Form(
"hXY_AllTracks_%d; x(cm); y (cm)", iSt),
1561 new TH2F(Form(
"hXY_AllStations_%d", iSt),
1562 Form(
"hXY_AllStations_%d; x(cm); y (cm)", iSt),
1570 new TH2F(Form(
"hXY_MissedStation_%d", iSt),
1571 Form(
"hXY_MissedStation_%d; x(cm); y (cm)", iSt),
1579 new TH3F(Form(
"hXY_DX_%d", iSt),
1580 Form(
"hXY_DX_%d; x(cm); y (cm); #DeltaX (cm)", iSt),
1591 new TH3F(Form(
"hXY_DY_%d", iSt),
1592 Form(
"hXY_DY_%d; x(cm); y (cm); #DeltaY (cm)", iSt),
1603 new TH3F(Form(
"hXY_DT_%d", iSt),
1604 Form(
"hXY_DT_%d; x(cm); y (cm); #DeltaT (ns)", iSt),
1615 new TH3F(Form(
"hXY_TOT_%d", iSt),
1616 Form(
"hXY_TOT_%d; x(cm); y (cm); TOT (a.u.)", iSt),
1626 vhXY_CSZ[iSt] =
new TH3F(Form(
"hXY_CSZ_%d", iSt),
1627 Form(
"hXY_CSZ_%d; x(cm); y (cm); CSZ ()", iSt),
1637 vhUDXDY_DT[iSt] =
new TH3F(Form(
"hUDXDY_DT_%d", iSt),
1638 Form(
"Unused missing hit - DXDY_DT_%d; #Deltax "
1639 "(cm); #Deltay (cm); #DeltaT (ns)",
1650 vhUCDXDY_DT[iSt] =
new TH3F(Form(
"hUCDXDY_DT_%d", iSt),
1651 Form(
"Unused close hit - DXDY_DT_%d; #Deltax "
1652 "(cm); #Deltay (cm); #DeltaT (ns)",
1667 Double_t NNORM = 40.;
1669 Form(
"Vertex Normalisation; #_{TrackletHits}"),
1674 Form(
"Vertex XY at z=0 ; x (xm); y (cm)"),
1682 new TH2F(Form(
"hVTX_DT0_Norm"),
1683 Form(
"Vertex #DeltaT at z=0 ; #_{TrackletHits}; #DeltaT (ns)"),
1703 for (Int_t iTrk = 0; iTrk <
fTrackArray->GetEntries(); iTrk++) {
1705 if (NULL == pTrk)
continue;
1707 LOG(debug1) << Form(
1708 "CbmTofFindTracks::FindVertex: N %3.0f, w %3.0f, min %d",
1728 "CbmTofFindTracks::FindVertex: N %3.0f, T %6.2f, X=%6.2f, Y=%6.2f Z=%6.2f ",
1741 Double_t RefMinTime = 1.E300;
1742 for (Int_t iHit = 0; iHit <
fTofHitArray->GetEntries();
1748 if (pHit->
GetTime() < RefMinTime) {
1750 RefMinTime = pRefHit->
GetTime();
1753 if (pHit->
GetTime() < RefMinTime) {
1755 RefMinTime = pRefHit->
GetTime();
1761 std::vector<Int_t> HMul;
1768 for (Int_t iTrk = 0; iTrk <
fTrackArray->GetEntries(); iTrk++) {
1770 if (NULL == pTrk)
continue;
1772 LOG(error) <<
"CbmTofFindTracks::FillHistograms: more hits ("
1788 for (Int_t iH = 1; iH < pTrk->
GetNofHits(); iH++) {
1793 LOG(debug1) << Form(
"<D> CbmTofFindTracks::FillHistograms: iDetId1 "
1794 "0x%08x, iST1 = %d with dTOff %f at RpcInd %d",
1813 Double_t dTt = pTrk->
GetTt();
1814 LOG(debug) << Form(
"Trk %d info: Lz=%6.2f Z0x=%6.2f Z0y=%6.2f Tt=%6.4f",
1841 if (iH < 0)
continue;
1869 Double_t dTOT = pHit->
GetCh() / 10.;
1873 " St %d Id 0x%08x Hit %2d, Z %6.2f - DX %6.2f, DY %6.2f, Z %6.2f, "
1874 "DT %6.2f, %6.2f, ZZ %6.2f, Tt %6.4f ",
1909 Double_t dDeltaTt = dTt -
fTtTarg;
1913 if (pRefHit != NULL) {
1916 TMath::Sqrt(TMath::Power(pHit->
GetX() - pRefHit->
GetX(), 2)
1917 + TMath::Power(pHit->
GetY() - pRefHit->
GetY(), 2)
1918 + TMath::Power(pHit->
GetZ() - pRefHit->
GetZ(), 2))
1934 for (Int_t iH = 0; iH < pTrk->
GetNofHits(); iH++) {
1939 Int_t iAddr = iChId &
DetMask;
1941 Double_t hitpos[3] = {3 * 0.};
1942 Double_t hitpos_local[3] = {3 * 0.};
1943 gGeoManager->FindNode(
1952 gGeoManager->MasterToLocal(hitpos, hitpos_local);
1957 LOG(debug) <<
"Complete Tracklet in event " <<
fiEvent;
1963 LOG(debug) <<
" Incomplete Tracklet, skip station " << iSt;
1968 Double_t hitpos[3] = {3 * 0.};
1969 Double_t hitpos_local[3] = {3 * 0.};
1975 gGeoManager->FindNode(
1988 gGeoManager->MasterToLocal(hitpos, hitpos_local);
2002 vhXY_DX[iSt]->Fill(hitpos_local[0], hitpos_local[1], dDX);
2003 vhXY_DY[iSt]->Fill(hitpos_local[0], hitpos_local[1], dDY);
2004 vhXY_DT[iSt]->Fill(hitpos_local[0], hitpos_local[1], dDTB);
2005 Double_t dCSZ = ((Double_t)(pHit->
GetFlag() % 100)) * 0.5;
2006 Double_t dTOT = ((Double_t) pHit->
GetCh()) * 0.1
2008 vhXY_TOT[iSt]->Fill(hitpos_local[0], hitpos_local[1], dTOT);
2009 vhXY_CSZ[iSt]->Fill(hitpos_local[0], hitpos_local[1], dCSZ);
2012 if (FairLogger::GetLogger()->IsLogNeeded(fair::Severity::debug)) {
2017 Double_t zPosMiss = -1;
2018 Double_t hitposD[3];
2019 Double_t hitpos_localD[3];
2025 while (zPos != zPosMiss && 0 < NIter--) {
2027 gGeoManager->FindNode(fChannelInfoD->
GetX(),
2028 fChannelInfoD->
GetY(),
2029 fChannelInfoD->
GetZ());
2030 zPos = fChannelInfoD->
GetZ()
2038 hitposD[2] = fChannelInfoD->
GetZ();
2039 gGeoManager->GetCurrentNode();
2040 gGeoManager->MasterToLocal(hitposD, hitpos_localD);
2043 Int_t iChMiss = hitpos_localD[0] / fChannelInfoD->
GetSizex()
2045 if (iChMiss < 0) iChMiss = 0;
2046 if (iChMiss > iNbCh - 1) iChMiss = iNbCh - 1;
2048 if (iChMiss > -1 && iChMiss < iNbCh) {
2057 fChannelInfoMiss->
GetZ()
2060 "Geo consistency check 0x%08x at St%d, z=%7.2f,%7.2f: "
2061 "iChTrafo %d, Miss %d , xloc %6.2f, dx %4.2f",
2075 "Predicted hit in Last Station 0x%08x at local pos x %6.2f, "
2076 "y %6.2f, z %6.2f, cell %p",
2083 "Measured hit in Last Station 0x%08x at local pos x %6.2f, "
2084 "y %6.2f, z %6.2f, cell %p",
2101 if (iAddr < 1)
continue;
2107 LOG(warning) << Form(
"CbmTofFindTracks::FillHistograms: Cell "
2108 "0x%08x not defined for Station %d",
2115 Double_t zPosMiss = -1;
2117 Double_t hitpos_local[3];
2123 while (zPos != zPosMiss && 0 < NIter--) {
2137 gGeoManager->GetCurrentNode();
2138 gGeoManager->MasterToLocal(hitpos, hitpos_local);
2144 if (iChMiss < 0) iChMiss = 0;
2145 if (iChMiss > iNbCh - 1) iChMiss = iNbCh - 1;
2147 if (iChMiss > -1 && iChMiss < iNbCh) {
2156 fChannelInfoMiss->
GetZ()
2160 "Geo consistency check 0x%08x at St%d, z=%7.2f,%7.2f: "
2161 "iChTrafo %d, Miss %d , xloc %6.2f, dx %4.2f",
2176 LOG(debug) << Form(
"Missing hit in Last Station in event %d at "
2177 "local pos x %6.2f, y %6.2f, z %6.2f",
2186 for (Int_t iTrk1 = iTrk + 1; iTrk1 <
fTrackArray->GetEntries();
2190 if (NULL == pTrk1 || pTrk == pTrk1)
continue;
2221 if (HMul.size() > 3)
2223 if (HMul.size() > 5)
2235 LOG(info) <<
"Found " << HMul[6] <<
" max length tracklets in event "
2238 for (Int_t iTrk = 0; iTrk <
fTrackArray->GetEntries(); iTrk++) {
2240 if (NULL == pTrk)
continue;
2246 LOG(info) <<
"Found high multiplicity of " <<
fTrackArray->GetEntries()
2247 <<
" in event " <<
fiEvent <<
" from "
2249 for (Int_t iTrk = 0; iTrk <
fTrackArray->GetEntries(); iTrk++) {
2251 if (NULL == pTrk)
continue;
2258 "CbmTofFindTracks::FillHistograms NTrkl %d(%d) in event %d",
2262 for (Int_t iTrk = 0; iTrk <
fTrackArray->GetEntries(); iTrk++) {
2264 if (NULL == pTrk)
continue;
2268 for (Int_t iTrk1 = iTrk + 1; iTrk1 <
fTrackArray->GetEntries();
2271 if (NULL == pTrk1)
continue;
2283 LOG(debug1) << Form(
"CbmTofFindTracks::FillHistograms: HMul.size() %u ",
2284 (UInt_t) HMul.size());
2285 for (UInt_t uHMul = 2; uHMul < HMul.size(); uHMul++) {
2286 LOG(debug1) << Form(
2287 "CbmTofFindTracks::FillHistograms() HMul %u, #%d", uHMul, HMul[uHMul]);
2288 if (HMul[uHMul] > 0) {
fhTrklHMul->Fill(uHMul, HMul[uHMul]); }
2291 for (Int_t iHit = 0; iHit <
fTofHitArray->GetEntries();
2305 for (Int_t iTrk = 0; iTrk <
fTrackArray->GetEntries(); iTrk++) {
2307 if (NULL == pTrk)
continue;
2325 for (Int_t
i = 0;
i < 10;
i++)
2328 Int_t iSm = ival % 10;
2334 ival = (ival - iSm) / 10;
2342 Int_t iCenterCh = 0;
2359 std::map<Int_t, Int_t>::iterator it;
2362 if (it->second == iAddr)
break;
2378 cout <<
" <I> Tracking station " << it->first <<
" contains RpcId "
2379 << Form(
"0x%08x", it->second) << endl;
2413 LOG(debug2) << Form(
"Station %d, Addr 0x%08x, HMul %d, Max %d, Sum %d",
2431 for (Int_t iHit = 0; iHit <
fTofHitArray->GetEntries(); iHit++) {
2445 for (Int_t iTrk = 0; iTrk <
fTrackArray->GetEntries(); iTrk++) {
2447 if (NULL == pTrk)
continue;
2451 LOG(debug) << Form(
"Test Trk %d with HMul %d for Addr 0x%08x in station %d "
2452 "with dx %5.1f, dy %5.1f, dt %5.1f",
2461 LOG(debug3) <<
"Fill histo " <<
vhUDXDY_DT[iSt]->GetName();
2488 LOG(info) << Form(
"MapRpcIdParInd: %d, 0x%08x ", it->second, it->first);