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