]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/correlationHF/AliDxHFECorrelation.h
DxHFE macros updated (Matthias)
[u/mrichter/AliRoot.git] / PWGHF / correlationHF / AliDxHFECorrelation.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   AliDxHFECorrelation.h
9 /// @author Sedat Altinpinar, Hege Erdal, Matthias Richter
10 /// @date   2012-04-25
11 /// @brief  Worker class for D0-HF electron correlation
12 ///
13
14 #ifndef ALIDXHFECORRELATION_H
15 #define ALIDXHFECORRELATION_H
16
17 #include "TNamed.h"
18
19 class TH1;
20 class THnSparse;
21 class TObject;
22 class TList;
23 class AliHFCorrelator;
24 class AliVParticle;
25 class TObjArray;
26 class AliVEvent;
27 class AliAnalysisCuts;
28
29 class AliDxHFECorrelation : public TNamed {
30  public:
31   /// default constructor
32   AliDxHFECorrelation(const char* name=NULL);
33   /// destructor
34   virtual ~AliDxHFECorrelation();
35
36   // event control histogram
37   enum {
38     kEventsAll = 0, // all events
39     kEventsSel,     // selected events
40     kEventsD0 ,     // events with D0s
41     kEventsD0e,     // events with correlated D0s
42     kNEventControlLabels
43   };
44
45   // init
46   int Init(const char* arguments="");
47
48   // parse argument string
49   int ParseArguments(const char* arguments);
50
51   /// fill histograms from particles
52   int Fill(const TObjArray* candidatesD0, const TObjArray* candidatesElectron, const AliVEvent* pEvent);
53
54   /// histogram event properties
55   virtual int HistogramEventProperties(int bin);
56   virtual THnSparse* DefineTHnSparse();
57   virtual int FillParticleProperties(AliVParticle* tr, AliVParticle* as, Double_t* data, int dimension) const;
58
59   /// create control THnSparse
60   THnSparse* CreateControlTHnSparse(const char* name,
61                                     int thnSize,
62                                     int* thnBins,
63                                     double* thnMin,
64                                     double* thnMax,
65                                     const char** binLabels) const;
66
67   /// overloaded from TObject: cleanup
68   virtual void Clear(Option_t * option ="");
69   /// overloaded from TObject: print info
70   virtual void Print(Option_t *option="") const;
71   /// overloaded from TObject: draw histograms
72   virtual void Draw(Option_t *option="");
73   /// overloaded from TObject: find object by name
74   virtual TObject* FindObject(const char *name) const;
75   /// overloaded from TObject: find object by pointer
76   virtual TObject* FindObject(const TObject *obj) const;
77   /// overloaded from TObject: save to file
78   virtual void     SaveAs(const char *filename="",Option_t *option="") const; // *MENU*
79
80   virtual void SetCuts(AliAnalysisCuts* cuts) {fCuts=cuts;}
81   virtual void SetUseMC(Bool_t useMC){fUseMC=useMC;}
82   //void SetUseEventMixing(Bool_t useMixing) {fUseEventMixing=useMixing;}
83   //void SetSystem(Bool_t system){fSystem=system;}
84   //void SetPhiRange(Double_t min, Double_t max){fMinPhi=min; fMaxPhi=max;}
85   // TODO: SetEventType only needed for MC. How to avoid this?
86   virtual void SetEventType(int type){fEventType=type;}
87
88   Bool_t GetUseMC() const {return fUseMC;}
89   const TList* GetControlObjects() const {return fControlObjects;}
90   Double_t GetMinPhi() const {return fMinPhi;}
91   Double_t GetMaxPhi() const {return fMaxPhi;}
92   Double_t GetDeltaPhi() const {return fDeltaPhi;}
93   Double_t GetDeltaEta() const {return fDeltaEta;}
94   inline int GetDimTHnSparse() const {return fDimThn;}
95
96   void EventMixingChecks(const AliVEvent* pEvent);
97
98   AliDxHFECorrelation& operator+=(const AliDxHFECorrelation& other);
99
100   // Probably not needed anymore, since code was changed to THnSparse
101   // but keep here in case we need it later
102   enum {
103     khD0pT,         // TH1F
104     khD0Phi,        // TH1F
105     khD0Eta,        // TH1F
106     khElectronpT,   // TH1F
107     khElectronPhi,  // TH1F
108     khElectronEta,  // TH1F
109     kNofHistograms
110   };
111
112  protected:
113   /// add control object to list, the base class becomes owner of the object
114   int AddControlObject(TObject* pObj);
115
116  /// set the dimension of THn and allocate filling array
117   void InitTHnSparseArray(int dimension) {
118     fDimThn=dimension; 
119     if (fCorrArray) delete[] fCorrArray; fCorrArray=NULL;
120     if (dimension>0) fCorrArray=new Double_t[dimension];
121   }
122
123   inline Double_t* ParticleProperties() const {return fCorrArray;}
124
125  private:
126   /// copy constructor
127   AliDxHFECorrelation(const AliDxHFECorrelation& other);
128   /// assignment operator
129   AliDxHFECorrelation& operator=(const AliDxHFECorrelation& other);
130
131   // 2012-09-18: when running on Grid the histograms were empty. We encountered
132   // messages "cannot create object of class TH1" when writing the analysis manager
133   // to file for Grid analysis.
134   // This class had a TH1 member marked to be saved, the object though was part of
135   // a list, also a member of the class. Root has a problem with the schema info
136   // in that case.
137   // Solved by marking fhEventControlCorr as transient, the cause, though, is not
138   // understood
139
140   TObjArray* fHistograms;        //  the histograms - for the moment not in use. 
141   TList* fControlObjects;        //  list of control objects
142   THnSparse* fCorrProperties;    //  the Correlation properties of selected particles
143   TH1* fhEventControlCorr;       //! event control histogram (saved via control object list)
144   AliAnalysisCuts *fCuts;        //! Cuts 
145   Bool_t fUseMC;                 // use MC info
146   AliHFCorrelator *fCorrelator;  //! object for correlations
147   Bool_t fUseEventMixing;        // Run Event Mixing analysis
148   Short_t fSystem;               // Which system pp/PbPb
149   Double_t fMinPhi;              // Holds min phi
150   Double_t fMaxPhi;              // Holds maxa phi
151   Double_t fDeltaPhi;            // Delta Phi  
152   Double_t fDeltaEta;            // Delta Eta
153   int fDimThn;                   // Holds dim of THnSparse
154   Double_t* fCorrArray;          //! filling array for THnSparse
155   Int_t fEventType;              // Event type. Only needed for MC (fix)
156
157
158   static const char* fgkEventControlBinNames[];
159
160   ClassDef(AliDxHFECorrelation, 4)
161 };
162 #endif