CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PPSGeometryBuilder Class Reference
Inheritance diagram for PPSGeometryBuilder:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 PPSGeometryBuilder (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

PDetGeomDesc::Item buildItemFromDetGeomDesc (const DetGeomDesc *geoInfo)
 
void buildSerializableDataFromGeoInfo (PDetGeomDesc *serializableData, const DetGeomDesc *geoInfo, int &counter)
 

Private Attributes

std::string compactViewTag_
 
edm::Service< cond::service::PoolDBOutputServicedbService_
 
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecorddd4hepToken_
 
edm::ESGetToken< DDCompactView, IdealGeometryRecordddToken_
 
bool fromDD4hep_
 
bool isRun2_
 
edm::ESWatcher< IdealGeometryRecordwatcherIdealGeometry_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 28 of file PPSGeometryBuilder.cc.

Constructor & Destructor Documentation

◆ PPSGeometryBuilder()

PPSGeometryBuilder::PPSGeometryBuilder ( const edm::ParameterSet iConfig)
explicit

Definition at line 46 of file PPSGeometryBuilder.cc.

48  : fromDD4hep_(iConfig.getUntrackedParameter<bool>("fromDD4hep", false)),
49  compactViewTag_(iConfig.getUntrackedParameter<std::string>("compactViewTag", "XMLIdealGeometryESSource_CTPPS")),
50  isRun2_(iConfig.getUntrackedParameter<bool>("isRun2", false)),

Member Function Documentation

◆ analyze()

void PPSGeometryBuilder::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 56 of file PPSGeometryBuilder.cc.

57  {
58  // Get DetGeomDesc tree
59  std::unique_ptr<DetGeomDesc> geoInfoRoot = nullptr;
60  if (watcherIdealGeometry_.check(iSetup)) {
61  edm::LogInfo("PPSGeometryBuilder") << "Got IdealGeometryRecord ";
62  // old DD
63  if (!fromDD4hep_) {
64  // Get CompactView from IdealGeometryRecord
65  auto const& myCompactView = iSetup.getData(ddToken_);
66 
67  // Build geometry
69  }
70  // DD4hep
71  else {
72  // Get CompactView from IdealGeometryRecord
73  auto const& myCompactView = iSetup.getData(dd4hepToken_);
74 
75  // Build geometry
77  }
78  }
79 
80  // Build persistent geometry data from geometry
81  PDetGeomDesc* serializableData =
82  new PDetGeomDesc(); // cond::service::PoolDBOutputService::writeOne interface requires raw pointer.
83  int counter = 0;
84  if (geoInfoRoot) {
85  buildSerializableDataFromGeoInfo(serializableData, geoInfoRoot.get(), counter);
86  }
87 
88  // Save geometry in the database
89  if (serializableData->container_.empty()) {
90  throw cms::Exception("PPSGeometryBuilder") << "PDetGeomDesc is empty, no geometry to save in the database.";
91  } else {
92  if (dbService_.isAvailable()) {
93  dbService_->writeOne(serializableData, dbService_->beginOfTime(), "VeryForwardIdealGeometryRecord");
94  edm::LogInfo("PPSGeometryBuilder") << "Successfully wrote DB, with " << serializableData->container_.size()
95  << " PDetGeomDesc items.";
96  } else {
97  throw cms::Exception("PPSGeometryBuilder") << "PoolDBService required.";
98  }
99  }

References cond::service::PoolDBOutputService::beginOfTime(), detgeomdescbuilder::buildDetGeomDescFromCompactView(), buildSerializableDataFromGeoInfo(), edm::ESWatcher< T >::check(), PDetGeomDesc::container_, counter, dbService_, dd4hepToken_, ddToken_, Exception, fromDD4hep_, edm::EventSetup::getData(), edm::Service< T >::isAvailable(), isRun2_, watcherIdealGeometry_, and cond::service::PoolDBOutputService::writeOne().

◆ buildItemFromDetGeomDesc()

PDetGeomDesc::Item PPSGeometryBuilder::buildItemFromDetGeomDesc ( const DetGeomDesc geoInfo)
private

Definition at line 126 of file PPSGeometryBuilder.cc.

127  {
129  result.dx_ = geoInfo->translation().X();
130  result.dy_ = geoInfo->translation().Y();
131  result.dz_ = geoInfo->translation().Z();
132 
133  const DDRotationMatrix& rot = geoInfo->rotation();
134  rot.GetComponents(result.axx_,
135  result.axy_,
136  result.axz_,
137  result.ayx_,
138  result.ayy_,
139  result.ayz_,
140  result.azx_,
141  result.azy_,
142  result.azz_);
143  result.name_ = geoInfo->name();
144  result.params_ = geoInfo->params();
145  result.copy_ = geoInfo->copyno();
146  result.z_ = geoInfo->parentZPosition();
147  result.sensorType_ = geoInfo->sensorType();
148  result.geographicalID_ = geoInfo->geographicalID();
149 
150  return result;

References DetGeomDesc::copyno(), DetGeomDesc::geographicalID(), DetGeomDesc::name(), DetGeomDesc::params(), DetGeomDesc::parentZPosition(), mps_fire::result, makeMuonMisalignmentScenario::rot, DetGeomDesc::rotation(), DetGeomDesc::sensorType(), and DetGeomDesc::translation().

Referenced by buildSerializableDataFromGeoInfo().

◆ buildSerializableDataFromGeoInfo()

void PPSGeometryBuilder::buildSerializableDataFromGeoInfo ( PDetGeomDesc serializableData,
const DetGeomDesc geoInfo,
int &  counter 
)
private

Definition at line 105 of file PPSGeometryBuilder.cc.

108  {
109  PDetGeomDesc::Item serializableItem = buildItemFromDetGeomDesc(geoInfo);
110  counter++;
111 
112  // Store item in serializableData
113  if ((!fromDD4hep_ && counter >= 2) // Old DD: Skip CMSE
114  || (fromDD4hep_ && counter >= 4)) { // DD4hep: Skip world + OCMS + CMSE
115  serializableData->container_.emplace_back(serializableItem);
116  }
117 
118  // Recursive calls on children
119  for (auto& child : geoInfo->components()) {
120  buildSerializableDataFromGeoInfo(serializableData, child, counter);
121  }

References buildItemFromDetGeomDesc(), DetGeomDesc::components(), PDetGeomDesc::container_, and fromDD4hep_.

Referenced by analyze().

Member Data Documentation

◆ compactViewTag_

std::string PPSGeometryBuilder::compactViewTag_
private

Definition at line 44 of file PPSGeometryBuilder.cc.

◆ dbService_

edm::Service<cond::service::PoolDBOutputService> PPSGeometryBuilder::dbService_
private

Definition at line 49 of file PPSGeometryBuilder.cc.

Referenced by analyze().

◆ dd4hepToken_

edm::ESGetToken<cms::DDCompactView, IdealGeometryRecord> PPSGeometryBuilder::dd4hepToken_
private

Definition at line 47 of file PPSGeometryBuilder.cc.

Referenced by analyze().

◆ ddToken_

edm::ESGetToken<DDCompactView, IdealGeometryRecord> PPSGeometryBuilder::ddToken_
private

Definition at line 46 of file PPSGeometryBuilder.cc.

Referenced by analyze().

◆ fromDD4hep_

bool PPSGeometryBuilder::fromDD4hep_
private

Definition at line 43 of file PPSGeometryBuilder.cc.

Referenced by analyze(), and buildSerializableDataFromGeoInfo().

◆ isRun2_

bool PPSGeometryBuilder::isRun2_
private

Definition at line 45 of file PPSGeometryBuilder.cc.

Referenced by analyze().

◆ watcherIdealGeometry_

edm::ESWatcher<IdealGeometryRecord> PPSGeometryBuilder::watcherIdealGeometry_
private

Definition at line 48 of file PPSGeometryBuilder.cc.

Referenced by analyze().

PPSGeometryBuilder::watcherIdealGeometry_
edm::ESWatcher< IdealGeometryRecord > watcherIdealGeometry_
Definition: PPSGeometryBuilder.cc:48
edm::ESWatcher::check
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
counter
Definition: counter.py:1
edm::ESInputTag
Definition: ESInputTag.h:87
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:215
PPSGeometryBuilder::compactViewTag_
std::string compactViewTag_
Definition: PPSGeometryBuilder.cc:44
DetGeomDesc::translation
const Translation & translation() const
Definition: DetGeomDesc.h:75
PDetGeomDesc::Item
Definition: PDetGeomDesc.h:11
DetGeomDesc::sensorType
const std::string & sensorType() const
Definition: DetGeomDesc.h:94
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
PPSGeometryBuilder::buildItemFromDetGeomDesc
PDetGeomDesc::Item buildItemFromDetGeomDesc(const DetGeomDesc *geoInfo)
Definition: PPSGeometryBuilder.cc:126
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
DetGeomDesc::parentZPosition
float parentZPosition() const
Definition: DetGeomDesc.h:101
PPSGeometryBuilder::isRun2_
bool isRun2_
Definition: PPSGeometryBuilder.cc:45
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
PPSGeometryBuilder::buildSerializableDataFromGeoInfo
void buildSerializableDataFromGeoInfo(PDetGeomDesc *serializableData, const DetGeomDesc *geoInfo, int &counter)
Definition: PPSGeometryBuilder.cc:105
DetGeomDesc::geographicalID
DetId geographicalID() const
Definition: DetGeomDesc.h:97
PDetGeomDesc::container_
std::vector< Item > container_
Definition: PDetGeomDesc.h:26
PPSGeometryBuilder::dbService_
edm::Service< cond::service::PoolDBOutputService > dbService_
Definition: PPSGeometryBuilder.cc:49
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DetGeomDesc::components
const Container & components() const
Definition: DetGeomDesc.h:100
PPSGeometryBuilder::dd4hepToken_
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > dd4hepToken_
Definition: PPSGeometryBuilder.cc:47
DetGeomDesc::name
const std::string & name() const
Definition: DetGeomDesc.h:68
PPSGeometryBuilder::fromDD4hep_
bool fromDD4hep_
Definition: PPSGeometryBuilder.cc:43
counter
static std::atomic< unsigned int > counter
Definition: SharedResourceNames.cc:18
PDetGeomDesc
Definition: PDetGeomDesc.h:9
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
DDRotationMatrix
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
Definition: DDRotationMatrix.h:8
PPSGeometryBuilder::ddToken_
edm::ESGetToken< DDCompactView, IdealGeometryRecord > ddToken_
Definition: PPSGeometryBuilder.cc:46
Exception
Definition: hltDiff.cc:245
cond::service::PoolDBOutputService::writeOne
Hash writeOne(const T *payload, Time_t time, const std::string &recordName)
Definition: PoolDBOutputService.h:63
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
DetGeomDesc::params
const std::vector< double > & params() const
Definition: DetGeomDesc.h:83
edm::EDConsumerBase::esConsumes
auto esConsumes()
Definition: EDConsumerBase.h:202
mps_fire.result
result
Definition: mps_fire.py:311
DetGeomDesc::copyno
int copyno() const
Definition: DetGeomDesc.h:69
DetGeomDesc::rotation
const RotationMatrix & rotation() const
Definition: DetGeomDesc.h:76
child
Definition: simpleInheritance.h:11
detgeomdescbuilder::buildDetGeomDescFromCompactView
std::unique_ptr< DetGeomDesc > buildDetGeomDescFromCompactView(const DDCompactView &myCompactView, const bool isRun2)
Definition: DetGeomDescBuilder.cc:10