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
 
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 &)
 
static AlignableObjectId commonObjectIdProvider (const AlignableTracker *, const AlignableMuon *)
 

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 15 of file AlignableObjectId.h.

Member Enumeration Documentation

Enumerator
RunI 
PhaseI 
PhaseII 
General 
Unspecified 

Definition at line 19 of file AlignableObjectId.h.

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

Constructor & Destructor Documentation

AlignableObjectId::AlignableObjectId ( AlignableObjectId::Geometry  geometry)

Definition at line 240 of file AlignableObjectId.cc.

References entries_, Exception, General, PhaseI, PhaseII, RunI, and Unspecified.

240  :
242 {
243  switch (geometry) {
244  case AlignableObjectId::Geometry::RunI: entries_ = entries_RunI; break;
245  case AlignableObjectId::Geometry::PhaseI: entries_ = entries_PhaseI; break;
246  case AlignableObjectId::Geometry::PhaseII: entries_ = entries_PhaseII; break;
247  case AlignableObjectId::Geometry::General: entries_ = entries_RunI; break;
248  case AlignableObjectId::Geometry::Unspecified: entries_ = nullptr; break;
249  }
250  if (!entries_) {
251  throw cms::Exception("LogicError")
252  << "@SUB=AlignableObjectId::ctor\n"
253  << "trying to create AlignableObjectId with unspecified geometry";
254  }
255 }
const entry * entries_
AlignableObjectId::AlignableObjectId ( const TrackerGeometry tracker,
const DTGeometry muonDt,
const CSCGeometry muonCsc 
)

Definition at line 260 of file AlignableObjectId.cc.

262  :
264  muonGeometry(muonDt, muonCsc)))
265 {
266 }
static Geometry trackerGeometry(const TrackerGeometry *)
static Geometry commonGeometry(Geometry, Geometry)
static Geometry muonGeometry(const DTGeometry *, const CSCGeometry *)
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 339 of file AlignableObjectId.cc.

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

Referenced by commonObjectIdProvider(), muonGeometry(), and stringToId().

339  {
340  if (first == Geometry::General) return second;
341  if (second == Geometry::General) return first;
342  if (first == second) return first;
343 
344  throw cms::Exception("AlignableObjectIdError")
345  << "@SUB=AlignableObjectId::commonGeometry\n"
346  << "impossible to find common geometry because the two geometries are "
347  << "different and none of them is 'General'";
348 }
U second(std::pair< T, U > const &p)
AlignableObjectId AlignableObjectId::commonObjectIdProvider ( const AlignableObjectId first,
const AlignableObjectId second 
)
static

Definition at line 351 of file AlignableObjectId.cc.

References commonGeometry(), and geometry().

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

352  {
353  return AlignableObjectId{commonGeometry(first.geometry(), second.geometry())};
354 }
static Geometry commonGeometry(Geometry, Geometry)
Allows conversion between type and name, and vice-versa.
Geometry geometry() const
retrieve the geometry information
AlignableObjectId AlignableObjectId::commonObjectIdProvider ( const AlignableTracker tracker,
const AlignableMuon muon 
)
static

Definition at line 357 of file AlignableObjectId.cc.

References commonGeometry(), General, geometry(), muonGeometry(), AlignableMuon::objectIdProvider(), AlignableTracker::objectIdProvider(), and trackerGeometry().

358  {
359  auto trackerGeometry = (tracker ?
360  tracker->objectIdProvider().geometry() :
362  auto muonGeometry = (muon ?
363  muon->objectIdProvider().geometry() :
366 }
static Geometry trackerGeometry(const TrackerGeometry *)
static Geometry commonGeometry(Geometry, Geometry)
const AlignableObjectId & objectIdProvider() const
Return muon alignable object ID provider derived from the muon system geometry.
Definition: AlignableMuon.h:85
static Geometry muonGeometry(const DTGeometry *, const CSCGeometry *)
Geometry geometry() const
retrieve the geometry information
const AlignableObjectId & objectIdProvider() const
Return tracker alignable object ID provider derived from the tracker&#39;s geometry.
Geometry AlignableObjectId::geometry ( ) const
inline
const char * AlignableObjectId::idToString ( align::StructureType  type) const

Definition at line 282 of file AlignableObjectId.cc.

References entries_, Exception, mps_fire::result, and AlignableObjectId::entry::type.

Referenced by MomentumDependentPedeLabeler::buildMomentumDependencyMap(), TrackerAlignmentLevelBuilder::buildPXBAlignmentLevels(), TrackerAlignmentLevelBuilder::buildPXEAlignmentLevels(), RunRangeDependentPedeLabeler::buildRunRangeDependencyMap(), 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().

283 {
284  const char *result = objectIdToString(type, entries_);
285 
286  if (result == 0)
287  {
288  throw cms::Exception("AlignableObjectIdError")
289  << "Unknown alignableObjectId " << type;
290  }
291 
292  return result;
293 }
type
Definition: HCALResponse.h:21
const entry * entries_
AlignableObjectId::Geometry AlignableObjectId::muonGeometry ( const DTGeometry ,
const CSCGeometry  
)
staticprivate

Definition at line 333 of file AlignableObjectId.cc.

References commonGeometry(), and General.

Referenced by commonObjectIdProvider(), stringToId(), and trackerGeometry().

333  {
334  // muon alignment structure types are identical for all kinds of geometries
335  return Geometry::General;
336 }
align::StructureType AlignableObjectId::nameToType ( const std::string &  name) const

Convert name to type.

Definition at line 270 of file AlignableObjectId.cc.

References stringToId().

Referenced by geometry().

271 {
272  return stringToId(name.c_str());
273 }
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 296 of file AlignableObjectId.cc.

References entries_, Exception, AlignableObjectId::entry::name, mps_fire::result, and trackerGeometry().

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

297 {
298  auto result = stringToObjectId(name, entries_);
299  if (result == -1)
300  {
301  throw cms::Exception("AlignableObjectIdError")
302  << "Unknown alignableObjectId " << name;
303  }
304 
305  return result;
306 }
const entry * entries_
align::StructureType AlignableObjectId::stringToId ( const std::string &  s) const
inline

Definition at line 39 of file AlignableObjectId.h.

References commonGeometry(), commonObjectIdProvider(), muonGeometry(), stringToId(), and trackerGeometry().

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

Definition at line 310 of file AlignableObjectId.cc.

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

Referenced by commonObjectIdProvider(), and stringToId().

310  {
311  if (!geometry) return Geometry::General;
312 
313  if (geometry->isThere(GeomDetEnumerators::P2PXEC)) {
314  // use structure-type <-> name translation for PhaseII geometry
315  return Geometry::PhaseII;
316 
317  } else if (geometry->isThere(GeomDetEnumerators::P1PXEC)) {
318  // use structure-type <-> name translation for PhaseI geometry
319  return Geometry::PhaseI;
320 
321  } else if (geometry->isThere(GeomDetEnumerators::PixelEndcap)) {
322  // use structure-type <-> name translation for RunI geometry
323  return Geometry::RunI;
324 
325  } else {
326  throw cms::Exception("AlignableObjectIdError")
327  << "@SUB=AlignableObjectId::trackerGeometry\n"
328  << "unknown version of TrackerGeometry";
329  }
330 }
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 52 of file AlignableObjectId.h.

Referenced by AlignableObjectId(), idToString(), and stringToId().

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

Definition at line 53 of file AlignableObjectId.h.

Referenced by geometry().