]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HMPID/AliHMPIDPid.cxx
Using AliPHOSLoader instead of AliPHOSGetter
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDPid.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 //////////////////////////////////////////////////////////////////////////
17 //                                                                      //
18 // AliHMPIDPid                                                          //
19 //                                                                      //
20 // HMPID class to perfom particle identification                        //
21 //                                                                      //
22 //////////////////////////////////////////////////////////////////////////
23
24 #include "AliHMPIDPid.h"       //class header
25 #include "AliHMPIDParam.h"     //class header
26 #include <AliESDtrack.h>       //FindPid()
27
28 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
29 AliHMPIDPid::AliHMPIDPid():TTask("HMPIDrec","HMPIDPid")
30 {
31 //..
32 //init of data members
33 //..
34 }
35 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
36 void AliHMPIDPid::FindPid(AliESDtrack *pTrk,Int_t nsp,Double_t *prob)
37 {
38 // Calculates probability to be a electron-muon-pion-kaon-proton
39 // from the given Cerenkov angle and momentum assuming no initial particle composition
40 // (i.e. apriory probability to be the particle of the given sort is the same for all sorts)
41
42   if(pTrk->GetHMPIDsignal()<=0){//HMPID does not find anything reasonable for this track, assign 0.2 for all species
43     for(Int_t iPart=0;iPart<nsp;iPart++) prob[iPart]=1.0/(Float_t)nsp;
44     return;
45   } 
46
47   Double_t pmod = pTrk->GetP();
48   Double_t hTot=0;
49   Double_t *h = new Double_t [nsp];
50
51   for(Int_t iPart=0;iPart<nsp;iPart++){
52     Double_t mass = AliPID::ParticleMass(iPart);
53     Double_t cosThetaTh = TMath::Sqrt(mass*mass+pmod*pmod)/(AliHMPIDParam::Instance()->MeanIdxRad()*pmod);
54     if(cosThetaTh<1) //calculate the height of theoretical theta ckov on the gaus of experimental one
55       h[iPart] =TMath::Gaus(TMath::ACos(cosThetaTh),pTrk->GetHMPIDsignal(),TMath::Sqrt(pTrk->GetHMPIDchi2()),kTRUE);      
56     else             //beta < 1/ref. idx. => no light at all  
57       h[iPart] =0 ;       
58     hTot    +=h[iPart]; //total height of all theoretical heights for normalization
59   }//species loop
60
61   Double_t hMin=TMath::Gaus(pTrk->GetHMPIDsignal()-4*TMath::Sqrt(pTrk->GetHMPIDchi2()),pTrk->GetHMPIDsignal(),TMath::Sqrt(pTrk->GetHMPIDchi2()),kTRUE);//5 sigma protection
62
63   for(Int_t iPart=0;iPart<nsp;iPart++) {//species loop to assign probabilities
64     if(hTot>hMin) prob[iPart]=h[iPart]/hTot;
65     else prob[iPart]=1.0/(Float_t)nsp;            //all theoretical values are far away from experemental one
66   }
67   delete [] h;
68 }
69 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++