3 #include "AliAnalysisDataSlot.h"
4 #include "AliAnalysisDataContainer.h"
5 #include "AliAnalysisManager.h"
6 #include "AliMCEvent.h"
8 #include "AliTwoParticlePIDCorrKine.h"
9 #include "AliGenEventHeader.h"
10 #include "AliCollisionGeometry.h"
11 #include "AliVEvent.h"
12 #include "AliVParticle.h"
15 ClassImp(AliTwoParticlePIDCorrKine)
17 //____________________________________________| Constructor
18 AliTwoParticlePIDCorrKine::AliTwoParticlePIDCorrKine():
21 fHistEventsProcessed(0x0),
27 fCentralityFrom("Impact"),
28 fCentralityEstimator("V0M")
34 //____________________________________________| Specific Constructor
35 AliTwoParticlePIDCorrKine::AliTwoParticlePIDCorrKine(const Char_t* name) :
36 AliAnalysisTaskSE(name),
39 fHistEventsProcessed(0x0),
45 fCentralityFrom("Impact"),
46 fCentralityEstimator("V0M")
48 // Constructor. Initialization of Inputs and Outputs
49 Info("AliTwoParticlePIDCorrKine","Calling Constructor");
50 // Output slot #1 writes into a TList container (nevents histogram)
51 DefineInput(0, TChain::Class());
52 DefineOutput(1,TList::Class()); // Basic output slot (more needed)
55 //____________________________________________| Destructor
56 AliTwoParticlePIDCorrKine::~AliTwoParticlePIDCorrKine()
59 Info("~AliTwoParticlePIDCorrKine","Calling Destructor");
60 if (fHistEventsProcessed) delete fHistEventsProcessed;
61 if (fOutputList) delete fOutputList;
62 if (fHistZvtx) delete fHistZvtx;
63 if (fHistPt) delete fHistPt;
67 //___________________________________________________________________________
68 void AliTwoParticlePIDCorrKine::UserCreateOutputObjects()
71 // AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
72 // AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
74 Info("CreateOutputObjects","CreateOutputObjects of task %s", GetName());
75 fOutputList = new TList();
76 fOutputList->SetOwner(kTRUE);
77 // fOutputList->SetName("KineTest");
80 fHistEventsProcessed = new TH1F("fHistNEvents","fHistEventsProcessed",3,-0.5,2.5) ;
81 fHistEventsProcessed->GetXaxis()->SetBinLabel(1,"All events");
82 fHistEventsProcessed->GetXaxis()->SetBinLabel(2,"Event within |Ztx| 10cm");
83 fHistEventsProcessed->GetXaxis()->SetBinLabel(3,"Good Reconstructed events");
86 fHistPt = new TH1F("fHistPt", "P_{T} distribution", 15, 0.1, 3.1);
87 fHistPt->GetXaxis()->SetTitle("P_{T} (GeV/c)");
88 fHistPt->GetYaxis()->SetTitle("dN/dP_{T} (c/GeV)");
89 fHistPt->SetMarkerStyle(kFullCircle);
91 fHistZvtx = new TH1F("fHistZvtx", "Zvtx distribution", 40, -20, 20);
92 fHistZvtx->GetXaxis()->SetTitle("ZVtx (cm)");
93 fHistZvtx->GetYaxis()->SetTitle("Nch");
94 fHistZvtx->SetMarkerStyle(kFullCircle);
96 fHistImpact = new TH1F ("fHistImpact","ImpactParameter_Dist", 100,0.0,20.0);
98 fOutputList->Add(fHistEventsProcessed);
99 fOutputList->Add(fHistZvtx);
100 fOutputList->Add(fHistPt);
101 fOutputList->Add(fHistImpact);
103 PostData(1, fOutputList);
111 //____________________________________________| User Exec
112 void AliTwoParticlePIDCorrKine::UserExec(Option_t *)
115 // fMcHandler = dynamic_cast<AliInputEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); //get handler
116 //if(!fMCHandler) return;
118 fEvent = dynamic_cast<AliVEvent*>(MCEvent());
121 //AliError("event not available");
126 fHistEventsProcessed->Fill(0.0); // # of Event after passing MC cuts
133 const AliVVertex *vtxMC = fEvent->GetPrimaryVertex();
134 Float_t zVtx = vtxMC->GetZ();
135 if(TMath::Abs(zVtx) < fZvtxLim)fHistZvtx->Fill(zVtx);
138 fHistEventsProcessed->Fill(1.0);
140 Double_t gImpactParameter = 0.;
141 //Double_t gMultiplicity = 0.;
142 Double_t gReactionPlane=0.0;
143 //Double_t gCentrality=0.0;
145 AliMCEvent *gMCEvent = dynamic_cast<AliMCEvent*>(fEvent);
147 AliCollisionGeometry* headerH = dynamic_cast<AliCollisionGeometry*>(gMCEvent->GenEventHeader());
149 gImpactParameter = headerH->ImpactParameter();
150 //gMultiplicity = GenMultiplicity(event); //calculate the multiplicity depending on the choice of centrality estimator
151 gReactionPlane= headerH->ReactionPlaneAngle();
152 // gCentrality = (CentralityFrom =="Multiplicity") ? gImpactParameter :gMultiplicity;
156 fHistImpact->Fill(gImpactParameter);
158 // # of Event after passing MC cuts
160 //Printf("MC particles: %d", fEvent->GetNumberOfTracks());
162 for (Int_t iTracks = 0; iTracks < fEvent->GetNumberOfTracks(); iTracks++) {
163 AliVParticle* track = fEvent->GetTrack(iTracks);
165 //AliError(Form("Could not receive particle %d", iTracks));
169 fHistPt->Fill(track->Pt());
173 fHistEventsProcessed->Fill(2.0); // # of Event after passing MC cuts
175 PostData(1, fOutputList);
180 //___________________________________________________________________________
181 void AliTwoParticlePIDCorrKine::Terminate(Option_t*)
184 Info("Terminate","Start and end of Method");
185 AliAnalysisTaskSE::Terminate();
187 fOutputList = dynamic_cast<TList*> (GetOutputData(1));
189 Printf("ERROR: Output list not available");