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