]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGDQ/dielectron/AliDielectronBtoJPSItoEle.cxx
Added macros for K* analysis with TOF
[u/mrichter/AliRoot.git] / PWGDQ / dielectron / AliDielectronBtoJPSItoEle.cxx
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 //-------------------------------------------------------------------------
11 class 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
20 ClassImp(AliDielectronBtoJPSItoEle)
21
22 //_______________________________________________________________________________ 
23 AliDielectronBtoJPSItoEle::AliDielectronBtoJPSItoEle() :
24 fFCNfunction(0),
25 fPtBin(0),
26 fMCtemplate(0),
27 fResType("FF")
28 {
29   //
30   // default constructor
31   //
32 }
33 //___________________________________________________________________________________
34 AliDielectronBtoJPSItoEle::AliDielectronBtoJPSItoEle(const AliDielectronBtoJPSItoEle& source) :
35 TNamed(source),
36 fFCNfunction(source.fFCNfunction),
37 fPtBin(source.fPtBin),
38 fMCtemplate(source.fMCtemplate),
39 fResType(source.fResType)
40 {
41   //
42   // copy constructor
43   //
44 }
45 //_________________________________________________________________________________________________
46
47 AliDielectronBtoJPSItoEle &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 //_________________________________________________________________________________________________
60 AliDielectronBtoJPSItoEle::~AliDielectronBtoJPSItoEle()
61 {
62   //
63   // destructor
64   //
65   delete fFCNfunction;
66   delete fMCtemplate;
67 }
68 //_________________________________________________________________________________________________
69 Int_t AliDielectronBtoJPSItoEle::DoMinimization(Int_t step)
70 {
71   //
72   // performs the minimization
73   //
74   Int_t iret=fFCNfunction->DoMinimization(step);
75
76   return iret;
77 }
78 //_________________________________________________________________________________________________
79 void AliDielectronBtoJPSItoEle::ReadCandidates(TNtuple* nt, Double_t* &pseudoproper, Double_t* &invmass, Int_t * &typeCand, Int_t& ncand)
80 {
81   //
82   // Read N-tuple with X and M values
83   //
84   Float_t mJPSI = 0; Float_t x = 0; Float_t type = 0;
85   Int_t nentries = 0;
86   ncand=0;
87   TString arrType[] = {"SS","FS","FF"};
88   nt->SetBranchAddress("Mass",&mJPSI);
89   nt->SetBranchAddress("Xdecaytime",&x);
90   //
91   if(!nt->GetListOfBranches()->At(2)) {AliInfo("ERROR: branch with candidate type doesn't exist! \n"); return;}
92   nt->SetBranchAddress("Type",&type);
93   //
94   nentries = (Int_t)nt->GetEntries();
95   pseudoproper = new Double_t[nentries];
96   invmass      = new Double_t[nentries];
97   typeCand     = new Int_t[nentries];
98
99   for(Int_t i = 0; i < nentries; i++) {
100       nt->GetEntry(i);
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;
105       ncand++;
106       }
107  return; 
108 }
109 //_________________________________________________________________________________________________
110 void 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 //_________________________________________________________________________________________________
120 void AliDielectronBtoJPSItoEle::SetFitHandler(Double_t* x /*pseudoproper*/, Double_t* m /*inv mass*/, Int_t* type /*type*/, Int_t ncand /*candidates*/) 
121 {
122   //
123   // Create the fit handler object to play with different params of the fitting function
124   //
125
126   fFCNfunction = new AliDielectronBtoJPSItoEleCDFfitHandler(x,m,type,ncand);
127   if(!fFCNfunction) {
128
129      AliInfo("fFCNfunction not istanziated  ---> nothing done");
130      return;
131
132      } 
133 }