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 //-----------------------------------------------------------------------
17 // Class for HF corrections as a function of many variables
18 // 6 Steps introduced: MC, MC Acc, Reco, Reco Acc, Reco Acc + ITS Cl,
19 // Reco Acc + ITS Cl + PPR cuts
20 // 12 variables used: pt, y, cosThetaStar, ptPi, ptK, ct,
21 // dca, d0Pi, d0K, d0Pixd0K, cosPointingAngle, phi
23 //-----------------------------------------------------------------------
24 // Author : C. Zampolli, CERN
25 // D. Caffarri, Univ & INFN Padova caffarri@pd.infn.it
26 //-----------------------------------------------------------------------
27 //-----------------------------------------------------------------------
28 // Base class for HF Unfolding (pt and eta)
29 // correlation matrix filled at Acceptance and PPR level
30 // Author: A.Grelli , Utrecht - agrelli@uu.nl
31 //-----------------------------------------------------------------------
33 #include <TParticle.h>
34 #include <TDatabasePDG.h>
39 #include "AliCFTaskVertexingHF.h"
41 #include "AliMCEvent.h"
42 #include "AliCFManager.h"
43 #include "AliCFContainer.h"
45 #include "AliAnalysisManager.h"
46 #include "AliAODHandler.h"
47 #include "AliAODEvent.h"
48 #include "AliAODRecoDecay.h"
49 #include "AliAODRecoDecayHF.h"
50 #include "AliAODRecoDecayHF2Prong.h"
51 #include "AliAODRecoDecayHF3Prong.h"
52 #include "AliAODRecoDecayHF4Prong.h"
53 #include "AliAODRecoCascadeHF.h"
54 #include "AliAODMCParticle.h"
55 #include "AliAODMCHeader.h"
56 #include "AliESDtrack.h"
58 #include "THnSparse.h"
60 #include "AliESDtrackCuts.h"
61 #include "AliRDHFCuts.h"
62 #include "AliRDHFCutsD0toKpi.h"
63 #include "AliRDHFCutsDplustoKpipi.h"
64 #include "AliRDHFCutsDStartoKpipi.h"
65 #include "AliRDHFCutsDstoKKpi.h"
66 #include "AliRDHFCutsLctopKpi.h"
67 #include "AliRDHFCutsD0toKpipipi.h"
68 #include "AliCFVertexingHF2Prong.h"
69 //#include "AliCFVertexingHF3Prong.h"
70 #include "AliCFVertexingHF.h"
71 #include "AliAnalysisDataSlot.h"
72 #include "AliAnalysisDataContainer.h"
74 //__________________________________________________________________________
75 AliCFTaskVertexingHF::AliCFTaskVertexingHF() :
79 fHistEventsProcessed(0x0),
87 fCountRecoITSClusters(0),
92 fFillFromGenerated(kFALSE),
94 fAcceptanceUnf(kTRUE),
104 //___________________________________________________________________________
105 AliCFTaskVertexingHF::AliCFTaskVertexingHF(const Char_t* name, AliRDHFCuts* cuts) :
106 AliAnalysisTaskSE(name),
109 fHistEventsProcessed(0x0),
117 fCountRecoITSClusters(0),
122 fFillFromGenerated(kFALSE),
123 fOriginDselection(0),
124 fAcceptanceUnf(kTRUE),
131 // Constructor. Initialization of Inputs and Outputs
134 DefineInput(0) and DefineOutput(0)
135 are taken care of by AliAnalysisTaskSE constructor
137 DefineOutput(1,TH1I::Class());
138 DefineOutput(2,AliCFContainer::Class());
139 DefineOutput(3,THnSparseD::Class());
140 DefineOutput(4,AliRDHFCuts::Class());
145 //___________________________________________________________________________
146 AliCFTaskVertexingHF& AliCFTaskVertexingHF::operator=(const AliCFTaskVertexingHF& c)
149 // Assignment operator
152 AliAnalysisTaskSE::operator=(c) ;
153 fCFManager = c.fCFManager;
154 fHistEventsProcessed = c.fHistEventsProcessed;
160 //___________________________________________________________________________
161 AliCFTaskVertexingHF::AliCFTaskVertexingHF(const AliCFTaskVertexingHF& c) :
162 AliAnalysisTaskSE(c),
164 fCFManager(c.fCFManager),
165 fHistEventsProcessed(c.fHistEventsProcessed),
166 fCorrelation(c.fCorrelation),
167 fCountMC(c.fCountMC),
168 fCountAcc(c.fCountAcc),
169 fCountVertex(c.fCountVertex),
170 fCountRefit(c.fCountRefit),
171 fCountReco(c.fCountReco),
172 fCountRecoAcc(c.fCountRecoAcc),
173 fCountRecoITSClusters(c.fCountRecoITSClusters),
174 fCountRecoPPR(c.fCountRecoPPR),
175 fCountRecoPID(c.fCountRecoPID),
177 fDecayChannel(c.fDecayChannel),
178 fFillFromGenerated(c.fFillFromGenerated),
179 fOriginDselection(c.fOriginDselection),
180 fAcceptanceUnf(c.fAcceptanceUnf),
182 fUseWeight(c.fUseWeight),
191 //___________________________________________________________________________
192 AliCFTaskVertexingHF::~AliCFTaskVertexingHF()
197 if (fCFManager) delete fCFManager ;
198 if (fHistEventsProcessed) delete fHistEventsProcessed ;
199 if (fCorrelation) delete fCorrelation ;
200 if (fCuts) delete fCuts;
203 //_________________________________________________________________________-
204 void AliCFTaskVertexingHF::Init()
210 if (fDebug>1) printf("AliCFTaskVertexingHF::Init()");
211 AliRDHFCuts *copyfCuts = 0x0;
214 switch (fDecayChannel){
216 copyfCuts = new AliRDHFCutsD0toKpi(*(dynamic_cast<AliRDHFCutsD0toKpi*>(fCuts)));
221 copyfCuts = new AliRDHFCutsDStartoKpipi(*(dynamic_cast<AliRDHFCutsDStartoKpipi*>(fCuts)));
226 copyfCuts = new AliRDHFCutsDplustoKpipi(*(dynamic_cast<AliRDHFCutsDplustoKpipi*>(fCuts)));
231 copyfCuts = new AliRDHFCutsLctopKpi(*(dynamic_cast<AliRDHFCutsLctopKpi*>(fCuts)));
236 copyfCuts = new AliRDHFCutsDstoKKpi(*(dynamic_cast<AliRDHFCutsDstoKKpi*>(fCuts)));
241 copyfCuts = new AliRDHFCutsD0toKpipipi(*(dynamic_cast<AliRDHFCutsD0toKpipipi*>(fCuts)));
246 AliFatal("The decay channel MUST be defined according to AliCFVertexing::DecayChannel - Exiting...");
250 const char* nameoutput=GetOutputSlot(4)->GetContainer()->GetName();
251 copyfCuts->SetName(nameoutput);
254 PostData(4, copyfCuts);
259 //_________________________________________________
260 void AliCFTaskVertexingHF::UserExec(Option_t *)
263 // Main loop function
266 PostData(1,fHistEventsProcessed) ;
267 PostData(2,fCFManager->GetParticleContainer()) ;
268 PostData(3,fCorrelation) ;
270 AliESDtrackCuts* trackCuts = fCuts->GetTrackCuts();
272 if (fFillFromGenerated){
273 AliWarning("Flag to fill container with generated value ON ---> dca, d0pi, d0K, d0xd0, cosPointingAngle will be set as dummy!");
277 Error("UserExec","NO EVENT FOUND!");
281 AliAODEvent* aodEvent = dynamic_cast<AliAODEvent*>(fInputEvent);
283 TClonesArray *arrayBranch=0;
285 if(!aodEvent && AODEvent() && IsStandardAOD()) {
286 // In case there is an AOD handler writing a standard AOD, use the AOD
287 // event in memory rather than the input (ESD) event.
288 aodEvent = dynamic_cast<AliAODEvent*> (AODEvent());
289 // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
290 // have to taken from the AOD event hold by the AliAODExtension
291 AliAODHandler* aodHandler = (AliAODHandler*)
292 ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
293 if(aodHandler->GetExtensions()) {
294 AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
295 AliAODEvent *aodFromExt = ext->GetAOD();
297 switch (fDecayChannel){
299 arrayBranch=(TClonesArray*)aodFromExt->GetList()->FindObject("D0toKpi");
303 arrayBranch=(TClonesArray*)aodFromExt->GetList()->FindObject("Dstar");
309 arrayBranch=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
313 arrayBranch=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm4Prong");
322 switch (fDecayChannel){
324 arrayBranch=(TClonesArray*)aodEvent->GetList()->FindObject("D0toKpi");
328 arrayBranch=(TClonesArray*)aodEvent->GetList()->FindObject("Dstar");
334 arrayBranch=(TClonesArray*)aodEvent->GetList()->FindObject("Charm3Prong");
338 arrayBranch=(TClonesArray*)aodEvent->GetList()->FindObject("Charm4Prong");
346 AliAODVertex *aodVtx = (AliAODVertex*)aodEvent->GetPrimaryVertex();
350 AliError("Could not find array of HF vertices");
355 if (fEvents%10000 == 0) AliDebug(2,Form("Event %d",fEvents));
357 fCFManager->SetRecEventInfo(aodEvent);
358 fCFManager->SetMCEventInfo(aodEvent);
360 //******** DEFINE number of variables of the container***** for now set at 13, in the future in the config macro.
363 Double_t* containerInput = new Double_t[fNvar];
364 Double_t* containerInputMC = new Double_t[fNvar];
366 //loop on the MC event
368 TClonesArray* mcArray = dynamic_cast<TClonesArray*>(aodEvent->FindListObject(AliAODMCParticle::StdBranchName()));
370 AliError("Could not find Monte-Carlo in AOD");
375 Int_t icountReco = 0;
376 Int_t icountVertex = 0;
377 Int_t icountRefit = 0;
378 Int_t icountRecoAcc = 0;
379 Int_t icountRecoITSClusters = 0;
380 Int_t icountRecoPPR = 0;
381 Int_t icountRecoPID = 0;
383 UShort_t originDselection = 0;
385 AliAODMCHeader *mcHeader = dynamic_cast<AliAODMCHeader*>(aodEvent->GetList()->FindObject(AliAODMCHeader::StdBranchName()));
387 AliError("Could not find MC Header in AOD");
391 AliCFVertexingHF* cfVtxHF=0x0;
392 switch (fDecayChannel){
394 cfVtxHF = new AliCFVertexingHF2Prong(mcArray, originDselection);
398 // cfVtxHF = new AliCFVertexingHFCascade(mcArray, originDselection); // not there yet
404 //cfVtxHF = new AliCFVertexingHF3Prong(mcArray, originDselection, fDecayChannel);
408 //cfVtxHF = new AliCFVertexingHF4Prong(mcArray, originDselection); // not there yet
415 Double_t zPrimVertex = aodVtx ->GetZ();
416 Double_t zMCVertex = mcHeader->GetVtxZ();
418 //General settings: vertex, feed down and fill reco container with generated values.
419 cfVtxHF->SetRecoPrimVertex(zPrimVertex);
420 cfVtxHF->SetMCPrimaryVertex(zMCVertex);
421 cfVtxHF->SetFillFromGenerated(fFillFromGenerated);
423 for (Int_t iPart=0; iPart<mcArray->GetEntriesFast(); iPart++) {
425 AliAODMCParticle* mcPart = dynamic_cast<AliAODMCParticle*>(mcArray->At(iPart));
427 // check the MC-level cuts, must be the desidered particle
428 if (!fCFManager->CheckParticleCuts(0, mcPart)) continue; // 0 stands for MC level
430 cfVtxHF->SetMCCandidateParam(iPart);
431 cfVtxHF->SetNVar(fNvar);
433 cquarks += cfVtxHF->MCcquarkCounting(mcPart);
435 //check the candiate family at MC level
436 if (!(cfVtxHF->CheckMCPartFamily(mcPart, mcArray))) {
437 Printf("Check on the family wrong!!! (decaychannel = %d)",fDecayChannel);
441 Printf("Check on the family OK!!! (decaychannel = %d)",fDecayChannel);
444 //Fill the MC container
445 Bool_t mcContainerFilled = cfVtxHF -> FillMCContainer(containerInputMC);
447 if (mcContainerFilled) {
448 if (fUseWeight)fWeight = GetWeight(containerInputMC[0]);
449 if (!fCuts->IsInFiducialAcceptance(containerInputMC[0],containerInputMC[1])) continue;
450 //MC Limited Acceptance
451 if (TMath::Abs(containerInputMC[1]) < 0.5) {
452 fCFManager->GetParticleContainer()->Fill(containerInputMC,kStepGeneratedLimAcc, fWeight);
453 AliDebug(3,"MC Lim Acc container filled\n");
457 fCFManager->GetParticleContainer()->Fill(containerInputMC, kStepGenerated, fWeight);
459 AliDebug(3,"MC cointainer filled \n");
462 // check the MC-Acceptance level cuts
463 // since standard CF functions are not applicable, using Kine Cuts on daughters
464 Bool_t mcAccepStep = cfVtxHF-> MCAcceptanceStep();
466 fCFManager->GetParticleContainer()->Fill(containerInputMC,kStepAcceptance, fWeight);
467 AliDebug(3,"MC acceptance cut passed\n");
471 if (fCuts->IsEventSelected(aodEvent)){
472 // filling the container if the vertex is ok
473 fCFManager->GetParticleContainer()->Fill(containerInputMC,kStepVertex, fWeight) ;
474 AliDebug(3,"Vertex cut passed and container filled\n");
477 //mc Refit requirement
478 Bool_t mcRefitStep = cfVtxHF->MCRefitStep(aodEvent, trackCuts);
480 fCFManager->GetParticleContainer()->Fill(containerInputMC,kStepRefit, fWeight);
481 AliDebug(3,"MC Refit cut passed and container filled\n");
485 AliDebug(3,"MC Refit cut not passed\n");
490 AliDebug (3, "MC vertex step not passed\n");
495 AliDebug (3, "MC in acceptance step not passed\n");
500 AliDebug (3, "MC container not filled\n");
504 if (cquarks<2) AliDebug(2,Form("Event with %d c-quarks", cquarks));
505 AliDebug(2,Form("Found %i MC particles that are D0!!",icountMC));
506 AliDebug(2,Form("Found %i MC particles that are D0 and satisfy Acc cuts!!",icountAcc));
507 AliDebug(2,Form("Found %i MC particles that are D0 and satisfy Vertex cuts!!",icountVertex));
508 AliDebug(2,Form("Found %i MC particles that are D0 and satisfy Refit cuts!!",icountRefit));
510 // Now go to rec level
511 fCountMC += icountMC;
512 fCountAcc += icountAcc;
513 fCountVertex+= icountVertex;
514 fCountRefit+= icountRefit;
516 AliDebug(2,Form("Found %d vertices",arrayBranch->GetEntriesFast()));
517 AliInfo(Form("Found %d vertices for decay channel %d",arrayBranch->GetEntriesFast(),fDecayChannel));
519 for(Int_t iCandid = 0; iCandid<arrayBranch->GetEntriesFast();iCandid++){
520 Printf("iCandid = %d", iCandid);
522 AliAODRecoDecayHF* charmCandidate=0x0;
523 switch (fDecayChannel){
525 charmCandidate = (AliAODRecoDecayHF2Prong*)arrayBranch->At(iCandid);
529 charmCandidate = (AliAODRecoCascadeHF*)arrayBranch->At(iCandid);
535 charmCandidate = (AliAODRecoDecayHF3Prong*)arrayBranch->At(iCandid);
539 charmCandidate = (AliAODRecoDecayHF4Prong*)arrayBranch->At(iCandid);
546 Bool_t unsetvtx=kFALSE;
547 if(!charmCandidate->GetOwnPrimaryVtx()) {
548 charmCandidate->SetOwnPrimaryVtx(aodVtx); // needed to compute all variables
552 Bool_t signAssociation = cfVtxHF->SetRecoCandidateParam((AliAODRecoDecayHF*)charmCandidate);
553 if (!signAssociation){
554 charmCandidate = 0x0;
558 Int_t isPartOrAntipart = cfVtxHF->CheckReflexion();
560 Bool_t recoContFilled = cfVtxHF->FillRecoContainer(containerInput);
563 if (!fCuts->IsInFiducialAcceptance(containerInput[0],containerInput[1])) continue;
566 Bool_t recoStep = cfVtxHF->RecoStep();
567 Bool_t vtxCheck = fCuts->IsEventSelected(aodEvent);
569 if (recoStep && recoContFilled && vtxCheck){
570 fCFManager->GetParticleContainer()->Fill(containerInput,kStepReconstructed, fWeight) ;
572 AliDebug(3,"Reco step passed and container filled\n");
574 //Reco in the acceptance -- take care of UNFOLDING!!!!
575 Bool_t recoAcceptanceStep = cfVtxHF->RecoAcceptStep(trackCuts);
576 if (recoAcceptanceStep) {
577 fCFManager->GetParticleContainer()->Fill(containerInput,kStepRecoAcceptance, fWeight) ;
579 AliDebug(3,"Reco acceptance cut passed and container filled\n");
582 Double_t fill[4]; //fill response matrix
583 Bool_t bUnfolding = cfVtxHF -> FillUnfoldingMatrix(fill);
584 if (bUnfolding) fCorrelation->Fill(fill);
587 //Number of ITS cluster requirements
588 Int_t recoITSnCluster = fCuts->IsSelected(charmCandidate, AliRDHFCuts::kTracks);
589 if (recoITSnCluster){
590 fCFManager->GetParticleContainer()->Fill(containerInput,kStepRecoITSClusters, fWeight) ;
591 icountRecoITSClusters++;
592 AliDebug(3,"Reco n ITS cluster cut passed and container filled\n");
594 Bool_t iscutsusingpid = fCuts->GetIsUsePID();
595 Int_t recoAnalysisCuts = -1, recoPidSelection = -1;
596 fCuts->SetUsePID(kFALSE);
597 recoAnalysisCuts = fCuts->IsSelected(charmCandidate, AliRDHFCuts::kCandidate, aodEvent);
599 if (recoAnalysisCuts > 3){ // Ds case, where more possibilities are considered
600 if (recoAnalysisCuts >= 8){
601 recoAnalysisCuts -= 8; // removing K0star mass
603 if (recoAnalysisCuts >= 4){
604 recoAnalysisCuts -= 4; // removing Phi mass
608 fCuts->SetUsePID(iscutsusingpid); //restoring usage of the PID from the cuts object
609 if (recoAnalysisCuts == 3 || recoAnalysisCuts == isPartOrAntipart){
610 fCFManager->GetParticleContainer()->Fill(containerInput, kStepRecoPPR, fWeight);
612 AliDebug(3,"Reco Analysis cuts passed and container filled \n");
614 //recoPidSelection = fCuts->IsSelected(charmCandidate, AliRDHFCuts::kPID);
615 //if((fCuts->CombineSelectionLevels(3,recoAnalysisCuts,recoPidSelection)==isPartOrAntipart)||(fCuts->CombineSelectionLevels(3,recoAnalysisCuts,recoPidSelection)==3)){
616 recoPidSelection = fCuts->IsSelected(charmCandidate, AliRDHFCuts::kCandidate, aodEvent);
617 if (recoPidSelection == 3 || recoPidSelection == isPartOrAntipart){
618 fCFManager->GetParticleContainer()->Fill(containerInput, kStepRecoPID, fWeight);
620 AliDebug(3,"Reco PID cuts passed and container filled \n");
622 Double_t fill[4]; //fill response matrix
623 Bool_t bUnfolding = cfVtxHF -> FillUnfoldingMatrix(fill);
624 if (bUnfolding) fCorrelation->Fill(fill);
628 AliDebug(3, "Analysis Cuts step not passed \n");
633 AliDebug(3, "PID selection not passed \n");
638 AliDebug(3, "Number of ITS cluster step not passed\n");
643 AliDebug(3, "Reco acceptance step not passed\n");
648 AliDebug(3, "Reco step not passed\n");
653 if(unsetvtx) charmCandidate->UnsetOwnPrimaryVtx();
654 } // end loop on candidate
656 fCountReco+= icountReco;
657 fCountRecoAcc+= icountRecoAcc;
658 fCountRecoITSClusters+= icountRecoITSClusters;
659 fCountRecoPPR+= icountRecoPPR;
660 fCountRecoPID+= icountRecoPID;
662 fHistEventsProcessed->Fill(0);
664 delete[] containerInput;
665 containerInput = 0x0;
666 delete[] containerInputMC;
667 containerInputMC = 0x0;
672 //___________________________________________________________________________
673 void AliCFTaskVertexingHF::Terminate(Option_t*)
675 // The Terminate() function is the last function to be called during
676 // a query. It always runs on the client, it can be used to present
677 // the results graphically or save the results to file.
679 AliAnalysisTaskSE::Terminate();
681 AliInfo(Form("Found %i MC particles that are D0 in MC, in %d events",fCountMC,fEvents));
682 AliInfo(Form("Found %i MC particles that are D0 in MC and satisfy Acc cuts, in %d events",fCountAcc,fEvents));
683 AliInfo(Form("Found %i MC particles that are D0 in MC and satisfy Acc cuts, and satisfy Vertex requirement in %d events",fCountVertex,fEvents));
684 AliInfo(Form("Found %i MC particles that are D0 in MC and satisfy Acc cuts, and satisfy ITS+TPC refit requirementin %d events",fCountRefit,fEvents));
685 AliInfo(Form("Found %i reco D0 that are decaying in K+pi, in %d events",fCountReco,fEvents));
686 AliInfo(Form("Among the above, found %i reco D0 that are decaying in K+pi and are in the requested acceptance, in %d events",fCountRecoAcc,fEvents));
687 AliInfo(Form("Among the above, found %i reco D0 that are decaying in K+pi and have at least 5 clusters in ITS, in %d events",fCountRecoITSClusters,fEvents));
688 AliInfo(Form("Among the above, found %i reco D0 that are decaying in K+pi and satisfy PPR cuts, in %d events",fCountRecoPPR,fEvents));
690 // draw some example plots....
692 AliCFContainer *cont= dynamic_cast<AliCFContainer*> (GetOutputData(2));
694 printf("CONTAINER NOT FOUND\n");
697 // projecting the containers to obtain histograms
698 // first argument = variable, second argument = step
701 TH1D* h00 = cont->ShowProjection(0,0) ; // pt
702 TH1D* h10 = cont->ShowProjection(1,0) ; // rapidity
703 TH1D* h20 = cont->ShowProjection(2,0) ; // cosThetaStar
704 TH1D* h30 = cont->ShowProjection(3,0) ; // pTpi
705 TH1D* h40 = cont->ShowProjection(4,0) ; // pTK
706 TH1D* h50 = cont->ShowProjection(5,0) ; // cT
707 TH1D* h60 = cont->ShowProjection(6,0) ; // dca
708 TH1D* h70 = cont->ShowProjection(7,0) ; // d0pi
709 TH1D* h80 = cont->ShowProjection(8,0) ; // d0K
710 TH1D* h90 = cont->ShowProjection(9,0) ; // d0xd0
711 TH1D* h100 = cont->ShowProjection(10,0) ; // cosPointingAngle
712 TH1D* h110 = cont->ShowProjection(11,0) ; // phi
714 // MC-Acceptance level
715 TH1D* h01 = cont->ShowProjection(0,1) ; // pt
716 TH1D* h11 = cont->ShowProjection(1,1) ; // rapidity
717 TH1D* h21 = cont->ShowProjection(2,1) ; // cosThetaStar
718 TH1D* h31 = cont->ShowProjection(3,1) ; // pTpi
719 TH1D* h41 = cont->ShowProjection(4,1) ; // pTK
720 TH1D* h51 = cont->ShowProjection(5,1) ; // cT
721 TH1D* h61 = cont->ShowProjection(6,1) ; // dca
722 TH1D* h71 = cont->ShowProjection(7,1) ; // d0pi
723 TH1D* h81 = cont->ShowProjection(8,1) ; // d0K
724 TH1D* h91 = cont->ShowProjection(9,1) ; // d0xd0
725 TH1D* h101 = cont->ShowProjection(10,1) ; // cosPointingAngle
726 TH1D* h111 = cont->ShowProjection(11,1) ; // phi
729 TH1D* h04 = cont->ShowProjection(0,4) ; // pt
730 TH1D* h14 = cont->ShowProjection(1,4) ; // rapidity
731 TH1D* h24 = cont->ShowProjection(2,4) ; // cosThetaStar
732 TH1D* h34 = cont->ShowProjection(3,4) ; // pTpi
733 TH1D* h44 = cont->ShowProjection(4,4) ; // pTK
734 TH1D* h54 = cont->ShowProjection(5,4) ; // cT
735 TH1D* h64 = cont->ShowProjection(6,4) ; // dca
736 TH1D* h74 = cont->ShowProjection(7,4) ; // d0pi
737 TH1D* h84 = cont->ShowProjection(8,4) ; // d0K
738 TH1D* h94 = cont->ShowProjection(9,4) ; // d0xd0
739 TH1D* h104 = cont->ShowProjection(10,4) ; // cosPointingAngle
740 TH1D* h114 = cont->ShowProjection(11,4) ; // phi
742 h00->SetTitle("pT_D0 (GeV/c)");
743 h10->SetTitle("rapidity");
744 h20->SetTitle("cosThetaStar");
745 h30->SetTitle("pT_pi (GeV/c)");
746 h40->SetTitle("pT_K (Gev/c)");
747 h50->SetTitle("cT (#mum)");
748 h60->SetTitle("dca (#mum)");
749 h70->SetTitle("d0_pi (#mum)");
750 h80->SetTitle("d0_K (#mum)");
751 h90->SetTitle("d0xd0 (#mum^2)");
752 h100->SetTitle("cosPointingAngle");
753 h100->SetTitle("phi (rad)");
755 h00->GetXaxis()->SetTitle("pT_D0 (GeV/c)");
756 h10->GetXaxis()->SetTitle("rapidity");
757 h20->GetXaxis()->SetTitle("cosThetaStar");
758 h30->GetXaxis()->SetTitle("pT_pi (GeV/c)");
759 h40->GetXaxis()->SetTitle("pT_K (Gev/c)");
760 h50->GetXaxis()->SetTitle("cT (#mum)");
761 h60->GetXaxis()->SetTitle("dca (#mum)");
762 h70->GetXaxis()->SetTitle("d0_pi (#mum)");
763 h80->GetXaxis()->SetTitle("d0_K (#mum)");
764 h90->GetXaxis()->SetTitle("d0xd0 (#mum^2)");
765 h100->GetXaxis()->SetTitle("cosPointingAngle");
766 h110->GetXaxis()->SetTitle("phi (rad)");
768 h01->SetTitle("pT_D0 (GeV/c)");
769 h11->SetTitle("rapidity");
770 h21->SetTitle("cosThetaStar");
771 h31->SetTitle("pT_pi (GeV/c)");
772 h41->SetTitle("pT_K (Gev/c)");
773 h51->SetTitle("cT (#mum)");
774 h61->SetTitle("dca (#mum)");
775 h71->SetTitle("d0_pi (#mum)");
776 h81->SetTitle("d0_K (#mum)");
777 h91->SetTitle("d0xd0 (#mum^2)");
778 h101->SetTitle("cosPointingAngle");
779 h111->GetXaxis()->SetTitle("phi (rad)");
781 h01->GetXaxis()->SetTitle("pT_D0 (GeV/c)");
782 h11->GetXaxis()->SetTitle("rapidity");
783 h21->GetXaxis()->SetTitle("cosThetaStar");
784 h31->GetXaxis()->SetTitle("pT_pi (GeV/c)");
785 h41->GetXaxis()->SetTitle("pT_K (Gev/c)");
786 h51->GetXaxis()->SetTitle("cT (#mum)");
787 h61->GetXaxis()->SetTitle("dca (#mum)");
788 h71->GetXaxis()->SetTitle("d0_pi (#mum)");
789 h81->GetXaxis()->SetTitle("d0_K (#mum)");
790 h91->GetXaxis()->SetTitle("d0xd0 (#mum^2)");
791 h101->GetXaxis()->SetTitle("cosPointingAngle");
792 h111->GetXaxis()->SetTitle("phi (rad)");
794 h04->SetTitle("pT_D0 (GeV/c)");
795 h14->SetTitle("rapidity");
796 h24->SetTitle("cosThetaStar");
797 h34->SetTitle("pT_pi (GeV/c)");
798 h44->SetTitle("pT_K (Gev/c)");
799 h54->SetTitle("cT (#mum)");
800 h64->SetTitle("dca (#mum)");
801 h74->SetTitle("d0_pi (#mum)");
802 h84->SetTitle("d0_K (#mum)");
803 h94->SetTitle("d0xd0 (#mum^2)");
804 h104->SetTitle("cosPointingAngle");
805 h114->GetXaxis()->SetTitle("phi (rad)");
807 h04->GetXaxis()->SetTitle("pT_D0 (GeV/c)");
808 h14->GetXaxis()->SetTitle("rapidity");
809 h24->GetXaxis()->SetTitle("cosThetaStar");
810 h34->GetXaxis()->SetTitle("pT_pi (GeV/c)");
811 h44->GetXaxis()->SetTitle("pT_K (Gev/c)");
812 h54->GetXaxis()->SetTitle("cT (#mum)");
813 h64->GetXaxis()->SetTitle("dca (#mum)");
814 h74->GetXaxis()->SetTitle("d0_pi (#mum)");
815 h84->GetXaxis()->SetTitle("d0_K (#mum)");
816 h94->GetXaxis()->SetTitle("d0xd0 (#mum^2)");
817 h104->GetXaxis()->SetTitle("cosPointingAngle");
818 h114->GetXaxis()->SetTitle("phi (rad)");
820 Double_t max0 = h00->GetMaximum();
821 Double_t max1 = h10->GetMaximum();
822 Double_t max2 = h20->GetMaximum();
823 Double_t max3 = h30->GetMaximum();
824 Double_t max4 = h40->GetMaximum();
825 Double_t max5 = h50->GetMaximum();
826 Double_t max6 = h60->GetMaximum();
827 Double_t max7 = h70->GetMaximum();
828 Double_t max8 = h80->GetMaximum();
829 Double_t max9 = h90->GetMaximum();
830 Double_t max10 = h100->GetMaximum();
831 Double_t max11 = h110->GetMaximum();
833 h00->GetYaxis()->SetRangeUser(0,max0*1.2);
834 h10->GetYaxis()->SetRangeUser(0,max1*1.2);
835 h20->GetYaxis()->SetRangeUser(0,max2*1.2);
836 h30->GetYaxis()->SetRangeUser(0,max3*1.2);
837 h40->GetYaxis()->SetRangeUser(0,max4*1.2);
838 h50->GetYaxis()->SetRangeUser(0,max5*1.2);
839 h60->GetYaxis()->SetRangeUser(0,max6*1.2);
840 h70->GetYaxis()->SetRangeUser(0,max7*1.2);
841 h80->GetYaxis()->SetRangeUser(0,max8*1.2);
842 h90->GetYaxis()->SetRangeUser(0,max9*1.2);
843 h100->GetYaxis()->SetRangeUser(0,max10*1.2);
844 h110->GetYaxis()->SetRangeUser(0,max11*1.2);
846 h01->GetYaxis()->SetRangeUser(0,max0*1.2);
847 h11->GetYaxis()->SetRangeUser(0,max1*1.2);
848 h21->GetYaxis()->SetRangeUser(0,max2*1.2);
849 h31->GetYaxis()->SetRangeUser(0,max3*1.2);
850 h41->GetYaxis()->SetRangeUser(0,max4*1.2);
851 h51->GetYaxis()->SetRangeUser(0,max5*1.2);
852 h61->GetYaxis()->SetRangeUser(0,max6*1.2);
853 h71->GetYaxis()->SetRangeUser(0,max7*1.2);
854 h81->GetYaxis()->SetRangeUser(0,max8*1.2);
855 h91->GetYaxis()->SetRangeUser(0,max9*1.2);
856 h101->GetYaxis()->SetRangeUser(0,max10*1.2);
857 h111->GetYaxis()->SetRangeUser(0,max11*1.2);
859 h00->SetMarkerStyle(20);
860 h10->SetMarkerStyle(24);
861 h20->SetMarkerStyle(21);
862 h30->SetMarkerStyle(25);
863 h40->SetMarkerStyle(27);
864 h50->SetMarkerStyle(28);
865 h60->SetMarkerStyle(20);
866 h70->SetMarkerStyle(24);
867 h80->SetMarkerStyle(21);
868 h90->SetMarkerStyle(25);
869 h100->SetMarkerStyle(27);
870 h110->SetMarkerStyle(28);
872 h00->SetMarkerColor(2);
873 h10->SetMarkerColor(2);
874 h20->SetMarkerColor(2);
875 h30->SetMarkerColor(2);
876 h40->SetMarkerColor(2);
877 h50->SetMarkerColor(2);
878 h60->SetMarkerColor(2);
879 h70->SetMarkerColor(2);
880 h80->SetMarkerColor(2);
881 h90->SetMarkerColor(2);
882 h100->SetMarkerColor(2);
883 h110->SetMarkerColor(2);
885 h01->SetMarkerStyle(20) ;
886 h11->SetMarkerStyle(24) ;
887 h21->SetMarkerStyle(21) ;
888 h31->SetMarkerStyle(25) ;
889 h41->SetMarkerStyle(27) ;
890 h51->SetMarkerStyle(28) ;
891 h61->SetMarkerStyle(20);
892 h71->SetMarkerStyle(24);
893 h81->SetMarkerStyle(21);
894 h91->SetMarkerStyle(25);
895 h101->SetMarkerStyle(27);
896 h111->SetMarkerStyle(28);
898 h01->SetMarkerColor(8);
899 h11->SetMarkerColor(8);
900 h21->SetMarkerColor(8);
901 h31->SetMarkerColor(8);
902 h41->SetMarkerColor(8);
903 h51->SetMarkerColor(8);
904 h61->SetMarkerColor(8);
905 h71->SetMarkerColor(8);
906 h81->SetMarkerColor(8);
907 h91->SetMarkerColor(8);
908 h101->SetMarkerColor(8);
909 h111->SetMarkerColor(8);
911 h04->SetMarkerStyle(20) ;
912 h14->SetMarkerStyle(24) ;
913 h24->SetMarkerStyle(21) ;
914 h34->SetMarkerStyle(25) ;
915 h44->SetMarkerStyle(27) ;
916 h54->SetMarkerStyle(28) ;
917 h64->SetMarkerStyle(20);
918 h74->SetMarkerStyle(24);
919 h84->SetMarkerStyle(21);
920 h94->SetMarkerStyle(25);
921 h104->SetMarkerStyle(27);
922 h114->SetMarkerStyle(28);
924 h04->SetMarkerColor(4);
925 h14->SetMarkerColor(4);
926 h24->SetMarkerColor(4);
927 h34->SetMarkerColor(4);
928 h44->SetMarkerColor(4);
929 h54->SetMarkerColor(4);
930 h64->SetMarkerColor(4);
931 h74->SetMarkerColor(4);
932 h84->SetMarkerColor(4);
933 h94->SetMarkerColor(4);
934 h104->SetMarkerColor(4);
935 h114->SetMarkerColor(4);
937 gStyle->SetCanvasColor(0);
938 gStyle->SetFrameFillColor(0);
939 gStyle->SetTitleFillColor(0);
940 gStyle->SetStatColor(0);
942 // drawing in 2 separate canvas for a matter of clearity
943 TCanvas * c1 =new TCanvas("c1New","pT, rapidiy, cosThetaStar",1100,1600);
975 TCanvas * c2 =new TCanvas("c2New","pTpi, pTK, cT",1100,1600);
1006 TCanvas * c3 =new TCanvas("c3New","dca, d0pi, d0K",1100,1600);
1037 TCanvas * c4 =new TCanvas("c4New","d0xd0, cosPointingAngle, phi",1100,1600);
1068 THnSparseD* hcorr = dynamic_cast<THnSparseD*> (GetOutputData(3));
1070 TH2D* corr1 =hcorr->Projection(0,2);
1071 TH2D* corr2 = hcorr->Projection(1,3);
1073 TCanvas * c7 =new TCanvas("c7New","",800,400);
1076 corr1->Draw("text");
1078 corr2->Draw("text");
1081 TFile* file_projection = new TFile("CFtaskHFprojectionNew.root","RECREATE");
1085 h00->Write("pT_D0_step0");
1086 h10->Write("rapidity_step0");
1087 h20->Write("cosThetaStar_step0");
1088 h30->Write("pT_pi_step0");
1089 h40->Write("pT_K_step0");
1090 h50->Write("cT_step0");
1091 h60->Write("dca_step0");
1092 h70->Write("d0_pi_step0");
1093 h80->Write("d0_K_step0");
1094 h90->Write("d0xd0_step0");
1095 h100->Write("cosPointingAngle_step0");
1096 h110->Write("phi_step0");
1098 h01->Write("pT_D0_step1");
1099 h11->Write("rapidity_step1");
1100 h21->Write("cosThetaStar_step1");
1101 h31->Write("pT_pi_step1");
1102 h41->Write("pT_K_step1");
1103 h51->Write("cT_step1");
1104 h61->Write("dca_step1");
1105 h71->Write("d0_pi_step1");
1106 h81->Write("d0_K_step1");
1107 h91->Write("d0xd0_step1");
1108 h101->Write("cosPointingAngle_step1");
1109 h111->Write("phi_step1");
1111 h04->Write("pT_D0_step2");
1112 h14->Write("rapidity_step2");
1113 h24->Write("cosThetaStar_step2");
1114 h34->Write("pT_pi_step2");
1115 h44->Write("pT_K_step2");
1116 h54->Write("cT_step2");
1117 h64->Write("dca_step2");
1118 h74->Write("d0_pi_step2");
1119 h80->Write("d0_K_step2");
1120 h94->Write("d0xd0_step2");
1121 h104->Write("cosPointingAngle_step2");
1122 h114->Write("phi_step2");
1124 file_projection->Close();
1129 c1->SaveAs("Plots/pT_rapidity_cosThetaStar.eps");
1130 c2->SaveAs("Plots/pTpi_pTK_cT.eps");
1131 c3->SaveAs("Plots/dca_d0pi_d0TK.eps");
1132 c4->SaveAs("Plots/d0xd0_cosPointingAngle.eps");
1134 c1->SaveAs("Plots/pT_rapidity_cosThetaStar.gif");
1135 c2->SaveAs("Plots/pTpi_pTK_cT.gif");
1136 c3->SaveAs("Plots/dca_d0pi_d0TK.gif");
1137 c4->SaveAs("Plots/d0xd0_cosPointingAngle.gif");
1141 //___________________________________________________________________________
1142 void AliCFTaskVertexingHF::UserCreateOutputObjects()
1144 //HERE ONE CAN CREATE OUTPUT OBJECTS, IN PARTICULAR IF THE OBJECT PARAMETERS DON'T NEED
1145 //TO BE SET BEFORE THE EXECUTION OF THE TASK
1147 Info("UserCreateOutputObjects","CreateOutputObjects of task %s\n", GetName());
1151 fHistEventsProcessed = new TH1I("CFHFchist0","",1,0,1) ;
1155 //_________________________________________________________________________
1156 Double_t AliCFTaskVertexingHF::GetWeight(Float_t pt)
1159 // calculating the weight to fill the container
1163 // p0 = 1.63297e-01 --> 0.322643
1169 // p0 = 1.85906e-01 --> 0.36609
1174 Double_t func1[4] = {0.322643,2.96275,2.30301,2.5};
1175 Double_t func2[4] = {0.36609,1.94635,1.40463,2.5};
1177 Double_t dndpt_func1 = dNdptFit(pt,func1);
1178 Double_t dndpt_func2 = dNdptFit(pt,func2);
1179 AliDebug(2,Form("pt = %f, FONLL = %f, Pythia = %f, ratio = %f",pt,dndpt_func1,dndpt_func2,dndpt_func1/dndpt_func2));
1180 return dndpt_func1/dndpt_func2;
1183 //__________________________________________________________________________________________________
1184 Double_t AliCFTaskVertexingHF::dNdptFit(Float_t pt, Double_t* par)
1187 // calculating dNdpt
1190 Double_t denom = TMath::Power((pt/par[1]), par[3] );
1191 Double_t dNdpt = par[0]*pt/TMath::Power(1.+denom, par[2]);