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 *)
 
 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 *)
 
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 12 of file AlignableObjectId.h.

Member Enumeration Documentation

Enumerator
RunI 
PhaseI 
PhaseII 
General 
Unspecified 

Definition at line 15 of file AlignableObjectId.h.

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

Constructor & Destructor Documentation

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

Definition at line 247 of file AlignableObjectId.cc.

250  : AlignableObjectId(commonGeometry(trackerGeometry(tracker), muonGeometry(muonDt, muonCsc))) {}
static Geometry trackerGeometry(const TrackerGeometry *)
static Geometry commonGeometry(Geometry, Geometry)
static Geometry muonGeometry(const DTGeometry *, const CSCGeometry *)
AlignableObjectId(Geometry)
AlignableObjectId::AlignableObjectId ( const AlignableObjectId )
default
AlignableObjectId::AlignableObjectId ( AlignableObjectId &&  )
default
virtual AlignableObjectId::~AlignableObjectId ( )
virtualdefault

Member Function Documentation

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

Definition at line 307 of file AlignableObjectId.cc.

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

Referenced by commonObjectIdProvider(), and stringToId().

307  {
308  if (first == Geometry::General)
309  return second;
310  if (second == Geometry::General)
311  return first;
312  if (first == second)
313  return first;
314 
315  throw cms::Exception("AlignableObjectIdError") << "@SUB=AlignableObjectId::commonGeometry\n"
316  << "impossible to find common geometry because the two geometries are "
317  << "different and none of them is 'General'";
318 }
U second(std::pair< T, U > const &p)
AlignableObjectId AlignableObjectId::commonObjectIdProvider ( const AlignableObjectId first,
const AlignableObjectId second 
)
static

Definition at line 320 of file AlignableObjectId.cc.

References commonGeometry(), and geometry().

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

321  {
322  return AlignableObjectId{commonGeometry(first.geometry(), second.geometry())};
323 }
static Geometry commonGeometry(Geometry, Geometry)
Allows conversion between type and name, and vice-versa.
Geometry geometry() const
retrieve the geometry information
template<typename TRACKER , typename MUON >
AlignableObjectId AlignableObjectId::commonObjectIdProvider ( const TRACKER *  tracker,
const MUON *  muon 
)
static

Definition at line 53 of file AlignableObjectId.h.

References commonGeometry(), General, muonGeometry(), and trackerGeometry().

53  {
54  auto trackerGeometry = (tracker ? tracker->objectIdProvider().geometry() : AlignableObjectId::Geometry::General);
55  auto muonGeometry = (muon ? muon->objectIdProvider().geometry() : AlignableObjectId::Geometry::General);
57 }
static Geometry trackerGeometry(const TrackerGeometry *)
static Geometry commonGeometry(Geometry, Geometry)
static Geometry muonGeometry(const DTGeometry *, const CSCGeometry *)
template<typename TRACKER >
static AlignableObjectId AlignableObjectId::commonObjectIdProvider ( const TRACKER *  ,
std::nullptr_t   
)
static
template<typename T >
AlignableObjectId AlignableObjectId::commonObjectIdProvider ( const T tracker,
std::nullptr_t   
)

Definition at line 60 of file AlignableObjectId.h.

References commonGeometry(), General, and trackerGeometry().

Geometry AlignableObjectId::geometry ( ) const
inline
const char * AlignableObjectId::idToString ( align::StructureType  type) const

Definition at line 259 of file AlignableObjectId.cc.

References entries_, Exception, and mps_fire::result.

Referenced by AlignableTrackerBuilder::buildAlignableDetUnits(), AlignableCompositeBuilder::buildAll(), AlignableCompositeBuilder::buildLevel(), MomentumDependentPedeLabeler::buildMomentumDependencyMap(), 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_(), geometry(), AlignableIndexer::get(), MuonAlignmentInputXML::getCSCnode(), MuonAlignmentInputXML::getDTnode(), PedeSteerer::hierarchyConstraint(), PedeSteerer::hierarchyConstraints(), PedeSteererWeakModeConstraints::makeLevelsFilenames(), PedeSteerer::presigmas(), PedeSteerer::presigmasFile(), typeToName(), and MuonAlignmentOutputXML::writeComponents().

259  {
260  const char *result = objectIdToString(type, entries_);
261 
262  if (result == nullptr) {
263  throw cms::Exception("AlignableObjectIdError") << "Unknown alignableObjectId " << type;
264  }
265 
266  return result;
267 }
type
Definition: HCALResponse.h:21
const entry * entries_
AlignableObjectId::Geometry AlignableObjectId::muonGeometry ( const DTGeometry ,
const CSCGeometry  
)
staticprivate

Definition at line 302 of file AlignableObjectId.cc.

References General.

Referenced by commonObjectIdProvider(), and stringToId().

302  {
303  // muon alignment structure types are identical for all kinds of geometries
304  return Geometry::General;
305 }
align::StructureType AlignableObjectId::nameToType ( const std::string &  name) const

Convert name to type.

Definition at line 253 of file AlignableObjectId.cc.

References stringToId().

Referenced by geometry().

253 { return stringToId(name.c_str()); }
align::StructureType stringToId(const char *) const
AlignableObjectId& AlignableObjectId::operator= ( const AlignableObjectId )
default
AlignableObjectId& AlignableObjectId::operator= ( AlignableObjectId &&  )
default
align::StructureType AlignableObjectId::stringToId ( const char *  name) const

Definition at line 270 of file AlignableObjectId.cc.

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

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

270  {
271  auto result = stringToObjectId(name, entries_);
272  if (result == -1) {
273  throw cms::Exception("AlignableObjectIdError") << "Unknown alignableObjectId " << name;
274  }
275 
276  return result;
277 }
const entry * entries_
align::StructureType AlignableObjectId::stringToId ( const std::string &  s) const
inline

Definition at line 35 of file AlignableObjectId.h.

References commonGeometry(), commonObjectIdProvider(), pat::MUON, muonGeometry(), stringToId(), sistripsummary::TRACKER, and trackerGeometry().

Referenced by stringToId().

35 { return stringToId(s.c_str()); }
align::StructureType stringToId(const char *) const
AlignableObjectId::Geometry AlignableObjectId::trackerGeometry ( const TrackerGeometry geometry)
staticprivate

Definition at line 280 of file AlignableObjectId.cc.

References Exception, General, TrackerGeometry::isThere(), GeomDetEnumerators::P1PXEC, GeomDetEnumerators::P2PXEC, PhaseI, PhaseII, GeomDetEnumerators::PixelEndcap, and RunI.

Referenced by commonObjectIdProvider(), and stringToId().

280  {
281  if (!geometry)
282  return Geometry::General;
283 
284  if (geometry->isThere(GeomDetEnumerators::P2PXEC)) {
285  // use structure-type <-> name translation for PhaseII geometry
286  return Geometry::PhaseII;
287 
288  } else if (geometry->isThere(GeomDetEnumerators::P1PXEC)) {
289  // use structure-type <-> name translation for PhaseI geometry
290  return Geometry::PhaseI;
291 
292  } else if (geometry->isThere(GeomDetEnumerators::PixelEndcap)) {
293  // use structure-type <-> name translation for RunI geometry
294  return Geometry::RunI;
295 
296  } else {
297  throw cms::Exception("AlignableObjectIdError") << "@SUB=AlignableObjectId::trackerGeometry\n"
298  << "unknown version of TrackerGeometry";
299  }
300 }
bool isThere(GeomDetEnumerators::SubDetector subdet) const
std::string AlignableObjectId::typeToName ( align::StructureType  type) const

Member Data Documentation

const entry* AlignableObjectId::entries_ {nullptr}
private

Definition at line 48 of file AlignableObjectId.h.

Referenced by idToString(), and stringToId().

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

Definition at line 49 of file AlignableObjectId.h.

Referenced by geometry().