CMS 3D CMS Logo

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

#include <PedeLabeler.h>

Inheritance diagram for PedeLabeler:
PedeLabelerBase

Public Member Functions

AlignablealignableFromLabel (unsigned int label) const override
 
unsigned int alignableLabel (const Alignable *alignable) const override
 Return 32-bit unique label for alignable, 0 indicates failure. More...
 
unsigned int alignableLabelFromLabel (unsigned int label) const override
 alignable label from parameter label (works also for alignable label...) More...
 
unsigned int alignableLabelFromParamAndInstance (const Alignable *alignable, unsigned int param, unsigned int instance) const override
 
bool hasSplitParameters (Alignable *alignable) const override
 returns true if the alignable has parameters that are split into various bins More...
 
unsigned int lasBeamIdFromLabel (unsigned int label) const override
 
unsigned int lasBeamLabel (unsigned int lasBeamId) const override
 
unsigned int maxNumberOfParameterInstances () const override
 returns the maximum number of instances for any parameter of an Alignable* More...
 
unsigned int numberOfParameterInstances (Alignable *alignable, int param=-1) const override
 returns the number of instances for a given parameter More...
 
unsigned int parameterLabel (unsigned int aliLabel, unsigned int parNum) const override
 returns the label for a given alignable parameter number combination More...
 
unsigned int parameterLabel (Alignable *alignable, unsigned int parNum, const AlignmentAlgorithmBase::EventInfo &eventInfo, const TrajectoryStateOnSurface &tsos) const override
 
unsigned int paramNumFromLabel (unsigned int paramLabel) const override
 parameter number, 0 <= .. < theMaxNumParam, belonging to unique parameter label More...
 
 PedeLabeler (const PedeLabelerBase::TopLevelAlignables &alignables, const edm::ParameterSet &config)
 constructor from three Alignables (null pointers allowed ) More...
 
 ~PedeLabeler () override
 destructor More...
 
- Public Member Functions inherited from PedeLabelerBase
virtual void addCalibrations (const std::vector< IntegratedCalibrationBase *> &iCals)
 tell labeler to treat also integrated calibrations More...
 
const AlignableExtrasalignableExtras () const
 
const AlignableMuonalignableMuon () const
 
const AlignableTrackeralignableTracker () const
 
virtual unsigned int calibrationLabel (const IntegratedCalibrationBase *calib, unsigned int paramNum) const
 label for parameter 'paramNum' (counted from 0) of an integrated calibration More...
 
virtual std::pair< IntegratedCalibrationBase *, unsigned int > calibrationParamFromLabel (unsigned int label) const
 
virtual unsigned int firstFreeLabel () const
 
unsigned int parameterInstanceOffset () const
 offset in labels between consecutive parameter instances of Alignable*s More...
 
 PedeLabelerBase (const TopLevelAlignables &alignables, const edm::ParameterSet &config)
 constructor from three Alignables (null pointers allowed ) More...
 
virtual const RunRangerunRangeFromLabel (unsigned int label) const
 
virtual ~PedeLabelerBase ()
 

Private Types

typedef std::map< Alignable *, unsigned int, AlignableComparatorAlignableToIdMap
 
typedef AlignableToIdMap::value_type AlignableToIdPair
 
typedef std::map< unsigned int, Alignable * > IdToAlignableMap
 
typedef std::map< unsigned int, unsigned int > UintUintMap
 

Private Member Functions

unsigned int buildMap (const align::Alignables &)
 returns size of map More...
 
unsigned int buildReverseMap ()
 returns size of map More...
 

Private Attributes

AlignableToIdMap theAlignableToIdMap
 
IdToAlignableMap theIdToAlignableMap
 providing unique ID for alignable, space for param IDs More...
 
UintUintMap theLabelToLasBeamMap
 labels for las beams More...
 
UintUintMap theLasBeamToLabelMap
 reverse map More...
 

Additional Inherited Members

- Public Types inherited from PedeLabelerBase
using RunNumber = align::RunNumber
 
using RunRange = align::RunRange
 
using RunRanges = align::RunRanges
 
- Static Public Attributes inherited from PedeLabelerBase
static const unsigned int theMaxNumParam = RigidBodyAlignmentParameters::N_PARAM + 14
 
static const unsigned int theMinLabel = 1
 
static const unsigned int theParamInstanceOffset = 700000
 
- Protected Member Functions inherited from PedeLabelerBase
virtual unsigned int firstNonAlignableLabel () const
 
const AlignableObjectIdobjectIdProvider () const
 Return tracker alignable object ID provider derived from the tracker's geometry. More...
 
- Protected Attributes inherited from PedeLabelerBase
const RunRange theOpenRunRange
 

Detailed Description

provides labels for AlignmentParameters for pede

Author
: Gero Flucke date : September 2007
Date
2011/02/16 12:52:46
Revision
1.5

(last update by

Author
mussgill

)

Definition at line 26 of file PedeLabeler.h.

Member Typedef Documentation

◆ AlignableToIdMap

typedef std::map<Alignable *, unsigned int, AlignableComparator> PedeLabeler::AlignableToIdMap
private

Definition at line 64 of file PedeLabeler.h.

◆ AlignableToIdPair

typedef AlignableToIdMap::value_type PedeLabeler::AlignableToIdPair
private

Definition at line 65 of file PedeLabeler.h.

◆ IdToAlignableMap

typedef std::map<unsigned int, Alignable *> PedeLabeler::IdToAlignableMap
private

Definition at line 66 of file PedeLabeler.h.

◆ UintUintMap

typedef std::map<unsigned int, unsigned int> PedeLabeler::UintUintMap
private

Definition at line 67 of file PedeLabeler.h.

Constructor & Destructor Documentation

◆ PedeLabeler()

PedeLabeler::PedeLabeler ( const PedeLabelerBase::TopLevelAlignables alignables,
const edm::ParameterSet config 
)

constructor from three Alignables (null pointers allowed )

Definition at line 22 of file PedeLabeler.cc.

References PedeLabelerBase::TopLevelAlignables::aliExtras_, PedeLabelerBase::TopLevelAlignables::aliMuon_, PedeLabelerBase::TopLevelAlignables::aliTracker_, buildMap(), buildReverseMap(), and AlignableExtras::components().

23  : PedeLabelerBase(alignables, config) {
24  align::Alignables alis;
25  alis.push_back(alignables.aliTracker_);
26  alis.push_back(alignables.aliMuon_);
27 
28  if (alignables.aliExtras_) {
29  for (const auto& ali : alignables.aliExtras_->components()) {
30  alis.push_back(ali);
31  }
32  }
33 
34  this->buildMap(alis);
35  this->buildReverseMap();
36 }
const Alignables & components() const
Definition: config.py:1
unsigned int buildReverseMap()
returns size of map
Definition: PedeLabeler.cc:183
PedeLabelerBase(const TopLevelAlignables &alignables, const edm::ParameterSet &config)
constructor from three Alignables (null pointers allowed )
unsigned int buildMap(const align::Alignables &)
returns size of map
Definition: PedeLabeler.cc:143
std::vector< Alignable * > Alignables
Definition: Utilities.h:31

◆ ~PedeLabeler()

PedeLabeler::~PedeLabeler ( )
override

destructor

Definition at line 39 of file PedeLabeler.cc.

39 {}

Member Function Documentation

◆ alignableFromLabel()

Alignable * PedeLabeler::alignableFromLabel ( unsigned int  label) const
overridevirtual

Alignable from alignable or parameter label, null if no alignable (but error only if not las beam, either!)

Implements PedeLabelerBase.

Definition at line 107 of file PedeLabeler.cc.

References alignableLabelFromLabel(), position, theIdToAlignableMap, theLabelToLasBeamMap, and PedeLabelerBase::theMinLabel.

107  {
108  const unsigned int aliLabel = this->alignableLabelFromLabel(label);
109  if (aliLabel < theMinLabel)
110  return nullptr; // error already given
111 
112  IdToAlignableMap::const_iterator position = theIdToAlignableMap.find(aliLabel);
113  if (position != theIdToAlignableMap.end()) {
114  return position->second;
115  } else {
116  // error only if not in lasBeamMap:
117  UintUintMap::const_iterator position = theLabelToLasBeamMap.find(aliLabel);
118  if (position == theLabelToLasBeamMap.end()) {
119  edm::LogError("LogicError") << "@SUB=PedeLabeler::alignableFromLabel"
120  << "Alignable label " << aliLabel << " not in map.";
121  }
122  return nullptr;
123  }
124 }
static const unsigned int theMinLabel
Log< level::Error, false > LogError
UintUintMap theLabelToLasBeamMap
labels for las beams
Definition: PedeLabeler.h:78
char const * label
IdToAlignableMap theIdToAlignableMap
providing unique ID for alignable, space for param IDs
Definition: PedeLabeler.h:76
unsigned int alignableLabelFromLabel(unsigned int label) const override
alignable label from parameter label (works also for alignable label...)
Definition: PedeLabeler.cc:102
static int position[264][3]
Definition: ReadPGInfo.cc:289

◆ alignableLabel()

unsigned int PedeLabeler::alignableLabel ( const Alignable alignable) const
overridevirtual

Return 32-bit unique label for alignable, 0 indicates failure.

uniqueId of Alignable, 0 if alignable not known between this ID and the next there is enough 'space' to add parameter numbers 0...nPar-1 to make unique IDs for the labels of active parameters

Implements PedeLabelerBase.

Definition at line 43 of file PedeLabeler.cc.

References Alignable::alignableObjectId(), Alignable::id(), position, and theAlignableToIdMap.

Referenced by alignableLabelFromParamAndInstance(), and parameterLabel().

43  {
44  if (!alignable)
45  return 0;
46 
47  AlignableToIdMap::const_iterator position = theAlignableToIdMap.find(alignable);
48  if (position != theAlignableToIdMap.end()) {
49  return position->second;
50  } else {
51  const DetId detId(alignable->id());
52  //throw cms::Exception("LogicError")
53  edm::LogError("LogicError") << "@SUB=PedeLabeler::alignableLabel"
54  << "Alignable " << typeid(*alignable).name()
55  << " not in map, det/subdet/alignableStructureType = " << detId.det() << "/"
56  << detId.subdetId() << "/" << alignable->alignableObjectId();
57  return 0;
58  }
59 }
Log< level::Error, false > LogError
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
AlignableToIdMap theAlignableToIdMap
Definition: PedeLabeler.h:75
Definition: DetId.h:17
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:180
static int position[264][3]
Definition: ReadPGInfo.cc:289

◆ alignableLabelFromLabel()

unsigned int PedeLabeler::alignableLabelFromLabel ( unsigned int  label) const
overridevirtual

alignable label from parameter label (works also for alignable label...)

Implements PedeLabelerBase.

Definition at line 102 of file PedeLabeler.cc.

References volumeBasedMagneticField_160812_cfi::paramLabel, and paramNumFromLabel().

Referenced by alignableFromLabel(), and lasBeamIdFromLabel().

102  {
103  return paramLabel - this->paramNumFromLabel(paramLabel);
104 }
unsigned int paramNumFromLabel(unsigned int paramLabel) const override
parameter number, 0 <= .. < theMaxNumParam, belonging to unique parameter label
Definition: PedeLabeler.cc:92

◆ alignableLabelFromParamAndInstance()

unsigned int PedeLabeler::alignableLabelFromParamAndInstance ( const Alignable alignable,
unsigned int  param,
unsigned int  instance 
) const
overridevirtual

uniqueId of Alignable for a given parameter index and instance, 0 if alignable not known between this ID and the next there is enough 'space' to add parameter numbers 0...nPar-1 to make unique IDs for the labels of active parameters

Implements PedeLabelerBase.

Definition at line 63 of file PedeLabeler.cc.

References alignableLabel().

65  {
66  return this->alignableLabel(alignable);
67 }
unsigned int alignableLabel(const Alignable *alignable) const override
Return 32-bit unique label for alignable, 0 indicates failure.
Definition: PedeLabeler.cc:43

◆ buildMap()

unsigned int PedeLabeler::buildMap ( const align::Alignables alis)
private

returns size of map

Definition at line 143 of file PedeLabeler.cc.

References l1ctLayer2EG_cff::id, theAlignableToIdMap, theLasBeamToLabelMap, PedeLabelerBase::theMaxNumParam, and PedeLabelerBase::theMinLabel.

Referenced by PedeLabeler().

143  {
144  theAlignableToIdMap.clear(); // just in case of re-use...
145 
146  align::Alignables allComps;
147 
148  for (const auto& iAli : alis) {
149  if (iAli) {
150  allComps.push_back(iAli);
151  iAli->recursiveComponents(allComps);
152  }
153  }
154 
155  unsigned int id = theMinLabel;
156  for (const auto& iter : allComps) {
157  theAlignableToIdMap.insert(AlignableToIdPair(iter, id));
158  id += theMaxNumParam;
159  }
160 
161  // also care about las beams
162  theLasBeamToLabelMap.clear(); // just in case of re-use...
163  // FIXME: Temporarily hard code values stolen from
164  // https://twiki.cern.ch/twiki/bin/view/CMS/TkLasTrackBasedInterface#Beam_identifier .
165  unsigned int beamIds[] = {0, 10, 20, 30, 40, 50, 60, 70, // TEC+ R4
166  1, 11, 21, 31, 41, 51, 61, 71, // TEC+ R6
167  100, 110, 120, 130, 140, 150, 160, 170, // TEC- R4
168  101, 111, 121, 131, 141, 151, 161, 171, // TEC- R6
169  200, 210, 220, 230, 240, 250, 260, 270}; // AT
170 
171  const size_t nBeams = sizeof(beamIds) / sizeof(beamIds[0]);
172  for (size_t iBeam = 0; iBeam < nBeams; ++iBeam) {
173  //edm::LogInfo("Alignment") << "Las beam " << beamIds[iBeam] << " gets label " << id << ".";
174  theLasBeamToLabelMap[beamIds[iBeam]] = id;
175  id += theMaxNumParam;
176  }
177 
178  // return combined size
179  return theAlignableToIdMap.size() + theLasBeamToLabelMap.size();
180 }
static const unsigned int theMinLabel
static const unsigned int theMaxNumParam
AlignableToIdMap::value_type AlignableToIdPair
Definition: PedeLabeler.h:65
AlignableToIdMap theAlignableToIdMap
Definition: PedeLabeler.h:75
UintUintMap theLasBeamToLabelMap
reverse map
Definition: PedeLabeler.h:77
std::vector< Alignable * > Alignables
Definition: Utilities.h:31

◆ buildReverseMap()

unsigned int PedeLabeler::buildReverseMap ( )
private

returns size of map

Definition at line 183 of file PedeLabeler.cc.

References theAlignableToIdMap, theIdToAlignableMap, theLabelToLasBeamMap, and theLasBeamToLabelMap.

Referenced by PedeLabeler().

183  {
184  // alignables
185  theIdToAlignableMap.clear(); // just in case of re-use...
186 
187  for (const auto& it : theAlignableToIdMap) {
188  theIdToAlignableMap[it.second] = it.first;
189  }
190 
191  // las beams
192  theLabelToLasBeamMap.clear(); // just in case of re-use...
193 
194  for (const auto& it : theLasBeamToLabelMap) {
195  theLabelToLasBeamMap[it.second] = it.first; //revert key/value
196  }
197 
198  // return combined size
199  return theIdToAlignableMap.size() + theLabelToLasBeamMap.size();
200 }
UintUintMap theLabelToLasBeamMap
labels for las beams
Definition: PedeLabeler.h:78
IdToAlignableMap theIdToAlignableMap
providing unique ID for alignable, space for param IDs
Definition: PedeLabeler.h:76
AlignableToIdMap theAlignableToIdMap
Definition: PedeLabeler.h:75
UintUintMap theLasBeamToLabelMap
reverse map
Definition: PedeLabeler.h:77

◆ hasSplitParameters()

bool PedeLabeler::hasSplitParameters ( Alignable alignable) const
inlineoverridevirtual

returns true if the alignable has parameters that are split into various bins

Implements PedeLabelerBase.

Definition at line 48 of file PedeLabeler.h.

48 { return false; }

◆ lasBeamIdFromLabel()

unsigned int PedeLabeler::lasBeamIdFromLabel ( unsigned int  label) const
overridevirtual

las beam id from las beam or parameter label zero and error if not a valid las beam label

Implements PedeLabelerBase.

Definition at line 127 of file PedeLabeler.cc.

References alignableLabelFromLabel(), position, theLabelToLasBeamMap, and PedeLabelerBase::theMinLabel.

127  {
128  const unsigned int aliLabel = this->alignableLabelFromLabel(label);
129  if (aliLabel < theMinLabel)
130  return 0; // error already given
131 
132  UintUintMap::const_iterator position = theLabelToLasBeamMap.find(aliLabel);
133  if (position != theLabelToLasBeamMap.end()) {
134  return position->second;
135  } else {
136  edm::LogError("LogicError") << "@SUB=PedeLabeler::lasBeamIdFromLabel"
137  << "Alignable label " << aliLabel << " not in map.";
138  return 0;
139  }
140 }
static const unsigned int theMinLabel
Log< level::Error, false > LogError
UintUintMap theLabelToLasBeamMap
labels for las beams
Definition: PedeLabeler.h:78
char const * label
unsigned int alignableLabelFromLabel(unsigned int label) const override
alignable label from parameter label (works also for alignable label...)
Definition: PedeLabeler.cc:102
static int position[264][3]
Definition: ReadPGInfo.cc:289

◆ lasBeamLabel()

unsigned int PedeLabeler::lasBeamLabel ( unsigned int  lasBeamId) const
overridevirtual

Implements PedeLabelerBase.

Definition at line 70 of file PedeLabeler.cc.

References position, and theLasBeamToLabelMap.

70  {
71  UintUintMap::const_iterator position = theLasBeamToLabelMap.find(lasBeamId);
72  if (position != theLasBeamToLabelMap.end()) {
73  return position->second;
74  } else {
75  //throw cms::Exception("LogicError")
76  edm::LogError("LogicError") << "@SUB=PedeLabeler::lasBeamLabel"
77  << "No label for beam Id " << lasBeamId;
78  return 0;
79  }
80 }
Log< level::Error, false > LogError
UintUintMap theLasBeamToLabelMap
reverse map
Definition: PedeLabeler.h:77
static int position[264][3]
Definition: ReadPGInfo.cc:289

◆ maxNumberOfParameterInstances()

unsigned int PedeLabeler::maxNumberOfParameterInstances ( ) const
inlineoverridevirtual

returns the maximum number of instances for any parameter of an Alignable*

Implements PedeLabelerBase.

Definition at line 50 of file PedeLabeler.h.

50 { return 1; }

◆ numberOfParameterInstances()

unsigned int PedeLabeler::numberOfParameterInstances ( Alignable alignable,
int  param = -1 
) const
inlineoverridevirtual

returns the number of instances for a given parameter

Implements PedeLabelerBase.

Definition at line 49 of file PedeLabeler.h.

49 { return 1; }

◆ parameterLabel() [1/2]

unsigned int PedeLabeler::parameterLabel ( unsigned int  aliLabel,
unsigned int  parNum 
) const
overridevirtual

returns the label for a given alignable parameter number combination

Implements PedeLabelerBase.

Definition at line 83 of file PedeLabeler.cc.

References Exception, and PedeLabelerBase::theMaxNumParam.

Referenced by parameterLabel().

83  {
84  if (parNum >= theMaxNumParam) {
85  throw cms::Exception("Alignment") << "@SUB=PedeLabeler::parameterLabel"
86  << "Parameter number " << parNum << " out of range 0 <= num < " << theMaxNumParam;
87  }
88  return aliLabel + parNum;
89 }
static const unsigned int theMaxNumParam

◆ parameterLabel() [2/2]

unsigned int PedeLabeler::parameterLabel ( Alignable alignable,
unsigned int  parNum,
const AlignmentAlgorithmBase::EventInfo eventInfo,
const TrajectoryStateOnSurface tsos 
) const
inlineoverridevirtual

returns the label for a given alignable parameter number combination in case the parameters are split into various instances

Implements PedeLabelerBase.

Definition at line 42 of file PedeLabeler.h.

References alignableLabel(), and parameterLabel().

45  {
46  return parameterLabel(alignableLabel(alignable), parNum);
47  }
unsigned int alignableLabel(const Alignable *alignable) const override
Return 32-bit unique label for alignable, 0 indicates failure.
Definition: PedeLabeler.cc:43
unsigned int parameterLabel(unsigned int aliLabel, unsigned int parNum) const override
returns the label for a given alignable parameter number combination
Definition: PedeLabeler.cc:83

◆ paramNumFromLabel()

unsigned int PedeLabeler::paramNumFromLabel ( unsigned int  paramLabel) const
overridevirtual

parameter number, 0 <= .. < theMaxNumParam, belonging to unique parameter label

Implements PedeLabelerBase.

Definition at line 92 of file PedeLabeler.cc.

References volumeBasedMagneticField_160812_cfi::paramLabel, PedeLabelerBase::theMaxNumParam, and PedeLabelerBase::theMinLabel.

Referenced by alignableLabelFromLabel().

92  {
93  if (paramLabel < theMinLabel) {
94  edm::LogError("LogicError") << "@SUB=PedeLabeler::paramNumFromLabel"
95  << "Label " << paramLabel << " should be >= " << theMinLabel;
96  return 0;
97  }
99 }
static const unsigned int theMinLabel
Log< level::Error, false > LogError
static const unsigned int theMaxNumParam

Member Data Documentation

◆ theAlignableToIdMap

AlignableToIdMap PedeLabeler::theAlignableToIdMap
private

Definition at line 75 of file PedeLabeler.h.

Referenced by alignableLabel(), buildMap(), and buildReverseMap().

◆ theIdToAlignableMap

IdToAlignableMap PedeLabeler::theIdToAlignableMap
private

providing unique ID for alignable, space for param IDs

Definition at line 76 of file PedeLabeler.h.

Referenced by alignableFromLabel(), and buildReverseMap().

◆ theLabelToLasBeamMap

UintUintMap PedeLabeler::theLabelToLasBeamMap
private

labels for las beams

Definition at line 78 of file PedeLabeler.h.

Referenced by alignableFromLabel(), buildReverseMap(), and lasBeamIdFromLabel().

◆ theLasBeamToLabelMap

UintUintMap PedeLabeler::theLasBeamToLabelMap
private

reverse map

Definition at line 77 of file PedeLabeler.h.

Referenced by buildMap(), buildReverseMap(), and lasBeamLabel().