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 **************************************************************************/
17 // Base class for DStar - Hadron Correlations Analysis
19 //-----------------------------------------------------------------------
22 // Author S.Bjelogrlic
24 // sandro.bjelogrlic@cern.ch
26 //-----------------------------------------------------------------------
30 //#include <TDatabasePDG.h>
31 #include <TParticle.h>
36 #include "AliAnalysisTaskDStarCorrelations.h"
37 #include "AliRDHFCutsDStartoKpipi.h"
38 #include "AliHFAssociatedTrackCuts.h"
39 #include "AliAODRecoDecay.h"
40 #include "AliAODRecoCascadeHF.h"
41 #include "AliAODRecoDecayHF2Prong.h"
42 #include "AliAODPidHF.h"
43 //#include "AliEventPoolManager.h"
44 #include "AliVParticle.h"
45 #include "AliAnalysisManager.h"
46 #include "AliAODInputHandler.h"
47 #include "AliAODHandler.h"
48 #include "AliESDtrack.h"
49 #include "AliAODMCParticle.h"
50 #include "AliNormalizationCounter.h"
51 #include "AliReducedParticle.h"
52 #include "AliHFCorrelator.h"
57 ClassImp(AliAnalysisTaskDStarCorrelations)
60 //__________________________________________________________________________
61 AliAnalysisTaskDStarCorrelations::AliAnalysisTaskDStarCorrelations() :
80 // default constructor
83 //__________________________________________________________________________
84 AliAnalysisTaskDStarCorrelations::AliAnalysisTaskDStarCorrelations(const Char_t* name,AliRDHFCutsDStartoKpipi* cuts, AliHFAssociatedTrackCuts *AsscCuts) :
85 AliAnalysisTaskSE(name),
105 Info("AliAnalysisTaskDStarCorrelations","Calling Constructor");
106 DefineInput(0, TChain::Class());
107 DefineOutput(1,TList::Class()); // histos from data
108 DefineOutput(2,AliRDHFCutsDStartoKpipi::Class()); // my cuts
109 DefineOutput(3,AliNormalizationCounter::Class()); // normalization
110 DefineOutput(4,AliHFAssociatedTrackCuts::Class()); // my cuts
113 //__________________________________________________________________________
115 AliAnalysisTaskDStarCorrelations::~AliAnalysisTaskDStarCorrelations() {
120 Info("AliAnalysisTaskDStarCorrelations","Calling Destructor");
122 if(fhandler) {delete fhandler; fhandler = 0;}
123 //if(fPoolMgr) {delete fPoolMgr; fPoolMgr = 0;}
124 if(fmcArray) {delete fmcArray; fmcArray = 0;}
125 if(fCounter) {delete fCounter; fCounter = 0;}
126 if(fCorrelator) {delete fCorrelator; fCorrelator = 0;}
127 if(fOutput) {delete fOutput; fOutput = 0;}
128 if(fCuts) {delete fCuts; fCuts = 0;}
129 if(fCuts2) {delete fCuts2; fCuts2=0;}
133 //___________________________________________________________
134 void AliAnalysisTaskDStarCorrelations::Init(){
138 if(fDebug > 1) printf("AliAnalysisTaskDStarCorrelations::Init() \n");
140 AliRDHFCutsDStartoKpipi* copyfCuts=new AliRDHFCutsDStartoKpipi(*fCuts);
146 PostData(2,copyfCuts);
148 // Post the hadron cuts
155 //_________________________________________________
156 void AliAnalysisTaskDStarCorrelations::UserCreateOutputObjects(){
157 Info("UserCreateOutputObjects","CreateOutputObjects of task %s\n", GetName());
161 fOutput = new TList();
165 DefineHistoForAnalysis();
166 fCounter = new AliNormalizationCounter(Form("%s",GetOutputSlot(3)->GetContainer()->GetName()));
169 Double_t Pi = TMath::Pi();
170 fCorrelator = new AliHFCorrelator("Correlator",fCuts2,fSystem); // fCuts2 is the hadron cut object, fSystem to switch between pp or PbPb
171 fCorrelator->SetDeltaPhiInterval((-0.5-1./32)*Pi,(1.5-1./32)*Pi); // set correct phi interval
172 //fCorrelator->SetDeltaPhiInterval(-1.57,4.71);
173 fCorrelator->SetEventMixing(fmixing); //set kFALSE/kTRUE for mixing Off/On
174 fCorrelator->SetAssociatedParticleType(fselect); // set 1/2/3 for hadron/kaons/kzeros
175 fCorrelator->SetApplyDisplacementCut(fDisplacement); //set kFALSE/kTRUE for using the displacement cut
176 fCorrelator->SetUseMC(fmontecarlo);
177 Bool_t pooldef = fCorrelator->DefineEventPool();
179 if(!pooldef) AliInfo("Warning:: Event pool not defined properly");
184 //_________________________________________________
185 void AliAnalysisTaskDStarCorrelations::UserExec(Option_t *){
187 cout << "USER EXEC CHECKPOINT 1" << endl;
189 //Double_t pi = TMath::Pi();
192 cout << "=================================================================================" << endl;
194 if(fselect==1) cout << "TASK::Correlation with hadrons on SE "<< endl;
195 if(fselect==2) cout << "TASK::Correlation with kaons on SE "<< endl;
196 if(fselect==3) cout << "TASK::Correlation with kzeros on SE "<< endl;
199 if(fselect==1) cout << "TASK::Correlation with hadrons on ME "<< endl;
200 if(fselect==2) cout << "TASK::Correlation with kaons on ME "<< endl;
201 if(fselect==3) cout << "TASK::Correlation with kzeros on ME "<< endl;
204 Error("UserExec","NO EVENT FOUND!");
208 AliAODEvent* aodEvent = dynamic_cast<AliAODEvent*>(fInputEvent);
210 AliError("AOD event not found!");
214 fCorrelator->SetAODEvent(aodEvent); // set the event to be processed
216 fEvents++; // event counter
217 ((TH1D*)fOutput->FindObject("NofEvents"))->Fill(0);
218 fmcArray = dynamic_cast<TClonesArray*>(aodEvent->FindListObject(AliAODMCParticle::StdBranchName()));
220 if(fmontecarlo && !fmcArray){
221 AliError("Array of MC particles not found");
224 Bool_t isEvSel=fCuts->IsEventSelected(aodEvent);
226 ((TH1D*)fOutput->FindObject("NofEvents"))->Fill(1);
228 Bool_t correlatorON = fCorrelator->Initialize(); //define the pool for mixing
230 AliInfo("AliHFCorrelator didn't initialize the pool correctly or processed a bad event");
234 if(fmontecarlo) fCorrelator->SetMCArray(fmcArray);
236 cout << "USER EXEC CHECKPOINT 2" << endl;
237 TClonesArray *arrayDStartoD0pi=0;
240 if(!aodEvent && AODEvent() && IsStandardAOD()) {
241 // In case there is an AOD handler writing a standard AOD, use the AOD
242 // event in memory rather than the input (ESD) event.
243 aodEvent = dynamic_cast<AliAODEvent*> (AODEvent());
244 // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
245 // have to taken from the AOD event hold by the AliAODExtension
246 AliAODHandler* aodHandler = (AliAODHandler*)
247 ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
248 if(aodHandler->GetExtensions()) {
249 AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
250 AliAODEvent *aodFromExt = ext->GetAOD();
251 arrayDStartoD0pi=(TClonesArray*)aodFromExt->GetList()->FindObject("Dstar");
254 arrayDStartoD0pi=(TClonesArray*)aodEvent->GetList()->FindObject("Dstar");
257 if(!aodEvent->GetPrimaryVertex() || TMath::Abs(aodEvent->GetMagneticField())<0.001) return;
259 // initialize variables you will need for the D*
264 Bool_t isInPeak, isInSideBand, isDStarMCtag;
265 Double_t invMassDZero;
266 Double_t deltainvMDStar;
269 Double_t mPDGD0=1.8648;//TDatabasePDG::Instance()->GetParticle(421)->Mass();
270 Double_t mPDGDstar=2.01022;//TDatabasePDG::Instance()->GetParticle(413)->Mass();
272 cout << "USER EXEC CHECKPOINT 3" << endl;
274 //if(fselect ==3){// check the K0 invariant mass
275 //TObjArray * fillkzerospectra = AcceptAndReduceKZero(aodEvent, 0,0);
276 //delete fillkzerospectra;
279 //MC tagging for DStar
280 //D* and D0 prongs needed to MatchToMC method
281 Int_t pdgDgDStartoD0pi[2]={421,211};
282 Int_t pdgDgD0toKpi[2]={321,211};
285 //loop on D* candidates
286 for (Int_t iDStartoD0pi = 0; iDStartoD0pi<arrayDStartoD0pi->GetEntriesFast(); iDStartoD0pi++) {
288 isInSideBand = kFALSE;
289 isDStarMCtag = kFALSE;
293 invMassDZero = - 999;
294 deltainvMDStar = -998;
296 AliAODRecoCascadeHF* dstarD0pi = (AliAODRecoCascadeHF*)arrayDStartoD0pi->At(iDStartoD0pi);
297 if(!dstarD0pi->GetSecondaryVtx()) continue;
298 AliAODRecoDecayHF2Prong* theD0particle = (AliAODRecoDecayHF2Prong*)dstarD0pi->Get2Prong();
299 if (!theD0particle) continue;
302 // track quality cuts
303 Int_t isTkSelected = fCuts->IsSelected(dstarD0pi,AliRDHFCuts::kTracks); // quality cuts on tracks
304 // region of interest + topological cuts + PID
305 Int_t isSelected=fCuts->IsSelected(dstarD0pi,AliRDHFCuts::kCandidate); //selected
307 if(!isTkSelected) continue;
308 if(!isSelected) continue;
309 if(!fCuts->IsInFiducialAcceptance(dstarD0pi->Pt(),dstarD0pi->YDstar())) continue;
310 Int_t mcLabelDStar = -999;
312 // find associated MC particle for D* ->D0toKpi
313 mcLabelDStar = dstarD0pi->MatchToMC(413,421,pdgDgDStartoD0pi,pdgDgD0toKpi,fmcArray,kFALSE);
314 if(mcLabelDStar>=0) isDStarMCtag = kTRUE;
317 ptDStar = dstarD0pi->Pt();
318 phiDStar = dstarD0pi->Phi();
319 etaDStar = dstarD0pi->Eta();
321 phiDStar = fCorrelator->SetCorrectPhiRange(phiDStar); // set the phi of the D meson in the correct range
323 Int_t ptbin=fCuts->PtBin(dstarD0pi->Pt());
325 Double_t dmDStarWindow =0.0019;// 0.0019 = 3 sigma
326 Double_t mD0Window=0.074;
329 if (ptbin==1) mD0Window = 0.026; //0.5-1
330 if (ptbin==2) mD0Window = 0.022; //1-2
331 if (ptbin==3) mD0Window = 0.024; //2-3
332 if (ptbin==4) mD0Window = 0.032;
333 if (ptbin==5) mD0Window = 0.032;
334 if (ptbin==6) mD0Window = 0.036;
335 if (ptbin==7) mD0Window = 0.036;
336 if (ptbin==8) mD0Window = 0.036;
337 if (ptbin==9) mD0Window = 0.058;
338 if (ptbin==10) mD0Window = 0.058;
339 if (ptbin>10) mD0Window = 0.074;
342 if (ptbin==0) mD0Window = 0.032; //1-1
343 if (ptbin==1) mD0Window = 0.032; //2-3
344 if (ptbin==2) mD0Window = 0.032; //3-4
345 if (ptbin==3) mD0Window = 0.032; //4-5
346 if (ptbin==4) mD0Window = 0.036; //5-6
347 if (ptbin==5) mD0Window = 0.036; //6-8
348 if (ptbin==6) mD0Window = 0.055; //8-12
349 if (ptbin==7) mD0Window = 0.074; //12-16
350 if (ptbin==8) mD0Window = 0.074; //16-24
351 if (ptbin==9) mD0Window = 0.074; //24-35
354 invMassDZero = dstarD0pi->InvMassD0();
355 ((TH2F*)fOutput->FindObject("D0InvMass"))->Fill(ptDStar,invMassDZero);
357 deltainvMDStar = dstarD0pi->DeltaInvMass();
361 if (TMath::Abs(invMassDZero-mPDGD0)<mD0Window){
363 ((TH2F*)fOutput->FindObject("DeltaInvMass"))->Fill(ptDStar,deltainvMDStar);
364 if(TMath::Abs(deltainvMDStar-(mPDGDstar-mPDGD0))<dmDStarWindow){ // is in DStar peak region?
366 ((TH1F*)fOutput->FindObject("RecoPtDStar"))->Fill(ptDStar);
368 ((TH2F*)fOutput->FindObject("PhiEtaTrigger"))->Fill(phiDStar,etaDStar);
370 }// end if good candidates
373 if (TMath::Abs(invMassDZero-mPDGD0)>1.3*mD0Window && TMath::Abs(invMassDZero-mPDGD0)<4.*mD0Window ){
374 ((TH2F*)fOutput->FindObject("bkgDeltaInvMass"))->Fill(ptDStar,deltainvMDStar);
375 ((TH2F*)fOutput->FindObject("D0InvMassinSB"))->Fill(ptDStar,invMassDZero);
377 if(TMath::Abs(deltainvMDStar-(mPDGDstar-mPDGD0))<dmDStarWindow){ // is in DStar peak region?
378 ((TH1F*)fOutput->FindObject("RecoPtBkg"))->Fill(ptDStar);
379 isInSideBand = kTRUE;
380 ((TH2F*)fOutput->FindObject("PhiEtaSideBand"))->Fill(phiDStar,etaDStar);
384 // getting the number of triggers in the MCtag D* case
387 if(fmontecarlo && isDStarMCtag) ((TH1F*)fOutput->FindObject("MCtagPtDStar"))->Fill(ptDStar);
390 if(!isInPeak && !isInSideBand) continue; // skip if it is not side band or peak event - SAVE CPU TIME
393 fCorrelator->SetTriggerParticleProperties(ptDStar,phiDStar,etaDStar); // pass to the object the necessary trigger part parameters
397 Int_t trackiddaugh0 = ((AliAODTrack*)theD0particle->GetDaughter(0))->GetID();
398 Int_t trackiddaugh1 = ((AliAODTrack*)theD0particle->GetDaughter(1))->GetID();
399 Int_t trackidsoftPi = ((AliAODTrack*)dstarD0pi->GetBachelor())->GetID();
401 Bool_t execPool = fCorrelator->ProcessEventPool();
402 if(fmixing && !execPool) {
403 AliInfo("Mixed event analysis: pool is not ready");
407 Int_t NofEventsinPool = 1;
408 if(fmixing) NofEventsinPool = fCorrelator->GetNofEventsInPool();
410 for (Int_t jMix =0; jMix < NofEventsinPool; jMix++){// loop on events in the pool; if it is SE analysis, stops at one
412 Bool_t analyzetracks = fCorrelator->ProcessAssociatedTracks(jMix);
415 AliInfo("AliHFCorrelator::Cannot process the track array");
420 Int_t NofTracks = fCorrelator->GetNofTracks();
422 for(Int_t iTrack = 0; iTrack<NofTracks; iTrack++){ // looping on track candidates
424 Bool_t runcorrelation = fCorrelator->Correlate(iTrack);
425 if(!runcorrelation) continue;
427 Double_t DeltaPhi = fCorrelator->GetDeltaPhi();
428 Double_t DeltaEta = fCorrelator->GetDeltaEta();
430 AliReducedParticle * hadron = fCorrelator->GetAssociatedParticle();
432 Double_t ptHad = hadron->Pt();
433 Double_t phiHad = hadron->Phi();
434 Double_t etaHad = hadron->Eta();
435 Double_t label = hadron->GetLabel();
436 Double_t trackid = hadron->GetID();
438 phiHad = fCorrelator->SetCorrectPhiRange(phiHad);
440 if(!fmixing){ // skip D* Daughetrs
441 if(trackid == trackiddaugh0) continue;
442 if(trackid == trackiddaugh1) continue;
443 if(trackid == trackidsoftPi) continue;
446 // from here on it is up to the user to decide what object to fill
448 if(fmontecarlo && isDStarMCtag){ // check correlations of MC tagged DStars in MonteCarlo
450 Int_t PartSource = fCuts2->IsMCpartFromHF(label,fmcArray); // check source of associated particle (hadron/kaon/K0)
452 FillMCTagCorrelations(ptDStar,DeltaPhi,DeltaEta,ptHad,PartSource);
458 if(fselect==1) ((TH3D*)fOutput->FindObject("DPhiDStarHadron"))->Fill(DeltaPhi,ptDStar,DeltaEta);
459 if(fselect==2) ((TH3D*)fOutput->FindObject("DPhiDStarKaon"))->Fill(DeltaPhi,ptDStar,DeltaEta);
460 if(fselect==3) ((TH3D*)fOutput->FindObject("DPhiDStarKZero"))->Fill(DeltaPhi,ptDStar,DeltaEta);
461 ((TH2F*)fOutput->FindObject("PhiEtaPart"))->Fill(phiHad,etaHad);
462 //counterPeak++; // count tracks per peak per event
468 if(fselect==1) ((TH3D*)fOutput->FindObject("bkgDPhiDStarHadron"))->Fill(DeltaPhi,ptDStar,DeltaEta);
469 if(fselect==2) ((TH3D*)fOutput->FindObject("bkgDPhiDStarKaon"))->Fill(DeltaPhi,ptDStar,DeltaEta);
470 if(fselect==3) ((TH3D*)fOutput->FindObject("bkgDPhiDStarKZero"))->Fill(DeltaPhi,ptDStar,DeltaEta);
478 } // end loop on track candidates
479 } // end loop on events in the pool
481 }// end loop on D* candidates
482 cout << "USER EXEC CHECKPOINT 4" << endl;
483 Bool_t updated = fCorrelator->PoolUpdate();
484 if(!updated) AliInfo("Pool was not updated");
486 //cout << ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END OF THE EVENT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<" << endl;
488 PostData(1,fOutput); // set the outputs
489 PostData(3,fCounter); // set the outputs
493 //________________________________________ terminate ___________________________
494 void AliAnalysisTaskDStarCorrelations::Terminate(Option_t*)
496 // The Terminate() function is the last function to be called during
497 // a query. It always runs on the client, it can be used to present
498 // the results graphically or save the results to file.
500 AliAnalysisTaskSE::Terminate();
502 fOutput = dynamic_cast<TList*> (GetOutputData(1));
504 printf("ERROR: fOutput not available\n");
512 //_____________________________________________________
513 void AliAnalysisTaskDStarCorrelations::DefineHistoForAnalysis(){
515 Double_t Pi = TMath::Pi();
516 Int_t nbinscorr = 32;
517 Double_t lowcorrbin = -0.5*Pi - Pi/32; // shift the bin by half the width so that at 0 is it the bin center
518 Double_t upcorrbin = 1.5*Pi - Pi/32;
520 // ========================= histograms for both Data and MonteCarlo
523 TH1D * NofEvents = new TH1D("NofEvents","NofEvents",1,0,1);
524 fOutput->Add(NofEvents);
526 TH2F *D0InvMass = new TH2F("D0InvMass","K#pi invariant mass distribution",300,0,30,1500,0.5,3.5);
527 fOutput->Add(D0InvMass);
529 TH2F *D0InvMassinSB = new TH2F("D0InvMassinSB","K#pi invariant mass distribution in sb",300,0,30,1500,0.5,3.5);
530 fOutput->Add(D0InvMassinSB);
532 TH2F *DeltaInvMass = new TH2F("DeltaInvMass","K#pi#pi - K#pi invariant mass distribution",300,0,30,750,0.1,0.2);
533 fOutput->Add(DeltaInvMass);
535 TH2F *bkgDeltaInvMass = new TH2F("bkgDeltaInvMass","K#pi#pi - K#pi invariant mass distribution",300,0,30,750,0.1,0.2);
536 fOutput->Add(bkgDeltaInvMass);
538 TH1F *RecoPtDStar = new TH1F("RecoPtDStar","RECO DStar pt distribution",30,0,30);
539 fOutput->Add(RecoPtDStar);
541 TH1F *RecoPtBkg = new TH1F("RecoPtBkg","RECO pt distribution side bands",30,0,30);
542 fOutput->Add(RecoPtBkg);
544 TH1F *MCtagPtDStar = new TH1F("MCtagPtDStar","RECO pt of MCtagged DStars side bands",30,0,30);
545 fOutput->Add(MCtagPtDStar);
547 TH2F *KZeroSpectra = new TH2F("KZeroSpectra","Spectra of K0s",500,0.3,0.8,250,0,25);
548 if(fselect==3) fOutput->Add(KZeroSpectra);
550 TH2F *KZeroSpectraifHF = new TH2F("KZeroSpectraifHF","Spectra of K0s in association with a D*",500,0.3,0.8,250,0,25);
551 if(fselect==3) fOutput->Add(KZeroSpectraifHF);
553 TH1D * NofTracksInPeak = new TH1D("NofTracksInPeak","NofTracksInPeak",500,0.5,500.5);
554 fOutput->Add(NofTracksInPeak);
556 TH1D * NofTracksInSB = new TH1D("NofTracksInSB","NofTracksInSB",500,0.5,500.5);
557 fOutput->Add(NofTracksInSB);
559 TH2I * EventMixingCheck = new TH2I("EventMixingCheck","EventMixingCheck",5,-0.5,4.5,7,-0.5,6.5);
560 if(fmixing) fOutput->Add(EventMixingCheck);
564 TH1F * MCSources = new TH1F("MCSources","Origin of associated particles in MC", 10, -0.5, 9.5);
565 MCSources->GetXaxis()->SetBinLabel(1,"All ");
566 MCSources->GetXaxis()->SetBinLabel(2," from Heavy flavour");
567 MCSources->GetXaxis()->SetBinLabel(3," from c->D");
568 MCSources->GetXaxis()->SetBinLabel(4," from b->D");
569 MCSources->GetXaxis()->SetBinLabel(5," from b->B");
570 if(fmontecarlo) fOutput->Add(MCSources);
572 TH2F * PhiEtaTrigger = new TH2F("PhiEtaTrigger","#phi distribution of the trigger particle",36,-0.5*Pi,1.5*Pi,18,-0.9,0.9);
573 fOutput->Add(PhiEtaTrigger);
575 TH2F * PhiEtaSideBand = new TH2F("PhiEtaSideBand","#phi distribution of the sideband particle",36,-0.5*Pi,1.5*Pi,18,-0.9,0.9);
576 fOutput->Add(PhiEtaSideBand);
578 TH2F * PhiEtaPart = new TH2F("PhiEtaPart","#phi distribution of the associated particle",36,-0.5*Pi,1.5*Pi,18,-0.9,0.9);
579 fOutput->Add(PhiEtaPart);
582 //correlations histograms
583 TString histoname1 = "DPhiDStar";
584 if(fselect==1) histoname1 += "Hadron";
585 if(fselect==2) histoname1 += "Kaon";
586 if(fselect==3) histoname1 += "KZero";
589 TH3D * DPhiDStar = new TH3D(histoname1.Data(),histoname1.Data(),nbinscorr,lowcorrbin,upcorrbin,30,0,30,19,-0.95,0.95);
591 TH3D * DPhiDStarKZero1 = new TH3D("DPhiDStarKZero1","DPhiDStarKZero1",nbinscorr,lowcorrbin,upcorrbin,30,0,30,19,-0.95,0.95);
593 //side band background histograms
594 TString histoname2 = "bkg";
595 histoname2 += histoname1;
596 TH3D * bkgDPhiDStar = new TH3D(histoname2.Data(),histoname2.Data(),nbinscorr,lowcorrbin,upcorrbin,30,0,30,19,-0.95,0.95);
597 TH3D * bkgDPhiDStarKZero1 = new TH3D("bkgDPhiDStarKZero1","bkgDPhiDStarKZero1",nbinscorr,lowcorrbin,upcorrbin,30,0,30,19,-0.95,0.95);
600 fOutput->Add(DPhiDStar);
602 if(fselect==3){fOutput->Add(DPhiDStarKZero1);}
604 fOutput->Add(bkgDPhiDStar);
606 if(fselect==3){fOutput->Add(bkgDPhiDStarKZero1);}
609 // ========================= histos for analysis on MC
610 TString histoname3 = "MCTag";
611 histoname3 += histoname1;
612 TH3D * MCTagDPhiDStar = new TH3D(histoname3.Data(),histoname3.Data(),nbinscorr,lowcorrbin,upcorrbin,30,0,30,19,-0.95,0.95);
614 TString histoname44 = "CharmDOrigin";
615 histoname44 += histoname1;
618 TH3D * CharmDOriginDPhiDStar = new TH3D(histoname44.Data(),histoname44.Data(),nbinscorr,lowcorrbin,upcorrbin,30,0,30,19,-0.95,0.95);
621 TString histoname54 = "BeautyDOrigin";
622 histoname54 += histoname1;
624 TH3D * BeautyDOriginDPhiDStar = new TH3D(histoname54.Data(),histoname54.Data(),nbinscorr,lowcorrbin,upcorrbin,30,0,30,19,-0.95,0.95);
626 TString histoname55 = "BeautyBOrigin";
627 histoname55 += histoname1;
629 TH3D * BeautyBOriginDPhiDStar = new TH3D(histoname55.Data(),histoname55.Data(),nbinscorr,lowcorrbin,upcorrbin,30,0,30,19,-0.95,0.95);
633 fOutput->Add(MCTagDPhiDStar);
634 fOutput->Add(CharmDOriginDPhiDStar);
635 fOutput->Add(BeautyDOriginDPhiDStar);
636 fOutput->Add(BeautyBOriginDPhiDStar);
646 //____________________________ Function for MC correlations ___________________________________________________
647 void AliAnalysisTaskDStarCorrelations::FillMCTagCorrelations(Double_t ptTrig, Double_t DelPhi, Double_t DelEta, Double_t ptTrack, Int_t mcSource){
650 if(fselect==1) ((TH3D*)fOutput->FindObject("MCTagDPhiDStarHadron"))->Fill(DelPhi,ptTrig,DelEta);
651 if(fselect==2 && ptTrack <1.5) ((TH3D*)fOutput->FindObject("MCTagDPhiDStarKaon"))->Fill(DelPhi,ptTrig,DelEta);
652 if(fselect==3) ((TH3D*)fOutput->FindObject("MCTagDPhiDStarKZero"))->Fill(DelPhi,ptTrig,DelEta);
656 ((TH1F*)fOutput->FindObject("MCSources"))->Fill(0);
658 if (mcSource==44){ // is from charm ->D
659 if(fselect==1) ((TH3D*)fOutput->FindObject("CharmDOriginDPhiDStarHadronMC"))->Fill(DelPhi,ptTrig,DelEta);
660 if(fselect==2 && ptTrack <1.5) ((TH3D*)fOutput->FindObject("CharmDOriginDPhiDStarKaonMC"))->Fill(DelPhi,ptTrig,DelEta);
661 if(fselect==3) ((TH3D*)fOutput->FindObject("CharmDOriginDPhiDStarKZeroMC"))->Fill(DelPhi,ptTrig,DelEta);
664 ((TH1F*)fOutput->FindObject("MCSources"))->Fill(1);
665 ((TH1F*)fOutput->FindObject("MCSources"))->Fill(2);
668 if (mcSource==54){ // is from beauty -> D
669 if(fselect==1) ((TH3D*)fOutput->FindObject("BeautyDOriginDPhiDStarHadronMC"))->Fill(DelPhi,ptTrig,DelEta);
670 if(fselect==2 && ptTrack <1.5) ((TH3D*)fOutput->FindObject("BeautyDOriginDPhiDStarKaonMC"))->Fill(DelPhi,ptTrig,DelEta);
671 if(fselect==3) ((TH3D*)fOutput->FindObject("BeautyDOriginDPhiDStarKZeroMC"))->Fill(DelPhi,ptTrig,DelEta);
672 if(fselect==3) ((TH1F*)fOutput->FindObject("MCSources"))->Fill(1);
673 if(fselect==3) ((TH1F*)fOutput->FindObject("MCSources"))->Fill(3);
676 if (mcSource==55){ // is from beauty ->B
677 if(fselect==1) ((TH3D*)fOutput->FindObject("BeautyBOriginDPhiDStarHadronMC"))->Fill(DelPhi,ptTrig,DelEta);
678 if(fselect==2 && ptTrack <1.5) ((TH3D*)fOutput->FindObject("BeautyBOriginDPhiDStarKaonMC"))->Fill(DelPhi,ptTrig,DelEta);
679 if(fselect==3) ((TH3D*)fOutput->FindObject("BeautyOriginBDPhiDStarKZeroMC"))->Fill(DelPhi,ptTrig,DelEta);
680 if(fselect==3) ((TH1F*)fOutput->FindObject("MCSources"))->Fill(1);
681 if(fselect==3) ((TH1F*)fOutput->FindObject("MCSources"))->Fill(4);