]>
Commit | Line | Data |
---|---|---|
49061176 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | ///////////////////////////////////////////////////////////// | |
17 | // | |
18 | // AliAnalysisTaskSE for D0 candidates invariant mass histogram | |
a41f6fad | 19 | // and comparison with the MC truth and cut variables distributions. |
49061176 | 20 | // |
21 | // Authors: A.Dainese, andrea.dainese@lnl.infn.it | |
feb73eca | 22 | // Chiara Bianchin, chiara.bianchin@pd.infn.it (invariant mass) |
23 | // Carmelo Di Giglio, carmelo.digiglio@ba.infn.it (like sign) | |
49061176 | 24 | ///////////////////////////////////////////////////////////// |
25 | ||
26 | #include <Riostream.h> | |
27 | #include <TClonesArray.h> | |
527f330b | 28 | #include <TCanvas.h> |
49061176 | 29 | #include <TNtuple.h> |
30 | #include <TList.h> | |
31 | #include <TH1F.h> | |
a41f6fad | 32 | #include <TH2F.h> |
33 | #include <TDatabasePDG.h> | |
49061176 | 34 | |
5b2e5fae | 35 | #include <AliAnalysisDataSlot.h> |
36 | #include <AliAnalysisDataContainer.h> | |
b557eb43 | 37 | #include "AliAnalysisManager.h" |
34137226 | 38 | #include "AliESDtrack.h" |
4e61a020 | 39 | #include "AliVertexerTracks.h" |
b557eb43 | 40 | #include "AliAODHandler.h" |
49061176 | 41 | #include "AliAODEvent.h" |
42 | #include "AliAODVertex.h" | |
43 | #include "AliAODTrack.h" | |
44 | #include "AliAODMCHeader.h" | |
45 | #include "AliAODMCParticle.h" | |
46 | #include "AliAODRecoDecayHF2Prong.h" | |
47 | #include "AliAODRecoCascadeHF.h" | |
48 | #include "AliAnalysisVertexingHF.h" | |
49 | #include "AliAnalysisTaskSE.h" | |
50 | #include "AliAnalysisTaskSED0Mass.h" | |
a96083b9 | 51 | #include "AliNormalizationCounter.h" |
b557eb43 | 52 | |
49061176 | 53 | ClassImp(AliAnalysisTaskSED0Mass) |
54 | ||
55 | ||
56 | //________________________________________________________________________ | |
57 | AliAnalysisTaskSED0Mass::AliAnalysisTaskSED0Mass(): | |
58 | AliAnalysisTaskSE(), | |
ea0d8716 | 59 | fOutputMass(0), |
60 | fDistr(0), | |
61 | fNentries(0), | |
ea0d8716 | 62 | fCuts(0), |
feb73eca | 63 | fArray(0), |
ce39f0ac | 64 | fReadMC(0), |
40445ada | 65 | fCutOnDistr(0), |
6b3e3c78 | 66 | fUsePid4Distr(0), |
a96083b9 | 67 | fCounter(0), |
87020237 | 68 | fNPtBins(1), |
449b1302 | 69 | fLsNormalization(1.), |
70 | fFillOnlyD0D0bar(0) | |
feb73eca | 71 | |
ea0d8716 | 72 | |
49061176 | 73 | { |
74 | // Default constructor | |
75 | } | |
76 | ||
77 | //________________________________________________________________________ | |
ea0d8716 | 78 | AliAnalysisTaskSED0Mass::AliAnalysisTaskSED0Mass(const char *name,AliRDHFCutsD0toKpi* cuts): |
49061176 | 79 | AliAnalysisTaskSE(name), |
ea0d8716 | 80 | fOutputMass(0), |
34137226 | 81 | fDistr(0), |
ea0d8716 | 82 | fNentries(0), |
ea0d8716 | 83 | fCuts(0), |
feb73eca | 84 | fArray(0), |
ce39f0ac | 85 | fReadMC(0), |
40445ada | 86 | fCutOnDistr(0), |
6b3e3c78 | 87 | fUsePid4Distr(0), |
a96083b9 | 88 | fCounter(0), |
87020237 | 89 | fNPtBins(1), |
449b1302 | 90 | fLsNormalization(1.), |
91 | fFillOnlyD0D0bar(0) | |
ea0d8716 | 92 | |
49061176 | 93 | { |
94 | // Default constructor | |
87020237 | 95 | |
96 | fNPtBins=cuts->GetNPtBins(); | |
700e80e0 | 97 | // fTotPosPairs=new Int_t[fNPtBins]; |
98 | // fTotNegPairs=new Int_t[fNPtBins]; | |
99 | // for(Int_t i=0;i<fNPtBins;i++) {fTotPosPairs[i]=0; fTotNegPairs[i]=0;} | |
4b4a1d25 | 100 | |
ea0d8716 | 101 | fCuts=cuts; |
102 | ||
103 | // Output slot #1 writes into a TList container (mass with cuts) | |
49061176 | 104 | DefineOutput(1,TList::Class()); //My private output |
ea0d8716 | 105 | // Output slot #2 writes into a TList container (distributions) |
a4ae02cd | 106 | DefineOutput(2,TList::Class()); //My private output |
ea0d8716 | 107 | // Output slot #3 writes into a TH1F container (number of events) |
a4ae02cd | 108 | DefineOutput(3,TH1F::Class()); //My private output |
700e80e0 | 109 | // Output slot #4 writes into a TList container (cuts) |
110 | DefineOutput(4,AliRDHFCutsD0toKpi::Class()); //My private output | |
111 | // Output slot #5 writes Normalization Counter | |
112 | DefineOutput(5,AliNormalizationCounter::Class()); | |
49061176 | 113 | } |
114 | ||
115 | //________________________________________________________________________ | |
116 | AliAnalysisTaskSED0Mass::~AliAnalysisTaskSED0Mass() | |
117 | { | |
ea0d8716 | 118 | if (fOutputMass) { |
119 | delete fOutputMass; | |
120 | fOutputMass = 0; | |
a4ae02cd | 121 | } |
a41f6fad | 122 | if (fDistr) { |
123 | delete fDistr; | |
124 | fDistr = 0; | |
125 | } | |
ea0d8716 | 126 | if (fCuts) { |
127 | delete fCuts; | |
128 | fCuts = 0; | |
49061176 | 129 | } |
46c96ce5 | 130 | if (fNentries){ |
131 | delete fNentries; | |
132 | fNentries = 0; | |
133 | } | |
a96083b9 | 134 | if(fCounter){ |
135 | delete fCounter; | |
136 | fCounter=0; | |
137 | } | |
ea0d8716 | 138 | |
49061176 | 139 | } |
140 | ||
141 | //________________________________________________________________________ | |
142 | void AliAnalysisTaskSED0Mass::Init() | |
143 | { | |
144 | // Initialization | |
145 | ||
146 | if(fDebug > 1) printf("AnalysisTaskSED0Mass::Init() \n"); | |
147 | ||
ea0d8716 | 148 | |
ea0d8716 | 149 | AliRDHFCutsD0toKpi* copyfCuts=new AliRDHFCutsD0toKpi(*fCuts); |
700e80e0 | 150 | const char* nameoutput=GetOutputSlot(4)->GetContainer()->GetName(); |
4e61a020 | 151 | copyfCuts->SetName(nameoutput); |
ea0d8716 | 152 | // Post the data |
700e80e0 | 153 | PostData(4,copyfCuts); |
4e61a020 | 154 | |
49061176 | 155 | |
49061176 | 156 | return; |
157 | } | |
158 | ||
159 | //________________________________________________________________________ | |
160 | void AliAnalysisTaskSED0Mass::UserCreateOutputObjects() | |
161 | { | |
162 | ||
163 | // Create the output container | |
164 | // | |
165 | if(fDebug > 1) printf("AnalysisTaskSED0Mass::UserCreateOutputObjects() \n"); | |
166 | ||
167 | // Several histograms are more conveniently managed in a TList | |
ea0d8716 | 168 | fOutputMass = new TList(); |
169 | fOutputMass->SetOwner(); | |
170 | fOutputMass->SetName("listMass"); | |
49061176 | 171 | |
a41f6fad | 172 | fDistr = new TList(); |
173 | fDistr->SetOwner(); | |
174 | fDistr->SetName("distributionslist"); | |
175 | ||
0108fa62 | 176 | TString nameMass=" ",nameSgn27=" ",nameSgn=" ", nameBkg=" ", nameRfl=" ",nameMassNocutsS =" ",nameMassNocutsB =" ", namedistr=" "; |
49061176 | 177 | |
ea0d8716 | 178 | for(Int_t i=0;i<fCuts->GetNPtBins();i++){ |
b272aebf | 179 | |
7646d6da | 180 | nameMass="histMass_"; |
ea0d8716 | 181 | nameMass+=i; |
9de8c723 | 182 | nameSgn27="histSgn27_"; |
ea0d8716 | 183 | nameSgn27+=i; |
7646d6da | 184 | nameSgn="histSgn_"; |
ea0d8716 | 185 | nameSgn+=i; |
7646d6da | 186 | nameBkg="histBkg_"; |
ea0d8716 | 187 | nameBkg+=i; |
a4ae02cd | 188 | nameRfl="histRfl_"; |
ea0d8716 | 189 | nameRfl+=i; |
0108fa62 | 190 | nameMassNocutsS="hMassS_"; |
ea0d8716 | 191 | nameMassNocutsS+=i; |
0108fa62 | 192 | nameMassNocutsB="hMassB_"; |
ea0d8716 | 193 | nameMassNocutsB+=i; |
7646d6da | 194 | |
b272aebf | 195 | //histograms of cut variable distributions |
196 | ||
197 | // pT | |
198 | namedistr="hptpiS_"; | |
ea0d8716 | 199 | namedistr+=i; |
b272aebf | 200 | TH1F *hptpiS = new TH1F(namedistr.Data(), "P_{T} distribution (pions);p_{T} [GeV/c]",200,0.,8.); |
201 | ||
202 | namedistr="hptKS_"; | |
ea0d8716 | 203 | namedistr+=i; |
b272aebf | 204 | TH1F *hptKS = new TH1F(namedistr.Data(), "P_{T} distribution (kaons);p_{T} [GeV/c]",200,0.,8.); |
205 | ||
206 | namedistr="hptB_"; | |
ea0d8716 | 207 | namedistr+=i; |
b272aebf | 208 | TH1F *hptB = new TH1F(namedistr.Data(), "P_{T} distribution;p_{T} [GeV/c]",200,0.,8.); |
209 | ||
210 | // pT no mass cut | |
211 | namedistr="hptpiSnoMcut_"; | |
ea0d8716 | 212 | namedistr+=i; |
b272aebf | 213 | TH1F *hptpiSnoMcut = new TH1F(namedistr.Data(), "P_{T} distribution (pions);p_{T} [GeV/c]",200,0.,8.); |
214 | ||
215 | namedistr="hptKSnoMcut_"; | |
ea0d8716 | 216 | namedistr+=i; |
b272aebf | 217 | TH1F *hptKSnoMcut = new TH1F(namedistr.Data(), "P_{T} distribution (kaons);p_{T} [GeV/c]",200,0.,8.); |
218 | ||
219 | namedistr="hptB1prongnoMcut_"; | |
ea0d8716 | 220 | namedistr+=i; |
b272aebf | 221 | TH1F *hptB1pnoMcut = new TH1F(namedistr.Data(), "P_{T} distribution;p_{T} [GeV/c]",200,0.,8.); |
222 | ||
223 | namedistr="hptB2prongsnoMcut_"; | |
ea0d8716 | 224 | namedistr+=i; |
b272aebf | 225 | TH1F *hptB2pnoMcut = new TH1F(namedistr.Data(), "P_{T} distribution;p_{T} [GeV/c]",200,0.,8.); |
226 | ||
227 | ||
228 | // dca | |
229 | namedistr="hdcaS_"; | |
ea0d8716 | 230 | namedistr+=i; |
b272aebf | 231 | TH1F *hdcaS = new TH1F(namedistr.Data(), "DCA distribution;dca [cm]",200,0.,0.1); |
232 | namedistr="hdcaB_"; | |
ea0d8716 | 233 | namedistr+=i; |
b272aebf | 234 | TH1F *hdcaB = new TH1F(namedistr.Data(), "DCA distribution;dca [cm]",200,0.,0.1); |
235 | ||
236 | // costhetastar | |
237 | namedistr="hcosthetastarS_"; | |
ea0d8716 | 238 | namedistr+=i; |
b272aebf | 239 | TH1F *hcosthetastarS = new TH1F(namedistr.Data(), "cos#theta* distribution;cos#theta*",200,-1.,1.); |
240 | namedistr="hcosthetastarB_"; | |
ea0d8716 | 241 | namedistr+=i; |
b272aebf | 242 | TH1F *hcosthetastarB = new TH1F(namedistr.Data(), "cos#theta* distribution;cos#theta*",200,-1.,1.); |
243 | ||
244 | // impact parameter | |
245 | namedistr="hd0piS_"; | |
ea0d8716 | 246 | namedistr+=i; |
b272aebf | 247 | TH1F *hd0piS = new TH1F(namedistr.Data(), "Impact parameter distribution (pions);d0(#pi) [cm]",200,-0.1,0.1); |
248 | ||
249 | namedistr="hd0KS_"; | |
ea0d8716 | 250 | namedistr+=i; |
b272aebf | 251 | TH1F *hd0KS = new TH1F(namedistr.Data(), "Impact parameter distribution (kaons);d0(K) [cm]",200,-0.1,0.1); |
4e61a020 | 252 | |
b272aebf | 253 | namedistr="hd0B_"; |
ea0d8716 | 254 | namedistr+=i; |
4e61a020 | 255 | TH1F *hd0B = new TH1F(namedistr.Data(), "Impact parameter distribution (both);d0 [cm]",200,-0.1,0.1); |
256 | ||
257 | namedistr="hd0p0B_"; | |
258 | namedistr+=i; | |
259 | TH1F *hd0p0B = new TH1F(namedistr.Data(), "Impact parameter distribution (prong +);d0 [cm]",200,-0.1,0.1); | |
260 | ||
6b3e3c78 | 261 | namedistr="hd0moresB_"; |
262 | namedistr+=i; | |
263 | TH1F *hd0moresB = new TH1F(namedistr.Data(), "Impact parameter distribution (both);d0 [cm]",200,-0.1,0.1); | |
264 | ||
265 | namedistr="hd0d0moresB_"; | |
266 | namedistr+=i; | |
267 | TH1F *hd0d0moresB = new TH1F(namedistr.Data(), "Impact parameter distribution (prong +);d0 [cm]",200,-0.001,0.001); | |
268 | ||
269 | namedistr="hd0vmoresB_"; | |
270 | namedistr+=i; | |
271 | TH1F *hd0vmoresB = new TH1F(namedistr.Data(), "Impact parameter distribution (both);d0 [cm]",200,-0.1,0.1); | |
272 | ||
273 | namedistr="hd0d0vmoresB_"; | |
274 | namedistr+=i; | |
275 | TH1F *hd0d0vmoresB = new TH1F(namedistr.Data(), "Impact parameter distribution (prong +);d0 [cm]",200,-0.001,0.001); | |
276 | ||
4e61a020 | 277 | namedistr="hd0p1B_"; |
278 | namedistr+=i; | |
279 | TH1F *hd0p1B = new TH1F(namedistr.Data(), "Impact parameter distribution (prong -);d0 [cm]",200,-0.1,0.1); | |
280 | ||
281 | namedistr="hd0vpiS_"; | |
282 | namedistr+=i; | |
283 | TH1F *hd0vpiS = new TH1F(namedistr.Data(), "Impact parameter distribution (pions)(vtx w/o these tracks);d0(#pi) [cm]",200,-0.1,0.1); | |
284 | ||
285 | namedistr="hd0vKS_"; | |
286 | namedistr+=i; | |
287 | TH1F *hd0vKS = new TH1F(namedistr.Data(), "Impact parameter distribution (kaons) (vtx w/o these tracks);d0(K) [cm]",200,-0.1,0.1); | |
288 | namedistr="hd0vB_"; | |
289 | namedistr+=i; | |
290 | TH1F *hd0vB = new TH1F(namedistr.Data(), "Impact parameter distribution (vtx w/o these tracks);d0 [cm]",200,-0.1,0.1); | |
291 | ||
292 | namedistr="hd0vp0B_"; | |
293 | namedistr+=i; | |
294 | TH1F *hd0vp0B = new TH1F(namedistr.Data(), "Impact parameter distribution (prong + ** vtx w/o these tracks);d0 [cm]",200,-0.1,0.1); | |
295 | ||
296 | namedistr="hd0vp1B_"; | |
297 | namedistr+=i; | |
298 | TH1F *hd0vp1B = new TH1F(namedistr.Data(), "Impact parameter distribution (prong - ** vtx w/o these tracks);d0 [cm]",200,-0.1,0.1); | |
b272aebf | 299 | |
300 | namedistr="hd0d0S_"; | |
ea0d8716 | 301 | namedistr+=i; |
b272aebf | 302 | TH1F *hd0d0S = new TH1F(namedistr.Data(), "d_{0}#timesd_{0} distribution;d_{0}#timesd_{0} [cm^{2}]",200,-0.001,0.001); |
303 | namedistr="hd0d0B_"; | |
ea0d8716 | 304 | namedistr+=i; |
b272aebf | 305 | TH1F *hd0d0B = new TH1F(namedistr.Data(), "d_{0}#timesd_{0} distribution;d_{0}#timesd_{0} [cm^{2}]",200,-0.001,0.001); |
306 | ||
4e61a020 | 307 | namedistr="hd0d0vS_"; |
308 | namedistr+=i; | |
309 | TH1F *hd0d0vS = new TH1F(namedistr.Data(), "d_{0}#timesd_{0} distribution (vtx w/o these tracks);d_{0}#timesd_{0} [cm^{2}]",200,-0.001,0.001); | |
310 | namedistr="hd0d0vB_"; | |
311 | namedistr+=i; | |
312 | TH1F *hd0d0vB = new TH1F(namedistr.Data(), "d_{0}#timesd_{0} distribution (vtx w/o these tracks);d_{0}#timesd_{0} [cm^{2}]",200,-0.001,0.001); | |
313 | ||
314 | //decay lenght | |
315 | namedistr="hdeclS_"; | |
316 | namedistr+=i; | |
6b3e3c78 | 317 | TH1F *hdeclengthS = new TH1F(namedistr.Data(), "Decay Length distribution;Decay Length [cm]",200,0,0.15); |
4e61a020 | 318 | |
319 | namedistr="hdeclB_"; | |
320 | namedistr+=i; | |
6b3e3c78 | 321 | TH1F *hdeclengthB = new TH1F(namedistr.Data(), "Decay Length distribution;Decay Length [cm]",200,0,0.15); |
4e61a020 | 322 | |
323 | namedistr="hnormdeclS_"; | |
324 | namedistr+=i; | |
6b3e3c78 | 325 | TH1F *hnormdeclengthS = new TH1F(namedistr.Data(), "Normalized Decay Length distribution;Decay Length/Err ",200,0,6.); |
4e61a020 | 326 | |
327 | namedistr="hnormdeclB_"; | |
328 | namedistr+=i; | |
6b3e3c78 | 329 | TH1F *hnormdeclengthB = new TH1F(namedistr.Data(), "Normalized Decay Length distribution;Decay Length/Err ",200,0,6.); |
4e61a020 | 330 | |
a2121012 | 331 | namedistr="hdeclvS_"; |
332 | namedistr+=i; | |
333 | TH1F *hdeclengthvS = new TH1F(namedistr.Data(), "Decay Length distribution (vtx w/o tracks);Decay Length [cm]",200,0,0.6); | |
334 | ||
335 | namedistr="hdeclvB_"; | |
336 | namedistr+=i; | |
337 | TH1F *hdeclengthvB = new TH1F(namedistr.Data(), "Decay Length distribution (vtx w/o tracks);Decay Length [cm]",200,0,0.6); | |
338 | ||
339 | namedistr="hnormdeclvS_"; | |
340 | namedistr+=i; | |
341 | TH1F *hnormdeclengthvS = new TH1F(namedistr.Data(), "Normalized Decay Length distribution (vtx w/o tracks);Decay Length/Err ",200,0,10.); | |
342 | ||
343 | namedistr="hnormdeclvB_"; | |
344 | namedistr+=i; | |
345 | TH1F *hnormdeclengthvB = new TH1F(namedistr.Data(), "Normalized Decay Length distribution (vtx w/o tracks);Decay Length/Err ",200,0,10.); | |
346 | ||
4e61a020 | 347 | // costhetapoint |
b272aebf | 348 | namedistr="hcosthetapointS_"; |
ea0d8716 | 349 | namedistr+=i; |
b272aebf | 350 | TH1F *hcosthetapointS = new TH1F(namedistr.Data(), "cos#theta_{Point} distribution;cos#theta_{Point}",200,0,1.); |
351 | namedistr="hcosthetapointB_"; | |
ea0d8716 | 352 | namedistr+=i; |
b272aebf | 353 | TH1F *hcosthetapointB = new TH1F(namedistr.Data(), "cos#theta_{Point} distribution;cos#theta_{Point}",200,0,1.); |
354 | ||
6b3e3c78 | 355 | namedistr="hcosthetapointmoresB_"; |
356 | namedistr+=i; | |
357 | TH1F *hcosthetapointmoresB = new TH1F(namedistr.Data(), "cos#theta_{Point} distribution;cos#theta_{Point}",200,0,1.); | |
358 | ||
4e61a020 | 359 | // costhetapoint vs d0 or d0d0 |
360 | namedistr="hcosthpointd0S_"; | |
361 | namedistr+=i; | |
362 | TH2F *hcosthpointd0S= new TH2F(namedistr.Data(),"Correlation cos#theta_{Point}-d_{0};cos#theta_{Point};d_{0} [cm^{2}]",200,0,1.,200,-0.001,0.001); | |
363 | ||
364 | namedistr="hcosthpointd0B_"; | |
365 | namedistr+=i; | |
366 | TH2F *hcosthpointd0B= new TH2F(namedistr.Data(),"Correlation cos#theta_{Point}-d_{0};cos#theta_{Point};d_{0} [cm^{2}]",200,0,1.,200,-0.001,0.001); | |
367 | ||
b272aebf | 368 | namedistr="hcosthpointd0d0S_"; |
ea0d8716 | 369 | namedistr+=i; |
b272aebf | 370 | TH2F *hcosthpointd0d0S= new TH2F(namedistr.Data(),"Correlation cos#theta_{Point}-d_{0}#timesd_{0};cos#theta_{Point};d_{0}#timesd_{0} [cm^{2}]",200,0,1.,200,-0.001,0.001); |
371 | namedistr="hcosthpointd0d0B_"; | |
ea0d8716 | 372 | namedistr+=i; |
b272aebf | 373 | TH2F *hcosthpointd0d0B= new TH2F(namedistr.Data(),"Correlation cos#theta_{Point}-d_{0}#timesd_{0};cos#theta_{Point};d_{0}#timesd_{0} [cm^{2}]",200,0,1.,200,-0.001,0.001); |
374 | ||
375 | fDistr->Add(hptpiS); | |
376 | fDistr->Add(hptKS); | |
377 | fDistr->Add(hptB); | |
378 | ||
379 | fDistr->Add(hptpiSnoMcut); | |
380 | fDistr->Add(hptKSnoMcut); | |
381 | fDistr->Add(hptB1pnoMcut); | |
382 | fDistr->Add(hptB2pnoMcut); | |
383 | ||
384 | fDistr->Add(hdcaS); | |
385 | fDistr->Add(hdcaB); | |
386 | ||
387 | fDistr->Add(hd0piS); | |
388 | fDistr->Add(hd0KS); | |
389 | fDistr->Add(hd0B); | |
4e61a020 | 390 | fDistr->Add(hd0p0B); |
6b3e3c78 | 391 | fDistr->Add(hd0moresB); |
4e61a020 | 392 | fDistr->Add(hd0p1B); |
393 | ||
394 | fDistr->Add(hd0vpiS); | |
395 | fDistr->Add(hd0vKS); | |
396 | fDistr->Add(hd0vB); | |
397 | fDistr->Add(hd0vp0B); | |
398 | fDistr->Add(hd0vp1B); | |
6b3e3c78 | 399 | fDistr->Add(hd0vmoresB); |
b272aebf | 400 | |
401 | fDistr->Add(hd0d0S); | |
402 | fDistr->Add(hd0d0B); | |
6b3e3c78 | 403 | fDistr->Add(hd0d0moresB); |
b272aebf | 404 | |
4e61a020 | 405 | fDistr->Add(hd0d0vS); |
406 | fDistr->Add(hd0d0vB); | |
6b3e3c78 | 407 | fDistr->Add(hd0d0vmoresB); |
4e61a020 | 408 | |
b272aebf | 409 | fDistr->Add(hcosthetastarS); |
410 | fDistr->Add(hcosthetastarB); | |
411 | ||
412 | fDistr->Add(hcosthetapointS); | |
413 | fDistr->Add(hcosthetapointB); | |
6b3e3c78 | 414 | fDistr->Add(hcosthetapointmoresB); |
b272aebf | 415 | |
4e61a020 | 416 | fDistr->Add(hdeclengthS); |
417 | fDistr->Add(hdeclengthB); | |
418 | ||
419 | fDistr->Add(hnormdeclengthS); | |
420 | fDistr->Add(hnormdeclengthB); | |
421 | ||
a2121012 | 422 | fDistr->Add(hdeclengthvS); |
423 | fDistr->Add(hdeclengthvB); | |
424 | ||
425 | fDistr->Add(hnormdeclengthvS); | |
426 | fDistr->Add(hnormdeclengthvB); | |
427 | ||
4e61a020 | 428 | fDistr->Add(hcosthpointd0S); |
429 | fDistr->Add(hcosthpointd0B); | |
430 | ||
b272aebf | 431 | fDistr->Add(hcosthpointd0d0S); |
432 | fDistr->Add(hcosthpointd0d0B); | |
433 | ||
434 | ||
a41f6fad | 435 | //histograms of invariant mass distributions |
436 | ||
50027560 | 437 | TH1F* tmpMt = new TH1F(nameMass.Data(),"D^{0} invariant mass; M [GeV]; Entries",200,1.5648,2.1648); |
46c96ce5 | 438 | TH1F *tmpMl=(TH1F*)tmpMt->Clone(); |
439 | tmpMt->Sumw2(); | |
440 | tmpMl->Sumw2(); | |
a4ae02cd | 441 | |
9de8c723 | 442 | //to compare with AliAnalysisTaskCharmFraction |
50027560 | 443 | TH1F* tmpS27t = new TH1F(nameSgn27.Data(),"D^{0} invariant mass in M(D^{0}) +/- 27 MeV - MC; M [GeV]; Entries",200,1.5648,2.1648); |
9de8c723 | 444 | TH1F *tmpS27l=(TH1F*)tmpS27t->Clone(); |
445 | tmpS27t->Sumw2(); | |
446 | tmpS27l->Sumw2(); | |
0108fa62 | 447 | |
448 | //distribution w/o cuts | |
6321ee46 | 449 | // TH1F* tmpMS = new TH1F(nameMassNocutsS.Data(),"D^{0} invariant mass; M [GeV]; Entries",300,0.7,3.); |
50027560 | 450 | TH1F* tmpMS = new TH1F(nameMassNocutsS.Data(),"D^{0} invariant mass; M [GeV]; Entries",300,1.5648,2.1648); //range (MD0-300MeV, mD0 + 300MeV) |
6321ee46 | 451 | TH1F *tmpMB=(TH1F*)tmpMS->Clone(); |
0108fa62 | 452 | tmpMB->SetName(nameMassNocutsB.Data()); |
453 | tmpMS->Sumw2(); | |
454 | tmpMB->Sumw2(); | |
455 | ||
456 | //MC signal and background | |
50027560 | 457 | TH1F* tmpSt = new TH1F(nameSgn.Data(), "D^{0} invariant mass - MC; M [GeV]; Entries",200,1.5648,2.1648); |
46c96ce5 | 458 | TH1F *tmpSl=(TH1F*)tmpSt->Clone(); |
459 | tmpSt->Sumw2(); | |
460 | tmpSl->Sumw2(); | |
a4ae02cd | 461 | |
50027560 | 462 | TH1F* tmpBt = new TH1F(nameBkg.Data(), "Background invariant mass - MC; M [GeV]; Entries",200,1.5648,2.1648); |
46c96ce5 | 463 | TH1F *tmpBl=(TH1F*)tmpBt->Clone(); |
464 | tmpBt->Sumw2(); | |
465 | tmpBl->Sumw2(); | |
a4ae02cd | 466 | |
feb73eca | 467 | //Reflection: histo filled with D0Mass which pass the cut (also) as D0bar and with D0bar which pass (also) the cut as D0 |
50027560 | 468 | TH1F* tmpRt = new TH1F(nameRfl.Data(), "Reflected signal invariant mass - MC; M [GeV]; Entries",200,1.5648,2.1648); |
46c96ce5 | 469 | TH1F *tmpRl=(TH1F*)tmpRt->Clone(); |
470 | tmpRt->Sumw2(); | |
471 | tmpRl->Sumw2(); | |
a4ae02cd | 472 | // printf("Created histograms %s\t%s\t%s\t%s\n",tmpM->GetName(),tmpS->GetName(),tmpB->GetName(),tmpR->GetName()); |
473 | ||
ea0d8716 | 474 | fOutputMass->Add(tmpMt); |
475 | fOutputMass->Add(tmpSt); | |
476 | fOutputMass->Add(tmpS27t); | |
477 | fOutputMass->Add(tmpBt); | |
478 | fOutputMass->Add(tmpRt); | |
479 | ||
0108fa62 | 480 | fDistr->Add(tmpMS); |
481 | fDistr->Add(tmpMB); | |
482 | ||
34137226 | 483 | |
7646d6da | 484 | } |
a4ae02cd | 485 | |
449b1302 | 486 | namedistr="hpospair"; |
700e80e0 | 487 | TH1F* hpospair=new TH1F(namedistr.Data(),"Number of positive pairs",2*fCuts->GetNPtBins(),-0.5,fCuts->GetNPtBins()-0.5); |
449b1302 | 488 | namedistr="hnegpair"; |
700e80e0 | 489 | TH1F* hnegpair=new TH1F(namedistr.Data(),"Number of negative pairs",fCuts->GetNPtBins(),-0.5,2*fCuts->GetNPtBins()-0.5); |
449b1302 | 490 | fDistr->Add(hpospair); |
491 | fDistr->Add(hnegpair); | |
492 | ||
493 | ||
5b2e5fae | 494 | const char* nameoutput=GetOutputSlot(3)->GetContainer()->GetName(); |
4e61a020 | 495 | |
700e80e0 | 496 | fNentries=new TH1F(nameoutput, "Integral(1,2) = number of AODs *** Integral(2,3) = number of candidates selected with cuts *** Integral(3,4) = number of D0 selected with cuts *** Integral(4,5) = events with good vertex *** Integral(5,6) = pt out of bounds", 14,-0.5,13.5); |
34137226 | 497 | |
498 | fNentries->GetXaxis()->SetBinLabel(1,"nEventsAnal"); | |
4e61a020 | 499 | fNentries->GetXaxis()->SetBinLabel(2,"nCandSel(Cuts)"); |
34137226 | 500 | fNentries->GetXaxis()->SetBinLabel(3,"nD0Selected"); |
6b3e3c78 | 501 | fNentries->GetXaxis()->SetBinLabel(4,"nEventsGoodVtxS"); |
700e80e0 | 502 | fNentries->GetXaxis()->SetBinLabel(5,"ptbin = -1"); |
503 | fNentries->GetXaxis()->SetBinLabel(6,"no daughter"); | |
504 | fNentries->GetXaxis()->SetBinLabel(7,"nCandSel(Tr)"); | |
505 | fNentries->GetXaxis()->SetBinLabel(8,"PID=0"); | |
506 | fNentries->GetXaxis()->SetBinLabel(9,"PID=1"); | |
507 | fNentries->GetXaxis()->SetBinLabel(10,"PID=2"); | |
508 | fNentries->GetXaxis()->SetBinLabel(11,"PID=3"); | |
509 | fNentries->GetXaxis()->SetBinLabel(12,"K"); | |
510 | fNentries->GetXaxis()->SetBinLabel(13,"Lambda"); | |
511 | fNentries->GetXaxis()->SetBinLabel(14,"Pile-up Rej"); | |
34137226 | 512 | fNentries->GetXaxis()->SetNdivisions(1,kFALSE); |
a4ae02cd | 513 | |
700e80e0 | 514 | fCounter = new AliNormalizationCounter(Form("%s",GetOutputSlot(5)->GetContainer()->GetName())); |
a96083b9 | 515 | |
40445ada | 516 | // Post the data |
ea0d8716 | 517 | PostData(1,fOutputMass); |
5b2e5fae | 518 | PostData(2,fDistr); |
40445ada | 519 | PostData(3,fNentries); |
700e80e0 | 520 | PostData(5,fCounter); |
49061176 | 521 | return; |
522 | } | |
523 | ||
524 | //________________________________________________________________________ | |
525 | void AliAnalysisTaskSED0Mass::UserExec(Option_t */*option*/) | |
526 | { | |
527 | // Execute analysis for current event: | |
528 | // heavy flavor candidates association to MC truth | |
a4ae02cd | 529 | //cout<<"I'm in UserExec"<<endl; |
ea0d8716 | 530 | |
531 | ||
532 | //cuts order | |
533 | // printf(" |M-MD0| [GeV] < %f\n",fD0toKpiCuts[0]); | |
534 | // printf(" dca [cm] < %f\n",fD0toKpiCuts[1]); | |
535 | // printf(" cosThetaStar < %f\n",fD0toKpiCuts[2]); | |
536 | // printf(" pTK [GeV/c] > %f\n",fD0toKpiCuts[3]); | |
537 | // printf(" pTpi [GeV/c] > %f\n",fD0toKpiCuts[4]); | |
538 | // printf(" |d0K| [cm] < %f\n",fD0toKpiCuts[5]); | |
539 | // printf(" |d0pi| [cm] < %f\n",fD0toKpiCuts[6]); | |
540 | // printf(" d0d0 [cm^2] < %f\n",fD0toKpiCuts[7]); | |
541 | // printf(" cosThetaPoint > %f\n",fD0toKpiCuts[8]); | |
542 | ||
543 | ||
49061176 | 544 | AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent()); |
feb73eca | 545 | |
b557eb43 | 546 | TString bname; |
feb73eca | 547 | if(fArray==0){ //D0 candidates |
b557eb43 | 548 | // load D0->Kpi candidates |
feb73eca | 549 | //cout<<"D0 candidates"<<endl; |
b557eb43 | 550 | bname="D0toKpi"; |
feb73eca | 551 | } else { //LikeSign candidates |
feb73eca | 552 | // load like sign candidates |
b557eb43 | 553 | //cout<<"LS candidates"<<endl; |
554 | bname="LikeSign2Prong"; | |
555 | } | |
556 | ||
557 | TClonesArray *inputArray=0; | |
34137226 | 558 | |
b557eb43 | 559 | if(!aod && AODEvent() && IsStandardAOD()) { |
560 | // In case there is an AOD handler writing a standard AOD, use the AOD | |
561 | // event in memory rather than the input (ESD) event. | |
562 | aod = dynamic_cast<AliAODEvent*> (AODEvent()); | |
563 | // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root) | |
564 | // have to taken from the AOD event hold by the AliAODExtension | |
565 | AliAODHandler* aodHandler = (AliAODHandler*) | |
566 | ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler()); | |
34137226 | 567 | |
b557eb43 | 568 | if(aodHandler->GetExtensions()) { |
569 | AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root"); | |
34137226 | 570 | AliAODEvent* aodFromExt = ext->GetAOD(); |
b557eb43 | 571 | inputArray=(TClonesArray*)aodFromExt->GetList()->FindObject(bname.Data()); |
feb73eca | 572 | } |
b557eb43 | 573 | } else { |
574 | inputArray=(TClonesArray*)aod->GetList()->FindObject(bname.Data()); | |
575 | } | |
feb73eca | 576 | |
b557eb43 | 577 | |
578 | if(!inputArray) { | |
579 | printf("AliAnalysisTaskSED0Mass::UserExec: input branch not found!\n"); | |
580 | return; | |
49061176 | 581 | } |
582 | ||
6b3e3c78 | 583 | // fix for temporary bug in ESDfilter |
7c23877d | 584 | // the AODs with null vertex pointer didn't pass the PhysSel |
5806c290 | 585 | if(!aod->GetPrimaryVertex() || TMath::Abs(aod->GetMagneticField())<0.001) return; |
586 | ||
7c23877d | 587 | |
ce39f0ac | 588 | TClonesArray *mcArray = 0; |
589 | AliAODMCHeader *mcHeader = 0; | |
590 | ||
591 | if(fReadMC) { | |
592 | // load MC particles | |
593 | mcArray = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName()); | |
594 | if(!mcArray) { | |
595 | printf("AliAnalysisTaskSED0Mass::UserExec: MC particles branch not found!\n"); | |
596 | return; | |
597 | } | |
40445ada | 598 | |
ce39f0ac | 599 | // load MC header |
600 | mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName()); | |
601 | if(!mcHeader) { | |
602 | printf("AliAnalysisTaskSED0Mass::UserExec: MC header branch not found!\n"); | |
603 | return; | |
604 | } | |
49061176 | 605 | } |
606 | ||
b557eb43 | 607 | //printf("VERTEX Z %f %f\n",vtx1->GetZ(),mcHeader->GetVtxZ()); |
40445ada | 608 | |
a4ae02cd | 609 | //histogram filled with 1 for every AOD |
34137226 | 610 | fNentries->Fill(0); |
a96083b9 | 611 | fCounter->StoreEvent(aod,fReadMC); |
d52f7b50 | 612 | if(!fCuts->IsEventSelected(aod)) { |
613 | if(fCuts->GetWhyRejection()==1) // rejected for pileup | |
700e80e0 | 614 | fNentries->Fill(13); |
d52f7b50 | 615 | return; |
616 | } | |
40445ada | 617 | |
618 | // AOD primary vertex | |
619 | AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex(); | |
b272aebf | 620 | |
40445ada | 621 | Bool_t isGoodVtx=kFALSE; |
b272aebf | 622 | |
40445ada | 623 | //vtx1->Print(); |
624 | TString primTitle = vtx1->GetTitle(); | |
625 | if(primTitle.Contains("VertexerTracks") && vtx1->GetNContributors()>0) { | |
626 | isGoodVtx=kTRUE; | |
627 | fNentries->Fill(3); | |
628 | } | |
629 | ||
75638da0 | 630 | // loop over candidates |
631 | Int_t nInD0toKpi = inputArray->GetEntriesFast(); | |
4e61a020 | 632 | if(fDebug>2) printf("Number of D0->Kpi: %d\n",nInD0toKpi); |
75638da0 | 633 | |
6b3e3c78 | 634 | // FILE *f=fopen("4display.txt","a"); |
635 | // fprintf(f,"Number of D0->Kpi: %d\n",nInD0toKpi); | |
a96083b9 | 636 | Int_t nSelectedloose=0,nSelectedtight=0; |
75638da0 | 637 | for (Int_t iD0toKpi = 0; iD0toKpi < nInD0toKpi; iD0toKpi++) { |
638 | //Int_t nPosPairs=0, nNegPairs=0; | |
639 | //cout<<"inside the loop"<<endl; | |
640 | AliAODRecoDecayHF2Prong *d = (AliAODRecoDecayHF2Prong*)inputArray->UncheckedAt(iD0toKpi); | |
4e61a020 | 641 | |
642 | //check daughters | |
643 | if(!(d->GetDaughter(0) || d->GetDaughter(1))) { | |
644 | AliDebug(1,"at least one daughter not found!"); | |
700e80e0 | 645 | fNentries->Fill(5); |
a96083b9 | 646 | continue; |
4e61a020 | 647 | } |
648 | ||
6b3e3c78 | 649 | // Bool_t unsetvtx=kFALSE; |
650 | // if(!d->GetOwnPrimaryVtx()) { | |
651 | // d->SetOwnPrimaryVtx(vtx1); // needed to compute all variables | |
652 | // unsetvtx=kTRUE; | |
653 | // } | |
ea0d8716 | 654 | |
4e61a020 | 655 | |
75638da0 | 656 | //check reco daughter in acceptance |
4e61a020 | 657 | /* |
75638da0 | 658 | Double_t eta0=d->EtaProng(0); |
659 | Double_t eta1=d->EtaProng(1); | |
4e61a020 | 660 | */ |
661 | if ( fCuts->IsInFiducialAcceptance(d->Pt(),d->Y(421)) ) { | |
662 | //if( TMath::Abs(eta0)<0.9 && TMath::Abs(eta1)<0.9 ){ | |
663 | //apply cuts on tracks | |
a96083b9 | 664 | nSelectedloose++; |
3cc4604b | 665 | Int_t isSelected = fCuts->IsSelected(d,AliRDHFCuts::kTracks); |
a2121012 | 666 | if(((AliAODTrack*)d->GetDaughter(0))->GetTPCNcls() < 70 || ((AliAODTrack*)d->GetDaughter(1))->GetTPCNcls() < 70) isSelected=kFALSE; |
a96083b9 | 667 | if (!isSelected) continue; |
668 | nSelectedtight++; | |
700e80e0 | 669 | fNentries->Fill(6); |
4e61a020 | 670 | if(fDebug>2) cout<<"tracks selected"<<endl; |
3cc4604b | 671 | |
6b3e3c78 | 672 | Int_t ptbin=fCuts->PtBin(d->Pt()); |
700e80e0 | 673 | if(ptbin==-1) {fNentries->Fill(4); continue;} //out of bounds |
4e61a020 | 674 | FillVarHists(aod,d,mcArray,fCuts,fDistr); |
6b3e3c78 | 675 | FillMassHists(aod,d,mcArray,fCuts,fOutputMass); |
75638da0 | 676 | } |
ea0d8716 | 677 | |
6b3e3c78 | 678 | //if(unsetvtx) d->UnsetOwnPrimaryVtx(); |
75638da0 | 679 | } //end for prongs |
a96083b9 | 680 | fCounter->StoreCandidates(aod,nSelectedloose,kTRUE); |
681 | fCounter->StoreCandidates(aod,nSelectedtight,kFALSE); | |
40445ada | 682 | // Post the data |
ea0d8716 | 683 | PostData(1,fOutputMass); |
684 | PostData(2,fDistr); | |
40445ada | 685 | PostData(3,fNentries); |
700e80e0 | 686 | PostData(5,fCounter); |
40445ada | 687 | return; |
688 | } | |
b272aebf | 689 | |
40445ada | 690 | //____________________________________________________________________________ |
4e61a020 | 691 | void AliAnalysisTaskSED0Mass::FillVarHists(AliAODEvent* aod,AliAODRecoDecayHF2Prong *part, TClonesArray *arrMC, AliRDHFCutsD0toKpi *cuts, TList *listout){ |
40445ada | 692 | // |
693 | // function used in UserExec to fill variable histograms: | |
694 | // | |
b272aebf | 695 | |
40445ada | 696 | //add distr here |
697 | UInt_t pdgs[2]; | |
698 | ||
699 | Double_t mPDG=TDatabasePDG::Instance()->GetParticle(421)->Mass(); | |
700 | pdgs[0]=211; | |
701 | pdgs[1]=321; | |
702 | Double_t minvD0 = part->InvMassD0(); | |
703 | pdgs[1]=211; | |
704 | pdgs[0]=321; | |
705 | Double_t minvD0bar = part->InvMassD0bar(); | |
706 | //cout<<"inside mass cut"<<endl; | |
b272aebf | 707 | |
40445ada | 708 | Int_t pdgDgD0toKpi[2]={321,211}; |
709 | Int_t lab=-9999; | |
710 | if(fReadMC) lab=part->MatchToMC(421,arrMC,2,pdgDgD0toKpi); //return MC particle label if the array corresponds to a D0, -1 if not (cf. AliAODRecoDecay.cxx) | |
711 | //Double_t pt = d->Pt(); //mother pt | |
6b3e3c78 | 712 | Int_t isSelected=3; |
713 | Int_t isSelectedPID=99; | |
b272aebf | 714 | |
6b3e3c78 | 715 | //isSelectedPID = cuts->IsSelected(part,AliRDHFCuts::kPID); //0 rejected,1 D0,2 Dobar, 3 both |
716 | isSelectedPID = cuts->IsSelectedPID(part); //0 rejected,1 D0,2 Dobar, 3 both | |
700e80e0 | 717 | if (isSelectedPID==0)fNentries->Fill(7); |
718 | if (isSelectedPID==1)fNentries->Fill(8); | |
719 | if (isSelectedPID==2)fNentries->Fill(9); | |
720 | if (isSelectedPID==3)fNentries->Fill(10); | |
6b3e3c78 | 721 | //fNentries->Fill(8+isSelectedPID); |
3cc4604b | 722 | |
ea0d8716 | 723 | if(fCutOnDistr){ |
6b3e3c78 | 724 | isSelected = cuts->IsSelected(part,AliRDHFCuts::kCandidate,aod); //cuts with variables recalculated with new vertex (w/o daughters) |
ea0d8716 | 725 | if (!isSelected){ |
726 | //cout<<"Not Selected"<<endl; | |
727 | return; | |
728 | } | |
729 | } | |
0108fa62 | 730 | |
4e61a020 | 731 | Double_t invmasscut=0.03; |
732 | ||
40445ada | 733 | TString fillthispi="",fillthisK="",fillthis=""; |
b272aebf | 734 | |
ea0d8716 | 735 | Int_t ptbin=cuts->PtBin(part->Pt()); |
6b3e3c78 | 736 | |
4e61a020 | 737 | |
738 | //recalculate vertex | |
739 | AliAODVertex *vtxProp=0x0; | |
740 | vtxProp=GetPrimaryVtxSkipped(aod,part); | |
741 | Double_t dz1[2],dz2[2],covar1[3],covar2[3];//,d0xd0proper,errd0xd0proper; | |
742 | dz1[0]=-99; dz2[0]=-99; | |
743 | if(vtxProp) { | |
744 | part->SetOwnPrimaryVtx(vtxProp); | |
745 | //Bool_t unsetvtx=kTRUE; | |
746 | //Calculate d0 for daughter tracks with Vtx Skipped | |
747 | AliESDtrack *esdtrack1=new AliESDtrack((AliVTrack*)part->GetDaughter(0)); | |
748 | AliESDtrack *esdtrack2=new AliESDtrack((AliVTrack*)part->GetDaughter(1)); | |
749 | esdtrack1->PropagateToDCA(vtxProp,aod->GetMagneticField(),1.,dz1,covar1); | |
750 | esdtrack2->PropagateToDCA(vtxProp,aod->GetMagneticField(),1.,dz2,covar2); | |
6b3e3c78 | 751 | delete vtxProp; vtxProp=NULL; |
4e61a020 | 752 | delete esdtrack1; |
753 | delete esdtrack2; | |
754 | } | |
755 | ||
756 | Double_t d0[2]={dz1[0],dz2[0]}; | |
6b3e3c78 | 757 | Double_t decl[2]={part->DecayLength(),part->NormalizedDecayLength()}; |
758 | part->UnsetOwnPrimaryVtx(); | |
4e61a020 | 759 | |
40445ada | 760 | if(!fCutOnDistr || (fCutOnDistr && isSelected)){ //if no cuts or cuts passed |
ea0d8716 | 761 | //printf("\nif no cuts or cuts passed\n"); |
0108fa62 | 762 | |
6b3e3c78 | 763 | //disable the PID |
764 | if(!fUsePid4Distr) isSelectedPID=0; | |
765 | if((lab>=0 && fReadMC) || (!fReadMC && isSelectedPID)){ //signal (from MC or PID) | |
766 | //if(!vtxProp) fNentries->Fill(3); | |
40445ada | 767 | //check pdg of the prongs |
768 | AliAODTrack *prong0=(AliAODTrack*)part->GetDaughter(0); | |
769 | AliAODTrack *prong1=(AliAODTrack*)part->GetDaughter(1); | |
4e61a020 | 770 | if(!prong0 || !prong1) { |
771 | return; | |
772 | } | |
40445ada | 773 | Int_t labprong[2]; |
6b3e3c78 | 774 | if(fReadMC){ |
775 | labprong[0]=prong0->GetLabel(); | |
776 | labprong[1]=prong1->GetLabel(); | |
777 | } | |
40445ada | 778 | AliAODMCParticle *mcprong=0; |
779 | Int_t pdgProng[2]={0,0}; | |
6b3e3c78 | 780 | |
40445ada | 781 | for (Int_t iprong=0;iprong<2;iprong++){ |
6b3e3c78 | 782 | if(fReadMC && labprong[iprong]>=0) { |
783 | mcprong= (AliAODMCParticle*)arrMC->At(labprong[iprong]); | |
784 | pdgProng[iprong]=mcprong->GetPdgCode(); | |
785 | } | |
0108fa62 | 786 | } |
6b3e3c78 | 787 | |
0108fa62 | 788 | |
40445ada | 789 | //no mass cut ditributions: ptbis |
790 | ||
791 | fillthispi="hptpiSnoMcut_"; | |
792 | fillthispi+=ptbin; | |
793 | ||
794 | fillthisK="hptKSnoMcut_"; | |
795 | fillthisK+=ptbin; | |
796 | ||
6b3e3c78 | 797 | if ((TMath::Abs(pdgProng[0]) == 211 && TMath::Abs(pdgProng[1]) == 321) |
798 | || (isSelectedPID==1 || isSelectedPID==3)){ | |
40445ada | 799 | ((TH1F*)listout->FindObject(fillthispi))->Fill(part->PtProng(0)); |
800 | ((TH1F*)listout->FindObject(fillthisK))->Fill(part->PtProng(1)); | |
6b3e3c78 | 801 | } |
802 | ||
803 | if ((TMath::Abs(pdgProng[0]) == 321 && TMath::Abs(pdgProng[1]) == 211) | |
804 | || (isSelectedPID==2 || isSelectedPID==3)){ | |
805 | ((TH1F*)listout->FindObject(fillthisK))->Fill(part->PtProng(0)); | |
806 | ((TH1F*)listout->FindObject(fillthispi))->Fill(part->PtProng(1)); | |
40445ada | 807 | } |
808 | ||
809 | //no mass cut ditributions: mass | |
810 | fillthis="hMassS_"; | |
811 | fillthis+=ptbin; | |
812 | ||
6b3e3c78 | 813 | if ((fReadMC && ((AliAODMCParticle*)arrMC->At(lab))->GetPdgCode() == 421) |
814 | || (!fReadMC && (isSelectedPID==1 || isSelectedPID==3))){//D0 | |
40445ada | 815 | ((TH1F*)listout->FindObject(fillthis))->Fill(minvD0); |
816 | } | |
817 | else { //D0bar | |
6b3e3c78 | 818 | if(fReadMC || (!fReadMC && isSelectedPID > 1)) |
40445ada | 819 | ((TH1F*)listout->FindObject(fillthis))->Fill(minvD0bar); |
820 | } | |
4e61a020 | 821 | |
0108fa62 | 822 | //apply cut on invariant mass on the pair |
4e61a020 | 823 | if(TMath::Abs(minvD0-mPDG)<invmasscut || TMath::Abs(minvD0bar-mPDG)<invmasscut){ |
40445ada | 824 | |
0108fa62 | 825 | if(fArray==1) cout<<"LS signal: ERROR"<<endl; |
826 | for (Int_t iprong=0; iprong<2; iprong++){ | |
40445ada | 827 | AliAODTrack *prong=(AliAODTrack*)part->GetDaughter(iprong); |
6b3e3c78 | 828 | if (fReadMC) labprong[iprong]=prong->GetLabel(); |
40445ada | 829 | |
0108fa62 | 830 | //cout<<"prong name = "<<prong->GetName()<<" label = "<<prong->GetLabel()<<endl; |
6b3e3c78 | 831 | Int_t pdgprong=0; |
832 | if(fReadMC && labprong[iprong]>=0) { | |
833 | mcprong= (AliAODMCParticle*)arrMC->At(labprong[iprong]); | |
834 | pdgprong=mcprong->GetPdgCode(); | |
835 | } | |
836 | ||
837 | Bool_t isPionHere[2]={(isSelectedPID==1 || isSelectedPID==3) ? kTRUE : kFALSE,(isSelectedPID==2 || isSelectedPID==3) ? kTRUE : kFALSE}; | |
838 | ||
839 | if(TMath::Abs(pdgprong)==211 || isPionHere[iprong]) { | |
0108fa62 | 840 | //cout<<"pi"<<endl; |
40445ada | 841 | |
842 | fillthispi="hptpiS_"; | |
843 | fillthispi+=ptbin; | |
844 | ((TH1F*)listout->FindObject(fillthispi))->Fill(part->PtProng(iprong)); | |
4e61a020 | 845 | fillthispi="hd0piS_"; |
846 | fillthispi+=ptbin; | |
847 | ((TH1F*)listout->FindObject(fillthispi))->Fill(part->Getd0Prong(iprong)); | |
848 | if(d0[iprong] != -99) { | |
849 | ||
850 | fillthispi="hd0vpiS_"; | |
851 | fillthispi+=ptbin; | |
852 | ((TH1F*)listout->FindObject(fillthispi))->Fill(d0[iprong]); | |
853 | } | |
854 | ||
b272aebf | 855 | } |
40445ada | 856 | |
6b3e3c78 | 857 | if(TMath::Abs(pdgprong)==321 || !isPionHere[iprong]) { |
40445ada | 858 | //cout<<"kappa"<<endl; |
859 | ||
860 | fillthisK="hptKS_"; | |
861 | fillthisK+=ptbin; | |
862 | ((TH1F*)listout->FindObject(fillthisK))->Fill(part->PtProng(iprong)); | |
40445ada | 863 | fillthisK="hd0KS_"; |
864 | fillthisK+=ptbin; | |
865 | ((TH1F*)listout->FindObject(fillthisK))->Fill(part->Getd0Prong(iprong)); | |
4e61a020 | 866 | if (d0[iprong] != -99){ |
867 | fillthisK="hd0vKS_"; | |
868 | fillthisK+=ptbin; | |
869 | ((TH1F*)listout->FindObject(fillthisK))->Fill(d0[iprong]); | |
870 | } | |
b272aebf | 871 | } |
b272aebf | 872 | |
4e61a020 | 873 | fillthis="hcosthpointd0S_"; |
40445ada | 874 | fillthis+=ptbin; |
4e61a020 | 875 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->CosPointingAngle(),part->Getd0Prong(iprong)); |
b272aebf | 876 | |
4e61a020 | 877 | } //end loop on prongs |
b272aebf | 878 | |
4e61a020 | 879 | fillthis="hdcaS_"; |
880 | fillthis+=ptbin; | |
881 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->GetDCA()); | |
882 | ||
883 | fillthis="hcosthetapointS_"; | |
884 | fillthis+=ptbin; | |
885 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->CosPointingAngle()); | |
886 | ||
887 | fillthis="hcosthpointd0d0S_"; | |
888 | fillthis+=ptbin; | |
889 | ((TH2F*)listout->FindObject(fillthis))->Fill(part->CosPointingAngle(),part->Prodd0d0()); | |
b272aebf | 890 | |
4e61a020 | 891 | fillthis="hcosthetastarS_"; |
892 | fillthis+=ptbin; | |
6b3e3c78 | 893 | if ((fReadMC && ((AliAODMCParticle*)arrMC->At(lab))->GetPdgCode() == 421)) ((TH1F*)listout->FindObject(fillthis))->Fill(part->CosThetaStarD0()); |
894 | else { | |
895 | if (fReadMC || isSelectedPID>1)((TH1F*)listout->FindObject(fillthis))->Fill(part->CosThetaStarD0bar()); | |
896 | if(isSelectedPID==1 || isSelectedPID==3)((TH1F*)listout->FindObject(fillthis))->Fill(part->CosThetaStarD0()); | |
897 | } | |
4e61a020 | 898 | fillthis="hd0d0S_"; |
899 | fillthis+=ptbin; | |
900 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->Prodd0d0()); | |
901 | ||
902 | if(d0[0] != -99 && d0[1] != -99 ){ | |
903 | fillthis="hd0d0vS_"; | |
40445ada | 904 | fillthis+=ptbin; |
4e61a020 | 905 | ((TH1F*)listout->FindObject(fillthis))->Fill(d0[0]*d0[1]); |
b272aebf | 906 | } |
4e61a020 | 907 | |
908 | fillthis="hdeclS_"; | |
909 | fillthis+=ptbin; | |
910 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->DecayLength()); | |
911 | ||
912 | fillthis="hnormdeclS_"; | |
913 | fillthis+=ptbin; | |
914 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->NormalizedDecayLength()); | |
a2121012 | 915 | |
916 | if(vtxProp) { | |
917 | fillthis="hdeclvS_"; | |
918 | fillthis+=ptbin; | |
6b3e3c78 | 919 | ((TH1F*)listout->FindObject(fillthis))->Fill(decl[0]); |
a2121012 | 920 | |
921 | fillthis="hnormdeclvS_"; | |
922 | fillthis+=ptbin; | |
6b3e3c78 | 923 | ((TH1F*)listout->FindObject(fillthis))->Fill(decl[1]); |
a2121012 | 924 | } |
6b3e3c78 | 925 | } //end mass cut |
4e61a020 | 926 | |
0108fa62 | 927 | } else{ //Background or LS |
6b3e3c78 | 928 | //if(!fReadMC){ |
0108fa62 | 929 | //cout<<"is background"<<endl; |
40445ada | 930 | |
b272aebf | 931 | //no mass cut distributions: mass, ptbis |
40445ada | 932 | fillthis="hMassB_"; |
933 | fillthis+=ptbin; | |
ea0d8716 | 934 | |
935 | if (!fCutOnDistr || (fCutOnDistr && (isSelected==1 || isSelected==3))) ((TH1F*)listout->FindObject(fillthis))->Fill(minvD0); | |
936 | if (!fCutOnDistr || (fCutOnDistr && isSelected>1)) ((TH1F*)listout->FindObject(fillthis))->Fill(minvD0bar); | |
b272aebf | 937 | |
40445ada | 938 | fillthis="hptB1prongnoMcut_"; |
939 | fillthis+=ptbin; | |
940 | ||
941 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->PtProng(0)); | |
942 | ||
943 | fillthis="hptB2prongsnoMcut_"; | |
944 | fillthis+=ptbin; | |
945 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->PtProng(0)); | |
946 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->PtProng(1)); | |
0108fa62 | 947 | |
948 | //apply cut on invariant mass on the pair | |
4e61a020 | 949 | if(TMath::Abs(minvD0-mPDG)<invmasscut || TMath::Abs(minvD0bar-mPDG)<invmasscut){ |
0108fa62 | 950 | |
951 | ||
6b3e3c78 | 952 | AliAODTrack *prongg=(AliAODTrack*)part->GetDaughter(0); |
953 | if(!prongg) { | |
4e61a020 | 954 | if(fDebug>2) cout<<"No daughter found"; |
955 | return; | |
956 | } | |
0108fa62 | 957 | else{ |
449b1302 | 958 | if(prongg->Charge()==1) { |
700e80e0 | 959 | //fTotPosPairs[ptbin]++; |
449b1302 | 960 | ((TH1F*)fDistr->FindObject("hpospair"))->Fill(ptbin); |
961 | } else { | |
700e80e0 | 962 | //fTotNegPairs[ptbin]++; |
449b1302 | 963 | ((TH1F*)fDistr->FindObject("hnegpair"))->Fill(ptbin); |
964 | } | |
0108fa62 | 965 | } |
40445ada | 966 | |
967 | //normalise pt distr to half afterwards | |
968 | fillthis="hptB_"; | |
969 | fillthis+=ptbin; | |
4e61a020 | 970 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->PtProng(0)); |
971 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->PtProng(1)); | |
0108fa62 | 972 | |
4e61a020 | 973 | fillthis="hd0p0B_"; |
40445ada | 974 | fillthis+=ptbin; |
975 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->Getd0Prong(0)); | |
4e61a020 | 976 | fillthis="hd0p1B_"; |
977 | fillthis+=ptbin; | |
978 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->Getd0Prong(1)); | |
a2121012 | 979 | fillthis="hd0B_"; |
980 | fillthis+=ptbin; | |
981 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->Getd0Prong(0)); | |
982 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->Getd0Prong(1)); | |
4e61a020 | 983 | |
6b3e3c78 | 984 | if(fReadMC){ |
985 | Int_t pdgMother[2]={0,0}; | |
986 | Double_t factor[2]={1,1}; | |
987 | ||
988 | for(Int_t iprong=0;iprong<2;iprong++){ | |
989 | AliAODTrack *prong=(AliAODTrack*)part->GetDaughter(iprong); | |
990 | lab=prong->GetLabel(); | |
991 | if(lab>=0){ | |
992 | AliAODMCParticle* mcprong=(AliAODMCParticle*)arrMC->At(lab); | |
993 | if(mcprong){ | |
994 | Int_t labmom=mcprong->GetMother(); | |
995 | if(labmom>=0){ | |
996 | AliAODMCParticle* mcmother=(AliAODMCParticle*)arrMC->At(labmom); | |
997 | if(mcmother) pdgMother[iprong]=mcmother->GetPdgCode(); | |
998 | } | |
999 | } | |
1000 | } | |
1001 | ||
1002 | fillthis="hd0moresB_"; | |
1003 | fillthis+=ptbin; | |
1004 | ||
1005 | if(TMath::Abs(pdgMother[iprong])==310 || TMath::Abs(pdgMother[iprong])==130 || TMath::Abs(pdgMother[iprong])==321){ //K^0_S, K^0_L, K^+- | |
1006 | if(part->PtProng(iprong)<=1)factor[iprong]=1./.7; | |
1007 | else factor[iprong]=1./.6; | |
700e80e0 | 1008 | fNentries->Fill(11); |
6b3e3c78 | 1009 | } |
1010 | ||
1011 | if(TMath::Abs(pdgMother[iprong])==3122) { //Lambda | |
1012 | factor[iprong]=1./0.25; | |
700e80e0 | 1013 | fNentries->Fill(12); |
6b3e3c78 | 1014 | } |
1015 | fillthis="hd0moresB_"; | |
1016 | fillthis+=ptbin; | |
1017 | ||
1018 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->Getd0Prong(iprong),factor[iprong]); | |
1019 | ||
1020 | fillthis="hd0vmoresB_"; | |
1021 | fillthis+=ptbin; | |
1022 | ((TH1F*)listout->FindObject(fillthis))->Fill(d0[iprong],factor[iprong]); | |
1023 | ||
1024 | } | |
1025 | ||
1026 | fillthis="hd0d0moresB_"; | |
1027 | fillthis+=ptbin; | |
1028 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->Prodd0d0(),factor[0]*factor[1]); | |
1029 | ||
1030 | fillthis="hd0d0vmoresB_"; | |
1031 | fillthis+=ptbin; | |
1032 | ((TH1F*)listout->FindObject(fillthis))->Fill(d0[0]*d0[1],factor[0]*factor[1]); | |
1033 | ||
1034 | fillthis="hcosthetapointmoresB_"; | |
1035 | fillthis+=ptbin; | |
1036 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->CosPointingAngle(),factor[0]*factor[1]); | |
1037 | } | |
1038 | ||
4e61a020 | 1039 | fillthis="hd0vp0B_"; |
1040 | fillthis+=ptbin; | |
1041 | ((TH1F*)listout->FindObject(fillthis))->Fill(d0[0]); | |
1042 | fillthis="hd0vp1B_"; | |
1043 | fillthis+=ptbin; | |
1044 | ((TH1F*)listout->FindObject(fillthis))->Fill(d0[1]); | |
1045 | ||
a2121012 | 1046 | fillthis="hd0vB_"; |
1047 | fillthis+=ptbin; | |
1048 | ((TH1F*)listout->FindObject(fillthis))->Fill(d0[0]); | |
1049 | ((TH1F*)listout->FindObject(fillthis))->Fill(d0[1]); | |
1050 | ||
1051 | ||
4e61a020 | 1052 | fillthis="hcosthpointd0B_"; |
1053 | fillthis+=ptbin; | |
1054 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->CosPointingAngle(),part->Getd0Prong(0)); | |
1055 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->CosPointingAngle(),part->Getd0Prong(1)); | |
1056 | ||
ce39f0ac | 1057 | |
40445ada | 1058 | fillthis="hdcaB_"; |
1059 | fillthis+=ptbin; | |
1060 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->GetDCA()); | |
34137226 | 1061 | |
40445ada | 1062 | fillthis="hcosthetastarB_"; |
1063 | fillthis+=ptbin; | |
ea0d8716 | 1064 | if (!fCutOnDistr || (fCutOnDistr && (isSelected==1 || isSelected==3)))((TH1F*)listout->FindObject(fillthis))->Fill(part->CosThetaStarD0()); |
4e61a020 | 1065 | if (!fCutOnDistr || (fCutOnDistr && isSelected>1))((TH1F*)listout->FindObject(fillthis))->Fill(part->CosThetaStarD0bar()); |
40445ada | 1066 | |
1067 | fillthis="hd0d0B_"; | |
1068 | fillthis+=ptbin; | |
1069 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->Prodd0d0()); | |
1070 | ||
a2121012 | 1071 | if(d0[0] != -99 && d0[1] != -99 ){ |
1072 | fillthis="hd0d0vB_"; | |
1073 | fillthis+=ptbin; | |
1074 | ((TH1F*)listout->FindObject(fillthis))->Fill(d0[0]*d0[1]); | |
1075 | } | |
1076 | ||
40445ada | 1077 | fillthis="hcosthetapointB_"; |
1078 | fillthis+=ptbin; | |
1079 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->CosPointingAngle()); | |
1080 | ||
1081 | fillthis="hcosthpointd0d0B_"; | |
1082 | fillthis+=ptbin; | |
1083 | ((TH2F*)listout->FindObject(fillthis))->Fill(part->CosPointingAngle(),part->Prodd0d0()); | |
a2121012 | 1084 | |
1085 | fillthis="hdeclB_"; | |
1086 | fillthis+=ptbin; | |
1087 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->DecayLength()); | |
1088 | ||
1089 | fillthis="hnormdeclB_"; | |
1090 | fillthis+=ptbin; | |
1091 | ((TH1F*)listout->FindObject(fillthis))->Fill(part->NormalizedDecayLength()); | |
1092 | ||
1093 | if(vtxProp) { | |
1094 | fillthis="hdeclvB_"; | |
1095 | fillthis+=ptbin; | |
6b3e3c78 | 1096 | ((TH1F*)listout->FindObject(fillthis))->Fill(decl[0]); |
a2121012 | 1097 | |
1098 | fillthis="hnormdeclvB_"; | |
1099 | fillthis+=ptbin; | |
6b3e3c78 | 1100 | ((TH1F*)listout->FindObject(fillthis))->Fill(decl[1]); |
a2121012 | 1101 | } |
6b3e3c78 | 1102 | }//mass cut |
4e61a020 | 1103 | }//else (background) |
40445ada | 1104 | } |
49061176 | 1105 | return; |
1106 | } | |
ea0d8716 | 1107 | //____________________________________________________________________________ |
1108 | ||
6b3e3c78 | 1109 | void AliAnalysisTaskSED0Mass::FillMassHists(AliAODEvent* aod,AliAODRecoDecayHF2Prong *part, TClonesArray *arrMC, AliRDHFCutsD0toKpi* cuts, TList *listout){ |
49061176 | 1110 | // |
40445ada | 1111 | // function used in UserExec to fill mass histograms: |
49061176 | 1112 | // |
9de8c723 | 1113 | |
1114 | ||
1115 | Double_t mPDG=TDatabasePDG::Instance()->GetParticle(421)->Mass(); | |
1116 | ||
6b3e3c78 | 1117 | Int_t isSelected=cuts->IsSelected(part,AliRDHFCuts::kCandidate,aod); //selected |
1118 | ||
ea0d8716 | 1119 | //cout<<"is selected = "<<isSelected<<endl; |
feb73eca | 1120 | |
ea0d8716 | 1121 | //cout<<"check cuts = "<<endl; |
1122 | //cuts->PrintAll(); | |
1123 | if (!isSelected){ | |
1124 | //cout<<"Not Selected"<<endl; | |
6b3e3c78 | 1125 | //cout<<"Rejected because "<<cuts->GetWhy()<<endl; |
ea0d8716 | 1126 | return; |
1127 | } | |
9de8c723 | 1128 | |
6b3e3c78 | 1129 | |
4e61a020 | 1130 | if(fDebug>2) cout<<"Candidate selected"<<endl; |
a41f6fad | 1131 | |
ea0d8716 | 1132 | Double_t invmassD0 = part->InvMassD0(), invmassD0bar = part->InvMassD0bar(); |
1133 | //printf("SELECTED\n"); | |
1134 | Int_t ptbin=cuts->PtBin(part->Pt()); | |
9de8c723 | 1135 | |
ea0d8716 | 1136 | AliAODTrack *prong=(AliAODTrack*)part->GetDaughter(0); |
4e61a020 | 1137 | if(!prong) { |
1138 | AliDebug(2,"No daughter found"); | |
1139 | return; | |
1140 | } | |
ea0d8716 | 1141 | else{ |
700e80e0 | 1142 | if(prong->Charge()==1) { |
1143 | ((TH1F*)fDistr->FindObject("hpospair"))->Fill(fCuts->GetNPtBins()+ptbin); | |
1144 | //fTotPosPairs[ptbin]++; | |
1145 | } else { | |
1146 | ((TH1F*)fDistr->FindObject("hnegpair"))->Fill(fCuts->GetNPtBins()+ptbin); | |
1147 | //fTotNegPairs[ptbin]++; | |
1148 | } | |
ea0d8716 | 1149 | } |
7646d6da | 1150 | |
6b3e3c78 | 1151 | for(Int_t it=0;it<2;it++){ |
700e80e0 | 1152 | |
1153 | //request on spd points to be addes | |
1154 | if(/*nSPD==2 && */part->Pt() > 5. && (TMath::Abs(invmassD0-mPDG)<0.01 || TMath::Abs(invmassD0bar-mPDG)<0.01)){ | |
1155 | FILE *f=fopen("4display.txt","a"); | |
1156 | fprintf(f,"pt: %f \n Rapidity: %f \t Period Number: %x \t Run Number: %d \t BunchCrossNumb: %d \t OrbitNumber: %d\n",part->Pt(),part->Y(421),aod->GetPeriodNumber(),aod->GetRunNumber(),aod->GetBunchCrossNumber(),aod->GetOrbitNumber()); | |
1157 | fclose(f); | |
1158 | //printf("PrimVtx NContributors: %d \n Prongs Rel Angle: %f \n \n",ncont,relangle); | |
1159 | } | |
6b3e3c78 | 1160 | } |
1161 | ||
ea0d8716 | 1162 | TString fillthis=""; |
1163 | Int_t pdgDgD0toKpi[2]={321,211}; | |
1164 | Int_t labD0=-1; | |
1165 | if (fReadMC) labD0 = part->MatchToMC(421,arrMC,2,pdgDgD0toKpi); //return MC particle label if the array corresponds to a D0, -1 if not (cf. AliAODRecoDecay.cxx) | |
1166 | ||
1167 | //count candidates selected by cuts | |
1168 | fNentries->Fill(1); | |
1169 | //count true D0 selected by cuts | |
1170 | if (fReadMC && labD0>=0) fNentries->Fill(2); | |
ea0d8716 | 1171 | |
449b1302 | 1172 | if ((isSelected==1 || isSelected==3) && fFillOnlyD0D0bar<2) { //D0 |
ea0d8716 | 1173 | fillthis="histMass_"; |
1174 | fillthis+=ptbin; | |
1175 | //cout<<"Filling "<<fillthis<<endl; | |
1176 | ||
1177 | //printf("Fill mass with D0"); | |
1178 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0); | |
feb73eca | 1179 | |
ea0d8716 | 1180 | if(labD0>=0) { |
1181 | if(fArray==1) cout<<"LS signal ERROR"<<endl; | |
1182 | ||
1183 | AliAODMCParticle *partD0 = (AliAODMCParticle*)arrMC->At(labD0); | |
1184 | Int_t pdgD0 = partD0->GetPdgCode(); | |
1185 | //cout<<"pdg = "<<pdgD0<<endl; | |
1186 | if (pdgD0==421){ //D0 | |
1187 | //cout<<"Fill S with D0"<<endl; | |
1188 | fillthis="histSgn_"; | |
1189 | fillthis+=ptbin; | |
1190 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0); | |
1191 | if(TMath::Abs(invmassD0 - mPDG) < 0.027){ | |
1192 | fillthis="histSgn27_"; | |
46c96ce5 | 1193 | fillthis+=ptbin; |
1194 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0); | |
a4ae02cd | 1195 | } |
ea0d8716 | 1196 | } else{ //it was a D0bar |
1197 | fillthis="histRfl_"; | |
a4ae02cd | 1198 | fillthis+=ptbin; |
1199 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0); | |
1200 | } | |
ea0d8716 | 1201 | } else {//background |
1202 | fillthis="histBkg_"; | |
a4ae02cd | 1203 | fillthis+=ptbin; |
ea0d8716 | 1204 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0); |
1205 | } | |
1206 | ||
1207 | } | |
449b1302 | 1208 | if (isSelected>1 && (fFillOnlyD0D0bar==0 || fFillOnlyD0D0bar==2)) { //D0bar |
ea0d8716 | 1209 | fillthis="histMass_"; |
1210 | fillthis+=ptbin; | |
1211 | //printf("Fill mass with D0bar"); | |
1212 | ((TH1F*)listout->FindObject(fillthis))->Fill(invmassD0bar); | |
feb73eca | 1213 | |
ea0d8716 | 1214 | if(labD0>=0) { |
1215 | if(fArray==1) cout<<"LS signal ERROR"<<endl; | |
1216 | AliAODMCParticle *partD0 = (AliAODMCParticle*)arrMC->At(labD0); | |
1217 | Int_t pdgD0 = partD0->GetPdgCode(); | |
1218 | //cout<<" pdg = "<<pdgD0<<endl; | |
1219 | if (pdgD0==-421){ //D0bar | |
1220 | fillthis="histSgn_"; | |
1221 | fillthis+=ptbin; | |
1222 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0bar); | |
1223 | if (TMath::Abs(invmassD0bar - mPDG) < 0.027){ | |
1224 | fillthis="histSgn27_"; | |
a4ae02cd | 1225 | fillthis+=ptbin; |
1226 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0bar); | |
ea0d8716 | 1227 | } |
9de8c723 | 1228 | |
a4ae02cd | 1229 | |
ea0d8716 | 1230 | } else{ |
1231 | fillthis="histRfl_"; | |
a4ae02cd | 1232 | fillthis+=ptbin; |
1233 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0bar); | |
1234 | } | |
ea0d8716 | 1235 | } else {//background or LS |
1236 | fillthis="histBkg_"; | |
1237 | fillthis+=ptbin; | |
1238 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0bar); | |
a4ae02cd | 1239 | } |
ea0d8716 | 1240 | } |
a4ae02cd | 1241 | |
40445ada | 1242 | return; |
49061176 | 1243 | } |
4e61a020 | 1244 | |
1245 | //__________________________________________________________________________ | |
1246 | AliAODVertex* AliAnalysisTaskSED0Mass::GetPrimaryVtxSkipped(AliAODEvent *aodev,AliAODRecoDecayHF2Prong *d){ | |
1247 | //Calculate the primary vertex w/o the daughter tracks of the candidate | |
1248 | ||
4e61a020 | 1249 | Int_t skipped[2]; |
1250 | Int_t nTrksToSkip=2; | |
1251 | AliAODTrack *dgTrack = (AliAODTrack*)d->GetDaughter(0); | |
1252 | if(!dgTrack){ | |
1253 | AliDebug(2,"no daughter found!"); | |
1254 | return 0x0; | |
1255 | } | |
1256 | skipped[0]=dgTrack->GetID(); | |
1257 | dgTrack = (AliAODTrack*)d->GetDaughter(1); | |
1258 | if(!dgTrack){ | |
1259 | AliDebug(2,"no daughter found!"); | |
1260 | return 0x0; | |
1261 | } | |
1262 | skipped[1]=dgTrack->GetID(); | |
1263 | ||
6b3e3c78 | 1264 | AliESDVertex *vertexESD=0x0; |
1265 | AliAODVertex *vertexAOD=0x0; | |
1266 | AliVertexerTracks *vertexer = new AliVertexerTracks(aodev->GetMagneticField()); | |
1267 | ||
4e61a020 | 1268 | // |
1269 | vertexer->SetSkipTracks(nTrksToSkip,skipped); | |
4e61a020 | 1270 | vertexer->SetMinClusters(4); |
a2121012 | 1271 | vertexESD = (AliESDVertex*)vertexer->FindPrimaryVertex(aodev); |
4e61a020 | 1272 | if(!vertexESD) return vertexAOD; |
1273 | if(vertexESD->GetNContributors()<=0) { | |
1274 | AliDebug(2,"vertexing failed"); | |
1275 | delete vertexESD; vertexESD=NULL; | |
1276 | return vertexAOD; | |
1277 | } | |
1278 | ||
1279 | delete vertexer; vertexer=NULL; | |
1280 | ||
1281 | ||
1282 | // convert to AliAODVertex | |
1283 | Double_t pos[3],cov[6],chi2perNDF; | |
1284 | vertexESD->GetXYZ(pos); // position | |
1285 | vertexESD->GetCovMatrix(cov); //covariance matrix | |
1286 | chi2perNDF = vertexESD->GetChi2toNDF(); | |
1287 | delete vertexESD; vertexESD=NULL; | |
1288 | ||
1289 | vertexAOD = new AliAODVertex(pos,cov,chi2perNDF); | |
1290 | return vertexAOD; | |
1291 | ||
1292 | } | |
1293 | ||
1294 | ||
49061176 | 1295 | //________________________________________________________________________ |
1296 | void AliAnalysisTaskSED0Mass::Terminate(Option_t */*option*/) | |
1297 | { | |
1298 | // Terminate analysis | |
1299 | // | |
1300 | if(fDebug > 1) printf("AnalysisTaskSED0Mass: Terminate() \n"); | |
1301 | ||
6321ee46 | 1302 | |
ea0d8716 | 1303 | fOutputMass = dynamic_cast<TList*> (GetOutputData(1)); |
1304 | if (!fOutputMass) { | |
1305 | printf("ERROR: fOutputMass not available\n"); | |
a4ae02cd | 1306 | return; |
1307 | } | |
ea0d8716 | 1308 | fDistr = dynamic_cast<TList*> (GetOutputData(2)); |
1309 | if (!fDistr) { | |
1310 | printf("ERROR: fDistr not available\n"); | |
a41f6fad | 1311 | return; |
1312 | } | |
5b2e5fae | 1313 | |
40445ada | 1314 | fNentries = dynamic_cast<TH1F*>(GetOutputData(3)); |
5b2e5fae | 1315 | |
40445ada | 1316 | if(!fNentries){ |
1317 | printf("ERROR: fNEntries not available\n"); | |
1318 | return; | |
1319 | } | |
700e80e0 | 1320 | fCuts = dynamic_cast<AliRDHFCutsD0toKpi*>(GetOutputData(4)); |
1321 | if(!fCuts){ | |
1322 | printf("ERROR: fCuts not available\n"); | |
34137226 | 1323 | return; |
1324 | } | |
700e80e0 | 1325 | fCounter = dynamic_cast<AliNormalizationCounter*>(GetOutputData(5)); |
a96083b9 | 1326 | if (!fCounter) { |
1327 | printf("ERROR: fCounter not available\n"); | |
1328 | return; | |
1329 | } | |
700e80e0 | 1330 | Int_t nptbins=fCuts->GetNPtBins(); |
1331 | for(Int_t ipt=0;ipt<nptbins;ipt++){ | |
4e61a020 | 1332 | |
1333 | if(fArray==1){ | |
700e80e0 | 1334 | fLsNormalization = 2.*TMath::Sqrt(((TH1F*)fDistr->FindObject("hpospair"))->Integral(nptbins+ipt+1,nptbins+ipt+2)*((TH1F*)fDistr->FindObject("hnegpair"))->Integral(nptbins+ipt+1,nptbins+ipt+2)); //after cuts |
feb73eca | 1335 | |
1336 | ||
ea0d8716 | 1337 | if(fLsNormalization>1e-6) { |
9de8c723 | 1338 | |
feb73eca | 1339 | TString massName="histMass_"; |
ea0d8716 | 1340 | massName+=ipt; |
1341 | ((TH1F*)fOutputMass->FindObject(massName))->Scale((1/fLsNormalization)*((TH1F*)fOutputMass->FindObject(massName))->GetEntries()); | |
1342 | ||
feb73eca | 1343 | } |
40445ada | 1344 | |
feb73eca | 1345 | |
700e80e0 | 1346 | fLsNormalization = 2.*TMath::Sqrt(((TH1F*)fDistr->FindObject("hpospair"))->Integral(ipt+1,ipt+2)*((TH1F*)fDistr->FindObject("hnegpair"))->Integral(ipt+1,ipt+2)); |
1347 | //fLsNormalization = 2.*TMath::Sqrt(fTotPosPairs[4]*fTotNegPairs[4]); | |
40445ada | 1348 | |
ea0d8716 | 1349 | if(fLsNormalization>1e-6) { |
40445ada | 1350 | |
1351 | TString nameDistr="hptB_"; | |
ea0d8716 | 1352 | nameDistr+=ipt; |
40445ada | 1353 | ((TH1F*)fDistr->FindObject(nameDistr))->Scale((1/fLsNormalization)*((TH1F*)fDistr->FindObject(nameDistr))->GetEntries()); |
1354 | nameDistr="hdcaB_"; | |
ea0d8716 | 1355 | nameDistr+=ipt; |
40445ada | 1356 | ((TH1F*)fDistr->FindObject(nameDistr))->Scale((1/fLsNormalization)*((TH1F*)fDistr->FindObject(nameDistr))->GetEntries()); |
1357 | nameDistr="hcosthetastarB_"; | |
ea0d8716 | 1358 | nameDistr+=ipt; |
40445ada | 1359 | ((TH1F*)fDistr->FindObject(nameDistr))->Scale((1/fLsNormalization)*((TH1F*)fDistr->FindObject(nameDistr))->GetEntries()); |
1360 | nameDistr="hd0B_"; | |
ea0d8716 | 1361 | nameDistr+=ipt; |
40445ada | 1362 | ((TH1F*)fDistr->FindObject(nameDistr))->Scale((1/fLsNormalization)*((TH1F*)fDistr->FindObject(nameDistr))->GetEntries()); |
1363 | nameDistr="hd0d0B_"; | |
ea0d8716 | 1364 | nameDistr+=ipt; |
40445ada | 1365 | ((TH1F*)fDistr->FindObject(nameDistr))->Scale((1/fLsNormalization)*((TH1F*)fDistr->FindObject(nameDistr))->GetEntries()); |
1366 | nameDistr="hcosthetapointB_"; | |
ea0d8716 | 1367 | nameDistr+=ipt; |
40445ada | 1368 | ((TH1F*)fDistr->FindObject(nameDistr))->Scale((1/fLsNormalization)*((TH1F*)fDistr->FindObject(nameDistr))->GetEntries()); |
1369 | nameDistr="hcosthpointd0d0B_"; | |
ea0d8716 | 1370 | nameDistr+=ipt; |
40445ada | 1371 | ((TH2F*)fDistr->FindObject(nameDistr))->Scale((1/fLsNormalization)*((TH2F*)fDistr->FindObject(nameDistr))->GetEntries()); |
feb73eca | 1372 | |
40445ada | 1373 | } |
feb73eca | 1374 | } |
1375 | } | |
4e61a020 | 1376 | TString cvname,cstname; |
527f330b | 1377 | |
1378 | if (fArray==0){ | |
1379 | cvname="D0invmass"; | |
4e61a020 | 1380 | cstname="cstat0"; |
1381 | } else { | |
1382 | cvname="LSinvmass"; | |
1383 | cstname="cstat1"; | |
1384 | } | |
527f330b | 1385 | |
34137226 | 1386 | TCanvas *cMass=new TCanvas(cvname,cvname); |
1387 | cMass->cd(); | |
ea0d8716 | 1388 | ((TH1F*)fOutputMass->FindObject("histMass_3"))->Draw(); |
527f330b | 1389 | |
4e61a020 | 1390 | TCanvas* cStat=new TCanvas(cstname,Form("Stat%s",fArray ? "LS" : "D0")); |
34137226 | 1391 | cStat->cd(); |
1392 | cStat->SetGridy(); | |
1393 | fNentries->Draw("htext0"); | |
527f330b | 1394 | |
4e61a020 | 1395 | // TCanvas *ccheck=new TCanvas(Form("cc%d",fArray),Form("cc%d",fArray)); |
1396 | // ccheck->cd(); | |
1397 | ||
49061176 | 1398 | return; |
1399 | } | |
1400 |