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 (HcalDetId const &)
 
virtual uint32_t getBin (HcalTrigTowerDetId const &)
 
virtual uint32_t getBin (int)
 
virtual uint32_t getBin (double)
 
virtual int getValue (HcalDetId const &)
 
virtual int getValue (HcalTrigTowerDetId const &)
 
virtual int getValue (int x)
 
virtual double getValue (double 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 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
 

Private Types

typedef std::map< int, uint32_t > CrateHashMap
 

Detailed Description

Definition at line 406 of file ElectronicsQuantity.h.

Member Typedef Documentation

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

Definition at line 407 of file ElectronicsQuantity.h.

Constructor & Destructor Documentation

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

Definition at line 409 of file ElectronicsQuantity.h.

409 {}
hcaldqm::quantity::CrateQuantity::CrateQuantity ( HcalElectronicsMap const *  emap)
inline

Definition at line 410 of file ElectronicsQuantity.h.

References GeneralSetup::setup().

410  : ElectronicsQuantity(fCrate, false) {
411  this->setup(emap);
412  }
virtual void setup(HcalElectronicsMap const *emap)
hcaldqm::quantity::CrateQuantity::CrateQuantity ( std::vector< int >  crates,
CrateHashMap  crateHashes 
)
inline

Definition at line 413 of file ElectronicsQuantity.h.

References GeneralSetup::setup().

413  : ElectronicsQuantity(fCrate, false) {
414  this->setup(crates, crateHashes);
415  }
virtual void setup(HcalElectronicsMap const *emap)
hcaldqm::quantity::CrateQuantity::~CrateQuantity ( )
inlineoverride

Member Function Documentation

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

Reimplemented from hcaldqm::quantity::ElectronicsQuantity.

Definition at line 809 of file ElectronicsQuantity.cc.

References HcalElectronicsId::crateId(), SoftLeptonByDistance_cfi::distance, and spr::find().

Referenced by BTagWeightCalculator.BTagWeightCalculator::calcJetWeightImpl().

810  {
811  int crate = eid.crateId();
812  auto it = std::find(_crates.begin(), _crates.end(), crate);
813  if (it == _crates.end()) {
814  return 0;
815  } else {
816  return std::distance(_crates.begin(), it) + 1;
817  }
818  }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
std::vector< std::string > hcaldqm::quantity::CrateQuantity::getLabels ( )
overridevirtual

Reimplemented from hcaldqm::quantity::ElectronicsQuantity.

Definition at line 820 of file ElectronicsQuantity.cc.

References runTauDisplay::eid, HcalElectronicsId::isVMEid(), tablePrinter::labels, and hcaldqm::quantity::Quantity::name().

821  {
822  std::vector<std::string> labels;
823  char name[5];
824  for (auto& it_crate : _crates) {
826  if (eid.isVMEid()) {
827  sprintf(name, "%dv", it_crate);
828  } else {
829  sprintf(name, "%du", it_crate);
830  }
831  labels.push_back(name);
832  }
833  return labels;
834  }
virtual std::string name()
Definition: Quantity.h:47
Readout chain identification for Hcal.
int hcaldqm::quantity::CrateQuantity::getValue ( HcalElectronicsId const &  eid)
overridevirtual

Reimplemented from hcaldqm::quantity::ElectronicsQuantity.

Definition at line 804 of file ElectronicsQuantity.cc.

References HcalElectronicsId::crateId().

805  {
806  return eid.crateId();
807  }
CrateQuantity* hcaldqm::quantity::CrateQuantity::makeCopy ( )
inlineoverridevirtual

Reimplemented from hcaldqm::quantity::ElectronicsQuantity.

Definition at line 435 of file ElectronicsQuantity.h.

436  {
437  // Make copies of the crate info
438  std::vector<int> tmpCrates;
439  std::map<int, uint32_t> tmpCrateHashes;
440  for (auto& it_crate : _crates) {
441  tmpCrates.push_back(it_crate);
442  tmpCrateHashes[it_crate] = _crateHashes[it_crate];
443  }
444  return new CrateQuantity(tmpCrates, tmpCrateHashes);
445  }
double hcaldqm::quantity::CrateQuantity::max ( )
inlineoverridevirtual

Reimplemented from hcaldqm::quantity::ElectronicsQuantity.

Definition at line 427 of file ElectronicsQuantity.h.

427 {return _crates.size();}
double hcaldqm::quantity::CrateQuantity::min ( )
inlineoverridevirtual

Reimplemented from hcaldqm::quantity::ElectronicsQuantity.

Definition at line 426 of file ElectronicsQuantity.h.

426 {return 0;}
int hcaldqm::quantity::CrateQuantity::nbins ( )
inlineoverridevirtual

Reimplemented from hcaldqm::quantity::ElectronicsQuantity.

Definition at line 423 of file ElectronicsQuantity.h.

423  {
424  return _crates.size();
425  }
void hcaldqm::quantity::CrateQuantity::setup ( HcalElectronicsMap const *  emap)
virtual

Definition at line 791 of file ElectronicsQuantity.cc.

References hcaldqm::utilities::getCrateHashMap(), and hcaldqm::utilities::getCrateList().

792  {
795  }
std::map< int, uint32_t > getCrateHashMap(HcalElectronicsMap const *emap)
Definition: Utilities.cc:77
std::vector< int > getCrateList(HcalElectronicsMap const *emap)
Definition: Utilities.cc:63
virtual void hcaldqm::quantity::CrateQuantity::setup ( std::vector< int >  crates,
CrateHashMap  crateHashes 
)
virtual

Member Data Documentation

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

Definition at line 432 of file ElectronicsQuantity.h.

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

Definition at line 431 of file ElectronicsQuantity.h.