]>
Commit | Line | Data |
---|---|---|
72c0a987 | 1 | //-*- Mode: C++ -*- |
2 | // $Id$ | |
3 | ||
4 | //* This file is property of and copyright by the ALICE Project * | |
5 | //* ALICE Experiment at CERN, All rights reserved. * | |
6 | //* See cxx source for full Copyright notice * | |
7 | ||
8 | /// @file AliDxHFEParticleSelection.h | |
9 | /// @author Sedat Altinpinar, Hege Erdal, Matthias Richter | |
10 | /// @date 2012-03-19 | |
11 | /// @brief Base class for particle selection | |
12 | /// | |
13 | ||
14 | #ifndef ALIDXHFEPARTICLESELECTION_H | |
15 | #define ALIDXHFEPARTICLESELECTION_H | |
16 | ||
93fcaf9f | 17 | #include "TNamed.h" |
72c0a987 | 18 | #include "TString.h" |
19 | class AliVEvent; | |
20 | class AliVParticle; | |
b86451e1 | 21 | class AliPIDResponse; |
72c0a987 | 22 | class TObjArray; |
93fcaf9f | 23 | class TH1; |
2229ac91 | 24 | class TH2; |
93fcaf9f | 25 | class THnSparse; |
72c0a987 | 26 | |
27 | /** | |
28 | * @class AliDxHFEParticleSelection | |
29 | * This is the base class for particle selections for the D0 - HFE | |
30 | * correlation studies. | |
31 | * | |
32 | * Ideas: | |
33 | * - configurable particle selection | |
34 | * - eventually histogramming of particle properties before vs. after | |
35 | * selection | |
36 | * | |
37 | * Might be that there is already something similar, then this class | |
38 | * can be merged with some other class. | |
39 | */ | |
93fcaf9f | 40 | class AliDxHFEParticleSelection : public TNamed { |
72c0a987 | 41 | public: |
42 | /// constructor | |
93fcaf9f | 43 | AliDxHFEParticleSelection(const char* name=NULL, const char* opt=""); |
72c0a987 | 44 | /// destructor |
45 | virtual ~AliDxHFEParticleSelection(); | |
46 | ||
9535cec9 | 47 | enum { |
48 | kEventsAll = 0, | |
49 | kEventsSel, | |
d731501a | 50 | kEventsWithParticle, |
9535cec9 | 51 | kNEventPropertyLabels |
52 | }; | |
d731501a | 53 | |
54 | enum { | |
55 | kTrackAll = 0, | |
56 | kTrackSel, | |
57 | kNTrackPropertyLabels | |
58 | }; | |
9535cec9 | 59 | |
72c0a987 | 60 | /// set options |
61 | void SetOption(const char* opt) { fOption = opt; } | |
62 | /// overloaded from TObject: get option | |
63 | virtual Option_t* GetOption() const { return fOption;} | |
64 | ||
93fcaf9f | 65 | /// init the control objects |
d731501a | 66 | virtual int Init(); |
93fcaf9f | 67 | virtual int InitControlObjects(); |
68 | ||
9535cec9 | 69 | /// create selection from 'Tracks' member of the event, |
70 | /// array contains only pointers but does not own the objects | |
72c0a987 | 71 | /// object array needs to be deleted by caller |
72 | virtual TObjArray* Select(const AliVEvent* pEvent); | |
9535cec9 | 73 | /// create selection from the array of particles, |
74 | /// array contains only pointers but does not own the objects | |
72c0a987 | 75 | /// object array needs to be deleted by caller |
9535cec9 | 76 | virtual TObjArray* Select(TObjArray* particles, const AliVEvent* pEvent); |
77 | ||
b86451e1 | 78 | virtual void SetPIDResponse(const AliPIDResponse* /*const pidresp*/){} |
79 | ||
9535cec9 | 80 | // Get the list fControlObjects. |
81 | const TList* GetControlObjects() const {return fControlObjects;} | |
82 | ||
83 | /// histogram event properties | |
84 | virtual int HistogramEventProperties(int bin); | |
72c0a987 | 85 | |
dcf83226 | 86 | virtual int FillParticleProperties(AliVParticle* p, Double_t* date, int dimension) const; |
dfe96b90 | 87 | virtual AliVParticle* CreateParticle(AliVParticle* track); |
d731501a | 88 | |
72c0a987 | 89 | /// check and add track to internal array |
90 | int CheckAndAdd(AliVParticle* p); | |
9535cec9 | 91 | |
92 | /// set cuts object: general TObject pointer is used as argument to support | |
93 | // different types; a type cast check is implemented in the method | |
94 | virtual void SetCuts(TObject* /*cuts*/, int /*level*/=0) {} | |
95 | ||
d731501a | 96 | // TODO: check whether that is needed, should be covered by the specific |
97 | // child implementation | |
9535cec9 | 98 | Bool_t GetUseMC() const {return fUseMC;} |
99 | ||
72c0a987 | 100 | /// get selected tracks |
101 | const TObjArray* GetSelected() const {return fSelectedTracks;} | |
102 | ||
103 | /// check particle if it passes the selection criteria | |
9535cec9 | 104 | virtual int IsSelected(AliVParticle* p, const AliVEvent *pEvent=NULL); |
72c0a987 | 105 | |
106 | /// inherited from TObject: cleanup | |
107 | virtual void Clear(Option_t * option =""); | |
108 | /// inherited from TObject: print info | |
109 | virtual void Print(Option_t *option="") const; | |
110 | /// inherited from TObject: safe selection criteria | |
9535cec9 | 111 | virtual void SaveAs(const char *filename="", Option_t *option="") const; |
93fcaf9f | 112 | /// inherited from TObject: draw content |
113 | virtual void Draw(Option_t *option=""); | |
114 | /// inherited from TObject: find object by name | |
115 | virtual TObject* FindObject(const char *name) const; | |
116 | /// inherited from TObject: find object by pointer | |
117 | virtual TObject* FindObject(const TObject *obj) const; | |
72c0a987 | 118 | |
9535cec9 | 119 | /// set verbosity |
120 | void SetVerbosity(int verbosity) {fVerbosity=verbosity;} | |
dcf83226 | 121 | |
9535cec9 | 122 | /// get verbosity |
dcf83226 | 123 | inline int GetVerbosity() const {return fVerbosity;} |
124 | ||
125 | /// get the dimension of THn, fixed | |
126 | inline int GetDimTHnSparse() const {return fDimThn;} | |
2229ac91 | 127 | |
128 | /// create 2D control histogram | |
129 | TH2* CreateControl2DHistogram(const char* name, | |
130 | const char* title, | |
131 | double* nBins, | |
132 | const char* xaxis, | |
133 | const char* yaxis) const; | |
134 | ||
135 | /// create control histogram | |
136 | TH1* CreateControlHistogram(const char* name, | |
137 | const char* title, | |
138 | int nBins, | |
b4779749 | 139 | double min, |
140 | double max, | |
141 | const char** binLabels=NULL) const; | |
142 | ||
143 | /// create control histogram | |
144 | TH1* CreateControlHistogram(const char* name, | |
145 | const char* title, | |
146 | int nBins, | |
147 | const char** binLabels=NULL) const { | |
148 | return CreateControlHistogram(name, title, nBins, -0.5, nBins-0.5, binLabels); | |
149 | } | |
d731501a | 150 | |
151 | /// create control THnSparse | |
152 | THnSparse* CreateControlTHnSparse(const char* name, | |
153 | int thnSize, | |
154 | int* thnBins, | |
155 | double* thnMin, | |
156 | double* thnMax, | |
157 | const char** binLabels) const; | |
158 | ||
dcf83226 | 159 | // define and create the THnSparse object |
160 | // initializes also the dimension to be used further | |
161 | virtual THnSparse* DefineTHnSparse(); | |
b4779749 | 162 | |
163 | Int_t GetSystem() const {return fSystem;} | |
9535cec9 | 164 | |
72c0a987 | 165 | protected: |
93fcaf9f | 166 | /// add control object to list, the base class becomes owner of the object |
167 | int AddControlObject(TObject* pObj); | |
168 | ||
169 | /// histogram particle properties | |
9535cec9 | 170 | virtual int HistogramParticleProperties(AliVParticle* p, int selected=1); |
171 | ||
dcf83226 | 172 | /// set the dimension of THn and allocate filling array |
173 | void InitTHnSparseArray(int dimension) { | |
174 | fDimThn=dimension; | |
175 | if (fParticleProperties) delete[] fParticleProperties; fParticleProperties=NULL; | |
176 | if (dimension>0) fParticleProperties=new Double_t[dimension]; | |
177 | } | |
178 | ||
179 | inline Double_t* ParticleProperties() const {return fParticleProperties;} | |
180 | ||
b4779749 | 181 | virtual int ParseArguments(const char* arguments); |
182 | ||
72c0a987 | 183 | private: |
184 | /// copy contructor prohibited | |
185 | AliDxHFEParticleSelection(const AliDxHFEParticleSelection&); | |
186 | /// assignment operator prohibited | |
187 | AliDxHFEParticleSelection& operator=(const AliDxHFEParticleSelection&); | |
188 | ||
189 | TString fOption; // option | |
190 | TObjArray* fSelectedTracks; //! array of selected tracks | |
191 | ||
93fcaf9f | 192 | // control histograms, note: only the list is saved, pointers only used for fast access |
193 | TList* fControlObjects; // list of control objects | |
194 | TH1* fhEventControl; //! event control histogram | |
195 | TH1* fhTrackControl; //! track control histogram | |
9535cec9 | 196 | bool fUseMC; // specific implementation for MC selection |
197 | int fVerbosity; //! verbosity | |
dcf83226 | 198 | int fDimThn; // dim of thnsparse |
199 | Double_t* fParticleProperties; //! filling array for THnSparse | |
b4779749 | 200 | Int_t fSystem; // whether running on pp(0,default), PbPb(1) or pPb(2, not used yet) |
9535cec9 | 201 | |
202 | static const char* fgkEventControlBinNames[]; //! bin labels for event control histogram | |
d731501a | 203 | static const char* fgkTrackControlBinNames[]; //! bin labels for track control histogram |
9535cec9 | 204 | |
b4779749 | 205 | ClassDef(AliDxHFEParticleSelection, 4); |
93fcaf9f | 206 | |
72c0a987 | 207 | }; |
208 | ||
209 | #endif |