Change Mult binning scheme
[u/mrichter/AliRoot.git] / PWGDQ / dielectron / AliDielectronBtoJPSItoEle.cxx
CommitLineData
ba15fdfb 1/* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
2 * See cxx source for full Copyright notice */
3
4//-------------------------------------------------------------------------
5// Class AliDielectronBtoJPSItoEle
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//-------------------------------------------------------------------------
11class TH1F ;
12#include "TNtuple.h"
13#include "TMath.h"
14
15#include "AliDielectronBtoJPSItoEleCDFfitFCN.h"
16#include "AliDielectronBtoJPSItoEleCDFfitHandler.h"
17#include "AliDielectronBtoJPSItoEle.h"
18#include "AliLog.h"
19
20ClassImp(AliDielectronBtoJPSItoEle)
21
22//_______________________________________________________________________________
23AliDielectronBtoJPSItoEle::AliDielectronBtoJPSItoEle() :
24fFCNfunction(0),
25fPtBin(0),
5720c765 26fMCtemplate(0),
27fResType("FF")
ba15fdfb 28{
29 //
30 // default constructor
31 //
32}
33//___________________________________________________________________________________
34AliDielectronBtoJPSItoEle::AliDielectronBtoJPSItoEle(const AliDielectronBtoJPSItoEle& source) :
35TNamed(source),
36fFCNfunction(source.fFCNfunction),
37fPtBin(source.fPtBin),
5720c765 38fMCtemplate(source.fMCtemplate),
39fResType(source.fResType)
ba15fdfb 40{
41 //
42 // copy constructor
43 //
44}
45//_________________________________________________________________________________________________
46
47AliDielectronBtoJPSItoEle &AliDielectronBtoJPSItoEle::operator=(const AliDielectronBtoJPSItoEle& source)
48{
49 //
50 // assignment operator
51 //
52 if(&source == this) return *this;
53 fFCNfunction = source.fFCNfunction;
54 fPtBin = source.fPtBin;
55 fMCtemplate = source.fMCtemplate;
56
57 return *this;
58}
59//_________________________________________________________________________________________________
60AliDielectronBtoJPSItoEle::~AliDielectronBtoJPSItoEle()
61{
62 //
63 // destructor
64 //
65 delete fFCNfunction;
66 delete fMCtemplate;
67}
68//_________________________________________________________________________________________________
5720c765 69Int_t AliDielectronBtoJPSItoEle::DoMinimization(Int_t step)
ba15fdfb 70{
71 //
72 // performs the minimization
73 //
5720c765 74 Int_t iret=fFCNfunction->DoMinimization(step);
ba15fdfb 75
76 return iret;
77}
78//_________________________________________________________________________________________________
5720c765 79void AliDielectronBtoJPSItoEle::ReadCandidates(TNtuple* nt, Double_t* &pseudoproper, Double_t* &invmass, Int_t * &typeCand, Int_t& ncand)
ba15fdfb 80{
81 //
82 // Read N-tuple with X and M values
83 //
5720c765 84 Float_t mJPSI = 0; Float_t x = 0; Float_t type = 0;
ba15fdfb 85 Int_t nentries = 0;
86 ncand=0;
5720c765 87 TString arrType[] = {"SS","FS","FF"};
ba15fdfb 88 nt->SetBranchAddress("Mass",&mJPSI);
89 nt->SetBranchAddress("Xdecaytime",&x);
5720c765 90 //
91 if(!nt->GetListOfBranches()->At(2)) {AliInfo("ERROR: branch with candidate type doesn't exist! \n"); return;}
92 nt->SetBranchAddress("Type",&type);
93 //
ba15fdfb 94 nentries = (Int_t)nt->GetEntries();
95 pseudoproper = new Double_t[nentries];
96 invmass = new Double_t[nentries];
5720c765 97 typeCand = new Int_t[nentries];
98
ba15fdfb 99 for(Int_t i = 0; i < nentries; i++) {
100 nt->GetEntry(i);
5720c765 101 if(!fResType.Contains(arrType[(Int_t)type])) continue;
102 pseudoproper[ncand]=(Double_t)x;
103 invmass[ncand]=(Double_t)mJPSI;
104 typeCand[ncand] = (Int_t)type;
ba15fdfb 105 ncand++;
5720c765 106 }
ba15fdfb 107 return;
108}
109//_________________________________________________________________________________________________
110void AliDielectronBtoJPSItoEle::SetCsiMC()
111{
112 //
113 // Sets X distribution used as MC template for JPSI from B
114 //
115 fFCNfunction->LikelihoodPointer()->SetCsiMC(fMCtemplate);
116
117 return;
118}
119//_________________________________________________________________________________________________
5720c765 120void AliDielectronBtoJPSItoEle::SetFitHandler(Double_t* x /*pseudoproper*/, Double_t* m /*inv mass*/, Int_t* type /*type*/, Int_t ncand /*candidates*/)
ba15fdfb 121{
122 //
123 // Create the fit handler object to play with different params of the fitting function
124 //
125
5720c765 126 fFCNfunction = new AliDielectronBtoJPSItoEleCDFfitHandler(x,m,type,ncand);
ba15fdfb 127 if(!fFCNfunction) {
128
129 AliInfo("fFCNfunction not istanziated ---> nothing done");
130 return;
131
132 }
133}