CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
CentralityBinProducer Class Reference

#include <RecoHI/CentralityBinProducer/src/CentralityBinProducer.cc>

Inheritance diagram for CentralityBinProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 CentralityBinProducer (const edm::ParameterSet &)
 
 ~CentralityBinProducer () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

enum  VariableType {
  HFtowers = 0, HFtowersPlus = 1, HFtowersMinus = 2, HFtowersTrunc = 3,
  HFtowersPlusTrunc = 4, HFtowersMinusTrunc = 5, HFhits = 6, PixelHits = 7,
  PixelTracks = 8, Tracks = 9, EB = 10, EE = 11,
  ZDChitsPlus = 12, ZDChitsMinus = 13, Missing = 14
}
 

Private Member Functions

void beginRun (edm::Run const &run, const edm::EventSetup &iSetup) override
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

std::string centralityLabel_
 
std::string centralityMC_
 
std::string centralityVariable_
 
edm::Handle< reco::Centralitychandle_
 
edm::ESHandle< CentralityTableinputDB_
 
unsigned int pPbRunFlip_
 
unsigned int prevRun_
 
edm::EDGetTokenT< reco::Centralitytag_
 
VariableType varType_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 46 of file CentralityBinProducer.cc.

Member Enumeration Documentation

◆ VariableType

Enumerator
HFtowers 
HFtowersPlus 
HFtowersMinus 
HFtowersTrunc 
HFtowersPlusTrunc 
HFtowersMinusTrunc 
HFhits 
PixelHits 
PixelTracks 
Tracks 
EB 
EE 
ZDChitsPlus 
ZDChitsMinus 
Missing 

Definition at line 47 of file CentralityBinProducer.cc.

47  {
48  HFtowers = 0,
49  HFtowersPlus = 1,
50  HFtowersMinus = 2,
51  HFtowersTrunc = 3,
54  HFhits = 6,
55  PixelHits = 7,
56  PixelTracks = 8,
57  Tracks = 9,
58  EB = 10,
59  EE = 11,
60  ZDChitsPlus = 12,
61  ZDChitsMinus = 13,
62  Missing = 14
63  };

Constructor & Destructor Documentation

◆ CentralityBinProducer()

CentralityBinProducer::CentralityBinProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 99 of file CentralityBinProducer.cc.

99  : prevRun_(0), varType_(Missing) {
100  using namespace edm;
101  tag_ = consumes<reco::Centrality>(iConfig.getParameter<edm::InputTag>("Centrality"));
102  centralityVariable_ = iConfig.getParameter<std::string>("centralityVariable");
103  pPbRunFlip_ = iConfig.getParameter<unsigned int>("pPbRunFlip");
104 
105  if (centralityVariable_ == "HFtowers")
106  varType_ = HFtowers;
107  if (centralityVariable_ == "HFtowersPlus")
109  if (centralityVariable_ == "HFtowersMinus")
111  if (centralityVariable_ == "HFtowersTrunc")
113  if (centralityVariable_ == "HFtowersPlusTrunc")
115  if (centralityVariable_ == "HFtowersMinusTrunc")
117  if (centralityVariable_ == "HFhits")
118  varType_ = HFhits;
119  if (centralityVariable_ == "PixelHits")
121  if (centralityVariable_ == "PixelTracks")
123  if (centralityVariable_ == "Tracks")
124  varType_ = Tracks;
125  if (centralityVariable_ == "EB")
126  varType_ = EB;
127  if (centralityVariable_ == "EE")
128  varType_ = EE;
129  if (centralityVariable_ == "ZDChitsPlus")
131  if (centralityVariable_ == "ZDChitsMinus")
133  if (varType_ == Missing) {
134  std::string errorMessage = "Requested Centrality variable does not exist : " + centralityVariable_ + "\n" +
135  "Supported variables are: \n" +
136  "HFtowers HFtowersPlus HFtowersMinus HFtowersTrunc HFtowersPlusTrunc HFtowersMinusTrunc "
137  "HFhits PixelHits PixelTracks Tracks EB EE" +
138  "\n";
139  throw cms::Exception("Configuration", errorMessage);
140  }
141 
142  if (iConfig.exists("nonDefaultGlauberModel")) {
143  centralityMC_ = iConfig.getParameter<std::string>("nonDefaultGlauberModel");
144  }
146 
147  produces<int>(centralityVariable_);
148 }

References centralityLabel_, centralityMC_, centralityVariable_, EB, EE, Exception, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), HFhits, HFtowers, HFtowersMinus, HFtowersMinusTrunc, HFtowersPlus, HFtowersPlusTrunc, HFtowersTrunc, Missing, PixelHits, PixelTracks, pPbRunFlip_, AlCaHLTBitMon_QueryRunRegistry::string, tag_, Tracks, varType_, ZDChitsMinus, and ZDChitsPlus.

◆ ~CentralityBinProducer()

CentralityBinProducer::~CentralityBinProducer ( )
override

Definition at line 150 of file CentralityBinProducer.cc.

150  {
151  // do anything here that needs to be done at desctruction time
152  // (e.g. close files, deallocate resources etc.)
153 }

Member Function Documentation

◆ beginRun()

void CentralityBinProducer::beginRun ( edm::Run const &  run,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 222 of file CentralityBinProducer.cc.

222  {
223  if (prevRun_ < pPbRunFlip_ && iRun.run() >= pPbRunFlip_) {
224  if (centralityVariable_ == "HFtowersPlus")
226  if (centralityVariable_ == "HFtowersMinus")
228  if (centralityVariable_ == "HFtowersPlusTrunc")
230  if (centralityVariable_ == "HFtowersMinusTrunc")
232  if (centralityVariable_ == "ZDChitsPlus")
234  if (centralityVariable_ == "ZDChitsMinus")
236  }
237  prevRun_ = iRun.run();
238 
240 }

References centralityLabel_, centralityVariable_, edm::EventSetup::get(), get, HFtowersMinus, HFtowersMinusTrunc, HFtowersPlus, HFtowersPlusTrunc, inputDB_, pPbRunFlip_, prevRun_, edm::RunBase::run(), varType_, ZDChitsMinus, and ZDChitsPlus.

◆ produce()

void CentralityBinProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 160 of file CentralityBinProducer.cc.

160  {
161  iEvent.getByToken(tag_, chandle_);
162 
163  double value = 0;
164  switch (varType_) {
165  case HFtowers:
167  break;
168  case HFtowersPlus:
170  break;
171  case HFtowersMinus:
173  break;
174  case HFhits:
176  break;
177  case HFtowersTrunc:
179  break;
180  case HFtowersPlusTrunc:
182  break;
183  case HFtowersMinusTrunc:
185  break;
186  case PixelHits:
188  break;
189  case PixelTracks:
191  break;
192  case Tracks:
193  value = chandle_->Ntracks();
194  break;
195  case EB:
196  value = chandle_->EtEBSum();
197  break;
198  case EE:
199  value = chandle_->EtEESum();
200  break;
201  case ZDChitsPlus:
203  break;
204  case ZDChitsMinus:
206  break;
207  default:
208  throw cms::Exception("CentralityBinProducer", "Centrality variable not recognized.");
209  }
210 
211  int bin = inputDB_->m_table.size() - 1;
212  for (unsigned int i = 0; i < inputDB_->m_table.size(); ++i) {
213  if (value >= inputDB_->m_table[i].bin_edge && value) {
214  bin = i;
215  break;
216  }
217  }
218 
219  iEvent.put(std::make_unique<int>(bin), centralityVariable_);
220 }

References newFWLiteAna::bin, centralityVariable_, chandle_, EB, EE, reco::Centrality::EtEBSum(), reco::Centrality::EtEESum(), reco::Centrality::EtHFhitSum(), reco::Centrality::EtHFtowerSum(), reco::Centrality::EtHFtowerSumMinus(), reco::Centrality::EtHFtowerSumPlus(), reco::Centrality::EtHFtruncated(), reco::Centrality::EtHFtruncatedMinus(), reco::Centrality::EtHFtruncatedPlus(), Exception, HFhits, HFtowers, HFtowersMinus, HFtowersMinusTrunc, HFtowersPlus, HFtowersPlusTrunc, HFtowersTrunc, mps_fire::i, iEvent, inputDB_, CentralityTable::m_table, reco::Centrality::multiplicityPixel(), reco::Centrality::NpixelTracks(), reco::Centrality::Ntracks(), PixelHits, PixelTracks, tag_, Tracks, varType_, ZDChitsMinus, ZDChitsPlus, reco::Centrality::zdcSumMinus(), and reco::Centrality::zdcSumPlus().

Member Data Documentation

◆ centralityLabel_

std::string CentralityBinProducer::centralityLabel_
private

Definition at line 80 of file CentralityBinProducer.cc.

Referenced by beginRun(), and CentralityBinProducer().

◆ centralityMC_

std::string CentralityBinProducer::centralityMC_
private

Definition at line 81 of file CentralityBinProducer.cc.

Referenced by CentralityBinProducer().

◆ centralityVariable_

std::string CentralityBinProducer::centralityVariable_
private

Definition at line 79 of file CentralityBinProducer.cc.

Referenced by beginRun(), CentralityBinProducer(), and produce().

◆ chandle_

edm::Handle<reco::Centrality> CentralityBinProducer::chandle_
private

Definition at line 75 of file CentralityBinProducer.cc.

Referenced by produce().

◆ inputDB_

edm::ESHandle<CentralityTable> CentralityBinProducer::inputDB_
private

Definition at line 77 of file CentralityBinProducer.cc.

Referenced by beginRun(), and produce().

◆ pPbRunFlip_

unsigned int CentralityBinProducer::pPbRunFlip_
private

Definition at line 85 of file CentralityBinProducer.cc.

Referenced by beginRun(), and CentralityBinProducer().

◆ prevRun_

unsigned int CentralityBinProducer::prevRun_
private

Definition at line 82 of file CentralityBinProducer.cc.

Referenced by beginRun().

◆ tag_

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

Definition at line 76 of file CentralityBinProducer.cc.

Referenced by CentralityBinProducer(), and produce().

◆ varType_

VariableType CentralityBinProducer::varType_
private

Definition at line 84 of file CentralityBinProducer.cc.

Referenced by beginRun(), CentralityBinProducer(), and produce().

CentralityBinProducer::HFtowersPlus
Definition: CentralityBinProducer.cc:49
mps_fire.i
i
Definition: mps_fire.py:355
CentralityBinProducer::centralityLabel_
std::string centralityLabel_
Definition: CentralityBinProducer.cc:80
CentralityBinProducer::chandle_
edm::Handle< reco::Centrality > chandle_
Definition: CentralityBinProducer.cc:75
reco::Centrality::EtHFhitSum
double EtHFhitSum() const
Definition: Centrality.h:21
edm
HLT enums.
Definition: AlignableModifier.h:19
CentralityBinProducer::EB
Definition: CentralityBinProducer.cc:58
CentralityBinProducer::centralityMC_
std::string centralityMC_
Definition: CentralityBinProducer.cc:81
CentralityBinProducer::PixelTracks
Definition: CentralityBinProducer.cc:56
CentralityBinProducer::HFtowersMinus
Definition: CentralityBinProducer.cc:50
CentralityBinProducer::ZDChitsMinus
Definition: CentralityBinProducer.cc:61
CentralityBinProducer::HFtowersMinusTrunc
Definition: CentralityBinProducer.cc:53
CentralityBinProducer::Missing
Definition: CentralityBinProducer.cc:62
CentralityBinProducer::HFtowersPlusTrunc
Definition: CentralityBinProducer.cc:52
CentralityBinProducer::PixelHits
Definition: CentralityBinProducer.cc:55
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
reco::Centrality::EtHFtruncated
double EtHFtruncated() const
Definition: Centrality.h:30
reco::Centrality::EtEBSum
double EtEBSum() const
Definition: Centrality.h:39
reco::Centrality::EtHFtowerSumPlus
double EtHFtowerSumPlus() const
Definition: Centrality.h:25
CentralityBinProducer::varType_
VariableType varType_
Definition: CentralityBinProducer.cc:84
reco::Centrality::EtHFtruncatedMinus
double EtHFtruncatedMinus() const
Definition: Centrality.h:32
CentralityTable::m_table
std::vector< CBin > m_table
Definition: CentralityTable.h:39
reco::Centrality::EtEESum
double EtEESum() const
Definition: Centrality.h:33
reco::Centrality::zdcSumPlus
double zdcSumPlus() const
Definition: Centrality.h:55
CentralityBinProducer::inputDB_
edm::ESHandle< CentralityTable > inputDB_
Definition: CentralityBinProducer.cc:77
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:674
CentralityBinProducer::tag_
edm::EDGetTokenT< reco::Centrality > tag_
Definition: CentralityBinProducer.cc:76
iEvent
int iEvent
Definition: GenABIO.cc:224
CentralityBinProducer::prevRun_
unsigned int prevRun_
Definition: CentralityBinProducer.cc:82
value
Definition: value.py:1
reco::Centrality::EtHFtruncatedPlus
double EtHFtruncatedPlus() const
Definition: Centrality.h:31
CentralityBinProducer::pPbRunFlip_
unsigned int pPbRunFlip_
Definition: CentralityBinProducer.cc:85
get
#define get
CentralityBinProducer::Tracks
Definition: CentralityBinProducer.cc:57
CentralityBinProducer::HFtowersTrunc
Definition: CentralityBinProducer.cc:51
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
CentralityBinProducer::centralityVariable_
std::string centralityVariable_
Definition: CentralityBinProducer.cc:79
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
CentralityBinProducer::ZDChitsPlus
Definition: CentralityBinProducer.cc:60
reco::Centrality::NpixelTracks
double NpixelTracks() const
Definition: Centrality.h:50
Exception
Definition: hltDiff.cc:246
reco::Centrality::zdcSumMinus
double zdcSumMinus() const
Definition: Centrality.h:56
reco::Centrality::multiplicityPixel
double multiplicityPixel() const
Definition: Centrality.h:43
CentralityBinProducer::HFhits
Definition: CentralityBinProducer.cc:54
HeavyIonRcd
Definition: HeavyIonRcd.h:24
reco::Centrality::EtHFtowerSum
double EtHFtowerSum() const
Definition: Centrality.h:24
CentralityBinProducer::EE
Definition: CentralityBinProducer.cc:59
reco::Centrality::Ntracks
double Ntracks() const
Definition: Centrality.h:46
edm::InputTag
Definition: InputTag.h:15
CentralityBinProducer::HFtowers
Definition: CentralityBinProducer.cc:48
reco::Centrality::EtHFtowerSumMinus
double EtHFtowerSumMinus() const
Definition: Centrality.h:26