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