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 (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 (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 > AlignableToIdMap
 
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 std::vector< Alignable * > &alis)
 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 25 of file PedeLabeler.h.

Member Typedef Documentation

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

Definition at line 66 of file PedeLabeler.h.

typedef AlignableToIdMap::value_type PedeLabeler::AlignableToIdPair
private

Definition at line 67 of file PedeLabeler.h.

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

Definition at line 68 of file PedeLabeler.h.

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

Definition at line 69 of file PedeLabeler.h.

Constructor & Destructor Documentation

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().

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

destructor

Definition at line 41 of file PedeLabeler.cc.

42 {
43 }

Member Function Documentation

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 117 of file PedeLabeler.cc.

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

Referenced by maxNumberOfParameterInstances().

118 {
119  const unsigned int aliLabel = this->alignableLabelFromLabel(label);
120  if (aliLabel < theMinLabel) return nullptr; // error already given
121 
122  IdToAlignableMap::const_iterator position = theIdToAlignableMap.find(aliLabel);
123  if (position != theIdToAlignableMap.end()) {
124  return position->second;
125  } else {
126  // error only if not in lasBeamMap:
127  UintUintMap::const_iterator position = theLabelToLasBeamMap.find(aliLabel);
128  if (position == theLabelToLasBeamMap.end()) {
129  edm::LogError("LogicError") << "@SUB=PedeLabeler::alignableFromLabel"
130  << "Alignable label " << aliLabel << " not in map.";
131  }
132  return nullptr;
133  }
134 }
static const unsigned int theMinLabel
UintUintMap theLabelToLasBeamMap
labels for las beams
Definition: PedeLabeler.h:80
IdToAlignableMap theIdToAlignableMap
providing unique ID for alignable, space for param IDs
Definition: PedeLabeler.h:78
unsigned int alignableLabelFromLabel(unsigned int label) const override
alignable label from parameter label (works also for alignable label...)
Definition: PedeLabeler.cc:111
static int position[264][3]
Definition: ReadPGInfo.cc:509
unsigned int PedeLabeler::alignableLabel ( 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 47 of file PedeLabeler.cc.

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

Referenced by alignableLabelFromParamAndInstance(), and parameterLabel().

48 {
49  if (!alignable) return 0;
50 
51  AlignableToIdMap::const_iterator position = theAlignableToIdMap.find(alignable);
52  if (position != theAlignableToIdMap.end()) {
53  return position->second;
54  } else {
55  const DetId detId(alignable->id());
56  //throw cms::Exception("LogicError")
57  edm::LogError("LogicError")
58  << "@SUB=PedeLabeler::alignableLabel" << "Alignable "
59  << typeid(*alignable).name() << " not in map, det/subdet/alignableStructureType = "
60  << detId.det() << "/" << detId.subdetId() << "/" << alignable->alignableObjectId();
61  return 0;
62  }
63 }
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:189
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
AlignableToIdMap theAlignableToIdMap
Definition: PedeLabeler.h:77
Definition: DetId.h:18
static int position[264][3]
Definition: ReadPGInfo.cc:509
unsigned int PedeLabeler::alignableLabelFromLabel ( unsigned int  label) const
overridevirtual

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

Implements PedeLabelerBase.

Definition at line 111 of file PedeLabeler.cc.

References paramNumFromLabel().

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

112 {
113  return paramLabel - this->paramNumFromLabel(paramLabel);
114 }
unsigned int paramNumFromLabel(unsigned int paramLabel) const override
parameter number, 0 <= .. < theMaxNumParam, belonging to unique parameter label
Definition: PedeLabeler.cc:100
unsigned int PedeLabeler::alignableLabelFromParamAndInstance ( 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 67 of file PedeLabeler.cc.

References alignableLabel().

70 {
71  return this->alignableLabel(alignable);
72 }
unsigned int alignableLabel(Alignable *alignable) const override
Return 32-bit unique label for alignable, 0 indicates failure.
Definition: PedeLabeler.cc:47
unsigned int PedeLabeler::buildMap ( const std::vector< Alignable * > &  alis)
private

returns size of map

Definition at line 153 of file PedeLabeler.cc.

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

Referenced by PedeLabeler().

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

returns size of map

Definition at line 194 of file PedeLabeler.cc.

References DEFINE_EDM_PLUGIN, theAlignableToIdMap, theIdToAlignableMap, theLabelToLasBeamMap, and theLasBeamToLabelMap.

Referenced by PedeLabeler().

195 {
196  // alignables
197  theIdToAlignableMap.clear(); // just in case of re-use...
198 
199  for (const auto& it: theAlignableToIdMap) {
200  theIdToAlignableMap[it.second] = it.first;
201  }
202 
203  // las beams
204  theLabelToLasBeamMap.clear(); // just in case of re-use...
205 
206  for (const auto& it: theLasBeamToLabelMap) {
207  theLabelToLasBeamMap[it.second] = it.first; //revert key/value
208  }
209 
210  // return combined size
211  return theIdToAlignableMap.size() + theLabelToLasBeamMap.size();
212 }
UintUintMap theLabelToLasBeamMap
labels for las beams
Definition: PedeLabeler.h:80
IdToAlignableMap theIdToAlignableMap
providing unique ID for alignable, space for param IDs
Definition: PedeLabeler.h:78
AlignableToIdMap theAlignableToIdMap
Definition: PedeLabeler.h:77
UintUintMap theLasBeamToLabelMap
reverse map
Definition: PedeLabeler.h:79
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 49 of file PedeLabeler.h.

49 { return false; }
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 137 of file PedeLabeler.cc.

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

Referenced by maxNumberOfParameterInstances().

138 {
139  const unsigned int aliLabel = this->alignableLabelFromLabel(label);
140  if (aliLabel < theMinLabel) return 0; // error already given
141 
142  UintUintMap::const_iterator position = theLabelToLasBeamMap.find(aliLabel);
143  if (position != theLabelToLasBeamMap.end()) {
144  return position->second;
145  } else {
146  edm::LogError("LogicError") << "@SUB=PedeLabeler::lasBeamIdFromLabel"
147  << "Alignable label " << aliLabel << " not in map.";
148  return 0;
149  }
150 }
static const unsigned int theMinLabel
UintUintMap theLabelToLasBeamMap
labels for las beams
Definition: PedeLabeler.h:80
unsigned int alignableLabelFromLabel(unsigned int label) const override
alignable label from parameter label (works also for alignable label...)
Definition: PedeLabeler.cc:111
static int position[264][3]
Definition: ReadPGInfo.cc:509
unsigned int PedeLabeler::lasBeamLabel ( unsigned int  lasBeamId) const
overridevirtual

Implements PedeLabelerBase.

Definition at line 75 of file PedeLabeler.cc.

References position, and theLasBeamToLabelMap.

76 {
77  UintUintMap::const_iterator position = theLasBeamToLabelMap.find(lasBeamId);
78  if (position != theLasBeamToLabelMap.end()) {
79  return position->second;
80  } else {
81  //throw cms::Exception("LogicError")
82  edm::LogError("LogicError") << "@SUB=PedeLabeler::lasBeamLabel"
83  << "No label for beam Id " << lasBeamId;
84  return 0;
85  }
86 }
UintUintMap theLasBeamToLabelMap
reverse map
Definition: PedeLabeler.h:79
static int position[264][3]
Definition: ReadPGInfo.cc:509
unsigned int PedeLabeler::maxNumberOfParameterInstances ( ) const
inlineoverridevirtual

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

Implements PedeLabelerBase.

Definition at line 52 of file PedeLabeler.h.

References alignableFromLabel(), alignableLabelFromLabel(), diffTwoXMLs::label, lasBeamIdFromLabel(), and paramNumFromLabel().

52 { return 1; }
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 50 of file PedeLabeler.h.

51  { return 1; }
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 89 of file PedeLabeler.cc.

References Exception, and PedeLabelerBase::theMaxNumParam.

Referenced by parameterLabel().

90 {
91  if (parNum >= theMaxNumParam) {
92  throw cms::Exception("Alignment") << "@SUB=PedeLabeler::parameterLabel"
93  << "Parameter number " << parNum
94  << " out of range 0 <= num < " << theMaxNumParam;
95  }
96  return aliLabel + parNum;
97 }
static const unsigned int theMaxNumParam
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 44 of file PedeLabeler.h.

References alignableLabel(), and parameterLabel().

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

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

Implements PedeLabelerBase.

Definition at line 100 of file PedeLabeler.cc.

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

Referenced by alignableLabelFromLabel(), and maxNumberOfParameterInstances().

101 {
102  if (paramLabel < theMinLabel) {
103  edm::LogError("LogicError") << "@SUB=PedeLabeler::paramNumFromLabel"
104  << "Label " << paramLabel << " should be >= " << theMinLabel;
105  return 0;
106  }
107  return (paramLabel - theMinLabel) % theMaxNumParam;
108 }
static const unsigned int theMinLabel
static const unsigned int theMaxNumParam

Member Data Documentation

AlignableToIdMap PedeLabeler::theAlignableToIdMap
private

Definition at line 77 of file PedeLabeler.h.

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

IdToAlignableMap PedeLabeler::theIdToAlignableMap
private

providing unique ID for alignable, space for param IDs

Definition at line 78 of file PedeLabeler.h.

Referenced by alignableFromLabel(), and buildReverseMap().

UintUintMap PedeLabeler::theLabelToLasBeamMap
private

labels for las beams

Definition at line 80 of file PedeLabeler.h.

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

UintUintMap PedeLabeler::theLasBeamToLabelMap
private

reverse map

Definition at line 79 of file PedeLabeler.h.

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