]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGDQ/dielectron/AliDielectronBtoJPSItoEle.cxx
including switch to set on/off iso-track core removal, cleaning and bug fix
[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 fMCtemplate(0),
26 fResType("FF")
27 {
28   //
29   // default constructor
30   //
31 }
32 //___________________________________________________________________________________
33 AliDielectronBtoJPSItoEle::AliDielectronBtoJPSItoEle(const AliDielectronBtoJPSItoEle& source) :
34 TNamed(source),
35 fFCNfunction(source.fFCNfunction),
36 fMCtemplate(source.fMCtemplate),
37 fResType(source.fResType)
38 {
39   //
40   // copy constructor
41   //
42 }
43 //_________________________________________________________________________________________________
44
45 AliDielectronBtoJPSItoEle &AliDielectronBtoJPSItoEle::operator=(const AliDielectronBtoJPSItoEle& source)
46 {
47   //
48   // assignment operator
49   //
50   if(&source == this) return *this;
51   fFCNfunction = source.fFCNfunction;
52   fMCtemplate = source.fMCtemplate;
53
54   return *this;
55 }
56 //_________________________________________________________________________________________________
57 AliDielectronBtoJPSItoEle::~AliDielectronBtoJPSItoEle()
58 {
59   //
60   // destructor
61   //
62   delete fFCNfunction;
63   delete fMCtemplate;
64 }
65 //_________________________________________________________________________________________________
66 Int_t AliDielectronBtoJPSItoEle::DoMinimization(Int_t step)
67 {
68   //
69   // performs the minimization
70   //
71   Int_t iret=fFCNfunction->DoMinimization(step);
72
73   return iret;
74 }
75 //_________________________________________________________________________________________________
76 void AliDielectronBtoJPSItoEle::ReadCandidates(TNtuple* nt, Double_t* &pseudoproper, Double_t* &invmass, Double_t* &pt, Int_t * &typeCand, Int_t& ncand, Double_t massLow, Double_t massUp, Double_t ptLow, Double_t ptUp)
77 {
78   //
79   // Read N-tuple with X and M values
80   //
81   Float_t mJPSI = 0; Float_t x = 0; Float_t type = 0; Float_t transvMom = 0.;
82   Int_t nentries = 0;
83   ncand=0;
84   TString arrType[] = {"SS","FS","FF"};
85   nt->SetBranchAddress("Mass",&mJPSI);
86   nt->SetBranchAddress("Xdecaytime",&x);
87   nt->SetBranchAddress("Pt",&transvMom);
88   //
89   if(!nt->GetListOfBranches()->At(2)) {AliInfo("ERROR: branch with candidate type doesn't exist! \n"); return;}
90   nt->SetBranchAddress("Type",&type);
91   //
92   nentries = (Int_t)nt->GetEntries();
93   pseudoproper = new Double_t[nentries];
94   invmass      = new Double_t[nentries];
95   pt           = new Double_t[nentries];
96   typeCand     = new Int_t[nentries];
97
98   for(Int_t i = 0; i < nentries; i++) {
99       nt->GetEntry(i);
100       if(!fResType.Contains(arrType[(Int_t)type])) continue;
101       if(massUp > massLow && massLow > 0) { if(mJPSI < massLow || mJPSI >massUp) continue; } 
102       if(ptUp > ptLow && ptLow > 0) { if(transvMom < ptLow || transvMom > ptUp) continue; } 
103       pseudoproper[ncand]=(Double_t)x;
104       invmass[ncand]=(Double_t)mJPSI;
105       pt[ncand]=(Double_t)transvMom;
106       typeCand[ncand] = (Int_t)type;
107       ncand++;
108       }
109  return; 
110 }
111 //_________________________________________________________________________________________________
112 void AliDielectronBtoJPSItoEle::SetCsiMC()
113 {
114   //
115   // Sets X distribution used as MC template for JPSI from B
116   //
117   fFCNfunction->LikelihoodPointer()->SetCsiMC(fMCtemplate);
118
119   return;
120 }
121 //_________________________________________________________________________________________________
122 void AliDielectronBtoJPSItoEle::SetFitHandler(Double_t* x /*pseudoproper*/, Double_t* m /*inv mass*/, Double_t* pt /*pt*/, Int_t* type /*type*/, Int_t ncand /*candidates*/) 
123 {
124   //
125   // Create the fit handler object to play with different params of the fitting function
126   //
127
128   fFCNfunction = new AliDielectronBtoJPSItoEleCDFfitHandler(x,m,pt,type,ncand);
129   if(!fFCNfunction) {
130
131      AliInfo("fFCNfunction not istanziated  ---> nothing done");
132      return;
133
134      } 
135 }