CMS 3D CMS Logo

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

#include <RunRangeDependentPedeLabeler.h>

Inheritance diagram for RunRangeDependentPedeLabeler:
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...
 
 RunRangeDependentPedeLabeler (const PedeLabelerBase::TopLevelAlignables &alignables, const edm::ParameterSet &config)
 constructor from three Alignables (null pointers allowed ) More...
 
const RunRangerunRangeFromLabel (unsigned int label) const override
 
 ~RunRangeDependentPedeLabeler () override
 
- 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 ~PedeLabelerBase ()
 

Private Types

typedef std::map< Alignable *, unsigned int > AlignableToIdMap
 
typedef AlignableToIdMap::value_type AlignableToIdPair
 
typedef std::map< Alignable *, RunRangeParamMapAlignableToRunRangeRangeMap
 
typedef AlignableToRunRangeRangeMap::value_type AlignableToRunRangeRangePair
 
typedef std::map< unsigned int, Alignable * > IdToAlignableMap
 
typedef std::map< unsigned int, RunRangeVectorRunRangeParamMap
 
typedef std::vector< RunRangeRunRangeVector
 
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...
 
unsigned int buildRunRangeDependencyMap (AlignableTracker *aliTracker, AlignableMuon *aliMuon, AlignableExtras *extras, const edm::ParameterSet &config)
 
std::vector< unsigned int > convertParamSel (const std::string &selString) const
 
std::vector< std::string > decompose (const std::string &s, std::string::value_type delimiter) const
 
unsigned int runRangeIndexFromLabel (unsigned int label) const
 

Private Attributes

AlignableToIdMap theAlignableToIdMap
 
AlignableToRunRangeRangeMap theAlignableToRunRangeRangeMap
 providing unique ID for alignable, space for param IDs More...
 
IdToAlignableMap theIdToAlignableMap
 providing unique ID for alignable, space for param IDs More...
 
UintUintMap theLabelToLasBeamMap
 labels for las beams More...
 
UintUintMap theLasBeamToLabelMap
 reverse map More...
 
unsigned int theMaxNumberOfParameterInstances
 reverse of the above 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 13:12:41
Revision
1.1

(last update by

Author
mussgill

)

Definition at line 32 of file RunRangeDependentPedeLabeler.h.

Member Typedef Documentation

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

Definition at line 81 of file RunRangeDependentPedeLabeler.h.

typedef AlignableToIdMap::value_type RunRangeDependentPedeLabeler::AlignableToIdPair
private

Definition at line 82 of file RunRangeDependentPedeLabeler.h.

Definition at line 85 of file RunRangeDependentPedeLabeler.h.

typedef AlignableToRunRangeRangeMap::value_type RunRangeDependentPedeLabeler::AlignableToRunRangeRangePair
private

Definition at line 86 of file RunRangeDependentPedeLabeler.h.

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

Definition at line 87 of file RunRangeDependentPedeLabeler.h.

typedef std::map<unsigned int, RunRangeVector> RunRangeDependentPedeLabeler::RunRangeParamMap
private

Definition at line 84 of file RunRangeDependentPedeLabeler.h.

Definition at line 83 of file RunRangeDependentPedeLabeler.h.

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

Definition at line 88 of file RunRangeDependentPedeLabeler.h.

Constructor & Destructor Documentation

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

constructor from three Alignables (null pointers allowed )

Definition at line 28 of file RunRangeDependentPedeLabeler.cc.

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

30  : PedeLabelerBase(alignables, config),
32 {
33  align::Alignables alis;
34  alis.push_back(alignables.aliTracker_);
35  alis.push_back(alignables.aliMuon_);
36 
37  if (alignables.aliExtras_) {
38  for (const auto& ali: alignables.aliExtras_->components()) {
39  alis.push_back(ali);
40  }
41  }
42 
43  this->buildRunRangeDependencyMap(alignables.aliTracker_,
44  alignables.aliMuon_,
45  alignables.aliExtras_,
46  config);
47  this->buildMap(alis);
48  this->buildReverseMap(); // needed already now to 'fill' theMaxNumberOfParameterInstances
49 }
unsigned int theMaxNumberOfParameterInstances
reverse of the above
PedeLabelerBase(const TopLevelAlignables &alignables, const edm::ParameterSet &config)
constructor from three Alignables (null pointers allowed )
unsigned int buildReverseMap()
returns size of map
const Alignables & components() const
std::vector< Alignable * > Alignables
Definition: Utilities.h:32
unsigned int buildRunRangeDependencyMap(AlignableTracker *aliTracker, AlignableMuon *aliMuon, AlignableExtras *extras, const edm::ParameterSet &config)
unsigned int buildMap(const align::Alignables &)
returns size of map
RunRangeDependentPedeLabeler::~RunRangeDependentPedeLabeler ( )
override

non-virtual destructor: do not inherit from this class

Definition at line 53 of file RunRangeDependentPedeLabeler.cc.

54 {
55 }

Member Function Documentation

Alignable * RunRangeDependentPedeLabeler::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 245 of file RunRangeDependentPedeLabeler.cc.

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

Referenced by runRangeFromLabel(), and runRangeIndexFromLabel().

246 {
247  const unsigned int aliLabel = this->alignableLabelFromLabel(label);
248  if (aliLabel < theMinLabel) return nullptr; // error already given
249 
250  IdToAlignableMap::const_iterator position = theIdToAlignableMap.find(aliLabel);
251  if (position != theIdToAlignableMap.end()) {
252  return position->second;
253  } else {
254  // error only if not in lasBeamMap:
255  UintUintMap::const_iterator position = theLabelToLasBeamMap.find(aliLabel);
256  if (position == theLabelToLasBeamMap.end()) {
257  edm::LogError("LogicError") << "@SUB=RunRangeDependentPedeLabeler::alignableFromLabel"
258  << "Alignable label " << aliLabel << " not in map.";
259  }
260  return nullptr;
261  }
262 }
UintUintMap theLabelToLasBeamMap
labels for las beams
unsigned int alignableLabelFromLabel(unsigned int label) const override
alignable label from parameter label (works also for alignable label...)
static const unsigned int theMinLabel
char const * label
IdToAlignableMap theIdToAlignableMap
providing unique ID for alignable, space for param IDs
static int position[264][3]
Definition: ReadPGInfo.cc:509
unsigned int RunRangeDependentPedeLabeler::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 59 of file RunRangeDependentPedeLabeler.cc.

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

Referenced by runRangeFromLabel(), and runRangeIndexFromLabel().

60 {
61  if (!alignable) return 0;
62 
63  AlignableToIdMap::const_iterator position = theAlignableToIdMap.find(alignable);
64  if (position != theAlignableToIdMap.end()) {
65  return position->second;
66  } else {
67  const DetId detId(alignable->id());
68  //throw cms::Exception("LogicError")
69  edm::LogError("LogicError")
70  << "@SUB=RunRangeDependentPedeLabeler::alignableLabel" << "Alignable "
71  << typeid(*alignable).name() << " not in map, det/subdet/alignableStructureType = "
72  << detId.det() << "/" << detId.subdetId() << "/" << alignable->alignableObjectId();
73  return 0;
74  }
75 }
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.
Definition: DetId.h:18
static int position[264][3]
Definition: ReadPGInfo.cc:509
unsigned int RunRangeDependentPedeLabeler::alignableLabelFromLabel ( unsigned int  label) const
overridevirtual

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

Implements PedeLabelerBase.

Definition at line 239 of file RunRangeDependentPedeLabeler.cc.

References paramNumFromLabel().

Referenced by alignableFromLabel(), and lasBeamIdFromLabel().

240 {
241  return paramLabel - this->paramNumFromLabel(paramLabel);
242 }
unsigned int paramNumFromLabel(unsigned int paramLabel) const override
parameter number, 0 <= .. < theMaxNumParam, belonging to unique parameter label
unsigned int RunRangeDependentPedeLabeler::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 79 of file RunRangeDependentPedeLabeler.cc.

References Alignable::alignableObjectId(), Exception, Alignable::id(), position, theAlignableToIdMap, theAlignableToRunRangeRangeMap, and PedeLabelerBase::theParamInstanceOffset.

82 {
83  if (!alignable) return 0;
84 
85  AlignableToIdMap::const_iterator position = theAlignableToIdMap.find(alignable);
86  if (position != theAlignableToIdMap.end()) {
87  AlignableToRunRangeRangeMap::const_iterator positionAli = theAlignableToRunRangeRangeMap.find(alignable);
88  if (positionAli != theAlignableToRunRangeRangeMap.end()) {
89  RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(param);
90  if (positionParam!=(*positionAli).second.end()) {
91  if (instance>=(*positionParam).second.size()) {
92  throw cms::Exception("Alignment") << "RunRangeDependentPedeLabeler::alignableLabelFromParamAndRunRange: "
93  << "RunRangeIdx out of bounds.\n";
94  }
95  return position->second + instance * theParamInstanceOffset;
96  } else {
97  return position->second;
98  }
99  } else {
100  return position->second;
101  }
102  } else {
103  const DetId detId(alignable->id());
104  //throw cms::Exception("LogicError")
105  edm::LogError("LogicError")
106  << "@SUB=RunRangeDependentPedeLabeler::alignableLabel" << "Alignable "
107  << typeid(*alignable).name() << " not in map, det/subdet/alignableStructureType = "
108  << detId.det() << "/" << detId.subdetId() << "/" << alignable->alignableObjectId();
109  return 0;
110  }
111 }
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:189
static PFTauRenderPlugin instance
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
AlignableToRunRangeRangeMap theAlignableToRunRangeRangeMap
providing unique ID for alignable, space for param IDs
Definition: DetId.h:18
static const unsigned int theParamInstanceOffset
static int position[264][3]
Definition: ReadPGInfo.cc:509
unsigned int RunRangeDependentPedeLabeler::buildMap ( const align::Alignables alis)
private

returns size of map

Definition at line 456 of file RunRangeDependentPedeLabeler.cc.

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

Referenced by RunRangeDependentPedeLabeler().

457 {
458  theAlignableToIdMap.clear(); // just in case of re-use...
459 
460  align::Alignables allComps;
461 
462  for (const auto& iAli: alis) {
463  if (iAli) {
464  allComps.push_back(iAli);
465  iAli->recursiveComponents(allComps);
466  }
467  }
468 
469  unsigned int id = theMinLabel;
470  for (const auto& iter: allComps) {
471  theAlignableToIdMap.insert(AlignableToIdPair(iter, id));
472  id += theMaxNumParam;
473  }
474 
475  // also care about las beams
476  theLasBeamToLabelMap.clear(); // just in case of re-use...
477  // FIXME: Temporarily hard code values stolen from
478  // https://twiki.cern.ch/twiki/bin/view/CMS/TkLasTrackBasedInterface#Beam_identifier .
479  unsigned int beamIds[] = { 0, 10, 20, 30, 40, 50, 60, 70, // TEC+ R4
480  1, 11, 21, 31, 41, 51, 61, 71, // TEC+ R6
481  100, 110, 120, 130, 140, 150, 160, 170, // TEC- R4
482  101, 111, 121, 131, 141, 151, 161, 171, // TEC- R6
483  200, 210, 220, 230, 240, 250, 260, 270};// AT
484 
485  const size_t nBeams = sizeof(beamIds)/sizeof(beamIds[0]);
486  for (size_t iBeam = 0; iBeam < nBeams; ++iBeam) {
487  //edm::LogInfo("Alignment") << "Las beam " << beamIds[iBeam] << " gets label " << id << ".";
488  theLasBeamToLabelMap[beamIds[iBeam]] = id;
489  id += theMaxNumParam;
490  }
491 
492  if (id > theParamInstanceOffset) { // 'overflow' per instance
493  throw cms::Exception("Alignment") << "@SUB=RunRangeDependentPedeLabeler::buildMap: "
494  << "Too many labels per instance (" << id-1 << ") leading to double use, "
495  << "increase PedeLabelerBase::theParamInstanceOffset!\n";
496  }
497  // return combined size
498  return theAlignableToIdMap.size() + theLasBeamToLabelMap.size();
499 }
AlignableToIdMap::value_type AlignableToIdPair
static const unsigned int theMinLabel
static const unsigned int theMaxNumParam
UintUintMap theLasBeamToLabelMap
reverse map
static const unsigned int theParamInstanceOffset
std::vector< Alignable * > Alignables
Definition: Utilities.h:32
unsigned int RunRangeDependentPedeLabeler::buildReverseMap ( )
private

returns size of map

Definition at line 502 of file RunRangeDependentPedeLabeler.cc.

References DEFINE_EDM_PLUGIN, crabWrapper::key, SiStripPI::max, numberOfParameterInstances(), theAlignableToIdMap, theIdToAlignableMap, theLabelToLasBeamMap, theLasBeamToLabelMap, theMaxNumberOfParameterInstances, and PedeLabelerBase::theParamInstanceOffset.

Referenced by RunRangeDependentPedeLabeler().

503 {
504 
505  // alignables
506  theIdToAlignableMap.clear(); // just in case of re-use...
507 
508  for (const auto& it: theAlignableToIdMap) {
509  const unsigned int key = it.second;
510  Alignable *ali = it.first;
511  const unsigned int nInstances = this->numberOfParameterInstances(ali, -1);
513  for (unsigned int iInstance=0;iInstance<nInstances;++iInstance) {
514  theIdToAlignableMap[key+iInstance*theParamInstanceOffset] = ali;
515  }
516  }
517 
518  // las beams
519  theLabelToLasBeamMap.clear(); // just in case of re-use...
520 
521  for (const auto& it: theLasBeamToLabelMap) {
522  theLabelToLasBeamMap[it.second] = it.first; //revert key/value
523  }
524 
525  // return combined size
526  return theIdToAlignableMap.size() + theLabelToLasBeamMap.size();
527 }
UintUintMap theLabelToLasBeamMap
labels for las beams
unsigned int theMaxNumberOfParameterInstances
reverse of the above
IdToAlignableMap theIdToAlignableMap
providing unique ID for alignable, space for param IDs
UintUintMap theLasBeamToLabelMap
reverse map
static const unsigned int theParamInstanceOffset
unsigned int numberOfParameterInstances(Alignable *alignable, int param=-1) const override
returns the number of instances for a given parameter
unsigned int RunRangeDependentPedeLabeler::buildRunRangeDependencyMap ( AlignableTracker aliTracker,
AlignableMuon aliMuon,
AlignableExtras extras,
const edm::ParameterSet config 
)
private

Definition at line 338 of file RunRangeDependentPedeLabeler.cc.

References AlignmentParameterSelector::addSelection(), cond::TimeTypeSpecs::beginValue, AlignmentParameterSelector::clear(), convertParamSel(), decompose(), Exception, plotBeamSpotDB::first, edm::ParameterSet::getUntrackedParameter(), mps_fire::i, AlignableObjectId::idToString(), PedeLabelerBase::objectIdProvider(), cond::runnumber, edm::second(), AlignmentParameterSelector::selectedAlignables(), AlignmentParameters::size(), groupFilesInBlocks::temp, theAlignableToRunRangeRangeMap, cond::timeTypeSpecs, and edm::tokenize().

Referenced by RunRangeDependentPedeLabeler().

342 {
343  static std::atomic<bool> oldRunRangeSelectionWarning{ false };
344 
346 
347  AlignmentParameterSelector selector(aliTracker, aliMuon, aliExtras);
348 
349  std::vector<char> paramSelDummy(6, '1');
350 
351  const std::vector<edm::ParameterSet> RunRangeSelectionVPSet =
352  config.getUntrackedParameter<std::vector<edm::ParameterSet> >("RunRangeSelection");
353 
354  for (const auto& runRangeSel: RunRangeSelectionVPSet) {
355 
356  const auto tempRunRanges = runRangeSel.getParameter<std::vector<std::string> >("RunRanges");
357  if (tempRunRanges.empty()) {
358  throw cms::Exception("BadConfig") << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
359  << "RunRanges empty\n";
360  }
361 
364  long int temp;
365  for (const auto& iRunRange: tempRunRanges) {
366  if (iRunRange.find(':') == std::string::npos) {
367 
369  temp = strtol(iRunRange.c_str(), nullptr, 0);
370  if (temp!=-1) first = temp;
371 
372  } else {
373 
374  bool expected = false;
375  if (oldRunRangeSelectionWarning.compare_exchange_strong(expected,true)) {
376  edm::LogWarning("BadConfig") << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap"
377  << "Config file contains old format for 'RunRangeSelection'. Only the start run\n"
378  << "number is used internally. The number of the last run is ignored and can be\n"
379  << "safely removed from the config file.\n";
380  }
381 
382  std::vector<std::string> tokens = edm::tokenize(iRunRange, ":");
384  temp = strtol(tokens[0].c_str(), nullptr, 0);
385  if (temp!=-1) first = temp;
386 
387  }
388 
389  RunRanges.push_back(std::pair<cond::Time_t,cond::Time_t>(first, cond::timeTypeSpecs[cond::runnumber].endValue));
390  }
391 
392  for (unsigned int i = 0;i<RunRanges.size()-1;++i) {
393  RunRanges[i].second = RunRanges[i+1].first - 1;
394  if (RunRanges[i].first > RunRanges[i].second) {
395  throw cms::Exception("BadConfig") << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
396  << "Inconsistency in 'RunRangeSelection' parameter set.";
397  }
398  }
399 
400  const auto selStrings = runRangeSel.getParameter<std::vector<std::string> >("selector");
401  for (const auto& iSel: selStrings) {
402  std::vector<std::string> decompSel(this->decompose(iSel, ','));
403 
404  if (decompSel.size()!=2) {
405  throw cms::Exception("BadConfig") << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
406  << iSel <<" should have at least 2 ','-separated parts\n";
407  }
408 
409  std::vector<unsigned int> selParam = this->convertParamSel(decompSel[1]);
410  selector.clear();
411  selector.addSelection(decompSel[0], paramSelDummy);
412 
413  const auto& alis = selector.selectedAlignables();
414 
415  for (const auto& iAli: alis) {
416 
417  if(iAli->alignmentParameters() == nullptr) {
418  throw cms::Exception("BadConfig")
419  << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
420  << "Run dependence configured for alignable of type "
421  << objectIdProvider().idToString(iAli->alignableObjectId())
422  << " at (" << iAli->globalPosition().x() << ","
423  << iAli->globalPosition().y() << ","
424  << iAli->globalPosition().z()<< "), "
425  << "but that has no parameters. Please check that all run "
426  << "dependent parameters are also selected for alignment.\n";
427  }
428 
429  for (const auto& iParam: selParam) {
430  AlignableToRunRangeRangeMap::const_iterator positionAli = theAlignableToRunRangeRangeMap.find(iAli);
431  if (positionAli!=theAlignableToRunRangeRangeMap.end()) {
432 
433  AlignmentParameters *AliParams = (*positionAli).first->alignmentParameters();
434  if (static_cast<int>(selParam[selParam.size()-1]) >= AliParams->size()) {
435  throw cms::Exception("BadConfig") << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
436  << "mismatch in number of parameters\n";
437  }
438 
439  RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(iParam);
440  if (positionParam!=(*positionAli).second.end()) {
441  throw cms::Exception("BadConfig") << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
442  << "RunRange range for parameter specified twice\n";
443  }
444  }
445 
447  }
448  }
449  }
450  }
451 
452  return theAlignableToRunRangeRangeMap.size();
453 }
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:22
T getUntrackedParameter(std::string const &, T const &) const
Time_t beginValue
Definition: Time.h:45
U second(std::pair< T, U > const &p)
unsigned long long Time_t
Definition: Time.h:16
AlignableToRunRangeRangeMap theAlignableToRunRangeRangeMap
providing unique ID for alignable, space for param IDs
int size(void) const
Get number of parameters.
const char * idToString(align::StructureType type) const
std::vector< unsigned int > convertParamSel(const std::string &selString) const
align::RunRanges RunRanges
const AlignableObjectId & objectIdProvider() const
Return tracker alignable object ID provider derived from the tracker&#39;s geometry.
std::vector< std::string > decompose(const std::string &s, std::string::value_type delimiter) const
std::vector< std::string > tokenize(std::string const &input, std::string const &separator)
breaks the input string into tokens, delimited by the separator
std::vector< unsigned int > RunRangeDependentPedeLabeler::convertParamSel ( const std::string &  selString) const
private

Definition at line 329 of file RunRangeDependentPedeLabeler.cc.

References mps_fire::result.

Referenced by buildRunRangeDependencyMap().

330 {
331  std::vector<unsigned int> result;
332  for (std::string::size_type pos = 0; pos < selString.size(); ++pos) {
333  if (selString[pos]=='1') result.push_back(pos);
334  }
335  return result;
336 }
uint16_t size_type
std::vector< std::string > RunRangeDependentPedeLabeler::decompose ( const std::string &  s,
std::string::value_type  delimiter 
) const
private

Definition at line 309 of file RunRangeDependentPedeLabeler.cc.

References mps_fire::result.

Referenced by buildRunRangeDependencyMap().

311 {
312  std::vector<std::string> result;
313 
314  std::string::size_type previousPos = 0;
315  while (true) {
316  const std::string::size_type delimiterPos = s.find(delimiter, previousPos);
317  if (delimiterPos == std::string::npos) {
318  result.push_back(s.substr(previousPos)); // until end
319  break;
320  }
321  result.push_back(s.substr(previousPos, delimiterPos - previousPos));
322  previousPos = delimiterPos + 1; // +1: skip delimiter
323  }
324 
325  return result;
326 }
uint16_t size_type
bool RunRangeDependentPedeLabeler::hasSplitParameters ( Alignable alignable) const
overridevirtual

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

Implements PedeLabelerBase.

Definition at line 195 of file RunRangeDependentPedeLabeler.cc.

References theAlignableToRunRangeRangeMap.

196 {
197  AlignableToRunRangeRangeMap::const_iterator positionAli = theAlignableToRunRangeRangeMap.find(alignable);
198  if (positionAli != theAlignableToRunRangeRangeMap.end()) return true;
199  return false;
200 }
AlignableToRunRangeRangeMap theAlignableToRunRangeRangeMap
providing unique ID for alignable, space for param IDs
unsigned int RunRangeDependentPedeLabeler::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 265 of file RunRangeDependentPedeLabeler.cc.

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

266 {
267  const unsigned int aliLabel = this->alignableLabelFromLabel(label);
268  if (aliLabel < theMinLabel) return 0; // error already given
269 
270  UintUintMap::const_iterator position = theLabelToLasBeamMap.find(aliLabel);
271  if (position != theLabelToLasBeamMap.end()) {
272  return position->second;
273  } else {
274  edm::LogError("LogicError") << "@SUB=RunRangeDependentPedeLabeler::lasBeamIdFromLabel"
275  << "Alignable label " << aliLabel << " not in map.";
276  return 0;
277  }
278 }
UintUintMap theLabelToLasBeamMap
labels for las beams
unsigned int alignableLabelFromLabel(unsigned int label) const override
alignable label from parameter label (works also for alignable label...)
static const unsigned int theMinLabel
char const * label
static int position[264][3]
Definition: ReadPGInfo.cc:509
unsigned int RunRangeDependentPedeLabeler::lasBeamLabel ( unsigned int  lasBeamId) const
overridevirtual

Implements PedeLabelerBase.

Definition at line 114 of file RunRangeDependentPedeLabeler.cc.

References position, and theLasBeamToLabelMap.

115 {
116  UintUintMap::const_iterator position = theLasBeamToLabelMap.find(lasBeamId);
117  if (position != theLasBeamToLabelMap.end()) {
118  return position->second;
119  } else {
120  //throw cms::Exception("LogicError")
121  edm::LogError("LogicError") << "@SUB=RunRangeDependentPedeLabeler::lasBeamLabel"
122  << "No label for beam Id " << lasBeamId;
123  return 0;
124  }
125 }
UintUintMap theLasBeamToLabelMap
reverse map
static int position[264][3]
Definition: ReadPGInfo.cc:509
unsigned int RunRangeDependentPedeLabeler::maxNumberOfParameterInstances ( ) const
inlineoverridevirtual

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

Implements PedeLabelerBase.

Definition at line 65 of file RunRangeDependentPedeLabeler.h.

References label.

unsigned int theMaxNumberOfParameterInstances
reverse of the above
unsigned int RunRangeDependentPedeLabeler::numberOfParameterInstances ( Alignable alignable,
int  param = -1 
) const
overridevirtual

returns the number of instances for a given parameter

Implements PedeLabelerBase.

Definition at line 203 of file RunRangeDependentPedeLabeler.cc.

References SiStripPI::max, and theAlignableToRunRangeRangeMap.

Referenced by buildReverseMap().

204 {
205  AlignableToRunRangeRangeMap::const_iterator positionAli = theAlignableToRunRangeRangeMap.find(alignable);
206  if (positionAli != theAlignableToRunRangeRangeMap.end()) {
207 
208  size_t nRunRanges = 1;
209  if (param==-1) {
210  for (const auto iParam: (*positionAli).second) {
211  nRunRanges = std::max(nRunRanges, iParam.second.size());
212  }
213  return nRunRanges;
214  } else {
215  RunRangeParamMap::const_iterator iParam = (*positionAli).second.find(param);
216  if (iParam != (*positionAli).second.end()) {
217  return iParam->second.size();
218  } else {
219  return 1;
220  }
221  }
222  }
223 
224  return 1;
225 }
AlignableToRunRangeRangeMap theAlignableToRunRangeRangeMap
providing unique ID for alignable, space for param IDs
unsigned int RunRangeDependentPedeLabeler::parameterLabel ( unsigned int  aliLabel,
unsigned int  parNum 
) const
overridevirtual

returns the label for a given alignable parameter number combination

Implements PedeLabelerBase.

Definition at line 128 of file RunRangeDependentPedeLabeler.cc.

References Exception, and PedeLabelerBase::theMaxNumParam.

129 {
130  if (parNum >= theMaxNumParam) {
131  throw cms::Exception("Alignment") << "@SUB=RunRangeDependentPedeLabeler::parameterLabel"
132  << "Parameter number " << parNum
133  << " out of range 0 <= num < " << theMaxNumParam;
134  }
135  return aliLabel + parNum;
136 }
static const unsigned int theMaxNumParam
unsigned int RunRangeDependentPedeLabeler::parameterLabel ( Alignable alignable,
unsigned int  parNum,
const AlignmentAlgorithmBase::EventInfo eventInfo,
const TrajectoryStateOnSurface tsos 
) const
overridevirtual

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

Implements PedeLabelerBase.

Definition at line 139 of file RunRangeDependentPedeLabeler.cc.

References Alignable::alignableObjectId(), AlignmentAlgorithmBase::EventInfo::eventId(), Exception, Alignable::id(), PFRecoTauDiscriminationByIsolation_cfi::offset, position, edm::EventID::run(), theAlignableToIdMap, theAlignableToRunRangeRangeMap, PedeLabelerBase::theMaxNumParam, and PedeLabelerBase::theParamInstanceOffset.

142 {
143  if (!alignable) return 0;
144 
145  if (parNum >= theMaxNumParam) {
146  throw cms::Exception("Alignment") << "@SUB=RunRangeDependentPedeLabeler::parameterLabel"
147  << "Parameter number " << parNum
148  << " out of range 0 <= num < " << theMaxNumParam;
149  }
150 
151  AlignableToIdMap::const_iterator position = theAlignableToIdMap.find(alignable);
152  if (position != theAlignableToIdMap.end()) {
153 
154  AlignableToRunRangeRangeMap::const_iterator positionAli = theAlignableToRunRangeRangeMap.find(alignable);
155  if (positionAli != theAlignableToRunRangeRangeMap.end()) {
156 
157  RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(parNum);
158  if (positionParam!=(*positionAli).second.end()) {
159 
160  int offset = 0;
161  const RunRangeVector & runRanges = (*positionParam).second;
162  for (const auto& iRunRange: runRanges) {
163  if (eventInfo.eventId().run() >= iRunRange.first &&
164  eventInfo.eventId().run() <= iRunRange.second) {
165  return position->second + offset * theParamInstanceOffset + parNum;
166  }
167  offset++;
168  }
169  const DetId detId(alignable->id());
170  edm::LogError("LogicError")
171  << "@SUB=RunRangeDependentPedeLabeler::parameterLabel" << "Instance for Alignable "
172  << typeid(*alignable).name() << " not in map, det/subdet/alignableStructureType = "
173  << detId.det() << "/" << detId.subdetId() << "/" << alignable->alignableObjectId()
174  << " for run " << eventInfo.eventId().run();
175  return 0;
176  } else {
177  return position->second + parNum;
178  }
179 
180  } else {
181  return position->second + parNum;
182  }
183  } else {
184  const DetId detId(alignable->id());
185  //throw cms::Exception("LogicError")
186  edm::LogError("LogicError")
187  << "@SUB=RunRangeDependentPedeLabeler::parameterLabel" << "Alignable "
188  << typeid(*alignable).name() << " not in map, det/subdet/alignableStructureType = "
189  << detId.det() << "/" << detId.subdetId() << "/" << alignable->alignableObjectId();
190  return 0;
191  }
192 }
RunNumber_t run() const
Definition: EventID.h:39
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:189
const edm::EventID eventId() const
static const unsigned int theMaxNumParam
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
AlignableToRunRangeRangeMap theAlignableToRunRangeRangeMap
providing unique ID for alignable, space for param IDs
Definition: DetId.h:18
static const unsigned int theParamInstanceOffset
static int position[264][3]
Definition: ReadPGInfo.cc:509
unsigned int RunRangeDependentPedeLabeler::paramNumFromLabel ( unsigned int  paramLabel) const
overridevirtual

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

Implements PedeLabelerBase.

Definition at line 228 of file RunRangeDependentPedeLabeler.cc.

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

Referenced by alignableLabelFromLabel(), and runRangeFromLabel().

229 {
230  if (paramLabel < theMinLabel) {
231  edm::LogError("LogicError") << "@SUB=RunRangeDependentPedeLabeler::paramNumFromLabel"
232  << "Label " << paramLabel << " should be >= " << theMinLabel;
233  return 0;
234  }
235  return (paramLabel - theMinLabel) % theMaxNumParam;
236 }
static const unsigned int theMinLabel
static const unsigned int theMaxNumParam
const RunRangeDependentPedeLabeler::RunRange & RunRangeDependentPedeLabeler::runRangeFromLabel ( unsigned int  label) const
overridevirtual

Reimplemented from PedeLabelerBase.

Definition at line 288 of file RunRangeDependentPedeLabeler.cc.

References alignableFromLabel(), alignableLabel(), paramNumFromLabel(), theAlignableToRunRangeRangeMap, PedeLabelerBase::theOpenRunRange, and PedeLabelerBase::theParamInstanceOffset.

289 {
291 
292  AlignableToRunRangeRangeMap::const_iterator positionAli = theAlignableToRunRangeRangeMap.find(ali);
293  if (positionAli==theAlignableToRunRangeRangeMap.end())
294  return theOpenRunRange;
295 
296  unsigned int firstLabel = alignableLabel(ali);
297  unsigned int runRangeIndex = (label-firstLabel)/theParamInstanceOffset;
298  unsigned int paramNum = this->paramNumFromLabel(label);
299 
300  RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(paramNum);
301  if (positionParam==(*positionAli).second.end()) {
302  return theOpenRunRange;
303  }
304 
305  return positionParam->second[runRangeIndex];
306 }
unsigned int paramNumFromLabel(unsigned int paramLabel) const override
parameter number, 0 <= .. < theMaxNumParam, belonging to unique parameter label
unsigned int alignableLabel(Alignable *alignable) const override
Return 32-bit unique label for alignable, 0 indicates failure.
const RunRange theOpenRunRange
char const * label
AlignableToRunRangeRangeMap theAlignableToRunRangeRangeMap
providing unique ID for alignable, space for param IDs
static const unsigned int theParamInstanceOffset
Alignable * alignableFromLabel(unsigned int label) const override
unsigned int RunRangeDependentPedeLabeler::runRangeIndexFromLabel ( unsigned int  label) const
private

Definition at line 280 of file RunRangeDependentPedeLabeler.cc.

References alignableFromLabel(), alignableLabel(), and PedeLabelerBase::theMaxNumParam.

281 {
283  unsigned int firstLabel = alignableLabel(ali);
284  return (label-firstLabel)/theMaxNumParam;
285 }
unsigned int alignableLabel(Alignable *alignable) const override
Return 32-bit unique label for alignable, 0 indicates failure.
static const unsigned int theMaxNumParam
char const * label
Alignable * alignableFromLabel(unsigned int label) const override

Member Data Documentation

AlignableToIdMap RunRangeDependentPedeLabeler::theAlignableToIdMap
private
AlignableToRunRangeRangeMap RunRangeDependentPedeLabeler::theAlignableToRunRangeRangeMap
private
IdToAlignableMap RunRangeDependentPedeLabeler::theIdToAlignableMap
private

providing unique ID for alignable, space for param IDs

Definition at line 106 of file RunRangeDependentPedeLabeler.h.

Referenced by alignableFromLabel(), and buildReverseMap().

UintUintMap RunRangeDependentPedeLabeler::theLabelToLasBeamMap
private

labels for las beams

Definition at line 108 of file RunRangeDependentPedeLabeler.h.

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

UintUintMap RunRangeDependentPedeLabeler::theLasBeamToLabelMap
private

reverse map

Definition at line 107 of file RunRangeDependentPedeLabeler.h.

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

unsigned int RunRangeDependentPedeLabeler::theMaxNumberOfParameterInstances
private

reverse of the above

Definition at line 109 of file RunRangeDependentPedeLabeler.h.

Referenced by buildReverseMap().