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() :
78 fHistEventsProcessed(0x0),
86 fCountRecoITSClusters(0),
91 fFillFromGenerated(kFALSE),
93 fAcceptanceUnf(kTRUE),
103 //___________________________________________________________________________
104 AliCFTaskVertexingHF::AliCFTaskVertexingHF(const Char_t* name, AliRDHFCuts* cuts) :
105 AliAnalysisTaskSE(name),
107 fHistEventsProcessed(0x0),
115 fCountRecoITSClusters(0),
120 fFillFromGenerated(kFALSE),
121 fOriginDselection(0),
122 fAcceptanceUnf(kTRUE),
129 // Constructor. Initialization of Inputs and Outputs
132 DefineInput(0) and DefineOutput(0)
133 are taken care of by AliAnalysisTaskSE constructor
135 DefineOutput(1,TH1I::Class());
136 DefineOutput(2,AliCFContainer::Class());
137 DefineOutput(3,THnSparseD::Class());
138 DefineOutput(4,AliRDHFCuts::Class());
143 //___________________________________________________________________________
144 AliCFTaskVertexingHF& AliCFTaskVertexingHF::operator=(const AliCFTaskVertexingHF& c)
147 // Assignment operator
150 AliAnalysisTaskSE::operator=(c) ;
151 fCFManager = c.fCFManager;
152 fHistEventsProcessed = c.fHistEventsProcessed;
158 //___________________________________________________________________________
159 AliCFTaskVertexingHF::AliCFTaskVertexingHF(const AliCFTaskVertexingHF& c) :
160 AliAnalysisTaskSE(c),
161 fCFManager(c.fCFManager),
162 fHistEventsProcessed(c.fHistEventsProcessed),
163 fCorrelation(c.fCorrelation),
164 fCountMC(c.fCountMC),
165 fCountAcc(c.fCountAcc),
166 fCountVertex(c.fCountVertex),
167 fCountRefit(c.fCountRefit),
168 fCountReco(c.fCountReco),
169 fCountRecoAcc(c.fCountRecoAcc),
170 fCountRecoITSClusters(c.fCountRecoITSClusters),
171 fCountRecoPPR(c.fCountRecoPPR),
172 fCountRecoPID(c.fCountRecoPID),
174 fDecayChannel(c.fDecayChannel),
175 fFillFromGenerated(c.fFillFromGenerated),
176 fOriginDselection(c.fOriginDselection),
177 fAcceptanceUnf(c.fAcceptanceUnf),
179 fUseWeight(c.fUseWeight),
188 //___________________________________________________________________________
189 AliCFTaskVertexingHF::~AliCFTaskVertexingHF()
194 if (fCFManager) delete fCFManager ;
195 if (fHistEventsProcessed) delete fHistEventsProcessed ;
196 if (fCorrelation) delete fCorrelation ;
197 if (fCuts) delete fCuts;
200 //_________________________________________________________________________-
201 void AliCFTaskVertexingHF::Init()
207 if (fDebug>1) printf("AliCFTaskVertexingHF::Init()");
208 AliRDHFCuts *copyfCuts = 0x0;
211 switch (fDecayChannel){
213 copyfCuts = new AliRDHFCutsD0toKpi(*(dynamic_cast<AliRDHFCutsD0toKpi*>(fCuts)));
218 copyfCuts = new AliRDHFCutsDStartoKpipi(*(dynamic_cast<AliRDHFCutsDStartoKpipi*>(fCuts)));
223 copyfCuts = new AliRDHFCutsDplustoKpipi(*(dynamic_cast<AliRDHFCutsDplustoKpipi*>(fCuts)));
228 copyfCuts = new AliRDHFCutsLctopKpi(*(dynamic_cast<AliRDHFCutsLctopKpi*>(fCuts)));
233 copyfCuts = new AliRDHFCutsDstoKKpi(*(dynamic_cast<AliRDHFCutsDstoKKpi*>(fCuts)));
238 copyfCuts = new AliRDHFCutsD0toKpipipi(*(dynamic_cast<AliRDHFCutsD0toKpipipi*>(fCuts)));
243 AliFatal("The decay channel MUST be defined according to AliCFVertexing::DecayChannel - Exiting...");
247 const char* nameoutput=GetOutputSlot(4)->GetContainer()->GetName();
248 copyfCuts->SetName(nameoutput);
251 PostData(4, copyfCuts);
256 //_________________________________________________
257 void AliCFTaskVertexingHF::UserExec(Option_t *)
260 // Main loop function
263 PostData(1,fHistEventsProcessed) ;
264 PostData(2,fCFManager->GetParticleContainer()) ;
265 PostData(3,fCorrelation) ;
267 AliESDtrackCuts* trackCuts = fCuts->GetTrackCuts();
269 if (fFillFromGenerated){
270 AliWarning("Flag to fill container with generated value ON ---> dca, d0pi, d0K, d0xd0, cosPointingAngle will be set as dummy!");
274 Error("UserExec","NO EVENT FOUND!");
278 AliAODEvent* aodEvent = dynamic_cast<AliAODEvent*>(fInputEvent);
280 TClonesArray *arrayBranch=0;
282 if(!aodEvent && AODEvent() && IsStandardAOD()) {
283 // In case there is an AOD handler writing a standard AOD, use the AOD
284 // event in memory rather than the input (ESD) event.
285 aodEvent = dynamic_cast<AliAODEvent*> (AODEvent());
286 // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
287 // have to taken from the AOD event hold by the AliAODExtension
288 AliAODHandler* aodHandler = (AliAODHandler*)
289 ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
290 if(aodHandler->GetExtensions()) {
291 AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
292 AliAODEvent *aodFromExt = ext->GetAOD();
294 switch (fDecayChannel){
296 arrayBranch=(TClonesArray*)aodFromExt->GetList()->FindObject("D0toKpi");
300 arrayBranch=(TClonesArray*)aodFromExt->GetList()->FindObject("Dstar");
306 arrayBranch=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
310 arrayBranch=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm4Prong");
319 switch (fDecayChannel){
321 arrayBranch=(TClonesArray*)aodEvent->GetList()->FindObject("D0toKpi");
325 arrayBranch=(TClonesArray*)aodEvent->GetList()->FindObject("Dstar");
331 arrayBranch=(TClonesArray*)aodEvent->GetList()->FindObject("Charm3Prong");
335 arrayBranch=(TClonesArray*)aodEvent->GetList()->FindObject("Charm4Prong");
343 AliAODVertex *aodVtx = (AliAODVertex*)aodEvent->GetPrimaryVertex();
347 AliError("Could not find array of HF vertices");
353 fCFManager->SetRecEventInfo(aodEvent);
354 fCFManager->SetMCEventInfo(aodEvent);
356 //******** DEFINE number of variables of the container***** for now set at 13, in the future in the config macro.
358 Double_t* containerInput = new Double_t[fNvar];
359 Double_t* containerInputMC = new Double_t[fNvar];
361 //loop on the MC event
363 TClonesArray* mcArray = dynamic_cast<TClonesArray*>(aodEvent->FindListObject(AliAODMCParticle::StdBranchName()));
365 AliError("Could not find Monte-Carlo in AOD");
370 Int_t icountReco = 0;
371 Int_t icountVertex = 0;
372 Int_t icountRefit = 0;
373 Int_t icountRecoAcc = 0;
374 Int_t icountRecoITSClusters = 0;
375 Int_t icountRecoPPR = 0;
376 Int_t icountRecoPID = 0;
379 AliAODMCHeader *mcHeader = dynamic_cast<AliAODMCHeader*>(aodEvent->GetList()->FindObject(AliAODMCHeader::StdBranchName()));
381 AliError("Could not find MC Header in AOD");
385 AliCFVertexingHF* cfVtxHF=0x0;
386 switch (fDecayChannel){
388 cfVtxHF = new AliCFVertexingHF2Prong(mcArray, fOriginDselection);
392 // cfVtxHF = new AliCFVertexingHFCascade(mcArray, originDselection); // not there yet
398 // cfVtxHF = new AliCFVertexingHF3Prong(mcArray, originDselection, fDecayChannel);
402 //cfVtxHF = new AliCFVertexingHF4Prong(mcArray, originDselection); // not there yet
409 Double_t zPrimVertex = aodVtx ->GetZ();
410 Double_t zMCVertex = mcHeader->GetVtxZ();
412 //General settings: vertex, feed down and fill reco container with generated values.
413 cfVtxHF->SetRecoPrimVertex(zPrimVertex);
414 cfVtxHF->SetMCPrimaryVertex(zMCVertex);
415 cfVtxHF->SetFillFromGenerated(fFillFromGenerated);
417 for (Int_t iPart=0; iPart<mcArray->GetEntriesFast(); iPart++) {
419 AliAODMCParticle* mcPart = dynamic_cast<AliAODMCParticle*>(mcArray->At(iPart));
421 // check the MC-level cuts, must be the desidered particle
422 if (!fCFManager->CheckParticleCuts(0, mcPart)) continue; // 0 stands for MC level
424 cfVtxHF->SetMCCandidateParam(iPart);
425 cfVtxHF->SetNVar(fNvar);
427 cquarks += cfVtxHF->MCcquarkCounting(mcPart);
429 if (!(cfVtxHF->SetLabelArray())){
430 AliDebug(2,Form("Impossible to set the label array (decaychannel = %d)",fDecayChannel));
434 //check the candiate family at MC level
435 if (!(cfVtxHF->CheckMCPartFamily(mcPart, mcArray))) {
436 AliDebug(2,Form("Check on the family wrong!!! (decaychannel = %d)",fDecayChannel));
440 AliDebug(2,Form("Check on the family OK!!! (decaychannel = %d)",fDecayChannel));
443 //Fill the MC container
444 Bool_t mcContainerFilled = cfVtxHF -> FillMCContainer(containerInputMC);
445 if (mcContainerFilled) {
446 if (fUseWeight)fWeight = GetWeight(containerInputMC[0]);
447 if (!fCuts->IsInFiducialAcceptance(containerInputMC[0],containerInputMC[1])) continue;
448 //MC Limited Acceptance
449 if (TMath::Abs(containerInputMC[1]) < 0.5) {
450 fCFManager->GetParticleContainer()->Fill(containerInputMC,kStepGeneratedLimAcc, fWeight);
451 AliDebug(3,"MC Lim Acc container filled\n");
455 fCFManager->GetParticleContainer()->Fill(containerInputMC, kStepGenerated, fWeight);
457 AliDebug(3,"MC cointainer filled \n");
460 // check the MC-Acceptance level cuts
461 // since standard CF functions are not applicable, using Kine Cuts on daughters
462 Bool_t mcAccepStep = cfVtxHF-> MCAcceptanceStep();
464 fCFManager->GetParticleContainer()->Fill(containerInputMC,kStepAcceptance, fWeight);
465 AliDebug(3,"MC acceptance cut passed\n");
469 if (fCuts->IsEventSelected(aodEvent)){
470 // filling the container if the vertex is ok
471 fCFManager->GetParticleContainer()->Fill(containerInputMC,kStepVertex, fWeight) ;
472 AliDebug(3,"Vertex cut passed and container filled\n");
475 //mc Refit requirement
476 Bool_t mcRefitStep = cfVtxHF->MCRefitStep(aodEvent, trackCuts);
478 fCFManager->GetParticleContainer()->Fill(containerInputMC,kStepRefit, fWeight);
479 AliDebug(3,"MC Refit cut passed and container filled\n");
483 AliDebug(3,"MC Refit cut not passed\n");
488 AliDebug (3, "MC vertex step not passed\n");
493 AliDebug (3, "MC in acceptance step not passed\n");
498 AliDebug (3, "MC container not filled\n");
502 if (cquarks<2) AliDebug(2,Form("Event with %d c-quarks", cquarks));
503 AliDebug(2,Form("Found %i MC particles that are D0!!",icountMC));
504 AliDebug(2,Form("Found %i MC particles that are D0 and satisfy Acc cuts!!",icountAcc));
505 AliDebug(2,Form("Found %i MC particles that are D0 and satisfy Vertex cuts!!",icountVertex));
506 AliDebug(2,Form("Found %i MC particles that are D0 and satisfy Refit cuts!!",icountRefit));
508 // Now go to rec level
509 fCountMC += icountMC;
510 fCountAcc += icountAcc;
511 fCountVertex+= icountVertex;
512 fCountRefit+= icountRefit;
514 AliDebug(2,Form("Found %d vertices for decay channel %d",arrayBranch->GetEntriesFast(),fDecayChannel));
516 for(Int_t iCandid = 0; iCandid<arrayBranch->GetEntriesFast();iCandid++){
517 AliAODRecoDecayHF* charmCandidate=0x0;
518 switch (fDecayChannel){
520 charmCandidate = (AliAODRecoDecayHF2Prong*)arrayBranch->At(iCandid);
524 charmCandidate = (AliAODRecoCascadeHF*)arrayBranch->At(iCandid);
530 charmCandidate = (AliAODRecoDecayHF3Prong*)arrayBranch->At(iCandid);
534 charmCandidate = (AliAODRecoDecayHF4Prong*)arrayBranch->At(iCandid);
541 Bool_t unsetvtx=kFALSE;
542 if(!charmCandidate->GetOwnPrimaryVtx()) {
543 charmCandidate->SetOwnPrimaryVtx(aodVtx); // needed to compute all variables
547 Bool_t signAssociation = cfVtxHF->SetRecoCandidateParam((AliAODRecoDecayHF*)charmCandidate);
548 if (!signAssociation){
549 charmCandidate = 0x0;
553 Int_t isPartOrAntipart = cfVtxHF->CheckReflexion();
554 Bool_t recoContFilled = cfVtxHF->FillRecoContainer(containerInput);
557 if (!fCuts->IsInFiducialAcceptance(containerInput[0],containerInput[1])) continue;
560 Bool_t recoStep = cfVtxHF->RecoStep();
561 Bool_t vtxCheck = fCuts->IsEventSelected(aodEvent);
563 if (recoStep && recoContFilled && vtxCheck){
564 fCFManager->GetParticleContainer()->Fill(containerInput,kStepReconstructed, fWeight) ;
566 AliDebug(3,"Reco step passed and container filled\n");
568 //Reco in the acceptance -- take care of UNFOLDING!!!!
569 Bool_t recoAcceptanceStep = cfVtxHF->RecoAcceptStep(trackCuts);
570 if (recoAcceptanceStep) {
571 fCFManager->GetParticleContainer()->Fill(containerInput,kStepRecoAcceptance, fWeight) ;
573 AliDebug(3,"Reco acceptance cut passed and container filled\n");
576 Double_t fill[4]; //fill response matrix
577 Bool_t bUnfolding = cfVtxHF -> FillUnfoldingMatrix(fill);
578 if (bUnfolding) fCorrelation->Fill(fill);
581 //Number of ITS cluster requirements
582 Int_t recoITSnCluster = fCuts->IsSelected(charmCandidate, AliRDHFCuts::kTracks);
583 if (recoITSnCluster){
584 fCFManager->GetParticleContainer()->Fill(containerInput,kStepRecoITSClusters, fWeight) ;
585 icountRecoITSClusters++;
586 AliDebug(3,"Reco n ITS cluster cut passed and container filled\n");
588 Bool_t iscutsusingpid = fCuts->GetIsUsePID();
589 Int_t recoAnalysisCuts = -1, recoPidSelection = -1;
590 fCuts->SetUsePID(kFALSE);
591 recoAnalysisCuts = fCuts->IsSelected(charmCandidate, AliRDHFCuts::kCandidate, aodEvent);
593 if (recoAnalysisCuts > 3){ // Ds case, where more possibilities are considered
594 if (recoAnalysisCuts >= 8){
595 recoAnalysisCuts -= 8; // removing K0star mass
597 if (recoAnalysisCuts >= 4){
598 recoAnalysisCuts -= 4; // removing Phi mass
602 fCuts->SetUsePID(iscutsusingpid); //restoring usage of the PID from the cuts object
603 if (recoAnalysisCuts == 3 || recoAnalysisCuts == isPartOrAntipart){
604 fCFManager->GetParticleContainer()->Fill(containerInput, kStepRecoPPR, fWeight);
606 AliDebug(3,"Reco Analysis cuts passed and container filled \n");
608 //recoPidSelection = fCuts->IsSelected(charmCandidate, AliRDHFCuts::kPID);
609 //if((fCuts->CombineSelectionLevels(3,recoAnalysisCuts,recoPidSelection)==isPartOrAntipart)||(fCuts->CombineSelectionLevels(3,recoAnalysisCuts,recoPidSelection)==3)){
610 recoPidSelection = fCuts->IsSelected(charmCandidate, AliRDHFCuts::kCandidate, aodEvent);
611 if (recoPidSelection == 3 || recoPidSelection == isPartOrAntipart){
612 fCFManager->GetParticleContainer()->Fill(containerInput, kStepRecoPID, fWeight);
614 AliDebug(3,"Reco PID cuts passed and container filled \n");
616 Double_t fill[4]; //fill response matrix
617 Bool_t bUnfolding = cfVtxHF -> FillUnfoldingMatrix(fill);
618 if (bUnfolding) fCorrelation->Fill(fill);
622 AliDebug(3, "Analysis Cuts step not passed \n");
627 AliDebug(3, "PID selection not passed \n");
632 AliDebug(3, "Number of ITS cluster step not passed\n");
637 AliDebug(3, "Reco acceptance step not passed\n");
642 AliDebug(3, "Reco step not passed\n");
647 if(unsetvtx) charmCandidate->UnsetOwnPrimaryVtx();
648 } // end loop on candidate
650 fCountReco+= icountReco;
651 fCountRecoAcc+= icountRecoAcc;
652 fCountRecoITSClusters+= icountRecoITSClusters;
653 fCountRecoPPR+= icountRecoPPR;
654 fCountRecoPID+= icountRecoPID;
656 fHistEventsProcessed->Fill(0);
658 delete[] containerInput;
659 containerInput = 0x0;
660 delete[] containerInputMC;
661 containerInputMC = 0x0;
666 //___________________________________________________________________________
667 void AliCFTaskVertexingHF::Terminate(Option_t*)
669 // The Terminate() function is the last function to be called during
670 // a query. It always runs on the client, it can be used to present
671 // the results graphically or save the results to file.
673 AliAnalysisTaskSE::Terminate();
675 AliInfo(Form("Found %i MC particles that are D0 in MC, in %d events",fCountMC,fEvents));
676 AliInfo(Form("Found %i MC particles that are D0 in MC and satisfy Acc cuts, in %d events",fCountAcc,fEvents));
677 AliInfo(Form("Found %i MC particles that are D0 in MC and satisfy Acc cuts, and satisfy Vertex requirement in %d events",fCountVertex,fEvents));
678 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));
679 AliInfo(Form("Found %i reco D0 that are decaying in K+pi, in %d events",fCountReco,fEvents));
680 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));
681 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));
682 AliInfo(Form("Among the above, found %i reco D0 that are decaying in K+pi and satisfy PPR cuts, in %d events",fCountRecoPPR,fEvents));
684 // draw some example plots....
686 AliCFContainer *cont= dynamic_cast<AliCFContainer*> (GetOutputData(2));
688 printf("CONTAINER NOT FOUND\n");
691 // projecting the containers to obtain histograms
692 // first argument = variable, second argument = step
695 TH1D* h00 = cont->ShowProjection(0,0) ; // pt
696 TH1D* h10 = cont->ShowProjection(1,0) ; // rapidity
697 TH1D* h20 = cont->ShowProjection(2,0) ; // cosThetaStar
698 TH1D* h30 = cont->ShowProjection(3,0) ; // pTpi
699 TH1D* h40 = cont->ShowProjection(4,0) ; // pTK
700 TH1D* h50 = cont->ShowProjection(5,0) ; // cT
701 TH1D* h60 = cont->ShowProjection(6,0) ; // dca
702 TH1D* h70 = cont->ShowProjection(7,0) ; // d0pi
703 TH1D* h80 = cont->ShowProjection(8,0) ; // d0K
704 TH1D* h90 = cont->ShowProjection(9,0) ; // d0xd0
705 TH1D* h100 = cont->ShowProjection(10,0) ; // cosPointingAngle
706 TH1D* h110 = cont->ShowProjection(11,0) ; // phi
708 // MC-Acceptance level
709 TH1D* h01 = cont->ShowProjection(0,1) ; // pt
710 TH1D* h11 = cont->ShowProjection(1,1) ; // rapidity
711 TH1D* h21 = cont->ShowProjection(2,1) ; // cosThetaStar
712 TH1D* h31 = cont->ShowProjection(3,1) ; // pTpi
713 TH1D* h41 = cont->ShowProjection(4,1) ; // pTK
714 TH1D* h51 = cont->ShowProjection(5,1) ; // cT
715 TH1D* h61 = cont->ShowProjection(6,1) ; // dca
716 TH1D* h71 = cont->ShowProjection(7,1) ; // d0pi
717 TH1D* h81 = cont->ShowProjection(8,1) ; // d0K
718 TH1D* h91 = cont->ShowProjection(9,1) ; // d0xd0
719 TH1D* h101 = cont->ShowProjection(10,1) ; // cosPointingAngle
720 TH1D* h111 = cont->ShowProjection(11,1) ; // phi
723 TH1D* h04 = cont->ShowProjection(0,4) ; // pt
724 TH1D* h14 = cont->ShowProjection(1,4) ; // rapidity
725 TH1D* h24 = cont->ShowProjection(2,4) ; // cosThetaStar
726 TH1D* h34 = cont->ShowProjection(3,4) ; // pTpi
727 TH1D* h44 = cont->ShowProjection(4,4) ; // pTK
728 TH1D* h54 = cont->ShowProjection(5,4) ; // cT
729 TH1D* h64 = cont->ShowProjection(6,4) ; // dca
730 TH1D* h74 = cont->ShowProjection(7,4) ; // d0pi
731 TH1D* h84 = cont->ShowProjection(8,4) ; // d0K
732 TH1D* h94 = cont->ShowProjection(9,4) ; // d0xd0
733 TH1D* h104 = cont->ShowProjection(10,4) ; // cosPointingAngle
734 TH1D* h114 = cont->ShowProjection(11,4) ; // phi
736 h00->SetTitle("pT_D0 (GeV/c)");
737 h10->SetTitle("rapidity");
738 h20->SetTitle("cosThetaStar");
739 h30->SetTitle("pT_pi (GeV/c)");
740 h40->SetTitle("pT_K (Gev/c)");
741 h50->SetTitle("cT (#mum)");
742 h60->SetTitle("dca (#mum)");
743 h70->SetTitle("d0_pi (#mum)");
744 h80->SetTitle("d0_K (#mum)");
745 h90->SetTitle("d0xd0 (#mum^2)");
746 h100->SetTitle("cosPointingAngle");
747 h100->SetTitle("phi (rad)");
749 h00->GetXaxis()->SetTitle("pT_D0 (GeV/c)");
750 h10->GetXaxis()->SetTitle("rapidity");
751 h20->GetXaxis()->SetTitle("cosThetaStar");
752 h30->GetXaxis()->SetTitle("pT_pi (GeV/c)");
753 h40->GetXaxis()->SetTitle("pT_K (Gev/c)");
754 h50->GetXaxis()->SetTitle("cT (#mum)");
755 h60->GetXaxis()->SetTitle("dca (#mum)");
756 h70->GetXaxis()->SetTitle("d0_pi (#mum)");
757 h80->GetXaxis()->SetTitle("d0_K (#mum)");
758 h90->GetXaxis()->SetTitle("d0xd0 (#mum^2)");
759 h100->GetXaxis()->SetTitle("cosPointingAngle");
760 h110->GetXaxis()->SetTitle("phi (rad)");
762 h01->SetTitle("pT_D0 (GeV/c)");
763 h11->SetTitle("rapidity");
764 h21->SetTitle("cosThetaStar");
765 h31->SetTitle("pT_pi (GeV/c)");
766 h41->SetTitle("pT_K (Gev/c)");
767 h51->SetTitle("cT (#mum)");
768 h61->SetTitle("dca (#mum)");
769 h71->SetTitle("d0_pi (#mum)");
770 h81->SetTitle("d0_K (#mum)");
771 h91->SetTitle("d0xd0 (#mum^2)");
772 h101->SetTitle("cosPointingAngle");
773 h111->GetXaxis()->SetTitle("phi (rad)");
775 h01->GetXaxis()->SetTitle("pT_D0 (GeV/c)");
776 h11->GetXaxis()->SetTitle("rapidity");
777 h21->GetXaxis()->SetTitle("cosThetaStar");
778 h31->GetXaxis()->SetTitle("pT_pi (GeV/c)");
779 h41->GetXaxis()->SetTitle("pT_K (Gev/c)");
780 h51->GetXaxis()->SetTitle("cT (#mum)");
781 h61->GetXaxis()->SetTitle("dca (#mum)");
782 h71->GetXaxis()->SetTitle("d0_pi (#mum)");
783 h81->GetXaxis()->SetTitle("d0_K (#mum)");
784 h91->GetXaxis()->SetTitle("d0xd0 (#mum^2)");
785 h101->GetXaxis()->SetTitle("cosPointingAngle");
786 h111->GetXaxis()->SetTitle("phi (rad)");
788 h04->SetTitle("pT_D0 (GeV/c)");
789 h14->SetTitle("rapidity");
790 h24->SetTitle("cosThetaStar");
791 h34->SetTitle("pT_pi (GeV/c)");
792 h44->SetTitle("pT_K (Gev/c)");
793 h54->SetTitle("cT (#mum)");
794 h64->SetTitle("dca (#mum)");
795 h74->SetTitle("d0_pi (#mum)");
796 h84->SetTitle("d0_K (#mum)");
797 h94->SetTitle("d0xd0 (#mum^2)");
798 h104->SetTitle("cosPointingAngle");
799 h114->GetXaxis()->SetTitle("phi (rad)");
801 h04->GetXaxis()->SetTitle("pT_D0 (GeV/c)");
802 h14->GetXaxis()->SetTitle("rapidity");
803 h24->GetXaxis()->SetTitle("cosThetaStar");
804 h34->GetXaxis()->SetTitle("pT_pi (GeV/c)");
805 h44->GetXaxis()->SetTitle("pT_K (Gev/c)");
806 h54->GetXaxis()->SetTitle("cT (#mum)");
807 h64->GetXaxis()->SetTitle("dca (#mum)");
808 h74->GetXaxis()->SetTitle("d0_pi (#mum)");
809 h84->GetXaxis()->SetTitle("d0_K (#mum)");
810 h94->GetXaxis()->SetTitle("d0xd0 (#mum^2)");
811 h104->GetXaxis()->SetTitle("cosPointingAngle");
812 h114->GetXaxis()->SetTitle("phi (rad)");
814 Double_t max0 = h00->GetMaximum();
815 Double_t max1 = h10->GetMaximum();
816 Double_t max2 = h20->GetMaximum();
817 Double_t max3 = h30->GetMaximum();
818 Double_t max4 = h40->GetMaximum();
819 Double_t max5 = h50->GetMaximum();
820 Double_t max6 = h60->GetMaximum();
821 Double_t max7 = h70->GetMaximum();
822 Double_t max8 = h80->GetMaximum();
823 Double_t max9 = h90->GetMaximum();
824 Double_t max10 = h100->GetMaximum();
825 Double_t max11 = h110->GetMaximum();
827 h00->GetYaxis()->SetRangeUser(0,max0*1.2);
828 h10->GetYaxis()->SetRangeUser(0,max1*1.2);
829 h20->GetYaxis()->SetRangeUser(0,max2*1.2);
830 h30->GetYaxis()->SetRangeUser(0,max3*1.2);
831 h40->GetYaxis()->SetRangeUser(0,max4*1.2);
832 h50->GetYaxis()->SetRangeUser(0,max5*1.2);
833 h60->GetYaxis()->SetRangeUser(0,max6*1.2);
834 h70->GetYaxis()->SetRangeUser(0,max7*1.2);
835 h80->GetYaxis()->SetRangeUser(0,max8*1.2);
836 h90->GetYaxis()->SetRangeUser(0,max9*1.2);
837 h100->GetYaxis()->SetRangeUser(0,max10*1.2);
838 h110->GetYaxis()->SetRangeUser(0,max11*1.2);
840 h01->GetYaxis()->SetRangeUser(0,max0*1.2);
841 h11->GetYaxis()->SetRangeUser(0,max1*1.2);
842 h21->GetYaxis()->SetRangeUser(0,max2*1.2);
843 h31->GetYaxis()->SetRangeUser(0,max3*1.2);
844 h41->GetYaxis()->SetRangeUser(0,max4*1.2);
845 h51->GetYaxis()->SetRangeUser(0,max5*1.2);
846 h61->GetYaxis()->SetRangeUser(0,max6*1.2);
847 h71->GetYaxis()->SetRangeUser(0,max7*1.2);
848 h81->GetYaxis()->SetRangeUser(0,max8*1.2);
849 h91->GetYaxis()->SetRangeUser(0,max9*1.2);
850 h101->GetYaxis()->SetRangeUser(0,max10*1.2);
851 h111->GetYaxis()->SetRangeUser(0,max11*1.2);
853 h00->SetMarkerStyle(20);
854 h10->SetMarkerStyle(24);
855 h20->SetMarkerStyle(21);
856 h30->SetMarkerStyle(25);
857 h40->SetMarkerStyle(27);
858 h50->SetMarkerStyle(28);
859 h60->SetMarkerStyle(20);
860 h70->SetMarkerStyle(24);
861 h80->SetMarkerStyle(21);
862 h90->SetMarkerStyle(25);
863 h100->SetMarkerStyle(27);
864 h110->SetMarkerStyle(28);
866 h00->SetMarkerColor(2);
867 h10->SetMarkerColor(2);
868 h20->SetMarkerColor(2);
869 h30->SetMarkerColor(2);
870 h40->SetMarkerColor(2);
871 h50->SetMarkerColor(2);
872 h60->SetMarkerColor(2);
873 h70->SetMarkerColor(2);
874 h80->SetMarkerColor(2);
875 h90->SetMarkerColor(2);
876 h100->SetMarkerColor(2);
877 h110->SetMarkerColor(2);
879 h01->SetMarkerStyle(20) ;
880 h11->SetMarkerStyle(24) ;
881 h21->SetMarkerStyle(21) ;
882 h31->SetMarkerStyle(25) ;
883 h41->SetMarkerStyle(27) ;
884 h51->SetMarkerStyle(28) ;
885 h61->SetMarkerStyle(20);
886 h71->SetMarkerStyle(24);
887 h81->SetMarkerStyle(21);
888 h91->SetMarkerStyle(25);
889 h101->SetMarkerStyle(27);
890 h111->SetMarkerStyle(28);
892 h01->SetMarkerColor(8);
893 h11->SetMarkerColor(8);
894 h21->SetMarkerColor(8);
895 h31->SetMarkerColor(8);
896 h41->SetMarkerColor(8);
897 h51->SetMarkerColor(8);
898 h61->SetMarkerColor(8);
899 h71->SetMarkerColor(8);
900 h81->SetMarkerColor(8);
901 h91->SetMarkerColor(8);
902 h101->SetMarkerColor(8);
903 h111->SetMarkerColor(8);
905 h04->SetMarkerStyle(20) ;
906 h14->SetMarkerStyle(24) ;
907 h24->SetMarkerStyle(21) ;
908 h34->SetMarkerStyle(25) ;
909 h44->SetMarkerStyle(27) ;
910 h54->SetMarkerStyle(28) ;
911 h64->SetMarkerStyle(20);
912 h74->SetMarkerStyle(24);
913 h84->SetMarkerStyle(21);
914 h94->SetMarkerStyle(25);
915 h104->SetMarkerStyle(27);
916 h114->SetMarkerStyle(28);
918 h04->SetMarkerColor(4);
919 h14->SetMarkerColor(4);
920 h24->SetMarkerColor(4);
921 h34->SetMarkerColor(4);
922 h44->SetMarkerColor(4);
923 h54->SetMarkerColor(4);
924 h64->SetMarkerColor(4);
925 h74->SetMarkerColor(4);
926 h84->SetMarkerColor(4);
927 h94->SetMarkerColor(4);
928 h104->SetMarkerColor(4);
929 h114->SetMarkerColor(4);
931 gStyle->SetCanvasColor(0);
932 gStyle->SetFrameFillColor(0);
933 gStyle->SetTitleFillColor(0);
934 gStyle->SetStatColor(0);
936 // drawing in 2 separate canvas for a matter of clearity
937 TCanvas * c1 =new TCanvas("c1New","pT, rapidiy, cosThetaStar",1100,1600);
969 TCanvas * c2 =new TCanvas("c2New","pTpi, pTK, cT",1100,1600);
1000 TCanvas * c3 =new TCanvas("c3New","dca, d0pi, d0K",1100,1600);
1031 TCanvas * c4 =new TCanvas("c4New","d0xd0, cosPointingAngle, phi",1100,1600);
1062 THnSparseD* hcorr = dynamic_cast<THnSparseD*> (GetOutputData(3));
1064 TH2D* corr1 =hcorr->Projection(0,2);
1065 TH2D* corr2 = hcorr->Projection(1,3);
1067 TCanvas * c7 =new TCanvas("c7New","",800,400);
1070 corr1->Draw("text");
1072 corr2->Draw("text");
1075 TFile* file_projection = new TFile("CFtaskHFprojectionNew.root","RECREATE");
1079 h00->Write("pT_D0_step0");
1080 h10->Write("rapidity_step0");
1081 h20->Write("cosThetaStar_step0");
1082 h30->Write("pT_pi_step0");
1083 h40->Write("pT_K_step0");
1084 h50->Write("cT_step0");
1085 h60->Write("dca_step0");
1086 h70->Write("d0_pi_step0");
1087 h80->Write("d0_K_step0");
1088 h90->Write("d0xd0_step0");
1089 h100->Write("cosPointingAngle_step0");
1090 h110->Write("phi_step0");
1092 h01->Write("pT_D0_step1");
1093 h11->Write("rapidity_step1");
1094 h21->Write("cosThetaStar_step1");
1095 h31->Write("pT_pi_step1");
1096 h41->Write("pT_K_step1");
1097 h51->Write("cT_step1");
1098 h61->Write("dca_step1");
1099 h71->Write("d0_pi_step1");
1100 h81->Write("d0_K_step1");
1101 h91->Write("d0xd0_step1");
1102 h101->Write("cosPointingAngle_step1");
1103 h111->Write("phi_step1");
1105 h04->Write("pT_D0_step2");
1106 h14->Write("rapidity_step2");
1107 h24->Write("cosThetaStar_step2");
1108 h34->Write("pT_pi_step2");
1109 h44->Write("pT_K_step2");
1110 h54->Write("cT_step2");
1111 h64->Write("dca_step2");
1112 h74->Write("d0_pi_step2");
1113 h80->Write("d0_K_step2");
1114 h94->Write("d0xd0_step2");
1115 h104->Write("cosPointingAngle_step2");
1116 h114->Write("phi_step2");
1118 file_projection->Close();
1123 c1->SaveAs("Plots/pT_rapidity_cosThetaStar.eps");
1124 c2->SaveAs("Plots/pTpi_pTK_cT.eps");
1125 c3->SaveAs("Plots/dca_d0pi_d0TK.eps");
1126 c4->SaveAs("Plots/d0xd0_cosPointingAngle.eps");
1128 c1->SaveAs("Plots/pT_rapidity_cosThetaStar.gif");
1129 c2->SaveAs("Plots/pTpi_pTK_cT.gif");
1130 c3->SaveAs("Plots/dca_d0pi_d0TK.gif");
1131 c4->SaveAs("Plots/d0xd0_cosPointingAngle.gif");
1135 //___________________________________________________________________________
1136 void AliCFTaskVertexingHF::UserCreateOutputObjects()
1138 //HERE ONE CAN CREATE OUTPUT OBJECTS, IN PARTICULAR IF THE OBJECT PARAMETERS DON'T NEED
1139 //TO BE SET BEFORE THE EXECUTION OF THE TASK
1141 Info("UserCreateOutputObjects","CreateOutputObjects of task %s\n", GetName());
1145 fHistEventsProcessed = new TH1I("CFHFchist0","",1,0,1) ;
1149 //_________________________________________________________________________
1150 Double_t AliCFTaskVertexingHF::GetWeight(Float_t pt)
1153 // calculating the weight to fill the container
1157 // p0 = 1.63297e-01 --> 0.322643
1163 // p0 = 1.85906e-01 --> 0.36609
1168 Double_t func1[4] = {0.322643,2.96275,2.30301,2.5};
1169 Double_t func2[4] = {0.36609,1.94635,1.40463,2.5};
1171 Double_t dndpt_func1 = dNdptFit(pt,func1);
1172 Double_t dndpt_func2 = dNdptFit(pt,func2);
1173 AliDebug(2,Form("pt = %f, FONLL = %f, Pythia = %f, ratio = %f",pt,dndpt_func1,dndpt_func2,dndpt_func1/dndpt_func2));
1174 return dndpt_func1/dndpt_func2;
1177 //__________________________________________________________________________________________________
1178 Double_t AliCFTaskVertexingHF::dNdptFit(Float_t pt, Double_t* par)
1181 // calculating dNdpt
1184 Double_t denom = TMath::Power((pt/par[1]), par[3] );
1185 Double_t dNdpt = par[0]*pt/TMath::Power(1.+denom, par[2]);