AliPhysics  master (3d17d9d)
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 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  ::Fatal("AddTaskHFQA", "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",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 AliRDHFCutsLctoV0();
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 
115  if(!analysiscuts && filecutsname!="none"){
116  cout<<"Specific AliRDHFCuts not found"<<endl;
117  return NULL;
118  }
119 
120  centr=Form("%.0f%.0f",analysiscuts->GetMinCentrality(),analysiscuts->GetMaxCentrality());
121  inname+=centr;
122  out1name+=centr;
123  out2name+=centr;
124  out3name+=centr;
125  out4name+=centr;
126  out5name+=centr;
127  out6name+=centr;
128  out7name+=centr;
129  inname+= finDirname.Data();
130  out1name+= finDirname.Data();
131  out2name+= finDirname.Data();
132  out3name+= finDirname.Data();
133  out4name+= finDirname.Data();
134  out5name+= finDirname.Data();
135  out6name+= finDirname.Data();
136  out7name+= finDirname.Data();
137 
138  AliAnalysisTaskSEHFQA* taskQA=new AliAnalysisTaskSEHFQA(Form("QA%s",suffix.Data()),ch,analysiscuts);
139 
140  taskQA->SetReadMC(readMC);
141  taskQA->SetSimpleMode(simplemode); // set to kTRUE to go faster in PbPb
142  taskQA->SetTrackOn(trackon);
143  taskQA->SetPIDOn(pidon);
144  taskQA->SetCentralityOn(centralityon);
145  taskQA->SetEvSelectionOn(eventselon);
146  taskQA->SetFillDistributionsForTrackEffChecks(filldistribforeffcheckson);
147  mgr->AddTask(taskQA);
148 
149  //
150  // Create containers for input/output
151  AliAnalysisDataContainer *cinput = mgr->CreateContainer(inname,TChain::Class(), AliAnalysisManager::kInputContainer);
152  mgr->ConnectInput(taskQA,0,mgr->GetCommonInputContainer());
153 
154  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(out1name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //events analysed
155  mgr->ConnectOutput(taskQA,1,coutput1);
156 
157  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(out2name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //PID
158  if(pidon) mgr->ConnectOutput(taskQA,2,coutput2);
159 
160  AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(out3name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //quality of tracks
161  if(trackon) mgr->ConnectOutput(taskQA,3,coutput3);
162 
163  AliAnalysisDataContainer *coutput4 = mgr->CreateContainer(out4name,AliRDHFCuts::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //cuts
164  mgr->ConnectOutput(taskQA,4,coutput4);
165 
166  AliAnalysisDataContainer *coutput5 = mgr->CreateContainer(out5name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //quality of centrality
167  if(centralityon) mgr->ConnectOutput(taskQA,5,coutput5);
168 
169  AliAnalysisDataContainer *coutput6 = mgr->CreateContainer(out6name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //quality of centrality
170  if(centralityon) mgr->ConnectOutput(taskQA,6,coutput6);
171 
172  AliAnalysisDataContainer *coutput7 = mgr->CreateContainer(out7name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //event selection
173  if(eventselon) mgr->ConnectOutput(taskQA,7,coutput7);
174 
175  return taskQA;
176 }
177 
Float_t GetMaxCentrality() const
Definition: AliRDHFCuts.h:299
const char * filename
Definition: TestFCM.C:1
void SetEvSelectionOn(Bool_t evselon=kTRUE)
virtual void SetStandardCutsPbPb2010()
Definition: AliRDHFCuts.h:50
void SetPIDOn(Bool_t pidon=kTRUE)
Float_t GetMinCentrality() const
Definition: AliRDHFCuts.h:298
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
virtual void SetStandardCutsPbPb2011()
Definition: AliRDHFCuts.h:51
void SetFillDistributionsForTrackEffChecks(Bool_t filldistrtrackeffcheckson=kFALSE)
void SetSimpleMode(Bool_t flag)
virtual void SetStandardCutsPP2010()
Definition: AliRDHFCuts.h:49
bool Bool_t
Definition: External.C:53
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 filldistribforeffcheckson=kFALSE)
Definition: AddTaskHFQA.C:1
void SetCentralityOn(Bool_t centron=kTRUE)