CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes | Private Types
hcaldqm::quantity::CrateQuantity Class Reference

#include <ElectronicsQuantity.h>

Inheritance diagram for hcaldqm::quantity::CrateQuantity:
hcaldqm::quantity::ElectronicsQuantity hcaldqm::quantity::Quantity

Public Member Functions

 CrateQuantity ()
 
 CrateQuantity (HcalElectronicsMap const *emap)
 
 CrateQuantity (std::vector< int > crates, CrateHashMap crateHashes)
 
uint32_t getBin (HcalElectronicsId const &) override
 
std::vector< std::string > getLabels () override
 
int getValue (HcalElectronicsId const &) override
 
CrateQuantitymakeCopy () override
 
double max () override
 
double min () override
 
int nbins () override
 
virtual void setup (HcalElectronicsMap const *emap)
 
virtual void setup (std::vector< int > crates, CrateHashMap crateHashes)
 
 ~CrateQuantity () override
 
- Public Member Functions inherited from hcaldqm::quantity::ElectronicsQuantity
 ElectronicsQuantity ()
 
 ElectronicsQuantity (ElectronicsQuantityType type, bool isLog=false)
 
bool isCoordinate () override
 
QuantityType type () override
 
 ~ElectronicsQuantity () override
 
- Public Member Functions inherited from hcaldqm::quantity::Quantity
virtual uint32_t getBin (double)
 
virtual uint32_t getBin (HcalDetId const &)
 
virtual uint32_t getBin (HcalTrigTowerDetId const &)
 
virtual uint32_t getBin (int)
 
virtual double getValue (double x)
 
virtual int getValue (HcalDetId const &)
 
virtual int getValue (HcalTrigTowerDetId const &)
 
virtual int getValue (int x)
 
virtual bool isLog ()
 
virtual std::string name ()
 
 Quantity ()
 
 Quantity (std::string const &name, bool isLog)
 
virtual void setAxisType (AxisType at)
 
virtual void setBits (TH1 *o)
 
virtual void setLog (TH1 *o)
 
virtual void setMax (double)
 
virtual void setMin (double)
 
virtual void setNbins (int)
 
virtual void showOverflow (bool showOverflow)
 
virtual int wofnbins ()
 
virtual ~Quantity ()
 

Protected Attributes

CrateHashMap _crateHashes
 
std::vector< int > _crates
 
- Protected Attributes inherited from hcaldqm::quantity::ElectronicsQuantity
ElectronicsQuantityType _type
 
- Protected Attributes inherited from hcaldqm::quantity::Quantity
AxisType _axistype
 
bool _isLog
 
std::string _name
 
bool _showOverflow
 

Private Types

typedef std::map< int, uint32_t > CrateHashMap
 

Detailed Description

Definition at line 390 of file ElectronicsQuantity.h.

Member Typedef Documentation

◆ CrateHashMap

typedef std::map<int, uint32_t> hcaldqm::quantity::CrateQuantity::CrateHashMap
private

Definition at line 391 of file ElectronicsQuantity.h.

Constructor & Destructor Documentation

◆ CrateQuantity() [1/3]

hcaldqm::quantity::CrateQuantity::CrateQuantity ( )
inline

Definition at line 394 of file ElectronicsQuantity.h.

394 {}

Referenced by makeCopy().

◆ CrateQuantity() [2/3]

hcaldqm::quantity::CrateQuantity::CrateQuantity ( HcalElectronicsMap const *  emap)
inline

Definition at line 395 of file ElectronicsQuantity.h.

395 : ElectronicsQuantity(fCrate, false) { this->setup(emap); }

References setup().

◆ CrateQuantity() [3/3]

hcaldqm::quantity::CrateQuantity::CrateQuantity ( std::vector< int >  crates,
CrateHashMap  crateHashes 
)
inline

Definition at line 396 of file ElectronicsQuantity.h.

396  : ElectronicsQuantity(fCrate, false) {
397  this->setup(crates, crateHashes);
398  }

References setup().

◆ ~CrateQuantity()

hcaldqm::quantity::CrateQuantity::~CrateQuantity ( )
inlineoverride

Definition at line 399 of file ElectronicsQuantity.h.

399 {}

Member Function Documentation

◆ getBin()

uint32_t hcaldqm::quantity::CrateQuantity::getBin ( HcalElectronicsId const &  eid)
overridevirtual

Reimplemented from hcaldqm::quantity::ElectronicsQuantity.

Definition at line 585 of file ElectronicsQuantity.cc.

585  {
586  int crate = eid.crateId();
587  auto it = std::find(_crates.begin(), _crates.end(), crate);
588  if (it == _crates.end()) {
589  return 0;
590  } else {
591  return std::distance(_crates.begin(), it) + 1;
592  }
593  }

References HLT_2018_cff::distance, runTauDisplay::eid, and spr::find().

Referenced by BTagWeightCalculator.BTagWeightCalculator::calcJetWeightImpl().

◆ getLabels()

std::vector< std::string > hcaldqm::quantity::CrateQuantity::getLabels ( )
overridevirtual

Reimplemented from hcaldqm::quantity::ElectronicsQuantity.

Definition at line 595 of file ElectronicsQuantity.cc.

595  {
596  std::vector<std::string> labels;
597  char name[5];
598  for (auto &it_crate : _crates) {
600  if (eid.isVMEid()) {
601  sprintf(name, "%dv", it_crate);
602  } else {
603  sprintf(name, "%du", it_crate);
604  }
605  labels.push_back(name);
606  }
607  return labels;
608  }

References runTauDisplay::eid, SummaryClient_cfi::labels, and Skims_PA_cff::name.

◆ getValue()

int hcaldqm::quantity::CrateQuantity::getValue ( HcalElectronicsId const &  eid)
overridevirtual

Reimplemented from hcaldqm::quantity::ElectronicsQuantity.

Definition at line 583 of file ElectronicsQuantity.cc.

583 { return eid.crateId(); }

References runTauDisplay::eid.

◆ makeCopy()

CrateQuantity* hcaldqm::quantity::CrateQuantity::makeCopy ( )
inlineoverridevirtual

Reimplemented from hcaldqm::quantity::ElectronicsQuantity.

Definition at line 416 of file ElectronicsQuantity.h.

416  {
417  // Make copies of the crate info
418  std::vector<int> tmpCrates;
419  std::map<int, uint32_t> tmpCrateHashes;
420  for (auto &it_crate : _crates) {
421  tmpCrates.push_back(it_crate);
422  tmpCrateHashes[it_crate] = _crateHashes[it_crate];
423  }
424  return new CrateQuantity(tmpCrates, tmpCrateHashes);
425  }

References _crateHashes, _crates, and CrateQuantity().

◆ max()

double hcaldqm::quantity::CrateQuantity::max ( )
inlineoverridevirtual

Reimplemented from hcaldqm::quantity::ElectronicsQuantity.

Definition at line 408 of file ElectronicsQuantity.h.

408 { return _crates.size(); }

References _crates.

◆ min()

double hcaldqm::quantity::CrateQuantity::min ( )
inlineoverridevirtual

Reimplemented from hcaldqm::quantity::ElectronicsQuantity.

Definition at line 407 of file ElectronicsQuantity.h.

407 { return 0; }

◆ nbins()

int hcaldqm::quantity::CrateQuantity::nbins ( )
inlineoverridevirtual

Reimplemented from hcaldqm::quantity::ElectronicsQuantity.

Definition at line 406 of file ElectronicsQuantity.h.

406 { return _crates.size(); }

References _crates.

◆ setup() [1/2]

void hcaldqm::quantity::CrateQuantity::setup ( HcalElectronicsMap const *  emap)
virtual

◆ setup() [2/2]

virtual void hcaldqm::quantity::CrateQuantity::setup ( std::vector< int >  crates,
CrateHashMap  crateHashes 
)
virtual

Member Data Documentation

◆ _crateHashes

CrateHashMap hcaldqm::quantity::CrateQuantity::_crateHashes
protected

Definition at line 413 of file ElectronicsQuantity.h.

Referenced by makeCopy().

◆ _crates

std::vector<int> hcaldqm::quantity::CrateQuantity::_crates
protected

Definition at line 412 of file ElectronicsQuantity.h.

Referenced by makeCopy(), max(), and nbins().

SummaryClient_cfi.labels
labels
Definition: SummaryClient_cfi.py:61
hcaldqm::utilities::getCrateHashMap
std::map< int, uint32_t > getCrateHashMap(HcalElectronicsMap const *emap)
Definition: Utilities.cc:66
hcaldqm::quantity::CrateQuantity::_crates
std::vector< int > _crates
Definition: ElectronicsQuantity.h:412
hcaldqm::utilities::getCrateList
std::vector< int > getCrateList(HcalElectronicsMap const *emap)
Definition: Utilities.cc:52
HLT_2018_cff.distance
distance
Definition: HLT_2018_cff.py:6417
hcaldqm::quantity::CrateQuantity::CrateQuantity
CrateQuantity()
Definition: ElectronicsQuantity.h:394
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
HcalElectronicsId
Readout chain identification for Hcal.
Definition: HcalElectronicsId.h:32
hcaldqm::quantity::fCrate
Definition: ElectronicsQuantity.h:18
hcaldqm::quantity::ElectronicsQuantity::ElectronicsQuantity
ElectronicsQuantity()
Definition: ElectronicsQuantity.h:335
hcaldqm::quantity::Quantity::name
virtual std::string name()
Definition: Quantity.h:34
runTauDisplay.eid
eid
Definition: runTauDisplay.py:298
hcaldqm::quantity::CrateQuantity::setup
virtual void setup(HcalElectronicsMap const *emap)
Definition: ElectronicsQuantity.cc:571
hcaldqm::quantity::CrateQuantity::_crateHashes
CrateHashMap _crateHashes
Definition: ElectronicsQuantity.h:413