* provided "as is" without express or implied warranty. *
**************************************************************************/
-////////////////////////////////////////////////////
-// AliAnalysisTaskFlowEvent:
-//
-// analysis task for filling the flow event
-// from MCEvent, ESD, AOD ....
-// and put it in an output stream so it can
-// be used by the various flow analysis methods
-// for cuts the correction framework is used
-// which also outputs QA histograms to view
-// the effects of the cuts
-////////////////////////////////////////////////////
-
-
#include "Riostream.h" //needed as include
#include "TChain.h"
#include "TTree.h"
#include "TFile.h" //needed as include
#include "TList.h"
+#include "TRandom3.h"
+#include "TTimeStamp.h"
// ALICE Analysis Framework
class AliAnalysisTask;
#include "AliAnalysisTaskFlowEvent.h"
+// AliAnalysisTaskFlowEvent:
+//
+// analysis task for filling the flow event
+// from MCEvent, ESD, AOD ....
+// and put it in an output stream so it can
+// be used by the various flow analysis methods
+// for cuts the correction framework is used
+// which also outputs QA histrograms to view
+// the effects of the cuts
+
ClassImp(AliAnalysisTaskFlowEvent)
fAOD(NULL),
fEventMaker(NULL),
fAnalysisType("ESD"),
- fMinMult(0),
- fMaxMult(10000000),
fCFManager1(NULL),
fCFManager2(NULL),
fQAInt(NULL),
fQADiff(NULL),
- fQA(on)
+ 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)"<<endl;
DefineOutput(1, TList::Class());
DefineOutput(2, TList::Class()); }
// and for testing open an output file
- // fOutputFile = new TFile("FlowEvents.root","RECREATE");
+ // fOutputFile = new TFile("FlowEvents.root","RECREATE");
}
fAOD(NULL),
fEventMaker(NULL),
fAnalysisType("ESD"),
- fMinMult(0),
- fMaxMult(10000000),
fCFManager1(NULL),
fCFManager2(NULL),
fQAInt(NULL),
fQADiff(NULL),
- fQA(kFALSE)
+ fQA(kFALSE),
+ fMCReactionPlaneAngle(0.),
+ fCount(0),
+ fNoOfLoops(1),
+ fEllipticFlowValue(0.),
+ fSigmaEllipticFlowValue(0.),
+ fMultiplicityOfEvent(1000000000),
+ fSigmaMultiplicityOfEvent(0),
+ fMyTRandom3(NULL)
{
// Constructor
cout<<"AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent()"<<endl;
}
+//________________________________________________________________________
+AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent(const char *name, Bool_t on, UInt_t iseed) :
+ AliAnalysisTask(name, ""),
+// fOutputFile(NULL),
+ fESD(NULL),
+ fAOD(NULL),
+ fEventMaker(NULL),
+ fAnalysisType("ESD"),
+ fCFManager1(NULL),
+ fCFManager2(NULL),
+ fQAInt(NULL),
+ fQADiff(NULL),
+ 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, Bool_t on, UInt_t iseed)"<<endl;
+
+ fMyTRandom3 = new TRandom3(iseed);
+ gRandom->SetSeed(fMyTRandom3->Integer(65539));
+
+ // Define input and output slots here
+ // Input slot #0 works with a TChain
+ DefineInput(0, TChain::Class());
+ // Define here the flow event output
+ DefineOutput(0, AliFlowEventSimple::Class());
+ if(on) {
+ DefineOutput(1, TList::Class());
+ DefineOutput(2, TList::Class()); }
+ // and for testing open an output file
+ // fOutputFile = new TFile("FlowEvents.root","RECREATE");
+
+}
+
//________________________________________________________________________
AliAnalysisTaskFlowEvent::~AliAnalysisTaskFlowEvent()
{
//
// Destructor
//
-
+ if (fMyTRandom3) delete fMyTRandom3;
// objects in the output list are deleted
// by the TSelector dtor (I hope)
if (eventHandler) {
mcEvent = eventHandler->MCEvent();
if (mcEvent) {
- //cout<<mcEvent-> GenEventHeader()->GetName()<<endl; //TEST
//COCKTAIL with HIJING
if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"Cocktail Header")) { //returns 0 if matches
AliGenCocktailEventHeader *headerC = dynamic_cast<AliGenCocktailEventHeader *> (mcEvent-> GenEventHeader());
AliGenHijingEventHeader *hdh = dynamic_cast<AliGenHijingEventHeader *> (lhd->At(0));
if (hdh) {
fRP = hdh->ReactionPlaneAngle();
- //cout<<"The reactionPlane from Cocktail + Hijing is: "<< fRP <<endl;
+ //cout<<"The reactionPlane from Hijing is: "<< fRP <<endl;
}
}
}
//else { cout<<"headerH is NULL"<<endl; }
}
}
- else {cout<<"No MC event!"<<endl; } //TEST
+ //else {cout<<"No MC event!"<<endl; }
}
//else {cout<<"No eventHandler!"<<endl; }
// set the value of the monte carlo event plane for the flow event
- fEventMaker->SetMCReactionPlaneAngle(fRP);
+ //RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
+ // paste setters from AliFlowEventSimpleMaker.cxx
+ //RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
+// TRandom3 random3Temp2; //init for manual settings (R.Rietkerk)
+// TTimeStamp dt2;
+// Int_t sseed2 = dt2.GetNanoSec()/1000;
+// random3Temp2.SetSeed(sseed2);
+// cout << "seed2 = " << sseed2 << endl;
+// cout << "random2 = " << random3Temp2.Rndm() << endl;
+ //RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
+ cout << "RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR" << endl;
+ cout << "TaskFlowEvent.cxx" << endl;
+ cout << "fCount" << fCount << endl;
+ cout << "fNoOfLoops" << fNoOfLoops << endl;
+ cout << "fEllipticFlowValue" << fEllipticFlowValue << endl;
+ cout << "fSigmaEllipticFlowValue" << fSigmaEllipticFlowValue << endl;
+ cout << "fMultiplicityOfEvent" << fMultiplicityOfEvent << endl;
+ cout << "fSigmaMultiplicityOfEvent" << fSigmaMultiplicityOfEvent << endl;
+
+ cout << "RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR" << endl;
+ Double_t xRPangle=TMath::TwoPi()*(fMyTRandom3->Rndm());
+ Double_t xNewFlowValue = fMyTRandom3->Gaus(fEllipticFlowValue,fSigmaEllipticFlowValue);
+ Int_t nNewMultOfEvent = fMyTRandom3->Gaus(fMultiplicityOfEvent,fSigmaMultiplicityOfEvent);
+
+ cout << "xRPangle = " << xRPangle << endl;
+ cout << "xNewFlowValue = " << xNewFlowValue << endl;
+ cout << "nNewMultOfEvent = " << nNewMultOfEvent << endl;
+ cout << "RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR" << endl;
+ //Int_t nNewMultOfEvent = random3Temp.Gaus(nMultiplicityOfEvent,nSigmaMult);
+ // cout << "new multiplicity: " << nNewMultOfEvent << endl;
+ //Double_t xNewFlowValue = random3Temp.Gaus(xEllipticFlowValue,xSigmaFlow);
+ // cout << "new flow value: " << xNewFlowValue << endl;
+ //fEventMaker->SetMCReactionPlaneAngle(fRP);
+ fEventMaker->SetMCReactionPlaneAngle(xRPangle);
+ fEventMaker->SetNoOfLoops(fNoOfLoops);
+ fEventMaker->SetEllipticFlowValue(xNewFlowValue);
+ fEventMaker->SetMultiplicityOfEvent(nNewMultOfEvent);
+ //RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
// Fill the FlowEventSimple for MC input
if (fAnalysisType == "MC") {
// analysis
Printf("Number of MC particles: %d", mcEvent->GetNumberOfTracks());
- fEventMaker->SetMinMult(fMinMult);
- fEventMaker->SetMaxMult(fMaxMult);
fEvent = fEventMaker->FillTracks(mcEvent,fCFManager1,fCFManager2);
// here we have the fEvent and want to make it available as an output stream
// so no delete fEvent;
Printf("There are %d tracks in this event", fESD->GetNumberOfTracks());
// analysis
- fEventMaker->SetMinMult(fMinMult);
- fEventMaker->SetMaxMult(fMaxMult);
fEvent = fEventMaker->FillTracks(fESD,fCFManager1,fCFManager2);
}
// Fill the FlowEventSimple for ESD input combined with MC info
fCFManager1->SetEventInfo(mcEvent);
fCFManager2->SetEventInfo(mcEvent);
- fEventMaker->SetMinMult(fMinMult);
- fEventMaker->SetMaxMult(fMaxMult);
+
if (fAnalysisType == "ESDMC0") {
fEvent = fEventMaker->FillTracks(fESD, mcEvent, fCFManager1, fCFManager2, 0); //0 = kine from ESD, 1 = kine from MC
} else if (fAnalysisType == "ESDMC1") {
Printf("There are %d tracks in this event", fAOD->GetNumberOfTracks());
// analysis
- fEventMaker->SetMinMult(fMinMult);
- fEventMaker->SetMaxMult(fMaxMult);
//For the moment don't use CF //AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fAOD,fCFManager1,fCFManager2);
fEvent = fEventMaker->FillTracks(fAOD);
}
// Called once at the end of the query -- do not call in case of CAF
}
+
+
* See cxx source for full Copyright notice */
/* $Id: $ */
-//////////////////////////////////////////////////////
-// AliAnalysisTaskFlowEvent:
-// analysis task to fill the flow event
-// and make it available to the flow analysis methods.
-//////////////////////////////////////////////////////
-
-
#ifndef AliAnalysisTaskFlowEvent_H
#define AliAnalysisTaskFlowEvent_H
+// AliAnalysisTaskFlowEvent:
+// analysis task to fill the flow event and make it available to the methods
+
+
class AliESDEvent;
class AliAODEvent;
class AliCFManager;
class AliFlowEventSimpleMaker;
class TList;
+class TRandom3;
#include "TString.h"
#include "AliAnalysisTask.h"
public:
AliAnalysisTaskFlowEvent();
AliAnalysisTaskFlowEvent(const char *name,Bool_t QAon);
+ AliAnalysisTaskFlowEvent(const char *name,Bool_t QAon,UInt_t);
virtual ~AliAnalysisTaskFlowEvent();
virtual void ConnectInputData(Option_t *);
virtual void Exec(Option_t *option);
virtual void Terminate(Option_t *);
- void SetAnalysisType(TString type){ this->fAnalysisType = type; }
- TString GetAnalysisType() const { return this->fAnalysisType; }
-
- void SetMinMult(Int_t multmin) {this->fMinMult = multmin; }
- Int_t GetMinMult() const {return this->fMinMult; }
- void SetMaxMult(Int_t multmax) {this->fMaxMult = multmax; }
- Int_t GetMaxMult() const {return this->fMaxMult; }
-
+ void SetAnalysisType(TString type) { this->fAnalysisType = type; }
+ TString GetAnalysisType() const { return this->fAnalysisType; }
void SetCFManager1(AliCFManager* cfmgr) {this->fCFManager1 = cfmgr; }
AliCFManager* GetCFManager1() {return this->fCFManager1; }
TList* GetQAList2() {return this->fQADiff; }
void SetQAOn(Bool_t kt) {this->fQA = kt; }
Bool_t GetQAOn() {return this->fQA; }
+ //setters for adding by hand flow values (afterburner)
+ void SetMCReactionPlaneAngle(Double_t fPhiRP) { this->fMCReactionPlaneAngle = fPhiRP; }
+ void SetNoOfLoops(Int_t noofl) {this->fNoOfLoops = noofl;}
+ Int_t GetNoOfLoops() const {return this->fNoOfLoops;}
+ void SetEllipticFlowValue(Double_t elfv) {this->fEllipticFlowValue = elfv;}
+ Double_t GetEllipticFlowValue() const {return this->fEllipticFlowValue;}
+ void SetSigmaEllipticFlowValue(Double_t sigelfv) {this->fSigmaEllipticFlowValue = sigelfv;}
+ Double_t GetSigmaEllipticFlowValue() const {return this->fSigmaEllipticFlowValue;}
+ void SetMultiplicityOfEvent(Int_t multevnt) {this->fMultiplicityOfEvent = multevnt;}
+ Int_t GetMultiplicityOfEvent() const {return this->fMultiplicityOfEvent;}
+ void SetSigmaMultiplicityOfEvent(Int_t sigmultevnt) {this->fSigmaMultiplicityOfEvent = sigmultevnt;}
+ Int_t GetSigmaMultiplicityOfEvent() const {return this->fSigmaMultiplicityOfEvent;}
+ //end setters afterburner
private:
AliAODEvent* fAOD; // AOD object
AliFlowEventSimpleMaker* fEventMaker; // FlowEventSimple maker object
TString fAnalysisType; // can be MC, ESD or AOD
- Int_t fMinMult; // Minimum multiplicity from tracks selected using CORRFW
- Int_t fMaxMult; // Maximum multiplicity from tracks selected using CORRFW
AliCFManager* fCFManager1; // correction framework manager
AliCFManager* fCFManager2; // correction framework manager
TList* fQAInt; // QA histogram list
TList* fQADiff; // QA histogram list
- Bool_t fQA; // flag to set the filling of the QA hostograms
-
+ Bool_t fQA; // flag to set the filling of the QA hostograms
+ // values afterburner
+ Double_t fMCReactionPlaneAngle; // the angle of the reaction plane from the MC truth
+ Int_t fCount; // counter for the number of events processed
+ Int_t fNoOfLoops; // number of times to use the same particle (nonflow)
+ Double_t fEllipticFlowValue; // Add Flow. Must be in range [0,1].
+ Double_t fSigmaEllipticFlowValue; // Sigma Flow (Gaussian). Must be in range [0,1].
+ Int_t fMultiplicityOfEvent; // Set maximal multiplicity.
+ Int_t fSigmaMultiplicityOfEvent; // Sigma multiplicity (Gaussian).
+
+ TRandom3* fMyTRandom3; // our TRandom3 generator
+ // end afterburner
+
ClassDef(AliAnalysisTaskFlowEvent, 1); // example of analysis
};
#endif
+
}
//-----------------------------------------------------------------------
+/*
AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager)
{
//Fills the event from the ESD
}
}
-
+*/
//-----------------------------------------------------------------------
AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager)
{
}
//-----------------------------------------------------------------------
+
+AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager)
+{
+ //Fills the event from the ESD
+
+ //flags for particles passing int. and diff. flow cuts
+ Bool_t bPassedRPFlowCuts = kFALSE;
+ Bool_t bPassedPOIFlowCuts = kFALSE;
+
+ Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
+
+ AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
+
+ Int_t iGoodTracks = 0; //number of good tracks
+ Int_t itrkN = 0; //track counter
+ Int_t iSelParticlesRP = 0; //number of tracks selected for Int
+ Int_t iSelParticlesPOI = 0; //number of tracks selected for Diff
+
+ //normal loop
+ while (itrkN < iNumberOfInputTracks) {
+ AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
+
+ //check if pParticle passes the cuts
+ if (intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
+ intCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
+ bPassedRPFlowCuts = kTRUE;
+ }
+ if (diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
+ diffCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
+ bPassedPOIFlowCuts = kTRUE;
+ }
+
+ if (bPassedRPFlowCuts || bPassedPOIFlowCuts) {
+ for(Int_t d=0;d<fNoOfLoops;d++) {
+ //make new AliFLowTrackSimple
+ AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
+ pTrack->SetPt(pParticle->Pt() );
+ pTrack->SetEta(pParticle->Eta() );
+ pTrack->SetPhi(pParticle->Phi()-fEllipticFlowValue*TMath::Sin(2*(pParticle->Phi()-fMCReactionPlaneAngle)) );
+
+ //marking the particles used for int. flow:
+ if(bPassedRPFlowCuts && iSelParticlesRP < fMultiplicityOfEvent) {
+ pTrack->SetForRPSelection(kTRUE);
+ iSelParticlesRP++;
+ }
+ //marking the particles used for diff. flow:
+ if(bPassedPOIFlowCuts && iGoodTracks%fNoOfLoops==0) {
+ pTrack->SetForPOISelection(kTRUE);
+ iSelParticlesPOI++;
+ }
+ //adding a particles which were used either for int. or diff. flow to the list
+ pEvent->TrackCollection()->Add(pTrack);
+ iGoodTracks++;
+ }//end of for(Int_t d=0;d<iLoops;d++)
+ }//end of if(bPassedIntFlowCuts || bPassedDiffFlowCuts)
+ itrkN++;
+ bPassedRPFlowCuts = kFALSE;
+ bPassedPOIFlowCuts = kFALSE;
+ }//end of while (itrkN < iNumberOfInputTracks)
+
+ pEvent->SetEventNSelTracksRP(iSelParticlesRP);
+ pEvent->SetNumberOfTracks(iGoodTracks);
+ pEvent->SetMCReactionPlaneAngle(fMCReactionPlaneAngle);
+
+ if ( (++fCount % 100) == 0) {
+ if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<< fMCReactionPlaneAngle << endl;
+ else cout<<" MC Reaction Plane Angle = unknown "<< endl;
+ cout<<" iGoodTracks = "<<iGoodTracks<<endl;
+ cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
+ cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;
+ cout << "# " << fCount << " events processed" << endl;
+ }
+
+ return pEvent;
+}
+
+//-----------------------------------------------------------------------
+
AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* anInput)
{
//Fills the event from the AOD