FairRoot/PandaRoot
PndPidMdtHCAssociatorTask.cxx
Go to the documentation of this file.
2 #include "PndPidCandidate.h"
3 #include "PndPidProbability.h"
4 #include "FairRootManager.h"
5 #include "TMath.h"
6 #include "Riostream.h"
7 
8 
9 //___________________________________________________________
11  //
12  FairRootManager *fManager =FairRootManager::Instance();
13  fManager->Write();
14 }
15 
16 //___________________________________________________________
18  //---
19  fPidChargedProb = new TClonesArray("PndPidProbability");
21 }
22 
23 //___________________________________________________________
24 PndPidMdtHCAssociatorTask::PndPidMdtHCAssociatorTask(const char *name, const char *title):FairTask(name)
25 {
26  //---
27  fPidChargedProb = new TClonesArray("PndPidProbability");
29  SetTitle(title);
30 }
31 
32 //___________________________________________________________
34 
35  std::cout << "InitStatus PndPidMdtHCAssociatorTask::Init()" << std::endl;
36 
37  FairRootManager *fManager =FairRootManager::Instance();
38 
39  fPidChargedCand = (TClonesArray *)fManager->GetObject("PidChargedCand"+fTrackBranchNamePidHypo);
40  if ( ! fPidChargedCand) {
41  std::cout << "-I- PndPidMdtHCAssociatorTask::Init: No PndPidCandidate array PidChargedCand there!" << std::endl;
42  return kERROR;
43  }
44 
45  Register();
46 
47  std::cout << "-I- PndPidMdtHCAssociatorTask::Init: Success!" << std::endl;
48 
49  return kSUCCESS;
50 }
51 
52 //______________________________________________________
54  //--
55 }
56 //______________________________________________________
58  if (fPidChargedProb->GetEntriesFast() != 0) fPidChargedProb->Delete();
59  if(fVerbose>1) std::cout << "-I- Start PndPidMdtHCAssociatorTask. "<<std::endl;
60 
61  // Get the Candidates
62  for(Int_t i=0; i<fPidChargedCand->GetEntriesFast(); i++)
63  {
65  TClonesArray& pidRef = *fPidChargedProb;
66  PndPidProbability* prob = new(pidRef[i]) PndPidProbability();// initializes with flat probabilities
67  prob->SetIndex(i);
68  if (pidcand->GetMuoIndex()==-1) continue;
69 
70 
71  DoPidMatch(pidcand,prob);
72  }
73 
74 }
75 
77 {
78  if (pidcand->GetMuoIron()==0.) return;
79 
80  Double_t iron_thr = 0, mom_min = 0, mom_max = 0;
81  if ((pidcand->GetMuoModule()==-1) || (pidcand->GetMuoModule()==2) )
82  {
83  iron_thr = 60.;
84  mom_min = 0.4;
85  mom_max = 1.1;
86  }
87  else if (pidcand->GetMuoModule()==1)
88  {
89  iron_thr = 40.;
90  mom_min = 0.2;
91  mom_max = 0.8;
92  }
93  else if (pidcand->GetMuoModule()==4)
94  {
95  iron_thr = 95.;
96  mom_min = 1.5;
97  mom_max = 1.5;
98  }
99  else
100  {
101  return;
102  }
103 
104  if (pidcand->GetMuoMomentumIn() < mom_min) return;
105 
106  if (pidcand->GetMuoMomentumIn() >= mom_max)
107  {
108  if (pidcand->GetMuoIron()>iron_thr)
109  {
110  // FIXME: Don't write zeros to that pdf!
111  prob->SetElectronPdf(0);
112  prob->SetMuonPdf(1);
113  prob->SetPionPdf(0);
114  prob->SetKaonPdf(0);
115  prob->SetProtonPdf(0);
116  return;
117  }
118  else
119  {
120  // FIXME: Don't write zeros to that pdf!
121  prob->SetElectronPdf(1);
122  prob->SetMuonPdf(0);
123  prob->SetPionPdf(1);
124  prob->SetKaonPdf(1);
125  prob->SetProtonPdf(1);
126  return;
127  }
128  } // end of momentum > mom_max
129  else
130  {
131  if (pidcand->GetMuoIron() > (pidcand->GetMuoMomentumIn()*iron_thr/(mom_max-mom_min) - iron_thr* mom_min/(mom_max-mom_min)) )
132  {
133  // FIXME: Don't write zeros to that pdf!
134  prob->SetElectronPdf(0);
135  prob->SetMuonPdf(1);
136  prob->SetPionPdf(0);
137  prob->SetKaonPdf(0);
138  prob->SetProtonPdf(0);
139  return;
140  }
141  else
142  {
143  // FIXME: Don't write zeros to that pdf!
144  prob->SetElectronPdf(1);
145  prob->SetMuonPdf(0);
146  prob->SetPionPdf(1);
147  prob->SetKaonPdf(1);
148  prob->SetProtonPdf(1);
149  return;
150  }
151  } // enf of mom_mim < momentum < mom_max
152 
153 }
154 
155 //_________________________________________________________________
157  //---
158  FairRootManager::Instance()->
159  Register("PidAlgoMdtHardCuts"+fTrackBranchNamePidHypo,"Pid", fPidChargedProb, kTRUE);
160 }
161 
162 //_________________________________________________________________
164 }
165 
166 //_________________________________________________________________
168  //---
169 }
170 
171 
int fVerbose
Definition: poormantracks.C:24
TString fTrackBranchNamePidHypo
PndPidProbability TCA for charged particles.
Int_t i
Definition: run_full.C:25
void SetPionPdf(Double_t val)
Float_t GetMuoIron() const
void SetKaonPdf(Double_t val)
Float_t GetMuoMomentumIn() const
Int_t GetMuoIndex() const
void SetElectronPdf(Double_t val)
void SetMuonPdf(Double_t val)
h_MC_angle SetTitle("MC truth: opening angle of #pi^{0}")
Double_t
virtual void Exec(Option_t *option)
TString name
void SetProtonPdf(Double_t val)
void DoPidMatch(PndPidCandidate *pidcand, PndPidProbability *prob)
TClonesArray * fPidChargedProb
PndPidCandidate TCA for charged particles.
ClassImp(PndAnaContFact)
Int_t GetMuoModule() const
void SetIndex(Int_t idx)