CMS 3D CMS Logo

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

Allows conversion between type and name, and vice-versa. More...

#include <AlignableObjectId.h>

Classes

struct  entry
 

Public Types

enum  Geometry {
  Geometry::RunI, Geometry::PhaseI, Geometry::PhaseII, Geometry::General,
  Geometry::Unspecified
}
 

Public Member Functions

 AlignableObjectId (Geometry)
 
 AlignableObjectId (const TrackerGeometry *, const DTGeometry *, const CSCGeometry *, const GEMGeometry *)
 
 AlignableObjectId (const AlignableObjectId &)=default
 
 AlignableObjectId (AlignableObjectId &&)=default
 
template<typename T >
AlignableObjectId commonObjectIdProvider (const T *tracker, std::nullptr_t)
 
Geometry geometry () const
 retrieve the geometry information More...
 
const char * idToString (align::StructureType type) const
 
align::StructureType nameToType (const std::string &name) const
 Convert name to type. More...
 
AlignableObjectIdoperator= (const AlignableObjectId &)=default
 
AlignableObjectIdoperator= (AlignableObjectId &&)=default
 
align::StructureType stringToId (const char *) const
 
align::StructureType stringToId (const std::string &s) const
 
std::string typeToName (align::StructureType type) const
 Convert type to name. More...
 
virtual ~AlignableObjectId ()=default
 

Static Public Member Functions

static Geometry commonGeometry (Geometry, Geometry)
 
static AlignableObjectId commonObjectIdProvider (const AlignableObjectId &, const AlignableObjectId &)
 
template<typename TRACKER , typename MUON >
static AlignableObjectId commonObjectIdProvider (const TRACKER *, const MUON *)
 
template<typename TRACKER >
static AlignableObjectId commonObjectIdProvider (const TRACKER *, std::nullptr_t)
 

Static Private Member Functions

static Geometry muonGeometry (const DTGeometry *, const CSCGeometry *, const GEMGeometry *)
 
static Geometry trackerGeometry (const TrackerGeometry *)
 

Private Attributes

const entryentries_ {nullptr}
 
Geometry geometry_ {Geometry::Unspecified}
 

Detailed Description

Allows conversion between type and name, and vice-versa.

Definition at line 13 of file AlignableObjectId.h.

Member Enumeration Documentation

◆ Geometry

Enumerator
RunI 
PhaseI 
PhaseII 
General 
Unspecified 

Definition at line 16 of file AlignableObjectId.h.

16 { RunI, PhaseI, PhaseII, General, Unspecified };

Constructor & Destructor Documentation

◆ AlignableObjectId() [1/4]

AlignableObjectId::AlignableObjectId ( Geometry  )

◆ AlignableObjectId() [2/4]

AlignableObjectId::AlignableObjectId ( const TrackerGeometry tracker,
const DTGeometry muonDt,
const CSCGeometry muonCsc,
const GEMGeometry muonGem 
)

Definition at line 260 of file AlignableObjectId.cc.

264  : AlignableObjectId(commonGeometry(trackerGeometry(tracker), muonGeometry(muonDt, muonCsc, muonGem))) {}
static Geometry trackerGeometry(const TrackerGeometry *)
static Geometry commonGeometry(Geometry, Geometry)
static Geometry muonGeometry(const DTGeometry *, const CSCGeometry *, const GEMGeometry *)
AlignableObjectId(Geometry)

◆ AlignableObjectId() [3/4]

AlignableObjectId::AlignableObjectId ( const AlignableObjectId )
default

◆ AlignableObjectId() [4/4]

AlignableObjectId::AlignableObjectId ( AlignableObjectId &&  )
default

◆ ~AlignableObjectId()

virtual AlignableObjectId::~AlignableObjectId ( )
virtualdefault

Member Function Documentation

◆ commonGeometry()

AlignableObjectId::Geometry AlignableObjectId::commonGeometry ( Geometry  first,
Geometry  second 
)
static

Definition at line 323 of file AlignableObjectId.cc.

References Exception, dqmdumpme::first, General, and edm::second().

Referenced by commonObjectIdProvider().

323  {
324  if (first == Geometry::General)
325  return second;
326  if (second == Geometry::General)
327  return first;
328  if (first == second)
329  return first;
330 
331  throw cms::Exception("AlignableObjectIdError") << "@SUB=AlignableObjectId::commonGeometry\n"
332  << "impossible to find common geometry because the two geometries are "
333  << "different and none of them is 'General'";
334 }
U second(std::pair< T, U > const &p)

◆ commonObjectIdProvider() [1/4]

AlignableObjectId AlignableObjectId::commonObjectIdProvider ( const AlignableObjectId first,
const AlignableObjectId second 
)
static

Definition at line 336 of file AlignableObjectId.cc.

References commonGeometry(), dqmdumpme::first, and edm::second().

Referenced by AlignmentMonitorSurvey::book(), AlignmentMonitorGeneric::book(), HIPAlignmentAlgorithm::initialize(), PedeLabelerBase::PedeLabelerBase(), PedeSteerer::PedeSteerer(), and PedeSteererWeakModeConstraints::PedeSteererWeakModeConstraints().

337  {
338  return AlignableObjectId{commonGeometry(first.geometry(), second.geometry())};
339 }
static Geometry commonGeometry(Geometry, Geometry)
U second(std::pair< T, U > const &p)
Allows conversion between type and name, and vice-versa.

◆ commonObjectIdProvider() [2/4]

template<typename TRACKER , typename MUON >
AlignableObjectId AlignableObjectId::commonObjectIdProvider ( const TRACKER *  tracker,
const MUON *  muon 
)
static

Definition at line 54 of file AlignableObjectId.h.

References commonGeometry(), General, muonGeometry(), PbPb_ZMuSkimMuonDPG_cff::tracker, and trackerGeometry().

54  {
55  auto trackerGeometry = (tracker ? tracker->objectIdProvider().geometry() : AlignableObjectId::Geometry::General);
56  auto muonGeometry = (muon ? muon->objectIdProvider().geometry() : AlignableObjectId::Geometry::General);
58 }
static Geometry trackerGeometry(const TrackerGeometry *)
static Geometry commonGeometry(Geometry, Geometry)
static Geometry muonGeometry(const DTGeometry *, const CSCGeometry *, const GEMGeometry *)

◆ commonObjectIdProvider() [3/4]

template<typename TRACKER >
static AlignableObjectId AlignableObjectId::commonObjectIdProvider ( const TRACKER *  ,
std::nullptr_t   
)
static

◆ commonObjectIdProvider() [4/4]

template<typename T >
AlignableObjectId AlignableObjectId::commonObjectIdProvider ( const T tracker,
std::nullptr_t   
)

◆ geometry()

Geometry AlignableObjectId::geometry ( ) const
inline

◆ idToString()

const char * AlignableObjectId::idToString ( align::StructureType  type) const

Definition at line 273 of file AlignableObjectId.cc.

References entries_, Exception, and mps_fire::result.

Referenced by AlignableTrackerBuilder::buildAlignableDetUnits(), AlignableCompositeBuilder::buildAll(), AlignableCompositeBuilder::buildLevel(), MomentumDependentPedeLabeler::buildMomentumDependencyMap(), AlignableTrackerBuilder::buildOuterTrackerDetector(), AlignableTrackerBuilder::buildPixelDetector(), TrackerAlignmentLevelBuilder::buildPXBAlignmentLevels(), TrackerAlignmentLevelBuilder::buildPXEAlignmentLevels(), RunRangeDependentPedeLabeler::buildRunRangeDependencyMap(), AlignableTrackerBuilder::buildStripDetector(), TrackerAlignmentLevelBuilder::buildTECAlignmentLevels(), TrackerAlignmentLevelBuilder::buildTIBAlignmentLevels(), TrackerAlignmentLevelBuilder::buildTIDAlignmentLevels(), TrackerAlignmentLevelBuilder::buildTOBAlignmentLevels(), PedeSteererWeakModeConstraints::checkSelectionShiftParameter(), PedeSteererWeakModeConstraints::constructConstraints(), PedeSteererWeakModeConstraints::createAlignablesDataStructure(), MisalignmentScenarioBuilder::decodeMovements_(), AlignableIndexer::get(), MuonAlignmentInputXML::getCSCnode(), MuonAlignmentInputXML::getDTnode(), MuonAlignmentInputXML::getGEMnode(), PedeSteerer::hierarchyConstraint(), PedeSteerer::hierarchyConstraints(), PedeSteererWeakModeConstraints::makeLevelsFilenames(), PedeSteerer::presigmas(), PedeSteerer::presigmasFile(), typeToName(), and MuonAlignmentOutputXML::writeComponents().

273  {
274  const char *result = objectIdToString(type, entries_);
275 
276  if (result == nullptr) {
277  throw cms::Exception("AlignableObjectIdError") << "Unknown alignableObjectId " << type;
278  }
279 
280  return result;
281 }
const entry * entries_

◆ muonGeometry()

AlignableObjectId::Geometry AlignableObjectId::muonGeometry ( const DTGeometry ,
const CSCGeometry ,
const GEMGeometry  
)
staticprivate

Definition at line 316 of file AlignableObjectId.cc.

References General.

Referenced by commonObjectIdProvider().

318  {
319  // muon alignment structure types are identical for all kinds of geometries
320  return Geometry::General;
321 }

◆ nameToType()

align::StructureType AlignableObjectId::nameToType ( const std::string &  name) const

Convert name to type.

Definition at line 267 of file AlignableObjectId.cc.

References mergeVDriftHistosByStation::name, and stringToId().

267 { return stringToId(name.c_str()); }
align::StructureType stringToId(const char *) const

◆ operator=() [1/2]

AlignableObjectId& AlignableObjectId::operator= ( const AlignableObjectId )
default

◆ operator=() [2/2]

AlignableObjectId& AlignableObjectId::operator= ( AlignableObjectId &&  )
default

◆ stringToId() [1/2]

align::StructureType AlignableObjectId::stringToId ( const char *  name) const

Definition at line 284 of file AlignableObjectId.cc.

References entries_, Exception, mergeVDriftHistosByStation::name, and mps_fire::result.

Referenced by TrackerGeometryCompare::analyze(), nameToType(), MisalignmentScenarioBuilder::propagateParameters_(), and TrackerGeometryCompare::setCommonTrackerSystem().

284  {
285  auto result = stringToObjectId(name, entries_);
286  if (result == -1) {
287  throw cms::Exception("AlignableObjectIdError") << "Unknown alignableObjectId " << name;
288  }
289 
290  return result;
291 }
const entry * entries_

◆ stringToId() [2/2]

align::StructureType AlignableObjectId::stringToId ( const std::string &  s) const
inline

Definition at line 36 of file AlignableObjectId.h.

References alignCSCRings::s, and stringToId().

Referenced by stringToId().

36 { return stringToId(s.c_str()); }
align::StructureType stringToId(const char *) const

◆ trackerGeometry()

AlignableObjectId::Geometry AlignableObjectId::trackerGeometry ( const TrackerGeometry geometry)
staticprivate

Definition at line 294 of file AlignableObjectId.cc.

References Exception, General, GeomDetEnumerators::P1PXEC, GeomDetEnumerators::P2PXEC, PhaseI, PhaseII, GeomDetEnumerators::PixelEndcap, and RunI.

Referenced by commonObjectIdProvider().

294  {
295  if (!geometry)
296  return Geometry::General;
297 
298  if (geometry->isThere(GeomDetEnumerators::P2PXEC)) {
299  // use structure-type <-> name translation for PhaseII geometry
300  return Geometry::PhaseII;
301 
302  } else if (geometry->isThere(GeomDetEnumerators::P1PXEC)) {
303  // use structure-type <-> name translation for PhaseI geometry
304  return Geometry::PhaseI;
305 
306  } else if (geometry->isThere(GeomDetEnumerators::PixelEndcap)) {
307  // use structure-type <-> name translation for RunI geometry
308  return Geometry::RunI;
309 
310  } else {
311  throw cms::Exception("AlignableObjectIdError") << "@SUB=AlignableObjectId::trackerGeometry\n"
312  << "unknown version of TrackerGeometry";
313  }
314 }

◆ typeToName()

std::string AlignableObjectId::typeToName ( align::StructureType  type) const

Member Data Documentation

◆ entries_

const entry* AlignableObjectId::entries_ {nullptr}
private

Definition at line 49 of file AlignableObjectId.h.

Referenced by idToString(), and stringToId().

◆ geometry_

Geometry AlignableObjectId::geometry_ {Geometry::Unspecified}
private

Definition at line 50 of file AlignableObjectId.h.

Referenced by geometry().