]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGDQ/dielectron/AliDielectronBtoJPSItoEle.cxx
o update dielectron package
[u/mrichter/AliRoot.git] / PWGDQ / dielectron / AliDielectronBtoJPSItoEle.cxx
index be4446c115b7c9bfd53b0f50e5157a3396383b3f..85502375447efa9647409f492dce7df8e587b80e 100644 (file)
@@ -23,7 +23,8 @@ ClassImp(AliDielectronBtoJPSItoEle)
 AliDielectronBtoJPSItoEle::AliDielectronBtoJPSItoEle() :
 fFCNfunction(0),
 fPtBin(0),
-fMCtemplate(0)
+fMCtemplate(0),
+fResType("FF")
 {
   //
   // default constructor
@@ -34,7 +35,8 @@ AliDielectronBtoJPSItoEle::AliDielectronBtoJPSItoEle(const AliDielectronBtoJPSIt
 TNamed(source),
 fFCNfunction(source.fFCNfunction),
 fPtBin(source.fPtBin),
-fMCtemplate(source.fMCtemplate)
+fMCtemplate(source.fMCtemplate),
+fResType(source.fResType)
 {
   //
   // copy constructor
@@ -64,36 +66,44 @@ AliDielectronBtoJPSItoEle::~AliDielectronBtoJPSItoEle()
   delete fMCtemplate;
 }
 //_________________________________________________________________________________________________
-Int_t AliDielectronBtoJPSItoEle::DoMinimization()
+Int_t AliDielectronBtoJPSItoEle::DoMinimization(Int_t step)
 {
   //
   // performs the minimization
   //
-  Int_t iret=fFCNfunction->DoMinimization();
+  Int_t iret=fFCNfunction->DoMinimization(step);
 
   return iret;
 }
 //_________________________________________________________________________________________________
-void AliDielectronBtoJPSItoEle::ReadCandidates(TNtuple* nt, Double_t* &pseudoproper,Double_t* &invmass, Int_t& ncand)
+void AliDielectronBtoJPSItoEle::ReadCandidates(TNtuple* nt, Double_t* &pseudoproper, Double_t* &invmass, Int_t * &typeCand, Int_t& ncand)
 {
   //
   // Read N-tuple with X and M values
   //
-  Float_t mJPSI = 0; Float_t x = 0;
+  Float_t mJPSI = 0; Float_t x = 0; Float_t type = 0;
   Int_t nentries = 0;
   ncand=0;
+  TString arrType[] = {"SS","FS","FF"};
   nt->SetBranchAddress("Mass",&mJPSI);
   nt->SetBranchAddress("Xdecaytime",&x);
+  //
+  if(!nt->GetListOfBranches()->At(2)) {AliInfo("ERROR: branch with candidate type doesn't exist! \n"); return;}
+  nt->SetBranchAddress("Type",&type);
+  //
   nentries = (Int_t)nt->GetEntries();
   pseudoproper = new Double_t[nentries];
   invmass      = new Double_t[nentries];
+  typeCand     = new Int_t[nentries];
+
   for(Int_t i = 0; i < nentries; i++) {
       nt->GetEntry(i);
+      if(!fResType.Contains(arrType[(Int_t)type])) continue;
+      pseudoproper[ncand]=(Double_t)x;
+      invmass[ncand]=(Double_t)mJPSI;
+      typeCand[ncand] = (Int_t)type;
       ncand++;
-      pseudoproper[i]=(Double_t)(10000*x);
-      invmass[i]=(Double_t)mJPSI;
-    }
-
+      }
  return; 
 }
 //_________________________________________________________________________________________________
@@ -107,13 +117,13 @@ void AliDielectronBtoJPSItoEle::SetCsiMC()
   return;
 }
 //_________________________________________________________________________________________________
-void AliDielectronBtoJPSItoEle::SetFitHandler(Double_t* x /*pseudoproper*/, Double_t* m /*inv mass*/, Int_t ncand /*candidates*/) 
+void AliDielectronBtoJPSItoEle::SetFitHandler(Double_t* x /*pseudoproper*/, Double_t* m /*inv mass*/, Int_t* type /*type*/, Int_t ncand /*candidates*/) 
 {
   //
   // Create the fit handler object to play with different params of the fitting function
   //
 
-  fFCNfunction = new AliDielectronBtoJPSItoEleCDFfitHandler(x,m,ncand);
+  fFCNfunction = new AliDielectronBtoJPSItoEleCDFfitHandler(x,m,type,ncand);
   if(!fFCNfunction) {
 
      AliInfo("fFCNfunction not istanziated  ---> nothing done");