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
26 * @class AliDxHFEParticleSelection
27 * This is the base class for particle selections for the D0 - HFE
28 * correlation studies.
31 * - configurable particle selection
32 * - eventually histogramming of particle properties before vs. after
35 * Might be that there is already something similar, then this class
36 * can be merged with some other class.
38 class AliDxHFEParticleSelection : public TNamed {
41 AliDxHFEParticleSelection(const char* name=NULL, const char* opt="");
43 virtual ~AliDxHFEParticleSelection();
59 void SetOption(const char* opt) { fOption = opt; }
60 /// overloaded from TObject: get option
61 virtual Option_t* GetOption() const { return fOption;}
63 /// init the control objects
65 virtual int InitControlObjects();
67 /// create selection from 'Tracks' member of the event,
68 /// array contains only pointers but does not own the objects
69 /// object array needs to be deleted by caller
70 virtual TObjArray* Select(const AliVEvent* pEvent);
71 /// create selection from the array of particles,
72 /// array contains only pointers but does not own the objects
73 /// object array needs to be deleted by caller
74 virtual TObjArray* Select(TObjArray* particles, const AliVEvent* pEvent);
76 // Get the list fControlObjects.
77 const TList* GetControlObjects() const {return fControlObjects;}
79 /// histogram event properties
80 virtual int HistogramEventProperties(int bin);
82 virtual int FillParticleProperties(AliVParticle* p, Double_t* date, int dimension) const;
83 virtual AliVParticle* CreateParticle(AliVParticle* track);
85 /// check and add track to internal array
86 int CheckAndAdd(AliVParticle* p);
88 /// set cuts object: general TObject pointer is used as argument to support
89 // different types; a type cast check is implemented in the method
90 virtual void SetCuts(TObject* /*cuts*/, int /*level*/=0) {}
92 // TODO: check whether that is needed, should be covered by the specific
93 // child implementation
94 Bool_t GetUseMC() const {return fUseMC;}
96 /// get selected tracks
97 const TObjArray* GetSelected() const {return fSelectedTracks;}
99 /// check particle if it passes the selection criteria
100 virtual int IsSelected(AliVParticle* p, const AliVEvent *pEvent=NULL);
102 /// inherited from TObject: cleanup
103 virtual void Clear(Option_t * option ="");
104 /// inherited from TObject: print info
105 virtual void Print(Option_t *option="") const;
106 /// inherited from TObject: safe selection criteria
107 virtual void SaveAs(const char *filename="", Option_t *option="") const;
108 /// inherited from TObject: draw content
109 virtual void Draw(Option_t *option="");
110 /// inherited from TObject: find object by name
111 virtual TObject* FindObject(const char *name) const;
112 /// inherited from TObject: find object by pointer
113 virtual TObject* FindObject(const TObject *obj) const;
116 void SetVerbosity(int verbosity) {fVerbosity=verbosity;}
119 inline int GetVerbosity() const {return fVerbosity;}
121 /// get the dimension of THn, fixed
122 inline int GetDimTHnSparse() const {return fDimThn;}
124 /// create control THnSparse
125 THnSparse* CreateControlTHnSparse(const char* name,
130 const char** binLabels) const;
132 // define and create the THnSparse object
133 // initializes also the dimension to be used further
134 virtual THnSparse* DefineTHnSparse();
137 /// add control object to list, the base class becomes owner of the object
138 int AddControlObject(TObject* pObj);
140 /// histogram particle properties
141 virtual int HistogramParticleProperties(AliVParticle* p, int selected=1);
143 /// set the dimension of THn and allocate filling array
144 void InitTHnSparseArray(int dimension) {
146 if (fParticleProperties) delete[] fParticleProperties; fParticleProperties=NULL;
147 if (dimension>0) fParticleProperties=new Double_t[dimension];
150 inline Double_t* ParticleProperties() const {return fParticleProperties;}
153 /// copy contructor prohibited
154 AliDxHFEParticleSelection(const AliDxHFEParticleSelection&);
155 /// assignment operator prohibited
156 AliDxHFEParticleSelection& operator=(const AliDxHFEParticleSelection&);
158 TString fOption; // option
159 TObjArray* fSelectedTracks; //! array of selected tracks
161 // control histograms, note: only the list is saved, pointers only used for fast access
162 TList* fControlObjects; // list of control objects
163 TH1* fhEventControl; //! event control histogram
164 TH1* fhTrackControl; //! track control histogram
165 bool fUseMC; // specific implementation for MC selection
166 int fVerbosity; //! verbosity
167 int fDimThn; // dim of thnsparse
168 Double_t* fParticleProperties; //! filling array for THnSparse
170 static const char* fgkEventControlBinNames[]; //! bin labels for event control histogram
171 static const char* fgkTrackControlBinNames[]; //! bin labels for track control histogram
173 ClassDef(AliDxHFEParticleSelection, 3);