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)
 
 CentralityProvider (const edm::EventSetup &iSetup, edm::ConsumesCollector &&iC)
 
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::EDGetTokenT
< reco::Centrality
tag_
 
VariableType varType_
 

Additional Inherited Members

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

Detailed Description

Definition at line 13 of file CentralityProvider.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

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

Definition at line 3 of file CentralityProvider.cc.

3 {}
CentralityProvider::CentralityProvider ( const edm::EventSetup iSetup,
edm::ConsumesCollector &&  iC 
)

Definition at line 5 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_, AlCaHLTBitMon_QueryRunRegistry::string, tag_, Tracks, and varType_.

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

Definition at line 18 of file CentralityProvider.h.

18 {;}

Member Function Documentation

float CentralityProvider::bMean ( ) const
inline

Definition at line 32 of file CentralityProvider.h.

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

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

Definition at line 33 of file CentralityProvider.h.

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

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

Definition at line 105 of file CentralityProvider.cc.

References chandle_, EB, EE, HFhits, HFtowers, HFtowersMinus, HFtowersMinusTrunc, HFtowersPlus, HFtowersPlusTrunc, HFtowersTrunc, PixelHits, PixelTracks, Tracks, MetTreeProducer::var(), and varType_.

Referenced by getBin().

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

Definition at line 22 of file CentralityProvider.h.

References CentralityBins::table_.

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

Definition at line 25 of file CentralityProvider.h.

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

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

Definition at line 28 of file CentralityProvider.h.

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

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

Definition at line 29 of file CentralityProvider.h.

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

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

Definition at line 42 of file CentralityProvider.cc.

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

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

42  {
44  if(ev.id().run() == prevRun_) return;
45  if(prevRun_ < pPbRunFlip_ && ev.id().run() >= pPbRunFlip_){
46  std::cout<<"Attention, the sides are flipped from this run on!"<<std::endl;
47  if(centralityVariable_.compare("HFtowersPlus") == 0) varType_ = HFtowersMinus;
48  if(centralityVariable_.compare("HFtowersMinus") == 0) varType_ = HFtowersPlus;
49  if(centralityVariable_.compare("HFtowersPlusTrunc") == 0) varType_ = HFtowersMinusTrunc;
50  if(centralityVariable_.compare("HFtowersMinusTrunc") == 0) varType_ = HFtowersPlusTrunc;
51  }
52  prevRun_ = ev.id().run();
53  newRun(iSetup);
54 }
RunNumber_t run() const
Definition: EventID.h:39
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
edm::Handle< reco::Centrality > chandle_
unsigned int pPbRunFlip_
edm::EDGetTokenT< reco::Centrality > tag_
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 56 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 CentralityTableProducer::analyze(), CentralityProvider(), and newEvent().

56  {
58  iSetup.get<HeavyIonRcd>().get(centralityLabel_,inputDB_);
59  int nbinsMax = inputDB_->m_table.size();
60  table_.clear();
61  table_.reserve(nbinsMax);
62  for(int j=0; j<nbinsMax; j++){
63  const CentralityTable::CBin* thisBin;
64  thisBin = &(inputDB_->m_table[j]);
65  CBin newBin;
66  newBin.bin_edge = thisBin->bin_edge;
67  newBin.n_part_mean = thisBin->n_part.mean;
68  newBin.n_part_var = thisBin->n_part.var;
69  newBin.n_coll_mean = thisBin->n_coll.mean;
70  newBin.n_coll_var = thisBin->n_coll.var;
71  newBin.n_hard_mean = thisBin->n_hard.mean;
72  newBin.n_hard_var = thisBin->n_hard.var;
73  newBin.b_mean = thisBin->b.mean;
74  newBin.b_var = thisBin->b.var;
75 
76  newBin.eccRP_mean = thisBin->eccRP.mean;
77  newBin.eccRP_var = thisBin->eccRP.var;
78  newBin.ecc2_mean = thisBin->ecc2.mean;
79  newBin.ecc2_var = thisBin->ecc2.var;
80  newBin.ecc3_mean = thisBin->ecc3.mean;
81  newBin.ecc3_var = thisBin->ecc3.var;
82  newBin.s_mean = thisBin->S.mean;
83  newBin.s_var = thisBin->S.var;
84 
85  table_.push_back(newBin);
86  }
87 }
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 30 of file CentralityProvider.h.

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

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

Definition at line 31 of file CentralityProvider.h.

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

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

Definition at line 26 of file CentralityProvider.h.

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

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

Definition at line 27 of file CentralityProvider.h.

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

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

Definition at line 89 of file CentralityProvider.cc.

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

Referenced by CentralityTableProducer::analyze().

89  {
90  std::cout<<"Number of bins : "<<table_.size()<<std::endl;
91  for(unsigned int j = 0; j < table_.size(); ++j){
92  std::cout<<"Bin : "<<j<<std::endl;
93  std::cout<<"Bin Low Edge : "<<table_[j].bin_edge <<std::endl;
94  std::cout<<"Npart Mean : "<<table_[j].n_part_mean <<std::endl;
95  std::cout<<"Npart RMS : "<<table_[j].n_part_var <<std::endl;
96  std::cout<<"Ncoll Mean : "<<table_[j].n_coll_mean <<std::endl;
97  std::cout<<"Ncoll RMS : "<<table_[j].n_coll_var <<std::endl;
98  std::cout<<"Nhard Mean : "<<table_[j].n_hard_mean <<std::endl;
99  std::cout<<"Nhard RMS : "<<table_[j].n_hard_var <<std::endl;
100  std::cout<<"b Mean : "<<table_[j].b_mean <<std::endl;
101  std::cout<<"b RMS : "<<table_[j].b_var <<std::endl;
102  }
103 }
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 38 of file CentralityProvider.h.

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

38 {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 37 of file CentralityProvider.h.

37 {return this;}

Member Data Documentation

std::string CentralityProvider::centralityLabel_
private

Definition at line 43 of file CentralityProvider.h.

Referenced by CentralityProvider(), and newRun().

std::string CentralityProvider::centralityMC_
private

Definition at line 44 of file CentralityProvider.h.

Referenced by CentralityProvider().

std::string CentralityProvider::centralityVariable_
private

Definition at line 42 of file CentralityProvider.h.

Referenced by CentralityProvider(), and newEvent().

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

Definition at line 46 of file CentralityProvider.h.

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

unsigned int CentralityProvider::pPbRunFlip_
private

Definition at line 48 of file CentralityProvider.h.

Referenced by CentralityProvider(), and newEvent().

unsigned int CentralityProvider::prevRun_
private

Definition at line 45 of file CentralityProvider.h.

Referenced by newEvent().

edm::EDGetTokenT<reco::Centrality> CentralityProvider::tag_
private

Definition at line 41 of file CentralityProvider.h.

Referenced by CentralityProvider(), and newEvent().

VariableType CentralityProvider::varType_
private

Definition at line 47 of file CentralityProvider.h.

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