CbmRoot
Loading...
Searching...
No Matches
CbmTofAnaTestbeam.cxx
Go to the documentation of this file.
1/* Copyright (C) 2014-2021 PI-UHd, GSI
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Christian Simon, Norbert Herrmann [committer], Pierre-Alain Loizeau */
4
5// ------------------------------------------------------------------
6// ----- CbmTofAnaTestbeam -----
7// ----- Created 12/04/2014 by nh -----
8// ------------------------------------------------------------------
9
10#include "CbmTofAnaTestbeam.h"
11
12// TOF Classes and includes
13#include "CbmDigiManager.h"
14#include "CbmEvent.h"
15#include "CbmMatch.h"
16#include "CbmTofAddress.h" // in cbmdata/tof
17#include "CbmTofCell.h" // in tof/TofData
18#include "CbmTofDetectorId_v12b.h" // in cbmdata/tof
19#include "CbmTofDetectorId_v14a.h" // in cbmdata/tof
20#include "CbmTofDigi.h" // in cbmdata/tof
21#include "CbmTofDigiBdfPar.h" // in tof/TofParam
22#include "CbmTofDigiPar.h" // in tof/TofParam
23#include "CbmTofGeoHandler.h" // in tof/TofTools
24#include "CbmTofHit.h" // in cbmdata/tof
25#include "CbmTofPoint.h"
27#include "CbmTofTrackFinderNN.h"
28#include "CbmTofTracklet.h"
29#include "CbmTofTrackletTools.h"
30#include "CbmTrackMatchNew.h"
31#include "CbmVertex.h"
32
33#include "TTrbHeader.h"
34//#include "TMbsMappingTofPar.h"
35
36#include "CbmMCDataArray.h"
37#include "CbmMCDataManager.h"
38#include "CbmMCDataObject.h"
39#include "CbmMCEventList.h"
40#include "CbmMCTrack.h"
41
42// CBMroot classes and includes
43
44// FAIR classes and includes
45#include "FairMCEventHeader.h"
46#include "FairRootManager.h"
47#include "FairRunAna.h"
48#include "FairRuntimeDb.h"
49#include <Logger.h>
50
51// ROOT Classes and includes
52#include "TClonesArray.h"
53#include "TDirectory.h"
54#include "TEfficiency.h"
55#include "TFile.h"
56#include "TFitResult.h"
57#include "TGeoManager.h"
58#include "TGeoPhysicalNode.h"
59#include "TH1.h"
60#include "TH2.h"
61#include "TH3.h"
62#include "TMCProcess.h"
63#include "TMath.h"
64#include "TProfile.h"
65#include "TROOT.h"
66#include "TRandom.h"
67#include "TString.h"
68
69#include "Riostream.h"
70
71// C++ STL
72#include <boost/lexical_cast.hpp>
73#include <boost/regex.hpp>
74
75using std::cout;
76using std::endl;
77using std::vector;
78
79const Int_t DetMask = 0x001FFFFF; // for v21a geometries
80const Double_t DTDMAX = 6.; // diamond inspection range in ns
81
82Double_t dTDia;
83Double_t dDTD4Min = 1.E8;
84static Double_t StartAnalysisTime = 0.;
85static Double_t dTLEvt = 0.;
86
88
89static Double_t fdMemoryTime = 1.E12; // memory time in ns
90
92
93static std::vector<TH2D*> fhLHTime;
94static std::vector<std::vector<CbmTofHit*>> fvLHit;
95static std::map<UInt_t, UInt_t> fDetIdMap;
96
97struct cmp_str {
98 bool operator()(char const* a, char const* b) const { return std::strcmp(a, b) < 0; }
99};
100
101std::map<Int_t, const char*> giPdgMap {// Gauge bosons
102 {22, "#gamma"},
103 // leptons
104 {11, "e^{-}"},
105 {-11, "e^{+}"},
106 {13, "#mu^{-}"},
107 {-13, "#mu^{+}"},
108 // mesons
109 {111, "#pi^{0}"},
110 {211, "#pi^{+}"},
111 {-211, "#pi^{-}"},
112 {221, "#eta"},
113 {130, "#Kappa^{0}_{L}"},
114 {310, "#Kappa^{0}_{S}"},
115 {321, "#Kappa^{+}"},
116 {-321, "#Kappa^{-}"},
117 // baryons
118 {2112, "n"},
119 {-2112, "#bar{n}"},
120 {2212, "p"},
121 {-2212, "#bar{p}"},
122 {3112, "#Sigma^{-}"},
123 {-3112, "#Sigma^{+}"},
124 {3122, "#Lambda"},
125 {-3122, "#bar{#Lambda}"},
126 {3212, "#Sigma^{0}"},
127 {-3212, "#bar{#Sigma^{0}}"},
128 {3222, "#Sigma^{+}"},
129 {-3222, "#Sigma^{-}"},
130 {3312, "#Xi^{-}"},
131 {-3312, "#Xi^{+}"},
132 {3322, "#Xi^{0}"},
133 {-3322, "#bar{#Xi^{0}}"},
134 {3334, "#Omega^{-}"},
135 {-3334, "#Omega^{+}"},
136 // fragments
137 {1000010020, "d"},
138 {1000010030, "t"},
139 {1000020040, "#alpha"},
140 // dummy
141 {0, "Geant"}};
142
143std::map<const char*, const char*, cmp_str> gcMaterialMap {
144 {"RPCgas", "gas"}, {"RPCgas_noact", "gas"}, {"RPCglass", "glass"}, {"air", "air"},
145 {"aluminium", "box"}, {"carbon", "pcb"}, {"targetMaterial", "target"}, {"silicon", "diamond"}};
146
147std::map<const char*, const char*, cmp_str> gcProcessMap {{"Compton scattering", "Compton"},
148 {"Decay", "Decay"},
149 {"Delta ray", "Delta"},
150 {"Hadronic interaction", "Hadronic"},
151 {"Lepton pair production", "Pair"},
152 {"Photoelectric effect", "Photo"},
153 {"Positron annihilation", "Annil"},
154 {"Primary particle emission", "Primary"},
155 {"Bremstrahlung", "Brems"}};
156
157void GetPdgName(Int_t iPdgCode, const char*& cPdgName);
158void GetMaterialName(const char* cMaterial, const char*& cMaterialName);
159void GetProcessName(const char* cProcess, const char*& cProcessName);
160
161//___________________________________________________________________
162//
163// CbmTofAnaTestbeam
164//
165// Task for analysis of Testbeam data
166//
167// ------------------------------------------------------------------
169{
170 cout << "CbmTofTests: Task started " << endl;
171}
172// ------------------------------------------------------------------
173
174// ------------------------------------------------------------------
176 : FairTask(name, verbose)
177 , fEvents(0)
178 , fGeoHandler(new CbmTofGeoHandler())
179 , fTofId(NULL)
180 , fChannelInfo(NULL)
181 , fChannelInfoRef(NULL)
182 , fChannelInfoDut(NULL)
183 , fChannelInfoSel2(NULL)
184 , fMbsMappingPar(NULL)
185 , iNbSmTot(0)
186 , fvTypeSmOffs()
187 , iNbRpcTot(0)
188 , fvSmRpcOffs()
189 , iNbChTot(0)
190 , fvRpcChOffs()
191 , fDigiPar(NULL)
192 , fDigiBdfPar(NULL)
193 , fTofDigisColl(NULL)
194 , fTofHitsColl(NULL)
195 , fTofDigiMatchColl(NULL)
196 , fTofTrackColl(NULL)
197 , fEventsColl(NULL)
198 , fTofDigisCollIn(NULL)
199 , fTofHitsCollIn(NULL)
200 , fTofDigiMatchCollIn(NULL)
201 , fTofTrackCollIn(NULL)
202 , fTrbHeader(NULL)
203 , fdDXMean(0.)
204 , fdDYMean(0.)
205 , fdDTMean(0.)
206 , fdDXWidth(0.)
207 , fdDYWidth(0.)
208 , fdDTWidth(0.)
209 , fhTriggerPattern(NULL)
210 , fhTriggerType(NULL)
211 , fhTimeInSpill(NULL)
212 , fhRate_all(NULL)
213 , fhTIS_all(NULL)
214 , fhTIS_sel(NULL)
215 , fhTIS_sel1(NULL)
216 , fhTIS_sel2(NULL)
217 , fhTIR_all(NULL)
218 , fhTIR_sel(NULL)
219 , fhTIR_sel1(NULL)
220 , fhTIR_sel2(NULL)
221 , fhTIS_Nhit(NULL)
222 , fhTIS_Ntrk(NULL)
223 , fhDTLH_all(NULL)
224 , fhDTLH_sel(NULL)
225 , fhDTLH_sel1(NULL)
226 , fhDTLH_sel2(NULL)
227 , fhDTLH_DStrip(NULL)
228 , fhDT2(NULL)
229 , fhXX2(NULL)
230 , fhYY2(NULL)
231 , fhNMatch04(NULL)
232 , fhXX04(NULL)
233 , fhYY04(NULL)
234 , fhXY04(NULL)
235 , fhYX04(NULL)
236 , fhTT04(NULL)
237 , fhDutDXDYDT(NULL)
238 , fhRefDXDYDT(NULL)
239 , fhChi04(NULL)
240 , fhChiSel24(NULL)
241 , fhDXSel24(NULL)
242 , fhDYSel24(NULL)
243 , fhDTSel24(NULL)
244 , fhDXDY04(NULL)
245 , fhDXDT04(NULL)
246 , fhDYDT04(NULL)
247 , fhTofSel24(NULL)
248 , fhNMatch04sel(NULL)
249 , fhChi04best(NULL)
250 , fhDigiMul0best(NULL)
251 , fhDigiMul4best(NULL)
252 , fhDXDY04best(NULL)
253 , fhDXDT04best(NULL)
254 , fhDYDT04best(NULL)
255 , fhChiDT04best(NULL)
256 , fhDT24DT04best(NULL)
257 , fhDTD4DT04best(NULL)
258 , fhX0DT04best(NULL)
259 , fhY0DT04best(NULL)
260 , fhNMatchD4sel(NULL)
261 , fhChi04D4best(NULL)
262 , fhTofD4best(NULL)
263 , fhVelD4best(NULL)
264 , fhDigiMul0D4best(NULL)
265 , fhDigiMul4D4best(NULL)
266 , fhCluSize04D4best(NULL)
267 , fhCluMul04D4best(NULL)
268 , fhStrMul04D4best(NULL)
269 , fhCluMulTSig0D4best(NULL)
270 , fhCluMulTSig4D4best(NULL)
271 , fhCluMulTrel0D4best(NULL)
272 , fhCluMulTrel4D4best(NULL)
273 , fhCluSizeTrel0D4best(NULL)
274 , fhCluSizeTrel4D4best(NULL)
275 , fhDXDY04D4best(NULL)
276 , fhDXDT04D4best(NULL)
277 , fhDYDT04D4best(NULL)
278 , fhDistDT04D4best(NULL)
279 , fhTexpDT04D4best(NULL)
280 , fhCluSize0DT04D4best(NULL)
281 , fhCluSize4DT04D4best(NULL)
282 , fhTot0DT04D4best(NULL)
283 , fhTot4DT04D4best(NULL)
284 , fhCluSizeSigT0D4best(NULL)
285 , fhCluSizeSigT4D4best(NULL)
286 , fhChiDT04D4best(NULL)
287 , fhDT24DT04D4best(NULL)
288 , fhDTD4DT04D4best(NULL)
289 , fhX0DT04D4best(NULL)
290 , fhY0DT04D4best(NULL)
291 , fhTISDT04D4best(NULL)
292 , fhDTMul4D4best(NULL)
293 , fhDTX4D4best(NULL)
294 , fhDTY4D4best(NULL)
295 , fhDXX4D4best(NULL)
296 , fhDXY4D4best(NULL)
297 , fhDYX4D4best(NULL)
298 , fhDYY4D4best(NULL)
299 , fhDTMul0D4best(NULL)
300 , fhDTX0D4best(NULL)
301 , fhDTY0D4best(NULL)
302 , fhDXX0D4best(NULL)
303 , fhDXY0D4best(NULL)
304 , fhDYX0D4best(NULL)
305 , fhDYY0D4best(NULL)
306 , fhChi04D4sbest(NULL)
307 , fhTofD4sbest(NULL)
308 , fhVelD4sbest(NULL)
309 , fhDigiMul0D4sbest(NULL)
310 , fhDigiMul4D4sbest(NULL)
311 , fhCluMul04D4sbest(NULL)
312 , fhDXDY04D4sbest(NULL)
313 , fhDXDT04D4sbest(NULL)
314 , fhDYDT04D4sbest(NULL)
315 , fhDistDT04D4sbest(NULL)
316 , fhTexpDT04D4sbest(NULL)
317 , fhCluSize0DT04D4sbest(NULL)
318 , fhCluSize4DT04D4sbest(NULL)
319 , fhTot0DT04D4sbest(NULL)
320 , fhTot4DT04D4sbest(NULL)
321 , fhChiDT04D4sbest(NULL)
322 , fhDT24DT04D4sbest(NULL)
323 , fhDTD4DT04D4sbest(NULL)
324 , fhX0DT04D4sbest(NULL)
325 , fhY0DT04D4sbest(NULL)
326 , fhDTMul4D4sbest(NULL)
327 , fhDTX4D4sbest(NULL)
328 , fhDTY4D4sbest(NULL)
329 , fhDXX4D4sbest(NULL)
330 , fhDXY4D4sbest(NULL)
331 , fhDYX4D4sbest(NULL)
332 , fhDYY4D4sbest(NULL)
333 , fhDTMul0D4sbest(NULL)
334 , fhDTX0D4sbest(NULL)
335 , fhDTY0D4sbest(NULL)
336 , fhDXX0D4sbest(NULL)
337 , fhDXY0D4sbest(NULL)
338 , fhDYX0D4sbest(NULL)
339 , fhDYY0D4sbest(NULL)
340 , fhNMatch24(NULL)
341 , fhNMatch24sel(NULL)
342 , fhDT24sel(NULL)
343 , fhChi24(NULL)
344 , fhXY24(NULL)
345 , fhDXDY24(NULL)
346 , fhDXDT24(NULL)
347 , fhDYDT24(NULL)
348 , fhXY0D4best(NULL)
349 , fhXY4D4best(NULL)
350 , fhXX04D4best(NULL)
351 , fhYY04D4best(NULL)
352 , fhXYSel2D4best(NULL)
353 , fhXY0D4sel(NULL)
354 , fhXY4D4sel(NULL)
355 , fhXYSel2D4sel(NULL)
356 , fhDTD4sel(NULL)
357 , fhTofD4sel(NULL)
358 , fhBRefMul(NULL)
359 , fhDTD4(NULL)
360 , fhXYPos()
361 , fhEtaPhi(NULL)
362 , fhDT04DX0_1(NULL)
363 , fhDT04DY0_1(NULL)
364 , fhDT04DT0_1(NULL)
365 , fhDT04DX4_1(NULL)
366 , fhDT04DY4_1(NULL)
367 , fhDT04DT4_1(NULL)
368 , fhDT04DX0_2(NULL)
369 , fhDT04DY0_2(NULL)
370 , fhDT04DT0_2(NULL)
371 , fhDT04DX4_2(NULL)
372 , fhDT04DY4_2(NULL)
373 , fhDT04DT4_2(NULL)
374 , fhDutPullX(NULL)
375 , fhDutPullXB(NULL)
376 , fhDutPullY(NULL)
377 , fhDutPullYB(NULL)
378 , fhDutPullZ(NULL)
379 , fhDutPullT(NULL)
380 , fhDutPullTB(NULL)
381 , fhDutChi_Found(NULL)
382 , fhDutChi_Missed(NULL)
383 , fhDutChi_Match(NULL)
384 , fhDutXY_Found(NULL)
385 , fhDutXY_Missed(NULL)
386 , fhDutDTLH_Found(NULL)
387 , fhDutDTLH_Missed(NULL)
388 , fhDutMul_Found(NULL)
389 , fhDutMul_Missed(NULL)
390 , fhDutTIS_Found(NULL)
391 , fhDutTIS_Missed(NULL)
392 , fhDutTIR_Found(NULL)
393 , fhDutTIR_Missed(NULL)
394 , fhDutVel_Found(NULL)
395 , fhDutVel_Missed(NULL)
396 , fhDutDTLH_CluSize(NULL)
397 , fhDutDTLH_Tot(NULL)
398 , fhDutDTLH_Mul(NULL)
399 , fhDutDTLH_TIS(NULL)
400 , fhDutDTLH_Missed_TIS(NULL)
401 , fhDutDTLH_DDH_Found(NULL)
402 , fhDutDTLH_DD_Found(NULL)
403 , fhDutDTLH_DD_Missed(NULL)
404 , fhDutXYDX(NULL)
405 , fhDutXYDY(NULL)
406 , fhDutXYDT(NULL)
407 , fhNMergedMCEvents(NULL)
408 , fhAccTrackMul(NULL)
409 , fhAccRefTrackMul(NULL)
410 , fhAccPrimTrackMul(NULL)
411 , fhAccTrackPointMul(NULL)
412 , fhAccRefTrackPointMul(NULL)
413 , fhAccRndmTrackPointMul(NULL)
414 , fhAccRefTrackAcceptance(NULL)
415 , fhAccRefTrackAcceptanceEfficiency(NULL)
416 , fhAccRefTrackAcceptancePurity(NULL)
417 , fhAccRefTrackMulCentrality(NULL)
418 , fhAccRefTracksProcSpec(NULL)
419 , fhSelMCTrackEfficiency(NULL)
420 , fhSelMCTrackMatchEfficiency(NULL)
421 , fhSelMCTrackMatchPurity(NULL)
422 , fhSelMCTrackDutHitMatchNNMul(NULL)
423 , fhSelMCTrackDutHitMatchAccNNMul(NULL)
424 , fhSelEfficiency(NULL)
425 , fhSelPurity(NULL)
426 , fhSelRefTrackShare(NULL)
427 , fhSelRefTrackProcSpec(NULL)
428 , fhSelMatchEfficiency(NULL)
429 , fhSelMatchPurity(NULL)
430 , fhResX04HitExp(NULL)
431 , fhResX04ExpMC(NULL)
432 , fhResX04HitMC(NULL)
433 , fhResY04HitExp(NULL)
434 , fhResY04ExpMC(NULL)
435 , fhResY04HitMC(NULL)
436 , fhResT04HitExp(NULL)
437 , fhResT04ExpMC(NULL)
438 , fhResT04HitMC(NULL)
439 , fhNTracksPerMRefHit(NULL)
440 , fhNTracksPerSel2Hit(NULL)
441 , fhNTracksPerDutHit(NULL)
442 , fhNTracksPerSelMRefHit(NULL)
443 , fhNTracksPerSelSel2Hit(NULL)
444 , fhNTracksPerSelDutHit(NULL)
445 , fhSelTrklEfficiency(NULL)
446 , fhSelTrklPurity(NULL)
447 , fhSelTrklRefTrackShare(NULL)
448 , fhSelTrklRefTrackProcSpec(NULL)
449 , fhSelTrklMatchEfficiency(NULL)
450 , fhSelTrklMatchPurity(NULL)
451 , fhDutResX_Hit_Trk(NULL)
452 , fhDutResX_Trk_MC(NULL)
453 , fhDutResX_Hit_MC(NULL)
454 , fhDutResY_Hit_Trk(NULL)
455 , fhDutResY_Trk_MC(NULL)
456 , fhDutResY_Hit_MC(NULL)
457 , fhDutResT_Hit_Trk(NULL)
458 , fhDutResT_Trk_MC(NULL)
459 , fhDutResT_Hit_MC(NULL)
460 , fhSelHitTupleEfficiencyTIS(NULL)
461 , fhSelTrklEfficiencyTIS(NULL)
462 , fhSelMCTrackEfficiencyTIS(NULL)
463 , fhSelHitTupleMatchEfficiencyTIS(NULL)
464 , fhSelTrklMatchEfficiencyTIS(NULL)
465 , fhSelMCTrackMatchEfficiencyTIS(NULL)
466 , fhSelHitTupleResidualTTIS(NULL)
467 , fhSelTrklResidualTTIS(NULL)
468 , fhSelMCTrackResidualTTIS(NULL)
469 , fhSelHitTupleDutCluSizeTIS(NULL)
470 , fhSelTrklDutCluSizeTIS(NULL)
471 , fhSelMCTrackDutCluSizeTIS(NULL)
472 , fhPVResTAll(NULL)
473 , fhPVResXAll(NULL)
474 , fhPVResYAll(NULL)
475 , fhPVResTRef(NULL)
476 , fhPVResXRef(NULL)
477 , fhPVResYRef(NULL)
478 , fhAccRefTrackResT(NULL)
479 , fhAccRefTrackResX(NULL)
480 , fhAccRefTrackResY(NULL)
481 , fhAccRefTrackResTx(NULL)
482 , fhAccRefTrackResTy(NULL)
483 , fhAccRefTrackResV(NULL)
484 , fhAccRefTrackResN(NULL)
485 , fhAccRefTrackShare(NULL)
486 , fhRecRefTrackEfficiency(NULL)
487 , fhRecRndmTrackEfficiency(NULL)
488 , fhRecRefTrackGhostShare(NULL)
489 , fhRecRefTrackCloneShare(NULL)
490 , fhRecRndmTrackGhostShare(NULL)
491 , fhRecRndmTrackCloneShare(NULL)
492 , fhDomTracksProcSpec()
493 , fhDomTracksProcMat()
494 , fhRndmTracksProcSpec()
495 , fhRndmTracksProcMat()
496 , fhCounterAccTrackMul()
497 , fhCounterAccRefTrackMul()
498 , fhCounterAccRndmTrackMul()
499 , fhCounterAccDomTrackMul()
500 , fhCounterRecRefTrackEfficiencyPassed()
501 , fhCounterRecRefTrackEfficiencyTotal()
502 , fhCounterRecRefTrackPurityPassed()
503 , fhCounterRefTrackMulHitMul()
504 , fhCounterRefTrackLocalXY()
505 , fhCounterRefTrackMulCell()
506 , fhCounterHitMulCell()
507 , fhSelTrklFitRedChiSq(NULL)
508 , fhSelTrklDutHitMatchNNMul(NULL)
509 , fhSelTrklDutHitMatchAccNNMul(NULL)
510 , fhSelHitTupleDutHitMatchMul(NULL)
511 , fhSelHitTupleDutHitMatchAccMul(NULL)
512 , fhSelTypeNNChiSq(NULL)
513 , fhSelTypeNNResidualT(NULL)
514 , fhSelTypeNNResidualX(NULL)
515 , fhSelTypeNNResidualY(NULL)
516 , fhSelTypeAccNNChiSq(NULL)
517 , fhSelTypeAccNNResidualT(NULL)
518 , fhSelTypeAccNNResidualX(NULL)
519 , fhSelTypeAccNNResidualY(NULL)
520 , fhGoodSelTypeNNPureChiSq(NULL)
521 , fhGoodSelTypeNNAllChiSq(NULL)
522 , fhTrklNofHitsRate(NULL)
523 , fhTrklDetHitRate(NULL)
524 , fhTrklNofHitsRateInSpill(NULL)
525 , fhTrklDetHitRateInSpill(NULL)
526 , fStart()
527 , fStop()
528 , fCalParFileName("")
529 , fCalOutFileName("./tofAnaTestBeam.hst.root")
530 , fCalParFile(NULL)
531 , fhDTD4DT04D4Off(NULL)
532 , fhDTX4D4Off(NULL)
533 , fhDTY4D4Off(NULL)
534 , fhDTTexpD4Off(NULL)
535 , fhCluSize0DT04D4Off(NULL)
536 , fhCluSize4DT04D4Off(NULL)
537 , fhTot0DT04D4Off(NULL)
538 , fhTot4DT04D4Off(NULL)
539 , fhSelTypeNNResidualT_Width(NULL)
540 , fhSelTypeNNResidualX_Width(NULL)
541 , fhSelTypeNNResidualY_Width(NULL)
542 , fhSelHitTupleResidualXYT_Width(NULL)
543 , fdMulDMax(0.)
544 , fdSpillDuration(20.)
545 , fdSpillBreak(0.9)
546 , fdStartSpillTime(-100)
547 , fdDTDia(0.)
548 , fdDTD4MAX(0.)
549 , fdMul0Max(0.)
550 , fdMul4Max(0.)
551 , fdCh4Sel(0.)
552 , fdDCh4Sel(0.)
553 , fdPosY4Sel(0.)
554 , fdPosY4SelOff(0.)
555 , fdChS2Sel(0.)
556 , fdDChS2Sel(0.)
557 , fdPosYS2Sel(0.)
558 , fdPosYS2SelOff(0.)
559 , fdSel2TOff(0.)
560 , fdHitDistMin(0.)
561 , fdHitDistAv(1.)
562 , fdTOffD4(0.)
563 , fdTShift(0.)
564 , fdChi2Lim(0.)
565 , fdChi2Lim2(0.)
566 , fdDutX(0.)
567 , fdDutDX(100.)
568 , fdDutY(0.)
569 , fdDutDY(100.)
570 , fiCorMode(0)
571 , fiDutAddr(0)
572 , fiMrpcRefAddr(0)
573 , fiMrpcSel2Addr(0)
574 , fiMrpcSel3Addr(0)
575 , fiBeamRefAddr(0)
576 , fiDut(0)
577 , fiDutSm(0)
578 , fiDutRpc(0)
579 , fiMrpcRef(0)
580 , fiMrpcRefSm(0)
581 , fiMrpcRefRpc(0)
582 , fiMrpcSel2(-1)
583 , fiMrpcSel2Sm(0)
584 , fiMrpcSel2Rpc(0)
585 , fiMrpcSel3(0)
586 , fiMrpcSel3Sm(0)
587 , fiMrpcSel3Rpc(0)
588 , fiPlaSelect(0)
589 , fiBeamRefSmType(0)
590 , fiBeamRefSmId(0)
591 , fiBeamRefRpc(0)
592 , fiDutNch(0)
593 , fiReqTrg(-1)
594 , fChi2LimFit(100.)
595 , fR0LimFit(0.)
596 , fSIGLIM(3.)
597 , fSIGT(100.)
598 , fSIGX(1.)
599 , fSIGY(1.)
600 , fEnableMatchPosScaling(kTRUE)
601 , fFindTracks(NULL)
602 , fClusterizer(NULL)
603 , fTrackletTools(NULL)
604 , fbMonteCarloComparison(kFALSE)
605 , fbPointsInInputFile(kFALSE)
606 , fbTracksInInputFile(kFALSE)
607 , fMCEventHeader(NULL)
608 , fMCEventList(NULL)
609 , fAccTracks(NULL)
610 , fTofPointsTB(NULL)
611 , fTofPoints(NULL)
612 , fMCTracks(NULL)
613 , fTofHitPointMatches(NULL)
614 , fTofHitAccTrackMatches(NULL)
615 , fTofTrackletAccTrackMatches(NULL)
616 , fTofAccTrackTrackletMatches(NULL)
617 , fTofAccTrackPointMatches(NULL)
618 , fCurrentNodePath()
619 , fCurrentModuleNodePath()
620 , fiCurrentModuleType(-1)
621 , fiCurrentModuleIndex(-1)
622 , fiCurrentCounterIndex(-1)
623 , fCounterModuleNodes()
624 , fiNAccRefTracks(0)
625 , fdGhostTrackHitQuota(0.7)
626 , fbDelayMCPoints(kFALSE)
627 , fbAttachDutHitToTracklet(kFALSE)
628 , fbBestSelTrackletOnly(kFALSE)
629 , fbUseSigCalib(kFALSE)
630 , fiAnaMode(0)
631 , fdMCSIGLIM(3.)
632 , fdMCSIGT(100.)
633 , fdMCSIGX(1.)
634 , fdMCSIGY(1.)
635 , fiMinMCRefTrackPoints(3)
636 , fiMaxMCRefTracks(1)
637
638{
639}
640// ------------------------------------------------------------------
641
642// ------------------------------------------------------------------
644{
645 // Destructor
646}
647// ------------------------------------------------------------------
648/************************************************************************************/
649// FairTasks inherited functions
651{
652 if (kFALSE == RegisterInputs()) return kFATAL;
653
654 // fTofId = new ( CbmTofDetectorId )CbmTofDetectorId_v14a();
655 if (kFALSE == InitParameters()) return kFATAL;
656
657 if (kFALSE == LoadGeometry()) return kFATAL;
658
659 if (kFALSE == LoadCalParameter()) return kFATAL;
660
661 if (kFALSE == CreateHistos()) return kFATAL;
662
663 if (fEnableMatchPosScaling) LOG(info) << Form("Position Scaling for Matching enabled ");
664 else
665 LOG(info) << Form("Position Scaling for Matching not enabled ");
666
669 fTrackletTools = new CbmTofTrackletTools(); // initialize tools
670
671 if (NULL == fFindTracks) {
672 //fdTShift += fChannelInfoDut->GetZ()/30.; // in ns
673 //if ( NULL != fChannelInfoSel2 ) fdSel2TOff += fChannelInfoSel2->GetZ()/30.;
674 LOG(warning) << Form("no FindTracks instance found, use TShift = %8.3f, Sel2Toff = %8.3f", fdTShift, fdSel2TOff);
675 }
676 else { // reinitialize Offsets
679 LOG(info) << Form("Set time offsets D: %7.1f, 4: %7.1f, D4: %7.1f, Sel24: %7.1f",
681 }
682 return kSUCCESS;
683}
684
686{
687 LOG(info) << " CbmTofAnaTestbeam => Get the digi parameters for tof";
688 return;
689 // Get Base Container
690 FairRunAna* ana = FairRunAna::Instance();
691 FairRuntimeDb* rtdb = ana->GetRuntimeDb();
692
693 fDigiPar = (CbmTofDigiPar*) (rtdb->getContainer("CbmTofDigiPar"));
694
695 fDigiBdfPar = (CbmTofDigiBdfPar*) (rtdb->getContainer("CbmTofDigiBdfPar"));
696}
697
699{
700 LOG(info) << "Geometry starting for " << fDigiPar->GetNrOfModules()
701 << " geometrically known detector cells, looking for type " << fiDut;
702 fiDutNch = 0;
703 Double_t dDutXmin = 1.E300;
704 Double_t dDutXmax = -1.E300;
705 fChannelInfoDut = NULL;
706 for (Int_t icell = 0; icell < fDigiPar->GetNrOfModules(); ++icell) {
707
708 Int_t cellId = fDigiPar->GetCellId(icell); // cellId is assigned in CbmTofCreateDigiPar
709 fChannelInfo = fDigiPar->GetCell(cellId);
710 /*
711 Int_t smodule = fGeoHandler->GetSMType(cellId); // FIXME - wrong inline functions!!!
712 Int_t smtype = fGeoHandler->GetSModule(cellId); // FIXME
713 Int_t module = fGeoHandler->GetCounter(cellId);
714 */
715 Int_t smtype = CbmTofAddress::GetSmType(cellId);
716 Int_t smodule = CbmTofAddress::GetSmId(cellId);
717 Int_t module = CbmTofAddress::GetRpcId(cellId);
718 /*
719 LOG(debug3) <<Form(" Id 0x%08x ",cellId)
720 << " got cell " << smtype << ", " << smodule << ", " << module
721 << ", x-size "<< fChannelInfo->GetSizex()
722 << ", y-size "<< fChannelInfo->GetSizey()
723 ;
724 */
725 if (smtype == fiDut && smodule == fiDutSm && module == fiDutRpc) {
726 fiDutNch++;
727 if (fChannelInfo->GetX() > dDutXmax) dDutXmax = fChannelInfo->GetX();
728 if (fChannelInfo->GetX() < dDutXmin) dDutXmin = fChannelInfo->GetX();
729 if (fiDutNch == 1) {
731 LOG(info) << Form(" DutId 0x%08x ", cellId) << " got cell " << smtype << ", " << smodule << ", " << module
732 << ", x-size " << fChannelInfoDut->GetSizex() << ", y-size " << fChannelInfoDut->GetSizey() << ", # "
733 << fiDutNch << ", Xmin " << dDutXmin << ", Xmax " << dDutXmax;
734 }
735 }
736 }
737 if (fiDutNch > 0) {
738 Double_t dDutDx = (dDutXmax - dDutXmin) / (fiDutNch - 1);
739 LOG(info) << "CbmTofAnaTestbeam::LoadGeometry Dut = " << fiDut << " with " << fiDutNch
740 << " channels in x- direction from " << dDutXmin << " to " << dDutXmax << ", dx = " << dDutDx;
741 }
742 else {
743 LOG(error) << "Dut inconsistent " << fiDut << ", " << fiDutNch;
744 return kFALSE;
745 }
746
747 if (!FindModuleNodes()) {
748 LOG(error) << "Could not retrieve module nodes from TGeoManager!";
749 return kFALSE;
750 }
751
752 return kTRUE;
753}
754
755void CbmTofAnaTestbeam::Exec(Option_t* opt)
756{
757 if (!fEventsColl) { ExecEvent(opt); }
758 else {
759 for (Int_t iEvent = 0; iEvent < fEventsColl->GetEntriesFast(); iEvent++) {
760 CbmEvent* tEvent = dynamic_cast<CbmEvent*>(fEventsColl->At(iEvent));
761 LOG(debug) << "Process event " << iEvent << " with " << tEvent->GetNofData(ECbmDataType::kTofHit) << " hits from "
763 << " digis ";
764
765 if (fTofDigisColl) fTofDigisColl->Clear("C");
766 //if(fTofDigisColl) fTofDigisColl->Delete();
767 if (fTofHitsColl) fTofHitsColl->Clear("C");
768 if (fTofDigiMatchColl) fTofDigiMatchColl->Clear("C");
769 if (fTofTrackColl) fTofTrackColl->Clear("C");
770
771 Int_t iNbDigi = 0;
772 /*
773 assert ( fTofDigisColl );
774 for (Int_t iDigi = 0; iDigi < tEvent->GetNofData(ECbmDataType::kTofCalDigi); iDigi++)
775 {
776 Int_t iDigiIndex = static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kTofCalDigi, iDigi));
777 const CbmTofDigi* tDigi = fDigiMan->Get<CbmTofDigi>(iDigiIndex);
778// CbmTofDigi* tDigi = dynamic_cast<CbmTofDigi*>(fTofDigisCollIn->At(iDigiIndex));
779 assert (tDigi);
780 //LOG(info) << "Copy TofDigi " << iDigi << " from " << iDigiIndex << " to " << iNbDigi;
781 //new((*fTofDigisColl)[iNbDigi++]) CbmTofDigi(*tDigi); // does not work for tDigi, since no TObject
782 }
783 */
784 Int_t iNbHits = 0;
785 for (size_t iHit = 0; iHit < tEvent->GetNofData(ECbmDataType::kTofHit); iHit++) {
786 Int_t iHitIndex = static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kTofHit, iHit));
787 CbmTofHit* tHit = dynamic_cast<CbmTofHit*>(fTofHitsCollIn->At(iHitIndex));
788 new ((*fTofHitsColl)[iNbHits]) CbmTofHit(*tHit);
789
790 CbmMatch* tMatch = dynamic_cast<CbmMatch*>(fTofDigiMatchCollIn->At(iHitIndex));
791 new ((*fTofDigiMatchColl)[iNbHits]) CbmMatch(*tMatch);
792
793 iNbHits++;
794 }
795
796 Int_t iNbTrks = 0;
797 for (size_t iTrk = 0; iTrk < tEvent->GetNofData(ECbmDataType::kTofTrack); iTrk++) {
798 Int_t iTrkIndex = static_cast<Int_t>(tEvent->GetIndex(ECbmDataType::kTofTrack, iTrk));
799 CbmTofTracklet* tTrk = dynamic_cast<CbmTofTracklet*>(fTofTrackCollIn->At(iTrkIndex));
800 new ((*fTofTrackColl)[iNbTrks++]) CbmTofTracklet(*tTrk);
801 }
802
803 ExecEvent(opt);
804
805 if (iNbDigi) fTofDigisColl->Delete(); //Clear("C"); // Clear causes memory leak, FIXME
806 if (iNbHits) fTofHitsColl->Clear("C");
807 if (iNbHits) fTofDigiMatchColl->Delete(); //Clear("C");
808 if (iNbTrks) fTofTrackColl->Delete(); //Clear("C");
809 }
810 }
811}
812
813
814void CbmTofAnaTestbeam::ExecEvent(Option_t* /*option*/)
815{
816 // Task execution
817 if (NULL != fFindTracks && fdMemoryTime == 0.) {
818 if (!fFindTracks->InspectEvent()) return;
819
820 LOG(debug) << "=> New event with " << fFindTracks->GetNStationsFired() << " fired stations for "
821 << fFindTracks->GetMinNofHits() << " requested hits";
822 }
823 fStart.Set();
824 FillHistos();
825 fStop.Set();
826
827
828 // if( 0 < fEvents )
829 if (0 == (fEvents % 100000) && 0 < fEvents) {
830 LOG(info) << "CbmTofAnaTestbeam::Exec : "
831 << "event " << fEvents << " in " << iNspills << " spills processed.";
832 }
833 fEvents += 1;
834}
835
837{
838 // Normalisations
839 LOG(info) << "Finish up with " << fEvents << " analyzed events in " << iNspills << " spills ";
840
842 TH1* tCurrentHistogram(NULL);
843
844 if (fhAccRefTracksProcSpec->GetEntries()) {
845 fhAccRefTracksProcSpec->LabelsDeflate("X");
846 fhAccRefTracksProcSpec->LabelsDeflate("Y");
847 fhAccRefTracksProcSpec->LabelsOption("<d", "X");
848 fhAccRefTracksProcSpec->LabelsOption("<v", "Y");
849 fhAccRefTracksProcSpec->Scale(1. / fhAccRefTracksProcSpec->GetEntries());
850 }
851
852 if (fhSelRefTrackProcSpec->GetEntries()) {
853 fhSelRefTrackProcSpec->LabelsDeflate("X");
854 fhSelRefTrackProcSpec->LabelsDeflate("Y");
855 fhSelRefTrackProcSpec->LabelsOption("<d", "X");
856 fhSelRefTrackProcSpec->LabelsOption("<v", "Y");
857 fhSelRefTrackProcSpec->Scale(1. / fhSelRefTrackProcSpec->GetEntries());
858 }
859
861 if (fhSelTrklRefTrackProcSpec->GetEntries()) {
862 fhSelTrklRefTrackProcSpec->LabelsDeflate("X");
863 fhSelTrklRefTrackProcSpec->LabelsDeflate("Y");
864 fhSelTrklRefTrackProcSpec->LabelsOption("<d", "X");
865 fhSelTrklRefTrackProcSpec->LabelsOption("<v", "Y");
866 fhSelTrklRefTrackProcSpec->Scale(1. / fhSelTrklRefTrackProcSpec->GetEntries());
867 }
868 }
869
870 for (auto const& CounterModuleNode : fCounterModuleNodes) {
871 auto const& CounterID = CounterModuleNode.first;
872
873 tCurrentHistogram = fhDomTracksProcSpec.at(CounterID);
874 if (tCurrentHistogram->GetEntries()) {
875 tCurrentHistogram->LabelsDeflate("X");
876 tCurrentHistogram->LabelsDeflate("Y");
877 tCurrentHistogram->LabelsOption("<d", "X");
878 tCurrentHistogram->LabelsOption("<v", "Y");
879 tCurrentHistogram->Scale(1. / tCurrentHistogram->GetEntries());
880 }
881
882 tCurrentHistogram = fhDomTracksProcMat.at(CounterID);
883 if (tCurrentHistogram->GetEntries()) {
884 tCurrentHistogram->LabelsDeflate("X");
885 tCurrentHistogram->LabelsDeflate("Y");
886 tCurrentHistogram->LabelsOption("<d", "X");
887 tCurrentHistogram->LabelsOption("<v", "Y");
888 tCurrentHistogram->Scale(1. / tCurrentHistogram->GetEntries());
889 }
890
891 tCurrentHistogram = fhRndmTracksProcSpec.at(CounterID);
892 if (tCurrentHistogram->GetEntries()) {
893 tCurrentHistogram->LabelsDeflate("X");
894 tCurrentHistogram->LabelsDeflate("Y");
895 tCurrentHistogram->LabelsOption("<d", "X");
896 tCurrentHistogram->LabelsOption("<v", "Y");
897 tCurrentHistogram->Scale(1. / tCurrentHistogram->GetEntries());
898 }
899
900 tCurrentHistogram = fhRndmTracksProcMat.at(CounterID);
901 if (tCurrentHistogram->GetEntries()) {
902 tCurrentHistogram->LabelsDeflate("X");
903 tCurrentHistogram->LabelsDeflate("Y");
904 tCurrentHistogram->LabelsOption("<d", "X");
905 tCurrentHistogram->LabelsOption("<v", "Y");
906 tCurrentHistogram->Scale(1. / tCurrentHistogram->GetEntries());
907 }
908 }
909 }
910
911
912 WriteHistos();
913 // Prevent them from being sucked in by the CbmHadronAnalysis WriteHistograms method
914 DeleteHistos();
915}
916
917/************************************************************************************/
918// Functions common for all clusters approximations
920{
921 FairRootManager* fManager = FairRootManager::Instance();
922
923 fEventsColl = dynamic_cast<TClonesArray*>(fManager->GetObject("Event"));
924 if (NULL == fEventsColl) fEventsColl = dynamic_cast<TClonesArray*>(fManager->GetObject("CbmEvent"));
925
926 if (NULL == fEventsColl) LOG(info) << "CbmEvent not found in input file, assume eventwise input";
927
929 fDigiMan->Init();
931 LOG(error) << GetName() << ": No digi input!";
932 return kFALSE;
933 }
934
935
936 if (!fEventsColl) {
937
938 if (NULL == fTofDigisColl) fTofDigisColl = (TClonesArray*) fManager->GetObject("CbmTofDigi");
939
940 if (NULL == fTofDigisColl) fTofDigisColl = (TClonesArray*) fManager->GetObject("TofCalDigi");
941
942 if (NULL == fTofDigisColl) {
943 LOG(warning) << "CbmTofAnaTestbeam::RegisterInputs => Could not get the TofDigi "
944 "TClonesArray!!! ... continuing with incomplete input ";
945 // return kFALSE;
946 } // if( NULL == fTofDigisColl)
947
948 fTofHitsColl = (TClonesArray*) fManager->GetObject("TofHit");
949 if (NULL == fTofHitsColl) {
950 LOG(error) << "CbmTofAnaTestbeam::RegisterInputs => Could not get the "
951 "TofHit TClonesArray!!!";
952 return kFALSE;
953 } // if( NULL == fTofHitsColl)
954
955 fTofDigiMatchColl = (TClonesArray*) fManager->GetObject("TofHitCalDigiMatch");
956 if (NULL == fTofDigiMatchColl) {
957 LOG(error) << "CbmTofAnaTestbeam::RegisterInputs => Could not get the "
958 "Match TClonesArray!!!";
959 return kFALSE;
960 } // if( NULL == fTofDigiMatchColl)
961
962
963 fTofTrackColl = (TClonesArray*) fManager->GetObject("TofTracks");
964 if (NULL == fTofTrackColl) {
965 LOG(info) << "CbmTofAnaTestbeam::RegisterInputs => Could not get the "
966 "TofTracklet TClonesArray!!!";
967 // return kFALSE;
968 } // if( NULL == fTofHitsColl)
969
970 fTrbHeader = (TTrbHeader*) fManager->GetObject("TofTrbHeader.");
971 if (NULL == fTrbHeader) {
972 LOG(info) << "CbmTofAnaTestbeam::RegisterInputs => Could not get the "
973 "TofTrbHeader Object";
974 }
975
977 fDigiMan->Init();
979 LOG(error) << GetName() << ": No input digis!";
980 //return kFALSE;
981 }
982 else
983 LOG(info) << "DigiManager has Tof Digis";
984
986 // The input data arrays correspond to a timeslice.
987 fMCEventList = dynamic_cast<CbmMCEventList*>(fManager->GetObject("MCEventList."));
988 if (!fMCEventList) {
989 // The input data arrays correspond to a reconstructed event.
990 fMCEventList = dynamic_cast<CbmMCEventList*>(fManager->GetObject("EventList."));
991
992 // TODO: For the time being, the following check prevents the MC comparison code
993 // from being executed when ordinary event-by-event input is being processed.
994 // Without a MC event list at hand (as is the case in event-based mode) it is
995 // not straightforward to find the position of the MC event header in the
996 // input chain.
997 if (!fMCEventList) {
998 LOG(error) << "CbmTofAnaTestbeam::RegisterInputs => Could not "
999 "retrieve branch \"(MC)EventList.\" for MC comparison.";
1000 return kFALSE;
1001 }
1002 }
1003
1004 CbmMCDataManager* tMCManager = dynamic_cast<CbmMCDataManager*>(fManager->GetObject("MCDataManager"));
1005 if (!tMCManager) {
1006 LOG(error) << "CbmTofAnaTestbeam::RegisterInputs => Could not retrieve "
1007 "CbmMCDataManager for MC comparison.";
1008 return kFALSE;
1009 }
1010
1011 fMCEventHeader = tMCManager->GetObject("MCEventHeader.");
1012 if (!fMCEventHeader) {
1013 LOG(error) << "CbmTofAnaTestbeam::RegisterInputs => Could not retrieve "
1014 "branch \"MCEventHeader.\" for MC comparison.";
1015 return kFALSE;
1016 }
1017
1018 fTofPointsTB = dynamic_cast<TClonesArray*>(fManager->GetObject("TofPointTB"));
1019 if (fTofPointsTB) { fbPointsInInputFile = kTRUE; }
1020 else {
1021 fTofPoints = tMCManager->InitBranch("TofPoint");
1022 if (!fTofPoints) {
1023 LOG(error) << "CbmTofAnaTestbeam::RegisterInputs => Could not "
1024 "retrieve branch \"TofPoint\" for MC comparison.";
1025 return kFALSE;
1026 }
1027 }
1028
1029 fTofHitPointMatches = dynamic_cast<TClonesArray*>(fManager->GetObject("TofHitMatch"));
1030 if (!fTofHitPointMatches) {
1031 LOG(error) << "CbmTofAnaTestbeam::RegisterInputs => Could not retrieve "
1032 "branch \"TofHitMatch\" for MC comparison.";
1033 return kFALSE;
1034 }
1035
1036 fAccTracks = dynamic_cast<TClonesArray*>(fManager->GetObject("TofAccMCTracks"));
1037 if (fAccTracks) {
1038 fbTracksInInputFile = kTRUE;
1039
1040 fTofAccTrackPointMatches = dynamic_cast<TClonesArray*>(fManager->GetObject("TofAccMCTrackPointMatch"));
1042 LOG(error) << "CbmTofAnaTestbeam::RegisterInputs => Could not retrieve branch "
1043 "\"TofAccMCTrackPointMatch\" for MC comparison.";
1044 return kFALSE;
1045 }
1046
1047 fTofHitAccTrackMatches = dynamic_cast<TClonesArray*>(fManager->GetObject("TofHitTrackMatch"));
1049 LOG(error) << "CbmTofAnaTestbeam::RegisterInputs => Could not retrieve branch "
1050 "\"TofHitTrackMatch\" for MC comparison.";
1051 return kFALSE;
1052 }
1053
1054 if (fTofTrackColl) {
1055 fTofTrackletAccTrackMatches = dynamic_cast<TClonesArray*>(fManager->GetObject("TofTrackMatch"));
1057 LOG(error) << "CbmTofAnaTestbeam::RegisterInputs => Could not retrieve "
1058 "branch \"TofTrackMatch\" for MC comparison.";
1059 return kFALSE;
1060 }
1061
1062 fTofAccTrackTrackletMatches = dynamic_cast<TClonesArray*>(fManager->GetObject("TofAccMCTrackMatch"));
1064 LOG(error) << "CbmTofAnaTestbeam::RegisterInputs => Could not retrieve "
1065 "branch \"TofAccMCTrackMatch\" for MC comparison.";
1066 return kFALSE;
1067 }
1068 }
1069 }
1070 else {
1071 fMCTracks = tMCManager->InitBranch("MCTrack");
1072 if (!fMCTracks) {
1073 LOG(error) << "CbmTofAnaTestbeam::RegisterInputs => Could not "
1074 "retrieve branch \"MCTrack\" for MC comparison.";
1075 return kFALSE;
1076 }
1077 }
1078 }
1079 }
1080 else {
1081 if (NULL == fTofDigisCollIn) fTofDigisCollIn = (TClonesArray*) fManager->GetObject("TofCalDigi");
1082 /*
1083 if( NULL == fTofDigisCollIn)
1084 fTofDigisCollIn = (TClonesArray *) fManager->GetObject("CbmTofDigi");
1085
1086 if( NULL == fTofDigisCollIn)
1087 fTofDigisCollIn = (TClonesArray *) fManager->GetObject("CbmTofDigi");
1088
1089 if( NULL == fTofDigisCollIn)
1090 fTofDigisCollIn = (TClonesArray *) fManager->GetObject("TofDigiExp");
1091
1092 if( NULL == fTofDigisCollIn)
1093 fTofDigisCollIn = (TClonesArray *) fManager->GetObject("TofDigi");
1094 */
1095 if (NULL == fTofDigisCollIn) {
1096 LOG(warning) << "CbmTofAnaTestbeam::RegisterInputs => Could not get the TofDigi "
1097 "TClonesArray!!! ... continuing with incomplete input ";
1098 //return kFALSE;
1099 } // if( NULL == fTofDigisColl)
1100
1101 fTofHitsCollIn = (TClonesArray*) fManager->GetObject("TofHit");
1102 if (NULL == fTofHitsCollIn) {
1103 LOG(error) << "CbmTofAnaTestbeam::RegisterInputs => Could not get the "
1104 "TofHit TClonesArray!!!";
1105 return kFALSE;
1106 } // if( NULL == fTofHitsColl)
1107
1108 fTofDigiMatchCollIn = (TClonesArray*) fManager->GetObject("TofDigiMatch");
1109 if (NULL == fTofDigiMatchCollIn) {
1110 fTofDigiMatchCollIn = (TClonesArray*) fManager->GetObject("TofHitCalDigiMatch");
1111 if (NULL == fTofDigiMatchCollIn) {
1112 LOG(error) << "CbmTofAnaTestbeam::RegisterInputs => Could not get the "
1113 "Match TClonesArray!!!";
1114 }
1115 } // if( NULL == fTofDigiMatchColl)
1116
1117 fTofTrackCollIn = (TClonesArray*) fManager->GetObject("TofTracks");
1118 if (NULL == fTofTrackCollIn) {
1119 LOG(info) << "CbmTofAnaTestbeam::RegisterInputs => Could not get the "
1120 "TofTracklet TClonesArray!!!";
1121 // return kFALSE;
1122 } // if( NULL == fTofHitsColl)
1123
1125 fDigiMan->Init();
1127 LOG(error) << GetName() << ": No input digis!";
1128 return kFALSE;
1129 }
1130 else
1131 LOG(info) << "DigiManager has Tof Digis";
1132
1133 // Create work Arrays
1134 fTofDigisColl = new TClonesArray("CbmTofDigi", 100);
1135 fTofDigiMatchColl = new TClonesArray("CbmMatch", 100);
1136 fTofHitsColl = new TClonesArray("CbmTofHit", 100);
1137 fTofTrackColl = new TClonesArray("CbmTofTracklet", 100);
1138
1140 LOG(error) << "CbmTofAnaTestbeam::RegisterInputs => MC comparison not "
1141 "compatible with 'CbmEvent' processing!!!";
1142 fbMonteCarloComparison = kFALSE;
1143 }
1144 }
1145 return kTRUE;
1146}
1147/************************************************************************************/
1149{
1150
1151 // Initialize the TOF GeoHandler
1152 Bool_t isSimulation = kFALSE;
1153 LOG(info) << "CbmTofAnaTestbeam::InitParameters - Geometry, Mapping, ... ";
1154 // Get Base Container
1155 FairRun* ana = FairRun::Instance();
1156 FairRuntimeDb* rtdb = ana->GetRuntimeDb();
1157
1158 Int_t iGeoVersion = fGeoHandler->Init(isSimulation);
1159 if (k14a > iGeoVersion) {}
1160
1161 fDigiPar = (CbmTofDigiPar*) (rtdb->getContainer("CbmTofDigiPar"));
1162 if (0 == fDigiPar) {
1163 LOG(error) << "CbmTofAnaTestbeam::InitParameters => Could not obtain the "
1164 "CbmTofDigiPar ";
1165 return kFALSE;
1166 }
1167
1168 fDigiBdfPar = (CbmTofDigiBdfPar*) (rtdb->getContainer("CbmTofDigiBdfPar"));
1169 if (0 == fDigiBdfPar) {
1170 LOG(error) << "CbmTofAnaTestbeam::InitParameters => Could not obtain the "
1171 "CbmTofDigiBdfPar ";
1172 return kFALSE;
1173 }
1174
1175 // Mapping parameter
1176 /*
1177 fMbsMappingPar = (TMbsMappingTofPar*) (rtdb->getContainer("TMbsMappingTofPar"));
1178 if( 0 == fMbsMappingPar )
1179 {
1180 LOG(error)<<"CbmTofAnaTestBeam::InitParameters => Could not obtain the TMbsMappingTofPar ";
1181 return kFALSE;
1182 }
1183 */
1184 rtdb->initContainers(ana->GetRunId());
1185
1186 LOG(info) << "CbmTofAnaTestbeam::InitParameter: currently " << fDigiPar->GetNrOfModules() << " digi cells ";
1187
1188 // set defaults for backward compatibility to sep14
1189 if (0 == fiBeamRefAddr) {
1190 LOG(info) << "CbmTofAnaTestbeam::InitParameter: set beam ref to default (sep14) ";
1191 fiBeamRefSmType = 5;
1192 fiBeamRefSmId = 1;
1194 }
1195 LOG(info) << Form("CbmTofAnaTestbeam::InitParameter BeamRef = %d, %d, 0x%08x", fiBeamRefSmType, fiBeamRefSmId,
1197
1198 if (0 == fdDTD4MAX) fdDTD4MAX = DTDMAX;
1199
1200 if (0. == fdChi2Lim) fdChi2Lim = 10.;
1201 if (0. == fdChi2Lim2) fdChi2Lim2 = fdChi2Lim;
1202 LOG(info) << "CbmTofAnaTestbeam::InitParameter: Chi2 limits initialized to " << fdChi2Lim << " and " << fdChi2Lim2;
1203 return kTRUE;
1204}
1205/************************************************************************************/
1207{
1208 if (fCalParFileName.IsNull()) return kTRUE;
1209
1211 TFile* oldFile = gFile;
1212 TDirectory* oldDir = gDirectory;
1213
1214 fCalParFile = new TFile(fCalParFileName, "");
1215 if (NULL == fCalParFile) {
1216 LOG(error) << "CbmTofAnaTestBeam::LoadCalParameter: "
1217 << "file " << fCalParFileName << " does not exist ";
1218 return kTRUE;
1219 }
1220
1221 LOG(info) << "CbmTofAnaTestBeam::LoadCalParameter: "
1222 << "read from file " << fCalParFileName;
1223
1224 TProfile* fhtmp = (TProfile*) gDirectory->FindObjectAny(Form("hDTD4DT04D4best_pfx_px"));
1225 if (NULL == fhtmp) {
1226 if (!fbUseSigCalib) {
1227 fdChi2Lim = fdChi2Lim * 100.;
1228 fdChi2Lim2 = fdChi2Lim2 * 100.;
1229 }
1230 LOG(info) << "Histo hDTD4DT04D4best_pfx_px not found => Chi2Lim = " << fdChi2Lim;
1231 }
1232
1233 TProfile* fhtmpx = (TProfile*) gDirectory->FindObjectAny(Form("hDTX4D4best_pfx_px"));
1234 if (NULL == fhtmpx) { LOG(info) << " Histo " << Form("hDTX4D4best_pfx_px") << " not found. "; }
1235
1236 TProfile* fhtmpy = (TProfile*) gDirectory->FindObjectAny(Form("hDTY4D4best_pfx_px"));
1237 if (NULL == fhtmpy) { LOG(info) << " Histo " << Form("hDTY4D4best_pfx_px") << " not found. "; }
1238
1239 TProfile* fhtmpt = (TProfile*) gDirectory->FindObjectAny(Form("hTexpDT04D4best_pfx_px"));
1240 if (NULL == fhtmpt) { LOG(info) << " Histo " << Form("hTexpDT04D4best_pfx_px") << " not found. "; }
1241
1242 TProfile* fhtmpcs0 = (TProfile*) gDirectory->FindObjectAny(Form("hCluSize0DT04D4best_pfx_px"));
1243 if (NULL == fhtmpcs0) { LOG(info) << " Histo " << Form("hCluSize0DT04D4best_pfx_px") << " not found. "; }
1244
1245 TProfile* fhtmpcs4 = (TProfile*) gDirectory->FindObjectAny(Form("hCluSize4DT04D4best_pfx_px"));
1246 if (NULL == fhtmpcs4) { LOG(info) << " Histo " << Form("hCluSize4DT04D4best_pfx_px") << " not found. "; }
1247
1248 TProfile* fhtmptot0 = (TProfile*) gDirectory->FindObjectAny(Form("hTot0DT04D4best_pfx_px"));
1249 if (NULL == fhtmptot0) { LOG(info) << " Histo " << Form("hTot0DT04D4best_pfx_px") << " not found. "; }
1250
1251 TProfile* fhtmptot4 = (TProfile*) gDirectory->FindObjectAny(Form("hTot4DT04D4best_pfx_px"));
1252 if (NULL == fhtmptot4) { LOG(info) << " Histo " << Form("hTot4DT04D4best_pfx_px") << " not found. "; }
1253
1254 TH1D* fhtmpstnnrt = (TH1D*) gDirectory->FindObjectAny(Form("hSelTypeNNResidualT_Width"));
1255 TH1D* fhtmpstnnrx = (TH1D*) gDirectory->FindObjectAny(Form("hSelTypeNNResidualX_Width"));
1256 TH1D* fhtmpstnnry = (TH1D*) gDirectory->FindObjectAny(Form("hSelTypeNNResidualY_Width"));
1257 TH1D* fhtmphtrxyt = (TH1D*) gDirectory->FindObjectAny(Form("hSelHitTupleResidualXYT_Width"));
1258
1259 TH2D* fh2tmp = (TH2D*) gDirectory->FindObjectAny(Form("hDistDT04D4best"));
1260 if (NULL != fh2tmp) fdHitDistAv = fh2tmp->GetMean(1);
1261 if (fdHitDistAv <= 0.) fdHitDistAv = 1.;
1262 LOG(info) << "CbmTofAnaTestBeam::LoadCalParameter: average distance Dut - "
1263 "Ref initialized to "
1264 << Form("%5.1f", fdHitDistAv) << " cm ";
1265
1266 gROOT->cd();
1267 if (NULL != fhtmp) fhDTD4DT04D4Off = (TH1D*) fhtmp->Clone();
1268 if (NULL != fhtmpx) fhDTX4D4Off = (TH1D*) fhtmpx->Clone();
1269 if (NULL != fhtmpy) fhDTY4D4Off = (TH1D*) fhtmpy->Clone();
1270 if (NULL != fhtmpt) fhDTTexpD4Off = (TH1D*) fhtmpt->Clone();
1271 if (NULL != fhtmpcs0) fhCluSize0DT04D4Off = (TH1D*) fhtmpcs0->Clone();
1272 if (NULL != fhtmpcs4) fhCluSize4DT04D4Off = (TH1D*) fhtmpcs4->Clone();
1273 if (NULL != fhtmptot0) fhTot0DT04D4Off = (TH1D*) fhtmptot0->Clone();
1274 if (NULL != fhtmptot4) fhTot4DT04D4Off = (TH1D*) fhtmptot4->Clone();
1275
1276
1277 if (NULL == fhtmpstnnrt) { LOG(info) << " Histo " << Form("hSelTypeNNResidualT_Width") << " not found. "; }
1278 else {
1279 if (fbUseSigCalib) { fhSelTypeNNResidualT_Width = (TH1D*) fhtmpstnnrt->Clone(); }
1280 }
1281
1282 if (NULL == fhSelTypeNNResidualT_Width) {
1283 fhSelTypeNNResidualT_Width = new TH1F(Form("hSelTypeNNResidualT_Width"),
1284 Form("Sel-DUT ResiT Width vs SelType ; SelType ; RMS(T) (ns)"), 3, 0, 3);
1285
1286 fhSelTypeNNResidualT_Width->SetBinContent(1, fdDTWidth);
1287 fhSelTypeNNResidualT_Width->SetBinContent(2, fSIGT);
1288 fhSelTypeNNResidualT_Width->SetBinContent(3, fdMCSIGT);
1289 }
1290
1291 if (NULL == fhtmpstnnrx) { LOG(info) << " Histo " << Form("hSelTypeNNResidualX_Width") << " not found. "; }
1292 else {
1293 if (fbUseSigCalib) { fhSelTypeNNResidualX_Width = (TH1D*) fhtmpstnnrx->Clone(); }
1294 }
1295
1296 if (NULL == fhSelTypeNNResidualX_Width) {
1297 fhSelTypeNNResidualX_Width = new TH1F(Form("hSelTypeNNResidualX_Width"),
1298 Form("Sel-DUT ResiX Width vs SelType ; SelType ; RMS(X) (cm)"), 3, 0, 3);
1299
1300 fhSelTypeNNResidualX_Width->SetBinContent(1, fdDXWidth);
1301 fhSelTypeNNResidualX_Width->SetBinContent(2, fSIGX);
1302 fhSelTypeNNResidualX_Width->SetBinContent(3, fdMCSIGX);
1303 }
1304
1305 if (NULL == fhtmpstnnry) { LOG(info) << " Histo " << Form("hSelTypeNNResidualY_Width") << " not found. "; }
1306 else {
1307 if (fbUseSigCalib) { fhSelTypeNNResidualY_Width = (TH1D*) fhtmpstnnry->Clone(); }
1308 }
1309
1310 if (NULL == fhSelTypeNNResidualY_Width) {
1311 fhSelTypeNNResidualY_Width = new TH1F(Form("hSelTypeNNResidualY_Width"),
1312 Form("Sel-DUT ResiY Width vs SelType ; SelType ; RMS(Y) (cm)"), 3, 0, 3);
1313
1314 fhSelTypeNNResidualY_Width->SetBinContent(1, fdDYWidth);
1315 fhSelTypeNNResidualY_Width->SetBinContent(2, fSIGY);
1316 fhSelTypeNNResidualY_Width->SetBinContent(3, fdMCSIGY);
1317 }
1318
1319 if (NULL == fhtmphtrxyt) { LOG(info) << " Histo " << Form("hSelHitTupleResidualXYT_Width") << " not found. "; }
1320 else {
1321 if (fbUseSigCalib) { fhSelHitTupleResidualXYT_Width = (TH1D*) fhtmphtrxyt->Clone(); }
1322 }
1323
1324 if (NULL == fhSelHitTupleResidualXYT_Width) {
1326 new TH1F(Form("hSelHitTupleResidualXYT_Width"),
1327 Form("Sel hit tuple Resi XYT Width; X/Y/T [] ; RMS(X/Y/T) (cm/cm/ns)"), 3, 0, 3);
1328
1329 fhSelHitTupleResidualXYT_Width->SetBinContent(1, fdDXWidth);
1330 fhSelHitTupleResidualXYT_Width->SetBinContent(2, fdDYWidth);
1331 fhSelHitTupleResidualXYT_Width->SetBinContent(3, fdDTWidth);
1332 }
1333
1335 gFile = oldFile;
1336 gDirectory = oldDir;
1337
1338 fCalParFile->Close();
1339 // fhDTD4DT04D4Off->Draw();
1340
1341 if (fdDCh4Sel == 0.) fdDCh4Sel = 1000.; // open default window
1342 if (fdPosY4Sel == 0.) fdPosY4Sel = 10.; // open default window
1343
1344 return kTRUE;
1345}
1346/************************************************************************************/
1347// ------------------------------------------------------------------
1349{
1350 // Create histogramms
1351 Double_t XDMAX = 300.;
1352 Double_t YDMAX = 300.;
1353 Double_t TDMAX = 1000.;
1354 Double_t DTMAX = 1.;
1355 Double_t DXMAX = 10.;
1356 Double_t DYMAX = 10.;
1357 /* Double_t XMAX=100.;*/
1358 /* Double_t YMAX=100.;*/
1359
1360 TDirectory* oldir = gDirectory; // <= To prevent histos from being sucked in by the param file of the TRootManager!
1361 gROOT->cd(); // <= To prevent histos from being sucked in by the param file of the TRootManager !
1362
1363 // define histos here
1364 Double_t TISmax = 11.; //fdSpillDuration;
1365 Double_t TISnbins = 110.; //50.;
1366 fhRate_all = new TH1F("hRate_all", "Event Rate; Rate (Hz); t (sec)", 1000, 0, 100);
1367 fhTriggerPattern = new TH1I("tof_trb_trigger_pattern", "CTS trigger pattern", 16, 0, 16);
1368 fhTriggerType = new TH1I("tof_trb_trigger_types", "CTS trigger types", 16, 0, 16);
1369 fhTimeInSpill = new TH1I("tof_trb_time_in_spill", "Time in Spill", TISnbins, 0, TISmax);
1370 fhTIS_all = new TH1F("TIS_all", "Time in Spill (all); t (sec)", TISnbins, 0, TISmax);
1371 fhTIS_sel = new TH1F("TIS_sel", "Time in Spill (sel); t (sec)", TISnbins, 0, TISmax);
1372 fhTIS_sel1 = new TH1F("TIS_sel1", "Time in Spill (sel1); t (sec)", TISnbins, 0, TISmax);
1373 fhTIS_sel2 = new TH1F("TIS_sel2", "Time in Spill (sel2); t (sec)", TISnbins, 0, TISmax);
1374
1375
1376 Double_t TIRmax = 1800.; // Run duration
1377 Double_t TIRnbins = 18000.;
1378 fhTIR_all = new TH1F("TIR_all", "Time in Run (all); t (sec)", TIRnbins, 0, TIRmax);
1379 fhTIR_sel = new TH1F("TIR_sel", "Time in Run (sel); t (sec)", TIRnbins, 0, TIRmax);
1380 fhTIR_sel1 = new TH1F("TIR_sel1", "Time in Run (sel1); t (sec)", TIRnbins, 0, TIRmax);
1381 fhTIR_sel2 = new TH1F("TIR_sel2", "Time in Run (sel2); t (sec)", TIRnbins, 0, TIRmax);
1382
1383 Double_t TISmax2 = 11.;
1384 Double_t TISnbins2 = 110.;
1385 fhTIS_Nhit = new TH2F("TIS_Nhit", "Time in Spill (Nhit); t (sec); N_{hit}", TISnbins2, 0, TISmax2, 25, 0, 50);
1386 fhTIS_Ntrk = new TH2F("TIS_Ntrk", "Time in Spill (Ntrk); t (sec); N_{trk}", TISnbins2, 0, TISmax2, 10, 0, 10);
1387
1388 fhDTLH_all = new TH1F("hDTLH_all", "Time to last hit in Dut(all); log( #DeltaT (ns)); counts", 100., 0., 12.);
1389 fhDTLH_sel = new TH1F("hDTLH_sel", "Time to last hit in Dut(sel); log( #DeltaT (ns)); counts", 100., 0., 12.);
1390 fhDTLH_sel1 = new TH1F("hDTLH_sel1", "Time to last hit in Dut(sel1); log( #DeltaT (ns)); counts", 100., 0., 12.);
1391 fhDTLH_sel2 = new TH1F("hDTLH_sel2", "Time to last hit in Dut(sel2); log( #DeltaT (ns)); counts", 100., 0., 12.);
1392 fhDTLH_DStrip = new TH2F("hDTLH_DStrip",
1393 "Time to last hit strip matching Dut(sel1); strip ; "
1394 "Channel-PredictedChannel",
1395 32, 0, 31, 7., -3.5, 3.5);
1396
1397 fhBRefMul = new TH1F(Form("hBRefMul"), Form("Multiplicity in Beam Reference counter ; Mul ()"), 50, 0., 50.);
1398 fhDTD4 = new TH1F(Form("hDTD4"), Form("reference time ; #Delta tD4 (ns)"), 101, -100., 100.);
1399
1400 Int_t iNbDet = fDigiBdfPar->GetNbDet(); //fMbsMappingPar->GetNbMappedDet();
1401 fhXYPos.resize(iNbDet);
1402 for (Int_t iDet = 0; iDet < iNbDet; iDet++) {
1403 fhXYPos[iDet] = new TH2F(Form("hXY_SmT%d", iDet), Form("XY Position correlation of Det# %d; X[cm]; Y [cm]", iDet),
1404 100, -YDMAX / 2., YDMAX / 2., 100, -YDMAX, 0.);
1405 }
1406
1407 fhEtaPhi =
1408 new TH2F(Form("hEtaPhi"), Form("Reconstructed Tof Hits; #phi (degree) ; #eta"), 200, -20., 20., 200, 1., 1.7);
1409
1410 fhXX2 =
1411 new TH2F(Form("hXX2"), Form("Plastic position correlation; XPla0; XPla1"), 100, -XDMAX, XDMAX, 100, -XDMAX, XDMAX);
1412 fhYY2 =
1413 new TH2F(Form("hYY2"), Form("Plastic position correlation; YPla0; YPla1"), 100, -YDMAX, YDMAX, 100, -YDMAX, YDMAX);
1414 fhDT2 = new TH1F(Form("hDT2"), Form("Plastic time difference; TPla0 - TPla1 (ns)"), 100, -1., 1.);
1415
1416 for (Int_t iDet = 0; iDet < 2; iDet++) {
1417 fhXX02[iDet] =
1418 new TH2F(Form("hXX02_%d", iDet), Form("X Position correlation; X0; X2"), 100, -YDMAX, YDMAX, 100, -YDMAX, YDMAX);
1419 fhYY02[iDet] =
1420 new TH2F(Form("hYY02_%d", iDet), Form("Y Position correlation; Y0; Y2"), 100, -YDMAX, YDMAX, 100, -YDMAX, YDMAX);
1421 }
1422
1423 const Double_t HTMAX = 100.;
1424 const Double_t HYMAX = 40.;
1425 fhDutDXDYDT = new TH3F(Form("hDutDXDYDT"), Form("Hits distances; #DeltaX [cm]; #DeltaY [cm]; #DeltaT [ns]"), 101,
1426 -HYMAX, HYMAX, 101, -HYMAX, HYMAX, 101, -HTMAX, HTMAX);
1427 fhRefDXDYDT = new TH3F(Form("hRefDXDYDT"), Form("Hits distances; #DeltaX [cm]; #DeltaY [cm]; #DeltaT [ns]"), 101,
1428 -HYMAX, HYMAX, 101, -HYMAX, HYMAX, 101, -HTMAX, HTMAX);
1429
1430 fhXX04 =
1431 new TH2F(Form("hXX04"), Form("X Position correlation; X0 [cm]; X4 [cm]"), 500, -YDMAX, YDMAX, 500, -YDMAX, YDMAX);
1432 fhYY04 =
1433 new TH2F(Form("hYY04"), Form("Y Position correlation; Y0 [cm]; Y4 [cm]"), 500, -YDMAX, YDMAX, 500, -YDMAX, YDMAX);
1434 fhXY04 =
1435 new TH2F(Form("hXY04"), Form("X Position correlation; X0 [cm]; Y4 [cm]"), 500, -YDMAX, YDMAX, 500, -YDMAX, YDMAX);
1436 fhYX04 =
1437 new TH2F(Form("hYX04"), Form("Y Position correlation; Y0 [cm]; X4 [cm]"), 500, -YDMAX, YDMAX, 500, -YDMAX, YDMAX);
1438 fhTT04 = new TH2F(Form("hTT04"), Form("Time correlation; T0 [ns]; T0 - T4 [ns]"), 100, -TDMAX, TDMAX, 100, -1., 1.);
1439 fhDXDY04 = new TH2F(Form("hDXDY04"), Form("position correlation; #Delta x [cm]; #DeltaY [cm]"), 100, -DXMAX, DXMAX,
1440 100, -DYMAX, DYMAX);
1441 fhDXDT04 = new TH2F(Form("hDXDT04"), Form("Time - position correlation; #Delta x [cm]; #DeltaT [ns]"), 100, -DXMAX,
1442 DXMAX, 100, -DTMAX, DTMAX);
1443 fhDYDT04 = new TH2F(Form("hDYDT04"), Form("Time - position correlation; #Delta y [cm]; #DeltaT [ns]"), 100, -DYMAX,
1444 DYMAX, 100, -DTMAX, DTMAX);
1445 fhChi04 = new TH1F(Form("hChi04"), Form("Matching Chi2; #chi; Nhits"), 100, 0., fdChi2Lim);
1446 fhChiSel24 = new TH1F(Form("hChiSel24"), Form("Matching Chi2S24; #chi; Nhits"), 100, 0., fdChi2Lim2);
1447 fhDXSel24 = new TH1F(Form("hDXSel24"), Form("Matching Sel24; #Delta x [cm]; Nhits"), 100, -10., 10.);
1448 fhDYSel24 = new TH1F(Form("hDYSel24"), Form("Matching Sel24; #Delta y [cm]; Nhits"), 100, -10., 10.);
1449 fhDTSel24 = new TH1F(Form("hDTSel24"), Form("Matching Sel24; #Delta t_{cor} [ns]; Nhits"), 100, -1., 1.);
1450 fhTofSel24 = new TH1F(Form("hTofSel24"), Form("Matching Sel24; #Delta t [ns]; Nhits"), 100, -10., 10.);
1451 Int_t iNbinXY = 34;
1452 fhXY0D4best =
1453 new TH2F(Form("hXY0D4best"), Form("local position 0; x [cm]; y [cm]"), iNbinXY, -17., 17., iNbinXY, -17., 17.);
1454 fhXY4D4best =
1455 new TH2F(Form("hXY4D4best"), Form("local position 4; x [cm]; y [cm]"), iNbinXY, -17., 17., iNbinXY, -17., 17.);
1456 fhXX04D4best = new TH2F(Form("hXX04D4best"), Form("local x position 0-4; x0 [cm]; x4 [cm]"), iNbinXY, -17., 17.,
1457 iNbinXY, -17., 17.);
1458 fhYY04D4best = new TH2F(Form("hYY04D4best"), Form("local y position 0-4; y0 [cm]; y4 [cm]"), iNbinXY, -17., 17.,
1459 iNbinXY, -17., 17.);
1460 fhXYSel2D4best = new TH2F(Form("hXYSel2D4best"), Form("local position Sel2; x [cm]; y [cm]"), iNbinXY, -17., 17.,
1461 iNbinXY, -17., 17.);
1462 fhXY0D4sel =
1463 new TH2F(Form("hXY0D4sel"), Form("predicted position 0; x [cm]; y [cm]"), iNbinXY, -17., 17., iNbinXY, -17., 17.);
1464 fhXY4D4sel =
1465 new TH2F(Form("hXY4D4sel"), Form("selected position 4; x [cm]; y [cm]"), iNbinXY, -17., 17., iNbinXY, -17., 17.);
1466 fhXYSel2D4sel = new TH2F(Form("hXYSel2D4sel"), Form("selected position Sel2; x [cm]; y [cm]"), iNbinXY, -17., 17.,
1467 iNbinXY, -17., 17.);
1468
1469 fhDXDY04best = new TH2F(Form("hDXDY04best"), Form("position correlation; #Delta x [cm]; #DeltaY [cm]"), 100, -DXMAX,
1470 DXMAX, 100, -DYMAX, DYMAX);
1471 fhDXDT04best = new TH2F(Form("hDXDT04best"), Form("time - position correlation; #Delta x [cm]; #DeltaT [ns]"), 100,
1472 -DXMAX, DXMAX, 100, -DTMAX, DTMAX);
1473 fhDYDT04best = new TH2F(Form("hDYDT04best"), Form("time - position correlation; #Delta y [cm]; #DeltaT [ns]"), 100,
1474 -DYMAX, DYMAX, 100, -DTMAX, DTMAX);
1475
1476 fhX0DT04best = new TH2F(Form("hX0DT04best"), Form("time - position correlation; #Delta x [cm]; #DeltaT [ns]"), 100,
1477 -50., 50., 100, -DTMAX, DTMAX);
1478 fhY0DT04best = new TH2F(Form("hY0DT04best"), Form("time - position correlation; #Delta y [cm]; #DeltaT [ns]"), 100,
1479 -50., 50., 100, -DTMAX, DTMAX);
1480
1481 fhChi04best = new TH1F(Form("hChi04best"), Form("matching chi2; #chi; Nhits"), 100, 0., fdChi2Lim);
1482 fhDigiMul0best = new TH1F(Form("hDigiMul0best"), Form("Number of digis in cluster; N_{digi}; "), 40, 0., 40.);
1483 fhDigiMul4best = new TH1F(Form("hDigiMul4best"), Form("Number of digis in cluster; N_{digi}; "), 40, 0., 40.);
1484
1485 fhChiDT04best = new TH2F(Form("hChiDT04best"), Form("Time - Chi correlation; #chi; #DeltaT [ns]"), 100, 0., 100., 100,
1486 -DTMAX, DTMAX);
1487
1488 fhDXDY04D4best = new TH2F(Form("hDXDY04D4best"), Form("position correlation; #Delta x [cm]; #DeltaY [cm]"), 100,
1489 -DXMAX, DXMAX, 100, -DYMAX, DYMAX);
1490 fhDXDT04D4best = new TH2F(Form("hDXDT04D4best"), Form("time - position correlation; #Delta x [cm]; #DeltaT [ns]"),
1491 100, -DXMAX, DXMAX, 100, -DTMAX, DTMAX);
1492 fhDYDT04D4best = new TH2F(Form("hDYDT04D4best"), Form("time - position correlation; #Delta y [cm]; #DeltaT [ns]"),
1493 100, -DYMAX, DYMAX, 100, -DTMAX, DTMAX);
1494 fhDistDT04D4best = new TH2F(Form("hDistDT04D4best"), Form("time - distance correlation; Dist [cm]; #DeltaT [ns]"),
1495 100, fdHitDistMin, fdHitDistMin + 30., 100, -DTMAX, DTMAX);
1497 new TH2F(Form("hTexpDT04D4best"), Form("measured - expected time - correlation; Texp [ns]; #DeltaT [ns]"), 100, 0.,
1498 1., 100, -DTMAX, DTMAX);
1500 new TH2F(Form("hCluSize0DT04D4best"), Form("time - CluSize correlation; M_{strips} ; #DeltaT [ns]"), 20, 0.5, 20.5,
1501 100, -DTMAX, DTMAX);
1503 new TH2F(Form("hCluSize4DT04D4best"), Form("time - CluSize correlation; M_{strips} ; #DeltaT [ns]"), 20, 0.5, 20.5,
1504 100, -DTMAX, DTMAX);
1506 new TH2F(Form("hCluSizeSigT0D4best"), Form("time spread - CluSize correlation; M_{strips} ; #sigma_{T} [ns]"), 20,
1507 0.5, 20.5, 100, 0., DTMAX / 5.);
1509 new TH2F(Form("hCluSizeSigT4D4best"), Form("time spread - CluSize correlation; M_{strips} ; #sigma_{T} [ns]"), 20,
1510 0.5, 20.5, 100, 0., DTMAX / 5.);
1511 fhTot0DT04D4best = new TH2F(Form("hTot0DT04D4best"), Form("time - Tot correlation; ln TOT0 ; #DeltaT [ns]"), 100,
1512 -2.5, 3.0, 100, -DTMAX, DTMAX);
1513 fhTot4DT04D4best = new TH2F(Form("hTot4DT04D4best"), Form("time - Tot correlation; ln TOT4 ; #DeltaT [ns]"), 100,
1514 -2.5, 3.0, 100, -DTMAX, DTMAX);
1515
1516 fhX0DT04D4best = new TH2F(Form("hX0DT04D4best"), Form("time - position correlation; #Delta x [cm]; #DeltaT [ns]"),
1517 100, -50., 50., 100, -DTMAX, DTMAX);
1518 fhY0DT04D4best = new TH2F(Form("hY0DT04D4best"), Form("time - position correlation; #Delta y [cm]; #DeltaT [ns]"),
1519 100, -50., 50., 100, -DTMAX, DTMAX);
1520
1521 fhTISDT04D4best = new TH2F(Form("hTISDT04D4best"), Form("time - TIS; time in spill [s]; #DeltaT [ns]"), TISnbins, 0.,
1522 TISmax, 100, -DTMAX, DTMAX);
1523
1524 fhChi04D4best = new TH1F(Form("hChi04D4best"), Form("matching chi2; #chi; Nhits"), 100, 0., fdChi2Lim);
1525 fhTofD4best = new TH1F(Form("hTofD4best"), Form("tof D4; t [ns]; Counts"), 100, 0., 50.);
1526 fhVelD4best = new TH1F(Form("hVelD4best"), Form("vel D4; v [cm/ns]; Counts"), 100, 0., 50.);
1527
1529 new TH2F(Form("hDigiMul0D4best"), Form("Number of digis in cluster; Mul0; N_{strips}; "), 40, 0., 40., 40, 0., 40.);
1531 new TH2F(Form("hDigiMul4D4best"), Form("Number of digis in cluster; Mul4; N_{strips}; "), 40, 0., 40., 40, 0., 40.);
1533 new TH2F(Form("hCluSize04D4best"), Form("cluster multiplicity ; CluSize0; CluSize4"), 40, 0., 40., 40, 0., 40.);
1535 new TH2F(Form("hCluMul04D4best"), Form("cluster size correlation ; Mul0; Mul4"), 40, 0., 40., 20, 0., 20.);
1537 new TH2F(Form("hStrMul04D4best"), Form("strip multiplicity ; StrMul0; StrMul4"), 50, 0., 50., 50, 0., 50.);
1539 new TH2F(Form("hCluMulTSig0D4best"), Form("time spread - cluster multiplicity ; Mul0; #sigma_{T} (ns)"), 50, 0.,
1540 50., 100, 0., 200.);
1542 new TH2F(Form("hCluMulTSig4D4best"), Form("time spread - cluster multiplicity ; Mul4; #sigma_{T} (ns)"), 50, 0.,
1543 50., 100, 0., 200.);
1545 new TH2F(Form("hCluMulTrel0D4best"), Form("arrrival time - cluster multiplicity ; Mul0; T_{rel} (ns)"), 50, 0., 50.,
1546 99, -10., 10.);
1548 new TH2F(Form("hCluMulTrel4D4best"), Form("arrival time - cluster multiplicity ; Mul4; T_{rel} (ns)"), 50, 0., 50.,
1549 99, -10., 10.);
1551 new TH2F(Form("hCluSizeTrel0D4best"), Form("arrrival time - cluster size ; CluSize0; T_{rel} (ns)"), 30, 0., 30.,
1552 99, -10., 10.);
1554 new TH2F(Form("hCluSizeTrel4D4best"), Form("arrival time - cluster size ; CluSize4; T_{rel} (ns)"), 30, 0., 30., 99,
1555 -10., 10.);
1556
1557 fhChiDT04D4best = new TH2F(Form("hChiDT04D4best"), Form("Time - position correlation; #chi; #DeltaT [ns]"), 100, 0.,
1558 100., 100, -DTMAX, DTMAX);
1559 Double_t dtscal = 5.;
1560 if (fdChi2Lim > 100.) dtscal *= 2.;
1562 new TH2F(Form("hDTD4DT04D4best"), Form("Time - velocity correlation; #DeltaTD4 [ns]; #DeltaT04 [ns]"), 100,
1563 -DTMAX * 6., DTMAX * 6., 500, -DTMAX * dtscal, DTMAX * dtscal);
1564
1565 /* Double_t dXMAX=30.;*/
1566 /* Double_t dYMAX=20.;*/
1567 fhDTMul4D4best = new TH2F(Form("hDTMul4D4best"), Form("MRef Time - Multiplicity correlation; Mul4 ; #DeltaT04 [ns]"),
1568 20, 0., 20., 100, -DTMAX, DTMAX);
1569 fhDTX4D4best = new TH2F(Form("hDTX4D4best"), Form("MRef Time - position correlation; X4 [cm]; #DeltaT04 [ns]"), 50,
1570 -17., 17., 100, -DTMAX, DTMAX);
1571 fhDTY4D4best = new TH2F(Form("hDTY4D4best"), Form("MRef Time - position correlation; Y4 [cm]; #DeltaT04 [ns]"), 50,
1572 -15., 15., 100, -DTMAX, DTMAX);
1573 fhDXX4D4best = new TH2F(Form("hDXX4D4best"), Form("MRef DX - position correlation; X4 [cm]; #DeltaX04 [cm]"), 50,
1574 -17., 17., 50, -10., 10.);
1575 fhDXY4D4best = new TH2F(Form("hDXY4D4best"), Form("MRef DX - position correlation; Y4 [cm]; #DeltaX04 [cm]"), 50,
1576 -15., 15., 50, -10., 10.);
1577 fhDYX4D4best = new TH2F(Form("hDYX4D4best"), Form("MRef DY - position correlation; X4 [cm]; #DeltaY04 [cm]"), 50,
1578 -17., 17., 50, -10., 10.);
1579 fhDYY4D4best = new TH2F(Form("hDYY4D4best"), Form("MRef DY - position correlation; Y4 [cm]; #DeltaY04 [cm]"), 50,
1580 -15., 15., 50, -10., 10.);
1581
1582 fhDTMul0D4best = new TH2F(Form("hDTMul0D4best"), Form("Dut Time - Multiplicity correlation; Mul0 ; #DeltaT04 [ns]"),
1583 40, 0., 40., 100, -DTMAX, DTMAX);
1584 fhDTX0D4best = new TH2F(Form("hDTX0D4best"), Form("Dut Time - position correlation; X0 [cm]; #DeltaT04 [ns]"), 50,
1585 -17., 17., 100, -DTMAX, DTMAX);
1586 fhDTY0D4best = new TH2F(Form("hDTY0D4best"), Form("Dut Time - position correlation; Y0 [cm]; #DeltaT04 [ns]"), 50,
1587 -15., 15., 100, -DTMAX, DTMAX);
1588 fhDXX0D4best = new TH2F(Form("hDXX0D4best"), Form("Dut DX - position correlation; X0 [cm]; #DeltaX04 [cm]"), 50, -17.,
1589 17., 50, -15., 15.);
1590 fhDXY0D4best = new TH2F(Form("hDXY0D4best"), Form("Dut DX - position correlation; Y0 [cm]; #DeltaX04 [cm]"), 50, -15.,
1591 15., 50, -15., 15.);
1592 fhDYX0D4best = new TH2F(Form("hDYX0D4best"), Form("Dut DY - position correlation; X0 [cm]; #DeltaY04 [cm]"), 50, -17.,
1593 17., 50, -15., 15.);
1594 fhDYY0D4best = new TH2F(Form("hDYY0D4best"), Form("Dut DY - position correlation; Y0 [cm]; #DeltaY04 [cm]"), 50, -15.,
1595 15., 50, -15., 15.);
1596
1597
1598 fhX0DT04D4sbest = new TH2F(Form("hX0DT04D4sbest"), Form("time - position correlation; #Delta x [cm]; #DeltaT [ns]"),
1599 100, -50., 50., 100, -DTMAX, DTMAX);
1600 fhY0DT04D4sbest = new TH2F(Form("hY0DT04D4sbest"), Form("time - position correlation; #Delta y [cm]; #DeltaT [ns]"),
1601 100, -50., 50., 100, -DTMAX, DTMAX);
1602
1603 fhDXDY04D4sbest = new TH2F(Form("hDXDY04D4sbest"), Form("position correlation; #Delta x [cm]; #DeltaY [cm]"), 100,
1604 -DXMAX, DXMAX, 100, -DYMAX, DYMAX);
1605 fhDXDT04D4sbest = new TH2F(Form("hDXDT04D4sbest"), Form("time - position correlation; #Delta x [cm]; #DeltaT [ns]"),
1606 100, -DXMAX, DXMAX, 100, -DTMAX, DTMAX);
1607 fhDYDT04D4sbest = new TH2F(Form("hDYDT04D4sbest"), Form("time - position correlation; #Delta y [cm]; #DeltaT [ns]"),
1608 100, -DYMAX, DYMAX, 100, -DTMAX, DTMAX);
1609 fhDistDT04D4sbest = new TH2F(Form("hDistDT04D4sbest"), Form("time - distance correlation; Dist [cm]; #DeltaT [ns]"),
1610 100, fdHitDistMin, fdHitDistMin + 30., 100, -DTMAX, DTMAX);
1612 new TH2F(Form("hTexpDT04D4sbest"), Form("measured - expected time - correlation; Texp [ns]; #DeltaT [ns]"), 100, 0.,
1613 6., 100, -DTMAX, DTMAX);
1615 new TH2F(Form("hCluSize0DT04D4sbest"), Form("time - CluSize correlation; N_{strips} ; #DeltaT [ns]"), 20, 0.5, 20.5,
1616 100, -DTMAX, DTMAX);
1618 new TH2F(Form("hCluSize4DT04D4sbest"), Form("time - CluSize correlation; N_{strips} ; #DeltaT [ns]"), 20, 0.5, 20.5,
1619 100, -DTMAX, DTMAX);
1620 fhTot0DT04D4sbest = new TH2F(Form("hTot0DT04D4sbest"), Form("time - Tot correlation; ln TOT0 ; #DeltaT [ns]"), 100,
1621 6.5, 9.5, 100, -DTMAX, DTMAX);
1622 fhTot4DT04D4sbest = new TH2F(Form("hTot4DT04D4sbest"), Form("time - Tot correlation; ln TOT4 ; #DeltaT [ns]"), 100,
1623 6.5, 9.5, 100, -DTMAX, DTMAX);
1624
1625 fhChi04D4sbest = new TH1F(Form("hChi04D4sbest"), Form("matching chi2; #chi; Nhits"), 100, 0., fdChi2Lim);
1626 fhTofD4sbest = new TH1F(Form("hTofD4sbest"), Form("tof D4; t [ns]; Counts"), 100, 0., 50.);
1627 fhVelD4sbest = new TH1F(Form("hVelD4sbest"), Form("vel D4; v [cm/ns]; Counts"), 100, 0., 50.);
1628
1629 fhDigiMul0D4sbest = new TH1F(Form("hDigiMul0D4sbest"), Form("Number of digis in cluster; N_{digi}; "), 20, 0., 20.);
1630 fhDigiMul4D4sbest = new TH1F(Form("hDigiMul4D4sbest"), Form("Number of digis in cluster; N_{digi}; "), 20, 0., 20.);
1632 new TH2F(Form("hCluMul04D4sbest"), Form("cluster multiplicity ; Mul0; Mul4"), 10, 0., 10., 10, 0., 10.);
1633
1634 fhChiDT04D4sbest = new TH2F(Form("hChiDT04D4sbest"), Form("Time - position correlation; #chi; #DeltaT [ns]"), 100, 0.,
1635 100., 100, -DTMAX, DTMAX);
1636
1638 new TH2F(Form("hDTD4DT04D4sbest"), Form("Time - velocity correlation; #DeltaTD4 [ns]; #DeltaT04 [ns]"), 100,
1639 -DTMAX * 6., DTMAX * 6., 100, -DTMAX, DTMAX);
1640
1641 fhDTMul4D4sbest = new TH2F(Form("hDTMul4D4sbest"), Form("Time - Multiplicity correlation; Mul4 ; #DeltaT04 [ns]"), 10,
1642 0., 10., 100, -DTMAX, DTMAX);
1643 fhDTX4D4sbest = new TH2F(Form("hDTX4D4sbest"), Form("Time - position correlation; X4 [cm]; #DeltaT04 [ns]"), 50, -15.,
1644 15., 100, -DTMAX, DTMAX);
1645 fhDTY4D4sbest = new TH2F(Form("hDTY4D4sbest"), Form("Time - position correlation; Y4 [cm]; #DeltaT04 [ns]"), 50, -15.,
1646 15., 100, -DTMAX, DTMAX);
1647 fhDXX4D4sbest = new TH2F(Form("hDXX4D4sbest"), Form("DX - position correlation; X4 [cm]; #DeltaX04 [cm]"), 50, -15.,
1648 15., 50, -10., 10.);
1649 fhDXY4D4sbest = new TH2F(Form("hDXY4D4sbest"), Form("DX - position correlation; Y4 [cm]; #DeltaX04 [cm]"), 50, -15.,
1650 15., 50, -10., 10.);
1651 fhDYX4D4sbest = new TH2F(Form("hDYX4D4sbest"), Form("DY - position correlation; X4 [cm]; #DeltaY04 [cm]"), 50, -15.,
1652 15., 50, -10., 10.);
1653 fhDYY4D4sbest = new TH2F(Form("hDYY4D4sbest"), Form("DY - position correlation; Y4 [cm]; #DeltaY04 [cm]"), 50, -15.,
1654 15., 50, -10., 10.);
1655
1656 fhDTMul0D4sbest = new TH2F(Form("hDTMul0D4sbest"), Form("Time - Multiplicity correlation; Mul0 ; #DeltaT04 [ns]"), 10,
1657 0., 10., 100, -DTMAX, DTMAX);
1658 fhDTX0D4sbest = new TH2F(Form("hDTX0D4sbest"), Form("Time - position correlation; X0 [cm]; #DeltaT04 [ns]"), 50, -17.,
1659 17., 100, -DTMAX, DTMAX);
1660 fhDTY0D4sbest = new TH2F(Form("hDTY0D4sbest"), Form("Time - position correlation; Y0 [cm]; #DeltaT04 [ns]"), 50, -15.,
1661 15., 100, -DTMAX, DTMAX);
1662 fhDXX0D4sbest = new TH2F(Form("hDXX0D4sbest"), Form("DX - position correlation; X0 [cm]; #DeltaX04 [cm]"), 50, -17.,
1663 17., 50, -15., 15.);
1664 fhDXY0D4sbest = new TH2F(Form("hDXY0D4sbest"), Form("DX - position correlation; Y0 [cm]; #DeltaX04 [cm]"), 50, -15.,
1665 15., 50, -15., 15.);
1666 fhDYX0D4sbest = new TH2F(Form("hDYX0D4sbest"), Form("DY - position correlation; X0 [cm]; #DeltaY04 [cm]"), 50, -17.,
1667 17., 50, -15., 15.);
1668 fhDYY0D4sbest = new TH2F(Form("hDYY0D4sbest"), Form("DY - position correlation; Y0 [cm]; #DeltaY04 [cm]"), 50, -15.,
1669 15., 50, -15., 15.);
1670
1671 fhNMatch04 = new TH1F(Form("hNMatch04"), Form("Number of Matched Hit pairs 0-4; NMatched"), 50, 0., 50.);
1672
1673 fhNMatch04sel = new TH1F(Form("hNMatch04sel"), Form("Number of Matched Hit pairs 0-4; NMatched"), 50, 0., 50.);
1674
1675 fhNMatchD4sel = new TH1F(Form("hNMatchD4sel"), Form("Number of Matched Hit pairs 0-4; NMatched"), 50, 0., 50.);
1676
1677 fhDTD4sel = new TH1F(Form("hDTD4sel"), Form("Time difference BRef - MrpcRef; #DeltaTD4 (ns)"), 100, -DTDMAX, DTDMAX);
1678
1679 fhTofD4sel =
1680 new TH1F(Form("hTofD4sel"), Form("Time difference BRef - MrpcRef; #DeltaTD4 (ns)"), 100, -DTDMAX, DTDMAX);
1681
1682 fhDT04DX0_1 = new TH2F(Form("hDT04DX0_1"), Form("Time - position correlation; #DeltaX0 [cm]; #DeltaT04 [ns]"), 50,
1683 -25., 25., 100, -DTMAX, DTMAX);
1684 fhDT04DY0_1 = new TH2F(Form("hDT04DY0_1"), Form("Time - position correlation; #DeltaY0 [cm]; #DeltaT04 [ns]"), 50,
1685 -25., 25., 100, -DTMAX, DTMAX);
1686 fhDT04DT0_1 = new TH2F(Form("hDT04DT0_1"), Form("Time - time correlation; #DeltaT0 [ns]; #DeltaT04 [ns]"), 50, -5.,
1687 5., 100, -DTMAX, DTMAX);
1688
1689 fhDT04DX4_1 = new TH2F(Form("hDT04DX4_1"), Form("Time - position correlation; #DeltaX4 [cm]; #DeltaT04 [ns]"), 50,
1690 -10., 10., 100, -DTMAX, DTMAX);
1691 fhDT04DY4_1 = new TH2F(Form("hDT04DY4_1"), Form("Time - position correlation; #DeltaY4 [cm]; #DeltaT04 [ns]"), 50,
1692 -15., 15., 100, -DTMAX, DTMAX);
1693 fhDT04DT4_1 = new TH2F(Form("hDT04DT4_1"), Form("Time - time correlation; #DeltaT4 [ns]; #DeltaT04 [ns]"), 50, -5.,
1694 5., 100, -DTMAX, DTMAX);
1695
1696 fhDT04DX0_2 = new TH2F(Form("hDT04DX0_2"), Form("Time - position correlation; #DeltaX0 [cm]; #DeltaT04 [ns]"), 50,
1697 -25., 25., 100, -DTMAX, DTMAX);
1698 fhDT04DY0_2 = new TH2F(Form("hDT04DY0_2"), Form("Time - position correlation; #DeltaY0 [cm]; #DeltaT04 [ns]"), 50,
1699 -25., 25., 100, -DTMAX, DTMAX);
1700 fhDT04DT0_2 = new TH2F(Form("hDT04DT0_2"), Form("Time - time correlation; #DeltaT0 [ns]; #DeltaT04 [ns]"), 50, -5.,
1701 5., 100, -DTMAX, DTMAX);
1702
1703 fhDT04DX4_2 = new TH2F(Form("hDT04DX4_2"), Form("Time - position correlation; #DeltaX4 [cm]; #DeltaT04 [ns]"), 50,
1704 -10., 10., 100, -DTMAX, DTMAX);
1705 fhDT04DY4_2 = new TH2F(Form("hDT04DY4_2"), Form("Time - position correlation; #DeltaY4 [cm]; #DeltaT04 [ns]"), 50,
1706 -15., 15., 100, -DTMAX, DTMAX);
1707 fhDT04DT4_2 = new TH2F(Form("hDT04DT4_2"), Form("Time - time correlation; #DeltaT4 [ns]; #DeltaT04 [ns]"), 50, -5.,
1708 5., 100, -DTMAX, DTMAX);
1709
1710 // Dut histos
1711 Int_t iDutId = fiDut * 100 + fiDutSm * 10 + fiDutRpc;
1712 fhDutPullX = new TH1F(Form("hDutPullX_Sm_%03d", iDutId), Form("hDutPullX_Sm_%03d; #DeltaX", iDutId), 100, -10., 10.);
1713 fhDutPullXB =
1714 new TH1F(Form("hDutPullXB_Sm_%03d", iDutId), Form("hDutPullXB_Sm_%03d; #DeltaX", iDutId), 100, -10., 10.);
1715 fhDutPullY = new TH1F(Form("hDutPullY_Sm_%03d", iDutId), Form("hDutPullY_Sm_%03d; #DeltaY", iDutId), 100, -10., 10.);
1716 fhDutPullYB =
1717 new TH1F(Form("hDutPullYB_Sm_%03d", iDutId), Form("hDutPullYB_Sm_%03d; #DeltaY", iDutId), 100, -10., 10.);
1718 fhDutPullZ =
1719 new TH1F(Form("hDutPullZ_Sm_%03d", iDutId), Form("hDutPullZ_Sm_%03d; #DeltaZ", iDutId), 100, -200., 200.);
1720 fhDutPullT = new TH1F(Form("hDutPullT_Sm_%03d", iDutId), Form("hDutPullT_Sm_%03d; #DeltaT", iDutId), 100, -0.5, 0.5);
1721 fhDutPullTB =
1722 new TH1F(Form("hDutPullTB_Sm_%03d", iDutId), Form("hDutPullTB_Sm_%03d; #DeltaT", iDutId), 150, -0.75, 0.75);
1723
1724 fhDutChi_Found = new TH1F(Form("hDutChi_Found_%03d", iDutId), Form("hDutChi_Found_%03d; #chi", iDutId), 50, 0., 10.);
1726 new TH1F(Form("hDutChi_Missed_%03d", iDutId), Form("hDutChi_Missed_%03d; #chi", iDutId), 50, 0., 10.);
1727
1728 fhDutChi_Match = new TH1F(Form("hDutChi_Match_%03d", iDutId), Form("hDutChi_Match_%03d; #chi", iDutId), 50, 0., 10.);
1729 Double_t XSIZ = 20.;
1730 Double_t DTSIZ = 0.5;
1731 Int_t Nbins = 40.;
1732 fhDutXY_Found = new TH2F(Form("hDutXY_Found_%03d", iDutId), Form("hDutXY_Found_%03d; x(cm); y (cm)", iDutId), Nbins,
1733 -XSIZ, XSIZ, Nbins, -XSIZ, XSIZ);
1734 fhDutXY_Missed = new TH2F(Form("hDutXY_Missed_%03d", iDutId), Form("hDutXY_Missed_%03d; x(cm); y (cm)", iDutId),
1735 Nbins, -XSIZ, XSIZ, Nbins, -XSIZ, XSIZ);
1736
1738 new TH1F(Form("hDutDTLH_Found_%03d", iDutId), Form("hDutDTLH_Found_%03d; log(#DeltaT)", iDutId), 50, 0., 12.);
1740 new TH1F(Form("hDutDTLH_Missed_%03d", iDutId), Form("hDutDTLH_Missed_%03d; log(#DeltaT)", iDutId), 50, 0., 12.);
1742 new TH1F(Form("hDutMul_Found_%03d", iDutId), Form("hDutMul_Found_%03d; Hit Multiplicity", iDutId), 32, 0., 32.);
1744 new TH1F(Form("hDutMul_Missed_%03d", iDutId), Form("hDutMul_Missed_%03d; Hit Multiplicity", iDutId), 32, 0., 32.);
1745 fhDutTIS_Found = new TH2F(Form("hDutTIS_Found_%03d", iDutId), Form("hDutTIS_Found_%03d; Time in spill (s)", iDutId),
1746 TISnbins, 0, TISmax, 9, 0, 9);
1747 fhDutTIS_Missed = new TH2F(Form("hDutTIS_Missed_%03d", iDutId),
1748 Form("hDutTIS_Missed_%03d; Time in spill (s)", iDutId), TISnbins, 0, TISmax, 9, 0, 9);
1749 fhDutTIR_Found = new TH2F(Form("hDutTIR_Found_%03d", iDutId), Form("hDutTIR_Found_%03d; Time in spill (s)", iDutId),
1750 TIRnbins, 0, TIRmax, 9, 0, 9);
1751 fhDutTIR_Missed = new TH2F(Form("hDutTIR_Missed_%03d", iDutId),
1752 Form("hDutTIR_Missed_%03d; Time in spill (s)", iDutId), TIRnbins, 0, TIRmax, 9, 0, 9);
1754 new TH1F(Form("hDutVel_Found_%03d", iDutId), Form("hDutVel_Found_%03d; velocity (cm/ns)", iDutId), 50, 0., 50.);
1756 new TH1F(Form("hDutVel_Missed_%03d", iDutId), Form("hDutVel_Missed_%03d; velocity (cm/ns)", iDutId), 50, 0., 50.);
1757 fhDutDTLH_CluSize = new TH2F(Form("hDutDTLH_CluSize_%03d", iDutId),
1758 Form("hDutDTLH_CluSize_%03d; log(#DeltaT); CluSize", iDutId), 50, 0., 12., 10, 1., 11.);
1759 fhDutDTLH_Tot = new TH2F(Form("hDutDTLH_Tot_%03d", iDutId), Form("hDutDTLH_Tot_%03d; log(#DeltaT); Tot", iDutId), 50,
1760 0., 12., 50, 0., 20.);
1761 fhDutDTLH_Mul = new TH2F(Form("hDutDTLH_Mul_%03d", iDutId), Form("hDutDTLH_Mul_%03d; log(#DeltaT); Mul", iDutId), 50,
1762 0., 12., 30, 0., 30.);
1763 fhDutDTLH_TIS = new TH2F(Form("hDutDTLH_TIS_%03d", iDutId), Form("hDutDTLH_TIS_%03d; log(#DeltaT); TIS (s)", iDutId),
1764 50, 0., 12., TISnbins, 0, TISmax);
1766 new TH2F(Form("hDutDTLH_Missed_TIS_%03d", iDutId), Form("hDutDTLH_Missed_TIS_%03d; log(#DeltaT); TIS (s)", iDutId),
1767 50, 0., 12., TISnbins, 0, TISmax);
1769 new TH2F(Form("hDutDTLH_DDH_Found_%03d", iDutId),
1770 Form("hDutDTLH_DDH_Found_%03d; log(#DeltaT); distance to LH (cm)", iDutId), 50, 0., 12., 40, 0., 4.);
1772 new TH2F(Form("hDutDTLH_DD_Found_%03d", iDutId),
1773 Form("hDutDTLH_DD_Found_%03d; log(#DeltaT); distance to LH (cm)", iDutId), 50, 0., 12., 40, 0., 4.);
1775 new TH2F(Form("hDutDTLH_DD_Missed_%03d", iDutId),
1776 Form("hDutDTLH_DD_Missed_%03d; log(#DeltaT); distance to LH (cm)", iDutId), 50, 0., 12., 40, 0., 4.);
1777 fhDutXYDX = new TH3F(Form("hDutXYDX_%03d", iDutId), Form("hDutXYDT_%03d; x(cm); y (cm); #Deltax (cm)", iDutId),
1778 Nbins, -XSIZ, XSIZ, Nbins, -XSIZ, XSIZ, Nbins, -2., 2.);
1779 fhDutXYDY = new TH3F(Form("hDutXYDY_%03d", iDutId), Form("hDutXYDT_%03d; x(cm); y (cm); #Deltay (cm)", iDutId),
1780 Nbins, -XSIZ, XSIZ, Nbins, -XSIZ, XSIZ, Nbins, -2., 2.);
1781 fhDutXYDT = new TH3F(Form("hDutXYDT_%03d", iDutId), Form("hDutXYDT_%03d; x(cm); y (cm); #Deltat (ns)", iDutId),
1782 Nbins, -XSIZ, XSIZ, Nbins, -XSIZ, XSIZ, Nbins, -DTSIZ, DTSIZ);
1783
1784
1786 new TH2F("hSelTypeNNChiSq", "ST NN #chi^{2}; sel type ST []; #chi^{2}_{3} []; ", 3, 0, 3, 1000, 0., 100.);
1787
1788 fhSelTypeNNResidualT = new TH2F("hSelTypeNNResidualT", "ST NN ResiT vs. ST; sel type ST []; T_{DUT} - T_{ST} [ns]",
1789 3, 0, 3, 3001, -1.5, 1.5);
1790
1791 fhSelTypeNNResidualX = new TH2F("hSelTypeNNResidualX", "ST NN ResiX vs. ST; sel type ST []; X_{DUT} - X_{ST} [cm]",
1792 3, 0, 3, 801, -4., 4.);
1793
1794 fhSelTypeNNResidualY = new TH2F("hSelTypeNNResidualY", "ST NN ResiY vs. ST; sel type ST []; Y_{DUT} - Y_{ST} [cm]",
1795 3, 0, 3, 3001, -15., 15.);
1796
1798 new TH2F("hSelTypeAccNNChiSq", "ST acc NN #chi^{2}; sel type ST []; #chi^{2}_{3} []; ", 3, 0, 3, 1000, 0., 100.);
1799
1801 new TH2F("hSelTypeAccNNResidualT", "ST acc NN ResiT vs. ST; sel type ST []; T_{DUT} - T_{ST} [ns]", 3, 0, 3, 3001,
1802 -1.5, 1.5);
1803
1804 fhSelTypeAccNNResidualX = new TH2F(
1805 "hSelTypeAccNNResidualX", "ST acc NN ResiX vs. ST; sel type ST []; X_{DUT} - X_{ST} [cm]", 3, 0, 3, 801, -4., 4.);
1806
1808 new TH2F("hSelTypeAccNNResidualY", "ST acc NN ResiY vs. ST; sel type ST []; Y_{DUT} - Y_{ST} [cm]", 3, 0, 3, 3001,
1809 -15., 15.);
1810
1811
1812 fhSelEfficiency = new TEfficiency("hSelEfficiency", "; acc ref MUL []; Sel efficiency []", 50, 0., 50.);
1813
1815 new TEfficiency("hSelHitTupleEfficiencyTIS", "; time in spill [s]; Sel efficiency []", TISnbins, 0., TISmax);
1816
1818 new TEfficiency("hSelMatchEfficiency", "; acc ref MUL []; Sel match efficiency []", 50, 0., 50.);
1819
1820 fhSelHitTupleMatchEfficiencyTIS = new TEfficiency(
1821 "hSelHitTupleMatchEfficiencyTIS", "; time in spill [s]; Sel match efficiency []", TISnbins, 0., TISmax);
1822
1823 fhSelHitTupleResidualTTIS = new TH2F("hSelHitTupleResidualTTIS", "; time in spill [s]; T_{hit} - T_{sel} [ns]",
1824 TISnbins, 0., TISmax, 301, -1.5, 1.5);
1825
1826 fhSelHitTupleDutCluSizeTIS = new TH2F("hSelHitTupleDutCluSizeTIS", "; time in spill [s]; cluster size [cells]",
1827 TISnbins, 0., TISmax, 20, 0.5, 20.5);
1828
1829
1830 fhSelTrklEfficiency = new TEfficiency("hSelTrklEfficiency", "; acc ref MUL []; Sel efficiency []", 50, 0., 50.);
1831
1833 new TEfficiency("hSelTrklEfficiencyTIS", "; time in spill [s]; Sel efficiency []", TISnbins, 0., TISmax);
1834
1836 new TEfficiency("hSelTrklMatchEfficiency", "; acc ref MUL []; Sel match efficiency []", 50, 0., 50.);
1837
1839 new TEfficiency("hSelTrklMatchEfficiencyTIS", "; time in spill [s]; Sel match efficiency []", TISnbins, 0., TISmax);
1840
1841 fhSelTrklResidualTTIS = new TH2F("hSelTrklResidualTTIS", "; time in spill [s]; T_{hit} - T_{sel} [ns]", TISnbins, 0.,
1842 TISmax, 301, -1.5, 1.5);
1843
1845 new TH2F("hSelTrklDutCluSizeTIS", "; time in spill [s]; cluster size [cells]", TISnbins, 0., TISmax, 20, 0.5, 20.5);
1846
1847
1849 Int_t iNCounters(fCounterModuleNodes.size());
1850
1851
1852 fhNMergedMCEvents = new TH1F("hNMergedMCEvents", "Merged MC events; events []; ", 10, -0.5, 9.5);
1853
1854 fhAccTrackMul = new TH1F("hAccTrackMul", "Acc track mul; MUL []; ", 150, -0.5, 149.5);
1855 fhAccRefTrackMul = new TH1F("hAccRefTrackMul", "Acc ref track mul; MUL []; ", 50, -0.5, 49.5);
1856 fhAccPrimTrackMul = new TH1F("hAccPrimTrackMul", "Acc prim track mul; MUL []; ", 60, -0.5, 59.5);
1858 new TH1F("hAccTrackPointMul", "Acc track points; points []; ", iNCounters, -0.5, iNCounters - 0.5);
1860 new TH1F("hAccRefTrackPointMul", "Acc ref track points; points []; ", iNCounters, -0.5, iNCounters - 0.5);
1862 new TH1F("hAccRndmTrackPointMul", "Acc rndm track points; points []; ", iNCounters, -0.5, iNCounters - 0.5);
1863
1864
1866 new TH2F("hAccRefTrackAcceptance", "Ref track acceptance; y_{lab} []; p_{t}/m [1/c]", 42, -1., 6., 30, 0., 2.5);
1867
1869 new TEfficiency("hAccRefTrackAcceptanceEfficiency", "Ref track acceptance efficiency; y_{lab} []; p_{t}/m [1/c]",
1870 42, -1., 6., 30, 0., 2.5);
1871
1873 new TEfficiency("hAccRefTrackAcceptancePurity", "Ref track acceptance purity; y_{lab} []; p_{t}/m [1/c]", 42, -1.,
1874 6., 30, 0., 2.5);
1875
1876 fhAccRefTrackMulCentrality = new TH2F(
1877 "hAccRefTrackMulCentrality", "Acc ref track mul vs. centrality; b [fm]; MUL []", 20, 0., 20., 50, -0.5, 49.5);
1878
1879 fhAccRefTracksProcSpec = new TH2F("hAccRefTracksProcSpec", "ref track proc/spec; ; ", 5, 0., 5., 5, 0., 5.);
1880 fhAccRefTracksProcSpec->SetCanExtend(TH1::kAllAxes);
1881 fhAccRefTracksProcSpec->SetStats(0);
1882
1883
1885 new TEfficiency("hSelMCTrackEfficiency", "; acc ref MUL []; Sel efficiency []", 50, 0., 50.);
1886
1888 new TEfficiency("hSelMCTrackMatchEfficiency", "; acc ref MUL []; Sel match efficiency []", 50, 0., 50.);
1889
1891 new TEfficiency("hSelMCTrackMatchPurity", "; acc ref MUL []; Sel match purity []", 50, 0., 50.);
1892
1894 new TH1F("hSelMCTrackDutHitMatchNNMul", "Sel track-hit match mul; MUL []; ", 30, 0.5, 30.5);
1895
1897 new TH1F("hSelMCTrackDutHitMatchAccNNMul", "Sel track-hit match acc mul; MUL []; ", 30, 0.5, 30.5);
1898
1899
1900 fhSelPurity = new TEfficiency("hSelPurity", "; acc ref MUL []; Sel purity []", 50, 0., 50.);
1901
1903 new TEfficiency("hSelRefTrackShare", "; acc ref MUL []; Sel ref track share []", 50, 0.5, 50.5);
1904
1905 fhSelRefTrackProcSpec = new TH2F("hSelRefTrackProcSpec", "ST 0 ref track proc/spec; ; ", 5, 0., 5., 5, 0., 5.);
1906 fhSelRefTrackProcSpec->SetCanExtend(TH1::kAllAxes);
1907 fhSelRefTrackProcSpec->SetStats(0);
1908
1909 fhSelMatchPurity = new TEfficiency("hSelMatchPurity", "; acc ref MUL []; Sel match purity []", 50, 0., 50.);
1910
1911
1912 fhResX04HitExp = new TH2F("hResX04HitExp", "DUT hit-exp residual X; acc ref MUL []; X_{hit} - X_{exp} [cm]", 50, 0.,
1913 50., 801, -4., 4.);
1914
1915 fhResX04ExpMC = new TH2F("hResX04ExpMC", "DUT exp-MC residual X; acc ref MUL []; X_{exp} - X_{MC} [cm]", 50, 0.,
1916 50., 801, -4., 4.);
1917
1918 fhResX04HitMC = new TH2F("hResX04HitMC", "DUT hit-MC residual X; acc ref MUL []; X_{hit} - X_{MC} [cm]", 50, 0.,
1919 50., 801, -4., 4.);
1920
1921 fhResY04HitExp = new TH2F("hResY04HitExp", "DUT hit-exp residual Y; acc ref MUL []; Y_{hit} - Y_{exp} [cm]", 50, 0.,
1922 50., 3001, -15., 15.);
1923
1924 fhResY04ExpMC = new TH2F("hResY04ExpMC", "DUT exp-MC residual Y; acc ref MUL []; Y_{exp} - Y_{MC} [cm]", 50, 0.,
1925 50., 3001, -15., 15.);
1926
1927 fhResY04HitMC = new TH2F("hResY04HitMC", "DUT hit-MC residual Y; acc ref MUL []; Y_{hit} - Y_{MC} [cm]", 50, 0.,
1928 50., 3001, -15., 15.);
1929
1930 fhResT04HitExp = new TH2F("hResT04HitExp", "DUT hit-exp residual T; acc ref MUL []; T_{hit} - T_{exp} [ns]", 50, 0.,
1931 50., 3001, -1.5, 1.5);
1932
1933 fhResT04ExpMC = new TH2F("hResT04ExpMC", "DUT exp-MC residual T; acc ref MUL []; T_{exp} - T_{MC} [ns]", 50, 0.,
1934 50., 3001, -1.5, 1.5);
1935
1936 fhResT04HitMC = new TH2F("hResT04HitMC", "DUT hit-MC residual T; acc ref MUL []; T_{hit} - T_{MC} [ns]", 50, 0.,
1937 50., 3001, -1.5, 1.5);
1938
1939 fhNTracksPerMRefHit = new TH1F("hNTracksPerMRefHit", "MRef tracks/hit; #tracks/hit []; ", 20, -0.5, 19.5);
1940
1941 fhNTracksPerSel2Hit = new TH1F("hNTracksPerSel2Hit", "Sel2 tracks/hit; #tracks/hit []; ", 20, -0.5, 19.5);
1942
1943 fhNTracksPerDutHit = new TH1F("hNTracksPerDutHit", "DUT tracks/hit; #tracks/hit []; ", 20, -0.5, 19.5);
1944
1945 fhNTracksPerSelMRefHit = new TH1F("hNTracksPerSelMRefHit", "MRef sel tracks/hit; #tracks/hit []; ", 20, -0.5, 19.5);
1946
1947 fhNTracksPerSelSel2Hit = new TH1F("hNTracksPerSelSel2Hit", "Sel2 sel tracks/hit; #tracks/hit []; ", 20, -0.5, 19.5);
1948
1949 fhNTracksPerSelDutHit = new TH1F("hNTracksPerSelDutHit", "DUT sel tracks/hit; #tracks/hit []; ", 20, -0.5, 19.5);
1950
1951
1952 fhSelTrklPurity = new TEfficiency("hSelTrklPurity", "; acc ref MUL []; Sel purity []", 50, 0., 50.);
1953
1955 new TEfficiency("hSelTrklRefTrackShare", "; acc ref MUL []; Sel ref track share []", 50, 0.5, 50.5);
1956
1958 new TH2F("hSelTrklRefTrackProcSpec", "ST 1 ref track proc/spec; ; ", 5, 0., 5., 5, 0., 5.);
1959 fhSelTrklRefTrackProcSpec->SetCanExtend(TH1::kAllAxes);
1960 fhSelTrklRefTrackProcSpec->SetStats(0);
1961
1962
1963 fhSelTrklMatchPurity = new TEfficiency("hSelTrklMatchPurity", "; acc ref MUL []; Sel match purity []", 50, 0., 50.);
1964
1966 new TH2F("hDutResX_Hit_Trk", "DUT hit-trklt residual X; acc ref MUL []; X_{hit} - X_{trklt} [cm]", 50, 0., 50.,
1967 801, -4., 4.);
1968
1969 fhDutResX_Trk_MC = new TH2F("hDutResX_Trk_MC", "DUT trklt-MC residual X; acc ref MUL []; X_{trklt} - X_{MC} [cm]",
1970 50, 0., 50., 801, -4., 4.);
1971
1972 fhDutResX_Hit_MC = new TH2F("hDutResX_Hit_MC", "DUT hit-MC residual X; acc ref MUL []; X_{hit} - X_{MC} [cm]", 50,
1973 0., 50., 801, -4., 4.);
1974
1976 new TH2F("hDutResY_Hit_Trk", "DUT hit-trklt residual Y; acc ref MUL []; Y_{hit} - Y_{trklt} [cm]", 50, 0., 50.,
1977 3001, -15., 15.);
1978
1979 fhDutResY_Trk_MC = new TH2F("hDutResY_Trk_MC", "DUT trklt-MC residual Y; acc ref MUL []; Y_{trklt} - Y_{MC} [cm]",
1980 50, 0., 50., 3001, -15., 15.);
1981
1982 fhDutResY_Hit_MC = new TH2F("hDutResY_Hit_MC", "DUT hit-MC residual Y; acc ref MUL []; Y_{hit} - Y_{MC} [cm]", 50,
1983 0., 50., 3001, -15., 15.);
1984
1986 new TH2F("hDutResT_Hit_Trk", "DUT hit-trklt residual T; acc ref MUL []; T_{hit} - T_{trklt} [ns]", 50, 0., 50.,
1987 3001, -1.5, 1.5);
1988
1989 fhDutResT_Trk_MC = new TH2F("hDutResT_Trk_MC", "DUT trklt-MC residual T; acc ref MUL []; T_{trklt} - T_{MC} [ns]",
1990 50, 0., 50., 3001, -1.5, 1.5);
1991
1992 fhDutResT_Hit_MC = new TH2F("hDutResT_Hit_MC", "DUT hit-MC residual T; acc ref MUL []; T_{hit} - T_{MC} [ns]", 50,
1993 0., 50., 3001, -1.5, 1.5);
1994
1995
1997 new TEfficiency("hSelMCTrackEfficiencyTIS", "; time in spill [s]; Sel efficiency []", TISnbins, 0., TISmax);
1998
1999 fhSelMCTrackMatchEfficiencyTIS = new TEfficiency(
2000 "hSelMCTrackMatchEfficiencyTIS", "; time in spill [s]; Sel match efficiency []", TISnbins, 0., TISmax);
2001
2002 fhSelMCTrackResidualTTIS = new TH2F("hSelMCTrackResidualTTIS", "; time in spill [s]; T_{hit} - T_{sel} [ns]",
2003 TISnbins, 0., TISmax, 301, -1.5, 1.5);
2004
2005 fhSelMCTrackDutCluSizeTIS = new TH2F("hSelMCTrackDutCluSizeTIS", "; time in spill [s]; cluster size [cells]",
2006 TISnbins, 0., TISmax, 20, 0.5, 20.5);
2007
2008
2009 fhPVResTAll = new TH2F("hPVResTAll", "PV all reco-MC residual T; acc ref MUL []; T_{reco} - T_{MC} [ns]", 50, 0.,
2010 50., 3001, -1.5, 1.5);
2011
2012 fhPVResXAll = new TH2F("hPVResXAll", "PV all reco-MC residual X; acc ref MUL []; X_{reco} - X_{MC} [cm]", 50, 0.,
2013 50., 801, -4., 4.);
2014
2015 fhPVResYAll = new TH2F("hPVResYAll", "PV all reco-MC residual Y; acc ref MUL []; Y_{reco} - Y_{MC} [cm]", 50, 0.,
2016 50., 2001, -10., 10.);
2017
2018 fhPVResTRef = new TH2F("hPVResTRef", "PV ref reco-MC residual T; acc ref MUL []; T_{reco} - T_{MC} [ns]", 50, 0.,
2019 50., 3001, -1.5, 1.5);
2020
2021 fhPVResXRef = new TH2F("hPVResXRef", "PV ref reco-MC residual X; acc ref MUL []; X_{reco} - X_{MC} [cm]", 50, 0.,
2022 50., 801, -4., 4.);
2023
2024 fhPVResYRef = new TH2F("hPVResYRef", "PV ref reco-MC residual Y; acc ref MUL []; Y_{reco} - Y_{MC} [cm]", 50, 0.,
2025 50., 2001, -10., 10.);
2026
2027
2028 fhAccRefTrackResT = new TH2F("hAccRefTrackResT",
2029 "ref track-tracklet residual T; acc ref MUL "
2030 "[]; T0_{trklt} - T_{trk} [ns]",
2031 50, 0., 50., 3001, -1.5, 1.5);
2032
2033 fhAccRefTrackResX = new TH2F("hAccRefTrackResX",
2034 "ref track-tracklet residual X; acc ref MUL "
2035 "[]; X0_{trklt} - X_{trk} [cm]",
2036 50, 0., 50., 801, -4., 4.);
2037
2038 fhAccRefTrackResY = new TH2F("hAccRefTrackResY",
2039 "ref track-tracklet residual Y; acc ref MUL "
2040 "[]; Y0_{trklt} - Y_{trk} [cm]",
2041 50, 0., 50., 2001, -10., 10.);
2042
2043 fhAccRefTrackResTx = new TH2F("hAccRefTrackResTx",
2044 "ref track-tracklet residual Tx; acc ref MUL "
2045 "[]; Tx0_{trklt} - Tx_{trk} []",
2046 50, 0., 50., 201, -1., 1.);
2047
2048 fhAccRefTrackResTy = new TH2F("hAccRefTrackResTy",
2049 "ref track-tracklet residual Ty; acc ref MUL "
2050 "[]; Ty0_{trklt} - Ty_{trk} []",
2051 50, 0., 50., 201, -1., 1.);
2052
2053 fhAccRefTrackResV = new TH2F("hAccRefTrackResV",
2054 "ref track-tracklet residual V; acc ref MUL "
2055 "[]; V0_{trklt} - V_{trk} [cm/ns]",
2056 50, 0., 50., 101, -5., 5.);
2057
2059 new TH2F("hAccRefTrackResN", "ref track-tracklet residual N; acc ref MUL []; N0_{trklt} - N_{trk} []", 50, 0.,
2060 50., 11, -5.5, 5.5);
2061
2062
2063 fhAccRefTrackShare = new TEfficiency("hAccRefTrackShare", "; acc ref MUL []; acc ref share []", 50, 0., 50.);
2064
2066 new TEfficiency("hRecRefTrackEfficiency", "; acc ref MUL []; acc ref reco eff []", 50, 0., 50.);
2067
2069 new TEfficiency("hRecRndmTrackEfficiency", "; acc ref MUL []; acc rndm reco eff []", 50, 0., 50.);
2070
2072 new TEfficiency("hRecRefTrackGhostShare", "; acc ref MUL []; acc ref ghost share []", 50, 0., 50.);
2073
2075 new TEfficiency("hRecRefTrackCloneShare", "; acc ref MUL []; acc ref clone share []", 50, 0., 50.);
2076
2078 new TEfficiency("hRecRndmTrackGhostShare", "; acc ref MUL []; acc rndm ghost share []", 50, 0., 50.);
2079
2081 new TEfficiency("hRecRndmTrackCloneShare", "; acc ref MUL []; acc rndm clone share []", 50, 0., 50.);
2082
2083 TH1* tCurrentHistogram(NULL);
2084
2085 for (auto const& CounterModuleNode : fCounterModuleNodes) {
2086 auto const& CounterID = CounterModuleNode.first;
2087
2088 Int_t iModuleType = std::get<0>(CounterID);
2089 Int_t iModuleIndex = std::get<1>(CounterID);
2090 Int_t iCounterIndex = std::get<2>(CounterID);
2091 Int_t iNCounterCells = fDigiBdfPar->GetNbChan(iModuleType, iCounterIndex);
2092
2093
2094 tCurrentHistogram =
2095 new TH2F(Form("hDomTracksProcSpec_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex),
2096 Form("%d-%d-%d dom proc/spec; ; ", iModuleType, iModuleIndex, iCounterIndex), 5, 0., 5., 5, 0., 5.);
2097 tCurrentHistogram->SetCanExtend(TH1::kAllAxes);
2098 tCurrentHistogram->SetStats(0);
2099
2100 fhDomTracksProcSpec.insert(std::make_pair(CounterID, dynamic_cast<TH2*>(tCurrentHistogram)));
2101
2102
2103 tCurrentHistogram =
2104 new TH2F(Form("hDomTracksProcMat_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex),
2105 Form("%d-%d-%d dom proc/mat; ; ", iModuleType, iModuleIndex, iCounterIndex), 5, 0., 5., 5, 0., 5.);
2106 tCurrentHistogram->SetCanExtend(TH1::kAllAxes);
2107 tCurrentHistogram->SetStats(0);
2108
2109 fhDomTracksProcMat.insert(std::make_pair(CounterID, dynamic_cast<TH2*>(tCurrentHistogram)));
2110
2111
2112 tCurrentHistogram =
2113 new TH2F(Form("hRndmTracksProcSpec_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex),
2114 Form("%d-%d-%d rndm proc/spec; ; ", iModuleType, iModuleIndex, iCounterIndex), 5, 0., 5., 5, 0., 5.);
2115 tCurrentHistogram->SetCanExtend(TH1::kAllAxes);
2116 tCurrentHistogram->SetStats(0);
2117
2118 fhRndmTracksProcSpec.insert(std::make_pair(CounterID, dynamic_cast<TH2*>(tCurrentHistogram)));
2119
2120
2121 tCurrentHistogram =
2122 new TH2F(Form("hRndmTracksProcMat_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex),
2123 Form("%d-%d-%d rndm proc/mat; ; ", iModuleType, iModuleIndex, iCounterIndex), 5, 0., 5., 5, 0., 5.);
2124 tCurrentHistogram->SetCanExtend(TH1::kAllAxes);
2125 tCurrentHistogram->SetStats(0);
2126
2127 fhRndmTracksProcMat.insert(std::make_pair(CounterID, dynamic_cast<TH2*>(tCurrentHistogram)));
2128
2129
2130 tCurrentHistogram =
2131 new TH1F(Form("hCounterAccTrackMul_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex),
2132 Form("%d-%d-%d acc mul; MUL []; ", iModuleType, iModuleIndex, iCounterIndex), 100, -0.5, 99.5);
2133
2134 fhCounterAccTrackMul.insert(std::make_pair(CounterID, tCurrentHistogram));
2135
2136
2137 tCurrentHistogram =
2138 new TH1F(Form("hCounterAccRefTrackMul_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex),
2139 Form("%d-%d-%d acc ref mul; MUL []; ", iModuleType, iModuleIndex, iCounterIndex), 50, -0.5, 49.5);
2140
2141 fhCounterAccRefTrackMul.insert(std::make_pair(CounterID, tCurrentHistogram));
2142
2143
2144 tCurrentHistogram =
2145 new TH1F(Form("hCounterAccRndmTrackMul_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex),
2146 Form("%d-%d-%d acc rndm mul; MUL []; ", iModuleType, iModuleIndex, iCounterIndex), 50, -0.5, 49.5);
2147
2148 fhCounterAccRndmTrackMul.insert(std::make_pair(CounterID, tCurrentHistogram));
2149
2150
2151 tCurrentHistogram =
2152 new TH1F(Form("hCounterAccDomTrackMul_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex),
2153 Form("%d-%d-%d acc dom mul; MUL []; ", iModuleType, iModuleIndex, iCounterIndex), 50, -0.5, 49.5);
2154
2155 fhCounterAccDomTrackMul.insert(std::make_pair(CounterID, tCurrentHistogram));
2156
2157
2158 tCurrentHistogram = new TH1F(
2159 Form("hCounterRecRefTrackEfficiencyPassed_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex),
2160 Form("%d-%d-%d acc ref reco eff; acc ref MUL []; reco efficiency []", iModuleType, iModuleIndex, iCounterIndex),
2161 50, 0., 50.);
2162
2163 fhCounterRecRefTrackEfficiencyPassed.insert(std::make_pair(CounterID, tCurrentHistogram));
2164
2165
2166 tCurrentHistogram = new TH1F(
2167 Form("hCounterRecRefTrackEfficiencyTotal_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex),
2168 Form("%d-%d-%d acc ref reco eff; acc ref MUL []; reco efficiency []", iModuleType, iModuleIndex, iCounterIndex),
2169 50, 0., 50.);
2170
2171 fhCounterRecRefTrackEfficiencyTotal.insert(std::make_pair(CounterID, tCurrentHistogram));
2172
2173
2174 tCurrentHistogram = new TH1F(
2175 Form("hCounterRecRefTrackPurityPassed_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex),
2176 Form("%d-%d-%d acc ref reco pure; acc ref MUL []; reco purity []", iModuleType, iModuleIndex, iCounterIndex),
2177 50, 0., 50.);
2178
2179 fhCounterRecRefTrackPurityPassed.insert(std::make_pair(CounterID, tCurrentHistogram));
2180
2181
2182 tCurrentHistogram = new TH2F(
2183 Form("hCounterRefTrackMulHitMul_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex),
2184 Form("%d-%d-%d acc ref mul/hit mul; acc ref MUL []; hit MUL []", iModuleType, iModuleIndex, iCounterIndex), 50,
2185 -0.5, 49.5, 30, -0.5, 29.5);
2186
2187 fhCounterRefTrackMulHitMul.insert(std::make_pair(CounterID, dynamic_cast<TH2*>(tCurrentHistogram)));
2188
2189
2190 tCurrentHistogram =
2191 new TH2F(Form("hCounterRefTrackLocalXY_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex),
2192 Form("%d-%d-%d acc ref track position; X [cm]; Y [cm]", iModuleType, iModuleIndex, iCounterIndex),
2193 2 * iNbinXY + 1, -17., 17., 2 * iNbinXY + 1, -17., 17.);
2194
2195 fhCounterRefTrackLocalXY.insert(std::make_pair(CounterID, dynamic_cast<TH2*>(tCurrentHistogram)));
2196
2197
2198 tCurrentHistogram = new TH2F(
2199 Form("hCounterRefTrackMulCell_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex),
2200 Form("%d-%d-%d cell acc ref mul; strip []; ref track MUL []", iModuleType, iModuleIndex, iCounterIndex),
2201 iNCounterCells, 0, iNCounterCells, 10, -0.5, 9.5);
2202
2203 fhCounterRefTrackMulCell.insert(std::make_pair(CounterID, dynamic_cast<TH2*>(tCurrentHistogram)));
2204 }
2205
2206
2207 fhGoodSelTypeNNPureChiSq = new TH2F(
2208 "hGoodSelTypeNNPureChiSq", "gST pure NN #chi^{2}; sel type ST []; #chi^{2}_{3} []; ", 3, 0, 3, 1000, 0., 100.);
2209
2210 fhGoodSelTypeNNAllChiSq = new TH2F(
2211 "hGoodSelTypeNNAllChiSq", "gST all NN #chi^{2}; sel type ST []; #chi^{2}_{3} []; ", 3, 0, 3, 1000, 0., 100.);
2212 }
2213
2214
2215 for (auto const& CounterModuleNode : fCounterModuleNodes) {
2216 auto const& CounterID = CounterModuleNode.first;
2217
2218 Int_t iModuleType = std::get<0>(CounterID);
2219 Int_t iModuleIndex = std::get<1>(CounterID);
2220 Int_t iCounterIndex = std::get<2>(CounterID);
2221 Int_t iNCounterCells = fDigiBdfPar->GetNbChan(iModuleType, iCounterIndex);
2222
2223 TH1* tCurrentHistogram =
2224 new TH2F(Form("hCounterHitMulCell_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex),
2225 Form("%d-%d-%d cell hit mul; strip []; hit MUL []", iModuleType, iModuleIndex, iCounterIndex),
2226 iNCounterCells, 0, iNCounterCells, 10, -0.5, 9.5);
2227
2228 fhCounterHitMulCell.insert(std::make_pair(CounterID, dynamic_cast<TH2*>(tCurrentHistogram)));
2229 }
2230
2231
2232 fhSelTrklFitRedChiSq = new TH1F("hSelTrklFitRedChiSq", "Sel trkl 3D fit #chi^{2}/4; #chi^{2}/4 []; ", 1000, 0., 10.);
2233 fhSelTrklDutHitMatchNNMul = new TH1F("hSelTrklDutHitMatchNNMul", "Sel trkl-hit match mul; MUL []; ", 30, 0.5, 30.5);
2235 new TH1F("hSelTrklDutHitMatchAccNNMul", "Sel trkl-hit match acc mul; MUL []; ", 30, 0.5, 30.5);
2236
2238 new TH1F("hSelHitTupleDutHitMatchMul", "Sel hit-hit match mul; MUL []; ", 30, 0.5, 30.5);
2240 new TH1F("hSelHitTupleDutHitMatchAccMul", "Sel hit-hit match acc mul; MUL []; ", 30, 0.5, 30.5);
2241
2242 // rate histos
2243 Double_t TRange = 600.; //in seconds
2244 Double_t NStations = 10.;
2245 if (NULL != fFindTracks) NStations = fFindTracks->GetNStations();
2246
2247 fhTrklNofHitsRate = new TH2F(Form("hTrklNofHitsRate"), Form("hTrklNofHitsRate; Time (s); NofHits "), (Int_t) TRange,
2248 0., TRange, 10, 1., 11.);
2249 fhTrklDetHitRate = new TH2F(Form("hTrklDetHitRate"), Form("hTrklDetHitRate; Time (s); DetIndx "), (Int_t) TRange, 0.,
2250 TRange, NStations, 0., NStations);
2251
2252 // spill histos
2253 Double_t TRangeSpill = 10.; //in seconds
2255 new TH2F(Form("hTrklNofHitsRateInSpill"), Form("hTrklNofHitsRateInSpill; Time (s); NofHits "),
2256 (Int_t) TRangeSpill * 10, 0., TRangeSpill, 10, 1., 11.);
2258 new TH2F(Form("hTrklDetHitRateInSpill"), Form("hTrklDetHitRateInSpill; Time (s); DetIndx "),
2259 (Int_t) TRangeSpill * 10, 0., TRangeSpill, NStations, 0., NStations);
2260
2261 if (fdMemoryTime > 0.) { // book histograms for memory effects
2262 fhLHTime.resize(iNbDet);
2263 fvLHit.resize(iNbDet);
2264 Int_t iNbins = 32; // corresponds to 2x2 cm^2 regions
2265 for (Int_t iDet = 0; iDet < iNbDet; iDet++) {
2266 fhLHTime[iDet] = new TH2D(Form("hLHTime_Det%d", iDet), Form("hLHTime_Det%d ; x (cm); y (cm) ", iDet), iNbins,
2267 -16., 16., iNbins, -16., 16.);
2268 fvLHit[iDet].resize(iNbins * iNbins);
2269 for (size_t iBin = 0; iBin < fvLHit[iDet].size(); iBin++)
2270 fvLHit[iDet][iBin] = NULL;
2271 }
2272 }
2273
2274 gDirectory->cd(oldir->GetPath()); // <= To prevent histos from being sucked in by the param file of the TRootManager!
2275
2276 return kTRUE;
2277}
2278
2279// ------------------------------------------------------------------
2281{
2282 std::set<Int_t> DutHitSet;
2283
2284 for (Int_t iHitInd = 0; iHitInd < fTofHitsColl->GetEntriesFast(); iHitInd++) {
2285 CbmTofHit* pHit = (CbmTofHit*) fTofHitsColl->At(iHitInd);
2286 Int_t iDetId = (pHit->GetAddress() & DetMask);
2287
2288 if (fiDutAddr == iDetId) { DutHitSet.emplace(iHitInd); }
2289 }
2290
2291
2293 if (fbTracksInInputFile) {
2294 fiNAccRefTracks = 0;
2295
2296 TGeoNode* tNode(NULL);
2297 TGeoMedium* tMedium(NULL);
2298 TGeoMaterial* tMaterial(NULL);
2299
2300 const char* cMaterialName;
2301
2302 fhAccTrackMul->Fill(fAccTracks->GetEntriesFast());
2303
2304 // Determine the number of reference tracks in the reconstructed event
2305 // as a function of which several QA observables are studied. A reference
2306 // track must originate from the target (not necessarily from the primary
2307 // vertex) and intersect the active planes of at least 'fiMinMCRefTrackPoints'
2308 // different counters.
2309 Int_t iNAccPrimTracks(0);
2310
2311 for (Int_t iTrack = 0; iTrack < fAccTracks->GetEntriesFast(); iTrack++) {
2312 CbmMCTrack* tAccTrack = dynamic_cast<CbmMCTrack*>(fAccTracks->At(iTrack));
2313 CbmMatch* tAccTrackPointMatch = dynamic_cast<CbmMatch*>(fTofAccTrackPointMatches->At(iTrack));
2314
2315 tNode = gGeoManager->FindNode(tAccTrack->GetStartX(), tAccTrack->GetStartY(), tAccTrack->GetStartZ());
2316 tMedium = tNode->GetMedium();
2317 tMaterial = tMedium->GetMaterial();
2318
2319 GetMaterialName(tMaterial->GetName(), cMaterialName);
2320
2321 if (0 == std::strcmp("target", cMaterialName)) {
2322 iNAccPrimTracks++;
2323
2325 }
2326 }
2327
2329 fhAccPrimTrackMul->Fill(iNAccPrimTracks);
2330 }
2331 }
2332
2333
2334 // Constants, TODO => put as parameter !!!
2335
2336 // Declare variables outside the loop
2337 CbmTofHit* pHit;
2338 CbmTofHit* pLHit;
2339 CbmTofHit* pHit1;
2340 CbmTofHit* pHit2;
2341 CbmTofHit* pHit3;
2342 CbmTofHit* pHit4;
2343 CbmTofHit* pHitRef = NULL; // May be used uninitialized later, to check!
2344 CbmTofHit* pHitSel2 = NULL;
2345 CbmTofHit* pDia;
2346 CbmTofCell* fChannelInfo1;
2347 CbmTofCell* fChannelInfo2;
2348 CbmTofCell* fChannelInfo3;
2349 CbmTofCell* fChannelInfo4;
2350
2351 Int_t iBRefHitInd(-1);
2352 Int_t iMRefHitInd(-1);
2353 Int_t iSel2HitInd(-1);
2354 CbmTrackMatchNew tSelHitTupleTrackMatch;
2355 Bool_t bGoodTrackSel(kFALSE);
2356
2357 // Trb System
2358 if (NULL != fTrbHeader) {
2359 if (fiReqTrg > -1)
2360 if (!fTrbHeader->TriggerFired(fiReqTrg)) return kFALSE;
2361 UInt_t uTriggerPattern = fTrbHeader->GetTriggerPattern();
2362 for (UInt_t uChannel = 0; uChannel < 16; uChannel++) {
2363 if (uTriggerPattern & (0x1 << uChannel)) { fhTriggerPattern->Fill(uChannel); }
2364 }
2367 }
2368
2369
2370 /* Int_t iNbTofDigis;*/
2371 Int_t iNbTofHits, iNbTofTracks;
2372
2373 // iNbTofDigis = fTofDigisColl->GetEntriesFast();
2374 iNbTofHits = fTofHitsColl->GetEntriesFast();
2375
2376 /*
2377 LOG(info)<<Form("CbmTofAnaTestbeam::FillHistos for %d digis and %d Tof hits",iNbTofDigis,iNbTofHits)
2378 ;
2379 */
2380 // Digis info
2381 /*
2382 Double_t dTotalDataSize = 0;
2383 if( kTRUE == fDigiBdfPar->UseExpandedDigi() )
2384 {
2385 CbmTofDigiExp *pDigi;
2386 for( Int_t iDigInd = 0; iDigInd < iNbTofDigis; iDigInd++ )
2387 {
2388 pDigi = (CbmTofDigiExp*) fTofDigisColl->At( iDigInd );
2389
2390 Int_t iSmType = pDigi->GetType();
2391 Int_t iSm = pDigi->GetSm();
2392 Int_t iRpc = pDigi->GetRpc();
2393 Int_t iCh = pDigi->GetChannel();
2394
2395 } // for( Int_t iDigInd = 0; iDigInd < iNbTofDigis; iDigInd++ )
2396 } // if( kTRUE == fDigiBdfPar->UseExpandedDigi() )
2397 */
2398 // Hits info
2399 Int_t iNbMatchedHits = 0;
2400 Int_t iNbMaxMatch = 500;
2401 // Double_t Zref=300.;
2402 /* Double_t Chi2MatchMin=1.E8;*/
2403 Double_t Chi2List[iNbMaxMatch];
2404 CbmTofHit* pChi2Hit1[iNbMaxMatch];
2405 CbmTofHit* pChi2Hit2[iNbMaxMatch];
2406 Chi2List[0] = 1.E8;
2407 pChi2Hit1[0] = NULL;
2408 pChi2Hit2[0] = NULL;
2409 pDia = NULL;
2410 Int_t iNSel = 1;
2411 Bool_t BSel[iNSel];
2412 for (Int_t iSel = 0; iSel < iNSel; iSel++) {
2413 BSel[iSel] = kFALSE;
2414 }
2415 Double_t dDTD4 = 0.;
2416 dTDia = 1.E300;
2417 dDTD4Min = 1.E300;
2418 Double_t dMul0 = 0.;
2419 Double_t dMul4 = 0.;
2420 Double_t dMulS2 = 0.;
2421 Double_t dStrMul0 = 0.;
2422 Double_t dStrMul4 = 0.;
2423 Double_t dMulD = 0.;
2424 Double_t dM4Max = 1; // modify
2425 if (fdMul4Max > 0) dM4Max = fdMul4Max;
2426 Double_t dM0Max = 100; // modify
2427 if (fdMul0Max > 0) dM0Max = fdMul0Max;
2428 Double_t dMDMax = 1;
2429 if (fdMulDMax > 0) dMDMax = fdMulDMax;
2430 Double_t hitpos1[3], hitpos2[3], hitpos3[3], hitpos4[3];
2431 Double_t hitpos1_local[3], hitpos2_local[3], hitpos3_local[3], hitpos4_local[3];
2432 std::vector<CbmTofHit*> vDiaHit;
2433 Double_t DDiaAvLim = 0.2; // average width for fastest diamond hits in ns
2434 Double_t dMulDAv = 0;
2435 Double_t dTAv = 0.;
2436 Double_t dMAv = 0.;
2437 fDetIdMap.clear();
2438
2439
2440 if (fiBeamRefAddr == 0x00055056) // determine reference time from earliest hits (25%)
2441 {
2442 //fTofHitsColl->Sort(); //not sortable!
2443 Int_t iBeamRefMul = iNbTofHits / 4;
2444 if (iBeamRefMul > 0) {
2445 pHit = (CbmTofHit*) fTofHitsColl->At(iNbTofHits - 1);
2446 Int_t iDetId = (pHit->GetAddress() & DetMask);
2447 if (iDetId == fiBeamRefAddr) {
2448 dMulD = (Double_t) iBeamRefMul;
2449 pDia = pHit;
2450 iBRefHitInd = iNbTofHits - 1;
2451 dTDia = pDia->GetTime();
2452 dTAv = dTDia;
2453 dMAv = 1.;
2454 }
2455 else {
2456 dTDia = 0.;
2457 Double_t vdTimes[iBeamRefMul];
2458 Int_t iLast = 0;
2459 vdTimes[iLast] = 1.E300;
2460 for (Int_t iHitInd = 0; iHitInd < iNbTofHits; iHitInd++) {
2461 pHit = (CbmTofHit*) fTofHitsColl->At(iHitInd);
2462 if (NULL == pHit) continue;
2463 iDetId = (pHit->GetAddress() & DetMask);
2464 if (iDetId != fiDutAddr) {
2465 if (pHit->GetTime() < vdTimes[iLast]) { // insert or replace
2466 if (iLast < iBeamRefMul) { iLast++; }
2467 Int_t iT;
2468 for (iT = 0; iT < iLast; iT++)
2469 if (pHit->GetTime() < vdTimes[iT]) break;
2470 for (Int_t iL = iLast; iL > iT; iL--)
2471 vdTimes[iL] = vdTimes[iL - 1];
2472 vdTimes[iT] = pHit->GetTime();
2473 }
2474 }
2475 }
2476 /*
2477 LOG(info)<<Form("Sorted %d hits of %d (%d): ", iLast, iBeamRefMul, iNbTofHits);
2478 for(Int_t iT=0; iT<iLast; iT++) LOG(info)<<Form(" %7.2f",vdTimes[iT]);
2479 LOG(info);
2480 */
2481 for (Int_t iHit = 0; iHit < iLast; iHit++) {
2482 dTDia += vdTimes[iHit];
2483 }
2484 dTDia /= (Double_t) iLast;
2485 dMulD = (Double_t) iLast;
2486 Double_t hitPos[3] = {3 * 0.};
2487 Double_t hitPosErr[3] = {3 * 1.};
2488 pDia = new CbmTofHit(fiBeamRefAddr, hitPos,
2489 hitPosErr, //local detector coordinates
2490 iNbTofHits, // this number is used as reference!!
2491 dTDia,
2492 0, // number of linked digis = 2*CluSize
2493 10); //channel -> Tot
2494 new ((*fTofHitsColl)[iNbTofHits]) CbmTofHit(*pDia); // insert fake hit into TClonesarray
2495 dTAv = dTDia;
2496 dMAv = 1.;
2497 pDia->Delete();
2498 pDia = (CbmTofHit*) fTofHitsColl->At(iNbTofHits);
2499 iBRefHitInd = iNbTofHits;
2500 iNbTofHits++;
2501 }
2502 }
2503 }
2504 else
2505 // find diamond reference (BRef)
2506 for (Int_t iHitInd = 0; iHitInd < iNbTofHits; iHitInd++) {
2507 pHit = (CbmTofHit*) fTofHitsColl->At(iHitInd);
2508 if (NULL == pHit) continue;
2509 Int_t iDetId = (pHit->GetAddress() & DetMask);
2510 dTAv += pHit->GetTime();
2511 dMAv += 1.;
2512
2513 std::map<UInt_t, UInt_t>::iterator it = fDetIdMap.find(iDetId);
2514 if (it == fDetIdMap.end()) fDetIdMap[iDetId] = fDetIdMap.size();
2515
2516 /*
2517 Int_t iChId = pHit->GetAddress();
2518 fChannelInfo = fDigiPar->GetCell( iChId );
2519 Int_t iSmType=CbmTofAddress::GetSmType( iDetId );
2520
2521 if(NULL == fChannelInfo){
2522 LOG(debug) << Form("CbmTofAnaTestbeam::FillHistos: NULL Channel Pointer for ChId 0x%08x ",iChId)
2523 ;
2524 continue;
2525 }
2526 */
2527 /*
2528 LOG(debug) << Form(" BRef 0x%08x == 0x%08x ? ",iDetId,fiBeamRefAddr)
2529 ;
2530 */
2531 if (iDetId == fiBeamRefAddr) { // diamond hit (or other reference counter)
2532 dMulD++;
2533 vDiaHit.resize(dMulD);
2534 vDiaHit[dMulD - 1] = pHit;
2535 if (pHit->GetTime() < dTDia) {
2536 dTDia = pHit->GetTime();
2537 pDia = pHit;
2538 iBRefHitInd = iHitInd;
2539 }
2540 }
2541 if (dMulD > 0) { // average fastest channels
2542 dMulDAv = 1;
2543 for (Int_t iDiaHit = 0; iDiaHit < dMulD; iDiaHit++) {
2544 if (vDiaHit[iDiaHit] != pDia) { //additional hit found
2545 if (TMath::Abs(vDiaHit[iDiaHit]->GetTime() - dTDia) < DDiaAvLim) {
2546 dTDia = (dTDia * dMulDAv + vDiaHit[iDiaHit]->GetTime()) / (dMulDAv + 1);
2547 dMulDAv++;
2548 }
2549 }
2550 }
2551 }
2552 } // reaction reference search loop end;
2553 fhBRefMul->Fill(dMulD);
2554 LOG(debug) << Form("Diamond mul %3.0f, mulAv %3.0f, time: %6.2e", dMulD, dMulDAv, dTDia)
2555 << Form(", inspect Dut 0x%08x, Ref 0x%08x, Sel2 0x%08x, Sel3 0x%08x ", fiDutAddr, fiMrpcRefAddr,
2557 dTAv /= dMAv; //use any hit
2558
2559 if (iNbTofHits > 5) { // FIXME hard wired constant in code
2560 if (StartAnalysisTime == 0.) {
2561 StartAnalysisTime = dTAv;
2562 dTLEvt = dTAv;
2563 LOG(info) << "StartAnalysisTime from TAv set to " << StartAnalysisTime << " ns. ";
2564 } // process counter hits, fill Chi2List, check selector
2565 }
2566
2567 vector<CbmTofHit*> vDutHit;
2568 vector<CbmTofHit*> vRefHit;
2569
2570 iNbTofHits = fTofHitsColl->GetEntriesFast();
2571 for (Int_t iHitInd = 0; iHitInd < iNbTofHits; iHitInd++) {
2572 pHit = (CbmTofHit*) fTofHitsColl->At(iHitInd);
2573 if (NULL == pHit) continue;
2574 Int_t iDetId = (pHit->GetAddress() & DetMask);
2575 Int_t iChId = pHit->GetAddress();
2576 fChannelInfo = fDigiPar->GetCell(iChId);
2577 // Int_t iSmType = CbmTofAddress::GetSmType( iDetId ); (VF) not used
2578 Int_t iDetInd = fDigiBdfPar->GetDetInd(iDetId); //fMbsMappingPar->GetMappedDetInd( pHit->GetAddress());
2579 LOG(debug) << Form("process %d.(%d) Tof hit 0x%08x, Ind %d, x = %6.1f, y = "
2580 "%6.1f, z=%6.1f, t=%10.1f",
2581 iHitInd, iNbTofHits, iChId, iDetInd, pHit->GetX(), pHit->GetY(), pHit->GetZ(), pHit->GetTime());
2582
2583 if (NULL == fChannelInfo) {
2584 LOG(debug) << "NULL Channel Pointer for ChId " << Form(" 0x%08x ", iChId);
2585 if (iDetId != fiBeamRefAddr) continue; // exception for software reference
2586 }
2587
2588 if (static_cast<UInt_t>(iDetInd) < fhXYPos.size()) fhXYPos[iDetInd]->Fill(pHit->GetX(), pHit->GetY());
2589
2590 Double_t dPhi = TMath::ATan2(pHit->GetY(), pHit->GetX()) * 180.0 / TMath::Pi();
2591 Double_t dTheta =
2592 TMath::ATan(TMath::Sqrt(pHit->GetX() * pHit->GetX() + pHit->GetY() * pHit->GetY()) / pHit->GetZ());
2593 Double_t dEta = -TMath::Log(TMath::Tan(dTheta * 0.5));
2594 //LOG(info) << "x,y,z->phi: "<< dPhi <<", "<<dTheta<<", "<<dEta;
2595 dPhi += 90.; // FIXME, just for STAR2018
2596 dPhi *= -1.;
2597 fhEtaPhi->Fill(dPhi, dEta);
2598
2599 LOG(debug2) << "process iDetId " << Form(" 0x%08x ", iDetId)
2600 << Form(", Muls %4.0f, %4.0f, %4.0f", dMulD, dMul0, dMul4);
2601
2602
2603 if (fiDutAddr == iDetId) { // Process Dut
2604 dMul0++;
2605 vDutHit.push_back(pHit);
2606
2607 CbmMatch* digiMatch = (CbmMatch*) fTofDigiMatchColl->At(fTofHitsColl->IndexOf(pHit));
2608 dStrMul0 += digiMatch->GetNofLinks() / 2.;
2609 //Double_t xPos1=Zref/pHit->GetZ()*pHit->GetX();
2610 //Double_t yPos1=Zref/pHit->GetZ()*pHit->GetY();
2611 Double_t xPos1 = pHit->GetX();
2612 Double_t yPos1 = pHit->GetY();
2613 Double_t zPos1 = pHit->GetZ();
2614 Double_t tof1 = pHit->GetTime();
2615 Double_t dzscal = 1.;
2616
2617 for (Int_t iHitInd2 = 0; iHitInd2 < iNbTofHits; iHitInd2++) {
2618 if (iHitInd2 != iHitInd) {
2619 pHit2 = (CbmTofHit*) fTofHitsColl->At(iHitInd2);
2620 if (NULL == pHit2) continue;
2621
2622 Int_t iDetId2 = (pHit2->GetAddress() & DetMask);
2623 Int_t iChId2 = pHit2->GetAddress();
2624 fChannelInfo2 = fDigiPar->GetCell(iChId2);
2625
2626 if (fiMrpcRefAddr == iDetId2
2627 /*
2628 fiMrpcRef == CbmTofAddress::GetSmType( iDetId2 )
2629 && fiMrpcRefSm == CbmTofAddress::GetSmId( iDetId2 )
2630 && fiMrpcRefRpc == CbmTofAddress::GetRpcId( iDetId2 )
2631 */
2632 ) { // Dut - MrpcRef
2633
2634 if (fEnableMatchPosScaling) dzscal = zPos1 / pHit2->GetZ();
2635
2636 Double_t xPos2 = dzscal * pHit2->GetX();
2637 Double_t yPos2 = dzscal * pHit2->GetY();
2638 Double_t tof2 = pHit2->GetTime();
2639 Double_t dTcor = 0.;
2640 if (fhDTD4DT04D4Off != NULL)
2641 dTcor = (Double_t) fhDTD4DT04D4Off->GetBinContent(fhDTD4DT04D4Off->FindBin(dTDia - tof2 - fdTShift));
2642
2643 Double_t Chi2Match = TMath::Power((xPos1 - xPos2 - fdDXMean) / GetSigX(0), 2.)
2644 + TMath::Power((yPos1 - yPos2 - fdDYMean) / GetSigY(0), 2.)
2645 + TMath::Power((tof1 - tof2 - dTcor - fdDTMean) / GetSigT(0), 2.);
2646 if (Chi2Match > 1.E8) continue;
2647 Chi2Match /= 3;
2648
2649 LOG(debug2) << " Chi2 "
2650 << Form(" %f %f %f %f %f %f ", fdDXMean, GetSigX(0), fdDYMean, GetSigY(0), fdDTMean, GetSigT(0))
2651 << Form(" -> %f ", Chi2Match);
2652 LOG(debug2) << " Chi2 " << Form(" %f %f %f %f %f %f ", xPos1, xPos2, yPos1, yPos2, tof1, tof2)
2653 << Form(" -> %f ", Chi2Match);
2654
2655 iNbMatchedHits++; // count Dut - Ref matches
2656 if (iNbMatchedHits == iNbMaxMatch) iNbMatchedHits = iNbMaxMatch - 1; //prevent array overflow
2657 LOG(debug) << Form("match %d (%f): %2d. - %2d. Tof hit 0x%08x "
2658 "with 0x%08x, DeltaT = %f ns",
2659 iNbMatchedHits, Chi2Match, iHitInd, iHitInd2, iChId2, iChId,
2660 tof1 - tof2 - dTcor - fdDTMean);
2661
2662 fhDXDY04->Fill(xPos1 - xPos2, yPos1 - yPos2);
2663 fhDXDT04->Fill(xPos1 - xPos2, tof1 - tof2 - dTcor - fdDTMean);
2664 fhDYDT04->Fill(yPos1 - yPos2, tof1 - tof2 - dTcor - fdDTMean);
2665 fhChi04->Fill(Chi2Match);
2666
2667 for (Int_t iM = 0; iM < iNbMatchedHits; iM++) {
2668 if (Chi2Match < Chi2List[iM]) {
2669
2670 LOG(debug) << Form(" fill Chi2 %3d (%3d), %12.1f, %12.1f: "
2671 "HitInd %3d, %3d, Ids 0x%08x, 0x%08x",
2672 iM, iNbMatchedHits, Chi2Match, Chi2List[iM], iHitInd, iHitInd2, iChId, iChId2);
2673
2674 for (Int_t iMM = iNbMatchedHits; iMM >= iM; iMM--) {
2675 Chi2List[iMM] = Chi2List[iMM - 1];
2676 pChi2Hit1[iMM] = pChi2Hit1[iMM - 1];
2677 pChi2Hit2[iMM] = pChi2Hit2[iMM - 1];
2678 }
2679
2680 Chi2List[iM] = Chi2Match;
2681 pChi2Hit1[iM] = pHit;
2682 pChi2Hit2[iM] = pHit2;
2683 Chi2List[iNbMatchedHits] = 1.E8;
2684 if (iM > 0) {
2685 if (Chi2Match == Chi2List[iM - 1]) {
2686 LOG(debug) << Form("same Chi2?: M %d, Mul0 %3.0f, HitInd "
2687 "%d, %d, Ids 0x%p, 0x%p - 0x%p, 0x%p",
2688 iM, dMul0, iHitInd, iHitInd2, pHit, pHit2, pChi2Hit1[iM - 1], pChi2Hit2[iM - 1]);
2689 LOG(debug) << pHit->ToString();
2690 LOG(debug) << pChi2Hit1[iM - 1]->ToString();
2691 LOG(debug) << pHit2->ToString();
2692 }
2693 }
2694 break;
2695 }
2696 }
2697 } //fiMrpcRef condition end
2698 if (2 == CbmTofAddress::GetSmType(iDetId2)) { // Plastic
2699 Int_t iSm = CbmTofAddress::GetSmId(iDetId2);
2700 if (iSm < 2) {
2701 fhXX02[iSm]->Fill(pHit->GetX(), dzscal * pHit2->GetX());
2702 fhYY02[iSm]->Fill(pHit->GetY(), dzscal * pHit2->GetY());
2703 }
2704 }
2705 } //iHit2 != iHit condition end
2706 } // iHit2 loop end
2707 } // fiDut condition end
2708
2709 if (fiMrpcRefAddr == iDetId) {
2710 dMul4++;
2711 vRefHit.push_back(pHit);
2712 CbmMatch* digiMatch = (CbmMatch*) fTofDigiMatchColl->At(fTofHitsColl->IndexOf(pHit));
2713 dStrMul4 += digiMatch->GetNofLinks() / 2.;
2714 }
2715
2716 if (fiMrpcSel2Addr == iDetId) { dMulS2++; }
2717
2718 if (fiBeamRefAddr == iDetId) { // process beam Ref hit
2719 LOG(debug2) << "Process BeamRef Hit with " << pHit << ", " << pDia;
2720 if (pHit != pDia) continue;
2721 if (fdDTDia > 0.) {
2722 Double_t dDDia = 0.;
2723 for (Int_t iHitInd1 = 0; iHitInd1 < iNbTofHits; iHitInd1++)
2724 if (iHitInd1 != iHitInd) {
2725 pHit1 = (CbmTofHit*) fTofHitsColl->At(iHitInd1);
2726 if (pHit1 == NULL) continue;
2727 Int_t iDetId1 = (pHit1->GetAddress() & DetMask);
2728 Int_t iChId1 = pHit1->GetAddress();
2729 fChannelInfo1 = fDigiPar->GetCell(iChId1);
2730 pHit1 = (CbmTofHit*) fTofHitsColl->At(iHitInd1);
2732 && TMath::Abs(pHit1->GetTime() - dTDia) < fdDTDia) { // second diamond fired
2733 dDDia = pHit1->GetTime() - dTDia;
2734 }
2735 }
2736 LOG(debug) << Form("DDia %f", dDDia);
2737 if (dDDia == 0.) continue;
2738 } // 2 diamond condition end
2739
2740 Double_t zPos1 = pHit->GetZ();
2741 for (Int_t iHitInd2 = 0; iHitInd2 < iNbTofHits; iHitInd2++)
2742 if (iHitInd2 != iHitInd) {
2743 pHit2 = (CbmTofHit*) fTofHitsColl->At(iHitInd2);
2744 if (pHit2 == NULL) continue;
2745
2746 Int_t iDetId2 = (pHit2->GetAddress() & DetMask);
2747 Int_t iChId2 = pHit2->GetAddress();
2748 fChannelInfo2 = fDigiPar->GetCell(iChId2);
2749 if (NULL == fChannelInfo2) {
2750 LOG(debug) << "Invalid Channel Pointer for ChId2 " << Form(" 0x%08x ", iChId2);
2751 continue;
2752 }
2753 LOG(debug2) << Form("TDia %f, THit %f", dTDia, pHit2->GetTime());
2754
2755 if (fiMrpcRefAddr == iDetId2 // Beam - Ref coincidence
2756 ) { // Reference RPC hit
2757 dDTD4 = pHit2->GetTime() - dTDia + fdTShift;
2758 fhDTD4->Fill(dDTD4);
2759
2760 LOG(debug) << Form("dDTD4 %8.4e, min: %8.4e", dDTD4, dDTD4Min);
2761
2762 if (TMath::Abs(dDTD4) < fdDTD4MAX && // single selection scheme, selector 0
2763 TMath::Abs(CbmTofAddress::GetChannelId(iChId2) - fdCh4Sel) < fdDCh4Sel) {
2764 LOG(debug1) << Form("Valid Mrpc hit 0x%08x", iChId2);
2765 /*TGeoNode *fNode=*/ // prepare global->local trafo
2766 gGeoManager->FindNode(fChannelInfo2->GetX(), fChannelInfo2->GetY(), fChannelInfo2->GetZ());
2767 Double_t hitpos[3], hitpos_local[3];
2768 hitpos[0] = pHit2->GetX();
2769 hitpos[1] = pHit2->GetY();
2770 hitpos[2] = pHit2->GetZ();
2771 /*TGeoNode* cNode=*/gGeoManager->GetCurrentNode();
2772 gGeoManager->MasterToLocal(hitpos, hitpos_local);
2773 if (TMath::Abs(hitpos_local[1] - fdPosY4SelOff) < fdPosY4Sel * fChannelInfo2->GetSizey()
2774 && TMath::Abs(dDTD4) < TMath::Abs(dDTD4Min)) {
2775 BSel[0] = kFALSE; // invalidate previous matches
2776 dDTD4Min = dDTD4;
2777 pHitRef = pHit2;
2778 iMRefHitInd = iHitInd2;
2779 fChannelInfoRef = fChannelInfo2;
2780 LOG(debug1) << Form("accept Mrpc, look for Sel2 %d, 0x%08x", fiMrpcSel2, fiMrpcSel2Addr);
2781 if (fiMrpcSel2 < 0) { // assume Mrpctype to be initialized to -1
2782 BSel[0] = kTRUE;
2783 }
2784 else { // request presence of coincident fiMrpcSel2 hit!
2785 Double_t dzscal = 1.;
2786 Double_t xPos2 = pHit2->GetX();
2787 Double_t yPos2 = pHit2->GetY();
2788 Double_t zPos2 = pHit2->GetZ();
2789 Double_t tof2 = pHit2->GetTime();
2790 Double_t dTcor = 0.;
2791 Double_t xPos3B = 0.;
2792 Double_t yPos3B = 0.;
2793 Double_t tof3B = 0.;
2794 // if(fhDTD4DT04D4Off != NULL)
2795 // dTcor=(Double_t)fhDTD4DT04D4Off->GetBinContent(fhDTD4DT04D4Off->FindBin(dTDia-tof2));
2796
2797 Double_t Chi2Max = fdChi2Lim2;
2798 pHitSel2 = NULL;
2799
2800 for (Int_t iHitInd3 = 0; iHitInd3 < iNbTofHits; iHitInd3++) {
2801 LOG(debug2) << Form("inspect %d. Sel2, Ind %d, Ind2 %d ", iHitInd3, iHitInd, iHitInd2);
2802
2803 //if(iHitInd3 != iHitInd && iHitInd3 != iHitInd2)
2804 if (iHitInd3 != iHitInd2) {
2805 pHit3 = (CbmTofHit*) fTofHitsColl->At(iHitInd3);
2806 if (pHit3 == NULL) continue;
2807 Int_t iDetId3 = (pHit3->GetAddress() & DetMask);
2808 Int_t iChId3 = pHit3->GetAddress();
2809 fChannelInfo3 = fDigiPar->GetCell(iChId3);
2810 if (NULL == fChannelInfo3) {
2811 LOG(debug) << "Invalid Channel Pointer for ChId3 " << Form(" 0x%08x ", iChId3);
2812 continue;
2813 }
2814 LOG(debug2) << Form("inspect %d. Sel2 0x%08x", iHitInd3, iDetId3);
2815
2816 if (fiMrpcSel2Addr == iDetId3) { //CbmTofAddress::GetSmType( iDetId3 )){ // Sel2 RPC hit
2817 LOG(debug1) << Form("found Sel2 0x%08x, z-info: %7.1f, %7.1f", fiMrpcSel2Addr, dzscal, zPos1);
2818 if (TMath::Abs(CbmTofAddress::GetChannelId(iChId3) - fdChS2Sel) < fdDChS2Sel) {
2819 /*TGeoNode *fNode3= */ // prepare global->local trafo
2820 gGeoManager->FindNode(fChannelInfo3->GetX(), fChannelInfo3->GetY(), fChannelInfo3->GetZ());
2821 hitpos3[0] = pHit3->GetX();
2822 hitpos3[1] = pHit3->GetY();
2823 hitpos3[2] = pHit3->GetZ();
2824 /*TGeoNode* cNode3=*/gGeoManager->GetCurrentNode();
2825 gGeoManager->MasterToLocal(hitpos3, hitpos3_local);
2826 if (TMath::Abs(hitpos3_local[1] - fdPosYS2SelOff) < fdPosYS2Sel * fChannelInfo3->GetSizey()) {
2827 if (fEnableMatchPosScaling) dzscal = zPos2 / pHit3->GetZ();
2828 Double_t xPos3 = dzscal * pHit3->GetX();
2829 Double_t yPos3 = dzscal * pHit3->GetY();
2830 Double_t tof3 = pHit3->GetTime();
2831
2832 Double_t Chi2Match = TMath::Power((xPos3 - xPos2) / GetSHTSigX(), 2.)
2833 + TMath::Power((yPos3 - yPos2) / GetSHTSigY(), 2.)
2834 + TMath::Power((tof3 - tof2 - dTcor - fdSel2TOff) / GetSHTSigT(), 2.);
2835
2836 Chi2Match /= 3;
2837 LOG(debug1) << Form("valid Sel2 0x%08x with Chi2 %7.1f, "
2838 "%7.1f, %7.1f, %7.1f, %7.1f, %7.1f",
2839 fiMrpcSel2Addr, Chi2Match, Chi2Max, dzscal, xPos3, yPos3, tof3);
2840
2841 if (Chi2Match < Chi2Max) {
2842 xPos3B = xPos3;
2843 yPos3B = yPos3;
2844 tof3B = tof3;
2845 Chi2Max = Chi2Match;
2846 BSel[0] = kTRUE;
2847 pHitSel2 = pHit3;
2848 iSel2HitInd = iHitInd3;
2849 fChannelInfoSel2 = fChannelInfo3;
2850 LOG(debug) << Form("better Sel2 0x%08x with Chi2 %7.1f, x %7.1f, "
2851 "Deltax %7.1f, y %7.1f, Deltay %7.1f",
2852 fiMrpcSel2Addr, Chi2Max, xPos3B, xPos3B - xPos2, yPos3B,
2853 yPos3B - yPos2);
2854 }
2855 }
2856 }
2857 }
2858 }
2859 } // loop over third hit end
2860
2861
2862 if (BSel[0]) {
2863 fhChiSel24->Fill(Chi2Max);
2864 fhDXSel24->Fill(xPos3B - xPos2);
2865 fhDYSel24->Fill(yPos3B - yPos2);
2866 fhDTSel24->Fill(tof3B - tof2 - dTcor - fdSel2TOff);
2867 fhTofSel24->Fill(tof3B - tof2 - fdSel2TOff);
2868 }
2869 }
2870 }
2871 }
2872 }
2873 } //LOG(info)<<" TDia="<<dTDia;
2874 } // diamond condition end
2875 } // for( Int_t iHitInd = 0; iHitInd < iNbTofHits; iHitInd++)
2876
2877
2878 /*
2879 if( dMulD>0 && dMul4>0 && dMul0>0 && dTDia - fdStartSpillTime > SpillDuration*1.E9 ) {
2880 Double_t dDTSpill=dTDia-fdStartSpillTime;
2881 fdStartSpillTime=dTDia;
2882 */
2883 if (fdSpillBreak == 0.) fdStartSpillTime = dTAv;
2884
2885 Double_t dDTSpill = dTAv - fdStartSpillTime;
2886 if (fDetIdMap.size() > 3 && dMulD > 0) { // FIXME - hardwired constants
2887 Double_t dDTLEvt = dTAv - dTLEvt;
2888 dTLEvt = dTAv;
2889 if (dDTLEvt > fdSpillBreak * 1.E9 && dDTSpill > fdSpillDuration * 1.E9) {
2890 fdStartSpillTime = dTAv;
2891 iNspills++;
2892 LOG(info) << "StartSpillTime for " << iNspills
2893 << Form(". spill set to %f ns after %7.4f s, at event %d with "
2894 "MulD %2.0f, MulDet %d, DTLE %7.4f s ",
2895 fdStartSpillTime, dDTSpill / 1.E9, fEvents, dMulD, (Int_t) fDetIdMap.size(), dDTLEvt / 1.E9);
2896 }
2897 }
2898 Double_t dTIR = (dTAv - StartAnalysisTime) / 1.E9;
2899 fhRate_all->Fill(dTIR, 1. / fhRate_all->GetBinWidth(1));
2900 if (fdStartSpillTime < 0) {
2901 LOG(debug) << "SpillStartTime not available, abort Anatestbeam ";
2902 return kFALSE;
2903 }
2904 // if(dMul4>dM4Max || dMulD>dMDMax || dMul0>dM0Max)
2905 if (dMul0 > dM0Max || dMul4 > dM4Max || dMulD > dMDMax || dMulS2 > dM4Max) {
2906 BSel[0] = kFALSE;
2907 LOG(debug) << Form("<D> Muls %4.0f, %4.0f, %4.0f, %4.0f, Matches %d", dMulD, dMul0, dMul4, dMulS2, iNbMatchedHits);
2908 }
2909
2910 // Determine average event quantities
2911
2912 Double_t dDutTMean = 0.;
2913 Double_t dDutTMean2 = 0.;
2914 Int_t iNDutHits = vDutHit.size();
2915 for (Int_t i = 0; i < iNDutHits; i++) { // loop over Dut Hits
2916 dDutTMean += vDutHit[i]->GetTime();
2917 dDutTMean2 += vDutHit[i]->GetTime() * vDutHit[i]->GetTime();
2918 }
2919 dDutTMean /= (Double_t) vDutHit.size();
2920 dDutTMean2 /= (Double_t) vDutHit.size();
2921 Double_t dDutTSig = TMath::Sqrt(dDutTMean2 - dDutTMean * dDutTMean);
2922
2923 Double_t dRefTMean = 0.;
2924 Double_t dRefTMean2 = 0.;
2925 Int_t iNRefHits = vRefHit.size();
2926 for (Int_t i = 0; i < iNRefHits; i++) { // loop over Ref Hits
2927 dRefTMean += vRefHit[i]->GetTime();
2928 dRefTMean2 += vRefHit[i]->GetTime() * vRefHit[i]->GetTime();
2929 }
2930 dRefTMean /= (Double_t) vRefHit.size();
2931 dRefTMean2 /= (Double_t) vRefHit.size();
2932 Double_t dRefTSig = TMath::Sqrt(dRefTMean2 - dRefTMean * dRefTMean);
2933
2934 // histogram distances
2935 for (Int_t i = 0; i < iNDutHits - 1; i++) { // loop over Dut Hits
2936 for (Int_t j = i + 1; j < iNDutHits; j++) { // loop over Dut Hits
2937 fhDutDXDYDT->Fill(vDutHit[j]->GetX() - vDutHit[i]->GetX(), vDutHit[j]->GetY() - vDutHit[i]->GetY(),
2938 vDutHit[j]->GetTime() - vDutHit[i]->GetTime());
2939 }
2940 }
2941 for (Int_t i = 0; i < iNRefHits - 1; i++) { // loop over Ref Hits
2942 for (Int_t j = i + 1; j < iNRefHits; j++) { // loop over Ref Hits
2943 fhRefDXDYDT->Fill(vRefHit[j]->GetX() - vRefHit[i]->GetX(), vRefHit[j]->GetY() - vRefHit[i]->GetY(),
2944 vRefHit[j]->GetTime() - vRefHit[i]->GetTime());
2945 }
2946 }
2947
2948 // normalisation distributions
2949 fhNMatch04->Fill(iNbMatchedHits);
2950 if (fTrbHeader != NULL) fhTIS_all->Fill(fTrbHeader->GetTimeInSpill());
2951 else
2952 fhTIS_all->Fill((dTAv - fdStartSpillTime) / 1.E9);
2953
2954 fhTIR_all->Fill(dTIR);
2955
2956 LOG(debug) << Form(" FoundMatches: %d with first chi2s = %12.1f, %12.1f, %12.1f, %12.1f", iNbMatchedHits, Chi2List[0],
2957 Chi2List[1], Chi2List[2], Chi2List[3])
2958 << Form(", Muls %4.0f, %4.0f, %4.0f", dMulD, dMul0, dMul4);
2959
2960
2961 if (BSel[0]) {
2962 fhSelEfficiency->Fill(kTRUE, fiNAccRefTracks);
2963 fhSelHitTupleEfficiencyTIS->Fill(kTRUE, (dTAv - fdStartSpillTime) / 1.E9);
2964 }
2965 else {
2966 fhSelEfficiency->Fill(kFALSE, fiNAccRefTracks);
2967 fhSelHitTupleEfficiencyTIS->Fill(kFALSE, (dTAv - fdStartSpillTime) / 1.E9);
2968 }
2969
2970
2971 // selector 0 distributions
2972 if (BSel[0]) {
2973 LOG(debug) << Form(" Found valid selector ");
2974 fhNMatchD4sel->Fill(iNbMatchedHits); // use as normalisation
2975
2976 if (fTrbHeader != NULL) fhTIS_sel->Fill(fTrbHeader->GetTimeInSpill());
2977 else
2978 fhTIS_sel->Fill((dTAv - fdStartSpillTime) / 1.E9);
2979 fhTIR_sel->Fill(dTIR);
2980
2981 fhTofD4sel->Fill(pHitRef->GetTime() - dTDia); // general normalisation
2982 fhDTD4sel->Fill(dDTD4Min); // general normalisation
2983
2984 Int_t iDutCh = 0;
2985 Double_t dTimeSinceLastDutHit = 0.;
2986
2987 if (fChannelInfoDut != NULL) {
2988 // Project into Dut reference frame
2989 /*TGeoNode *fNodeDut=*/ // prepare global->local trafo
2990 gGeoManager->FindNode(fChannelInfoDut->GetX(), fChannelInfoDut->GetY(), fChannelInfoDut->GetZ());
2991
2992 hitpos1[0] = fChannelInfoDut->GetZ() / pHitRef->GetZ() * pHitRef->GetX();
2993 hitpos1[1] = fChannelInfoDut->GetZ() / pHitRef->GetZ() * pHitRef->GetY();
2994 hitpos1[2] = fChannelInfoDut->GetZ();
2995
2996 /*TGeoNode* cNodeDut=*/gGeoManager->GetCurrentNode();
2997 gGeoManager->MasterToLocal(hitpos1, hitpos1_local);
2998 //hitpos1_local[0] -= fiDutNch/2 * fChannelInfoDut->GetSizex();
2999 fhXY0D4sel->Fill(hitpos1_local[0], hitpos1_local[1]);
3000
3001 iDutCh =
3002 TMath::Floor(hitpos1_local[0] / fChannelInfoDut->GetSizex()) + fiDutNch / 2; // FIXME: needs proper calculation
3003 if (iDutCh < 0 || iDutCh > fiDutNch - 1) {
3004 LOG(debug) << "Predicted ch " << iDutCh << " from x = " << hitpos1_local[0]
3005 << ", Sizex =" << fChannelInfoDut->GetSizex();
3006 if (iDutCh < 0) iDutCh = 0;
3007 if (iDutCh > fiDutNch - 1) iDutCh = fiDutNch - 1;
3008 }
3009 if (NULL != fClusterizer)
3010 if (fClusterizer->fdMemoryTime > 0) {
3011 for (Int_t iDutChtest = iDutCh; iDutChtest < iDutCh + 1; iDutChtest++) { // test possible strips
3012 if (iDutChtest < 0) iDutChtest = 0;
3013 if (iDutChtest > fiDutNch - 1) iDutChtest = fiDutNch - 1;
3014 if (fClusterizer->fvLastHits[fiDut][fiDutSm][fiDutRpc][iDutChtest].size() > 1) {
3015 std::list<CbmTofHit*>::iterator itL =
3016 fClusterizer->fvLastHits[fiDut][fiDutSm][fiDutRpc][iDutChtest].end();
3017 itL--;
3018 //find out, whether hit was added for current event
3019 for (Int_t i = 0; i < iNDutHits; i++) { // loop over Dut Hits
3020 LOG(debug1) << "Inspect " << i << " for address match " << (*itL)->GetAddress() << " - "
3021 << vDutHit[i]->GetAddress();
3022 if ((*itL)->GetAddress() == vDutHit[i]->GetAddress()) {
3023 LOG(debug) << "iDutCh hit was added to DTLH from Mul " << iNDutHits;
3024 itL--;
3025 break; //
3026 }
3027 }
3028 // std::list<CbmTofHit *>::iterator itL=fClusterizer->fvLastHits[fiDut][fiDutSm][fiDutRpc][iDutChtest].begin();
3029 dTimeSinceLastDutHit = TMath::Max(0., TMath::Log10(pHitRef->GetTime() - (*itL)->GetTime()));
3030 break; //leave for-loop
3031 }
3032 else
3033 dTimeSinceLastDutHit = 9.9; //generate entry in last bin of histogram
3034 }
3035
3036 LOG(debug) << Form(" DTLH for iDutCh %02d Mul %03d: %6.1f from size %lu, ref %12.0f ", iDutCh, iNDutHits,
3037 dTimeSinceLastDutHit,
3038 //fClusterizer->fvLastHits[fiDut][fiDutSm][fiDutRpc][iDutCh-1].size(),
3039 fClusterizer->fvLastHits[fiDut][fiDutSm][fiDutRpc][iDutCh].size(),
3040 //fClusterizer->fvLastHits[fiDut][fiDutSm][fiDutRpc][iDutCh+1].size(),
3041 // (*fClusterizer->fvLastHits[fiDut][fiDutSm][fiDutRpc][iDutCh-1].begin())->GetTime(),
3042 // (*fClusterizer->fvLastHits[fiDut][fiDutSm][fiDutRpc][iDutCh].begin())->GetTime(),
3043 //(*(fClusterizer->fvLastHits[fiDut][fiDutSm][fiDutRpc][iDutCh].end())--)->GetTime(),
3044 //(*fClusterizer->fvLastHits[fiDut][fiDutSm][fiDutRpc][iDutCh+1].begin())->GetTime(),
3045 pHitRef->GetTime());
3046 fhDTLH_sel->Fill(dTimeSinceLastDutHit);
3047 }
3048 }
3049
3050 // Monitor selected Reference Hit position
3051 /*TGeoNode *fNodeRef=*/ // prepare global->local trafo
3052 gGeoManager->FindNode(fChannelInfoRef->GetX(), fChannelInfoRef->GetY(), fChannelInfoRef->GetZ());
3053
3054 hitpos2[0] = pHitRef->GetX();
3055 hitpos2[1] = pHitRef->GetY();
3056 hitpos2[2] = pHitRef->GetZ();
3057 /*TGeoNode* cNodeRef=*/gGeoManager->GetCurrentNode();
3058 gGeoManager->MasterToLocal(hitpos2, hitpos2_local);
3059 fhXY4D4sel->Fill(hitpos2_local[0], hitpos2_local[1]);
3060
3061 if (NULL != pHitSel2) {
3062 /*Int_t iDetId3 = (pHitSel2->GetAddress() & DetMask);*/
3063 Int_t iChId3 = pHitSel2->GetAddress();
3064 fChannelInfo3 = fDigiPar->GetCell(iChId3);
3065 /*TGeoNode *fNode3=*/ // prepare global->local trafo
3066 gGeoManager->FindNode(fChannelInfo3->GetX(), fChannelInfo3->GetY(), fChannelInfo3->GetZ());
3067 hitpos3[0] = pHitSel2->GetX();
3068 hitpos3[1] = pHitSel2->GetY();
3069 hitpos3[2] = pHitSel2->GetZ();
3070 /*TGeoNode* cNode3=*/gGeoManager->GetCurrentNode();
3071 gGeoManager->MasterToLocal(hitpos3, hitpos3_local);
3072 fhXYSel2D4sel->Fill(hitpos3_local[0], hitpos3_local[1]);
3073
3074 if (fTrbHeader != NULL) fhTIS_sel2->Fill(fTrbHeader->GetTimeInSpill());
3075 else
3076 fhTIS_sel2->Fill((dTAv - fdStartSpillTime) / 1.E9);
3077 fhTIR_sel2->Fill(dTIR);
3078
3079 if (NULL != fClusterizer)
3080 if (fClusterizer->fdMemoryTime > 0) { fhDTLH_sel2->Fill(dTimeSinceLastDutHit); }
3081 }
3082
3084 if (fbTracksInInputFile) {
3085 Int_t iMatchedRealTrackLink(-1);
3086 std::set<Int_t> RealTrackLinkSet;
3087
3088 // A Sel2 counter was defined. Assessing purity for a selector hit tuple
3089 // does not make too much sense if the MRef counter is the only reference
3090 // apart from a BRef (start) counter.
3091 if (pHitSel2) {
3092 Int_t iNSelHitTupleHits(3);
3093
3094 CbmMatch* tMRefHitTrackMatch = dynamic_cast<CbmMatch*>(fTofHitAccTrackMatches->At(iMRefHitInd));
3095 CbmMatch* tSel2HitTrackMatch = dynamic_cast<CbmMatch*>(fTofHitAccTrackMatches->At(iSel2HitInd));
3096 CbmMatch* tBRefHitTrackMatch = dynamic_cast<CbmMatch*>(fTofHitAccTrackMatches->At(iBRefHitInd));
3097
3098 for (Int_t iMRefHitTrackLink = 0; iMRefHitTrackLink < tMRefHitTrackMatch->GetNofLinks();
3099 iMRefHitTrackLink++) {
3100 tSelHitTupleTrackMatch.AddLink(tMRefHitTrackMatch->GetLink(iMRefHitTrackLink));
3101 }
3102
3103 for (Int_t iSel2HitTrackLink = 0; iSel2HitTrackLink < tSel2HitTrackMatch->GetNofLinks();
3104 iSel2HitTrackLink++) {
3105 tSelHitTupleTrackMatch.AddLink(tSel2HitTrackMatch->GetLink(iSel2HitTrackLink));
3106 }
3107
3108 for (Int_t iBRefHitTrackLink = 0; iBRefHitTrackLink < tBRefHitTrackMatch->GetNofLinks();
3109 iBRefHitTrackLink++) {
3110 tSelHitTupleTrackMatch.AddLink(tBRefHitTrackMatch->GetLink(iBRefHitTrackLink));
3111 }
3112
3113 const CbmLink& tSelHitTupleMatchedTrackLink = tSelHitTupleTrackMatch.GetMatchedLink();
3114 Double_t dSelHitTupleMaxTrackLinkWeight = tSelHitTupleMatchedTrackLink.GetWeight();
3115
3116 for (Int_t iSelHitTupleTrackLink = 0; iSelHitTupleTrackLink < tSelHitTupleTrackMatch.GetNofLinks();
3117 iSelHitTupleTrackLink++) {
3118 const CbmLink& tSelHitTupleTrackLink = tSelHitTupleTrackMatch.GetLink(iSelHitTupleTrackLink);
3119
3120 if (dSelHitTupleMaxTrackLinkWeight == tSelHitTupleTrackLink.GetWeight()
3121 && -1 < tSelHitTupleTrackLink.GetIndex()) {
3122 iMatchedRealTrackLink = tSelHitTupleTrackLink.GetIndex();
3123 RealTrackLinkSet.emplace(tSelHitTupleTrackLink.GetIndex());
3124 }
3125 }
3126
3127 Int_t iNTrueTupleHits = static_cast<Int_t>(dSelHitTupleMaxTrackLinkWeight);
3128
3129 // The beam particle track link (-5, -5, -5) cannot add up to the
3130 // weight of track links found in the MRef and Sel2 counters. For
3131 // consistency, it should be counted as a true sel tuple hit, though.
3132 if (5 == fiBeamRefSmType) { iNTrueTupleHits++; }
3133
3134 tSelHitTupleTrackMatch.SetNofTrueHits(iNTrueTupleHits);
3135 tSelHitTupleTrackMatch.SetNofWrongHits(iNSelHitTupleHits - iNTrueTupleHits);
3136
3137 // For a pure sel hit tuple, request a particle track match different
3138 // from a beam or a dark point.
3139 // The case that a noise link and a particle link have the same weight
3140 // and the noise link is - by chance - the matched one is handled here:
3141 // The noise link is ignored while assessing purity if and only if a
3142 // particle link with the same weight exists.
3143 if (-1 < iMatchedRealTrackLink) {
3144 if (1. == tSelHitTupleTrackMatch.GetTrueOverAllHitsRatio()) {
3145 fhSelPurity->Fill(kTRUE, fiNAccRefTracks);
3146 bGoodTrackSel = kTRUE;
3147 }
3148 else {
3149 fhSelPurity->Fill(kFALSE, fiNAccRefTracks);
3150 }
3151 }
3152 else {
3153 fhSelPurity->Fill(kFALSE, fiNAccRefTracks);
3154 }
3155 }
3156
3157
3158 if (bGoodTrackSel) {
3159 TGeoNode* tNode(NULL);
3160 TGeoMedium* tMedium(NULL);
3161 TGeoMaterial* tMaterial(NULL);
3162
3163 const char* cMaterialName;
3164
3165 const char* cSelRefTrackPdgName;
3166 const char* cSelRefTrackProcessName;
3167
3168 Bool_t bSelRefTrack(kFALSE);
3169
3170 for (auto const& iTrack : RealTrackLinkSet) {
3171 CbmMCTrack* tTrack = dynamic_cast<CbmMCTrack*>(fAccTracks->At(iTrack));
3172 CbmMatch* tTrackPointMatch = dynamic_cast<CbmMatch*>(fTofAccTrackPointMatches->At(iTrack));
3173
3174 tNode = gGeoManager->FindNode(tTrack->GetStartX(), tTrack->GetStartY(), tTrack->GetStartZ());
3175 tMedium = tNode->GetMedium();
3176 tMaterial = tMedium->GetMaterial();
3177
3178 GetMaterialName(tMaterial->GetName(), cMaterialName);
3179
3180 if (0 == std::strcmp("target", cMaterialName) && fiMinMCRefTrackPoints <= tTrackPointMatch->GetNofLinks()) {
3181 bSelRefTrack = kTRUE;
3182
3183 GetPdgName(tTrack->GetPdgCode(), cSelRefTrackPdgName);
3184 GetProcessName(TMCProcessName[tTrack->GetGeantProcessId()], cSelRefTrackProcessName);
3185 }
3186 }
3187
3188 if (bSelRefTrack) {
3189 fhSelRefTrackShare->Fill(kTRUE, fiNAccRefTracks);
3190 fhSelRefTrackProcSpec->Fill(cSelRefTrackProcessName, cSelRefTrackPdgName, 1.);
3191 }
3192 else {
3193 fhSelRefTrackShare->Fill(kFALSE, fiNAccRefTracks);
3194 }
3195 }
3196 }
3197 }
3198
3199
3200 if (iNbMatchedHits > 0) {
3201 // best match
3202 LOG(debug) << Form("best match D4 (%d): 0x%p, 0x%p in ch 0x%08x, 0x%08x: "
3203 "%12.1f < %12.1f ?",
3204 iNbMatchedHits, pChi2Hit1[0], pChi2Hit2[0], pChi2Hit1[0]->GetAddress(),
3205 pChi2Hit2[0]->GetAddress(), Chi2List[0], fdChi2Lim);
3206
3207 if (NULL != pHitSel2) { fhXYSel2D4best->Fill(hitpos3_local[0], hitpos3_local[1]); }
3208
3209 pHit1 = pChi2Hit1[0]; //Dut
3210 pHit2 = pChi2Hit2[0]; //MRpcRef
3211 Int_t iM0 = 0;
3212 if (pHit2 != pHitRef) {
3213 LOG(debug) << " selector hit does not match reference hit for best "
3214 "match, chi2best "
3215 << Chi2List[0] << Form(", ref found in Addr 0x%08x ", pHitRef->GetAddress());
3216 for (iM0 = 1; iM0 < iNbMatchedHits; iM0++) {
3217 if (pHitRef == pChi2Hit2[iM0]) {
3218 LOG(debug) << " found reference hit for best match, chi2new " << Chi2List[iM0];
3219 pHit1 = pChi2Hit1[iM0];
3220 pHit2 = pChi2Hit2[iM0];
3221 break;
3222 }
3223 }
3224 if (iM0 == iNbMatchedHits) {
3225 LOG(debug) << Form("no valid match in %d hits for Addr 0x%08x found ", iNbMatchedHits, pHitRef->GetAddress());
3226 if (fair::Logger::Logging(fair::Severity::debug1)) LOG(fatal) << "Check for consistency!";
3227 return 0;
3228 }
3229 }
3230
3231 // 2019-01-02 chs
3232 // Calibration code was moved here to make the corrected time difference
3233 // 'dToD' between the DUT and MRef counters available also for the
3234 // (else) case that the selected DUT-MRef hit pair does not meet the
3235 // 'fdChi2Lim' criterion for an efficient match.
3236 Int_t iDetId1 = (pHit1->GetAddress() & DetMask);
3237 Int_t iChId1 = pHit1->GetAddress();
3238 fChannelInfo1 = fDigiPar->GetCell(iChId1);
3239
3240 Int_t iDetId2 = (pHit2->GetAddress() & DetMask);
3241 Int_t iChId2 = pHit2->GetAddress();
3242 fChannelInfo2 = fDigiPar->GetCell(iChId2);
3243
3244 Double_t xPos1 = pHit1->GetX();
3245 Double_t yPos1 = pHit1->GetY();
3246 Double_t zPos1 = pHit1->GetZ();
3247 Double_t tof1 = pHit1->GetTime();
3248 Double_t dzscal = 1.;
3249 if (fEnableMatchPosScaling) dzscal = zPos1 / pHit2->GetZ();
3250
3251 Double_t xPos2 = dzscal * pHit2->GetX();
3252 Double_t yPos2 = dzscal * pHit2->GetY();
3253 Double_t tof2 = pHit2->GetTime();
3254
3255 Double_t dDist =
3256 TMath::Sqrt(TMath::Power(pHit1->GetX() - pHit2->GetX(), 2) + TMath::Power(pHit1->GetY() - pHit2->GetY(), 2)
3257 + TMath::Power(pHit1->GetZ() - pHit2->GetZ(), 2));
3258
3259 CbmMatch* digiMatch1 = (CbmMatch*) fTofDigiMatchColl->At(fTofHitsColl->IndexOf(pHit1));
3260 Double_t dCluSize0 = digiMatch1->GetNofLinks() / 2.;
3261
3262 CbmMatch* digiMatch2 = (CbmMatch*) fTofDigiMatchColl->At(fTofHitsColl->IndexOf(pHit2));
3263 Double_t dCluSize4 = digiMatch2->GetNofLinks() / 2.;
3264
3265 // check for dependence in counter reference frame
3266 /*TGeoNode *fNode=*/ // prepare global->local trafo
3267 gGeoManager->FindNode(fChannelInfo2->GetX(), fChannelInfo2->GetY(), fChannelInfo2->GetZ());
3268
3269 hitpos2[0] = pHit2->GetX();
3270 hitpos2[1] = pHit2->GetY();
3271 hitpos2[2] = pHit2->GetZ();
3272
3273 /* TGeoNode* cNode=*/gGeoManager
3274 ->GetCurrentNode(); // -> Comment to remove warning because set but never used
3275 // if(0) cNode->Print();
3276 gGeoManager->MasterToLocal(hitpos2, hitpos2_local);
3277
3278 Double_t dTofD4 = fdTOffD4 + dDTD4Min;
3279 Double_t dInvVel = dTofD4 / pHitRef->GetR(); // in ns/cm
3280 Double_t dDTexp = dDist * dInvVel;
3281 Double_t dTMin = fdHitDistAv / 30.; // in ns
3282 CbmMatch* digiMatch0 = (CbmMatch*) fTofDigiMatchColl->At(fTofHitsColl->IndexOf(pHit1));
3283 Double_t dTot0 = 0.;
3284
3286 for (Int_t iLink = 0; iLink < digiMatch0->GetNofLinks(); iLink++) { // loop over digis
3287 CbmLink L0 = digiMatch0->GetLink(iLink);
3288 Int_t iDigInd0 = L0.GetIndex();
3289 const CbmTofDigi* pDig0 = fDigiMan->Get<CbmTofDigi>(iDigInd0);
3290 dTot0 += pDig0->GetTot();
3291 LOG(debug1) << Form(" dTot of hit 0x%08x: digind %d add %f -> sum %f", iDetId1, iDigInd0, pDig0->GetTot(),
3292 dTot0);
3293 }
3294 dTot0 /= digiMatch0->GetNofLinks(); // average time over threshold
3295
3296 CbmMatch* digiMatch4 = (CbmMatch*) fTofDigiMatchColl->At(fTofHitsColl->IndexOf(pHit2));
3297 Double_t dTot4 = 0.;
3298 // if(NULL != fTofDigisColl)
3300 for (Int_t iLink = 0; iLink < digiMatch4->GetNofLinks(); iLink++) { // loop over digis
3301 CbmLink L0 = digiMatch4->GetLink(iLink);
3302 Int_t iDigInd0 = L0.GetIndex();
3303 const CbmTofDigi* pDig0 = fDigiMan->Get<CbmTofDigi>(iDigInd0);
3304 // CbmTofDigi *pDig0 = (CbmTofDigi*) (fTofDigisColl->At(iDigInd0));
3305 dTot4 += pDig0->GetTot();
3306 LOG(debug1) << Form(" dTot of hit 0x%08x: digind %d add %f -> sum %f", iDetId1, iDigInd0, pDig0->GetTot(),
3307 dTot4);
3308 }
3309 dTot4 /= digiMatch4->GetNofLinks(); // average time over threshold
3310
3311 Double_t dTcor = 0.;
3312 if (fhDTD4DT04D4Off != NULL)
3313 dTcor += (Double_t) fhDTD4DT04D4Off->GetBinContent(fhDTD4DT04D4Off->FindBin(-dDTD4Min));
3314 if (fhDTX4D4Off != NULL) dTcor += (Double_t) fhDTX4D4Off->GetBinContent(fhDTX4D4Off->FindBin(hitpos2_local[0]));
3315 if (fhDTY4D4Off != NULL) dTcor += (Double_t) fhDTY4D4Off->GetBinContent(fhDTY4D4Off->FindBin(hitpos2_local[1]));
3316 if (fhDTTexpD4Off != NULL)
3317 dTcor += (Double_t) fhDTTexpD4Off->GetBinContent(fhDTTexpD4Off->FindBin(dDTexp - dTMin));
3318 if (fhCluSize0DT04D4Off != NULL)
3319 dTcor += (Double_t) fhCluSize0DT04D4Off->GetBinContent(fhCluSize0DT04D4Off->FindBin(dCluSize0));
3320 if (fhCluSize4DT04D4Off != NULL)
3321 dTcor += (Double_t) fhCluSize4DT04D4Off->GetBinContent(fhCluSize4DT04D4Off->FindBin(dCluSize4));
3322 if (fhTot0DT04D4Off != NULL)
3323 dTcor += (Double_t) fhTot0DT04D4Off->GetBinContent(fhTot0DT04D4Off->FindBin(TMath::Log(dTot0)));
3324 if (fhTot4DT04D4Off != NULL)
3325 dTcor += (Double_t) fhTot4DT04D4Off->GetBinContent(fhTot4DT04D4Off->FindBin(TMath::Log(dTot4)));
3326
3327 // dTcor *= dDist/fdHitDistAv;
3328 Double_t dToD = (tof1 - tof2 - dTcor - fdDTMean); //*fdHitDistAv/dDist;
3329 // LOG(info) << "dTcor for "<<-dDTD4<<" from "<<fhDTD4DT04D4Off<<": "<<dTcor;
3330
3331
3332 Bool_t bGoodSelDutMatch(kFALSE);
3333
3335 Int_t iDutHitInd = fTofHitsColl->IndexOf(pHit1);
3336
3337 if (fbTracksInInputFile) {
3338 if (bGoodTrackSel) {
3339 CbmMatch* tDutHitTrackMatch = dynamic_cast<CbmMatch*>(fTofHitAccTrackMatches->At(iDutHitInd));
3340
3341 Double_t dSelHitTupleMaxTrackLinkWeight = (tSelHitTupleTrackMatch.GetMatchedLink()).GetWeight();
3342
3343
3344 for (Int_t iSelHitTupleTrackLink = 0; iSelHitTupleTrackLink < tSelHitTupleTrackMatch.GetNofLinks();
3345 iSelHitTupleTrackLink++) {
3346 const CbmLink& tSelHitTupleTrackLink = tSelHitTupleTrackMatch.GetLink(iSelHitTupleTrackLink);
3347
3348 if (dSelHitTupleMaxTrackLinkWeight == tSelHitTupleTrackLink.GetWeight()) {
3349 for (Int_t iDutHitTrackLink = 0; iDutHitTrackLink < tDutHitTrackMatch->GetNofLinks();
3350 iDutHitTrackLink++) {
3351 const CbmLink& tDutHitTrackLink = tDutHitTrackMatch->GetLink(iDutHitTrackLink);
3352
3353 if (tSelHitTupleTrackLink == tDutHitTrackLink) {
3354 bGoodSelDutMatch = kTRUE;
3355 break;
3356 }
3357 }
3358 }
3359
3360 if (bGoodSelDutMatch) { break; }
3361 }
3362
3363 if (bGoodSelDutMatch) { fhGoodSelTypeNNPureChiSq->Fill(0., 3. * Chi2List[iM0]); }
3364
3365 fhGoodSelTypeNNAllChiSq->Fill(0., 3. * Chi2List[iM0]);
3366 }
3367 }
3368 }
3369
3370
3371 if (Chi2List[iM0] < fdChi2Lim) {
3372
3374 fhSelHitTupleMatchEfficiencyTIS->Fill(kTRUE, (dTAv - fdStartSpillTime) / 1.E9);
3375
3376 if (fTrbHeader != NULL) fhTIS_sel1->Fill(fTrbHeader->GetTimeInSpill());
3377 else
3378 fhTIS_sel1->Fill((dTAv - fdStartSpillTime) / 1.E9);
3379 fhTIR_sel1->Fill(dTIR);
3380
3381 if (NULL != fClusterizer)
3382 if (fClusterizer->fdMemoryTime > 0) {
3383 Int_t iDut = CbmTofAddress::GetSmType(pHit1->GetAddress());
3384 if (fiDut != iDut) LOG(fatal) << "inconsistent Dut - type " << iDut << " != " << fiDut;
3385
3387 if (iDutCh != iCh) LOG(debug) << "Inconsistent Dut strip #: " << iCh << " != " << iDutCh;
3388 fhDTLH_DStrip->Fill((Double_t) iCh, (Double_t)(iCh - iDutCh));
3389 fhDTLH_sel1->Fill(dTimeSinceLastDutHit);
3390 }
3391
3392 fhXX04->Fill(xPos1, xPos2);
3393 fhYY04->Fill(yPos1, yPos2);
3394 fhXY04->Fill(xPos1, yPos2);
3395 fhYX04->Fill(yPos1, xPos2);
3396 fhTT04->Fill(tof1, tof1 - tof2);
3397
3398
3399 fhChi04D4best->Fill(Chi2List[iM0]);
3400
3401
3402 fhDigiMul0D4best->Fill(dMul0, dCluSize0);
3403 fhDigiMul4D4best->Fill(dMul4, dCluSize4);
3404
3405 fhCluSize04D4best->Fill(dCluSize0, dCluSize4);
3406
3407 fhCluMul04D4best->Fill(dMul0, dMul4);
3408 fhStrMul04D4best->Fill(dStrMul0, dStrMul4);
3409
3410 fhCluMulTSig0D4best->Fill(dMul0, dDutTSig);
3411 fhCluMulTSig4D4best->Fill(dMul4, dRefTSig);
3412
3413 fhCluMulTrel0D4best->Fill(dMul0, pHit1->GetTime() - dDutTMean);
3414 fhCluMulTrel4D4best->Fill(dMul4, pHit2->GetTime() - dRefTMean);
3415
3416 fhCluSizeTrel0D4best->Fill(dCluSize0, pHit1->GetTime() - dDutTMean);
3417 fhCluSizeTrel4D4best->Fill(dCluSize4, pHit2->GetTime() - dRefTMean);
3418
3419
3420 fhTofD4best->Fill(dTofD4);
3421 if (dInvVel > 0.) fhVelD4best->Fill(1. / dInvVel);
3422
3423 fhChiDT04D4best->Fill(Chi2List[iM0], dToD);
3424 fhDTD4DT04D4best->Fill(-dDTD4Min, dToD);
3425 fhDTMul4D4best->Fill(dMul4, dToD);
3426
3427 fhXY4D4best->Fill(hitpos2_local[0], hitpos2_local[1]);
3428 fhDTX4D4best->Fill(hitpos2_local[0], dToD);
3429 fhDTY4D4best->Fill(hitpos2_local[1], dToD);
3430 fhDXX4D4best->Fill(hitpos2_local[0], xPos1 - xPos2);
3431 fhDXY4D4best->Fill(hitpos2_local[1], xPos1 - xPos2);
3432 fhDYX4D4best->Fill(hitpos2_local[0], yPos1 - yPos2);
3433 fhDYY4D4best->Fill(hitpos2_local[1], yPos1 - yPos2);
3434
3435 fhCluSize4DT04D4best->Fill(digiMatch2->GetNofLinks() / 2., dToD);
3436
3437 Double_t dTot = 0.;
3439 for (Int_t iLink = 0; iLink < digiMatch2->GetNofLinks(); iLink++) { // loop over digis
3440 CbmLink L0 = digiMatch2->GetLink(iLink);
3441 Int_t iDigInd0 = L0.GetIndex();
3442 const CbmTofDigi* pDig0 = fDigiMan->Get<CbmTofDigi>(iDigInd0);
3443 dTot += pDig0->GetTot();
3444 LOG(debug) << Form(" dTot of hit 0x%08x: digind %d add %f -> sum %f", iDetId2, iDigInd0, pDig0->GetTot(),
3445 dTot);
3446 }
3447
3448 dTot /= digiMatch2->GetNofLinks(); // average time over threshold
3449 fhTot4DT04D4best->Fill(TMath::Log(dTot), dToD);
3450
3451 fhCluSize0DT04D4best->Fill(digiMatch0->GetNofLinks() / 2., dToD);
3452
3453 dTot = 0.;
3455 for (Int_t iLink = 0; iLink < digiMatch0->GetNofLinks(); iLink++) { // loop over digis
3456 CbmLink L0 = digiMatch0->GetLink(iLink);
3457 Int_t iDigInd0 = L0.GetIndex();
3458 const CbmTofDigi* pDig0 = fDigiMan->Get<CbmTofDigi>(iDigInd0);
3459 dTot += pDig0->GetTot();
3460 LOG(debug1) << Form(" dTot of hit 0x%08x: digind %d add %f -> sum %f", iDetId1, iDigInd0, pDig0->GetTot(),
3461 dTot);
3462 }
3463 dTot /= digiMatch0->GetNofLinks(); // average time over threshold
3464 fhTot0DT04D4best->Fill(TMath::Log(dTot), dToD);
3465
3466 fhCluSizeSigT0D4best->Fill(digiMatch1->GetNofLinks() / 2., pHit1->GetTimeError());
3467 fhCluSizeSigT4D4best->Fill(digiMatch2->GetNofLinks() / 2., pHit2->GetTimeError());
3468
3469 fhDTMul0D4best->Fill(dMul0, dToD);
3470
3471 // check for dependence in counter reference frame
3472 /*TGeoNode *fNode1=*/ // prepare global->local trafo
3473 gGeoManager->FindNode(fChannelInfo1->GetX(), fChannelInfo1->GetY(), fChannelInfo1->GetZ());
3474
3475 hitpos1[0] = pHit1->GetX();
3476 hitpos1[1] = pHit1->GetY();
3477 hitpos1[2] = pHit1->GetZ();
3478
3479 /*TGeoNode* cNode1=*/gGeoManager->GetCurrentNode();
3480 gGeoManager->MasterToLocal(hitpos1, hitpos1_local);
3481
3482 fhXY0D4best->Fill(hitpos1_local[0], hitpos1_local[1]);
3483 fhXX04D4best->Fill(hitpos1_local[0], hitpos2_local[0]);
3484 fhYY04D4best->Fill(hitpos1_local[1], hitpos2_local[1]);
3485
3486 fhDTX0D4best->Fill(hitpos1_local[0], dToD);
3487 fhDTY0D4best->Fill(hitpos1_local[1], dToD);
3488 fhDXX0D4best->Fill(hitpos1_local[0], xPos1 - xPos2);
3489 fhDXY0D4best->Fill(hitpos1_local[1], xPos1 - xPos2);
3490 fhDYX0D4best->Fill(hitpos1_local[0], yPos1 - yPos2);
3491 fhDYY0D4best->Fill(hitpos1_local[1], yPos1 - yPos2);
3492
3493 fhDXDY04D4best->Fill(xPos1 - xPos2, yPos1 - yPos2);
3494 fhDXDT04D4best->Fill(xPos1 - xPos2, dToD);
3495 fhDYDT04D4best->Fill(yPos1 - yPos2, dToD);
3496 fhDistDT04D4best->Fill(dDist, dToD);
3497 fhTexpDT04D4best->Fill(dDTexp - dTMin, dToD);
3498 fhX0DT04D4best->Fill(hitpos1_local[0], dToD);
3499 fhY0DT04D4best->Fill(hitpos1_local[1], dToD);
3500 if (fTrbHeader != NULL) fhTISDT04D4best->Fill(fTrbHeader->GetTimeInSpill(), dToD);
3501 else
3502 fhTISDT04D4best->Fill((dTAv - fdStartSpillTime) / 1.E9, dToD);
3503
3505 Int_t iDutHitInd = fTofHitsColl->IndexOf(pHit1);
3506
3507 if (fbTracksInInputFile) {
3508 if (bGoodTrackSel) {
3509 if (bGoodSelDutMatch) { fhSelMatchPurity->Fill(kTRUE, fiNAccRefTracks); }
3510 else {
3511 fhSelMatchPurity->Fill(kFALSE, fiNAccRefTracks);
3512 }
3513 }
3514 // uncomment to account for impure selectors in the matching purity calculation
3515 /*
3516 else
3517 {
3518 fhSelMatchPurity->Fill(kFALSE, fiNAccRefTracks);
3519 }
3520*/
3521
3523 dynamic_cast<CbmMatch*>(fTofHitAccTrackMatches->At(iMRefHitInd))->GetNofLinks());
3524 if (pHitSel2) {
3526 dynamic_cast<CbmMatch*>(fTofHitAccTrackMatches->At(iSel2HitInd))->GetNofLinks());
3527 }
3528 fhNTracksPerSelDutHit->Fill(dynamic_cast<CbmMatch*>(fTofHitAccTrackMatches->At(iDutHitInd))->GetNofLinks());
3529 }
3530
3531
3532 CbmMatch* tDutHitPointMatch = dynamic_cast<CbmMatch*>(fTofHitPointMatches->At(iDutHitInd));
3533 const CbmLink& tDutHitPointLink = tDutHitPointMatch->GetMatchedLink();
3534 CbmTofPoint* tDutHitMatchedPoint(NULL);
3535
3536 Int_t iFileIndex = tDutHitPointLink.GetFile();
3537 Int_t iEventIndex = tDutHitPointLink.GetEntry();
3538 Int_t iArrayIndex = tDutHitPointLink.GetIndex();
3539
3540 if (-1 < iFileIndex && -1 < iEventIndex && -1 < iArrayIndex) {
3541 Double_t dMCEventStartTime(0.);
3542
3543 if (fbPointsInInputFile) {
3544 tDutHitMatchedPoint = dynamic_cast<CbmTofPoint*>(fTofPointsTB->At(iArrayIndex));
3545 }
3546 else {
3547 tDutHitMatchedPoint = dynamic_cast<CbmTofPoint*>(fTofPoints->Get(iFileIndex, iEventIndex, iArrayIndex));
3548
3549 dMCEventStartTime = fMCEventList->GetEventTime(iEventIndex, iFileIndex);
3550 }
3551
3552 // The extrapolation of a hit position in the DUT plane from the
3553 // position of the reference hit in the MRef plane following the
3554 // intercept theorem (fEnableMatchPosScaling) is based on
3555 // two assumptions:
3556 // 1) The track which both DUT and MRef hits are supposed to be
3557 // associated with is a 3D original straight line.
3558 // 2) The global X and Y coordinates of hits in both planes have
3559 // identical signs.
3560
3561 fhResX04HitExp->Fill(fiNAccRefTracks, xPos1 - xPos2 - fdDXMean);
3562 fhResX04ExpMC->Fill(fiNAccRefTracks, xPos2 - tDutHitMatchedPoint->GetX() + fdDXMean);
3563 fhResX04HitMC->Fill(fiNAccRefTracks, xPos1 - tDutHitMatchedPoint->GetX());
3564
3565 fhResY04HitExp->Fill(fiNAccRefTracks, yPos1 - yPos2 - fdDYMean);
3566 fhResY04ExpMC->Fill(fiNAccRefTracks, yPos2 - tDutHitMatchedPoint->GetY() + fdDYMean);
3567 fhResY04HitMC->Fill(fiNAccRefTracks, yPos1 - tDutHitMatchedPoint->GetY());
3568
3570 dToD); // center-adjustable with 'fdDTMean'
3571 Double_t dSign(1.);
3572 if (pHit1->GetZ() < pHit2->GetZ()) { dSign = -1.; }
3573 Double_t dDutMCPointDelay(0.);
3574 Double_t dMRefMCPointDelay(0.);
3575 if (fbDelayMCPoints) {
3576 dDutMCPointDelay = 0.5
3577 * (fChannelInfo1->GetSizey() >= fChannelInfo1->GetSizex() ? fChannelInfo1->GetSizey()
3578 : fChannelInfo1->GetSizex())
3580 dMRefMCPointDelay = 0.5
3581 * (fChannelInfo2->GetSizey() >= fChannelInfo2->GetSizex() ? fChannelInfo2->GetSizey()
3582 : fChannelInfo2->GetSizex())
3584 }
3586 tof2 + dSign * dDTexp - tDutHitMatchedPoint->GetTime() - dMCEventStartTime
3587 - dMRefMCPointDelay); // center-adjustable with 'fdTOffD4'
3589 tof1 - tDutHitMatchedPoint->GetTime() - dMCEventStartTime
3590 - dDutMCPointDelay); // TODO: how to adjust?
3591 }
3592 }
3593
3594
3595 if (iNbMatchedHits > 1) {
3596 LOG(debug) << Form(" Matches>1: %d with first chi2s = %12.1f, %12.1f, %12.1f, %12.1f", iNbMatchedHits,
3597 Chi2List[0], Chi2List[1], Chi2List[2], Chi2List[3]);
3598
3599 for (Int_t iM = 0; iM < iNbMatchedHits; iM++) {
3600 LOG(debug) << Form(" Match: %d (%d) with ids = 0x%08x, 0x%08x - 0x%08x, 0x%08x", iM, iNbMatchedHits,
3601 pChi2Hit1[iM]->GetAddress(), pHit1->GetAddress(), pChi2Hit2[iM]->GetAddress(),
3602 pHit2->GetAddress());
3603 if (pChi2Hit1[iM] != pHit1 && pChi2Hit2[iM] != pHit2) {
3604
3605 LOG(debug) << Form(" second best match D4 at %d (%d): chi2 %f ", iM, iNbMatchedHits, Chi2List[iM]);
3606
3607 if (Chi2List[iM] > 1.E3) break; // FIXME hardwired limit !
3608
3609 pHit3 = pChi2Hit1[iM];
3610 pHit4 = pChi2Hit2[iM];
3611
3612 /*Int_t iDetId3 = (pHit1->GetAddress() & DetMask);*/
3613 Int_t iChId3 = pHit1->GetAddress();
3614 fChannelInfo3 = fDigiPar->GetCell(iChId3);
3615
3616 /*Int_t iDetId4 = (pHit4->GetAddress() & DetMask);*/
3617 Int_t iChId4 = pHit4->GetAddress();
3618 fChannelInfo4 = fDigiPar->GetCell(iChId4);
3619
3620 // check for dependence in counter reference frame
3621 /*TGeoNode *fNode4= */ // prepare global->local trafo
3622 gGeoManager->FindNode(fChannelInfo4->GetX(), fChannelInfo4->GetY(), fChannelInfo4->GetZ());
3623
3624 hitpos4[0] = pChi2Hit2[iM]->GetX();
3625 hitpos4[1] = pChi2Hit2[iM]->GetY();
3626 hitpos4[2] = pChi2Hit2[iM]->GetZ();
3627
3628 /* cNode=*/gGeoManager
3629 ->GetCurrentNode(); // -> Comment to remove warning because set but never used
3630 gGeoManager->MasterToLocal(hitpos4, hitpos4_local);
3631
3632 if (TMath::Abs(hitpos4_local[1]) > fdPosY4Sel * fChannelInfo4->GetSizey()) continue;
3633
3634 fhChi04D4sbest->Fill(Chi2List[iM]);
3635 if (fEnableMatchPosScaling) dzscal = zPos1 / pChi2Hit1[iM]->GetZ();
3636 Double_t xPos3 = dzscal * pChi2Hit1[iM]->GetX();
3637 Double_t yPos3 = dzscal * pChi2Hit1[iM]->GetY();
3638 Double_t tof3 = pChi2Hit1[iM]->GetTime();
3639
3640 if (fEnableMatchPosScaling) dzscal = zPos1 / pChi2Hit2[iM]->GetZ();
3641 Double_t xPos4 = dzscal * pChi2Hit2[iM]->GetX();
3642 Double_t yPos4 = dzscal * pChi2Hit2[iM]->GetY();
3643 Double_t tof4 = pChi2Hit2[iM]->GetTime();
3644
3645 Double_t dDist34 = TMath::Sqrt(TMath::Power(pHit3->GetX() - pHit4->GetX(), 2)
3646 + TMath::Power(pHit3->GetY() - pHit4->GetY(), 2)
3647 + TMath::Power(pHit3->GetZ() - pHit4->GetZ(), 2));
3648
3649 CbmMatch* digiMatch3 = (CbmMatch*) fTofDigiMatchColl->At(fTofHitsColl->IndexOf(pHit3));
3650 fhDigiMul0D4sbest->Fill(digiMatch3->GetNofLinks() / 2.);
3651 digiMatch4 = (CbmMatch*) fTofDigiMatchColl->At(fTofHitsColl->IndexOf(pHit4));
3652 fhDigiMul4D4sbest->Fill(digiMatch4->GetNofLinks() / 2.);
3653
3654 fhCluMul04D4sbest->Fill(dMul0, dMul4);
3655
3656 Double_t dTofD44 = fdTOffD4 + pHit4->GetTime() - dTDia;
3657 Double_t dInvVel4 = dTofD44 / pHitRef->GetR(); // in ns/cm
3658 Double_t dDTexp4 = dDist34 * dInvVel4;
3659 Double_t dTcor4 = 0.;
3660 if (fhDTD4DT04D4Off != NULL)
3661 dTcor4 = (Double_t) fhDTD4DT04D4Off->GetBinContent(fhDTD4DT04D4Off->FindBin(dTDia - pHit4->GetTime()));
3662 if (fhDTX4D4Off != NULL)
3663 dTcor4 += (Double_t) fhDTX4D4Off->GetBinContent(fhDTX4D4Off->FindBin(hitpos4_local[0]));
3664 if (fhDTY4D4Off != NULL)
3665 dTcor4 += (Double_t) fhDTY4D4Off->GetBinContent(fhDTY4D4Off->FindBin(hitpos4_local[1]));
3666 if (fhDTTexpD4Off != NULL)
3667 dTcor4 += (Double_t) fhDTTexpD4Off->GetBinContent(fhDTTexpD4Off->FindBin(dDTexp4));
3668
3669 Double_t dToD34 = (tof3 - tof4 - dTcor4 - fdDTMean);
3670
3671 fhTofD4sbest->Fill(dTofD44);
3672 if (dInvVel4 > 0.) fhVelD4sbest->Fill(1000. / dInvVel4);
3673
3674 fhChiDT04D4sbest->Fill(Chi2List[iM], dToD34);
3675
3676 fhDTD4DT04D4sbest->Fill(dTDia - pHit4->GetTime(), dToD34);
3677 fhDTMul4D4sbest->Fill(dMul4, dToD34);
3678
3679 fhDTX4D4sbest->Fill(hitpos4_local[0], dToD34);
3680 fhDTY4D4sbest->Fill(hitpos4_local[1], dToD34);
3681 fhDXX4D4sbest->Fill(hitpos4_local[0], xPos3 - xPos4);
3682 fhDXY4D4sbest->Fill(hitpos4_local[1], xPos3 - xPos4);
3683 fhDYX4D4sbest->Fill(hitpos4_local[0], yPos3 - yPos4);
3684 fhDYY4D4sbest->Fill(hitpos4_local[1], yPos3 - yPos4);
3685
3686 fhCluSize4DT04D4sbest->Fill(digiMatch4->GetNofLinks() / 2., dToD34);
3687
3688 dTot4 = 0.;
3690 for (Int_t iLink = 0; iLink < digiMatch4->GetNofLinks(); iLink++) { // loop over digis
3691 CbmLink L0 = digiMatch4->GetLink(iLink);
3692 Int_t iDigInd0 = L0.GetIndex();
3693 const CbmTofDigi* pDig0 = fDigiMan->Get<CbmTofDigi>(iDigInd0);
3694 dTot4 += pDig0->GetTot();
3695 LOG(debug) << Form(" dTot4 of hit 0x%08x: digind %d add %f -> sum %f", iDetId2, iDigInd0,
3696 pDig0->GetTot(), dTot4);
3697 }
3698
3699 dTot4 /= digiMatch4->GetNofLinks(); // average time over threshold
3700 fhTot4DT04D4sbest->Fill(TMath::Log(dTot4), dToD34);
3701
3702 fhCluSize0DT04D4sbest->Fill(digiMatch3->GetNofLinks() / 2., dToD34);
3703
3704 Double_t dTot3 = 0.;
3706 for (Int_t iLink = 0; iLink < digiMatch3->GetNofLinks(); iLink++) { // loop over digis
3707 CbmLink L0 = digiMatch3->GetLink(iLink);
3708 Int_t iDigInd0 = L0.GetIndex();
3709 const CbmTofDigi* pDig0 = fDigiMan->Get<CbmTofDigi>(iDigInd0);
3710 dTot3 += pDig0->GetTot();
3711 LOG(debug) << Form(" dTot of hit 0x%08x: digind %d add %f -> sum %f", iDetId1, iDigInd0,
3712 pDig0->GetTot(), dTot3);
3713 }
3714 dTot3 /= digiMatch3->GetNofLinks(); // average time over threshold
3715 fhTot0DT04D4sbest->Fill(TMath::Log(dTot3), dToD34);
3716
3717 fhDTMul0D4sbest->Fill(dMul0, dToD34);
3718
3719 // check for dependence in counter reference frame
3720 /*TGeoNode *fNode3=*/ // prepare global->local trafo
3721 gGeoManager->FindNode(fChannelInfo3->GetX(), fChannelInfo3->GetY(), fChannelInfo3->GetZ());
3722
3723 hitpos3[0] = pChi2Hit1[iM]->GetX();
3724 hitpos3[1] = pChi2Hit1[iM]->GetY();
3725 hitpos3[2] = pChi2Hit1[iM]->GetZ();
3726
3727 /*TGeoNode* cNode3=*/gGeoManager->GetCurrentNode();
3728 gGeoManager->MasterToLocal(hitpos3, hitpos3_local);
3729
3730 fhDTX0D4sbest->Fill(hitpos3_local[0], dToD34);
3731 fhDTY0D4sbest->Fill(hitpos3_local[1], tof4 - tof4 - dTcor4);
3732 fhDXX0D4sbest->Fill(hitpos3_local[0], xPos3 - xPos4);
3733 fhDXY0D4sbest->Fill(hitpos3_local[1], xPos3 - xPos4);
3734 fhDYX0D4sbest->Fill(hitpos3_local[0], yPos3 - yPos4);
3735 fhDYY0D4sbest->Fill(hitpos3_local[1], yPos3 - yPos4);
3736
3737 fhDXDY04D4sbest->Fill(xPos3 - xPos4, yPos3 - yPos4);
3738 fhDXDT04D4sbest->Fill(xPos3 - xPos4, dToD34);
3739 fhDYDT04D4sbest->Fill(yPos3 - yPos4, dToD34);
3740 fhDistDT04D4sbest->Fill(dDist34, dToD34);
3741 fhTexpDT04D4sbest->Fill(dDTexp4, dToD34);
3742 fhX0DT04D4sbest->Fill(hitpos3_local[0], dToD34);
3743 fhY0DT04D4sbest->Fill(hitpos3_local[1], dToD34);
3744
3745 fhDT04DX0_2->Fill(hitpos1_local[0] - hitpos3_local[0], dToD34);
3746 fhDT04DY0_2->Fill(hitpos1_local[1] - hitpos3_local[1], dToD34);
3747 fhDT04DT0_2->Fill(tof1 - tof3, dToD34);
3748
3749 fhDT04DX4_2->Fill(hitpos2_local[0] - hitpos4_local[0], dToD34);
3750 fhDT04DY4_2->Fill(hitpos2_local[1] - hitpos4_local[1], dToD34);
3751 fhDT04DT4_2->Fill(tof2 - tof4, dToD34);
3752
3753 fhDT04DX0_1->Fill(hitpos1_local[0] - hitpos3_local[0], dToD);
3754 fhDT04DY0_1->Fill(hitpos1_local[1] - hitpos3_local[1], dToD);
3755 fhDT04DT0_1->Fill(tof1 - tof3, dToD);
3756
3757 fhDT04DX4_1->Fill(hitpos2_local[0] - hitpos4_local[0], dToD);
3758 fhDT04DY4_1->Fill(hitpos2_local[1] - hitpos4_local[1], dToD);
3759 fhDT04DT4_1->Fill(tof2 - tof4, dToD);
3760
3761 break;
3762 }
3763 }
3764 }
3765
3766 fhSelTypeAccNNChiSq->Fill(0., 3. * Chi2List[iM0]);
3767 fhSelTypeAccNNResidualT->Fill(0., dToD);
3768 fhSelTypeAccNNResidualX->Fill(0., xPos1 - xPos2 - fdDXMean);
3769 fhSelTypeAccNNResidualY->Fill(0., yPos1 - yPos2 - fdDYMean);
3770
3771 fhSelTypeNNChiSq->Fill(0., 3. * Chi2List[iM0]);
3772 fhSelTypeNNResidualT->Fill(0., dToD);
3773 fhSelTypeNNResidualX->Fill(0., xPos1 - xPos2 - fdDXMean);
3774 fhSelTypeNNResidualY->Fill(0., yPos1 - yPos2 - fdDYMean);
3775
3776 fhSelHitTupleResidualTTIS->Fill((dTAv - fdStartSpillTime) / 1.E9, dToD);
3777 fhSelHitTupleDutCluSizeTIS->Fill((dTAv - fdStartSpillTime) / 1.E9, dCluSize0);
3778
3779 } // fdChi2Lim end
3780 else {
3782 fhSelHitTupleMatchEfficiencyTIS->Fill(kFALSE, (dTAv - fdStartSpillTime) / 1.E9);
3783
3784 fhSelTypeNNChiSq->Fill(0., 3. * Chi2List[iM0]);
3785 fhSelTypeNNResidualT->Fill(0., dToD);
3786 fhSelTypeNNResidualX->Fill(0., xPos1 - xPos2 - fdDXMean);
3787 fhSelTypeNNResidualY->Fill(0., yPos1 - yPos2 - fdDYMean);
3788 }
3789
3790
3791 Int_t iSelHitTupleDutHitMatchMul(0);
3792 Int_t iSelHitTupleDutHitMatchAccMul(0);
3793
3794 for (Int_t iMatch = 0; iMatch < iNbMatchedHits; iMatch++) {
3795 if (pHitRef == pChi2Hit2[iMatch]) {
3796 iSelHitTupleDutHitMatchMul++;
3797
3798 if (fdChi2Lim > Chi2List[iMatch]) { iSelHitTupleDutHitMatchAccMul++; }
3799 }
3800 }
3801
3802 if (iSelHitTupleDutHitMatchMul) { fhSelHitTupleDutHitMatchMul->Fill(iSelHitTupleDutHitMatchMul); }
3803
3804 if (iSelHitTupleDutHitMatchAccMul) { fhSelHitTupleDutHitMatchAccMul->Fill(iSelHitTupleDutHitMatchAccMul); }
3805
3806 } // end of if(iNbMatchedHits>0)
3807 else {
3809 fhSelHitTupleMatchEfficiencyTIS->Fill(kFALSE, (dTAv - fdStartSpillTime) / 1.E9);
3810 }
3811 } // BSel[0] condition end
3812
3813 // Tracklet based analysis
3814 Double_t hitpos[3], hitpos_local[3];
3815
3816 // DDDDDD for verifying storage concept
3817 /*
3818 if(fFindTracks != NULL && fdMemoryTime > 0.) {
3819 // everything else done -> update hit memory to latest hits
3820 for( Int_t iHitInd = 0; iHitInd < iNbTofHits; iHitInd++)
3821 {
3822 pHit = (CbmTofHit*) fTofHitsColl->At( iHitInd );
3823 if(NULL == pHit) continue;
3824 Int_t iDetId = (pHit->GetAddress() & DetMask);
3825 Int_t iDet=fFindTracks->fMapRpcIdParInd[iDetId];
3826 fChannelInfo = fDigiPar->GetCell(pHit->GetAddress());
3827 gGeoManager->FindNode(fChannelInfo->GetX(),fChannelInfo->GetY(),fChannelInfo->GetZ());
3828 hitpos[0]=pHit->GetX();
3829 hitpos[1]=pHit->GetY();
3830 hitpos[2]=pHit->GetZ();
3831 gGeoManager->MasterToLocal(hitpos, hitpos_local);
3832 Int_t iBin = fhLHTime[iDet]->FindBin( hitpos_local[0], hitpos_local[1] );
3833 fhLHTime[iDet]->SetBinContent(iBin,pHit->GetTime()-2.);
3834 LOG(debug) << Form("Store hit 0x%08x at x %6.3f, y %6.3f, bin %d, time %f in det Id 0x%08x, #%d from x %6.3f, y %6.3f",
3835 pHit->GetAddress(),hitpos_local[0],hitpos_local[1], iBin,
3836 pHit->GetTime(), iDetId, iDet, hitpos[0],hitpos[1] )
3837 ;
3838 }
3839 } //(fdMemoryTime > 0.) end
3840 */
3841
3842 fhTIS_Nhit->Fill((dTAv - fdStartSpillTime) / 1.E9, (Double_t) iNbTofHits);
3843 if (NULL != fTofTrackColl && NULL != fFindTracks) {
3844 Bool_t bSelTrackletFound(kFALSE);
3845 Int_t iBestTrklFitIndex(-1);
3846 Double_t dBestTrklFitRedChiSq(1.E300);
3847
3848 iNbTofTracks = fTofTrackColl->GetEntriesFast();
3849 fhTIS_Ntrk->Fill((dTAv - fdStartSpillTime) / 1.E9, (Double_t) iNbTofTracks);
3850
3851 Int_t NStations = fFindTracks->GetNStations();
3852 LOG(debug) << Form("Tracklet analysis of %d tracklets from %d stations", iNbTofTracks, NStations);
3853
3854 // if(dMul4<=dM4Max && dMulD<=dMDMax &&dMulS2<=dM4Max)
3855 if (dMul0 <= dM0Max && dMul4 <= dM4Max && dMulD <= dMDMax && dMulS2 <= dM4Max)
3856 if (iNbTofTracks > 0) { // Tracklet Analysis
3857 // prepare Dut Hit List
3858
3860 fChannelInfo = fDigiPar->GetCell(iChIdDut);
3861 /*TGeoNode *fNode=*/ // prepare global->local trafo
3862 gGeoManager->FindNode(fChannelInfo->GetX(), fChannelInfo->GetY(), fChannelInfo->GetZ());
3863 /*TGeoNode* cNode=*/gGeoManager->GetCurrentNode();
3864 Double_t dDutzPos = fChannelInfo->GetZ();
3865
3866 LOG(debug) << Form("Tracklet analysis of %d tracks and %d Dut Hits ", iNbTofTracks, (int) vDutHit.size());
3867
3868 std::vector<std::map<Double_t, Int_t>> vTrkMap; //contains the tracks for a given hit
3869 std::vector<std::map<Double_t, Int_t>> vHitMap; //contains the hits for a given track
3870
3871 vTrkMap.resize(vDutHit.size());
3872 vHitMap.resize(iNbTofTracks);
3873
3874 std::multimap<Double_t, std::pair<Int_t, Int_t>> RedChiSqTrackletDutHitPair;
3875 std::map<Int_t, std::pair<Int_t, Double_t>> TrackletMatchedDutHitRedChiSq;
3876
3877 for (Int_t iTrk = 0; iTrk < iNbTofTracks; iTrk++) {
3878 CbmTofTracklet* pTrk = (CbmTofTracklet*) fTofTrackColl->At(iTrk);
3879 if (NULL == pTrk) continue;
3880
3881 if (dBestTrklFitRedChiSq > pTrk->GetChiSq()) {
3882 dBestTrklFitRedChiSq = pTrk->GetChiSq();
3883 iBestTrklFitIndex = iTrk;
3884 }
3885 }
3886
3887 for (Int_t iTrk = 0; iTrk < iNbTofTracks; iTrk++) { // loop over all Tracklets
3888 CbmTofTracklet* pTrk = (CbmTofTracklet*) fTofTrackColl->At(iTrk);
3889 if (NULL == pTrk) continue;
3890 fhTrklNofHitsRate->Fill((pTrk->GetTime() - StartAnalysisTime) / 1.E9,
3891 pTrk->GetNofHits()); // Monitor tracklet size
3892 for (Int_t iTH = 0; iTH < pTrk->GetNofHits(); iTH++) { // Loop over Tracklet hits
3893 fhTrklDetHitRate->Fill((pTrk->GetTime() - StartAnalysisTime) / 1.E9, // Station hit rate
3895 }
3896
3897 fhTrklNofHitsRateInSpill->Fill((pTrk->GetTime() - fdStartSpillTime) / 1.E9,
3898 pTrk->GetNofHits()); // Monitor tracklet size
3899 for (Int_t iTH = 0; iTH < pTrk->GetNofHits(); iTH++) { // Loop over Tracklet hits
3901 (pTrk->GetTime() - fdStartSpillTime) / 1.E9, // Station hit rate
3903 }
3904
3905 /*
3906 if (pTrk->GetNofHits() < NStations - 1) continue;
3907
3908 // Calculate positions and time in Dut plane
3909 Double_t dXex=pTrk->GetFitX(dDutzPos);
3910 Double_t dYex=pTrk->GetFitY(dDutzPos);
3911 Double_t dR=TMath::Sqrt(dXex*dXex + dYex*dYex + dDutzPos*dDutzPos);
3912 Double_t dTex=pTrk->GetFitT(dR);
3913
3914 for (UInt_t i=0; i<vDutHit.size();i++){ // loop over Dut Hits
3915 Double_t dChi = TMath::Sqrt(TMath::Power(TMath::Abs(dTex-vDutHit[i]->GetTime())/fSIGT,2)
3916 +TMath::Power(TMath::Abs(dXex-vDutHit[i]->GetX())/fSIGX,2)
3917 +TMath::Power(TMath::Abs(dYex-vDutHit[i]->GetY())/fSIGY,2))/3;
3918 LOG(debug1)<<Form(" Inspect track %d, hit %d Chi %6.2f,%6.2f, T %6.2f,%6.2f ",
3919 iTrk,i,dChi,fSIGLIM,dTex,vDutHit[i]->GetTime())
3920 ;
3921
3922 if(dChi < fSIGLIM) { // acceptable match
3923 if(vHitMap[iTrk].size()>0) {
3924 Int_t iCnt=0;
3925 for ( std::map<Double_t,Int_t>::iterator it=vHitMap[iTrk].begin(); it!=vHitMap[iTrk].end(); it++){
3926 iCnt++;
3927 LOG(debug)<<Form(" HitMap[%d]: cnt %d, check %d, %6.2f > %6.2f ?",iTrk,iCnt, it->second,it->first,dChi)
3928 ;
3929 if(it->first > dChi) {
3930 vHitMap[iTrk].insert(--it,std::pair<Double_t, Int_t>(dChi,i));
3931 LOG(debug)<<Form(" HitMap[%d]: ins at %d: %d, %6.2f ",iTrk,iCnt,it->second,it->first);
3932 break;
3933 }
3934 }
3935 }
3936 else{
3937 vHitMap[iTrk].insert(std::pair<Double_t, Int_t>(dChi,i));
3938 LOG(debug)<<Form(" HitMap[%d]: start %d, %6.2f ",iTrk,i,dChi);
3939 }
3940
3941 if(vTrkMap[i].size()>0) {
3942 for ( std::map<Double_t,Int_t>::iterator it=vTrkMap[i].begin(); it!=vTrkMap[i].end(); it++){
3943 if(it->first > dChi) {
3944 vTrkMap[i].insert(--it,std::pair<Double_t, Int_t>(dChi,iTrk));
3945 break;
3946 }
3947 }
3948 }
3949 else{
3950 vTrkMap[i].insert(std::pair<Double_t, Int_t>(dChi,iTrk));
3951 }
3952
3953 } // end of Chi condition
3954 if(vTrkMap[i].size()>0)
3955 LOG(debug1)<<Form(" TrkMap[%d]: best %d, %6.4f ",i,vTrkMap[i].begin()->second,vTrkMap[i].begin()->first)
3956 ;
3957 }
3958 if(vHitMap[iTrk].size()>0)
3959 LOG(debug)<<Form(" HitMap[%d]: best %d, %6.4f ",iTrk,vHitMap[iTrk].begin()->second,vHitMap[iTrk].begin()->first)
3960 ;
3961 } // tracklet loop end
3962
3963 // inspect assignment results
3964 Int_t iCheck = 1;
3965 while(iCheck-- > 0)
3966 for(Int_t iHit=0; static_cast<UInt_t>(iHit)<vDutHit.size(); iHit++) {
3967 if(vTrkMap[iHit].size()>0){
3968 Int_t iTrk=vTrkMap[iHit].begin()->second; // hit was assigned best to track iTrk
3969 if(vHitMap[iTrk].begin()->second == iHit) { // unique/consistent assignment
3970 LOG(debug)<<Form(" Hit %d -> HitMap[%d]: uni %d, %6.4f ",
3971 iHit,iTrk,vHitMap[iTrk].begin()->second,vHitMap[iTrk].begin()->first)
3972 ;
3973 // remove all other assignments of this hit and this track
3974 for ( std::map<Double_t,Int_t>::iterator it=vTrkMap[iHit].begin()++; it != vTrkMap[iHit].end(); it++){
3975 Int_t iTrk1=it->second;
3976 if(iTrk != iTrk1)
3977 for ( std::map<Double_t,Int_t>::iterator it1=vHitMap[iTrk1].begin()++; it1 != vHitMap[iTrk1].end(); it1++){
3978 if(it1->second == iHit) {
3979 vHitMap[iTrk1].erase(it1);
3980 LOG(debug1)<<Form(" Erase hit %d from HitMap[%d]",iHit,iTrk1);
3981 break;
3982 }
3983 }
3984 }
3985 for ( std::map<Double_t,Int_t>::iterator it=vHitMap[iTrk].begin()++; it != vHitMap[iTrk].end(); it++){
3986 Int_t iHit1=it->second;
3987 if(iHit != iHit1)
3988 for ( std::map<Double_t,Int_t>::iterator it1=vTrkMap[iHit1].begin()++; it1 != vTrkMap[iHit1].end(); it1++){
3989 if(it1->second == iTrk) {
3990 vTrkMap[iHit1].erase(it1);
3991 LOG(debug1)<<Form(" Erase trk %d from TrkMap[%d]",iHit1,iTrk);
3992 break;
3993 }
3994 }
3995 }
3996 }else{ // mismatch, other track fits even better
3997 LOG(debug)<<Form(" Hit %d -> HitMap[%d]: mis %d, %6.4f < %6.4f ",iHit,iTrk,
3998 vHitMap[iTrk].begin()->second,vHitMap[iTrk].begin()->first,vTrkMap[iHit].begin()->first)
3999 ;
4000 }
4001 LOG(debug)<<Form(" Hit %d -> TrkMap.size: %d ",iHit,(int)vTrkMap[iHit].size())
4002 ;
4003
4004 }
4005 */
4006
4007 if (fChi2LimFit < pTrk->GetChiSq()) { continue; }
4008
4010 if (iTrk != iBestTrklFitIndex) { continue; }
4011 }
4012
4013
4014 if (NStations == pTrk->GetNofHits()) {
4016 if (pTrk->ContainsAddr(fiDutAddr)) {
4017 LOG(fatal) << "DUT hit found already attached to a tracklet in "
4018 "'AttachDutHitToTracklet' mode!";
4019 }
4020
4021 Int_t iSelTrklDutHitMatchMul(0);
4022 Int_t iSelTrklDutHitMatchAccMul(0);
4023
4024 Double_t dXex = pTrk->GetFitX(dDutzPos);
4025 Double_t dYex = pTrk->GetFitY(dDutzPos);
4026 Double_t dTex = pTrk->GetFitT(dDutzPos);
4027
4028 for (auto const& iHit : DutHitSet) {
4029 CbmTofHit* tHit = dynamic_cast<CbmTofHit*>(fTofHitsColl->At(iHit));
4030
4031 Double_t dRedChiSq = (TMath::Power(TMath::Abs(dTex - tHit->GetTime()) / GetSigT(1), 2)
4032 + TMath::Power(TMath::Abs(dXex - tHit->GetX()) / GetSigX(1), 2)
4033 + TMath::Power(TMath::Abs(dYex - tHit->GetY()) / GetSigY(1), 2))
4034 / 3.;
4035
4036 RedChiSqTrackletDutHitPair.emplace(dRedChiSq, std::make_pair(iTrk, iHit));
4037
4038
4039 iSelTrklDutHitMatchMul++;
4040
4041 if (dRedChiSq < fSIGLIM) { iSelTrklDutHitMatchAccMul++; }
4042 }
4043
4044
4045 if (iSelTrklDutHitMatchMul) { fhSelTrklDutHitMatchNNMul->Fill(iSelTrklDutHitMatchMul); }
4046
4047 if (iSelTrklDutHitMatchAccMul) { fhSelTrklDutHitMatchAccNNMul->Fill(iSelTrklDutHitMatchAccMul); }
4048 }
4049
4050 // A selector tracklet is considered to be found in a given reconstructed
4051 // event if the event satisfies the specified hit multiplicity criteria
4052 // and at least one reconstructed tracklet comprises hits from
4053 // 'CbmTofFindTracks::fNTofStations' counters.
4054 bSelTrackletFound = kTRUE;
4055 }
4056 }
4057
4058
4060 // DUT hits are (if at all) AMBIGUOUSLY matched with selector tracklets
4061 // (possibly multiple tracklets -> one hit) according to a minimum reduced
4062 // chi-square criterion. As the chi-square keys of the map looped over
4063 // below are sorted in ascending order, all other map elements containing
4064 // the corresponding tracklet index can be eliminated. The best match
4065 // (i.e. the lowest chi-square value) has been identified for the tracklet
4066 // by the current map element.
4067 for (auto itChi2Map = RedChiSqTrackletDutHitPair.cbegin(); itChi2Map != RedChiSqTrackletDutHitPair.cend();) {
4068 Double_t dRedChiSq = itChi2Map->first;
4069 Int_t iUsedTracklet = itChi2Map->second.first;
4070 Int_t iUsedHit = itChi2Map->second.second;
4071
4072 TrackletMatchedDutHitRedChiSq.emplace(iUsedTracklet, std::make_pair(iUsedHit, dRedChiSq));
4073
4074 Bool_t bFoundNextUniqueMatch(kFALSE);
4075
4076 for (auto itSubMap = ++itChi2Map; itSubMap != RedChiSqTrackletDutHitPair.cend();) {
4077 Int_t iTracklet = itSubMap->second.first;
4078 // Int_t iHit = itSubMap->second.second; (VF) not used
4079
4080 // Uncomment the rear part of the following line of code to obtain
4081 // UNIQUE hit-to-tracklet matching.
4082 if (iUsedTracklet == iTracklet) // || iUsedHit == iHit)
4083 {
4084 itSubMap = RedChiSqTrackletDutHitPair.erase(itSubMap);
4085 }
4086 else {
4087 if (!bFoundNextUniqueMatch) {
4088 itChi2Map = itSubMap;
4089 bFoundNextUniqueMatch = kTRUE;
4090 }
4091
4092 ++itSubMap;
4093 }
4094 }
4095
4096 if (!bFoundNextUniqueMatch) { itChi2Map = RedChiSqTrackletDutHitPair.cend(); }
4097 }
4098 }
4099
4100
4101 // fill tracklet histos
4102 Double_t dTiS = (dTAv - fdStartSpillTime) / 1.E9; // Time in Spill of current event
4103 for (Int_t iTrk = 0; iTrk < iNbTofTracks; iTrk++) { // loop over all Tracklets
4104 CbmTofTracklet* pTrk = (CbmTofTracklet*) fTofTrackColl->At(iTrk);
4105 if (NULL == pTrk) continue;
4106 if (pTrk->GetNofHits() < NStations - 1) continue; // pick only full & full - 1 tracklets
4107
4108 if (fChi2LimFit < pTrk->GetChiSq()) { continue; }
4109
4111 if (iTrk != iBestTrklFitIndex) { continue; }
4112 }
4113
4114 pLHit = NULL;
4115 Double_t dDelTLH = 11.;
4116 Double_t dTLH = 0.;
4117 hitpos[0] = pTrk->GetFitX(dDutzPos);
4118 hitpos[1] = pTrk->GetFitY(dDutzPos);
4119 hitpos[2] = dDutzPos;
4120 gGeoManager->FindNode(fChannelInfoDut->GetX(), fChannelInfoDut->GetY(), fChannelInfoDut->GetZ());
4121 gGeoManager->MasterToLocal(hitpos, hitpos_local);
4122
4123 // select limited Dut area
4124 if (TMath::Abs(hitpos_local[0] - fdDutX) > fdDutDX || TMath::Abs(hitpos_local[1] - fdDutY) > fdDutDY)
4125 continue;
4126
4127 pLHit = NULL;
4129 Double_t LHpos[3], LHpos_local[3];
4130 Int_t iBinA = 0;
4131 if (fhLHTime.size() > static_cast<size_t>(iDet)) {
4132 Int_t iBin = fhLHTime[iDet]->FindBin(hitpos_local[0], hitpos_local[1]);
4133 iBinA = iBin - 1; // index in pointer array
4134
4135 if (iBin <= 0 || iBin > fhLHTime[iDet]->GetNbinsX() * fhLHTime[iDet]->GetNbinsY()) {
4136 LOG(debug) << "Invalid bin number for reading fhLHTime, det " << iDet << ": " << iBin << ", " << dTLH;
4137 dTLH = 0.;
4138 }
4139 else
4140 pLHit = fvLHit[iDet][iBinA]; // pointer to Last Hit object
4141
4142 if (NULL != pLHit) {
4143 dTLH = fhLHTime[iDet]->GetBinContent(iBin);
4144 if (pLHit->GetTime() != dTLH)
4145 LOG(fatal) << " LHTime mismatch for Det " << iDet << ", Bin " << iBin
4146 << Form(": %f - %f = %f", pLHit->GetTime(), dTLH, pLHit->GetTime() - dTLH);
4147 if (0) {
4148 // Check whether neighbouring bins contain later hit
4149 Int_t iNbinsX = (Int_t) fhLHTime[iDet]->GetNbinsX();
4150 CbmTofHit* pLLHit = pLHit;
4151 Double_t dTLLH = dTLH;
4152 Int_t iRow = iBin / iNbinsX + 1;
4153 Int_t iCol = iBin % iNbinsX;
4154
4155 if (iCol > 1) { // check left side
4156 if (fhLHTime[iDet]->GetBinContent(iBin - 1) > dTLLH) {
4157 pLLHit = fvLHit[iDet][iBinA - 1];
4158 dTLLH = pLLHit->GetTime();
4159 }
4160 if (iRow > 1) { // lower neighbbour
4161 for (Int_t iBLL = iBin - iNbinsX - 1; iBLL < iBin - iNbinsX + 1; iBLL++) {
4162 if (fhLHTime[iDet]->GetBinContent(iBLL) > dTLLH) {
4163 pLLHit = fvLHit[iDet][iBLL - 1];
4164 dTLLH = pLLHit->GetTime();
4165 }
4166 }
4167 }
4168 if (iRow < iNbinsX - 1) { //upper neighbour
4169 for (Int_t iBLL = iBin + iNbinsX - 1; iBLL < iBin + iNbinsX + 1; iBLL++) {
4170 if (fhLHTime[iDet]->GetBinContent(iBLL) > dTLLH) {
4171 pLLHit = fvLHit[iDet][iBLL - 1];
4172 dTLLH = pLLHit->GetTime();
4173 }
4174 }
4175 }
4176 }
4177 if (iCol < iNbinsX - 1) { // check right side
4178 if (fhLHTime[iDet]->GetBinContent(iBin + 1) > dTLLH) {
4179 pLLHit = fvLHit[iDet][iBin];
4180 dTLLH = pLLHit->GetTime();
4181 }
4182 if (iRow > 1) { // lower neighbbour
4183 for (Int_t iBLL = iBin - iNbinsX + 1; iBLL < iBin - iNbinsX + 2; iBLL++) {
4184 if (fhLHTime[iDet]->GetBinContent(iBLL) > dTLLH) {
4185 pLLHit = fvLHit[iDet][iBLL - 1];
4186 dTLLH = pLLHit->GetTime();
4187 }
4188 }
4189 }
4190 if (iRow < iNbinsX - 1) { //upper neighbour
4191 for (Int_t iBLL = iBin + iNbinsX + 1; iBLL < iBin + iNbinsX + 2; iBLL++) {
4192 if (fhLHTime[iDet]->GetBinContent(iBLL) > dTLLH) {
4193 pLLHit = fvLHit[iDet][iBLL - 1];
4194 dTLLH = pLLHit->GetTime();
4195 }
4196 }
4197 }
4198 }
4199 pLHit = pLLHit;
4200 dTLH = dTLLH;
4201 } // enable/disable neigbor inspection
4202 // TODO: Why was the fitted tracklet time at the origin (and not at the DUT plane) used here before?
4203 // if( dTLH > 0) dDelTLH=TMath::Log10( pTrk->GetTime()-dTLH);
4204 if (dTLH > 0) dDelTLH = TMath::Log10(pTrk->GetFitT(dDutzPos) - dTLH);
4205 /*
4206 LOG(info)<< "Got LHTime NbinsX: "<<iNbinsX
4207 << ", Bin "<<iBin<<", Row "<<iRow<<", Col "<<iCol
4208 << ": TLH "<<dTLH<<", "<<dTLLH
4209 ;
4210 */
4211 LHpos[0] = pLHit->GetX();
4212 LHpos[1] = pLHit->GetY();
4213 LHpos[2] = pLHit->GetZ();
4214 gGeoManager->MasterToLocal(LHpos, LHpos_local);
4215
4216 if (0)
4217 LOG(info) << Form(" expect hit at %f in %d. spill got TLH = %f, DelT %f for "
4218 "Det %d at x %6.2f, y %6.2f, bin %d from x %6.2f, y %6.2f",
4219 pTrk->GetTime(), iNspills, dTLH, dDelTLH, iDet, hitpos_local[0], hitpos_local[1],
4220 iBin, LHpos_local[0], LHpos_local[1]);
4221 }
4222 if (0)
4223 LOG(info) << Form(" Trkl with %d hits expect Dut hit at %f in %d. spill after "
4224 "TLH = %f, LogDelT %f for Det %d in Bin %d at x %6.2f, y %6.2f",
4225 pTrk->GetNofHits(), pTrk->GetTime(), iNspills, dTLH, dDelTLH, iDet, iBinA,
4226 hitpos_local[0], hitpos_local[1]);
4227 }
4228
4229 Bool_t bGoodSelTracklet(kFALSE);
4230 Bool_t bGoodSelTrackletDutMatch(kFALSE);
4231
4232 auto itDutHitMatch = TrackletMatchedDutHitRedChiSq.find(iTrk);
4233
4234 Double_t dVel = 0.;
4235 Double_t dTt = fTrackletTools->FitTt(pTrk, fiDutAddr);
4236 if (dTt > 0.) dVel = 1. / dTt;
4237
4238 if (NStations == pTrk->GetNofHits()) {
4241 if (fbTracksInInputFile) {
4242 Int_t iMatchedRealTrackLink(-1);
4243 std::set<Int_t> RealTrackLinkSet;
4244
4245 CbmTrackMatchNew* tTrackletAccTrackMatch =
4246 dynamic_cast<CbmTrackMatchNew*>(fTofTrackletAccTrackMatches->At(iTrk));
4247 const CbmLink& tLink = tTrackletAccTrackMatch->GetMatchedLink();
4248 Double_t dSelTrackletMaxTrackLinkWeight = tLink.GetWeight();
4249
4250 for (Int_t iSelTrackletTrackLink = 0; iSelTrackletTrackLink < tTrackletAccTrackMatch->GetNofLinks();
4251 iSelTrackletTrackLink++) {
4252 const CbmLink& tSelTrackletTrackLink = tTrackletAccTrackMatch->GetLink(iSelTrackletTrackLink);
4253
4254 if (dSelTrackletMaxTrackLinkWeight == tSelTrackletTrackLink.GetWeight()
4255 && -1 < tSelTrackletTrackLink.GetIndex()) {
4256 iMatchedRealTrackLink = tSelTrackletTrackLink.GetIndex();
4257 RealTrackLinkSet.emplace(tSelTrackletTrackLink.GetIndex());
4258 }
4259 }
4260
4261 // For a pure sel tracklet, request a particle track match different
4262 // from a beam or a dark point.
4263 // The case that a noise link and a particle link have the same weight
4264 // and the noise link is - by chance - the matched one is handled here:
4265 // The noise link is ignored while assessing purity if and only if a
4266 // particle link with the same weight exists.
4267 if (-1 < iMatchedRealTrackLink) {
4268 if (1. == tTrackletAccTrackMatch->GetTrueOverAllHitsRatio()) {
4269 fhSelTrklPurity->Fill(kTRUE, fiNAccRefTracks);
4270 bGoodSelTracklet = kTRUE;
4271 }
4272 else {
4273 fhSelTrklPurity->Fill(kFALSE, fiNAccRefTracks);
4274 }
4275 }
4276 else {
4277 fhSelTrklPurity->Fill(kFALSE, fiNAccRefTracks);
4278 }
4279
4280 if (bGoodSelTracklet) {
4281 TGeoNode* tNode(NULL);
4282 TGeoMedium* tMedium(NULL);
4283 TGeoMaterial* tMaterial(NULL);
4284
4285 const char* cMaterialName;
4286
4287 const char* cSelRefTrackPdgName;
4288 const char* cSelRefTrackProcessName;
4289
4290 Bool_t bSelRefTrack(kFALSE);
4291
4292 for (auto const& iTrack : RealTrackLinkSet) {
4293 CbmMCTrack* tTrack = dynamic_cast<CbmMCTrack*>(fAccTracks->At(iTrack));
4294 CbmMatch* tTrackPointMatch = dynamic_cast<CbmMatch*>(fTofAccTrackPointMatches->At(iTrack));
4295
4296 tNode = gGeoManager->FindNode(tTrack->GetStartX(), tTrack->GetStartY(), tTrack->GetStartZ());
4297 tMedium = tNode->GetMedium();
4298 tMaterial = tMedium->GetMaterial();
4299
4300 GetMaterialName(tMaterial->GetName(), cMaterialName);
4301
4302 if (0 == std::strcmp("target", cMaterialName)
4304 bSelRefTrack = kTRUE;
4305
4306 GetPdgName(tTrack->GetPdgCode(), cSelRefTrackPdgName);
4307 GetProcessName(TMCProcessName[tTrack->GetGeantProcessId()], cSelRefTrackProcessName);
4308 }
4309 }
4310
4311 if (bSelRefTrack) {
4313 fhSelTrklRefTrackProcSpec->Fill(cSelRefTrackProcessName, cSelRefTrackPdgName, 1.);
4314 }
4315 else {
4317 }
4318
4319
4320 if (itDutHitMatch != TrackletMatchedDutHitRedChiSq.end()) {
4321 Int_t iDutHitIndex = itDutHitMatch->second.first;
4322
4323 CbmMatch* tDutHitTrackMatch = dynamic_cast<CbmMatch*>(fTofHitAccTrackMatches->At(iDutHitIndex));
4324
4325
4326 for (Int_t iSelTrackletTrackLink = 0;
4327 iSelTrackletTrackLink < tTrackletAccTrackMatch->GetNofLinks(); iSelTrackletTrackLink++) {
4328 const CbmLink& tSelTrackletTrackLink = tTrackletAccTrackMatch->GetLink(iSelTrackletTrackLink);
4329
4330 if (dSelTrackletMaxTrackLinkWeight == tSelTrackletTrackLink.GetWeight()) {
4331 for (Int_t iDutHitTrackLink = 0; iDutHitTrackLink < tDutHitTrackMatch->GetNofLinks();
4332 iDutHitTrackLink++) {
4333 const CbmLink& tDutHitTrackLink = tDutHitTrackMatch->GetLink(iDutHitTrackLink);
4334
4335 if (tSelTrackletTrackLink == tDutHitTrackLink) {
4336 bGoodSelTrackletDutMatch = kTRUE;
4337 break;
4338 }
4339 }
4340 }
4341
4342 if (bGoodSelTrackletDutMatch) { break; }
4343 }
4344
4345 if (bGoodSelTrackletDutMatch) {
4346 fhGoodSelTypeNNPureChiSq->Fill(1, 3. * itDutHitMatch->second.second);
4347 }
4348
4349 fhGoodSelTypeNNAllChiSq->Fill(1, 3. * itDutHitMatch->second.second);
4350 }
4351 }
4352 }
4353 }
4354 }
4355 }
4356
4357
4358 // matched hit found
4359 if ((!fbAttachDutHitToTracklet && pTrk->GetNofHits() == NStations && pTrk->ContainsAddr(fiDutAddr))
4360 || (fbAttachDutHitToTracklet && pTrk->GetNofHits() == NStations
4361 && itDutHitMatch != TrackletMatchedDutHitRedChiSq.end() && itDutHitMatch->second.second < fSIGLIM)) {
4362 LOG(debug) << Form(" Event %d : process complete Trkl %d, HMul %d, iDet %d ", fEvents, iTrk,
4364
4365 fhSelTrklFitRedChiSq->Fill(pTrk->GetChiSq());
4366
4367 Int_t iDutHitIndex(-1);
4369 iDutHitIndex = itDutHitMatch->second.first;
4370 // pHit = vDutHit[vHitMap[iTrk].begin()->second];
4371 pHit = dynamic_cast<CbmTofHit*>(fTofHitsColl->At(iDutHitIndex));
4372 }
4373 else {
4374 iDutHitIndex = pTrk->GetTofHitIndex(pTrk->HitIndexOfAddr(fiDutAddr));
4375 pHit = pTrk->HitPointerOfAddr(fiDutAddr);
4376 }
4377
4378 if (NULL == pHit) LOG(warning) << "Dut not found in full length track";
4379
4380 //fChannelInfo = fDigiPar->GetCell(pHit->GetAddress());
4381 //gGeoManager->FindNode(fChannelInfo->GetX(),fChannelInfo->GetY(),fChannelInfo->GetZ());
4382 /*
4383 gGeoManager->FindNode(fChannelInfoDut->GetX(),fChannelInfoDut->GetY(),fChannelInfoDut->GetZ());
4384 hitpos[0]=pHit->GetX();
4385 hitpos[1]=pHit->GetY();
4386 hitpos[2]=pHit->GetZ();
4387 gGeoManager->MasterToLocal(hitpos, hitpos_local);
4388 */
4389
4390 if (fR0LimFit > 0.) // consider only tracks originating from interaction point
4391 if (pTrk->GetR0() > fR0LimFit) continue;
4392
4393 Double_t dDX = pHit->GetX() - pTrk->GetFitX(pHit->GetZ()); // - tPar->GetX() - tPar->GetTx()*dDZ;
4394 Double_t dDXB = pTrk->GetXdif(fiDutAddr, pHit); // ignore pHit in calc of reference
4395 Double_t dDY = pHit->GetY() - pTrk->GetFitY(pHit->GetZ()); // - tPar->GetTy()*dDZ;
4396 Double_t dDYB = pTrk->GetYdif(fiDutAddr, pHit); // ignore pHit in calc of reference
4397 Double_t dDT = pHit->GetTime() - pTrk->GetFitT(pHit->GetZ()); // pTrk->GetTdif(fStationType[iSt]);
4398 Double_t dDTB = pTrk->GetTdif(fiDutAddr, pHit); // ignore pHit in calc of reference
4399
4400 fhDutPullX->Fill(dDX);
4401 fhDutPullXB->Fill(dDXB);
4402 fhDutPullY->Fill(dDY);
4403 fhDutPullYB->Fill(dDYB);
4404 fhDutPullT->Fill(dDT);
4405 fhDutPullTB->Fill(dDTB);
4406 fhDutChi_Found->Fill(pTrk->GetChiSq());
4407
4408 Int_t iGet4 = -1;
4409 Double_t dTot = 0.;
4410 CbmMatch* digiMatch = (CbmMatch*) fTofDigiMatchColl->At(iDutHitIndex);
4411 if (NULL != digiMatch)
4413 for (Int_t iLink = 0; iLink < digiMatch->GetNofLinks(); iLink++) { // loop over digis
4414 CbmLink L0 = digiMatch->GetLink(iLink);
4415 Int_t iDigInd0 = L0.GetIndex();
4416 const CbmTofDigi* pDig0 = fDigiMan->Get<CbmTofDigi>(iDigInd0);
4417 if (iGet4 == -1) {
4418 iGet4 = Int_t(pDig0->GetChannel()) % 8 + 1;
4419 dTot = pDig0->GetTot();
4420 }
4421 else {
4422 if (iGet4 > 0) {
4423 if (pDig0->GetTot() > dTot) {
4424 iGet4 = Int_t(pDig0->GetChannel()) % 8 + 1;
4425 dTot = pDig0->GetTot();
4426 }
4427 //if ( Int_t(pDig0->GetChannel())%8 + 1 != iGet4 ) iGet4=0;
4428 }
4429 }
4430 }
4431 else
4432 LOG(error) << "no Tof Digis";
4433 else
4434 LOG(error) << "no Tof Digi Match";
4435
4437 // fhDutChi_Match->Fill(vHitMap[iTrk].begin()->first);
4438 fhDutChi_Match->Fill(itDutHitMatch->second.second);
4439 }
4440 fhDutXY_Found->Fill(hitpos_local[0], hitpos_local[1]);
4441 fhDutDTLH_Found->Fill(dDelTLH);
4442 fhDutMul_Found->Fill(dMul4);
4443 fhDutTIS_Found->Fill(dTiS, iGet4);
4444 fhDutTIR_Found->Fill(dTIR, iGet4);
4445 fhDutVel_Found->Fill(dVel);
4446
4447 fhDutXYDX->Fill(hitpos_local[0], hitpos_local[1], dDX);
4448 fhDutXYDY->Fill(hitpos_local[0], hitpos_local[1], dDY);
4449 fhDutXYDT->Fill(hitpos_local[0], hitpos_local[1], dDTB);
4450
4452 fhSelTrklMatchEfficiencyTIS->Fill(kTRUE, (dTAv - fdStartSpillTime) / 1.E9);
4453
4456 if (fbTracksInInputFile) {
4457 if (bGoodSelTracklet) {
4458 if (bGoodSelTrackletDutMatch) { fhSelTrklMatchPurity->Fill(kTRUE, fiNAccRefTracks); }
4459 else {
4461 }
4462 }
4463 // uncomment to account for impure selectors in the matching purity calculation
4464 /*
4465 else
4466 {
4467 fhSelTrklMatchPurity->Fill(kFALSE, fiNAccRefTracks);
4468 }
4469*/
4470 }
4471 }
4472
4473
4475 CbmTofHit* tDutHitPointer = dynamic_cast<CbmTofHit*>(fTofHitsColl->At(iDutHitIndex));
4476 Double_t dDutHitChi = pTrk->GetMatChi2(fiDutAddr);
4477
4478 pTrk->RemoveTofHitIndex(-1, fiDutAddr, NULL, 0.);
4480 pTrk->SetTime(pTrk->UpdateT0());
4481 pTrk->AddTofHitIndex(iDutHitIndex, fiDutAddr, tDutHitPointer, dDutHitChi);
4482 pHit = pTrk->HitPointerOfAddr(fiDutAddr);
4483 }
4484
4485 CbmMatch* tDutHitPointMatch = dynamic_cast<CbmMatch*>(fTofHitPointMatches->At(iDutHitIndex));
4486 const CbmLink& tDutHitPointLink = tDutHitPointMatch->GetMatchedLink();
4487 CbmTofPoint* tDutHitMatchedPoint(NULL);
4488
4489 Int_t iFileIndex = tDutHitPointLink.GetFile();
4490 Int_t iEventIndex = tDutHitPointLink.GetEntry();
4491 Int_t iArrayIndex = tDutHitPointLink.GetIndex();
4492
4493 if (-1 < iFileIndex && -1 < iEventIndex && -1 < iArrayIndex) {
4494 Double_t dMCEventStartTime(0.);
4495
4496 if (fbPointsInInputFile) {
4497 tDutHitMatchedPoint = dynamic_cast<CbmTofPoint*>(fTofPointsTB->At(iArrayIndex));
4498 }
4499 else {
4500 tDutHitMatchedPoint =
4501 dynamic_cast<CbmTofPoint*>(fTofPoints->Get(iFileIndex, iEventIndex, iArrayIndex));
4502
4503 dMCEventStartTime = fMCEventList->GetEventTime(iEventIndex, iFileIndex);
4504 }
4505
4506 // fhDutResX_Hit_Trk->Fill(fiNAccRefTracks, pTrk->GetXdif(fiDutAddr, pHit));
4507 fhDutResX_Hit_Trk->Fill(fiNAccRefTracks, pHit->GetX() - pTrk->GetFitX(pHit->GetZ()));
4508 fhDutResX_Trk_MC->Fill(fiNAccRefTracks, pTrk->GetFitX(pHit->GetZ()) - tDutHitMatchedPoint->GetX());
4509 fhDutResX_Hit_MC->Fill(fiNAccRefTracks, pHit->GetX() - tDutHitMatchedPoint->GetX());
4510
4511 // fhDutResY_Hit_Trk->Fill(fiNAccRefTracks, pTrk->GetYdif(fiDutAddr, pHit));
4512 fhDutResY_Hit_Trk->Fill(fiNAccRefTracks, pHit->GetY() - pTrk->GetFitY(pHit->GetZ()));
4513 fhDutResY_Trk_MC->Fill(fiNAccRefTracks, pTrk->GetFitY(pHit->GetZ()) - tDutHitMatchedPoint->GetY());
4514 fhDutResY_Hit_MC->Fill(fiNAccRefTracks, pHit->GetY() - tDutHitMatchedPoint->GetY());
4515
4516 // fhDutResT_Hit_Trk->Fill(fiNAccRefTracks, pTrk->GetTdif(fiDutAddr, pHit));
4517 fhDutResT_Hit_Trk->Fill(fiNAccRefTracks, pHit->GetTime() - pTrk->GetFitT(pHit->GetZ()));
4518 fhDutResT_Trk_MC->Fill(fiNAccRefTracks, pTrk->GetFitT(pHit->GetZ()) - tDutHitMatchedPoint->GetTime()
4519 - dMCEventStartTime);
4521 pHit->GetTime() - tDutHitMatchedPoint->GetTime() - dMCEventStartTime);
4522 }
4523
4526 pTrk->SetTime(pTrk->UpdateT0());
4527 }
4528 }
4529
4531 fhSelTypeAccNNChiSq->Fill(1, 3. * itDutHitMatch->second.second);
4532 fhSelTypeAccNNResidualT->Fill(1, pHit->GetTime() - pTrk->GetFitT(pHit->GetZ()));
4533 fhSelTypeAccNNResidualX->Fill(1, pHit->GetX() - pTrk->GetFitX(pHit->GetZ()));
4534 fhSelTypeAccNNResidualY->Fill(1, pHit->GetY() - pTrk->GetFitY(pHit->GetZ()));
4535
4536 fhSelTypeNNChiSq->Fill(1, 3. * itDutHitMatch->second.second);
4537 fhSelTypeNNResidualT->Fill(1, pHit->GetTime() - pTrk->GetFitT(pHit->GetZ()));
4538 fhSelTypeNNResidualX->Fill(1, pHit->GetX() - pTrk->GetFitX(pHit->GetZ()));
4539 fhSelTypeNNResidualY->Fill(1, pHit->GetY() - pTrk->GetFitY(pHit->GetZ()));
4540
4541 CbmMatch* tDutHitDigiMatch = dynamic_cast<CbmMatch*>(fTofDigiMatchColl->At(iDutHitIndex));
4542
4543 fhSelTrklResidualTTIS->Fill((dTAv - fdStartSpillTime) / 1.E9,
4544 pHit->GetTime() - pTrk->GetFitT(pHit->GetZ()));
4545 fhSelTrklDutCluSizeTIS->Fill((dTAv - fdStartSpillTime) / 1.E9, tDutHitDigiMatch->GetNofLinks() / 2);
4546 }
4547
4548 if (NULL != pLHit) {
4549
4550 CbmMatch* digiMatch0 = (CbmMatch*) fTofDigiMatchColl->At(iDutHitIndex);
4551 Double_t dTot0 = 0.;
4552
4553 if (fDigiMan->IsPresent(ECbmModuleId::kTof) && NULL != digiMatch0) {
4554 for (Int_t iLink = 0; iLink < digiMatch0->GetNofLinks(); iLink++) { // loop over digis
4555 CbmLink L0 = digiMatch0->GetLink(iLink);
4556 Int_t iDigInd0 = L0.GetIndex();
4557 const CbmTofDigi* pDig0 = fDigiMan->Get<CbmTofDigi>(iDigInd0);
4558 dTot0 += pDig0->GetTot();
4559 }
4560 dTot0 /= digiMatch0->GetNofLinks(); // average time over threshold
4561 }
4562 fhDutDTLH_CluSize->Fill(dDelTLH, digiMatch0->GetNofLinks() / 2.);
4563 fhDutDTLH_Tot->Fill(dDelTLH, dTot0);
4564 fhDutDTLH_Mul->Fill(dDelTLH, (Double_t) vDutHit.size());
4565 fhDutDTLH_TIS->Fill(dDelTLH, dTiS);
4566 Double_t dDDH = TMath::Sqrt(TMath::Power(hitpos_local[0] - LHpos_local[0], 2.)
4567 + TMath::Power(hitpos_local[1] - LHpos_local[1], 2.));
4568 fhDutDTLH_DDH_Found->Fill(dDelTLH, dDDH);
4569
4570 hitpos[0] = pTrk->GetFitX(dDutzPos);
4571 hitpos[1] = pTrk->GetFitY(dDutzPos);
4572 hitpos[2] = dDutzPos;
4573 gGeoManager->MasterToLocal(hitpos, hitpos_local);
4574 Double_t dDD = TMath::Sqrt(TMath::Power(hitpos_local[0] - LHpos_local[0], 2.)
4575 + TMath::Power(hitpos_local[1] - LHpos_local[1], 2.));
4576 fhDutDTLH_DD_Found->Fill(dDelTLH, dDD);
4577
4578 /*
4579 if( pHit->GetTime()- dTLH > 10.) // debugging check
4580 LOG(info)<< Form("invalid time distance for event %d, hit address 0x%08x",
4581 fEvents, pHit->GetAddress())
4582 ;
4583 */
4584 }
4585 }
4586
4587 if (fbAttachDutHitToTracklet && pTrk->GetNofHits() == NStations
4588 && itDutHitMatch != TrackletMatchedDutHitRedChiSq.end() && !(itDutHitMatch->second.second < fSIGLIM)) {
4589 pHit = dynamic_cast<CbmTofHit*>(fTofHitsColl->At(itDutHitMatch->second.first));
4590
4591 fhSelTypeNNChiSq->Fill(1, 3. * itDutHitMatch->second.second);
4592 fhSelTypeNNResidualT->Fill(1, pHit->GetTime() - pTrk->GetFitT(pHit->GetZ()));
4593 fhSelTypeNNResidualX->Fill(1, pHit->GetX() - pTrk->GetFitX(pHit->GetZ()));
4594 fhSelTypeNNResidualY->Fill(1, pHit->GetY() - pTrk->GetFitY(pHit->GetZ()));
4595
4597 fhSelTrklMatchEfficiencyTIS->Fill(kFALSE, (dTAv - fdStartSpillTime) / 1.E9);
4598 }
4599
4600 // no match for this track
4601 if ((!fbAttachDutHitToTracklet && pTrk->GetNofHits() == NStations - 1 && !pTrk->ContainsAddr(fiDutAddr))
4602 || (fbAttachDutHitToTracklet && pTrk->GetNofHits() == NStations
4603 && itDutHitMatch == TrackletMatchedDutHitRedChiSq.end())) {
4604 if (0)
4605 LOG(info) << Form(" Missed hit at %f, TLH = %f, LogDelT %f for Det %d at x "
4606 "%6.2f, y %6.2f, bin %d from x %6.2f, y %6.2f",
4607 pTrk->GetTime(), dTLH, dDelTLH, iDet, hitpos_local[0], hitpos_local[1], iBinA,
4608 hitpos[0], hitpos[1]);
4609
4610 if (fR0LimFit > 0.) // consider only tracks originating from interaction point
4611 if (pTrk->GetR0() > fR0LimFit) continue;
4612
4613 fhSelTrklFitRedChiSq->Fill(pTrk->GetChiSq());
4614 fhDutChi_Missed->Fill(pTrk->GetChiSq());
4615 fhDutXY_Missed->Fill(hitpos_local[0], hitpos_local[1]);
4616 fhDutMul_Missed->Fill(dMul4);
4617 Int_t iGet4 = ((Int_t) hitpos_local[0] + 16) % 8 + 1;
4618 fhDutTIS_Missed->Fill(dTiS, iGet4);
4619 fhDutTIR_Missed->Fill(dTIR, iGet4);
4620 fhDutVel_Missed->Fill(dVel);
4621 fhDutDTLH_Missed->Fill(dDelTLH);
4622 fhDutDTLH_Missed_TIS->Fill(dDelTLH, dTiS);
4623 if (NULL != pLHit) {
4624 LHpos[0] = pLHit->GetX();
4625 LHpos[1] = pLHit->GetY();
4626 LHpos[2] = pLHit->GetZ();
4627 gGeoManager->MasterToLocal(LHpos, LHpos_local);
4628 Double_t dDD = TMath::Sqrt(TMath::Power(hitpos_local[0] - LHpos_local[0], 2.)
4629 + TMath::Power(hitpos_local[1] - LHpos_local[1], 2.));
4630 fhDutDTLH_DD_Missed->Fill(dDelTLH, dDD);
4631 }
4632
4634 fhSelTrklMatchEfficiencyTIS->Fill(kFALSE, (dTAv - fdStartSpillTime) / 1.E9);
4635 }
4636
4637 } // end of loop over all tracklets
4638
4640 // Eliminate all tracklet - DUT hit matches which do not meet the
4641 // specified 'fSIGLIM' criterion. TODO: LEGACY code
4642 for (auto itChi2Map = TrackletMatchedDutHitRedChiSq.cbegin();
4643 itChi2Map != TrackletMatchedDutHitRedChiSq.cend();) {
4644 Double_t dRedChiSq = itChi2Map->second.second;
4645
4646 if (dRedChiSq < fSIGLIM) { ++itChi2Map; }
4647 else {
4648 itChi2Map = TrackletMatchedDutHitRedChiSq.erase(itChi2Map);
4649 }
4650 }
4651 }
4652
4653 } //(iNbTofTracks>0) end
4654
4655
4656 /* this is the proper place LHTime filling, move for testing purpose*/
4657 if (fFindTracks != NULL && fdMemoryTime > 0.) {
4658 // everything else done -> update hit memory to latest hits
4659 for (Int_t iHitInd = 0; iHitInd < iNbTofHits; iHitInd++) {
4660 pHit = (CbmTofHit*) fTofHitsColl->At(iHitInd);
4661 if (NULL == pHit) continue;
4662 Int_t iDetId = (pHit->GetAddress() & DetMask);
4663 if (iDetId != fiDutAddr) continue; // store only Dut Hits
4664
4665 Int_t iDet = fFindTracks->fMapRpcIdParInd[iDetId];
4666 //fChannelInfo = fDigiPar->GetCell(pHit->GetAddress());
4667 //gGeoManager->FindNode(fChannelInfo->GetX(),fChannelInfo->GetY(),fChannelInfo->GetZ());
4668 gGeoManager->FindNode(fChannelInfoDut->GetX(), fChannelInfoDut->GetY(), fChannelInfoDut->GetZ());
4669 hitpos[0] = pHit->GetX();
4670 hitpos[1] = pHit->GetY();
4671 hitpos[2] = pHit->GetZ();
4672 gGeoManager->MasterToLocal(hitpos, hitpos_local);
4673 if (fhLHTime.size() > 0) {
4674 if (static_cast<size_t>(iDet) >= fhLHTime.size()) {
4675 LOG(warning) << " LHdeb: invalid iDet index " << iDet << " of " << fhLHTime.size();
4677 continue;
4678 }
4679 Int_t iBin = fhLHTime[iDet]->FindBin(hitpos_local[0], hitpos_local[1]);
4680 Int_t iBinA = iBin - 1; // index in pointer array
4681 if (0)
4682 LOG(info) << Form("Insert Dut hit for Det %d, Bin %d, x %f, y %f, poi ", iDet, iBinA, hitpos_local[0],
4683 hitpos_local[1])
4684 << fhLHTime[iDet];
4685
4686 if (iBin <= 0 || iBin > fhLHTime[iDet]->GetNbinsX() * fhLHTime[iDet]->GetNbinsY()) {
4687 LOG(debug) << "Invalid bin number for fhLHTime, det " << iDet << ": " << iBin;
4688 }
4689 else {
4690 fhLHTime[iDet]->SetBinContent(iBin, pHit->GetTime());
4691 /*
4692 LOG(info)<<"LHit check for "<<iDet<<", "<<iBin
4693 ;
4694 */
4695 if (NULL != fvLHit[iDet][iBinA]) {
4696 /*
4697 LOG(info)<<"LHit "<<fvLHit[iDet][iBinA]->GetName()<<" exists for "<<iDet<<", "<<iBin
4698 <<" at "<< fvLHit[iDet][iBinA] <<" -> delete "
4699 ;
4700 */
4701 fvLHit[iDet][iBinA]->Delete();
4702 //delete fvLHit[iDet][iBinA]; // delete outdated CbmTofHit
4703 }
4704 fvLHit[iDet][iBinA] = new CbmTofHit(*pHit); // put onto heap
4705
4706 if (0)
4707 LOG(info) << Form("Store hit 0x%08x at x %6.3f, y %6.3f, bin %d, "
4708 "time %f in det Id 0x%08x, #%d",
4709 fvLHit[iDet][iBinA]->GetAddress(), hitpos_local[0], hitpos_local[1], iBinA,
4710 pHit->GetTime(), iDetId, iDet);
4711 }
4712 }
4713 }
4714 } //(fdMemoryTime > 0.) end
4715
4716
4717 if (bSelTrackletFound) {
4719 fhSelTrklEfficiencyTIS->Fill(kTRUE, (dTAv - fdStartSpillTime) / 1.E9);
4720 }
4721 else {
4722 fhSelTrklEfficiency->Fill(kFALSE, fiNAccRefTracks);
4723 fhSelTrklEfficiencyTIS->Fill(kFALSE, (dTAv - fdStartSpillTime) / 1.E9);
4724 }
4725
4726 } // (NULL!=fTofTrackColl && NULL != fFindTracks) end
4727
4728
4729 std::map<std::tuple<Int_t, Int_t, Int_t>, std::map<Int_t, Int_t>> CounterNCellHits;
4730
4731 for (Int_t iHit = 0; iHit < fTofHitsColl->GetEntriesFast(); iHit++) {
4732 CbmTofHit* tHit = dynamic_cast<CbmTofHit*>(fTofHitsColl->At(iHit));
4733 Int_t iHitAddress = tHit->GetAddress();
4734 Int_t iModuleType = CbmTofAddress::GetSmType(iHitAddress);
4735 Int_t iModuleIndex = CbmTofAddress::GetSmId(iHitAddress);
4736 Int_t iCounterIndex = CbmTofAddress::GetRpcId(iHitAddress);
4737 Int_t iCellIndex = CbmTofAddress::GetChannelId(iHitAddress);
4738
4739 CounterNCellHits[std::make_tuple(iModuleType, iModuleIndex, iCounterIndex)][iCellIndex]++;
4740
4742 if (fbTracksInInputFile) {
4743 CbmMatch* tHitTrackMatch = dynamic_cast<CbmMatch*>(fTofHitAccTrackMatches->At(iHit));
4744
4745 if (fiMrpcRefAddr == (iHitAddress & DetMask)) { fhNTracksPerMRefHit->Fill(tHitTrackMatch->GetNofLinks()); }
4746 else if (fiMrpcSel2Addr == (iHitAddress & DetMask)) {
4747 fhNTracksPerSel2Hit->Fill(tHitTrackMatch->GetNofLinks());
4748 }
4749 else if (fiDutAddr == (iHitAddress & DetMask)) {
4750 fhNTracksPerDutHit->Fill(tHitTrackMatch->GetNofLinks());
4751 }
4752 }
4753 }
4754 }
4755
4756
4757 // MC track selector analysis
4759 if (fbTracksInInputFile) {
4760 // if(fiMaxMCRefTracks >= fiNAccRefTracks)
4761 if (dMul0 <= dM0Max && dMul4 <= dM4Max && dMulD <= dMDMax && dMulS2 <= dM4Max) {
4762 std::vector<Int_t> RefTrackSet;
4763
4764 TGeoNode* tNode(NULL);
4765 TGeoMedium* tMedium(NULL);
4766 TGeoMaterial* tMaterial(NULL);
4767
4768 const char* cMaterialName;
4769
4770 std::multimap<Double_t, std::pair<Int_t, Int_t>> RedChiSqTrackDutHitPair;
4771 std::map<Int_t, std::pair<Int_t, Double_t>> TrackMatchedDutHitRedChiSq;
4772 Int_t iSelMCTrack(-1);
4773 Int_t iSelMCTrackDutHitMatchMul(0);
4774 Int_t iSelMCTrackDutHitMatchAccMul(0);
4775
4776 for (Int_t iTrack = 0; iTrack < fAccTracks->GetEntriesFast(); iTrack++) {
4777 CbmMCTrack* tAccTrack = dynamic_cast<CbmMCTrack*>(fAccTracks->At(iTrack));
4778 CbmMatch* tAccTrackPointMatch = dynamic_cast<CbmMatch*>(fTofAccTrackPointMatches->At(iTrack));
4779
4780 tNode = gGeoManager->FindNode(tAccTrack->GetStartX(), tAccTrack->GetStartY(), tAccTrack->GetStartZ());
4781 tMedium = tNode->GetMedium();
4782 tMaterial = tMedium->GetMaterial();
4783
4784 GetMaterialName(tMaterial->GetName(), cMaterialName);
4785
4786 if (0 == std::strcmp("target", cMaterialName)
4788 // Scan for a MC track intersection with the DUT counter plane
4789 for (Int_t iPoint = 0; iPoint < tAccTrackPointMatch->GetNofLinks(); iPoint++) {
4790 const CbmLink& tLink = tAccTrackPointMatch->GetLink(iPoint);
4791
4792 CbmTofPoint* tPoint(NULL);
4793 Int_t iFileIndex = tLink.GetFile();
4794 Int_t iEventIndex = tLink.GetEntry();
4795 Int_t iArrayIndex = tLink.GetIndex();
4796
4797 Double_t dMCEventStartTime(0.);
4798
4799 if (fbPointsInInputFile) { tPoint = dynamic_cast<CbmTofPoint*>(fTofPointsTB->At(iArrayIndex)); }
4800 else {
4801 tPoint = dynamic_cast<CbmTofPoint*>(fTofPoints->Get(iFileIndex, iEventIndex, iArrayIndex));
4802
4803 dMCEventStartTime = fMCEventList->GetEventTime(iEventIndex, iFileIndex);
4804 }
4805
4806 Int_t iModuleType = fGeoHandler->GetSMType(tPoint->GetDetectorID());
4807 Int_t iModuleIndex = fGeoHandler->GetSModule(tPoint->GetDetectorID());
4808 Int_t iCounterIndex = fGeoHandler->GetCounter(tPoint->GetDetectorID());
4809
4810 if (fiDut == iModuleType && fiDutSm == iModuleIndex && fiDutRpc == iCounterIndex) {
4811 for (auto const& iHit : DutHitSet) {
4812 CbmTofHit* tHit = dynamic_cast<CbmTofHit*>(fTofHitsColl->At(iHit));
4813
4814 Double_t dRedChiSq =
4815 (TMath::Power(TMath::Abs(tPoint->GetTime() + dMCEventStartTime - tHit->GetTime()) / GetSigT(2), 2)
4816 + TMath::Power(TMath::Abs(tPoint->GetX() - tHit->GetX()) / GetSigX(2), 2)
4817 + TMath::Power(TMath::Abs(tPoint->GetY() - tHit->GetY()) / GetSigY(2), 2))
4818 / 3.;
4819
4820 RedChiSqTrackDutHitPair.emplace(dRedChiSq, std::make_pair(iTrack, iHit));
4821 }
4822
4823 RefTrackSet.push_back(iTrack);
4824
4825 break;
4826 }
4827 }
4828 }
4829 }
4830
4831
4832 // Randomly choose a selector MC track from the set of available reference
4833 // MC tracks in the event.
4834 if (RefTrackSet.size()) { iSelMCTrack = RefTrackSet.at(gRandom->Integer(RefTrackSet.size())); }
4835
4836
4837 for (auto const& Chi2MapElement : RedChiSqTrackDutHitPair) {
4838 Double_t dRedChiSq = Chi2MapElement.first;
4839 Int_t iTrackIndex = Chi2MapElement.second.first;
4840
4841 if (iTrackIndex == iSelMCTrack) {
4842 iSelMCTrackDutHitMatchMul++;
4843
4844 if (dRedChiSq < fdMCSIGLIM) { iSelMCTrackDutHitMatchAccMul++; }
4845 }
4846 }
4847
4848 if (iSelMCTrackDutHitMatchMul) { fhSelMCTrackDutHitMatchNNMul->Fill(iSelMCTrackDutHitMatchMul); }
4849
4850 if (iSelMCTrackDutHitMatchAccMul) { fhSelMCTrackDutHitMatchAccNNMul->Fill(iSelMCTrackDutHitMatchAccMul); }
4851
4852
4853 // DUT hits are (if at all) AMBIGUOUSLY matched with selector MC tracks
4854 // (possibly multiple tracks -> one hit) according to a minimum reduced
4855 // chi-square criterion. As the chi-square keys of the map looped over
4856 // below are sorted in ascending order, all other map elements containing
4857 // the corresponding MC track index can be eliminated. The best match
4858 // (i.e. the lowest chi-square value) has been identified for the track
4859 // by the current map element.
4860 for (auto itChi2Map = RedChiSqTrackDutHitPair.cbegin(); itChi2Map != RedChiSqTrackDutHitPair.cend();) {
4861 Double_t dRedChiSq = itChi2Map->first;
4862 Int_t iUsedTrack = itChi2Map->second.first;
4863 Int_t iUsedHit = itChi2Map->second.second;
4864
4865 TrackMatchedDutHitRedChiSq.emplace(iUsedTrack, std::make_pair(iUsedHit, dRedChiSq));
4866
4867 Bool_t bFoundNextUniqueMatch(kFALSE);
4868
4869 for (auto itSubMap = ++itChi2Map; itSubMap != RedChiSqTrackDutHitPair.cend();) {
4870 Int_t iTrack = itSubMap->second.first;
4871 //Int_t iHit = itSubMap->second.second; (VF) not used
4872
4873 // Uncomment the rear part of the following line of code to obtain
4874 // UNIQUE hit-to-track matching.
4875 if (iUsedTrack == iTrack) // || iUsedHit == iHit)
4876 {
4877 itSubMap = RedChiSqTrackDutHitPair.erase(itSubMap);
4878 }
4879 else {
4880 if (!bFoundNextUniqueMatch) {
4881 itChi2Map = itSubMap;
4882 bFoundNextUniqueMatch = kTRUE;
4883 }
4884
4885 ++itSubMap;
4886 }
4887 }
4888
4889 if (!bFoundNextUniqueMatch) { itChi2Map = RedChiSqTrackDutHitPair.cend(); }
4890 }
4891
4892
4893 if (-1 < iSelMCTrack) {
4894 auto itDutHitMatch = TrackMatchedDutHitRedChiSq.find(iSelMCTrack);
4895
4896 if (itDutHitMatch != TrackMatchedDutHitRedChiSq.end()) {
4897 Double_t dRedChiSq = itDutHitMatch->second.second;
4898 Int_t iDutHit = itDutHitMatch->second.first;
4899
4900 // CbmMCTrack* tTrack = dynamic_cast<CbmMCTrack*>(fAccTracks->At(iSelMCTrack)); (VF) not used
4901 CbmMatch* tTrackPointMatch = dynamic_cast<CbmMatch*>(fTofAccTrackPointMatches->At(iSelMCTrack));
4902 CbmTofHit* tHit = dynamic_cast<CbmTofHit*>(fTofHitsColl->At(iDutHit));
4903 CbmTofPoint* tPoint(NULL);
4904
4905 Double_t dMCEventStartTime(0.);
4906
4907 // Scan for the MC track intersection with the DUT counter plane
4908 for (Int_t iPoint = 0; iPoint < tTrackPointMatch->GetNofLinks(); iPoint++) {
4909 const CbmLink& tLink = tTrackPointMatch->GetLink(iPoint);
4910
4911 Int_t iFileIndex = tLink.GetFile();
4912 Int_t iEventIndex = tLink.GetEntry();
4913 Int_t iArrayIndex = tLink.GetIndex();
4914
4915 if (fbPointsInInputFile) { tPoint = dynamic_cast<CbmTofPoint*>(fTofPointsTB->At(iArrayIndex)); }
4916 else {
4917 tPoint = dynamic_cast<CbmTofPoint*>(fTofPoints->Get(iFileIndex, iEventIndex, iArrayIndex));
4918
4919 dMCEventStartTime = fMCEventList->GetEventTime(iEventIndex, iFileIndex);
4920 }
4921
4922 Int_t iModuleType = fGeoHandler->GetSMType(tPoint->GetDetectorID());
4923 Int_t iModuleIndex = fGeoHandler->GetSModule(tPoint->GetDetectorID());
4924 Int_t iCounterIndex = fGeoHandler->GetCounter(tPoint->GetDetectorID());
4925
4926 if (fiDut == iModuleType && fiDutSm == iModuleIndex && fiDutRpc == iCounterIndex) { break; }
4927 }
4928
4929
4930 Bool_t bGoodSelDutMatch(kFALSE);
4931 CbmMatch* tDutHitTrackMatch = dynamic_cast<CbmMatch*>(fTofHitAccTrackMatches->At(iDutHit));
4932
4933 for (Int_t iDutHitTrackLink = 0; iDutHitTrackLink < tDutHitTrackMatch->GetNofLinks(); iDutHitTrackLink++) {
4934 const CbmLink& tDutHitTrackLink = tDutHitTrackMatch->GetLink(iDutHitTrackLink);
4935
4936 if (tDutHitTrackLink.GetIndex() == iSelMCTrack) {
4937 bGoodSelDutMatch = kTRUE;
4938 break;
4939 }
4940 }
4941
4942 if (bGoodSelDutMatch) { fhGoodSelTypeNNPureChiSq->Fill(2, 3. * dRedChiSq); }
4943
4944 fhGoodSelTypeNNAllChiSq->Fill(2, 3. * dRedChiSq);
4945
4946
4947 if (dRedChiSq < fdMCSIGLIM) {
4948 fhSelTypeAccNNChiSq->Fill(2, 3. * dRedChiSq);
4949 fhSelTypeAccNNResidualT->Fill(2, tHit->GetTime() - tPoint->GetTime() - dMCEventStartTime);
4950 fhSelTypeAccNNResidualX->Fill(2, tHit->GetX() - tPoint->GetX());
4951 fhSelTypeAccNNResidualY->Fill(2, tHit->GetY() - tPoint->GetY());
4952
4953 fhSelTypeNNChiSq->Fill(2, 3. * dRedChiSq);
4954 fhSelTypeNNResidualT->Fill(2, tHit->GetTime() - tPoint->GetTime() - dMCEventStartTime);
4955 fhSelTypeNNResidualX->Fill(2, tHit->GetX() - tPoint->GetX());
4956 fhSelTypeNNResidualY->Fill(2, tHit->GetY() - tPoint->GetY());
4957
4959 fhSelMCTrackMatchEfficiencyTIS->Fill(kTRUE, (dTAv - fdStartSpillTime) / 1.E9);
4960
4961 if (bGoodSelDutMatch) { fhSelMCTrackMatchPurity->Fill(kTRUE, fiNAccRefTracks); }
4962 else {
4964 }
4965
4966 CbmMatch* tDutHitDigiMatch = dynamic_cast<CbmMatch*>(fTofDigiMatchColl->At(iDutHit));
4967
4968 fhSelMCTrackResidualTTIS->Fill((dTAv - fdStartSpillTime) / 1.E9,
4969 tHit->GetTime() - tPoint->GetTime() - dMCEventStartTime);
4970 fhSelMCTrackDutCluSizeTIS->Fill((dTAv - fdStartSpillTime) / 1.E9, tDutHitDigiMatch->GetNofLinks() / 2);
4971 }
4972 else {
4973 fhSelTypeNNChiSq->Fill(2, 3. * dRedChiSq);
4974 fhSelTypeNNResidualT->Fill(2, tHit->GetTime() - tPoint->GetTime() - dMCEventStartTime);
4975 fhSelTypeNNResidualX->Fill(2, tHit->GetX() - tPoint->GetX());
4976 fhSelTypeNNResidualY->Fill(2, tHit->GetY() - tPoint->GetY());
4977
4979 fhSelMCTrackMatchEfficiencyTIS->Fill(kFALSE, (dTAv - fdStartSpillTime) / 1.E9);
4980 }
4981 }
4982 else {
4984 fhSelMCTrackMatchEfficiencyTIS->Fill(kFALSE, (dTAv - fdStartSpillTime) / 1.E9);
4985 }
4986
4987
4988 // Eliminate all MC track - DUT hit matches which do not meet the
4989 // specified 'fdMCSIGLIM' criterion. TODO: LEGACY code
4990 for (auto itChi2Map = TrackMatchedDutHitRedChiSq.cbegin(); itChi2Map != TrackMatchedDutHitRedChiSq.cend();) {
4991 Double_t dRedChiSq = itChi2Map->second.second;
4992
4993 if (dRedChiSq < fdMCSIGLIM) { ++itChi2Map; }
4994 else {
4995 itChi2Map = TrackMatchedDutHitRedChiSq.erase(itChi2Map);
4996 }
4997 }
4998
4999
5001 fhSelMCTrackEfficiencyTIS->Fill(kTRUE, (dTAv - fdStartSpillTime) / 1.E9);
5002 }
5003 else {
5005 fhSelMCTrackEfficiencyTIS->Fill(kFALSE, (dTAv - fdStartSpillTime) / 1.E9);
5006 }
5007 }
5008 else {
5010 fhSelMCTrackEfficiencyTIS->Fill(kFALSE, (dTAv - fdStartSpillTime) / 1.E9);
5011 }
5012 }
5013 }
5014
5015
5017 // Retrieve the original MC event header which provides detailed information
5018 // about the collision parameters in case no event mixing occurred during
5019 // event reconstruction.
5020 FairMCEventHeader* tMCEventHeader(NULL);
5021 Double_t dMCEventStartTime(0.);
5022
5023 if (1 == fMCEventList->GetNofEvents()) {
5024 Int_t iFileID = fMCEventList->GetFileIdByIndex(0);
5025 Int_t iEventID = fMCEventList->GetEventIdByIndex(0);
5026
5027 dMCEventStartTime = fMCEventList->GetEventTimeByIndex(0);
5028 tMCEventHeader = dynamic_cast<FairMCEventHeader*>(fMCEventHeader->Get(iFileID, iEventID));
5029
5030 fhAccRefTrackMulCentrality->Fill(tMCEventHeader->GetB(), fiNAccRefTracks);
5031 }
5032
5034
5035 if (tMCEventHeader && fFindTracks && fFindTracks->InspectEvent() && fFindTracks->GetVertexT()) {
5036 // collision vertex reconstruction QA
5037 fhPVResTAll->Fill(fiNAccRefTracks, fFindTracks->GetVertexT() - tMCEventHeader->GetT() - dMCEventStartTime);
5038 fhPVResXAll->Fill(fiNAccRefTracks, fFindTracks->GetVertexX() - tMCEventHeader->GetX());
5039 fhPVResYAll->Fill(fiNAccRefTracks, fFindTracks->GetVertexY() - tMCEventHeader->GetY());
5040 }
5041
5042
5043 if (fbTracksInInputFile) {
5044 TGeoNode* tNode(NULL);
5045 TGeoMedium* tMedium(NULL);
5046 TGeoMaterial* tMaterial(NULL);
5047
5048 const char* cPdgName;
5049 const char* cMaterialName;
5050 const char* cProcessName;
5051
5052 Double_t dLocalTrackStart[3] = {0., 0., 0.};
5053 Double_t dGlobalTrackStart[3] = {0., 0., 0.};
5054 Double_t dLocalPoint[3] = {0., 0., 0.};
5055 Double_t dGlobalPoint[3] = {0., 0., 0.};
5056
5057 std::map<std::tuple<Int_t, Int_t, Int_t>, Int_t> CounterNAccTracks;
5058 std::map<std::tuple<Int_t, Int_t, Int_t>, Int_t> CounterNAccRefTracks;
5059 std::map<std::tuple<Int_t, Int_t, Int_t>, Int_t> CounterNAccRndmTracks;
5060 std::map<std::tuple<Int_t, Int_t, Int_t>, Int_t> CounterNAccDomTracks;
5061 std::map<std::tuple<Int_t, Int_t, Int_t>, Int_t> CounterNRecRefTracks;
5062 std::map<std::tuple<Int_t, Int_t, Int_t>, Int_t> CounterNPureRefTracks;
5063
5064 std::map<std::tuple<Int_t, Int_t, Int_t>, std::map<Int_t, Int_t>> CounterNCellAccRefTracks;
5065
5066
5067 Double_t dRefPVRecoT(0.);
5068 Double_t dRefPVRecoX(0.);
5069 Double_t dRefPVRecoY(0.);
5070 Int_t iRefPVRecoN(0);
5071
5072 for (Int_t iTrack = 0; iTrack < fAccTracks->GetEntriesFast(); iTrack++) {
5073 Bool_t bIsAccRefTrack(kFALSE);
5074
5075 CbmMCTrack* tAccTrack = dynamic_cast<CbmMCTrack*>(fAccTracks->At(iTrack));
5076 CbmMatch* tAccTrackPointMatch = dynamic_cast<CbmMatch*>(fTofAccTrackPointMatches->At(iTrack));
5077 CbmMatch* tAccTrackTrackletMatch(NULL);
5078 if (fTofTrackColl) {
5079 tAccTrackTrackletMatch = dynamic_cast<CbmMatch*>(fTofAccTrackTrackletMatches->At(iTrack));
5080 }
5081
5082 dGlobalTrackStart[0] = tAccTrack->GetStartX();
5083 dGlobalTrackStart[1] = tAccTrack->GetStartY();
5084 dGlobalTrackStart[2] = tAccTrack->GetStartZ();
5085
5086 tNode = gGeoManager->FindNode(dGlobalTrackStart[0], dGlobalTrackStart[1], dGlobalTrackStart[2]);
5087 tMedium = tNode->GetMedium();
5088 tMaterial = tMedium->GetMaterial();
5089
5090 GetPdgName(tAccTrack->GetPdgCode(), cPdgName);
5091 GetMaterialName(tMaterial->GetName(), cMaterialName);
5092 GetProcessName(TMCProcessName[tAccTrack->GetGeantProcessId()], cProcessName);
5093
5094 fhAccTrackPointMul->Fill(tAccTrackPointMatch->GetNofLinks());
5095 // XXX: tAccTrack->GetNPoints(ECbmModuleId::kTof)
5096
5097 if (0 == std::strcmp("target", cMaterialName) && fiMinMCRefTrackPoints <= tAccTrackPointMatch->GetNofLinks()) {
5098 bIsAccRefTrack = kTRUE;
5099
5100 fhAccRefTrackShare->Fill(kTRUE, fiNAccRefTracks);
5101
5102 if (tAccTrack->GetMass()) {
5103 fhAccRefTrackAcceptance->Fill(tAccTrack->GetRapidity(), tAccTrack->GetPt() / tAccTrack->GetMass());
5104 }
5105
5106 fhAccRefTracksProcSpec->Fill(cProcessName, cPdgName, 1.);
5107
5108 if (fTofTrackColl) {
5109 if (0 < tAccTrackTrackletMatch->GetNofLinks()) {
5111
5112 if (tAccTrack->GetMass()) {
5113 fhAccRefTrackAcceptanceEfficiency->Fill(kTRUE, tAccTrack->GetRapidity(),
5114 tAccTrack->GetPt() / tAccTrack->GetMass());
5115 }
5116
5117 CbmTofTracklet* tTracklet =
5118 dynamic_cast<CbmTofTracklet*>(fTofTrackColl->At((tAccTrackTrackletMatch->GetMatchedLink()).GetIndex()));
5119
5120 // The properties of 'CbmTofTrackletParam' (fX, fY, fTx, fTy) describe
5121 // the position and orientation of the tracklet at fZ = 0.
5122 // The MC reference track, however, can - according to its definition -
5123 // originate from the entire target volume, i.e. have an origin in Z
5124 // different from 0. As the track production vertex is just a random
5125 // point on its straight-line trajectory, we are free to choose any
5126 // other location along the track/tracklet for a point-to-point
5127 // comparison between the two 3D straight lines. Since methods
5128 // for tracklet parameter extrapolation along Z are available in
5129 // 'CbmTofTracklet', values are calculated at 'CbmMCTrack::fStartZ'
5130 // for tracklet-track comparison.
5132 tTracklet->GetFitT(tAccTrack->GetStartZ()) - tAccTrack->GetStartT());
5134 tTracklet->GetFitX(tAccTrack->GetStartZ()) - tAccTrack->GetStartX());
5136 tTracklet->GetFitY(tAccTrack->GetStartZ()) - tAccTrack->GetStartY());
5138 tTracklet->GetTrackTx() - tAccTrack->GetPx() / tAccTrack->GetPz());
5140 tTracklet->GetTrackTy() - tAccTrack->GetPy() / tAccTrack->GetPz());
5142 1. / tTracklet->GetTt()
5143 - tAccTrack->GetP() / tAccTrack->GetEnergy() * TMath::Ccgs() * 1.e-9);
5144
5145 // To compare the number of hits assigned to the tracklet with the
5146 // number of points created by the MC reference track the number
5147 // of diamond hits which have no point equivalent in the MC track
5148 // needs to be subtracted from the number of tracklet hits.
5149 Int_t iNTrackletHits = tTracklet->GetNofHits();
5150
5151 for (Int_t iHit = 0; iHit < tTracklet->GetNofHits(); iHit++) {
5152 if (5 == CbmTofAddress::GetSmType((tTracklet->GetTofHitPointer(iHit))->GetAddress())) {
5153 iNTrackletHits--;
5154 }
5155 }
5156
5157 fhAccRefTrackResN->Fill(fiNAccRefTracks, iNTrackletHits - tAccTrackPointMatch->GetNofLinks());
5158
5159 Int_t iRefPVRecoW = tTracklet->GetNofHits();
5160
5161 if (fFindTracks) {
5162 if (iRefPVRecoW >= fFindTracks->GetMinNofHits()) {
5163 dRefPVRecoT += iRefPVRecoW * tTracklet->GetFitT(0.);
5164 dRefPVRecoX += iRefPVRecoW * tTracklet->GetFitX(0.);
5165 dRefPVRecoY += iRefPVRecoW * tTracklet->GetFitY(0.);
5166 iRefPVRecoN += iRefPVRecoW;
5167 }
5168 }
5169 }
5170 else {
5172
5173 if (tAccTrack->GetMass()) {
5174 fhAccRefTrackAcceptanceEfficiency->Fill(kFALSE, tAccTrack->GetRapidity(),
5175 tAccTrack->GetPt() / tAccTrack->GetMass());
5176 }
5177 }
5178 }
5179
5180 fhAccRefTrackPointMul->Fill(tAccTrackPointMatch->GetNofLinks());
5181 }
5182 else {
5183 fhAccRefTrackShare->Fill(kFALSE, fiNAccRefTracks);
5184
5185 if (fTofTrackColl) {
5186 if (0 < tAccTrackTrackletMatch->GetNofLinks()) { fhRecRndmTrackEfficiency->Fill(kTRUE, fiNAccRefTracks); }
5187 else {
5189 }
5190 }
5191
5192 fhAccRndmTrackPointMul->Fill(tAccTrackPointMatch->GetNofLinks());
5193 }
5194
5195 // Having a maximum of 1 MC point per track per counter this point loop is
5196 // effectively a loop over counters which the MC track crossed.
5197 for (Int_t iPoint = 0; iPoint < tAccTrackPointMatch->GetNofLinks(); iPoint++) {
5198 const CbmLink& tLink = tAccTrackPointMatch->GetLink(iPoint);
5199
5200 CbmTofPoint* tPoint(NULL);
5201 Int_t iFileIndex = tLink.GetFile();
5202 Int_t iEventIndex = tLink.GetEntry();
5203 Int_t iArrayIndex = tLink.GetIndex();
5204
5205 if (fbPointsInInputFile) { tPoint = dynamic_cast<CbmTofPoint*>(fTofPointsTB->At(iArrayIndex)); }
5206 else {
5207 tPoint = dynamic_cast<CbmTofPoint*>(fTofPoints->Get(iFileIndex, iEventIndex, iArrayIndex));
5208 }
5209
5210 Int_t iModuleType = fGeoHandler->GetSMType(tPoint->GetDetectorID());
5211 Int_t iModuleIndex = fGeoHandler->GetSModule(tPoint->GetDetectorID());
5212 Int_t iCounterIndex = fGeoHandler->GetCounter(tPoint->GetDetectorID());
5213
5214 auto CounterID = std::make_tuple(iModuleType, iModuleIndex, iCounterIndex);
5215
5216 CounterNAccTracks[CounterID]++;
5217
5218 // A MC reference track passed through the current counter.
5219 if (bIsAccRefTrack) {
5220 CounterNAccRefTracks[CounterID]++;
5221
5222 fChannelInfo = fDigiPar->GetCell(tPoint->GetDetectorID());
5223 gGeoManager->FindNode(fChannelInfo->GetX(), fChannelInfo->GetY(), fChannelInfo->GetZ());
5224 dGlobalPoint[0] = tPoint->GetX();
5225 dGlobalPoint[1] = tPoint->GetY();
5226 dGlobalPoint[2] = tPoint->GetZ();
5227 gGeoManager->MasterToLocal(dGlobalPoint, dLocalPoint);
5228
5229 fhCounterRefTrackLocalXY[CounterID]->Fill(dLocalPoint[0], dLocalPoint[1]);
5230
5231 Int_t iNCounterCells = fDigiBdfPar->GetNbChan(iModuleType, iCounterIndex);
5232
5233 Int_t iCellIndex(-1);
5235 iCellIndex = static_cast<Int_t>(dLocalPoint[0] / fChannelInfo->GetSizex()
5236 + static_cast<Double_t>(iNCounterCells) / 2.);
5237 }
5238 else {
5239 iCellIndex = static_cast<Int_t>(dLocalPoint[1] / fChannelInfo->GetSizey()
5240 + static_cast<Double_t>(iNCounterCells) / 2.);
5241 }
5242
5243 CounterNCellAccRefTracks[CounterID][iCellIndex]++;
5244
5245 if (fTofTrackColl) {
5246 // A tracklet was constructed for the MC reference track.
5247 if (0 < tAccTrackTrackletMatch->GetNofLinks()) {
5248 Int_t iCounterAddress = CbmTofAddress::GetUniqueAddress(iModuleIndex, iCounterIndex, 0, 0, iModuleType);
5249
5250 CbmTofTracklet* tTracklet = dynamic_cast<CbmTofTracklet*>(
5251 fTofTrackColl->At((tAccTrackTrackletMatch->GetMatchedLink()).GetIndex()));
5252
5253 Int_t iHitIndex = tTracklet->HitIndexOfAddr(iCounterAddress);
5254
5255 // A hit on the current counter was assigned to the tracklet.
5256 // As there is a point created by the MC reference track on this
5257 // counter, the counter is efficient with respect to the MC
5258 // reference track because it provided a hit to the matched
5259 // tracklet where it should provide one.
5260 if (-1 < iHitIndex) {
5261 CounterNRecRefTracks[CounterID]++;
5262
5263 iHitIndex = tTracklet->GetTofHitIndex(iHitIndex);
5264 CbmMatch* tHitTrackMatch = dynamic_cast<CbmMatch*>(fTofHitAccTrackMatches->At(iHitIndex));
5265
5266 // Although the counter detected a hit that is attributed
5267 // to the tracklet matching the MC reference track best it
5268 // is not granted that this hit actually is the true one, i.e.
5269 // contains a link to the MC reference track. If it contains
5270 // a corresponding link, the counter "purely" detected the
5271 // track.
5272 for (Int_t iHitTrackLink = 0; iHitTrackLink < tHitTrackMatch->GetNofLinks(); iHitTrackLink++) {
5273 if (iTrack == tHitTrackMatch->GetLink(iHitTrackLink).GetIndex()) {
5274 CounterNPureRefTracks[CounterID]++;
5275 }
5276 }
5277 }
5278 }
5279 }
5280 }
5281
5282 TGeoPhysicalNode* tModuleNode = fCounterModuleNodes.at(CounterID);
5283
5284 tModuleNode->GetMatrix()->MasterToLocal(dGlobalTrackStart, dLocalTrackStart);
5285
5286 if (tModuleNode->GetVolume()->Contains(dLocalTrackStart)) {
5287 fhDomTracksProcSpec.at(CounterID)->Fill(cProcessName, cPdgName, 1.);
5288 fhDomTracksProcMat.at(CounterID)->Fill(cProcessName, cMaterialName, 1.);
5289
5290 CounterNAccDomTracks[CounterID]++;
5291 }
5292 else {
5293 if (!bIsAccRefTrack) {
5294 fhRndmTracksProcSpec.at(CounterID)->Fill(cProcessName, cPdgName, 1.);
5295 fhRndmTracksProcMat.at(CounterID)->Fill(cProcessName, cMaterialName, 1.);
5296
5297 CounterNAccRndmTracks[CounterID]++;
5298 }
5299 }
5300 }
5301 }
5302
5303 if (tMCEventHeader && fFindTracks) {
5304 if (0 < iRefPVRecoN) {
5305 dRefPVRecoT /= iRefPVRecoN;
5306 dRefPVRecoX /= iRefPVRecoN;
5307 dRefPVRecoY /= iRefPVRecoN;
5308
5309 fhPVResTRef->Fill(fiNAccRefTracks, dRefPVRecoT - tMCEventHeader->GetT() - dMCEventStartTime);
5310 fhPVResXRef->Fill(fiNAccRefTracks, dRefPVRecoX - tMCEventHeader->GetX());
5311 fhPVResYRef->Fill(fiNAccRefTracks, dRefPVRecoY - tMCEventHeader->GetY());
5312 }
5313 }
5314
5315
5316 if (fTofTrackColl) {
5317 std::set<CbmLink> tMatchedAccTracks;
5318
5319 for (Int_t iTracklet = 0; iTracklet < fTofTrackColl->GetEntriesFast(); iTracklet++) {
5320 CbmTrackMatchNew* tTrackletAccTrackMatch =
5321 dynamic_cast<CbmTrackMatchNew*>(fTofTrackletAccTrackMatches->At(iTracklet));
5322 const CbmLink& tLink = tTrackletAccTrackMatch->GetMatchedLink();
5323
5324 // Ignore tracklets which have been matched to a beam or to a dark point
5325 // for which no MC track exists.
5326 // TODO: dedicated QA for such cases
5327 if (-1 < tLink.GetFile() && -1 < tLink.GetEntry() && -1 < tLink.GetIndex()) {
5328 CbmMCTrack* tAccTrack = dynamic_cast<CbmMCTrack*>(fAccTracks->At(tLink.GetIndex()));
5329 CbmMatch* tAccTrackPointMatch = dynamic_cast<CbmMatch*>(fTofAccTrackPointMatches->At(tLink.GetIndex()));
5330
5331 dGlobalTrackStart[0] = tAccTrack->GetStartX();
5332 dGlobalTrackStart[1] = tAccTrack->GetStartY();
5333 dGlobalTrackStart[2] = tAccTrack->GetStartZ();
5334
5335 tNode = gGeoManager->FindNode(dGlobalTrackStart[0], dGlobalTrackStart[1], dGlobalTrackStart[2]);
5336 tMedium = tNode->GetMedium();
5337 tMaterial = tMedium->GetMaterial();
5338
5339 GetMaterialName(tMaterial->GetName(), cMaterialName);
5340
5341 // TODO: There could be another tracklet-to-track link with the same weight
5342 // as the matched one that hypothetically - in contrast to the
5343 // matched link - originated from the target. This case is
5344 // not covered here (cf. the filling of the "SelRefTrackShare"
5345 // efficiency histograms above).
5346 if (0 == std::strcmp("target", cMaterialName)
5348 if (fdGhostTrackHitQuota > tTrackletAccTrackMatch->GetTrueOverAllHitsRatio()) {
5350
5351 if (tAccTrack->GetMass()) {
5352 fhAccRefTrackAcceptancePurity->Fill(kFALSE, tAccTrack->GetRapidity(),
5353 tAccTrack->GetPt() / tAccTrack->GetMass());
5354 }
5355 }
5356 else {
5358
5359 if (tAccTrack->GetMass()) {
5360 fhAccRefTrackAcceptancePurity->Fill(kTRUE, tAccTrack->GetRapidity(),
5361 tAccTrack->GetPt() / tAccTrack->GetMass());
5362 }
5363 }
5364
5365 // Another tracklet has been matched to the MC track the current
5366 // tracklet has been matched to as well.
5367 if (kFALSE
5368 == (tMatchedAccTracks.emplace(1., tLink.GetIndex(), tLink.GetEntry(), tLink.GetFile())).second) {
5370 }
5371 else {
5373 }
5374 }
5375 else {
5376 if (fdGhostTrackHitQuota > tTrackletAccTrackMatch->GetTrueOverAllHitsRatio()) {
5378 }
5379 else {
5381 }
5382
5383 // Another tracklet has been matched to the MC track the current
5384 // tracklet has been matched to as well.
5385 if (kFALSE
5386 == (tMatchedAccTracks.emplace(1., tLink.GetIndex(), tLink.GetEntry(), tLink.GetFile())).second) {
5388 }
5389 else {
5391 }
5392 }
5393 }
5394 }
5395 }
5396
5397
5398 for (auto const& CounterModuleNode : fCounterModuleNodes) {
5399 auto const& CounterID = CounterModuleNode.first;
5400 Int_t iModuleType = std::get<0>(CounterID);
5401 // Int_t iModuleIndex = std::get<1>(CounterID); (VF) not used
5402 Int_t iCounterIndex = std::get<2>(CounterID);
5403 Int_t iNCounterCells = fDigiBdfPar->GetNbChan(iModuleType, iCounterIndex);
5404
5405 fhCounterAccTrackMul.at(CounterID)->Fill(CounterNAccTracks[CounterID]);
5406 fhCounterAccRefTrackMul.at(CounterID)->Fill(CounterNAccRefTracks[CounterID]);
5407 fhCounterAccRndmTrackMul.at(CounterID)->Fill(CounterNAccRndmTracks[CounterID]);
5408 fhCounterAccDomTrackMul.at(CounterID)->Fill(CounterNAccDomTracks[CounterID]);
5409
5410 if (fTofTrackColl) {
5411 fhCounterRecRefTrackEfficiencyPassed.at(CounterID)->Fill(CounterNAccRefTracks[CounterID],
5412 CounterNRecRefTracks[CounterID]);
5413 fhCounterRecRefTrackEfficiencyTotal.at(CounterID)->Fill(CounterNAccRefTracks[CounterID],
5414 CounterNAccRefTracks[CounterID]);
5415 fhCounterRecRefTrackPurityPassed.at(CounterID)->Fill(CounterNAccRefTracks[CounterID],
5416 CounterNPureRefTracks[CounterID]);
5417 }
5418
5419 Int_t iCounterHitMul(0);
5420 Int_t iCounterRefTrackMul(0);
5421
5422 for (Int_t iCell = 0; iCell < iNCounterCells; iCell++) {
5423 fhCounterRefTrackMulCell.at(CounterID)->Fill(iCell, CounterNCellAccRefTracks[CounterID][iCell]);
5424 iCounterRefTrackMul += CounterNCellAccRefTracks[CounterID][iCell];
5425 iCounterHitMul += CounterNCellHits[CounterID][iCell];
5426 }
5427
5428 fhCounterRefTrackMulHitMul.at(CounterID)->Fill(iCounterRefTrackMul, iCounterHitMul);
5429 }
5430 }
5431 }
5432
5433
5434 for (auto const& CounterModuleNode : fCounterModuleNodes) {
5435 auto const& CounterID = CounterModuleNode.first;
5436 Int_t iModuleType = std::get<0>(CounterID);
5437 // Int_t iModuleIndex = std::get<1>(CounterID); (VF) not used
5438 Int_t iCounterIndex = std::get<2>(CounterID);
5439 Int_t iNCounterCells = fDigiBdfPar->GetNbChan(iModuleType, iCounterIndex);
5440
5441 for (Int_t iCell = 0; iCell < iNCounterCells; iCell++) {
5442 fhCounterHitMulCell.at(CounterID)->Fill(iCell, CounterNCellHits[CounterID][iCell]);
5443 }
5444 }
5445
5446 return kTRUE;
5447} //FillHistos end
5448// ------------------------------------------------------------------
5449
5451{
5452
5453 LOG(info) << "Write ./tofAnaTestBeam.hst.root, mode = " << fiCorMode;
5454
5456 TFile* oldFile = gFile;
5457 TDirectory* oldDir = gDirectory;
5458
5459 // Write histogramms to the file
5460 TFile* fHist = new TFile(fCalOutFileName, "RECREATE");
5461 fHist->cd();
5462
5463 switch (fiCorMode) {
5464 case 0:
5465 case 1: {
5466 TProfile* htmp = fhDTD4DT04D4best->ProfileX();
5467 TH1D* htmp1D = htmp->ProjectionX();
5468
5469 // htmp1D->Draw();
5470
5471 if (fhDTD4DT04D4Off != NULL) {
5472 // fhDTD4DT04D4Off->Draw("same");
5473 // fhDTD4DT04D4Off->Write();
5474 //LOG(info)<<"Update hDTD4DT04D4best";
5475 Double_t nx = htmp1D->GetNbinsX();
5476 for (Int_t ix = 1; ix <= nx; ix++) {
5477 Double_t dVal = htmp1D->GetBinContent(ix) + fhDTD4DT04D4Off->GetBinContent(ix);
5478 // Double_t dVal=fhDTD4DT04D4Off->GetBinContent(ix);
5479 LOG(debug2) << "Update hDTD4DT04D4best " << ix << ": " << htmp1D->GetBinContent(ix) << " + "
5480 << fhDTD4DT04D4Off->GetBinContent(ix) << " -> " << dVal;
5481 htmp1D->SetBinContent(ix, dVal);
5482 }
5483 }
5484 else {
5485 LOG(warning) << "Histo fhDTD4DT04D4Off not found ";
5486 }
5487 // fhDTD4DT04D4best->Write();
5488 htmp1D->Write();
5489 if (fhDTX4D4Off != NULL) fhDTX4D4Off->Write();
5490 if (fhDTY4D4Off != NULL) fhDTY4D4Off->Write();
5491 if (fhDTTexpD4Off != NULL) fhDTTexpD4Off->Write();
5492 if (fhCluSize0DT04D4Off != NULL) fhCluSize0DT04D4Off->Write();
5493 if (fhCluSize4DT04D4Off != NULL) fhCluSize4DT04D4Off->Write();
5494 if (fhTot0DT04D4Off != NULL) fhTot0DT04D4Off->Write();
5495 if (fhTot4DT04D4Off != NULL) fhTot4DT04D4Off->Write();
5496 } break;
5497 case 2: {
5498 TProfile* htmpx = fhDTX4D4best->ProfileX();
5499 TH1D* htmpx1D = htmpx->ProjectionX();
5500 if (fhDTX4D4Off != NULL) {
5501 Double_t nx = htmpx1D->GetNbinsX();
5502 for (Int_t ix = 1; ix <= nx; ix++) {
5503 Double_t dVal = htmpx1D->GetBinContent(ix) + fhDTX4D4Off->GetBinContent(ix);
5504 LOG(debug1) << "Update hDTX4D4best " << ix << ": " << htmpx1D->GetBinContent(ix) << " + "
5505 << fhDTX4D4Off->GetBinContent(ix) << " -> " << dVal;
5506 htmpx1D->SetBinContent(ix, dVal);
5507 }
5508 }
5509 else {
5510 LOG(warning) << "Histo fhDTX4D4Off not found ";
5511 }
5512 htmpx1D->Write();
5513 if (fhDTD4DT04D4Off != NULL) fhDTD4DT04D4Off->Write();
5514 if (fhDTY4D4Off != NULL) fhDTY4D4Off->Write();
5515 if (fhDTTexpD4Off != NULL) fhDTTexpD4Off->Write();
5516 if (fhCluSize0DT04D4Off != NULL) fhCluSize0DT04D4Off->Write();
5517 if (fhCluSize4DT04D4Off != NULL) fhCluSize4DT04D4Off->Write();
5518 if (fhTot0DT04D4Off != NULL) fhTot0DT04D4Off->Write();
5519 if (fhTot4DT04D4Off != NULL) fhTot4DT04D4Off->Write();
5520 } break;
5521
5522 case 3: {
5523 TProfile* htmpx = fhDTY4D4best->ProfileX();
5524 TH1D* htmpx1D = htmpx->ProjectionX();
5525 if (fhDTY4D4Off != NULL) {
5526 Double_t nx = htmpx1D->GetNbinsX();
5527 for (Int_t ix = 1; ix <= nx; ix++) {
5528 Double_t dVal = htmpx1D->GetBinContent(ix) + fhDTY4D4Off->GetBinContent(ix);
5529 LOG(debug1) << "Update hDTY4D4best " << ix << ": " << htmpx1D->GetBinContent(ix) << " + "
5530 << fhDTY4D4Off->GetBinContent(ix) << " -> " << dVal;
5531 htmpx1D->SetBinContent(ix, dVal);
5532 }
5533 }
5534 else {
5535 LOG(warning) << "Histo fhDTY4D4Off not found ";
5536 }
5537 htmpx1D->Write();
5538 if (fhDTD4DT04D4Off != NULL) fhDTD4DT04D4Off->Write();
5539 if (fhDTX4D4Off != NULL) fhDTX4D4Off->Write();
5540 if (fhDTTexpD4Off != NULL) fhDTTexpD4Off->Write();
5541 if (fhCluSize0DT04D4Off != NULL) fhCluSize0DT04D4Off->Write();
5542 if (fhCluSize4DT04D4Off != NULL) fhCluSize4DT04D4Off->Write();
5543 if (fhTot0DT04D4Off != NULL) fhTot0DT04D4Off->Write();
5544 if (fhTot4DT04D4Off != NULL) fhTot4DT04D4Off->Write();
5545 } break;
5546
5547 case 4: {
5548 TProfile* htmpx = fhTexpDT04D4best->ProfileX();
5549 TH1D* htmpx1D = htmpx->ProjectionX();
5550 if (fhDTTexpD4Off != NULL) {
5551 Double_t nx = htmpx1D->GetNbinsX();
5552 for (Int_t ix = 1; ix <= nx; ix++) {
5553 Double_t dVal = htmpx1D->GetBinContent(ix) + fhDTTexpD4Off->GetBinContent(ix);
5554 LOG(debug1) << "Update hDTTexpD4best " << ix << ": " << htmpx1D->GetBinContent(ix) << " + "
5555 << fhDTTexpD4Off->GetBinContent(ix) << " -> " << dVal;
5556 htmpx1D->SetBinContent(ix, dVal);
5557 }
5558 }
5559 else {
5560 LOG(warning) << "Histo fhDTTexpD4Off not found ";
5561 }
5562 htmpx1D->Write();
5563 if (fhDTD4DT04D4Off != NULL) fhDTD4DT04D4Off->Write();
5564 if (fhDTX4D4Off != NULL) fhDTX4D4Off->Write();
5565 if (fhDTY4D4Off != NULL) fhDTY4D4Off->Write();
5566 if (fhCluSize0DT04D4Off != NULL) fhCluSize0DT04D4Off->Write();
5567 if (fhCluSize4DT04D4Off != NULL) fhCluSize4DT04D4Off->Write();
5568 if (fhTot0DT04D4Off != NULL) fhTot0DT04D4Off->Write();
5569 if (fhTot4DT04D4Off != NULL) fhTot4DT04D4Off->Write();
5570 } break;
5571
5572 case 5: {
5573 TProfile* htmpx = fhCluSize0DT04D4best->ProfileX();
5574 TH1D* htmpx1D = htmpx->ProjectionX();
5575 if (fhCluSize0DT04D4Off != NULL) {
5576 Double_t nx = htmpx1D->GetNbinsX();
5577 for (Int_t ix = 1; ix <= nx; ix++) {
5578 Double_t dVal = htmpx1D->GetBinContent(ix) + fhCluSize0DT04D4Off->GetBinContent(ix);
5579 LOG(debug1) << "Update hCluSize0DT04D4best " << ix << ": " << htmpx1D->GetBinContent(ix) << " + "
5580 << fhCluSize0DT04D4Off->GetBinContent(ix) << " -> " << dVal;
5581 htmpx1D->SetBinContent(ix, dVal);
5582 }
5583 }
5584 else {
5585 LOG(warning) << "Histo fhCluSize0DT04D4Off not found ";
5586 }
5587 htmpx1D->Write();
5588 if (fhDTD4DT04D4Off != NULL) fhDTD4DT04D4Off->Write();
5589 if (fhDTX4D4Off != NULL) fhDTX4D4Off->Write();
5590 if (fhDTY4D4Off != NULL) fhDTY4D4Off->Write();
5591 if (fhDTTexpD4Off != NULL) fhDTTexpD4Off->Write();
5592 if (fhCluSize4DT04D4Off != NULL) fhCluSize4DT04D4Off->Write();
5593 if (fhTot0DT04D4Off != NULL) fhTot0DT04D4Off->Write();
5594 if (fhTot4DT04D4Off != NULL) fhTot4DT04D4Off->Write();
5595 } break;
5596
5597 case 6: {
5598 TProfile* htmpx = fhCluSize4DT04D4best->ProfileX();
5599 TH1D* htmpx1D = htmpx->ProjectionX();
5600 if (fhCluSize4DT04D4Off != NULL) {
5601 Double_t nx = htmpx1D->GetNbinsX();
5602 for (Int_t ix = 1; ix <= nx; ix++) {
5603 Double_t dVal = htmpx1D->GetBinContent(ix) + fhCluSize4DT04D4Off->GetBinContent(ix);
5604 LOG(debug1) << "Update hCluSize4DT04D4best " << ix << ": " << htmpx1D->GetBinContent(ix) << " + "
5605 << fhCluSize4DT04D4Off->GetBinContent(ix) << " -> " << dVal;
5606 htmpx1D->SetBinContent(ix, dVal);
5607 }
5608 }
5609 else {
5610 LOG(warning) << "Histo fhCluSize4DT04D4Off not found ";
5611 }
5612 htmpx1D->Write();
5613 if (fhDTD4DT04D4Off != NULL) fhDTD4DT04D4Off->Write();
5614 if (fhDTX4D4Off != NULL) fhDTX4D4Off->Write();
5615 if (fhDTY4D4Off != NULL) fhDTY4D4Off->Write();
5616 if (fhDTTexpD4Off != NULL) fhDTTexpD4Off->Write();
5617 if (fhCluSize0DT04D4Off != NULL) fhCluSize0DT04D4Off->Write();
5618 if (fhTot0DT04D4Off != NULL) fhTot0DT04D4Off->Write();
5619 if (fhTot4DT04D4Off != NULL) fhTot4DT04D4Off->Write();
5620 } break;
5621
5622 case 7: {
5623 TProfile* htmpx = fhTot0DT04D4best->ProfileX();
5624 TH1D* htmpx1D = htmpx->ProjectionX();
5625 if (fhTot0DT04D4Off != NULL) {
5626 Double_t nx = htmpx1D->GetNbinsX();
5627 for (Int_t ix = 1; ix <= nx; ix++) {
5628 Double_t dVal = htmpx1D->GetBinContent(ix) + fhTot0DT04D4Off->GetBinContent(ix);
5629 LOG(debug1) << "Update hTot0DT04D4best " << ix << ": " << htmpx1D->GetBinContent(ix) << " + "
5630 << fhTot0DT04D4Off->GetBinContent(ix) << " -> " << dVal;
5631 htmpx1D->SetBinContent(ix, dVal);
5632 }
5633 }
5634 else {
5635 LOG(warning) << "Histo fhTot0DT04D4Off not found ";
5636 }
5637 htmpx1D->Write();
5638 if (fhDTD4DT04D4Off != NULL) fhDTD4DT04D4Off->Write();
5639 if (fhDTX4D4Off != NULL) fhDTX4D4Off->Write();
5640 if (fhDTY4D4Off != NULL) fhDTY4D4Off->Write();
5641 if (fhDTTexpD4Off != NULL) fhDTTexpD4Off->Write();
5642 if (fhCluSize0DT04D4Off != NULL) fhCluSize0DT04D4Off->Write();
5643 if (fhCluSize4DT04D4Off != NULL) fhCluSize4DT04D4Off->Write();
5644 if (fhTot4DT04D4Off != NULL) fhTot4DT04D4Off->Write();
5645 } break;
5646
5647 case 8: {
5648 TProfile* htmpx = fhTot4DT04D4best->ProfileX();
5649 TH1D* htmpx1D = htmpx->ProjectionX();
5650 if (fhTot4DT04D4Off != NULL) {
5651 Double_t nx = htmpx1D->GetNbinsX();
5652 for (Int_t ix = 1; ix <= nx; ix++) {
5653 Double_t dVal = htmpx1D->GetBinContent(ix) + fhTot4DT04D4Off->GetBinContent(ix);
5654 LOG(debug1) << "Update hTot4DT04D4best " << ix << ": " << htmpx1D->GetBinContent(ix) << " + "
5655 << fhTot4DT04D4Off->GetBinContent(ix) << " -> " << dVal;
5656 htmpx1D->SetBinContent(ix, dVal);
5657 }
5658 }
5659 else {
5660 LOG(warning) << "Histo fhTot4DT04D4Off not found ";
5661 }
5662 htmpx1D->Write();
5663 if (fhDTD4DT04D4Off != NULL) fhDTD4DT04D4Off->Write();
5664 if (fhDTX4D4Off != NULL) fhDTX4D4Off->Write();
5665 if (fhDTY4D4Off != NULL) fhDTY4D4Off->Write();
5666 if (fhDTTexpD4Off != NULL) fhDTTexpD4Off->Write();
5667 if (fhCluSize0DT04D4Off != NULL) fhCluSize0DT04D4Off->Write();
5668 if (fhCluSize4DT04D4Off != NULL) fhCluSize4DT04D4Off->Write();
5669 if (fhTot0DT04D4Off != NULL) fhTot0DT04D4Off->Write();
5670 } break;
5671
5672 case 9: {
5673 for (Int_t iSelType = 0; iSelType < 3; iSelType++) {
5674 TH1D* hResidualT = fhSelTypeNNResidualT->ProjectionY("_py", iSelType + 1, iSelType + 1);
5675 TH1D* hResidualX = fhSelTypeNNResidualX->ProjectionY("_py", iSelType + 1, iSelType + 1);
5676 TH1D* hResidualY = fhSelTypeNNResidualY->ProjectionY("_py", iSelType + 1, iSelType + 1);
5677
5678 if (hResidualT->GetEntries() > 100.) {
5679 Double_t dRMS = TMath::Abs(hResidualT->GetRMS());
5680 /*
5681 TFitResultPtr tFitResult = hResidualT->Fit("gaus", "SQM");
5682 dRMS = tFitResult->Parameter(2);
5683*/
5684 fhSelTypeNNResidualT_Width->SetBinContent(iSelType + 1, dRMS);
5685 }
5686
5687 if (hResidualX->GetEntries() > 100.) {
5688 Double_t dRMS = TMath::Abs(hResidualX->GetRMS());
5689 /*
5690 TFitResultPtr tFitResult = hResidualX->Fit("gaus", "SQM");
5691 dRMS = tFitResult->Parameter(2);
5692*/
5693 fhSelTypeNNResidualX_Width->SetBinContent(iSelType + 1, dRMS);
5694 }
5695
5696 if (hResidualY->GetEntries() > 100.) {
5697 Double_t dRMS = TMath::Abs(hResidualY->GetRMS());
5698 /*
5699 TFitResultPtr tFitResult = hResidualY->Fit("gaus", "SQM");
5700 dRMS = tFitResult->Parameter(2);
5701*/
5702 fhSelTypeNNResidualY_Width->SetBinContent(iSelType + 1, dRMS);
5703 }
5704 }
5705
5706
5707 if (fhDTD4DT04D4Off != NULL) fhDTD4DT04D4Off->Write();
5708 if (fhDTX4D4Off != NULL) fhDTX4D4Off->Write();
5709 if (fhDTY4D4Off != NULL) fhDTY4D4Off->Write();
5710 if (fhDTTexpD4Off != NULL) fhDTTexpD4Off->Write();
5711 if (fhCluSize0DT04D4Off != NULL) fhCluSize0DT04D4Off->Write();
5712 if (fhCluSize4DT04D4Off != NULL) fhCluSize4DT04D4Off->Write();
5713 if (fhTot0DT04D4Off != NULL) fhTot0DT04D4Off->Write();
5714 if (fhTot4DT04D4Off != NULL) fhTot4DT04D4Off->Write();
5715 } break;
5716
5717 case 10: {
5718 if (fhDXSel24->GetEntries() > 100.) {
5719 Double_t dRMS = TMath::Abs(fhDXSel24->GetRMS());
5720
5721 fhSelHitTupleResidualXYT_Width->SetBinContent(1, dRMS);
5722 }
5723
5724 if (fhDYSel24->GetEntries() > 100.) {
5725 Double_t dRMS = TMath::Abs(fhDYSel24->GetRMS());
5726
5727 fhSelHitTupleResidualXYT_Width->SetBinContent(2, dRMS);
5728 }
5729
5730 if (fhDTSel24->GetEntries() > 100.) {
5731 Double_t dRMS = TMath::Abs(fhDTSel24->GetRMS());
5732
5733 fhSelHitTupleResidualXYT_Width->SetBinContent(3, dRMS);
5734 }
5735
5736
5737 if (fhDTD4DT04D4Off != NULL) fhDTD4DT04D4Off->Write();
5738 if (fhDTX4D4Off != NULL) fhDTX4D4Off->Write();
5739 if (fhDTY4D4Off != NULL) fhDTY4D4Off->Write();
5740 if (fhDTTexpD4Off != NULL) fhDTTexpD4Off->Write();
5741 if (fhCluSize0DT04D4Off != NULL) fhCluSize0DT04D4Off->Write();
5742 if (fhCluSize4DT04D4Off != NULL) fhCluSize4DT04D4Off->Write();
5743 if (fhTot0DT04D4Off != NULL) fhTot0DT04D4Off->Write();
5744 if (fhTot4DT04D4Off != NULL) fhTot4DT04D4Off->Write();
5745 } break;
5746
5747 default:;
5748 }
5749
5750 fhDistDT04D4best->Write();
5751
5756
5757 // fHist->Write();
5758 if (0) {
5759 fhXX2->Write();
5760 fhYY2->Write();
5761 for (Int_t iDet = 0; iDet < 2; iDet++) {
5762 fhXX02[iDet]->Write();
5763 fhYY02[iDet]->Write();
5764 }
5765 fhXX04->Write();
5766 fhYY04->Write();
5767 fhXY04->Write();
5768 fhYX04->Write();
5769 }
5771 gFile = oldFile;
5772 gDirectory = oldDir;
5773
5774 fHist->Close();
5775
5776 return kTRUE;
5777}
5778
5780{
5781 // Test class performance
5782
5783 // Mapping
5784
5785 return kTRUE;
5786}
5787
5788
5790{
5791 return (Double_t) fhSelTypeNNResidualT_Width->GetBinContent(iSelType + 1);
5792}
5793
5794
5796{
5797 return (Double_t) fhSelTypeNNResidualX_Width->GetBinContent(iSelType + 1);
5798}
5799
5800
5802{
5803 return (Double_t) fhSelTypeNNResidualY_Width->GetBinContent(iSelType + 1);
5804}
5805
5806
5807Double_t CbmTofAnaTestbeam::GetSHTSigX() { return (Double_t) fhSelHitTupleResidualXYT_Width->GetBinContent(1); }
5808
5809
5810Double_t CbmTofAnaTestbeam::GetSHTSigY() { return (Double_t) fhSelHitTupleResidualXYT_Width->GetBinContent(2); }
5811
5812
5813Double_t CbmTofAnaTestbeam::GetSHTSigT() { return (Double_t) fhSelHitTupleResidualXYT_Width->GetBinContent(3); }
5814
5815
5817{
5818 Bool_t bFoundTofNode(kFALSE);
5819 TGeoNode* tTofNode(NULL);
5820
5821 fCurrentNodePath = "/" + (TString) gGeoManager->GetTopNode()->GetName();
5822
5823 TObjArray* tDaughterNodes = gGeoManager->GetTopNode()->GetNodes();
5824 for (Int_t iNode = 0; iNode < tDaughterNodes->GetEntriesFast(); iNode++) {
5825 TGeoNode* tDaughterNode = dynamic_cast<TGeoNode*>(tDaughterNodes->At(iNode));
5826 if (TString(tDaughterNode->GetName()).Contains("tof", TString::kIgnoreCase)) {
5827 bFoundTofNode = kTRUE;
5828 tTofNode = tDaughterNode;
5829 fCurrentNodePath += "/" + (TString) tDaughterNode->GetName();
5830 break;
5831 }
5832 }
5833
5834 if (!bFoundTofNode) {
5835 LOG(error) << "Could not retrieve 'tof' node from TGeoManager.";
5836 return kFALSE;
5837 }
5838
5839 ExpandNode(tTofNode);
5840
5841 return kTRUE;
5842}
5843
5844
5845void CbmTofAnaTestbeam::ExpandNode(TGeoNode* tMotherNode)
5846{
5847 TObjArray* tDaughterNodes = tMotherNode->GetNodes();
5848
5849 for (Int_t iNode = 0; iNode < tDaughterNodes->GetEntriesFast(); iNode++) {
5850 TGeoNode* tDaughterNode = dynamic_cast<TGeoNode*>(tDaughterNodes->At(iNode));
5851 fCurrentNodePath += "/" + (TString) tDaughterNode->GetName();
5852
5853 // Extract the current module type and module index from the module node
5854 if (TString(tDaughterNode->GetName()).Contains("module")) {
5858
5859 boost::regex rgx(".*_(\\d+)_.*");
5860 boost::cmatch match;
5861 if (boost::regex_search(tDaughterNode->GetName(), match, rgx)) {
5862 fiCurrentModuleType = boost::lexical_cast<Int_t>(match[1]);
5863 }
5864
5865 fiCurrentModuleIndex = tDaughterNode->GetNumber();
5866
5868 }
5869 // Extract the current counter index from the counter node
5870 else if (TString(tDaughterNode->GetName()).Contains("counter")) {
5871 fiCurrentCounterIndex = tDaughterNode->GetNumber();
5872
5874 new TGeoPhysicalNode(fCurrentModuleNodePath.Data());
5875 }
5876
5877 // Expand nodes recursively
5878 if (0 < tDaughterNode->GetNdaughters()) { ExpandNode(tDaughterNode); }
5879
5880 // Remove a node's name from the current node path upon completing a recursion step
5881 fCurrentNodePath.ReplaceAll("/" + (TString) tDaughterNode->GetName(), "");
5882 }
5883}
5884
5885
5886void GetPdgName(Int_t iPdgCode, const char*& cPdgName)
5887{
5888 auto itPdg = giPdgMap.find(iPdgCode);
5889 if (itPdg != giPdgMap.end()) { cPdgName = itPdg->second; }
5890 else {
5891 cPdgName = "XXX";
5892 LOG(error) << "unknown PDG code: " << iPdgCode;
5893 }
5894}
5895
5896void GetMaterialName(const char* cMaterial, const char*& cMaterialName)
5897{
5898 auto itMaterial = gcMaterialMap.find(cMaterial);
5899 if (itMaterial != gcMaterialMap.end()) { cMaterialName = itMaterial->second; }
5900 else {
5901 cMaterialName = "XXX";
5902 LOG(error) << "unknown material: " << cMaterial;
5903 }
5904}
5905
5906void GetProcessName(const char* cProcess, const char*& cProcessName)
5907{
5908 auto itProcess = gcProcessMap.find(cProcess);
5909 if (itProcess != gcProcessMap.end()) { cProcessName = itProcess->second; }
5910 else {
5911 cProcessName = "XXX";
5912 LOG(error) << "unknown process: " << cProcess;
5913 }
5914}
5915
5916
@ kTof
Time-of-flight Detector.
static TFile * fHist
TClonesArray * fTofHitsColl
TClonesArray * fEventsColl
void GetMaterialName(const char *cMaterial, const char *&cMaterialName)
static Double_t StartAnalysisTime
const Int_t DetMask
static std::vector< std::vector< CbmTofHit * > > fvLHit
std::map< const char *, const char *, cmp_str > gcMaterialMap
std::map< const char *, const char *, cmp_str > gcProcessMap
static Double_t fdMemoryTime
const Double_t DTDMAX
CbmDigiManager * fDigiMan
static Double_t dTLEvt
void GetProcessName(const char *cProcess, const char *&cProcessName)
std::map< Int_t, const char * > giPdgMap
static std::vector< TH2D * > fhLHTime
void GetPdgName(Int_t iPdgCode, const char *&cPdgName)
Int_t iNspills
static std::map< UInt_t, UInt_t > fDetIdMap
Double_t dTDia
ClassImp(CbmTofAnaTestbeam)
Double_t dDTD4Min
const Int_t iNSel
const Double_t fdSpillBreak
const Double_t fdSpillDuration
@ k14a
int Int_t
bool Bool_t
CbmDigiManager.
static Bool_t IsPresent(ECbmModuleId systemId)
Presence of a digi branch.
InitStatus Init()
Initialisation.
const Digi * Get(Int_t index) const
Get a digi object.
static CbmDigiManager * Instance()
Static instance.
Class characterising one event by a collection of links (indices) to data objects,...
Definition CbmEvent.h:34
size_t GetNofData() const
Definition CbmEvent.cxx:58
uint32_t GetIndex(ECbmDataType type, uint32_t iData) const
Definition CbmEvent.cxx:42
double GetTimeError() const
Definition CbmHit.h:77
double GetTime() const
Definition CbmHit.h:76
int32_t GetAddress() const
Definition CbmHit.h:74
double GetZ() const
Definition CbmHit.h:71
TObject * Get(const CbmLink *lnk)
Task class creating and managing CbmMCDataArray objects.
CbmMCDataObject * GetObject(const char *name)
CbmMCDataArray * InitBranch(const char *name)
TObject * Get(const CbmLink *lnk)
Container class for MC events with number, file and start time.
int32_t GetFileIdByIndex(uint32_t index)
File number by index @value File number for event at given index in list.
double GetEventTimeByIndex(uint32_t index)
Event time by index @value Event time for event at given index in list.
int32_t GetEventIdByIndex(uint32_t index)
Event number by index @value Event number for event at given index in list.
std::size_t GetNofEvents() const
Number of events in the list @value Number of events.
double GetEventTime(uint32_t event, uint32_t file)
Event start time.
double GetPz() const
Definition CbmMCTrack.h:72
double GetStartT() const
Definition CbmMCTrack.h:76
double GetPt() const
Definition CbmMCTrack.h:97
double GetP() const
Definition CbmMCTrack.h:98
double GetPx() const
Definition CbmMCTrack.h:70
uint32_t GetGeantProcessId() const
Definition CbmMCTrack.h:67
double GetStartZ() const
Definition CbmMCTrack.h:75
double GetMass() const
Mass of the associated particle.
double GetStartX() const
Definition CbmMCTrack.h:73
int32_t GetPdgCode() const
Definition CbmMCTrack.h:68
double GetStartY() const
Definition CbmMCTrack.h:74
double GetPy() const
Definition CbmMCTrack.h:71
double GetRapidity() const
double GetEnergy() const
Definition CbmMCTrack.h:162
const CbmLink & GetLink(int32_t i) const
Definition CbmMatch.h:39
int32_t GetNofLinks() const
Definition CbmMatch.h:42
void AddLink(const CbmLink &newLink)
Definition CbmMatch.cxx:47
const CbmLink & GetMatchedLink() const
Definition CbmMatch.h:41
double GetY() const
Definition CbmPixelHit.h:74
double GetX() const
Definition CbmPixelHit.h:73
static uint32_t GetUniqueAddress(uint32_t Sm, uint32_t Rpc, uint32_t Channel, uint32_t Side=0, uint32_t SmType=0, uint32_t RpcType=0)
static int32_t GetSmId(uint32_t address)
static int32_t GetRpcId(uint32_t address)
static int32_t GetSmType(uint32_t address)
static int32_t GetChannelId(uint32_t address)
CbmTofFindTracks * fFindTracks
TEfficiency * fhSelTrklMatchEfficiency
std::map< std::tuple< Int_t, Int_t, Int_t >, TH1 * > fhCounterRecRefTrackEfficiencyTotal
TEfficiency * fhSelTrklPurity
TClonesArray * fTofAccTrackTrackletMatches
TClonesArray * fTofDigisColl
TClonesArray * fAccTracks
std::map< std::tuple< Int_t, Int_t, Int_t >, TH1 * > fhCounterAccRndmTrackMul
TEfficiency * fhRecRefTrackEfficiency
TEfficiency * fhRecRndmTrackCloneShare
TEfficiency * fhSelHitTupleEfficiencyTIS
TEfficiency * fhSelMatchPurity
TClonesArray * fTofPointsTB
TClonesArray * fTofAccTrackPointMatches
TEfficiency * fhSelRefTrackShare
CbmTofTestBeamClusterizer * fClusterizer
CbmMCEventList * fMCEventList
TClonesArray * fTofHitsCollIn
TClonesArray * fTofDigiMatchCollIn
CbmTofCell * fChannelInfoSel2
TEfficiency * fhRecRefTrackCloneShare
TEfficiency * fhSelMCTrackMatchPurity
TEfficiency * fhAccRefTrackShare
CbmTofCell * fChannelInfoDut
std::map< std::tuple< Int_t, Int_t, Int_t >, TH2 * > fhCounterRefTrackMulCell
TEfficiency * fhRecRndmTrackEfficiency
TClonesArray * fTofHitPointMatches
std::map< std::tuple< Int_t, Int_t, Int_t >, TH1 * > fhCounterAccTrackMul
Double_t GetSigX(Int_t iSelType)
TEfficiency * fhSelMCTrackMatchEfficiencyTIS
virtual void SetParContainers()
Inherited from FairTask.
CbmTofGeoHandler * fGeoHandler
TEfficiency * fhSelTrklRefTrackShare
CbmMCDataArray * fTofPoints
TClonesArray * fTofDigiMatchColl
TEfficiency * fhAccRefTrackAcceptanceEfficiency
std::map< std::tuple< Int_t, Int_t, Int_t >, TH2 * > fhCounterRefTrackLocalXY
std::map< std::tuple< Int_t, Int_t, Int_t >, TH1 * > fhCounterAccRefTrackMul
Double_t GetSigY(Int_t iSelType)
std::map< std::tuple< Int_t, Int_t, Int_t >, TH1 * > fhCounterAccDomTrackMul
TEfficiency * fhSelTrklEfficiencyTIS
std::map< std::tuple< Int_t, Int_t, Int_t >, TH2 * > fhCounterRefTrackMulHitMul
TClonesArray * fTofTrackCollIn
TEfficiency * fhSelPurity
TClonesArray * fEventsColl
CbmTofCell * fChannelInfoRef
std::vector< TH2 * > fhXYPos
TEfficiency * fhSelTrklMatchPurity
TClonesArray * fTofDigisCollIn
TEfficiency * fhSelMatchEfficiency
TEfficiency * fhRecRndmTrackGhostShare
CbmTofCell * fChannelInfo
std::map< std::tuple< Int_t, Int_t, Int_t >, TH2 * > fhRndmTracksProcSpec
TEfficiency * fhAccRefTrackAcceptancePurity
CbmTofDigiBdfPar * fDigiBdfPar
TClonesArray * fTofHitAccTrackMatches
TEfficiency * fhSelMCTrackEfficiencyTIS
TClonesArray * fTofTrackletAccTrackMatches
Double_t GetSigT(Int_t iSelType)
std::map< std::tuple< Int_t, Int_t, Int_t >, TH1 * > fhCounterRecRefTrackPurityPassed
CbmMCDataArray * fMCTracks
TEfficiency * fhSelHitTupleMatchEfficiencyTIS
TEfficiency * fhSelTrklEfficiency
virtual void ExecEvent(Option_t *option)
Bool_t LoadCalParameter()
Load the geometry: for now just resizing the Digis temporary vectors.
std::map< std::tuple< Int_t, Int_t, Int_t >, TH2 * > fhDomTracksProcMat
std::map< std::tuple< Int_t, Int_t, Int_t >, TH2 * > fhDomTracksProcSpec
void ExpandNode(TGeoNode *tMotherNode)
CbmTofTrackletTools * fTrackletTools
TEfficiency * fhRecRefTrackGhostShare
CbmTofDigiPar * fDigiPar
std::map< std::tuple< Int_t, Int_t, Int_t >, TH2 * > fhCounterHitMulCell
std::map< std::tuple< Int_t, Int_t, Int_t >, TH2 * > fhRndmTracksProcMat
TClonesArray * fTofHitsColl
TEfficiency * fhSelMCTrackMatchEfficiency
TEfficiency * fhSelTrklMatchEfficiencyTIS
CbmMCDataObject * fMCEventHeader
virtual void Exec(Option_t *option)
std::map< std::tuple< Int_t, Int_t, Int_t >, TGeoPhysicalNode * > fCounterModuleNodes
std::map< std::tuple< Int_t, Int_t, Int_t >, TH1 * > fhCounterRecRefTrackEfficiencyPassed
TEfficiency * fhSelEfficiency
TEfficiency * fhSelMCTrackEfficiency
TClonesArray * fTofTrackColl
Bool_t InitParameters()
Initialize other parameters not included in parameter classes.
virtual InitStatus Init()
Double_t GetSizey() const
Definition CbmTofCell.h:40
Double_t GetY() const
Definition CbmTofCell.h:36
Double_t GetSizex() const
Definition CbmTofCell.h:39
Double_t GetX() const
Definition CbmTofCell.h:35
Double_t GetZ() const
Definition CbmTofCell.h:37
Parameters class for the CBM ToF digitizer using beam data distributions.
Int_t GetNbChan(Int_t iSmType, Int_t iRpc) const
Int_t GetDetInd(Int_t iAddr)
Double_t GetSigVel(Int_t iSmType, Int_t iSm, Int_t iRpc) const
CbmTofCell * GetCell(Int_t i)
Int_t GetNrOfModules()
Int_t GetCellId(Int_t i)
Data class for expanded digital TOF information.
Definition CbmTofDigi.h:47
double GetChannel() const
Channel .
Definition CbmTofDigi.h:157
double GetTot() const
Alias for GetCharge.
Definition CbmTofDigi.h:141
Double_t GetVertexT() const
Int_t GetStationOfAddr(Int_t iAddr)
static CbmTofFindTracks * Instance()
std::map< Int_t, Int_t > fMapRpcIdParInd
Int_t GetMinNofHits() const
Double_t GetTOff(Int_t iAddr)
Double_t GetVertexY() const
Double_t GetVertexX() const
Bool_t InspectEvent() const
Int_t GetNStations() const
Int_t Init(Bool_t isSimulation=kFALSE)
Int_t GetSModule(Int_t uniqueId)
Int_t GetCounter(Int_t uniqueId)
Int_t GetSMType(Int_t uniqueId)
double GetR() const
Definition CbmTofHit.h:78
virtual std::string ToString() const
Inherited from CbmBaseHit.
Definition CbmTofHit.cxx:66
Geometric intersection of a MC track with a TOFb detector.
Definition CbmTofPoint.h:44
static CbmTofTestBeamClusterizer * Instance()
std::vector< std::vector< std::vector< std::vector< std::list< CbmTofHit * > > > > > fvLastHits
static void Line3Dfit(CbmTofTracklet *pTrk)
contains fits and resolution functions
Double_t FitTt(CbmTofTracklet *pTrk, Int_t iDetId)
Provides information on attaching a TofHit to a TofTrack.
double GetFitY(double Z)
int32_t GetTofHitIndex(int32_t ind) const
virtual double GetTdif(int32_t iSmType, CbmTofHit *pHit)
void AddTofHitIndex(int32_t tofHitIndex, int32_t iDet, CbmTofHit *pHit)
virtual bool ContainsAddr(int32_t iAddr)
void SetTime(double val)
virtual CbmTofHit * HitPointerOfAddr(int32_t iAddr)
virtual int32_t HitIndexOfAddr(int32_t iAddr)
void RemoveTofHitIndex(int32_t, int32_t iDet, CbmTofHit *, double)
double GetTt() const
double GetTrackTx() const
virtual double GetXdif(int32_t iSmType, CbmTofHit *pHit)
int32_t GetNofHits() const
CbmTofHit * GetTofHitPointer(int32_t ind)
virtual double GetMatChi2(int32_t iSm)
double GetFitT(double R)
double GetTime() const
virtual double GetYdif(int32_t iSmType, CbmTofHit *pHit)
double GetTrackTy() const
double GetChiSq() const
double GetFitX(double Z)
void SetNofWrongHits(int32_t nofWrongHits)
double GetTrueOverAllHitsRatio() const
void SetNofTrueHits(int32_t nofTrueHits)
UInt_t GetTriggerPattern() const
Definition TTrbHeader.h:34
UInt_t GetTriggerType() const
Definition TTrbHeader.h:35
Double_t GetTimeInSpill() const
Definition TTrbHeader.h:36
Bool_t TriggerFired(Int_t iTrg)
bool operator()(char const *a, char const *b) const