AliPhysics  1168478 (1168478)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AddTaskHFQA.C
Go to the documentation of this file.
1 AliAnalysisTaskSEHFQA* AddTaskHFQA(AliAnalysisTaskSEHFQA::DecChannel ch,TString filecutsname="",Bool_t readMC=kFALSE, Bool_t simplemode=kFALSE, Int_t system=1 /*0=pp, 1=PbPb*/, TString finDirname="",Bool_t trackon=kTRUE,Bool_t pidon=kTRUE,Bool_t centralityon=kTRUE, Bool_t eventselon=kTRUE, Bool_t flowobson=kFALSE, Bool_t filldistribforeffcheckson=kFALSE){
2  //
3  // Test macro for the AliAnalysisTaskSE for HF mesons quality assurance
4  //Author: C.Bianchin chiara.bianchin@pd.infn.it
5 
6  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
7  if (!mgr) {
8  ::Error("AddTaskHFQA", "No analysis manager to connect to.");
9  return NULL;
10  }
11 
12  Bool_t stdcuts=kFALSE;
13  TFile* filecuts;
14  if( filecutsname.EqualTo("") ) {
15  stdcuts=kTRUE;
16  } else {
17  filecuts=TFile::Open(filecutsname.Data());
18  if(!filecuts ||(filecuts&& !filecuts->IsOpen())){
19  AliFatal("Input file not found : check your cut object");
20  }
21  }
22 
23  if(system==0) centralityon=kFALSE;
24 
25  AliRDHFCuts *analysiscuts=0x0;
26 
27  TString filename="",out1name="nEntriesQA",out2name="outputPid",out3name="outputTrack",out4name="cuts",out5name="countersCentrality",out6name="outputCentrCheck",out7name="outputEvSel",out8name="outputFlowObs",inname="input",suffix="",cutsobjname="",centr="";
28  filename = AliAnalysisManager::GetCommonFileName();
29  filename += ":PWG3_D2H_QA";
30  filename += finDirname.Data();
31 
32  switch (ch){
33  case 0:
34  cutsobjname="AnalysisCuts";
35  if(stdcuts) {
36  analysiscuts = new AliRDHFCutsDplustoKpipi();
37  if (system == 0) analysiscuts->SetStandardCutsPP2010();
38  else analysiscuts->SetStandardCutsPbPb2011();
39  }
40  else analysiscuts = (AliRDHFCutsDplustoKpipi*)filecuts->Get(cutsobjname);
41  suffix="Dplus";
42  break;
43  case 1:
44  cutsobjname="D0toKpiCuts";
45  if(stdcuts) {
46  analysiscuts = new AliRDHFCutsD0toKpi();
47  if (system == 0) analysiscuts->SetStandardCutsPP2010();
48  else analysiscuts->SetStandardCutsPbPb2011();
49  }
50  else analysiscuts = (AliRDHFCutsD0toKpi*)filecuts->Get(cutsobjname);
51  suffix="D0";
52  break;
53  case 2:
54  cutsobjname="DStartoKpipiCuts";
55  if(stdcuts) {
56  analysiscuts = new AliRDHFCutsDStartoKpipi();
57  if (system == 0) analysiscuts->SetStandardCutsPP2010();
58  else analysiscuts->SetStandardCutsPbPb2011();
59  }
60  else analysiscuts = (AliRDHFCutsDStartoKpipi*)filecuts->Get(cutsobjname);
61  suffix="Dstar";
62  break;
63  case 3:
64  cutsobjname="DstoKKpiCuts";
65  if(stdcuts) {
66  analysiscuts = new AliRDHFCutsDstoKKpi();
67  if (system == 0) analysiscuts->SetStandardCutsPP2010();
68  else analysiscuts->SetStandardCutsPbPb2010();
69  }
70  else analysiscuts = (AliRDHFCutsDstoKKpi*)filecuts->Get(cutsobjname);
71  suffix="Ds";
72  break;
73  case 4:
74  cutsobjname="D0toKpipipiCuts";
75  if(stdcuts) {
76  analysiscuts = new AliRDHFCutsD0toKpipipi();
77  if (system == 0) analysiscuts->SetStandardCutsPP2010();
78  else analysiscuts->SetStandardCutsPbPb2010();
79  }
80  else analysiscuts = (AliRDHFCutsD0toKpipipi*)filecuts->Get(cutsobjname);
81  suffix="D04";
82  break;
83  case 5:
84  cutsobjname="LctopKpiAnalysisCuts";
85  if(stdcuts) {
86  analysiscuts = new AliRDHFCutsLctopKpi();
87  if (system == 0) analysiscuts->SetStandardCutsPP2010();
88  else analysiscuts->SetStandardCutsPbPb2010();
89  }
90  else analysiscuts = (AliRDHFCutsLctopKpi*)filecuts->Get(cutsobjname);
91  suffix="Lc";
92  break;
93  case 6:
94  cutsobjname="LctoV0AnalysisCuts";
95  if(stdcuts) {
96  analysiscuts = new AliRDHFCutsLctoV0bachelor();
97  if (system == 0) analysiscuts->SetStandardCutsPP2010();
98  else analysiscuts->SetStandardCutsPbPb2010();
99  }
100  else analysiscuts = (AliRDHFCutsLctoV0*)filecuts->Get(cutsobjname);
101  suffix="LcToV0x";
102  break;
103  }
104 
105  inname+=suffix;
106  out1name+=suffix;
107  out2name+=suffix;
108  out3name+=suffix;
109  out4name=cutsobjname;
110  out4name+=suffix;
111  out5name+=suffix;
112  out6name+=suffix;
113  out7name+=suffix;
114  out8name+=suffix;
115 
116  if(!analysiscuts && filecutsname!="none"){
117  cout<<"Specific AliRDHFCuts not found"<<endl;
118  return;
119  }
120 
121  centr=Form("%.0f%.0f",analysiscuts->GetMinCentrality(),analysiscuts->GetMaxCentrality());
122  inname+=centr;
123  out1name+=centr;
124  out2name+=centr;
125  out3name+=centr;
126  out4name+=centr;
127  out5name+=centr;
128  out6name+=centr;
129  out7name+=centr;
130  out8name+=centr;
131  inname+= finDirname.Data();
132  out1name+= finDirname.Data();
133  out2name+= finDirname.Data();
134  out3name+= finDirname.Data();
135  out4name+= finDirname.Data();
136  out5name+= finDirname.Data();
137  out6name+= finDirname.Data();
138  out7name+= finDirname.Data();
139  out8name+= finDirname.Data();
140 
141  AliAnalysisTaskSEHFQA* taskQA=new AliAnalysisTaskSEHFQA(Form("QA%s",suffix.Data()),ch,analysiscuts);
142 
143  taskQA->SetReadMC(readMC);
144  taskQA->SetSimpleMode(simplemode); // set to kTRUE to go faster in PbPb
145  taskQA->SetTrackOn(trackon);
146  taskQA->SetPIDOn(pidon);
147  taskQA->SetCentralityOn(centralityon);
148  taskQA->SetEvSelectionOn(eventselon);
149  taskQA->SetFlowObsOn(flowobson);
150  taskQA->SetFillDistributionsForTrackEffChecks(filldistribforeffcheckson);
151  mgr->AddTask(taskQA);
152 
153  //
154  // Create containers for input/output
155  AliAnalysisDataContainer *cinput = mgr->CreateContainer(inname,TChain::Class(), AliAnalysisManager::kInputContainer);
156  mgr->ConnectInput(taskQA,0,mgr->GetCommonInputContainer());
157 
158  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(out1name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //events analysed
159  mgr->ConnectOutput(taskQA,1,coutput1);
160 
161  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(out2name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //PID
162  if(pidon) mgr->ConnectOutput(taskQA,2,coutput2);
163 
164  AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(out3name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //quality of tracks
165  if(trackon) mgr->ConnectOutput(taskQA,3,coutput3);
166 
167  AliAnalysisDataContainer *coutput4 = mgr->CreateContainer(out4name,AliRDHFCuts::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //cuts
168  mgr->ConnectOutput(taskQA,4,coutput4);
169 
170  AliAnalysisDataContainer *coutput5 = mgr->CreateContainer(out5name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //quality of centrality
171  if(centralityon) mgr->ConnectOutput(taskQA,5,coutput5);
172 
173  AliAnalysisDataContainer *coutput6 = mgr->CreateContainer(out6name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //quality of centrality
174  if(centralityon) mgr->ConnectOutput(taskQA,6,coutput6);
175 
176  AliAnalysisDataContainer *coutput7 = mgr->CreateContainer(out7name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //event selection
177  if(eventselon) mgr->ConnectOutput(taskQA,7,coutput7);
178 
179  AliAnalysisDataContainer *coutput8 = mgr->CreateContainer(out8name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //flow observables
180  if(flowobson) mgr->ConnectOutput(taskQA,8,coutput8);
181 
182  return taskQA;
183 }
184 
Float_t GetMaxCentrality() const
Definition: AliRDHFCuts.h:272
const char * filename
Definition: TestFCM.C:1
void SetEvSelectionOn(Bool_t evselon=kTRUE)
virtual void SetStandardCutsPbPb2010()
Definition: AliRDHFCuts.h:47
void SetPIDOn(Bool_t pidon=kTRUE)
Float_t GetMinCentrality() const
Definition: AliRDHFCuts.h:271
Class for cuts on AOD reconstructed D+->Kpipi.
void SetTrackOn(Bool_t trackon=kTRUE)
int Int_t
Definition: External.C:63
void SetReadMC(Bool_t mcflag)
setters
AliAnalysisTaskSEHFQA * AddTaskHFQA(AliAnalysisTaskSEHFQA::DecChannel ch, TString filecutsname="", Bool_t readMC=kFALSE, Bool_t simplemode=kFALSE, Int_t system=1, TString finDirname="", Bool_t trackon=kTRUE, Bool_t pidon=kTRUE, Bool_t centralityon=kTRUE, Bool_t eventselon=kTRUE, Bool_t flowobson=kFALSE, Bool_t filldistribforeffcheckson=kFALSE)
Definition: AddTaskHFQA.C:1
void SetFlowObsOn(Bool_t flowobson=kTRUE)
virtual void SetStandardCutsPbPb2011()
Definition: AliRDHFCuts.h:48
void SetFillDistributionsForTrackEffChecks(Bool_t filldistrtrackeffcheckson=kFALSE)
void SetSimpleMode(Bool_t flag)
virtual void SetStandardCutsPP2010()
Definition: AliRDHFCuts.h:46
bool Bool_t
Definition: External.C:53
void SetCentralityOn(Bool_t centron=kTRUE)