]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/hfe/AliHFEvarManager.h
updated
[u/mrichter/AliRoot.git] / PWGHF / 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 #ifndef ROOT_TArrayD
29 #include <TArrayD.h>
30 #endif
31
32 template <class X>
33 class THnSparseT;
34 class TArrayF;
35 typedef class THnSparseT<TArrayF> THnSparseF;
36 class TH3F;
37 class TF3;
38 class AliCFContainer;
39 class AliHFEcontainer;
40 class AliHFEsignalCuts;
41 class AliVParticle;
42
43
44 class AliHFEvarManager : public TNamed{
45 public:
46   enum EVarCode_t{
47     kPt = 1,
48     kEta,
49     kPhi,
50     kCharge,
51     kSource,
52     kCentrality,
53     kSpecies,
54   };
55         AliHFEvarManager();
56         AliHFEvarManager(const Char_t *name);
57   AliHFEvarManager(const AliHFEvarManager &ref);
58   AliHFEvarManager &operator=(const AliHFEvarManager &ref);
59   void Copy(TObject &o) const;
60         ~AliHFEvarManager();
61
62   TObjArray *GetVariables() const { return fVariables; }
63   
64   void SetOwner(Bool_t owner = kTRUE) { SetBit(kOwner, owner); }
65   Bool_t IsOwner() const { return TestBit(kOwner); }
66
67   void AddVariable(TString name);
68   void AddVariable(TString name, Int_t nBins, Double_t min, Double_t max, Bool_t isLogarithmic = kFALSE);
69   void AddVariable(TString name, Int_t nBins, const Double_t *binning);
70   Bool_t IsVariableDefined(TString name);
71   void DefineVariables(AliHFEcontainer *cont);
72   void NewTrack(AliVParticle *track, AliVParticle *mcTrack = NULL, Float_t centrality = 99.0, Int_t aprioriPID = -1, Bool_t signal = kTRUE);
73   Bool_t IsSignalTrack() const { return fSignalTrack; }
74   void FillContainer(AliCFContainer *const cont, Int_t step, Bool_t useMC = kFALSE) const;
75   void FillContainer(const AliHFEcontainer *const cont, const Char_t *contname, UInt_t step, Bool_t useMC = kFALSE, Double_t externalWeight = 1.) const;
76   void FillContainerStepname(const AliHFEcontainer *const cont, const Char_t *contname, const Char_t *step, Bool_t useMC = kFALSE, Double_t externalWeight = 1.) const;
77   void FillCorrelationMatrix(THnSparseF *matrix) const;
78   
79   void SetSignalCuts(AliHFEsignalCuts *signal) { fSignal = signal; }
80   void SetWeightFactors(TH3F *weightFactors);
81   void SetWeightFactorsFunction(TF3*weightFactorsFunction);
82   
83   struct AliHFEvariable : public TNamed{
84     public:
85       AliHFEvariable();
86       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);
87       AliHFEvariable(const Char_t *name, const Char_t *title, UInt_t fCode, UInt_t nBins, const Double_t *binning);
88       AliHFEvariable(const AliHFEvariable &ref);
89       AliHFEvariable &operator=(const AliHFEvariable &ref);
90       ~AliHFEvariable();
91
92       UInt_t GetVarCode() const { return fCode; }
93       UInt_t GetNumberOfBins() const { return fNBins; }
94       Double_t* GetBinning();
95       Bool_t HasUserDefinedBinning() const { return fUserDefinedBinning; }
96       Double_t GetMinimum() const { return fMin; }
97       Double_t GetMaximum() const { return fMax; } 
98       Int_t IsLogarithmic() const { return fIsLogarithmic; }
99     private:
100       UInt_t    fCode;              // Unique variable code
101       UInt_t    fNBins;             // Number of bins
102       Double_t  fMin;               // Minimum
103       Double_t  fMax;               // Maximum
104       TArrayD   fBinning;           // User defined binning
105       Bool_t    fIsLogarithmic;     // Logarithmic binning
106       Bool_t    fUserDefinedBinning;// Has User defined binning
107
108       ClassDef(AliHFEvarManager::AliHFEvariable, 1) // HFE variable definition
109   };
110  
111 protected:
112   Double_t GetValue(AliVParticle *track, UInt_t code, Float_t centrality = 99.0, Int_t aprioriPID = -1) const;
113   void FillArray(AliVParticle *track, Double_t *container, Float_t centrality = 99.0, Int_t aprioriPID = -1) const;
114   Double_t FindWeight(Double_t pt, Double_t eta, Double_t phi) const;
115
116 private:
117   enum{
118     kOwner = BIT(14)
119   };
120   TObjArray *fVariables;                // Variables to process
121   Double_t *fContent;                   //! Cache values for track in classmember 
122   Double_t *fContentMC;                 //! Cache content of the asssociated MC track in class member
123   Double_t fWeightFactor;               // Cache weighting factor
124   Bool_t  fSignalTrack;                 // Signal Track
125         Bool_t  fWeighting;                   // Weighting or not for the efficiency maps
126   AliHFEsignalCuts *fSignal;            // MC Signal Definition
127         TH3F *fWeightFactors;                 // Weight factors
128         TF3  *fWeightFactorsFunction;         // Weight factors
129
130         ClassDef(AliHFEvarManager, 1)         // The variable Manager for the HFE Analysis
131 };
132
133 #endif /* ALIHFEVARMANAGER_H */