#include "AliStack.h"
#include "AliMCEvent.h"
#include "AliMCEventHandler.h"
+#include "AliESDInputHandler.h"
#include "AliAODEvent.h"
#include "AliAODHeader.h"
#include "AliAODMCHeader.h"
#include "AliGenHijingEventHeader.h"
#include "AliGenPythiaEventHeader.h"
#include "AliGenCocktailEventHeader.h"
+#include "AliGenEventHeaderTunedPbPb.h"
+#include "AliESDtrack.h"
+#include "AliAODTrack.h"
+#include "AliAODPid.h"
+#include "AliESDpid.h"
#include "AliLog.h"
// Implemented Notify() to read the cross sections
// from pyxsec.root
//
- TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree();
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ TTree *tree = mgr->GetTree();
Double_t xsection = 0;
UInt_t ntrials = 0;
if(tree){
}
TString fileName(curfile->GetName());
- if(fileName.Contains("AliESDs.root")){
+ TString datafile = mgr->GetInputEventHandler()->GetInputFileName();
+ if (fileName.Contains(datafile)) {
+ fileName.ReplaceAll(datafile, "pyxsec.root");
+ }
+ else if(fileName.Contains("AliESDs.root")){
fileName.ReplaceAll("AliESDs.root", "pyxsec.root");
}
else if(fileName.Contains("AliAOD.root")){
void AliAnalysisTaskMCParticleFilter::UserCreateOutputObjects()
{
// Create the output container
- PostData(1,fHistList);
+
if (OutputTree()&&fTrackFilterMother)
OutputTree()->GetUserInfo()->Add(fTrackFilterMother);
h1Trials->GetXaxis()->SetBinLabel(1,"#sum{ntrials}");
fHistList->Add(h1Trials);
+ PostData(1,fHistList);
}
//____________________________________________________________________
void AliAnalysisTaskMCParticleFilter::UserExec(Option_t */*option*/)
{
-// Execute analysis for current event
-//
-
-// Fill AOD tracks from Kinematic stack
-
+ // Execute analysis for current event
+ //
+
+ // Fill AOD tracks from Kinematic stack
+ PostData(1,fHistList);
+
// get AliAOD Event
AliAODEvent* aod = AODEvent();
if (!aod) {
AliGenHijingEventHeader *hiH = 0;
AliCollisionGeometry *colG = 0;
AliGenDPMjetEventHeader *dpmH = 0;
+ AliGenEventHeaderTunedPbPb *tunedH = 0;
+
// it can be only one save some casts
// assuming PYTHIA and HIJING are the most likely ones...
if(!pyH){
hiH = dynamic_cast<AliGenHijingEventHeader*>(mcEH);
if(!hiH){
dpmH = dynamic_cast<AliGenDPMjetEventHeader*>(mcEH);
+ if(!dpmH){
+ tunedH = dynamic_cast<AliGenEventHeaderTunedPbPb*>(mcEH);
+ }
}
}
fAODMcHeader->SetReactionPlaneAngle(colG->ReactionPlaneAngle());
AliInfo(Form("Found Collision Geometry. Got Reaction Plane %lf\n", colG->ReactionPlaneAngle()));
}
-
-
+ else if(tunedH) {
+ fAODMcHeader->SetReactionPlaneAngle(tunedH->GetPsi2());
+ fAODMcHeader->SetCrossSection(tunedH->GetCentrality());
+ }
Int_t j=0;
// Check that the decay chain ends at a primary particle
AliMCParticle* mother = mcpart;
Int_t imo = mcpart->GetMother();
- while((imo >= nprim) && (mother->GetUniqueID() == kPDecay)) {
+ while((imo >= nprim) && (mother->Particle()->GetUniqueID() == kPDecay)) {
mother = (AliMCParticle*) mcE->GetTrack(imo);
imo = mother->GetMother();
}
// Check if the gamma comes from the decay chain of a primary particle
AliMCParticle* mother = (AliMCParticle*) mcE->GetTrack(imo);
imo = mother->GetMother();
- while((imo >= nprim) && (mother->GetUniqueID() == kPDecay)) {
+ while((imo >= nprim) && (mother->Particle()->GetUniqueID() == kPDecay)) {
mother = (AliMCParticle*) mcE->GetTrack(imo);
imo = mother->GetMother();
}
aodH->StoreMCParticles();
- PostData(1,fHistList);
return;
}