CMS 3D CMS Logo

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

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

Inheritance diagram for CaloGeometryBuilder:
edm::ESProducer edm::ESProductResolverFactoryProducer edm::eventsetup::ESProductResolverProvider

Public Types

using ReturnType = std::unique_ptr< CaloGeometry >
 

Public Member Functions

 CaloGeometryBuilder (const edm::ParameterSet &iConfig)
 
ReturnType produceAligned (const CaloGeometryRecord &iRecord)
 
 ~CaloGeometryBuilder () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
 ESProducer (ESProducer &&)=delete
 
ESResolverIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProduceroperator= (const ESProducer &)=delete
 
ESProduceroperator= (ESProducer &&)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESResolverIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProductResolverFactoryProducer
 ESProductResolverFactoryProducer ()
 
 ESProductResolverFactoryProducer (const ESProductResolverFactoryProducer &)=delete
 
const ESProductResolverFactoryProduceroperator= (const ESProductResolverFactoryProducer &)=delete
 
 ~ESProductResolverFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
void createKeyedResolvers (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
const ComponentDescriptiondescription () const
 
 ESProductResolverProvider ()
 
 ESProductResolverProvider (const ESProductResolverProvider &)=delete
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedResolverskeyedResolvers (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const ESProductResolverProvideroperator= (const ESProductResolverProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~ESProductResolverProvider () noexcept(false)
 

Private Attributes

edm::ESGetToken< CaloSubdetectorGeometry, CaloTowerGeometryRecordcaloTowerToken_
 
edm::ESGetToken< CaloSubdetectorGeometry, CastorGeometryRecordcastorToken_
 
edm::ESGetToken< CaloSubdetectorGeometry, EcalBarrelGeometryRecordecalBarrelToken_
 
edm::ESGetToken< CaloSubdetectorGeometry, EcalEndcapGeometryRecordecalEndcapToken_
 
edm::ESGetToken< CaloSubdetectorGeometry, EcalPreshowerGeometryRecordecalPreshowerToken_
 
edm::ESGetToken< CaloSubdetectorGeometry, HcalGeometryRecordhcalToken_
 
std::vector< std::pair< edm::ESGetToken< HGCalGeometry, IdealGeometryRecord >, std::string > > hgcalTokens_
 
edm::ESGetToken< CaloSubdetectorGeometry, ZDCGeometryRecordzdcToken_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Types inherited from edm::ESProductResolverFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::ESProductResolverProvider
using KeyedResolversVector = std::vector< std::pair< DataKey, std::shared_ptr< ESProductResolver > >>
 
- Protected Member Functions inherited from edm::ESProducer
ESConsumesInfoconsumesInfoPushBackNew ()
 
unsigned int consumesInfoSize () const
 
template<typename CallbackT , typename TList , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>> iCallback, const TList *, const TRecord *iRecord, const es::Label &iLabel)
 
template<typename CallbackT , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>>, const eventsetup::produce::Null *, const TRecord *, const es::Label &)
 
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 TDecorator >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename TFunc >
auto setWhatProduced (TFunc &&func, const es::Label &iLabel={})
 
template<typename TReturn , typename TRecord , typename TFunc , typename TDecorator >
ESConsumesCollectorT< TRecord > setWhatProduced (TFunc &&func, TDecorator &&iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- Protected Member Functions inherited from edm::ESProductResolverFactoryProducer
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::ESProductResolverFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedResolversVector registerResolvers (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::ESProductResolverProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 

Detailed Description

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

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

Definition at line 37 of file CaloGeometryBuilder.h.

Member Typedef Documentation

◆ ReturnType

Definition at line 39 of file CaloGeometryBuilder.h.

Constructor & Destructor Documentation

◆ CaloGeometryBuilder()

CaloGeometryBuilder::CaloGeometryBuilder ( const edm::ParameterSet iConfig)

Definition at line 52 of file CaloGeometryBuilder.cc.

References caloTowerToken_, castorToken_, gpuPixelDoublets::cc, ecalBarrelToken_, ecalEndcapToken_, ecalPreshowerToken_, edm::ParameterSet::getParameter(), hcalToken_, hgcalTokens_, l1ctLayer1_patternWriters_cff::partition, produceAligned(), CaloTowerGeometry::producerTag(), ZdcGeometry::producerTag(), CastorGeometry::producerTag(), EcalPreshowerGeometry::producerTag(), HcalGeometry::producerTag(), EcalEndcapGeometry::producerTag(), EcalBarrelGeometry::producerTag(), HGCalGeometry::producerTag(), edm::ESProducer::setWhatProduced(), AlCaHLTBitMon_QueryRunRegistry::string, and zdcToken_.

52  {
53  //the following line is needed to tell the framework what
54  // data is being produced
56 
57  //now do what ever other initialization is needed
58  auto caloList = iConfig.getParameter<std::vector<std::string> >("SelectedCalos");
59  if (caloList.empty())
60  throw cms::Exception("Configuration") << "No calorimeter specified for geometry, aborting";
61 
62  makeToken(cc, caloList, HcalGeometry::producerTag(), hcalToken_);
63  makeToken(cc, caloList, ZdcGeometry::producerTag(), zdcToken_);
64  makeToken(cc, caloList, CastorGeometry::producerTag(), castorToken_);
65  makeToken(cc, caloList, EcalBarrelGeometry::producerTag(), ecalBarrelToken_);
66  makeToken(cc, caloList, EcalEndcapGeometry::producerTag(), ecalEndcapToken_);
68  makeToken(cc, caloList, CaloTowerGeometry::producerTag(), caloTowerToken_);
69 
70  // Move HGC elements to the end
71  auto hgcBegin = std::partition(caloList.begin(), caloList.end(), [](std::string const& elem) {
72  return elem.find(HGCalGeometry::producerTag()) == std::string::npos;
73  });
74  // Process HGC elements
75  for (auto iter = hgcBegin; iter != caloList.end(); ++iter) {
76  hgcalTokens_.emplace_back(cc.consumesFrom<HGCalGeometry, IdealGeometryRecord>(edm::ESInputTag{"", *iter}), *iter);
77  }
78  // Erase HGC elements
79  caloList.erase(hgcBegin, caloList.end());
80 
81  // Throw if any elements are left
82  if (not caloList.empty()) {
83  cms::Exception ex{"Configuration"};
84  ex << "Reconstruction geometry requested for a not implemented sub-detectors:";
85  for (auto const& elem : caloList) {
86  ex << " " << elem;
87  }
88  throw ex;
89  }
90 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
static std::string producerTag()
Definition: ZdcGeometry.h:44
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
static std::string producerTag()
static std::string producerTag()
Definition: HcalGeometry.h:65
edm::ESGetToken< CaloSubdetectorGeometry, CaloTowerGeometryRecord > caloTowerToken_
static std::string producerTag()
edm::ESGetToken< CaloSubdetectorGeometry, HcalGeometryRecord > hcalToken_
static std::string producerTag()
static std::string producerTag()
std::vector< std::pair< edm::ESGetToken< HGCalGeometry, IdealGeometryRecord >, std::string > > hgcalTokens_
edm::ESGetToken< CaloSubdetectorGeometry, CastorGeometryRecord > castorToken_
static std::string producerTag()
edm::ESGetToken< CaloSubdetectorGeometry, EcalBarrelGeometryRecord > ecalBarrelToken_
edm::ESGetToken< CaloSubdetectorGeometry, ZDCGeometryRecord > zdcToken_
static std::string producerTag()
edm::ESGetToken< CaloSubdetectorGeometry, EcalPreshowerGeometryRecord > ecalPreshowerToken_
edm::ESGetToken< CaloSubdetectorGeometry, EcalEndcapGeometryRecord > ecalEndcapToken_
ReturnType produceAligned(const CaloGeometryRecord &iRecord)

◆ ~CaloGeometryBuilder()

CaloGeometryBuilder::~CaloGeometryBuilder ( )
inlineoverride

Definition at line 43 of file CaloGeometryBuilder.h.

43 {};

Member Function Documentation

◆ produceAligned()

CaloGeometryBuilder::ReturnType CaloGeometryBuilder::produceAligned ( const CaloGeometryRecord iRecord)

Definition at line 94 of file CaloGeometryBuilder.cc.

References DetId::Calo, caloTowerToken_, castorToken_, DetId::Ecal, EcalBarrel, ecalBarrelToken_, EcalEndcap, ecalEndcapToken_, EcalPreshower, ecalPreshowerToken_, edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), DetId::Hcal, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, hcalToken_, hgcalTokens_, edm::ESGetToken< ESProduct, ESRecord >::isInitialized(), HcalCastorDetId::SubdetectorId, HcalZDCDetId::SubdetectorId, and zdcToken_.

Referenced by CaloGeometryBuilder().

94  {
95  ReturnType pCalo = std::make_unique<CaloGeometry>();
96 
97  // look for HCAL parts
98  // assume 'HCAL' for all of HCAL.
99  if (hcalToken_.isInitialized()) {
100  edm::LogVerbatim("CaloGeometryBuilder") << "Building HCAL reconstruction geometry";
101 
102  auto const& pG = iRecord.get(hcalToken_);
103  pCalo->setSubdetGeometry(DetId::Hcal, HcalBarrel, &pG);
104  pCalo->setSubdetGeometry(DetId::Hcal, HcalEndcap, &pG);
105  pCalo->setSubdetGeometry(DetId::Hcal, HcalOuter, &pG);
106  pCalo->setSubdetGeometry(DetId::Hcal, HcalForward, &pG);
107  }
108  if (zdcToken_.isInitialized()) {
109  edm::LogVerbatim("CaloGeometryBuilder") << "Building ZDC reconstruction geometry";
110  auto const& pG = iRecord.get(zdcToken_);
111  pCalo->setSubdetGeometry(DetId::Calo, HcalZDCDetId::SubdetectorId, &pG);
112  }
113  if (castorToken_.isInitialized()) {
114  edm::LogVerbatim("CaloGeometryBuilder") << "Building CASTOR reconstruction geometry";
115  auto const& pG = iRecord.get(castorToken_);
116  pCalo->setSubdetGeometry(DetId::Calo, HcalCastorDetId::SubdetectorId, &pG);
117  }
118 
119  // look for Ecal Barrel
121  edm::LogVerbatim("CaloGeometryBuilder") << "Building EcalBarrel reconstruction geometry";
122  auto const& pG = iRecord.get(ecalBarrelToken_);
123  pCalo->setSubdetGeometry(DetId::Ecal, EcalBarrel, &pG);
124  }
125  // look for Ecal Endcap
127  edm::LogVerbatim("CaloGeometryBuilder") << "Building EcalEndcap reconstruction geometry";
128  auto const& pG = iRecord.get(ecalEndcapToken_);
129  pCalo->setSubdetGeometry(DetId::Ecal, EcalEndcap, &pG);
130  }
131  // look for Ecal Preshower
133  edm::LogVerbatim("CaloGeometryBuilder") << "Building EcalPreshower reconstruction geometry";
134  const auto& pG = iRecord.get(ecalPreshowerToken_);
135  pCalo->setSubdetGeometry(DetId::Ecal, EcalPreshower, &pG);
136  }
137 
138  // look for TOWER parts
140  edm::LogVerbatim("CaloGeometryBuilder") << "Building TOWER reconstruction geometry";
141  const auto& pG = iRecord.get(caloTowerToken_);
142  pCalo->setSubdetGeometry(DetId::Calo, 1, &pG);
143  }
144 
145  for (auto const& hgcTokenLabel : hgcalTokens_) {
146  edm::LogVerbatim("CaloGeometryBuilder") << "Building " << hgcTokenLabel.second << " reconstruction geometry";
147  auto const& pHG = iRecord.get(hgcTokenLabel.first);
148  const auto& topo = pHG.topology();
149  pCalo->setSubdetGeometry(topo.detector(), topo.subDetector(), &pHG);
150  }
151 
152  return pCalo;
153 }
Log< level::Info, true > LogVerbatim
edm::ESGetToken< CaloSubdetectorGeometry, CaloTowerGeometryRecord > caloTowerToken_
edm::ESGetToken< CaloSubdetectorGeometry, HcalGeometryRecord > hcalToken_
constexpr bool isInitialized() const noexcept
Definition: ESGetToken.h:63
static const int SubdetectorId
std::vector< std::pair< edm::ESGetToken< HGCalGeometry, IdealGeometryRecord >, std::string > > hgcalTokens_
edm::ESGetToken< CaloSubdetectorGeometry, CastorGeometryRecord > castorToken_
edm::ESGetToken< CaloSubdetectorGeometry, EcalBarrelGeometryRecord > ecalBarrelToken_
edm::ESGetToken< CaloSubdetectorGeometry, ZDCGeometryRecord > zdcToken_
std::unique_ptr< CaloGeometry > ReturnType
edm::ESGetToken< CaloSubdetectorGeometry, EcalPreshowerGeometryRecord > ecalPreshowerToken_
static constexpr int32_t SubdetectorId
Definition: HcalZDCDetId.h:35
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
edm::ESGetToken< CaloSubdetectorGeometry, EcalEndcapGeometryRecord > ecalEndcapToken_

Member Data Documentation

◆ caloTowerToken_

edm::ESGetToken<CaloSubdetectorGeometry, CaloTowerGeometryRecord> CaloGeometryBuilder::caloTowerToken_
private

Definition at line 56 of file CaloGeometryBuilder.h.

Referenced by CaloGeometryBuilder(), and produceAligned().

◆ castorToken_

edm::ESGetToken<CaloSubdetectorGeometry, CastorGeometryRecord> CaloGeometryBuilder::castorToken_
private

Definition at line 52 of file CaloGeometryBuilder.h.

Referenced by CaloGeometryBuilder(), and produceAligned().

◆ ecalBarrelToken_

edm::ESGetToken<CaloSubdetectorGeometry, EcalBarrelGeometryRecord> CaloGeometryBuilder::ecalBarrelToken_
private

Definition at line 53 of file CaloGeometryBuilder.h.

Referenced by CaloGeometryBuilder(), and produceAligned().

◆ ecalEndcapToken_

edm::ESGetToken<CaloSubdetectorGeometry, EcalEndcapGeometryRecord> CaloGeometryBuilder::ecalEndcapToken_
private

Definition at line 54 of file CaloGeometryBuilder.h.

Referenced by CaloGeometryBuilder(), and produceAligned().

◆ ecalPreshowerToken_

edm::ESGetToken<CaloSubdetectorGeometry, EcalPreshowerGeometryRecord> CaloGeometryBuilder::ecalPreshowerToken_
private

Definition at line 55 of file CaloGeometryBuilder.h.

Referenced by CaloGeometryBuilder(), and produceAligned().

◆ hcalToken_

edm::ESGetToken<CaloSubdetectorGeometry, HcalGeometryRecord> CaloGeometryBuilder::hcalToken_
private

Definition at line 50 of file CaloGeometryBuilder.h.

Referenced by CaloGeometryBuilder(), and produceAligned().

◆ hgcalTokens_

std::vector<std::pair<edm::ESGetToken<HGCalGeometry, IdealGeometryRecord>, std::string> > CaloGeometryBuilder::hgcalTokens_
private

Definition at line 57 of file CaloGeometryBuilder.h.

Referenced by CaloGeometryBuilder(), and produceAligned().

◆ zdcToken_

edm::ESGetToken<CaloSubdetectorGeometry, ZDCGeometryRecord> CaloGeometryBuilder::zdcToken_
private

Definition at line 51 of file CaloGeometryBuilder.h.

Referenced by CaloGeometryBuilder(), and produceAligned().