#include "AliGenGeVSimEventHeader.h"
#include "AliGenEposEventHeader.h"
+// Interface to Load short life particles
+#include "TObjArray.h"
+#include "AliFlowCandidateTrack.h"
+
// Interface to make the Flow Event Simple used in the flow analysis methods
#include "AliFlowEvent.h"
#include "AliFlowTrackCuts.h"
fCutsEvent(NULL),
fCutsRP(NULL),
fCutsPOI(NULL),
- fQAInt(NULL),
- fQADiff(NULL),
+ fQAList(NULL),
fMinMult(0),
fMaxMult(10000000),
fMinA(-1.0),
fMaxA(-0.01),
fMinB(0.01),
fMaxB(1.0),
- fQA(kFALSE),
+ fQAon(kFALSE),
+ fLoadCandidates(kFALSE),
fNbinsMult(10000),
fNbinsPt(100),
fNbinsPhi(100),
fEtaMax(5.),
fQMin(0.),
fQMax(3.),
+ fHistWeightvsPhiMin(0.),
+ fHistWeightvsPhiMax(3.),
fExcludedEtaMin(0.),
fExcludedEtaMax(0.),
fExcludedPhiMin(0.),
fV2(0.),
fV3(0.),
fV4(0.),
+ fV5(0.),
+ fFlowEvent(NULL),
fMyTRandom3(NULL)
{
// Constructor
}
//________________________________________________________________________
-AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent(const char *name, TString RPtype, Bool_t on, UInt_t iseed) :
+AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent(const char *name, TString RPtype, Bool_t on, UInt_t iseed, Bool_t bCandidates) :
AliAnalysisTaskSE(name),
// fOutputFile(NULL),
fAnalysisType("AUTOMATIC"),
fCutsEvent(NULL),
fCutsRP(NULL),
fCutsPOI(NULL),
- fQAInt(NULL),
- fQADiff(NULL),
+ fQAList(NULL),
fMinMult(0),
fMaxMult(10000000),
fMinA(-1.0),
fMaxA(-0.01),
fMinB(0.01),
fMaxB(1.0),
- fQA(on),
+ fQAon(on),
+ fLoadCandidates(bCandidates),
fNbinsMult(10000),
fNbinsPt(100),
fNbinsPhi(100),
fEtaMax(5.),
fQMin(0.),
fQMax(3.),
+ fHistWeightvsPhiMin(0.),
+ fHistWeightvsPhiMax(3.),
fExcludedEtaMin(0.),
fExcludedEtaMax(0.),
fExcludedPhiMin(0.),
fV2(0.),
fV3(0.),
fV4(0.),
+ fV5(0.),
+ fFlowEvent(NULL),
fMyTRandom3(NULL)
{
// Constructor
fMyTRandom3 = new TRandom3(iseed);
gRandom->SetSeed(fMyTRandom3->Integer(65539));
+ int availableINslot=1;
//FMD input slot
if (strcmp(RPtype,"FMD")==0) {
- DefineInput(1, TList::Class());
+ DefineInput(availableINslot++, TList::Class());
}
+ //Candidates input slot
+ if( fLoadCandidates )
+ DefineInput(availableINslot, TObjArray::Class());
// Define output slots here
// Define here the flow event output
DefineOutput(1, AliFlowEventSimple::Class());
- if(on)
- {
- DefineOutput(2, TList::Class());
- DefineOutput(3, TList::Class());
- }
+ DefineOutput(2, TList::Class());
+
// and for testing open an output file
// fOutputFile = new TFile("FlowEvents.root","RECREATE");
//
// Destructor
//
- if (fMyTRandom3) delete fMyTRandom3;
+ delete fMyTRandom3;
+ delete fFlowEvent;
+ delete fCutsEvent;
+ delete fCutsRP;
+ delete fCutsPOI;
+ delete fQAList;
// objects in the output list are deleted
// by the TSelector dtor (I hope)
}
+//________________________________________________________________________
+void AliAnalysisTaskFlowEvent::NotifyRun()
+{
+ //at the beginning of each new run
+ AliESDEvent* fESD = dynamic_cast<AliESDEvent*> (InputEvent());
+ if (!fESD) return;
+
+ Int_t run = fESD->GetRunNumber();
+ AliInfo(Form("Stariting run #%i",run));
+}
+
//________________________________________________________________________
void AliAnalysisTaskFlowEvent::UserCreateOutputObjects()
{
cc->SetEtaMax(fEtaMax);
cc->SetQMin(fQMin);
cc->SetQMax(fQMax);
+ cc->SetHistWeightvsPhiMax(fHistWeightvsPhiMax);
+ cc->SetHistWeightvsPhiMin(fHistWeightvsPhiMin);
+ fFlowEvent = new AliFlowEvent(3000);
+
+ if (fQAon)
+ {
+ fQAList=new TList();
+ fQAList->SetOwner();
+ fQAList->SetName(Form("%s QA",GetName()));
+ if (fCutsEvent->GetQA()) fQAList->Add(fCutsEvent->GetQA()); //0
+ if (fCutsRP->GetQA()) fQAList->Add(fCutsRP->GetQA()); //1
+ if (fCutsPOI->GetQA())fQAList->Add(fCutsPOI->GetQA()); //2
+ fQAList->Add(new TH1F("event plane angle","event plane angle;angle [rad];",100,0.,TMath::TwoPi())); //3
+ PostData(2,fQAList);
+ }
}
//________________________________________________________________________
{
// Main loop
// Called for each event
- AliFlowEvent* flowEvent = NULL;
+ //delete fFlowEvent;
AliMCEvent* mcEvent = MCEvent(); // from TaskSE
AliESDEvent* myESD = dynamic_cast<AliESDEvent*>(InputEvent()); // from TaskSE
AliAODEvent* myAOD = dynamic_cast<AliAODEvent*>(InputEvent()); // from TaskSE
AliMultiplicity* myTracklets = NULL;
AliESDPmdTrack* pmdtracks = NULL;//pmd
- TH2F* histFMD = NULL;
- if(GetNinputs()==2) {
- TList* FMDdata = dynamic_cast<TList*>(GetInputData(1));
- if(!FMDdata) {
- cout<<" No FMDdata "<<endl;
- exit(2);
- }
- histFMD = dynamic_cast<TH2F*>(FMDdata->FindObject("dNdetadphiHistogramTrVtx"));
- if (!histFMD) {
- cout<< "No histFMD"<<endl;
- exit(2);
- }
+ int availableINslot=1;
+
+ if (!(fCutsRP&&fCutsPOI&&fCutsEvent))
+ {
+ AliError("cuts not set");
+ return;
}
-
- //use the new and temporarily inclomplete way of doing things
+
+ //DEFAULT - automatically takes care of everything
if (fAnalysisType == "AUTOMATIC")
{
- if (!(fCutsRP&&fCutsPOI))
- {
- AliError("cuts not set");
- return;
- }
- if (fCutsEvent)
- {
- if (!fCutsEvent->IsSelected(InputEvent())) return;
- }
+ //check event cuts
+ if (InputEvent() && !fCutsEvent->IsSelected(InputEvent())) return;
//first attach all possible information to the cuts
- fCutsRP->SetEvent( InputEvent() ); //attach event
- fCutsRP->SetMCevent( MCEvent() ); //attach mc truth
- fCutsPOI->SetEvent( InputEvent() );
- fCutsPOI->SetMCevent( MCEvent() );
+ fCutsRP->SetEvent( InputEvent(), MCEvent() ); //attach event
+ fCutsPOI->SetEvent( InputEvent(), MCEvent() );
+
//then make the event
- flowEvent = new AliFlowEvent( fCutsRP, fCutsPOI );
+ fFlowEvent->Fill( fCutsRP, fCutsPOI );
+ //fFlowEvent = new AliFlowEvent( fCutsRP, fCutsPOI );
+
if (myESD)
- flowEvent->SetReferenceMultiplicity(fCutsEvent->GetReferenceMultiplicity(InputEvent()));
- if (mcEvent && mcEvent->GenEventHeader()) flowEvent->SetMCReactionPlaneAngle(mcEvent);
+ fFlowEvent->SetReferenceMultiplicity(fCutsEvent->GetReferenceMultiplicity(InputEvent()));
+ if (mcEvent && mcEvent->GenEventHeader()) fFlowEvent->SetMCReactionPlaneAngle(mcEvent);
}
// Make the FlowEvent for MC input
- if (fAnalysisType == "MC")
+ else if (fAnalysisType == "MC")
{
// Process MC truth, therefore we receive the AliAnalysisManager and ask it for the AliMCEventHandler
// This handler can return the current MC event
AliWarning("Event does not pass multiplicity cuts"); return;
}
//make event
- flowEvent = new AliFlowEvent(mcEvent,fCFManager1,fCFManager2);
+ fFlowEvent = new AliFlowEvent(mcEvent,fCFManager1,fCFManager2);
}
// Make the FlowEvent for ESD input
//make event
if (fRPType == "Global") {
- flowEvent = new AliFlowEvent(myESD,fCFManager1,fCFManager2);
+ fFlowEvent = new AliFlowEvent(myESD,fCFManager1,fCFManager2);
}
- if (fRPType == "TPCOnly") {
- flowEvent = new AliFlowEvent(myESD,fCFManager2,kFALSE);
+ else if (fRPType == "TPCOnly") {
+ fFlowEvent = new AliFlowEvent(myESD,fCFManager2,kFALSE);
}
- if (fRPType == "TPCHybrid") {
- flowEvent = new AliFlowEvent(myESD,fCFManager2,kTRUE);
+ else if (fRPType == "TPCHybrid") {
+ fFlowEvent = new AliFlowEvent(myESD,fCFManager2,kTRUE);
}
else if (fRPType == "Tracklet"){
- flowEvent = new AliFlowEvent(myESD,myTracklets,fCFManager2);
+ fFlowEvent = new AliFlowEvent(myESD,myTracklets,fCFManager2);
}
else if (fRPType == "FMD"){
- flowEvent = new AliFlowEvent(myESD,histFMD,fCFManager2);
+ TList* FMDdata = dynamic_cast<TList*>(GetInputData(availableINslot++));
+ if(!FMDdata) {
+ cout<<" No FMDdata "<<endl;
+ return;
+ }
+ TH2F* histFMD = dynamic_cast<TH2F*>(FMDdata->FindObject("dNdetadphiHistogramTrVtx"));
+ if (!histFMD) {
+ cout<< "No histFMD"<<endl;
+ return;
+ }
+ fFlowEvent = new AliFlowEvent(myESD,histFMD,fCFManager2);
}
- //pmd
else if (fRPType == "PMD"){
- flowEvent = new AliFlowEvent(myESD,pmdtracks,fCFManager2);
+ fFlowEvent = new AliFlowEvent(myESD,pmdtracks,fCFManager2);
}
- //pmd
+ else return;
// if monte carlo event get reaction plane from monte carlo (depends on generator)
- if (mcEvent && mcEvent->GenEventHeader()) flowEvent->SetMCReactionPlaneAngle(mcEvent);
+ if (mcEvent && mcEvent->GenEventHeader()) fFlowEvent->SetMCReactionPlaneAngle(mcEvent);
//set reference multiplicity, TODO: maybe move it to the constructor?
- flowEvent->SetReferenceMultiplicity(AliESDtrackCuts::GetReferenceMultiplicity(myESD,kTRUE));
+ fFlowEvent->SetReferenceMultiplicity(AliESDtrackCuts::GetReferenceMultiplicity(myESD,kTRUE));
}
// Make the FlowEvent for ESD input combined with MC info
//make event
if (fAnalysisType == "ESDMCkineESD")
{
- flowEvent = new AliFlowEvent(myESD, mcEvent, AliFlowEvent::kESDkine, fCFManager1, fCFManager2 );
+ fFlowEvent = new AliFlowEvent(myESD, mcEvent, AliFlowEvent::kESDkine, fCFManager1, fCFManager2 );
}
else if (fAnalysisType == "ESDMCkineMC")
{
- flowEvent = new AliFlowEvent(myESD, mcEvent, AliFlowEvent::kMCkine, fCFManager1, fCFManager2 );
+ fFlowEvent = new AliFlowEvent(myESD, mcEvent, AliFlowEvent::kMCkine, fCFManager1, fCFManager2 );
}
+ if (!fFlowEvent) return;
// if monte carlo event get reaction plane from monte carlo (depends on generator)
- if (mcEvent && mcEvent->GenEventHeader()) flowEvent->SetMCReactionPlaneAngle(mcEvent);
+ if (mcEvent && mcEvent->GenEventHeader()) fFlowEvent->SetMCReactionPlaneAngle(mcEvent);
//set reference multiplicity, TODO: maybe move it to the constructor?
- flowEvent->SetReferenceMultiplicity(AliESDtrackCuts::GetReferenceMultiplicity(myESD,kTRUE));
+ fFlowEvent->SetReferenceMultiplicity(AliESDtrackCuts::GetReferenceMultiplicity(myESD,kTRUE));
}
// Make the FlowEventSimple for AOD input
else if (fAnalysisType == "AOD")
return;
}
AliInfo(Form("AOD has %d tracks", myAOD->GetNumberOfTracks()));
- flowEvent = new AliFlowEvent(myAOD);
+ fFlowEvent = new AliFlowEvent(myAOD);
+ }
+
+ //inject candidates
+ if(fLoadCandidates) {
+ TObjArray* Candidates = dynamic_cast<TObjArray*>(GetInputData(availableINslot++));
+ //if(Candidates->GetEntriesFast())
+ //printf("I received %d candidates\n",Candidates->GetEntriesFast());
+ if (Candidates)
+ {
+ for(int iCand=0; iCand!=Candidates->GetEntriesFast(); ++iCand ) {
+ AliFlowCandidateTrack *cand = dynamic_cast<AliFlowCandidateTrack*>(Candidates->At(iCand));
+ if (!cand) continue;
+ cand->SetForPOISelection(kTRUE);
+ cand->SetForRPSelection(kFALSE);
+ //printf(" Ⱶ Checking at candidate %d with %d daughters\n",iCand,cand->GetNDaughters());
+ for(int iDau=0; iDau!=cand->GetNDaughters(); ++iDau) {
+ //printf(" Ⱶ Daughter %d with fID %d", iDau, cand->GetIDDaughter(iDau) );
+ for(int iRPs=0; iRPs!=fFlowEvent->NumberOfTracks(); ++iRPs ) {
+ AliFlowTrack *iRP = dynamic_cast<AliFlowTrack*>(fFlowEvent->GetTrack( iRPs ));
+ if (!iRP) continue;
+ if( !iRP->InRPSelection() )
+ continue;
+ if( cand->GetIDDaughter(iDau) == iRP->GetID() ) {
+ //printf(" was in RP set");
+ cand->SetDaughter( iDau, iRP );
+ //temporarily untagging all daugters
+ iRP->SetForRPSelection(kFALSE);
+ }
+ }
+ //printf("\n");
+ }
+ fFlowEvent->AddTrack(cand);
+ }
+ }
}
+ if (!fFlowEvent) return; //shuts up coverity
+
//check final event cuts
- Int_t mult = flowEvent->NumberOfTracks();
+ Int_t mult = fFlowEvent->NumberOfTracks();
AliInfo(Form("FlowEvent has %i tracks",mult));
if (mult<fMinMult || mult>fMaxMult)
{
}
//define dead zone
- flowEvent->DefineDeadZone(fExcludedEtaMin, fExcludedEtaMax, fExcludedPhiMin, fExcludedPhiMax );
+ fFlowEvent->DefineDeadZone(fExcludedEtaMin, fExcludedEtaMax, fExcludedPhiMin, fExcludedPhiMax );
//////////////////////////////////////////////////////////////////////////////
if (fAfterburnerOn)
{
//if reaction plane not set from elsewhere randomize it before adding flow
- if (!flowEvent->IsSetMCReactionPlaneAngle())
- flowEvent->SetMCReactionPlaneAngle(gRandom->Uniform(0.0,TMath::TwoPi()));
+ if (!fFlowEvent->IsSetMCReactionPlaneAngle())
+ fFlowEvent->SetMCReactionPlaneAngle(gRandom->Uniform(0.0,TMath::TwoPi()));
- flowEvent->AddFlow(fV1,fV2,fV3,fV4); //add flow
- flowEvent->CloneTracks(fNonFlowNumberOfTrackClones); //add nonflow by cloning tracks
+ fFlowEvent->AddFlow(fV1,fV2,fV3,fV4,fV5); //add flow
+ fFlowEvent->CloneTracks(fNonFlowNumberOfTrackClones); //add nonflow by cloning tracks
}
//////////////////////////////////////////////////////////////////////////////
//tag subEvents
- flowEvent->TagSubeventsInEta(fMinA,fMaxA,fMinB,fMaxB);
+ fFlowEvent->TagSubeventsInEta(fMinA,fMaxA,fMinB,fMaxB);
- //fListHistos->Print();
- //fOutputFile->WriteObject(flowEvent,"myFlowEventSimple");
- PostData(1,flowEvent);
- if (fQA)
+ //QA
+ if (fQAon)
{
- PostData(2,fQAInt);
- PostData(3,fQADiff);
+ TH1* h1 = static_cast<TH1*>(fQAList->At(3));
+ h1->Fill(fFlowEvent->GetMCReactionPlaneAngle());
}
+
+ //fListHistos->Print();
+ //fOutputFile->WriteObject(fFlowEvent,"myFlowEventSimple");
+ PostData(1,fFlowEvent);
}
//________________________________________________________________________
// Called once at the end of the query -- do not call in case of CAF
}
-