- Reshuffling of the particle codes in AliPID. Now the light nuclei are between the
[u/mrichter/AliRoot.git] / CORRFW / AliCFTrackCutPid.h
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 // author : A. Mastroserio
18 //
19
20 #ifndef ALICFTRACKCUTPID_H
21 #define ALICFTRACKCUTPID_H
22
23 #include "AliCFCutBase.h"
24 #include "AliPID.h"
25 #include "AliESDtrack.h"
26 #include "AliAODTrack.h"
27 #include <TString.h>
28 #include <TObject.h>
29 #include <TH1F.h>
30 #include <TF1.h>
31 //__________________________________________________________________________________
32 // CUT ON TRACK PID
33 //__________________________________________________________________________________
34 class AliESDtrack;
35
36 class AliCFTrackCutPid : public AliCFCutBase
37 {
38   public :
39     AliCFTrackCutPid() ;
40   AliCFTrackCutPid(const Char_t* name, const Char_t* title) ;
41   AliCFTrackCutPid(const AliCFTrackCutPid& c) ;
42   AliCFTrackCutPid& operator=(const AliCFTrackCutPid& c) ;
43   
44   virtual ~AliCFTrackCutPid();
45   
46   enum EDetType {kITS = 0, kTPC, kTRD,  kTOF, kHMPID=4, kNoDet=-11};
47   enum EDetNum {kNdets=5};
48   enum ENoId {kCheckProb = -10, kCheckResp = -11, kDetRestr = -12};
49   
50   // Setters 
51   
52   void SetDetectors(TString dets);                            
53   void SetPriors(Double_t r[AliPID::kSPECIES]);                    
54   void SetProbabilityCut(Double_t cut) {fCut=cut;}                  
55   void SetParticleType(Int_t iType, Bool_t tocombine) {fgParticleType=iType; fgIsComb=tocombine;} 
56   void SetMinDiffResp(Bool_t check, Double_t mindiff) {fCheckResponse=check; fMinDiffResponse=mindiff;}  
57   void SetMinDiffProb(Bool_t check, Double_t mindiff) {fCheckSelection=check; fMinDiffProbability=mindiff;} 
58   void SetPriorFunctions(TF1 *func[AliPID::kSPECIES]);
59   void SetANDstatus(TString dets);
60   void SetDetectorProbabilityRestriction(TString det, Int_t iPart, Double_t upperprob); 
61   void SetHistogramAxis(Int_t nbins, Double_t xmin, Double_t xmax) {fNbins=nbins; fXmin = xmin; fXmax = xmax;}
62   void SetAODmode(Bool_t isaod = kFALSE) {fgIsAOD=isaod;}  
63   void SetProbThreshold(Double_t value) {fProbThreshold=value;}
64  
65   //returns the track identification number  
66   Int_t GetID(ULong_t status[kNdets+1], Double_t pid[kNdets+1][AliPID::kSPECIES]) const;  
67   //returns the track identification number in caso of an AliAODTrack
68   Int_t GetAODID(AliAODTrack *aodtrack) const;
69   
70  
71   //main 
72   virtual Bool_t IsSelected(TObject *track); 
73   Bool_t IsSelected(TList* /*list*/) {return kTRUE;}  
74   //histos are added to a list
75   void AddQAHistograms(TList *qalist);
76   
77   
78  private:
79
80   //loads the track detector responses and the track status
81   void TrackInfo(const AliESDtrack *pTrk,ULong_t status[kNdets+1], Double_t pid[kNdets+1][AliPID::kSPECIES]) const;
82
83   //identifies the track
84   Int_t Identify(Double_t pid[AliPID::kSPECIES]) const;
85
86   //identifies the track filling the QA histograms
87   Int_t IdentifyQA(const Double_t pid[AliPID::kSPECIES],Int_t idets) const;
88
89   void SetPPriors(AliESDtrack *pTrk);                          
90   ULong_t StatusForAND(ULong_t status[kNdets+1]) const; 
91   void InitialiseHisto();
92   void DefineHistograms();                                 // histo booking  
93   Bool_t Check(const Double_t *p, Int_t iPsel, Double_t minDiff) const;
94   void CombPID(ULong_t status[kNdets+1],Double_t pid[kNdets+1][AliPID::kSPECIES],Double_t *combpid) const;
95   
96   Double_t fCut;                                            // probability cut
97   Double_t fMinDiffResponse;                                // minimum difference between detector resposes
98   Double_t fMinDiffProbability;                             // minimum difference between probability values
99   Int_t fgParticleType;                                     // requested particle type
100   Bool_t fgIsComb;                                          // flag for the combined pid
101   Bool_t fgIsAOD;                                           // flag for AOD QA histograms
102   Bool_t fCheckResponse;                                    // flag to check the minimum difference of det responsess
103   Bool_t fCheckSelection;                                   // flag to check the minimum difference of probabilities
104   Bool_t fIsPpriors;                                        // flag for momentum dependent priors
105   Bool_t fIsDetAND;                                         // flag for AND with multiple detectors
106   Double_t fXmin;                                           // x min QA histo
107   Double_t fXmax;                                           // x max QA histo
108   Int_t fNbins;                                             // n bins QA histo 
109   Int_t fDetRestr;                                          // id of the detector for the restriction
110   Int_t fiPartRestr;                                        // id of the particle for the restriction
111   Double_t fDetProbRestr;                                   // probability restriction value
112   Double_t fProbThreshold;                                  // if different from 0, the assigned PID will be set to 
113                                                             // fgParticleType if the probability is larger than this threshold,
114                                                             // regardless it is the highest or not (!)
115
116   Double_t fPriors[AliPID::kSPECIES];                       // a priori concentrations
117   TF1 *fPriorsFunc[AliPID::kSPECIES];                       // momentum dependent priors
118   Bool_t fDets[kNdets];                                     // boolean(s) corresponding to the chosen detector(s) 
119   Bool_t fDetsInAnd[kNdets];                                // detector to be in AND for the combined PID
120   TH1F *fhResp[kNdets][AliPID::kSPECIES];                   // QA histo
121   TH1F *fhProb[kNdets][AliPID::kSPECIES];                   // QA histo
122   TH1F *fhCombResp[AliPID::kSPECIES];                       // QA histo
123   TH1F *fhCombProb[AliPID::kSPECIES];                       // QA histo
124   
125   ClassDef(AliCFTrackCutPid,1);
126 };
127 #endif
128