#include <PedeLabeler.h>
Public Member Functions | |
Alignable * | alignableFromLabel (unsigned int label) const |
unsigned int | alignableLabel (Alignable *alignable) const |
Return 32-bit unique label for alignable, 0 indicates failure. | |
unsigned int | alignableLabelFromLabel (unsigned int label) const |
alignable label from parameter label (works also for alignable label...) | |
unsigned int | alignableLabelFromParamAndInstance (Alignable *alignable, unsigned int param, unsigned int instance) const |
bool | hasSplitParameters (Alignable *alignable) const |
returns true if the alignable has parameters that are split into various bins | |
unsigned int | lasBeamIdFromLabel (unsigned int label) const |
unsigned int | lasBeamLabel (unsigned int lasBeamId) const |
unsigned int | numberOfParameterInstances (Alignable *alignable, int param=-1) const |
returns the number of instances for a given parameter | |
unsigned int | parameterLabel (Alignable *alignable, unsigned int parNum, const AlignmentAlgorithmBase::EventInfo &eventInfo, const TrajectoryStateOnSurface &tsos) const |
unsigned int | parameterLabel (unsigned int aliLabel, unsigned int parNum) const |
returns the label for a given alignable parameter number combination | |
unsigned int | paramNumFromLabel (unsigned int paramLabel) const |
parameter number, 0 <= .. < theMaxNumParam, belonging to unique parameter label | |
PedeLabeler (const PedeLabelerBase::TopLevelAlignables &alignables, const edm::ParameterSet &config) | |
constructor from three Alignables (null pointers allowed ) | |
~PedeLabeler () | |
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 | |
unsigned int | buildReverseMap () |
returns size of map | |
Private Attributes | |
AlignableToIdMap | theAlignableToIdMap |
IdToAlignableMap | theIdToAlignableMap |
providing unique ID for alignable, space for param IDs | |
UintUintMap | theLabelToLasBeamMap |
labels for las beams | |
UintUintMap | theLasBeamToLabelMap |
reverse map |
provides labels for AlignmentParameters for pede
(last update by
)
Definition at line 25 of file PedeLabeler.h.
typedef std::map<Alignable*, unsigned int> PedeLabeler::AlignableToIdMap [private] |
Definition at line 65 of file PedeLabeler.h.
typedef AlignableToIdMap::value_type PedeLabeler::AlignableToIdPair [private] |
Definition at line 66 of file PedeLabeler.h.
typedef std::map<unsigned int, Alignable*> PedeLabeler::IdToAlignableMap [private] |
Definition at line 67 of file PedeLabeler.h.
typedef std::map<unsigned int, unsigned int> PedeLabeler::UintUintMap [private] |
Definition at line 68 of file PedeLabeler.h.
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(), and AlignableExtras::components().
:PedeLabelerBase(alignables, config) { std::vector<Alignable*> alis; alis.push_back(alignables.aliTracker_); alis.push_back(alignables.aliMuon_); if (alignables.aliExtras_) { align::Alignables allExtras = alignables.aliExtras_->components(); for ( std::vector<Alignable*>::iterator it = allExtras.begin(); it != allExtras.end(); ++it ) { alis.push_back(*it); } } this->buildMap(alis); }
PedeLabeler::~PedeLabeler | ( | ) |
non-virtual destructor: do not inherit from this class
Definition at line 41 of file PedeLabeler.cc.
{ }
Alignable * PedeLabeler::alignableFromLabel | ( | unsigned int | label | ) | const [virtual] |
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.
{ const unsigned int aliLabel = this->alignableLabelFromLabel(label); if (aliLabel < theMinLabel) return 0; // error already given if (theIdToAlignableMap.empty()) const_cast<PedeLabeler*>(this)->buildReverseMap(); IdToAlignableMap::const_iterator position = theIdToAlignableMap.find(aliLabel); if (position != theIdToAlignableMap.end()) { return position->second; } else { // error only if not in lasBeamMap: UintUintMap::const_iterator position = theLabelToLasBeamMap.find(aliLabel); if (position == theLabelToLasBeamMap.end()) { edm::LogError("LogicError") << "@SUB=PedeLabeler::alignableFromLabel" << "Alignable label " << aliLabel << " not in map."; } return 0; } }
unsigned int PedeLabeler::alignableLabel | ( | Alignable * | alignable | ) | const [virtual] |
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().
{ if (!alignable) return 0; AlignableToIdMap::const_iterator position = theAlignableToIdMap.find(alignable); if (position != theAlignableToIdMap.end()) { return position->second; } else { const DetId detId(alignable->id()); //throw cms::Exception("LogicError") edm::LogError("LogicError") << "@SUB=PedeLabeler::alignableLabel" << "Alignable " << typeid(*alignable).name() << " not in map, det/subdet/alignableStructureType = " << detId.det() << "/" << detId.subdetId() << "/" << alignable->alignableObjectId(); return 0; } }
unsigned int PedeLabeler::alignableLabelFromLabel | ( | unsigned int | label | ) | const [virtual] |
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(), and lasBeamIdFromLabel().
{ return paramLabel - this->paramNumFromLabel(paramLabel); }
unsigned int PedeLabeler::alignableLabelFromParamAndInstance | ( | Alignable * | alignable, |
unsigned int | param, | ||
unsigned int | instance | ||
) | const [virtual] |
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().
{ return this->alignableLabel(alignable); }
unsigned int PedeLabeler::buildMap | ( | const std::vector< Alignable * > & | alis | ) | [private] |
returns size of map
Definition at line 155 of file PedeLabeler.cc.
References theAlignableToIdMap, theLasBeamToLabelMap, PedeLabelerBase::theMaxNumParam, and PedeLabelerBase::theMinLabel.
Referenced by PedeLabeler().
{ theAlignableToIdMap.clear(); // just in case of re-use... std::vector<Alignable*> allComps; for (std::vector<Alignable*>::const_iterator iAli = alis.begin(); iAli != alis.end(); ++iAli) { if (*iAli) { allComps.push_back(*iAli); (*iAli)->recursiveComponents(allComps); } } unsigned int id = theMinLabel; for (std::vector<Alignable*>::const_iterator iter = allComps.begin(); iter != allComps.end(); ++iter) { theAlignableToIdMap.insert(AlignableToIdPair(*iter, id)); id += theMaxNumParam; } // also care about las beams theLasBeamToLabelMap.clear(); // just in case of re-use... // FIXME: Temporarily hard code values stolen from // https://twiki.cern.ch/twiki/bin/view/CMS/TkLasTrackBasedInterface#Beam_identifier . unsigned int beamIds[] = { 0, 10, 20, 30, 40, 50, 60, 70, // TEC+ R4 1, 11, 21, 31, 41, 51, 61, 71, // TEC+ R6 100, 110, 120, 130, 140, 150, 160, 170, // TEC- R4 101, 111, 121, 131, 141, 151, 161, 171, // TEC- R6 200, 210, 220, 230, 240, 250, 260, 270};// AT const size_t nBeams = sizeof(beamIds)/sizeof(beamIds[0]); for (size_t iBeam = 0; iBeam < nBeams; ++iBeam) { //edm::LogInfo("Alignment") << "Las beam " << beamIds[iBeam] << " gets label " << id << "."; theLasBeamToLabelMap[beamIds[iBeam]] = id; id += theMaxNumParam; } // return combined size return theAlignableToIdMap.size() + theLasBeamToLabelMap.size(); }
unsigned int PedeLabeler::buildReverseMap | ( | ) | [private] |
returns size of map
Definition at line 197 of file PedeLabeler.cc.
References combine::key, theAlignableToIdMap, theIdToAlignableMap, theLabelToLasBeamMap, and theLasBeamToLabelMap.
{ // alignables theIdToAlignableMap.clear(); // just in case of re-use... for (AlignableToIdMap::iterator it = theAlignableToIdMap.begin(); it != theAlignableToIdMap.end(); ++it) { const unsigned int key = (*it).second; Alignable *ali = (*it).first; theIdToAlignableMap[key] = ali; } // las beams theLabelToLasBeamMap.clear(); // just in case of re-use... for (UintUintMap::const_iterator it = theLasBeamToLabelMap.begin(); it != theLasBeamToLabelMap.end(); ++it) { theLabelToLasBeamMap[it->second] = it->first; //revert key/value } // return combined size return theIdToAlignableMap.size() + theLabelToLasBeamMap.size(); }
bool PedeLabeler::hasSplitParameters | ( | Alignable * | alignable | ) | const [inline, virtual] |
returns true if the alignable has parameters that are split into various bins
Implements PedeLabelerBase.
Definition at line 49 of file PedeLabeler.h.
{ return false; }
unsigned int PedeLabeler::lasBeamIdFromLabel | ( | unsigned int | label | ) | const [virtual] |
las beam id from las beam or parameter label zero and error if not a valid las beam label
Implements PedeLabelerBase.
Definition at line 138 of file PedeLabeler.cc.
References alignableLabelFromLabel(), position, theLabelToLasBeamMap, and PedeLabelerBase::theMinLabel.
{ const unsigned int aliLabel = this->alignableLabelFromLabel(label); if (aliLabel < theMinLabel) return 0; // error already given if (theLabelToLasBeamMap.empty()) const_cast<PedeLabeler*>(this)->buildReverseMap(); UintUintMap::const_iterator position = theLabelToLasBeamMap.find(aliLabel); if (position != theLabelToLasBeamMap.end()) { return position->second; } else { edm::LogError("LogicError") << "@SUB=PedeLabeler::lasBeamIdFromLabel" << "Alignable label " << aliLabel << " not in map."; return 0; } }
unsigned int PedeLabeler::lasBeamLabel | ( | unsigned int | lasBeamId | ) | const [virtual] |
Implements PedeLabelerBase.
Definition at line 75 of file PedeLabeler.cc.
References position, and theLasBeamToLabelMap.
{ UintUintMap::const_iterator position = theLasBeamToLabelMap.find(lasBeamId); if (position != theLasBeamToLabelMap.end()) { return position->second; } else { //throw cms::Exception("LogicError") edm::LogError("LogicError") << "@SUB=PedeLabeler::lasBeamLabel" << "No label for beam Id " << lasBeamId; return 0; } }
unsigned int PedeLabeler::numberOfParameterInstances | ( | Alignable * | alignable, |
int | param = -1 |
||
) | const [inline, virtual] |
returns the number of instances for a given parameter
Implements PedeLabelerBase.
Definition at line 50 of file PedeLabeler.h.
{ return 1; }
unsigned int PedeLabeler::parameterLabel | ( | unsigned int | aliLabel, |
unsigned int | parNum | ||
) | const [virtual] |
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().
{ if (parNum >= theMaxNumParam) { throw cms::Exception("Alignment") << "@SUB=PedeLabeler::parameterLabel" << "Parameter number " << parNum << " out of range 0 <= num < " << theMaxNumParam; } return aliLabel + parNum; }
unsigned int PedeLabeler::parameterLabel | ( | Alignable * | alignable, |
unsigned int | parNum, | ||
const AlignmentAlgorithmBase::EventInfo & | eventInfo, | ||
const TrajectoryStateOnSurface & | tsos | ||
) | const [inline, virtual] |
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().
{ return parameterLabel(alignableLabel(alignable), parNum); }
unsigned int PedeLabeler::paramNumFromLabel | ( | unsigned int | paramLabel | ) | const [virtual] |
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().
{ if (paramLabel < theMinLabel) { edm::LogError("LogicError") << "@SUB=PedeLabeler::paramNumFromLabel" << "Label " << paramLabel << " should be >= " << theMinLabel; return 0; } return (paramLabel - theMinLabel) % theMaxNumParam; }
Definition at line 76 of file PedeLabeler.h.
Referenced by alignableLabel(), buildMap(), and buildReverseMap().
providing unique ID for alignable, space for param IDs
Definition at line 77 of file PedeLabeler.h.
Referenced by alignableFromLabel(), and buildReverseMap().
UintUintMap PedeLabeler::theLabelToLasBeamMap [private] |
labels for las beams
Definition at line 79 of file PedeLabeler.h.
Referenced by alignableFromLabel(), buildReverseMap(), and lasBeamIdFromLabel().
UintUintMap PedeLabeler::theLasBeamToLabelMap [private] |
reverse map
Definition at line 78 of file PedeLabeler.h.
Referenced by buildMap(), buildReverseMap(), and lasBeamLabel().