From 333ce021574a3a5c69163fb91c7bc753cc238eb4 Mon Sep 17 00:00:00 2001 From: snelling Date: Fri, 15 Oct 2010 12:30:57 +0000 Subject: [PATCH] adds PMD + fixes in cuts (reference multiplicity in event cuts) --- .../AliFlowTasks/AliAnalysisTaskFlowEvent.cxx | 9 +- PWG2/FLOW/AliFlowTasks/AliFlowEvent.cxx | 114 +++++++++++++++++- PWG2/FLOW/AliFlowTasks/AliFlowEvent.h | 7 +- PWG2/FLOW/AliFlowTasks/AliFlowEventCuts.cxx | 24 +++- PWG2/FLOW/AliFlowTasks/AliFlowEventCuts.h | 5 + PWG2/FLOW/AliFlowTasks/AliFlowTrack.h | 3 +- PWG2/FLOW/macros/AddTaskFlow.C | 1 + PWG2/FLOW/macros/AddTaskFlowCentrality.C | 1 + 8 files changed, 155 insertions(+), 9 deletions(-) diff --git a/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.cxx b/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.cxx index e0165690072..b55680c6c11 100644 --- a/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.cxx +++ b/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.cxx @@ -246,6 +246,7 @@ void AliAnalysisTaskFlowEvent::UserExec(Option_t *) AliESDEvent* myESD = dynamic_cast(InputEvent()); // from TaskSE AliAODEvent* myAOD = dynamic_cast(InputEvent()); // from TaskSE AliMultiplicity* myTracklets = NULL; + AliESDPmdTrack* pmdtracks = NULL;//pmd TH2F* histFMD = NULL; if(GetNinputs()==2) { @@ -278,7 +279,8 @@ void AliAnalysisTaskFlowEvent::UserExec(Option_t *) fCutsPOI->SetMCevent( MCEvent() ); flowEvent = new AliFlowEvent( InputEvent(), fCutsRP, fCutsPOI ); if (myESD) - flowEvent->SetReferenceMultiplicity(AliESDtrackCuts::GetReferenceMultiplicity(myESD,kTRUE)); + flowEvent->SetReferenceMultiplicity(fCutsEvent->GetReferenceMultiplicity()); + if (mcEvent && mcEvent->GenEventHeader()) flowEvent->SetMCReactionPlaneAngle(mcEvent); } // Make the FlowEvent for MC input @@ -350,6 +352,11 @@ void AliAnalysisTaskFlowEvent::UserExec(Option_t *) else if (fRPType == "FMD"){ flowEvent = new AliFlowEvent(myESD,histFMD,fCFManager2); } + //pmd + else if (fRPType == "PMD"){ + flowEvent = new AliFlowEvent(myESD,pmdtracks,fCFManager2); + } + //pmd // if monte carlo event get reaction plane from monte carlo (depends on generator) if (mcEvent && mcEvent->GenEventHeader()) flowEvent->SetMCReactionPlaneAngle(mcEvent); diff --git a/PWG2/FLOW/AliFlowTasks/AliFlowEvent.cxx b/PWG2/FLOW/AliFlowTasks/AliFlowEvent.cxx index 849a63fd2fb..0478c26c92b 100644 --- a/PWG2/FLOW/AliFlowTasks/AliFlowEvent.cxx +++ b/PWG2/FLOW/AliFlowTasks/AliFlowEvent.cxx @@ -26,6 +26,7 @@ #include "AliMCParticle.h" #include "AliCFManager.h" #include "AliESDtrack.h" +#include "AliESDPmdTrack.h" #include "AliESDEvent.h" #include "AliAODEvent.h" #include "AliGenCocktailEventHeader.h" @@ -567,9 +568,9 @@ AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput, pTrack->SetPhi(phiFMD); pTrack->SetWeight(weightFMD); //marking the particles used for the reference particle (RP) selection: - pTrack->SetForRPSelection(kTRUE); - pTrack->SetSource(AliFlowTrack::kFromFMD); + pTrack->TagRP(); fNumberOfRPs++; + pTrack->SetSource(AliFlowTrack::kFromFMD); //Add the track to the flowevent AddTrack(pTrack); @@ -636,3 +637,112 @@ AliFlowEvent::AliFlowEvent( AliVEvent* event, }//end of while (i < numberOfTracks) } +//-------------------------------------------------------------------// +//---- Including PMD tracks as RP --------------------------// + +AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput, + const AliESDPmdTrack *pmdtracks, + const AliCFManager* poiCFManager ): + AliFlowEventSimple(20) +{ + Float_t GetPmdEta(Float_t xPos, Float_t yPos, Float_t zPos); + Float_t GetPmdPhi(Float_t xPos, Float_t yPos); + //Select the particles of interest from the ESD + Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ; + + //loop over tracks + for (Int_t itrkN=0; itrkNGetTrack(itrkN); //get input particle + //check if pParticle passes the cuts + Bool_t poiOK = kTRUE; + if (poiCFManager) + { + poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) && + poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)); + } + if (!poiOK) continue; + + //make new AliFLowTrack + AliFlowTrack* pTrack = new AliFlowTrack(pParticle); + + //marking the particles used for the particle of interest (POI) selection: + if(poiOK && poiCFManager) + { + pTrack->SetForPOISelection(kTRUE); + pTrack->SetSource(AliFlowTrack::kFromESD); + } + + AddTrack(pTrack); + }//end of while (itrkN < iNumberOfInputTracks) + + //Select the reference particles from the PMD tracks + Int_t npmdcl = anInput->GetNumberOfPmdTracks(); + printf("======There are %d PMD tracks in this event\n-------",npmdcl); + //loop over clusters + for(Int_t iclust=0; iclust < npmdcl; iclust++){ + //AliESDPmdTrack *pmdtr = anInput->GetPmdTrack(iclust); + pmdtracks = anInput->GetPmdTrack(iclust); + Int_t det = pmdtracks->GetDetector(); + //Int_t smn = pmdtracks->GetSmn(); + Float_t clsX = pmdtracks->GetClusterX(); + Float_t clsY = pmdtracks->GetClusterY(); + Float_t clsZ = pmdtracks->GetClusterZ(); + Float_t ncell = pmdtracks->GetClusterCells(); + Float_t adc = pmdtracks->GetClusterADC(); + //Float_t pid = pmdtracks->GetClusterPID(); + Float_t etacls = GetPmdEta(clsX,clsY,clsZ); + Float_t phicls = GetPmdPhi(clsX,clsY); + //make new AliFLowTrackSimple + AliFlowTrack* pTrack = new AliFlowTrack(); + //if(det == 0){ //selecting preshower plane only + if(det == 0 && adc > 270 && ncell > 1){ //selecting preshower plane only + //pTrack->SetPt(adc);//cluster adc + pTrack->SetPt(0.0); + pTrack->SetEta(etacls); + pTrack->SetPhi(phicls); + //marking the particles used for the reference particle (RP) selection: + fNumberOfRPs++; + pTrack->SetForRPSelection(kTRUE); + pTrack->SetSource(AliFlowTrack::kFromPMD); + //Add the track to the flowevent + AddTrack(pTrack); + }//if det + } +} +//----------------------------------------------------------------------------// +Float_t GetPmdEta(Float_t xPos, Float_t yPos, Float_t zPos) +{ + Float_t rpxpy, theta, eta; + rpxpy = TMath::Sqrt(xPos*xPos + yPos*yPos); + theta = TMath::ATan2(rpxpy,zPos); + eta = -TMath::Log(TMath::Tan(0.5*theta)); + return eta; +} +//--------------------------------------------------------------------------// +Float_t GetPmdPhi(Float_t xPos, Float_t yPos) +{ + Float_t pybypx, phi = 0., phi1; + if(xPos==0) + { + if(yPos>0) phi = 90.; + if(yPos<0) phi = 270.; + } + if(xPos != 0) + { + pybypx = yPos/xPos; + if(pybypx < 0) pybypx = - pybypx; + phi1 = TMath::ATan(pybypx)*180./3.14159; + + if(xPos > 0 && yPos > 0) phi = phi1; // 1st Quadrant + if(xPos < 0 && yPos > 0) phi = 180 - phi1; // 2nd Quadrant + if(xPos < 0 && yPos < 0) phi = 180 + phi1; // 3rd Quadrant + if(xPos > 0 && yPos < 0) phi = 360 - phi1; // 4th Quadrant + + } + phi = phi*3.14159/180.; + return phi; +} +//---------------------------------------------------------------// + + diff --git a/PWG2/FLOW/AliFlowTasks/AliFlowEvent.h b/PWG2/FLOW/AliFlowTasks/AliFlowEvent.h index b6fd3976c9a..602480d7913 100644 --- a/PWG2/FLOW/AliFlowTasks/AliFlowEvent.h +++ b/PWG2/FLOW/AliFlowTasks/AliFlowEvent.h @@ -19,6 +19,7 @@ class AliMCEvent; class AliESDEvent; class AliAODEvent; class AliMultiplicity; +class AliESDPmdTrack; class TH2F; #include "AliFlowEventSimple.h" @@ -59,7 +60,11 @@ public: AliFlowEvent( AliVEvent* anInput, AliFlowTrackCuts* rpCuts, AliFlowTrackCuts* poiCuts ); - + //pmd + AliFlowEvent( const AliESDEvent* anInput, + const AliESDPmdTrack *pmdtracks, + const AliCFManager* poiCFManager ); + //pmd void SetMCReactionPlaneAngle(const AliMCEvent* mcEvent); using AliFlowEventSimple::SetMCReactionPlaneAngle; diff --git a/PWG2/FLOW/AliFlowTasks/AliFlowEventCuts.cxx b/PWG2/FLOW/AliFlowTasks/AliFlowEventCuts.cxx index 43cb80feefa..ffc803aa1ba 100644 --- a/PWG2/FLOW/AliFlowTasks/AliFlowEventCuts.cxx +++ b/PWG2/FLOW/AliFlowTasks/AliFlowEventCuts.cxx @@ -24,7 +24,10 @@ #include #include "TNamed.h" #include "AliVEvent.h" +#include "AliESDEvent.h" +#include "AliMCEvent.h" #include "AliFlowEventCuts.h" +#include "AliESDtrackCuts.h" ClassImp(AliFlowEventCuts) @@ -36,7 +39,8 @@ AliFlowEventCuts::AliFlowEventCuts(): fNumberOfTracksMin(INT_MIN), fCutRefMult(kFALSE), fRefMultMax(INT_MAX), - fRefMultMin(INT_MIN) + fRefMultMin(INT_MIN), + fReferenceMultiplicity(-1) { //constructor } @@ -49,7 +53,8 @@ AliFlowEventCuts::AliFlowEventCuts(const char* name, const char* title): fNumberOfTracksMin(INT_MIN), fCutRefMult(kFALSE), fRefMultMax(INT_MAX), - fRefMultMin(INT_MIN) + fRefMultMin(INT_MIN), + fReferenceMultiplicity(-1) { //constructor } @@ -91,8 +96,8 @@ Bool_t AliFlowEventCuts::PassesCuts(const AliVEvent *event) if(fCutRefMult) { //reference multiplicity still to be defined - Int_t refMult = event->GetNumberOfTracks(); - if (refMult < fRefMultMin || refMult >= fRefMultMax ) + fReferenceMultiplicity = ReferenceMultiplicity(event); + if (fReferenceMultiplicity < fRefMultMin || fReferenceMultiplicity >= fRefMultMax ) return kFALSE; } return kTRUE; @@ -105,3 +110,14 @@ AliFlowEventCuts* AliFlowEventCuts::StandardCuts() AliFlowEventCuts* cuts = new AliFlowEventCuts(); return cuts; } + +//----------------------------------------------------------------------- +Int_t AliFlowEventCuts::ReferenceMultiplicity(const AliVEvent* event) +{ + //calculate the reference multiplicity + const AliESDEvent* esd=dynamic_cast(event); + if (esd) return AliESDtrackCuts::GetReferenceMultiplicity(const_cast(esd),kTRUE); + AliMCEvent* mc=const_cast(dynamic_cast(event)); + if (mc) return mc->GetNumberOfPrimaries(); + return event->GetNumberOfTracks(); //default +} diff --git a/PWG2/FLOW/AliFlowTasks/AliFlowEventCuts.h b/PWG2/FLOW/AliFlowTasks/AliFlowEventCuts.h index d1b0abb64b5..a3cceb0b724 100644 --- a/PWG2/FLOW/AliFlowTasks/AliFlowEventCuts.h +++ b/PWG2/FLOW/AliFlowTasks/AliFlowEventCuts.h @@ -41,6 +41,9 @@ class AliFlowEventCuts : public TNamed { Int_t GetRefMultMax() const {return fRefMultMax;} Int_t GetRefMultMin() const {return fRefMultMin;} + static Int_t ReferenceMultiplicity(const AliVEvent* event); + Int_t GetReferenceMultiplicity() {return fReferenceMultiplicity;} + private: Bool_t fCutNumberOfTracks;//cut on # of tracks Int_t fNumberOfTracksMax; //limits @@ -49,6 +52,8 @@ class AliFlowEventCuts : public TNamed { Int_t fRefMultMax; //max refmult Int_t fRefMultMin; //min refmult + Int_t fReferenceMultiplicity; //store the reference multiplicity + ClassDef(AliFlowEventCuts,1) }; diff --git a/PWG2/FLOW/AliFlowTasks/AliFlowTrack.h b/PWG2/FLOW/AliFlowTasks/AliFlowTrack.h index ee9f444f5a4..9399f97ff94 100644 --- a/PWG2/FLOW/AliFlowTasks/AliFlowTrack.h +++ b/PWG2/FLOW/AliFlowTasks/AliFlowTrack.h @@ -19,7 +19,8 @@ public: kFromMC=1, kFromAOD=2, kFromTracklet=3, - kFromFMD=4 }; + kFromFMD=4, + kFromPMD=5 }; AliFlowTrack(); AliFlowTrack(const AliVParticle* p); AliFlowTrack& operator=(const AliFlowTrack& aTrack); diff --git a/PWG2/FLOW/macros/AddTaskFlow.C b/PWG2/FLOW/macros/AddTaskFlow.C index 154fe61d196..572f095bacb 100644 --- a/PWG2/FLOW/macros/AddTaskFlow.C +++ b/PWG2/FLOW/macros/AddTaskFlow.C @@ -74,6 +74,7 @@ const Int_t multmax = 10000; //used for AliFlowEventSimple (to set the centr const TString rptype = "Global"; //const TString rptype = "Tracklet"; //const TString rptype = "FMD"; +//const TString rptype = "PMD"; //KINEMATICS (on generated and reconstructed tracks) Bool_t UseKineforRP = kFALSE; diff --git a/PWG2/FLOW/macros/AddTaskFlowCentrality.C b/PWG2/FLOW/macros/AddTaskFlowCentrality.C index 491f4b8ebd3..c59f6783a49 100644 --- a/PWG2/FLOW/macros/AddTaskFlowCentrality.C +++ b/PWG2/FLOW/macros/AddTaskFlowCentrality.C @@ -74,6 +74,7 @@ const Int_t multmax = 10000; //used for AliFlowEventSimple (to set the centr const TString rptype = "Global"; //const TString rptype = "Tracklet"; //const TString rptype = "FMD"; +//const TString rptype = "PMD"; //KINEMATICS (on generated and reconstructed tracks) Bool_t UseKineforRP = kFALSE; -- 2.43.5