]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/hfe/AliHFEBeautySpectrum.h
Updates for TRD HFE analysis
[u/mrichter/AliRoot.git] / PWGHF / hfe / AliHFEBeautySpectrum.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 ALIHFEBEAUTYSPECTRUM_H
22 #define ALIHFEBEAUTYSPECTRUM_H
23
24 #include "AliHFECorrectSpectrumBase.h"
25
26
27
28 class TGraphErrors;
29 class TObject;
30 class TH1;
31 class TF1;
32 class TList;
33 class TObjArray;
34 class AliCFContainer;
35 class AliHFEcontainer;
36 class AliCFDataGrid;
37 class AliCFEffGrid;
38 class AliHFEInclusiveSpectrumQA;
39 class AliHFEBeautySpectrumQA;
40
41 class AliHFEBeautySpectrum : public AliHFECorrectSpectrumBase{
42  public:
43   
44   enum{
45     kElecBgSources = 9,
46     kBgLevels = 3,
47     kBgPtBins = 44,
48     kSignalPtBins = 35,
49     kCentrality = 12
50   };
51   
52   AliHFEBeautySpectrum(const char* name);
53   ~AliHFEBeautySpectrum();
54   
55   
56   virtual Bool_t Init(const AliHFEcontainer *datahfecontainer, const AliHFEcontainer *mchfecontainer, const AliHFEcontainer *bghfecontainer=0x0, const AliHFEcontainer */*v0hfecontainer*/ = 0x0,AliCFContainer */*photoniccontainerD*/ = 0x0);
57   virtual Bool_t Correct(Bool_t subtractcontamination=kTRUE, Bool_t /*subtractphotonic*/=kFALSE);
58   
59   AliCFDataGrid *SubtractBackground(Bool_t setBackground = kFALSE);
60   
61   AliCFDataGrid *CorrectParametrizedEfficiency(AliCFDataGrid* const bgsubpectrum = 0x0);
62   
63   THnSparse *Unfold(AliCFDataGrid* const bgsubpectrum = 0x0);
64   void UnfoldBG(AliCFDataGrid* const bgsubpectrum);
65   AliCFDataGrid *CorrectForEfficiency(AliCFDataGrid* const bgsubpectrum = 0x0);
66   
67   void SetPbPbAnalysis(Bool_t isPbPb = kFALSE) { fBeamType=(Char_t) isPbPb; };
68   void SetEtaSyst(Bool_t etaSyst = kTRUE) { fEtaSyst = etaSyst; };
69   
70   void SetParameterizedEff(AliCFContainer *container, AliCFContainer *containermb, AliCFContainer *containeresd, AliCFContainer *containeresdmb, Int_t *dimensions);
71   
72   void SetNumberOfMCEvents(Int_t nEvents) { fNMCEvents = nEvents; };
73   void SetNumberOfMC2Events(Int_t nEvents) { fNMCbgEvents = nEvents; };
74   void SetUnSetCorrelatedErrors(Bool_t unsetcorrelatederrors) {fUnSetCorrelatedErrors = unsetcorrelatederrors;};
75   void SetFillMoreCorrelationMatrix(Bool_t fillMoreCorrelationMatrix) { fFillMoreCorrelationMatrix = fillMoreCorrelationMatrix;}
76   
77   void SetNCentralityBinAtTheEnd(Int_t nCentralityBinAtTheEnd) {fNCentralityBinAtTheEnd = nCentralityBinAtTheEnd; };
78   void SetLowHighBoundaryCentralityBinAtTheEnd(Int_t low, Int_t high, Int_t i) { fLowBoundaryCentralityBinAtTheEnd[i] = low; fHighBoundaryCentralityBinAtTheEnd[i] = high;};
79   
80   void CallInputFileForBeauty2ndMethod();
81   void SetInputFileForBeauty2ndMethod(const char *filenameb = "BSpectrum2ndmethod.root"){fkBeauty2ndMethodfilename = filenameb; };
82   void SetBeautyAnalysis2ndMethod(Bool_t beauty2ndmethod) { fBeauty2ndMethod = beauty2ndmethod; }
83   void SetIPEffCombinedSamples(Bool_t ipEffCombinedSamples) { fIPEffCombinedSamples = ipEffCombinedSamples; }
84   void SetHadronEffbyIPcut(THnSparseF* hsHadronEffbyIPcut) { fHadronEffbyIPcut = hsHadronEffbyIPcut;};
85   void SetNonHFEsyst(Bool_t syst){ fNonHFEsyst = syst; };
86   
87   void SetDumpToFile(Bool_t dumpToFile) { fDumpToFile=dumpToFile; }; 
88   
89   void SetDebugLevel(Int_t debugLevel, Bool_t writeToFile = kFALSE) { fDebugLevel = debugLevel; fWriteToFile = writeToFile; };
90   void SetUnfoldBG() { fUnfoldBG = kTRUE; };
91   
92   
93   AliCFDataGrid* GetRawBspectra2ndMethod();
94   AliCFDataGrid* GetCharmBackground();
95   AliCFDataGrid* GetNonHFEBackground(Int_t decay = 0, Int_t source = 0);
96   THnSparse* GetCharmWeights(Int_t centBin);
97   THnSparse* GetBeautyIPEff(Bool_t isMCpt);
98   THnSparse* GetPIDxIPEff(Int_t source);
99   void CalculateNonHFEsyst();
100   
101   void EnableIPanaHadronBgSubtract() { fIPanaHadronBgSubtract = kTRUE; };
102   void EnableIPanaCharmBgSubtract() { fIPanaCharmBgSubtract = kTRUE; };
103   void EnableIPanaNonHFEBgSubtract() { fIPanaNonHFEBgSubtract = kTRUE; };
104   void EnableIPParameterizedEff() { fIPParameterizedEff = kTRUE; };
105   
106  protected:
107   void AddTemporaryObject(TObject *cont);
108   void ClearObject(TObject *o);
109   
110  private:
111   AliHFEBeautySpectrum(const AliHFEBeautySpectrum &ref);
112   AliHFEBeautySpectrum &operator=(const AliHFEBeautySpectrum &ref);
113   virtual void Copy(TObject &o) const;
114   
115   AliHFEBeautySpectrumQA *fQA; // Beauty QA
116   
117   //shift some of the following to QA or Base class:
118   TList *fTemporaryObjects;     // Emulate garbage collection
119   AliCFDataGrid *fBackground;   // Background Grid
120   TF1 *fEfficiencyTOFPIDD;       // TOF PID efficiency parameterized
121   TF1 *fEfficiencyesdTOFPIDD;    // TOF PID efficiency parameterized
122   TF1 *fEfficiencyIPCharmD;      // IP efficiency parameterized for charm
123   TF1 *fEfficiencyIPBeautyD;     // IP efficiency parameterized for beauty 
124   TF1 *fEfficiencyIPBeautyesdD;  // IP efficiency parameterized for beauty for esd
125   TF1 *fEfficiencyIPConversionD; // IP efficiency parameterized for conversion
126   TF1 *fEfficiencyIPNonhfeD;     // IP efficiency parameterized for nonhfe 
127   TF1 *fNonHFEbg;     // Efficiency Function
128   THnSparseF *fWeightCharm;     // Weight for charm bg
129   
130   AliCFContainer *fConvSourceContainer[kElecBgSources][kBgLevels]; //container for conversion electrons, divided into different photon sources
131   AliCFContainer *fNonHFESourceContainer[kElecBgSources][kBgLevels]; //container for non-HF electrons, divided into different sources
132   
133   Bool_t fInclusiveSpectrum;     // Inclusive Spectrum
134   Bool_t fDumpToFile;           // Write Result in a file
135   
136   Bool_t fUnSetCorrelatedErrors;    // Unset correlated errors
137   
138   Bool_t fIPanaHadronBgSubtract;     // Hadron background subtraction
139   Bool_t fIPanaCharmBgSubtract;      // Charm background subtraction 
140   Bool_t fIPanaNonHFEBgSubtract;     // nonHFE background subtraction
141   Bool_t fIPParameterizedEff;        // switch to use parameterized efficiency for ip analysis
142   Bool_t fNonHFEsyst;            // choose NonHFE background level (upper, lower, central)
143   Bool_t fBeauty2ndMethod;      // 2nd method to get beauty spectrum
144   Bool_t fIPEffCombinedSamples; // flag to combine two different samples
145   
146   Int_t fNMCEvents;             // Number of MC Events
147   Int_t fNMCbgEvents;       // Number of BG MC Events
148   
149   Int_t fNCentralityBinAtTheEnd;// Number of centrality class at the end
150   Int_t fLowBoundaryCentralityBinAtTheEnd[20];  // Boundary of the bins
151   Int_t fHighBoundaryCentralityBinAtTheEnd[20];  // Boundary of the bins
152   Bool_t fFillMoreCorrelationMatrix;             // For low stats to have reasonable errors
153   
154   THnSparseF *fHadronEffbyIPcut;// container for hadron efficiency by IP cut
155   TH1D *fEfficiencyCharmSigD; // charm IP cut eff from signal enhanced MC
156   TH1D *fEfficiencyBeautySigD; // beauty IP cut eff from signal enhanced MC
157   TH1D *fEfficiencyBeautySigesdD; // beauty IP cut eff from signal enhanced MC for esd
158   TH1D *fConversionEff;     // conversion IP cut eff
159   TH1D *fNonHFEEff;         // nonhfe IP cut eff
160   TH1D *fCharmEff;          // charm IP cut eff
161   TH1D *fBeautyEff;         // beauty IP cut eff
162   TH1D *fConversionEffbgc;      // conversion IP cut eff
163   TH1D *fNonHFEEffbgc;          // nonhfe IP cut eff
164   TH1D *fBSpectrum2ndMethod;             // beauty spectrum for 2nd method
165   const char *fkBeauty2ndMethodfilename;      // name of file, which contains beauty spectrum for 2ndmethod
166   Char_t fBeamType;             // beamtype; default -1; pp =0; PbPb=1
167   Bool_t fEtaSyst;              // pp 2.76 TeV (= kTRUE) or 7 TeV (= kFALSE)
168   
169   
170   Int_t fDebugLevel;            // Debug Level
171   Bool_t fWriteToFile;           // Write plots to eps files
172   Bool_t fUnfoldBG;             // flag to unfold backgroud
173   
174   ClassDef(AliHFEBeautySpectrum, 1) 
175     };
176 #endif
177