FairRoot/PandaRoot
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
PndPidFtofAssociatorTask Class Reference

#include <PndPidFtofAssociatorTask.h>

Inheritance diagram for PndPidFtofAssociatorTask:

Public Member Functions

virtual void Exec (Option_t *option)
 
virtual InitStatus Init ()
 
void Register ()
 
void Reset ()
 
 PndPidFtofAssociatorTask (const char *name, const char *title="Pnd Task")
 
 PndPidFtofAssociatorTask ()
 
virtual ~PndPidFtofAssociatorTask ()
 
void SetVerbose (Bool_t verb)
 
virtual void SetParContainers ()
 
virtual void Finish ()
 
void SetOutputBranch (TString branch)
 

Protected Member Functions

void DoPidMatch (PndPidCandidate *pidcand, PndPidProbability *prob)
 
Double_t GetPdf (Double_t mass2, Double_t mom, Double_t mass, Double_t sigma)
 

Protected Attributes

TClonesArray * fPidChargedCand
 
TClonesArray * fPidChargedProb
 PndPidCandidate TCA for charged particles. More...
 
TString fTrackBranchNamePidHypo
 PndPidProbability TCA for charged particles. More...
 

Private Attributes

PndPidCorrParfCorrPar
 

Detailed Description

Definition at line 11 of file PndPidFtofAssociatorTask.h.

Constructor & Destructor Documentation

PndPidFtofAssociatorTask::PndPidFtofAssociatorTask ( const char *  name,
const char *  title = "Pnd Task" 
)

Definition at line 29 of file PndPidFtofAssociatorTask.cxx.

References fPidChargedProb, fTrackBranchNamePidHypo, and SetTitle().

29  :FairTask(name), fCorrPar()
30 {
31  //---
32  fPidChargedProb = new TClonesArray("PndPidProbability");
34  SetTitle(title);
35 }
TString fTrackBranchNamePidHypo
PndPidProbability TCA for charged particles.
h_MC_angle SetTitle("MC truth: opening angle of #pi^{0}")
TString name
TClonesArray * fPidChargedProb
PndPidCandidate TCA for charged particles.
PndPidFtofAssociatorTask::PndPidFtofAssociatorTask ( )

Definition at line 22 of file PndPidFtofAssociatorTask.cxx.

References fPidChargedProb, and fTrackBranchNamePidHypo.

22  : fCorrPar() {
23  //---
24  fPidChargedProb = new TClonesArray("PndPidProbability");
26 }
TString fTrackBranchNamePidHypo
PndPidProbability TCA for charged particles.
TClonesArray * fPidChargedProb
PndPidCandidate TCA for charged particles.
PndPidFtofAssociatorTask::~PndPidFtofAssociatorTask ( )
virtual

Definition at line 15 of file PndPidFtofAssociatorTask.cxx.

15  {
16  //
17  FairRootManager *fManager =FairRootManager::Instance();
18  fManager->Write();
19 }

Member Function Documentation

void PndPidFtofAssociatorTask::DoPidMatch ( PndPidCandidate pidcand,
PndPidProbability prob 
)
protected

Definition at line 90 of file PndPidFtofAssociatorTask.cxx.

References Double_t, exp(), PndPidCandidate::GetMomentum(), GetPdf(), PndPidCandidate::GetTofM2(), mom, PndPidProbability::SetElectronPdf(), PndPidProbability::SetKaonPdf(), PndPidProbability::SetMuonPdf(), PndPidProbability::SetPionPdf(), PndPidProbability::SetProtonPdf(), sigma, and CAMath::Sqrt().

Referenced by Exec().

91 {
92 
93  Double_t mom = pidcand->GetMomentum().Mag();
94 
95  // electron
96  {
97  Double_t mass = 0.0005;
98  Double_t center = mom / TMath::Sqrt(mom*mom + mass*mass);
99  if (mom > 1) center = center - 0.; //electron OK
100  Double_t sigma = 0.004;
101  prob->SetElectronPdf(GetPdf(pidcand->GetTofM2(),pidcand->GetMomentum().Mag(),center, sigma));
102  }
103 
104  // muon
105  {
106  Double_t mass = 0.106;
107  Double_t center = mom / TMath::Sqrt(mom*mom + mass*mass);
108  if (mom > 1) center = center - 0.1 + 0.1*mom; //tracking bug, later remove
109  Double_t sigma = 0.004 + 0.64*exp(-mom/0.11);
110  prob->SetMuonPdf(GetPdf(pidcand->GetTofM2(),pidcand->GetMomentum().Mag(),center, sigma));
111  }
112 
113  // pion
114  {
115  Double_t mass = 0.140;
116  Double_t center = mom / TMath::Sqrt(mom*mom + mass*mass);
117  if (mom > 1) center = center - 0.1 + 0.1*mom; //tracking bug, later remove
118  Double_t sigma = 0.004 + 0.64*exp(-mom/0.11);
119  prob->SetPionPdf(GetPdf(pidcand->GetTofM2(),pidcand->GetMomentum().Mag(),center, sigma));
120  }
121 
122  // kaon
123  {
124  Double_t mass = 0.494;
125  Double_t center = mom / TMath::Sqrt(mom*mom + mass*mass);
126  if (mom > 1) center = center - 0.39 + 0.37*mom; //tracking bug, later remove
127  Double_t sigma = 0.004 + 0.62*exp(-mom/0.21);
128  prob->SetKaonPdf(GetPdf(pidcand->GetTofM2(),pidcand->GetMomentum().Mag(),center, sigma));
129  }
130 
131  // proton
132  {
133  Double_t mass = 0.938;
134  Double_t center = mom / TMath::Sqrt(mom*mom + mass*mass);
135  if (mom > 1) center = center - 0.12 + 0.12*mom; //tracking bug, later remove
136  Double_t sigma = 0.004 + 0.5*exp(-mom/0.13);
137  prob->SetProtonPdf(GetPdf(pidcand->GetTofM2(),pidcand->GetMomentum().Mag(),center, sigma));
138  }
139 }
friend F32vec4 exp(const F32vec4 &a)
Definition: P4_F32vec4.h:109
void SetPionPdf(Double_t val)
static T Sqrt(const T &x)
Definition: PndCAMath.h:37
void SetKaonPdf(Double_t val)
Double_t sigma[nsteps]
Definition: dedx_bands.C:65
Double_t mom
Definition: plot_dirc.C:14
void SetElectronPdf(Double_t val)
void SetMuonPdf(Double_t val)
Double_t
void SetProtonPdf(Double_t val)
Double_t GetPdf(Double_t mass2, Double_t mom, Double_t mass, Double_t sigma)
TVector3 GetMomentum() const
Float_t GetTofM2() const
void PndPidFtofAssociatorTask::Exec ( Option_t *  option)
virtual

Definition at line 72 of file PndPidFtofAssociatorTask.cxx.

References DoPidMatch(), fCorrPar, fPidChargedCand, fPidChargedProb, fVerbose, PndPidCandidate::GetLastHit(), PndPidCandidate::GetTofIndex(), PndPidCorrPar::GetZLastPlane(), i, and PndPidProbability::SetIndex().

72  {
73  if (fPidChargedProb->GetEntriesFast() != 0) fPidChargedProb->Clear();
74  if(fVerbose>1) std::cout << "-I- Start PndPidFtofAssociatorTask. "<<std::endl;
75 
76  // Get the Candidates
77  for(Int_t i=0; i<fPidChargedCand->GetEntriesFast(); i++)
78  {
80  TClonesArray& pidRef = *fPidChargedProb;
81  PndPidProbability* prob = new(pidRef[i]) PndPidProbability();// initializes with zeros
82  prob->SetIndex(i);
83  if (pidcand->GetTofIndex()==-1) continue;
84  if (pidcand->GetLastHit().Z() < fCorrPar->GetZLastPlane()) continue; // runs ftof pid only for forward tracks
85  DoPidMatch(pidcand,prob);
86  }
87 
88 }
int fVerbose
Definition: poormantracks.C:24
Int_t i
Definition: run_full.C:25
Int_t GetTofIndex() const
void DoPidMatch(PndPidCandidate *pidcand, PndPidProbability *prob)
TVector3 GetLastHit() const
TClonesArray * fPidChargedProb
PndPidCandidate TCA for charged particles.
void SetIndex(Int_t idx)
Float_t GetZLastPlane()
Definition: PndPidCorrPar.h:22
void PndPidFtofAssociatorTask::Finish ( )
virtual

Definition at line 170 of file PndPidFtofAssociatorTask.cxx.

170  {
171 }
Double_t PndPidFtofAssociatorTask::GetPdf ( Double_t  mass2,
Double_t  mom,
Double_t  mass,
Double_t  sigma 
)
protected

Definition at line 141 of file PndPidFtofAssociatorTask.cxx.

References Double_t, CAMath::Sqrt(), and val.

Referenced by DoPidMatch().

142 {
143 
144  Double_t beta_c = mom / TMath::Sqrt(mom*mom + mass2);
145  if (beta_c>0.)
146  {
147  TF1 *gausPdf = new TF1("gausPdf","gausn",0,1);
148  gausPdf->SetParameter(0,1);
149  gausPdf->SetParameter(1,center);
150  gausPdf->SetParameter(2,sigma);
151  Double_t val = gausPdf->Eval(beta_c);
152  delete gausPdf;
153  return val;
154  }
155  else
156  {
157  // FIXME: Don't write zeros to that pdf!
158  return 0.;
159  }
160 }
Double_t val[nBoxes][nFEBox]
Definition: createCalib.C:11
static T Sqrt(const T &x)
Definition: PndCAMath.h:37
Double_t sigma[nsteps]
Definition: dedx_bands.C:65
Double_t mom
Definition: plot_dirc.C:14
Double_t
InitStatus PndPidFtofAssociatorTask::Init ( )
virtual

Definition at line 38 of file PndPidFtofAssociatorTask.cxx.

References fPidChargedCand, fTrackBranchNamePidHypo, and Register().

38  {
39 
40  std::cout << "InitStatus PndPidFtofAssociatorTask::Init()" << std::endl;
41 
42  FairRootManager *fManager =FairRootManager::Instance();
43 
44  fPidChargedCand = (TClonesArray *)fManager->GetObject("PidChargedCand"+fTrackBranchNamePidHypo);
45  if ( ! fPidChargedCand) {
46  std::cout << "-I- PndPidFtofAssociatorTask::Init: No PndPidCandidate array PidChargedCand there!" << std::endl;
47  return kERROR;
48  }
49 
50  Register();
51 
52  std::cout << "-I- PndPidFtofAssociatorTask::Init: Success!" << std::endl;
53 
54  return kSUCCESS;
55 }
TString fTrackBranchNamePidHypo
PndPidProbability TCA for charged particles.
void PndPidFtofAssociatorTask::Register ( )

Definition at line 163 of file PndPidFtofAssociatorTask.cxx.

References fPidChargedProb, and fTrackBranchNamePidHypo.

Referenced by Init().

163  {
164  //---
165  FairRootManager::Instance()->
166  Register("PidAlgoFtof"+fTrackBranchNamePidHypo,"Pid", fPidChargedProb, kTRUE);
167 }
TString fTrackBranchNamePidHypo
PndPidProbability TCA for charged particles.
TClonesArray * fPidChargedProb
PndPidCandidate TCA for charged particles.
void PndPidFtofAssociatorTask::Reset ( )

Definition at line 174 of file PndPidFtofAssociatorTask.cxx.

174  {
175  //---
176 }
void PndPidFtofAssociatorTask::SetOutputBranch ( TString  branch)
inline

Definition at line 42 of file PndPidFtofAssociatorTask.h.

Referenced by PndMasterMultiPidTask::PndMasterMultiPidTask().

42 { fTrackBranchNamePidHypo = branch; };
TString fTrackBranchNamePidHypo
PndPidProbability TCA for charged particles.
void PndPidFtofAssociatorTask::SetParContainers ( )
virtual

Get parameter containers

Definition at line 58 of file PndPidFtofAssociatorTask.cxx.

References fCorrPar, and run.

58  {
59  //--
60  // Get run and runtime database
61  FairRun* run = FairRun::Instance();
62  if ( ! run ) Fatal("PndPidFtofAssociatorTask:: SetParContainers", "No analysis run");
63 
64  FairRuntimeDb* db = run->GetRuntimeDb();
65  if ( ! db ) Fatal("PndPidFtofAssociatorTask:: SetParContainers", "No runtime database");
66 
67  // Get PID Correlation parameter container
68  fCorrPar = (PndPidCorrPar*) db->getContainer("PndPidCorrPar");
69 
70 }
Int_t run
Definition: autocutx.C:47
void PndPidFtofAssociatorTask::SetVerbose ( Bool_t  verb)
inline

Definition at line 36 of file PndPidFtofAssociatorTask.h.

References fVerbose.

36 { fVerbose = verb ;};
int fVerbose
Definition: poormantracks.C:24

Member Data Documentation

PndPidCorrPar* PndPidFtofAssociatorTask::fCorrPar
private

Definition at line 42 of file PndPidFtofAssociatorTask.h.

Referenced by Exec(), and SetParContainers().

TClonesArray* PndPidFtofAssociatorTask::fPidChargedCand
protected

Definition at line 15 of file PndPidFtofAssociatorTask.h.

Referenced by Exec(), and Init().

TClonesArray* PndPidFtofAssociatorTask::fPidChargedProb
protected

PndPidCandidate TCA for charged particles.

Definition at line 16 of file PndPidFtofAssociatorTask.h.

Referenced by Exec(), PndPidFtofAssociatorTask(), and Register().

TString PndPidFtofAssociatorTask::fTrackBranchNamePidHypo
protected

PndPidProbability TCA for charged particles.

Definition at line 18 of file PndPidFtofAssociatorTask.h.

Referenced by Init(), PndPidFtofAssociatorTask(), and Register().


The documentation for this class was generated from the following files: