]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/hfe/AliHFEvarManager.h
Cannot wait for the fix -- better do it myself
[u/mrichter/AliRoot.git] / PWG3 / hfe / AliHFEvarManager.h
1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 *                                                                        *
4 * Author: The ALICE Off-line Project.                                    *
5 * Contributors are mentioned in the code where appropriate.              *
6 *                                                                        *
7 * Permission to use, copy, modify and distribute this software and its   *
8 * documentation strictly for non-commercial purposes is hereby granted   *
9 * without fee, provided that the above copyright notice appears in all   *
10 * copies and that both the copyright notice and this permission notice   *
11 * appear in the supporting documentation. The authors make no claims     *
12 * about the suitability of this software for any purpose. It is          *
13 * provided "as is" without express or implied warranty.                  *
14 **************************************************************************/
15 //
16 // Class AliHFEvarManager
17 // Common place for definiton of variables to be filled into the 
18 // correction framework container
19 // More information can be found inside the implementation file
20 //
21 #ifndef ALIHFEVARMANAGER_H
22 #define ALIHFEVARMANAGER_H
23
24 #ifndef ROOT_TNamed
25 #include <TNamed.h>
26 #endif
27
28 template <class X>
29 class THnSparseT;
30 class TArrayF;
31 typedef class THnSparseT<TArrayF> THnSparseF;
32 class TH3F;
33 class TF3;
34 class AliCFContainer;
35 class AliHFEcontainer;
36 class AliHFEsignalCuts;
37 class AliVParticle;
38
39
40 class AliHFEvarManager : public TNamed{
41 public:
42   enum EVarCode_t{
43     kPt = 1,
44     kEta,
45     kPhi,
46     kCharge,
47     kSource,
48     kCentrality,
49     kSpecies,
50   };
51         AliHFEvarManager();
52         AliHFEvarManager(const Char_t *name);
53   AliHFEvarManager(const AliHFEvarManager &ref);
54   AliHFEvarManager &operator=(const AliHFEvarManager &ref);
55   void Copy(TObject &o) const;
56         ~AliHFEvarManager();
57
58   TObjArray *GetVariables() const { return fVariables; }
59   
60   void SetOwner(Bool_t owner = kTRUE) { SetBit(kOwner, owner); }
61   Bool_t IsOwner() const { return TestBit(kOwner); }
62
63   void AddVariable(TString name);
64   void AddVariable(TString name, Int_t nBins, Double_t min, Double_t max, Bool_t isLogarithmic = kFALSE);
65   void AddVariable(TString name, Int_t nBins, const Double_t *binning);
66   Bool_t IsVariableDefined(TString name);
67   void DefineVariables(AliHFEcontainer *cont);
68   void NewTrack(AliVParticle *track, AliVParticle *mcTrack = NULL, Float_t centrality = 99.0, Int_t aprioriPID = -1, Bool_t signal = kTRUE);
69   Bool_t IsSignalTrack() const { return fSignalTrack; }
70   void FillContainer(AliCFContainer *const cont, Int_t step, Bool_t useMC = kFALSE) const;
71   void FillContainer(const AliHFEcontainer *const cont, const Char_t *contname, UInt_t step, Bool_t useMC = kFALSE, Double_t externalWeight = 1.) const;
72   void FillContainerStepname(const AliHFEcontainer *const cont, const Char_t *contname, const Char_t *step, Bool_t useMC = kFALSE, Double_t externalWeight = 1.) const;
73   void FillCorrelationMatrix(THnSparseF *matrix) const;
74   
75   void SetSignalCuts(AliHFEsignalCuts *signal) { fSignal = signal; }
76   void SetWeightFactors(TH3F *weightFactors);
77   void SetWeightFactorsFunction(TF3*weightFactorsFunction);
78   
79   struct AliHFEvariable : public TNamed{
80     public:
81       AliHFEvariable();
82       AliHFEvariable(const Char_t *name, const Char_t *title, UInt_t fCode, UInt_t nBins, Double_t min, Double_t max, Bool_t isLogarithmic = kFALSE);
83       AliHFEvariable(const Char_t *name, const Char_t *title, UInt_t fCode, UInt_t nBins, const Double_t *binning);
84       AliHFEvariable(const AliHFEvariable &ref);
85       AliHFEvariable &operator=(const AliHFEvariable &ref);
86       ~AliHFEvariable();
87
88       UInt_t GetVarCode() const { return fCode; }
89       UInt_t GetNumberOfBins() const { return fNBins; }
90       const Double_t* GetBinning() const { return fBinning; }
91       Bool_t HasUserDefinedBinning() const { return fBinning != NULL; }
92       Double_t GetMinimum() const { return fMin; }
93       Double_t GetMaximum() const { return fMax; } 
94       Int_t IsLogarithmic() const { return fIsLogarithmic; }
95     private:
96       UInt_t    fCode;              // Unique variable code
97       UInt_t    fNBins;             // Number of bins
98       Double_t  fMin;               // Minimum
99       Double_t  fMax;               // Maximum
100       Double_t *fBinning;           // User defined binning
101       Bool_t    fIsLogarithmic;     // Logarithmic binning
102
103       ClassDef(AliHFEvarManager::AliHFEvariable, 1) // HFE variable definition
104   };
105  
106 protected:
107   Double_t GetValue(AliVParticle *track, UInt_t code, Float_t centrality = 99.0, Int_t aprioriPID = -1) const;
108   void FillArray(AliVParticle *track, Double_t *container, Float_t centrality = 99.0, Int_t aprioriPID = -1) const;
109   Double_t FindWeight(Double_t pt, Double_t eta, Double_t phi) const;
110
111 private:
112   enum{
113     kOwner = BIT(14)
114   };
115   TObjArray *fVariables;                // Variables to process
116   Double_t *fContent;                   //! Cache values for track in classmember 
117   Double_t *fContentMC;                 //! Cache content of the asssociated MC track in class member
118   Double_t fWeightFactor;               // Cache weighting factor
119   Bool_t  fSignalTrack;                 // Signal Track
120         Bool_t  fWeighting;                   // Weighting or not for the efficiency maps
121   AliHFEsignalCuts *fSignal;            // MC Signal Definition
122         TH3F *fWeightFactors;                 // Weight factors
123         TF3  *fWeightFactorsFunction;         // Weight factors
124
125         ClassDef(AliHFEvarManager, 1)         // The variable Manager for the HFE Analysis
126 };
127
128 #endif /* ALIHFEVARMANAGER_H */