extended by cuts on min / max absolute and relative impact parameter
[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  
64   //returns the track identification number  
65   Int_t GetID(ULong_t status[kNdets+1], Double_t pid[kNdets+1][AliPID::kSPECIES]) const;  
66   //returns the track identification number in caso of an AliAODTrack
67   Int_t GetAODID(AliAODTrack *aodtrack) const;
68   
69  
70   //main 
71   virtual Bool_t IsSelected(TObject *track); 
72   Bool_t IsSelected(TList* /*list*/) {return kTRUE;}  
73   //histos are added to a list
74   void AddQAHistograms(TList *qalist);
75   
76   
77  private:
78
79   //loads the track detector responses and the track status
80   void TrackInfo(const AliESDtrack *pTrk,ULong_t status[kNdets+1], Double_t pid[kNdets+1][AliPID::kSPECIES]) const;
81
82   //identifies the track
83   Int_t Identify(Double_t pid[AliPID::kSPECIES]) const;
84
85   //identifies the track filling the QA histograms
86   Int_t IdentifyQA(const Double_t pid[AliPID::kSPECIES],Int_t idets) const;
87
88   void SetPPriors(AliESDtrack *pTrk);                          
89   ULong_t StatusForAND(ULong_t status[kNdets+1]) const; 
90   void InitialiseHisto();
91   void DefineHistograms();                                 // histo booking  
92   Bool_t Check(const Double_t *p, Int_t iPsel, Double_t minDiff) const;
93   void CombPID(ULong_t status[kNdets+1],Double_t pid[kNdets+1][AliPID::kSPECIES],Double_t *combpid) const;
94   
95   Double_t fCut;                                            // probability cut
96   Double_t fMinDiffResponse;                                // minimum difference between detector resposes
97   Double_t fMinDiffProbability;                             // minimum difference between probability values
98   Int_t fgParticleType;                                     // requested particle type
99   Bool_t fgIsComb;                                          // flag for the combined pid
100   Bool_t fgIsAOD;                                           // flag for AOD QA histograms
101   Bool_t fCheckResponse;                                    // flag to check the minimum difference of det responsess
102   Bool_t fCheckSelection;                                   // flag to check the minimum difference of probabilities
103   Bool_t fIsPpriors;                                        // flag for momentum dependent priors
104   Bool_t fIsDetAND;                                         // flag for AND with multiple detectors
105   Double_t fXmin;                                           // x min QA histo
106   Double_t fXmax;                                           // x max QA histo
107   Int_t fNbins;                                             // n bins QA histo 
108   Int_t fDetRestr;                                          // id of the detector for the restriction
109   Int_t fiPartRestr;                                        // id of the particle for the restriction
110   Double_t fDetProbRestr;                                   // probability restriction value
111
112   Double_t fPriors[AliPID::kSPECIES];                       // a priori concentrations
113   TF1 *fPriorsFunc[AliPID::kSPECIES];                       // momentum dependent priors
114   Bool_t fDets[kNdets];                                     // boolean(s) corresponding to the chosen detector(s) 
115   Bool_t fDetsInAnd[kNdets];                                // detector to be in AND for the combined PID
116   TH1F *fhResp[kNdets][AliPID::kSPECIES];                   // QA histo
117   TH1F *fhProb[kNdets][AliPID::kSPECIES];                   // QA histo
118   TH1F *fhCombResp[AliPID::kSPECIES];                       // QA histo
119   TH1F *fhCombProb[AliPID::kSPECIES];                       // QA histo
120   
121   ClassDef(AliCFTrackCutPid,1);
122 };
123 #endif
124