32#include "FairRootFileSink.h"
33#include "FairRootManager.h"
34#include "FairRunAna.h"
35#include "FairRuntimeDb.h"
38#include "TClonesArray.h"
39#include "TDirectory.h"
42#include "TFitResult.h"
43#include "TGeoManager.h"
83 , fTrackletTools(NULL)
84 , fTofCalibrator(NULL)
86 , fTofHitArrayIn(NULL)
87 , fStsHitArrayIn(NULL)
88 , fMuchHitArrayIn(NULL)
89 , fRichHitArrayIn(NULL)
90 , fTofMatchArrayIn(NULL)
92 , fTofTrackArrayIn(NULL)
93 , fTrackArrayOut(nullptr)
114 , fhMulCorTrkTof(NULL)
115 , fhMulCorTrkSts(NULL)
116 , fhMulCorTrkMuch(NULL)
117 , fhMulCorTrkRich(NULL)
118 , fhPosCorTrkTof(NULL)
119 , fhPosCorTrkSts(NULL)
120 , fhPosCorTrkMuch(NULL)
121 , fhPosCorTrkRich(NULL)
126 , fhTrkStationNHits()
140 , fhExt_TrkSizChiSq()
141 , fhExtSutXY_Found(NULL)
142 , fhExtSutXY_Missed(NULL)
143 , fhExtSutXY_DX(NULL)
144 , fhExtSutXY_DY(NULL)
145 , fhExtSutXY_DT(NULL)
162 , fiCutStationMaxHitMul(1000)
186 FairRootManager* ioman = FairRootManager::Instance();
188 cout <<
"-E- CbmTofExtendTracks::Init: "
189 <<
"RootManager not instantiated!" << endl;
195 fEventsColl =
dynamic_cast<TClonesArray*
>(ioman->GetObject(
"Event"));
198 LOG(fatal) <<
"CbmEvent not found in input file";
206 LOG(fatal) <<
"-W- CbmTofExtendTracks::Init: No TofHit array!";
211 LOG(info) <<
"-I- CbmTofExtendTracks::Init: TofCalHit array!";
217 LOG(fatal) <<
"-W- CbmTofExtendTracks::Init: No TofTrack array!";
224 LOG(warn) <<
"-W- CbmTofExtendTracks::Init: No StsHit array!";
231 LOG(warn) <<
"-W- CbmTofExtendTracks::Init: No MuchHit array!";
238 LOG(warn) <<
"-W- CbmTofExtendTracks::Init: No RichHit array!";
248 LOG(info) <<
"CbmTofExtendTracks initialized";
257 for (uint i = 0; i < NSt; i++)
260 for (uint i = 0; i < NSt; i++)
263 for (uint i = 0; i < NSt; i++)
266 for (uint i = 0; i < NSt; i++)
272 TFile* oldFile = gFile;
273 TDirectory* oldDir = gDirectory;
277 LOG(error) <<
"CbmTofExtendTracks::LoadCalParameter: "
282 LOG(info) <<
"CbmTofExtendTracks::LoadCalParameter: "
285 TH1D* fht = (TH1D*) gDirectory->FindObjectAny(Form(
"hExt_Toff"));
286 TH1D* fhx = (TH1D*) gDirectory->FindObjectAny(Form(
"hExt_Xoff"));
287 TH1D* fhy = (TH1D*) gDirectory->FindObjectAny(Form(
"hExt_Yoff"));
288 TH1D* fhz = (TH1D*) gDirectory->FindObjectAny(Form(
"hExt_Zoff"));
290 TH1D* fhts = (TH1D*) gDirectory->FindObjectAny(Form(
"hExt_Tsig"));
291 TH1D* fhxs = (TH1D*) gDirectory->FindObjectAny(Form(
"hExt_Xsig"));
292 TH1D* fhys = (TH1D*) gDirectory->FindObjectAny(Form(
"hExt_Ysig"));
293 TH1D* fhzs = (TH1D*) gDirectory->FindObjectAny(Form(
"hExt_Zsig"));
301 for (UInt_t iSt = 0; iSt < NSt; iSt++) {
307 for (UInt_t iSt = 0; iSt < NSt; iSt++) {
313 for (UInt_t iSt = 0; iSt < NSt; iSt++) {
319 for (UInt_t iSt = 0; iSt < NSt; iSt++) {
326 for (UInt_t iSt = 0; iSt < NSt; iSt++) {
332 for (UInt_t iSt = 0; iSt < NSt; iSt++) {
338 for (UInt_t iSt = 0; iSt < NSt; iSt++) {
344 for (UInt_t iSt = 0; iSt < NSt; iSt++) {
375 LOG(info) <<
"UpdateCalHist on level " << iLev <<
" from src " <<
fiCorSrc <<
" in mode " << iCorMode;
383 if (NULL != hCorDT) {
384 Double_t nx = hCorDT->GetNbinsX();
386 fhExt_Toff =
new TH1D(
"hExt_Toff",
";station;Toff (ns)", nx, 0, nx);
387 LOG(warn) <<
"Created " <<
fhExt_Toff->GetName();
390 fhExt_Tsig =
new TH1D(
"hExt_Tsig",
";station;Tsig (ns)", nx, 0, nx);
391 LOG(warn) <<
"Created " <<
fhExt_Tsig->GetName();
393 for (Int_t ix = 0; ix < nx; ix++) {
394 Double_t dVal =
fhExt_Toff->GetBinContent(ix + 1);
395 TH1D* hpy = hCorDT->ProjectionY(Form(
"%s_py%d", hCorDT->GetName(), ix), ix + 1, ix + 1,
"");
396 Double_t dFMean = 0.;
397 LOG(warn) <<
"TOff Entries for station " << ix <<
": " << hpy->GetEntries();
398 if (hpy->GetEntries() > 100) {
399 Int_t iBmax = hpy->GetMaximumBin();
400 TAxis* xaxis = hpy->GetXaxis();
401 Double_t dMean = xaxis->GetBinCenter(iBmax);
402 Double_t dLim = 1. * hpy->GetRMS();
410 hpy->Fit(
"gaus",
"SQM",
"", dMean - dLim, dMean + dLim);
411 Int_t iFitStatus = fRes;
414 if (iFitStatus != -1) {
415 dFMean = fRes->Parameter(1);
417 fhExt_Tsig->SetBinContent(ix + 1, fRes->Parameter(2));
421 LOG(warn) <<
"Update hExt_Toff Ind " << ix <<
": Old " <<
fhExt_Toff->GetBinContent(ix + 1)
422 <<
", FitMean " << dFMean <<
" => " << dVal <<
", width "
427 LOG(warn) <<
"Update hExt_Toff " << ix <<
": insufficient counts: " << hpy->GetEntries();
439 if (NULL != hCorDX) {
440 Double_t nx = hCorDX->GetNbinsX();
442 fhExt_Xoff =
new TH1D(
"hExt_Xoff",
";station;Xoff (cm)", nx, 0, nx);
443 LOG(warn) <<
"Created " <<
fhExt_Xoff->GetName();
446 fhExt_Xsig =
new TH1D(
"hExt_Xsig",
";station;Xsig (cm)", nx, 0, nx);
447 LOG(warn) <<
"Created " <<
fhExt_Xsig->GetName();
449 for (Int_t ix = 0; ix < nx; ix++) {
450 Double_t dVal =
fhExt_Xoff->GetBinContent(ix + 1);
451 TH1D* hpy = hCorDX->ProjectionY(Form(
"%s_py%d", hCorDX->GetName(), ix), ix + 1, ix + 1,
"");
452 Double_t dFMean = 0.;
453 LOG(warn) <<
"XOff Entries for station " << ix <<
": " << hpy->GetEntries();
454 if (hpy->GetEntries() > 100) {
455 Int_t iBmax = hpy->GetMaximumBin();
456 TAxis* xaxis = hpy->GetXaxis();
457 Double_t dMean = xaxis->GetBinCenter(iBmax);
459 Double_t dLim = 5. * hpy->GetBinWidth(1);
466 hpy->Fit(
"gaus",
"SQM",
"", dMean - dLim, dMean + dLim);
467 Int_t iFitStatus = fRes;
469 if (iFitStatus != -1) {
470 dFMean = fRes->Parameter(1);
472 fhExt_Xsig->SetBinContent(ix + 1, fRes->Parameter(2));
476 LOG(warn) <<
"Update hExt_Xoff Ind " << ix <<
": Old " <<
fhExt_Xoff->GetBinContent(ix + 1)
477 <<
", FitMean " << dFMean <<
" => " << dVal <<
", width "
482 LOG(warn) <<
"Update hExt_Xoff " << ix <<
": insufficient counts: " << hpy->GetEntries();
494 if (NULL != hCorDY) {
495 Double_t nx = hCorDY->GetNbinsX();
497 fhExt_Yoff =
new TH1D(
"hExt_Yoff",
";station;Yoff (cm)", nx, 0, nx);
498 LOG(warn) <<
"Created " <<
fhExt_Yoff->GetName();
501 fhExt_Ysig =
new TH1D(
"hExt_Ysig",
";station;Ysig (cm)", nx, 0, nx);
502 LOG(warn) <<
"Created " <<
fhExt_Ysig->GetName();
504 for (Int_t ix = 0; ix < nx; ix++) {
505 Double_t dVal =
fhExt_Yoff->GetBinContent(ix + 1);
506 TH1D* hpy = hCorDY->ProjectionY(Form(
"%s_py%d", hCorDY->GetName(), ix), ix + 1, ix + 1,
"");
507 Double_t dFMean = 0.;
508 LOG(warn) <<
"YOff Entries for station " << ix <<
": " << hpy->GetEntries();
509 if (hpy->GetEntries() > 100) {
510 Int_t iBmax = hpy->GetMaximumBin();
511 TAxis* xaxis = hpy->GetXaxis();
512 Double_t dMean = xaxis->GetBinCenter(iBmax);
514 Double_t dLim = 5. * hpy->GetBinWidth(1);
520 LOG(warn) <<
"Fit gaus with " << dMean <<
", " << dLim;
523 hpy->Fit(
"gaus",
"SQM",
"", dMean - dLim, dMean + dLim);
524 Int_t iFitStatus = fRes;
526 if (iFitStatus != -1) {
527 dFMean = fRes->Parameter(1);
529 fhExt_Ysig->SetBinContent(ix + 1, fRes->Parameter(2));
534 LOG(warn) <<
"Update hExt_Yoff Ind " << ix <<
": Old " <<
fhExt_Yoff->GetBinContent(ix + 1)
535 <<
", FitMean " << dFMean <<
" => " << dVal <<
", width "
540 LOG(warn) <<
"Update hExt_Yoff " << ix <<
": insufficient counts: " << hpy->GetEntries();
546 default: LOG(info) <<
"Correction Mode not implemented";
555 TFile* oldFile = gFile;
556 TDirectory* oldDir = gDirectory;
579 LOG(fatal) <<
"Analysis needs EventsColl ";
583 LOG(debug) <<
"ExtExec TS " <<
fiTS <<
" with " <<
fEventsColl->GetEntriesFast() <<
" evts";
585 for (Int_t iEvent = 0; iEvent <
fEventsColl->GetEntriesFast(); iEvent++) {
601 UInt_t iNbTofStations = 0;
602 UInt_t iNbStsStations = 0;
603 UInt_t iNbMuchStations = 0;
604 UInt_t iNbRichStations = 0;
605 const Double_t STATION_TOF_ZWIDTH = 10.;
606 const Double_t STATION_STS_ZWIDTH = 1.5;
607 const Double_t STATION_MUCH_ZWIDTH = 1.;
608 const Double_t STATION_RICH_ZWIDTH = 3.;
614 LOG(debug) <<
"Ev " <<
fiEvent <<
" has hits "
641 LOG(debug) << Form(
"Inspect Ev %d, TofHit %lu, Ind %d at %6.1f in %lu (%u) stations",
fiEvent, iHit, iHitIndex,
644 Int_t iStZ = (Int_t)(tHit->
GetZ() /
dStDZ);
653 LOG(debug) << Form(
"Ev %d, init TofSt %d, Mul %lu at z %8.1f from Ind %d",
fiEvent, iSt,
664 LOG(debug) << Form(
"Ev %d, upd TofSt %d, Mul %lu at z %8.1f from Ind %d",
fiEvent, iSt,
671 if (iSt == iNbTofStations) {
678 LOG(debug) << Form(
"Ev %d, add TofSt %d (%d), Mul %lu at z %8.1f from Ind %d",
fiEvent, iSt, iNbTofStations,
683 LOG(info) <<
"Insert new tracking station " << Int_t(
ECbmModuleId::kTof) * 100 + iSt <<
" at z=" << iStZ;
726 Int_t iStZ = (Int_t)(tHit->
GetZ() /
dStDZ);
735 LOG(debug) << Form(
"Ev %d, init StsSt %d at z %8.1f from Ind %d",
fiEvent, iSt,
fvStsStationZ[iSt],
746 LOG(debug) << Form(
"Ev %d, upd StsSt %d at z %8.1f from Ind %d",
fiEvent, iSt,
fvStsStationZ[iSt],
752 if (iSt == iNbStsStations) {
759 LOG(debug) << Form(
"Ev %d, add StsSt %d (%d) at z %8.1f from Ind %d",
fiEvent, iSt, iNbStsStations,
764 LOG(info) <<
"Insert new tracking station " << Int_t(
ECbmModuleId::kSts) * 100 + iSt <<
" at z=" << iStZ;
802 Int_t iStZ = (Int_t)(tHit->
GetZ() /
dStDZ);
828 if (iSt == iNbMuchStations) {
835 LOG(debug) << Form(
"Ev %d, add MuchSt %d (%d) at z %8.1f from Ind %d",
fiEvent, iSt, iNbMuchStations,
841 LOG(info) <<
"Insert new tracking station " << Int_t(
ECbmModuleId::kMuch) * 100 + iSt <<
" at z=" << iStZ;
861 Double_t Xin = pHit->
GetX();
863 Double_t Xout = pHit->
GetX();
865 if (
fvXoff[iAllSt] != 0.) assert(Xin != Xout);
871 const TVector3 MuchHitError = {0.5, 0.5, 0.5};
876 LOG(info) << Form(
"Proc ev %d, MuchIn St %d, H %d, MpHit: ",
fiEvent, iAllSt, iH) << tHit->
ToString();
881 LOG(warn) <<
"Undefined station for Much ";
896 Int_t iStZ = (Int_t)(tHit->
GetZ() /
dStDZ);
905 LOG(debug) << Form(
"Ev %d, init RichSt %d at z %8.1f from Ind %d",
fiEvent, iSt,
fvRichStationZ[iSt],
922 if (iSt == iNbRichStations) {
929 LOG(debug) << Form(
"Ev %d, add RichSt %d (%d) at z %8.1f from Ind %d",
fiEvent, iSt, iNbRichStations,
935 LOG(info) <<
"Insert new tracking station " << Int_t(
ECbmModuleId::kRich) * 100 + iSt <<
" at z=" << iStZ;
989 for (
size_t iTr = 0; iTr < iNTrks; iTr++) {
998 for (Int_t iHit = 0; iHit < iNHits; iHit++) {
1001 if (NULL == pHitIn) {
1002 LOG(warn) << Form(
"Hit %d not found at index %d ", iHit, iHitInd);
1009 LOG(debug) << Form(
"Added PixHit %d, ind %d: x %6.3f, y %6.3f, z %6.3f, t %9.2f "
1010 ", dx %6.3f, dy %6.3f, dz %6.3f ",
1021 LOG(debug) <<
"CompareTrk " << iTr
1027 while (iAddStations > 0) {
1028 Int_t iAddNextStation = iAddStations % 100;
1029 iAddStations /= 100;
1049 FairRootManager* ioman = FairRootManager::Instance();
1050 TList* tList = gROOT->GetList();
1052 ((FairRootFileSink*) ioman->GetSink())->GetRootFile()->cd();
1056 while ((obj = (TObject*) next())) {
1057 if (obj->InheritsFrom(TH1::Class())) obj->Write();
1062 LOG(info) << Form(
" CbmTofExtendTracks::Finished ");
1069 TDirectory* oldir = gDirectory;
1076 new TH2F(
"hMulCorTrkTof", Form(
"Multiplicity correlation ; N_{Track}; N_{TofHits}"), 50, 0, 50, 150, 0, 150);
1079 new TH2F(
"hMulCorTrkSts", Form(
"Multiplicity correlation ; N_{Track}; N_{StsHits}"), 50, 0, 50, 150, 0, 150);
1081 new TH2F(
"hMulCorTrkMuch", Form(
"Multiplicity correlation ; N_{Track}; N_{MuchHits}"), 50, 0, 50, 150, 0, 150);
1083 new TH2F(
"hMulCorTrkRich", Form(
"Multiplicity correlation ; N_{Track}; N_{RichHits}"), 50, 0, 50, 150, 0, 150);
1084 fhPosCorTrkTof =
new TH2F(
"hPosCorTrkTof", Form(
"Tof position correlation ; #DeltaX (cm); #DeltaY (cm)"), 100, -10,
1086 fhPosCorTrkSts =
new TH2F(
"hPosCorTrkSts", Form(
"Sts position correlation ; #DeltaX (cm); #DeltaY (cm)"), 100, -10,
1088 fhPosCorTrkMuch =
new TH2F(
"hPosCorTrkMuch", Form(
"Much position correlation ; #DeltaX (cm); #DeltaY (cm)"), 100,
1089 -10, 10, 100, -10, 10);
1090 fhPosCorTrkRich =
new TH2F(
"hPosCorTrkRich", Form(
"Rich position correlation ; #DeltaX (cm); #DeltaY (cm)"), 100,
1091 -10, 10, 100, -10, 10);
1096 LOG(info) <<
"Book histos for the following stations: ";
1121 for (Int_t iLev = 0; iLev < NLev; iLev++) {
1122 fhExt_TrkSizVel[iLev] =
new TH2F(Form(
"hExt_TrkSizVel%d", iLev),
";TrkSize;v (cm/ns)", 15, 0, 15, 100, 0., 50.);
1123 fhExt_TrkSizChiSq[iLev] =
new TH2F(Form(
"hExt_TrkSizChiSq%d", iLev),
";TrkSize;#chi^2", 15, 0, 15, 50, 0., 5.);
1125 fhTrkStationDX[iLev] =
new TH2F(Form(
"hTrkStationDX%d", iLev), Form(
"TrkStationDX; StationNr ; #DeltaX (cm)"), NSt,
1126 0, NSt, 100, -10., 10.);
1127 fhTrkStationDY[iLev] =
new TH2F(Form(
"hTrkStationDY%d", iLev), Form(
"TrkStationDY; StationNr ; #DeltaY (cm)"), NSt,
1128 0, NSt, 100, -10., 10.);
1129 fhTrkStationDZ[iLev] =
new TH2F(Form(
"hTrkStationDZ%d", iLev), Form(
"TrkStationDZ; StationNr ; #DeltaZ (cm)"), NSt,
1130 0, NSt, 100, -20., 20.);
1131 fhTrkStationDT[iLev] =
new TH2F(Form(
"hTrkStationDT%d", iLev), Form(
"TrkStationDT; StationNr ; #DeltaT (ns)"), NSt,
1132 0, NSt, 100, -50., 50.);
1134 new TH2F(Form(
"hTrkStationNHits%d", iLev), Form(
"TrkStationNHits; StationNr ; Number of Hits"), NSt, 0, NSt, 100,
1138 new TH2F(Form(
"hTrkPullDX%d", iLev), Form(
"TrkPullDX; StationNr ; #DeltaX (cm)"), NSt, 0, NSt, 100, -10., 10.);
1140 new TH2F(Form(
"hTrkPullDY%d", iLev), Form(
"TrkPullDY; StationNr ; #DeltaY (cm)"), NSt, 0, NSt, 100, -10., 10.);
1142 new TH2F(Form(
"hTrkPullDT%d", iLev), Form(
"TrkPullDT; StationNr ; #DeltaT (ns)"), NSt, 0, NSt, 100, -50., 50.);
1145 for (UInt_t iSt = 0; iSt < NSt; iSt++) {
1146 fhTrkStationDXDY[iLev][iSt] =
new TH2F(Form(
"hTrkPosCor%d_St%d", iLev, iSt),
1147 Form(
"Lev%d-St%d position correlation ; "
1148 "#DeltaX (cm); #DeltaY (cm)",
1150 100, -10, 10, 100, -10, 10);
1159 LOG(info) <<
"Create SUT histos for station " <<
fiStationUT <<
" at distance " <<
dSUT_z;
1160 const Double_t dSUT_RefDx = 0.15;
1161 const Double_t dSUT_RefDy = 0.3;
1162 const Double_t dNbinX = 100;
1163 const Double_t dNbinY = 100;
1164 const Double_t dNbinZ = 50;
1166 Double_t dSUT_dx = dSUT_RefDx *
dSUT_z;
1167 Double_t dSUT_dy = dSUT_RefDy *
dSUT_z;
1169 new TH2F(
"hExtSutXY_Found", Form(
"StationUnderTest %d found hits ; X (cm); Y (cm)",
fiStationUT), dNbinX,
1170 -dSUT_dx, dSUT_dx, dNbinY, -dSUT_dy, dSUT_dy);
1172 new TH2F(
"hExtSutXY_Missed", Form(
"StationUnderTest %d missed hits ; X (cm); Y (cm)",
fiStationUT), dNbinX,
1173 -dSUT_dx, dSUT_dx, dNbinY, -dSUT_dy, dSUT_dy);
1175 new TH3F(
"hExtSutXY_DX", Form(
"StationUnderTest %d #DeltaX ; X (cm); Y (cm); #DeltaX (cm)",
fiStationUT),
1176 dNbinX, -dSUT_dx, dSUT_dx, dNbinY, -dSUT_dy, dSUT_dy, dNbinZ, -10., 10.);
1178 new TH3F(
"hExtSutXY_DY", Form(
"StationUnderTest %d #DeltaY ; X (cm); Y (cm); #DeltaY (cm)",
fiStationUT),
1179 dNbinX, -dSUT_dx, dSUT_dx, dNbinY, -dSUT_dy, dSUT_dy, dNbinZ, -10., 10.);
1181 new TH3F(
"hExtSutXY_DT", Form(
"StationUnderTest %d #DeltaT ; X (cm); Y (cm); #DeltaT (ns)",
fiStationUT),
1182 dNbinX, -dSUT_dx, dSUT_dx, dNbinY, -dSUT_dy, dSUT_dy, dNbinZ, -50., 50.);
1186 gDirectory->cd(oldir->GetPath());
1198 Int_t fMinNofHits = 3;
1202 if (NULL == pTrk)
continue;
1205 if (w > (Double_t) fMinNofHits) {
1218 LOG(debug) << Form(
"CbmTofExtendTracks::FindVertex: N %3.0f, T %6.2f, "
1219 "X=%6.2f, Y=%6.2f Z=%6.2f ",
1227 while (iAddStations > 0) {
1228 Int_t iAddNextStation = iAddStations % 100;
1229 iAddStations /= 100;
1250 for (Int_t iTr = 0; iTr < NTrkTof; iTr++) {
1260 for (UInt_t iHit = 0; iHit <
fvTofHitIndex[iSt].size(); iHit++) {
1263 LOG(warn) << Form(
"Invalid TofHit %d(%lu) ind %d in station %d(%lu)", iHit,
fvTofHitIndex[iSt].
size(),
1268 if (iTrSt < 0 || iTrSt >= (Int_t)
fMapStationZ.size()) {
1269 LOG(error) <<
"Invalid station index " << iTrSt;
1291 for (UInt_t iHit = 0; iHit <
fvStsHitIndex[iSt].size(); iHit++) {
1294 LOG(warn) << Form(
"Invalid StsHit %d(%lu) ind %d in station %d(%lu)", iHit,
fvStsHitIndex[iSt].
size(),
1318 for (UInt_t iHit = 0; iHit <
fvMuchHitIndex[iSt].size(); iHit++) {
1321 LOG(warn) << Form(
"Invalid MuchHit %d(%lu) ind %d in station %d(%lu)", iHit,
fvMuchHitIndex[iSt].
size(),
1327 LOG(info) << Form(
"Proc ev %d, Trk %d, St %d, iLe%d MtHit: ",
fiEvent, iTr, iTrSt, iLev) << tHit->
ToString();
1343 LOG(info) << Form(
"Proc ev %d, Trk %d, St %d, iLe%d, DX %6.3f, dY %6.3f, MtHit: ",
fiEvent, iTr, iTrSt, iLev,
1358 for (UInt_t iHit = 0; iHit <
fvRichHitIndex[iSt].size(); iHit++) {
1361 LOG(warn) << Form(
"Invalid RichHit %d(%lu) ind %d in station %d(%lu)", iHit,
fvRichHitIndex[iSt].
size(),
1389 if (NTrkTof < 0) NTrkTof = 0;
1390 assert(NTrk == (UInt_t) NTrkTof);
1392 for (UInt_t iTr = 0; iTr < NTrk; iTr++) {
1396 for (UInt_t iH = 0; iH <
fvTrkCalHits[iTr].size(); iH++) {
1404 Int_t iReqStation = 0;
1405 while (iReqStations > 0) {
1406 iReqStation = iReqStations % 100;
1411 iReqStations /= 100;
1412 for (; iHit > 0; iHit--)
1420 if (iReqStation != 0 && iHit == 0)
break;
1424 if (iReqStation != 0 && iHit == 0)
continue;
1438 Bool_t bSUT_Found = kFALSE;
1439 for (UInt_t iHit = 0; iHit <
fvTrkCalHits[iTr].size(); iHit++) {
1473 LOG(debug) << Form(
"Proc ev %d, Trk %d, St %d, Lev%d, DX %6.3f, dY %6.3f, MtHit: ",
fiEvent, iTr, iTrSt, 0, dDX,
1478 if (bSUT_Found == kFALSE) {
1483 for (UInt_t iSt = 0; iSt < NSt; iSt++) {
1502 LOG(debug) << Form(
"Proc ev %d, Trk %d, St %d, Lev%d, DX %6.3f, dY %6.3f, MtHit: ",
fiEvent, iTr, iSt, iLev,
1520 TGraph2DErrors*
gr =
new TGraph2DErrors();
1523 for (UInt_t N = 0; N < pHits.size(); N++) {
1525 x = pHits[N]->GetX();
1526 y = pHits[N]->GetY();
1527 z = pHits[N]->GetZ();
1528 gr->SetPoint(N,
x,
y, z);
1529 double dx, dy, dz = 0.;
1530 dx = pHits[N]->GetDx();
1531 dy = pHits[N]->GetDy();
1532 dz = pHits[N]->GetDz();
1533 gr->SetPointError(N, dx, dy, dz);
1534 LOG(debug) <<
"Line3Dfit add N = " << N <<
",\t" <<
x <<
",\t" <<
y <<
",\t" << z <<
",\t" << dx <<
",\t" << dy
1539 Double_t pStart[4] = {0., 0., 0., 0.};
1540 pStart[0] = pTrkPar->
GetX();
1541 pStart[1] = pTrkPar->
GetTx();
1542 pStart[2] = pTrkPar->
GetY();
1543 pStart[3] = pTrkPar->
GetTy();
1544 LOG(debug) <<
"Line3Dfit init: X0 " << pStart[0] <<
", TX " << pStart[1] <<
", Y0 " << pStart[2] <<
", TY "
1552 LOG(debug) <<
"Line3Dfit result(" << pHits.size() <<
") " << gMinuit->fCstatu <<
" : X0 "
1553 << Form(
" %7.4f, TX %7.4f, Y0 %7.4f, TY %7.4f, Chi2DoF %7.4f ", dRes[0], dRes[1], dRes[2], dRes[3],
1556 pTrkPar->
SetX(dRes[0]);
1557 pTrkPar->
SetY(dRes[2]);
1559 pTrkPar->
SetTx(dRes[1]);
1560 pTrkPar->
SetTy(dRes[3]);
1567 return fTrkPar->
GetX() + fTrkPar->
GetTx() * (dZ - fTrkPar->
GetZ());
1572 return fTrkPar->
GetY() + fTrkPar->
GetTy() * (dZ - fTrkPar->
GetZ());
1577 return fTrkPar->
GetT()
1578 + fTrkPar->
GetTt() * (dZ - fTrkPar->
GetZ())
1585 LOG(debug) <<
"Add " <<
fvAllHitPointer[iStation].size() <<
" hits from station " << iStation <<
" to "
1588 const Int_t NCand = 100;
1590 Double_t tSIGX = 1.;
1591 Double_t tSIGY = 1.;
1592 Double_t tSIGT = 1000.;
1594 Double_t MatchChi2Min[NCand] = {NCand *
fdChi2Max};
1595 Int_t MatchHit[NCand] = {NCand * -1};
1596 Int_t MatchTrk[NCand] = {NCand * -1};
1599 for (UInt_t iTr = 0; iTr < NTr; iTr++) {
1600 for (UInt_t iHit = 0; iHit <
fvAllHitPointer[iStation].size(); iHit++) {
1602 LOG(debug) <<
" Hit " << iHit <<
": X " << tHit->
GetX() <<
", Y " << tHit->
GetY() <<
", Z " << tHit->
GetZ()
1604 Double_t MatchChi2 =
1609 LOG(debug) <<
"Match Tr " << iTr <<
", Hit " << iHit <<
": " << MatchChi2;
1612 for (; iCand < iMatch + 1; iCand++) {
1613 if (MatchChi2 < MatchChi2Min[iCand]) {
1614 LOG(debug) <<
"Better Match found for iTr " << iTr <<
" Chi2 " << MatchChi2;
1615 for (Int_t i = iMatch - 1; i >= iCand; i--) {
1616 MatchChi2Min[i + 1] = MatchChi2Min[i];
1617 MatchHit[i + 1] = MatchHit[i];
1618 MatchTrk[i + 1] = MatchTrk[i];
1620 MatchChi2Min[iCand] = MatchChi2;
1621 MatchHit[iCand] = (Int_t) iHit;
1622 MatchTrk[iCand] = (Int_t) iTr;
1627 if (iMatch == NCand) iMatch--;
1628 LOG(debug) <<
"New Match " << iMatch <<
" stored as candidate " << iCand <<
" for Tr " << iTr <<
" with hit "
1635 for (Int_t iCand = 0; iCand < iMatch; iCand++) {
1636 if (MatchHit[iCand] > -1) {
1648 for (Int_t i = iCand + 1; i < iMatch; i++) {
1649 if (MatchHit[i] == MatchHit[iCand] || MatchTrk[i] == MatchTrk[iCand]) MatchHit[i] = -1;
1653 fvTrkPar[MatchTrk[iCand]]->SetY(0.);
@ kTof
Time-of-flight Detector.
@ kSts
Silicon Tracking System.
@ kMuch
Muon detection system.
@ kRich
Ring-Imaging Cherenkov Detector.
TClonesArray * fEventsColl
ClassImp(CbmTofExtendTracks)
Data class for track parameters.
static constexpr size_t size()
Class characterising one event by a collection of links (indices) to data objects,...
size_t GetNofData() const
uint32_t GetIndex(ECbmDataType type, uint32_t iData)
void SetTime(double time)
virtual std::string ToString() const
Inherited from CbmBaseHit.
void SetPositionError(const TVector3 &dpos)
std::vector< Double_t > fvZsig
std::vector< Double_t > fvStsStationZ
std::vector< Double_t > fvXsig
std::vector< Double_t > fvToff
virtual void Line3Dfit(std::vector< CbmPixelHit * >, CbmTofTrackletParam *)
virtual InitStatus Init()
std::vector< Double_t > fvMuchStationZ
std::vector< CbmTofTrackletParam * > fvTrkPar
std::vector< std::vector< CbmPixelHit * > > fvTrkCalHits
virtual void CreateHistograms()
virtual void TrkAddStation(Int_t iStation)
std::vector< TH2 * > fhTrkStationDY
Int_t fiCutStationMaxHitMul
virtual void ExecExtend(Option_t *opt, CbmEvent *tEvent=NULL)
std::map< Int_t, Int_t >::iterator itMapStationZ
std::vector< TH2 * > fhTrkPullDY
std::vector< TH2 * > fhTrkStationDT
std::vector< TH2 * > fhTrkPullDX
std::vector< std::vector< TH2 * > > fhTrkStationDXDY
virtual void FillHistograms(CbmEvent *tEvent=NULL)
std::vector< std::vector< CbmPixelHit * > > fvAllHitPointer
std::vector< std::vector< Int_t > > fvTofHitIndex
std::vector< Double_t > fvXoff
TClonesArray * fMuchHitArrayIn
std::vector< Double_t > fvTofStationZ
TClonesArray * fTofHitArrayIn
std::vector< TH2 * > fhTrkStationNHits
Double_t GetFitY(Double_t, CbmTofTrackletParam *)
std::vector< Double_t > fvTsig
virtual void SetParContainers()
std::vector< Double_t > fvYsig
std::vector< TH2 * > fhTrkStationDX
std::map< Int_t, Int_t > fMapStationZ
TClonesArray * fTofTrackArrayIn
virtual ~CbmTofExtendTracks()
TClonesArray * fRichHitArrayIn
std::vector< TH2 * > fhTrkPullDT
Double_t GetFitT(Double_t, CbmTofTrackletParam *)
std::vector< TH2 * > fhExt_TrkSizVel
Bool_t LoadCalParameter()
Double_t GetFitX(Double_t, CbmTofTrackletParam *)
std::vector< std::vector< Int_t > > fvMuchHitIndex
std::vector< Double_t > fvYoff
virtual void FindVertex()
static CbmTofExtendTracks * fInstance
TClonesArray * fStsHitArrayIn
TClonesArray * fEventsColl
std::vector< Double_t > fvRichStationZ
std::vector< Double_t > fvZoff
CbmTofTrackletTools * fTrackletTools
std::vector< std::vector< Int_t > > fvRichHitIndex
std::vector< TH2 * > fhExt_TrkSizChiSq
std::vector< std::vector< Int_t > > fvStsHitIndex
std::vector< TH2 * > fhTrkStationDZ
virtual void Exec(Option_t *opt)
Provides information on attaching a TofHit to a TofTrack.
int32_t GetTofHitIndex(int32_t ind) const
double GetTrackTx() const
int32_t GetNofHits() const
double GetTrackTy() const
CbmTofTrackletParam * GetTrackParameter()
int DoFit(TGraph2DErrors *gr, double pStart[])