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