CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
CentralityProvider Class Reference

#include <CentralityProvider.h>

Inheritance diagram for CentralityProvider:
CentralityBins

Public Types

enum  VariableType {
  HFtowers, HFtowersPlus, HFtowersMinus, HFtowersTrunc,
  HFtowersPlusTrunc, HFtowersMinusTrunc, HFhits, PixelHits,
  PixelTracks, Tracks, EB, EE,
  Missing
}
 
- Public Types inherited from CentralityBins
typedef std::map< int, const
CentralityBins * > 
RunMap
 

Public Member Functions

float bMean () const
 
float bSigma () const
 
 CentralityProvider (const edm::EventSetup &iSetup)
 
double centralityValue () const
 
int getBin () const
 
int getNbins () const
 
float lowEdge () const
 
float NcollMean () const
 
float NcollSigma () const
 
void newEvent (const edm::Event &ev, const edm::EventSetup &iSetup)
 
void newRun (const edm::EventSetup &iSetup)
 
float NhardMean () const
 
float NhardSigma () const
 
float NpartMean () const
 
float NpartSigma () const
 
void print ()
 
const reco::Centralityraw () const
 
const CentralityBinstable () const
 
 ~CentralityProvider ()
 
- Public Member Functions inherited from CentralityBins
float areaMean (double value) const
 
float areaMeanOfBin (int bin) const
 
float areaSigma (double value) const
 
float areaSigmaOfBin (int bin) const
 
float bMean (double value) const
 
float bMeanOfBin (int bin) const
 
float bSigma (double value) const
 
float bSigmaOfBin (int bin) const
 
 CentralityBins ()
 
 CentralityBins (const char *name, const char *title, int nbins)
 
float eccentricityMean (double value) const
 
float eccentricityMeanOfBin (int bin) const
 
float eccentricityRPMean (double value) const
 
float eccentricityRPMeanOfBin (int bin) const
 
float eccentricityRPSigma (double value) const
 
float eccentricityRPSigmaOfBin (int bin) const
 
float eccentricitySigma (double value) const
 
float eccentricitySigmaOfBin (int bin) const
 
int getBin (double value) const
 
int getNbins () const
 
float lowEdge (double value) const
 
float lowEdgeOfBin (int bin) const
 
float NcollMean (double value) const
 
float NcollMeanOfBin (int bin) const
 
float NcollSigma (double value) const
 
float NcollSigmaOfBin (int bin) const
 
float NhardMean (double value) const
 
float NhardMeanOfBin (int bin) const
 
float NhardSigma (double value) const
 
float NhardSigmaOfBin (int bin) const
 
float NpartMean (double value) const
 
float NpartMeanOfBin (int bin) const
 
float NpartSigma (double value) const
 
float NpartSigmaOfBin (int bin) const
 
float triangularityMean (double value) const
 
float triangularityMeanOfBin (int bin) const
 
float triangularitySigma (double value) const
 
float triangularitySigmaOfBin (int bin) const
 
 ~CentralityBins ()
 

Private Attributes

std::string centralityLabel_
 
std::string centralityMC_
 
std::string centralityVariable_
 
edm::Handle< reco::Centralitychandle_
 
unsigned int pPbRunFlip_
 
unsigned int prevRun_
 
edm::InputTag tag_
 
VariableType varType_
 

Additional Inherited Members

- Public Attributes inherited from CentralityBins
std::vector< CBintable_
 

Detailed Description

Definition at line 12 of file CentralityProvider.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

CentralityProvider::CentralityProvider ( const edm::EventSetup iSetup)

Definition at line 3 of file CentralityProvider.cc.

References centralityLabel_, centralityMC_, centralityVariable_, EB, EE, edm::hlt::Exception, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), edm::getProcessParameterSet(), edm::ParameterSet::getUntrackedParameter(), HFhits, HFtowers, HFtowersMinus, HFtowersMinusTrunc, HFtowersPlus, HFtowersPlusTrunc, HFtowersTrunc, Missing, newRun(), PixelHits, PixelTracks, pPbRunFlip_, tag_, Tracks, and varType_.

3  :
4  prevRun_(0),
6 {
8  if(thepset.exists("HeavyIonGlobalParameters")){
9  edm::ParameterSet hiPset = thepset.getParameter<edm::ParameterSet>("HeavyIonGlobalParameters");
10  tag_ = hiPset.getParameter<edm::InputTag>("centralitySrc");
11  centralityVariable_ = hiPset.getParameter<std::string>("centralityVariable");
12  pPbRunFlip_ = hiPset.getUntrackedParameter<unsigned int>("pPbRunFlip",99999999);
13  if(centralityVariable_.compare("HFtowers") == 0) varType_ = HFtowers;
14  if(centralityVariable_.compare("HFtowersPlus") == 0) varType_ = HFtowersPlus;
15  if(centralityVariable_.compare("HFtowersMinus") == 0) varType_ = HFtowersMinus;
16  if(centralityVariable_.compare("HFtowersTrunc") == 0) varType_ = HFtowersTrunc;
17  if(centralityVariable_.compare("HFtowersPlusTrunc") == 0) varType_ = HFtowersPlusTrunc;
18  if(centralityVariable_.compare("HFtowersMinusTrunc") == 0) varType_ = HFtowersMinusTrunc;
19  if(centralityVariable_.compare("HFhits") == 0) varType_ = HFhits;
20  if(centralityVariable_.compare("PixelHits") == 0) varType_ = PixelHits;
21  if(centralityVariable_.compare("PixelTracks") == 0) varType_ = PixelTracks;
22  if(centralityVariable_.compare("Tracks") == 0) varType_ = Tracks;
23  if(centralityVariable_.compare("EB") == 0) varType_ = EB;
24  if(centralityVariable_.compare("EE") == 0) varType_ = EE;
25  if(varType_ == Missing){
26  std::string errorMessage="Requested Centrality variable does not exist : "+centralityVariable_+"\n" +
27  "Supported variables are: \n" + "HFtowers HFhits PixelHits PixelTracks Tracks EB EE" + "\n";
28  throw cms::Exception("Configuration",errorMessage);
29  }
30  if(hiPset.exists("nonDefaultGlauberModel")){
31  centralityMC_ = hiPset.getParameter<std::string>("nonDefaultGlauberModel");
32  }
33  centralityLabel_ = centralityVariable_+centralityMC_;
34  SetName(centralityLabel_.data());
35  }else{
36  }
37  newRun(iSetup);
38 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::string centralityLabel_
unsigned int pPbRunFlip_
ParameterSet const & getProcessParameterSet()
Definition: Registry.cc:34
void newRun(const edm::EventSetup &iSetup)
std::string centralityVariable_
CentralityProvider::~CentralityProvider ( )
inline

Definition at line 16 of file CentralityProvider.h.

16 {;}

Member Function Documentation

float CentralityProvider::bMean ( ) const
inline

Definition at line 30 of file CentralityProvider.h.

References CentralityBins::bMeanOfBin(), and getBin().

Referenced by AnalyzerWithCentrality::analyze().

30 { return bMeanOfBin(getBin());}
float bMeanOfBin(int bin) const
float CentralityProvider::bSigma ( ) const
inline

Definition at line 31 of file CentralityProvider.h.

References CentralityBins::bSigmaOfBin(), and getBin().

Referenced by AnalyzerWithCentrality::analyze().

31 { return bSigmaOfBin(getBin());}
float bSigmaOfBin(int bin) const
double CentralityProvider::centralityValue ( ) const

Definition at line 103 of file CentralityProvider.cc.

References chandle_, EB, EE, HFhits, HFtowers, HFtowersMinus, HFtowersMinusTrunc, HFtowersPlus, HFtowersPlusTrunc, HFtowersTrunc, PixelHits, PixelTracks, Tracks, and varType_.

Referenced by AnalyzerWithCentrality::analyze(), and getBin().

103  {
104  double var = -99;
105  if(varType_ == HFhits) var = chandle_->EtHFhitSum();
106  if(varType_ == HFtowers) var = chandle_->EtHFtowerSum();
107  if(varType_ == HFtowersPlus) var = chandle_->EtHFtowerSumPlus();
108  if(varType_ == HFtowersMinus) var = chandle_->EtHFtowerSumMinus();
109  if(varType_ == HFtowersTrunc) var = chandle_->EtHFtruncated();
110  if(varType_ == HFtowersPlusTrunc) var = chandle_->EtHFtruncatedPlus();
111  if(varType_ == HFtowersMinusTrunc) var = chandle_->EtHFtruncatedMinus();
112  if(varType_ == PixelHits) var = chandle_->multiplicityPixel();
113  if(varType_ == PixelTracks) var = chandle_->NpixelTracks();
114  if(varType_ == Tracks) var = chandle_->Ntracks();
115  if(varType_ == EB) var = chandle_->EtEBSum();
116  if(varType_ == EE) var = chandle_->EtEESum();
117 
118  return var;
119 }
edm::Handle< reco::Centrality > chandle_
int CentralityProvider::getBin ( void  ) const
inline
int CentralityProvider::getNbins ( ) const
inline

Definition at line 20 of file CentralityProvider.h.

References CentralityBins::table_.

Referenced by AnalyzerWithCentrality::analyze().

20 {return table_.size();}
std::vector< CBin > table_
float CentralityProvider::lowEdge ( ) const
inline

Definition at line 23 of file CentralityProvider.h.

References getBin(), and CentralityBins::lowEdgeOfBin().

23 { return lowEdgeOfBin(getBin());}
float lowEdgeOfBin(int bin) const
float CentralityProvider::NcollMean ( ) const
inline

Definition at line 26 of file CentralityProvider.h.

References getBin(), and CentralityBins::NcollMeanOfBin().

Referenced by AnalyzerWithCentrality::analyze().

26 { return NcollMeanOfBin(getBin());}
float NcollMeanOfBin(int bin) const
float CentralityProvider::NcollSigma ( ) const
inline

Definition at line 27 of file CentralityProvider.h.

References getBin(), and CentralityBins::NcollSigmaOfBin().

Referenced by AnalyzerWithCentrality::analyze().

27 { return NcollSigmaOfBin(getBin());}
float NcollSigmaOfBin(int bin) const
void CentralityProvider::newEvent ( const edm::Event ev,
const edm::EventSetup iSetup 
)

Definition at line 40 of file CentralityProvider.cc.

References centralityVariable_, chandle_, gather_cfg::cout, edm::Event::getByLabel(), HFtowersMinus, HFtowersMinusTrunc, HFtowersPlus, HFtowersPlusTrunc, edm::EventBase::id(), newRun(), pPbRunFlip_, prevRun_, edm::EventID::run(), tag_, and varType_.

Referenced by AnalyzerWithCentrality::analyze(), CentralityFilter::filter(), and CentralityBinProducer::produce().

40  {
42  if(ev.id().run() == prevRun_) return;
43  if(prevRun_ < pPbRunFlip_ && ev.id().run() >= pPbRunFlip_){
44  std::cout<<"Attention, the sides are flipped from this run on!"<<std::endl;
45  if(centralityVariable_.compare("HFtowersPlus") == 0) varType_ = HFtowersMinus;
46  if(centralityVariable_.compare("HFtowersMinus") == 0) varType_ = HFtowersPlus;
47  if(centralityVariable_.compare("HFtowersPlusTrunc") == 0) varType_ = HFtowersMinusTrunc;
48  if(centralityVariable_.compare("HFtowersMinusTrunc") == 0) varType_ = HFtowersPlusTrunc;
49  }
50  prevRun_ = ev.id().run();
51  newRun(iSetup);
52 }
RunNumber_t run() const
Definition: EventID.h:42
edm::Handle< reco::Centrality > chandle_
unsigned int pPbRunFlip_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
void newRun(const edm::EventSetup &iSetup)
edm::EventID id() const
Definition: EventBase.h:56
std::string centralityVariable_
tuple cout
Definition: gather_cfg.py:121
void CentralityProvider::newRun ( const edm::EventSetup iSetup)

Definition at line 54 of file CentralityProvider.cc.

References CentralityTable::CBin::b, CBin::b_mean, CBin::b_var, CBin::bin_edge, CentralityTable::CBin::bin_edge, centralityLabel_, CentralityTable::CBin::ecc2, CBin::ecc2_mean, CBin::ecc2_var, CentralityTable::CBin::ecc3, CBin::ecc3_mean, CBin::ecc3_var, CentralityTable::CBin::eccRP, CBin::eccRP_mean, CBin::eccRP_var, edm::EventSetup::get(), j, CentralityTable::BinValues::mean, CentralityTable::CBin::n_coll, CBin::n_coll_mean, CBin::n_coll_var, CentralityTable::CBin::n_hard, CBin::n_hard_mean, CBin::n_hard_var, CentralityTable::CBin::n_part, CBin::n_part_mean, CBin::n_part_var, CentralityTable::CBin::S, CBin::s_mean, CBin::s_var, CentralityBins::table_, and CentralityTable::BinValues::var.

Referenced by CentralityProvider(), and newEvent().

54  {
56  iSetup.get<HeavyIonRcd>().get(centralityLabel_,inputDB_);
57  int nbinsMax = inputDB_->m_table.size();
58  table_.clear();
59  table_.reserve(nbinsMax);
60  for(int j=0; j<nbinsMax; j++){
61  const CentralityTable::CBin* thisBin;
62  thisBin = &(inputDB_->m_table[j]);
63  CBin newBin;
64  newBin.bin_edge = thisBin->bin_edge;
65  newBin.n_part_mean = thisBin->n_part.mean;
66  newBin.n_part_var = thisBin->n_part.var;
67  newBin.n_coll_mean = thisBin->n_coll.mean;
68  newBin.n_coll_var = thisBin->n_coll.var;
69  newBin.n_hard_mean = thisBin->n_hard.mean;
70  newBin.n_hard_var = thisBin->n_hard.var;
71  newBin.b_mean = thisBin->b.mean;
72  newBin.b_var = thisBin->b.var;
73 
74  newBin.eccRP_mean = thisBin->eccRP.mean;
75  newBin.eccRP_var = thisBin->eccRP.var;
76  newBin.ecc2_mean = thisBin->ecc2.mean;
77  newBin.ecc2_var = thisBin->ecc2.var;
78  newBin.ecc3_mean = thisBin->ecc3.mean;
79  newBin.ecc3_var = thisBin->ecc3.var;
80  newBin.s_mean = thisBin->S.mean;
81  newBin.s_var = thisBin->S.var;
82 
83  table_.push_back(newBin);
84  }
85 }
float ecc2_var
float s_mean
float eccRP_var
float bin_edge
float n_part_mean
float n_hard_var
float b_var
float n_hard_mean
float ecc2_mean
int j
Definition: DBlmapReader.cc:9
std::string centralityLabel_
float eccRP_mean
float ecc3_var
float n_coll_mean
const T & get() const
Definition: EventSetup.h:55
float n_part_var
float b_mean
float s_var
std::vector< CBin > table_
float ecc3_mean
float n_coll_var
float CentralityProvider::NhardMean ( ) const
inline

Definition at line 28 of file CentralityProvider.h.

References getBin(), and CentralityBins::NhardMeanOfBin().

Referenced by AnalyzerWithCentrality::analyze().

28 { return NhardMeanOfBin(getBin());}
float NhardMeanOfBin(int bin) const
float CentralityProvider::NhardSigma ( ) const
inline

Definition at line 29 of file CentralityProvider.h.

References getBin(), and CentralityBins::NhardSigmaOfBin().

Referenced by AnalyzerWithCentrality::analyze().

29 { return NhardSigmaOfBin(getBin());}
float NhardSigmaOfBin(int bin) const
float CentralityProvider::NpartMean ( ) const
inline

Definition at line 24 of file CentralityProvider.h.

References getBin(), and CentralityBins::NpartMeanOfBin().

Referenced by AnalyzerWithCentrality::analyze().

24 { return NpartMeanOfBin(getBin());}
float NpartMeanOfBin(int bin) const
float CentralityProvider::NpartSigma ( ) const
inline

Definition at line 25 of file CentralityProvider.h.

References getBin(), and CentralityBins::NpartSigmaOfBin().

Referenced by AnalyzerWithCentrality::analyze().

25 { return NpartSigmaOfBin(getBin());}
float NpartSigmaOfBin(int bin) const
void CentralityProvider::print ( void  )

Definition at line 87 of file CentralityProvider.cc.

References gather_cfg::cout, j, and CentralityBins::table_.

Referenced by AnalyzerWithCentrality::analyze(), and CentralityTableProducer::analyze().

87  {
88  std::cout<<"Number of bins : "<<table_.size()<<std::endl;
89  for(unsigned int j = 0; j < table_.size(); ++j){
90  std::cout<<"Bin : "<<j<<std::endl;
91  std::cout<<"Bin Low Edge : "<<table_[j].bin_edge <<std::endl;
92  std::cout<<"Npart Mean : "<<table_[j].n_part_mean <<std::endl;
93  std::cout<<"Npart RMS : "<<table_[j].n_part_var <<std::endl;
94  std::cout<<"Ncoll Mean : "<<table_[j].n_coll_mean <<std::endl;
95  std::cout<<"Ncoll RMS : "<<table_[j].n_coll_var <<std::endl;
96  std::cout<<"Nhard Mean : "<<table_[j].n_hard_mean <<std::endl;
97  std::cout<<"Nhard RMS : "<<table_[j].n_hard_var <<std::endl;
98  std::cout<<"b Mean : "<<table_[j].b_mean <<std::endl;
99  std::cout<<"b RMS : "<<table_[j].b_var <<std::endl;
100  }
101 }
int j
Definition: DBlmapReader.cc:9
tuple cout
Definition: gather_cfg.py:121
std::vector< CBin > table_
const reco::Centrality* CentralityProvider::raw ( ) const
inline

Definition at line 36 of file CentralityProvider.h.

References chandle_, and edm::Handle< T >::product().

Referenced by AnalyzerWithCentrality::analyze().

36 {return chandle_.product();}
edm::Handle< reco::Centrality > chandle_
T const * product() const
Definition: Handle.h:74
const CentralityBins* CentralityProvider::table ( ) const
inline

Definition at line 35 of file CentralityProvider.h.

35 {return this;}

Member Data Documentation

std::string CentralityProvider::centralityLabel_
private

Definition at line 41 of file CentralityProvider.h.

Referenced by CentralityProvider(), and newRun().

std::string CentralityProvider::centralityMC_
private

Definition at line 42 of file CentralityProvider.h.

Referenced by CentralityProvider().

std::string CentralityProvider::centralityVariable_
private

Definition at line 40 of file CentralityProvider.h.

Referenced by CentralityProvider(), and newEvent().

edm::Handle<reco::Centrality> CentralityProvider::chandle_
mutableprivate

Definition at line 44 of file CentralityProvider.h.

Referenced by centralityValue(), newEvent(), and raw().

unsigned int CentralityProvider::pPbRunFlip_
private

Definition at line 46 of file CentralityProvider.h.

Referenced by CentralityProvider(), and newEvent().

unsigned int CentralityProvider::prevRun_
private

Definition at line 43 of file CentralityProvider.h.

Referenced by newEvent().

edm::InputTag CentralityProvider::tag_
private

Definition at line 39 of file CentralityProvider.h.

Referenced by CentralityProvider(), and newEvent().

VariableType CentralityProvider::varType_
private

Definition at line 45 of file CentralityProvider.h.

Referenced by CentralityProvider(), centralityValue(), and newEvent().