CbmRoot
CbmTofFindTracks.cxx
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- CbmTofFindTracks source file -----
3 // ----- Created 25/04/15 by N. Herrmann -----
4 // ----- initially following CbmTrdFindTracks -----
5 // -------------------------------------------------------------------------
6 
7 #include "CbmTofFindTracks.h"
8 #include "CbmTofAddress.h" // in cbmdata/tof
9 
10 #include "CbmEvent.h"
11 #include "CbmMatch.h"
12 #include "CbmTofCalibrator.h"
13 #include "CbmTofCell.h" // in tof/TofData
14 #include "CbmTofCreateDigiPar.h" // in tof/TofTools
15 #include "CbmTofDetectorId_v12b.h" // in cbmdata/tof
16 #include "CbmTofDetectorId_v14a.h" // in cbmdata/tof
17 #include "CbmTofDigiBdfPar.h" // in tof/TofParam
18 #include "CbmTofDigiPar.h" // in tof/TofParam
19 #include "CbmTofGeoHandler.h" // in tof/TofTools
20 #include "CbmTofHit.h"
21 #include "CbmTofTrackFinder.h"
22 #include "CbmTofTrackFinderNN.h"
23 #include "CbmTofTrackFitter.h"
24 #include "CbmTofTracklet.h"
25 #include "CbmTofTrackletTools.h"
26 #include "CbmVertex.h"
27 
28 #include "FairLogger.h"
29 #include "FairRootManager.h"
30 #include "FairRunAna.h"
31 #include "FairRuntimeDb.h"
32 
33 #include "TClonesArray.h"
34 #include "TDirectory.h"
35 #include "TF1.h"
36 #include "TFile.h"
37 #include "TFitResult.h"
38 #include "TGeoManager.h"
39 #include "TH1.h"
40 #include "TH2.h"
41 #include "TH3.h"
42 #include "TMath.h"
43 #include "TProfile.h"
44 #include "TROOT.h"
45 #include "TRandom.h"
46 #include "TString.h"
47 
48 #include <iostream>
49 #include <vector>
50 
51 using std::cout;
52 using std::endl;
53 using std::vector;
54 
55 const Int_t DetMask = 0x3FFFFF; // check for consistency with geometry
56 
58 
60 
61 // ----- Default constructor -------------------------------------------
63  : CbmTofFindTracks::CbmTofFindTracks("TofFindTracks", "Main", NULL) {
64  if (!fInstance) fInstance = this;
65 }
66 // -------------------------------------------------------------------------
67 
68 
69 // ----- Standard constructor ------------------------------------------
71  const char* /*title*/,
72  CbmTofTrackFinder* finder)
73  : FairTask(name)
74  , fFinder(finder)
75  , fFitter(NULL)
76  , fTrackletTools(NULL)
77  , fTofCalibrator(NULL)
78  , fEventsColl(NULL)
79  , fTofHitArrayIn(NULL)
80  , fTofMatchArrayIn(NULL)
81  , fTofHitArray(NULL)
82  , fTrackArray(NULL)
83  , fTrackArrayOut(nullptr)
84  , fTofUHitArray(NULL)
85  , fMinNofHits(-1)
86  , fNofTracks(-1)
87  , fNTofStations(-1)
88  , fNReqStations(-1)
89  , fInspectEvent(kTRUE)
90  , fStationType()
91  , fStationHMul()
92  , fRpcAddr()
93  , fMapStationRpcId()
94  , fMapRpcIdParInd()
95  , fhTrklMul(NULL)
96  , fhTrklChi2(NULL)
97  , fhAllHitsStation(NULL)
98  , fhAllHitsSmTypes(NULL)
99  , fhUsedHitsStation(NULL)
100  , fhTrackingTimeNhits(NULL)
101  , fhTrklMulNhits(NULL)
102  , fhTrklMulMaxMM(NULL)
103  , fhTrklMul3D(NULL)
104  , fhTrklHMul(NULL)
105  , fhTrklZ0xHMul(NULL)
106  , fhTrklZ0yHMul(NULL)
107  , fhTrklTxHMul(NULL)
108  , fhTrklTyHMul(NULL)
109  , fhTrklTtHMul(NULL)
110  , fhTrklVelHMul(NULL)
111  , fhTrklT0HMul(NULL)
112  , fhTrklT0Mul(NULL)
113  , fhTrklDT0SmMis(NULL)
114  , fhTrklDT0StMis2(NULL)
115  , fhTrklXY0_0(NULL)
116  , fhTrklXY0_1(NULL)
117  , fhTrklXY0_2(NULL)
118  , vhPullX()
119  , vhPullY()
120  , vhPullZ()
121  , vhPullT()
122  , vhPullTB()
123  , vhResidualTBWalk()
124  , vhResidualYWalk()
125  , vhXY_AllTracks()
126  , vhXY_AllStations()
127  , vhXY_MissedStation()
128  , vhXY_DX()
129  , vhXY_DY()
130  , vhXY_DT()
131  , vhXY_TOT()
132  , vhXY_CSZ()
133  , vhUDXDY_DT()
134  , vhUCDXDY_DT()
135  , fhVTXNorm(NULL)
136  , fhVTX_XY0(NULL)
137  , fhVTX_DT0_Norm(NULL)
138  , fOutHstFileName("")
139  , fCalParFileName("")
140  , fCalOutFileName("./tofFindTracks.hst.root")
141  , fCalParFile(NULL)
142  , fhPullT_Smt(NULL)
143  , fhPullT_Smt_Off(NULL)
144  , fhPullX_Smt(NULL)
145  , fhPullX_Smt_Off(NULL)
146  , fhPullY_Smt(NULL)
147  , fhPullY_Smt_Off(NULL)
148  , fhPullZ_Smt(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)
154  , fhTOff_Smt(NULL)
155  , fhTOff_Smt_Off(NULL)
156  , fhDeltaTt_Smt(NULL)
157  , fhTOff_HMul2(NULL)
158  , fiCorMode(0)
159  , fiBeamCounter(-1)
160  , fiStationMaxHMul(1000)
161  , fTtTarg(30.)
162  , fVTXNorm(0.)
163  , fVTX_T(0.)
164  , fVTX_X(0.)
165  , fVTX_Y(0.)
166  , fVTX_Z(0.)
167  , fT0MAX(0.5)
168  , fiEvent(0)
170  , fTofId(NULL)
171  , fDigiPar(NULL)
172  , fDigiBdfPar(NULL)
173  , fSIGT(0.1)
174  , fSIGX(1.)
175  , fSIGY(1.)
176  , fSIGZ(1.)
177  , fbUseSigCalib(kTRUE)
178  , fdRefVelMean(0.)
179  , fdRefDVel(1.E7)
180  , fStart()
181  , fStop()
182  , fdTrackingTime(0.)
183  , fdBeamMomentumLab(0.)
184  , fbRemoveSignalPropagationTime(kFALSE)
185  , fiBeamMaxHMul(1000)
186  , fiCalOpt(0) {
187  if (!fInstance) fInstance = this;
188 }
189 // -------------------------------------------------------------------------
190 
191 
192 // ----- Destructor ----------------------------------------------------
194  if (fInstance == this) fInstance = 0;
195  fTrackArray->Delete();
196 }
197 // -------------------------------------------------------------------------
198 
199 
200 // ----- Public method Init (abstract in base class) --------------------
202 
203  // Check for Track finder
204  if (!fFinder) {
205  cout << "-W- CbmTofFindTracks::Init: No track finder selected!" << endl;
206  return kERROR;
207  }
208 
209  // Check for Track fitter
210  if (!fFitter) {
211  cout << "-W- CbmTofFindTracks::Init: No track fitter selected!" << endl;
212  return kERROR;
213  }
214  cout << Form("-D- CbmTofFindTracks::Init: track fitter at 0x%p", fFitter)
215  << endl;
216 
217  fTrackletTools = new CbmTofTrackletTools(); // initialize tools
218 
219  // Get and check FairRootManager
220  FairRootManager* ioman = FairRootManager::Instance();
221  if (!ioman) {
222  cout << "-E- CbmTofFindTracks::Init: "
223  << "RootManager not instantiated!" << endl;
224  return kFATAL;
225  }
226 
227  ioman->InitSink();
228 
229  fEventsColl = dynamic_cast<TClonesArray*>(ioman->GetObject("Event"));
230  if (!fEventsColl)
231  fEventsColl = dynamic_cast<TClonesArray*>(ioman->GetObject("CbmEvent"));
232  if (!fEventsColl) {
233  LOG(info) << "CbmEvent not found in input file, assume eventwise input";
234  } else {
235  fTofHitArray = new TClonesArray("CbmTofHit");
236  }
237 
238  // Get TOF hit Array
239  fTofHitArrayIn = (TClonesArray*) ioman->GetObject("TofHit");
240  if (!fTofHitArrayIn) {
241  LOG(fatal) << "-W- CbmTofFindTracks::Init: No TofHit array!";
242  return kERROR;
243  }
244 
245  // Get TOF hit Array
246  fTofMatchArrayIn = (TClonesArray*) ioman->GetObject("TofCalDigiMatch");
247  if (!fTofMatchArrayIn) {
248  LOG(fatal) << "CbmTofFindTracks::Init: No TofDigiMatch array!";
249  return kERROR;
250  }
251 
252  // Create and register output TofTrack array
253  fTrackArray = new TClonesArray("CbmTofTracklet", 100);
254  fTofUHitArray = new TClonesArray("CbmTofHit", 100);
255  //fTrackArray->BypassStreamer(kTRUE); //needed?
256  //ioman->Register("TofTracks", "TOF", fTrackArray, kFALSE); //FIXME
257  if (fEventsColl) {
258  fTrackArrayOut = new TClonesArray("CbmTofTracklet", 100);
259  ioman->Register(
260  "TofTracks", "TOF", fTrackArrayOut, kTRUE); //FIXME, does not work !
261  } else {
262  ioman->Register(
263  "TofTracks", "TOF", fTrackArray, kTRUE); //FIXME, does not work !
264  cout << "-I- CbmTofFindTracks::Init:TofTrack array registered" << endl;
265 
266  // Create and register TofUHit array for unused Hits
267  ioman->Register("TofUHit", "TOF", fTofUHitArray, kFALSE);
268  }
269  // Call the Init method of the track finder
270  fFinder->Init();
271 
272  if (fOutHstFileName == "") { fOutHstFileName = "./FindTofTracks.hst.root"; }
273  LOG(info) << "CbmTofFindTracks::Init: Hst Output filename = "
274  << fOutHstFileName;
275 
276  if (kFALSE == InitParameters()) return kFATAL;
277 
278  // default parameters
279  // if (fMinNofHits < 1) fMinNofHits=1;
280 
281  //fill RpcId - map
282  Bool_t bBeamCounter = kFALSE;
283  Int_t iRpc = 0;
284  for (Int_t iCell = 0; iCell < fDigiPar->GetNrOfModules(); iCell++) {
285  Int_t iCellId = fDigiPar->GetCellId(iCell);
286  Int_t iCh = fTofId->GetCell(iCellId);
287  if (0 == iCh) {
288  LOG(info) << Form(
289  "Init found RpcInd %d at Addr 0x%08x, ModType %d, ModId %d, RpcId %d ",
290  iRpc,
291  iCellId,
292  fTofId->GetSMType(iCellId),
293  fTofId->GetSModule(iCellId),
294  fTofId->GetCounter(iCellId));
295  if (fTofId->GetSMType(iCellId) == 5) bBeamCounter = kTRUE;
296  fMapRpcIdParInd[iCellId] = iRpc;
297  fRpcAddr.resize(fRpcAddr.size() + 1);
298  fRpcAddr.push_back(iCellId);
299  iRpc++;
300  }
301  }
302  fStationHMul.resize(fNTofStations + 1);
303 
304 
306 
308 
309  if (fiCalOpt > 0) {
311  if (fTofCalibrator->Init() != kSUCCESS) return kFATAL;
312  if (bBeamCounter) {
313  fTofCalibrator->SetR0Lim(2.); // FIXME, hardwired parameter for debugging
314  LOG(info) << "Set CbmTofCalibrator::R0Lim to 2.";
315  }
316  }
317 
318  LOG(info) << Form("BeamCounter to be used in tracking: 0x%08x",
319  fiBeamCounter);
320 
321  return kSUCCESS;
322 }
323 // -------------------------------------------------------------------------
324 /************************************************************************************/
326  if (fCalParFileName.IsNull()) return kTRUE;
327 
328  fCalParFile = new TFile(fCalParFileName, "");
329  if (NULL == fCalParFile) {
330  LOG(error) << "CbmTofFindTracks::LoadCalParameter: "
331  << "file " << fCalParFileName << " does not exist!";
332  return kTRUE;
333  }
334 
335  LOG(info) << "CbmTofFindTracks::LoadCalParameter: "
336  << " read from file " << fCalParFileName;
337 
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"));
346 
347 
348  gROOT->cd();
349  if (NULL == fhtmp) {
350  LOG(info) << Form("CbmTofFindTracks::LoadCalParameter: hPullT_Smt_Off")
351  << " not found. ";
352  } else {
353  fhPullT_Smt_Off = (TH1D*) fhtmp->Clone();
354  }
355 
356  if (NULL == fhtmpX) {
357  LOG(info) << Form("CbmTofFindTracks::LoadCalParameter: hPullX_Smt_Off")
358  << " not found. ";
359  } else {
360  fhPullX_Smt_Off = (TH1D*) fhtmpX->Clone();
361  }
362 
363  if (NULL == fhtmpY) {
364  LOG(info) << Form("CbmTofFindTracks::LoadCalParameter: hPullY_Smt_Off")
365  << " not found. ";
366  } else {
367  fhPullY_Smt_Off = (TH1D*) fhtmpY->Clone();
368  }
369 
370  if (NULL == fhtmpZ) {
371  LOG(info) << Form("CbmTofFindTracks::LoadCalParameter: hPullZ_Smt_Off")
372  << " not found. ";
373  } else {
374  fhPullZ_Smt_Off = (TH1D*) fhtmpZ->Clone();
375  }
376 
377  if (NULL == fhtmpW) {
378  LOG(info) << Form("CbmTofFindTracks::LoadCalParameter: hPullT_Smt_Width")
379  << " not found. ";
380  } else {
381  if (fbUseSigCalib) fhPullT_Smt_Width = (TH1D*) fhtmpW->Clone();
382  }
383 
384  if (NULL == fhtmpWX) {
385  LOG(info) << Form("CbmTofFindTracks::LoadCalParameter: hPullX_Smt_Width")
386  << " not found. ";
387  } else {
388  if (fbUseSigCalib) fhPullX_Smt_Width = (TH1D*) fhtmpWX->Clone();
389  }
390 
391  if (NULL == fhtmpWY) {
392  LOG(info) << Form("CbmTofFindTracks::LoadCalParameter: hPullY_Smt_Width")
393  << " not found. ";
394  } else {
395  if (fbUseSigCalib) fhPullY_Smt_Width = (TH1D*) fhtmpWY->Clone();
396  }
397 
398  if (NULL == fhtmpWZ) {
399  LOG(info) << Form("CbmTofFindTracks::LoadCalParameter: hPullZ_Smt_Width")
400  << " not found. ";
401  } else {
402  if (fbUseSigCalib) fhPullZ_Smt_Width = (TH1D*) fhtmpWZ->Clone();
403  }
404 
405  fCalParFile->Close();
406 
407  Double_t nSmt = fMapRpcIdParInd.size();
408 
409  if (NULL == fhPullT_Smt_Off) { // provide default TOffset histogram
411  new TH1F(Form("hPullT_Smt_Off"),
412  Form("Tracklet PullT vs RpcInd ; RpcInd ; #DeltaT (ns)"),
413  nSmt,
414  0,
415  nSmt);
416 
417  // Initialize Parameter
418  if (fiCorMode == 3) // hidden option, FIXME
419  for (Int_t iDet = 0; iDet < nSmt; iDet++) {
420  std::map<Int_t, Int_t>::iterator it;
421  //it = fMapRpcIdParInd.find(iDet);
422  for (it = fMapRpcIdParInd.begin(); it != fMapRpcIdParInd.end(); it++) {
423  if (it->second == iDet) break;
424  }
425  LOG(debug1) << Form(" iDet %d -> iUniqueId ? 0x%08x, 0x%08x ",
426  iDet,
427  it->first,
428  it->second);
429  Int_t iUniqueId = it->first;
430  CbmTofCell* fChannelInfo = fDigiPar->GetCell(iUniqueId);
431  if (NULL != fChannelInfo) {
432  Double_t dVal =
433  0.; // FIXME numeric constant in code, default for cosmic
434  if (fiBeamCounter != iUniqueId)
435  dVal =
436  fChannelInfo->GetZ() * fTtTarg; // use calibration target value
437  fhPullT_Smt_Off->SetBinContent(iDet + 1, dVal);
438  LOG(info) << Form("Initialize det 0x%08x at %d, z=%f with TOff %6.2f",
439  iUniqueId,
440  iDet + 1,
441  fChannelInfo->GetZ(),
442  dVal);
443  }
444  }
445  }
446 
447  if (NULL == fhPullT_Smt_Width) { // provide default TWidth histogram
449  new TH1F(Form("hPullT_Smt_Width"),
450  Form("Tracklet ResiT Width vs RpcInd ; RpcInd ; RMS(T) (ns)"),
451  nSmt,
452  0,
453  nSmt);
454 
455  // Initialize Parameter
456  for (Int_t iDet = 0; iDet < nSmt; iDet++) {
457  fhPullT_Smt_Width->SetBinContent(iDet + 1, fSIGT);
458  }
459  }
460 
461  LOG(info) << "CbmTofFindTracks::LoadCalParameter: fhPullT_Smt_Off at "
462  << fhPullT_Smt_Off;
463 
464  if (NULL == fhPullX_Smt_Off) // provide default XOffset histogram
466  new TH1F(Form("hPullX_Smt_Off"),
467  Form("Tracklet ResiX vs RpcInd ; RpcInd ; #DeltaX (cm)"),
468  nSmt,
469  0,
470  nSmt);
471  if (NULL == fhPullX_Smt_Width) {
473  new TH1F(Form("hPullX_Smt_Width"),
474  Form("Tracklet ResiX Width vs RpcInd ; RpcInd ; RMS(X) (cm)"),
475  nSmt,
476  0,
477  nSmt);
478  // Initialize Parameter
479  for (Int_t iDet = 0; iDet < nSmt; iDet++) {
480  fhPullX_Smt_Width->SetBinContent(iDet + 1, fSIGX);
481  }
482  }
483 
484  if (NULL == fhPullY_Smt_Off) // provide default YOffset histogram
486  new TH1F(Form("hPullY_Smt_Off"),
487  Form("Tracklet ResiY vs RpcInd ; RpcInd ; #DeltaY (cm)"),
488  nSmt,
489  0,
490  nSmt);
491  if (NULL == fhPullY_Smt_Width) {
493  new TH1F(Form("hPullY_Smt_Width"),
494  Form("Tracklet ResiY Width vs RpcInd ; RpcInd ; RMS(Y) (cm)"),
495  nSmt,
496  0,
497  nSmt);
498  // Initialize Parameter
499  for (Int_t iDet = 0; iDet < nSmt; iDet++) {
500  fhPullY_Smt_Width->SetBinContent(iDet + 1, fSIGY);
501  }
502  }
503 
504  if (NULL == fhPullZ_Smt_Off) // provide default TOffset histogram
506  new TH1F(Form("hPullZ_Smt_Off"),
507  Form("Tracklet ResiZ vs RpcInd ; RpcInd ; #DeltaZ (cm)"),
508  nSmt,
509  0,
510  nSmt);
511  if (NULL == fhPullZ_Smt_Width) {
513  new TH1F(Form("hPullZ_Smt_Width"),
514  Form("Tracklet ResiZ Width vs RpcInd ; RpcInd ; RMS(Z) (cm)"),
515  nSmt,
516  0,
517  nSmt);
518  // Initialize Parameter
519  for (Int_t iDet = 0; iDet < nSmt; iDet++) {
520  fhPullZ_Smt_Width->SetBinContent(iDet + 1, fSIGZ);
521  }
522  }
523 
524  return kTRUE;
525 }
526 //-------------------------------------------------------------------------------------------------
528  // Initialize the TOF GeoHandler
529  Bool_t isSimulation = kFALSE;
530  Int_t iGeoVersion = fGeoHandler->Init(isSimulation);
531  if (k12b > iGeoVersion) {
532  LOG(error) << "CbmTofFindTracks::InitParameters => Only compatible with "
533  "geometries after v12b !!!";
534  return kFALSE;
535  }
536 
537  LOG(info) << "CbmTofFindTracks::InitParameters: GeoVersion " << iGeoVersion;
538 
539  switch (iGeoVersion) {
540  case k12b: fTofId = new CbmTofDetectorId_v12b(); break;
541  case k14a: fTofId = new CbmTofDetectorId_v14a(); break;
542  default:
543  LOG(error) << "CbmTofFindTracks::InitParameters: Invalid Detector ID "
544  << iGeoVersion;
545  }
546 
547  // create digitization parameters from geometry file
548  CbmTofCreateDigiPar* tofDigiPar =
549  new CbmTofCreateDigiPar("TOF Digi Producer", "TOF task");
550  LOG(info) << "Create DigiPar ";
551  tofDigiPar->Init();
552 
553  return kTRUE;
554 }
555 // ----- SetParContainers -------------------------------------------------
557  FairRunAna* ana = FairRunAna::Instance();
558  FairRuntimeDb* rtdb = ana->GetRuntimeDb();
559  // rtdb->getContainer("CbmGeoPassivePar");
560  // rtdb->getContainer("CbmGeoStsPar");
561  // rtdb->getContainer("CbmGeoTofPar");
562  rtdb->getContainer("FairBaseParSet");
563  // rtdb->getContainer("CbmGeoPassivePar");
564  // rtdb->getContainer("CbmGeoStsPar");
565  // rtdb->getContainer("CbmGeoRichPar");
566  rtdb->getContainer("CbmGeoTofPar");
567  // rtdb->getContainer("CbmFieldPar");
568  fDigiPar = (CbmTofDigiPar*) (rtdb->getContainer("CbmTofDigiPar"));
569 
570  LOG(info) << " CbmTofFindTracks::SetParContainers found "
571  << fDigiPar->GetNrOfModules() << " cells ";
572 
573  fDigiBdfPar = (CbmTofDigiBdfPar*) (rtdb->getContainer("CbmTofDigiBdfPar"));
574 }
575 // -------------------------------------------------------------------------
576 
578  if (fiCorMode < 0) return kTRUE;
579 
580  LOG(info) << Form("CbmTofFindTracks::WriteHistos: %s, mode = %d",
581  fCalOutFileName.Data(),
582  fiCorMode);
583 
584  // Write histogramms to the file
585  TDirectory* oldir = gDirectory;
586  TFile* fHist = new TFile(fCalOutFileName, "RECREATE");
587  fHist->cd();
588  const Double_t RMSmin = 0.03; // in ns
589 
590  switch (fiCorMode) {
591  case 0: {
592  TProfile* htmp = fhPullT_Smt->ProfileX();
593  TH1D* htmp1D = htmp->ProjectionX();
594  TProfile* hTOff = fhTOff_HMul2->ProfileX();
595  TH1D* hTOff1D = hTOff->ProjectionX();
596 
597  Double_t nx = htmp1D->GetNbinsX();
598  for (Int_t ix = 1; ix < nx; ix++) {
599  Double_t dVal = 0;
600  if (fhPullT_Smt_Off != NULL) {
601  dVal = fhPullT_Smt_Off->GetBinContent(ix + 1);
602  } else {
603  fhPullT_Smt_Off = htmp1D;
604  }
605  TH1D* hTOff1DY =
606  fhTOff_HMul2->ProjectionY(Form("_py%d", ix), ix + 1, ix + 1, "");
607  Double_t dFMean = 0.;
608  if (hTOff1DY->GetEntries() > 100) {
609  //Double_t dMean=hTOff1DY->GetMean();
610  Int_t iBmax = hTOff1DY->GetMaximumBin();
611  TAxis* xaxis = hTOff1DY->GetXaxis();
612  Double_t dMean =
613  xaxis->GetBinCenter(iBmax); //X-value of bin with maximal content
614  Double_t dLim = 1000.; //1.5*hTOff1DY->GetRMS();
615  TFitResultPtr fRes =
616  hTOff1DY->Fit("gaus", "S", "", dMean - dLim, dMean + dLim);
617  dFMean = fRes->Parameter(1);
618  }
619  dVal -= dFMean;
620  LOG(info) << "Init TOff " << ix << ": Old "
621  << fhPullT_Smt_Off->GetBinContent(ix + 1) << ", Cnts "
622  << hTOff1D->GetBinContent(ix + 1) << ", FitMean " << dFMean
623  << " -> " << dVal;
624  fhPullT_Smt_Off->SetBinContent(ix + 1, dVal);
625  }
626  }
627 
628  break;
629 
630  case 1: // correct mean deviation from fit (Pull)
631  {
632  TProfile* htmp = fhPullT_Smt->ProfileX();
633  TH1D* htmp1D = htmp->ProjectionX();
634  TProfile* hTOff = fhTOff_Smt->ProfileX();
635  TH1D* hTOff1D = hTOff->ProjectionX();
636 
637  if (fhPullT_Smt_Off != NULL) {
638  Double_t nx = htmp1D->GetNbinsX();
639  for (Int_t ix = 0; ix < nx; ix++) {
640  Double_t dVal = fhPullT_Smt_Off->GetBinContent(ix + 1);
641  dVal -= htmp1D->GetBinContent(ix + 1);
642 
643  LOG(debug1) << "Update hPullT_Smt_Off " << ix << ": "
644  << fhPullT_Smt_Off->GetBinContent(ix + 1) << " + "
645  << htmp1D->GetBinContent(ix + 1) << " + "
646  << hTOff1D->GetBinContent(ix + 1) << " -> " << dVal;
647  fhPullT_Smt_Off->SetBinContent(ix + 1, dVal);
648  }
649  } else {
650  LOG(warning)
651  << "CbmTofFindTracks::WriteHistos: fhPullT_Smt_Off not found ";
652  }
653  }
654 
655  break;
656 
657  case 2: // correct deviation from DeltaTt=0 expectation
658  {
659  TProfile* htmp = fhPullT_Smt->ProfileX();
660  TH1D* htmp1D = htmp->ProjectionX();
661  TProfile* hTOff = fhTOff_Smt->ProfileX();
662  TH1D* hTOff1D = hTOff->ProjectionX();
663 
664  if (fhPullT_Smt_Off != NULL) {
665  Double_t nx = htmp1D->GetNbinsX();
666  for (Int_t ix = 0; ix < nx; ix++) {
667  Double_t dVal = fhPullT_Smt_Off->GetBinContent(ix + 1);
668  dVal -= hTOff1D->GetBinContent(ix + 1);
669  TH1D* hTOff1DY =
670  fhTOff_Smt->ProjectionY(Form("_py%d", ix), ix + 1, ix + 1, "");
671  Double_t dFMean = 0.;
672  if (hTOff1DY->GetEntries() > 100) {
673  //Double_t dMean=hTOff1DY->GetMean();
674  Int_t iBmax = hTOff1DY->GetMaximumBin();
675  TAxis* xaxis = hTOff1DY->GetXaxis();
676  Double_t dMean =
677  xaxis->GetBinCenter(iBmax); //X-value of bin with maximal content
678  Double_t dLim = 1.5 * hTOff1DY->GetRMS();
679  TFitResultPtr fRes =
680  hTOff1DY->Fit("gaus", "S", "", dMean - dLim, dMean + dLim);
681  Int_t iFitStatus = fRes;
682  if (iFitStatus == 0) { // check validity of fit
683  dFMean = fRes->Parameter(1);
684  dVal +=
685  hTOff1D->GetBinContent(ix + 1); //revert default correction
686  dVal -= dFMean;
687  }
688  LOG(info) << "Update hPullT_Smt_Off Ind " << ix << ": Old "
689  << fhPullT_Smt_Off->GetBinContent(ix + 1) << ", Pull "
690  << htmp1D->GetBinContent(ix + 1) << ", Dev@Peak "
691  << hTOff1D->GetBinContent(ix + 1) << ", FitMean "
692  << dFMean << " -> " << dVal;
693  } else {
694  LOG(debug1) << "Update hPullT_Smt_Off " << ix
695  << ": insufficient counts: " << hTOff1DY->GetEntries();
696  }
697  fhPullT_Smt_Off->SetBinContent(ix + 1, dVal);
698  }
699  } else {
700  LOG(warning)
701  << "CbmTofFindTracks::WriteHistos: fhPullT_Smt_Off not found ";
702  }
703  } break;
704 
705  case 3: // correct Time Offset from PullT, extract width
706  {
707  TProfile* htmp = fhPullT_Smt->ProfileX();
708  TH1D* htmp1D = htmp->ProjectionX();
709 
710  if (fhPullT_Smt_Off != NULL) {
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();
717  Double_t dMean =
718  xaxis->GetBinCenter(iBmax); //X-value of bin with maximal content
719  Double_t dRMS = TMath::Abs(hpy->GetRMS());
720  Double_t dLim = 1.5 * dRMS;
721  TFitResultPtr fRes =
722  hpy->Fit("gaus", "S", "", dMean - dLim, dMean + dLim);
723  Double_t dFMean = fRes->Parameter(1);
724 
725  Double_t dVal = fhPullT_Smt_Off->GetBinContent(ix + 1);
726  dVal -= dFMean;
727  TF1* fg = hpy->GetFunction("gaus");
728  Double_t dFMeanError = fg->GetParError(1);
729  LOG(info) << "Update hPullT_Smt_Off3 Ind " << ix << ": "
730  << fhPullT_Smt_Off->GetBinContent(ix + 1) << " + "
731  << dFMean << ", Err " << dFMeanError << " -> " << dVal
732  << ", Width " << dRMS << ", Chi2 " << fg->GetChisquare();
733  if (dFMeanError < 0.05) { // FIXME: hardwired constant
734  if (dRMS < RMSmin) dRMS = RMSmin;
735  if (dRMS > fSIGT * 3.0) dRMS = fSIGT * 3.;
736  if (fRpcAddr[ix]
737  != fiBeamCounter) // don't correct beam counter position
738  fhPullT_Smt_Off->SetBinContent(ix + 1, dVal);
739  fhPullT_Smt_Width->SetBinContent(ix + 1, dRMS);
740  }
741  } else {
742  LOG(debug1) << "Update hPullT_Smt_Off " << ix
743  << ": insufficient counts: " << hpy->GetEntries();
744  }
745  }
746  } else {
747  LOG(warning)
748  << "CbmTofFindTracks::WriteHistos: fhPullT_Smt_Off not found ";
749  }
750  }
751 
752  break;
753 
754  case 4: // correct mean deviation from fit (Pull), extract width for x direction
755  {
756  TProfile* htmp = fhPullX_Smt->ProfileX();
757  TH1D* htmp1D = htmp->ProjectionX();
758 
759  if (fhPullX_Smt_Off != NULL) {
760  Double_t nx = htmp1D->GetNbinsX();
761  for (Int_t ix = 0; ix < nx; ix++) {
762  Double_t dVal = fhPullX_Smt_Off->GetBinContent(ix + 1);
763  dVal -= htmp1D->GetBinContent(ix + 1);
764  if (dVal < -3.)
765  dVal =
766  -3.; // limit maximal shift in X, for larger values, change geometry file
767  if (dVal > 3.) dVal = 3.;
768  //if( fRpcAddr[ix] != fiBeamCounter ) // don't correct beam counter position
769  fhPullX_Smt_Off->SetBinContent(ix + 1, dVal);
770 
771  TH1D* hpy = fhPullX_Smt->ProjectionY("_py", ix + 1, ix + 1);
772  if (hpy->GetEntries() > 100.) {
773  Double_t dRMS = TMath::Abs(hpy->GetRMS());
774  if (dRMS < fSIGX * 0.5) dRMS = fSIGX * 0.5;
775  if (dRMS > fSIGX * 3.0) dRMS = fSIGX * 3.;
776  fhPullX_Smt_Width->SetBinContent(ix + 1, dRMS);
777 
778  LOG(info) << "Update hPullX_Smt_Off " << ix << ": "
779  << fhPullX_Smt_Off->GetBinContent(ix + 1) << " + "
780  << htmp1D->GetBinContent(ix + 1) << " -> " << dVal
781  << ", Width " << dRMS;
782  }
783  }
784  } else {
785  LOG(warning)
786  << "CbmTofFindTracks::WriteHistos: fhPullX_Smt_Off not found ";
787  }
788  }
789 
790  break;
791 
792  case 5: // correct mean deviation from fit (Pull), extract width for Y direction
793  {
794  TProfile* htmp = fhPullY_Smt->ProfileX();
795  TH1D* htmp1D = htmp->ProjectionX();
796 
797  if (fhPullY_Smt_Off != NULL) {
798  Double_t nx = htmp1D->GetNbinsX();
799  for (Int_t ix = 0; ix < nx; ix++) {
800  Double_t dVal = fhPullY_Smt_Off->GetBinContent(ix + 1);
801  dVal -= htmp1D->GetBinContent(ix + 1);
802  //if( fRpcAddr[ix] != fiBeamCounter ) // don't correct beam counter position
803  fhPullY_Smt_Off->SetBinContent(ix + 1, dVal);
804 
805  TH1D* hpy = fhPullY_Smt->ProjectionY("_py", ix + 1, ix + 1);
806  if (hpy->GetEntries() > 100.) {
807  Double_t dRMS = TMath::Abs(hpy->GetRMS());
808  if (dRMS < fSIGY * 0.5) dRMS = 0.5 * fSIGY;
809  if (dRMS > fSIGY * 3.0) dRMS = fSIGY * 3.;
810  fhPullY_Smt_Width->SetBinContent(ix + 1, dRMS);
811 
812  LOG(debug1) << "Update hPullY_Smt_Off " << ix << ": "
813  << fhPullY_Smt_Off->GetBinContent(ix + 1) << " + "
814  << htmp1D->GetBinContent(ix + 1) << " -> " << dVal
815  << ", Width " << dRMS;
816  }
817  }
818  } else {
819  LOG(warning)
820  << "CbmTofFindTracks::WriteHistos: fhPullY_Smt_Off not found ";
821  }
822 
823  }
824 
825  break;
826 
827  case 6: // correct mean deviation from fit (Pull), extract width
828  {
829  TProfile* htmp = fhPullZ_Smt->ProfileX();
830  TH1D* htmp1D = htmp->ProjectionX();
831 
832  if (fhPullZ_Smt_Off != NULL) {
833  Double_t nx = htmp1D->GetNbinsX();
834  for (Int_t ix = 0; ix < nx; ix++) {
835  Double_t dVal = fhPullZ_Smt_Off->GetBinContent(ix + 1);
836  dVal -= htmp1D->GetBinContent(ix + 1);
837  fhPullZ_Smt_Off->SetBinContent(ix + 1, dVal);
838 
839  TH1D* hpy = fhPullZ_Smt->ProjectionY("_py", ix + 1, ix + 1);
840  if (hpy->GetEntries() > 100.) {
841  Double_t dRMS = TMath::Abs(hpy->GetRMS());
842 
843  LOG(debug1) << "Update hPullZ_Smt_Off " << ix << ": "
844  << fhPullZ_Smt_Off->GetBinContent(ix + 1) << " + "
845  << htmp1D->GetBinContent(ix + 1) << " -> " << dVal
846  << ", Width " << dRMS;
847  if (dRMS < 1.5) dRMS = 1.5;
848  fhPullZ_Smt_Width->SetBinContent(ix + 1, dRMS);
849  }
850  }
851  } else {
852  LOG(warning)
853  << "CbmTofFindTracks::WriteHistos: fhPullZ_Smt_Off not found ";
854  }
855 
856  } break;
857 
858  case 7: // extract residual widthes in T, X, Y, Z
859  {
860  for (Int_t iStation = 0;
861  iStation < static_cast<Int_t>(fMapRpcIdParInd.size());
862  iStation++) {
863  TH1D* hResidualT =
864  fhPullT_Smt->ProjectionY("_py", iStation + 1, iStation + 1);
865  TH1D* hResidualX =
866  fhPullX_Smt->ProjectionY("_py", iStation + 1, iStation + 1);
867  TH1D* hResidualY =
868  fhPullY_Smt->ProjectionY("_py", iStation + 1, iStation + 1);
869  TH1D* hResidualZ =
870  fhPullZ_Smt->ProjectionY("_py", iStation + 1, iStation + 1);
871 
872  if (hResidualT->GetEntries() > 100.) {
873  Double_t dRMS = TMath::Abs(hResidualT->GetRMS());
874 
875  if (dRMS < RMSmin) dRMS = RMSmin;
876  if (dRMS > 3. * fSIGT) dRMS = 3. * fSIGT;
877 
878  fhPullT_Smt_Width->SetBinContent(iStation + 1, dRMS);
879  }
880 
881  if (hResidualX->GetEntries() > 100.) {
882  Double_t dRMS = TMath::Abs(hResidualX->GetRMS());
883 
884  if (dRMS < 0.5 * fSIGX) dRMS = 0.5 * fSIGX;
885  if (dRMS > 3. * fSIGX) dRMS = 3. * fSIGX;
886 
887  fhPullX_Smt_Width->SetBinContent(iStation + 1, dRMS);
888  }
889 
890  if (hResidualY->GetEntries() > 100.) {
891  Double_t dRMS = TMath::Abs(hResidualY->GetRMS());
892 
893  if (dRMS < 0.5 * fSIGY) dRMS = 0.5 * fSIGY;
894  if (dRMS > 3. * fSIGY) dRMS = 3. * fSIGY;
895 
896  fhPullY_Smt_Width->SetBinContent(iStation + 1, dRMS);
897  }
898 
899  if (hResidualZ->GetEntries() > 100.) {
900  Double_t dRMS = TMath::Abs(hResidualZ->GetRMS());
901 
902  if (dRMS < 1.5) dRMS = 1.5;
903 
904  fhPullZ_Smt_Width->SetBinContent(iStation + 1, dRMS);
905  }
906  }
907  } break;
908 
909  case 10: //correct mean deviation from TB - histo of station 0
910  case 11:
911  case 12:
912  case 13:
913  case 14:
914  case 15:
915  case 16:
916  case 17:
917  case 18:
918  case 19: {
919  Int_t iSt = fiCorMode % 10;
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();
925  TFitResultPtr fRes =
926  h1->Fit("gaus", "S", "", dFMean - dFLim, dFMean + dFLim);
927  Double_t dDOff = fRes->Parameter(1);
928  Double_t dSig = fRes->Parameter(2);
929  Int_t iRpcInd = fMapRpcIdParInd[fMapStationRpcId[iSt]];
930  Double_t dVal = fhPullT_Smt_Off->GetBinContent(iRpcInd + 1);
931  dVal -= dDOff;
932  LOG(info) << "Update hPullT_Smt_OffP Ind " << iSt << ", Ind " << iRpcInd
933  << ": " << fhPullT_Smt_Off->GetBinContent(iRpcInd + 1)
934  << " - " << dDOff << " -> " << dVal << ", Width " << dSig;
935  fhPullT_Smt_Off->SetBinContent(iRpcInd + 1, dVal);
936  if (dSig < fSIGT * 0.5) dSig = 0.5 * fSIGT;
937  if (dSig > fSIGT * 3.0) dSig = fSIGT * 3.;
938  fhPullT_Smt_Width->SetBinContent(iRpcInd + 1, dSig);
939  } else {
940  LOG(info) << "CbmTofFindTracks::WriteHistos: Too few entries in histo "
941  << hname;
942  }
943  } break;
944 
945  default:;
946  }
947 
948  if (NULL != fhPullT_Smt_Off) {
949  // always extract residual widthes in T, X, Y, Z
950  for (Int_t iStation = 0;
951  iStation < static_cast<Int_t>(fMapRpcIdParInd.size());
952  iStation++) {
953  TH1D* hResidualT =
954  fhPullT_Smt->ProjectionY("_py", iStation + 1, iStation + 1);
955  TH1D* hResidualX =
956  fhPullX_Smt->ProjectionY("_py", iStation + 1, iStation + 1);
957  TH1D* hResidualY =
958  fhPullY_Smt->ProjectionY("_py", iStation + 1, iStation + 1);
959  TH1D* hResidualZ =
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;
964  if (dRMS > 3. * fSIGT) dRMS = 3. * fSIGT;
965  fhPullT_Smt_Width->SetBinContent(iStation + 1, dRMS);
966  }
967  if (hResidualX->GetEntries() > 100.) {
968  Double_t dRMS = TMath::Abs(hResidualX->GetRMS());
969  if (dRMS < 0.5 * fSIGX) dRMS = 0.5 * fSIGX;
970  if (dRMS > 3. * fSIGX) dRMS = 3. * fSIGX;
971  fhPullX_Smt_Width->SetBinContent(iStation + 1, dRMS);
972  }
973  if (hResidualY->GetEntries() > 100.) {
974  Double_t dRMS = TMath::Abs(hResidualY->GetRMS());
975  if (dRMS < 0.5 * fSIGY) dRMS = 0.5 * fSIGY;
976  if (dRMS > 3. * fSIGY) dRMS = 3. * fSIGY;
977  fhPullY_Smt_Width->SetBinContent(iStation + 1, dRMS);
978  }
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.;
983  fhPullZ_Smt_Width->SetBinContent(iStation + 1, dRMS);
984  }
985  }
986 
987  fhPullT_Smt_Off->Write();
988  fhPullX_Smt_Off->Write();
989  fhPullY_Smt_Off->Write();
990  fhPullZ_Smt_Off->Write();
991  fhPullT_Smt_Width->Write();
992  fhPullX_Smt_Width->Write();
993  fhPullY_Smt_Width->Write();
994  fhPullZ_Smt_Width->Write();
995  }
996  gDirectory->cd(oldir->GetPath());
997  fHist->Close();
998 
999  return kTRUE;
1000 }
1001 
1002 
1003 // ----- Public method Exec --------------------------------------------
1004 void CbmTofFindTracks::Exec(Option_t* opt) {
1005  if (!fEventsColl) {
1006  // fTofHitArray = (TClonesArray*)fTofHitArrayIn->Clone();
1007  fTofHitArray = (TClonesArray*) fTofHitArrayIn;
1008  ExecFind(opt);
1009  } else {
1010  Int_t iNbTrks = 0;
1011  fTrackArrayOut->Delete(); //Clear("C");
1012  for (Int_t iEvent = 0; iEvent < fEventsColl->GetEntriesFast(); iEvent++) {
1013  CbmEvent* tEvent = dynamic_cast<CbmEvent*>(fEventsColl->At(iEvent));
1014  LOG(debug) << "Process event " << iEvent << " with "
1015  << tEvent->GetNofData(ECbmDataType::kTofHit) << " hits";
1016 
1017  if (fTofHitArray) fTofHitArray->Clear("C");
1018  Int_t iNbHits = 0;
1019  for (Int_t iHit = 0; iHit < tEvent->GetNofData(ECbmDataType::kTofHit);
1020  iHit++) {
1021  Int_t iHitIndex =
1022  static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kTofHit, iHit));
1023  CbmTofHit* tHit =
1024  dynamic_cast<CbmTofHit*>(fTofHitArrayIn->At(iHitIndex));
1025  new ((*fTofHitArray)[iNbHits++]) CbmTofHit(*tHit);
1026  }
1027 
1028  ExecFind(opt);
1029 
1030  // --- In event-by-event mode: copy tracks to output array and register them to event
1031  for (Int_t iTrk = 0; iTrk < fTrackArray->GetEntries(); iTrk++) {
1032  CbmTofTracklet* pTrk = (CbmTofTracklet*) fTrackArray->At(iTrk);
1033  new ((*fTrackArrayOut)[iNbTrks]) CbmTofTracklet(*pTrk);
1034  tEvent->AddData(ECbmDataType::kTofTrack, iNbTrks);
1035  iNbTrks++;
1036  }
1037  fTrackArray->Delete();
1038  }
1039  }
1040 }
1041 
1042 void CbmTofFindTracks::ExecFind(Option_t* /*opt*/) {
1043  fiEvent++;
1045  if (NULL != fTofUHitArray) fTofUHitArray->Clear("C");
1046  if (NULL != fTrackArray) fTrackArray->Delete(); // reset
1047 
1048  // recalibrate hits and count trackable hits
1049  for (Int_t iHit = 0; iHit < fTofHitArray->GetEntries(); iHit++) {
1050  CbmTofHit* pHit = (CbmTofHit*) fTofHitArray->At(iHit);
1051  Int_t iDetId = (pHit->GetAddress() & DetMask);
1052 
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); // include positioning uncertainty
1060  pHit->SetPositionError(hitPosErr);
1061 
1062  Double_t dSIGT = GetSigT(iDetId);
1063  if (dSIGT == 0.) dSIGT = fSIGT;
1064  pHit->SetTimeError(dSIGT);
1065 
1066  if (fiBeamCounter > -1) {
1067  // set diamond positions to (0,0,0) to allow inclusion in straight line fit
1068  if ((iDetId & 0x0000F00F) == 0x00005006) // modify diamond position
1069  {
1070  if (0. != fdBeamMomentumLab) {
1071  Double_t dTargetTimeOffset =
1072  pHit->GetZ() / fdBeamMomentumLab
1073  * TMath::Sqrt(TMath::Power(fdBeamMomentumLab, 2.)
1074  + TMath::Power(0.938271998, 2.))
1075  / TMath::Ccgs() * 1.0e09;
1076  pHit->SetTime(pHit->GetTime() - dTargetTimeOffset);
1077  }
1078 
1079  TVector3 hitPos(0., 0., 0.);
1080  // TVector3 hitPos(pHit->GetX(), pHit->GetY(), 0.);
1081  // TVector3 hitPosErr(1.,1.,5.0); // including positioning uncertainty
1082  pHit->SetPosition(hitPos);
1083  TVector3 hitPosErr0(1., 1., 1.); // including positioning uncertainty
1084  pHit->SetPositionError(hitPosErr0); //
1085  }
1086  }
1087 
1089  Int_t iHitAddress = pHit->GetAddress();
1090  Int_t iModuleType = CbmTofAddress::GetSmType(iHitAddress);
1091  Int_t iModuleIndex = CbmTofAddress::GetSmId(iHitAddress);
1092  Int_t iCounterIndex = CbmTofAddress::GetRpcId(iHitAddress);
1093 
1094  CbmTofCell* fChannelInfo = fDigiPar->GetCell(iHitAddress);
1095 
1096  Double_t dSignalPropagationTime =
1097  0.5
1099  ? fChannelInfo->GetSizey()
1100  : fChannelInfo->GetSizex())
1101  / fDigiBdfPar->GetSigVel(iModuleType, iModuleIndex, iCounterIndex);
1102 
1103  pHit->SetTime(pHit->GetTime() - dSignalPropagationTime);
1104  }
1105 
1106  // tune positions and times
1107  Double_t dTcor = 0.;
1108  if ((iDetId & 0x0000F00F)
1109  != 0x00005006) { // do not modify diamond position
1110  Int_t iRpcInd = fMapRpcIdParInd[iDetId];
1111  if (fhPullT_Smt_Off != NULL) {
1112  dTcor = (Double_t) fhPullT_Smt_Off->GetBinContent(iRpcInd + 1);
1113  pHit->SetTime(pHit->GetTime() + dTcor);
1114  }
1115  if (fhPullX_Smt_Off != NULL) {
1116  Double_t dXcor = (Double_t) fhPullX_Smt_Off->GetBinContent(iRpcInd + 1);
1117  pHit->SetX(pHit->GetX() + dXcor);
1118  }
1119  if (fhPullY_Smt_Off != NULL) {
1120  Double_t dYcor = (Double_t) fhPullY_Smt_Off->GetBinContent(iRpcInd + 1);
1121  pHit->SetY(pHit->GetY() + dYcor);
1122  }
1123  if (fhPullZ_Smt_Off != NULL) {
1124  Double_t dZcor = (Double_t) fhPullZ_Smt_Off->GetBinContent(iRpcInd + 1);
1125  pHit->SetZ(pHit->GetZ() + dZcor);
1126  }
1127  }
1128 
1129  Int_t iSt = GetStationOfAddr(iDetId);
1130  MarkStationFired(iSt);
1131 
1132  LOG(debug) << Form(
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)",
1135  iHit,
1136  pHit->GetAddress(),
1137  GetStationOfAddr(iDetId),
1138  fStationHMul[GetStationOfAddr(iDetId)],
1139  pHit->GetX(),
1140  pHit->GetDx(),
1141  pHit->GetY(),
1142  pHit->GetDy(),
1143  pHit->GetZ(),
1144  pHit->GetDz(),
1145  pHit->GetTime(),
1146  pHit->GetTimeError(),
1147  dTcor);
1148  }
1149 
1150  LOG(debug) << Form("CbmTofFindTracks::Exec NStationsFired %d > %d Min ?",
1152  GetMinNofHits());
1153 
1154  if (GetNStationsFired() < GetMinNofHits()) {
1155  fInspectEvent = kFALSE; // mark event as non trackable
1156  } else
1157  fInspectEvent = kTRUE;
1158 
1159  CheckMaxHMul();
1160  // resort Hit array with respect to time, FIXME danger: links to digis become invalid (???, check!!!)
1161  // fTofHitArray->Sort(fTofHitArray->GetEntries()); // feature not available
1162 
1163  if (fInspectEvent && fNTofStations > 1) {
1164  fStart.Set();
1165  //fTrackArray->Clear("C+C");
1167  // fTrackArray->Compress();
1168  fStop.Set();
1169  fdTrackingTime = fStop.GetSec() - fStart.GetSec()
1170  + (fStop.GetNanoSec() - fStart.GetNanoSec()) / 1e9;
1171 
1172  LOG(debug) << Form("CbmTofFindTracks::Exec found %d Tracklets in %f sec",
1173  fTrackArray->GetEntriesFast(),
1174  fdTrackingTime);
1175 
1176  FindVertex();
1177 
1178  FillHistograms();
1179  }
1180 
1181  FillUHits(); // put unused hits into TClonesArray
1182 }
1183 // -------------------------------------------------------------------------
1184 
1185 
1186 // ----- Public method Finish ------------------------------------------
1188  if (fiEvent < 1000) return; // preserve calibration histos in event display
1190  WriteHistos();
1191 
1192  LOG(info) << Form(" CbmTofFindTracks::Finished ");
1193 }
1194 // -------------------------------------------------------------------------
1195 
1197 
1198  TDirectory* oldir =
1199  gDirectory; // <= To prevent histos from being sucked in by the param file of the TRootManager!
1200  gROOT
1201  ->cd(); // <= To prevent histos from being sucked in by the param file of the TRootManager !
1202 
1203  // define histos here
1204 
1205  Double_t nSmt = fMapRpcIdParInd.size();
1206  LOG(info) << Form(
1207  " CbmTofFindTracks::CreateHistograms for %d counters, %d stations ",
1208  (Int_t) nSmt,
1209  fNTofStations);
1210 
1211  fhTrklMul = new TH1F(
1212  Form("hTrklMul"), Form("Tracklet Multiplicity; MulTracklet"), 100, 0, 100);
1213 
1214  fhAllHitsStation = new TH1F(Form("hAllHitsStation"),
1215  Form("Reconstructed Hits; Station #"),
1216  fNTofStations,
1217  0,
1218  fNTofStations);
1219  fhAllHitsSmTypes = new TH1F(
1220  Form("hAllHitsSmTypes"), Form("Reconstructed Hits; SmType #"), 10, 0, 10);
1221 
1223  new TH1F(Form("hUsedHitsStation"),
1224  Form("Used (HMul>2) / Reconstructed Hits; Station #"),
1225  fNTofStations,
1226  0,
1227  fNTofStations);
1228 
1229  fhTrklChi2 = new TH2F(Form("hTrklChi2"),
1230  Form("Tracklet Chi; HMul_{Tracklet}; #chi"),
1231  8,
1232  2,
1233  10,
1234  100,
1235  0,
1236  ((CbmTofTrackFinderNN*) fFinder)->GetChiMaxAccept());
1237 
1238  fhTrackingTimeNhits = new TH2F(Form("hTrackingTimeNhits"),
1239  Form("Tracking Time; NHits; #Deltat (s)"),
1240  100,
1241  0,
1242  200,
1243  50,
1244  0,
1245  0.1);
1246 
1247  fhTrklMulNhits = new TH2F(Form("hTrklMulNhits"),
1248  Form("Tracklet Multiplicity; NHits; NTracklet"),
1249  150,
1250  0,
1251  150,
1252  25,
1253  0,
1254  25);
1255 
1256  fhTrklMulMaxMM = new TH2F(Form("hTrklMulMaxMax-1"),
1257  Form("Tracklet Multiplicity; TMulMax; TMulMax-1"),
1258  10,
1259  0,
1260  10,
1261  10,
1262  0,
1263  10);
1264  fhTrklMul3D = new TH3F(Form("hTrklMul3D"),
1265  Form("Tracklet Multiplicities; TMul3; TMul4; TMul5"),
1266  10,
1267  0,
1268  10,
1269  10,
1270  0,
1271  10,
1272  10,
1273  0,
1274  10);
1275 
1276  fhTrklHMul =
1277  new TH2F(Form("hTrklHMul"),
1278  Form("Tracklet Hit - Multiplicity; HMul_{Tracklet}; Mul_{HMul}"),
1279  8,
1280  2,
1281  10,
1282  20,
1283  0,
1284  20);
1285  fhTrklZ0xHMul =
1286  new TH2F(Form("hTrklZ0xHMul"),
1287  Form("Tracklet Z0x vs. Hit - Multiplicity; HMul_{Tracklet}; Z0x"),
1288  8,
1289  2,
1290  10,
1291  100,
1292  -500,
1293  500);
1294  fhTrklZ0yHMul =
1295  new TH2F(Form("hTrklZ0yHMul"),
1296  Form("Tracklet Z0y vs. Hit - Multiplicity; HMul_{Tracklet}; Z0y"),
1297  8,
1298  2,
1299  10,
1300  100,
1301  -300,
1302  300);
1303 
1304  fhTrklTxHMul =
1305  new TH2F(Form("hTrklTxHMul"),
1306  Form("Tracklet Tx vs. Hit - Multiplicity; HMul_{Tracklet}; Tx"),
1307  8,
1308  2,
1309  10,
1310  100,
1311  -0.65,
1312  0.65);
1313 
1314  fhTrklTyHMul =
1315  new TH2F(Form("hTrklTyHMul"),
1316  Form("Tracklet Ty vs. Hit - Multiplicity; HMul_{Tracklet}; Ty"),
1317  8,
1318  2,
1319  10,
1320  100,
1321  -0.65,
1322  0.65);
1323  Double_t TTMAX = 0.2;
1324  fhTrklTtHMul =
1325  new TH2F(Form("hTrklTtHMul"),
1326  Form("Tracklet Tt vs. Hit - Multiplicity; HMul_{Tracklet}; Tt"),
1327  8,
1328  2,
1329  10,
1330  100,
1331  -TTMAX,
1332  TTMAX);
1333  fhTrklVelHMul = new TH2F(
1334  Form("hTrklVelHMul"),
1335  Form("Tracklet Vel vs. Hit - Multiplicity; HMul_{Tracklet}; v (cm/ns)"),
1336  8,
1337  2,
1338  10,
1339  100,
1340  0.,
1341  50.);
1342  fhTrklT0HMul =
1343  new TH2F(Form("hTrklT0HMul"),
1344  Form("Tracklet T0 vs. Hit - Multiplicity; HMul_{Tracklet}; T0"),
1345  8,
1346  2,
1347  10,
1348  100,
1349  -0.5,
1350  0.5);
1351 
1352  fhTrklT0Mul = new TH2F(
1353  Form("hTrklT0Mul"),
1354  Form(
1355  "Tracklet #DeltaT0 vs. Trkl - Multiplicity; Mul_{Tracklet}; #Delta(T0)"),
1356  10,
1357  0,
1358  10,
1359  100,
1360  -2.,
1361  2.);
1362  fhTrklDT0SmMis = new TH2F(
1363  Form("hTrklDT0SmMis"),
1364  Form("Tracklet DeltaT0 vs. Trkl - ID; SmType_{missed}; #Delta(T0)"),
1365  10,
1366  0,
1367  10,
1368  100,
1369  -2.,
1370  2.);
1371  fhTrklDT0StMis2 = new TH2F(
1372  Form("hTrklDT0SmMis2"),
1373  Form("Tracklet DeltaT0 vs. Station - ID; St2_{missed}; #Delta(T0)"),
1374  50,
1375  0,
1376  50,
1377  100,
1378  -2.,
1379  2.);
1380 
1381  Double_t X0MAX = 40.;
1382  fhTrklXY0_0 =
1383  new TH2F(Form("hTrklXY0_0"),
1384  Form("Tracklet XY at z=0 for hmulmax ; x (cm); y (cm)"),
1385  100,
1386  -X0MAX,
1387  X0MAX,
1388  100,
1389  -X0MAX,
1390  X0MAX);
1391  fhTrklXY0_1 =
1392  new TH2F(Form("hTrklXY0_1"),
1393  Form("Tracklet XY at z=0 for hmulmax-1 ; x (cm); y (cm)"),
1394  100,
1395  -X0MAX * 2.,
1396  X0MAX * 2.,
1397  100,
1398  -X0MAX * 2.,
1399  X0MAX * 2.);
1400  fhTrklXY0_2 =
1401  new TH2F(Form("hTrklXY0_2"),
1402  Form("Tracklet XY at z=0 for hmulmax-2 ; x (cm); y (cm)"),
1403  100,
1404  -X0MAX * 3.,
1405  X0MAX * 3.,
1406  100,
1407  -X0MAX * 3.,
1408  X0MAX * 3.);
1409 
1410  Double_t DT0MAX = 5.;
1411  if (fT0MAX == 0) fT0MAX = DT0MAX;
1412  fhPullT_Smt =
1413  new TH2F(Form("hPullT_Smt"),
1414  Form("Tracklet ResiT vs RpcInd ; RpcInd ; #DeltaT (ns)"),
1415  nSmt,
1416  0,
1417  nSmt,
1418  501,
1419  -fT0MAX,
1420  fT0MAX);
1421  Double_t DX0MAX = 5.;
1422  fhPullX_Smt =
1423  new TH2F(Form("hPullX_Smt"),
1424  Form("Tracklet ResiX vs RpcInd ; RpcInd ; #DeltaX (cm)"),
1425  nSmt,
1426  0,
1427  nSmt,
1428  100,
1429  -DX0MAX,
1430  DX0MAX);
1431  Double_t DY0MAX = 5.;
1432  fhPullY_Smt =
1433  new TH2F(Form("hPullY_Smt"),
1434  Form("Tracklet ResiY vs RpcInd ; RpcInd ; #DeltaY (cm)"),
1435  nSmt,
1436  0,
1437  nSmt,
1438  100,
1439  -DY0MAX,
1440  DY0MAX);
1441  Double_t DZ0MAX = 20.;
1442  fhPullZ_Smt =
1443  new TH2F(Form("hPullZ_Smt"),
1444  Form("Tracklet ResiZ vs RpcInd ; RpcInd ; #DeltaZ (cm)"),
1445  nSmt,
1446  0,
1447  nSmt,
1448  100,
1449  -DZ0MAX,
1450  DZ0MAX);
1451 
1452  fhTOff_Smt = new TH2F(Form("hTOff_Smt"),
1453  Form("Tracklet TOff; RpcInd ; TOff (ns)"),
1454  nSmt,
1455  0,
1456  nSmt,
1457  501,
1458  -fT0MAX,
1459  fT0MAX);
1460  fhTOff_HMul2 = new TH2F(Form("hTOff_HMul2"),
1461  Form("Tracklet TOff(HMul2); RpcInd ; TOff (ns)"),
1462  nSmt,
1463  0,
1464  nSmt,
1465  500,
1466  -fT0MAX,
1467  fT0MAX);
1468 
1469  Double_t DTTMAX = 0.09;
1470  fhDeltaTt_Smt = new TH2F(Form("hDeltaTt_Smt"),
1471  Form("Tracklet DeltaTt; RpcInd ; #DeltaTt (ns/cm)"),
1472  nSmt,
1473  0,
1474  nSmt,
1475  100,
1476  -DTTMAX,
1477  DTTMAX);
1478 
1479  vhPullX.resize(fNTofStations);
1480  vhPullY.resize(fNTofStations);
1481  vhPullZ.resize(fNTofStations);
1482  vhPullT.resize(fNTofStations);
1483  vhPullTB.resize(fNTofStations);
1486  vhXY_AllTracks.resize(fNTofStations);
1489  vhXY_DX.resize(fNTofStations);
1490  vhXY_DY.resize(fNTofStations);
1491  vhXY_DT.resize(fNTofStations);
1492  vhXY_TOT.resize(fNTofStations);
1493  vhXY_CSZ.resize(fNTofStations);
1494  vhUDXDY_DT.resize(fNTofStations);
1495  vhUCDXDY_DT.resize(fNTofStations);
1496 
1497  for (Int_t iSt = 0; iSt < fNTofStations; iSt++) {
1498  vhPullX[iSt] = new TH1F(Form("hPullX_Station_%d", iSt),
1499  Form("hResiX_Station_%d; #DeltaX (cm)", iSt),
1500  99,
1501  -DX0MAX,
1502  DX0MAX);
1503  vhPullY[iSt] = new TH1F(Form("hPullY_Station_%d", iSt),
1504  Form("hResiY_Station_%d; #DeltaY (cm)", iSt),
1505  99,
1506  -DY0MAX,
1507  DY0MAX);
1508  vhPullZ[iSt] = new TH1F(Form("hPullZ_Station_%d", iSt),
1509  Form("hResiZ_Station_%d; #DeltaZ (cm)", iSt),
1510  99,
1511  -50.,
1512  50.);
1513  vhPullT[iSt] = new TH1F(Form("hPullT_Station_%d", iSt),
1514  Form("hResiT_Station_%d; #DeltaT (ns)", iSt),
1515  59,
1516  -fT0MAX,
1517  fT0MAX);
1518  vhPullTB[iSt] = new TH1F(Form("hPullTB_Station_%d", iSt),
1519  Form("hResiTB_Station_%d; #DeltaT (ns)", iSt),
1520  59,
1521  -1.25 * fT0MAX,
1522  1.25 * fT0MAX);
1523  const Double_t TOTmax = 50.;
1524  vhResidualTBWalk[iSt] =
1525  new TH2F(Form("hResidualTBWalk_Station_%d", iSt),
1526  Form("hResidualTBWalk_Station_%d; #DeltaT (ns)", iSt),
1527  TOTmax,
1528  0.,
1529  TOTmax,
1530  59,
1531  -1.25 * fT0MAX,
1532  1.25 * fT0MAX);
1533  vhResidualYWalk[iSt] =
1534  new TH2F(Form("hResidualYWalk_Station_%d", iSt),
1535  Form("hResidualYWalk_Station_%d; #DeltaT (ns)", iSt),
1536  TOTmax,
1537  0.,
1538  TOTmax,
1539  59,
1540  -DY0MAX,
1541  DY0MAX);
1542  Double_t XSIZ = 16.;
1543  Int_t Nbins = 32.;
1545  if (NULL == fChannelInfo) {
1546  LOG(fatal) << "Geometry for station " << iSt << ", Rpc "
1547  << fMapStationRpcId[iSt] << " not defined ";
1548  return;
1549  }
1550  Int_t NbinsX = 2 * XSIZ / fChannelInfo->GetSizex();
1551  vhXY_AllTracks[iSt] =
1552  new TH2F(Form("hXY_AllTracks_%d", iSt),
1553  Form("hXY_AllTracks_%d; x(cm); y (cm)", iSt),
1554  NbinsX,
1555  -XSIZ,
1556  XSIZ,
1557  Nbins,
1558  -XSIZ,
1559  XSIZ);
1560  vhXY_AllStations[iSt] =
1561  new TH2F(Form("hXY_AllStations_%d", iSt),
1562  Form("hXY_AllStations_%d; x(cm); y (cm)", iSt),
1563  NbinsX,
1564  -XSIZ,
1565  XSIZ,
1566  Nbins,
1567  -XSIZ,
1568  XSIZ);
1569  vhXY_MissedStation[iSt] =
1570  new TH2F(Form("hXY_MissedStation_%d", iSt),
1571  Form("hXY_MissedStation_%d; x(cm); y (cm)", iSt),
1572  NbinsX,
1573  -XSIZ,
1574  XSIZ,
1575  Nbins,
1576  -XSIZ,
1577  XSIZ);
1578  vhXY_DX[iSt] =
1579  new TH3F(Form("hXY_DX_%d", iSt),
1580  Form("hXY_DX_%d; x(cm); y (cm); #DeltaX (cm)", iSt),
1581  NbinsX,
1582  -XSIZ,
1583  XSIZ,
1584  Nbins,
1585  -XSIZ,
1586  XSIZ,
1587  Nbins,
1588  -2.,
1589  2.);
1590  vhXY_DY[iSt] =
1591  new TH3F(Form("hXY_DY_%d", iSt),
1592  Form("hXY_DY_%d; x(cm); y (cm); #DeltaY (cm)", iSt),
1593  NbinsX,
1594  -XSIZ,
1595  XSIZ,
1596  Nbins,
1597  -XSIZ,
1598  XSIZ,
1599  Nbins,
1600  -2.,
1601  2.);
1602  vhXY_DT[iSt] =
1603  new TH3F(Form("hXY_DT_%d", iSt),
1604  Form("hXY_DT_%d; x(cm); y (cm); #DeltaT (ns)", iSt),
1605  NbinsX,
1606  -XSIZ,
1607  XSIZ,
1608  Nbins,
1609  -XSIZ,
1610  XSIZ,
1611  Nbins,
1612  -0.5,
1613  0.5);
1614  vhXY_TOT[iSt] =
1615  new TH3F(Form("hXY_TOT_%d", iSt),
1616  Form("hXY_TOT_%d; x(cm); y (cm); TOT (a.u.)", iSt),
1617  NbinsX,
1618  -XSIZ,
1619  XSIZ,
1620  Nbins,
1621  -XSIZ,
1622  XSIZ,
1623  Nbins,
1624  0.,
1625  10.);
1626  vhXY_CSZ[iSt] = new TH3F(Form("hXY_CSZ_%d", iSt),
1627  Form("hXY_CSZ_%d; x(cm); y (cm); CSZ ()", iSt),
1628  NbinsX,
1629  -XSIZ,
1630  XSIZ,
1631  Nbins,
1632  -XSIZ,
1633  XSIZ,
1634  6,
1635  1.,
1636  7.);
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)",
1640  iSt),
1641  11,
1642  -3.,
1643  3.,
1644  11,
1645  -3.,
1646  3.,
1647  101,
1648  -50.,
1649  50.);
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)",
1653  iSt),
1654  11,
1655  -3.,
1656  3.,
1657  11,
1658  -3.,
1659  3.,
1660  101,
1661  -50.,
1662  50.);
1663  }
1664 
1665 
1666  // vertex histrograms
1667  Double_t NNORM = 40.;
1668  fhVTXNorm = new TH1F(Form("hVTXNorm"),
1669  Form("Vertex Normalisation; #_{TrackletHits}"),
1670  NNORM,
1671  0,
1672  NNORM);
1673  fhVTX_XY0 = new TH2F(Form("hVTX_XY0"),
1674  Form("Vertex XY at z=0 ; x (xm); y (cm)"),
1675  100,
1676  -X0MAX,
1677  X0MAX,
1678  100,
1679  -X0MAX,
1680  X0MAX);
1681  fhVTX_DT0_Norm =
1682  new TH2F(Form("hVTX_DT0_Norm"),
1683  Form("Vertex #DeltaT at z=0 ; #_{TrackletHits}; #DeltaT (ns)"),
1684  NNORM,
1685  0,
1686  NNORM,
1687  100,
1688  -2.,
1689  2.);
1690 
1691  gDirectory->cd(
1692  oldir
1693  ->GetPath()); // <= To prevent histos from being sucked in by the param file of the TRootManager!
1694 }
1695 
1697  fVTX_T = 0.; //reset
1698  fVTX_X = 0.;
1699  fVTX_Y = 0.;
1700  fVTX_Z = 0.;
1701  fVTXNorm = 0.;
1702 
1703  for (Int_t iTrk = 0; iTrk < fTrackArray->GetEntries(); iTrk++) {
1704  CbmTofTracklet* pTrk = (CbmTofTracklet*) fTrackArray->At(iTrk);
1705  if (NULL == pTrk) continue;
1706  Double_t w = pTrk->GetNofHits();
1707  LOG(debug1) << Form(
1708  "CbmTofFindTracks::FindVertex: N %3.0f, w %3.0f, min %d",
1709  fVTXNorm,
1710  w,
1711  fMinNofHits);
1712 
1713  if (w > (Double_t)
1714  fMinNofHits) { // for further analysis request minimum number of hits
1715  fVTXNorm += w;
1716  fVTX_T += w * pTrk->GetFitT(0.);
1717  fVTX_X += w * pTrk->GetFitX(0.);
1718  fVTX_Y += w * pTrk->GetFitY(0.);
1719  }
1720  }
1721  if (fVTXNorm > 0.) {
1722  fVTX_T /= fVTXNorm;
1723  fVTX_X /= fVTXNorm;
1724  fVTX_Y /= fVTXNorm;
1725  fVTX_Z /= fVTXNorm;
1726  }
1727  LOG(debug) << Form(
1728  "CbmTofFindTracks::FindVertex: N %3.0f, T %6.2f, X=%6.2f, Y=%6.2f Z=%6.2f ",
1729  fVTXNorm,
1730  fVTX_T,
1731  fVTX_X,
1732  fVTX_Y,
1733  fVTX_Z);
1734 }
1735 
1736 static Int_t iWarnNotDefined = 0;
1737 
1739  // Locate reference ("beam counter") hit
1740  CbmTofHit* pRefHit = NULL;
1741  Double_t RefMinTime = 1.E300;
1742  for (Int_t iHit = 0; iHit < fTofHitArray->GetEntries();
1743  iHit++) { // loop over Hits
1744  CbmTofHit* pHit = (CbmTofHit*) fTofHitArray->At(iHit);
1745  Int_t iAddr = (pHit->GetAddress() & DetMask);
1746  if (fiBeamCounter != -1) {
1747  if (iAddr == fiBeamCounter)
1748  if (pHit->GetTime() < RefMinTime) {
1749  pRefHit = pHit;
1750  RefMinTime = pRefHit->GetTime();
1751  }
1752  } else { // take earliest hit as reference
1753  if (pHit->GetTime() < RefMinTime) {
1754  pRefHit = pHit;
1755  RefMinTime = pRefHit->GetTime();
1756  }
1757  }
1758  }
1759  if (fiBeamCounter != -1 && NULL == pRefHit) return;
1760 
1761  std::vector<Int_t> HMul;
1762  HMul.resize(fNTofStations + 1);
1763  // HMul.clear();
1764 
1765  fhTrklMul->Fill(fTrackArray->GetEntries());
1766 
1767  Int_t iTMul = 0;
1768  for (Int_t iTrk = 0; iTrk < fTrackArray->GetEntries(); iTrk++) {
1769  CbmTofTracklet* pTrk = (CbmTofTracklet*) fTrackArray->At(iTrk);
1770  if (NULL == pTrk) continue;
1771  if (pTrk->GetNofHits() > fNTofStations) {
1772  LOG(error) << "CbmTofFindTracks::FillHistograms: more hits ("
1773  << pTrk->GetNofHits() << ") than stations (" << fNTofStations
1774  << ")";
1775  continue;
1776  }
1777 
1778  HMul[pTrk->GetNofHits()]++;
1779 
1780  if (pTrk->GetNofHits() >= 2) { // initial offset calibration
1781  //Int_t iH0 = pTrk->GetStationHitIndex(fMapStationRpcId[0]); // Hit index for station 0 (Diamond)
1782  //if(iH0<0) continue; // Station 0 not part of tracklet
1783  // Int_t iDetId0 = pTrk->GetTofDetIndex(0); // DetId of 1. Hit (FU) not used
1784  // Int_t iSt0 = GetStationOfAddr(iDetId0); // Station of 1. Hit (FU) not used
1785  CbmTofHit* pHit0 = pTrk->GetTofHitPointer(0);
1786  Double_t dTRef0 = pHit0->GetTime() - pHit0->GetR() * fTtTarg;
1787 
1788  for (Int_t iH = 1; iH < pTrk->GetNofHits(); iH++) {
1789  Int_t iDetId = pTrk->GetTofDetIndex(iH); // DetId of iH. Hit
1790  CbmTofHit* pHit = pTrk->GetTofHitPointer(iH);
1791  Int_t iSt = GetStationOfAddr(iDetId); // Station of 1. Hit
1792  Double_t dTOff = pHit->GetTime() - pHit->GetR() * fTtTarg - dTRef0;
1793  LOG(debug1) << Form("<D> CbmTofFindTracks::FillHistograms: iDetId1 "
1794  "0x%08x, iST1 = %d with dTOff %f at RpcInd %d",
1795  iDetId,
1796  iSt,
1797  dTOff,
1799  fhTOff_HMul2->Fill((Double_t) fMapRpcIdParInd[fMapStationRpcId[iSt]],
1800  dTOff);
1801  } // loop over tracklets' hits
1802  }
1803 
1804  if (
1805  pTrk->GetNofHits()
1806  > fMinNofHits) { // for further analysis request at least 3 matched hits
1807  iTMul++;
1808  fhTrklChi2->Fill(pTrk->GetNofHits(), pTrk->GetChiSq());
1809 
1810  if (fiCalOpt > 0) fTofCalibrator->FillCalHist(pTrk);
1811 
1812  CbmTofTrackletParam* tPar = pTrk->GetTrackParameter();
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",
1815  iTrk,
1816  tPar->GetLz(),
1817  pTrk->GetZ0x(),
1818  pTrk->GetZ0y(),
1819  dTt)
1820  << tPar->ToString();
1821 
1822  fhTrklZ0xHMul->Fill(pTrk->GetNofHits(), pTrk->GetFitX(0.));
1823  fhTrklZ0yHMul->Fill(pTrk->GetNofHits(), pTrk->GetFitY(0.));
1824  fhTrklTxHMul->Fill(pTrk->GetNofHits(), tPar->GetTx());
1825  fhTrklTyHMul->Fill(pTrk->GetNofHits(), tPar->GetTy());
1826  fhTrklTtHMul->Fill(pTrk->GetNofHits(), dTt);
1827 
1828  switch (GetNReqStations() - pTrk->GetNofHits()) {
1829  case 0: // max hit number
1830  fhTrklXY0_0->Fill(pTrk->GetFitX(0.), pTrk->GetFitY(0.));
1831  break;
1832  case 1: fhTrklXY0_1->Fill(pTrk->GetFitX(0.), pTrk->GetFitY(0.)); break;
1833  case 2: fhTrklXY0_2->Fill(pTrk->GetFitX(0.), pTrk->GetFitY(0.)); break;
1834  default:;
1835  }
1836 
1837  if (dTt > 0.)
1838  for (Int_t iSt = 0; iSt < fNTofStations; iSt++) {
1839  Int_t iH = pTrk->GetStationHitIndex(
1840  fMapStationRpcId[iSt]); // Station Hit index
1841  if (iH < 0) continue; // Station not part of tracklet
1842  fhUsedHitsStation->Fill(iSt);
1843 
1844  if (pTrk->GetNofHits() < GetNReqStations())
1845  continue; // fill Pull histos only for complete tracks
1846  CbmTofHit* pHit = (CbmTofHit*) fTofHitArray->At(iH);
1847 
1848  //if (0 == fMapStationRpcId[iSt]) pHit->SetTime(pTrk->GetT0()); // set time of fake hit, abandoned
1849  /*
1850  cout << " -D- CbmTofFindTracks::FillHistograms: "<< iSt <<", "
1851  <<fMapStationRpcId[iSt]<<", "<< iH <<", "<< iH0 <<", "<<pHit->ToString() << endl;
1852  */
1853  Double_t dDZ =
1854  pHit->GetZ() - tPar->GetZ(); // z- Distance to reference point
1855  Double_t dDX =
1856  pHit->GetX()
1857  - pTrk->GetFitX(
1858  pHit->GetZ()); // - tPar->GetX() - tPar->GetTx()*dDZ;
1859  Double_t dDY =
1860  pHit->GetY() - pTrk->GetFitY(pHit->GetZ()); // - tPar->GetTy()*dDZ;
1861  Double_t dDT =
1862  pHit->GetTime()
1863  - pTrk->GetFitT(
1864  pHit->GetZ()); // pTrk->GetTdif(fMapStationRpcId[iSt]);
1865  Double_t dDTB =
1866  fTrackletTools->GetTdif(pTrk,
1867  fMapStationRpcId[iSt],
1868  pHit); // ignore pHit in calc of reference
1869  Double_t dTOT = pHit->GetCh() / 10.; // misuse of channel field
1870 
1871  Double_t dZZ = pHit->GetZ() - tPar->GetZy(pHit->GetY());
1872  LOG(debug) << Form(
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 ",
1875  iSt,
1876  fMapStationRpcId[iSt],
1877  iH,
1878  pHit->GetZ(),
1879  dDX,
1880  dDY,
1881  dDZ,
1882  dDT,
1883  dDTB,
1884  dZZ,
1885  dTt) << tPar->ToString();
1886 
1887  vhPullX[iSt]->Fill(dDX);
1888  vhPullY[iSt]->Fill(dDY);
1889  vhPullZ[iSt]->Fill(dZZ);
1890  vhPullT[iSt]->Fill(dDT);
1891  vhPullTB[iSt]->Fill(dDTB);
1892  vhResidualTBWalk[iSt]->Fill(dTOT, dDTB);
1893  vhResidualYWalk[iSt]->Fill(dTOT, dDY);
1894 
1895  fhPullT_Smt->Fill((Double_t) fMapRpcIdParInd[fMapStationRpcId[iSt]],
1896  dDT);
1897  fhPullX_Smt->Fill((Double_t) fMapRpcIdParInd[fMapStationRpcId[iSt]],
1898  dDX);
1899  fhPullY_Smt->Fill((Double_t) fMapRpcIdParInd[fMapStationRpcId[iSt]],
1900  dDY);
1901  /*
1902  fhPullT_Smt->Fill((Double_t)fMapRpcIdParInd[fMapStationRpcId[iSt]], fTrackletTools->GetTdif(pTrk,fMapStationRpcId[iSt], pHit) );
1903  fhPullX_Smt->Fill((Double_t)fMapRpcIdParInd[fMapStationRpcId[iSt]], fTrackletTools->GetXdif(pTrk,fMapStationRpcId[iSt], pHit) );
1904  fhPullY_Smt->Fill((Double_t)fMapRpcIdParInd[fMapStationRpcId[iSt]], fTrackletTools->GetYdif(pTrk,fMapStationRpcId[iSt], pHit) );
1905  */
1906  fhPullZ_Smt->Fill((Double_t) fMapRpcIdParInd[fMapStationRpcId[iSt]],
1907  dZZ);
1908 
1909  Double_t dDeltaTt = dTt - fTtTarg;
1910  fhDeltaTt_Smt->Fill((Double_t) fMapRpcIdParInd[fMapStationRpcId[iSt]],
1911  dDeltaTt);
1912  //XXX use BRef as Referenz!!!
1913  if (pRefHit != NULL) {
1914  Double_t dTOff =
1915  dDeltaTt * //pHit->GetR();
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))
1919  * TMath::Sign(1, pHit->GetZ() - pRefHit->GetZ());
1920  fhTOff_Smt->Fill((Double_t) fMapRpcIdParInd[fMapStationRpcId[iSt]],
1921  dTOff);
1922  }
1923  }
1924 
1925  // extrapolation of tracklet to vertex @ z=0
1926  // FairTrackParam paramExtr;
1927  // fFitter->Extrapolate(pTrk->GetParamFirst(),0.,&paramExtr);
1928  } // condition on NofHits>2 end
1929 
1930  // monitoring of tracklet hits with selected velocities from reference counters
1931  if (TMath::Abs(pTrk->GetRefVel((UInt_t)(fNReqStations - 1)) - fdRefVelMean)
1932  < fdRefDVel) {
1933  fhTrklVelHMul->Fill(pTrk->GetNofHits(), 1. / pTrk->GetTt());
1934  for (Int_t iH = 0; iH < pTrk->GetNofHits(); iH++) {
1935  CbmTofHit* pHit = pTrk->GetTofHitPointer(iH);
1936  Int_t iChId = pHit->GetAddress();
1938  if (NULL == fChannelInfo) continue;
1939  Int_t iAddr = iChId & DetMask;
1940  Int_t iSt = GetStationOfAddr(iAddr);
1941  Double_t hitpos[3] = {3 * 0.};
1942  Double_t hitpos_local[3] = {3 * 0.};
1943  gGeoManager->FindNode(
1945  Int_t iRpcInd = fMapRpcIdParInd[iChId & DetMask];
1946  hitpos[0] =
1947  pHit->GetX() - (Double_t) fhPullX_Smt_Off->GetBinContent(iRpcInd + 1);
1948  hitpos[1] =
1949  pHit->GetY() - (Double_t) fhPullY_Smt_Off->GetBinContent(iRpcInd + 1);
1950  hitpos[2] =
1951  pHit->GetZ() - (Double_t) fhPullZ_Smt_Off->GetBinContent(iRpcInd + 1);
1952  gGeoManager->MasterToLocal(hitpos, hitpos_local);
1953  vhXY_AllTracks[iSt]->Fill(hitpos_local[0], hitpos_local[1]);
1954  }
1955 
1956  if (pTrk->GetNofHits() >= fNReqStations) { // all possible hits are there
1957  LOG(debug) << "Complete Tracklet in event " << fiEvent;
1958 
1959  for (Int_t iSt = 0; iSt < fNTofStations; iSt++) {
1960  Int_t iH = pTrk->GetStationHitIndex(
1961  fMapStationRpcId[iSt]); // Station Hit index
1962  if (iH < 0) {
1963  LOG(debug) << " Incomplete Tracklet, skip station " << iSt;
1964  continue; // Station not part of tracklet
1965  }
1966  CbmTofHit* pHit = (CbmTofHit*) fTofHitArray->At(iH);
1967  Int_t iChId = pHit->GetAddress();
1968  Double_t hitpos[3] = {3 * 0.};
1969  Double_t hitpos_local[3] = {3 * 0.};
1971  if (NULL == fChannelInfo) {
1972  //faked hit, take init values
1973  } else {
1974  /* TGeoNode *fNode=*/ // prepare global->local trafo
1975  gGeoManager->FindNode(
1977  Int_t iRpcInd = fMapRpcIdParInd[iChId & DetMask];
1978  hitpos[0] =
1979  pHit->GetX()
1980  - (Double_t) fhPullX_Smt_Off->GetBinContent(iRpcInd + 1);
1981  hitpos[1] =
1982  pHit->GetY()
1983  - (Double_t) fhPullY_Smt_Off->GetBinContent(iRpcInd + 1);
1984  hitpos[2] =
1985  pHit->GetZ()
1986  - (Double_t) fhPullZ_Smt_Off->GetBinContent(iRpcInd + 1);
1987  /* TGeoNode* cNode= gGeoManager->GetCurrentNode();*/
1988  gGeoManager->MasterToLocal(hitpos, hitpos_local);
1989  }
1990  vhXY_AllStations[iSt]->Fill(hitpos_local[0], hitpos_local[1]);
1991  Double_t dDX =
1992  pHit->GetX()
1993  - pTrk->GetFitX(
1994  pHit->GetZ()); // - tPar->GetX() - tPar->GetTx()*dDZ;
1995  Double_t dDY =
1996  pHit->GetY() - pTrk->GetFitY(pHit->GetZ()); // - tPar->GetTy()*dDZ;
1997  //Double_t dDT = pHit->GetTime() - pTrk->GetFitT(pHit->GetR()); //pTrk->GetTdif(fMapStationRpcId[iSt]);
1998  Double_t dDTB =
1999  fTrackletTools->GetTdif(pTrk,
2000  fMapStationRpcId[iSt],
2001  pHit); // ignore pHit in calc of reference
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
2007  / dCSZ; // counteract UHIT flagging
2008  vhXY_TOT[iSt]->Fill(hitpos_local[0], hitpos_local[1], dTOT);
2009  vhXY_CSZ[iSt]->Fill(hitpos_local[0], hitpos_local[1], dCSZ);
2010 
2011  // debugging consistency of geometry transformations ....
2012  if (FairLogger::GetLogger()->IsLogNeeded(fair::Severity::debug)) {
2013  if (iSt == fNReqStations - 1) { // treat as if not found
2014  Int_t iAddr = fMapStationRpcId[iSt];
2015  CbmTofCell* fChannelInfoD = fDigiPar->GetCell(iAddr);
2016  Double_t zPos = 0;
2017  Double_t zPosMiss = -1;
2018  Double_t hitposD[3];
2019  Double_t hitpos_localD[3];
2020  Int_t NIter = 5;
2021  Int_t iRpcInd = fMapRpcIdParInd[iAddr];
2022  Int_t iNbCh =
2024  CbmTofAddress::GetRpcId(iAddr));
2025  while (zPos != zPosMiss && 0 < NIter--) {
2026  fChannelInfoD = fDigiPar->GetCell(iAddr);
2027  gGeoManager->FindNode(fChannelInfoD->GetX(),
2028  fChannelInfoD->GetY(),
2029  fChannelInfoD->GetZ());
2030  zPos = fChannelInfoD->GetZ()
2031  + (Double_t) fhPullZ_Smt_Off->GetBinContent(iRpcInd + 1);
2032  hitposD[0] =
2033  pTrk->GetFitX(zPos)
2034  - (Double_t) fhPullX_Smt_Off->GetBinContent(iRpcInd + 1);
2035  hitposD[1] =
2036  pTrk->GetFitY(zPos)
2037  - (Double_t) fhPullY_Smt_Off->GetBinContent(iRpcInd + 1);
2038  hitposD[2] = fChannelInfoD->GetZ();
2039  /* TGeoNode* cNode=*/gGeoManager->GetCurrentNode();
2040  gGeoManager->MasterToLocal(hitposD, hitpos_localD);
2041  // Check for consistency of geometry
2042  Int_t iChTrafo = CbmTofAddress::GetChannelId(iAddr);
2043  Int_t iChMiss = hitpos_localD[0] / fChannelInfoD->GetSizex()
2044  + (iNbCh - 1) / 2;
2045  if (iChMiss < 0) iChMiss = 0;
2046  if (iChMiss > iNbCh - 1) iChMiss = iNbCh - 1;
2047  assert(fDigiBdfPar);
2048  if (iChMiss > -1 && iChMiss < iNbCh) {
2049  Int_t iAddrMiss = CbmTofAddress::GetUniqueAddress(
2050  CbmTofAddress::GetSmId(iAddr),
2051  CbmTofAddress::GetRpcId(iAddr),
2052  iChMiss,
2053  0,
2054  CbmTofAddress::GetSmType(iAddr));
2055  CbmTofCell* fChannelInfoMiss = fDigiPar->GetCell(iAddrMiss);
2056  zPosMiss =
2057  fChannelInfoMiss->GetZ()
2058  + (Double_t) fhPullZ_Smt_Off->GetBinContent(iRpcInd + 1);
2059  LOG(debug) << Form(
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",
2062  iAddr,
2063  iSt,
2064  zPos,
2065  zPosMiss,
2066  iChTrafo,
2067  iChMiss,
2068  hitpos_localD[0],
2069  fChannelInfoD->GetSizex());
2070  fChannelInfo = fChannelInfoMiss;
2071  iAddr = iAddrMiss;
2072  } else
2073  zPosMiss = zPos;
2074  LOG(debug) << Form(
2075  "Predicted hit in Last Station 0x%08x at local pos x %6.2f, "
2076  "y %6.2f, z %6.2f, cell %p",
2077  iAddr,
2078  hitpos_localD[0],
2079  hitpos_localD[1],
2080  zPos,
2081  fChannelInfoD);
2082  LOG(debug) << Form(
2083  "Measured hit in Last Station 0x%08x at local pos x %6.2f, "
2084  "y %6.2f, z %6.2f, cell %p",
2085  pHit->GetAddress(),
2086  hitpos_local[0],
2087  hitpos_local[1],
2088  pHit->GetZ(),
2089  fChannelInfo);
2090  }
2091  }
2092  }
2093  }
2094  } else {
2095  if (pTrk->GetNofHits() == fNReqStations - 1) { // one hit missing
2096  for (Int_t iSt = 0; iSt < fNTofStations; iSt++) {
2097  Int_t iH = pTrk->GetStationHitIndex(
2098  fMapStationRpcId[iSt]); // Station Hit index
2099  if (iH < 0) { // find geo element for the missing Station iSt
2100  Int_t iAddr = fMapStationRpcId[iSt];
2101  if (iAddr < 1) continue;
2102  //Int_t iChId = CbmTofAddress::GetUniqueAddress(0,0,0,0,iSmType);
2103  //CbmTofCell* fChannelInfo = fDigiPar->GetCell( iChId );
2105  if (NULL == fChannelInfo) {
2106  if (iWarnNotDefined++ < 100)
2107  LOG(warning) << Form("CbmTofFindTracks::FillHistograms: Cell "
2108  "0x%08x not defined for Station %d",
2109  iAddr,
2110  iSt);
2111  continue;
2112  }
2113  /* TGeoNode *fNode= */ // prepare global->local trafo
2114  Double_t zPos = 0;
2115  Double_t zPosMiss = -1;
2116  Double_t hitpos[3];
2117  Double_t hitpos_local[3];
2118  Int_t NIter = 5;
2119  Int_t iRpcInd = fMapRpcIdParInd[iAddr];
2120  Int_t iNbCh =
2122  CbmTofAddress::GetRpcId(iAddr));
2123  while (zPos != zPosMiss && 0 < NIter--) {
2124  fChannelInfo = fDigiPar->GetCell(iAddr);
2125  gGeoManager->FindNode(fChannelInfo->GetX(),
2126  fChannelInfo->GetY(),
2127  fChannelInfo->GetZ());
2128  zPos = fChannelInfo->GetZ()
2129  + (Double_t) fhPullZ_Smt_Off->GetBinContent(iRpcInd + 1);
2130  hitpos[0] =
2131  pTrk->GetFitX(zPos)
2132  - (Double_t) fhPullX_Smt_Off->GetBinContent(iRpcInd + 1);
2133  hitpos[1] =
2134  pTrk->GetFitY(zPos)
2135  - (Double_t) fhPullY_Smt_Off->GetBinContent(iRpcInd + 1);
2136  hitpos[2] = fChannelInfo->GetZ();
2137  /* TGeoNode* cNode=*/gGeoManager->GetCurrentNode();
2138  gGeoManager->MasterToLocal(hitpos, hitpos_local);
2139 
2140  // Check for consistency of geometry
2141  Int_t iChTrafo = CbmTofAddress::GetChannelId(iAddr);
2142  Int_t iChMiss =
2143  hitpos_local[0] / fChannelInfo->GetSizex() + (iNbCh - 1) / 2;
2144  if (iChMiss < 0) iChMiss = 0;
2145  if (iChMiss > iNbCh - 1) iChMiss = iNbCh - 1;
2146  assert(fDigiBdfPar);
2147  if (iChMiss > -1 && iChMiss < iNbCh) {
2148  Int_t iAddrMiss = CbmTofAddress::GetUniqueAddress(
2149  CbmTofAddress::GetSmId(iAddr),
2150  CbmTofAddress::GetRpcId(iAddr),
2151  iChMiss,
2152  0,
2153  CbmTofAddress::GetSmType(iAddr));
2154  CbmTofCell* fChannelInfoMiss = fDigiPar->GetCell(iAddrMiss);
2155  zPosMiss =
2156  fChannelInfoMiss->GetZ()
2157  + (Double_t) fhPullZ_Smt_Off->GetBinContent(iRpcInd + 1);
2158 
2159  LOG(debug) << Form(
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",
2162  iAddr,
2163  iSt,
2164  zPos,
2165  zPosMiss,
2166  iChTrafo,
2167  iChMiss,
2168  hitpos_local[0],
2169  fChannelInfo->GetSizex());
2170  fChannelInfo = fChannelInfoMiss;
2171  iAddr = iAddrMiss;
2172  } else
2173  zPosMiss = zPos;
2174  }
2175  if (iSt == fNReqStations - 1)
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",
2178  fiEvent,
2179  hitpos_local[0],
2180  hitpos_local[1],
2181  zPos);
2182 
2183  vhXY_MissedStation[iSt]->Fill(hitpos_local[0], hitpos_local[1]);
2184 
2185  // correlation analysis
2186  for (Int_t iTrk1 = iTrk + 1; iTrk1 < fTrackArray->GetEntries();
2187  iTrk1++) {
2188  CbmTofTracklet* pTrk1 =
2189  (CbmTofTracklet*) fTrackArray->At(iTrk1);
2190  if (NULL == pTrk1 || pTrk == pTrk1) continue;
2191  if (pTrk1->GetNofHits()
2192  >= fNReqStations) { // all possible hits are there
2193  fhTrklDT0SmMis->Fill(iSt,
2194  pTrk->GetFitT(0.) - pTrk1->GetFitT(0.));
2195  } else {
2196  if (pTrk1->GetNofHits()
2197  == fNReqStations - 1) { // one hit missing
2198  for (Int_t iSt1 = 0; iSt1 < fNTofStations; iSt1++) {
2199  Int_t iH1 = pTrk1->GetStationHitIndex(
2200  fMapStationRpcId[iSt1]); // Station Hit index
2201  if (
2202  iH1
2203  < 0) { // find geo element for the missing Station iSt
2204  // Int_t iSmType1 = fMapStationRpcId[iSt1]; (FU) not used
2205  //if (iSmType1 < 1) continue;
2206  fhTrklDT0StMis2->Fill(Double_t(iSt * 10 + iSt1),
2207  pTrk->GetFitT(0.)
2208  - pTrk1->GetFitT(0.));
2209  }
2210  }
2211  }
2212  }
2213  }
2214  }
2215  }
2216  }
2217  }
2218  } // velocity selection end
2219  } // loop over tracklets end
2220 
2221  if (HMul.size() > 3)
2222  fhTrklMulMaxMM->Fill(HMul[fNTofStations], HMul[fNTofStations - 1]);
2223  if (HMul.size() > 5)
2224  fhTrklMul3D->Fill(
2225  HMul[fNTofStations], HMul[fNTofStations - 1], HMul[fNTofStations - 2]);
2226  fhTrklMulNhits->Fill(fTofHitArray->GetEntries(), iTMul);
2227  fhTrackingTimeNhits->Fill(fTofHitArray->GetEntries(), fdTrackingTime);
2228 
2229  // print info about special events
2230  if (0)
2231  if (5 < fNTofStations)
2232  if (HMul[6] > 1) { // temporary
2233  //if (HMul[fNTofStations]>0)
2234  //LOG(info)<<"Found "<<HMul[fNTofStations]<<" max length tracklets in event "<<fiEvent
2235  LOG(info) << "Found " << HMul[6] << " max length tracklets in event "
2236  << fiEvent << " within " << fTofHitArray->GetEntries()
2237  << " hits ";
2238  for (Int_t iTrk = 0; iTrk < fTrackArray->GetEntries(); iTrk++) {
2239  CbmTofTracklet* pTrk = (CbmTofTracklet*) fTrackArray->At(iTrk);
2240  if (NULL == pTrk) continue;
2241  pTrk->PrintInfo();
2242  }
2243  }
2244  if (1)
2245  if (fTrackArray->GetEntries() > 25) { // temporary
2246  LOG(info) << "Found high multiplicity of " << fTrackArray->GetEntries()
2247  << " in event " << fiEvent << " from "
2248  << fTofHitArray->GetEntries() << " hits ";
2249  for (Int_t iTrk = 0; iTrk < fTrackArray->GetEntries(); iTrk++) {
2250  CbmTofTracklet* pTrk = (CbmTofTracklet*) fTrackArray->At(iTrk);
2251  if (NULL == pTrk) continue;
2252  pTrk->PrintInfo();
2253  }
2254  }
2255 
2256  if (iTMul > 1) {
2257  LOG(debug) << Form(
2258  "CbmTofFindTracks::FillHistograms NTrkl %d(%d) in event %d",
2259  iTMul,
2260  fTrackArray->GetEntries(),
2261  fiEvent);
2262  for (Int_t iTrk = 0; iTrk < fTrackArray->GetEntries(); iTrk++) {
2263  CbmTofTracklet* pTrk = (CbmTofTracklet*) fTrackArray->At(iTrk);
2264  if (NULL == pTrk) continue;
2265  if (
2266  pTrk->GetNofHits()
2267  > fMinNofHits) { // for further analysis request min # of matched hits
2268  for (Int_t iTrk1 = iTrk + 1; iTrk1 < fTrackArray->GetEntries();
2269  iTrk1++) {
2270  CbmTofTracklet* pTrk1 = (CbmTofTracklet*) fTrackArray->At(iTrk1);
2271  if (NULL == pTrk1) continue;
2272  if (
2273  pTrk1->GetNofHits()
2274  > fMinNofHits) { // for further analysis request min # of matched hits
2275  //cout << " -D- iT "<<iTrk<<", iT1 "<<iTrk1<<endl;
2276  fhTrklT0Mul->Fill(iTMul, pTrk->GetFitT(0.) - pTrk1->GetFitT(0.));
2277  }
2278  }
2279  }
2280  }
2281  }
2282 
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]); }
2289  }
2290 
2291  for (Int_t iHit = 0; iHit < fTofHitArray->GetEntries();
2292  iHit++) { // loop over Hits
2293  CbmTofHit* pHit = (CbmTofHit*) fTofHitArray->At(iHit);
2294  // Int_t iSmType = CbmTofAddress::GetSmType( pHit->GetAddress() & DetMask ); (FU) not used
2295  Int_t iAddr = (pHit->GetAddress() & DetMask);
2296  fhAllHitsSmTypes->Fill(GetStationOfAddr(iAddr));
2297  //cout << " -D- " << iSmType <<", " << fTypeStation[iSmType] << endl;
2298  if (GetStationOfAddr(iAddr) > -1)
2299  fhAllHitsStation->Fill(GetStationOfAddr(iAddr));
2300  }
2301  // vertex stuff
2302  fhVTXNorm->Fill(fVTXNorm);
2303  if (fVTXNorm > 0.) {
2304  fhVTX_XY0->Fill(fVTX_X, fVTX_Y);
2305  for (Int_t iTrk = 0; iTrk < fTrackArray->GetEntries(); iTrk++) {
2306  CbmTofTracklet* pTrk = (CbmTofTracklet*) fTrackArray->At(iTrk);
2307  if (NULL == pTrk) continue;
2308  if (Double_t w = pTrk->GetNofHits() > (Double_t) fMinNofHits) {
2309  if (fVTXNorm > w) {
2310  Double_t DeltaT0 =
2311  pTrk->GetFitT(0.)
2312  - (fVTXNorm * fVTX_T - w * pTrk->GetFitT(0.)) / (fVTXNorm - w);
2313  fhVTX_DT0_Norm->Fill(fVTXNorm, DeltaT0);
2314  }
2315  }
2316  }
2317  }
2318  if (0 == fMapStationRpcId[0]) { // Generated Pseudo TofHit at origin
2319  fTofHitArray->RemoveAt(fTofHitArray->GetEntries() - 1); // remove added hit
2320  }
2321 }
2322 
2324  fStationType.resize(fNTofStations);
2325  for (Int_t i = 0; i < 10; i++)
2326  fTypeStation[i] = -1; // initialize
2327  for (Int_t i = 0; i < fNTofStations; i++) {
2328  Int_t iSm = ival % 10;
2329  Int_t iSt = fNTofStations - 1 - i;
2330  Int_t iAddr = CbmTofAddress::GetUniqueAddress(0, 0, 0, 0, iSm);
2331  fStationType[iSt] = iSm;
2332  fTypeStation[iSm] = iSt;
2333  fMapStationRpcId[iSt] = iAddr;
2334  ival = (ival - iSm) / 10;
2335  }
2336 }
2337 
2339  Int_t iModType,
2340  Int_t iModId,
2341  Int_t iRpcId) {
2342  Int_t iCenterCh = 0;
2343  if (NULL != fDigiBdfPar)
2344  iCenterCh =
2345  TMath::Floor((fDigiBdfPar->GetNbChan(iModType, iRpcId) - 1) / 2);
2346  Int_t iAddr =
2347  CbmTofAddress::GetUniqueAddress(iModId, iRpcId, iCenterCh, 0, iModType);
2348  fMapStationRpcId[iVal] = iAddr;
2349 }
2350 
2352  Int_t iModId,
2353  Int_t iRpcId) {
2354  fiBeamCounter =
2355  CbmTofAddress::GetUniqueAddress(iModId, iRpcId, 0, 0, iModType);
2356 }
2357 
2359  std::map<Int_t, Int_t>::iterator it;
2360  for (it = fMapStationRpcId.begin(); it != fMapStationRpcId.end(); it++)
2361  //std::map <Int_t, Int_t>::iterator it = fMapStationRpcId.find(iAddr);
2362  if (it->second == iAddr) break;
2363  /*
2364  if(it->first == fMapStationRpcId.size())
2365  {
2366  PrintSetup();
2367  LOG(fatal)<<Form("CbmTofFindTracks::GetStationOfAddr failed for 0x%08x, found Station = %d",iAddr,it->first)
2368  ;
2369  }
2370  */
2371  return it->first;
2372 }
2373 
2375  for (std::map<Int_t, Int_t>::iterator it = fMapStationRpcId.begin();
2376  it != fMapStationRpcId.end();
2377  it++) {
2378  cout << " <I> Tracking station " << it->first << " contains RpcId "
2379  << Form("0x%08x", it->second) << endl;
2380  }
2381 }
2382 
2383 Double_t CbmTofFindTracks::GetTOff(Int_t iAddr) {
2384  //cout << Form(" <D> GetTOff for 0x%08x at HistoIndex %d: %7.1f ", iAddr, fMapRpcIdParInd[iAddr],
2385  //(Double_t)fhPullT_Smt_Off->GetBinContent( fMapRpcIdParInd[iAddr] + 1)) <<endl;
2386  return (Double_t) fhPullT_Smt_Off->GetBinContent(fMapRpcIdParInd[iAddr] + 1);
2387 }
2388 
2389 Double_t CbmTofFindTracks::GetSigT(Int_t iAddr) {
2390  return (Double_t) fhPullT_Smt_Width->GetBinContent(fMapRpcIdParInd[iAddr]
2391  + 1);
2392 }
2393 
2394 Double_t CbmTofFindTracks::GetSigX(Int_t iAddr) {
2395  return (Double_t) fhPullX_Smt_Width->GetBinContent(fMapRpcIdParInd[iAddr]
2396  + 1);
2397 }
2398 
2399 Double_t CbmTofFindTracks::GetSigY(Int_t iAddr) {
2400  return (Double_t) fhPullY_Smt_Width->GetBinContent(fMapRpcIdParInd[iAddr]
2401  + 1);
2402 }
2403 
2404 Double_t CbmTofFindTracks::GetSigZ(Int_t iAddr) {
2405  return (Double_t) fhPullZ_Smt_Width->GetBinContent(fMapRpcIdParInd[iAddr]
2406  + 1);
2407 }
2408 
2410  Int_t iNSt = 0;
2411  for (Int_t iSt = 0; iSt < fNTofStations; iSt++) {
2412  if (fStationHMul[iSt] > 0 && fStationHMul[iSt] < fiStationMaxHMul) iNSt++;
2413  LOG(debug2) << Form("Station %d, Addr 0x%08x, HMul %d, Max %d, Sum %d",
2414  iSt,
2415  GetAddrOfStation(iSt),
2416  fStationHMul[iSt],
2418  iNSt);
2419  }
2420  return iNSt;
2421 }
2422 
2424  for (Int_t iSt = 0; iSt < fNTofStations; iSt++)
2425  fStationHMul[iSt] = 0;
2426 }
2427 
2429  // collect unused hits in active tracking stations
2430  Int_t iNbUHits = 0;
2431  for (Int_t iHit = 0; iHit < fTofHitArray->GetEntries(); iHit++) {
2432  CbmTofHit* pHit = (CbmTofHit*) fTofHitArray->At(iHit);
2433  Int_t iAddr = (pHit->GetAddress() & DetMask);
2434  if (pHit->GetFlag() < 100. && GetStationOfAddr(iAddr) < fNTofStations) {
2435  if (!CheckHit2Track(pHit)) // check whether hit could belong to any track
2436  new ((*fTofUHitArray)[iNbUHits++]) CbmTofHit(*pHit);
2437  }
2438  }
2439 }
2440 
2442  Int_t iAddr = (pHit->GetAddress() & DetMask);
2443  Int_t iSt = GetStationOfAddr(iAddr);
2444  if (iSt < 0 || iSt >= GetNofStations()) return kFALSE;
2445  for (Int_t iTrk = 0; iTrk < fTrackArray->GetEntries(); iTrk++) {
2446  CbmTofTracklet* pTrk = (CbmTofTracklet*) fTrackArray->At(iTrk);
2447  if (NULL == pTrk) continue;
2448  Double_t dDX = pHit->GetX() - pTrk->GetFitX(pHit->GetZ());
2449  Double_t dDY = pHit->GetY() - pTrk->GetFitY(pHit->GetZ());
2450  Double_t dDT = pHit->GetTime() - pTrk->GetFitT(pHit->GetZ());
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",
2453  iTrk,
2454  pTrk->GetNofHits(),
2455  iAddr,
2456  iSt,
2457  dDX,
2458  dDY,
2459  dDT);
2460  if (!(pTrk->ContainsAddr(iAddr))) {
2461  LOG(debug3) << "Fill histo " << vhUDXDY_DT[iSt]->GetName();
2462  vhUDXDY_DT[iSt]->Fill(dDX, dDY, dDT);
2463  } else {
2464  vhUCDXDY_DT[iSt]->Fill(dDX, dDY, dDT);
2465  }
2466  }
2467  return kFALSE;
2468 }
2469 
2471  fInspectEvent = kTRUE;
2472 
2473  for (Int_t iSt = 0; iSt < fNTofStations; iSt++) {
2474  if (fStationHMul[iSt] > fiStationMaxHMul) {
2475  fInspectEvent = kFALSE;
2476  } else {
2477  if (fMapStationRpcId[iSt] == fiBeamCounter
2478  && fStationHMul[iSt] > fiBeamMaxHMul) {
2479  fInspectEvent = kFALSE;
2480  }
2481  }
2482  }
2483 }
2484 
2486  std::map<Int_t, Int_t>::iterator it = fMapRpcIdParInd.begin();
2487  while (it != fMapRpcIdParInd.end()) {
2488  LOG(info) << Form("MapRpcIdParInd: %d, 0x%08x ", it->second, it->first);
2489  it++;
2490  }
2491 }
CbmTofDigiBdfPar.h
CbmTofFindTracks::fhVTX_XY0
TH2 * fhVTX_XY0
Definition: CbmTofFindTracks.h:252
CbmTofCell::GetZ
Double_t GetZ() const
Definition: CbmTofCell.h:38
CbmHit::GetZ
Double_t GetZ() const
Definition: CbmHit.h:70
CbmTofTrackletTools
contains fits and resolution functions
Definition: CbmTofTrackletTools.h:21
CbmTofFindTracks::fSIGY
Double_t fSIGY
Definition: CbmTofFindTracks.h:300
CbmTofTrackFinder
Definition: CbmTofTrackFinder.h:27
CbmPixelHit::SetY
void SetY(Double_t y)
Definition: CbmPixelHit.h:103
CbmTofFindTracks::GetMinNofHits
Int_t GetMinNofHits() const
Definition: CbmTofFindTracks.h:107
CbmEvent::GetIndex
UInt_t GetIndex(ECbmDataType type, UInt_t iData)
Definition: CbmEvent.cxx:24
CbmTofFindTracks::fT0MAX
Double_t fT0MAX
Definition: CbmTofFindTracks.h:289
CbmTofCell::GetSizex
Double_t GetSizex() const
Definition: CbmTofCell.h:40
CbmTofCalibrator
contains filling and updating of calibration histos
Definition: CbmTofCalibrator.h:44
CbmVertex.h
CbmTofFindTracks::vhResidualYWalk
std::vector< TH2 * > vhResidualYWalk
Definition: CbmTofFindTracks.h:239
CbmTofFindTracks::vhUDXDY_DT
std::vector< TH3 * > vhUDXDY_DT
Definition: CbmTofFindTracks.h:248
CbmTofCalibrator::SetR0Lim
void SetR0Lim(Double_t dVal)
Definition: CbmTofCalibrator.h:61
CbmTofTracklet::GetTrackParameter
CbmTofTrackletParam * GetTrackParameter()
Definition: CbmTofTracklet.h:96
CbmTofFindTracks::vhPullY
std::vector< TH1 * > vhPullY
Definition: CbmTofFindTracks.h:234
CbmTofFindTracks::Finish
virtual void Finish()
Definition: CbmTofFindTracks.cxx:1187
CbmTofFindTracks::fiBeamCounter
Int_t fiBeamCounter
Definition: CbmTofFindTracks.h:281
CbmTofFindTracks::fOutHstFileName
TString fOutHstFileName
Definition: CbmTofFindTracks.h:257
CbmTofFindTracks::fiBeamMaxHMul
Int_t fiBeamMaxHMul
Definition: CbmTofFindTracks.h:312
CbmTofFindTracks::fhTrackingTimeNhits
TH2 * fhTrackingTimeNhits
Definition: CbmTofFindTracks.h:214
CbmTofAnaTestbeam::fDigiBdfPar
CbmTofDigiBdfPar * fDigiBdfPar
Definition: CbmTofAnaTestbeam.h:329
CbmTofFindTracks::vhXY_DT
std::vector< TH3 * > vhXY_DT
Definition: CbmTofFindTracks.h:245
CbmTofAddress::GetSmType
static Int_t GetSmType(UInt_t address)
Definition: CbmTofAddress.h:82
CbmTofFindTracks::vhPullX
std::vector< TH1 * > vhPullX
Definition: CbmTofFindTracks.h:233
CbmPixelHit::GetX
Double_t GetX() const
Definition: CbmPixelHit.h:83
CbmTofFindTracks::fhPullZ_Smt_Off
TH1 * fhPullZ_Smt_Off
Definition: CbmTofFindTracks.h:271
CbmTofFindTracks::Init
virtual InitStatus Init()
Definition: CbmTofFindTracks.cxx:201
CbmTofTracklet::PrintInfo
virtual void PrintInfo()
Definition: CbmTofTracklet.cxx:541
CbmTofAnaTestbeam::fbUseSigCalib
Bool_t fbUseSigCalib
Definition: CbmTofAnaTestbeam.h:823
CbmTofTrackFinder::Init
virtual void Init()
Definition: CbmTofTrackFinder.h:41
CbmTofTracklet::GetNofHits
Int_t GetNofHits() const
Definition: CbmTofTracklet.h:48
CbmTofTrackletParam::GetTy
Double_t GetTy() const
Definition: CbmTofTrackletParam.h:53
CbmPixelHit::GetY
Double_t GetY() const
Definition: CbmPixelHit.h:84
CbmTofTrackletParam::GetTx
Double_t GetTx() const
Definition: CbmTofTrackletParam.h:52
CbmTofFindTracks::fVTX_Y
Double_t fVTX_Y
Definition: CbmTofFindTracks.h:287
CbmTofAnaTestbeam::fCalParFileName
TString fCalParFileName
Definition: CbmTofAnaTestbeam.h:713
CbmTofFindTracks::fhPullX_Smt
TH2 * fhPullX_Smt
Definition: CbmTofFindTracks.h:266
CbmPixelHit::GetDx
Double_t GetDx() const
Definition: CbmPixelHit.h:85
CbmTofDetectorId::GetSMType
virtual Int_t GetSMType(const Int_t detectorId)=0
CbmTofCalibrator::Init
InitStatus Init()
Definition: CbmTofCalibrator.cxx:58
CbmTofTrackFinder.h
CbmTofDigiBdfPar::GetNbChan
Int_t GetNbChan(Int_t iSmType, Int_t iRpc) const
Definition: CbmTofDigiBdfPar.cxx:570
CbmTofTracklet::GetStationHitIndex
Int_t GetStationHitIndex(Int_t iSm) const
Definition: CbmTofTracklet.h:65
CbmTofDigiPar::GetNrOfModules
Int_t GetNrOfModules()
Definition: CbmTofDigiPar.h:44
CbmTofFindTracks::fInspectEvent
Bool_t fInspectEvent
Definition: CbmTofFindTracks.h:194
CbmTofFindTracks::fhTrklXY0_2
TH2 * fhTrklXY0_2
Definition: CbmTofFindTracks.h:231
CbmTofFindTracks::fMinNofHits
Int_t fMinNofHits
Definition: CbmTofFindTracks.h:190
CbmTofFindTracks::fTrackArray
TClonesArray * fTrackArray
Definition: CbmTofFindTracks.h:185
CbmTofTracklet::GetZ0x
Double_t GetZ0x()
Definition: CbmTofTracklet.cxx:135
CbmTofFindTracks::fhTrklDT0SmMis
TH2 * fhTrklDT0SmMis
Definition: CbmTofFindTracks.h:227
CbmTofTracklet
Provides information on attaching a TofHit to a TofTrack.
Definition: CbmTofTracklet.h:25
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmTofFindTracks::FindVertex
virtual void FindVertex()
Definition: CbmTofFindTracks.cxx:1696
CbmTofFindTracks::fhTOff_HMul2
TH2 * fhTOff_HMul2
Definition: CbmTofFindTracks.h:279
CbmTofFindTracks::fTofCalibrator
CbmTofCalibrator * fTofCalibrator
Definition: CbmTofFindTracks.h:180
CbmTofFindTracks::ResetStationsFired
void ResetStationsFired()
Definition: CbmTofFindTracks.cxx:2423
CbmTofFindTracks::fStationType
std::vector< Int_t > fStationType
Definition: CbmTofFindTracks.h:196
CbmTofFindTracks::fhTrklMul3D
TH3 * fhTrklMul3D
Definition: CbmTofFindTracks.h:217
CbmTofFindTracks::fhVTXNorm
TH1 * fhVTXNorm
Definition: CbmTofFindTracks.h:251
CbmTofFindTracks::vhXY_DX
std::vector< TH3 * > vhXY_DX
Definition: CbmTofFindTracks.h:243
CbmTofDetectorId::GetCounter
virtual Int_t GetCounter(const Int_t detectorId)=0
CbmTofFindTracks::GetSigT
Double_t GetSigT() const
Definition: CbmTofFindTracks.h:128
CbmTofAddress::GetRpcId
static Int_t GetRpcId(UInt_t address)
Definition: CbmTofAddress.h:89
CbmTofFindTracks::vhXY_TOT
std::vector< TH3 * > vhXY_TOT
Definition: CbmTofFindTracks.h:246
CbmTofFindTracks::fhTrklTxHMul
TH2 * fhTrklTxHMul
Definition: CbmTofFindTracks.h:221
CbmEvent::AddData
void AddData(ECbmDataType type, UInt_t index)
Definition: CbmEvent.cxx:15
CbmTofFindTracks::fhPullT_Smt_Off
TH1 * fhPullT_Smt_Off
Definition: CbmTofFindTracks.h:265
CbmTofTrackFinderNN.h
CbmTofFindTracks::GetSigZ
Double_t GetSigZ() const
Definition: CbmTofFindTracks.h:131
CbmTofDetectorId_v12b
Definition: CbmTofDetectorId_v12b.h:33
CbmTofFindTracks::fbUseSigCalib
Bool_t fbUseSigCalib
Definition: CbmTofFindTracks.h:302
CbmTofFindTracks::CbmTofFindTracks
CbmTofFindTracks()
Definition: CbmTofFindTracks.cxx:62
CbmTofTrackletParam
Definition: CbmTofTrackletParam.h:27
CbmTofFindTracks::vhResidualTBWalk
std::vector< TH2 * > vhResidualTBWalk
Definition: CbmTofFindTracks.h:238
CbmTofFindTracks::fFitter
CbmTofTrackFitter * fFitter
Definition: CbmTofFindTracks.h:178
CbmTofFindTracks::LoadCalParameter
Bool_t LoadCalParameter()
Definition: CbmTofFindTracks.cxx:325
CbmTofDigiBdfPar::GetSigVel
Double_t GetSigVel(Int_t iSmType, Int_t iSm, Int_t iRpc) const
Definition: CbmTofDigiBdfPar.cxx:546
ECbmDataType::kTofHit
@ kTofHit
CbmTofFindTracks::fhTrklXY0_1
TH2 * fhTrklXY0_1
Definition: CbmTofFindTracks.h:230
CbmTofFindTracks::GetNofStations
Int_t GetNofStations()
Definition: CbmTofFindTracks.h:97
CbmTofAnaTestbeam::fSIGY
Double_t fSIGY
Definition: CbmTofAnaTestbeam.h:787
CbmTofHit::GetCh
Int_t GetCh() const
Definition: core/data/tof/CbmTofHit.h:92
CbmTofFindTracks::fStationHMul
std::vector< Int_t > fStationHMul
Definition: CbmTofFindTracks.h:197
Cbm::Sign
int Sign(const T &x)
Definition: CbmUtils.h:36
CbmTofFindTracks::fTrackletTools
CbmTofTrackletTools * fTrackletTools
Definition: CbmTofFindTracks.h:179
CbmTofFindTracks::fhPullZ_Smt_Width
TH1 * fhPullZ_Smt_Width
Definition: CbmTofFindTracks.h:275
CbmTofDigiPar.h
CbmMatch.h
CbmTofFindTracks::GetSigX
Double_t GetSigX() const
Definition: CbmTofFindTracks.h:129
CbmTofTrackletParam::ToString
std::string ToString() const
Return string representation of class.
Definition: CbmTofTrackletParam.h:118
CbmPixelHit::GetDy
Double_t GetDy() const
Definition: CbmPixelHit.h:86
CbmTofFindTracks::ExecFind
virtual void ExecFind(Option_t *opt)
Definition: CbmTofFindTracks.cxx:1042
CbmTofAddress::GetSmId
static Int_t GetSmId(UInt_t address)
Definition: CbmTofAddress.h:75
CbmTofDigiPar::GetCell
CbmTofCell * GetCell(Int_t i)
Definition: CbmTofDigiPar.h:48
CbmTofFindTracks::fStop
TTimeStamp fStop
Definition: CbmTofFindTracks.h:307
CbmHit::GetTimeError
Double_t GetTimeError() const
Definition: CbmHit.h:76
CbmTofFindTracks::~CbmTofFindTracks
virtual ~CbmTofFindTracks()
Definition: CbmTofFindTracks.cxx:193
CbmTofFindTracks::fNofTracks
Int_t fNofTracks
Definition: CbmTofFindTracks.h:191
CbmTofCreateDigiPar.h
CbmTofFindTracks::vhPullZ
std::vector< TH1 * > vhPullZ
Definition: CbmTofFindTracks.h:235
CbmTofTracklet.h
CbmTofFindTracks::fhUsedHitsStation
TH1 * fhUsedHitsStation
Definition: CbmTofFindTracks.h:212
CbmTofFindTracks::fTofHitArray
TClonesArray * fTofHitArray
Definition: CbmTofFindTracks.h:184
CbmTofFindTracks::fhPullY_Smt_Off
TH1 * fhPullY_Smt_Off
Definition: CbmTofFindTracks.h:269
CbmTofAnaTestbeam::fGeoHandler
CbmTofGeoHandler * fGeoHandler
Definition: CbmTofAnaTestbeam.h:308
CbmTofFindTracks::fhPullX_Smt_Off
TH1 * fhPullX_Smt_Off
Definition: CbmTofFindTracks.h:267
CbmTofFindTracks::fhPullY_Smt_Width
TH1 * fhPullY_Smt_Width
Definition: CbmTofFindTracks.h:274
CbmTofGeoHandler.h
CbmTofCalibrator.h
CbmTofFindTracks::fSIGZ
Double_t fSIGZ
Definition: CbmTofFindTracks.h:301
DetMask
const Int_t DetMask
Definition: CbmTofFindTracks.cxx:55
CbmTofDetectorId_v14a.h
ECbmDataType::kTofTrack
@ kTofTrack
CbmEvent.h
CbmTofFindTracks::fVTX_X
Double_t fVTX_X
Definition: CbmTofFindTracks.h:286
CbmTofFindTracks::fSIGX
Double_t fSIGX
Definition: CbmTofFindTracks.h:299
CbmTofFindTracks::CreateHistograms
virtual void CreateHistograms()
Definition: CbmTofFindTracks.cxx:1196
CbmTofFindTracks::fhTrklT0HMul
TH2 * fhTrklT0HMul
Definition: CbmTofFindTracks.h:225
CbmTofAnaTestbeam::fDigiPar
CbmTofDigiPar * fDigiPar
Definition: CbmTofAnaTestbeam.h:328
CbmTofFindTracks::fNReqStations
Int_t fNReqStations
Definition: CbmTofFindTracks.h:193
CbmTofAnaTestbeam::fSIGX
Double_t fSIGX
Definition: CbmTofAnaTestbeam.h:786
CbmTofFindTracks::fhPullT_Smt_Width
TH1 * fhPullT_Smt_Width
Definition: CbmTofFindTracks.h:272
CbmTofFindTracks::fhAllHitsStation
TH1 * fhAllHitsStation
Definition: CbmTofFindTracks.h:210
CbmTofTrackFinderNN
Definition: CbmTofTrackFinderNN.h:20
CbmTofFindTracks::fVTX_Z
Double_t fVTX_Z
Definition: CbmTofFindTracks.h:288
CbmTofFindTracks::fiStationMaxHMul
Int_t fiStationMaxHMul
Definition: CbmTofFindTracks.h:282
CbmTofFindTracks::vhUCDXDY_DT
std::vector< TH3 * > vhUCDXDY_DT
Definition: CbmTofFindTracks.h:249
CbmTofGeoHandler
Definition: CbmTofGeoHandler.h:30
iWarnNotDefined
static Int_t iWarnNotDefined
Definition: CbmTofFindTracks.cxx:1736
CbmTofTracklet::ContainsAddr
virtual Bool_t ContainsAddr(Int_t iAddr)
Definition: CbmTofTracklet.cxx:466
k12b
@ k12b
Definition: CbmTofGeoHandler.h:17
CbmTofFindTracks::fhTrklDT0StMis2
TH2 * fhTrklDT0StMis2
Definition: CbmTofFindTracks.h:228
CbmTofFindTracks::fRpcAddr
std::vector< Int_t > fRpcAddr
Definition: CbmTofFindTracks.h:198
CbmTofCell::GetX
Double_t GetX() const
Definition: CbmTofCell.h:36
CbmTofFindTracks::PrintSetup
void PrintSetup()
Definition: CbmTofFindTracks.cxx:2374
CbmTofFindTracks::vhXY_DY
std::vector< TH3 * > vhXY_DY
Definition: CbmTofFindTracks.h:244
CbmTofDetectorId_v12b.h
CbmHit::GetTime
Double_t GetTime() const
Definition: CbmHit.h:75
CbmTofCell
Definition: CbmTofCell.h:8
CbmTofFindTracks::fhTOff_Smt
TH2 * fhTOff_Smt
Definition: CbmTofFindTracks.h:276
CbmTofAddress::GetChannelId
static Int_t GetChannelId(UInt_t address)
Definition: CbmTofAddress.h:96
CbmTofFindTracks::fhTrklMulNhits
TH2 * fhTrklMulNhits
Definition: CbmTofFindTracks.h:215
CbmTofFindTracks::GetTOff
Double_t GetTOff(Int_t iAddr)
Definition: CbmTofFindTracks.cxx:2383
CbmTofFindTracks::fTrackArrayOut
TClonesArray * fTrackArrayOut
Definition: CbmTofFindTracks.h:187
CbmHit::GetAddress
Int_t GetAddress() const
Definition: CbmHit.h:73
CbmTofFindTracks::fhPullZ_Smt
TH2 * fhPullZ_Smt
Definition: CbmTofFindTracks.h:270
k14a
@ k14a
Definition: CbmTofGeoHandler.h:17
CbmTofFindTracks::fEventsColl
TClonesArray * fEventsColl
Definition: CbmTofFindTracks.h:181
CbmTofTrackFinder::DoFind
virtual Int_t DoFind(TClonesArray *hits, TClonesArray *tracks)=0
CbmTofFindTracks
Definition: CbmTofFindTracks.h:43
CbmTofFindTracks::fhTrklMulMaxMM
TH2 * fhTrklMulMaxMM
Definition: CbmTofFindTracks.h:216
CbmTofAnaTestbeam::fiCorMode
Int_t fiCorMode
Definition: CbmTofAnaTestbeam.h:757
CbmPixelHit::SetPositionError
void SetPositionError(const TVector3 &dpos)
Definition: CbmPixelHit.cxx:78
CbmTofFindTracks::fhTrklT0Mul
TH2 * fhTrklT0Mul
Definition: CbmTofFindTracks.h:226
CbmTofTracklet::GetTt
Double_t GetTt() const
Definition: CbmTofTracklet.h:54
CbmTofFindTracks::fGeoHandler
CbmTofGeoHandler * fGeoHandler
Definition: CbmTofFindTracks.h:293
CbmTofFindTracks.h
CbmTofAddress.h
CbmTofFindTracks::fdRefVelMean
Double_t fdRefVelMean
Definition: CbmTofFindTracks.h:303
CbmTofDetectorId_v14a
Definition: CbmTofDetectorId_v14a.h:36
CbmTofHit::GetR
Double_t GetR() const
Definition: core/data/tof/CbmTofHit.h:94
CbmTofGeoHandler::Init
Int_t Init(Bool_t isSimulation=kFALSE)
Definition: CbmTofGeoHandler.cxx:39
CbmTofAnaTestbeam::fChannelInfo
CbmTofCell * fChannelInfo
Definition: CbmTofAnaTestbeam.h:310
CbmTofFindTracks::fCalParFile
TFile * fCalParFile
Definition: CbmTofFindTracks.h:263
CbmTofTrackletParam::GetZ
Double_t GetZ() const
Definition: CbmTofTrackletParam.h:50
CbmTofDigiBdfPar
Parameters class for the CBM ToF digitizer using beam data distributions.
Definition: CbmTofDigiBdfPar.h:30
CbmTofFindTracks::fhTrklXY0_0
TH2 * fhTrklXY0_0
Definition: CbmTofFindTracks.h:229
CbmTofFindTracks::fiEvent
Int_t fiEvent
Definition: CbmTofFindTracks.h:290
CbmTofTracklet::GetRefVel
Double_t GetRefVel(UInt_t N)
Definition: CbmTofTracklet.cxx:565
CbmTofTrackletParam::GetLz
Double_t GetLz() const
Definition: CbmTofTrackletParam.h:51
CbmTofFindTracks::fiCorMode
Int_t fiCorMode
Definition: CbmTofFindTracks.h:280
CbmTofFindTracks::fVTXNorm
Double_t fVTXNorm
Definition: CbmTofFindTracks.h:284
CbmTofCell.h
CbmTofFindTracks::fVTX_T
Double_t fVTX_T
Definition: CbmTofFindTracks.h:285
CbmTofFindTracks::fCalParFileName
TString fCalParFileName
Definition: CbmTofFindTracks.h:261
CbmTofCreateDigiPar::Init
virtual InitStatus Init()
Definition: CbmTofCreateDigiPar.cxx:102
CbmTofAnaTestbeam::fStop
TTimeStamp fStop
Definition: CbmTofAnaTestbeam.h:711
CbmTofFindTracks::MarkStationFired
void MarkStationFired(Int_t iSt)
Definition: CbmTofFindTracks.h:159
CbmTofFindTracks::fDigiPar
CbmTofDigiPar * fDigiPar
Definition: CbmTofFindTracks.h:295
CbmTofAnaTestbeam::fStart
TTimeStamp fStart
Definition: CbmTofAnaTestbeam.h:710
CbmPixelHit::SetX
void SetX(Double_t x)
Definition: CbmPixelHit.h:102
CbmTofHit::GetFlag
Int_t GetFlag() const
Definition: core/data/tof/CbmTofHit.h:91
CbmTofFindTracks::fhPullT_Smt
TH2 * fhPullT_Smt
Definition: CbmTofFindTracks.h:264
CbmTofCell::GetSizey
Double_t GetSizey() const
Definition: CbmTofCell.h:41
CbmTofFindTracks::fhPullX_Smt_Width
TH1 * fhPullX_Smt_Width
Definition: CbmTofFindTracks.h:273
CbmEvent::GetNofData
Int_t GetNofData() const
Definition: CbmEvent.h:90
CbmHit::SetTimeError
void SetTimeError(Double_t error)
Definition: CbmHit.h:89
CbmTofFindTracks::GetSigY
Double_t GetSigY() const
Definition: CbmTofFindTracks.h:130
CbmTofDetectorId::GetCell
virtual Int_t GetCell(const Int_t detectorId)=0
CbmTofFindTracks::fMapRpcIdParInd
std::map< Int_t, Int_t > fMapRpcIdParInd
Definition: CbmTofFindTracks.h:200
CbmTofCalibrator::UpdateCalHist
Bool_t UpdateCalHist(Int_t iOpt)
Definition: CbmTofCalibrator.cxx:358
CbmTofFindTracks::fMapStationRpcId
std::map< Int_t, Int_t > fMapStationRpcId
Definition: CbmTofFindTracks.h:199
CbmHit::SetTime
void SetTime(Double_t time)
Definition: CbmHit.h:84
CbmTofFindTracks::fhTrklMul
TH1 * fhTrklMul
Definition: CbmTofFindTracks.h:208
CbmTofFindTracks::fhPullY_Smt
TH2 * fhPullY_Smt
Definition: CbmTofFindTracks.h:268
CbmTofFindTracks::vhXY_AllTracks
std::vector< TH2 * > vhXY_AllTracks
Definition: CbmTofFindTracks.h:240
CbmTofFindTracks::fTofUHitArray
TClonesArray * fTofUHitArray
Definition: CbmTofFindTracks.h:188
CbmTofFindTracks::fhAllHitsSmTypes
TH1 * fhAllHitsSmTypes
Definition: CbmTofFindTracks.h:211
CbmTofFindTracks::CheckMaxHMul
void CheckMaxHMul()
Definition: CbmTofFindTracks.cxx:2470
CbmTofFindTracks::InitParameters
Bool_t InitParameters()
Definition: CbmTofFindTracks.cxx:527
CbmTofFindTracks::fhTrklZ0xHMul
TH2 * fhTrklZ0xHMul
Definition: CbmTofFindTracks.h:219
CbmTofFindTracks::fbRemoveSignalPropagationTime
Bool_t fbRemoveSignalPropagationTime
Definition: CbmTofFindTracks.h:311
CbmTofTracklet::GetFitX
Double_t GetFitX(Double_t Z)
Definition: CbmTofTracklet.cxx:516
CbmTofAnaTestbeam::fSIGT
Double_t fSIGT
Definition: CbmTofAnaTestbeam.h:785
CbmTofFindTracks::CheckHit2Track
virtual Bool_t CheckHit2Track(CbmTofHit *pHit)
Definition: CbmTofFindTracks.cxx:2441
CbmTofAnaTestbeam::fTrackletTools
CbmTofTrackletTools * fTrackletTools
Definition: CbmTofAnaTestbeam.h:793
CbmTofAnaTestbeam::fCalOutFileName
TString fCalOutFileName
Definition: CbmTofAnaTestbeam.h:714
CbmTofFindTracks::FillUHits
virtual void FillUHits()
Definition: CbmTofFindTracks.cxx:2428
CbmTofFindTracks::fdBeamMomentumLab
Double_t fdBeamMomentumLab
Definition: CbmTofFindTracks.h:310
CbmHit::SetZ
void SetZ(Double_t z)
Definition: CbmHit.h:79
CbmTofFindTracks::fTofId
CbmTofDetectorId * fTofId
Definition: CbmTofFindTracks.h:294
CbmTofAnaTestbeam::fCalParFile
TFile * fCalParFile
Definition: CbmTofAnaTestbeam.h:715
CbmTofFindTracks::fSIGT
Double_t fSIGT
Definition: CbmTofFindTracks.h:298
CbmTofFindTracks::fhDeltaTt_Smt
TH2 * fhDeltaTt_Smt
Definition: CbmTofFindTracks.h:278
CbmTofDetectorId::GetSModule
virtual Int_t GetSModule(const Int_t detectorId)=0
CbmTofDigiPar
Definition: CbmTofDigiPar.h:18
CbmTofAnaTestbeam::fTofId
CbmTofDetectorId * fTofId
Definition: CbmTofAnaTestbeam.h:309
CbmTofTracklet::GetFitY
Double_t GetFitY(Double_t Z)
Definition: CbmTofTracklet.cxx:520
CbmPixelHit::SetPosition
void SetPosition(const TVector3 &pos)
Sets position of the hit.
Definition: CbmPixelHit.cxx:72
CbmTofFindTracks::GetNStationsFired
Int_t GetNStationsFired()
Definition: CbmTofFindTracks.cxx:2409
CbmTofTrackletTools.h
CbmTofFindTracks::fDigiBdfPar
CbmTofDigiBdfPar * fDigiBdfPar
Definition: CbmTofFindTracks.h:296
CbmTofTracklet::GetChiSq
Double_t GetChiSq() const
Definition: CbmTofTracklet.h:127
CbmTofDigiPar::GetCellId
Int_t GetCellId(Int_t i)
Definition: CbmTofDigiPar.h:45
CbmTofFindTracks::fhTrklTyHMul
TH2 * fhTrklTyHMul
Definition: CbmTofFindTracks.h:222
fEventsColl
TClonesArray * fEventsColl
Definition: CbmHadronAnalysis.cxx:50
CbmTofFindTracks::fdRefDVel
Double_t fdRefDVel
Definition: CbmTofFindTracks.h:304
CbmTofFindTracks::GetAddrOfStation
Int_t GetAddrOfStation(Int_t iVal)
Definition: CbmTofFindTracks.h:116
CbmTofFindTracks::SetStations
void SetStations(Int_t ival)
Definition: CbmTofFindTracks.cxx:2323
CbmEvent
Class characterising one event by a collection of links (indices) to data objects,...
Definition: CbmEvent.h:30
CbmTofFindTracks::vhXY_MissedStation
std::vector< TH2 * > vhXY_MissedStation
Definition: CbmTofFindTracks.h:242
CbmTofFindTracks::fTypeStation
Int_t fTypeStation[100]
Definition: CbmTofFindTracks.h:255
CbmTofFindTracks::fhTrklZ0yHMul
TH2 * fhTrklZ0yHMul
Definition: CbmTofFindTracks.h:220
CbmTofFindTracks::GetNReqStations
Int_t GetNReqStations() const
Definition: CbmTofFindTracks.h:109
CbmTofFindTracks::SetParContainers
virtual void SetParContainers()
Definition: CbmTofFindTracks.cxx:556
CbmTofFindTracks::Exec
virtual void Exec(Option_t *opt)
Definition: CbmTofFindTracks.cxx:1004
CbmTofFindTracks::fhTrklChi2
TH1 * fhTrklChi2
Definition: CbmTofFindTracks.h:209
CbmTofFindTracks::fhVTX_DT0_Norm
TH2 * fhVTX_DT0_Norm
Definition: CbmTofFindTracks.h:253
CbmTofHit
Definition: core/data/tof/CbmTofHit.h:26
CbmTofFindTracks::fhTrklTtHMul
TH2 * fhTrklTtHMul
Definition: CbmTofFindTracks.h:223
CbmTofFindTracks::fdTrackingTime
Double_t fdTrackingTime
Definition: CbmTofFindTracks.h:308
CbmTofFindTracks::vhXY_CSZ
std::vector< TH3 * > vhXY_CSZ
Definition: CbmTofFindTracks.h:247
CbmTofCell::GetY
Double_t GetY() const
Definition: CbmTofCell.h:37
CbmTofAddress::GetUniqueAddress
static UInt_t GetUniqueAddress(UInt_t Sm, UInt_t Rpc, UInt_t Channel, UInt_t Side=0, UInt_t SmType=0)
Definition: CbmTofAddress.h:124
CbmTofCalibrator::FillCalHist
void FillCalHist(CbmTofTracklet *pTrk)
Definition: CbmTofCalibrator.cxx:228
CbmTofFindTracks::vhPullTB
std::vector< TH1 * > vhPullTB
Definition: CbmTofFindTracks.h:237
CbmTofFindTracks::fFinder
CbmTofTrackFinder * fFinder
Definition: CbmTofFindTracks.h:177
CbmTofFindTracks::FillHistograms
virtual void FillHistograms()
Definition: CbmTofFindTracks.cxx:1738
CbmTofFindTracks::fNTofStations
Int_t fNTofStations
Definition: CbmTofFindTracks.h:192
CbmTofTracklet::GetTofDetIndex
Int_t GetTofDetIndex(Int_t ind) const
Definition: CbmTofTracklet.h:73
CbmTofFindTracks::fInstance
static CbmTofFindTracks * fInstance
Definition: CbmTofFindTracks.h:176
CbmTofTracklet::GetZ0y
Double_t GetZ0y()
Definition: CbmTofTracklet.cxx:142
CbmTofFindTracks::PrintMapRpcIdParInd
void PrintMapRpcIdParInd()
Definition: CbmTofFindTracks.cxx:2485
CbmTofFindTracks::fTofHitArrayIn
TClonesArray * fTofHitArrayIn
Definition: CbmTofFindTracks.h:182
CbmTofFindTracks::fStart
TTimeStamp fStart
Definition: CbmTofFindTracks.h:306
CbmTofFindTracks::fTofMatchArrayIn
TClonesArray * fTofMatchArrayIn
Definition: CbmTofFindTracks.h:183
ClassImp
ClassImp(CbmTofFindTracks)
CbmTofFindTracks::fTtTarg
Double_t fTtTarg
Definition: CbmTofFindTracks.h:283
CbmTofFindTracks::vhPullT
std::vector< TH1 * > vhPullT
Definition: CbmTofFindTracks.h:236
CbmTofFindTracks::fhTrklHMul
TH2 * fhTrklHMul
Definition: CbmTofFindTracks.h:218
CbmTofFindTracks::fCalOutFileName
TString fCalOutFileName
Definition: CbmTofFindTracks.h:262
CbmTofTrackletParam::GetZy
Double_t GetZy(Double_t Y) const
Definition: CbmTofTrackletParam.h:134
CbmTofFindTracks::WriteHistos
Bool_t WriteHistos()
Definition: CbmTofFindTracks.cxx:577
CbmTofFindTracks::fhTrklVelHMul
TH2 * fhTrklVelHMul
Definition: CbmTofFindTracks.h:224
CbmTofTrackFitter.h
CbmTofTracklet::GetFitT
Double_t GetFitT(Double_t R)
Definition: CbmTofTracklet.cxx:524
CbmTofTracklet::GetTofHitPointer
CbmTofHit * GetTofHitPointer(Int_t ind)
Definition: CbmTofTracklet.h:72
CbmTofFindTracks::SetBeamCounter
void SetBeamCounter(Int_t iModType, Int_t iModId, Int_t iRpcId)
Definition: CbmTofFindTracks.cxx:2351
CbmTofFindTracks::SetStation
void SetStation(Int_t iVal, Int_t iModType, Int_t iModId, Int_t iRpcId)
Definition: CbmTofFindTracks.cxx:2338
CbmTofFindTracks::fiCalOpt
Int_t fiCalOpt
Definition: CbmTofFindTracks.h:313
CbmHit::GetDz
Double_t GetDz() const
Definition: CbmHit.h:71
CbmTofCreateDigiPar
Definition: CbmTofCreateDigiPar.h:23
CbmTofFindTracks::GetStationOfAddr
Int_t GetStationOfAddr(Int_t iAddr)
Definition: CbmTofFindTracks.cxx:2358
CbmTofFindTracks::vhXY_AllStations
std::vector< TH2 * > vhXY_AllStations
Definition: CbmTofFindTracks.h:241
CbmTofTrackletTools::GetTdif
virtual Double_t GetTdif(CbmTofTracklet *pTrk, Int_t iDetId, CbmTofHit *pHit)
Definition: CbmTofTrackletTools.cxx:229