1 #include "HighlandAnalysisUtils.hxx" 5 const unsigned int NMAXPARTICLESWITHTPC = NMAXPARTICLES;
25 UInt_t itrk = track.
Index;
27 if( itrk >= NMAXPARTICLESWITHTPC )
return;
29 Double_t prob[5]={1,1,1,1,1};
30 Double_t tmp_prob[3][5];
31 Double_t total_prob=0;
35 for(
int i = 0; i < 3; ++i){
36 segmentsInTPC[i] = NULL;
37 for (Int_t j=0;j<5;j++){
48 if (!TPCSegment)
continue;
52 if(!prod5Cut)
if (!cutUtils::TPCTrackQualityCut(*TPCSegment))
continue;
56 if( TPCSegment->
dEdxMeas ==-0xABCDEF )
continue;
58 if( TPCSegment->
dEdxMeas ==-99999 )
continue;
68 Float_t pullmu = pulls[0];
69 Float_t pullele = pulls[1];
70 Float_t pullp = pulls[2];
71 Float_t pullpi = pulls[3];
72 Float_t pullka = pulls[4];
74 if (!TMath::Finite(pullmu) || !TMath::Finite(pullele) || !TMath::Finite(pullp) || !TMath::Finite(pullpi) || !TMath::Finite(pullka))
continue;
75 if (pullmu != pullmu || pullele != pullele || pullp != pullp || pullpi != pullpi || pullka != pullka)
continue;
80 if (segmentsInTPC[det-2]){
82 segmentsInTPC[det-2] = TPCSegment;
83 tmp_prob[det-2][0] = exp(-(pullmu*pullmu)/2);
84 tmp_prob[det-2][1] = exp(-(pullele*pullele)/2);
85 tmp_prob[det-2][2] = exp(-(pullp*pullp)/2);
86 tmp_prob[det-2][3] = exp(-(pullpi*pullpi)/2);
87 tmp_prob[det-2][4] = exp(-(pullka*pullka)/2);
91 segmentsInTPC[det-2] = TPCSegment;
92 tmp_prob[det-2][0] = exp(-(pullmu*pullmu)/2);
93 tmp_prob[det-2][1] = exp(-(pullele*pullele)/2);
94 tmp_prob[det-2][2] = exp(-(pullp*pullp)/2);
95 tmp_prob[det-2][3] = exp(-(pullpi*pullpi)/2);
96 tmp_prob[det-2][4] = exp(-(pullka*pullka)/2);
101 for (
int tpc=0;tpc<3;tpc++){
102 if (segmentsInTPC[tpc]){
104 prob[0] *= tmp_prob[tpc][0];
105 prob[1] *= tmp_prob[tpc][1];
106 prob[2] *= tmp_prob[tpc][2];
107 prob[3] *= tmp_prob[tpc][3];
108 prob[4] *= tmp_prob[tpc][4];
116 for (
int h=0;h<5;h++){
117 total_prob += prob[h];
121 for (
int h=0;h<5;h++){
122 hypo[h] = prob[h]/total_prob;
133 if( hypo >= 5 )
return -1.e+6;
135 Float_t Likelihood[5];
137 return Likelihood[hypo];
Float_t dEdxexpMuon
Expected dE/dx for a muon, based on the reconstructed momentum.
Float_t dEdxexpProton
Expected dE/dx for a proton, based on the reconstructed momentum.
void ComputeTPCPullIncludingKaon(const AnaTPCParticleB &track, Float_t *pulls)
Function to recompute the pull for a TPC track segment including the kaon hypothesis.
Int_t NNodes
The number of nodes in the reconstructed object.
SubDetId::SubDetEnum GetClosestTPC(const AnaTrackB &track)
For tracks that start in the FGD, get the closest TPC in the direction of the track.
AnaTPCParticleB * TPCSegments[NMAXTPCS]
The TPC segments that contributed to this global track.
static bool GetDetectorUsed(unsigned long BitField, SubDetId::SubDetEnum det)
Method to see if a certain subdetector or subdetector system is used.
Float_t GetPIDLikelihoodIncludingKaon(const AnaTrackB &track, Int_t hypo, bool prod5Cut=0)
Float_t dEdxexpPion
Expected dE/dx for a pion, based on the reconstructed momentum.
Float_t dEdxexpEle
Expected dE/dx for an electron, based on the reconstructed momentum.
Int_t Index
The index of this particle track in the vector of particles. TODO: Not sure it is needed (only use in...
int nTPCSegments
How many TPC tracks are associated with this track.
Float_t dEdxSigmaKaon
Expected error on the dE/dx measurement, for the proton hypothesis.
SubDetEnum
Enumeration of all detector systems and subdetectors.
Float_t dEdxMeas
dE/dx as measured by the TPC.
Representation of a global track.
Float_t ComputeTPCPull(const AnaTPCParticleB &track, const std::string &particle)
Function to recompute the pull for a TPC track segment.
static SubDetId::SubDetEnum GetSubdetectorEnum(unsigned long BitField)
Get the single subdetector that this track is from.
Representation of a TPC segment of a global track.
Representation of a TPC segment of a global track.
Float_t dEdxexpKaon
Expected dE/dx for a proton, based on the reconstructed momentum.