AliPhysics  aaf9c62 (aaf9c62)
AddTaskD0MassCutVarFDSub.C
Go to the documentation of this file.
2  Bool_t filldistr=kFALSE,Bool_t cutOnDistr=kFALSE,
3  Int_t system=0/*0=pp,1=PbPb,2=pPb*/,Int_t flagD0D0bar=0,
4  Float_t minC=0, Float_t maxC=0,
5  TString finDirname="Loose",
6  TString finname="",TString finObjname="D0toKpiCuts", Bool_t flagAOD049=kFALSE,
7  Bool_t FillMassPt=false, Bool_t FillImpPar=false,
8  Bool_t DrawDetSignal=false, Bool_t PIDCheck=false, Bool_t FillMassY=false,
9  Bool_t upgrade=false)
10 {
11  //
12  // AddTask for the AliAnalysisTaskSE for the analysis of D0 candidates using
13  // the cut-variation feed-down subtraction method
14  //
15 
16  // Get the pointer to the existing analysis manager via the static access method.
17  //==============================================================================
18  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
19  if (!mgr) {
20  ::Error("AddTaskD0Distr", "No analysis manager to connect to.");
21  return NULL;
22  }
23 
24  TString filename="",out1name="",out2name="",out3name="",out4name="",out5name="",out6name="",out7name="",out8name="",out9name="", out10name="", inname="";
25  filename = AliAnalysisManager::GetCommonFileName();
26  filename += ":PWG3_D2H_";
27  if(flag==0){
28  filename+="D0InvMass";
29  if(cutOnDistr) filename+="C";
30  if(flagD0D0bar==1)filename+="D0";
31  if(flagD0D0bar==2)filename+="D0bar";
32  //list mass
33  out1name="coutputmassD0Mass";
34  if(cutOnDistr) out1name+="C";
35  if(flagD0D0bar==1)out1name+="D0";
36  if(flagD0D0bar==2)out1name+="D0bar";
37  //list distr
38  out2name="coutputmassD0distr";
39  if(cutOnDistr) out2name+="C";
40  if(flagD0D0bar==1)out2name+="D0";
41  if(flagD0D0bar==2)out2name+="D0bar";
42  //hist entries
43  out3name="nEntriesD0";
44  if(cutOnDistr) out3name+="C";
45  if(flagD0D0bar==1)out3name+="D0";
46  if(flagD0D0bar==2)out3name+="D0bar";
47  //cuts object
48  out4name="cutsD0";
49  if(cutOnDistr) out4name+="C";
50  if(flagD0D0bar==1)out4name+="D0";
51  if(flagD0D0bar==2)out4name+="D0bar";
52 
53  //AliNormalizationCounter
54  out5name="normalizationCounter";
55  if(cutOnDistr) out5name+="C";
56  if(flagD0D0bar==1)out5name+="D0";
57  if(flagD0D0bar==2)out5name+="D0bar";
58 
59  // mass, pt, imp param distr
60  out6name="coutputmassD0MassPt";
61  if(cutOnDistr) out6name+="C";
62  if(flagD0D0bar==1)out6name+="D0";
63  if(flagD0D0bar==2)out6name+="D0bar";
64 
65  out7name ="coutputVarTree";
66 
67  //detector signal hists
68  out8name="detectorSignals";
69  if(cutOnDistr) out8name+="C";
70  if(flagD0D0bar==1)out8name+="D0";
71  if(flagD0D0bar==2)out8name+="D0bar";
72 
73  // mass, y distr
74  out9name="coutputmassD0MassY";
75  if(cutOnDistr) out9name+="C";
76  if(flagD0D0bar==1)out9name+="D0";
77  if(flagD0D0bar==2)out9name+="D0bar";
78 
79  // sparse for FD studies
80  out10name="cSparseFD";
81  if(cutOnDistr) out10name+="C";
82  if(flagD0D0bar==1)out10name+="D0";
83  if(flagD0D0bar==2)out10name+="D0bar";
84 
85  inname="cinputmassD0_0";
86  if(cutOnDistr) inname+="C";
87  if(flagD0D0bar==1)inname+="D0";
88  if(flagD0D0bar==2)inname+="D0bar";
89 
90  } else {
91  filename+="D0InvMassLikeSign";
92  if(cutOnDistr) filename+="C";
93  if(flagD0D0bar==1)filename+="D0";
94  if(flagD0D0bar==2)filename+="D0bar";
95  //list mass
96  out1name="coutputmassLSMass";
97  if(cutOnDistr) out1name+="C";
98  if(flagD0D0bar==1)out1name+="D0";
99  if(flagD0D0bar==2)out1name+="D0bar";
100  //list distr
101  out2name="coutputmassLSdistr";
102  if(cutOnDistr) out2name+="C";
103  if(flagD0D0bar==1)out2name+="D0";
104  if(flagD0D0bar==2)out2name+="D0bar";
105  //hist entries
106  out3name="nEntriesLS";
107  if(cutOnDistr) out3name+="C";
108  if(flagD0D0bar==1)out3name+="D0";
109  if(flagD0D0bar==2)out3name+="D0bar";
110  //cuts object
111  out4name="cutsLS";
112  if(cutOnDistr) out4name+="C";
113  if(flagD0D0bar==1)out4name+="D0";
114  if(flagD0D0bar==2)out4name+="D0bar";
115 
116  //AliNormalizationCounter
117  out5name="normalizationCounterLS";
118  if(cutOnDistr) out5name+="C";
119  if(flagD0D0bar==1)out5name+="D0";
120  if(flagD0D0bar==2)out5name+="D0bar";
121 
122  // mass, pt, imp param distr
123  out6name="coutputmassD0MassPtLS";
124  if(cutOnDistr) out6name+="C";
125  if(flagD0D0bar==1)out6name+="D0";
126  if(flagD0D0bar==2)out6name+="D0bar";
127 
128  out7name ="coutputVarTreeLS";
129 
130  //detector signal hists
131  out8name="detectorSignalsLS";
132  if(cutOnDistr) out8name+="C";
133  if(flagD0D0bar==1)out8name+="D0";
134  if(flagD0D0bar==2)out8name+="D0bar";
135 
136  // mass, y distr
137  out9name="coutputmassD0MassYLS";
138  if(cutOnDistr) out9name+="C";
139  if(flagD0D0bar==1)out9name+="D0";
140  if(flagD0D0bar==2)out9name+="D0bar";
141 
142 
143  // sparse for FD studies
144  out10name="cSparseFD";
145  if(cutOnDistr) out10name+="C";
146  if(flagD0D0bar==1)out10name+="D0";
147  if(flagD0D0bar==2)out10name+="D0bar";
148 
149  inname="cinputmassD0_1";
150  if(cutOnDistr) inname+="C";
151  if(flagD0D0bar==1)inname+="D0";
152  if(flagD0D0bar==2)inname+="D0bar";
153  }
154  filename += finDirname.Data();
155  out1name += finDirname.Data();
156  out2name += finDirname.Data();
157  out3name += finDirname.Data();
158  out4name += finDirname.Data();
159  out5name += finDirname.Data();
160  out6name += finDirname.Data();
161  out7name += finDirname.Data();
162  out8name += finDirname.Data();
163  out9name += finDirname.Data();
164  out10name += finDirname.Data();
165  inname += finDirname.Data();
166 
167  if (upgrade) {
168  filename += "Upgrade";
169  out1name += "Upgrade";
170  out2name += "Upgrade";
171  out3name += "Upgrade";
172  out4name += "Upgrade";
173  out5name += "Upgrade";
174  out6name += "Upgrade";
175  out7name += "Upgrade";
176  out8name += "Upgrade";
177  out9name += "Upgrade";
178  out10name += "Upgrade";
179  }
180 
181  //setting my cut values
182 
183  //cuts order
184  // printf(" |M-MD0| [GeV] < %f\n",fD0toKpiCuts[0]);
185  // printf(" dca [cm] < %f\n",fD0toKpiCuts[1]);
186  // printf(" cosThetaStar < %f\n",fD0toKpiCuts[2]);
187  // printf(" pTK [GeV/c] > %f\n",fD0toKpiCuts[3]);
188  // printf(" pTpi [GeV/c] > %f\n",fD0toKpiCuts[4]);
189  // printf(" |d0K| [cm] < %f\n",fD0toKpiCuts[5]);
190  // printf(" |d0pi| [cm] < %f\n",fD0toKpiCuts[6]);
191  // printf(" d0d0 [cm^2] < %f\n",fD0toKpiCuts[7]);
192  // printf(" cosThetaPoint > %f\n",fD0toKpiCuts[8]);
193 
194  Bool_t stdcuts=kFALSE;
195  TFile* filecuts;
196  if( finname.EqualTo("") ) {
197  stdcuts=kTRUE;
198  } else {
199  filecuts=TFile::Open(finname.Data());
200  if(!filecuts ||(filecuts&& !filecuts->IsOpen())){
201  AliFatal("Input file not found : check your cut object");
202  }
203  }
204 
205  AliRDHFCutsD0toKpi* RDHFD0toKpi=new AliRDHFCutsD0toKpi();
206  if(stdcuts) {
207  if(system==0) RDHFD0toKpi->SetStandardCutsPP2010();
208  else {
209  RDHFD0toKpi->SetStandardCutsPbPb2011();
210  if(minC!=0 && maxC!=0) { //if centrality 0 and 0 leave the values in the cut object
211  RDHFD0toKpi->SetMinCentrality(minC);
212  RDHFD0toKpi->SetMaxCentrality(maxC);
213  }
214  if(flagAOD049)RDHFD0toKpi->SetUseAOD049(kTRUE);
216  }
217  }
218  else {
219  RDHFD0toKpi = (AliRDHFCutsD0toKpi*)filecuts->Get(finObjname.Data());
220  if(!RDHFD0toKpi){
221  AliFatal("Specific AliRDHFCuts not found");
222  return;
223  }
224  if(flagAOD049)RDHFD0toKpi->SetUseAOD049(kTRUE);
225  if(minC!=0 && maxC!=0) { //if centrality 0 and 0 leave the values in the cut object
226  RDHFD0toKpi->SetMinCentrality(minC);
227  RDHFD0toKpi->SetMaxCentrality(maxC);
228  }
229  }
230  // RDHFD0toKpi->SetName(Form("D0toKpiCuts%d",flag));
231 
232  TString centr="";
233  if(minC!=0 && maxC!=0) centr = Form("%.0f%.0f",minC,maxC);
234  else centr = Form("%.0f%.0f",RDHFD0toKpi->GetMinCentrality(),RDHFD0toKpi->GetMaxCentrality());
235  out1name+=centr;
236  out2name+=centr;
237  out3name+=centr;
238  out4name+=centr;
239  out5name+=centr;
240  out6name+=centr;
241  out7name+=centr;
242  out8name+=centr;
243  out9name+=centr;
244  out10name+=centr;
245  inname+=centr;
246 
247  // Aanalysis task
248  TString taskname="MassAndDistrAnalysisCutVarFD";
249  if (flag==0)taskname.Prepend("D0");
250  else taskname.Prepend("LS");
251  AliAnalysisTaskSED0MassCutVarFDSub *massD0Task = new AliAnalysisTaskSED0MassCutVarFDSub(taskname.Data(),RDHFD0toKpi);
252  massD0Task->SetDebugLevel(0);
253  massD0Task->SetArray(flag);
254  massD0Task->SetReadMC(readMC);
255  massD0Task->SetCutOnDistr(cutOnDistr);
256  massD0Task->SetUsePid4Distr(kFALSE);
257  massD0Task->SetFillOnlyD0D0bar(flagD0D0bar);
258  massD0Task->SetSystem(system); //0=pp, 1=PbPb
259  massD0Task->SetFillVarHists(filldistr); // default is FALSE if System=PbPb
260 
261  massD0Task->SetFillPtHistos(FillMassPt);
262  massD0Task->SetFillImpactParameterHistos(FillImpPar);
263  massD0Task->SetFillYHistos(FillMassY);
264  massD0Task->SetDrawDetSignal(DrawDetSignal);
265  massD0Task->SetPIDCheck(PIDCheck);
266  // massD0Task->SetRejectSDDClusters(kTRUE);
267 
268  //massD0Task->SetWriteVariableTree(kTRUE);
269 
270  mgr->AddTask(massD0Task);
271 
272  //
273  // Create containers for input/output
274  AliAnalysisDataContainer *cinputmassD0 = mgr->CreateContainer(inname,TChain::Class(),
275  AliAnalysisManager::kInputContainer);
276 
277  AliAnalysisDataContainer *coutputmassD01 = mgr->CreateContainer(out1name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //mass
278  AliAnalysisDataContainer *coutputmassD02 = mgr->CreateContainer(out2name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //distr
279  AliAnalysisDataContainer *coutputmassD03 = mgr->CreateContainer(out3name,TH1F::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //nev
280  AliAnalysisDataContainer *coutputmassD04 = mgr->CreateContainer(out4name,AliRDHFCutsD0toKpi::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //cuts
281  AliAnalysisDataContainer *coutputmassD05 = mgr->CreateContainer(out5name,AliNormalizationCounter::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //counter
282  AliAnalysisDataContainer *coutputmassD06 = mgr->CreateContainer(out6name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //mass vs pt vs impt par
283  AliAnalysisDataContainer *coutputmassD07 = mgr->CreateContainer(out7name,TTree::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //mass vs pt vs impt par
284  AliAnalysisDataContainer *coutputmassD08 = mgr->CreateContainer(out8name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //dedx
285  AliAnalysisDataContainer *coutputmassD09 = mgr->CreateContainer(out9name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //mass vs y
286  AliAnalysisDataContainer *coutputmassD010 = mgr->CreateContainer(out10name,THnSparseF::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //Sparse for FD study
287 
288 
289  mgr->ConnectInput(massD0Task,0,mgr->GetCommonInputContainer());
290 
291  mgr->ConnectOutput(massD0Task,1,coutputmassD01);
292  mgr->ConnectOutput(massD0Task,2,coutputmassD02);
293  mgr->ConnectOutput(massD0Task,3,coutputmassD03);
294  mgr->ConnectOutput(massD0Task,4,coutputmassD04);
295  mgr->ConnectOutput(massD0Task,5,coutputmassD05);
296  mgr->ConnectOutput(massD0Task,6,coutputmassD06);
297  mgr->ConnectOutput(massD0Task,7,coutputmassD07);
298  mgr->ConnectOutput(massD0Task,8,coutputmassD08);
299  mgr->ConnectOutput(massD0Task,9,coutputmassD09);
300  mgr->ConnectOutput(massD0Task,10,coutputmassD010);
301 
302  return massD0Task;
303 }
Float_t GetMaxCentrality() const
Definition: AliRDHFCuts.h:282
const char * filename
Definition: TestFCM.C:1
void SetUseAOD049(Bool_t flag=kTRUE)
Definition: AliRDHFCuts.h:210
void SetUseCentrality(Int_t flag=1)
virtual void SetStandardCutsPP2010()
Float_t GetMinCentrality() const
Definition: AliRDHFCuts.h:281
int Int_t
Definition: External.C:63
void SetMinCentrality(Float_t minCentrality=0.)
Definition: AliRDHFCuts.h:51
float Float_t
Definition: External.C:68
void SetMaxCentrality(Float_t maxCentrality=100.)
Definition: AliRDHFCuts.h:52
void SetArray(Int_t type=AliAnalysisTaskSED0MassCutVarFDSub::kD0)
AliAnalysisTaskSED0MassCutVarFDSub * AddTaskD0MassCutVarFDSub(Int_t flag=0, Bool_t readMC=kFALSE, Bool_t filldistr=kFALSE, Bool_t cutOnDistr=kFALSE, Int_t system=0, Int_t flagD0D0bar=0, Float_t minC=0, Float_t maxC=0, TString finDirname="Loose", TString finname="", TString finObjname="D0toKpiCuts", Bool_t flagAOD049=kFALSE, Bool_t FillMassPt=false, Bool_t FillImpPar=false, Bool_t DrawDetSignal=false, Bool_t PIDCheck=false, Bool_t FillMassY=false, Bool_t upgrade=false)
bool Bool_t
Definition: External.C:53
virtual void SetStandardCutsPbPb2011()