Minors
authordibari <dibari@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 13 Dec 2007 18:47:47 +0000 (18:47 +0000)
committerdibari <dibari@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 13 Dec 2007 18:47:47 +0000 (18:47 +0000)
HMPID/AliHMPIDPid.cxx
HMPID/AliHMPIDPid.h
HMPID/AliHMPIDReconstructor.cxx

index 5740d4e..2d1edad 100644 (file)
@@ -33,24 +33,22 @@ AliHMPIDPid::AliHMPIDPid():TTask("HMPIDrec","HMPIDPid")
 //..
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void AliHMPIDPid::FindPid(AliESDtrack *pTrk,Double_t *prob)
+void AliHMPIDPid::FindPid(AliESDtrack *pTrk,Int_t nsp,Double_t *prob)
 {
 // Calculates probability to be a electron-muon-pion-kaon-proton
 // from the given Cerenkov angle and momentum assuming no initial particle composition
 // (i.e. apriory probability to be the particle of the given sort is the same for all sorts)
 
-  AliPID ppp; //needed
-  Double_t h[AliPID::kSPECIES];
-  
   if(pTrk->GetHMPIDsignal()<=0){//HMPID does not find anything reasonable for this track, assign 0.2 for all species
-    for(Int_t iPart=0;iPart<AliPID::kSPECIES;iPart++) prob[iPart]=1.0/AliPID::kSPECIES;
+    for(Int_t iPart=0;iPart<nsp;iPart++) prob[iPart]=1.0/(Float_t)nsp;
     return;
   } 
 
   Double_t pmod = pTrk->GetP();
   Double_t hTot=0;
+  Double_t *h = new Double_t [nsp];
 
-  for(Int_t iPart=0;iPart<AliPID::kSPECIES;iPart++){
+  for(Int_t iPart=0;iPart<nsp;iPart++){
     Double_t mass = AliPID::ParticleMass(iPart);
     Double_t cosThetaTh = TMath::Sqrt(mass*mass+pmod*pmod)/(AliHMPIDParam::Instance()->MeanIdxRad()*pmod);
     if(cosThetaTh<1) //calculate the height of theoretical theta ckov on the gaus of experimental one
@@ -62,9 +60,10 @@ void AliHMPIDPid::FindPid(AliESDtrack *pTrk,Double_t *prob)
 
   Double_t hMin=TMath::Gaus(pTrk->GetHMPIDsignal()-4*TMath::Sqrt(pTrk->GetHMPIDchi2()),pTrk->GetHMPIDsignal(),TMath::Sqrt(pTrk->GetHMPIDchi2()),kTRUE);//5 sigma protection
 
-  for(Int_t iPart=0;iPart<AliPID::kSPECIES;iPart++) {//species loop to assign probabilities
+  for(Int_t iPart=0;iPart<nsp;iPart++) {//species loop to assign probabilities
     if(hTot>hMin) prob[iPart]=h[iPart]/hTot;
-    else prob[iPart]=1.0/AliPID::kSPECIES;            //all theoretical values are far away from experemental one
+    else prob[iPart]=1.0/(Float_t)nsp;            //all theoretical values are far away from experemental one
   }
+  delete [] h;
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
index caea28f..7b48b59 100644 (file)
@@ -23,7 +23,7 @@ public :
              AliHMPIDPid();    //ctor
     virtual ~AliHMPIDPid() {;} //dtor
     
-    void FindPid(AliESDtrack *pESD,Double_t *prob);  //Find PID for tracks
+    void FindPid(AliESDtrack *pESD,Int_t nsp,Double_t *prob);  //Find PID for tracks
 
 //
 protected:
index fd9ae68..4264ec9 100644 (file)
@@ -198,13 +198,12 @@ void AliHMPIDReconstructor::FillESD(TTree */*digitsTree*/, TTree */*clustersTree
 // Probability vector from AliHMPIDPid
 //...
   AliHMPIDPid pID;
-  Double_t prob[5];
+  Double_t prob[AliPID::kSPECIES];
   
   for(Int_t iTrk=0;iTrk<pESD->GetNumberOfTracks();iTrk++){//ESD tracks loop
     AliESDtrack *pTrk = pESD->GetTrack(iTrk);// get next reconstructed track
-    pID.FindPid(pTrk,prob);
-    Printf("Theta Cherenkov %5.3f |  e %5.1f%% | u %5.1f%% | K %5.1f%% | pi %5.1f%% | p %5.1f%%",
-          pTrk->GetHMPIDsignal(),prob[0]*100,prob[1]*100,prob[2]*100,prob[3]*100,prob[4]*100);
+    pID.FindPid(pTrk,AliPID::kSPECIES,prob);
+    pTrk->SetHMPIDpid(prob);
   }//ESD tracks loop
   
 }//FillESD()