]>
Commit | Line | Data |
---|---|---|
7b54a483 | 1 | /* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. * |
2 | * See cxx source for full Copyright notice */ | |
3 | ||
4 | //------------------------------------------------------------------------- | |
5 | // Class AliAnalysisBtoJPSItoEle | |
6 | // Unbinned log-likelihood fit analysis class | |
7 | // | |
8 | // Origin: C.Di Giglio | |
9 | // Contact: Carmelo.Digiglio@ba.infn.it , giuseppe.bruno@ba.infn.it | |
10 | //------------------------------------------------------------------------- | |
11 | class TH1F ; | |
12 | #include "TNtuple.h" | |
13 | #include "TMath.h" | |
14 | ||
15 | #include "AliBtoJPSItoEleCDFfitFCN.h" | |
16 | #include "AliBtoJPSItoEleCDFfitHandler.h" | |
17 | #include "AliAnalysisBtoJPSItoEle.h" | |
18 | #include "AliLog.h" | |
19 | ||
20 | ClassImp(AliAnalysisBtoJPSItoEle) | |
21 | ||
22 | //_______________________________________________________________________________ | |
23 | AliAnalysisBtoJPSItoEle::AliAnalysisBtoJPSItoEle() : | |
24 | fFCNfunction(0), | |
25 | fPtBin(0), | |
26 | fMCtemplate(0) | |
27 | { | |
28 | // | |
29 | // default constructor | |
30 | // | |
31 | } | |
32 | //___________________________________________________________________________________ | |
33 | AliAnalysisBtoJPSItoEle::AliAnalysisBtoJPSItoEle(const AliAnalysisBtoJPSItoEle& source) : | |
34 | TNamed(source), | |
35 | fFCNfunction(source.fFCNfunction), | |
36 | fPtBin(source.fPtBin), | |
37 | fMCtemplate(source.fMCtemplate) | |
38 | { | |
39 | // | |
40 | // copy constructor | |
41 | // | |
42 | } | |
43 | //_________________________________________________________________________________________________ | |
44 | ||
45 | AliAnalysisBtoJPSItoEle &AliAnalysisBtoJPSItoEle::operator=(const AliAnalysisBtoJPSItoEle& source) | |
46 | { | |
47 | // | |
48 | // assignment operator | |
49 | // | |
50 | if(&source == this) return *this; | |
51 | fFCNfunction = source.fFCNfunction; | |
52 | fPtBin = source.fPtBin; | |
53 | fMCtemplate = source.fMCtemplate; | |
54 | ||
55 | return *this; | |
56 | } | |
57 | //_________________________________________________________________________________________________ | |
58 | AliAnalysisBtoJPSItoEle::~AliAnalysisBtoJPSItoEle() | |
59 | { | |
60 | // | |
61 | // destructor | |
62 | // | |
63 | delete fFCNfunction; | |
64 | delete fMCtemplate; | |
65 | } | |
66 | //_________________________________________________________________________________________________ | |
67 | Int_t AliAnalysisBtoJPSItoEle::DoMinimization(Double_t* x, | |
68 | Double_t* m, Int_t ncand) | |
69 | { | |
70 | // | |
71 | // performs the minimization | |
72 | // | |
73 | AliInfo(Form("Number of candidates used for the minimisation is %d",ncand)); | |
74 | fFCNfunction = new AliBtoJPSItoEleCDFfitHandler(x,m,ncand); | |
75 | SetResolutionConstants(fPtBin); | |
76 | SetCsiMC(fMCtemplate); | |
77 | fFCNfunction->SetErrorDef(0.5); // tells Minuit that the error interval is the one in which | |
78 | // the function differs from the minimum for less than setted value | |
79 | Int_t iret=fFCNfunction->DoMinimization(); | |
80 | ||
81 | return iret; | |
82 | } | |
83 | //_________________________________________________________________________________________________ | |
84 | void AliAnalysisBtoJPSItoEle::SetResolutionConstants(Int_t BinNum) | |
85 | { | |
86 | // | |
87 | // sets constants for parametrized resolution function | |
88 | // | |
89 | if(!fFCNfunction) { | |
90 | AliInfo("fFCNfunction not istanziated ---> nothing done"); | |
91 | return; | |
92 | } | |
93 | AliInfo("Call likelihood SetResolutionConstants method ---> OK"); | |
94 | AliBtoJPSItoEleCDFfitFCN* loglikePnt = fFCNfunction->LikelihoodPointer(); | |
95 | if(!loglikePnt) { | |
96 | AliWarning("Pointer to AliBtoJPSItoEleCDFfitFCN class not found!"); | |
97 | return; | |
98 | } | |
99 | loglikePnt->SetResolutionConstants(BinNum); | |
100 | } | |
101 | //_________________________________________________________________________________________________ | |
102 | void AliAnalysisBtoJPSItoEle::ReadCandidates(TNtuple* nt, Double_t* &pseudoproper,Double_t* &invmass, Int_t& ncand) | |
103 | { | |
104 | // | |
105 | // Read N-tuple with X and M values | |
106 | // | |
107 | Float_t mJPSI = 0; Float_t x = 0; | |
108 | Int_t nentries = 0; | |
109 | ncand=0; | |
110 | nt->SetBranchAddress("Mass",&mJPSI); | |
111 | nt->SetBranchAddress("Xdecaytime",&x); | |
112 | nentries = (Int_t)nt->GetEntries(); | |
113 | pseudoproper = new Double_t[nentries]; | |
114 | invmass = new Double_t[nentries]; | |
115 | for(Int_t i = 0; i < nentries; i++) { | |
116 | nt->GetEntry(i); | |
117 | ncand++; | |
118 | pseudoproper[i]=(Double_t)(10000*x); | |
119 | invmass[i]=(Double_t)mJPSI; | |
120 | } | |
121 | ||
122 | return; | |
123 | } | |
124 | //_________________________________________________________________________________________________ | |
125 | void AliAnalysisBtoJPSItoEle::SetCsiMC(TH1F* MCtemplates) | |
126 | { | |
127 | // | |
128 | // Sets X distribution used as MC template for JPSI from B | |
129 | // | |
130 | fFCNfunction->LikelihoodPointer()->SetCsiMC(MCtemplates); | |
131 | ||
132 | return; | |
133 | } | |
134 | //_________________________________________________________________________________________________ |