AliPhysics  v5-06-40-01 (42bb456)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AddTaskDplus.C
Go to the documentation of this file.
1 AliAnalysisTaskSEDplus *AddTaskDplus(Int_t system=0/*0=pp,1=PbPb*/,
2  Float_t minC=0, Float_t maxC=100,
3  Bool_t storeNtuple=kFALSE,
4  Bool_t doSparse=kFALSE,
5  Bool_t readMC=kFALSE,
6  TString finDirname="Loose",
7  TString filename="",
8  TString finAnObjname="AnalysisCuts",
9  Int_t etaRange=0,
10  Bool_t cutsDistr=kFALSE)
11 {
12  //
13  // Test macro for the AliAnalysisTaskSE for D+ candidates
14 
15  //Invariant mass histogram and
16  // association with MC truth (using MC info in AOD)
17  // R. Bala, bala@to.infn.it
18  // Get the pointer to the existing analysis manager via the static access method.
19  //==============================================================================
20  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
21  if (!mgr) {
22  ::Error("AddTaskDplus", "No analysis manager to connect to.");
23  }
24 
25  Bool_t stdcuts=kFALSE;
26  TFile* filecuts;
27  if( filename.EqualTo("") ) {
28  stdcuts=kTRUE;
29  } else {
30  filecuts=TFile::Open(filename.Data());
31  if(!filecuts ||(filecuts&& !filecuts->IsOpen())){
32  AliFatal("Input file not found : check your cut object");
33  }
34  }
35 
36 
37  //Analysis Task
38 
39 
41  if(stdcuts) {
42  if(system==0) analysiscuts->SetStandardCutsPP2010();
43  else if(system==1){
44  analysiscuts->SetStandardCutsPbPb2011();
45  analysiscuts->SetMinCentrality(minC);
46  analysiscuts->SetMaxCentrality(maxC);
47  // analysiscuts->SetUseAOD049(kTRUE);
49  }
50  }
51  else analysiscuts = (AliRDHFCutsDplustoKpipi*)filecuts->Get(finAnObjname);
52 
53  AliAnalysisTaskSEDplus *dplusTask = new AliAnalysisTaskSEDplus("DplusAnalysis",analysiscuts,storeNtuple);
54  dplusTask->SetReadMC(readMC);
55  dplusTask->SetDoLikeSign(kFALSE);
56  // dplusTask->SetUseTPCpid(kTRUE);
57  //dplusTask->SetUseTOFpid(kTRUE);
58  dplusTask->SetDebugLevel(0);
59  dplusTask->SetMassLimits(0.2);
60  dplusTask->SetUseBit(kTRUE);
61  dplusTask->SetCutsDistr(cutsDistr);
62  dplusTask->SetSystem(system);
63  if (doSparse)
64  dplusTask->SetDoImpactParameterHistos(kTRUE);
65  if(doSparse && readMC)
66  dplusTask->SetDoMCAcceptanceHistos(kTRUE);
67  if(etaRange==1) dplusTask->SetUseOnlyPositiveEta();
68  if(etaRange==-1) dplusTask->SetUseOnlyNegativeEta();
69 
70  mgr->AddTask(dplusTask);
71 
72  // Create containers for input/output
73 
74  TString inname = "cinputDplus";
75  TString outname = "coutputDplus";
76  TString cutsname = "coutputDplusCuts";
77  TString normname = "coutputDplusNorm";
78  TString ntuplename = "coutputDplus2";
79  inname += finDirname.Data();
80  outname += finDirname.Data();
81  cutsname += finDirname.Data();
82  normname += finDirname.Data();
83  ntuplename += finDirname.Data();
84  TString centr=Form("%.0f%.0f",analysiscuts->GetMinCentrality(),analysiscuts->GetMaxCentrality());
85  inname += centr;
86  outname += centr;
87  cutsname += centr;
88  normname += centr;
89  ntuplename += centr;
90 
91 
92  AliAnalysisDataContainer *cinputDplus = mgr->CreateContainer(inname,TChain::Class(),
93  AliAnalysisManager::kInputContainer);
94  TString outputfile = AliAnalysisManager::GetCommonFileName();
95  outputfile += ":PWG3_D2H_InvMassDplus";
96 
97  AliAnalysisDataContainer *coutputDplusCuts = mgr->CreateContainer(cutsname,TList::Class(),
98  AliAnalysisManager::kOutputContainer,
99  outputfile.Data());
100 
101  AliAnalysisDataContainer *coutputDplus = mgr->CreateContainer(outname,TList::Class(),
102  AliAnalysisManager::kOutputContainer,
103  outputfile.Data());
104  AliAnalysisDataContainer *coutputDplusNorm = mgr->CreateContainer(normname,AliNormalizationCounter::Class(),
105  AliAnalysisManager::kOutputContainer,
106  outputfile.Data());
107 
108  if(storeNtuple){
109  AliAnalysisDataContainer *coutputDplus2 = mgr->CreateContainer(ntuplename,TNtuple::Class(),
110  AliAnalysisManager::kOutputContainer,
111  outputfile.Data());
112 
113  coutputDplus2->SetSpecialOutput();
114  }
115  mgr->ConnectInput(dplusTask,0,mgr->GetCommonInputContainer());
116 
117  mgr->ConnectOutput(dplusTask,1,coutputDplus);
118 
119  mgr->ConnectOutput(dplusTask,2,coutputDplusCuts);
120 
121  mgr->ConnectOutput(dplusTask,3,coutputDplusNorm);
122  if(storeNtuple){
123  mgr->ConnectOutput(dplusTask,4,coutputDplus2);
124  }
125  return dplusTask;
126 }
Float_t GetMaxCentrality() const
Definition: AliRDHFCuts.h:265
void SetUseCentrality(Int_t flag=1)
void SetDoMCAcceptanceHistos(Bool_t doMCAcc=kTRUE)
void SetDoImpactParameterHistos(Bool_t doImp=kTRUE)
Float_t GetMinCentrality() const
Definition: AliRDHFCuts.h:264
void SetUseBit(Bool_t dols=kTRUE)
Class for cuts on AOD reconstructed D+->Kpipi.
void SetSystem(Int_t system=0)
void SetDoLikeSign(Int_t dols=0)
void SetMinCentrality(Float_t minCentrality=0.)
Definition: AliRDHFCuts.h:51
AliAnalysisTaskSEDplus * AddTaskDplus(Int_t system=0, Float_t minC=0, Float_t maxC=100, Bool_t storeNtuple=kFALSE, Bool_t doSparse=kFALSE, Bool_t readMC=kFALSE, TString finDirname="Loose", TString filename="", TString finAnObjname="AnalysisCuts", Int_t etaRange=0, Bool_t cutsDistr=kFALSE)
Definition: AddTaskDplus.C:1
void SetCutsDistr(Bool_t cutsDistr=kTRUE)
void SetMaxCentrality(Float_t maxCentrality=100.)
Definition: AliRDHFCuts.h:52
void SetMassLimits(Float_t range)
void SetReadMC(Bool_t readMC=kTRUE)