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 *
8 /// @file AliDxHFEParticleSelection.h
9 /// @author Sedat Altinpinar, Hege Erdal, Matthias Richter
11 /// @brief Base class for particle selection
14 #ifndef ALIDXHFEPARTICLESELECTION_H
15 #define ALIDXHFEPARTICLESELECTION_H
28 * @class AliDxHFEParticleSelection
29 * This is the base class for particle selections for the D0 - HFE
30 * correlation studies.
33 * - configurable particle selection
34 * - eventually histogramming of particle properties before vs. after
37 * Might be that there is already something similar, then this class
38 * can be merged with some other class.
40 class AliDxHFEParticleSelection : public TNamed {
43 AliDxHFEParticleSelection(const char* name=NULL, const char* opt="");
45 virtual ~AliDxHFEParticleSelection();
66 void SetOption(const char* opt) { fOption = opt; }
67 /// overloaded from TObject: get option
68 virtual Option_t* GetOption() const { return fOption;}
70 /// init the control objects
72 virtual int InitControlObjects();
74 /// create selection from 'Tracks' member of the event,
75 /// array contains only pointers but does not own the objects
76 /// object array needs to be deleted by caller
77 virtual TObjArray* Select(const AliVEvent* pEvent);
78 /// create selection from the array of particles,
79 /// array contains only pointers but does not own the objects
80 /// object array needs to be deleted by caller
81 virtual TObjArray* Select(TObjArray* particles, const AliVEvent* pEvent);
83 virtual void SetPIDResponse(const AliPIDResponse* /*const pidresp*/){}
85 // Get the list fControlObjects.
86 const TList* GetControlObjects() const {return fControlObjects;}
88 /// histogram event properties
89 virtual int HistogramEventProperties(int histonr, int bin);
90 virtual int HistogramEventProperties(int bin){
91 return HistogramEventProperties(kHistoEvent,bin);
94 virtual int FillParticleProperties(AliVParticle* p, Double_t* date, int dimension) const;
95 virtual AliVParticle* CreateParticle(AliVParticle* track);
97 /// check and add track to internal array
98 int CheckAndAdd(AliVParticle* p);
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) {}
104 // TODO: check whether that is needed, should be covered by the specific
105 // child implementation
106 Bool_t GetUseMC() const {return fUseMC;}
108 /// get selected tracks
109 const TObjArray* GetSelected() const {return fSelectedTracks;}
111 /// check particle if it passes the selection criteria
112 virtual int IsSelected(AliVParticle* p, const AliVEvent *pEvent=NULL);
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
119 virtual void SaveAs(const char *filename="", Option_t *option="") const;
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;
128 void SetVerbosity(int verbosity) {fVerbosity=verbosity;}
131 inline int GetVerbosity() const {return fVerbosity;}
133 /// get the dimension of THn, fixed
134 inline int GetDimTHnSparse() const {return fDimThn;}
136 /// create 2D control histogram
137 TH2* CreateControl2DHistogram(const char* name,
141 const char* yaxis) const;
143 /// create control histogram
144 TH1* CreateControlHistogram(const char* name,
149 const char** binLabels=NULL) const;
151 /// create control histogram
152 TH1* CreateControlHistogram(const char* name,
155 const char** binLabels=NULL) const {
156 return CreateControlHistogram(name, title, nBins, -0.5, nBins-0.5, binLabels);
159 /// create control THnSparse
160 THnSparse* CreateControlTHnSparse(const char* name,
165 const char** binLabels) const;
167 // define and create the THnSparse object
168 // initializes also the dimension to be used further
169 virtual THnSparse* DefineTHnSparse();
171 Int_t GetSystem() const {return fSystem;}
174 /// add control object to list, the base class becomes owner of the object
175 int AddControlObject(TObject* pObj);
177 /// histogram particle properties
178 virtual int HistogramParticleProperties(AliVParticle* p, int selected=1);
180 /// set the dimension of THn and allocate filling array
181 void InitTHnSparseArray(int dimension) {
183 if (fParticleProperties) delete[] fParticleProperties; fParticleProperties=NULL;
184 if (dimension>0) fParticleProperties=new Double_t[dimension];
187 inline Double_t* ParticleProperties() const {return fParticleProperties;}
189 virtual int ParseArguments(const char* arguments);
192 /// copy contructor prohibited
193 AliDxHFEParticleSelection(const AliDxHFEParticleSelection&);
194 /// assignment operator prohibited
195 AliDxHFEParticleSelection& operator=(const AliDxHFEParticleSelection&);
197 TString fOption; // option
198 TObjArray* fSelectedTracks; //! array of selected tracks
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
204 TH1* fhNrTracksPerEvent; //! Control histo for nr particles pr event
205 bool fUseMC; // specific implementation for MC selection
206 int fVerbosity; //! verbosity
207 int fDimThn; // dim of thnsparse
208 Double_t* fParticleProperties; //! filling array for THnSparse
209 Int_t fSystem; // whether running on pp(0,default), PbPb(1) or pPb(2, not used yet)
211 static const char* fgkEventControlBinNames[]; //! bin labels for event control histogram
212 static const char* fgkTrackControlBinNames[]; //! bin labels for track control histogram
214 ClassDef(AliDxHFEParticleSelection, 5);