Incrementing class version.
[u/mrichter/AliRoot.git] / PWGHF / correlationHF / AliDxHFEParticleSelection.h
CommitLineData
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"
19class AliVEvent;
20class AliVParticle;
b86451e1 21class AliPIDResponse;
72c0a987 22class TObjArray;
93fcaf9f 23class TH1;
2229ac91 24class TH2;
93fcaf9f 25class 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 40class 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
fad30eb8 60 enum {
61 kHistoEvent=0,
62 kHistoNrTracksPrEvent
63 };
64
72c0a987 65 /// set options
66 void SetOption(const char* opt) { fOption = opt; }
67 /// overloaded from TObject: get option
68 virtual Option_t* GetOption() const { return fOption;}
69
93fcaf9f 70 /// init the control objects
d731501a 71 virtual int Init();
93fcaf9f 72 virtual int InitControlObjects();
73
9535cec9 74 /// create selection from 'Tracks' member of the event,
75 /// array contains only pointers but does not own the objects
72c0a987 76 /// object array needs to be deleted by caller
77 virtual TObjArray* Select(const AliVEvent* pEvent);
9535cec9 78 /// create selection from the array of particles,
79 /// array contains only pointers but does not own the objects
72c0a987 80 /// object array needs to be deleted by caller
9535cec9 81 virtual TObjArray* Select(TObjArray* particles, const AliVEvent* pEvent);
82
b86451e1 83 virtual void SetPIDResponse(const AliPIDResponse* /*const pidresp*/){}
84
9535cec9 85 // Get the list fControlObjects.
86 const TList* GetControlObjects() const {return fControlObjects;}
87
88 /// histogram event properties
fad30eb8 89 virtual int HistogramEventProperties(int histonr, int bin);
90 virtual int HistogramEventProperties(int bin){
91 return HistogramEventProperties(kHistoEvent,bin);
92 }
93
dcf83226 94 virtual int FillParticleProperties(AliVParticle* p, Double_t* date, int dimension) const;
dfe96b90 95 virtual AliVParticle* CreateParticle(AliVParticle* track);
d731501a 96
72c0a987 97 /// check and add track to internal array
98 int CheckAndAdd(AliVParticle* p);
9535cec9 99
100 /// set cuts object: general TObject pointer is used as argument to support
101 // different types; a type cast check is implemented in the method
102 virtual void SetCuts(TObject* /*cuts*/, int /*level*/=0) {}
103
d731501a 104 // TODO: check whether that is needed, should be covered by the specific
105 // child implementation
9535cec9 106 Bool_t GetUseMC() const {return fUseMC;}
107
72c0a987 108 /// get selected tracks
109 const TObjArray* GetSelected() const {return fSelectedTracks;}
110
111 /// check particle if it passes the selection criteria
9535cec9 112 virtual int IsSelected(AliVParticle* p, const AliVEvent *pEvent=NULL);
72c0a987 113
114 /// inherited from TObject: cleanup
115 virtual void Clear(Option_t * option ="");
116 /// inherited from TObject: print info
117 virtual void Print(Option_t *option="") const;
118 /// inherited from TObject: safe selection criteria
9535cec9 119 virtual void SaveAs(const char *filename="", Option_t *option="") const;
93fcaf9f 120 /// inherited from TObject: draw content
121 virtual void Draw(Option_t *option="");
122 /// inherited from TObject: find object by name
123 virtual TObject* FindObject(const char *name) const;
124 /// inherited from TObject: find object by pointer
125 virtual TObject* FindObject(const TObject *obj) const;
72c0a987 126
9535cec9 127 /// set verbosity
128 void SetVerbosity(int verbosity) {fVerbosity=verbosity;}
dcf83226 129
9535cec9 130 /// get verbosity
dcf83226 131 inline int GetVerbosity() const {return fVerbosity;}
132
133 /// get the dimension of THn, fixed
134 inline int GetDimTHnSparse() const {return fDimThn;}
2229ac91 135
136 /// create 2D control histogram
137 TH2* CreateControl2DHistogram(const char* name,
138 const char* title,
139 double* nBins,
140 const char* xaxis,
141 const char* yaxis) const;
142
143 /// create control histogram
144 TH1* CreateControlHistogram(const char* name,
145 const char* title,
146 int nBins,
b4779749 147 double min,
148 double max,
149 const char** binLabels=NULL) const;
150
151 /// create control histogram
152 TH1* CreateControlHistogram(const char* name,
153 const char* title,
154 int nBins,
155 const char** binLabels=NULL) const {
156 return CreateControlHistogram(name, title, nBins, -0.5, nBins-0.5, binLabels);
157 }
d731501a 158
159 /// create control THnSparse
160 THnSparse* CreateControlTHnSparse(const char* name,
161 int thnSize,
162 int* thnBins,
163 double* thnMin,
164 double* thnMax,
165 const char** binLabels) const;
166
dcf83226 167 // define and create the THnSparse object
168 // initializes also the dimension to be used further
169 virtual THnSparse* DefineTHnSparse();
b4779749 170
171 Int_t GetSystem() const {return fSystem;}
9535cec9 172
72c0a987 173 protected:
93fcaf9f 174 /// add control object to list, the base class becomes owner of the object
175 int AddControlObject(TObject* pObj);
176
177 /// histogram particle properties
9535cec9 178 virtual int HistogramParticleProperties(AliVParticle* p, int selected=1);
179
dcf83226 180 /// set the dimension of THn and allocate filling array
181 void InitTHnSparseArray(int dimension) {
182 fDimThn=dimension;
183 if (fParticleProperties) delete[] fParticleProperties; fParticleProperties=NULL;
184 if (dimension>0) fParticleProperties=new Double_t[dimension];
185 }
186
187 inline Double_t* ParticleProperties() const {return fParticleProperties;}
188
b4779749 189 virtual int ParseArguments(const char* arguments);
190
72c0a987 191 private:
192 /// copy contructor prohibited
193 AliDxHFEParticleSelection(const AliDxHFEParticleSelection&);
194 /// assignment operator prohibited
195 AliDxHFEParticleSelection& operator=(const AliDxHFEParticleSelection&);
196
197 TString fOption; // option
198 TObjArray* fSelectedTracks; //! array of selected tracks
199
93fcaf9f 200 // control histograms, note: only the list is saved, pointers only used for fast access
201 TList* fControlObjects; // list of control objects
202 TH1* fhEventControl; //! event control histogram
203 TH1* fhTrackControl; //! track control histogram
fad30eb8 204 TH1* fhNrTracksPerEvent; //! Control histo for nr particles pr event
9535cec9 205 bool fUseMC; // specific implementation for MC selection
206 int fVerbosity; //! verbosity
dcf83226 207 int fDimThn; // dim of thnsparse
208 Double_t* fParticleProperties; //! filling array for THnSparse
b4779749 209 Int_t fSystem; // whether running on pp(0,default), PbPb(1) or pPb(2, not used yet)
9535cec9 210
211 static const char* fgkEventControlBinNames[]; //! bin labels for event control histogram
d731501a 212 static const char* fgkTrackControlBinNames[]; //! bin labels for track control histogram
9535cec9 213
fad30eb8 214 ClassDef(AliDxHFEParticleSelection, 5);
93fcaf9f 215
72c0a987 216};
217
218#endif