CbmRoot
CbmKFParticleFinderPID.cxx
Go to the documentation of this file.
1 //-----------------------------------------------------------
2 //-----------------------------------------------------------
3 
4 // Cbm Headers ----------------------
6 #include "CbmGlobalTrack.h"
7 #include "CbmMCTrack.h"
8 #include "CbmMuchTrack.h"
9 #include "CbmRichRing.h"
10 #include "CbmStsCluster.h"
11 #include "CbmStsDigi.h"
12 #include "CbmStsHit.h"
13 #include "CbmStsTrack.h"
14 #include "CbmTofHit.h"
15 #include "CbmTrackMatchNew.h"
16 #include "CbmTrdHit.h"
17 #include "CbmTrdTrack.h"
18 
19 #include "CbmDigiManager.h"
20 #include "CbmEvent.h"
21 #include "CbmMCDataManager.h"
22 
23 #include "FairRunAna.h"
24 
25 //ROOT headers
26 #include "TClonesArray.h"
27 
28 //c++ and std headers
29 #include <iostream>
30 #include <vector>
31 using std::vector;
32 
33 double vecMedian(const vector<double>& vec) {
34  double median = 0.;
35  vector<double> vecCopy = vec;
36  sort(vecCopy.begin(), vecCopy.end());
37  int size = vecCopy.size();
38  if (size % 2 == 0)
39  median = (vecCopy[size / 2 - 1] + vecCopy[size / 2]) / 2;
40  else
41  median = vecCopy[size / 2];
42  return median;
43 }
44 
45 CbmKFParticleFinderPID::CbmKFParticleFinderPID(const char* name, Int_t iVerbose)
46  : FairTask(name, iVerbose)
47  , fStsTrackBranchName("StsTrack")
48  , fGlobalTrackBranchName("GlobalTrack")
49  , fStsHitBranchName("StsHit")
50  , fStsClusterBranchName("StsCluster")
51  , fStsDigiBranchName("StsDigi")
52  , fTofBranchName("TofHit")
53  , fMCTracksBranchName("MCTrack")
54  , fTrackMatchBranchName("StsTrackMatch")
55  , fTrdBranchName("TrdTrack")
56  , fTrdHitBranchName("TrdHit")
57  , fRichBranchName("RichRing")
58  , fMuchTrackBranchName("MuchTrack")
59  , fTrackArray(0)
60  , fGlobalTrackArray(0)
61  , fStsHitArray(0)
62  , fStsClusterArray(0)
63  , fDigiManager(nullptr)
64  , fTofHitArray(0)
65  , fMCTrackArray(0)
66  , fTrackMatchArray(0)
67  , fTrdTrackArray(0)
68  , fTrdHitArray(0)
69  , fRichRingArray(0)
70  , fMuchTrackArray(0)
71  , fMCTracks(0)
72  , fPIDMode(0)
73  , fSisMode(1)
74  , fTrdPIDMode(0)
75  , fRichPIDMode(0)
76  , fMuchMode(0)
77  , fUseSTSdEdX(kFALSE)
78  , fUseTRDdEdX(kFALSE)
79  , fTimeSliceMode(0)
80  , fPID(0) {
81  //MuCh cuts
82  fMuchCutsInt[0] = 7; // N sts hits
83  fMuchCutsInt[1] = 14; // N MuCh hits for LMVM
84  fMuchCutsInt[2] = 17; // N MuCh hits for J/Psi
85  fMuchCutsFloat[0] = 1.e6; // STS Chi2/NDF for muons
86  fMuchCutsFloat[1] = 1.5; // MuSh Chi2/NDF for muons
87 }
88 
90 
92  //Get ROOT Manager
93  FairRootManager* ioman = FairRootManager::Instance();
94 
95  if (ioman == 0) {
96  Error("CbmKFParticleFinderPID::Init", "RootManager not instantiated!");
97  return kERROR;
98  }
99 
100 
101  //check the mode
102  fTimeSliceMode = 0;
103  if (ioman->CheckBranch("Event")) {
104  fTimeSliceMode = 1;
105  LOG(info) << GetName() << ": Running in the timeslice mode.";
106  } else
107  LOG(info) << GetName() << ": Running in the event by event mode.";
108 
109  // Get reconstructed events
110 
111  if (fPIDMode == 1) {
112  FairRootManager* fManger = FairRootManager::Instance();
113  if (fManger == 0) {
114  Fatal("CbmKFParticleFinder::Init", "fManger is not found!");
115  return kERROR;
116  }
117 
118 
119  CbmMCDataManager* mcManager = 0;
120 
121  if (fTimeSliceMode)
122  mcManager = (CbmMCDataManager*) fManger->GetObject("MCDataManager");
123 
124  if (fTimeSliceMode)
125  if (mcManager == 0) {
126  Fatal("CbmKFParticleFinderPID::Init", "MC Data Manager is not found!");
127  return kERROR;
128  }
129 
130  if (fTimeSliceMode) {
131  fMCTracks = mcManager->InitBranch("MCTrack");
132  if (fMCTracks == 0) {
133  Fatal("CbmKFParticleFinderPID::Init", "MC track array not found!");
134  return kERROR;
135  }
136  } else {
137  fMCTrackArray = (TClonesArray*) ioman->GetObject("MCTrack");
138  if (fMCTrackArray == 0) {
139  Fatal("CbmKFParticleFinderPID::Init", "MC track array not found!");
140  return kERROR;
141  }
142  }
143 
144  //Track match
145  fTrackMatchArray = (TClonesArray*) ioman->GetObject(fTrackMatchBranchName);
146  if (fTrackMatchArray == 0) {
147  Error("CbmKFParticleFinderPID::Init", "track match array not found!");
148  return kERROR;
149  }
150  }
151 
152  // Get sts tracks
153  fTrackArray = (TClonesArray*) ioman->GetObject(fStsTrackBranchName);
154  if (fTrackArray == 0) {
155  Error("CbmKFParticleFinderPID::Init", "track-array not found!");
156  return kERROR;
157  }
158 
159  if (fPIDMode == 2) {
160  // Get global tracks
162  (TClonesArray*) ioman->GetObject(fGlobalTrackBranchName);
163  if (fGlobalTrackArray == 0) {
164  Error("CbmKFParticleFinderPID::Init", "global track array not found!");
165  return kERROR;
166  }
167 
168  // Get STS hit
169  fStsHitArray = (TClonesArray*) ioman->GetObject(fStsHitBranchName);
170  if (fStsHitArray == 0) {
171  Error("CbmKFParticleFinderPID::Init", "STS hit array not found!");
172  return kERROR;
173  }
174 
175  // Get sts clusters
176  fStsClusterArray = (TClonesArray*) ioman->GetObject(fStsClusterBranchName);
177  if (fStsClusterArray == 0) {
178  Error("CbmKFParticleFinderPID::Init", "STS cluster array not found!");
179  return kERROR;
180  }
181 
182 
183  // --- Digi Manager
185  fDigiManager->Init();
186 
187  // --- Check input array (StsDigis)
189  LOG(fatal) << GetName() << ": No StsDigi branch in input!";
190 
191  // Get ToF hits
192  fTofHitArray = (TClonesArray*) ioman->GetObject(fTofBranchName);
193  if (fTofHitArray == 0) {
194  Error("CbmKFParticleFinderPID::Init", "TOF track-array not found!");
195  //return kERROR;
196  }
197 
198  if (fTrdPIDMode > 0) {
199  fTrdTrackArray = (TClonesArray*) ioman->GetObject(fTrdBranchName);
200  if (fTrdTrackArray == 0) {
201  Error("CbmKFParticleFinderPID::Init", "TRD track-array not found!");
202  //return kERROR;
203  }
204  }
205 
206  fTrdHitArray = (TClonesArray*) ioman->GetObject(fTrdHitBranchName);
207  if (fTrdHitArray == 0) {
208  Error("CbmKFParticleFinderPID::Init", "TRD hit array not found!");
209  }
210 
211  if (fRichPIDMode > 0) {
212  fRichRingArray = (TClonesArray*) ioman->GetObject(fRichBranchName);
213  if (fRichRingArray == 0) {
214  Error("CbmKFParticleFinderPID::Init", "Rich ring array not found!");
215  //return kERROR;
216  }
217  }
218 
219  if (fMuchMode > 0) {
220  fMuchTrackArray = (TClonesArray*) ioman->GetObject(fMuchTrackBranchName);
221  if (fMuchTrackArray == 0) {
222  Error("CbmKFParticleFinderPID::Init", "Much track-array not found!");
223  return kERROR;
224  }
225  }
226  }
227 
228  return kSUCCESS;
229 }
230 
231 void CbmKFParticleFinderPID::Exec(Option_t* /*opt*/) {
232  fPID.clear();
233 
234  Int_t nTracks = fTrackArray->GetEntriesFast();
235  fPID.resize(nTracks, -1);
236 
237  if (fPIDMode == 1) SetMCPID();
238  if (fPIDMode == 2) SetRecoPID();
239 }
240 
242 
244  Int_t nTracks = fTrackArray->GetEntriesFast();
245  Int_t nMCTracks = 0;
246  if (!fTimeSliceMode) nMCTracks = fMCTrackArray->GetEntriesFast();
247 
248  for (int iTr = 0; iTr < nTracks; iTr++) {
249  fPID[iTr] = -2;
250 
251  CbmTrackMatchNew* stsTrackMatch =
253  if (stsTrackMatch->GetNofLinks() == 0) continue;
254  Float_t bestWeight = 0.f;
255  Float_t totalWeight = 0.f;
256  Int_t mcTrackId = -1;
257  Int_t iFile = -1;
258  Int_t iEvent = -1;
259 
260  for (int iLink = 0; iLink < stsTrackMatch->GetNofLinks(); iLink++) {
261  totalWeight += stsTrackMatch->GetLink(iLink).GetWeight();
262  if (stsTrackMatch->GetLink(iLink).GetWeight() > bestWeight) {
263  bestWeight = stsTrackMatch->GetLink(iLink).GetWeight();
264  mcTrackId = stsTrackMatch->GetLink(iLink).GetIndex();
265  if (fTimeSliceMode) {
266  iFile = stsTrackMatch->GetLink(iLink).GetFile();
267  iEvent = stsTrackMatch->GetLink(iLink).GetEntry();
268  }
269  }
270  }
271  if (bestWeight / totalWeight < 0.7) continue;
272 
273  if ((!fTimeSliceMode) && (mcTrackId >= nMCTracks || mcTrackId < 0))
274  continue;
275  // if(mcTrackId >= nMCTracks || mcTrackId < 0)
276  // {
277  // LOG(info) << "Sts Matching is wrong! StsTrackId = " << mcTrackId << " N mc tracks = " << nMCTracks;
278  // continue;
279  // }
280 
281 
282  // LOG(info) <<mcTrackId<<" mcTrackId "<<fMCTrackArray->GetEntriesFast();
283 
284  CbmMCTrack* cbmMCTrack = 0;
285 
286  if (fTimeSliceMode)
287  cbmMCTrack =
288  dynamic_cast<CbmMCTrack*>(fMCTracks->Get(iFile, iEvent, mcTrackId));
289  else
290  cbmMCTrack = (CbmMCTrack*) fMCTrackArray->At(mcTrackId);
291 
292 
293  if (!(TMath::Abs(cbmMCTrack->GetPdgCode()) == 11
294  || TMath::Abs(cbmMCTrack->GetPdgCode()) == 13
295  || TMath::Abs(cbmMCTrack->GetPdgCode()) == 211
296  || TMath::Abs(cbmMCTrack->GetPdgCode()) == 321
297  || TMath::Abs(cbmMCTrack->GetPdgCode()) == 2212
298  || TMath::Abs(cbmMCTrack->GetPdgCode()) == 1000010020
299  || TMath::Abs(cbmMCTrack->GetPdgCode()) == 1000010030
300  || TMath::Abs(cbmMCTrack->GetPdgCode()) == 1000020030
301  || TMath::Abs(cbmMCTrack->GetPdgCode()) == 1000020040))
302  fPID[iTr] = -1;
303  else
304  fPID[iTr] = cbmMCTrack->GetPdgCode();
305  }
306 }
307 
309  const Double_t m2TOF[7] = {0.885, 0.245, 0.019479835, 0., 3.49, 7.83, 1.95};
310 
311  Double_t sP[7][5];
312  if (fSisMode == 0) //SIS-100
313  {
314  Double_t sPLocal[7][5] = {
315  {0.056908, -0.0470572, 0.0216465, -0.0021016, 8.50396e-05},
316  {0.00943075, -0.00635429, 0.00998695, -0.00111527, 7.77811e-05},
317  {0.00176298, 0.00367263, 0.00308013, 0.000844013, -0.00010423},
318  {0.00218401, 0.00152391, 0.00895357, -0.000533423, 3.70326e-05},
319  {0.261491, -0.103121, 0.0247587, -0.00123286, 2.61731e-05},
320  {0.657274, -0.22355, 0.0430177, -0.0026822, 7.34146e-05},
321  {0.116525, -0.045522, 0.0151319, -0.000495545, 4.43144e-06}};
322  for (Int_t iSp = 0; iSp < 7; iSp++)
323  for (Int_t jSp = 0; jSp < 5; jSp++)
324  sP[iSp][jSp] = sPLocal[iSp][jSp];
325  }
326 
327  if (fSisMode == 1) //SIS-300
328  {
329  Double_t sPLocal[7][5] = {
330  {0.0337428, -0.013939, 0.00567602, -0.000202229, 4.07531e-06},
331  {0.00717827, -0.00257353, 0.00389851, -9.83097e-05, 1.33011e-06},
332  {0.001348, 0.00220126, 0.0023619, 7.35395e-05, -4.06706e-06},
333  {0.00142972, 0.00308919, 0.00326995, 6.91715e-05, -2.44194e-06},
334  {0.261491,
335  -0.103121,
336  0.0247587,
337  -0.00123286,
338  2.61731e-05}, //TODO tune for SIS300
339  {0.657274, -0.22355, 0.0430177, -0.0026822, 7.34146e-05},
340  {0.116525, -0.045522, 0.0151319, -0.000495545, 4.43144e-06}};
341  for (Int_t iSp = 0; iSp < 7; iSp++)
342  for (Int_t jSp = 0; jSp < 5; jSp++)
343  sP[iSp][jSp] = sPLocal[iSp][jSp];
344  }
345 
346  const Int_t PdgHypo[9] = {
347  2212, 321, 211, -11, 1000010029, 1000010030, 1000020030, -13, -19};
348 
349  for (Int_t igt = 0; igt < fGlobalTrackArray->GetEntriesFast(); igt++) {
350  const CbmGlobalTrack* globalTrack =
351  static_cast<const CbmGlobalTrack*>(fGlobalTrackArray->At(igt));
352 
353  Int_t stsTrackIndex = globalTrack->GetStsTrackIndex();
354  if (stsTrackIndex < 0) continue;
355 
356  Bool_t isElectronTRD = 0;
357  Bool_t isElectronRICH = 0;
358  Bool_t isElectron = 0;
359 
360 
361  CbmStsTrack* cbmStsTrack = (CbmStsTrack*) fTrackArray->At(stsTrackIndex);
362 
363  const FairTrackParam* stsPar = cbmStsTrack->GetParamFirst();
364  TVector3 mom;
365  stsPar->Momentum(mom);
366 
367  Double_t p = mom.Mag();
368  Double_t pt = mom.Perp();
369  Double_t pz = sqrt(p * p - pt * pt);
370  Int_t q = stsPar->GetQp() > 0 ? 1 : -1;
371 
372  if (fRichPIDMode == 1) {
373  if (fRichRingArray) {
374  Int_t richIndex = globalTrack->GetRichRingIndex();
375  if (richIndex > -1) {
376  CbmRichRing* richRing = (CbmRichRing*) fRichRingArray->At(richIndex);
377  if (richRing) {
378  Double_t axisA = richRing->GetAaxis();
379  Double_t axisB = richRing->GetBaxis();
380  Double_t dist = 0; // richRing->GetDistance();
381 
382  Double_t fMeanA = 4.95;
383  Double_t fMeanB = 4.54;
384  Double_t fRmsA = 0.30;
385  Double_t fRmsB = 0.22;
386  Double_t fRmsCoeff = 3.5;
387  Double_t fDistCut = 1.;
388 
389 
390  // if(fElIdAnn->DoSelect(richRing, p) > -0.5) isElectronRICH = 1;
391  if (p < 5.) {
392  if (fabs(axisA - fMeanA) < fRmsCoeff * fRmsA
393  && fabs(axisB - fMeanB) < fRmsCoeff * fRmsB
394  && dist < fDistCut)
395  isElectronRICH = 1;
396  } else {
398  // Double_t polAaxis = 5.80008 - 4.10118 / (momentum - 3.67402);
399  // Double_t polBaxis = 5.58839 - 4.75980 / (momentum - 3.31648);
400  // Double_t polRaxis = 5.87252 - 7.64641/(momentum - 1.62255);
402  Double_t polAaxis = 5.64791 - 4.24077 / (p - 3.65494);
403  Double_t polBaxis = 5.41106 - 4.49902 / (p - 3.52450);
404  //Double_t polRaxis = 5.66516 - 6.62229/(momentum - 2.25304);
405  if (axisA < (fMeanA + fRmsCoeff * fRmsA) && axisA > polAaxis
406  && axisB < (fMeanB + fRmsCoeff * fRmsB) && axisB > polBaxis
407  && dist < fDistCut)
408  isElectronRICH = 1;
409  }
410  }
411  }
412  }
413  }
414 
415  if (fTrdPIDMode == 1) {
416  if (fTrdTrackArray) {
417  Int_t trdIndex = globalTrack->GetTrdTrackIndex();
418  if (trdIndex > -1) {
419  CbmTrdTrack* trdTrack = (CbmTrdTrack*) fTrdTrackArray->At(trdIndex);
420  if (trdTrack) {
421  if (trdTrack->GetPidWkn() > 0.635) isElectronTRD = 1;
422  }
423  }
424  }
425  }
426 
427  if (fTrdPIDMode == 2) {
428  if (fTrdTrackArray) {
429  Int_t trdIndex = globalTrack->GetTrdTrackIndex();
430  if (trdIndex > -1) {
431  CbmTrdTrack* trdTrack = (CbmTrdTrack*) fTrdTrackArray->At(trdIndex);
432  if (trdTrack) {
433  if (trdTrack->GetPidANN() > 0.9) isElectronTRD = 1;
434  }
435  }
436  }
437  }
438 
439  // dEdX in TRD
440  double dEdXTRD = 1e6; // in case if TRD is not used
441  if (fTrdTrackArray) {
442  Int_t trdIndex = globalTrack->GetTrdTrackIndex();
443  if (trdIndex > -1) {
444  CbmTrdTrack* trdTrack = (CbmTrdTrack*) fTrdTrackArray->At(trdIndex);
445  if (trdTrack) {
446  Double_t eloss = 0.;
447  for (Int_t iTRD = 0; iTRD < trdTrack->GetNofHits(); iTRD++) {
448  Int_t TRDindex = trdTrack->GetHitIndex(iTRD);
449  CbmTrdHit* trdHit = (CbmTrdHit*) fTrdHitArray->At(TRDindex);
450  eloss += trdHit->GetELoss();
451  }
452  if (trdTrack->GetNofHits() > 0.)
453  dEdXTRD = 1e6 * pz / p * eloss / trdTrack->GetNofHits();
454  }
455  }
456  }
457 
458  //STS dE/dX
459  vector<double> dEdxAllveto;
460  int nClustersWveto =
461  cbmStsTrack->GetNofStsHits()
462  + cbmStsTrack->GetNofStsHits(); //assume all clusters with veto
463  double dr = 1.;
464  for (int iHit = 0; iHit < cbmStsTrack->GetNofStsHits(); ++iHit) {
465  bool frontVeto = kFALSE, backVeto = kFALSE;
466  CbmStsHit* stsHit =
467  (CbmStsHit*) fStsHitArray->At(cbmStsTrack->GetStsHitIndex(iHit));
468 
469  double x, y, z, xNext, yNext, zNext;
470  x = stsHit->GetX();
471  y = stsHit->GetY();
472  z = stsHit->GetZ();
473 
474  if (iHit != cbmStsTrack->GetNofStsHits() - 1) {
475  CbmStsHit* stsHitNext =
476  (CbmStsHit*) fStsHitArray->At(cbmStsTrack->GetStsHitIndex(iHit + 1));
477  xNext = stsHitNext->GetX();
478  yNext = stsHitNext->GetY();
479  zNext = stsHitNext->GetZ();
480  dr = sqrt((xNext - x) * (xNext - x) + (yNext - y) * (yNext - y)
481  + (zNext - z) * (zNext - z))
482  / (zNext - z); // if *300um, you get real reconstructed dr
483  } // else dr stay previous
484 
485  CbmStsCluster* frontCluster =
487  CbmStsCluster* backCluster =
489 
490  if (!frontCluster || !backCluster) {
491  LOG(info) << "CbmKFParticleFinderPID: no front or back cluster";
492  continue;
493  }
494 
495  //check if at least one digi in a cluster has overflow --- charge is registered in the last ADC channel #31
496  for (int iDigi = 0; iDigi < frontCluster->GetNofDigis(); ++iDigi) {
497  if (31
498  == (fDigiManager->Get<CbmStsDigi>(frontCluster->GetDigi(iDigi))
499  ->GetCharge()))
500  frontVeto = kTRUE;
501  }
502  for (int iDigi = 0; iDigi < backCluster->GetNofDigis(); ++iDigi) {
503  if (31
504  == (fDigiManager->Get<CbmStsDigi>(backCluster->GetDigi(iDigi))
505  ->GetCharge()))
506  backVeto = kTRUE;
507  }
508 
509  if (!frontVeto) dEdxAllveto.push_back((frontCluster->GetCharge()) / dr);
510  if (!backVeto) dEdxAllveto.push_back((backCluster->GetCharge()) / dr);
511 
512  if (0 == frontVeto) nClustersWveto--;
513  if (0 == backVeto) nClustersWveto--;
514  }
515  float dEdXSTS = 1.e6;
516  if (dEdxAllveto.size() != 0) dEdXSTS = vecMedian(dEdxAllveto);
517 
518 
519  int isMuon = 0;
520  if (fMuchTrackArray && fMuchMode > 0) {
521  Int_t muchIndex = globalTrack->GetMuchTrackIndex();
522  if (muchIndex > -1) {
523  CbmMuchTrack* muchTrack =
524  (CbmMuchTrack*) fMuchTrackArray->At(muchIndex);
525  if (muchTrack) {
526  if ((cbmStsTrack->GetChiSq() / cbmStsTrack->GetNDF())
527  < fMuchCutsFloat[0]
528  && (muchTrack->GetChiSq() / muchTrack->GetNDF())
529  < fMuchCutsFloat[1]
530  && cbmStsTrack->GetNofHits() >= fMuchCutsInt[0]) {
531  if (muchTrack->GetNofHits() >= fMuchCutsInt[1]) isMuon = 2;
532  if (muchTrack->GetNofHits() >= fMuchCutsInt[2]) isMuon = 1;
533  }
534  }
535  }
536  }
537 
538  if (p > 1.5) {
539  if (isElectronRICH && isElectronTRD) isElectron = 1;
540  if (fRichPIDMode == 0 && isElectronTRD) isElectron = 1;
541  if (fTrdPIDMode == 0 && isElectronRICH) isElectron = 1;
542  } else if (isElectronRICH)
543  isElectron = 1;
544 
545  if (fTofHitArray && isMuon == 0) {
546  Double_t l =
547  globalTrack->GetLength(); // l is calculated by global tracking
548  if (fSisMode == 0) //SIS-100
549  if (!((l > 500.) && (l < 900.))) continue;
550  if (fSisMode == 1) //SIS 300
551  if (!((l > 700.) && (l < 1500.))) continue;
552 
553  Double_t time;
554  Int_t tofHitIndex = globalTrack->GetTofHitIndex();
555  if (tofHitIndex >= 0) {
556  const CbmTofHit* tofHit =
557  static_cast<const CbmTofHit*>(fTofHitArray->At(tofHitIndex));
558  if (!tofHit) continue;
559  time = tofHit->GetTime();
560  } else
561  continue;
562 
563  if (fSisMode == 0) //SIS-100
564  if (!((time > 16.) && (time < 42.))) continue;
565  if (fSisMode == 1) //SIS 300
566  if (!((time > 26.) && (time < 52.))) continue;
567 
568  Double_t m2 =
569  p * p * (1. / ((l / time / 29.9792458) * (l / time / 29.9792458)) - 1.);
570 
571  Double_t sigma[7];
572  Double_t dm2[7];
573 
574  for (int iSigma = 0; iSigma < 7; iSigma++) {
575  sigma[iSigma] = sP[iSigma][0] + sP[iSigma][1] * p
576  + sP[iSigma][2] * p * p + sP[iSigma][3] * p * p * p
577  + sP[iSigma][4] * p * p * p * p;
578  dm2[iSigma] = fabs(m2 - m2TOF[iSigma]) / sigma[iSigma];
579  }
580 
581  if (isElectron) {
582  if (dm2[3] > 3.) isElectron = 0;
583  }
584 
585  int iPdg = 2;
586  Double_t dm2min = dm2[2];
587 
588  if (!isElectron && isMuon == 0) {
589  // if(p>12.) continue;
590 
591  for (int jPDG = 0; jPDG < 7; jPDG++) {
592  if (jPDG == 3) continue;
593  if (dm2[jPDG] < dm2min) {
594  iPdg = jPDG;
595  dm2min = dm2[jPDG];
596  }
597  }
598 
599  if (dm2min > 2) iPdg = -1;
600 
601  Double_t dEdXTRDthresholdProton = 10.;
602  if (iPdg == 6) {
603  if (fUseTRDdEdX && (dEdXTRD < dEdXTRDthresholdProton)) iPdg = 0;
604  if (fUseSTSdEdX && (dEdXSTS < 7.5e4)) iPdg = 0;
605  }
606 
607  if (iPdg > -1) fPID[stsTrackIndex] = q * PdgHypo[iPdg];
608  }
609  }
610 
611  if (isElectron) fPID[stsTrackIndex] = q * PdgHypo[3];
612 
613  if (isMuon == 1) fPID[stsTrackIndex] = q * PdgHypo[7];
614  if (isMuon == 2) fPID[stsTrackIndex] = q * PdgHypo[8];
615  }
616 }
617 
CbmHit::GetZ
Double_t GetZ() const
Definition: CbmHit.h:70
CbmKFParticleFinderPID
Definition: CbmKFParticleFinderPID.h:22
CbmKFParticleFinderPID::fMuchMode
Int_t fMuchMode
Definition: CbmKFParticleFinderPID.h:123
CbmMCDataManager::GetObject
CbmMCDataObject * GetObject(const char *name)
Definition: CbmMCDataManager.cxx:137
CbmTrack::GetChiSq
Double_t GetChiSq() const
Definition: CbmTrack.h:58
CbmMCDataManager.h
CbmKFParticleFinderPID::fStsHitArray
TClonesArray * fStsHitArray
Definition: CbmKFParticleFinderPID.h:106
CbmKFParticleFinderPID::Finish
virtual void Finish()
Definition: CbmKFParticleFinderPID.cxx:241
CbmKFParticleFinderPID::fTofBranchName
TString fTofBranchName
Definition: CbmKFParticleFinderPID.h:95
CbmKFParticleFinderPID::SetRecoPID
void SetRecoPID()
Definition: CbmKFParticleFinderPID.cxx:308
CbmPixelHit::GetX
Double_t GetX() const
Definition: CbmPixelHit.h:83
CbmGlobalTrack::GetMuchTrackIndex
Int_t GetMuchTrackIndex() const
Definition: CbmGlobalTrack.h:40
CbmMatch::GetLink
const CbmLink & GetLink(Int_t i) const
Definition: CbmMatch.h:35
CbmMatch::GetNofLinks
Int_t GetNofLinks() const
Definition: CbmMatch.h:38
CbmStsCluster
Data class for STS clusters.
Definition: CbmStsCluster.h:31
CbmTrack::GetNofHits
virtual Int_t GetNofHits() const
Definition: CbmTrack.h:53
CbmKFParticleFinderPID::fUseSTSdEdX
Bool_t fUseSTSdEdX
Definition: CbmKFParticleFinderPID.h:124
CbmKFParticleFinderPID::fPIDMode
Int_t fPIDMode
Definition: CbmKFParticleFinderPID.h:119
CbmPixelHit::GetY
Double_t GetY() const
Definition: CbmPixelHit.h:84
CbmKFParticleFinderPID::fUseTRDdEdX
Bool_t fUseTRDdEdX
Definition: CbmKFParticleFinderPID.h:125
sqrt
friend F32vec4 sqrt(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:41
CbmKFParticleFinderPID::Exec
virtual void Exec(Option_t *opt)
Definition: CbmKFParticleFinderPID.cxx:231
CbmDigiManager::Init
InitStatus Init()
Initialisation.
Definition: CbmDigiManager.cxx:71
CbmTrdHit::GetELoss
Double_t GetELoss() const
Definition: CbmTrdHit.h:79
CbmKFParticleFinderPID::fMuchTrackArray
TClonesArray * fMuchTrackArray
Definition: CbmKFParticleFinderPID.h:115
CbmKFParticleFinderPID.h
CbmGlobalTrack::GetRichRingIndex
Int_t GetRichRingIndex() const
Definition: CbmGlobalTrack.h:41
CbmKFParticleFinderPID::fDigiManager
CbmDigiManager * fDigiManager
Definition: CbmKFParticleFinderPID.h:108
CbmMCTrack::GetPdgCode
Int_t GetPdgCode() const
Definition: CbmMCTrack.h:70
CbmStsCluster::GetCharge
Double_t GetCharge() const
Get cluster charge @value Total cluster charge [e].
Definition: CbmStsCluster.h:55
CbmTrdHit
data class for a reconstructed Energy-4D measurement in the TRD
Definition: CbmTrdHit.h:35
CbmMCDataManager::InitBranch
CbmMCDataArray * InitBranch(const char *name)
Definition: CbmMCDataManager.cxx:106
CbmGlobalTrack.h
CbmStsHit::GetFrontClusterId
Int_t GetFrontClusterId() const
Definition: CbmStsHit.h:93
CbmRichRing
Definition: CbmRichRing.h:17
CbmGlobalTrack::GetLength
Double_t GetLength() const
Definition: CbmGlobalTrack.h:50
CbmKFParticleFinderPID::~CbmKFParticleFinderPID
~CbmKFParticleFinderPID()
Definition: CbmKFParticleFinderPID.cxx:89
CbmRichRing.h
CbmKFParticleFinderPID::fRichBranchName
TString fRichBranchName
Definition: CbmKFParticleFinderPID.h:100
CbmDigiManager::IsPresent
static Bool_t IsPresent(ECbmModuleId systemId)
Presence of a digi branch.
Definition: CbmDigiManager.cxx:112
CbmMuchTrack
Definition: CbmMuchTrack.h:16
CbmKFParticleFinderPID::fTrackMatchBranchName
TString fTrackMatchBranchName
Definition: CbmKFParticleFinderPID.h:97
CbmStsTrack::GetNofHits
virtual Int_t GetNofHits() const
Definition: CbmStsTrack.h:76
CbmKFParticleFinderPID::fStsHitBranchName
TString fStsHitBranchName
Definition: CbmKFParticleFinderPID.h:92
CbmDigiManager::Instance
static CbmDigiManager * Instance()
Static instance.
Definition: CbmDigiManager.h:93
CbmCluster::GetNofDigis
Int_t GetNofDigis() const
Number of digis in cluster.
Definition: CbmCluster.h:69
CbmEvent.h
CbmStsHit
data class for a reconstructed 3-d hit in the STS
Definition: CbmStsHit.h:31
CbmKFParticleFinderPID::fGlobalTrackArray
TClonesArray * fGlobalTrackArray
Definition: CbmKFParticleFinderPID.h:105
ClassImp
ClassImp(CbmKFParticleFinderPID)
CbmStsDigi.h
CbmStsTrack.h
Data class for STS tracks.
CbmGlobalTrack::GetStsTrackIndex
Int_t GetStsTrackIndex() const
Definition: CbmGlobalTrack.h:38
CbmTrdTrack::GetPidANN
Double_t GetPidANN() const
Definition: CbmTrdTrack.h:32
CbmMuchTrack.h
CbmKFParticleFinderPID::fTrdTrackArray
TClonesArray * fTrdTrackArray
Definition: CbmKFParticleFinderPID.h:112
CbmKFParticleFinderPID::fStsClusterArray
TClonesArray * fStsClusterArray
Definition: CbmKFParticleFinderPID.h:107
CbmDigiManager::Get
const Digi * Get(Int_t index) const
Get a digi object.
Definition: CbmDigiManager.h:52
CbmKFParticleFinderPID::fTrdHitBranchName
TString fTrdHitBranchName
Definition: CbmKFParticleFinderPID.h:99
CbmKFParticleFinderPID::fTrackMatchArray
TClonesArray * fTrackMatchArray
Definition: CbmKFParticleFinderPID.h:111
CbmMCDataArray::Get
TObject * Get(const CbmLink *lnk)
Definition: CbmMCDataArray.h:47
CbmHit::GetTime
Double_t GetTime() const
Definition: CbmHit.h:75
CbmKFParticleFinderPID::fMuchCutsInt
int fMuchCutsInt[3]
Definition: CbmKFParticleFinderPID.h:131
CbmTrack::GetHitIndex
Int_t GetHitIndex(Int_t iHit) const
Definition: CbmTrack.h:54
CbmKFParticleFinderPID::SetMCPID
void SetMCPID()
Definition: CbmKFParticleFinderPID.cxx:243
CbmKFParticleFinderPID::fPID
std::vector< int > fPID
Definition: CbmKFParticleFinderPID.h:133
CbmGlobalTrack::GetTrdTrackIndex
Int_t GetTrdTrackIndex() const
Definition: CbmGlobalTrack.h:39
CbmTrackMatchNew.h
CbmKFParticleFinderPID::fMCTracks
CbmMCDataArray * fMCTracks
Definition: CbmKFParticleFinderPID.h:116
CbmKFParticleFinderPID::fMuchCutsFloat
float fMuchCutsFloat[2]
Definition: CbmKFParticleFinderPID.h:130
CbmKFParticleFinderPID::fTofHitArray
TClonesArray * fTofHitArray
Interface to digi branch.
Definition: CbmKFParticleFinderPID.h:109
nMCTracks
Int_t nMCTracks
Definition: CbmHadronAnalysis.cxx:63
CbmTrack::GetNDF
Int_t GetNDF() const
Definition: CbmTrack.h:59
CbmTrdHit.h
Class for hits in TRD detector.
CbmKFParticleFinderPID::fStsTrackBranchName
TString fStsTrackBranchName
Definition: CbmKFParticleFinderPID.h:90
CbmKFParticleFinderPID::fGlobalTrackBranchName
TString fGlobalTrackBranchName
Definition: CbmKFParticleFinderPID.h:91
CbmStsDigi
Data class for a single-channel message in the STS.
Definition: CbmStsDigi.h:29
CbmTrack::GetParamFirst
const FairTrackParam * GetParamFirst() const
Definition: CbmTrack.h:61
CbmKFParticleFinderPID::fMCTrackArray
TClonesArray * fMCTrackArray
Definition: CbmKFParticleFinderPID.h:110
CbmKFParticleFinderPID::fStsClusterBranchName
TString fStsClusterBranchName
Definition: CbmKFParticleFinderPID.h:93
CbmRichRing::GetAaxis
Double_t GetAaxis() const
Definition: CbmRichRing.h:83
CbmKFParticleFinderPID::fMuchTrackBranchName
TString fMuchTrackBranchName
Definition: CbmKFParticleFinderPID.h:101
CbmKFParticleFinderPID::fTrdHitArray
TClonesArray * fTrdHitArray
Definition: CbmKFParticleFinderPID.h:113
CbmMCDataManager
Task class creating and managing CbmMCDataArray objects.
Definition: CbmMCDataManager.h:27
CbmTrdTrack
Definition: CbmTrdTrack.h:22
CbmKFParticleFinderPID::fRichPIDMode
Int_t fRichPIDMode
Definition: CbmKFParticleFinderPID.h:122
CbmStsDigi::GetCharge
Double_t GetCharge() const
Definition: CbmStsDigi.h:71
CbmRichRing::GetBaxis
Double_t GetBaxis() const
Definition: CbmRichRing.h:84
CbmGlobalTrack
Definition: CbmGlobalTrack.h:26
CbmKFParticleFinderPID::fTimeSliceMode
bool fTimeSliceMode
Definition: CbmKFParticleFinderPID.h:127
CbmMCTrack.h
CbmStsHit::GetBackClusterId
Int_t GetBackClusterId() const
Definition: CbmStsHit.h:69
CbmDigiManager.h
CbmMCTrack
Definition: CbmMCTrack.h:34
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmTrdTrack::GetPidWkn
Double_t GetPidWkn() const
Definition: CbmTrdTrack.h:31
fabs
friend F32vec4 fabs(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:60
CbmKFParticleFinderPID::CbmKFParticleFinderPID
CbmKFParticleFinderPID(const char *name="CbmKFParticleFinderPID", Int_t iVerbose=0)
Definition: CbmKFParticleFinderPID.cxx:45
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmTrackMatchNew
Definition: CbmTrackMatchNew.h:19
CbmTofHit
Definition: core/data/tof/CbmTofHit.h:26
CbmGlobalTrack::GetTofHitIndex
Int_t GetTofHitIndex() const
Definition: CbmGlobalTrack.h:42
CbmTrdTrack.h
CbmStsTrack::GetStsHitIndex
Int_t GetStsHitIndex(Int_t iHit) const
Definition: CbmStsTrack.h:98
CbmStsCluster.h
Data class for STS clusters.
CbmKFParticleFinderPID::fRichRingArray
TClonesArray * fRichRingArray
Definition: CbmKFParticleFinderPID.h:114
CbmStsTrack
Definition: CbmStsTrack.h:37
ECbmModuleId::kSts
@ kSts
Silicon Tracking System.
CbmCluster::GetDigi
Int_t GetDigi(Int_t index) const
Get digi at position index.
Definition: CbmCluster.h:76
CbmKFParticleFinderPID::Init
virtual InitStatus Init()
Definition: CbmKFParticleFinderPID.cxx:91
CbmKFParticleFinderPID::fTrdBranchName
TString fTrdBranchName
Definition: CbmKFParticleFinderPID.h:98
CbmKFParticleFinderPID::fTrackArray
TClonesArray * fTrackArray
Definition: CbmKFParticleFinderPID.h:104
CbmStsHit.h
Data class for a reconstructed hit in the STS.
CbmKFParticleFinderPID::fTrdPIDMode
Int_t fTrdPIDMode
Definition: CbmKFParticleFinderPID.h:121
vecMedian
double vecMedian(const vector< double > &vec)
Definition: CbmKFParticleFinderPID.cxx:33
CbmStsTrack::GetNofStsHits
Int_t GetNofStsHits() const
Definition: CbmStsTrack.h:90
CbmKFParticleFinderPID::fSisMode
Int_t fSisMode
Definition: CbmKFParticleFinderPID.h:120