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
 
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)
 
 ~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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, 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 ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 48 of file CentralityBinProducer.cc.

Member Enumeration Documentation

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

Definition at line 49 of file CentralityBinProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 87 of file CentralityBinProducer.cc.

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.

87  :
88  prevRun_(0),
90 {
91  using namespace edm;
92  tag_ = consumes<reco::Centrality>(iConfig.getParameter<edm::InputTag>("Centrality"));
93  centralityVariable_ = iConfig.getParameter<std::string>("centralityVariable");
94  pPbRunFlip_ = iConfig.getParameter<unsigned int>("pPbRunFlip");
95 
96  if(centralityVariable_ == "HFtowers") varType_ = HFtowers;
97  if(centralityVariable_ == "HFtowersPlus") varType_ = HFtowersPlus;
98  if(centralityVariable_ == "HFtowersMinus") varType_ = HFtowersMinus;
99  if(centralityVariable_ == "HFtowersTrunc") varType_ = HFtowersTrunc;
100  if(centralityVariable_ == "HFtowersPlusTrunc") varType_ = HFtowersPlusTrunc;
101  if(centralityVariable_ == "HFtowersMinusTrunc") varType_ = HFtowersMinusTrunc;
102  if(centralityVariable_ == "HFhits") varType_ = HFhits;
103  if(centralityVariable_ == "PixelHits") varType_ = PixelHits;
104  if(centralityVariable_ == "PixelTracks") varType_ = PixelTracks;
105  if(centralityVariable_ == "Tracks") varType_ = Tracks;
106  if(centralityVariable_ == "EB") varType_ = EB;
107  if(centralityVariable_ == "EE") varType_ = EE;
108  if(centralityVariable_ == "ZDChitsPlus") varType_ = ZDChitsPlus;
109  if(centralityVariable_ == "ZDChitsMinus") varType_ = ZDChitsMinus;
110  if(varType_ == Missing){
111  std::string errorMessage="Requested Centrality variable does not exist : "+centralityVariable_+"\n" +
112  "Supported variables are: \n" + "HFtowers HFtowersPlus HFtowersMinus HFtowersTrunc HFtowersPlusTrunc HFtowersMinusTrunc HFhits PixelHits PixelTracks Tracks EB EE" + "\n";
113  throw cms::Exception("Configuration",errorMessage);
114  }
115 
116  if(iConfig.exists("nonDefaultGlauberModel")){
117  centralityMC_ = iConfig.getParameter<std::string>("nonDefaultGlauberModel");
118  }
120 
121  produces<int>(centralityVariable_);
122 }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
HLT enums.
edm::EDGetTokenT< reco::Centrality > tag_
CentralityBinProducer::~CentralityBinProducer ( )
override

Definition at line 125 of file CentralityBinProducer.cc.

126 {
127 
128  // do anything here that needs to be done at desctruction time
129  // (e.g. close files, deallocate resources etc.)
130 
131 }

Member Function Documentation

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

Definition at line 180 of file CentralityBinProducer.cc.

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

181 {
182 
183  if(prevRun_ < pPbRunFlip_ && iRun.run() >= pPbRunFlip_){
184  if(centralityVariable_ == "HFtowersPlus") varType_ = HFtowersMinus;
185  if(centralityVariable_ == "HFtowersMinus") varType_ = HFtowersPlus;
186  if(centralityVariable_ == "HFtowersPlusTrunc") varType_ = HFtowersMinusTrunc;
187  if(centralityVariable_ == "HFtowersMinusTrunc") varType_ = HFtowersPlusTrunc;
188  if(centralityVariable_ == "ZDChitsPlus") varType_ = ZDChitsMinus;
189  if(centralityVariable_ == "ZDChitsMinus") varType_ = ZDChitsPlus;
190  }
191  prevRun_ = iRun.run();
192 
193  iSetup.get<HeavyIonRcd>().get(centralityLabel_,inputDB_);
194 
195 }
edm::ESHandle< CentralityTable > inputDB_
T get() const
Definition: EventSetup.h:63
void CentralityBinProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 140 of file CentralityBinProducer.cc.

References stringResolutionProvider_cfi::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, edm::Event::getByToken(), HFhits, HFtowers, HFtowersMinus, HFtowersMinusTrunc, HFtowersPlus, HFtowersPlusTrunc, HFtowersTrunc, mps_fire::i, inputDB_, CentralityTable::m_table, reco::Centrality::multiplicityPixel(), reco::Centrality::NpixelTracks(), reco::Centrality::Ntracks(), PixelHits, PixelTracks, edm::Event::put(), tag_, Tracks, varType_, ZDChitsMinus, ZDChitsPlus, reco::Centrality::zdcSumMinus(), and reco::Centrality::zdcSumPlus().

141 {
142 
143  iEvent.getByToken(tag_,chandle_);
144 
145  double value = 0;
146  switch(varType_){
147  case HFtowers : value = chandle_->EtHFtowerSum();break;
148  case HFtowersPlus : value = chandle_->EtHFtowerSumPlus();break;
149  case HFtowersMinus : value = chandle_->EtHFtowerSumMinus();break;
150  case HFhits : value = chandle_->EtHFhitSum();break;
151  case HFtowersTrunc : value = chandle_->EtHFtruncated();break;
152  case HFtowersPlusTrunc : value = chandle_->EtHFtruncatedPlus();break;
153  case HFtowersMinusTrunc : value = chandle_->EtHFtruncatedMinus();break;
154  case PixelHits : value = chandle_->multiplicityPixel();break;
155  case PixelTracks : value = chandle_->NpixelTracks();break;
156  case Tracks : value = chandle_->Ntracks();break;
157  case EB : value = chandle_->EtEBSum();break;
158  case EE : value = chandle_->EtEESum();break;
159  case ZDChitsPlus : value = chandle_->zdcSumPlus();break;
160  case ZDChitsMinus : value = chandle_->zdcSumMinus();break;
161  default:
162  throw cms::Exception("CentralityBinProducer","Centrality variable not recognized.");
163  }
164 
165  int bin = inputDB_->m_table.size() - 1;
166  for(unsigned int i = 0; i < inputDB_->m_table.size(); ++i){
167 
168  if(value >= inputDB_->m_table[i].bin_edge && value){
169  bin = i; break;
170  }
171 
172  }
173 
174  iEvent.put(std::make_unique<int>(bin),centralityVariable_);
175 
176 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
std::vector< CBin > m_table
double EtEESum() const
Definition: Centrality.h:29
double Ntracks() const
Definition: Centrality.h:40
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
double EtHFtowerSumMinus() const
Definition: Centrality.h:25
double EtHFtruncatedPlus() const
Definition: Centrality.h:27
edm::ESHandle< CentralityTable > inputDB_
double zdcSumMinus() const
Definition: Centrality.h:48
double EtHFtowerSumPlus() const
Definition: Centrality.h:24
Definition: value.py:1
edm::Handle< reco::Centrality > chandle_
bin
set the eta bin as selection string.
double EtHFtruncatedMinus() const
Definition: Centrality.h:28
double multiplicityPixel() const
Definition: Centrality.h:39
double EtHFtowerSum() const
Definition: Centrality.h:23
double EtEBSum() const
Definition: Centrality.h:35
double EtHFhitSum() const
Definition: Centrality.h:20
double EtHFtruncated() const
Definition: Centrality.h:26
edm::EDGetTokenT< reco::Centrality > tag_
double NpixelTracks() const
Definition: Centrality.h:44
double zdcSumPlus() const
Definition: Centrality.h:47

Member Data Documentation

std::string CentralityBinProducer::centralityLabel_
private

Definition at line 66 of file CentralityBinProducer.cc.

Referenced by beginRun(), and CentralityBinProducer().

std::string CentralityBinProducer::centralityMC_
private

Definition at line 67 of file CentralityBinProducer.cc.

Referenced by CentralityBinProducer().

std::string CentralityBinProducer::centralityVariable_
private

Definition at line 65 of file CentralityBinProducer.cc.

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

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

Definition at line 61 of file CentralityBinProducer.cc.

Referenced by produce().

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

Definition at line 63 of file CentralityBinProducer.cc.

Referenced by beginRun(), and produce().

unsigned int CentralityBinProducer::pPbRunFlip_
private

Definition at line 71 of file CentralityBinProducer.cc.

Referenced by beginRun(), and CentralityBinProducer().

unsigned int CentralityBinProducer::prevRun_
private

Definition at line 68 of file CentralityBinProducer.cc.

Referenced by beginRun().

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

Definition at line 62 of file CentralityBinProducer.cc.

Referenced by CentralityBinProducer(), and produce().

VariableType CentralityBinProducer::varType_
private

Definition at line 70 of file CentralityBinProducer.cc.

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