]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/correlationHF/AliDxHFEParticleSelection.h
Big fix + updates in D0-h THnSparse (Fabio)
[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   /// set options
46   void SetOption(const char* opt) { fOption = opt; }
47   /// overloaded from TObject: get option
48   virtual Option_t* GetOption() const { return fOption;}
49
50   /// init the control objects
51   virtual int InitControlObjects();
52
53   /// create selection, array contains only pointers but does not own the objects
54   /// object array needs to be deleted by caller
55   virtual TObjArray* Select(const AliVEvent* pEvent);
56
57   /// create selection, array contains only pointers but does not own the objects
58   /// object array needs to be deleted by caller
59   virtual TObjArray* Select(TObjArray* pTracks);
60
61   /// check and add track to internal array
62   int CheckAndAdd(AliVParticle* p);
63   /// get selected tracks
64   const TObjArray* GetSelected() const {return fSelectedTracks;}
65
66   /// check particle if it passes the selection criteria
67   virtual bool IsSelected(AliVParticle* p);
68
69   /// inherited from TObject: cleanup
70   virtual void Clear(Option_t * option ="");
71   /// inherited from TObject: print info
72   virtual void Print(Option_t *option="") const;
73   /// inherited from TObject: safe selection criteria
74   virtual void SaveAs(const char *filename="",Option_t *option="") const;
75   /// inherited from TObject: draw content
76   virtual void Draw(Option_t *option="");
77   /// inherited from TObject: find object by name
78   virtual TObject* FindObject(const char *name) const;
79   /// inherited from TObject: find object by pointer
80   virtual TObject* FindObject(const TObject *obj) const;
81
82  protected:
83   /// add control object to list, the base class becomes owner of the object
84   int AddControlObject(TObject* pObj);
85
86   /// histogram particle properties
87   virtual int HistogramParticleProperties(AliVParticle* p, bool selected=true);
88
89  private:
90   /// copy contructor prohibited
91   AliDxHFEParticleSelection(const AliDxHFEParticleSelection&);
92   /// assignment operator prohibited
93   AliDxHFEParticleSelection& operator=(const AliDxHFEParticleSelection&);
94
95   TString fOption; // option
96   TObjArray* fSelectedTracks; //! array of selected tracks
97
98   // control histograms, note: only the list is saved, pointers only used for fast access
99   TList* fControlObjects; // list of control objects
100   TH1* fhEventControl; //! event control histogram
101   TH1* fhTrackControl; //! track control histogram
102
103   ClassDef(AliDxHFEParticleSelection, 1);
104 };
105
106 #endif