1 /**************************************************************************
2 * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 /////////////////////////////////////////////////////////////
18 // Class AliAnalysisTaskCharmFraction
19 // AliAnalysisTask for the extraction of the fraction of prompt charm
20 // using the charm hadron impact parameter to the primary vertex
22 // Author: Andrea Rossi, andrea.rossi@ts.infn.it
23 /////////////////////////////////////////////////////////////
30 #include <TDatabasePDG.h>
33 #include "AliAnalysisTask.h"
34 #include "AliAnalysisManager.h"
35 #include "AliAODEvent.h"
36 #include "AliAODInputHandler.h"
37 #include "AliAnalysisVertexingHF.h"
38 #include "AliAODRecoDecayHF2Prong.h"
39 #include "AliAODRecoDecayHF.h"
40 #include "AliAODRecoDecay.h"
41 #include "AliAODTrack.h"
42 #include "AliAODVertex.h"
43 #include "AliAODMCParticle.h"
44 #include "AliAODMCHeader.h"
45 #include "AliAnalysisTaskCharmFraction.h"
47 ClassImp(AliAnalysisTaskCharmFraction)
49 //________________________________________________________________________
50 AliAnalysisTaskCharmFraction::AliAnalysisTaskCharmFraction(const char *name)
51 : AliAnalysisTask(name, ""), fAOD(0), fVHF(0),
75 fcheckMC2prongs(kFALSE),
76 fcheckMCprompt(kFALSE),
77 fcheckMCfromB(kFALSE),
79 fStudyd0fromBTrue(kTRUE),
80 fStudyPureBackground(kFALSE),
84 //Side bands selection (see cxx): 999 -> no inv mass selection at all,
85 // >0 -> both D0 and D0bar hypothesis are required to be kFALSE,
86 // <0 -> only 1 inv mass hypothesis is required to be KFALSE
89 // Define input and output slots here
90 // Input slot #0 works with a TChain
91 DefineInput(0, TChain::Class());
92 // DefineInput(1, TChain::Class());
93 // Output slot #0 writes into a TH1 container
94 DefineOutput(0, TH2F::Class());// hCPtaVsd0d0
95 DefineOutput(1, TH2F::Class());// hVtxXY
96 for(Int_t j=2;j<3*fnbins+11;j++){ // hCPta, hd0xd0, hVtZ, hVtX hVtY hVtPhi + nptbin hd0D0 +hd0D0 integreated +nptbin hd0VtxTrueD0 +hd0VtxTrueD0 integrated +nptbin hMCd0D0 +hMCd0D0 integrated
97 DefineOutput(j, TH1F::Class());
99 // DefineOutput(fnbins+8, TH1F::Class());// hd0D0 pt integrated
102 //________________________________________________________________________
103 AliAnalysisTaskCharmFraction::AliAnalysisTaskCharmFraction(const char *name,Int_t nptbins)
104 : AliAnalysisTask(name, ""), fAOD(0), fVHF(0),
121 fhd0D0VtxTruept(0x0),
128 fcheckMC2prongs(kFALSE),
129 fcheckMCprompt(kFALSE),
130 fcheckMCfromB(kFALSE),
132 fStudyd0fromBTrue(kTRUE),
133 fStudyPureBackground(kFALSE),
137 //Side bands selection (see cxx): 999 -> no inv mass selection at all,
138 // >0 -> both D0 and D0bar hypothesis are required to be kFALSE,
139 // <0 -> only 1 inv mass hypothesis is required to be KFALSE
141 // Define input and output slots here
142 // Input slot #0 works with a TChain
143 DefineInput(0, TChain::Class());
144 // DefineInput(1, TChain::Class());
145 // Output slot #0 writes into a TH1 container
147 DefineOutput(0, TH2F::Class());// hCPtaVsd0d0
148 DefineOutput(1, TH2F::Class());// hVtxXY
149 for(Int_t j=2;j<3*fnbins+13;j++){ // hCPta, hd0xd0, hVtZ, hVtX hVtY hVtPhi + nptbin hd0D0 +hd0D0 integreated +nptbin hd0VtxTrueD0 +hd0VtxTrueD0 integrated +nptbin hMCd0D0 +hMCd0D0 integrated
150 DefineOutput(j, TH1F::Class());
152 // DefineOutput(fnbins+8, TH1F::Class());// hd0D0 pt integrated
155 //________________________________________________________________________
156 void AliAnalysisTaskCharmFraction::ConnectInputData(Option_t *)
158 // Connect ESD or AOD here
161 TTree* tree = dynamic_cast<TTree*> (GetInputData(0));
162 // TTree* treeFriend = dynamic_cast<TTree*> (GetInputData(1));
164 Printf("ERROR: Could not read chain from input slot 0");
166 // tree->AddFriend(treeFriend);
168 // Disable all branches and enable only the needed ones
169 // The next two lines are different when data produced as AliESDEvent is read
171 AliAODInputHandler *aodH = dynamic_cast<AliAODInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
172 fAOD=new AliAODEvent();
173 fAOD->ReadFromTree(tree);
175 fArrayD0toKpi = (TClonesArray*)fAOD->GetList()->FindObject("D0toKpi");
176 fArrayMC = (TClonesArray*)fAOD->GetList()->FindObject("mcparticles");
178 fAODmcHeader=(AliAODMCHeader*)fAOD->GetList()->FindObject("mcHeader");
181 Printf("ERROR: Could not get AODInputHandler");
183 fAOD = aodH->GetEvent();
188 //________________________________________________________________________
189 void AliAnalysisTaskCharmFraction::CreateOutputObjects()
193 fhd0D0 = new TH1F("hd0D0","D^{0} impact par. plot (All momenta)",1000,-1000.,1000.);
194 fhd0D0->SetXTitle("Impact parameter [#mum]");
195 fhd0D0->SetYTitle("Entries");
197 fhd0D0VtxTrue = new TH1F("hd0D0VtxTrue","D^{0} impact par. w.r.t. True Vtx (All momenta)",1000,-1000.,1000.);
198 fhd0D0VtxTrue->SetXTitle("Impact parameter [#mum]");
199 fhd0D0VtxTrue->SetYTitle("Entries");
201 fhMCd0D0 = new TH1F("hMCd0D0","D^{0} impact par. plot (All momenta)",1000,-1000.,1000.);
202 fhMCd0D0->SetXTitle("MC Impact parameter [#mum]");
203 fhMCd0D0->SetYTitle("Entries");
205 fhCPtaVSd0d0=new TH2F("hCPtaVSd0d0","hCPtaVSd0d0",1000,-100000.,100000.,100,0.,1.);
206 fhSecVtxZ=new TH1F("hSecVtxZ","hSecVtxZ",1000,-8.,8.);
207 fhSecVtxX=new TH1F("hSecVtxX","hSecVtxX",1000,-3000.,3000.);
208 fhSecVtxY=new TH1F("hSecVtxY","hSecVtxY",1000,-3000.,3000.);
209 fhSecVtxXY=new TH2F("hSecVtxXY","hSecVtxXY",1000,-3000.,3000.,1000,-3000.,3000.);
210 fhSecVtxPhi=new TH1F("hSecVtxPhi","hSecVtxPhi",180,-180.1,180.1);
211 fhCPta=new TH1F("hCPta","hCPta",100,0.,1.);
212 fhd0xd0=new TH1F("hd0xd0","hd0xd0",1000,-100000.,100000.);
213 fhMassTrue=new TH1F("hMassTrue","D^{0} MC inv. Mass (All momenta)",600,1.600,2.200);
214 fhMass=new TH1F("hMass","D^{0} inv. Mass (All momenta)",600,1.600,2.200);
215 Double_t standardptbins[14]={0.,0.5,1.,2.,3.,5.,7.,10.,15.,20.,30.,40.,50.,100.};
217 fhd0D0pt=new TH1F*[fnbins];
218 fhMCd0D0pt=new TH1F*[fnbins];
219 fhd0D0VtxTruept=new TH1F*[fnbins];
220 TString namehist="hd0D0pt";
221 TString titlehist="D^{0} impact par. plot ";
222 TString strnamept,strtitlept;
223 for(Int_t i=0;i<fnbins;i++){
225 strnamept+=i;// strnamept+=standardptbins[i+1];
226 // strnamept.Append("_");
227 //strnamept+=standardptbins[i+1];
230 strtitlept+=standardptbins[i];
231 strtitlept.Append("<= pt <");
232 strtitlept+=standardptbins[i+1];
233 strtitlept.Append(" [GeV/c]");
235 fhd0D0pt[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
236 fhd0D0pt[i]->SetXTitle("Impact parameter [#mum] ");
237 fhd0D0pt[i]->SetYTitle("Entries");
239 strnamept.ReplaceAll("hd0D0","hMCd0D0");
240 fhMCd0D0pt[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
241 fhMCd0D0pt[i]->SetXTitle("MC Impact parameter [#mum] ");
242 fhMCd0D0pt[i]->SetYTitle("Entries");
244 strnamept.ReplaceAll("hMCd0D0","hd0D0VtxTrue");
245 fhd0D0VtxTruept[i] = new TH1F(strnamept.Data(),strtitlept.Data(),1000,-1000.,1000.);
246 fhd0D0VtxTruept[i]->SetXTitle("Impact parameter w.r.t. True Vtx [#mum] ");
247 fhd0D0VtxTruept[i]->SetYTitle("Entries");
252 /* fHistPt = new TH1F("fHistPt", "P_{T} distribution", 15, 0.1, 3.1);
253 fHistPt->GetXaxis()->SetTitle("P_{T} (GeV/c)");
254 fHistPt->GetYaxis()->SetTitle("dN/dP_{T} (c/GeV)");
255 fHistPt->SetMarkerStyle(kFullCircle);*/
258 //________________________________________________________________________
259 void AliAnalysisTaskCharmFraction::Exec(Option_t *)
262 // Called for each event
265 Printf("ERROR: fAOD not available");
269 //Printf("There are %d tracks in this event", fAOD->GetNumberOfTracks());
270 // Int_t nTotHF=0,nTotDstar=0,nTot3Prong=0;
272 // const Int_t nptbins=10;
273 Double_t standardptbins[14]={0.,0.5,1.,2.,3.,5.,7.,10.,15.,20.,30.,40.,50.,100.};
274 Double_t pD[3],xD[3],pXtrTrue[2],pYtrTrue[2],pZtrTrue[2],xtr1[3],xtr2[3];
276 // cutsD0[0] = inv. mass half width [GeV]
277 // cutsD0[1] = dca [cm]
278 // cutsD0[2] = cosThetaStar
279 // cutsD0[3] = pTK [GeV/c]
280 // cutsD0[4] = pTPi [GeV/c]
281 // cutsD0[5] = d0K [cm] upper limit!
282 // cutsD0[6] = d0Pi [cm] upper limit!
283 // cutsD0[7] = d0d0 [cm^2]
284 // cutsD0[8] = cosThetaPoint
305 const Double_t fixedInvMassCut=cutsD0[0];
306 AliAODVertex *vtx1=0;
308 vtx1 = (AliAODVertex*)fAOD->GetPrimaryVertex();
310 fAODmcHeader->GetVertex(vtxTrue);
312 AliAODRecoDecayHF *aodDMC=0x0;
313 Bool_t nomum=kFALSE,background=kFALSE;
314 AliAODMCParticle *mum1=0x0,*mum2=0x0;
315 AliAODMCParticle *b1=0x0,*b2=0x0;
316 AliAODMCParticle *sonpart=0x0,*grandmoth1=0x0;
318 // make trkIDtoEntry register (temporary)
319 Int_t trkIDtoEntry[100000];
320 for(Int_t it=0;it<fAOD->GetNumberOfTracks();it++) {
321 AliAODTrack *track = fAOD->GetTrack(it);
322 if(track->GetID()<0) {
323 //printf("Track ID <0, id= %d\n",track->GetID());
326 trkIDtoEntry[track->GetID()]=it;
330 // loop over D0->Kpi candidates
331 Int_t nD0toKpi = fArrayD0toKpi->GetEntriesFast();
332 nTotD0toKpi += nD0toKpi;
333 // cout<<"Number of D0->Kpi: "<<nD0toKpi<<endl;
335 for (Int_t iD0toKpi = 0; iD0toKpi < nD0toKpi; iD0toKpi++) {
336 if(aodDMC!=0x0)delete aodDMC;
344 AliAODRecoDecayHF2Prong *d = (AliAODRecoDecayHF2Prong*)fArrayD0toKpi->UncheckedAt(iD0toKpi);
345 Bool_t unsetvtx=kFALSE;
346 if(!d->GetOwnPrimaryVtx()) {
347 d->SetOwnPrimaryVtx(vtx1); // needed to compute all variables
351 // d->SetOwnPrimaryVtx(vtx1);
354 Int_t okD0=0,okD0bar=0;
355 Double_t invMassD0,invMassD0bar,cutmassvalue=-1.;
356 Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
360 cutsD0[0]=fixedInvMassCut;
362 cutmassvalue=cutsD0[0];
363 if(fSideBands==999.)cutsD0[0]=1000.;
364 else cutsD0[0]=2.*TMath::Abs(fSideBands)*cutsD0[0];
366 if(d->SelectD0(cutsD0,okD0,okD0bar)) {
368 if(fSideBands==999.)cutmassvalue=-1.;
369 d->InvMassD0(invMassD0,invMassD0bar);
371 if(TMath::Abs(invMassD0-mD0PDG) > TMath::Abs(fSideBands)*cutmassvalue) okD0 = okD0 && kTRUE;
373 if(TMath::Abs(invMassD0bar-mD0PDG) > TMath::Abs(fSideBands)*cutmassvalue) okD0bar = okD0bar && kTRUE; // SIDE BANDS SELECTION
377 if(!okD0 && !okD0bar) continue;
379 else if (!okD0 || !okD0bar)continue;
383 // get daughter AOD tracks
384 AliAODTrack *trk0 = (AliAODTrack*)d->GetDaughter(0);
385 AliAODTrack *trk1 = (AliAODTrack*)d->GetDaughter(1);
387 //Check if it's a True D0
391 if(trk0->GetLabel()==-1||trk1->GetLabel()==-1){
393 background=kTRUE; //FAKE TRACK
396 // printf("Before entering the MC checks \n");
398 b1=(AliAODMCParticle*)fArrayMC->At(trk0->GetLabel());
399 b2=(AliAODMCParticle*)fArrayMC->At(trk1->GetLabel());
402 if(b1->GetMother()==-1||b2->GetMother()==-1){
403 nomum=kTRUE; //Tracks with no mother
404 //printf("Inside problem mothering \n");// FAKE DECAY VERTEX
407 // if(!fStudyPureBackground)continue;
410 if(b1->GetMother()!=b2->GetMother()){
411 //Check the label of the mother is the same
412 background=kTRUE; // NOT SAME MOTHER
415 // printf("After first mothering \n");
416 mum1=(AliAODMCParticle*)fArrayMC->At(b1->GetMother());
417 mum2=(AliAODMCParticle*)fArrayMC->At(b2->GetMother());
418 // if((mum1->GetPdgCode()!=mum2->GetPdgCode()))continue; //Check the mother is the same particle
419 // printf("After second mothering \n");
420 // printf("Particle codes: tr1: %d, tr2: %d, mum1: %d, mum 2: %d \n",b1->GetPdgCode(),b2->GetPdgCode(),mum1->GetPdgCode(),mum2->GetPdgCode());
421 if(fcheckMCD0)if(TMath::Abs(mum1->GetPdgCode())!=421){
422 //^fStudyPureBackground)continue;//NPRONG
423 background=kTRUE;// NOT A D0
426 if(fcheckMC2prongs)if(mum1->GetDaughter(1)-mum1->GetDaughter(0)+1!=2){
427 //^fStudyPureBackground)continue;// NPRONG
428 background=kTRUE; // NOT A 2 PRONG DECAY
432 if(mum1->GetMother()==-1){
433 background=kTRUE; // A particle coming from nothing
437 // ^fStudyPureBackground)continue;
438 // printf("After second mothering \n");
439 grandmoth1=(AliAODMCParticle*)fArrayMC->At(mum1->GetMother());
440 if(fSkipD0star)if(TMath::Abs(grandmoth1->GetPdgCode())==413||TMath::Abs(grandmoth1->GetPdgCode())==423){
441 //^fStudyPureBackground)continue;
442 background=kTRUE;// D0 COMING FROM A D0*
445 if(fcheckMCD0){//THIS CHECK IS NEEDE TO AVOID POSSIBLE FAILURE IN THE SECOND WHILE
446 while(TMath::Abs(grandmoth1->GetPdgCode())!=4&&TMath::Abs(grandmoth1->GetPdgCode())!=5){
447 if(grandmoth1->GetMother()==-1){
448 // printf("Inside grandmothering \n");
449 //printf("mother=-1, pdgcode: %d \n",grandmoth1->GetPdgCode());
450 Int_t son=grandmoth1->GetDaughter(0);
451 sonpart=(AliAODMCParticle*)fArrayMC->At(son);
452 while(TMath::Abs(sonpart->GetPdgCode())!=421){
453 //printf("mother=-1, pdgcode: %d \n",sonpart->GetPdgCode());
455 sonpart=(AliAODMCParticle*)fArrayMC->At(son);
459 grandmoth1=(AliAODMCParticle*)fArrayMC->At(grandmoth1->GetMother());
462 if(fcheckMCprompt)if(TMath::Abs(grandmoth1->GetPdgCode())!=4){
463 //^fStudyPureBackground)continue;
468 if(TMath::Abs(grandmoth1->GetPdgCode())!=5){
469 //^fStudyPureBackground)continue;
474 //else if(!fStudyPureBackground)continue;
477 if(background^fStudyPureBackground)continue;
478 if(fStudyd0fromBTrue){
479 if(b1!=0x0&&b2!=0x0){
480 Int_t charge[2]={0,0};
481 if(b1->Charge()==-1)charge[0]=1;
483 if(b2->Charge()==-1){
484 //printf("Same charges for prongs \n");
489 /* if(!pXtrTrue[charge[0]]=b1->Px()){printf("!first MCtrack:Get momentum X failed \n");continue;}
490 if(!b1->Py(pYtrTrue[charge[0]])){printf("!first MCtrack:Get momentum Y failed \n");continue;}
491 if(!b1->Pz(pZtrTrue[charge[0]])){printf("!first MCtrack:Get momentum Z failed \n");continue;}
494 pXtrTrue[charge[0]]=b1->Px();
495 pYtrTrue[charge[0]]=b1->Py();
496 pZtrTrue[charge[0]]=b1->Pz();
497 if(!b1->XvYvZv(xtr1)){
498 //printf("!first MCtrack:Get position failed \n");
501 /*if(!b2->Px(pXtrTrue[charge[1]])){printf("!second MCtrack:Get momentum X failed \n");continue;}
502 if(!b2->Py(pYtrTrue[charge[1]])){printf("!second MCtrack:Get momentum Y failed \n");continue;}
503 if(!b2->Pz(pZtrTrue[charge[1]])){printf("!second MCtrack:Get momentum Z failed \n");continue;}*/
504 pXtrTrue[charge[1]]=b2->Px();
505 pYtrTrue[charge[1]]=b2->Py();
506 pZtrTrue[charge[1]]=b2->Pz();
508 if(!(mum1==0x0||mum2==0x0)){
509 if(!mum1->PxPyPz(pD)){
510 //printf("!D from B:Get momentum failed \n");
513 if(!mum1->XvYvZv(xD)){
514 //printf("!D from B:Get position failed \n");
517 if(pXtrTrue[0]+pXtrTrue[1]!=pD[0]){
518 //printf("Warning! MCinfo: Pt of the mother doesn't match the sum of the daughters pt: X component %f + %f = %f Vs %f \n",pXtrTrue[0],pXtrTrue[1],pXtrTrue[0]+pXtrTrue[1],pD[0]);
519 //printf("Warning! MCinfo: Pt of the mother doesn't match the sum of the daughters pt: Y componente %f + %f = %f Vs %f \n",pYtrTrue[0],pYtrTrue[1],pYtrTrue[0]+pYtrTrue[1],pD[1]);
520 //printf("Warning!: Pt comparison from the sum of the daughters:%f Vs mother pT: %f \n",TMath::Sqrt((pXtrTrue[0]+pXtrTrue[1])*(pXtrTrue[0]+pXtrTrue[1])+(pYtrTrue[0]+pYtrTrue[1])*(pYtrTrue[0]+pYtrTrue[1])),TMath::Sqrt(pD[0]*pD[0]+pD[1]*pD[1]));
524 // if(!b2->PxPyPz(ptr2True)){printf("!second MCtrack:Get momentum failed \n");continue;}
525 if(!b2->XvYvZv(xtr2)){
526 //printf("!second MCtrack:Get position failed \n");
529 Double_t d0dummy[2]={0.,0.};//TEMPORARY : dummy d0 for AliAODRecoDeay constructor
530 aodDMC=new AliAODRecoDecayHF(vtxTrue,xD,2,0,pXtrTrue,pYtrTrue,pZtrTrue,d0dummy);
531 fhMassTrue->Fill(mum1->GetCalcMass());
533 //else printf("Warning! The candidate comes from two track with a different mother, \n -> the true mother d0 doesn't exist ! -> There will be different entries between observed and MC d0distributions \n");
537 //printf("End of MC checks \n");
540 //printf("A real D0 was found!! \n");
543 //cout<<1e8*d->Prodd0d0()<<endl;
544 /* if(fSideBands){ // The integral of the Hists will in general differ
545 // from the number of candidates which passed the selection
546 if(okD0)fhMass->Fill(d->InvMassD0(),1.);
547 if(okD0bar)fhMass->Fill(d->InvMassD0bar(),1.);
549 else { // The integral of the Hists will in general differ
550 // from the number of candidates which passed the selection
551 if(okD0)fhMass->Fill(d->InvMassD0(),1.);
552 if(okD0bar)fhMass->Fill(d->InvMassD0bar(),1.);
556 if(okD0)fhMass->Fill(d->InvMassD0(),1.);
557 if(okD0bar)fhMass->Fill(d->InvMassD0bar(),1.);
559 fhCPtaVSd0d0->Fill(1e8*d->Prodd0d0(),d->CosPointingAngle());
560 fhSecVtxZ->Fill(d->GetSecVtxZ());
561 fhSecVtxX->Fill(d->GetSecVtxX()*10000.);
562 fhSecVtxY->Fill(d->GetSecVtxY()*10000.);
563 fhSecVtxXY->Fill(d->GetSecVtxX()*10000.,d->GetSecVtxY()*10000.);
564 fhSecVtxPhi->Fill(TMath::ATan2(d->GetSecVtxY()*10000.,d->GetSecVtxX()*10000.)*TMath::RadToDeg());
565 fhd0xd0->Fill(1e8*d->Prodd0d0());
566 fhCPta->Fill(d->CosPointingAngle());
569 //cout<<d->GetSecVtxX() <<endl;
572 /* if(d->GetProngID(0)<0||d->GetProngID(1)<0){
573 printf("Wrong ProngID,%d or %d\n",d->GetProngID(0),d->GetProngID(1));continue;
576 trk0=fAOD->GetTrack(trkIDtoEntry[d->GetProngID(0)]);
577 trk1=fAOD->GetTrack(trkIDtoEntry[d->GetProngID(1)]);
578 // cout<<"references to standard AOD not available"<<endl;
580 // cout<<"pt of positive track: "<<trk0->Pt()<<endl;
582 // make a AliExternalTrackParam from the D0
583 // and calculate impact parameters to primary vertex
586 // AliExternalTrackParam trackD0(d);
587 //cout<<"pt of D0: "<<d->Pt()<<" (AliAODRecoDecay); "<<trackD0.Pt()<<" (track)"<<endl;
589 Double_t ptD0=d->Pt();
590 for(Int_t j=0;j<fnbins;j++){
591 if(ptD0<standardptbins[j+1]){
592 fhd0D0VtxTruept[j]->Fill(d->AliAODRecoDecay::ImpParXY(vtxTrue)*10000.);
593 fhd0D0pt[j]->Fill(d->ImpParXY()*10000.);
594 // printf("HERE in tha class \n");
595 if(aodDMC!=0x0)fhMCd0D0pt[j]->Fill(aodDMC->ImpParXY()*10000.);
596 // printf("HERE2 in tha class \n");
600 fhd0D0->Fill(d->ImpParXY()*10000.);
601 fhd0D0VtxTrue->Fill(d->AliAODRecoDecay::ImpParXY(vtxTrue)*10000.);
602 if(aodDMC!=0x0)fhMCd0D0->Fill(aodDMC->ImpParXY()*10000.);
603 // if((1.864-3.*0.011.<d->InvMassD0()&&d->InvMassD0()<1.864+3.*0.011)||(1.864-3.*0.011<d->InvMassD0bar()&&d->InvMassD0bar()<1.864+3.*0.011)){
616 // Double_t dz[2],covdz[3];
617 //trackD0.PropagateToDCA(vtx1,fAOD->GetMagneticField(),1000.,dz,covdz);
618 // cout<<"D0 impact parameter rphi: "<<dz[0]<<" +- "<<TMath::Sqrt(covdz[0])<<endl;
620 // printf("Before end of the event \n");
621 if(unsetvtx) d->UnsetOwnPrimaryVtx();
629 PostData(0,fhCPtaVSd0d0);
630 PostData(1,fhSecVtxXY);
633 PostData(4,fhSecVtxZ);
634 PostData(5,fhSecVtxX);
635 PostData(6,fhSecVtxY);
636 PostData(7,fhSecVtxPhi);
639 for(Int_t j=0;j<fnbins;j++){
641 PostData(j+8, fhd0D0pt[j]);
644 PostData(fnbins+8, fhd0D0);
646 for(Int_t j=0;j<fnbins;j++){
648 PostData(j+fnbins+9,fhMCd0D0pt[j]);
651 PostData(2*fnbins+9, fhMCd0D0);
653 for(Int_t j=0;j<fnbins;j++){
655 PostData(j+2*fnbins+10,fhd0D0VtxTruept[j]);
658 PostData(3*fnbins+10,fhd0D0VtxTrue);
659 PostData(3*fnbins+11,fhMassTrue);
660 PostData(3*fnbins+12,fhMass);
663 //________________________________________________________________________
664 void AliAnalysisTaskCharmFraction::Terminate(Option_t *)
666 // Draw result to the screen
667 // Called once at the end of the query
669 fhd0D0 = dynamic_cast<TH1F*> (GetOutputData(fnbins+8));
671 Printf("ERROR: fhd0D0 not available");
675 TCanvas *c1 = new TCanvas("AliAnalysisTaskCharmFraction","D0 impact par",10,10,510,510);
676 c1->cd(1)->SetLogy();
677 fhd0D0->DrawCopy("E");
679 TCanvas *cd0D0pt=new TCanvas("cd0D0pt","cd0D0pt",0,0,800,700);
680 cd0D0pt->Divide(fnbins/2+fnbins%2,2);
681 for(Int_t j=0;j<fnbins;j++){
682 fhd0D0pt[j] = dynamic_cast<TH1F*> (GetOutputData(8+j));
684 Printf("ERROR: fhd0D0pt not available");