Dplus and Ds tasks use the new cuts classes (Francesco, Renu, Giacomo)
authordainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 15 Apr 2010 21:14:07 +0000 (21:14 +0000)
committerdainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 15 Apr 2010 21:14:07 +0000 (21:14 +0000)
PWG3/vertexingHF/AddTaskDplus.C
PWG3/vertexingHF/AddTaskDs.C
PWG3/vertexingHF/AliAnalysisTaskSEDplus.cxx
PWG3/vertexingHF/AliAnalysisTaskSEDplus.h
PWG3/vertexingHF/AliAnalysisTaskSEDs.cxx
PWG3/vertexingHF/AliAnalysisTaskSEDs.h

index e47b85dcfd89288e34cc4358ea4b50c433c45f32..8a1a6bb644f45eedd68bfa42d7941c2ee6a90308 100644 (file)
@@ -15,23 +15,136 @@ AliAnalysisTaskSEDplus *AddTaskDplus(Bool_t storeNtuple=kFALSE,
     return NULL;
   }
 
+  //ptbins
+  const Int_t nptbins=4;
+  Float_t* ptbins;
+  ptbins=new Float_t[nptbins+1];
+  ptbins[0]=0.;
+  ptbins[1]=2.;
+  ptbins[2]=3.;
+  ptbins[3]=5.;
+  ptbins[4]=99999.;
+  const Int_t nvars=12;
 
-  // Aanalysis task                                                                                                                     
-  AliAnalysisTaskSEDplus *dplusTask = new AliAnalysisTaskSEDplus("DplusAnalysis",storeNtuple);
+  
+
+
+  Float_t** prodcutsval;
+  prodcutsval=new Float_t*[nvars];
+  for(Int_t ic=0;ic<nvars;ic++){prodcutsval[ic]=new Float_t[nptbins];}  
+  for(Int_t ipt=0;ipt<nptbins;ipt++){
+    prodcutsval[0][ipt]=0.2;
+    prodcutsval[1][ipt]=0.4;
+    prodcutsval[2][ipt]=0.4;
+    prodcutsval[3][ipt]=0.;
+    prodcutsval[4][ipt]=0.;
+    prodcutsval[5][ipt]=0.001;
+    prodcutsval[6][ipt]=0.006;
+    prodcutsval[7][ipt]=0.02;
+    prodcutsval[8][ipt]=0.;
+    prodcutsval[9][ipt]=0.85;
+    prodcutsval[10][ipt]=0.;
+    prodcutsval[11][ipt]=10000000.0;
+    
+  }
+
+
+
+ Float_t** anacutsval;
+  anacutsval=new Float_t*[nvars];
+  for(Int_t ic=0;ic<nvars;ic++){anacutsval[ic]=new Float_t[nptbins];}
+ //Double_t cutsDplus[12]={0.2,0.4,0.4,0.,0.,0.01,0.06,0.02,0.,0.85,0.,10000000000.};
+   Int_t ic=0;
+   for(Int_t ipt=0;ipt<nptbins;ipt++){
+     anacutsval[ic][ipt]=0.2;
+   }
+   Int_t ic=1;
+   for(Int_t ipt=0;ipt<nptbins;ipt++){
+     anacutsval[ic][ipt]=0.4;
+   }
+   Int_t ic=2;
+   for(Int_t ipt=0;ipt<nptbins;ipt++){
+     anacutsval[ic][ipt]=0.4;
+   }
+   Int_t ic=3;
+   for(Int_t ipt=0;ipt<nptbins;ipt++){
+     anacutsval[ic][ipt]=0.;
+   }
+   Int_t ic=4;
+   for(Int_t ipt=0;ipt<nptbins;ipt++){
+     anacutsval[ic][ipt]=0.;
+   }
+   Int_t ic=5;
+   for(Int_t ipt=0;ipt<nptbins;ipt++){
+     anacutsval[ic][ipt]=0.01;
+   }
+   Int_t ic=11;
+   for(Int_t ipt=0;ipt<nptbins;ipt++){
+     anacutsval[ic][ipt]=10000000000.;
+   }
+   anacutsval[6][0]=0.022100;
+   anacutsval[6][1]=0.034;
+   anacutsval[6][2]=0.020667;
+   anacutsval[6][3]=0.023333;
+
+   anacutsval[7][0]=0.08;
+   anacutsval[7][1]=0.09;
+   anacutsval[7][2]=0.095;
+   anacutsval[7][3]=0.115;
+
+   anacutsval[8][0]=0.5;
+   anacutsval[8][1]=1.0;
+   anacutsval[8][2]=0.5;
+   anacutsval[8][3]=0.5;
+
+   anacutsval[9][0]=0.979;
+   anacutsval[9][1]=0.9975;
+   anacutsval[9][2]=0.995;
+   anacutsval[9][3]=0.9975;
+
+   anacutsval[10][0]=0.0055;
+   anacutsval[10][1]=0.0028;
+   anacutsval[10][2]=0.000883;
+   anacutsval[10][3]=0.000883;
+
+
+
+//Production cuts
+
+  AliRDHFCutsDplustoKpipi *prodcuts = new AliRDHFCutsDplustoKpipi();
+  prodcuts->SetPtBins(nptbins+1,ptbins);
+  prodcuts->SetCuts(nvars,nptbins,prodcutsval);
+
+  //Analysis cuts
+  AliRDHFCutsDplustoKpipi *analysiscuts = new AliRDHFCutsDplustoKpipi();
+  analysiscuts->SetPtBins(nptbins+1,ptbins);
+  analysiscuts->SetCuts(nvars,nptbins,anacutsval);
+
+
+  // Aanalysis task
+  AliAnalysisTaskSEDplus *dplusTask = new AliAnalysisTaskSEDplus("DplusAnalysis",analysiscuts,prodcuts,storeNtuple);
   dplusTask->SetReadMC(readMC);
   dplusTask->SetDoLikeSign(kTRUE);
   dplusTask->SetDebugLevel(0);
+
   mgr->AddTask(dplusTask);
 
-  //                                                                                                                                    
-  // Create containers for input/output                                                                                                 
+ // Create containers for input/output 
+
   AliAnalysisDataContainer *cinputDplus = mgr->CreateContainer("cinputDplus",TChain::Class(),
                                                           AliAnalysisManager::kInputContainer);
   TString outputfile = AliAnalysisManager::GetCommonFileName();
   outputfile += ":PWG3_D2H_InvMassDplus";
+
+ AliAnalysisDataContainer *coutputDplusCuts = mgr->CreateContainer("coutputDplusCuts",TList::Class(),
+                                                            AliAnalysisManager::kOutputContainer,
+                                                               outputfile.Data());
   AliAnalysisDataContainer *coutputDplus = mgr->CreateContainer("coutputDplus",TList::Class(),
                                                            AliAnalysisManager::kOutputContainer,
                                                                outputfile.Data());
+
   if(storeNtuple){
     AliAnalysisDataContainer *coutputDplus2 = mgr->CreateContainer("coutputDplus2",TNtuple::Class(),
                                                            AliAnalysisManager::kOutputContainer,
@@ -42,9 +155,11 @@ AliAnalysisTaskSEDplus *AddTaskDplus(Bool_t storeNtuple=kFALSE,
   mgr->ConnectInput(dplusTask,0,mgr->GetCommonInputContainer());
 
   mgr->ConnectOutput(dplusTask,1,coutputDplus);
+
+  mgr->ConnectOutput(dplusTask,2,coutputDplusCuts);
   
   if(storeNtuple){
-    mgr->ConnectOutput(dplusTask,2,coutputDplus2);
+    mgr->ConnectOutput(dplusTask,3,coutputDplus2);
   }
   return dplusTask;
 }
index 55cec4b071e3ff36915a0ab4f818bea194f2d196..67fdcf9835c5f834ef2aa9d6f326dfb1f5922771 100644 (file)
@@ -11,8 +11,62 @@ AliAnalysisTaskSEDs *AddTaskDs(Bool_t readMC=kTRUE)
   }
 
 
-  // Aanalysis task                                                                                                                     
-  AliAnalysisTaskSEDs *dsTask = new AliAnalysisTaskSEDs("DsAnalysis");
+
+  //ptbins
+  const Int_t nptbins=4;
+  Float_t ptbins[nptbins+1]={0.,2.,3.,5.,99999.};
+
+  //setting cut values
+  Int_t nvars=14;
+  Float_t** ancutsval;
+  ancutsval=new Float_t*[nvars];
+  for(Int_t ic=0;ic<nvars;ic++){ancutsval[ic]=new Float_t[nptbins];}  
+  for(Int_t ipt=0;ipt<nptbins;ipt++){
+    ancutsval[0][ipt]=0.2;
+    ancutsval[1][ipt]=0.4;
+    ancutsval[2][ipt]=0.4;
+    ancutsval[3][ipt]=0.;
+    ancutsval[4][ipt]=0.;
+    ancutsval[5][ipt]=0.005;
+    ancutsval[6][ipt]=0.038;
+    ancutsval[7][ipt]=0.;
+    ancutsval[8][ipt]=0.;
+    ancutsval[9][ipt]=0.95;
+    ancutsval[10][ipt]=0.;
+    ancutsval[11][ipt]=0.1;
+    ancutsval[12][ipt]=0.004;
+    ancutsval[13][ipt]=0.035;
+  }
+  Float_t** prcutsval;
+  prcutsval=new Float_t*[nvars];
+  for(Int_t ic=0;ic<nvars;ic++){prcutsval[ic]=new Float_t[nptbins];}  
+  for(Int_t ipt=0;ipt<nptbins;ipt++){
+    prcutsval[0][ipt]=0.2;
+    prcutsval[1][ipt]=0.4;
+    prcutsval[2][ipt]=0.4;
+    prcutsval[3][ipt]=0.;
+    prcutsval[4][ipt]=0.;
+    prcutsval[5][ipt]=0.005;
+    prcutsval[6][ipt]=0.06;
+    prcutsval[7][ipt]=0.;
+    prcutsval[8][ipt]=0.;
+    prcutsval[9][ipt]=0.85;
+    prcutsval[10][ipt]=0.;
+    prcutsval[11][ipt]=0.1;
+    prcutsval[12][ipt]=0.1;
+    prcutsval[13][ipt]=0.1;
+  }
+
+  //Analysis cuts
+  AliRDHFCutsDstoKKpi *analysiscuts = new AliRDHFCutsDstoKKpi();
+  analysiscuts->SetPtBins(nptbins+1,ptbins);
+  analysiscuts->SetCuts(nvars,nptbins,ancutsval);
+  AliRDHFCutsDstoKKpi *prodcuts = new AliRDHFCutsDstoKKpi();
+  prodcuts->SetPtBins(nptbins+1,ptbins);
+  prodcuts->SetCuts(nvars,nptbins,prcutsval);
+
+  // Analysis task                                                                                                                     
+  AliAnalysisTaskSEDs *dsTask = new AliAnalysisTaskSEDs("DsAnalysis",prodcuts,analysiscuts);
   dsTask->SetReadMC(readMC);
   dsTask->SetDebugLevel(0);
   mgr->AddTask(dsTask);
@@ -22,15 +76,23 @@ AliAnalysisTaskSEDs *AddTaskDs(Bool_t readMC=kTRUE)
   AliAnalysisDataContainer *cinputDs = mgr->CreateContainer("cinputDs",TChain::Class(),
                                                            AliAnalysisManager::kInputContainer);
 
-  TString outputfile = AliAnalysisManager::GetCommonFileName();
-  outputfile += ":PWG3_D2H_InvMassDs";
+ TString outputfile = AliAnalysisManager::GetCommonFileName(); 
+ outputfile += ":PWG3_D2H_InvMassDs";
+ AliAnalysisDataContainer *coutputDsCuts = mgr->CreateContainer("coutputDsCuts",TList::Class(),
+                                                            AliAnalysisManager::kOutputContainer,
+                                                               outputfile.Data());
+
   AliAnalysisDataContainer *coutputDs = mgr->CreateContainer("coutputDs",TList::Class(),
                                                             AliAnalysisManager::kOutputContainer,
                                                             outputfile.Data());
 
+
   mgr->ConnectInput(dsTask,0,mgr->GetCommonInputContainer());
 
   mgr->ConnectOutput(dsTask,1,coutputDs);
-  
+
+  mgr->ConnectOutput(dsTask,2,coutputDsCuts);
   return dsTask;
 }
index 298966253b548c615e3c4e78ffe152508e79bded..fb7029f52485209c70d23c3a5b0e765e96c5a628 100644 (file)
@@ -31,6 +31,7 @@
 #include <TDatabasePDG.h>
 
 #include "AliAnalysisManager.h"
+#include "AliRDHFCutsDplustoKpipi.h"
 #include "AliAODHandler.h"
 #include "AliAODEvent.h"
 #include "AliAODVertex.h"
@@ -54,16 +55,18 @@ fNtupleDplus(0),
 fUpmasslimit(1.965),
 fLowmasslimit(1.765),
 fNPtBins(0),
+fListCuts(0),
+fRDCutsProduction(0),
+fRDCutsAnalysis(0),
 fFillNtuple(kFALSE),
 fReadMC(kFALSE),
-fDoLS(kFALSE),
-fVHF(0)
+fDoLS(kFALSE)
 {
    // Default constructor
 }
 
 //________________________________________________________________________
-AliAnalysisTaskSEDplus::AliAnalysisTaskSEDplus(const char *name,Bool_t fillNtuple):
+AliAnalysisTaskSEDplus::AliAnalysisTaskSEDplus(const char *name,AliRDHFCutsDplustoKpipi *dpluscutsana,AliRDHFCutsDplustoKpipi *dpluscutsprod,Bool_t fillNtuple):
 AliAnalysisTaskSE(name),
 fOutput(0),
 fHistNEvents(0),
@@ -71,59 +74,75 @@ fNtupleDplus(0),
 fUpmasslimit(1.965),
 fLowmasslimit(1.765),
 fNPtBins(0),
+fListCuts(0),
+fRDCutsProduction(dpluscutsprod),
+fRDCutsAnalysis(dpluscutsana),
 fFillNtuple(fillNtuple),
 fReadMC(kFALSE),
-fDoLS(kFALSE),
-fVHF(0)
+fDoLS(kFALSE)
 {
-  Double_t ptlim[5]={0.,2.,3.,5,9999999.};
-  SetPtBinLimit(5, ptlim);
+  // 
+  // Standrd constructor
+  //
+  //Double_t ptlim[5]={0.,2.,3.,5,9999999.};
+   //SetPtBinLimit(5, ptlim);
+  SetPtBinLimit(fRDCutsAnalysis->GetNPtBins()+1,fRDCutsAnalysis->GetPtBinLimits());
   // Default constructor
    // Output slot #1 writes into a TList container
   DefineOutput(1,TList::Class());  //My private output
-
+ // Output slot #2 writes cut to private output
+  //  DefineOutput(2,AliRDHFCutsDplustoKpipi::Class());
+  DefineOutput(2,TList::Class());
   if(fFillNtuple){
-    // Output slot #2 writes into a TNtuple container
-    DefineOutput(2,TNtuple::Class());  //My private output
+    // Output slot #3 writes into a TNtuple container
+    DefineOutput(3,TNtuple::Class());  //My private output
   }
 }
 
 //________________________________________________________________________
 AliAnalysisTaskSEDplus::~AliAnalysisTaskSEDplus()
 {
+  //
   // Destructor
+  //
   if (fOutput) {
     delete fOutput;
     fOutput = 0;
   }
-  if (fVHF) {
-    delete fVHF;
-    fVHF = 0;
+
+  if (fListCuts) {
+    delete fListCuts;
+    fListCuts = 0;
   }
-  
-  // if(fArrayBinLimits) {
-  //delete fArrayBinLimits;
-  //fArrayBinLimits= 0;
-  //} 
-  
+
+  if(fRDCutsProduction){
+    delete fRDCutsProduction;
+    fRDCutsProduction = 0;
+  }
+
+   if(fRDCutsAnalysis){
+    delete fRDCutsAnalysis;
+    fRDCutsAnalysis = 0;
+  }
+
 }  
 //_________________________________________________________________
 void  AliAnalysisTaskSEDplus::SetMassLimits(Float_t range){
+  // set invariant mass limits
   fUpmasslimit = 1.865+range;
   fLowmasslimit = 1.865-range;
 }
 //_________________________________________________________________
 void  AliAnalysisTaskSEDplus::SetMassLimits(Float_t lowlimit, Float_t uplimit){
+  // set invariant mass limits
   if(uplimit>lowlimit)
     {
       fUpmasslimit = lowlimit;
       fLowmasslimit = uplimit;
     }
 }
-
-
 //________________________________________________________________________
-void AliAnalysisTaskSEDplus::SetPtBinLimit(Int_t n, Double_t* lim){
+void AliAnalysisTaskSEDplus::SetPtBinLimit(Int_t n, Float_t* lim){
   // define pt bins for analysis
   if(n>kMaxPtBins){
     printf("Max. number of Pt bins = %d\n",kMaxPtBins);
@@ -152,18 +171,17 @@ void AliAnalysisTaskSEDplus::SetPtBinLimit(Int_t n, Double_t* lim){
 }
 //_________________________________________________________________
 Double_t  AliAnalysisTaskSEDplus::GetPtBinLimit(Int_t ibin){
+  // get pt bin limit
   if(ibin>fNPtBins)return -1;
   return fArrayBinLimits[ibin];
 } 
 
 //_________________________________________________________________
 void AliAnalysisTaskSEDplus::LSAnalysis(TClonesArray *arrayOppositeSign,TClonesArray *arrayLikeSign,AliAODEvent *aod,AliAODVertex *vtx1, Int_t nDplusOS){
-
-/*
- * Fill the Like Sign histograms
- */
-
-  Double_t cutsDplus[12]={0.2,0.4,0.4,0.,0.,0.01,0.06,0.02,0.,0.85,0.,10000000000.};
+  //
+  //
+  // Fill the Like Sign histograms
+  //
 
   //count pos/neg tracks
   Int_t nPosTrks=0,nNegTrks=0;
@@ -201,7 +219,7 @@ void AliAnalysisTaskSEDplus::LSAnalysis(TClonesArray *arrayOppositeSign,TClonesA
       d->SetOwnPrimaryVtx(vtx1); // needed to compute all variables
       unsetvtx=kTRUE;
     }
-    if(d->SelectDplus(fVHF->GetDplusCuts()))nDplusLS++;
+    if(fRDCutsProduction->IsSelected(d,AliRDHFCuts::kCandidate))nDplusLS++;
     if(unsetvtx) d->UnsetOwnPrimaryVtx();
   }
 
@@ -219,47 +237,11 @@ void AliAnalysisTaskSEDplus::LSAnalysis(TClonesArray *arrayOppositeSign,TClonesA
       unsetvtx=kTRUE;
     }
  
-    if(d->SelectDplus(fVHF->GetDplusCuts())){
+    if(fRDCutsProduction->IsSelected(d,AliRDHFCuts::kCandidate)){
 
       //set tight cuts values
       Int_t iPtBin=-1;
       Double_t ptCand = d->Pt();
-         
-      if(ptCand<2.){    //NO change
-       cutsDplus[6]=0.022100;//added 
-       cutsDplus[7]=0.08;
-       cutsDplus[8]=0.5;
-       cutsDplus[9]=0.979;
-       cutsDplus[10]=0.0055;
-      }
-      else if(ptCand>2. && ptCand<3){ 
-       //iPtBin=1;
-       cutsDplus[6]=0.034;//added
-       cutsDplus[7]=0.09;//cutsDplus[7]=0.08;
-       cutsDplus[8]=1.0;//cutsDplus[8]=0.5;
-       cutsDplus[9]=0.9975;//cutsDplus[9]=0.991;
-       cutsDplus[10]=0.0028;//cutsDplus[10]=0.005;
-      }else if(ptCand>3. && ptCand<5){ 
-       //iPtBin=2;
-       cutsDplus[6]=0.020667;//added
-       cutsDplus[7]=0.095;//cutsDplus[7]=0.1;
-       cutsDplus[8]=0.5;//cutsDplus[8]=0.5;
-       cutsDplus[9]=0.995;//cutsDplus[9]=0.995;
-       cutsDplus[10]=0.000883;//cutsDplus[10]=0.0035;
-      }else{
-       //iPtBin=3;
-       cutsDplus[6]=0.023333;//added
-       cutsDplus[7]=0.115;//cutsDplus[7]=0.1;
-       cutsDplus[8]=0.5;//cutsDplus[8]=0.5;
-       cutsDplus[9]=0.9975;//cutsDplus[9]=0.997;
-       cutsDplus[10]=0.000883;//cutsDplus[10]=0.001;
-      }
-      
-      
-
-      
-
-      
       for(Int_t ibin=0;ibin<fNPtBins&&iPtBin<0&&ptCand>fArrayBinLimits[0]&&ptCand<fArrayBinLimits[fNPtBins];ibin++){
        if(ptCand<fArrayBinLimits[ibin+1])iPtBin=ibin;
       }
@@ -268,7 +250,7 @@ void AliAnalysisTaskSEDplus::LSAnalysis(TClonesArray *arrayOppositeSign,TClonesA
        return;
       }
 
-      Bool_t passTightCuts=d->SelectDplus(cutsDplus);
+      Int_t passTightCuts=fRDCutsAnalysis->IsSelected(d,AliRDHFCuts::kCandidate);
 
       Int_t sign= d->GetCharge();
       Float_t wei=1;
@@ -309,7 +291,7 @@ void AliAnalysisTaskSEDplus::LSAnalysis(TClonesArray *arrayOppositeSign,TClonesA
       fPtMaxHistLS[indexcut]->Fill(ptmax);
       fDCAHistLS[indexcut]->Fill(dca);
       
-      if(passTightCuts){
+      if(passTightCuts==1){
        fMassHistLSTC[index]->Fill(invMass,wei);
        fMassHistLSTC[index+1]->Fill(invMass);
        fMassHistLSTC[index+2]->Fill(invMass,wei2);
@@ -327,18 +309,25 @@ void AliAnalysisTaskSEDplus::LSAnalysis(TClonesArray *arrayOppositeSign,TClonesA
 
 }
 
-//________________________________________________________________________
-void AliAnalysisTaskSEDplus::Init()
-{
-  // Initialization
 
+//__________________________________________
+void AliAnalysisTaskSEDplus::Init(){
+  //
+  // Initialization
+  //
   if(fDebug > 1) printf("AnalysisTaskSEDplus::Init() \n");
-
-  gROOT->LoadMacro("ConfigVertexingHF.C");
-
-  fVHF = (AliAnalysisVertexingHF*)gROOT->ProcessLine("ConfigVertexingHF()");  
-  fVHF->PrintStatus();
-
+  
+  //PostData(2,fRDCutsloose);//we should then put those cuts in a tlist if we have more than 1
+  fListCuts=new TList();
+  AliRDHFCutsDplustoKpipi *production = new AliRDHFCutsDplustoKpipi();
+  production=fRDCutsProduction;
+  AliRDHFCutsDplustoKpipi *analysis = new AliRDHFCutsDplustoKpipi();
+  analysis=fRDCutsAnalysis;
+  
+  fListCuts->Add(production);
+  fListCuts->Add(analysis);
+  PostData(2,fListCuts);
+  
   return;
 }
 
@@ -608,8 +597,8 @@ void AliAnalysisTaskSEDplus::UserExec(Option_t */*option*/)
   // Execute analysis for current event:
   // heavy flavor candidates association to MC truth
 
-   AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent());
- fHistNEvents->Fill(0); // count event
+  AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent());
 fHistNEvents->Fill(0); // count event
   // Post the data already here
   PostData(1,fOutput);
   
@@ -619,8 +608,8 @@ void AliAnalysisTaskSEDplus::UserExec(Option_t */*option*/)
     // In case there is an AOD handler writing a standard AOD, use the AOD 
     // event in memory rather than the input (ESD) event.    
     aod = dynamic_cast<AliAODEvent*> (AODEvent());
-    // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
-    // have to taken from the AOD event hold by the AliAODExtension
+     // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
+     // have to taken from the AOD event hold by the AliAODExtension
     AliAODHandler* aodHandler = (AliAODHandler*) 
       ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
     if(aodHandler->GetExtensions()) {
@@ -675,7 +664,8 @@ void AliAnalysisTaskSEDplus::UserExec(Option_t */*option*/)
   Int_t nOS=0;
   Int_t index;
   Int_t pdgDgDplustoKpipi[3]={321,211,211};
-  Double_t cutsDplus[12]={0.2,0.4,0.4,0.,0.,0.01,0.06,0.02,0.,0.85,0.,10000000000.};
+  // Double_t cutsDplus[12]={0.2,0.4,0.4,0.,0.,0.01,0.06,0.02,0.,0.85,0.,10000000000.};//TO REMOVE
+  //Double_t *cutsDplus = new (Double_t*)fRDCuts->GetCuts();
   for (Int_t i3Prong = 0; i3Prong < n3Prong; i3Prong++) {
     AliAODRecoDecayHF3Prong *d = (AliAODRecoDecayHF3Prong*)array3Prong->UncheckedAt(i3Prong);
     
@@ -686,45 +676,16 @@ void AliAnalysisTaskSEDplus::UserExec(Option_t */*option*/)
       unsetvtx=kTRUE;
     }
 
-    if(d->SelectDplus(fVHF->GetDplusCuts())) {
+    if(fRDCutsProduction->IsSelected(d,AliRDHFCuts::kCandidate)) {
       Int_t iPtBin = -1;
       Double_t ptCand = d->Pt();
-      
-      if(ptCand<2.){   //NO CHANGE
-       cutsDplus[6]=0.022100;//added
-       cutsDplus[7]=0.08;
-       cutsDplus[8]=0.5;
-       cutsDplus[9]=0.979;
-       cutsDplus[10]=0.0055;
-      }
-      else if(ptCand>2. && ptCand<3){ 
-       //iPtBin=1;
-       cutsDplus[6]=0.034;//added
-       cutsDplus[7]=0.09;//cutsDplus[7]=0.08;
-       cutsDplus[8]=1.0;//cutsDplus[8]=0.5;
-       cutsDplus[9]=0.9975;//cutsDplus[9]=0.991;
-       cutsDplus[10]=0.0028;//cutsDplus[10]=0.005;
-      }else if(ptCand>3. && ptCand<5){ 
-       //iPtBin=2;
-       cutsDplus[6]=0.020667;//added
-       cutsDplus[7]=0.095;//cutsDplus[7]=0.1;
-       cutsDplus[8]=0.5;//cutsDplus[8]=0.5;
-       cutsDplus[9]=0.995;//cutsDplus[9]=0.995;
-       cutsDplus[10]=0.000883;//cutsDplus[10]=0.0035;
-      }else{
-       //iPtBin=3;
-       cutsDplus[6]=0.023333;//added
-       cutsDplus[7]=0.115;//cutsDplus[7]=0.1;
-       cutsDplus[8]=0.5;//cutsDplus[8]=0.5;
-       cutsDplus[9]=0.9975;//cutsDplus[9]=0.997;
-       cutsDplus[10]=0.000883;//cutsDplus[10]=0.001;
-      }
-      
+
       for(Int_t ibin=0;ibin<fNPtBins&&iPtBin<0&&ptCand>fArrayBinLimits[0]&&ptCand<fArrayBinLimits[fNPtBins];ibin++){
        if(ptCand<fArrayBinLimits[ibin+1])iPtBin=ibin;
       }
       
-      Bool_t passTightCuts=d->SelectDplus(cutsDplus);
+      Int_t passTightCuts=fRDCutsAnalysis->IsSelected(d,AliRDHFCuts::kCandidate);
+
       Int_t labDp=-1;
       Float_t deltaPx=0.;
       Float_t deltaPy=0.;
@@ -780,7 +741,7 @@ void AliAnalysisTaskSEDplus::UserExec(Option_t */*option*/)
        tmp[22]=d->GetDCA();
        tmp[23]=d->Prodd0d0(); 
        fNtupleDplus->Fill(tmp);
-       PostData(2,fNtupleDplus);
+       PostData(3,fNtupleDplus);
       }
       Double_t dlen=d->DecayLength();
       Double_t cosp=d->CosPointingAngle();
@@ -800,7 +761,7 @@ Double_t ptmax=0;
        fPtMaxHist[index]->Fill(ptmax);
        fDCAHist[index]->Fill(dca);
        
-       if(passTightCuts){
+       if(passTightCuts==1){
          fMassHistTC[index]->Fill(invMass);
        }
        
@@ -813,7 +774,7 @@ Double_t ptmax=0;
            fSumd02Hist[index]->Fill(sumD02);
            fPtMaxHist[index]->Fill(ptmax);
            fDCAHist[index]->Fill(dca);
-           if(passTightCuts){
+           if(passTightCuts==1){
              fMassHistTC[index]->Fill(invMass);
 
            }
@@ -826,23 +787,17 @@ Double_t ptmax=0;
            fSumd02Hist[index]->Fill(sumD02);
            fPtMaxHist[index]->Fill(ptmax);
            fDCAHist[index]->Fill(dca);
-           if(passTightCuts){
+           if(passTightCuts==1){
              fMassHistTC[index]->Fill(invMass);
 
            }   
          }
        }
       }
-      /*
-      //start OS analysis
-      if(labDp<0)fHistOSbkg->Fill(d->InvMassDplus());
-      fHistOS->Fill(d->InvMassDplus());
-      */
-      nOS++;
     }
     if(unsetvtx) d->UnsetOwnPrimaryVtx();
   }
+  
   //start LS analysis
   if(fDoLS && arrayLikeSign) LSAnalysis(array3Prong,arrayLikeSign,aod,vtx1,nOS);
   
@@ -1009,7 +964,7 @@ void AliAnalysisTaskSEDplus::Terminate(Option_t */*option*/)
  }
 
   if(fFillNtuple){
-    fNtupleDplus = dynamic_cast<TNtuple*>(GetOutputData(2));
+    fNtupleDplus = dynamic_cast<TNtuple*>(GetOutputData(3));
   }
 
   TCanvas *c1=new TCanvas("c1","D+ invariant mass distribution",500,500);
index de50e9dde1d3a3eea260d15a82fbdc52dd62319b..547823b92971f2c7e59ca0b7c3538f43ae0abdb3 100644 (file)
@@ -18,6 +18,7 @@
 #include <TH1F.h>
 #include <TArrayD.h>
 
+#include "AliRDHFCutsDplustoKpipi.h"
 #include "AliAnalysisTaskSE.h"
 #include "AliAnalysisVertexingHF.h"
 
@@ -26,14 +27,14 @@ class AliAnalysisTaskSEDplus : public AliAnalysisTaskSE
  public:
 
   AliAnalysisTaskSEDplus();
-  AliAnalysisTaskSEDplus(const char *name, Bool_t fillNtuple=kFALSE);
+  AliAnalysisTaskSEDplus(const char *name, AliRDHFCutsDplustoKpipi* analysiscuts,AliRDHFCutsDplustoKpipi* productioncuts,Bool_t fillNtuple=kFALSE);
   virtual ~AliAnalysisTaskSEDplus();
 
   void SetReadMC(Bool_t readMC=kTRUE){fReadMC=readMC;}
   void SetDoLikeSign(Bool_t dols=kTRUE){fDoLS=dols;}
   void SetMassLimits(Float_t range);
   void SetMassLimits(Float_t lowlimit, Float_t uplimit);
-  void SetPtBinLimit(Int_t n, Double_t *limitarray);
+  void SetPtBinLimit(Int_t n, Float_t *limitarray);
   
   Float_t GetUpperMassLimit(){return fUpmasslimit;}
   Float_t GetLowerMassLimit(){return fLowmasslimit;}
@@ -81,14 +82,16 @@ class AliAnalysisTaskSEDplus : public AliAnalysisTaskSE
   TNtuple *fNtupleDplus; //! output ntuple
   Float_t fUpmasslimit;  //upper inv mass limit for histos
   Float_t fLowmasslimit; //lower inv mass limit for histos
-  Int_t fNPtBins; //number of bins in Pt for histograms
+  Int_t fNPtBins; //Number of Pt Bins
+  TList *fListCuts; //list of cuts
+  AliRDHFCutsDplustoKpipi *fRDCutsProduction; //Production D+ Cuts
+  AliRDHFCutsDplustoKpipi *fRDCutsAnalysis; //Cuts for Analysis
   Double_t fArrayBinLimits[kMaxPtBins+1]; //limits for the Pt bins
   Bool_t fFillNtuple;   // flag for filling ntuple
   Bool_t fReadMC;    //flag for access to MC
   Bool_t fDoLS;      //flag to do LS analysis
-  AliAnalysisVertexingHF *fVHF;  // Vertexer heavy flavour (used to pass the cuts)
   
-  ClassDef(AliAnalysisTaskSEDplus,4); // AliAnalysisTaskSE for the MC association of heavy-flavour decay candidates
+  ClassDef(AliAnalysisTaskSEDplus,5); // AliAnalysisTaskSE for the MC association of heavy-flavour decay candidates
 };
 
 #endif
index b48d16ab378aeec6c6586c5ffefa83ea1e96fd38..00e99181b5ee2eda7b6a21f0ca49bb9a998050e4 100644 (file)
@@ -39,6 +39,7 @@
 #include "AliAODMCParticle.h"
 #include "AliAODRecoDecayHF3Prong.h"
 #include "AliAnalysisVertexingHF.h"
+#include "AliRDHFCutsDstoKKpi.h"
 #include "AliAnalysisTaskSE.h"
 #include "AliAnalysisTaskSEDs.h"
 
@@ -52,33 +53,39 @@ AliAnalysisTaskSEDs::AliAnalysisTaskSEDs():
   fHistNEvents(0),
   fReadMC(kFALSE),
   fNPtBins(0),
+  fListCuts(0),
   fMassRange(0.2),
-  fVHF(0)
+  fProdCuts(0),
+  fAnalysisCuts(0)
 {
   // Default constructor
 }
 
 //________________________________________________________________________
-AliAnalysisTaskSEDs::AliAnalysisTaskSEDs(const char *name):
+AliAnalysisTaskSEDs::AliAnalysisTaskSEDs(const char *name, AliRDHFCutsDstoKKpi* productioncuts, AliRDHFCutsDstoKKpi* analysiscuts):
   AliAnalysisTaskSE(name),
   fOutput(0),
   fHistNEvents(0),
   fReadMC(kFALSE),
   fNPtBins(0),
+  fListCuts(0),
   fMassRange(0.2),
-  fVHF(0)
+  fProdCuts(productioncuts),
+  fAnalysisCuts(analysiscuts)
 {
   // Default constructor
   // Output slot #1 writes into a TList container
-  Double_t ptlim[6]={0.,1.,3.,5.,10.,9999999.};  
-  SetPtBins(5,ptlim);
+  Int_t nptbins=fAnalysisCuts->GetNPtBins();
+  Float_t *ptlim=fAnalysisCuts->GetPtBinLimits();
+  SetPtBins(nptbins,ptlim);
  
   DefineOutput(1,TList::Class());  //My private output
 
+  DefineOutput(2,TList::Class());
 }
 
 //________________________________________________________________________
-void AliAnalysisTaskSEDs::SetPtBins(Int_t n, Double_t* lim){
+void AliAnalysisTaskSEDs::SetPtBins(Int_t n, Float_t* lim){
   // define pt bins for analysis
   if(n>kMaxPtBins){
     printf("Max. number of Pt bins = %d\n",kMaxPtBins);
@@ -107,9 +114,18 @@ AliAnalysisTaskSEDs::~AliAnalysisTaskSEDs()
     delete fOutput;
     fOutput = 0;
   }
-  if (fVHF) {
-    delete fVHF;
-    fVHF = 0;
+  if (fListCuts) {
+    delete fListCuts;
+    fListCuts = 0;
+  }
+
+  if (fProdCuts) {
+    delete fProdCuts;
+    fProdCuts = 0;
+  }
+  if (fAnalysisCuts) {
+    delete fAnalysisCuts;
+    fAnalysisCuts = 0;
   }
 }  
 
@@ -120,11 +136,15 @@ void AliAnalysisTaskSEDs::Init()
 
   if(fDebug > 1) printf("AnalysisTaskSEDs::Init() \n");
 
-  gROOT->LoadMacro("ConfigVertexingHF.C");
-
-  fVHF = (AliAnalysisVertexingHF*)gROOT->ProcessLine("ConfigVertexingHF()");  
-  fVHF->PrintStatus();
-
+  fListCuts=new TList();
+  AliRDHFCutsDstoKKpi *production = new AliRDHFCutsDstoKKpi();
+  production=fProdCuts;
+  AliRDHFCutsDstoKKpi *analysis = new AliRDHFCutsDstoKKpi();
+  analysis=fAnalysisCuts;
+  
+  fListCuts->Add(production);
+  fListCuts->Add(analysis);
+  PostData(2,fListCuts);
   return;
 }
 
@@ -295,7 +315,6 @@ void AliAnalysisTaskSEDs::UserExec(Option_t */*option*/)
   
   
   Int_t pdgDstoKKpi[3]={321,321,211};
-  Double_t cutsDs[14]={0.2,0.4,0.4,0.,0.,0.005,0.038,0.,0.,0.95,0.,0.1,0.004,0.035};
   for (Int_t i3Prong = 0; i3Prong < n3Prong; i3Prong++) {
     AliAODRecoDecayHF3Prong *d = (AliAODRecoDecayHF3Prong*)array3Prong->UncheckedAt(i3Prong);
     
@@ -305,14 +324,21 @@ void AliAnalysisTaskSEDs::UserExec(Option_t */*option*/)
       d->SetOwnPrimaryVtx(vtx1);
       unsetvtx=kTRUE;
     }
-    Int_t isKKpi,ispiKK;
-    Int_t isPhi,isK0star;
-    Int_t isKKpiTC,ispiKKTC;
-    Int_t isPhiTC,isK0starTC;
-    if(d->SelectDs(fVHF->GetDsCuts(),isKKpi,ispiKK,isPhi,isK0star)) {
+
+    Int_t retCodeProductionCuts=fProdCuts->IsSelected(d,AliRDHFCuts::kCandidate);
+    if(retCodeProductionCuts>0){
+      Int_t isKKpi=retCodeProductionCuts&1;
+      Int_t ispiKK=retCodeProductionCuts&2;
+//       Int_t isPhi=retCodeProductionCuts&4;
+//       Int_t isK0star=retCodeProductionCuts&8;
       Double_t ptCand = d->Pt();
-      Int_t iPtBin=TMath::BinarySearch(fNPtBins,fPtLimits,ptCand);
-      Bool_t passTightCuts=d->SelectDs(cutsDs,isKKpiTC,ispiKKTC,isPhiTC,isK0starTC);
+      Int_t iPtBin=TMath::BinarySearch(fNPtBins,fPtLimits,(Float_t)ptCand);
+      Int_t retCodeAnalysisCuts=fAnalysisCuts->IsSelected(d,AliRDHFCuts::kCandidate);
+      Int_t isKKpiAC=retCodeAnalysisCuts&1;
+      Int_t ispiKKAC=retCodeAnalysisCuts&2;
+//       Int_t isPhiAC=retCodeAnalysisCuts&4;
+//       Int_t isK0starAC=retCodeAnalysisCuts&8;
+
       Int_t labDs=-1;
       if(fReadMC){
        labDs = d->MatchToMC(431,arrayMC,3,pdgDstoKKpi);
@@ -324,26 +350,26 @@ void AliAnalysisTaskSEDs::UserExec(Option_t */*option*/)
       Int_t type=0;
       if(isKKpi) type+=1;
       if(ispiKK) type+=2;
-      Int_t typeTC=0;
-      if(isKKpiTC) typeTC+=1;
-      if(ispiKKTC) typeTC+=2;
+      Int_t typeAC=0;
+      if(isKKpiAC) typeAC+=1;
+      if(ispiKKAC) typeAC+=2;
       fCosPHist[index]->Fill(cosp);
       fDLenHist[index]->Fill(dlen);
       fChanHist[0]->Fill(type);
-      if(passTightCuts) fChanHistCuts[0]->Fill(typeTC);
+      if(retCodeAnalysisCuts>0) fChanHistCuts[0]->Fill(typeAC);
       if(fReadMC){
        if(labDs>=0) {    
          index=GetSignalHistoIndex(iPtBin);
          fCosPHist[index]->Fill(cosp);
          fDLenHist[index]->Fill(dlen);
          fChanHist[1]->Fill(type);       
-         if(passTightCuts) fChanHistCuts[1]->Fill(typeTC);
+         if(retCodeAnalysisCuts>0) fChanHistCuts[1]->Fill(typeAC);
        }else{
          index=GetBackgroundHistoIndex(iPtBin);
          fCosPHist[index]->Fill(cosp);
          fDLenHist[index]->Fill(dlen);
          fChanHist[2]->Fill(type);       
-         if(passTightCuts) fChanHistCuts[2]->Fill(typeTC);
+         if(retCodeAnalysisCuts>0) fChanHistCuts[2]->Fill(typeAC);
        }
       }
       if(isKKpi){
@@ -353,18 +379,18 @@ void AliAnalysisTaskSEDs::UserExec(Option_t */*option*/)
        Double_t mass01=d->InvMass2Prongs(0,1,321,321);
        Double_t mass12=d->InvMass2Prongs(1,2,321,211);
        fDalitz[index]->Fill(mass01,mass12);
-       if(passTightCuts && isKKpiTC) fMassHistCuts[index]->Fill(invMass);
+       if(retCodeAnalysisCuts>0 && isKKpiAC) fMassHistCuts[index]->Fill(invMass);
        if(fReadMC){
          if(labDs>=0) {          
            index=GetSignalHistoIndex(iPtBin);
            fMassHist[index]->Fill(invMass);
            fDalitz[index]->Fill(mass01,mass12);
-           if(passTightCuts&& isKKpiTC) fMassHistCuts[index]->Fill(invMass);
+           if(retCodeAnalysisCuts>0 && isKKpiAC) fMassHistCuts[index]->Fill(invMass);
          }else{
            index=GetBackgroundHistoIndex(iPtBin);
            fMassHist[index]->Fill(invMass);
            fDalitz[index]->Fill(mass01,mass12);
-           if(passTightCuts&& isKKpiTC) fMassHistCuts[index]->Fill(invMass);
+           if(retCodeAnalysisCuts>0 && isKKpiAC) fMassHistCuts[index]->Fill(invMass);
          }
        }       
       }
@@ -372,16 +398,16 @@ void AliAnalysisTaskSEDs::UserExec(Option_t */*option*/)
        index=GetHistoIndex(iPtBin);
        Double_t invMass=d->InvMassDspiKK();
        fMassHist[index]->Fill(invMass);
-       if(passTightCuts && ispiKKTC) fMassHistCuts[index]->Fill(invMass);
+       if(retCodeAnalysisCuts>0 && ispiKKAC) fMassHistCuts[index]->Fill(invMass);
        if(fReadMC){
          if(labDs>=0) {          
            index=GetSignalHistoIndex(iPtBin);
            fMassHist[index]->Fill(invMass);
-           if(passTightCuts && ispiKKTC) fMassHistCuts[index]->Fill(invMass);
+           if(retCodeAnalysisCuts>0 && ispiKKAC) fMassHistCuts[index]->Fill(invMass);
          }else{
            index=GetBackgroundHistoIndex(iPtBin);
            fMassHist[index]->Fill(invMass);
-           if(passTightCuts && ispiKKTC) fMassHistCuts[index]->Fill(invMass);
+           if(retCodeAnalysisCuts>0 && ispiKKAC) fMassHistCuts[index]->Fill(invMass);
          }
        }
       }
index 16f741f682528410ba53282069b11bbab4ab05ac..555ecddef6b08461372dbeb537a6949d89411032 100644 (file)
 #include <TH2F.h>
 
 #include "AliAnalysisTaskSE.h"
-#include "AliAnalysisVertexingHF.h"
+#include "AliRDHFCutsDstoKKpi.h"
 
 class AliAnalysisTaskSEDs : public AliAnalysisTaskSE
 {
  public:
 
   AliAnalysisTaskSEDs();
-  AliAnalysisTaskSEDs(const char *name);
+  AliAnalysisTaskSEDs(const char *name, AliRDHFCutsDstoKKpi* productioncuts, AliRDHFCutsDstoKKpi* analysiscuts);
   virtual ~AliAnalysisTaskSEDs();
   void SetReadMC(Bool_t readMC=kTRUE){fReadMC=readMC;}
   void SetMassRange(Double_t rang=0.2){fMassRange=rang;}
-  void SetPtBins(Int_t n, Double_t* lim);
-
+  void SetPtBins(Int_t n, Float_t* lim);
+  void SetProductionCuts(AliRDHFCutsDstoKKpi* cuts){fProdCuts=cuts;}
+  void SetAnalysisCuts(AliRDHFCutsDstoKKpi* cuts){fAnalysisCuts=cuts;}
   // Implementation of interface methods
   virtual void UserCreateOutputObjects();
   virtual void Init();
@@ -61,11 +62,13 @@ class AliAnalysisTaskSEDs : public AliAnalysisTaskSE
   TH2F*   fDalitz[3*kMaxPtBins];      //! dalitz plot (sig,bkg,tot)
   Bool_t  fReadMC;                    //  flag for access to MC
   UChar_t fNPtBins;                   // number of Pt bins
-  Double_t fPtLimits[kMaxPtBins+1];   //  limits for pt bins
+  TList *fListCuts; //list of cuts
+  Float_t fPtLimits[kMaxPtBins+1];    //  limits for pt bins
   Double_t fMassRange;                // range for mass histogram 
-  AliAnalysisVertexingHF *fVHF;       //  Heavy flavour analysis object
+  AliRDHFCutsDstoKKpi *fProdCuts;     //Cuts for Analysis
+  AliRDHFCutsDstoKKpi *fAnalysisCuts; //Cuts for Analysis
   
-  ClassDef(AliAnalysisTaskSEDs,1);    //  AliAnalysisTaskSE for Ds mass spectra
+  ClassDef(AliAnalysisTaskSEDs,2);    //  AliAnalysisTaskSE for Ds mass spectra
 };
 
 #endif