]>
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> | |
28 | #include <TNtuple.h> | |
29 | #include <TList.h> | |
30 | #include <TH1F.h> | |
a41f6fad | 31 | #include <TH2F.h> |
32 | #include <TDatabasePDG.h> | |
49061176 | 33 | |
34 | #include "AliAODEvent.h" | |
35 | #include "AliAODVertex.h" | |
36 | #include "AliAODTrack.h" | |
37 | #include "AliAODMCHeader.h" | |
38 | #include "AliAODMCParticle.h" | |
39 | #include "AliAODRecoDecayHF2Prong.h" | |
40 | #include "AliAODRecoCascadeHF.h" | |
41 | #include "AliAnalysisVertexingHF.h" | |
42 | #include "AliAnalysisTaskSE.h" | |
43 | #include "AliAnalysisTaskSED0Mass.h" | |
44 | ||
45 | ClassImp(AliAnalysisTaskSED0Mass) | |
46 | ||
47 | ||
48 | //________________________________________________________________________ | |
49 | AliAnalysisTaskSED0Mass::AliAnalysisTaskSED0Mass(): | |
50 | AliAnalysisTaskSE(), | |
9de8c723 | 51 | fOutputPPR(0), |
a41f6fad | 52 | fOutputloose(0), |
53 | fDistr(0), | |
feb73eca | 54 | fNentries(0), |
9de8c723 | 55 | fVHFPPR(0), |
6ce5994f | 56 | fVHFloose(0), |
feb73eca | 57 | fArray(0), |
58 | fLsNormalization(1.) | |
59 | ||
49061176 | 60 | { |
61 | // Default constructor | |
9de8c723 | 62 | for(Int_t i=0;i<5;i++) {fTotPosPairs[i]=0; fTotNegPairs[i]=0;} |
49061176 | 63 | } |
64 | ||
65 | //________________________________________________________________________ | |
66 | AliAnalysisTaskSED0Mass::AliAnalysisTaskSED0Mass(const char *name): | |
67 | AliAnalysisTaskSE(name), | |
9de8c723 | 68 | fOutputPPR(0), |
a4ae02cd | 69 | fOutputloose(0), |
a41f6fad | 70 | fDistr(0), |
feb73eca | 71 | fNentries(0), |
9de8c723 | 72 | fVHFPPR(0), |
6ce5994f | 73 | fVHFloose(0), |
feb73eca | 74 | fArray(0), |
75 | fLsNormalization(1.) | |
49061176 | 76 | { |
77 | // Default constructor | |
9de8c723 | 78 | for(Int_t i=0;i<5;i++) {fTotPosPairs[i]=0; fTotNegPairs[i]=0;} |
49061176 | 79 | |
80 | // Output slot #1 writes into a TList container | |
81 | DefineOutput(1,TList::Class()); //My private output | |
a4ae02cd | 82 | // Output slot #2 writes into a TList container |
83 | DefineOutput(2,TList::Class()); //My private output | |
84 | // Output slot #3 writes into a TH1F container | |
85 | DefineOutput(3,TH1F::Class()); //My private output | |
a41f6fad | 86 | // Output slot #4 writes into a TList container |
87 | DefineOutput(4,TList::Class()); //My private output | |
49061176 | 88 | } |
89 | ||
90 | //________________________________________________________________________ | |
91 | AliAnalysisTaskSED0Mass::~AliAnalysisTaskSED0Mass() | |
92 | { | |
9de8c723 | 93 | if (fOutputPPR) { |
94 | delete fOutputPPR; | |
95 | fOutputPPR = 0; | |
a4ae02cd | 96 | } |
9de8c723 | 97 | if (fVHFPPR) { |
98 | delete fVHFPPR; | |
99 | fVHFPPR = 0; | |
a4ae02cd | 100 | } |
101 | if (fOutputloose) { | |
102 | delete fOutputloose; | |
103 | fOutputloose = 0; | |
104 | } | |
a41f6fad | 105 | |
106 | if (fDistr) { | |
107 | delete fDistr; | |
108 | fDistr = 0; | |
109 | } | |
110 | ||
a4ae02cd | 111 | if (fVHFloose) { |
112 | delete fVHFloose; | |
113 | fVHFloose = 0; | |
49061176 | 114 | } |
46c96ce5 | 115 | if (fNentries){ |
116 | delete fNentries; | |
117 | fNentries = 0; | |
118 | } | |
a41f6fad | 119 | |
120 | ||
49061176 | 121 | } |
122 | ||
123 | //________________________________________________________________________ | |
124 | void AliAnalysisTaskSED0Mass::Init() | |
125 | { | |
126 | // Initialization | |
127 | ||
128 | if(fDebug > 1) printf("AnalysisTaskSED0Mass::Init() \n"); | |
129 | ||
130 | gROOT->LoadMacro("$ALICE_ROOT/PWG3/vertexingHF/ConfigVertexingHF.C"); | |
131 | ||
a4ae02cd | 132 | // 2 sets of dedidcated cuts -- defined in UserExec |
9de8c723 | 133 | fVHFPPR = (AliAnalysisVertexingHF*)gROOT->ProcessLine("ConfigVertexingHF()"); |
a4ae02cd | 134 | fVHFloose = (AliAnalysisVertexingHF*)gROOT->ProcessLine("ConfigVertexingHF()"); |
135 | ||
49061176 | 136 | return; |
137 | } | |
138 | ||
139 | //________________________________________________________________________ | |
140 | void AliAnalysisTaskSED0Mass::UserCreateOutputObjects() | |
141 | { | |
142 | ||
143 | // Create the output container | |
144 | // | |
145 | if(fDebug > 1) printf("AnalysisTaskSED0Mass::UserCreateOutputObjects() \n"); | |
146 | ||
147 | // Several histograms are more conveniently managed in a TList | |
9de8c723 | 148 | fOutputPPR = new TList(); |
149 | fOutputPPR->SetOwner(); | |
150 | fOutputPPR->SetName("listPPR"); | |
a4ae02cd | 151 | |
152 | fOutputloose = new TList(); | |
153 | fOutputloose->SetOwner(); | |
154 | fOutputloose->SetName("listloose"); | |
49061176 | 155 | |
a41f6fad | 156 | fDistr = new TList(); |
157 | fDistr->SetOwner(); | |
158 | fDistr->SetName("distributionslist"); | |
159 | ||
9de8c723 | 160 | const Int_t nhist=5; |
a4ae02cd | 161 | |
9de8c723 | 162 | TString nameMass=" ",nameSgn27=" ",nameSgn=" ", nameBkg=" ", nameRfl=" ", namedistr=" "; |
49061176 | 163 | |
164 | for(Int_t i=0;i<nhist;i++){ | |
7646d6da | 165 | nameMass="histMass_"; |
49061176 | 166 | nameMass+=i+1; |
9de8c723 | 167 | nameSgn27="histSgn27_"; |
168 | nameSgn27+=i+1; | |
7646d6da | 169 | nameSgn="histSgn_"; |
49061176 | 170 | nameSgn+=i+1; |
7646d6da | 171 | nameBkg="histBkg_"; |
49061176 | 172 | nameBkg+=i+1; |
a4ae02cd | 173 | nameRfl="histRfl_"; |
174 | nameRfl+=i+1; | |
7646d6da | 175 | |
a41f6fad | 176 | //histograms of invariant mass distributions |
177 | ||
46c96ce5 | 178 | TH1F* tmpMt = new TH1F(nameMass.Data(),"D^{0} invariant mass; M [GeV]; Entries",200,1.765,1.965); |
179 | TH1F *tmpMl=(TH1F*)tmpMt->Clone(); | |
180 | tmpMt->Sumw2(); | |
181 | tmpMl->Sumw2(); | |
a4ae02cd | 182 | |
9de8c723 | 183 | //to compare with AliAnalysisTaskCharmFraction |
184 | TH1F* tmpS27t = new TH1F(nameSgn27.Data(),"D^{0} invariant mass in M(D^{0}) +/- 27 MeV - MC; M [GeV]; Entries",200,1.765,1.965); | |
185 | TH1F *tmpS27l=(TH1F*)tmpS27t->Clone(); | |
186 | tmpS27t->Sumw2(); | |
187 | tmpS27l->Sumw2(); | |
188 | ||
46c96ce5 | 189 | TH1F* tmpSt = new TH1F(nameSgn.Data(), "D^{0} invariant mass - MC; M [GeV]; Entries",200,1.765,1.965); |
190 | TH1F *tmpSl=(TH1F*)tmpSt->Clone(); | |
191 | tmpSt->Sumw2(); | |
192 | tmpSl->Sumw2(); | |
a4ae02cd | 193 | |
46c96ce5 | 194 | TH1F* tmpBt = new TH1F(nameBkg.Data(), "Background invariant mass - MC; M [GeV]; Entries",200,1.765,1.965); |
195 | TH1F *tmpBl=(TH1F*)tmpBt->Clone(); | |
196 | tmpBt->Sumw2(); | |
197 | tmpBl->Sumw2(); | |
a4ae02cd | 198 | |
feb73eca | 199 | //Reflection: histo filled with D0Mass which pass the cut (also) as D0bar and with D0bar which pass (also) the cut as D0 |
46c96ce5 | 200 | TH1F* tmpRt = new TH1F(nameRfl.Data(), "Reflected signal invariant mass - MC; M [GeV]; Entries",200,1.765,1.965); |
201 | TH1F *tmpRl=(TH1F*)tmpRt->Clone(); | |
202 | tmpRt->Sumw2(); | |
203 | tmpRl->Sumw2(); | |
a4ae02cd | 204 | // printf("Created histograms %s\t%s\t%s\t%s\n",tmpM->GetName(),tmpS->GetName(),tmpB->GetName(),tmpR->GetName()); |
205 | ||
9de8c723 | 206 | fOutputPPR->Add(tmpMt); |
207 | fOutputPPR->Add(tmpSt); | |
208 | fOutputPPR->Add(tmpS27t); | |
209 | fOutputPPR->Add(tmpBt); | |
210 | fOutputPPR->Add(tmpRt); | |
a4ae02cd | 211 | |
46c96ce5 | 212 | fOutputloose->Add(tmpMl); |
213 | fOutputloose->Add(tmpSl); | |
9de8c723 | 214 | fOutputloose->Add(tmpS27l); |
46c96ce5 | 215 | fOutputloose->Add(tmpBl); |
216 | fOutputloose->Add(tmpRl); | |
a4ae02cd | 217 | |
7646d6da | 218 | } |
a4ae02cd | 219 | |
a41f6fad | 220 | //histograms of cut variable distributions |
221 | // pT | |
222 | namedistr="hptpiS"; | |
223 | TH1F *hptpiS = new TH1F(namedistr.Data(), "P_{T} distribution (pions);p_{T} [GeV/c]",200,0.,8.); | |
a41f6fad | 224 | |
225 | namedistr="hptKS"; | |
226 | TH1F *hptKS = new TH1F(namedistr.Data(), "P_{T} distribution (kaons);p_{T} [GeV/c]",200,0.,8.); | |
227 | ||
228 | namedistr="hptB"; | |
229 | TH1F *hptB = new TH1F(namedistr.Data(), "P_{T} distribution;p_{T} [GeV/c]",200,0.,8.); | |
a41f6fad | 230 | |
231 | // dca | |
232 | namedistr="hdcaS"; | |
233 | TH1F *hdcaS = new TH1F(namedistr.Data(), "DCA distribution;dca [cm]",200,0.,0.1); | |
234 | namedistr="hdcaB"; | |
235 | TH1F *hdcaB = new TH1F(namedistr.Data(), "DCA distribution;dca [cm]",200,0.,0.1); | |
a41f6fad | 236 | |
237 | // costhetastar | |
feb73eca | 238 | namedistr="hcosthetastarS"; |
a41f6fad | 239 | TH1F *hcosthetastarS = new TH1F(namedistr.Data(), "cos#theta* distribution;cos#theta*",200,-1.,1.); |
feb73eca | 240 | namedistr="hcosthetastarB"; |
a41f6fad | 241 | TH1F *hcosthetastarB = new TH1F(namedistr.Data(), "cos#theta* distribution;cos#theta*",200,-1.,1.); |
a41f6fad | 242 | |
243 | // impact parameter | |
244 | namedistr="hd0piS"; | |
245 | TH1F *hd0piS = new TH1F(namedistr.Data(), "Impact parameter distribution (pions);d0(#pi) [cm]",200,-0.1,0.1); | |
a41f6fad | 246 | |
247 | namedistr="hd0KS"; | |
248 | TH1F *hd0KS = new TH1F(namedistr.Data(), "Impact parameter distribution (kaons);d0(K) [cm]",200,-0.1,0.1); | |
249 | namedistr="hd0B"; | |
250 | TH1F *hd0B = new TH1F(namedistr.Data(), "Impact parameter distribution;d0 [cm]",200,-0.1,0.1); | |
a41f6fad | 251 | |
252 | namedistr="hd0d0S"; | |
253 | TH1F *hd0d0S = new TH1F(namedistr.Data(), "d_{0}#timesd_{0} distribution;d_{0}#timesd_{0} [cm^{2}]",200,-0.001,0.001); | |
254 | namedistr="hd0d0B"; | |
255 | TH1F *hd0d0B = new TH1F(namedistr.Data(), "d_{0}#timesd_{0} distribution;d_{0}#timesd_{0} [cm^{2}]",200,-0.001,0.001); | |
a41f6fad | 256 | |
257 | // costhetapoint | |
258 | namedistr="hcosthetapointS"; | |
259 | TH1F *hcosthetapointS = new TH1F(namedistr.Data(), "cos#theta_{Point} distribution;cos#theta_{Point}",200,0,1.); | |
260 | namedistr="hcosthetapointB"; | |
261 | TH1F *hcosthetapointB = new TH1F(namedistr.Data(), "cos#theta_{Point} distribution;cos#theta_{Point}",200,0,1.); | |
a41f6fad | 262 | |
263 | namedistr="hcosthpointd0d0S"; | |
264 | 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); | |
265 | namedistr="hcosthpointd0d0B"; | |
266 | 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); | |
267 | ||
268 | fDistr->Add(hptpiS); | |
a41f6fad | 269 | fDistr->Add(hptKS); |
270 | fDistr->Add(hptB); | |
a41f6fad | 271 | |
272 | fDistr->Add(hdcaS); | |
273 | fDistr->Add(hdcaB); | |
a41f6fad | 274 | |
275 | fDistr->Add(hd0piS); | |
a41f6fad | 276 | fDistr->Add(hd0KS); |
277 | fDistr->Add(hd0B); | |
a41f6fad | 278 | |
279 | fDistr->Add(hd0d0S); | |
280 | fDistr->Add(hd0d0B); | |
a41f6fad | 281 | |
282 | fDistr->Add(hcosthetastarS); | |
283 | fDistr->Add(hcosthetastarB); | |
a41f6fad | 284 | |
285 | fDistr->Add(hcosthetapointS); | |
286 | fDistr->Add(hcosthetapointB); | |
a41f6fad | 287 | |
288 | fDistr->Add(hcosthpointd0d0S); | |
289 | fDistr->Add(hcosthpointd0d0B); | |
290 | ||
9de8c723 | 291 | fNentries=new TH1F("nentriesD0", "nentriesD0->Integral(1,2) = number of AODs *** nentriesD0->Integral(3,4) = number of candidates selected with cuts *** nentriesD0->Integral(5,6) = number of D0 selected with cuts", 6,1.,4.); |
a4ae02cd | 292 | |
49061176 | 293 | return; |
294 | } | |
295 | ||
296 | //________________________________________________________________________ | |
297 | void AliAnalysisTaskSED0Mass::UserExec(Option_t */*option*/) | |
298 | { | |
299 | // Execute analysis for current event: | |
300 | // heavy flavor candidates association to MC truth | |
a4ae02cd | 301 | //cout<<"I'm in UserExec"<<endl; |
49061176 | 302 | AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent()); |
feb73eca | 303 | |
8931c313 | 304 | // In case there is an AOD handler writing a standard AOD, use the AOD |
305 | // event in memory rather than the input (ESD) event. | |
306 | if (!aod && AODEvent() && IsStandardAOD()) aod = dynamic_cast<AliAODEvent*> (AODEvent()); | |
307 | ||
feb73eca | 308 | TClonesArray *inputArray=0; |
309 | ||
310 | if(fArray==0){ //D0 candidates | |
311 | // load D0->Kpi candidates | |
312 | //cout<<"D0 candidates"<<endl; | |
313 | inputArray = | |
314 | (TClonesArray*)aod->GetList()->FindObject("D0toKpi"); | |
315 | if(!inputArray) { | |
316 | printf("AliAnalysisTaskSECompareHFpt::UserExec: D0toKpi branch not found!\n"); | |
317 | return; | |
318 | } | |
319 | ||
320 | } else { //LikeSign candidates | |
321 | ||
322 | //cout<<"LS candidates"<<endl; | |
323 | // load like sign candidates | |
324 | inputArray = | |
325 | (TClonesArray*)aod->GetList()->FindObject("LikeSign2Prong"); | |
326 | if(!inputArray) { | |
327 | printf("AliAnalysisTaskSEBkgLikeSignD0::UserExec: LikeSign2Prong branch not found!\n"); | |
328 | return; | |
329 | } | |
330 | ||
49061176 | 331 | } |
332 | ||
333 | // AOD primary vertex | |
334 | AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex(); | |
335 | //vtx1->Print(); | |
feb73eca | 336 | |
49061176 | 337 | // load MC particles |
338 | TClonesArray *mcArray = | |
339 | (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName()); | |
340 | if(!mcArray) { | |
341 | printf("AliAnalysisTaskSED0Mass::UserExec: MC particles branch not found!\n"); | |
342 | return; | |
343 | } | |
344 | ||
345 | // load MC header | |
346 | AliAODMCHeader *mcHeader = | |
347 | (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName()); | |
348 | if(!mcHeader) { | |
349 | printf("AliAnalysisTaskSED0Mass::UserExec: MC header branch not found!\n"); | |
350 | return; | |
351 | } | |
352 | ||
a4ae02cd | 353 | |
354 | //histogram filled with 1 for every AOD | |
355 | fNentries->Fill(1); | |
356 | PostData(3,fNentries); | |
9de8c723 | 357 | |
feb73eca | 358 | // loop over candidates |
359 | Int_t nInD0toKpi = inputArray->GetEntriesFast(); | |
4464ce7e | 360 | if(fDebug>1) printf("Number of D0->Kpi: %d\n",nInD0toKpi); |
49061176 | 361 | |
362 | for (Int_t iD0toKpi = 0; iD0toKpi < nInD0toKpi; iD0toKpi++) { | |
feb73eca | 363 | //Int_t nPosPairs=0, nNegPairs=0; |
a41f6fad | 364 | //cout<<"inside the loop"<<endl; |
feb73eca | 365 | AliAODRecoDecayHF2Prong *d = (AliAODRecoDecayHF2Prong*)inputArray->UncheckedAt(iD0toKpi); |
49061176 | 366 | Bool_t unsetvtx=kFALSE; |
367 | if(!d->GetOwnPrimaryVtx()) { | |
368 | d->SetOwnPrimaryVtx(vtx1); // needed to compute all variables | |
369 | unsetvtx=kTRUE; | |
370 | } | |
371 | ||
9de8c723 | 372 | |
373 | ||
374 | //check reco daughter in acceptance | |
375 | Double_t eta0=d->EtaProng(0); | |
376 | Double_t eta1=d->EtaProng(1); | |
377 | Bool_t prongsinacc=kFALSE; | |
378 | if (TMath::Abs(eta0) < 0.9 && TMath::Abs(eta1) < 0.9) prongsinacc=kTRUE; | |
a41f6fad | 379 | |
380 | //add distr here | |
381 | UInt_t pdgs[2]; | |
49061176 | 382 | |
a41f6fad | 383 | Double_t mPDG=TDatabasePDG::Instance()->GetParticle(421)->Mass(); |
384 | pdgs[0]=211; | |
385 | pdgs[1]=321; | |
386 | Double_t minvD0 = d->InvMassD0(); | |
387 | pdgs[1]=211; | |
388 | pdgs[0]=321; | |
389 | Double_t minvD0bar = d->InvMassD0bar(); | |
390 | //apply cut on invariant mass on the pair | |
391 | if(TMath::Abs(minvD0-mPDG)<0.03 || TMath::Abs(minvD0bar-mPDG)<0.03){ | |
feb73eca | 392 | //cout<<"inside mass cut"<<endl; |
a41f6fad | 393 | Int_t pdgDgD0toKpi[2]={321,211}; |
394 | Int_t lab=d->MatchToMC(421,mcArray,2,pdgDgD0toKpi); //return MC particle label if the array corresponds to a D0, -1 if not (cf. AliAODRecoDecay.cxx) | |
395 | ||
a41f6fad | 396 | if(lab>=0){ //signal |
feb73eca | 397 | if(fArray==1) cout<<"LS signal: ERROR"<<endl; |
a41f6fad | 398 | for (Int_t iprong=0; iprong<2; iprong++){ |
399 | AliAODTrack *prong=(AliAODTrack*)d->GetDaughter(iprong); | |
400 | Int_t labprong=prong->GetLabel(); | |
401 | ||
402 | //cout<<"prong name = "<<prong->GetName()<<" label = "<<prong->GetLabel()<<endl; | |
403 | AliAODMCParticle *mcprong=0; | |
404 | if(labprong>=0) mcprong= (AliAODMCParticle*)mcArray->At(labprong); | |
405 | Int_t pdgprong=mcprong->GetPdgCode(); | |
406 | if(TMath::Abs(pdgprong)==211) { | |
407 | //cout<<"pi"<<endl; | |
408 | ((TH1F*)fDistr->FindObject("hptpiS"))->Fill(d->PtProng(iprong)); | |
409 | ((TH1F*)fDistr->FindObject("hd0piS"))->Fill(d->Getd0Prong(iprong)); | |
410 | } | |
411 | ||
412 | if(TMath::Abs(pdgprong)==321) { | |
413 | //cout<<"kappa"<<endl; | |
414 | ((TH1F*)fDistr->FindObject("hptKS"))->Fill(d->PtProng(iprong)); | |
415 | ((TH1F*)fDistr->FindObject("hd0KS"))->Fill(d->Getd0Prong(iprong)); | |
416 | } | |
417 | ((TH1F*)fDistr->FindObject("hdcaS"))->Fill(d->GetDCA()); | |
418 | ||
419 | } | |
420 | ||
421 | if (((AliAODMCParticle*)mcArray->At(lab))->GetPdgCode() == 421) | |
feb73eca | 422 | ((TH1F*)fDistr->FindObject("hcosthetastarS"))->Fill(d->CosThetaStarD0()); |
423 | else ((TH1F*)fDistr->FindObject("hcosthetastarS"))->Fill(d->CosThetaStarD0bar()); | |
a41f6fad | 424 | |
425 | ((TH1F*)fDistr->FindObject("hd0d0S"))->Fill(d->Prodd0d0()); | |
426 | ||
427 | ((TH1F*)fDistr->FindObject("hcosthetapointS"))->Fill(d->CosPointingAngle()); | |
428 | ((TH1F*)fDistr->FindObject("hcosthpointd0d0S"))->Fill(d->CosPointingAngle(),d->Prodd0d0()); | |
429 | ||
430 | //cout<<"ok point"<<endl; | |
431 | ||
feb73eca | 432 | |
433 | } else{ //Background or LS | |
a41f6fad | 434 | //cout<<"is background"<<endl; |
feb73eca | 435 | AliAODTrack *prong=(AliAODTrack*)d->GetDaughter(0); |
436 | if(!prong) cout<<"No daughter found"; | |
437 | else{ | |
9de8c723 | 438 | if(prong->Charge()==1) {fTotPosPairs[4]++;} else {fTotNegPairs[4]++;} |
feb73eca | 439 | } |
a41f6fad | 440 | ((TH1F*)fDistr->FindObject("hptB"))->Fill(d->PtProng(0)); |
441 | //cout<<"ptok"<<endl; | |
442 | ((TH1F*)fDistr->FindObject("hd0B"))->Fill(d->Getd0Prong(0)); | |
443 | //cout<<"d0ok"<<endl; | |
444 | ((TH1F*)fDistr->FindObject("hdcaB"))->Fill(d->GetDCA()); | |
445 | //cout<<"dcaok"<<endl; | |
feb73eca | 446 | ((TH1F*)fDistr->FindObject("hcosthetastarB"))->Fill(d->CosThetaStarD0()); |
447 | ((TH1F*)fDistr->FindObject("hcosthetastarB"))->Fill(d->CosThetaStarD0bar()); | |
a41f6fad | 448 | ((TH1F*)fDistr->FindObject("hd0d0B"))->Fill(d->Prodd0d0()); |
449 | //cout<<"d0d0ok"<<endl; | |
450 | ((TH1F*)fDistr->FindObject("hcosthetapointB"))->Fill(d->CosPointingAngle()); | |
451 | ((TH1F*)fDistr->FindObject("hcosthpointd0d0B"))->Fill(d->CosPointingAngle(),d->Prodd0d0()); | |
452 | ||
453 | //cout<<"pointok"<<endl; | |
454 | ||
455 | } | |
456 | ||
457 | } //inv mass cut | |
458 | ||
9de8c723 | 459 | //cuts order |
460 | // printf(" |M-MD0| [GeV] < %f\n",fD0toKpiCuts[0]); | |
461 | // printf(" dca [cm] < %f\n",fD0toKpiCuts[1]); | |
462 | // printf(" cosThetaStar < %f\n",fD0toKpiCuts[2]); | |
463 | // printf(" pTK [GeV/c] > %f\n",fD0toKpiCuts[3]); | |
464 | // printf(" pTpi [GeV/c] > %f\n",fD0toKpiCuts[4]); | |
465 | // printf(" |d0K| [cm] < %f\n",fD0toKpiCuts[5]); | |
466 | // printf(" |d0pi| [cm] < %f\n",fD0toKpiCuts[6]); | |
467 | // printf(" d0d0 [cm^2] < %f\n",fD0toKpiCuts[7]); | |
468 | // printf(" cosThetaPoint > %f\n",fD0toKpiCuts[8]); | |
a41f6fad | 469 | |
49061176 | 470 | Double_t pt = d->Pt(); |
a41f6fad | 471 | |
49061176 | 472 | Int_t ptbin=0; |
473 | ||
474 | //cout<<"P_t = "<<pt<<endl; | |
475 | if (pt>0. && pt<=1.) { | |
a4ae02cd | 476 | ptbin=1; |
9de8c723 | 477 | fVHFPPR->SetD0toKpiCuts(0.7,0.04,0.8,0.5,0.5,0.05,0.05,-0.0002,0.5); |
6ce5994f | 478 | fVHFloose->SetD0toKpiCuts(0.7,0.04,0.8,0.5,0.5,0.05,0.05,-0.00025,0.7); |
9de8c723 | 479 | // fVHFPPR->SetD0toKpiCuts(0.7,0.04,0.8,0.5,0.5,0.05,0.05,-0.0002,0.7); |
6ce5994f | 480 | // fVHFloose->SetD0toKpiCuts(0.7,0.04,0.8,0.5,0.5,1,1,-0.00015,0.5); |
49061176 | 481 | //printf("I'm in the bin %d\n",ptbin); |
a4ae02cd | 482 | |
49061176 | 483 | } |
46c96ce5 | 484 | |
485 | if(pt>1. && pt<=3.) { | |
9de8c723 | 486 | if(pt>1. && pt<=2.) ptbin=2; |
487 | if(pt>2. && pt<=3.) ptbin=3; | |
488 | fVHFPPR->SetD0toKpiCuts(0.7,0.02,0.8,0.7,0.7,0.05,0.05,-0.0002,0.8); | |
46c96ce5 | 489 | fVHFloose->SetD0toKpiCuts(0.7,0.02,0.8,0.7,0.7,1,1,-0.00025,0.8); |
490 | //printf("I'm in the bin %d\n",ptbin); | |
491 | } | |
492 | ||
493 | if(pt>3. && pt<=5.){ | |
9de8c723 | 494 | ptbin=4; |
495 | fVHFPPR->SetD0toKpiCuts(0.7,0.02,0.8,0.7,0.7,0.05,0.05,-0.0001,0.8); | |
6ce5994f | 496 | fVHFloose->SetD0toKpiCuts(0.7,0.02,0.8,0.7,0.7,0.05,0.05,-0.00015,0.8); |
49061176 | 497 | //printf("I'm in the bin %d\n",ptbin); |
49061176 | 498 | } |
46c96ce5 | 499 | if(pt>5.){ |
9de8c723 | 500 | ptbin=5; |
501 | fVHFPPR->SetD0toKpiCuts(0.7,0.02,0.8,0.7,0.7,0.05,0.05,-0.00005,0.8); | |
46c96ce5 | 502 | fVHFloose->SetD0toKpiCuts(0.7,0.02,0.8,0.7,0.7,0.05,0.05,-0.00015,0.9); |
503 | }//if(pt>5) | |
504 | ||
a4ae02cd | 505 | //printf("I'm in the bin %d\n",ptbin); |
506 | //old | |
507 | //fVHF->SetD0toKpiCuts(0.7,0.03,0.8,0.06,0.06,0.05,0.05,-0.0002,0.6); //2.p-p vertex reconstructed | |
9de8c723 | 508 | if(prongsinacc){ |
509 | FillHists(ptbin,d,mcArray,fVHFPPR,fOutputPPR); | |
510 | FillHists(ptbin,d,mcArray,fVHFloose,fOutputloose); | |
511 | } | |
49061176 | 512 | if(unsetvtx) d->UnsetOwnPrimaryVtx(); |
49061176 | 513 | } |
46c96ce5 | 514 | |
49061176 | 515 | |
516 | ||
517 | ||
518 | // Post the data | |
9de8c723 | 519 | PostData(1,fOutputPPR); |
a4ae02cd | 520 | PostData(2,fOutputloose); |
a41f6fad | 521 | PostData(4,fDistr); |
49061176 | 522 | return; |
523 | } | |
524 | //____________________________________________________________________________* | |
a4ae02cd | 525 | void AliAnalysisTaskSED0Mass::FillHists(Int_t ptbin, AliAODRecoDecayHF2Prong *part, TClonesArray *arrMC, AliAnalysisVertexingHF *vhf, TList *listout){ |
49061176 | 526 | // |
527 | // function used in UserExec: | |
528 | // | |
9de8c723 | 529 | |
530 | ||
531 | Double_t mPDG=TDatabasePDG::Instance()->GetParticle(421)->Mass(); | |
532 | ||
49061176 | 533 | Int_t okD0=0,okD0bar=0; |
feb73eca | 534 | //cout<<"inside FillHist"<<endl; |
a4ae02cd | 535 | if(part->SelectD0(vhf->GetD0toKpiCuts(),okD0,okD0bar)) {//selected |
49061176 | 536 | Double_t invmassD0 = part->InvMassD0(), invmassD0bar = part->InvMassD0bar(); |
537 | //printf("SELECTED\n"); | |
feb73eca | 538 | |
9de8c723 | 539 | |
feb73eca | 540 | AliAODTrack *prong=(AliAODTrack*)part->GetDaughter(0); |
541 | if(!prong) cout<<"No daughter found"; | |
542 | else{ | |
9de8c723 | 543 | if(prong->Charge()==1) {fTotPosPairs[ptbin-1]++;} else {fTotNegPairs[ptbin-1]++;} |
feb73eca | 544 | } |
545 | ||
546 | TString fillthis=""; | |
c8112d2f | 547 | Int_t pdgDgD0toKpi[2]={321,211}; |
548 | Int_t labD0 = part->MatchToMC(421,arrMC,2,pdgDgD0toKpi); //return MC particle label if the array corresponds to a D0, -1 if not (cf. AliAODRecoDecay.cxx) | |
a41f6fad | 549 | |
9de8c723 | 550 | //count candidates selected by cuts |
551 | fNentries->Fill(2); | |
552 | //count true D0 selected by cuts | |
553 | if (labD0>=0) fNentries->Fill(3); | |
554 | PostData(3,fNentries); | |
555 | ||
a4ae02cd | 556 | if (okD0==1) { |
557 | fillthis="histMass_"; | |
7646d6da | 558 | fillthis+=ptbin; |
559 | //cout<<"Filling "<<fillthis<<endl; | |
560 | ||
49061176 | 561 | //printf("Fill mass with D0"); |
a4ae02cd | 562 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0); |
feb73eca | 563 | |
a4ae02cd | 564 | if(labD0>=0) { |
feb73eca | 565 | if(fArray==1) cout<<"LS signal ERROR"<<endl; |
566 | ||
a4ae02cd | 567 | AliAODMCParticle *partD0 = (AliAODMCParticle*)arrMC->At(labD0); |
568 | Int_t pdgD0 = partD0->GetPdgCode(); | |
569 | //cout<<"pdg = "<<pdgD0<<endl; | |
a4ae02cd | 570 | if (pdgD0==421){ //D0 |
571 | //cout<<"Fill S with D0"<<endl; | |
46c96ce5 | 572 | fillthis="histSgn_"; |
573 | fillthis+=ptbin; | |
a4ae02cd | 574 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0); |
9de8c723 | 575 | if(TMath::Abs(invmassD0 - mPDG) < 0.027){ |
576 | fillthis="histSgn27_"; | |
577 | fillthis+=ptbin; | |
578 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0); | |
579 | } | |
a4ae02cd | 580 | } else{ //it was a D0bar |
46c96ce5 | 581 | fillthis="histRfl_"; |
582 | fillthis+=ptbin; | |
583 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0); | |
a4ae02cd | 584 | } |
585 | } else {//background | |
586 | fillthis="histBkg_"; | |
587 | fillthis+=ptbin; | |
588 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0); | |
589 | } | |
feb73eca | 590 | |
49061176 | 591 | } |
592 | if (okD0bar==1) { | |
a4ae02cd | 593 | fillthis="histMass_"; |
594 | fillthis+=ptbin; | |
49061176 | 595 | //printf("Fill mass with D0bar"); |
a4ae02cd | 596 | ((TH1F*)listout->FindObject(fillthis))->Fill(invmassD0bar); |
feb73eca | 597 | |
a4ae02cd | 598 | if(labD0>=0) { |
feb73eca | 599 | if(fArray==1) cout<<"LS signal ERROR"<<endl; |
a4ae02cd | 600 | AliAODMCParticle *partD0 = (AliAODMCParticle*)arrMC->At(labD0); |
601 | Int_t pdgD0 = partD0->GetPdgCode(); | |
602 | //cout<<" pdg = "<<pdgD0<<endl; | |
603 | if (pdgD0==-421){ //D0bar | |
604 | fillthis="histSgn_"; | |
605 | fillthis+=ptbin; | |
606 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0bar); | |
9de8c723 | 607 | if (TMath::Abs(invmassD0bar - mPDG) < 0.027){ |
608 | fillthis="histSgn27_"; | |
609 | fillthis+=ptbin; | |
610 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0bar); | |
611 | } | |
612 | ||
a4ae02cd | 613 | |
614 | } else{ | |
46c96ce5 | 615 | fillthis="histRfl_"; |
616 | fillthis+=ptbin; | |
617 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0bar); | |
a4ae02cd | 618 | } |
feb73eca | 619 | } else {//background or LS |
a4ae02cd | 620 | fillthis="histBkg_"; |
621 | fillthis+=ptbin; | |
622 | ((TH1F*)(listout->FindObject(fillthis)))->Fill(invmassD0bar); | |
623 | } | |
624 | } | |
625 | ||
626 | ||
49061176 | 627 | } //else cout<<"NOT SELECTED"<<endl; |
628 | ||
629 | } | |
630 | //________________________________________________________________________ | |
631 | void AliAnalysisTaskSED0Mass::Terminate(Option_t */*option*/) | |
632 | { | |
633 | // Terminate analysis | |
634 | // | |
635 | if(fDebug > 1) printf("AnalysisTaskSED0Mass: Terminate() \n"); | |
636 | ||
9de8c723 | 637 | fOutputPPR = dynamic_cast<TList*> (GetOutputData(1)); |
638 | if (!fOutputPPR) { | |
a41f6fad | 639 | printf("ERROR: fOutputthight not available\n"); |
a4ae02cd | 640 | return; |
641 | } | |
642 | fOutputloose = dynamic_cast<TList*> (GetOutputData(2)); | |
643 | if (!fOutputloose) { | |
a41f6fad | 644 | printf("ERROR: fOutputloose not available\n"); |
645 | return; | |
646 | } | |
9de8c723 | 647 | fDistr = dynamic_cast<TList*> (GetOutputData(4)); |
a41f6fad | 648 | if (!fDistr) { |
649 | printf("ERROR: fDistr not available\n"); | |
49061176 | 650 | return; |
651 | } | |
652 | ||
feb73eca | 653 | if(fArray==1){ |
654 | for(Int_t ipt=0;ipt<4;ipt++){ | |
655 | fLsNormalization = 2.*TMath::Sqrt(fTotPosPairs[ipt]*fTotNegPairs[ipt]); | |
656 | ||
657 | ||
658 | if(fLsNormalization>0) { | |
9de8c723 | 659 | |
feb73eca | 660 | TString massName="histMass_"; |
661 | massName+=ipt+1; | |
9de8c723 | 662 | ((TH1F*)fOutputPPR->FindObject(massName))->Scale((1/fLsNormalization)*((TH1F*)fOutputPPR->FindObject(massName))->GetEntries()); |
feb73eca | 663 | ((TH1F*)fOutputloose->FindObject(massName))->Scale((1/fLsNormalization)*((TH1F*)fOutputloose->FindObject(massName))->GetEntries()); |
664 | } | |
665 | } | |
666 | ||
667 | fLsNormalization = 2.*TMath::Sqrt(fTotPosPairs[4]*fTotNegPairs[4]); | |
668 | ||
669 | if(fLsNormalization>0) { | |
670 | ||
671 | TString nameDistr="hptB"; | |
672 | ((TH1F*)fDistr->FindObject(nameDistr))->Scale((1/fLsNormalization)*((TH1F*)fDistr->FindObject(nameDistr))->GetEntries()); | |
673 | nameDistr="hdcaB"; | |
674 | ((TH1F*)fDistr->FindObject(nameDistr))->Scale((1/fLsNormalization)*((TH1F*)fDistr->FindObject(nameDistr))->GetEntries()); | |
675 | nameDistr="hcosthetastarB"; | |
676 | ((TH1F*)fDistr->FindObject(nameDistr))->Scale((1/fLsNormalization)*((TH1F*)fDistr->FindObject(nameDistr))->GetEntries()); | |
677 | nameDistr="hd0B"; | |
678 | ((TH1F*)fDistr->FindObject(nameDistr))->Scale((1/fLsNormalization)*((TH1F*)fDistr->FindObject(nameDistr))->GetEntries()); | |
679 | nameDistr="hd0d0B"; | |
680 | ((TH1F*)fDistr->FindObject(nameDistr))->Scale((1/fLsNormalization)*((TH1F*)fDistr->FindObject(nameDistr))->GetEntries()); | |
681 | nameDistr="hcosthetapointB"; | |
682 | ((TH1F*)fDistr->FindObject(nameDistr))->Scale((1/fLsNormalization)*((TH1F*)fDistr->FindObject(nameDistr))->GetEntries()); | |
683 | nameDistr="hcosthpointd0d0B"; | |
684 | ((TH2F*)fDistr->FindObject(nameDistr))->Scale((1/fLsNormalization)*((TH2F*)fDistr->FindObject(nameDistr))->GetEntries()); | |
685 | ||
686 | } | |
687 | } | |
6ce5994f | 688 | |
49061176 | 689 | return; |
690 | } | |
691 |