]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HMPID/AliHMPIDPid.cxx
For ITS upgrade MC
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDPid.cxx
index 27f274f0367897cb166620ec707e817059e009b4..4a6675054c8697a18750178f88893ed1cc4a6ee9 100644 (file)
 #include <TRandom.h>           //Resolution()
 
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-AliHMPIDPid::AliHMPIDPid():TTask("HMPIDrec","HMPIDPid")
+AliHMPIDPid::AliHMPIDPid():TNamed("HMPIDrec","HMPIDPid")
 {
 //..
 //init of data members
 //..
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void AliHMPIDPid::FindPid(AliESDtrack *pTrk,Int_t nsp,Double_t *prob)
+void AliHMPIDPid::FindPid(AliESDtrack *pTrk,Double_t nmean,Int_t nsp,Double_t *prob)
 {
 // Calculates probability to be a electron-muon-pion-kaon-proton with the "amplitude" method
 // 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 *pPid = new AliPID();
-  Double_t thetaCerExp = pTrk->GetHMPIDsignal();                                                                           //  measured thetaCherenkov
   
-  if(thetaCerExp<=0){                                         //HMPID does not find anything reasonable for this track, assign 0.2 for all species
+  Double_t thetaCerExp = -999.;                                                                           
+  if(pTrk->GetHMPIDsignal()<=0) thetaCerExp = pTrk->GetHMPIDsignal();                                                                           
+  else                          thetaCerExp = pTrk->GetHMPIDsignal() - (Int_t)pTrk->GetHMPIDsignal();     //  measured thetaCherenkov
+  
+  if(thetaCerExp<=0){                                                                                     //HMPID does not find anything reasonable for this track, assign 0.2 for all species
     for(Int_t iPart=0;iPart<nsp;iPart++) prob[iPart]=1.0/(Float_t)nsp;
     delete pPid ; pPid=0x0; return;
   } 
@@ -66,14 +69,14 @@ void AliHMPIDPid::FindPid(AliESDtrack *pTrk,Int_t nsp,Double_t *prob)
     
     h[iPart] = 0;                                                                                                            //  reset the height
     Double_t mass = pPid->ParticleMass(iPart);                                                                             //  with the given mass
-    Double_t cosThetaTh = TMath::Sqrt(mass*mass+pmod*pmod)/(AliHMPIDParam::Instance()->MeanIdxRad()*pmod);                   //  evaluate the theor. Theta Cherenkov
+    Double_t cosThetaTh = TMath::Sqrt(mass*mass+pmod*pmod)/(nmean*pmod);                   //  evaluate the theor. Theta Cherenkov
     if(cosThetaTh>1) continue;                                                                                               //  no light emitted, zero height
     Double_t thetaCerTh = TMath::ACos(cosThetaTh);                                                                           //  theoretical Theta Cherenkov
     Double_t sigmaRing = Resolution(thetaCerTh,pTrk);
     
     if(sigmaRing==0) {
       for(Int_t jPart=0;jPart<nsp;jPart++) prob[jPart]=1.0/(Float_t)nsp;
-      delete pPid ; pPid=0x0; return;
+      delete pPid ; pPid=0x0; delete [] h; return;
     } 
     
     if(TMath::Abs(thetaCerExp-thetaCerTh)<4*sigmaRing) desert = kFALSE;                                                                //   
@@ -98,9 +101,14 @@ Double_t AliHMPIDPid::Resolution(Double_t thetaCerTh, AliESDtrack *pTrk)
   AliHMPIDParam *pParam = AliHMPIDParam::Instance();
       
   AliHMPIDRecon rec;
-  Float_t xRa,yRa,thRa,phRa;
-  pTrk->GetHMPIDtrk(xRa,yRa,thRa,phRa);
+  Float_t xPc,yPc,thRa,phRa;
+  pTrk->GetHMPIDtrk(xPc,yPc,thRa,phRa);
+  
+  Double_t xRa = xPc - (pParam->RadThick()+pParam->WinThick()+pParam->GapThick())*TMath::Cos(phRa)*TMath::Tan(thRa); //just linear extrapolation back to RAD
+  Double_t yRa = yPc - (pParam->RadThick()+pParam->WinThick()+pParam->GapThick())*TMath::Sin(phRa)*TMath::Tan(thRa); //just linear extrapolation back to RAD
   rec.SetTrack(xRa,yRa,thRa,phRa);
+  
+  Double_t occupancy = pTrk->GetHMPIDoccupancy();
   Double_t thetaMax = TMath::ACos(1./pParam->MeanIdxRad());
   Int_t nPhots = (Int_t)(21.*TMath::Sin(thetaCerTh)*TMath::Sin(thetaCerTh)/(TMath::Sin(thetaMax)*TMath::Sin(thetaMax))+0.01);
 
@@ -122,5 +130,5 @@ Double_t AliHMPIDPid::Resolution(Double_t thetaCerTh, AliESDtrack *pTrk)
     }      
     if(invSigma!=0) sigmatot += 1./TMath::Sqrt(invSigma);  
   }
-  return sigmatot/nTrks;
+  return (sigmatot/nTrks)*pParam->SigmaCorrFact(occupancy);
 }