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