]>
Commit | Line | Data |
---|---|---|
c683985a | 1 | #ifndef ALIDIELECTRONBTOJPSITOELECDFFITFCN_H |
2 | #define ALIDIELECTRONBTOJPSITOELECDFFITFCN_H | |
3 | /* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
6 | //_________________________________________________________________________ | |
7 | // Class AliDielectronBtoJPSItoEleCDFfitFCN | |
8 | // Definition of main function used in | |
9 | // unbinned log-likelihood fit for | |
10 | // the channel B -> JPsi + X -> e+e- + X | |
11 | // | |
12 | // Origin: C.Di Giglio | |
13 | // Contact: Carmelo.Digiglio@ba.infn.it , Giuseppe.Bruno@ba.infn.it | |
14 | //_________________________________________________________________________ | |
15 | ||
16 | #include <TNamed.h> | |
17 | #include <TDatabasePDG.h> | |
18 | #include <TH1F.h> | |
19 | ||
20 | ||
21 | class TRandom3; | |
22 | class TF1; | |
23 | ||
24 | //_________________________________________________________________________________________________ | |
25 | class AliDielectronBtoJPSItoEleCDFfitFCN : public TNamed { | |
26 | public: | |
27 | // | |
28 | AliDielectronBtoJPSItoEleCDFfitFCN(); | |
29 | AliDielectronBtoJPSItoEleCDFfitFCN(const AliDielectronBtoJPSItoEleCDFfitFCN& source); | |
30 | AliDielectronBtoJPSItoEleCDFfitFCN& operator=(const AliDielectronBtoJPSItoEleCDFfitFCN& source); | |
31 | virtual ~AliDielectronBtoJPSItoEleCDFfitFCN(); | |
32 | ||
33 | Double_t EvaluateLikelihood(const Double_t* pseudoproperdecaytime, | |
34e8fe1d | 34 | const Double_t* invariantmass, const Double_t* pt, const Int_t* type, Int_t ncand) const; |
c683985a | 35 | |
36 | // getters for parameters | |
37 | Double_t GetResWeight() const { return fParameters[0]; } | |
38 | Double_t GetFPlus() const { return fParameters[1]; } | |
39 | Double_t GetFMinus() const { return fParameters[2]; } | |
40 | Double_t GetFSym() const { return fParameters[3]; } | |
41 | Double_t GetFSym1() const { return fParameters[46]; } | |
42 | Double_t GetLamPlus() const { return fParameters[4]; } | |
43 | Double_t GetLamMinus() const { return fParameters[5]; } | |
44 | Double_t GetLamSym() const { return fParameters[6]; } | |
45 | Double_t GetLamSym1() const { return fParameters[45]; } | |
46 | Double_t GetFractionJpsiFromBeauty() const { return fParameters[7]; } | |
47 | Double_t GetFsig() const { return fParameters[8]; } | |
48 | Double_t GetCrystalBallMmean() const { return fParameters[9]; } | |
49 | Double_t GetCrystalBallNexp() const { return fParameters[10]; } | |
50 | Double_t GetCrystalBallSigma() const { return fParameters[11]; } | |
51 | Double_t GetCrystalBallAlpha() const { return fParameters[12]; } | |
52 | Double_t GetCrystalBallNorm() const { return fParameters[13]; } | |
53 | Double_t GetBkgInvMassNorm() const { return fParameters[14]; } | |
54 | Double_t GetBkgInvMassMean() const { return fParameters[15]; } | |
55 | Double_t GetBkgInvMassSlope() const { return fParameters[16]; } | |
56 | Double_t GetBkgInvMassConst() const { return fParameters[17]; } | |
57 | Double_t GetNormGaus1ResFunc(Int_t type) const { return fParameters[18+(2-type)*9]; } | |
58 | Double_t GetNormGaus2ResFunc(Int_t type) const { return fParameters[19+(2-type)*9]; } | |
59 | Double_t GetIntegralMassSig() const { return fintmMassSig; } | |
60 | Double_t GetIntegralMassBkg() const { return fintmMassBkg; } | |
61 | Double_t GetResMean1(Int_t type) const { return fParameters[20+(2-type)*9]; } | |
62 | Double_t GetResSigma1(Int_t type) const { return fParameters[21+(2-type)*9]; } | |
63 | Double_t GetResMean2(Int_t type) const { return fParameters[22+(2-type)*9]; } | |
64 | Double_t GetResSigma2(Int_t type) const { return fParameters[23+(2-type)*9]; } | |
65 | Double_t GetResAlfa(Int_t type) const { return fParameters[24+(2-type)*9]; } | |
66 | Double_t GetResLambda(Int_t type) const { return fParameters[25+(2-type)*9]; } | |
67 | Double_t GetResNormExp(Int_t type) const { return fParameters[26+(2-type)*9]; } | |
68 | Double_t GetPolyn4() const { return fParameters[47]; } | |
69 | Double_t GetPolyn5() const { return fParameters[48]; } | |
70 | Bool_t GetCrystalBallParam() const { return fCrystalBallParam; } | |
71 | Bool_t GetExponentialParam() const { return fExponentialParam; } | |
72 | TH1F * GetCsiMcHisto() const { return fhCsiMC; } | |
73 | Double_t GetResWeight(Int_t iW) const { return fWeightType[iW]; } | |
74 | ||
75 | // return pointer to likelihood functions | |
76 | TF1* GetCsiMC(Double_t xmin, Double_t xmax,Double_t normalization); | |
77 | TF1* GetResolutionFunc(Double_t xmin, Double_t xmax,Double_t normalization, Double_t pt, Int_t type=2); | |
78 | TF1* GetResolutionFuncAllTypes(Double_t xmin, Double_t xmax,Double_t normalization); | |
79 | TF1* GetFunB(Double_t xmin, Double_t xmax, Double_t normalization, Double_t pt, Int_t type=2, Int_t npx = 5000); | |
80 | TF1* GetFunBAllTypes(Double_t xmin, Double_t xmax, Double_t normalization); | |
81 | TF1* GetEvaluateCDFDecayTimeBkgDistr(Double_t xmin, Double_t xmax, Double_t normalization, Int_t type = 2, Double_t mass = 3.09, Double_t pt = 200.,Int_t npx = 5000); | |
82 | TF1* GetEvaluateCDFDecayTimeBkgDistrAllTypes(Double_t xmin, Double_t xmax, Double_t normalization); | |
83 | TF1* GetEvaluateCDFDecayTimeSigDistr(Double_t xmin, Double_t xmax, Double_t normalization, Double_t type); | |
84 | TF1* GetEvaluateCDFInvMassBkgDistr(Double_t mMin, Double_t mMax, Double_t normalization); | |
85 | TF1* GetEvaluateCDFInvMassSigDistr(Double_t mMin, Double_t mMax, Double_t normalization); | |
86 | TF1* GetEvaluateCDFInvMassTotalDistr(Double_t mMin, Double_t mMax, Double_t normalization); | |
87 | TF1* GetEvaluateCDFDecayTimeTotalDistr(Double_t xMin, Double_t xMax, Double_t normalization,Double_t pt = 200., Int_t type=2); | |
88 | TF1 *GetEvaluateCDFDecayTimeTotalDistrAllTypes(Double_t xMin, Double_t xMax, Double_t normalization); | |
89 | ||
90 | void SetResWeight(Double_t resWgt) {fParameters[0] = resWgt;} | |
91 | void SetFPlus(Double_t plus) {fParameters[1] = plus;} | |
92 | void SetFMinus(Double_t minus) {fParameters[2] = minus;} | |
93 | void SetFSym(Double_t sym) {fParameters[3] = sym;} | |
94 | void SetFSym1(Double_t sym) {fParameters[46] = sym;} | |
95 | void SetLamPlus(Double_t lamplus) {fParameters[4] = lamplus;} | |
96 | void SetLamMinus(Double_t lamminus) {fParameters[5] = lamminus;} | |
97 | void SetLamSym(Double_t lamsym) {fParameters[6] = lamsym;} | |
98 | void SetLamSym1(Double_t lamsym) {fParameters[45] = lamsym;} | |
99 | void SetFractionJpsiFromBeauty(Double_t B) {fParameters[7] = B;} | |
100 | void SetFsig(Double_t Fsig) {fParameters[8] = Fsig;} | |
101 | void SetCrystalBallMmean(Double_t CrystalBallMmean) {fParameters[9] = CrystalBallMmean;} | |
102 | void SetCrystalBallNexp(Double_t CrystalBallNexp) {fParameters[10] = CrystalBallNexp;} | |
103 | void SetCrystalBallSigma(Double_t CrystalBallSigma) {fParameters[11] = CrystalBallSigma;} | |
104 | void SetCrystalBallAlpha(Double_t CrystalBallAlpha) {fParameters[12] = CrystalBallAlpha;} | |
105 | void SetCrystalBallNorm(Double_t CrystalBallNorm) {fParameters[13] = CrystalBallNorm;} | |
106 | void SetBkgInvMassNorm(Double_t BkgInvMassNorm) {fParameters[14] = BkgInvMassNorm;} | |
107 | void SetBkgInvMassMean(Double_t BkgInvMassMean) {fParameters[15] = BkgInvMassMean;} | |
108 | void SetBkgInvMassSlope(Double_t BkgInvMassSlope) {fParameters[16] = BkgInvMassSlope;} | |
109 | void SetBkgInvMassConst(Double_t BkgInvMassConst) {fParameters[17] = BkgInvMassConst;} | |
110 | void SetBkgInvMassPolyn4(Double_t coeffPol4) {fParameters[47] = coeffPol4;} | |
111 | void SetBkgInvMassPolyn5(Double_t coeffPol5) {fParameters[48] = coeffPol5;} | |
112 | void SetNormGaus1ResFunc(Double_t norm1) {fParameters[18] = norm1;} | |
113 | void SetNormGaus2ResFunc(Double_t norm2) {fParameters[19] = norm2;} | |
114 | void SetAllParameters(const Double_t* parameters); | |
115 | void SetIntegralMassSig(Double_t integral) { fintmMassSig = integral; } | |
116 | void SetIntegralMassBkg(Double_t integral) { fintmMassBkg = integral; } | |
117 | void SetCsiMC(const TH1F* MCtemplate) {fhCsiMC = (TH1F*)MCtemplate->Clone("fhCsiMC");} | |
118 | void SetTemplateShift(Double_t shift = 0.){fShiftTemplate = shift;} | |
119 | ||
120 | void SetResolutionConstants(const Double_t* resolutionConst, Int_t type); | |
121 | void SetMassWndHigh(Double_t limit) { fMassWndHigh = TDatabasePDG::Instance()->GetParticle(443)->Mass() + limit ;} | |
122 | void SetMassWndLow(Double_t limit) { fMassWndLow = TDatabasePDG::Instance()->GetParticle(443)->Mass() - limit ;} | |
123 | void SetCrystalBallFunction(Bool_t okCB) {fCrystalBallParam = okCB;} | |
124 | void SetExponentialFunction(Bool_t okExp) {fExponentialParam = okExp;} | |
125 | ||
126 | void SetWeightType(Double_t wFF, Double_t wFS, Double_t wSS) {fWeightType[0]= wSS; fWeightType[1]= wFS; fWeightType[2]= wFF;} | |
127 | ||
128 | void SetChangeResolution(Double_t change){fChangeResolution = change;} | |
129 | void SetChangeMass(Double_t change){fChangeMass = change;} | |
130 | void ComputeMassIntegral(); | |
131 | void ReadMCtemplates(Int_t BinNum); | |
132 | void PrintStatus(); | |
133 | ||
134 | //specific methods for multi-variational fit | |
135 | void SetBkgWeights(Double_t ***bkgWgt){for(int kpt=0; kpt<(fPtWindows->GetSize()-1); kpt++){for(int k=0; k<(fMassWindows->GetSize()-2); k++) { for(int ktype=0; ktype<3; ktype++) fWeights[k][kpt][ktype]=bkgWgt[k][kpt][ktype]; }}} | |
136 | ||
137 | void SetBkgFunction(Int_t massRange,Int_t type, Int_t ptB, TF1 *histBkg){ | |
138 | fFunBkgSaved[ptB][massRange][type] = histBkg; | |
139 | } | |
140 | TF1 *GetBkgFunction(Int_t massRange, Int_t ptB, Int_t type) const {return fFunBkgSaved[ptB][massRange][type];} | |
141 | void SetFunBFunction(Int_t type, Int_t ptB, TF1 *histSec) { fFunBSaved[ptB][type] = histSec; } | |
142 | void SetBackgroundSpecificParameters(Int_t pt, Int_t mb, Int_t tp); | |
143 | void SetExtrapolationRegion(Int_t extrRegion){fSignalBinForExtrapolation = extrRegion;} void SetLoadFunction(Bool_t loadFunc) { fLoadFunctions = loadFunc;} | |
144 | void SetMultivariateFit(Bool_t multVar) { fMultivariate = multVar;} | |
145 | Bool_t GetMultivariate() const { return fMultivariate;} | |
146 | void SetFunctionsSaved(Int_t npxFunB=5000, Int_t npxFunBkg=5000, Double_t funBLimits = 20000., Double_t funBkgLimits = 40000., Int_t signalRegion=2); | |
147 | void SetResParams(Double_t ***pars){ fResParams = pars;} | |
148 | void SetBkgParams(Float_t ****pars){ fBkgParams = pars;} | |
149 | void SetMassWindows(TArrayD *msWnd){ fMassWindows = msWnd;} | |
150 | void SetPtWindows(TArrayD *ptWnd){ fPtWindows = ptWnd;} | |
151 | void InitializeFunctions(Int_t ptSize, Int_t massSize); | |
152 | Double_t EvaluateCDFInvMassSigDistr(Double_t m) const ; | |
153 | Double_t EvaluateCDFInvMassBkgDistr(Double_t m) const; | |
154 | Double_t ResolutionFunc(Double_t x, Double_t pt, Int_t type) const; | |
155 | Double_t EvaluateCDFDecayTimeBkgDistr(Double_t x, Int_t type, Double_t m=3.09, Double_t pt=200.) const ; | |
156 | ||
157 | ||
158 | private: | |
159 | Double_t fParameters[49]; /* par[0] = weightRes; | |
160 | par[1] = fPos; | |
161 | par[2] = fNeg; | |
162 | par[3] = fSym | |
163 | par[4] = fOneOvLamPlus; | |
164 | par[5] = fOneOvLamMinus; | |
165 | par[6] = fOneOvLamSym; | |
166 | par[7] = fFractionJpsiFromBeauty; | |
167 | par[8] = fFsig; | |
168 | par[9] = fCrystalBallMmean; | |
169 | par[10] = fCrystalBallNexp; | |
170 | par[11] = fCrystalBallSigma; | |
171 | par[12] = fCrystalBallAlpha; | |
172 | par[13] = fCrystalBallNorm; | |
173 | par[14] = fBkgNorm; | |
174 | par[15] = fBkgMean; | |
175 | par[16] = fBkgSlope; | |
176 | par[17] = fBkgConst; | |
177 | par[18] = norm1Gaus; // resolution param used for First-First | |
178 | par[19] = norm2Gaus; | |
179 | par[20] = fMean1ResFunc; | |
180 | par[21] = fSigma1ResFunc; | |
181 | par[22] = fMean2ResFunc; | |
182 | par[23] = fSigma2ResFunc; | |
183 | par[24] = fResAlfa; | |
184 | par[25] = fResLambda; | |
185 | par[26] = fResNormExp; | |
186 | par[27] = norm1Gaus; // resolution param used for First-Second | |
187 | par[28] = norm2Gaus; | |
188 | par[29] = fMean1ResFunc; | |
189 | par[30] = fSigma1ResFunc; | |
190 | par[31] = fMean2ResFunc; | |
191 | par[32] = fSigma2ResFunc; | |
192 | par[33] = fResAlfa; | |
193 | par[34] = fResLambda; | |
194 | par[35] = fResNormExp; | |
195 | par[36] = norm1Gaus; // resolution param used for Second-Second | |
196 | par[37] = norm2Gaus; | |
197 | par[38] = fMean1ResFunc; | |
198 | par[39] = fSigma1ResFunc; | |
199 | par[40] = fMean2ResFunc; | |
200 | par[41] = fSigma2ResFunc; | |
201 | par[42] = fResAlfa; | |
202 | par[43] = fResLambda; | |
203 | par[44] = fResNormExp; | |
204 | ------------------------------> parameters to describe x and m à la CDF | |
205 | // additional parameters below (added for PbPb analysis): if not used should be fixed | |
206 | // by the FitHandler pointer | |
207 | par[45] = fOneOvLamSym1; // additional parameter for background | |
208 | par[46] = fSym1; // additional parameter for background | |
209 | par[47] = fPolyn4; //additional parameter for inv. mass background | |
210 | par[48] = fPolyn5; //additional parameter for inv. mass background */ | |
211 | ||
212 | Double_t fFPlus; // parameter of the log-likelihood function | |
213 | Double_t fFMinus; // slopes of the x distributions of the background | |
214 | Double_t fFSym; // functions | |
215 | ||
216 | Double_t fintmMassSig; // integral of invariant mass distribution for the signal | |
217 | Double_t fintmMassBkg; // integral of invariant mass distribution for the bkg | |
218 | ||
219 | TH1F *fhCsiMC; // X distribution used as MC template for JPSI from B | |
220 | ||
221 | Double_t fShiftTemplate; // to shift the MC template | |
222 | Double_t fMassWndHigh; // JPSI Mass window higher limit | |
223 | Double_t fMassWndLow; // JPSI Mass window lower limit | |
224 | Bool_t fCrystalBallParam; // Boolean to switch to Crystall Ball parameterisation | |
225 | ||
226 | Double_t fWeightType[3]; // vector with weights of candidates types (used to draw functions) | |
227 | Double_t fChangeResolution; // constant to change the RMS of the resolution function | |
228 | Double_t fChangeMass; // constant to change the RMS of the signal mass function | |
229 | ||
230 | // data members for multivariate fit | |
231 | Double_t ***fWeights; // weights to interpolate bkg shape in pt, mass, type bins under signal region | |
232 | Bool_t fLoadFunctions; // boolean to load functions saved | |
233 | Bool_t fMultivariate; // switch-on multivariate fit | |
234 | TF1 ***fFunBSaved; // pointers to save functions for x of non-prompt J/psi in pt, mass, type bins | |
235 | TF1 ****fFunBkgSaved; // pointers to save functions for x of background in pt, mass, type bins | |
236 | Double_t ***fResParams; // resolution function parameters in pt and type bins | |
237 | Float_t ****fBkgParams; // x background parameters in pt, mass, type bins | |
238 | TArrayD *fMassWindows; // limits for invariant mass bins | |
239 | TArrayD *fPtWindows; // limits for pt bins | |
240 | Bool_t fExponentialParam; // Boolean to switch to Exponential parameterisation | |
241 | Double_t fSignalBinForExtrapolation; // inv. mass region in which extrapolate the background shape | |
242 | // starting from background shapes in the near inv. mass regions | |
243 | ||
244 | ||
245 | Double_t EvaluateCDFfunc(Double_t x, Double_t m, Double_t pt, Int_t type) const ; | |
246 | Double_t EvaluateCDFfuncNorm(Double_t x, Double_t m, Double_t pt, Int_t type) const ; | |
247 | Double_t EvaluateCDFfuncSignalPart(Double_t x, Double_t m, Double_t pt, Int_t type) const ; // Signal part | |
248 | Double_t EvaluateCDFDecayTimeSigDistr(Double_t x, Double_t pt, Int_t type) const ; | |
249 | Double_t EvaluateCDFDecayTimeSigDistrFunc(const Double_t* x, const Double_t *par) const { return par[0]*EvaluateCDFDecayTimeSigDistr(x[0],par[1],(Int_t)par[2]);} | |
250 | Double_t EvaluateCDFInvMassSigDistrFunc(const Double_t* x, const Double_t *par) const {return par[0]*EvaluateCDFInvMassSigDistr(x[0])/fintmMassSig;} | |
251 | Double_t EvaluateCDFfuncBkgPart(Double_t x,Double_t m, Double_t pt, Int_t type) const ; // Background part | |
252 | Double_t EvaluateCDFDecayTimeBkgDistrFunc(const Double_t* x, const Double_t *par) const { return EvaluateCDFDecayTimeBkgDistr(x[0],(Int_t)par[1],par[2],par[3])*par[0];} | |
253 | Double_t EvaluateCDFDecayTimeBkgDistrFuncAllTypes(const Double_t* x, const Double_t *par) const {return (fWeightType[2]*EvaluateCDFDecayTimeBkgDistr(x[0],2)+fWeightType[1]*EvaluateCDFDecayTimeBkgDistr(x[0],1)+fWeightType[0]*EvaluateCDFDecayTimeBkgDistr(x[0],0))*par[0];} | |
254 | Double_t EvaluateCDFInvMassBkgDistrFunc(const Double_t* x, const Double_t *par) const {return par[0]*EvaluateCDFInvMassBkgDistr(x[0])/fintmMassBkg;} | |
255 | ||
256 | Double_t EvaluateCDFInvMassTotalDistr(const Double_t* x, const Double_t *par) const; | |
257 | Double_t EvaluateCDFDecayTimeTotalDistr(const Double_t* x, const Double_t *par) const; | |
258 | //// | |
259 | Double_t EvaluateCDFDecayTimeTotalDistrAllTypes(const Double_t* x, const Double_t *par) const; | |
260 | ||
261 | Double_t FunB(Double_t x, Double_t pt, Int_t type) const; | |
262 | Double_t FunBfunc(const Double_t *x, const Double_t *par) const {return FunB(x[0],par[1],(Int_t)par[2])*par[0];} | |
263 | Double_t FunBfuncAllTypes(const Double_t *x, const Double_t *par) const {return (fWeightType[2]*FunB(x[0],200.,2)+fWeightType[1]*FunB(x[0],200.,1)+fWeightType[0]*FunB(x[0],200.,0))*par[0];} | |
264 | Double_t FunP(Double_t x, Double_t pt,Int_t type) const ; | |
265 | Double_t CsiMC(Double_t x) const; | |
266 | Double_t CsiMCfunc(const Double_t* x, const Double_t *par) const { return CsiMC(x[0])*par[0];} | |
267 | Double_t FunBkgPos(Double_t x, Double_t pt, Int_t type) const ; | |
268 | Double_t FunBkgNeg(Double_t x, Double_t pt, Int_t type) const ; | |
269 | Double_t FunBkgSym(Double_t x, Double_t pt, Int_t type) const ; | |
270 | Double_t FunBkgSym1(Double_t x, Double_t pt, Int_t type) const ; | |
271 | Double_t ResolutionFuncf(const Double_t* x, const Double_t *par) const { return ResolutionFunc(x[0],par[1],(Int_t)par[2])*par[0];} | |
272 | Double_t ResolutionFuncAllTypes(const Double_t* x, const Double_t *par) const { return (fWeightType[2]*ResolutionFunc(x[0],200.,2)+fWeightType[1]*ResolutionFunc(x[0],200.,1)+fWeightType[0]*ResolutionFunc(x[0],200.,0))*par[0]; } | |
273 | ||
274 | // private methods for multivariate fit | |
275 | Double_t EvaluateCDFDecayTimeBkgDistrSaved(Double_t x, Int_t type, Double_t m=3.09, Double_t pt = 200.) const ; | |
276 | Double_t EvaluateCDFDecayTimeBkgDistrDifferential(Double_t x, Int_t type, Double_t m=3.09, Double_t pt = 200.) const; | |
277 | Double_t FunBsaved(Double_t x, Double_t pt, Int_t type) const; | |
278 | ||
279 | ClassDef (AliDielectronBtoJPSItoEleCDFfitFCN,1); // Unbinned log-likelihood fit | |
280 | ||
281 | }; | |
282 | ||
283 | #endif |