00001 #ifndef __CentralityProvider_h__ 00002 #define __CentralityProvider_h__ 00003 #include <iostream> 00004 00005 #include "FWCore/Framework/interface/Event.h" 00006 #include "DataFormats/HeavyIonEvent/interface/Centrality.h" 00007 #include "FWCore/ParameterSet/interface/Registry.h" 00008 #include "CondFormats/HIObjects/interface/CentralityTable.h" 00009 #include "CondFormats/DataRecord/interface/HeavyIonRcd.h" 00010 #include "FWCore/Framework/interface/ESHandle.h" 00011 00012 class CentralityProvider : public CentralityBins { 00013 00014 public: 00015 CentralityProvider(const edm::EventSetup& iSetup); 00016 ~CentralityProvider(){;} 00017 00018 enum VariableType {HFtowers,HFhits,PixelHits,PixelTracks,Tracks,EB,EE,Missing}; 00019 00020 int getNbins() const {return table_.size();} 00021 double centralityValue() const; 00022 int getBin() const {return CentralityBins::getBin(centralityValue());} 00023 float lowEdge() const { return lowEdgeOfBin(getBin());} 00024 float NpartMean() const { return NpartMeanOfBin(getBin());} 00025 float NpartSigma() const { return NpartSigmaOfBin(getBin());} 00026 float NcollMean() const { return NcollMeanOfBin(getBin());} 00027 float NcollSigma()const { return NcollSigmaOfBin(getBin());} 00028 float NhardMean() const { return NhardMeanOfBin(getBin());} 00029 float NhardSigma() const { return NhardSigmaOfBin(getBin());} 00030 float bMean() const { return bMeanOfBin(getBin());} 00031 float bSigma() const { return bSigmaOfBin(getBin());} 00032 void newRun(const edm::EventSetup& iSetup); 00033 void newEvent(const edm::Event& ev,const edm::EventSetup& iSetup); 00034 void print(); 00035 const CentralityBins* table() const {return this;} 00036 const reco::Centrality* raw() const {return chandle_.product();} 00037 00038 private: 00039 edm::InputTag tag_; 00040 std::string centralityVariable_; 00041 std::string centralityLabel_; 00042 std::string centralityMC_; 00043 unsigned int prevRun_; 00044 mutable edm::Handle<reco::Centrality> chandle_; 00045 VariableType varType_; 00046 }; 00047 00048 #endif 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059