CMS 3D CMS Logo

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

#include <tmp/CaloTowerConstituentsMapBuilder/interface/CaloTowerConstituentsMapBuilder.h>

Inheritance diagram for CaloTowerConstituentsMapBuilder:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Types

typedef std::unique_ptr< CaloTowerConstituentsMapReturnType
 

Public Member Functions

 CaloTowerConstituentsMapBuilder (const edm::ParameterSet &)
 
ReturnType produce (const CaloGeometryRecord &)
 
 ~CaloTowerConstituentsMapBuilder () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESProxyIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
 ESProxyFactoryProducer (const ESProxyFactoryProducer &)=delete
 
const ESProxyFactoryProduceroperator= (const ESProxyFactoryProducer &)=delete
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
void createKeyedProxies (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
 DataProxyProvider ()
 
 DataProxyProvider (const DataProxyProvider &)=delete
 
const ComponentDescriptiondescription () const
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const DataProxyProvideroperator= (const DataProxyProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 

Private Member Functions

void assignEEtoHE (const CaloGeometry *geometry, CaloTowerConstituentsMap &theMap, const CaloTowerTopology *cttopo)
 
void parseTextMap (const std::string &filename, CaloTowerConstituentsMap &theMap)
 

Private Attributes

edm::ESGetToken< CaloTowerTopology, HcalRecNumberingRecordcttopoToken_
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordgeometryToken_
 
edm::ESGetToken< HcalTopology, HcalRecNumberingRecordhcaltopoToken_
 
bool mapAuto_
 
std::string mapFile_
 
bool skipHE_
 

Additional Inherited Members

- Protected Types inherited from edm::ESProxyFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::DataProxyProvider
using KeyedProxiesVector = std::vector< std::pair< DataKey, std::shared_ptr< DataProxy > >>
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
ESConsumesCollectorT< TRecord > setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedProxiesVector registerProxies (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 42 of file CaloTowerConstituentsMapBuilder.h.

Member Typedef Documentation

◆ ReturnType

Definition at line 47 of file CaloTowerConstituentsMapBuilder.h.

Constructor & Destructor Documentation

◆ CaloTowerConstituentsMapBuilder()

CaloTowerConstituentsMapBuilder::CaloTowerConstituentsMapBuilder ( const edm::ParameterSet iConfig)

Definition at line 32 of file CaloTowerConstituentsMapBuilder.cc.

References cttopoToken_, geometryToken_, hcaltopoToken_, and edm::ESProducer::setWhatProduced().

33  : mapFile_(iConfig.getUntrackedParameter<std::string>("MapFile", "")),
34  mapAuto_(iConfig.getUntrackedParameter<bool>("MapAuto", false)),
35  skipHE_(iConfig.getUntrackedParameter<bool>("SkipHE", false)) {
36  //the following line is needed to tell the framework what
37  // data is being produced
38  auto cc = setWhatProduced(this);
39 
43 
44  //now do what ever other initialization is needed
45 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
edm::ESGetToken< CaloTowerTopology, HcalRecNumberingRecord > cttopoToken_
T getUntrackedParameter(std::string const &, T const &) const
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > hcaltopoToken_

◆ ~CaloTowerConstituentsMapBuilder()

CaloTowerConstituentsMapBuilder::~CaloTowerConstituentsMapBuilder ( )
override

Definition at line 47 of file CaloTowerConstituentsMapBuilder.cc.

47 {}

Member Function Documentation

◆ assignEEtoHE()

void CaloTowerConstituentsMapBuilder::assignEEtoHE ( const CaloGeometry geometry,
CaloTowerConstituentsMap theMap,
const CaloTowerTopology cttopo 
)
private

Definition at line 113 of file CaloTowerConstituentsMapBuilder.cc.

References CaloTowerConstituentsMap::assign(), CaloTowerTopology::convertHcaltoCT(), DetId::Ecal, EcalEndcap, CaloSubdetectorGeometry::getClosestCell(), CaloSubdetectorGeometry::getGeometry(), CaloSubdetectorGeometry::getValidDetIds(), runTauDisplay::gp, DetId::Hcal, and HcalEndcap.

Referenced by produce().

115  {
116  //get EE and HE geometries
117  const CaloSubdetectorGeometry* geomEE = geometry->getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
118  if (geomEE == nullptr)
119  return; // if no EE is defined don't know where it is used
120 
121  const CaloSubdetectorGeometry* geomHE = geometry->getSubdetectorGeometry(DetId::Hcal, HcalEndcap);
122 
123  //get list of EE detids
124  const std::vector<DetId>& vec(geomEE->getValidDetIds());
125  //loop over EE detids
126  for (auto detId_itr : vec) {
127  //get detid position
128  auto cellGeometry = geomEE->getGeometry(detId_itr);
129  const GlobalPoint& gp(cellGeometry->getPosition());
130 
131  //find closest HE cell
132  HcalDetId closestCell(geomHE->getClosestCell(gp));
133 
134  //assign to appropriate CaloTower
135  CaloTowerDetId tid(cttopo->convertHcaltoCT(closestCell.ietaAbs(), closestCell.subdet()) * closestCell.zside(),
136  closestCell.iphi());
137  theMap.assign(detId_itr, tid);
138  }
139 }
int convertHcaltoCT(int hcal_ieta, HcalSubdetector subdet) const
virtual const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const
Get a list of valid detector ids (for the given subdetector)
void assign(const DetId &cell, const CaloTowerDetId &tower)
set the association between a DetId and a tower
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
virtual DetId getClosestCell(const GlobalPoint &r) const

◆ fillDescriptions()

void CaloTowerConstituentsMapBuilder::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 53 of file CaloTowerConstituentsMapBuilder.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

53  {
55  desc.addUntracked<std::string>("MapFile", "");
56  desc.addUntracked<bool>("MapAuto", false);
57  desc.addUntracked<bool>("SkipHE", false);
58  descriptions.add("caloTowerConstituents", desc);
59 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ parseTextMap()

void CaloTowerConstituentsMapBuilder::parseTextMap ( const std::string &  filename,
CaloTowerConstituentsMap theMap 
)
private

Definition at line 90 of file CaloTowerConstituentsMapBuilder.cc.

References CaloTowerConstituentsMap::assign(), corrVsCorr::filename, edm::FileInPath::fullPath(), LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, and mps_splice::line.

Referenced by produce().

90  {
92 
93  gzFile gzed = gzopen(eff.fullPath().c_str(), "rb");
94 
95  while (!gzeof(gzed)) {
96  char line[1024];
97  int ieta, iphi, rawid;
98  if (nullptr != gzgets(gzed, line, 1023)) {
99  if (index(line, '#') != nullptr)
100  *(index(line, '#')) = 0;
101  int ct = sscanf(line, "%i %d %d", &rawid, &ieta, &iphi);
102  if (ct == 3) {
103  DetId detid(rawid);
104  CaloTowerDetId tid(ieta, iphi);
105  theMap.assign(detid, tid);
106  }
107  }
108  }
109  gzclose(gzed);
110 }
void assign(const DetId &cell, const CaloTowerDetId &tower)
set the association between a DetId and a tower
Definition: DetId.h:17

◆ produce()

CaloTowerConstituentsMapBuilder::ReturnType CaloTowerConstituentsMapBuilder::produce ( const CaloGeometryRecord iRecord)

Definition at line 62 of file CaloTowerConstituentsMapBuilder.cc.

References assignEEtoHE(), cttopoToken_, geometryToken_, edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), hcaltopoToken_, mapAuto_, mapFile_, parseTextMap(), dumpMFGeometry_cfg::prod, and skipHE_.

62  {
63  const auto& hcaltopo = iRecord.get(hcaltopoToken_);
64  const auto& cttopo = iRecord.get(cttopoToken_);
65 
66  auto prod = std::make_unique<CaloTowerConstituentsMap>(&hcaltopo, &cttopo);
67 
68  //auto prod = std::make_unique<CaloTowerConstituentsMap>( &hcaltopo );
69 
70  //keep geometry pointer as member for alternate EE->HE mapping
71  const CaloGeometry& geometry = iRecord.get(geometryToken_);
72 
73  prod->useStandardHB(true);
74  if (!skipHE_)
75  prod->useStandardHE(true);
76  prod->useStandardHF(true);
77  prod->useStandardHO(true);
78  prod->useStandardEB(true);
79 
80  if (!mapFile_.empty()) {
82  } else if (mapAuto_ && !skipHE_) {
83  assignEEtoHE(&geometry, *prod, &cttopo);
84  }
85  prod->sort();
86 
87  return prod;
88 }
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
edm::ESGetToken< CaloTowerTopology, HcalRecNumberingRecord > cttopoToken_
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > hcaltopoToken_
void assignEEtoHE(const CaloGeometry *geometry, CaloTowerConstituentsMap &theMap, const CaloTowerTopology *cttopo)
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
void parseTextMap(const std::string &filename, CaloTowerConstituentsMap &theMap)

Member Data Documentation

◆ cttopoToken_

edm::ESGetToken<CaloTowerTopology, HcalRecNumberingRecord> CaloTowerConstituentsMapBuilder::cttopoToken_
private

Definition at line 56 of file CaloTowerConstituentsMapBuilder.h.

Referenced by CaloTowerConstituentsMapBuilder(), and produce().

◆ geometryToken_

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> CaloTowerConstituentsMapBuilder::geometryToken_
private

Definition at line 57 of file CaloTowerConstituentsMapBuilder.h.

Referenced by CaloTowerConstituentsMapBuilder(), and produce().

◆ hcaltopoToken_

edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> CaloTowerConstituentsMapBuilder::hcaltopoToken_
private

Definition at line 55 of file CaloTowerConstituentsMapBuilder.h.

Referenced by CaloTowerConstituentsMapBuilder(), and produce().

◆ mapAuto_

bool CaloTowerConstituentsMapBuilder::mapAuto_
private

Definition at line 59 of file CaloTowerConstituentsMapBuilder.h.

Referenced by produce().

◆ mapFile_

std::string CaloTowerConstituentsMapBuilder::mapFile_
private

Definition at line 58 of file CaloTowerConstituentsMapBuilder.h.

Referenced by produce().

◆ skipHE_

bool CaloTowerConstituentsMapBuilder::skipHE_
private

Definition at line 59 of file CaloTowerConstituentsMapBuilder.h.

Referenced by produce().