]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/correlationHF/AliDxHFEParticleSelection.h
cleanup
[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;
24class THnSparse;
72c0a987 25
26/**
27 * @class AliDxHFEParticleSelection
28 * This is the base class for particle selections for the D0 - HFE
29 * correlation studies.
30 *
31 * Ideas:
32 * - configurable particle selection
33 * - eventually histogramming of particle properties before vs. after
34 * selection
35 *
36 * Might be that there is already something similar, then this class
37 * can be merged with some other class.
38 */
93fcaf9f 39class AliDxHFEParticleSelection : public TNamed {
72c0a987 40 public:
41 /// constructor
93fcaf9f 42 AliDxHFEParticleSelection(const char* name=NULL, const char* opt="");
72c0a987 43 /// destructor
44 virtual ~AliDxHFEParticleSelection();
45
9535cec9 46 enum {
47 kEventsAll = 0,
48 kEventsSel,
d731501a 49 kEventsWithParticle,
9535cec9 50 kNEventPropertyLabels
51 };
d731501a 52
53 enum {
54 kTrackAll = 0,
55 kTrackSel,
56 kNTrackPropertyLabels
57 };
9535cec9 58
72c0a987 59 /// set options
60 void SetOption(const char* opt) { fOption = opt; }
61 /// overloaded from TObject: get option
62 virtual Option_t* GetOption() const { return fOption;}
63
93fcaf9f 64 /// init the control objects
d731501a 65 virtual int Init();
93fcaf9f 66 virtual int InitControlObjects();
67
9535cec9 68 /// create selection from 'Tracks' member of the event,
69 /// array contains only pointers but does not own the objects
72c0a987 70 /// object array needs to be deleted by caller
71 virtual TObjArray* Select(const AliVEvent* pEvent);
9535cec9 72 /// create selection from the array of particles,
73 /// array contains only pointers but does not own the objects
72c0a987 74 /// object array needs to be deleted by caller
9535cec9 75 virtual TObjArray* Select(TObjArray* particles, const AliVEvent* pEvent);
76
b86451e1 77 virtual void SetPIDResponse(const AliPIDResponse* /*const pidresp*/){}
78
9535cec9 79 // Get the list fControlObjects.
80 const TList* GetControlObjects() const {return fControlObjects;}
81
82 /// histogram event properties
83 virtual int HistogramEventProperties(int bin);
72c0a987 84
dcf83226 85 virtual int FillParticleProperties(AliVParticle* p, Double_t* date, int dimension) const;
dfe96b90 86 virtual AliVParticle* CreateParticle(AliVParticle* track);
d731501a 87
72c0a987 88 /// check and add track to internal array
89 int CheckAndAdd(AliVParticle* p);
9535cec9 90
91 /// set cuts object: general TObject pointer is used as argument to support
92 // different types; a type cast check is implemented in the method
93 virtual void SetCuts(TObject* /*cuts*/, int /*level*/=0) {}
94
d731501a 95 // TODO: check whether that is needed, should be covered by the specific
96 // child implementation
9535cec9 97 Bool_t GetUseMC() const {return fUseMC;}
98
72c0a987 99 /// get selected tracks
100 const TObjArray* GetSelected() const {return fSelectedTracks;}
101
102 /// check particle if it passes the selection criteria
9535cec9 103 virtual int IsSelected(AliVParticle* p, const AliVEvent *pEvent=NULL);
72c0a987 104
105 /// inherited from TObject: cleanup
106 virtual void Clear(Option_t * option ="");
107 /// inherited from TObject: print info
108 virtual void Print(Option_t *option="") const;
109 /// inherited from TObject: safe selection criteria
9535cec9 110 virtual void SaveAs(const char *filename="", Option_t *option="") const;
93fcaf9f 111 /// inherited from TObject: draw content
112 virtual void Draw(Option_t *option="");
113 /// inherited from TObject: find object by name
114 virtual TObject* FindObject(const char *name) const;
115 /// inherited from TObject: find object by pointer
116 virtual TObject* FindObject(const TObject *obj) const;
72c0a987 117
9535cec9 118 /// set verbosity
119 void SetVerbosity(int verbosity) {fVerbosity=verbosity;}
dcf83226 120
9535cec9 121 /// get verbosity
dcf83226 122 inline int GetVerbosity() const {return fVerbosity;}
123
124 /// get the dimension of THn, fixed
125 inline int GetDimTHnSparse() const {return fDimThn;}
d731501a 126
127 /// create control THnSparse
128 THnSparse* CreateControlTHnSparse(const char* name,
129 int thnSize,
130 int* thnBins,
131 double* thnMin,
132 double* thnMax,
133 const char** binLabels) const;
134
dcf83226 135 // define and create the THnSparse object
136 // initializes also the dimension to be used further
137 virtual THnSparse* DefineTHnSparse();
9535cec9 138
72c0a987 139 protected:
93fcaf9f 140 /// add control object to list, the base class becomes owner of the object
141 int AddControlObject(TObject* pObj);
142
143 /// histogram particle properties
9535cec9 144 virtual int HistogramParticleProperties(AliVParticle* p, int selected=1);
145
dcf83226 146 /// set the dimension of THn and allocate filling array
147 void InitTHnSparseArray(int dimension) {
148 fDimThn=dimension;
149 if (fParticleProperties) delete[] fParticleProperties; fParticleProperties=NULL;
150 if (dimension>0) fParticleProperties=new Double_t[dimension];
151 }
152
153 inline Double_t* ParticleProperties() const {return fParticleProperties;}
154
72c0a987 155 private:
156 /// copy contructor prohibited
157 AliDxHFEParticleSelection(const AliDxHFEParticleSelection&);
158 /// assignment operator prohibited
159 AliDxHFEParticleSelection& operator=(const AliDxHFEParticleSelection&);
160
161 TString fOption; // option
162 TObjArray* fSelectedTracks; //! array of selected tracks
163
93fcaf9f 164 // control histograms, note: only the list is saved, pointers only used for fast access
165 TList* fControlObjects; // list of control objects
166 TH1* fhEventControl; //! event control histogram
167 TH1* fhTrackControl; //! track control histogram
9535cec9 168 bool fUseMC; // specific implementation for MC selection
169 int fVerbosity; //! verbosity
dcf83226 170 int fDimThn; // dim of thnsparse
171 Double_t* fParticleProperties; //! filling array for THnSparse
9535cec9 172
173 static const char* fgkEventControlBinNames[]; //! bin labels for event control histogram
d731501a 174 static const char* fgkTrackControlBinNames[]; //! bin labels for track control histogram
9535cec9 175
dcf83226 176 ClassDef(AliDxHFEParticleSelection, 3);
93fcaf9f 177
72c0a987 178};
179
180#endif