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::stream::EDProducer<>

Public Member Functions

 CentralityBinProducer (const edm::ParameterSet &)
 
 ~CentralityBinProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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_
 
edm::ESGetToken< CentralityTable, HeavyIonRcdinputDBToken_
 
unsigned int pPbRunFlip_
 
unsigned int prevRun_
 
edm::EDGetTokenT< reco::Centralitytag_
 
VariableType varType_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

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 100 of file CentralityBinProducer.cc.

100  : prevRun_(0), varType_(Missing) {
101  using namespace edm;
102  tag_ = consumes<reco::Centrality>(iConfig.getParameter<edm::InputTag>("Centrality"));
103  centralityVariable_ = iConfig.getParameter<std::string>("centralityVariable");
104  pPbRunFlip_ = iConfig.getParameter<unsigned int>("pPbRunFlip");
105 
106  if (centralityVariable_ == "HFtowers")
107  varType_ = HFtowers;
108  if (centralityVariable_ == "HFtowersPlus")
110  if (centralityVariable_ == "HFtowersMinus")
112  if (centralityVariable_ == "HFtowersTrunc")
114  if (centralityVariable_ == "HFtowersPlusTrunc")
116  if (centralityVariable_ == "HFtowersMinusTrunc")
118  if (centralityVariable_ == "HFhits")
119  varType_ = HFhits;
120  if (centralityVariable_ == "PixelHits")
122  if (centralityVariable_ == "PixelTracks")
124  if (centralityVariable_ == "Tracks")
125  varType_ = Tracks;
126  if (centralityVariable_ == "EB")
127  varType_ = EB;
128  if (centralityVariable_ == "EE")
129  varType_ = EE;
130  if (centralityVariable_ == "ZDChitsPlus")
132  if (centralityVariable_ == "ZDChitsMinus")
134  if (varType_ == Missing) {
135  std::string errorMessage = "Requested Centrality variable does not exist : " + centralityVariable_ + "\n" +
136  "Supported variables are: \n" +
137  "HFtowers HFtowersPlus HFtowersMinus HFtowersTrunc HFtowersPlusTrunc HFtowersMinusTrunc "
138  "HFhits PixelHits PixelTracks Tracks EB EE" +
139  "\n";
140  throw cms::Exception("Configuration", errorMessage);
141  }
142 
143  if (iConfig.exists("nonDefaultGlauberModel")) {
144  centralityMC_ = iConfig.getParameter<std::string>("nonDefaultGlauberModel");
145  }
147  inputDBToken_ =
148  esConsumes<CentralityTable, HeavyIonRcd, edm::Transition::BeginRun>(edm::ESInputTag("", centralityLabel_));
149 
150  produces<int>(centralityVariable_);
151 }

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

◆ ~CentralityBinProducer()

CentralityBinProducer::~CentralityBinProducer ( )
override

Definition at line 153 of file CentralityBinProducer.cc.

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

Member Function Documentation

◆ beginRun()

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

Definition at line 225 of file CentralityBinProducer.cc.

225  {
226  if (prevRun_ < pPbRunFlip_ && iRun.run() >= pPbRunFlip_) {
227  if (centralityVariable_ == "HFtowersPlus")
229  if (centralityVariable_ == "HFtowersMinus")
231  if (centralityVariable_ == "HFtowersPlusTrunc")
233  if (centralityVariable_ == "HFtowersMinusTrunc")
235  if (centralityVariable_ == "ZDChitsPlus")
237  if (centralityVariable_ == "ZDChitsMinus")
239  }
240  prevRun_ = iRun.run();
241 
242  inputDB_ = iSetup.getHandle(inputDBToken_);
243 }

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

◆ produce()

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

Definition at line 163 of file CentralityBinProducer.cc.

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

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 81 of file CentralityBinProducer.cc.

Referenced by CentralityBinProducer().

◆ centralityMC_

std::string CentralityBinProducer::centralityMC_
private

Definition at line 82 of file CentralityBinProducer.cc.

Referenced by CentralityBinProducer().

◆ centralityVariable_

std::string CentralityBinProducer::centralityVariable_
private

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

◆ inputDBToken_

edm::ESGetToken<CentralityTable, HeavyIonRcd> CentralityBinProducer::inputDBToken_
private

Definition at line 78 of file CentralityBinProducer.cc.

Referenced by beginRun(), and CentralityBinProducer().

◆ pPbRunFlip_

unsigned int CentralityBinProducer::pPbRunFlip_
private

Definition at line 86 of file CentralityBinProducer.cc.

Referenced by beginRun(), and CentralityBinProducer().

◆ prevRun_

unsigned int CentralityBinProducer::prevRun_
private

Definition at line 83 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 85 of file CentralityBinProducer.cc.

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

CentralityBinProducer::HFtowersPlus
Definition: CentralityBinProducer.cc:49
mps_fire.i
i
Definition: mps_fire.py:428
edm::ESInputTag
Definition: ESInputTag.h:87
CentralityBinProducer::centralityLabel_
std::string centralityLabel_
Definition: CentralityBinProducer.cc:81
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:82
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
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:85
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:681
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:83
value
Definition: value.py:1
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:148
reco::Centrality::EtHFtruncatedPlus
double EtHFtruncatedPlus() const
Definition: Centrality.h:31
CentralityBinProducer::pPbRunFlip_
unsigned int pPbRunFlip_
Definition: CentralityBinProducer.cc:86
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:80
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
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
CentralityBinProducer::HFhits
Definition: CentralityBinProducer.cc:54
reco::Centrality::EtHFtowerSum
double EtHFtowerSum() const
Definition: Centrality.h:24
CentralityBinProducer::EE
Definition: CentralityBinProducer.cc:59
CentralityBinProducer::inputDBToken_
edm::ESGetToken< CentralityTable, HeavyIonRcd > inputDBToken_
Definition: CentralityBinProducer.cc:78
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