From 6e214c87c29d8c0cb583ad0797dd4c212cf48042 Mon Sep 17 00:00:00 2001 From: snelling Date: Sun, 26 Dec 2010 21:24:31 +0000 Subject: [PATCH] modifications and additional classes for nonprimary particle flow --- .../FLOW/AliFlowCommon/AliFlowTrackSimple.cxx | 13 +- PWG2/FLOW/AliFlowCommon/AliFlowTrackSimple.h | 3 + .../AliFlowTasks/AliAnalysisTaskFlowEvent.cxx | 31 +- .../AliFlowTasks/AliAnalysisTaskFlowEvent.h | 3 +- .../AliAnalysisTaskFlowK0Candidates.cxx | 229 ++++++++++ .../AliAnalysisTaskFlowK0Candidates.h | 45 ++ .../AliFlowTasks/AliFlowCandidateTrack.cxx | 39 ++ .../FLOW/AliFlowTasks/AliFlowCandidateTrack.h | 37 ++ PWG2/FLOW/AliFlowTasks/AliFlowTrackCuts.cxx | 5 +- PWG2/FLOW/AliFlowTasks/AliFlowTrackCuts.h | 2 +- .../runFlowTaskCentralityTrain4Candidates.C | 413 ++++++++++++++++++ PWG2/PWG2flowTasksLinkDef.h | 2 + PWG2/libPWG2flowTasks.pkg | 2 + 13 files changed, 813 insertions(+), 11 deletions(-) create mode 100644 PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowK0Candidates.cxx create mode 100644 PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowK0Candidates.h create mode 100644 PWG2/FLOW/AliFlowTasks/AliFlowCandidateTrack.cxx create mode 100644 PWG2/FLOW/AliFlowTasks/AliFlowCandidateTrack.h create mode 100644 PWG2/FLOW/macros/runFlowTaskCentralityTrain4Candidates.C diff --git a/PWG2/FLOW/AliFlowCommon/AliFlowTrackSimple.cxx b/PWG2/FLOW/AliFlowCommon/AliFlowTrackSimple.cxx index 0a3598f9398..08ed0278dc7 100644 --- a/PWG2/FLOW/AliFlowCommon/AliFlowTrackSimple.cxx +++ b/PWG2/FLOW/AliFlowCommon/AliFlowTrackSimple.cxx @@ -40,7 +40,8 @@ AliFlowTrackSimple::AliFlowTrackSimple(): fTrackWeight(1.), fCharge(0), fFlowBits(0), - fSubEventBits(0) + fSubEventBits(0), + fCollIndex(-1) { //constructor } @@ -54,7 +55,8 @@ AliFlowTrackSimple::AliFlowTrackSimple(Double_t phi, Double_t eta, Double_t pt, fTrackWeight(weight), fCharge(charge), fFlowBits(0), - fSubEventBits(0) + fSubEventBits(0), + fCollIndex(-1) { //constructor } @@ -68,7 +70,8 @@ AliFlowTrackSimple::AliFlowTrackSimple( TParticle* p ): fTrackWeight(1.), fCharge(0), fFlowBits(0), - fSubEventBits(0) + fSubEventBits(0), + fCollIndex(-1) { //ctor TParticlePDG* ppdg = p->GetPDG(); @@ -84,7 +87,8 @@ AliFlowTrackSimple::AliFlowTrackSimple(const AliFlowTrackSimple& aTrack): fTrackWeight(aTrack.fTrackWeight), fCharge(aTrack.fCharge), fFlowBits(aTrack.fFlowBits), - fSubEventBits(aTrack.fSubEventBits) + fSubEventBits(aTrack.fSubEventBits), + fCollIndex(-1) { //copy constructor } @@ -106,6 +110,7 @@ AliFlowTrackSimple& AliFlowTrackSimple::operator=(const AliFlowTrackSimple& aTra fCharge = aTrack.fCharge; fFlowBits = aTrack.fFlowBits; fSubEventBits = aTrack.fSubEventBits; + fCollIndex = aTrack.fCollIndex; return *this; } diff --git a/PWG2/FLOW/AliFlowCommon/AliFlowTrackSimple.h b/PWG2/FLOW/AliFlowCommon/AliFlowTrackSimple.h index e1cb5bb5068..fde228c974c 100644 --- a/PWG2/FLOW/AliFlowCommon/AliFlowTrackSimple.h +++ b/PWG2/FLOW/AliFlowCommon/AliFlowTrackSimple.h @@ -82,6 +82,8 @@ public: const TBits* GetFlowBits() const {return &fFlowBits;} + void SetIndexOnCollection(int i) {fCollIndex=i;} + private: AliFlowTrackSimple(Double_t phi, Double_t eta, Double_t pt, Double_t weight, Int_t charge); Double_t fEta; // eta @@ -91,6 +93,7 @@ public: Int_t fCharge; //charge TBits fFlowBits; // bits to set if track is selected TBits fSubEventBits;// bits to set if track is selected for a subevent + Int_t fCollIndex; // stores the relative position of the track in the original collection ClassDef(AliFlowTrackSimple,1) // macro for rootcint diff --git a/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.cxx b/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.cxx index f1e7225a17f..3dcefc82c77 100644 --- a/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.cxx +++ b/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.cxx @@ -60,6 +60,10 @@ #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" @@ -96,6 +100,7 @@ AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent() : fMinB(0.01), fMaxB(1.0), fQA(kFALSE), + fLoadCandidates(kFALSE), fNbinsMult(10000), fNbinsPt(100), fNbinsPhi(100), @@ -132,7 +137,7 @@ AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent() : } //________________________________________________________________________ -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"), @@ -151,6 +156,7 @@ AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent(const char *name, TString RPt fMinB(0.01), fMaxB(1.0), fQA(on), + fLoadCandidates(bCandidates), fNbinsMult(10000), fNbinsPt(100), fNbinsPhi(100), @@ -187,10 +193,14 @@ AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent(const char *name, TString RPt 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()); //PID fESDpid=new AliESDpid(); @@ -204,6 +214,7 @@ AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent(const char *name, TString RPt DefineOutput(2, TList::Class()); DefineOutput(3, TList::Class()); } + // and for testing open an output file // fOutputFile = new TFile("FlowEvents.root","RECREATE"); @@ -309,8 +320,9 @@ void AliAnalysisTaskFlowEvent::UserExec(Option_t *) AliESDPmdTrack* pmdtracks = NULL;//pmd TH2F* histFMD = NULL; - if(GetNinputs()==2) { - TList* FMDdata = dynamic_cast(GetInputData(1)); + int availableINslot=1; + if(strcmp(fRPType,"FMD")==0) { + TList* FMDdata = dynamic_cast(GetInputData(availableINslot++)); if(!FMDdata) { cout<<" No FMDdata "<(GetInputData(availableINslot++)); + AliFlowCandidateTrack *cand; + for(int iCand=0; iCand!=Candidates->GetEntriesFast(); ++iCand ) { + cand = dynamic_cast(Candidates->At(iCand)); + cand->SetForPOISelection(); + flowEvent->AddTrack(cand); + } + } + //check final event cuts Int_t mult = flowEvent->NumberOfTracks(); AliInfo(Form("FlowEvent has %i tracks",mult)); diff --git a/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.h b/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.h index f8fa3a2cd99..8bdcb2d2411 100644 --- a/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.h +++ b/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.h @@ -26,7 +26,7 @@ class AliTOFT0maker; class AliAnalysisTaskFlowEvent : public AliAnalysisTaskSE { public: AliAnalysisTaskFlowEvent(); - AliAnalysisTaskFlowEvent(const char *name, TString RPtype, Bool_t QAon, UInt_t seed=666); + AliAnalysisTaskFlowEvent(const char *name, TString RPtype, Bool_t QAon, UInt_t seed=666, Bool_t bCandidates=kFALSE); virtual ~AliAnalysisTaskFlowEvent(); virtual void UserCreateOutputObjects(); @@ -128,6 +128,7 @@ class AliAnalysisTaskFlowEvent : public AliAnalysisTaskSE { Double_t fMaxB; // Maximum of eta range for subevent B Bool_t fQA; // flag to set the filling of the QA hostograms + Bool_t fLoadCandidates; // true if reciving candidates collection // setters for common constants //histogram sizes diff --git a/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowK0Candidates.cxx b/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowK0Candidates.cxx new file mode 100644 index 00000000000..833b6db725f --- /dev/null +++ b/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowK0Candidates.cxx @@ -0,0 +1,229 @@ +/************************************************************************* +* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. * +* * +* Author: The ALICE Off-line Project. * +* Contributors are mentioned in the code where appropriate. * +* * +* Permission to use, copy, modify and distribute this software and its * +* documentation strictly for non-commercial purposes is hereby granted * +* without fee, provided that the above copyright notice appears in all * +* copies and that both the copyright notice and this permission notice * +* appear in the supporting documentation. The authors make no claims * +* about the suitability of this software for any purpose. It is * +* provided "as is" without express or implied warranty. * +**************************************************************************/ + +///////////////////////////////////////////////////// +// AliAnalysisTaskFlowK0Candidates: +// Analysis task to select K0 candidates for flow analysis. +// Uses one AliESDtrackCuts object for both daughters and +// QA histograms to monitor the reconstruction. +// Author: Carlos Perez (cperez@cern.ch) +////////////////////////////////////////////////////// + +#include "TChain.h" +#include "TList.h" +#include "TH1D.h" +#include "TVector3.h" + +#include "AliAnalysisTaskSE.h" +#include "AliAnalysisManager.h" + +#include "AliESDEvent.h" +#include "AliESDInputHandler.h" +#include "AliESDtrack.h" +#include "AliESDtrackCuts.h" + +#include "AliAODEvent.h" +#include "AliAODInputHandler.h" +#include "AliAODTrack.h" + +#include "AliCFManager.h" + +#include "TObjArray.h" +#include "AliFlowCandidateTrack.h" +#include "AliFlowEventCuts.h" + +#include "AliAnalysisTaskFlowK0Candidates.h" + + +ClassImp(AliAnalysisTaskFlowK0Candidates) + +//_____________________________________________________________________________ +AliAnalysisTaskFlowK0Candidates::AliAnalysisTaskFlowK0Candidates() : + AliAnalysisTaskSE(), + fCutsEvent(NULL), + fCuts(NULL), + fList(NULL), + fMass(NULL), + fDCA(NULL), + fDL(NULL), + fCTP(NULL), + fMassF(NULL), + fDCAF(NULL), + fDLF(NULL), + fCTPF(NULL), + fMassMin(0), + fMassMax(0) +{ +} + +//_____________________________________________________________________________ +AliAnalysisTaskFlowK0Candidates::AliAnalysisTaskFlowK0Candidates(const char *name, AliFlowEventCuts *cutsEvent, AliESDtrackCuts *cuts, Double_t MassMin, Double_t MassMax) : + AliAnalysisTaskSE(name), + fCutsEvent(cutsEvent), + fCuts(cuts), + fList(NULL), + fMass(NULL), + fDCA(NULL), + fDL(NULL), + fCTP(NULL), + fMassF(NULL), + fDCAF(NULL), + fDLF(NULL), + fCTPF(NULL), + fMassMin(MassMin), + fMassMax(MassMax) +{ + DefineInput( 0, TChain::Class() ); + DefineOutput( 1, TObjArray::Class() ); + DefineOutput( 2, TList::Class() ); +} + +//_____________________________________________________________________________ +AliAnalysisTaskFlowK0Candidates::~AliAnalysisTaskFlowK0Candidates() +{ + if(fList) { + fList->Delete(); + delete fList; + } +} + +//_____________________________________________________________________________ +void AliAnalysisTaskFlowK0Candidates::UserCreateOutputObjects() +{ + fList = new TList(); + fList->SetOwner(); + fMass = new TH1D( "fMass","Mass;M_{#pi#pi} [GeV];Counts per MeV", 180, 0.41, 0.59); fList->Add( fMass ); + fDCA = new TH1D( "fDCA" ,"DCA;[cm];Counts per 10 um", 180, 0.00, 0.18); fList->Add( fDCA ); + fDL = new TH1D( "fDL" ,"Decay Length;[cm];Counts per 0.1 mm", 180, 0.00, 1.80); fList->Add( fDL ); + fCTP = new TH1D( "fCTP" ,"Cos#theta_{p}", 180,-1.10, 1.10); fList->Add( fCTP ); + + fMassF= new TH1D( "fMassF","Mass after Cuts;M_{#pi#pi} [GeV];Counts per MeV", 180, 0.41, 0.59); fList->Add( fMassF ); + fDCAF = new TH1D( "fDCAF" ,"DCA after Cuts;[cm];Counts per 10 um", 180, 0.00, 0.18); fList->Add( fDCAF ); + fDLF = new TH1D( "fDLF" ,"Decay Length after Cuts;[cm];Counts per 0.1 mm", 180, 0.00, 1.80); fList->Add( fDLF ); + fCTPF = new TH1D( "fCTPF" ,"Cos#theta_{p} after Cuts", 180,-1.10, 1.10); fList->Add( fCTPF ); + + PostData( 2, fList); +} + + +//_____________________________________________________________________________ +void AliAnalysisTaskFlowK0Candidates::NotifyRun() +{ + AliESDEvent *fESD = dynamic_cast(InputEvent()); + if(!fESD) return; +} + +//_____________________________________________________________________________ +void AliAnalysisTaskFlowK0Candidates::UserExec(Option_t *) +{ + AliESDEvent *fESD = dynamic_cast(fInputEvent); + if(!fESD) return; + if(fCutsEvent) + if( !(fCutsEvent->IsSelected(InputEvent())) ) return; + + TObjArray *POIselection = new TObjArray(); + POIselection->SetOwner(); + + int nTracks = fESD->GetNumberOfTracks(); + for(int i=0; i!=nTracks; ++i) { // first particle + AliESDtrack *ioT = fESD->GetTrack(i); + if(fCuts) + if( !(fCuts->IsSelected(ioT)) ) + continue; + for(int j=i+1; j!=nTracks; ++j) { // second particle + AliESDtrack *joT = fESD->GetTrack(j); + if( (ioT->Charge()*joT->Charge()) > 0 ) // only keeping opposite signs + continue; + if(fCuts) + if( !(fCuts->IsSelected(joT)) ) + continue; + AliESDtrack *iT = new AliESDtrack(*ioT); + AliESDtrack *jT = new AliESDtrack(*joT); + // getting distance of closest approach + double DCA = iT->PropagateToDCA(jT,fESD->GetMagneticField()); + fDCA->Fill( DCA ); + // getting decay length + double DL; + double vx = fESD->GetPrimaryVertex()->GetX(); + double vy = fESD->GetPrimaryVertex()->GetY(); + double vz = fESD->GetPrimaryVertex()->GetZ(); + double px = (iT->Xv()+jT->Xv())/2; + double py = (iT->Yv()+jT->Yv())/2; + double pz = (iT->Zv()+jT->Zv())/2; + DL = (vx-px)*(vx-px); + DL += (vy-py)*(vy-py); + DL += (vz-pz)*(vz-pz); + DL = sqrt(DL); + fDL->Fill( DL ); + // cos pointing angle + double CTP; + TVector3 vi, vj, vs, vp; + vi = TVector3( iT->Px(), iT->Py(), iT->Pz() ); + vj = TVector3( jT->Px(), jT->Py(), jT->Pz() ); + vs = vi + vj; + vp = TVector3( px, py, pz ); + CTP = TMath::Cos( vp.Angle(vs) ); + fCTP->Fill(CTP); + + // getting invariant mass + double sum12 = iT->P()*iT->P()+jT->P()*jT->P(); + double pro12 = iT->P()*iT->P()*jT->P()*jT->P(); + double InvMass = 0; + InvMass += TMath::Power(0.13957018,2); + InvMass += sqrt( TMath::Power(0.13957018,4) + TMath::Power(0.13957018,2)*(sum12) + pro12 ); + InvMass -= ( iT->Px()*jT->Px()+iT->Py()*jT->Py()+iT->Pz()*jT->Pz() ); + InvMass *= 2; + InvMass = sqrt(InvMass); + fMass->Fill( InvMass ); + + // evaluating cuts + bool bW = (InvMass>fMassMin) && (InvMass0.95); + bool bDCA = (DCA<0.05); + bool bDL = (DL>2.5); + if( (!bW) || (!bDCA) || (!bDL) || (!bCTP) ) { + delete iT; + delete jT; + continue; + } + fDCAF->Fill( DCA ); + fDLF->Fill( DL ); + fCTPF->Fill(CTP); + fMassF->Fill( InvMass ); + + AliFlowCandidateTrack *sTrack = new AliFlowCandidateTrack(); + //booking pt of selected candidates + sTrack->SetMass( InvMass ); + sTrack->SetPt( vs.Pt() ); + sTrack->SetPhi( vs.Phi() ); + sTrack->SetEta( vs.Eta() ); + sTrack->SetCharge( 0 ); + sTrack->AddDaughter( i ); + sTrack->AddDaughter( j ); + //saving selected candidate + POIselection->AddLast( sTrack ); + delete iT; + delete jT; + } + } + PostData( 1, POIselection ); + PostData( 2, fList); +} + +//_____________________________________________________________________________ +void AliAnalysisTaskFlowK0Candidates::Terminate(Option_t *) +{ +} + diff --git a/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowK0Candidates.h b/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowK0Candidates.h new file mode 100644 index 00000000000..a144d7d25f8 --- /dev/null +++ b/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowK0Candidates.h @@ -0,0 +1,45 @@ +///////////////////////////////////////////////////// +// AliAnalysisTaskFlowK0Candidates: +// Analysis task to select K0 candidates for flow analysis. +// Author: Carlos Perez (cperez@cern.ch) +////////////////////////////////////////////////////// + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * +* See cxx source for full Copyright notice */ +/* $Id: $ */ + +#ifndef AliAnalysisTaskFlowK0Candidates_H +#define AliAnalysisTaskFlowK0Candidates_H + +#include "AliAnalysisTaskSE.h" + +class AliESDtrackCuts; +class AliFlowEventCuts; +class TList; +class TH1D; + +class AliAnalysisTaskFlowK0Candidates : public AliAnalysisTaskSE { + private: + AliAnalysisTaskFlowK0Candidates(const AliAnalysisTaskFlowK0Candidates& analysisTask); + AliAnalysisTaskFlowK0Candidates& operator=(const AliAnalysisTaskFlowK0Candidates& analysisTask); + + AliFlowEventCuts *fCutsEvent; // cuts for event + AliESDtrackCuts *fCuts; // cuts for both pis + TList *fList; + TH1D *fMass, *fDCA, *fDL, *fCTP; + TH1D *fMassF, *fDCAF, *fDLF, *fCTPF; + Double_t fMassMin, fMassMax; // Mass cutting range + + public: + AliAnalysisTaskFlowK0Candidates(); + AliAnalysisTaskFlowK0Candidates(const char *name, AliFlowEventCuts *cutsEvent, AliESDtrackCuts *cuts, Double_t MassMin, Double_t MassMax); + virtual ~AliAnalysisTaskFlowK0Candidates(); + virtual void UserCreateOutputObjects(); + virtual void UserExec(Option_t *); + virtual void Terminate(Option_t *); + virtual void NotifyRun(); + + ClassDef(AliAnalysisTaskFlowK0Candidates, 1); // example of analysis +}; + +#endif diff --git a/PWG2/FLOW/AliFlowTasks/AliFlowCandidateTrack.cxx b/PWG2/FLOW/AliFlowTasks/AliFlowCandidateTrack.cxx new file mode 100644 index 00000000000..443ead56020 --- /dev/null +++ b/PWG2/FLOW/AliFlowTasks/AliFlowCandidateTrack.cxx @@ -0,0 +1,39 @@ +/************************************************************************* +* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. * +* * +* Author: The ALICE Off-line Project. * +* Contributors are mentioned in the code where appropriate. * +* * +* Permission to use, copy, modify and distribute this software and its * +* documentation strictly for non-commercial purposes is hereby granted * +* without fee, provided that the above copyright notice appears in all * +* copies and that both the copyright notice and this permission notice * +* appear in the supporting documentation. The authors make no claims * +* about the suitability of this software for any purpose. It is * +* provided "as is" without express or implied warranty. * +**************************************************************************/ + +//////////////////////////////////////////////////// +// AliFlowCandidateTrack: +// Class for reconstructed particles to be used in flow analysis +// Author: Carlos Perez (cperez@cern.ch) +//////////////////////////////////////////////////// + +#include "AliFlowCandidateTrack.h" + +ClassImp(AliFlowCandidateTrack) + +AliFlowCandidateTrack::AliFlowCandidateTrack(): + AliFlowTrack(), + fMass(0), + fNDaughters(0) +{ + for(int i=0; i!=5; ++i) + fDaughter[i] = -1; +} + + +AliFlowCandidateTrack::~AliFlowCandidateTrack() +{ +} + diff --git a/PWG2/FLOW/AliFlowTasks/AliFlowCandidateTrack.h b/PWG2/FLOW/AliFlowTasks/AliFlowCandidateTrack.h new file mode 100644 index 00000000000..5603c9f71fd --- /dev/null +++ b/PWG2/FLOW/AliFlowTasks/AliFlowCandidateTrack.h @@ -0,0 +1,37 @@ +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * +* See cxx source for full Copyright notice */ +/* $Id: $ */ + +#ifndef AliFlowCandidateTrack_H +#define AliFlowCandidateTrack_H + +#include "AliFlowTrack.h" + +//////////////////////////////////////////////////// +// AliFlowCandidateTrack: +// Class for reconstructed particles to be used in flow analysis +// Author: Carlos Perez (cperez@cern.ch) +//////////////////////////////////////////////////// + +class AliFlowCandidateTrack : public AliFlowTrack { + protected: + Double_t fMass; // mass + Int_t fNDaughters; // number of daughters (5 max) + Int_t fDaughter[5]; // index of daughters + + public: + AliFlowCandidateTrack(); + AliFlowCandidateTrack(const AliFlowCandidateTrack& ); + AliFlowCandidateTrack& operator=(const AliFlowCandidateTrack& ); + ~AliFlowCandidateTrack(); + + Double_t Mass(void) { return fMass; } + void SetMass(Double_t value) { fMass=value; } + + Int_t GetNDaughters(void) { return fNDaughters; } + void AddDaughter(Int_t value) { if(fNDaughters<3) fDaughter[fNDaughters++]=value; } + + ClassDef(AliFlowCandidateTrack, 1); +}; + +#endif diff --git a/PWG2/FLOW/AliFlowTasks/AliFlowTrackCuts.cxx b/PWG2/FLOW/AliFlowTasks/AliFlowTrackCuts.cxx index c3260cdb3b7..2fcdef927c8 100644 --- a/PWG2/FLOW/AliFlowTasks/AliFlowTrackCuts.cxx +++ b/PWG2/FLOW/AliFlowTasks/AliFlowTrackCuts.cxx @@ -569,7 +569,7 @@ AliFlowTrackCuts* AliFlowTrackCuts::GetStandardITSTPCTrackCuts2009(Bool_t selPri } //----------------------------------------------------------------------- -AliFlowTrack* AliFlowTrackCuts::MakeFlowTrack() const +AliFlowTrack* AliFlowTrackCuts::MakeFlowTrack(int index) const { //get a flow track constructed from whatever we applied cuts on //caller is resposible for deletion @@ -653,6 +653,9 @@ AliFlowTrack* AliFlowTrackCuts::MakeFlowTrack() const else if (dynamic_cast(fTrack)) flowtrack->SetSource(AliFlowTrack::kFromAOD); else if (dynamic_cast(fTrack)) flowtrack->SetSource(AliFlowTrack::kFromMC); } + + if(flowtrack) + flowtrack->SetIndexOnCollection(index); return flowtrack; } diff --git a/PWG2/FLOW/AliFlowTasks/AliFlowTrackCuts.h b/PWG2/FLOW/AliFlowTasks/AliFlowTrackCuts.h index bf35ae65eeb..c5c918758ac 100644 --- a/PWG2/FLOW/AliFlowTasks/AliFlowTrackCuts.h +++ b/PWG2/FLOW/AliFlowTasks/AliFlowTrackCuts.h @@ -117,7 +117,7 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts { virtual Bool_t IsSelectedMCtruth(TObject* obj, Int_t id=-666); AliVParticle* GetTrack() const {return fTrack;} AliMCParticle* GetMCparticle() const {return fMCparticle;} - AliFlowTrack* MakeFlowTrack() const; + AliFlowTrack* MakeFlowTrack(int index=0) const; Bool_t IsPhysicalPrimary() const; static Bool_t IsPhysicalPrimary(AliMCEvent* p, Int_t label, Bool_t requiretransported=kTRUE); diff --git a/PWG2/FLOW/macros/runFlowTaskCentralityTrain4Candidates.C b/PWG2/FLOW/macros/runFlowTaskCentralityTrain4Candidates.C new file mode 100644 index 00000000000..1fe5a34a579 --- /dev/null +++ b/PWG2/FLOW/macros/runFlowTaskCentralityTrain4Candidates.C @@ -0,0 +1,413 @@ +enum anaModes {mLocal,mLocalPAR,mPROOF,mGrid,mGridPAR}; +//mLocal: Analyze locally files in your computer using aliroot +//mLocalPAR: Analyze locally files in your computer using root + PAR files +//mPROOF: Analyze CAF files with PROOF +//mGrid: Analyze files on Grid via AliEn plug-in and using precompiled FLOW libraries +// (Remark: When using this mode set also Bool_t bUseParFiles = kFALSE; in CreateAlienHandler.C) +//mGridPAR: Analyze files on Grid via AliEn plug-in and using par files for FLOW package +// (Remark: when using this mode set also Bool_t bUseParFiles = kTRUE; in CreateAlienHandler.C) + +// CENTRALITY DEFINITION +//Int_t binfirst = 4; //where do we start numbering bins +//Int_t binlast = 6; //where do we stop numbering bins +//const Int_t numberOfCentralityBins = 9; +Int_t binfirst = 0; //where do we start numbering bins +Int_t binlast = 8; //where do we stop numbering bins +const Int_t numberOfCentralityBins = 9; +Float_t centralityArray[numberOfCentralityBins+1] = {0.,5.,10.,20.,30.,40.,50.,60.,70.,80.}; // in centrality percentile +//Int_t centralityArray[numberOfCentralityBins+1] = {41,80,146,245,384,576,835,1203,1471,10000}; // in terms of TPC only reference multiplicity + +TString commonOutputFileName = "outputCentrality"; // e.g.: result for centrality bin 0 will be in the file "outputCentrality0.root", etc + + +//void runFlowTaskCentralityTrain(Int_t mode=mLocal, Int_t nRuns = 10, +//Bool_t DATA = kFALSE, const Char_t* dataDir="/Users/snelling/alice_data/Therminator_midcentral", Int_t offset = 0) + +void runFlowTaskCentralityTrain4Candidates(Int_t mode = mGridPAR, Int_t nRuns = 50000000, + Bool_t DATA = kTRUE, const Char_t* dataDir="/alice/data/LHC10h_000137161_p1_plusplusplus", Int_t offset=0) +//void runFlowTaskCentralityTrain4Candidates(Int_t mode = mLocal, Int_t nRuns = 50000000, +// Bool_t DATA = kTRUE, const Char_t* dataDir="./data/", Int_t offset=0) +//void runFlowTaskCentralityTrain(Int_t mode = mGridPAR, Bool_t DATA = kTRUE) +{ + // Time: + TStopwatch timer; + timer.Start(); + // Cross-check user settings before starting: + // CrossCheckUserSettings(DATA); + // Load needed libraries: + LoadLibraries(mode); + // Create and configure the AliEn plug-in: + if(mode == mGrid || mode == mGridPAR) + { + gROOT->LoadMacro("CreateAlienHandler.C"); + AliAnalysisGrid *alienHandler = CreateAlienHandler(); + if(!alienHandler) return; + } + // Chains: + if(mode == mLocal || mode == mLocalPAR) { +// TChain* chain = CreateESDChain(dataDir, nRuns, offset); + TChain* chain = new TChain(); + chain->Add("~/alice/datasets/Pb/AliESDs.root/esdTree"); + //TChain* chain = CreateAODChain(dataDir, nRuns, offset); + } + + // Create analysis manager: + AliAnalysisManager *mgr = new AliAnalysisManager("FlowAnalysisManager"); + // Connect plug-in to the analysis manager: + if(mode == mGrid || mode == mGridPAR) + { + mgr->SetGridHandler(alienHandler); + } + + // Event handlers: + AliVEventHandler* esdH = new AliESDInputHandler; + mgr->SetInputEventHandler(esdH); + if (!DATA) { + AliMCEventHandler *mc = new AliMCEventHandler(); + mgr->SetMCtruthEventHandler(mc); + } + + // Task to check the offline trigger: + gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C"); + AddTaskPhysicsSelection(!DATA); + + //Add the centrality determination task + gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C"); + AddTaskCentrality(); + + // Setup analysis per centrality bin: + gROOT->LoadMacro("AddTaskFlowCentrality4Candidates.C"); + for (Int_t i=binfirst; iSetDebugLevel(2); + // Run the analysis: + if(!mgr->InitAnalysis()) return; + mgr->PrintStatus(); + if(mode == mLocal || mode == mLocalPAR) { + mgr->StartAnalysis("local",chain); + } else if(mode == mPROOF) { + mgr->StartAnalysis("proof",dataDir,nRuns,offset); + } else if(mode == mGrid || mode == mGridPAR) { + mgr->StartAnalysis("grid"); + } + + // Print real and CPU time used for analysis: + timer.Stop(); + timer.Print(); + +} // end of void runFlowTaskCentralityTrain(...) + +//=============================================================================================== +/* +void CrossCheckUserSettings(Bool_t bData) +{ + // Check in this method if the user settings make sense. + if(LYZ1SUM && LYZ2SUM) {cout<<" WARNING: You cannot run LYZ1 and LYZ2 at the same time! LYZ2 needs the output from LYZ1 !!!!"<Load("libCore"); + gSystem->Load("libTree"); + gSystem->Load("libGeom"); + gSystem->Load("libVMC"); + gSystem->Load("libXMLIO"); + gSystem->Load("libPhysics"); + gSystem->Load("libXMLParser"); + gSystem->Load("libProof"); + + if (mode==mLocal || mode==mGrid || mode == mGridPAR || mode == mLocalPAR ) + { + gSystem->Load("libSTEERBase"); + gSystem->Load("libCDB"); + gSystem->Load("libRAWDatabase"); + gSystem->Load("libRAWDatarec"); + gSystem->Load("libESD"); + gSystem->Load("libAOD"); + gSystem->Load("libSTEER"); + gSystem->Load("libANALYSIS"); + gSystem->Load("libANALYSISalice"); + gSystem->Load("libTOFbase"); + gSystem->Load("libTOFrec"); + + if (mode == mLocal || mode == mGrid) + { + gSystem->Load("libPWG2flowCommon"); + gSystem->Load("libPWG2flowTasks"); + } + if (mode == mLocalPAR || mode == mGridPAR ) + { + AliAnalysisAlien::SetupPar("PWG2flowCommon"); + AliAnalysisAlien::SetupPar("PWG2flowTasks"); + } + } + + //--------------------------------------------------------- + // <<<<<<<<<< PROOF mode >>>>>>>>>>>> + //--------------------------------------------------------- + else if (mode==mPROOF) { + // set to debug root versus if needed + //TProof::Mgr("alicecaf")->SetROOTVersion("v5-24-00a_dbg"); + //TProof::Mgr("alicecaf")->SetROOTVersion("v5-24-00a"); + //TProof::Reset("proof://snelling@alicecaf.cern.ch"); + // Connect to proof + printf("*** Connect to PROOF ***\n"); + gEnv->SetValue("XSec.GSI.DelegProxy","2"); + TProof::Open("mkrzewic@alice-caf.cern.ch"); + //TProof::Open("mkrzewic@skaf.saske.sk"); + // list the data available + //gProof->ShowDataSets("/*/*"); + //gProof->ShowDataSets("/alice/sim/"); //for MC Data + //gProof->ShowDataSets("/alice/data/"); //for REAL Data + + // Clear the Packages + /* + gProof->ClearPackage("STEERBase.par"); + gProof->ClearPackage("ESD.par"); + gProof->ClearPackage("AOD.par"); + */ + //gProof->ClearPackage("ANALYSIS.par"); + //gProof->ClearPackage("ANALYSISalice.par"); + //gProof->ClearPackage("CORRFW.par"); + + gProof->ClearPackage("PWG2flowCommon"); + gProof->ClearPackage("PWG2flowTasks"); + + // Upload the Packages + //gProof->UploadPackage("STEERBase.par"); + //gProof->UploadPackage("ESD.par"); + //gProof->UploadPackage("AOD.par"); + + //gProof->UploadPackage("ANALYSIS.par"); + //gProof->UploadPackage("ANALYSISalice.par"); + gProof->UploadPackage("CORRFW.par"); + gProof->UploadPackage("PWG2flowCommon.par"); + gProof->UploadPackage("PWG2flowTasks.par"); + gProof->UploadPackage("ALIRECO.par"); + + // Enable the Packages + // The global package + TList* list = new TList(); + list->Add(new TNamed("ALIROOT_EXTRA_INCLUDES","RAW:OCDB:STEER:TOF")); + gProof->EnablePackage("VO_ALICE@AliRoot::v4-21-07-AN",list); + gProof->EnablePackage("ALIRECO"); + //gProof->EnablePackage("ANALYSIS"); + //gProof->EnablePackage("ANALYSISalice"); + //gProof->EnablePackage("CORRFW"); + gProof->EnablePackage("PWG2flowCommon"); + gProof->EnablePackage("PWG2flowTasks"); + + // Show enables Packages + gProof->ShowEnabledPackages(); + } + +} // end of void LoadLibraries(const anaModes mode) + +// Helper macros for creating chains +// from: CreateESDChain.C,v 1.10 jgrosseo Exp + +TChain* CreateESDChain(const char* aDataDir, Int_t aRuns, Int_t offset) +{ + // creates chain of files in a given directory or file containing a list. + // In case of directory the structure is expected as: + // //AliESDs.root + // //AliESDs.root + // ... + + if (!aDataDir) + return 0; + + Long_t id, size, flags, modtime; + if (gSystem->GetPathInfo(aDataDir, &id, &size, &flags, &modtime)) + { + printf("%s not found.\n", aDataDir); + return 0; + } + + TChain* chain = new TChain("esdTree"); + TChain* chaingAlice = 0; + + if (flags & 2) + { + TString execDir(gSystem->pwd()); + TSystemDirectory* baseDir = new TSystemDirectory(".", aDataDir); + TList* dirList = baseDir->GetListOfFiles(); + Int_t nDirs = dirList->GetEntries(); + gSystem->cd(execDir); + + Int_t count = 0; + + for (Int_t iDir=0; iDirAt(iDir); + if (!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0) + continue; + + if (offset > 0) + { + --offset; + continue; + } + + if (count++ == aRuns) + break; + + TString presentDirName(aDataDir); + presentDirName += "/"; + presentDirName += presentDir->GetName(); + chain->Add(presentDirName + "/AliESDs.root/esdTree"); + // cerr<> esdfile; + if (!esdfile.Contains("root")) continue; // protection + + if (offset > 0) + { + --offset; + continue; + } + + if (count++ == aRuns) + break; + + // add esd file + chain->Add(esdfile); + } + + in.close(); + } + + return chain; + +} // end of TChain* CreateESDChain(const char* aDataDir, Int_t aRuns, Int_t offset) + +//=============================================================================================== + +TChain* CreateAODChain(const char* aDataDir, Int_t aRuns, Int_t offset) +{ + // creates chain of files in a given directory or file containing a list. + // In case of directory the structure is expected as: + // //AliAOD.root + // //AliAOD.root + // ... + + if (!aDataDir) + return 0; + + Long_t id, size, flags, modtime; + if (gSystem->GetPathInfo(aDataDir, &id, &size, &flags, &modtime)) + { + printf("%s not found.\n", aDataDir); + return 0; + } + + TChain* chain = new TChain("aodTree"); + TChain* chaingAlice = 0; + + if (flags & 2) + { + TString execDir(gSystem->pwd()); + TSystemDirectory* baseDir = new TSystemDirectory(".", aDataDir); + TList* dirList = baseDir->GetListOfFiles(); + Int_t nDirs = dirList->GetEntries(); + gSystem->cd(execDir); + + Int_t count = 0; + + for (Int_t iDir=0; iDirAt(iDir); + if (!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0) + continue; + + if (offset > 0) + { + --offset; + continue; + } + + if (count++ == aRuns) + break; + + TString presentDirName(aDataDir); + presentDirName += "/"; + presentDirName += presentDir->GetName(); + chain->Add(presentDirName + "/AliAOD.root/aodTree"); + // cerr<> aodfile; + if (!aodfile.Contains("root")) continue; // protection + + if (offset > 0) + { + --offset; + continue; + } + + if (count++ == aRuns) + break; + + // add aod file + chain->Add(aodfile); + } + + in.close(); + } + + return chain; + +} // end of TChain* CreateAODChain(const char* aDataDir, Int_t aRuns, Int_t offset) + diff --git a/PWG2/PWG2flowTasksLinkDef.h b/PWG2/PWG2flowTasksLinkDef.h index aa81e729af3..f9d8a4cb697 100644 --- a/PWG2/PWG2flowTasksLinkDef.h +++ b/PWG2/PWG2flowTasksLinkDef.h @@ -6,6 +6,7 @@ #pragma link C++ class AliFlowEvent+; #pragma link C++ class AliFlowEventCuts+; +#pragma link C++ class AliFlowCandidateTrack+; #pragma link C++ class AliFlowTrack+; #pragma link C++ class AliFlowTrackCuts+; #pragma link C++ class AliFlowEventSimpleMaker+; @@ -19,6 +20,7 @@ #pragma link C++ class AliAnalysisTaskFittingQDistribution+; #pragma link C++ class AliAnalysisTaskFlowEvent+; #pragma link C++ class AliAnalysisTaskFlowEventforRP+; +#pragma link C++ class AliAnalysisTaskFlowK0Candidates+; #pragma link C++ class AliAnalysisTaskMixedHarmonics+; #pragma link C++ class AliAnalysisTaskNestedLoops+; #pragma link C++ class AliAnalysisTaskQAflow+; diff --git a/PWG2/libPWG2flowTasks.pkg b/PWG2/libPWG2flowTasks.pkg index b99a77cd9c1..798f6a7eca7 100644 --- a/PWG2/libPWG2flowTasks.pkg +++ b/PWG2/libPWG2flowTasks.pkg @@ -4,6 +4,7 @@ SRCS= FLOW/AliFlowTasks/AliFlowEventSimpleMaker.cxx \ FLOW/AliFlowTasks/AliFlowEvent.cxx \ FLOW/AliFlowTasks/AliFlowEventCuts.cxx \ FLOW/AliFlowTasks/AliFlowTrack.cxx \ + FLOW/AliFlowTasks/AliFlowCandidateTrack.cxx \ FLOW/AliFlowTasks/AliFlowTrackCuts.cxx \ FLOW/AliFlowTasks/AliAnalysisTaskScalarProduct.cxx \ FLOW/AliFlowTasks/AliAnalysisTaskMCEventPlane.cxx \ @@ -13,6 +14,7 @@ SRCS= FLOW/AliFlowTasks/AliFlowEventSimpleMaker.cxx \ FLOW/AliFlowTasks/AliAnalysisTaskLeeYangZeros.cxx \ FLOW/AliFlowTasks/AliAnalysisTaskFittingQDistribution.cxx \ FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.cxx \ + FLOW/AliFlowTasks/AliAnalysisTaskFlowK0Candidates.cxx \ FLOW/AliFlowTasks/AliAnalysisTaskFlowEventforRP.cxx \ FLOW/AliFlowTasks/AliAnalysisTaskMixedHarmonics.cxx \ FLOW/AliFlowTasks/AliAnalysisTaskNestedLoops.cxx \ -- 2.43.0