]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/hfe/AliHFEspectrum.h
Major update of the HFE package (comments inside the code
[u/mrichter/AliRoot.git] / PWG3 / hfe / AliHFEspectrum.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 for spectrum correction
17 // Subtraction of hadronic background, Unfolding of the data and
18 // Renormalization done here
19 // For more information see the implementation file
20 //
21 #ifndef ALIHFESPECTRUM_H
22 #define ALIHFESPECTRUM_H
23
24 #ifndef ROOT_TNamed
25 #include <TNamed.h>
26 #endif
27
28 class TGraphErrors;
29 class TObject;
30 class TH1;
31 class TList;
32 class AliCFContainer;
33 class AliHFEcontainer;
34 class AliCFDataGrid;
35 class AliCFEffGrid;
36
37 class AliHFEspectrum : public TNamed{
38   public:
39     enum CFContainer_t{
40       kDataContainer  = 0,
41       kBackgroundData = 1,
42       kMCContainerMC = 2,
43       kMCContainerESD = 3,
44       kDataContainerV0 = 4
45     };
46    
47     AliHFEspectrum(const char* name);
48     ~AliHFEspectrum();
49     
50
51     Bool_t Init(AliHFEcontainer *datahfecontainer,AliHFEcontainer *mchfecontainer,AliHFEcontainer *v0hfecontainer=0x0);
52     Bool_t Correct(Bool_t subtractcontamination=kTRUE);
53    
54     AliCFDataGrid *SubtractBackground(Bool_t setBackground = kFALSE);
55     
56     AliCFDataGrid *CorrectV0Efficiency(AliCFDataGrid* const bgsubpectrum = 0x0);
57    
58     TList *Unfold(AliCFDataGrid* const bgsubpectrum = 0x0);
59     AliCFDataGrid *CorrectForEfficiency(AliCFDataGrid* const bgsubpectrum = 0x0);
60    
61     TGraphErrors *Normalize(THnSparse * const spectrum) const;
62     TGraphErrors *Normalize(AliCFDataGrid * const spectrum) const;
63     
64     void SetCorrelation(THnSparseF * const correlation) {fCorrelation = correlation; };
65     void SetContainer(AliCFContainer *cont, AliHFEspectrum::CFContainer_t type);
66     
67     void SetNumberOfEvents(Int_t nEvents) { fNEvents = nEvents; }
68     void SetMCEffStep(Int_t step) { fStepMC = step; };
69     void SetMCTruthStep(Int_t step) { fStepTrue = step; };
70     void SetStepToCorrect(Int_t step) { fStepData = step; };
71     void SetStepBeforeCutsV0(Int_t step) { fStepBeforeCutsV0 = step; };
72     void SetStepAfterCutsV0(Int_t step) { fStepAfterCutsV0 = step; };
73
74     void SetStepGuessedUnfolding(Int_t stepGuessedUnfolding) { fStepGuessedUnfolding = stepGuessedUnfolding; };
75     void SetNumberOfIteration(Int_t numberOfIteration) { fNumberOfIterations = numberOfIteration; };
76     
77     void SetDumpToFile(Bool_t dumpToFile) { fDumpToFile=dumpToFile; }; 
78   
79     void SetDebugLevel(Int_t debugLevel) { fDebugLevel = debugLevel; };
80
81   protected:
82        
83     AliCFContainer *GetContainer(AliHFEspectrum::CFContainer_t contt);
84     AliCFContainer *GetSlicedContainer(AliCFContainer *cont, Int_t ndim, Int_t *dimensions,Int_t source=-1);
85     THnSparseF *GetSlicedCorrelation(THnSparseF *correlationmatrix,Int_t nDim, Int_t *dimensions) const;
86     TObject* GetSpectrum(AliCFContainer * const c, Int_t step);
87     TObject* GetEfficiency(AliCFContainer * const c, Int_t step, Int_t step0);
88  
89     void AddTemporaryObject(TObject *cont);
90     void ClearObject(TObject *o);
91     
92     void CorrectFromTheWidth(TH1D *h1) const;
93     TGraphErrors *NormalizeTH1(TH1 *input) const;
94
95
96   private:
97     AliHFEspectrum(const AliHFEspectrum &);
98     AliHFEspectrum &operator=(const AliHFEspectrum &);
99  
100     TList *fCFContainers;         // List of Correction Framework Containers
101     TList *fTemporaryObjects;     // Emulate garbage collection
102     THnSparseF *fCorrelation;     // Correlation Matrices
103     AliCFDataGrid *fBackground;   // Background Grid
104
105     Bool_t fInclusiveSpectrum;     // Inclusive Spectrum
106     Bool_t fDumpToFile;           // Write Result in a file
107
108     Int_t fNbDimensions;          // Number of dimensions for the correction
109     Int_t fNEvents;               // Number of Events
110     Int_t fStepMC;                // MC step (for unfolding)
111     Int_t fStepTrue;              // MC step of the final spectrum
112     Int_t fStepData;              // Data Step (various applications)
113     Int_t fStepBeforeCutsV0;      // Before cuts V0
114     Int_t fStepAfterCutsV0;       // After cuts V0
115     Int_t fStepGuessedUnfolding;  // Step for first guessed unfolding
116     Int_t fNumberOfIterations;    // Number of iterations
117
118     Int_t fDebugLevel;            // Debug Level
119
120     ClassDef(AliHFEspectrum, 1) 
121 };
122 #endif
123