From 65201059737e89174d6cbba00d84ca6b8ee042b5 Mon Sep 17 00:00:00 2001 From: snelling Date: Thu, 18 Feb 2010 11:15:47 +0000 Subject: [PATCH] Change to TaskSE --- .../AliFlowTasks/AliAnalysisTaskFlowEvent.cxx | 225 ++++++------------ .../AliFlowTasks/AliAnalysisTaskFlowEvent.h | 21 +- 2 files changed, 80 insertions(+), 166 deletions(-) diff --git a/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.cxx b/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.cxx index 770b2361740..549c169ab01 100644 --- a/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.cxx +++ b/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.cxx @@ -66,55 +66,10 @@ class AliAnalysisTask; ClassImp(AliAnalysisTaskFlowEvent) -//________________________________________________________________________ -AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent(const char *name, Bool_t on) : - AliAnalysisTask(name, ""), -// fOutputFile(NULL), - fESD(NULL), - fAOD(NULL), - fEventMaker(NULL), - fAnalysisType("ESD"), - fCFManager1(NULL), - fCFManager2(NULL), - fQAInt(NULL), - fQADiff(NULL), - fMinMult(0), - fMaxMult(10000000), - fMinA(-1.0), - fMaxA(-0.01), - fMinB(0.01), - fMaxB(1.0), - fQA(on), - fMCReactionPlaneAngle(0.), - fCount(0), - fNoOfLoops(1), - fEllipticFlowValue(0.), - fSigmaEllipticFlowValue(0.), - fMultiplicityOfEvent(1000000000), - fSigmaMultiplicityOfEvent(0), - fMyTRandom3(NULL) -{ - // Constructor - cout<<"AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent(const char *name)"<SetSeed(fMyTRandom3->Integer(65539)); - - // Define input and output slots here - // Input slot #0 works with a TChain - DefineInput(0, TChain::Class()); + + + // Define output slots here // Define here the flow event output - DefineOutput(0, AliFlowEventSimple::Class()); + DefineOutput(1, AliFlowEventSimple::Class()); if(on) { - DefineOutput(1, TList::Class()); - DefineOutput(2, TList::Class()); } + DefineOutput(2, TList::Class()); + DefineOutput(3, TList::Class()); } // and for testing open an output file // fOutputFile = new TFile("FlowEvents.root","RECREATE"); @@ -201,40 +154,7 @@ AliAnalysisTaskFlowEvent::~AliAnalysisTaskFlowEvent() } //________________________________________________________________________ -void AliAnalysisTaskFlowEvent::ConnectInputData(Option_t *) -{ - // Connect ESD or AOD here - // Called once - cout<<"AliAnalysisTaskFlowEvent::ConnectInputData(Option_t *)"< (GetInputData(0)); - if (!tree) { - Printf("ERROR: Could not read chain from input slot 0"); - } - else { - if (fAnalysisType == "ESD" || fAnalysisType == "ESDMC0" || fAnalysisType == "ESDMC1" || fAnalysisType == "MC") { - AliESDInputHandler *esdH = dynamic_cast (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); - if (!esdH) { - Printf("ERROR: Could not get ESDInputHandler"); - } - else {fESD = esdH->GetEvent();} - } - else if (fAnalysisType == "AOD") { - AliAODInputHandler *aodH = dynamic_cast (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); - if (!aodH) { - Printf("ERROR: Could not get AODInputHandler"); - } - else { fAOD = aodH->GetEvent();} - } - else { - Printf("!!!!!Wrong analysis type: Only ESD, ESDMC0, ESDMC1, AOD and MC types are allowed!"); - exit(1); - } - } -} - -//________________________________________________________________________ -void AliAnalysisTaskFlowEvent::CreateOutputObjects() +void AliAnalysisTaskFlowEvent::UserCreateOutputObjects() { // Called at every worker node to initialize cout<<"AliAnalysisTaskFlowEvent::CreateOutputObjects()"< (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); - if (eventHandler) { - mcEvent = eventHandler->MCEvent(); - if (mcEvent) { - - //COCKTAIL with HIJING - if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"Cocktail Header")) { //returns 0 if matches - AliGenCocktailEventHeader *headerC = dynamic_cast (mcEvent-> GenEventHeader()); - if (headerC) { - TList *lhd = headerC->GetHeaders(); - if (lhd) { - AliGenHijingEventHeader *hdh = dynamic_cast (lhd->At(0)); - if (hdh) { - fRP = hdh->ReactionPlaneAngle(); - //cout<<"The reactionPlane from Hijing is: "<< fRP < GenEventHeader()->GetName(),"Cocktail Header")) { //returns 0 if matches + AliGenCocktailEventHeader *headerC = dynamic_cast (mcEvent-> GenEventHeader()); + if (headerC) { + TList *lhd = headerC->GetHeaders(); + if (lhd) { + AliGenHijingEventHeader *hdh = dynamic_cast (lhd->At(0)); + if (hdh) { + fRP = hdh->ReactionPlaneAngle(); + //cout<<"The reactionPlane from Hijing is: "<< fRP < GenEventHeader()->GetName(),"GeVSim header")) { //returns 0 if matches - AliGenGeVSimEventHeader* headerG = (AliGenGeVSimEventHeader*)(mcEvent->GenEventHeader()); - if (headerG) { - fRP = headerG->GetEventPlane(); - //cout<<"The reactionPlane from GeVSim is: "<< fRP < GenEventHeader()->GetName(),"GeVSim header")) { //returns 0 if matches + AliGenGeVSimEventHeader* headerG = (AliGenGeVSimEventHeader*)(mcEvent->GenEventHeader()); + if (headerG) { + fRP = headerG->GetEventPlane(); + //cout<<"The reactionPlane from GeVSim is: "<< fRP < GenEventHeader()->GetName(),"Hijing")) { //returns 0 if matches - AliGenHijingEventHeader* headerH = (AliGenHijingEventHeader*)(mcEvent->GenEventHeader()); - if (headerH) { - fRP = headerH->ReactionPlaneAngle(); - //cout<<"The reactionPlane from Hijing is: "<< fRP < GenEventHeader()->GetName(),"Hijing")) { //returns 0 if matches + AliGenHijingEventHeader* headerH = (AliGenHijingEventHeader*)(mcEvent->GenEventHeader()); + if (headerH) { + fRP = headerH->ReactionPlaneAngle(); + //cout<<"The reactionPlane from Hijing is: "<< fRP <GenEventHeader()->GetName(),"EPOS")) { - AliGenEposEventHeader* headerE = (AliGenEposEventHeader*)(mcEvent->GenEventHeader()); - if (headerE) { - fRP = headerE->ReactionPlaneAngle(); - //cout<<"The reactionPlane from EPOS is: "<< fR <GenEventHeader()->GetName(),"EPOS")) { + AliGenEposEventHeader* headerE = (AliGenEposEventHeader*)(mcEvent->GenEventHeader()); + if (headerE) { + fRP = headerE->ReactionPlaneAngle(); + //cout<<"The reactionPlane from EPOS is: "<< fR <Rndm()); xNewFlowValue = fMyTRandom3->Gaus(fEllipticFlowValue,fSigmaEllipticFlowValue); nNewMultOfEvent = TMath::Nint(fMyTRandom3->Gaus(fMultiplicityOfEvent,fSigmaMultiplicityOfEvent)); @@ -381,22 +296,22 @@ void AliAnalysisTaskFlowEvent::Exec(Option_t *) if (!fCFManager1) {cout << "ERROR: No pointer to correction framework cuts! " << endl; return; } if (!fCFManager2) {cout << "ERROR: No pointer to correction framework cuts! " << endl; return; } - if (!fESD) { Printf("ERROR: fESD not available"); return;} + if (!fInputEvent) { Printf("ERROR: fInputEvent not available"); return;} //check the offline trigger (check if the event has the correct trigger) if (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()) { - Printf("There are %d tracks in this event", fESD->GetNumberOfTracks()); + Printf("There are %d tracks in this event", fInputEvent->GetNumberOfTracks()); // analysis - fEvent = fEventMaker->FillTracks(fESD,fCFManager1,fCFManager2); + fEvent = fEventMaker->FillTracks(dynamic_cast (fInputEvent),fCFManager1,fCFManager2); } } // Fill the FlowEventSimple for ESD input combined with MC info else if (fAnalysisType == "ESDMC0" || fAnalysisType == "ESDMC1" ) { if (!fCFManager1) {cout << "ERROR: No pointer to correction framework cuts! " << endl; return; } if (!fCFManager2) {cout << "ERROR: No pointer to correction framework cuts! " << endl; return; } - if (!fESD) { Printf("ERROR: fESD not available"); return;} - Printf("There are %d tracks in this event", fESD->GetNumberOfTracks()); + if (!fInputEvent) { Printf("ERROR: fInputEvent not available"); return;} + Printf("There are %d tracks in this event", fInputEvent->GetNumberOfTracks()); if (!mcEvent) {Printf("ERROR: Could not retrieve MC event"); return;} @@ -405,27 +320,27 @@ void AliAnalysisTaskFlowEvent::Exec(Option_t *) if (fAnalysisType == "ESDMC0") { - fEvent = fEventMaker->FillTracks(fESD, mcEvent, fCFManager1, fCFManager2, 0); //0 = kine from ESD, 1 = kine from MC + fEvent = fEventMaker->FillTracks(dynamic_cast (fInputEvent), mcEvent, fCFManager1, fCFManager2, 0); //0 = kine from ESD, 1 = kine from MC } else if (fAnalysisType == "ESDMC1") { - fEvent = fEventMaker->FillTracks(fESD, mcEvent, fCFManager1, fCFManager2, 1); //0 = kine from ESD, 1 = kine from MC + fEvent = fEventMaker->FillTracks(dynamic_cast (fInputEvent), mcEvent, fCFManager1, fCFManager2, 1); //0 = kine from ESD, 1 = kine from MC } } // Fill the FlowEventSimple for AOD input else if (fAnalysisType == "AOD") { - if (!fAOD) {Printf("ERROR: fAOD not available"); return;} - Printf("There are %d tracks in this event", fAOD->GetNumberOfTracks()); + if (!fOutputAOD) {Printf("ERROR: fOutputAOD not available"); return;} + Printf("There are %d tracks in this event", fOutputAOD->GetNumberOfTracks()); // analysis - //For the moment don't use CF //AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fAOD,fCFManager1,fCFManager2); - fEvent = fEventMaker->FillTracks(fAOD); + //For the moment don't use CF //AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fOutputAOD,fCFManager1,fCFManager2); + fEvent = fEventMaker->FillTracks(fOutputAOD); } //fListHistos->Print(); // fOutputFile->WriteObject(fEvent,"myFlowEventSimple"); - PostData(0,fEvent); + PostData(1,fEvent); if (fQA) { - PostData(1,fQAInt); - PostData(2,fQADiff); } + PostData(2,fQAInt); + PostData(3,fQADiff); } } //________________________________________________________________________ diff --git a/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.h b/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.h index d120fb37f5e..e37311f3fac 100644 --- a/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.h +++ b/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.h @@ -11,26 +11,24 @@ #ifndef AliAnalysisTaskFlowEvent_H #define AliAnalysisTaskFlowEvent_H -class AliESDEvent; -class AliAODEvent; +//class AliESDEvent; +//class AliAODEvent; class AliCFManager; class AliFlowEventSimpleMaker; class TList; class TRandom3; #include "TString.h" -#include "AliAnalysisTask.h" +#include "AliAnalysisTaskSE.h" -class AliAnalysisTaskFlowEvent : public AliAnalysisTask { +class AliAnalysisTaskFlowEvent : public AliAnalysisTaskSE { public: AliAnalysisTaskFlowEvent(); - AliAnalysisTaskFlowEvent(const char *name,Bool_t QAon); - AliAnalysisTaskFlowEvent(const char *name,Bool_t QAon,UInt_t); + AliAnalysisTaskFlowEvent(const char *name,Bool_t QAon,UInt_t=666); virtual ~AliAnalysisTaskFlowEvent(); - virtual void ConnectInputData(Option_t *); - virtual void CreateOutputObjects(); - virtual void Exec(Option_t *option); + virtual void UserCreateOutputObjects(); + virtual void UserExec(Option_t *option); virtual void Terminate(Option_t *); void SetAnalysisType(TString type) { this->fAnalysisType = type; } @@ -79,8 +77,8 @@ class AliAnalysisTaskFlowEvent : public AliAnalysisTask { AliAnalysisTaskFlowEvent& operator=(const AliAnalysisTaskFlowEvent& aAnalysisTask); // TFile* fOutputFile; // temporary output file for testing - AliESDEvent* fESD; // ESD object - AliAODEvent* fAOD; // AOD object + // AliESDEvent* fESD; // ESD object + // AliAODEvent* fAOD; // AOD object AliFlowEventSimpleMaker* fEventMaker; // FlowEventSimple maker object TString fAnalysisType; // can be MC, ESD or AOD AliCFManager* fCFManager1; // correction framework manager @@ -105,6 +103,7 @@ class AliAnalysisTaskFlowEvent : public AliAnalysisTask { Int_t fSigmaMultiplicityOfEvent; // Sigma multiplicity (Gaussian). TRandom3* fMyTRandom3; // our TRandom3 generator + Bool_t fbAfterburnerOn; // end afterburner ClassDef(AliAnalysisTaskFlowEvent, 1); // example of analysis -- 2.43.5