]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/correlationHF/AliDxHFEParticleSelection.h
Update in D-electon correlation code (Hege, Matthias)
[u/mrichter/AliRoot.git] / PWGHF / correlationHF / AliDxHFEParticleSelection.h
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
17 #include "TNamed.h"
18 #include "TString.h"
19 class AliVEvent;
20 class AliVParticle;
21 class TObjArray;
22 class TH1;
23 class THnSparse;
24
25 /**
26  * @class AliDxHFEParticleSelection
27  * This is the base class for particle selections for the D0 - HFE
28  * correlation studies.
29  *
30  * Ideas:
31  * - configurable particle selection
32  * - eventually histogramming of particle properties before vs. after
33  *   selection
34  *
35  * Might be that there is already something similar, then this class
36  * can be merged with some other class.
37  */
38 class AliDxHFEParticleSelection : public TNamed {
39   public:
40   /// constructor
41   AliDxHFEParticleSelection(const char* name=NULL, const char* opt="");
42   /// destructor
43   virtual ~AliDxHFEParticleSelection();
44
45   enum {
46     kEventsAll = 0,
47     kEventsSel,
48     kEventsD0,
49     kNEventPropertyLabels
50   };
51
52   /// set options
53   void SetOption(const char* opt) { fOption = opt; }
54   /// overloaded from TObject: get option
55   virtual Option_t* GetOption() const { return fOption;}
56
57   /// init the control objects
58   virtual int InitControlObjects();
59
60   /// create selection from 'Tracks' member of the event,
61   /// array contains only pointers but does not own the objects
62   /// object array needs to be deleted by caller
63   virtual TObjArray* Select(const AliVEvent* pEvent);
64   /// create selection from the array of particles,
65   /// array contains only pointers but does not own the objects
66   /// object array needs to be deleted by caller
67   virtual TObjArray* Select(TObjArray* particles, const AliVEvent* pEvent);
68
69   // Get the list fControlObjects. 
70   const TList* GetControlObjects() const {return fControlObjects;}
71
72   /// histogram event properties
73   virtual int HistogramEventProperties(int bin);
74
75   /// check and add track to internal array
76   int CheckAndAdd(AliVParticle* p);
77
78   /// set cuts object: general TObject pointer is used as argument to support
79   // different types; a type cast check is implemented in the method
80   virtual void SetCuts(TObject* /*cuts*/, int /*level*/=0) {}
81
82   Bool_t GetUseMC() const {return fUseMC;}
83
84   /// get selected tracks
85   const TObjArray* GetSelected() const {return fSelectedTracks;}
86
87   /// check particle if it passes the selection criteria
88   virtual int IsSelected(AliVParticle* p, const AliVEvent *pEvent=NULL);
89
90   /// inherited from TObject: cleanup
91   virtual void Clear(Option_t * option ="");
92   /// inherited from TObject: print info
93   virtual void Print(Option_t *option="") const;
94   /// inherited from TObject: safe selection criteria
95   virtual void SaveAs(const char *filename="", Option_t *option="") const;
96   /// inherited from TObject: draw content
97   virtual void Draw(Option_t *option="");
98   /// inherited from TObject: find object by name
99   virtual TObject* FindObject(const char *name) const;
100   /// inherited from TObject: find object by pointer
101   virtual TObject* FindObject(const TObject *obj) const;
102
103   /// set verbosity
104   void SetVerbosity(int verbosity) {fVerbosity=verbosity;}
105   /// get verbosity
106   int GetVerbosity() const {return fVerbosity;}
107
108  protected:
109   /// add control object to list, the base class becomes owner of the object
110   int AddControlObject(TObject* pObj);
111
112   /// histogram particle properties
113   virtual int HistogramParticleProperties(AliVParticle* p, int selected=1);
114
115   /// set from the specific child class implementation
116   /// TODO: think about removing this function
117   /// in principle that should not be necessary, the analysis should
118   /// be blind after the particle selection
119   void SetUseMC(bool useMC=true) {fUseMC=useMC;}
120
121  private:
122   /// copy contructor prohibited
123   AliDxHFEParticleSelection(const AliDxHFEParticleSelection&);
124   /// assignment operator prohibited
125   AliDxHFEParticleSelection& operator=(const AliDxHFEParticleSelection&);
126
127   TString fOption; // option
128   TObjArray* fSelectedTracks; //! array of selected tracks
129
130   // control histograms, note: only the list is saved, pointers only used for fast access
131   TList* fControlObjects; // list of control objects
132   TH1* fhEventControl; //! event control histogram
133   TH1* fhTrackControl; //! track control histogram
134   bool fUseMC;         // specific implementation for MC selection
135   int fVerbosity;      //! verbosity
136
137   static const char* fgkEventControlBinNames[]; //! bin labels for event control histogram
138
139   ClassDef(AliDxHFEParticleSelection, 2);
140
141 };
142
143 #endif