CbmRoot
CbmTofSimpClusterizer.cxx
Go to the documentation of this file.
1 
7 
8 // TOF Classes and includes
9 #include "CbmTofAddress.h" // in cbmdata/tof
10 #include "CbmTofCell.h" // in tof/TofData
11 #include "CbmTofDetectorId_v12b.h" // in cbmdata/tof
12 #include "CbmTofDetectorId_v14a.h" // in cbmdata/tof
13 #include "CbmTofDigi.h" // in cbmdata/tof
14 #include "CbmTofDigiBdfPar.h" // in tof/TofParam
15 #include "CbmTofDigiPar.h" // in tof/TofParam
16 #include "CbmTofGeoHandler.h" // in tof/TofTools
17 #include "CbmTofHit.h" // in cbmdata/tof
18 #include "CbmTofPoint.h" // in cbmdata/tof
19 
20 // CBMroot classes and includes
21 #include "CbmDigiManager.h"
22 #include "CbmMCTrack.h"
23 #include "CbmMatch.h"
24 
25 // FAIR classes and includes
26 #include "FairEventHeader.h" // from CbmStsDigitize, for GetEventInfo
27 #include "FairLogger.h"
28 #include "FairMCEventHeader.h" // from CbmStsDigitize, for GetEventInfo
29 #include "FairRootManager.h"
30 #include "FairRunAna.h"
31 #include "FairRunSim.h" // from CbmStsDigitize, for GetEventInfo
32 #include "FairRuntimeDb.h"
33 
34 // ROOT Classes and includes
35 #include "TClonesArray.h"
36 #include "TDirectory.h"
37 #include "TF2.h"
38 #include "TGeoManager.h"
39 #include "TH1.h"
40 #include "TH2.h"
41 #include "TLine.h"
42 #include "TMath.h"
43 #include "TProfile.h"
44 #include "TROOT.h"
45 #include "TRandom3.h"
46 #include "TVector3.h"
47 #include <TFile.h>
48 
49 // C++ Classes and includes
50 
51 // const Int_t DetMask = 4194303; (VF) not used
52 const Int_t nbClWalkBinX = 20;
53 //const Int_t nbClWalkBinY=41; (VF) not used // choose odd number to have central bin symmetric around 0
54 //const Double_t WalkNHmin=100; (VF) not used // minimal number of hits in bin for walk correction
55 Double_t TOTMax = 5.E4;
56 Double_t TOTMin = 2.E4;
57 const Double_t TTotMean = 2.E4;
58 
59 const Int_t nbClDelTofBinX = 50;
60 //const Int_t nbClDelTofBinY=49; (VF) not used
61 //const Double_t DelTofMax=5000.; (VF) not used
62 
63 //const Int_t nbCldXdYBinX=49; (VF) not used
64 //const Int_t nbCldXdYBinY=49; (VF) not used
65 //const Double_t dXdYMax=10.; (VF) not used
66 
67 const Int_t iNTrg = 1;
68 
69 //const Double_t Zref = 200.; (VF) not used // distance of projection plane to target
70 // C++ Classes and includes
71 
72 /************************************************************************************/
74  : FairTask("CbmTofSimpClusterizer")
75  , fGeoHandler(new CbmTofGeoHandler())
76  , fTofId(NULL)
77  , fDigiPar(NULL)
78  , fChannelInfo(NULL)
79  , fDigiBdfPar(NULL)
80  , fdParFeeTimeRes(0.0)
81  , fdParSystTimeRes(0.0)
82  , fTofPointsColl(NULL)
83  , fMcTracksColl(NULL)
84  , fDigiMan(nullptr)
85  , fTofHitsColl(NULL)
86  , fTofDigiMatchColl(NULL)
87  , fiNbHits(0)
88  , fVerbose(1)
89  , fStorDigiExp()
90  , fStorDigiInd()
91  , fviClusterMul()
92  , fviClusterSize()
93  , fviTrkMul()
94  , fvdX()
95  , fvdY()
96  , fvdDifX()
97  , fvdDifY()
98  , fvdDifCh()
99  , fsHistoOutFilename("")
100  , fhClustBuildTime(NULL)
101  , fhHitsPerTracks(NULL)
102  , fhPtsPerHit(NULL)
103  , fhTimeResSingHits(NULL)
104  , fhTimeResSingHitsB(NULL)
105  , fhTimePtVsHits(NULL)
106  , fhClusterSize(NULL)
107  , fhClusterSizeType(NULL)
108  , fhTrackMul(NULL)
109  , fhClusterSizeMulti(NULL)
110  , fhTrk1MulPos(NULL)
111  , fhHiTrkMulPos(NULL)
112  , fhAllTrkMulPos(NULL)
113  , fhMultiTrkProbPos(NULL)
114  , fhDigSpacDifClust(NULL)
115  , fhDigTimeDifClust(NULL)
116  , fhDigDistClust(NULL)
117  , fhClustSizeDifX(NULL)
118  , fhClustSizeDifY(NULL)
119  , fhChDifDifX(NULL)
120  , fhChDifDifY(NULL)
121  , fhRpcDigiCor()
122  , fhRpcCluMul()
123  , fhRpcSigPropSpeed()
124  , fhRpcCluPosition()
125  , fhRpcCluTOff()
126  , fhRpcCluTrms()
127  , fhRpcCluTot()
128  , fhRpcCluSize()
129  , fhRpcCluAvWalk()
130  , fhRpcCluWalk()
131  , fhTRpcCluMul()
132  , fhTRpcCluPosition()
133  , fhTRpcCluTOff()
134  , fhTRpcCluTot()
135  , fhTRpcCluSize()
136  , fhTRpcCluAvWalk()
137  , fhTRpcCluDelTof()
138  , fhTRpcCludXdY()
139  , fhTRpcCluWalk()
140  , fhTrgdT()
141  , fvCPSigPropSpeed()
142  , fvCPDelTof()
143  , fvCPTOff()
144  , fvCPTotGain()
145  , fvCPWalk()
146  , fiNbSameSide(0)
147  , fhNbSameSide(NULL)
148  , fhNbDigiPerChan(NULL)
149  , fStart()
150  , fStop()
151  , fTimer()
152  , fiNofEvents(0.)
153  , fdNofDigisTot(0.)
154  , fdNofHitsTot(0.)
155  , fdTimeTot(0.)
156  , dTRef(0.)
157  , fdTRefMax(0.)
158  , fCalMode(0)
159  , fCalTrg(0)
160  , fCalSmType(0)
161  , fdCaldXdYMax(0.)
162  , fTRefMode(0)
163  , fTRefHits(0)
164  , fPosYMaxScal(0.)
165  , fTRefDifMax(0.)
166  , fTotMax(0.)
167  , fTotMin(0.)
168  , fOutTimeFactor(1.)
169  , fCalParFileName("")
170  , fCalParFile(NULL)
171  , fbMcTrkMonitor(kFALSE) {}
172 
173 CbmTofSimpClusterizer::CbmTofSimpClusterizer(const char* name, Int_t verbose)
174  : FairTask(TString(name), verbose)
175  , fGeoHandler(new CbmTofGeoHandler())
176  , fTofId(NULL)
177  , fDigiPar(NULL)
178  , fChannelInfo(NULL)
179  , fDigiBdfPar(NULL)
180  , fdParFeeTimeRes(0.0)
181  , fdParSystTimeRes(0.0)
182  , fTofPointsColl(NULL)
183  , fMcTracksColl(NULL)
184  , fDigiMan(nullptr)
185  , fTofHitsColl(NULL)
186  , fTofDigiMatchColl(NULL)
187  , fiNbHits(0)
188  , fVerbose(verbose)
189  , fStorDigiExp()
190  , fStorDigiInd()
191  , fviClusterMul()
192  , fviClusterSize()
193  , fviTrkMul()
194  , fvdX()
195  , fvdY()
196  , fvdDifX()
197  , fvdDifY()
198  , fvdDifCh()
199  , fsHistoOutFilename("")
200  , fhClustBuildTime(NULL)
201  , fhHitsPerTracks(NULL)
202  , fhPtsPerHit(NULL)
203  , fhTimeResSingHits(NULL)
204  , fhTimeResSingHitsB(NULL)
205  , fhTimePtVsHits(NULL)
206  , fhClusterSize(NULL)
207  , fhClusterSizeType(NULL)
208  , fhTrackMul(NULL)
209  , fhClusterSizeMulti(NULL)
210  , fhTrk1MulPos(NULL)
211  , fhHiTrkMulPos(NULL)
212  , fhAllTrkMulPos(NULL)
213  , fhMultiTrkProbPos(NULL)
214  , fhDigSpacDifClust(NULL)
215  , fhDigTimeDifClust(NULL)
216  , fhDigDistClust(NULL)
217  , fhClustSizeDifX(NULL)
218  , fhClustSizeDifY(NULL)
219  , fhChDifDifX(NULL)
220  , fhChDifDifY(NULL)
221  , fhRpcDigiCor()
222  , fhRpcCluMul()
223  , fhRpcSigPropSpeed()
224  , fhRpcCluPosition()
225  , fhRpcCluTOff()
226  , fhRpcCluTrms()
227  , fhRpcCluTot()
228  , fhRpcCluSize()
229  , fhRpcCluAvWalk()
230  , fhRpcCluWalk()
231  , fhTRpcCluMul()
232  , fhTRpcCluPosition()
233  , fhTRpcCluTOff()
234  , fhTRpcCluTot()
235  , fhTRpcCluSize()
236  , fhTRpcCluAvWalk()
237  , fhTRpcCluDelTof()
238  , fhTRpcCludXdY()
239  , fhTRpcCluWalk()
240  , fhTrgdT()
241  , fvCPSigPropSpeed()
242  , fvCPDelTof()
243  , fvCPTOff()
244  , fvCPTotGain()
245  , fvCPWalk()
246  , fiNbSameSide(0)
247  , fhNbSameSide(NULL)
248  , fhNbDigiPerChan(NULL)
249  , fStart()
250  , fStop()
251  , fTimer()
252  , fiNofEvents(0.)
253  , fdNofDigisTot(0.)
254  , fdNofHitsTot(0.)
255  , fdTimeTot(0.)
256  , dTRef(0.)
257  , fdTRefMax(0.)
258  , fCalMode(0)
259  , fCalTrg(0)
260  , fCalSmType(0)
261  , fdCaldXdYMax(0.)
262  , fTRefMode(0)
263  , fTRefHits(0)
264  , fPosYMaxScal(0.)
265  , fTRefDifMax(0.)
266  , fTotMax(0.)
267  , fTotMin(0.)
268  , fOutTimeFactor(1.)
269  , fCalParFileName("")
270  , fCalParFile(NULL)
271  , fbMcTrkMonitor(kFALSE)
272 
273 {}
274 
276  if (fGeoHandler) delete fGeoHandler;
277  // DeleteHistos(); // <-- if needed ?
278 }
279 
280 /************************************************************************************/
281 // FairTasks inherited functions
283 
285 
286  if (kFALSE == RegisterInputs()) return kFATAL;
287 
288  if (kFALSE == RegisterOutputs()) return kFATAL;
289 
290  if (kFALSE == InitParameters()) return kFATAL;
291 
292  if (kFALSE == LoadGeometry()) return kFATAL;
293 
294  if (kFALSE == InitCalibParameter()) return kFATAL;
295 
296  if (kFALSE == CreateHistos()) return kFATAL;
297 
298  return kSUCCESS;
299 }
300 
302  LOG(info) << " CbmTofSimpClusterizer => Get the digi parameters for tof";
303 
304  // Get Base Container
305  FairRunAna* ana = FairRunAna::Instance();
306  FairRuntimeDb* rtdb = ana->GetRuntimeDb();
307 
308  fDigiPar = (CbmTofDigiPar*) (rtdb->getContainer("CbmTofDigiPar"));
309 
310  LOG(info) << " CbmTofSimpClusterizer::SetParContainers found "
311  << fDigiPar->GetNrOfModules() << " cells ";
312 
313  fDigiBdfPar = (CbmTofDigiBdfPar*) (rtdb->getContainer("CbmTofDigiBdfPar"));
314 }
315 
316 void CbmTofSimpClusterizer::Exec(Option_t* /*option*/) {
317  // Start timer counter
318  fTimer.Start();
319 
320  fTofHitsColl->Clear("C");
321  // fTofDigiMatchColl->Clear("C"); // Not enough => CbmMatch has no Clear functions!!
322  fTofDigiMatchColl->Delete();
323 
324  fiNbHits = 0;
325 
327  LOG(debug) << " CbmTofSimpClusterizer => New event with " << iNbTofDigi
328  << " digis ";
329  fStart.Set();
330 
331  BuildClusters();
332 
333  fStop.Set();
334 
335  FillHistos();
336 
337  // --- Update Counters
338  fTimer.Stop();
339  fiNofEvents++;
340  fdNofDigisTot += iNbTofDigi;
342  fdTimeTot += fTimer.RealTime();
343 }
344 
346  WriteHistos();
347  // Prevent them from being sucked in by the CbmHadronAnalysis WriteHistograms method
348  DeleteHistos();
349 
350  // Final printout for reference
351  LOG(info) << "=====================================";
352  LOG(info) << GetName() << ": Run summary (Time includes Hist filling)";
353  LOG(info) << "Events processed : " << fiNofEvents;
354  LOG(info) << "Digis / event : "
355  << fdNofDigisTot / static_cast<Double_t>(fiNofEvents);
356  LOG(info) << "Hits / event : "
357  << fdNofHitsTot / static_cast<Double_t>(fiNofEvents);
358  LOG(info) << "Digis per Hits : " << fdNofDigisTot / fdNofHitsTot;
359  LOG(info) << "Time per event : "
360  << fdTimeTot / static_cast<Double_t>(fiNofEvents) << " ";
361  LOG(info) << "=====================================";
362 }
363 
364 /************************************************************************************/
365 // Functions common for all clusters approximations
367  FairRootManager* fManager = FairRootManager::Instance();
368 
377  fTofPointsColl = nullptr;
378 
379 
380  // --- Check input branch (TofDigiExp). If not present, set task inactive.
382  LOG(error) << GetName() << ": No TofDigi input array present; "
383  << "task will be inactive.";
384  return kERROR;
385  }
386 
387 
388  fMcTracksColl = (TClonesArray*) fManager->GetObject("MCTrack");
389  if (NULL == fMcTracksColl) {
390  LOG(info) << "CbmTofSimpClusterizer: No MCTrack array.";
391  } // if( NULL == fMcTracksColl)
392 
393 
394  return kTRUE;
395 }
397  FairRootManager* rootMgr = FairRootManager::Instance();
398 
399  fTofHitsColl = new TClonesArray("CbmTofHit");
400 
401  // Flag check to control whether digis are written in output root file
402  rootMgr->Register(
403  "TofHit", "Tof", fTofHitsColl, IsOutputBranchPersistent("TofHit"));
404 
405  fTofDigiMatchColl = new TClonesArray("CbmMatch", 100);
406  rootMgr->Register("TofHitDigiMatch",
407  "Tof",
409  IsOutputBranchPersistent("TofHitDigiMatch"));
410 
411  return kTRUE;
412 }
414 
415  // Initialize the TOF GeoHandler
416  Bool_t isSimulation = kFALSE;
417  Int_t iGeoVersion = fGeoHandler->Init(isSimulation);
418  LOG(info) << "CbmTofSimpClusterizer::InitParameters with GeoVersion "
419  << iGeoVersion;
420 
421  if (k12b > iGeoVersion) {
422  LOG(error) << "CbmTofSimpClusterizer::InitParameters => Only compatible "
423  "with geometries after v12b !!!";
424  return kFALSE;
425  }
426 
427  if (NULL != fTofId)
428  LOG(info) << "CbmTofSimpClusterizer::InitParameters with GeoVersion "
430  else {
431  switch (iGeoVersion) {
432  case k12b: fTofId = new CbmTofDetectorId_v12b(); break;
433  case k14a: fTofId = new CbmTofDetectorId_v14a(); break;
434  default:
435  LOG(error)
436  << "CbmTofSimpClusterizer::InitParameters => Invalid geometry!!!"
437  << iGeoVersion;
438  return kFALSE;
439  }
440  }
441 
443  fdParSystTimeRes = 0.080;
444 
445  LOG(info) << " CbmTofSimpClusterizer::InitParameters found Tres FEE = "
446  << fdParFeeTimeRes << " ns ";
447  LOG(info) << " CbmTofSimpClusterizer::InitParameters found Tres Syst = "
448  << fdParSystTimeRes << " ns ";
449 
450  return kTRUE;
451 }
452 /************************************************************************************/
454  // dimension and initialize calib parameter
455  //
456  Int_t iNbSmTypes = fDigiBdfPar->GetNbSmTypes();
457 
458  fvCPSigPropSpeed.resize(iNbSmTypes);
459  for (Int_t iT = 0; iT < iNbSmTypes; iT++) {
460  Int_t iNbRpc = fDigiBdfPar->GetNbRpc(iT);
461  fvCPSigPropSpeed[iT].resize(iNbRpc);
462  for (Int_t iRpc = 0; iRpc < iNbRpc; iRpc++)
463  if (0.0 < fDigiBdfPar->GetSigVel(iT, 0, iRpc))
464  fvCPSigPropSpeed[iT][iRpc] = fDigiBdfPar->GetSigVel(iT, 0, iRpc);
465  else
467  } // for (Int_t iT=0; iT<iNbSmTypes; iT++)
468 
469  fvCPTOff.resize(iNbSmTypes);
470  fvCPTotGain.resize(iNbSmTypes);
471  fvCPWalk.resize(iNbSmTypes);
472  fvCPDelTof.resize(iNbSmTypes);
473  for (Int_t iSmType = 0; iSmType < iNbSmTypes; iSmType++) {
474  Int_t iNbSm = fDigiBdfPar->GetNbSm(iSmType);
475  Int_t iNbRpc = fDigiBdfPar->GetNbRpc(iSmType);
476  fvCPTOff[iSmType].resize(iNbSm * iNbRpc);
477  fvCPTotGain[iSmType].resize(iNbSm * iNbRpc);
478  fvCPWalk[iSmType].resize(iNbSm * iNbRpc);
479  fvCPDelTof[iSmType].resize(iNbSm * iNbRpc);
480  for (Int_t iSm = 0; iSm < iNbSm; iSm++) {
481  for (Int_t iRpc = 0; iRpc < iNbRpc; iRpc++) {
482  // LOG(info)<<Form(" fvCPDelTof resize for SmT %d, R %d, B %d ",iSmType,iNbSm*iNbRpc,nbClDelTofBinX)
483  // ;
484  fvCPDelTof[iSmType][iSm * iNbRpc + iRpc].resize(nbClDelTofBinX);
485  for (Int_t iBx = 0; iBx < nbClDelTofBinX; iBx++) {
486  // LOG(info)<<Form(" fvCPDelTof for SmT %d, R %d, B %d",iSmType,iSm*iNbRpc+iRpc,iBx);
487  fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx].resize(iNTrg);
488  for (Int_t iTrg = 0; iTrg < iNTrg; iTrg++)
489  fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iTrg] =
490  0.; // initialize
491  }
492 
493  Int_t iNbChan = fDigiBdfPar->GetNbChan(iSmType, iRpc);
494  fvCPTOff[iSmType][iSm * iNbRpc + iRpc].resize(iNbChan);
495  fvCPTotGain[iSmType][iSm * iNbRpc + iRpc].resize(iNbChan);
496  fvCPWalk[iSmType][iSm * iNbRpc + iRpc].resize(iNbChan);
497  Int_t nbSide = 2 - fDigiBdfPar->GetChanType(iSmType, iRpc);
498  for (Int_t iCh = 0; iCh < iNbChan; iCh++) {
499  fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh].resize(nbSide);
500  fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh].resize(nbSide);
501  fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh].resize(nbSide);
502  for (Int_t iSide = 0; iSide < nbSide; iSide++) {
503  fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] =
504  0.; //initialize
505  fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] =
506  1.; //initialize
507  fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][iSide].resize(
508  nbClWalkBinX);
509  for (Int_t iWx = 0; iWx < nbClWalkBinX; iWx++) {
510  fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][iSide][iWx] = 0.;
511  }
512  }
513  }
514  }
515  }
516  }
517 
518  LOG(info) << "CbmTofSimpClusterizer::InitCalibParameter: defaults set";
519 
520  TDirectory* oldir =
521  gDirectory; // <= To prevent histos from being sucked in by the param file of the TRootManager!
522  /*
523  gROOT->cd(); // <= To prevent histos from being sucked in by the param file of the TRootManager !
524  */
525 
526  if (0 < fCalMode) {
527  LOG(info) << "CbmTofSimpClusterizer::InitCalibParameter: read histos from "
528  << "file " << fCalParFileName;
529 
530  // read parameter from histos
531  if (fCalParFileName.IsNull()) return kTRUE;
532 
533  fCalParFile = new TFile(fCalParFileName, "");
534  if (NULL == fCalParFile) {
535  LOG(error) << "CbmTofSimpClusterizer::InitCalibParameter: "
536  << "file " << fCalParFileName << " does not exist!";
537  return kTRUE;
538  }
539  /*
540  gDirectory->Print();
541  fCalParFile->cd();
542  fCalParFile->ls();
543  */
544 
545  for (Int_t iSmType = 0; iSmType < iNbSmTypes; iSmType++) {
546  Int_t iNbSm = fDigiBdfPar->GetNbSm(iSmType);
547  Int_t iNbRpc = fDigiBdfPar->GetNbRpc(iSmType);
548  for (Int_t iSm = 0; iSm < iNbSm; iSm++)
549  for (Int_t iRpc = 0; iRpc < iNbRpc; iRpc++) {
550  TH2F* htempPos_pfx = (TH2F*) gDirectory->FindObjectAny(
551  Form("cl_CorSmT%01d_sm%03d_rpc%03d_Pos_pfx", iSmType, iSm, iRpc));
552  TH2F* htempTOff_pfx = (TH2F*) gDirectory->FindObjectAny(
553  Form("cl_CorSmT%01d_sm%03d_rpc%03d_TOff_pfx", iSmType, iSm, iRpc));
554  TH2F* htempTot_pfx = (TH2F*) gDirectory->FindObjectAny(
555  Form("cl_CorSmT%01d_sm%03d_rpc%03d_Tot_pfx", iSmType, iSm, iRpc));
556  if (NULL != htempPos_pfx && NULL != htempTOff_pfx
557  && NULL != htempTot_pfx) {
558  Int_t iNbCh = fDigiBdfPar->GetNbChan(iSmType, iRpc);
559  Int_t iNbinTot = htempTot_pfx->GetNbinsX();
560  for (Int_t iCh = 0; iCh < iNbCh; iCh++) {
561  Double_t YMean = ((TProfile*) htempPos_pfx)
562  ->GetBinContent(iCh + 1); //nh +1 empirical(?)
563  Double_t TMean =
564  ((TProfile*) htempTOff_pfx)->GetBinContent(iCh + 1);
565  Double_t dTYOff = YMean / fvCPSigPropSpeed[iSmType][iRpc];
566  fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0] += -dTYOff + TMean;
567  fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1] += +dTYOff + TMean;
568 
569  Double_t TotMean =
570  ((TProfile*) htempTot_pfx)
571  ->GetBinContent(iCh + 1); //nh +1 empirical(?)
572  if (1 < TotMean) {
573  fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0] *=
574  TTotMean / TotMean;
575  fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][1] *=
576  TTotMean / TotMean;
577  }
578  LOG(debug1) << "CbmTofSimpClusterizer::InitCalibParameter:"
579  << " SmT " << iSmType << " Sm " << iSm << " Rpc "
580  << iRpc << " Ch " << iCh << ": YMean " << YMean
581  << ", TMean " << TMean << " -> "
582  << fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0]
583  << ", "
584  << fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]
585  << ", "
586  << fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][0]
587  << ", NbinTot " << iNbinTot;
588 
589  TH1D* htempWalk0 = (TH1D*) gDirectory->FindObjectAny(
590  Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S0_Walk_px",
591  iSmType,
592  iSm,
593  iRpc,
594  iCh));
595  TH1D* htempWalk1 = (TH1D*) gDirectory->FindObjectAny(
596  Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S1_Walk_px",
597  iSmType,
598  iSm,
599  iRpc,
600  iCh));
601  if (NULL != htempWalk0
602  && NULL != htempWalk1) { // reinitialize Walk array
603  LOG(info) << "Initialize Walk correction for "
604  << Form(" SmT%01d_sm%03d_rpc%03d_Ch%03d",
605  iSmType,
606  iSm,
607  iRpc,
608  iCh);
609  if (htempWalk0->GetNbinsX() != nbClWalkBinX)
610  LOG(error) << "CbmTofSimpClusterizer::InitCalibParameter: "
611  "Inconsistent Walk histograms";
612  for (Int_t iBin = 0; iBin < nbClWalkBinX; iBin++) {
613  fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iBin] =
614  htempWalk0->GetBinContent(iBin + 1);
615  fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][1][iBin] =
616  htempWalk1->GetBinContent(iBin + 1);
617  LOG(debug1) << Form(
618  " SmT%01d_sm%03d_rpc%03d_Ch%03d bin %d walk %f ",
619  iSmType,
620  iSm,
621  iRpc,
622  iCh,
623  iBin,
624  fvCPWalk[iSmType][iSm * iNbRpc + iRpc][iCh][0][iBin]);
625  }
626  }
627  }
628  } else {
629  LOG(error) << " Histos "
630  << Form(
631  "cl_SmT%01d_sm%03d_rpc%03d_XXX", iSmType, iSm, iRpc)
632  << " not found. ";
633  }
634  for (Int_t iTrg = 0; iTrg < iNTrg; iTrg++) {
635  TH1D* htmpDelTof = (TH1D*) gDirectory->FindObjectAny(
636  Form("cl_CorSmT%01d_sm%03d_rpc%03d_Trg%02d_DelTof",
637  iSmType,
638  iSm,
639  iRpc,
640  iTrg));
641  if (NULL == htmpDelTof) {
642  LOG(info) << " Histos "
643  << Form("cl_CorSmT%01d_sm%03d_rpc%03d_Trg%02d_DelTof",
644  iSmType,
645  iSm,
646  iRpc,
647  iTrg)
648  << " not found. ";
649  continue;
650  }
651  LOG(info) << " Load DelTof from histos "
652  << Form("cl_CorSmT%01d_sm%03d_rpc%03d_Trg%02d_DelTof",
653  iSmType,
654  iSm,
655  iRpc,
656  iTrg)
657  << ".";
658  for (Int_t iBx = 0; iBx < nbClDelTofBinX; iBx++) {
659  fvCPDelTof[iSmType][iSm * iNbRpc + iRpc][iBx][iTrg] +=
660  htmpDelTof->GetBinContent(iBx + 1);
661  }
662 
663  // copy Histo to memory
664  TDirectory* curdir = gDirectory;
665  gDirectory->cd(oldir->GetPath());
666  TH1D* h1DelTof = (TH1D*) htmpDelTof->Clone(
667  Form("cl_CorSmT%01d_sm%03d_rpc%03d_Trg%02d_DelTof",
668  iSmType,
669  iSm,
670  iRpc,
671  iTrg));
672 
673  LOG(info) << " copy histo " << h1DelTof->GetName()
674  << " to directory " << oldir->GetName();
675 
676  gDirectory->cd(curdir->GetPath());
677  }
678  }
679  }
680  }
681  // fCalParFile->Delete();
682  gDirectory->cd(
683  oldir
684  ->GetPath()); // <= To prevent histos from being sucked in by the param file of the TRootManager!
685  LOG(info) << "CbmTofSimpClusterizer::InitCalibParameter: initialization done";
686  return kTRUE;
687 }
688 /************************************************************************************/
690  LOG(debug) << "CbmTofSimpClusterizer::LoadGeometry starting for "
691  << fDigiPar->GetNrOfModules() << " geometrically known modules ";
692 
693  Int_t iNrOfCells = fDigiPar->GetNrOfModules();
694  LOG(debug) << "Digi Parameter container contains " << iNrOfCells << " cells"
695  << ", interpret with GeoVersion " << fGeoHandler->GetGeoVersion();
696 
698 
699  for (Int_t icell = 0; icell < iNrOfCells; ++icell) {
700 
701  Int_t cellId =
702  fDigiPar->GetCellId(icell); // cellId is assigned in CbmTofCreateDigiPar
703  fChannelInfo = fDigiPar->GetCell(cellId);
704 
705  Int_t smtype = fGeoHandler->GetSMType(cellId);
706  Int_t smodule = fGeoHandler->GetSModule(cellId);
707  Int_t module = fGeoHandler->GetCounter(cellId);
708  Int_t cell = fGeoHandler->GetCell(cellId);
709 
710  Double_t x = fChannelInfo->GetX();
711  Double_t y = fChannelInfo->GetY();
712  Double_t z = fChannelInfo->GetZ();
713  Double_t dx = fChannelInfo->GetSizex();
714  Double_t dy = fChannelInfo->GetSizey();
715  LOG(debug1) << "-I- InitPar " << icell << " Id: " << Form("0x%08x", cellId)
716  << " " << cell << " tmcs: " << smtype << " " << smodule << " "
717  << module << " " << cell << " x=" << Form("%6.2f", x)
718  << " y=" << Form("%6.2f", y) << " z=" << Form("%6.2f", z)
719  << " dx=" << dx << " dy=" << dy;
720  }
721 
722  Int_t iNbSmTypes = fDigiBdfPar->GetNbSmTypes();
723 
724  if (kTRUE == fDigiBdfPar->UseExpandedDigi()) {
725  fStorDigiExp.resize(iNbSmTypes);
726  fStorDigiInd.resize(iNbSmTypes);
727  fviClusterSize.resize(iNbSmTypes);
728  fviTrkMul.resize(iNbSmTypes);
729  fvdX.resize(iNbSmTypes);
730  fvdY.resize(iNbSmTypes);
731  fvdDifX.resize(iNbSmTypes);
732  fvdDifY.resize(iNbSmTypes);
733  fvdDifCh.resize(iNbSmTypes);
734  fviClusterMul.resize(iNbSmTypes);
735  for (Int_t iSmType = 0; iSmType < iNbSmTypes; iSmType++) {
736  Int_t iNbSm = fDigiBdfPar->GetNbSm(iSmType);
737  Int_t iNbRpc = fDigiBdfPar->GetNbRpc(iSmType);
738  fStorDigiExp[iSmType].resize(iNbSm * iNbRpc);
739  fStorDigiInd[iSmType].resize(iNbSm * iNbRpc);
740  fviClusterSize[iSmType].resize(iNbRpc);
741  fviTrkMul[iSmType].resize(iNbRpc);
742  fvdX[iSmType].resize(iNbRpc);
743  fvdY[iSmType].resize(iNbRpc);
744  fvdDifX[iSmType].resize(iNbRpc);
745  fvdDifY[iSmType].resize(iNbRpc);
746  fvdDifCh[iSmType].resize(iNbRpc);
747  for (Int_t iSm = 0; iSm < iNbSm; iSm++) {
748  fviClusterMul[iSmType].resize(iNbSm);
749  for (Int_t iRpc = 0; iRpc < iNbRpc; iRpc++) {
750  fviClusterMul[iSmType][iSm].resize(iNbRpc);
751  Int_t iNbChan = fDigiBdfPar->GetNbChan(iSmType, iRpc);
752  LOG(debug)
753  << "CbmTofSimpClusterizer::LoadGeometry: StoreDigi with "
754  << Form(
755  " %3d %3d %3d %3d %5d ", iSmType, iSm, iNbRpc, iRpc, iNbChan);
756  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc].resize(iNbChan);
757  fStorDigiInd[iSmType][iSm * iNbRpc + iRpc].resize(iNbChan);
758  } // for( Int_t iRpc = 0; iRpc < iNbRpc; iRpc++ )
759  } // for( Int_t iSm = 0; iSm < iNbSm; iSm++ )
760  } // for( Int_t iSmType = 0; iSmType < iNbSmTypes; iSmType++ )
761  } // if( kTRUE == fDigiBdfPar->UseExpandedDigi() )
762  LOG(debug) << "CbmTofSimpClusterizer::LoadGeometry: Done!";
763  return kTRUE;
764 }
766  Int_t iNbSmTypes = fDigiBdfPar->GetNbSmTypes();
767  if (kTRUE == fDigiBdfPar->UseExpandedDigi()) {
768  for (Int_t iSmType = 0; iSmType < iNbSmTypes; iSmType++) {
769  Int_t iNbSm = fDigiBdfPar->GetNbSm(iSmType);
770  Int_t iNbRpc = fDigiBdfPar->GetNbRpc(iSmType);
771  for (Int_t iSm = 0; iSm < iNbSm; iSm++) {
772  for (Int_t iRpc = 0; iRpc < iNbRpc; iRpc++) {
773  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc].clear();
774  fStorDigiInd[iSmType][iSm * iNbRpc + iRpc].clear();
775  }
776  } // for( Int_t iSm = 0; iSm < iNbSm; iSm++ )
777  fStorDigiExp[iSmType].clear();
778  fStorDigiInd[iSmType].clear();
779  } // for( Int_t iSmType = 0; iSmType < iNbSmTypes; iSmType++ )
780  fStorDigiExp.clear();
781  fStorDigiInd.clear();
782  } // if( kTRUE == fDigiBdfPar->UseExpandedDigi() )
783  return kTRUE;
784 }
785 /************************************************************************************/
786 // Histogramming functions
788  TDirectory* oldir =
789  gDirectory; // <= To prevent histos from being sucked in by the param file of the TRootManager!
790  gROOT
791  ->cd(); // <= To prevent histos from being sucked in by the param file of the TRootManager !
793  new TH1I("TofSimpClus_ClustBuildTime",
794  "Time needed to build clusters in each event; Time [s]",
795  4000,
796  0.0,
797  4.0);
799  new TH1I("TofSimpClus_TofHitPerTrk",
800  "Mean Number of TofHit per Mc Track; Nb TofHits/Nb MC Tracks []",
801  2000,
802  0.0,
803  20.0);
804  if (kFALSE == fDigiBdfPar->ClustUseTrackId())
805  fhPtsPerHit = new TH1I("TofSimpClus_TofPtsPerHit",
806  "Distribution of the Number of MCPoints associated "
807  "to each TofHit; Nb MCPoint []",
808  20,
809  0.0,
810  20.0);
811  if (kTRUE == fDigiBdfPar->ClustUseTrackId()) {
813  new TH1I("TofSimpClus_TofTimeResClust",
814  "Time resolution for TofHits containing Digis from a single MC "
815  "Track; t(1st Mc Point) -tTofHit [ns]",
816  10000,
817  -25.0,
818  25.0);
820  new TH2I("TofSimpClus_TofTimeResClustB",
821  "Time resolution for TofHits containing Digis from a single MC "
822  "Track; (1st Mc Point) -tTofHit [ns]",
823  5000,
824  -25.0,
825  25.0,
826  6,
827  0,
828  6);
830  new TH2I("TofSimpClus_TofTimePtVsHit",
831  "Time resolution for TofHits containing Digis from a single MC "
832  "Track; t(1st Mc Point) -tTofHit [ps]",
833  2000,
834  0.0,
835  50000.0,
836  2000,
837  0.0,
838  50000.0);
839  } else {
841  new TH1I("TofSimpClus_TofTimeResClust",
842  "Time resolution for TofHits containing Digis from a single "
843  "TofPoint; tMcPoint -tTofHit [ns]",
844  10000,
845  -25.0,
846  25.0);
848  new TH2I("TofSimpClus_TofTimeResClustB",
849  "Time resolution for TofHits containing Digis from a single "
850  "TofPoint; tMcPoint -tTofHit [ns]",
851  5000,
852  -25.0,
853  25.0,
854  6,
855  0,
856  6);
857  fhTimePtVsHits = new TH2I("TofSimpClus_TofTimePtVsHit",
858  "Time resolution for TofHits containing Digis "
859  "from a single TofPoint; tMcPoint -tTofHit [ps]",
860  2000,
861  0.0,
862  50000.0,
863  2000,
864  0.0,
865  50000.0);
866  } // else of if( kTRUE == fDigiBdfPar->ClustUseTrackId() )
867  fhClusterSize = new TH1I("TofSimpClus_ClusterSize",
868  "Cluster Size distribution; Cluster Size [Strips]",
869  100,
870  0.5,
871  100.5);
873  new TH2I("TofSimpClus_ClusterSizeType",
874  "Cluster Size distribution in each (SM type, Rpc) pair; Cluster "
875  "Size [Strips]; 10*SM Type + Rpc Index []",
876  100,
877  0.5,
878  100.5,
879  40 * fDigiBdfPar->GetNbSmTypes(),
880  0.0,
881  40 * fDigiBdfPar->GetNbSmTypes());
882  if (kTRUE == fDigiBdfPar->ClustUseTrackId()) {
883  fhTrackMul = new TH1I(
884  "TofSimpClus_TrackMul",
885  "Number of MC tracks generating the cluster; MC Tracks multiplicity []",
886  100,
887  0.5,
888  100.5);
889  fhClusterSizeMulti = new TH2I(
890  "TofSimpClus_ClusterSizeMulti",
891  "Cluster Size distribution as function of Number of MC tracks generating "
892  "the cluster; Cluster Size [Strips]; MC tracks mul. []",
893  100,
894  0.5,
895  100.5,
896  100,
897  0.5,
898  100.5);
899  fhTrk1MulPos = new TH2D("TofSimpClus_Trk1MulPos",
900  "Position of Clusters with only 1 MC tracks "
901  "generating the cluster; X [cm]; Y [cm]",
902  1500,
903  -750,
904  750,
905  1000,
906  -500,
907  500);
908  fhHiTrkMulPos = new TH2D("TofSimpClus_HiTrkMulPos",
909  "Position of Clusters with >1 MC tracks "
910  "generating the cluster; X [cm]; Y [cm]",
911  1500,
912  -750,
913  750,
914  1000,
915  -500,
916  500);
917  fhAllTrkMulPos = new TH2D(
918  "TofSimpClus_AllTrkMulPos",
919  "Position of all clusters generating the cluster; X [cm]; Y [cm]",
920  1500,
921  -750,
922  750,
923  1000,
924  -500,
925  500);
927  new TH2D("TofSimpClus_MultiTrkProbPos",
928  "Probability of having a cluster with multiple tracks as "
929  "function of position; X [cm]; Y [cm]; Prob. [%]",
930  1500,
931  -750,
932  750,
933  1000,
934  -500,
935  500);
936  } // if( kTRUE == fDigiBdfPar->ClustUseTrackId() )
937 
939  new TH1I("TofSimpClus_DigSpacDifClust",
940  "Space difference along channel direction between Digi pairs on "
941  "adjacent channels; PosCh i - Pos Ch i+1 [cm]",
942  5000,
943  -10.0,
944  10.0);
946  new TH1I("TofSimpClus_DigTimeDifClust",
947  "Time difference between Digi pairs on adjacent channels; "
948  "0.5*(tDigiA + tDigiA)chi - 0.5*(tDigiA + tDigiA)chi+1 [ns]",
949  5000,
950  -5.0,
951  5.0);
952  fhDigDistClust = new TH2I(
953  "TofSimpClus_DigDistClust",
954  "Distance between Digi pairs on adjacent channels; PosCh i - Pos Ch i+1 "
955  "[cm along ch]; 0.5*(tDigiA + tDigiA)chi - 0.5*(tDigiA + tDigiA)chi+1 [ns]",
956  5000,
957  -10.0,
958  10.0,
959  2000,
960  -5.0,
961  5.0);
962 
964  new TH2I("TofSimpClus_ClustSizeDifX",
965  "Position difference between Point and Hit as function of Cluster "
966  "Size; Cluster Size [Strips]; dX [cm]",
967  100,
968  0.5,
969  100.5,
970  500,
971  -50,
972  50);
974  new TH2I("TofSimpClus_ClustSizeDifY",
975  "Position difference between Point and Hit as function of Cluster "
976  "Size; Cluster Size [Strips]; dY [cm]",
977  100,
978  0.5,
979  100.5,
980  500,
981  -50,
982  50);
983  fhChDifDifX = new TH2I("TofSimpClus_ChDifDifX",
984  "Position difference between Point and Hit as "
985  "function of Channel dif; Ch Dif [Strips]; dX [cm]",
986  101,
987  -50.5,
988  50.5,
989  500,
990  -50,
991  50);
992  fhChDifDifY = new TH2I("TofSimpClus_ChDifDifY",
993  "Position difference between Point and Hit as "
994  "function of Channel Dif; Ch Dif [Strips]; dY [cm]",
995  101,
996  -50.5,
997  50.5,
998  500,
999  -50,
1000  50);
1001 
1002  fhNbSameSide = new TH1I("TofSimpClus_NbSameSide",
1003  "How many time per event the 2 digis on a channel "
1004  "were of the same side ; Counts/Event []",
1005  500,
1006  0.0,
1007  500.0);
1008  fhNbDigiPerChan = new TH1I("TofSimpClus_NbDigiPerChan",
1009  "Nb of Digis per channel; Nb Digis []",
1010  100,
1011  0.0,
1012  100.0);
1013 
1014  gDirectory->cd(
1015  oldir
1016  ->GetPath()); // <= To prevent histos from being sucked in by the param file of the TRootManager!
1017 
1018  return kTRUE;
1019 }
1021  fhClustBuildTime->Fill(fStop.GetSec() - fStart.GetSec()
1022  + (fStop.GetNanoSec() - fStart.GetNanoSec()) / 1e9);
1023  Int_t iNbTofHits = fTofHitsColl->GetEntries();
1024 
1025  if (fbMcTrkMonitor && fMcTracksColl) {
1026  Int_t iNbTracks = fMcTracksColl->GetEntries();
1027 
1028  // Trakcs Info
1029  Int_t iNbTofTracks = 0;
1030  Int_t iNbTofTracksPrim = 0;
1031  CbmMCTrack* pMcTrk;
1032  for (Int_t iTrkInd = 0; iTrkInd < iNbTracks; iTrkInd++) {
1033  pMcTrk = (CbmMCTrack*) fMcTracksColl->At(iTrkInd);
1034 
1035  if (0 < pMcTrk->GetNPoints(ECbmModuleId::kTof)) { iNbTofTracks++; }
1036  if (0 < pMcTrk->GetNPoints(ECbmModuleId::kTof)
1037  && -1 == pMcTrk->GetMotherId())
1038  iNbTofTracksPrim++;
1039 
1040  } // for(Int_t iTrkInd = 0; iTrkInd < nMcTracks; iTrkInd++)
1041 
1042  if (0 < iNbTofTracks)
1043  fhHitsPerTracks->Fill((Double_t) iNbTofHits / (Double_t) iNbTofTracks);
1044  } // if( fbMcTrkMonitor )
1045 
1046  CbmTofHit* pHit;
1047  for (Int_t iHitInd = 0; iHitInd < iNbTofHits; iHitInd++) {
1048  pHit = (CbmTofHit*) fTofHitsColl->At(iHitInd);
1049  if (kFALSE == fDigiBdfPar->ClustUseTrackId())
1050  fhPtsPerHit->Fill(pHit->GetFlag());
1051  if (1 == pHit->GetFlag()) {
1052  // CbmTofPoint* pPt = (CbmTofPoint*)pHit->GetRefId();
1053  // Using the SetLinks/GetLinks of the TofHit class seems to conflict
1054  // with something in littrack QA
1055  // CbmTofPoint* pPt = (CbmTofPoint*)(pHit->GetLinks());
1056  /*
1057  // Use instead the index => WRONG and not consistent with hit creation
1058  // Need to loop on digi match object, check the digi to pnt match object for each, etc....
1059  // ====> Just comment this code, if anybody needs it, have to implement proper solution
1060  CbmTofPoint* pPt = (CbmTofPoint*)fTofPointsColl->At( pHit->GetRefId() );
1061  fhTimePtVsHits->Fill( pPt->GetTime(), pHit->GetTime() );
1062  fhTimeResSingHits->Fill( pHit->GetTime() - pPt->GetTime() );
1063  fhTimeResSingHitsB->Fill( pHit->GetTime() - pPt->GetTime(),
1064  fGeoHandler->GetSMType(pPt->GetDetectorID()) );
1065 */
1066  } // if( 1 == pHit->GetFlag() )
1067  } // for( Int_t iHitInd = 0; iHitInd < iNbTofHits; iHitInd++)
1068 
1069  for (Int_t iSmType = 0; iSmType < fDigiBdfPar->GetNbSmTypes(); iSmType++)
1070  for (Int_t iRpc = 0; iRpc < fDigiBdfPar->GetNbRpc(iSmType); iRpc++) {
1071  for (UInt_t uCluster = 0; uCluster < fviClusterSize[iSmType][iRpc].size();
1072  uCluster++) {
1073  fhClusterSize->Fill(fviClusterSize[iSmType][iRpc][uCluster]);
1074  fhClusterSizeType->Fill(fviClusterSize[iSmType][iRpc][uCluster],
1075  40 * iSmType + iRpc);
1076  if (kTRUE == fDigiBdfPar->ClustUseTrackId()) {
1077  fhTrackMul->Fill(fviTrkMul[iSmType][iRpc][uCluster]);
1078  fhClusterSizeMulti->Fill(fviClusterSize[iSmType][iRpc][uCluster],
1079  fviTrkMul[iSmType][iRpc][uCluster]);
1080  if (1 == fviTrkMul[iSmType][iRpc][uCluster])
1081  fhTrk1MulPos->Fill(fvdX[iSmType][iRpc][uCluster],
1082  fvdY[iSmType][iRpc][uCluster]);
1083  if (1 < fviTrkMul[iSmType][iRpc][uCluster])
1084  fhHiTrkMulPos->Fill(fvdX[iSmType][iRpc][uCluster],
1085  fvdY[iSmType][iRpc][uCluster]);
1086  fhAllTrkMulPos->Fill(fvdX[iSmType][iRpc][uCluster],
1087  fvdY[iSmType][iRpc][uCluster]);
1088  } // if( kTRUE == fDigiBdfPar->ClustUseTrackId() )
1089  if (1 == fviTrkMul[iSmType][iRpc][uCluster]) {
1090  fhClustSizeDifX->Fill(fviClusterSize[iSmType][iRpc][uCluster],
1091  fvdDifX[iSmType][iRpc][uCluster]);
1092  fhClustSizeDifY->Fill(fviClusterSize[iSmType][iRpc][uCluster],
1093  fvdDifY[iSmType][iRpc][uCluster]);
1094  if (1 == fviClusterSize[iSmType][iRpc][uCluster]) {
1095  fhChDifDifX->Fill(fvdDifCh[iSmType][iRpc][uCluster],
1096  fvdDifX[iSmType][iRpc][uCluster]);
1097  fhChDifDifY->Fill(fvdDifCh[iSmType][iRpc][uCluster],
1098  fvdDifY[iSmType][iRpc][uCluster]);
1099  }
1100  }
1101  } // for( UInt_t uCluster = 0; uCluster < fviClusterSize[iSmType][iRpc].size(); uCluster++ )
1102  fviClusterSize[iSmType][iRpc].clear();
1103  fviTrkMul[iSmType][iRpc].clear();
1104  fvdX[iSmType][iRpc].clear();
1105  fvdY[iSmType][iRpc].clear();
1106  fvdDifX[iSmType][iRpc].clear();
1107  fvdDifY[iSmType][iRpc].clear();
1108  fvdDifCh[iSmType][iRpc].clear();
1109  } // for( Int_t iRpc = 0; iRpc < fDigiBdfPar->GetNbRpc( iSmType); iRpc++ )
1110 
1111  fhNbSameSide->Fill(fiNbSameSide);
1112 
1113  return kTRUE;
1114 }
1116  if ("" == fsHistoOutFilename) {
1117  LOG(info) << "CbmTofSimpClusterizer::WriteHistos => Control histograms "
1118  "will not be written to disk!";
1119  LOG(info) << "CbmTofSimpClusterizer::WriteHistos => To change this "
1120  "behavior please provide a full path "
1121  << "with the SetHistoFileName method";
1122  return kTRUE;
1123  } // if( "" == fsHistoOutFilename )
1124 
1125  TDirectory* oldir = gDirectory;
1126  TFile* fHist = new TFile(fsHistoOutFilename, "RECREATE");
1127 
1128  fHist->cd();
1129  fhClustBuildTime->Write();
1130  fhHitsPerTracks->Write();
1131  if (kFALSE == fDigiBdfPar->ClustUseTrackId()) fhPtsPerHit->Write();
1132  fhTimeResSingHits->Write();
1133  fhTimeResSingHitsB->Write();
1134  fhTimePtVsHits->Write();
1135  fhClusterSize->Write();
1136  fhClusterSizeType->Write();
1137  if (kTRUE == fDigiBdfPar->ClustUseTrackId()) {
1138  fhTrackMul->Write();
1139  fhClusterSizeMulti->Write();
1140  fhTrk1MulPos->Write();
1141  fhHiTrkMulPos->Write();
1142  fhAllTrkMulPos->Write();
1144  fhMultiTrkProbPos->Scale(100.0);
1145  fhMultiTrkProbPos->Write();
1146  } // if( kTRUE == fDigiBdfPar->ClustUseTrackId() )
1147  fhDigSpacDifClust->Write();
1148  fhDigTimeDifClust->Write();
1149  fhDigDistClust->Write();
1150 
1151  fhClustSizeDifX->Write();
1152  fhClustSizeDifY->Write();
1153 
1154  fhChDifDifX->Write();
1155  fhChDifDifY->Write();
1156 
1157  fhNbSameSide->Write();
1158  fhNbDigiPerChan->Write();
1159 
1160  gDirectory->cd(oldir->GetPath());
1161 
1162  fHist->Close();
1163 
1164  return kTRUE;
1165 }
1166 Bool_t CbmTofSimpClusterizer::SetHistoFileName(TString sFilenameIn) {
1167  fsHistoOutFilename = sFilenameIn;
1168  return kTRUE;
1169 }
1171  delete fhClustBuildTime;
1172  delete fhHitsPerTracks;
1173  delete fhPtsPerHit;
1174  delete fhTimeResSingHits;
1175  delete fhTimeResSingHitsB;
1176  delete fhTimePtVsHits;
1177  delete fhClusterSize;
1178  delete fhClusterSizeType;
1179 
1180  if (kTRUE == fDigiBdfPar->ClustUseTrackId()) {
1181  delete fhTrackMul;
1182  delete fhClusterSizeMulti;
1183  delete fhTrk1MulPos;
1184  delete fhHiTrkMulPos;
1185  delete fhAllTrkMulPos;
1186  delete fhMultiTrkProbPos;
1187  }
1188  delete fhDigSpacDifClust;
1189  delete fhDigTimeDifClust;
1190  delete fhDigDistClust;
1191 
1192  delete fhClustSizeDifX;
1193  delete fhClustSizeDifY;
1194 
1195  delete fhChDifDifX;
1196  delete fhChDifDifY;
1197 
1198  delete fhNbSameSide;
1199  delete fhNbDigiPerChan;
1200 
1201  return kTRUE;
1202 }
1203 /************************************************************************************/
1205  // --- MC Event info (input file, entry number, start time)
1206  Int_t iInputNr = 0;
1207  Int_t iEventNr = 0;
1208  Double_t dEventTime = 0.;
1209  GetEventInfo(iInputNr, iEventNr, dEventTime);
1210 
1211  /*
1212  * FIXME: maybe use the 2D distance (X/Y) as criteria instead of the distance long channel
1213  * direction
1214  */
1215  Double_t dMaxTimeDist = fDigiBdfPar->GetMaxTimeDist();
1216  Double_t dMaxSpaceDist = fDigiBdfPar->GetMaxDistAlongCh();
1217 
1218  LOG(debug) << " BuildCluster with MaxTimeDist " << dMaxTimeDist
1219  << ", MaxSpaceDist " << dMaxSpaceDist;
1220 
1221  // First Time order the Digis array
1222  // fTofDigisColl->Sort();
1223 
1224  // Then loop over the digis array and store the Digis in separate vectors for
1225  // each RPC modules
1226  Int_t iNbTofDigi = fDigiMan->GetNofDigis(ECbmModuleId::kTof);
1227  LOG(info) << "Number of TOF digis: " << iNbTofDigi;
1228  if (kTRUE == fDigiBdfPar->UseExpandedDigi()) {
1229  CbmTofDigi* pDigi = nullptr;
1230  for (Int_t iDigInd = 0; iDigInd < iNbTofDigi; iDigInd++) {
1231  assert(fDigiMan->Get<CbmTofDigi>(iDigInd));
1232  pDigi = new CbmTofDigi(*(fDigiMan->Get<CbmTofDigi>(iDigInd)));
1233  LOG(debug1) << "CbmTofSimpClusterizer::BuildClusters: " << iDigInd << " "
1234  << pDigi << " " << pDigi->GetType() << " " << pDigi->GetSm()
1235  << " " << pDigi->GetRpc() << " " << pDigi->GetChannel() << " "
1236  << Form("T %6.2f, Tot %6.1f ",
1237  pDigi->GetTime(),
1238  pDigi->GetTot());
1239  if (fDigiBdfPar->GetNbSmTypes()
1240  > pDigi->GetType() // prevent crash due to misconfiguration
1241  && fDigiBdfPar->GetNbSm(pDigi->GetType()) > pDigi->GetSm()
1242  && fDigiBdfPar->GetNbRpc(pDigi->GetType()) > pDigi->GetRpc()
1243  && fDigiBdfPar->GetNbChan(pDigi->GetType(), 0)
1244  > pDigi->GetChannel()) {
1245 
1246  fStorDigiExp[pDigi->GetType()]
1247  [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType())
1248  + pDigi->GetRpc()][pDigi->GetChannel()]
1249  .push_back(pDigi);
1250  fStorDigiInd[pDigi->GetType()]
1251  [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType())
1252  + pDigi->GetRpc()][pDigi->GetChannel()]
1253  .push_back(iDigInd);
1254 
1255  // apply calibration vectors
1256  pDigi->SetTime(
1257  pDigi->GetTime() - // calibrate Digi Time
1258  fvCPTOff[pDigi->GetType()]
1259  [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType())
1260  + pDigi->GetRpc()][pDigi->GetChannel()][pDigi->GetSide()]);
1261 
1262  pDigi->SetTot(
1263  pDigi->GetTot() * // calibrate Digi ToT
1264  fvCPTotGain[pDigi->GetType()]
1265  [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType())
1266  + pDigi->GetRpc()][pDigi->GetChannel()]
1267  [pDigi->GetSide()]);
1268 
1269  // walk correction
1270  Double_t dTotBinSize = (TOTMax - TOTMin) / 2. / nbClWalkBinX;
1271  Int_t iWx = (Int_t)((pDigi->GetTot() - TOTMin / 2.) / dTotBinSize);
1272  if (0 > iWx) iWx = 0;
1273  if (iWx > (nbClWalkBinX - 1)) iWx = nbClWalkBinX - 1;
1274  Double_t dDTot =
1275  (pDigi->GetTot() - TOTMin / 2.) / dTotBinSize - (Double_t) iWx - 0.5;
1276  Double_t dWT =
1277  fvCPWalk[pDigi->GetType()]
1278  [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType())
1279  + pDigi->GetRpc()][pDigi->GetChannel()][pDigi->GetSide()]
1280  [iWx];
1281  if (dDTot > 0) {
1282  if (iWx < nbClWalkBinX - 1) { // linear interpolation to next bin
1283  dWT += dDTot
1284  * (fvCPWalk[pDigi->GetType()]
1285  [pDigi->GetSm()
1286  * fDigiBdfPar->GetNbRpc(pDigi->GetType())
1287  + pDigi->GetRpc()][pDigi->GetChannel()]
1288  [pDigi->GetSide()][iWx + 1]
1289  - fvCPWalk[pDigi->GetType()]
1290  [pDigi->GetSm()
1291  * fDigiBdfPar->GetNbRpc(pDigi->GetType())
1292  + pDigi->GetRpc()][pDigi->GetChannel()]
1293  [pDigi->GetSide()][iWx]);
1294  } // if(iWx < nbClWalkBinX -1)
1295  } else // dDTot < 0,
1296  {
1297  if (0 < iWx) { // linear interpolation to next bin
1298  dWT -= dDTot
1299  * (fvCPWalk[pDigi->GetType()]
1300  [pDigi->GetSm()
1301  * fDigiBdfPar->GetNbRpc(pDigi->GetType())
1302  + pDigi->GetRpc()][pDigi->GetChannel()]
1303  [pDigi->GetSide()][iWx - 1]
1304  - fvCPWalk[pDigi->GetType()]
1305  [pDigi->GetSm()
1306  * fDigiBdfPar->GetNbRpc(pDigi->GetType())
1307  + pDigi->GetRpc()][pDigi->GetChannel()]
1308  [pDigi->GetSide()][iWx]);
1309  } // if(0 < iWx)
1310  }
1311 
1312  pDigi->SetTime(pDigi->GetTime() - dWT); // calibrate Digi Time
1313 
1314  if (0) { //pDigi->GetType()==2 && pDigi->GetSm()==0){
1315  LOG(info)
1316  << "CbmTofSimpClusterizer::BuildClusters: CalDigi " << iDigInd
1317  << ", T " << pDigi->GetType() << ", Sm " << pDigi->GetSm()
1318  << ", R " << pDigi->GetRpc() << ", Ch " << pDigi->GetChannel()
1319  << ", S " << pDigi->GetSide() << ", T " << pDigi->GetTime()
1320  << ", Tot " << pDigi->GetTot() << ", TotGain "
1321  << fvCPTotGain[pDigi->GetType()]
1322  [pDigi->GetSm()
1323  * fDigiBdfPar->GetNbRpc(pDigi->GetType())
1324  + pDigi->GetRpc()][pDigi->GetChannel()]
1325  [pDigi->GetSide()]
1326  << ", Walk " << iWx << ": "
1327  << fvCPWalk[pDigi->GetType()]
1328  [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType())
1329  + pDigi->GetRpc()][pDigi->GetChannel()]
1330  [pDigi->GetSide()][iWx];
1331 
1332  LOG(info)
1333  << " dDTot " << dDTot << " BinSize: " << dTotBinSize << ", CPWalk "
1334  << fvCPWalk[pDigi->GetType()]
1335  [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType())
1336  + pDigi->GetRpc()][pDigi->GetChannel()]
1337  [pDigi->GetSide()][iWx - 1]
1338  << ", "
1339  << fvCPWalk[pDigi->GetType()]
1340  [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType())
1341  + pDigi->GetRpc()][pDigi->GetChannel()]
1342  [pDigi->GetSide()][iWx]
1343  << ", "
1344  << fvCPWalk[pDigi->GetType()]
1345  [pDigi->GetSm() * fDigiBdfPar->GetNbRpc(pDigi->GetType())
1346  + pDigi->GetRpc()][pDigi->GetChannel()]
1347  [pDigi->GetSide()][iWx + 1]
1348  << " -> dWT = " << dWT;
1349  }
1350  } else {
1351  LOG(debug) << "CbmTofSimpBeamClusterizer::BuildClusters: Skip Digi "
1352  << " Type " << pDigi->GetType() << " "
1353  << fDigiBdfPar->GetNbSmTypes() << " Sm " << pDigi->GetSm()
1354  << " " << fDigiBdfPar->GetNbSm(pDigi->GetType()) << " Rpc "
1355  << pDigi->GetRpc() << " "
1356  << fDigiBdfPar->GetNbRpc(pDigi->GetType()) << " Ch "
1357  << pDigi->GetChannel() << " "
1358  << fDigiBdfPar->GetNbChan(pDigi->GetType(), 0);
1359  }
1360  } // for( Int_t iDigInd = 0; iDigInd < nTofDigi; iDigInd++ )
1361  } // if( kTRUE == fDigiBdfPar->UseExpandedDigi() )
1362 
1363  // Then build clusters inside each RPC module
1364  // Assume only 0 or 1 Digi per channel/side in each event
1365  // Use simplest method possible, scan direction independent:
1366  // a) Loop over channels in the RPC starting from 0
1367  // * If strips
1368  // i) Loop over Digis to check if both ends of the channel have a Digi
1369  // ii) Reconstruct a mean channel time and a mean position
1370  // + If a Hit is currently filled & the mean position (space, time) is less than XXX from last channel position
1371  // iii) Add the mean channel time and the mean position to the ones of the hit
1372  // + else
1373  // iii) Use nb of strips in cluster to cal. the hit mean time and pos (charge/tot weighting)
1374  // iv) Save the hit
1375  // v) Start a new hit with current channel
1376  // * else (pads)
1377  // i) Loop over Digis to find if this channel fired
1378  // ii) FIXME: either scan all other channels to check for matching Digis or have more than 1 hit open
1379  Int_t iNbSmTypes = fDigiBdfPar->GetNbSmTypes();
1380  // Hit variables
1381  Double_t dWeightedTime = 0.0;
1382  Double_t dWeightedPosX = 0.0;
1383  Double_t dWeightedPosY = 0.0;
1384  Double_t dWeightedPosZ = 0.0;
1385  Double_t dWeightedTimeErr = 0.0;
1386  Double_t dWeightsSum = 0.0;
1387  std::vector<CbmTofPoint*> vPtsRef;
1388  std::vector<Int_t> vDigiIndRef;
1389  CbmTofCell* fTrafoCell = NULL;
1390  Int_t iTrafoCell = -1;
1391  Int_t iNbChanInHit = 0;
1392  // Last Channel Temp variables
1393  Int_t iLastChan = -1;
1394  // Double_t dLastPosX = 0.0; // -> Comment to remove warning because set but never used
1395  Double_t dLastPosY = 0.0;
1396  Double_t dLastTime = 0.0;
1397  // Channel Temp variables
1398  Double_t dPosX = 0.0;
1399  Double_t dPosY = 0.0;
1400  Double_t dPosZ = 0.0;
1401  Double_t dTime = 0.0;
1402  Double_t dTotS = 0.0;
1403  fiNbSameSide = 0;
1406  gGeoManager->CdTop();
1407  if (kTRUE == fDigiBdfPar->UseExpandedDigi()) {
1408  for (Int_t iSmType = 0; iSmType < iNbSmTypes; iSmType++) {
1409  Int_t iNbSm = fDigiBdfPar->GetNbSm(iSmType);
1410  Int_t iNbRpc = fDigiBdfPar->GetNbRpc(iSmType);
1411  for (Int_t iSm = 0; iSm < iNbSm; iSm++)
1412  for (Int_t iRpc = 0; iRpc < iNbRpc; iRpc++) {
1413  Int_t iNbCh = fDigiBdfPar->GetNbChan(iSmType, iRpc);
1414  Int_t iChType = fDigiBdfPar->GetChanType(iSmType, iRpc);
1415  LOG(debug2) << "CbmTofSimpClusterizer::BuildClusters: RPC - Loop "
1416  << Form(" %3d %3d %3d %3d ", iSmType, iSm, iRpc, iChType);
1417  fviClusterMul[iSmType][iSm][iRpc] = 0;
1418  Int_t iChId = 0;
1419  if (0 == iChType) {
1420  // Don't spread clusters over RPCs!!!
1421  dWeightedTime = 0.0;
1422  dWeightedPosX = 0.0;
1423  dWeightedPosY = 0.0;
1424  dWeightedPosZ = 0.0;
1425  dWeightedTimeErr = 0.0;
1426  dWeightsSum = 0.0;
1427  iNbChanInHit = 0;
1428  vPtsRef.clear();
1429  // For safety reinitialize everything
1430  iLastChan = -1;
1431  // dLastPosX = 0.0; // -> Comment to remove warning because set but never used
1432  dLastPosY = 0.0;
1433  dLastTime = 0.0;
1434  fTrafoCell = NULL;
1435  iTrafoCell = -1;
1436  LOG(debug2) << "CbmTofSimpClusterizer::BuildClusters: ChanOrient "
1437  << Form(" %3d %3d %3d %3d %3d ",
1438  iSmType,
1439  iSm,
1440  iRpc,
1441  fDigiBdfPar->GetChanOrient(iSmType, iRpc),
1442  iNbCh);
1443 
1444  if (1 == fDigiBdfPar->GetChanOrient(iSmType, iRpc)) {
1445  // Horizontal strips => X comes from left right time difference
1446  } // if( 1 == fDigiBdfPar->GetChanOrient( iSmType, iRpc ) )
1447  else {
1448  // Vertical strips => Y comes from bottom top time difference
1449  for (Int_t iCh = 0; iCh < iNbCh; iCh++) {
1450  LOG(debug3)
1451  << "CbmTofSimpClusterizer::BuildClusters: VDigisize"
1452  << Form(
1453  " T %3d Sm %3d R %3d Ch %3d Size %3zu ",
1454  iSmType,
1455  iSm,
1456  iRpc,
1457  iCh,
1458  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].size());
1459 
1460  if (0 < fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].size())
1461  fhNbDigiPerChan->Fill(
1462  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].size());
1463  while (
1464  1 < fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].size()) {
1465  LOG(debug2)
1466  << "CbmTofSimpClusterizer::BuildClusters: digis processing "
1467  "for "
1468  << Form(" SmT %3d Sm %3d Rpc %3d Ch %3d # %3zu ",
1469  iSmType,
1470  iSm,
1471  iRpc,
1472  iCh,
1473  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh]
1474  .size());
1475  /*
1476  if (3 < fStorDigiExp[iSmType][iSm*iNbRpc+iRpc][iCh].size()) // needs more work!
1477  LOG(debug) << "CbmTofSimpClusterizer::BuildClusters: digis ignored for "
1478  << Form(" SmT %3d Sm %3d Rpc %3d Ch %3d # %3d ",iSmType,iSm,iRpc,iCh,fStorDigiExp[iSmType][iSm*iNbRpc+iRpc][iCh].size())
1479  ;
1480  */
1481 
1482  while ((fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh][0])
1483  ->GetSide()
1484  == (fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh][1])
1485  ->GetSide()) {
1486  // Not one Digi of each end!
1487  fiNbSameSide++;
1488  LOG(debug)
1489  << "CbmTofSimpClusterizer::BuildClusters: SameSide Hits! "
1490  "Times: "
1491  << (fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh][0])
1492  ->GetTime()
1493  << ", "
1494  << (fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh][1])
1495  ->GetTime()
1496  << ", DeltaT "
1497  << (fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh][1])
1498  ->GetTime()
1499  - (fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh]
1500  [0])
1501  ->GetTime();
1502  LOG(debug2)
1503  << " SameSide Erase fStor entries(d) " << iSmType
1504  << ", SR " << iSm * iNbRpc + iRpc << ", Ch" << iCh;
1505  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
1506  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
1507  fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
1508  fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
1509  if (2 > fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh]
1510  .size())
1511  break;
1512  continue;
1513  }
1514 
1515  LOG(debug2)
1516  << "CbmTofSimpClusterizer::BuildClusters: digis processing "
1517  "for "
1518  << Form(" SmT %3d Sm %3d Rpc %3d Ch %3d # %3zu ",
1519  iSmType,
1520  iSm,
1521  iRpc,
1522  iCh,
1523  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh]
1524  .size());
1525  if (2
1526  > fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].size())
1527  break;
1528  /* Int_t iLastChId = iChId; // Save Last hit channel */
1529 
1530  // 2 Digis = both sides present
1531  Int_t iCh1 = iCh;
1532  if (fGeoHandler->GetGeoVersion() < k14a)
1533  iCh1 = iCh1 + 1; //FIXME
1534  CbmTofDetectorInfo xDetInfo(
1535  ECbmModuleId::kTof, iSmType, iSm, iRpc, 0, iCh1);
1536 
1537  iChId = fTofId->SetDetectorInfo(xDetInfo);
1538  Int_t iUCellId =
1539  CbmTofAddress::GetUniqueAddress(iSm, iRpc, iCh, 0, iSmType);
1540 
1541  fChannelInfo = fDigiPar->GetCell(iChId);
1542  if (NULL == fChannelInfo) {
1543  LOG(error) << "CbmTofSimpClusterizer::BuildClusters: no "
1544  "geometry info! "
1545  << Form(" %3d %3d %3d %3d 0x%08x 0x%08x ",
1546  iSmType,
1547  iSm,
1548  iRpc,
1549  iCh,
1550  iChId,
1551  iUCellId);
1552  break;
1553  }
1554  LOG(debug1)
1555  << "CbmTofSimpClusterizer::BuildClusters:"
1556  << Form(
1557  " T %3d Sm %3d R %3d Ch %3d size %3zu ",
1558  iSmType,
1559  iSm,
1560  iRpc,
1561  iCh,
1562  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].size())
1563  << Form(" ChId: 0x%08x 0x%08x %p",
1564  iChId,
1565  iUCellId,
1566  fChannelInfo);
1567 
1568  CbmTofDigi* xDigiA =
1569  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh][0];
1570  CbmTofDigi* xDigiB =
1571  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh][1];
1572 
1573 
1574  // The "Strip" time is the mean time between each end
1575  dTime = 0.5 * (xDigiA->GetTime() + xDigiB->GetTime());
1576 
1577  // Weight is the total charge => sum of both ends ToT
1578  dTotS = xDigiA->GetTot() + xDigiB->GetTot();
1579 
1580  // X position is just the center of the channel
1581  //dPosX = fChannelInfo->GetX();
1582 
1583  // Y position from strip ends time difference
1584  //dPosY = fChannelInfo->GetY();
1585 
1586  // For Z always just take the one of the channel itself( in fact its gap one)
1587  //dPosZ = fChannelInfo->GetZ();
1588 
1589  TGeoNode* fNode = // prepare local->global trafo
1590  gGeoManager->FindNode(fChannelInfo->GetX(),
1591  fChannelInfo->GetY(),
1592  fChannelInfo->GetZ());
1593  if (NULL == fTrafoCell) {
1594  fTrafoCell = fChannelInfo;
1595  iTrafoCell = iCh;
1596  }
1597 
1598  //fNode->Print();
1599  LOG(debug1)
1600  << Form(" Node at (%6.1f,%6.1f,%6.1f) : %p, info %p, %p",
1601  fChannelInfo->GetX(),
1602  fChannelInfo->GetY(),
1603  fChannelInfo->GetZ(),
1604  fNode,
1605  fChannelInfo,
1606  fTrafoCell);
1607  // fNode->Print();
1608 
1609 
1610  // switch to local coordinates, (0,0,0) is in the center of counter ?
1611  dPosX =
1612  ((Double_t)(-iTrafoCell + iCh)) * fChannelInfo->GetSizex();
1613  dPosY = 0.;
1614  dPosZ = 0.;
1615 
1616 
1617  if (1 == xDigiA->GetSide())
1618 
1619  // 0 is the top side, 1 is the bottom side
1620  dPosY += fvCPSigPropSpeed[iSmType][iRpc]
1621  * (xDigiA->GetTime() - xDigiB->GetTime()) / 2.0;
1622 
1623  else
1624 
1625  // 0 is the bottom side, 1 is the top side
1626  dPosY += fvCPSigPropSpeed[iSmType][iRpc]
1627  * (xDigiB->GetTime() - xDigiA->GetTime()) / 2.0;
1628 
1629  if (fChannelInfo->GetSizey() / 2.0 < dPosY
1630  || -1 * fChannelInfo->GetSizey() / 2.0 > dPosY) {
1631  // if outside of strip limits, the pair is bad => try to remove one end and check the next pair
1632  // (if another possibility exist)
1633  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
1634  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
1635  fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
1636  fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
1637  continue;
1638  } // Pair leads to hit oustide of strip limits
1639 
1640  LOG(debug1)
1641  << "CbmTofSimpClusterizer::BuildClusters: NbChanInHit"
1642  << Form(" %3d %3d %3d %p %2.0f Time %6.1f PosY %5.1f Svel "
1643  "%5.1f",
1644  iNbChanInHit,
1645  iCh,
1646  iLastChan,
1647  xDigiA,
1648  xDigiA->GetSide(),
1649  dTime,
1650  dPosY,
1651  fvCPSigPropSpeed[iSmType][iRpc])
1652  << Form(", Offs %5.1f, %5.1f",
1653  fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][0],
1654  fvCPTOff[iSmType][iSm * iNbRpc + iRpc][iCh][1]);
1655 
1656  // Now check if a hit/cluster is already started
1657  if (0 < iNbChanInHit) {
1658 
1659 
1660  if (iLastChan == iCh - 1) {
1661  fhDigTimeDifClust->Fill(dTime - dLastTime);
1662  fhDigSpacDifClust->Fill(dPosY - dLastPosY);
1663  fhDigDistClust->Fill(dPosY - dLastPosY,
1664  dTime - dLastTime);
1665  } // if( iLastChan == iCh - 1 )
1666  // a cluster is already started => check distance in space/time
1667  // For simplicity, just check along strip direction for now
1668  // and break cluster when a not fired strip is found
1669  if (TMath::Abs(dTime - dLastTime) < dMaxTimeDist
1670  && iLastChan == iCh - 1
1671  && TMath::Abs(dPosY - dLastPosY) < dMaxSpaceDist) {
1672  // Add to cluster/hit
1673  dWeightedTime += dTime * dTotS;
1674  dWeightedPosX += dPosX * dTotS;
1675  dWeightedPosY += dPosY * dTotS;
1676  dWeightedPosZ += dPosZ * dTotS;
1677  dWeightedTimeErr += dTotS * dTotS;
1678  dWeightsSum += dTotS;
1679  iNbChanInHit += 1;
1680  // if one of the side digi comes from a CbmTofPoint not already found
1681  // in this cluster, save its pointer
1682  // Bool_t bFoundA = kFALSE; // -> Comment to remove warning because set but never used
1683  // Bool_t bFoundB = kFALSE; // -> Comment to remove warning because set but never used
1684  if (NULL != fTofPointsColl) { // MC
1685 
1687  /*
1688  if( kTRUE == fDigiBdfPar->ClustUseTrackId() )
1689  for( UInt_t uPtRef = 0; uPtRef < vPtsRef.size(); uPtRef++)
1690  {
1691  //if( ((CbmTofPoint*)(vPtsRef[uPtRef]))->GetTrackID() == ((CbmTofPoint*)(xDigiA->GetLinks()))->GetTrackID() )
1692 // bFoundA = kTRUE; // -> Comment to remove warning because set but never used
1693  //if( ((CbmTofPoint*)(vPtsRef[uPtRef]))->GetTrackID() == ((CbmTofPoint*)(xDigiB->GetLinks()))->GetTrackID() )
1694 // bFoundB = kTRUE; // -> Comment to remove warning because set but never used
1695  } // for( Int
1696  else for( UInt_t uPtRef = 0; uPtRef < vPtsRef.size(); uPtRef++)
1697  {
1698  // if( vPtsRef[uPtRef] == (CbmTofPoint*)xDigiA->GetLinks() )
1699 // bFoundA = kTRUE; // -> Comment to remove warning because set but never used
1700  // if( vPtsRef[uPtRef] == (CbmTofPoint*)xDigiB->GetLinks() )
1701 // bFoundB = kTRUE; // -> Comment to remove warning because set but never used
1702  } // for( Int_t uPtRef = 0; uPtRef < vPtsRef.size(); uPtRef++)
1703 */
1704 
1705  // CbmTofPoint pointer for 1st digi not found => save it
1706  //if( kFALSE == bFoundA )
1707  // vPtsRef.push_back( (CbmTofPoint*)(xDigiA->GetLinks()) );
1708  // CbmTofPoint pointer for 2nd digi not found => save it
1709  // if( kFALSE == bFoundB )
1710  // vPtsRef.push_back( (CbmTofPoint*)(xDigiB->GetLinks()) );
1711  } // MC end
1712  vDigiIndRef.push_back((Int_t)(
1713  fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][0]));
1714  vDigiIndRef.push_back((Int_t)(
1715  fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][1]));
1716 
1717  LOG(debug1)
1718  << " Add Digi and erase fStor entries(a): NbChanInHit "
1719  << iNbChanInHit << ", " << iSmType << ", SR "
1720  << iSm * iNbRpc + iRpc << ", Ch" << iCh;
1721 
1722  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
1723  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh]
1724  .begin());
1725  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
1726  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh]
1727  .begin());
1728  fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
1729  fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh]
1730  .begin());
1731  fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
1732  fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh]
1733  .begin());
1734 
1735  } // if current Digis compatible with last fired chan
1736  else {
1737  // Save Hit
1738  dWeightedTime /= dWeightsSum;
1739  dWeightedPosX /= dWeightsSum;
1740  dWeightedPosY /= dWeightsSum;
1741  dWeightedPosZ /= dWeightsSum;
1742  // simple error scaling with TOT
1743  // dWeightedTimeErr = TMath::Sqrt( dWeightedTimeErr ) * fdParSystTimeRes / dWeightsSum;
1744  // OR harcoded value
1745  dWeightedTimeErr = fdParSystTimeRes;
1746 
1747  Double_t hitpos_local[3];
1748  Double_t hitpos[3];
1749 
1750  TGeoNode* tNode = // prepare local->global trafo
1751  gGeoManager->FindNode(fTrafoCell->GetX(),
1752  fTrafoCell->GetY(),
1753  fTrafoCell->GetZ());
1754  TGeoNode* cNode = gGeoManager->GetCurrentNode();
1755 
1756  TGeoRotation rotMatrix(*gGeoManager->GetCurrentMatrix());
1757 
1758  hitpos[0] = fTrafoCell->GetX();
1759  hitpos[1] = fTrafoCell->GetY();
1760  hitpos[2] = fTrafoCell->GetZ();
1761  gGeoManager->MasterToLocal(hitpos, hitpos_local);
1762  LOG(debug1) << Form(" Node0 at (%6.1f,%6.1f,%6.1f) : "
1763  "(%6.1f,%6.1f,%6.1f) pointer %p",
1764  fChannelInfo->GetX(),
1765  fChannelInfo->GetY(),
1766  fChannelInfo->GetZ(),
1767  hitpos_local[0],
1768  hitpos_local[1],
1769  hitpos_local[2],
1770  tNode);
1771 
1772  hitpos_local[0] += dWeightedPosX;
1773  hitpos_local[1] += dWeightedPosY;
1774  hitpos_local[2] += dWeightedPosZ;
1775 
1776  gGeoManager->LocalToMaster(hitpos_local, hitpos);
1777  LOG(debug1)
1778  << Form(" LTM for node %p, info %p: "
1779  "(%6.1f,%6.1f,%6.1f) ->(%6.1f,%6.1f,%6.1f)",
1780  cNode,
1781  fChannelInfo,
1782  hitpos_local[0],
1783  hitpos_local[1],
1784  hitpos_local[2],
1785  hitpos[0],
1786  hitpos[1],
1787  hitpos[2]);
1788 
1789  TVector3 hitPos(hitpos[0], hitpos[1], hitpos[2]);
1790 
1791  // Simple errors, not properly done at all for now
1792  // Right way of doing it should take into account the weight distribution
1793  // and real system time resolution
1794  Double_t hiterr_local[3];
1795  Double_t hiterr[3];
1796 
1797  hiterr_local[0] =
1799  / TMath::Sqrt(12.0); // Single strips approximation
1800  hiterr_local[1] =
1803  [iSmType][iRpc]; // Use the electronics resolution
1804  hiterr_local[2] =
1805  fDigiBdfPar->GetNbGaps(iSmType, iRpc)
1806  * fDigiBdfPar->GetGapSize(iSmType, iRpc)
1807  / 10.0 // Change gap size in cm
1808  / TMath::Sqrt(
1809  12.0); // Use full RPC thickness as "Channel" Z size
1810 
1811  rotMatrix.LocalToMaster(hiterr_local, hiterr);
1812  // TVector3 hitPosErr( hiterr_local[0], hiterr_local[1], hiterr_local[2] );
1813  TVector3 hitPosErr(hiterr[0], hiterr[1], hiterr[2]);
1814 
1815  // Int_t iDetId = vPtsRef[0]->GetDetectorID();// detID = pt->GetDetectorID() <= from TofPoint
1816  // calc mean ch from dPosX=((Double_t)(-iNbCh/2 + iCh)+0.5)*fChannelInfo->GetSizex();
1817 
1818  Int_t iChm =
1819  iTrafoCell
1820  + floor(dWeightedPosX / fChannelInfo->GetSizex());
1821  if (iChm < 0 || iChm > iNbCh) {
1822  LOG(debug) << "CbmTofSimpClusterizer::BuildClusters: "
1823  "Invalid mean channel";
1824  }
1825  Int_t iDetId = CbmTofAddress::GetUniqueAddress(
1826  iSm, iRpc, iChm, 0, iSmType);
1827  Int_t iRefId = 0; // Index of the correspondng TofPoint
1828  // if(NULL != fTofPointsColl) { iRefId = fTofPointsColl->IndexOf( vPtsRef[0] ); }
1829  LOG(debug)
1830  << "CbmTofSimpClusterizer::BuildClusters: Save Hit "
1831  << Form(" %3d %3d 0x%08x %3d %3d %3d %f %f",
1832  fiNbHits,
1833  iNbChanInHit,
1834  iDetId,
1835  iCh,
1836  iLastChan,
1837  iRefId,
1838  dWeightedTime,
1839  dWeightedPosY)
1840  << ", DigiSize: " << vDigiIndRef.size()
1841  << ", DigiInds: ";
1842  fviClusterMul[iSmType][iSm][iRpc]++;
1843  for (UInt_t i = 0; i < vDigiIndRef.size(); i++) {
1844  LOG(debug) << " " << vDigiIndRef.at(i);
1845  }
1846  LOG(debug);
1847 
1848  new ((*fTofHitsColl)[fiNbHits]) CbmTofHit(
1849  iDetId,
1850  hitPos,
1851  hitPosErr, //local detector coordinates
1852  fiNbHits,
1853  dWeightedTime * fOutTimeFactor,
1854  dWeightedTimeErr,
1855  vPtsRef
1856  .size(), // flag = number of TofPoints generating the cluster
1857  0); //channel
1858  // vDigiIndRef);
1859 
1860  CbmMatch* digiMatch = new CbmMatch();
1861  for (UInt_t i = 0; i < vDigiIndRef.size(); i++) {
1862  digiMatch->AddLink(
1863  CbmLink(0., vDigiIndRef.at(i), iEventNr, iInputNr));
1864  }
1865  new ((*fTofDigiMatchColl)[fiNbHits]) CbmMatch(*digiMatch);
1866  delete digiMatch;
1867 
1868  // Using the SetLinks/GetLinks of the TofHit class seems to conflict
1869  // with something in littrack QA
1870  // ((CbmTofHit*)fTofHitsColl->At(fiNbHits))->SetLinks(vPtsRef[0]);
1871  fiNbHits++;
1872  // For Histogramming
1873  fviClusterSize[iSmType][iRpc].push_back(iNbChanInHit);
1874  fviTrkMul[iSmType][iRpc].push_back(vPtsRef.size());
1875  fvdX[iSmType][iRpc].push_back(dWeightedPosX);
1876  fvdY[iSmType][iRpc].push_back(dWeightedPosY);
1877  /* no TofPoint available for data!
1878  fvdDifX[iSmType][iRpc].push_back( vPtsRef[0]->GetX() - dWeightedPosX);
1879  fvdDifY[iSmType][iRpc].push_back( vPtsRef[0]->GetY() - dWeightedPosY);
1880  fvdDifCh[iSmType][iRpc].push_back( fGeoHandler->GetCell( vPtsRef[0]->GetDetectorID() ) -1 -iLastChan );
1881  */
1882  vPtsRef.clear();
1883  vDigiIndRef.clear();
1884 
1885  // Start a new hit
1886  dWeightedTime = dTime * dTotS;
1887  dWeightedPosX = dPosX * dTotS;
1888  dWeightedPosY = dPosY * dTotS;
1889  dWeightedPosZ = dPosZ * dTotS;
1890  dWeightedTimeErr = dTotS * dTotS;
1891  dWeightsSum = dTotS;
1892  iNbChanInHit = 1;
1893  // Save pointer on CbmTofPoint
1894  // vPtsRef.push_back( (CbmTofPoint*)(xDigiA->GetLinks()) );
1895  // Save next digi address
1896  LOG(DEBUG4)
1897  << " Next fStor Digi " << iSmType << ", SR "
1898  << iSm * iNbRpc + iRpc << ", Ch" << iCh << ", Dig0 "
1899  << (fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][0])
1900  << ", Dig1 "
1901  << (fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][1]);
1902 
1903  vDigiIndRef.push_back((Int_t)(
1904  fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][0]));
1905  vDigiIndRef.push_back((Int_t)(
1906  fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][1]));
1907  LOG(debug3)
1908  << " Erase fStor entries(b) " << iSmType << ", SR "
1909  << iSm * iNbRpc + iRpc << ", Ch" << iCh;
1910  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
1911  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh]
1912  .begin());
1913  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
1914  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh]
1915  .begin());
1916  fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
1917  fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh]
1918  .begin());
1919  fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
1920  fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh]
1921  .begin());
1922 
1923  if (kTRUE == fDigiBdfPar->ClustUseTrackId()) {
1924  // if( ((CbmTofPoint*)(xDigiA->GetLinks()))->GetTrackID() !=
1925  // ((CbmTofPoint*)(xDigiB->GetLinks()))->GetTrackID() )
1926  // if other side come from a different Track,
1927  // also save the pointer on CbmTofPoint
1928  // vPtsRef.push_back( (CbmTofPoint*)(xDigiB->GetLinks()) );
1929  } // if( kTRUE == fDigiBdfPar->ClustUseTrackId() )
1930  //else if( xDigiA->GetLinks() != xDigiB->GetLinks() )
1931  // if other side come from a different TofPoint,
1932  // also save the pointer on CbmTofPoint
1933  // vPtsRef.push_back( (CbmTofPoint*)(xDigiB->GetLinks()) );
1934  } // else of if current Digis compatible with last fired chan
1935  } // if( 0 < iNbChanInHit)
1936  else {
1937  LOG(debug1)
1938  << "CbmTofSimpClusterizer::BuildClusters: 1.Hit on "
1939  "channel "
1940  << iCh << ", time: " << dTime << ", x: " << dPosX
1941  << ", y: " << dPosY << ", Tot: " << dTotS;
1942 
1943  // first fired strip in this RPC
1944  dWeightedTime = dTime * dTotS;
1945  dWeightedPosX = dPosX * dTotS;
1946  dWeightedPosY = dPosY * dTotS;
1947  dWeightedPosZ = dPosZ * dTotS;
1948  dWeightedTimeErr = dTotS * dTotS;
1949  dWeightsSum = dTotS;
1950  iNbChanInHit = 1;
1951  // Save pointer on CbmTofPoint
1952  //if(NULL != fTofPointsColl)
1953  // vPtsRef.push_back( (CbmTofPoint*)(xDigiA->GetLinks()) );
1954  vDigiIndRef.push_back((Int_t)(
1955  fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][0]));
1956  vDigiIndRef.push_back((Int_t)(
1957  fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh][1]));
1958 
1959  LOG(debug2)
1960  << " Erase fStor entries(c) " << iSmType << ", SR "
1961  << iSm * iNbRpc + iRpc << ", Ch" << iCh;
1962  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
1963  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
1964  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
1965  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
1966  fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
1967  fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
1968  fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].erase(
1969  fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].begin());
1970 
1971  if (kTRUE == fDigiBdfPar->ClustUseTrackId()) {
1972  // if( ((CbmTofPoint*)(xDigiA->GetLinks()))->GetTrackID() !=
1973  // ((CbmTofPoint*)(xDigiB->GetLinks()))->GetTrackID() )
1974  // if other side come from a different Track,
1975  // also save the pointer on CbmTofPoint
1976  // vPtsRef.push_back( (CbmTofPoint*)(xDigiB->GetLinks()) );
1977  } // if( kTRUE == fDigiBdfPar->ClustUseTrackId() )
1978  // else if( xDigiA->GetLinks() != xDigiB->GetLinks() )
1979  // if other side come from a different TofPoint,
1980  // also save the pointer on CbmTofPoint
1981  // vPtsRef.push_back( (CbmTofPoint*)(xDigiB->GetLinks()) );
1982  } // else of if( 0 < iNbChanInHit)
1983  iLastChan = iCh;
1984  // dLastPosX = dPosX; // -> Comment to remove warning because set but never used
1985  dLastPosY = dPosY;
1986  dLastTime = dTime;
1987  } // if( 2 == fStorDigiExp[iSmType][iSm*iNbRpc+iRpc][iCh].size() )
1988  fStorDigiExp[iSmType][iSm * iNbRpc + iRpc][iCh].clear();
1989  fStorDigiInd[iSmType][iSm * iNbRpc + iRpc][iCh].clear();
1990  } // for( Int_t iCh = 0; iCh < iNbCh; iCh++ )
1991  LOG(debug2)
1992  << "CbmTofSimpClusterizer::BuildClusters: finished V-RPC"
1993  << Form(" %3d %3d %3d %d",
1994  iSmType,
1995  iSm,
1996  iRpc,
1997  fTofHitsColl->GetEntries());
1998  } // else of if( 1 == fDigiBdfPar->GetChanOrient( iSmType, iRpc ) )
1999  } // if( 0 == iChType)
2000  else {
2001  LOG(error)
2002  << "CbmTofSimpClusterizer::BuildClusters => Cluster building "
2003  << "from digis to hits not implemented for pads, Sm type "
2004  << iSmType << " Rpc " << iRpc;
2005  return kFALSE;
2006  } // else of if( 0 == iChType)
2007 
2008  // Now check if another hit/cluster is started
2009  // and save it if it's the case
2010  if (0 < iNbChanInHit) {
2011  LOG(debug1)
2012  << "CbmTofSimpClusterizer::BuildClusters: Process cluster "
2013  << iNbChanInHit;
2014 
2015  // Check orientation to properly assign errors
2016  if (1 == fDigiBdfPar->GetChanOrient(iSmType, iRpc)) {
2017  LOG(debug1) << "CbmTofSimpClusterizer::BuildClusters: H-Hit ";
2018  } // if( 1 == fDigiBdfPar->GetChanOrient( iSmType, iRpc ) )
2019  else {
2020  LOG(debug2) << "CbmTofSimpClusterizer::BuildClusters: V-Hit ";
2021  // Save Hit
2022  dWeightedTime /= dWeightsSum;
2023  dWeightedPosX /= dWeightsSum;
2024  dWeightedPosY /= dWeightsSum;
2025  dWeightedPosZ /= dWeightsSum;
2026  // simple error scaling with TOT
2027  // dWeightedTimeErr = TMath::Sqrt( dWeightedTimeErr ) * fdParSystTimeRes / dWeightsSum;
2028  // OR harcoded value
2029  dWeightedTimeErr = fdParSystTimeRes;
2030 
2031  Double_t hitpos_local[3];
2032  Double_t hitpos[3];
2033 
2034  TGeoNode* tNode = // prepare local->global trafo
2035  gGeoManager->FindNode(
2036  fTrafoCell->GetX(), fTrafoCell->GetY(), fTrafoCell->GetZ());
2037  //TGeoNode *cNode =
2038  gGeoManager->GetCurrentNode();
2039 
2040  TGeoRotation rotMatrix(*gGeoManager->GetCurrentMatrix());
2041 
2042  hitpos[0] = fTrafoCell->GetX();
2043  hitpos[1] = fTrafoCell->GetY();
2044  hitpos[2] = fTrafoCell->GetZ();
2045  gGeoManager->MasterToLocal(hitpos, hitpos_local);
2046  LOG(debug1) << Form(
2047  " Node0 at (%6.1f,%6.1f,%6.1f) : (%6.1f,%6.1f,%6.1f)",
2048  fChannelInfo->GetX(),
2049  fChannelInfo->GetY(),
2050  fChannelInfo->GetZ(),
2051  hitpos_local[0],
2052  hitpos_local[1],
2053  hitpos_local[2]);
2054 
2055  hitpos_local[0] += dWeightedPosX;
2056  hitpos_local[1] += dWeightedPosY;
2057  hitpos_local[2] += dWeightedPosZ;
2058 
2059  gGeoManager->LocalToMaster(hitpos_local, hitpos);
2060  LOG(debug1) << Form(
2061  " LTM for V-node %p, info %p, tra %p: (%6.1f,%6.1f,%6.1f) "
2062  "->(%6.1f,%6.1f,%6.1f) [(%6.1f,%6.1f,%6.1f)]",
2063  tNode,
2064  fChannelInfo,
2065  fTrafoCell,
2066  hitpos_local[0],
2067  hitpos_local[1],
2068  hitpos_local[2],
2069  hitpos[0],
2070  hitpos[1],
2071  hitpos[2],
2072  fTrafoCell->GetX(),
2073  fTrafoCell->GetY(),
2074  fTrafoCell->GetZ());
2075 
2076  TVector3 hitPos(hitpos[0], hitpos[1], hitpos[2]);
2077  // TestBeam errors, not properly done at all for now
2078  // Right way of doing it should take into account the weight distribution
2079  // and real system time resolution
2080  Double_t hiterr_local[3];
2081  Double_t hiterr[3];
2082 
2083  hiterr_local[0] =
2084  fTrafoCell->GetSizex()
2085  / TMath::Sqrt(12.0); // Single strips approximation
2086  hiterr_local[1] =
2088  * fvCPSigPropSpeed[iSmType]
2089  [iRpc]; // Use the electronics resolution
2090  hiterr_local[2] =
2091  fDigiBdfPar->GetNbGaps(iSmType, iRpc)
2092  * fDigiBdfPar->GetGapSize(iSmType, iRpc)
2093  / 10.0 // Change gap size in cm
2094  / TMath::Sqrt(
2095  12.0); // Use full RPC thickness as "Channel" Z size
2096 
2097  rotMatrix.LocalToMaster(hiterr_local, hiterr);
2098  // TVector3 hitPosErr( hiterr_local[0], hiterr_local[1], hiterr_local[2] );
2099  TVector3 hitPosErr(hiterr[0], hiterr[1], hiterr[2]);
2100  /*
2101  LOG(info)<< " Size X " << fTrafoCell->GetSizex()
2102  ;
2103  LOG(info)<< " Nb gaps " << fDigiBdfPar->GetNbGaps( iSmType, iRpc)
2104  << " gap size " << fDigiBdfPar->GetGapSize( iSmType, iRpc)
2105  ;
2106  LOG(info)<<"CbmTofSimpClusterizer::BuildClusters: Errors in local "
2107  << hiterr_local[0] << " "<< hiterr_local[1] << " " << hiterr_local[2]
2108  ;
2109  LOG(info)<<"CbmTofSimpClusterizer::BuildClusters: Errors in master "
2110  << hiterr[0] << " "<< hiterr[1] << " " << hiterr[2]
2111  ;
2112 */
2113  // cout<<"a "<<vPtsRef.size()<<endl;
2114  // cout<<"b "<<vPtsRef[0]<<endl;
2115  // cout<<"c "<<vPtsRef[0]->GetDetectorID()<<endl;
2116  // Int_t iDetId = vPtsRef[0]->GetDetectorID();// detID = pt->GetDetectorID() <= from TofPoint
2117  // Int_t iDetId = iChId;
2118 
2119  Int_t iChm =
2120  iTrafoCell + floor(dWeightedPosX / fChannelInfo->GetSizex());
2121  if (iChm < 0 || iChm > iNbCh) {
2122  LOG(debug) << "CbmTofSimpClusterizer::BuildClusters: Invalid "
2123  "mean channel "
2124  << iChm << "(" << iNbCh << ")";
2125  }
2126  Int_t iDetId =
2127  CbmTofAddress::GetUniqueAddress(iSm, iRpc, iChm, 0, iSmType);
2128  Int_t iRefId = 0; // Index of the correspondng TofPoint
2129  // if(NULL != fTofPointsColl) iRefId = fTofPointsColl->IndexOf( vPtsRef[0] );
2130  LOG(debug)
2131  << "CbmTofSimpClusterizer::BuildClusters: Save V-Hit "
2132  // << Form(" %3d %3d 0x%08x %3d %3d %3d 0x%08x",
2133  << Form(" %3d %3d %3d %3d %3d ",
2134  fiNbHits,
2135  iNbChanInHit,
2136  iDetId,
2137  iLastChan,
2138  iRefId) //vPtsRef.size(),vPtsRef[0])
2139  // dWeightedTime,dWeightedPosY)
2140  << ", DigiSize: " << vDigiIndRef.size();
2141  LOG(debug) << ", DigiInds: ";
2142  for (UInt_t i = 0; i < vDigiIndRef.size(); i++) {
2143  LOG(debug) << " " << vDigiIndRef.at(i);
2144  }
2145  LOG(debug);
2146 
2147  fviClusterMul[iSmType][iSm][iRpc]++;
2148 
2149  new ((*fTofHitsColl)[fiNbHits])
2150  CbmTofHit(iDetId,
2151  hitPos,
2152  hitPosErr,
2153  fiNbHits, //iRefId
2154  dWeightedTime * fOutTimeFactor,
2155  dWeightedTimeErr,
2156  vPtsRef.size(),
2157  0);
2158  // vDigiIndRef);
2159  CbmMatch* digiMatch = new CbmMatch();
2160  for (UInt_t i = 0; i < vDigiIndRef.size(); i++) {
2161  digiMatch->AddLink(
2162  CbmLink(0., vDigiIndRef.at(i), iEventNr, iInputNr));
2163  }
2164  new ((*fTofDigiMatchColl)[fiNbHits]) CbmMatch(*digiMatch);
2165  delete digiMatch;
2166 
2167  // Using the SetLinks/GetLinks of the TofHit class seems to conflict
2168  // with something in littrack QA
2169  // ((CbmTofHit*)fTofHitsColl->At(fiNbHits))->SetLinks(vPtsRef[0]);
2170  fiNbHits++;
2171  // For Histogramming
2172  fviClusterSize[iSmType][iRpc].push_back(iNbChanInHit);
2173  fviTrkMul[iSmType][iRpc].push_back(vPtsRef.size());
2174  fvdX[iSmType][iRpc].push_back(dWeightedPosX);
2175  fvdY[iSmType][iRpc].push_back(dWeightedPosY);
2176  /*
2177  fvdDifX[iSmType][iRpc].push_back( vPtsRef[0]->GetX() - dWeightedPosX);
2178  fvdDifY[iSmType][iRpc].push_back( vPtsRef[0]->GetY() - dWeightedPosY);
2179  fvdDifCh[iSmType][iRpc].push_back( fGeoHandler->GetCell( vPtsRef[0]->GetDetectorID() ) -1 -iLastChan );
2180  */
2181  vPtsRef.clear();
2182  vDigiIndRef.clear();
2183  } // else of if( 1 == fDigiBdfPar->GetChanOrient( iSmType, iRpc ) )
2184  } // if( 0 < iNbChanInHit)
2185  LOG(DEBUG4) << " Fini-A "
2186  << Form(" %3d %3d %3d ", iSmType, iSm, iRpc);
2187  } // for each sm/rpc pair
2188  LOG(debug3) << " Fini-B " << Form(" %3d ", iSmType);
2189  } // for( Int_t iSmType = 0; iSmType < iNbSmTypes; iSmType++ )
2190  } // if( kTRUE == fDigiBdfPar->UseExpandedDigi() )
2191  else {
2192  LOG(error) << " Compressed Digis not implemented ... ";
2193  }
2194  return kTRUE;
2195 }
2196 
2198  Int_t& eventNr,
2199  Double_t& eventTime) {
2200 
2201  // --- In a FairRunAna, take the information from FairEventHeader
2202  if (FairRunAna::Instance()) {
2203  FairEventHeader* event = FairRunAna::Instance()->GetEventHeader();
2204  inputNr = event->GetInputFileId();
2205  eventNr = event->GetMCEntryNumber();
2206  eventTime = event->GetEventTime();
2207  }
2208 
2209  // --- In a FairRunSim, the input number and event time are always zero;
2210  // --- only the event number is retrieved.
2211  else {
2212  if (!FairRunSim::Instance())
2213  LOG(fatal) << GetName() << ": neither SIM nor ANA run.";
2214  FairMCEventHeader* event = FairRunSim::Instance()->GetMCEventHeader();
2215  inputNr = 0;
2216  eventNr = event->GetEventID();
2217  eventTime = 0.;
2218  }
2219 }
CbmTofDigiBdfPar.h
CbmTofCell::GetZ
Double_t GetZ() const
Definition: CbmTofCell.h:38
CbmTofSimpClusterizer::fhClusterSizeType
TH2 * fhClusterSizeType
Definition: CbmTofSimpClusterizer.h:213
CbmTofSimpClusterizer::fCalMode
Int_t fCalMode
Definition: CbmTofSimpClusterizer.h:282
CbmMCTrack::GetMotherId
Int_t GetMotherId() const
Definition: CbmMCTrack.h:71
CbmTofGeoHandler::GetGeoVersion
Int_t GetGeoVersion()
Definition: CbmTofGeoHandler.h:45
CbmTofSimpClusterizer::fGeoHandler
CbmTofGeoHandler * fGeoHandler
Definition: CbmTofSimpClusterizer.h:154
CbmTofSimpClusterizer::fvCPSigPropSpeed
std::vector< std::vector< Double_t > > fvCPSigPropSpeed
Definition: CbmTofSimpClusterizer.h:253
CbmMatch
Definition: CbmMatch.h:22
CbmTofSimpClusterizer::fCalParFile
TFile * fCalParFile
Definition: CbmTofSimpClusterizer.h:295
CbmTofCell::GetSizex
Double_t GetSizex() const
Definition: CbmTofCell.h:40
CbmTofSimpClusterizer::fvdY
std::vector< std::vector< std::vector< Double_t > > > fvdY
Definition: CbmTofSimpClusterizer.h:195
CbmTofSimpClusterizer::fdNofHitsTot
Double_t fdNofHitsTot
Total number of hits produced.
Definition: CbmTofSimpClusterizer.h:276
CbmTofSimpClusterizer::WriteHistos
Bool_t WriteHistos()
Definition: CbmTofSimpClusterizer.cxx:1115
CbmTofGeoHandler::GetCounter
Int_t GetCounter(Int_t uniqueId)
Definition: CbmTofGeoHandler.cxx:469
CbmTofSimpClusterizer::fviTrkMul
std::vector< std::vector< std::vector< Int_t > > > fviTrkMul
Definition: CbmTofSimpClusterizer.h:191
CbmTofDigi::SetTime
void SetTime(Double_t time)
Definition: CbmTofDigi.h:153
CbmTofSimpClusterizer::fiNofEvents
Int_t fiNofEvents
Total number of events processed.
Definition: CbmTofSimpClusterizer.h:274
CbmTofSimpClusterizer::fhClusterSize
TH1 * fhClusterSize
Definition: CbmTofSimpClusterizer.h:212
vPtsRef
std::vector< CbmTofPoint * > vPtsRef
Definition: CbmTofTestBeamClusterizer.cxx:63
CbmTofSimpClusterizer::fvCPTotGain
std::vector< std::vector< std::vector< std::vector< Double_t > > > > fvCPTotGain
Definition: CbmTofSimpClusterizer.h:259
CbmTofDigiBdfPar::GetNbChan
Int_t GetNbChan(Int_t iSmType, Int_t iRpc) const
Definition: CbmTofDigiBdfPar.cxx:570
CbmTofSimpClusterizer::Finish
virtual void Finish()
Inherited from FairTask.
Definition: CbmTofSimpClusterizer.cxx:345
CbmTofDigiPar::GetNrOfModules
Int_t GetNrOfModules()
Definition: CbmTofDigiPar.h:44
CbmDigiManager::Init
InitStatus Init()
Initialisation.
Definition: CbmDigiManager.cxx:71
nbClWalkBinX
const Int_t nbClWalkBinX
Definition: CbmTofSimpClusterizer.cxx:52
CbmTofSimpClusterizer::fdParFeeTimeRes
Double_t fdParFeeTimeRes
Definition: CbmTofSimpClusterizer.h:159
rootMgr
static FairRootManager * rootMgr
Definition: CbmDeviceHitBuilderTof.cxx:72
CbmTofSimpClusterizer::fdTimeTot
Double_t fdTimeTot
Total execution time.
Definition: CbmTofSimpClusterizer.h:277
nbClDelTofBinX
const Int_t nbClDelTofBinX
Definition: CbmTofSimpClusterizer.cxx:59
CbmTofSimpClusterizer::fviClusterSize
std::vector< std::vector< std::vector< Int_t > > > fviClusterSize
Definition: CbmTofSimpClusterizer.h:189
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmTofDigiBdfPar::GetNbRpc
Int_t GetNbRpc(Int_t iSmType) const
Definition: CbmTofDigiBdfPar.cxx:519
CbmTofSimpClusterizer::fChannelInfo
CbmTofCell * fChannelInfo
Definition: CbmTofSimpClusterizer.h:157
CbmTofSimpClusterizer::CbmTofSimpClusterizer
CbmTofSimpClusterizer()
Constructor.
Definition: CbmTofSimpClusterizer.cxx:73
CbmTofSimpClusterizer::fhHiTrkMulPos
TH2 * fhHiTrkMulPos
Definition: CbmTofSimpClusterizer.h:217
CbmTofSimpClusterizer::SetHistoFileName
Bool_t SetHistoFileName(TString sFilenameIn="./tofSimpClust.hst.root")
Definition: CbmTofSimpClusterizer.cxx:1166
CbmTofSimpClusterizer::fdNofDigisTot
Double_t fdNofDigisTot
Total number of Tof Digis processed.
Definition: CbmTofSimpClusterizer.h:275
CbmTofDigi::SetTot
void SetTot(Double_t tot)
Definition: CbmTofDigi.h:154
CbmTofSimpClusterizer::fvdX
std::vector< std::vector< std::vector< Double_t > > > fvdX
Definition: CbmTofSimpClusterizer.h:193
CbmTofSimpClusterizer::DeleteGeometry
Bool_t DeleteGeometry()
Delete the geometry related arrays: for now just clearing the Digis temporary vectors.
Definition: CbmTofSimpClusterizer.cxx:765
CbmTofDetectorId_v12b
Definition: CbmTofDetectorId_v12b.h:33
CbmTofSimpClusterizer::fDigiMan
CbmDigiManager * fDigiMan
Definition: CbmTofSimpClusterizer.h:165
CbmTofDigiBdfPar::GetChanOrient
Int_t GetChanOrient(Int_t iSmType, Int_t iRpc) const
Definition: CbmTofDigiBdfPar.cxx:590
CbmTofSimpClusterizer::LoadGeometry
Bool_t LoadGeometry()
Load the geometry: for now just resizing the Digis temporary vectors.
Definition: CbmTofSimpClusterizer.cxx:689
CbmTofSimpClusterizer::fhClustBuildTime
TH1 * fhClustBuildTime
Definition: CbmTofSimpClusterizer.h:206
CbmTofSimpClusterizer::fhClusterSizeMulti
TH2 * fhClusterSizeMulti
Definition: CbmTofSimpClusterizer.h:215
CbmDigiManager::GetNofDigis
static Int_t GetNofDigis(ECbmModuleId systemId)
Definition: CbmDigiManager.cxx:62
CbmTofSimpClusterizer::fhTrackMul
TH1 * fhTrackMul
Definition: CbmTofSimpClusterizer.h:214
CbmTofSimpClusterizer::fhClustSizeDifY
TH2 * fhClustSizeDifY
Definition: CbmTofSimpClusterizer.h:224
CbmTofDigiBdfPar::GetSigVel
Double_t GetSigVel(Int_t iSmType, Int_t iSm, Int_t iRpc) const
Definition: CbmTofDigiBdfPar.cxx:546
CbmTofDigiBdfPar::GetNbSmTypes
Int_t GetNbSmTypes() const
Definition: CbmTofDigiBdfPar.h:56
CbmTofSimpClusterizer::~CbmTofSimpClusterizer
virtual ~CbmTofSimpClusterizer()
Destructor.
Definition: CbmTofSimpClusterizer.cxx:275
CbmTofSimpClusterizer::CreateHistos
Bool_t CreateHistos()
Definition: CbmTofSimpClusterizer.cxx:787
CbmTofSimpClusterizer::fvdDifY
std::vector< std::vector< std::vector< Double_t > > > fvdDifY
Definition: CbmTofSimpClusterizer.h:199
CbmTofDigi.h
ECbmModuleId::kTof
@ kTof
Time-of-flight Detector.
CbmTofDigiPar.h
CbmMatch.h
CbmTofDigi::GetSm
Double_t GetSm() const
Sm.
Definition: CbmTofDigi.h:124
CbmTofGeoHandler::CheckGeometryVersion
Int_t CheckGeometryVersion()
Definition: CbmTofGeoHandler.cxx:61
CbmTofSimpClusterizer::fDigiBdfPar
CbmTofDigiBdfPar * fDigiBdfPar
Definition: CbmTofSimpClusterizer.h:158
CbmTofDigiPar::GetCell
CbmTofCell * GetCell(Int_t i)
Definition: CbmTofDigiPar.h:48
CbmDigiManager::IsPresent
static Bool_t IsPresent(ECbmModuleId systemId)
Presence of a digi branch.
Definition: CbmDigiManager.cxx:112
CbmTofSimpClusterizer::fhDigSpacDifClust
TH1 * fhDigSpacDifClust
Definition: CbmTofSimpClusterizer.h:220
CbmTofSimpClusterizer::fdParSystTimeRes
Double_t fdParSystTimeRes
Definition: CbmTofSimpClusterizer.h:160
CbmTofGeoHandler::GetSModule
Int_t GetSModule(Int_t uniqueId)
Definition: CbmTofGeoHandler.cxx:464
CbmTofSimpClusterizer::fhClustSizeDifX
TH2 * fhClustSizeDifX
Definition: CbmTofSimpClusterizer.h:223
CbmTofSimpClusterizer::fDigiPar
CbmTofDigiPar * fDigiPar
Definition: CbmTofSimpClusterizer.h:156
CbmTofSimpClusterizer::Exec
virtual void Exec(Option_t *option)
Inherited from FairTask.
Definition: CbmTofSimpClusterizer.cxx:316
CbmTofSimpClusterizer::fhChDifDifY
TH2 * fhChDifDifY
Definition: CbmTofSimpClusterizer.h:226
CbmDigiManager::Instance
static CbmDigiManager * Instance()
Static instance.
Definition: CbmDigiManager.h:93
CbmTofGeoHandler.h
CbmTofSimpClusterizer::fvCPDelTof
std::vector< std::vector< std::vector< std::vector< Double_t > > > > fvCPDelTof
Definition: CbmTofSimpClusterizer.h:255
CbmTofDetectorId_v14a.h
CbmTofSimpClusterizer::DeleteHistos
Bool_t DeleteHistos()
Definition: CbmTofSimpClusterizer.cxx:1170
CbmTofDigi::GetSide
Double_t GetSide() const
Channel Side.
Definition: CbmTofDigi.h:142
CbmTofSimpClusterizer::fhDigDistClust
TH2 * fhDigDistClust
Definition: CbmTofSimpClusterizer.h:222
CbmTofSimpClusterizer::fbMcTrkMonitor
Bool_t fbMcTrkMonitor
Definition: CbmTofSimpClusterizer.h:297
CbmTofDigi::GetType
Double_t GetType() const
Sm Type .
Definition: CbmTofDigi.h:128
CbmTofSimpClusterizer::fvCPWalk
std::vector< std::vector< std::vector< std::vector< std::vector< Double_t > > > > > fvCPWalk
Definition: CbmTofSimpClusterizer.h:261
CbmTofSimpClusterizer::fMcTracksColl
TClonesArray * fMcTracksColl
Definition: CbmTofSimpClusterizer.h:164
CbmTofSimpClusterizer::fStop
TTimeStamp fStop
Definition: CbmTofSimpClusterizer.h:270
CbmTofSimpClusterizer::SetParContainers
virtual void SetParContainers()
Inherited from FairTask.
Definition: CbmTofSimpClusterizer.cxx:301
CbmMCTrack::GetNPoints
Int_t GetNPoints(ECbmModuleId detId) const
Definition: CbmMCTrack.cxx:186
CbmTofSimpClusterizer.h
CbmTofSimpClusterizer::Init
virtual InitStatus Init()
Inherited from FairTask.
Definition: CbmTofSimpClusterizer.cxx:282
CbmTofSimpClusterizer::fsHistoOutFilename
TString fsHistoOutFilename
Definition: CbmTofSimpClusterizer.h:204
CbmTofGeoHandler
Definition: CbmTofGeoHandler.h:30
k12b
@ k12b
Definition: CbmTofGeoHandler.h:17
CbmDigiManager::Get
const Digi * Get(Int_t index) const
Get a digi object.
Definition: CbmDigiManager.h:52
CbmTofSimpClusterizer::fhPtsPerHit
TH1 * fhPtsPerHit
Definition: CbmTofSimpClusterizer.h:208
CbmTofCell::GetX
Double_t GetX() const
Definition: CbmTofCell.h:36
CbmTofDetectorId_v12b.h
CbmTofDigi::GetChannel
Double_t GetChannel() const
Channel .
Definition: CbmTofDigi.h:136
CbmTofCell
Definition: CbmTofCell.h:8
CbmTofSimpClusterizer::InitParameters
Bool_t InitParameters()
Initialize other parameters not included in parameter classes.
Definition: CbmTofSimpClusterizer.cxx:413
TOTMin
Double_t TOTMin
Definition: CbmTofSimpClusterizer.cxx:56
k14a
@ k14a
Definition: CbmTofGeoHandler.h:17
vDigiIndRef
std::vector< Int_t > vDigiIndRef
Definition: CbmTofTestBeamClusterizer.cxx:64
CbmMatch::AddLink
void AddLink(const CbmLink &newLink)
Definition: CbmMatch.cxx:42
CbmTofSimpClusterizer::fStorDigiInd
std::vector< std::vector< std::vector< std::vector< Int_t > > > > fStorDigiInd
Definition: CbmTofSimpClusterizer.h:179
CbmTofSimpClusterizer::fCalParFileName
TString fCalParFileName
Definition: CbmTofSimpClusterizer.h:294
CbmTofDigi::GetTime
Double_t GetTime() const
Inherited from CbmDigi.
Definition: CbmTofDigi.h:111
CbmTofAddress.h
CbmTofDetectorId_v14a
Definition: CbmTofDetectorId_v14a.h:36
CbmTofGeoHandler::Init
Int_t Init(Bool_t isSimulation=kFALSE)
Definition: CbmTofGeoHandler.cxx:39
TTotMean
const Double_t TTotMean
Definition: CbmTofSimpClusterizer.cxx:57
CbmTofDigiBdfPar::GetChanType
Int_t GetChanType(Int_t iSmType, Int_t iRpc) const
Definition: CbmTofDigiBdfPar.cxx:580
CbmTofSimpClusterizer::RegisterInputs
Bool_t RegisterInputs()
Recover pointer on input TClonesArray: TofPoints, TofDigis...
Definition: CbmTofSimpClusterizer.cxx:366
CbmTofDigiBdfPar
Parameters class for the CBM ToF digitizer using beam data distributions.
Definition: CbmTofDigiBdfPar.h:30
CbmTofSimpClusterizer::RegisterOutputs
Bool_t RegisterOutputs()
Create and register output TClonesArray of Tof Hits.
Definition: CbmTofSimpClusterizer.cxx:396
CbmTofDigiBdfPar::GetFeeTimeRes
Double_t GetFeeTimeRes() const
Definition: CbmTofDigiBdfPar.h:49
CbmTofSimpClusterizer::fhAllTrkMulPos
TH2 * fhAllTrkMulPos
Definition: CbmTofSimpClusterizer.h:218
CbmTofDetectorId::SetDetectorInfo
virtual Int_t SetDetectorInfo(const CbmTofDetectorInfo detectorInfo)=0
CbmTofCell.h
CbmTofSimpClusterizer::fiNbHits
Int_t fiNbHits
Definition: CbmTofSimpClusterizer.h:170
CbmTofSimpClusterizer::fiNbSameSide
Int_t fiNbSameSide
Definition: CbmTofSimpClusterizer.h:264
CbmTofSimpClusterizer::fvdDifX
std::vector< std::vector< std::vector< Double_t > > > fvdDifX
Definition: CbmTofSimpClusterizer.h:197
CbmTofDetectorInfo
Definition: CbmTofDetectorId.h:20
CbmTofSimpClusterizer::fTofPointsColl
TClonesArray * fTofPointsColl
Definition: CbmTofSimpClusterizer.h:163
CbmTofSimpClusterizer::fOutTimeFactor
Double_t fOutTimeFactor
Definition: CbmTofSimpClusterizer.h:292
fDigiMan
CbmDigiManager * fDigiMan
Definition: CbmTofAnaTestbeam.cxx:88
CbmTofHit::GetFlag
Int_t GetFlag() const
Definition: core/data/tof/CbmTofHit.h:91
fTofHitsColl
TClonesArray * fTofHitsColl
Definition: CbmHadronAnalysis.cxx:52
TOTMax
Double_t TOTMax
Definition: CbmTofSimpClusterizer.cxx:55
CbmTofDigi
Data class for expanded digital TOF information.
Definition: CbmTofDigi.h:38
CbmTofCell::GetSizey
Double_t GetSizey() const
Definition: CbmTofCell.h:41
CbmTofSimpClusterizer::fviClusterMul
std::vector< std::vector< std::vector< Int_t > > > fviClusterMul
Definition: CbmTofSimpClusterizer.h:187
CbmTofDigiBdfPar::GetGapSize
Double_t GetGapSize(Int_t iSmType, Int_t iRpc) const
Definition: CbmTofDigiBdfPar.cxx:535
CbmTofSimpClusterizer::fhTimeResSingHits
TH1 * fhTimeResSingHits
Definition: CbmTofSimpClusterizer.h:209
CbmTofSimpClusterizer::fhNbSameSide
TH1 * fhNbSameSide
Definition: CbmTofSimpClusterizer.h:265
CbmTofGeoHandler::GetCell
Int_t GetCell(Int_t uniqueId)
Definition: CbmTofGeoHandler.cxx:479
CbmTofDigiBdfPar::UseExpandedDigi
Bool_t UseExpandedDigi() const
Definition: CbmTofDigiBdfPar.h:85
CbmTofSimpClusterizer::fhHitsPerTracks
TH1 * fhHitsPerTracks
Definition: CbmTofSimpClusterizer.h:207
CbmTofDigi::GetRpc
Double_t GetRpc() const
Detector aka Module aka RPC .
Definition: CbmTofDigi.h:132
CbmTofSimpClusterizer::fhNbDigiPerChan
TH1 * fhNbDigiPerChan
Definition: CbmTofSimpClusterizer.h:266
CbmTofSimpClusterizer::fhTrk1MulPos
TH2 * fhTrk1MulPos
Definition: CbmTofSimpClusterizer.h:216
CbmMCTrack.h
CbmTofSimpClusterizer::InitCalibParameter
Bool_t InitCalibParameter()
Initialize other parameters not included in parameter classes.
Definition: CbmTofSimpClusterizer.cxx:453
CbmDigiManager.h
CbmTofSimpClusterizer::fTimer
TStopwatch fTimer
ROOT timer.
Definition: CbmTofSimpClusterizer.h:273
CbmMCTrack
Definition: CbmMCTrack.h:34
CbmTofSimpClusterizer::BuildClusters
Bool_t BuildClusters()
Build clusters out of ToF Digis and store the resulting info in a TofHit.
Definition: CbmTofSimpClusterizer.cxx:1204
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmTofDigiPar
Definition: CbmTofDigiPar.h:18
CbmTofPoint.h
CbmTofGeoHandler::GetSMType
Int_t GetSMType(Int_t uniqueId)
Definition: CbmTofGeoHandler.cxx:459
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmTofDigiPar::GetCellId
Int_t GetCellId(Int_t i)
Definition: CbmTofDigiPar.h:45
CbmTofHit
Definition: core/data/tof/CbmTofHit.h:26
CbmTofSimpClusterizer::fhTimeResSingHitsB
TH2 * fhTimeResSingHitsB
Definition: CbmTofSimpClusterizer.h:210
CbmTofDigiBdfPar::GetSignalSpeed
Double_t GetSignalSpeed() const
Definition: CbmTofDigiBdfPar.h:55
CbmTofSimpClusterizer::fStorDigiExp
std::vector< std::vector< std::vector< std::vector< CbmTofDigi * > > > > fStorDigiExp
Definition: CbmTofSimpClusterizer.h:177
CbmTofSimpClusterizer::fvdDifCh
std::vector< std::vector< std::vector< Double_t > > > fvdDifCh
Definition: CbmTofSimpClusterizer.h:201
CbmTofCell::GetY
Double_t GetY() const
Definition: CbmTofCell.h:37
CbmTofSimpClusterizer::fhChDifDifX
TH2 * fhChDifDifX
Definition: CbmTofSimpClusterizer.h:225
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
CbmTofDigi::GetTot
Double_t GetTot() const
Alias for GetCharge.
Definition: CbmTofDigi.h:120
CbmTofDigiBdfPar::GetMaxDistAlongCh
Double_t GetMaxDistAlongCh() const
Definition: CbmTofDigiBdfPar.h:97
CbmTofSimpClusterizer::fhMultiTrkProbPos
TH2 * fhMultiTrkProbPos
Definition: CbmTofSimpClusterizer.h:219
CbmTofSimpClusterizer::FillHistos
Bool_t FillHistos()
Definition: CbmTofSimpClusterizer.cxx:1020
CbmTofSimpClusterizer::fTofHitsColl
TClonesArray * fTofHitsColl
Definition: CbmTofSimpClusterizer.h:168
CbmTofDigiBdfPar::ClustUseTrackId
Bool_t ClustUseTrackId() const
Definition: CbmTofDigiBdfPar.h:95
CbmTofSimpClusterizer::fStart
TTimeStamp fStart
Definition: CbmTofSimpClusterizer.h:269
CbmTofSimpClusterizer::fhDigTimeDifClust
TH1 * fhDigTimeDifClust
Definition: CbmTofSimpClusterizer.h:221
CbmTofDigiBdfPar::GetMaxTimeDist
Double_t GetMaxTimeDist() const
Definition: CbmTofDigiBdfPar.cxx:661
CbmTofSimpClusterizer::GetEventInfo
void GetEventInfo(Int_t &inputNr, Int_t &eventNr, Double_t &eventTime)
Retrieve event info from run manager to properly fill the CbmLink objects.
Definition: CbmTofSimpClusterizer.cxx:2197
CbmTofSimpClusterizer::fTofId
CbmTofDetectorId * fTofId
Definition: CbmTofSimpClusterizer.h:155
CbmTofSimpClusterizer::fTofDigiMatchColl
TClonesArray * fTofDigiMatchColl
Definition: CbmTofSimpClusterizer.h:169
iNTrg
const Int_t iNTrg
Definition: CbmTofSimpClusterizer.cxx:67
CbmTofSimpClusterizer::fvCPTOff
std::vector< std::vector< std::vector< std::vector< Double_t > > > > fvCPTOff
Definition: CbmTofSimpClusterizer.h:257
CbmTofSimpClusterizer::fhTimePtVsHits
TH2 * fhTimePtVsHits
Definition: CbmTofSimpClusterizer.h:211
CbmTofDigiBdfPar::GetNbGaps
Int_t GetNbGaps(Int_t iSmType, Int_t iRpc) const
Definition: CbmTofDigiBdfPar.cxx:525
CbmTofDigiBdfPar::GetNbSm
Int_t GetNbSm(Int_t iSmType) const
Definition: CbmTofDigiBdfPar.cxx:513