From: gconesab Date: Sat, 22 Jan 2011 12:36:38 +0000 (+0000) Subject: Select events within a given centrality bin, move centrality code from AliAnaPartCorr... X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=32fd29fed86d4074bf230f0b04d90aeea9642446;p=u%2Fmrichter%2FAliRoot.git Select events within a given centrality bin, move centrality code from AliAnaPartCorrBaseClass to AliCaloTrackReader --- diff --git a/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.cxx b/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.cxx index 21af4f2f63d..4c6556fc0c6 100755 --- a/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.cxx +++ b/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.cxx @@ -53,7 +53,6 @@ ClassImp(AliAnaPartCorrBaseClass) fOutputAODBranch(0x0), fNewAOD(kFALSE), fOutputAODName(""), fOutputAODClassName(""), fAODObjArrayName(""), fAddToHistogramsName(""), - fCentralityClass("V0M"),fCentralityOpt(10), fCaloPID(0x0), fFidCut(0x0), fIC(0x0),fMCUtils(0x0), fNMS(0x0), fCaloUtils(0x0), fHistoPtBins(0), fHistoPtMax(0.), fHistoPtMin(0.), @@ -363,23 +362,6 @@ Int_t AliAnaPartCorrBaseClass::GetEventNumber() const { return fReader->GetEventNumber() ; } -//__________________________________________________ -Int_t AliAnaPartCorrBaseClass::GetEventCentrality() const { - //Return current event centrality - - if(GetCentrality()){ - if(fCentralityOpt==100) return (Int_t) GetCentrality()->GetCentralityPercentile(fCentralityClass); - else if(fCentralityOpt==10) return GetCentrality()->GetCentralityClass10(fCentralityClass); - else if(fCentralityOpt==5) return GetCentrality()->GetCentralityClass5(fCentralityClass); - else { - printf("AliAnaPartCorrBaseClass::Unknown centrality option %d, use 5, 10 or 100\n",fCentralityOpt); - return 0; - } - } - else return 0; - -} - //__________________________________________________ AliStack * AliAnaPartCorrBaseClass::GetMCStack() const { diff --git a/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.h b/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.h index e15e90e7150..2308cb8ab81 100755 --- a/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.h +++ b/PWG4/PartCorrBase/AliAnaPartCorrBaseClass.h @@ -87,12 +87,8 @@ public: return fCaloUtils->GetModuleNumber(cluster);} //Centrality - AliCentrality* GetCentrality() const { return fReader->GetCentrality() ;} - void SetCentralityClass(TString name) { fCentralityClass = name ;} - void SetCentralityOpt(Int_t opt) { fCentralityOpt = opt ;} - TString GetCentralityClass() const { return fCentralityClass ;} - Int_t GetCentralityPercent() const { return fCentralityOpt ;} - Int_t GetEventCentrality() const ; + AliCentrality* GetCentrality() const { return fReader->GetCentrality() ;} + Int_t GetEventCentrality() const { return fReader->GetEventCentrality() ;} virtual void Terminate(TList * /*outputList*/) {;} @@ -323,9 +319,6 @@ private: TString fAODObjArrayName ; // Name of ref array kept in a TList in AliAODParticleCorrelation with clusters or track references. TString fAddToHistogramsName;// Add this string to histograms name - TString fCentralityClass; // Name of selected centrality class - Int_t fCentralityOpt; // Option for the returned value of the centrality, possible options 5, 10, 100 - //Analysis helper classes access pointers AliCaloPID * fCaloPID; //! PID calculation AliFiducialCut * fFidCut; //! Acceptance cuts @@ -360,7 +353,7 @@ private: Int_t fHistoTrMMax ; // Maximum value of track multiplicity histogram range Int_t fHistoTrMMin ; // Minimum value of track multiplicity histogram range - ClassDef(AliAnaPartCorrBaseClass,14) + ClassDef(AliAnaPartCorrBaseClass,15) } ; diff --git a/PWG4/PartCorrBase/AliCaloTrackReader.cxx b/PWG4/PartCorrBase/AliCaloTrackReader.cxx index 8363f07a285..097f1c92f1d 100755 --- a/PWG4/PartCorrBase/AliCaloTrackReader.cxx +++ b/PWG4/PartCorrBase/AliCaloTrackReader.cxx @@ -69,7 +69,9 @@ ClassImp(AliCaloTrackReader) fAnaLED(kFALSE),fTaskName(""),fCaloUtils(0x0), fMixedEvent(NULL), fNMixedEvent(1), fVertex(NULL), fWriteOutputDeltaAOD(kFALSE),fOldAOD(kFALSE),fCaloFilterPatch(kFALSE), - fEMCALClustersListName(""),fZvtxCut(0.) + fEMCALClustersListName(""),fZvtxCut(0.), + fCentralityClass("V0M"),fCentralityOpt(10) + { //Ctor @@ -328,6 +330,9 @@ void AliCaloTrackReader::InitParameters() fZvtxCut = 10.; + //Centrality + fCentralityBin[0]=fCentralityBin[1]=-1; + } //________________________________________________________________ @@ -363,7 +368,11 @@ void AliCaloTrackReader::Print(const Option_t * opt) const printf("Read Kine from, stack? %d, AOD ? %d \n", fReadStack, fReadAODMCParticles) ; printf("Delta AOD File Name = %s\n", fDeltaAODFileName.Data()) ; + if(GetCentrality()) + printf("Centrality: Class %s, Option %d, Bin [%d,%d] \n", fCentralityClass.Data(),fCentralityOpt,fCentralityBin[0], fCentralityBin[1]) ; + printf(" \n") ; + } //___________________________________________________ @@ -432,6 +441,13 @@ Bool_t AliCaloTrackReader::FillInputEvent(const Int_t iEntry, const char * curre // // } + //Check if there is a centrality value, PbPb analysis, and if a centrality bin selection is requested + //If we need a centrality bin, we select only those events in the corresponding bin. + if(GetCentrality() && fCentralityBin[0]>=0 && fCentralityBin[1]>=0 && fCentralityOpt==100){ + Int_t cen = GetEventCentrality(); + if(cen > fCentralityBin[1] || cen < fCentralityBin[0]) return kFALSE; //reject events out of bin. + } + //Fill Vertex array FillVertexArray(); @@ -508,6 +524,23 @@ void AliCaloTrackReader::SetInputEvent(AliVEvent* const input) } } +//__________________________________________________ +Int_t AliCaloTrackReader::GetEventCentrality() const { + //Return current event centrality + + if(GetCentrality()){ + if(fCentralityOpt==100) return (Int_t) GetCentrality()->GetCentralityPercentile(fCentralityClass); + else if(fCentralityOpt==10) return GetCentrality()->GetCentralityClass10(fCentralityClass); + else if(fCentralityOpt==5) return GetCentrality()->GetCentralityClass5(fCentralityClass); + else { + printf("AliAnaPartCorrBaseClass::Unknown centrality option %d, use 5, 10 or 100\n",fCentralityOpt); + return 0; + } + } + else return 0; + +} + //____________________________________________________________________________ void AliCaloTrackReader::GetVertex(Double_t vertex[3]) const { //Return vertex position to be used for single event analysis diff --git a/PWG4/PartCorrBase/AliCaloTrackReader.h b/PWG4/PartCorrBase/AliCaloTrackReader.h index f3804bab58d..fb41c93d475 100755 --- a/PWG4/PartCorrBase/AliCaloTrackReader.h +++ b/PWG4/PartCorrBase/AliCaloTrackReader.h @@ -229,9 +229,16 @@ public: void SwitchOffCaloFilterPatch() {fCaloFilterPatch = kFALSE ; } Bool_t IsCaloFilterPatchOn() {if(fDataType == kAOD) { return fCaloFilterPatch ; } else { return kFALSE ; } } - - virtual AliCentrality* GetCentrality() const {return 0x0;} - + //Centrality + virtual AliCentrality* GetCentrality() const {return 0x0;} //Actual method to recover the pointer is in the ESD/AODReader + void SetCentralityClass(TString name) { fCentralityClass = name ;} + void SetCentralityOpt(Int_t opt) { fCentralityOpt = opt ;} + TString GetCentralityClass() const { return fCentralityClass ;} + Int_t GetCentralityOpt() const { return fCentralityOpt ;} + Int_t GetEventCentrality() const ; + void SetCentralityBin(Int_t min, Int_t max) //Set the centrality bin to select the event. If used, then need to get percentile + {fCentralityBin[0]=min; fCentralityBin[1]=max; if(min>=0 && max > 0) fCentralityOpt = 100; } + Float_t GetCentralityBin(Int_t i) const { if(i < 0 || i > 1) return 0 ; else return fCentralityBin[i] ; } //MC reader methods: @@ -320,8 +327,13 @@ public: Bool_t fCaloFilterPatch; // CaloFilter patch TString fEMCALClustersListName; //Alternative list of clusters produced elsewhere and not from InputEvent Float_t fZvtxCut ; // Cut on vertex position - - ClassDef(AliCaloTrackReader,22) + + //Centrality + TString fCentralityClass; // Name of selected centrality class + Int_t fCentralityOpt; // Option for the returned value of the centrality, possible options 5, 10, 100 + Int_t fCentralityBin[2]; // Minimum and maximum value of the centrality for the analysis + + ClassDef(AliCaloTrackReader,23) } ;