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, 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 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(), HFhits, HFtowers, Missing, newRun(), PixelHits, PixelTracks, AlCaHLTBitMon_QueryRunRegistry::string, 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  if(centralityVariable_.compare("HFtowers") == 0) varType_ = HFtowers;
13  if(centralityVariable_.compare("HFhits") == 0) varType_ = HFhits;
14  if(centralityVariable_.compare("PixelHits") == 0) varType_ = PixelHits;
15  if(centralityVariable_.compare("PixelTracks") == 0) varType_ = PixelTracks;
16  if(centralityVariable_.compare("Tracks") == 0) varType_ = Tracks;
17  if(centralityVariable_.compare("EB") == 0) varType_ = EB;
18  if(centralityVariable_.compare("EE") == 0) varType_ = EE;
19  if(varType_ == Missing){
20  std::string errorMessage="Requested Centrality variable does not exist : "+centralityVariable_+"\n" +
21  "Supported variables are: \n" + "HFtowers HFhits PixelHits PixelTracks Tracks EB EE" + "\n";
22  throw cms::Exception("Configuration",errorMessage);
23  }
24  if(hiPset.exists("nonDefaultGlauberModel")){
25  centralityMC_ = hiPset.getParameter<std::string>("nonDefaultGlauberModel");
26  }
27  centralityLabel_ = centralityVariable_+centralityMC_;
28  SetName(centralityLabel_.data());
29  }else{
30  }
31  newRun(iSetup);
32 }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::string centralityLabel_
ParameterSet const & getProcessParameterSet()
Definition: Registry.cc:82
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().

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().

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

Definition at line 90 of file CentralityProvider.cc.

References chandle_, EB, EE, HFhits, HFtowers, PixelHits, PixelTracks, Tracks, and varType_.

Referenced by getBin().

90  {
91  double var = -99;
92  if(varType_ == HFhits) var = chandle_->EtHFhitSum();
93  if(varType_ == HFtowers) var = chandle_->EtHFtowerSum();
94  if(varType_ == PixelHits) var = chandle_->multiplicityPixel();
95  if(varType_ == PixelTracks) var = chandle_->NpixelTracks();
96  if(varType_ == Tracks) var = chandle_->Ntracks();
97  if(varType_ == EB) var = chandle_->EtEBSum();
98  if(varType_ == EE) var = chandle_->EtEESum();
99 
100  return var;
101 }
edm::Handle< reco::Centrality > chandle_
int CentralityProvider::getBin ( ) const
inline
int CentralityProvider::getNbins ( ) const
inline

Definition at line 20 of file CentralityProvider.h.

References CentralityBins::table_.

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().

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().

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

Definition at line 34 of file CentralityProvider.cc.

References chandle_, edm::Event::getByLabel(), edm::EventBase::id(), newRun(), prevRun_, edm::EventID::run(), and tag_.

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

34  {
36  if(ev.id().run() == prevRun_) return;
37  prevRun_ = ev.id().run();
38  newRun(iSetup);
39 }
RunNumber_t run() const
Definition: EventID.h:42
edm::Handle< reco::Centrality > chandle_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
void newRun(const edm::EventSetup &iSetup)
edm::EventID id() const
Definition: EventBase.h:56
void CentralityProvider::newRun ( const edm::EventSetup iSetup)

Definition at line 41 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().

41  {
43  iSetup.get<HeavyIonRcd>().get(centralityLabel_,inputDB_);
44  int nbinsMax = inputDB_->m_table.size();
45  table_.clear();
46  table_.reserve(nbinsMax);
47  for(int j=0; j<nbinsMax; j++){
48  const CentralityTable::CBin* thisBin;
49  thisBin = &(inputDB_->m_table[j]);
50  CBin newBin;
51  newBin.bin_edge = thisBin->bin_edge;
52  newBin.n_part_mean = thisBin->n_part.mean;
53  newBin.n_part_var = thisBin->n_part.var;
54  newBin.n_coll_mean = thisBin->n_coll.mean;
55  newBin.n_coll_var = thisBin->n_coll.var;
56  newBin.n_hard_mean = thisBin->n_hard.mean;
57  newBin.n_hard_var = thisBin->n_hard.var;
58  newBin.b_mean = thisBin->b.mean;
59  newBin.b_var = thisBin->b.var;
60 
61  newBin.eccRP_mean = thisBin->eccRP.mean;
62  newBin.eccRP_var = thisBin->eccRP.var;
63  newBin.ecc2_mean = thisBin->ecc2.mean;
64  newBin.ecc2_var = thisBin->ecc2.var;
65  newBin.ecc3_mean = thisBin->ecc3.mean;
66  newBin.ecc3_var = thisBin->ecc3.var;
67  newBin.s_mean = thisBin->S.mean;
68  newBin.s_var = thisBin->S.var;
69 
70  table_.push_back(newBin);
71  }
72 }
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().

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().

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().

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().

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

Definition at line 74 of file CentralityProvider.cc.

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

Referenced by CentralityTableProducer::analyze().

74  {
75  std::cout<<"Number of bins : "<<table_.size()<<std::endl;
76  for(unsigned int j = 0; j < table_.size(); ++j){
77  std::cout<<"Bin : "<<j<<std::endl;
78  std::cout<<"Bin Low Edge : "<<table_[j].bin_edge <<std::endl;
79  std::cout<<"Npart Mean : "<<table_[j].n_part_mean <<std::endl;
80  std::cout<<"Npart RMS : "<<table_[j].n_part_var <<std::endl;
81  std::cout<<"Ncoll Mean : "<<table_[j].n_coll_mean <<std::endl;
82  std::cout<<"Ncoll RMS : "<<table_[j].n_coll_var <<std::endl;
83  std::cout<<"Nhard Mean : "<<table_[j].n_hard_mean <<std::endl;
84  std::cout<<"Nhard RMS : "<<table_[j].n_hard_var <<std::endl;
85  std::cout<<"b Mean : "<<table_[j].b_mean <<std::endl;
86  std::cout<<"b RMS : "<<table_[j].b_var <<std::endl;
87  }
88 }
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().

36 {return chandle_.product();}
edm::Handle< reco::Centrality > chandle_
T const * product() const
Definition: Handle.h:81
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().

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

Definition at line 44 of file CentralityProvider.h.

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

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(), and centralityValue().