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 (Alignable *alignable, unsigned int parNum, const AlignmentAlgorithmBase::EventInfo &eventInfo, const TrajectoryStateOnSurface &tsos) const override
 
unsigned int parameterLabel (unsigned int aliLabel, unsigned int parNum) const override
 returns the label for a given alignable parameter number combination More...
 
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 31 of file RunRangeDependentPedeLabeler.h.

Member Typedef Documentation

◆ AlignableToIdMap

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

Definition at line 77 of file RunRangeDependentPedeLabeler.h.

◆ AlignableToIdPair

typedef AlignableToIdMap::value_type RunRangeDependentPedeLabeler::AlignableToIdPair
private

Definition at line 78 of file RunRangeDependentPedeLabeler.h.

◆ AlignableToRunRangeRangeMap

Definition at line 81 of file RunRangeDependentPedeLabeler.h.

◆ AlignableToRunRangeRangePair

typedef AlignableToRunRangeRangeMap::value_type RunRangeDependentPedeLabeler::AlignableToRunRangeRangePair
private

Definition at line 82 of file RunRangeDependentPedeLabeler.h.

◆ IdToAlignableMap

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

Definition at line 83 of file RunRangeDependentPedeLabeler.h.

◆ RunRangeParamMap

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

Definition at line 80 of file RunRangeDependentPedeLabeler.h.

◆ RunRangeVector

Definition at line 79 of file RunRangeDependentPedeLabeler.h.

◆ UintUintMap

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

Definition at line 84 of file RunRangeDependentPedeLabeler.h.

Constructor & Destructor Documentation

◆ RunRangeDependentPedeLabeler()

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.

31  align::Alignables alis;
32  alis.push_back(alignables.aliTracker_);
33  alis.push_back(alignables.aliMuon_);
34 
35  if (alignables.aliExtras_) {
36  for (const auto& ali : alignables.aliExtras_->components()) {
37  alis.push_back(ali);
38  }
39  }
40 
41  this->buildRunRangeDependencyMap(alignables.aliTracker_, alignables.aliMuon_, alignables.aliExtras_, config);
42  this->buildMap(alis);
43  this->buildReverseMap(); // needed already now to 'fill' theMaxNumberOfParameterInstances
44 }

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

◆ ~RunRangeDependentPedeLabeler()

RunRangeDependentPedeLabeler::~RunRangeDependentPedeLabeler ( )
override

non-virtual destructor: do not inherit from this class

Definition at line 48 of file RunRangeDependentPedeLabeler.cc.

48 {}

Member Function Documentation

◆ alignableFromLabel()

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 227 of file RunRangeDependentPedeLabeler.cc.

227  {
228  const unsigned int aliLabel = this->alignableLabelFromLabel(label);
229  if (aliLabel < theMinLabel)
230  return nullptr; // error already given
231 
232  IdToAlignableMap::const_iterator position = theIdToAlignableMap.find(aliLabel);
233  if (position != theIdToAlignableMap.end()) {
234  return position->second;
235  } else {
236  // error only if not in lasBeamMap:
237  UintUintMap::const_iterator position = theLabelToLasBeamMap.find(aliLabel);
238  if (position == theLabelToLasBeamMap.end()) {
239  edm::LogError("LogicError") << "@SUB=RunRangeDependentPedeLabeler::alignableFromLabel"
240  << "Alignable label " << aliLabel << " not in map.";
241  }
242  return nullptr;
243  }
244 }

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

Referenced by runRangeFromLabel(), and runRangeIndexFromLabel().

◆ alignableLabel()

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 52 of file RunRangeDependentPedeLabeler.cc.

52  {
53  if (!alignable)
54  return 0;
55 
56  AlignableToIdMap::const_iterator position = theAlignableToIdMap.find(alignable);
57  if (position != theAlignableToIdMap.end()) {
58  return position->second;
59  } else {
60  const DetId detId(alignable->id());
61  //throw cms::Exception("LogicError")
62  edm::LogError("LogicError") << "@SUB=RunRangeDependentPedeLabeler::alignableLabel"
63  << "Alignable " << typeid(*alignable).name()
64  << " not in map, det/subdet/alignableStructureType = " << detId.det() << "/"
65  << detId.subdetId() << "/" << alignable->alignableObjectId();
66  return 0;
67  }
68 }

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

Referenced by runRangeFromLabel(), and runRangeIndexFromLabel().

◆ alignableLabelFromLabel()

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

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

Implements PedeLabelerBase.

Definition at line 222 of file RunRangeDependentPedeLabeler.cc.

222  {
223  return paramLabel - this->paramNumFromLabel(paramLabel);
224 }

References volumeBasedMagneticField_160812_cfi::paramLabel, and paramNumFromLabel().

Referenced by alignableFromLabel(), and lasBeamIdFromLabel().

◆ alignableLabelFromParamAndInstance()

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 72 of file RunRangeDependentPedeLabeler.cc.

74  {
75  if (!alignable)
76  return 0;
77 
78  AlignableToIdMap::const_iterator position = theAlignableToIdMap.find(alignable);
79  if (position != theAlignableToIdMap.end()) {
80  AlignableToRunRangeRangeMap::const_iterator positionAli = theAlignableToRunRangeRangeMap.find(alignable);
81  if (positionAli != theAlignableToRunRangeRangeMap.end()) {
82  RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(param);
83  if (positionParam != (*positionAli).second.end()) {
84  if (instance >= (*positionParam).second.size()) {
85  throw cms::Exception("Alignment") << "RunRangeDependentPedeLabeler::alignableLabelFromParamAndRunRange: "
86  << "RunRangeIdx out of bounds.\n";
87  }
88  return position->second + instance * theParamInstanceOffset;
89  } else {
90  return position->second;
91  }
92  } else {
93  return position->second;
94  }
95  } else {
96  const DetId detId(alignable->id());
97  //throw cms::Exception("LogicError")
98  edm::LogError("LogicError") << "@SUB=RunRangeDependentPedeLabeler::alignableLabel"
99  << "Alignable " << typeid(*alignable).name()
100  << " not in map, det/subdet/alignableStructureType = " << detId.det() << "/"
101  << detId.subdetId() << "/" << alignable->alignableObjectId();
102  return 0;
103  }
104 }

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

◆ buildMap()

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

returns size of map

Definition at line 428 of file RunRangeDependentPedeLabeler.cc.

428  {
429  theAlignableToIdMap.clear(); // just in case of re-use...
430 
431  align::Alignables allComps;
432 
433  for (const auto& iAli : alis) {
434  if (iAli) {
435  allComps.push_back(iAli);
436  iAli->recursiveComponents(allComps);
437  }
438  }
439 
440  unsigned int id = theMinLabel;
441  for (const auto& iter : allComps) {
442  theAlignableToIdMap.insert(AlignableToIdPair(iter, id));
443  id += theMaxNumParam;
444  }
445 
446  // also care about las beams
447  theLasBeamToLabelMap.clear(); // just in case of re-use...
448  // FIXME: Temporarily hard code values stolen from
449  // https://twiki.cern.ch/twiki/bin/view/CMS/TkLasTrackBasedInterface#Beam_identifier .
450  unsigned int beamIds[] = {0, 10, 20, 30, 40, 50, 60, 70, // TEC+ R4
451  1, 11, 21, 31, 41, 51, 61, 71, // TEC+ R6
452  100, 110, 120, 130, 140, 150, 160, 170, // TEC- R4
453  101, 111, 121, 131, 141, 151, 161, 171, // TEC- R6
454  200, 210, 220, 230, 240, 250, 260, 270}; // AT
455 
456  const size_t nBeams = sizeof(beamIds) / sizeof(beamIds[0]);
457  for (size_t iBeam = 0; iBeam < nBeams; ++iBeam) {
458  //edm::LogInfo("Alignment") << "Las beam " << beamIds[iBeam] << " gets label " << id << ".";
459  theLasBeamToLabelMap[beamIds[iBeam]] = id;
460  id += theMaxNumParam;
461  }
462 
463  if (id > theParamInstanceOffset) { // 'overflow' per instance
464  throw cms::Exception("Alignment") << "@SUB=RunRangeDependentPedeLabeler::buildMap: "
465  << "Too many labels per instance (" << id - 1 << ") leading to double use, "
466  << "increase PedeLabelerBase::theParamInstanceOffset!\n";
467  }
468  // return combined size
469  return theAlignableToIdMap.size() + theLasBeamToLabelMap.size();
470 }

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

Referenced by RunRangeDependentPedeLabeler().

◆ buildReverseMap()

unsigned int RunRangeDependentPedeLabeler::buildReverseMap ( )
private

returns size of map

Definition at line 473 of file RunRangeDependentPedeLabeler.cc.

473  {
474  // alignables
475  theIdToAlignableMap.clear(); // just in case of re-use...
476 
477  for (const auto& it : theAlignableToIdMap) {
478  const unsigned int key = it.second;
479  Alignable* ali = it.first;
480  const unsigned int nInstances = this->numberOfParameterInstances(ali, -1);
482  for (unsigned int iInstance = 0; iInstance < nInstances; ++iInstance) {
483  theIdToAlignableMap[key + iInstance * theParamInstanceOffset] = ali;
484  }
485  }
486 
487  // las beams
488  theLabelToLasBeamMap.clear(); // just in case of re-use...
489 
490  for (const auto& it : theLasBeamToLabelMap) {
491  theLabelToLasBeamMap[it.second] = it.first; //revert key/value
492  }
493 
494  // return combined size
495  return theIdToAlignableMap.size() + theLabelToLasBeamMap.size();
496 }

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

Referenced by RunRangeDependentPedeLabeler().

◆ buildRunRangeDependencyMap()

unsigned int RunRangeDependentPedeLabeler::buildRunRangeDependencyMap ( AlignableTracker aliTracker,
AlignableMuon aliMuon,
AlignableExtras extras,
const edm::ParameterSet config 
)
private

Definition at line 316 of file RunRangeDependentPedeLabeler.cc.

319  {
320  static std::atomic<bool> oldRunRangeSelectionWarning{false};
321 
323 
324  AlignmentParameterSelector selector(aliTracker, aliMuon, aliExtras);
325 
326  std::vector<char> paramSelDummy(6, '1');
327 
328  const std::vector<edm::ParameterSet> RunRangeSelectionVPSet =
329  config.getUntrackedParameter<std::vector<edm::ParameterSet> >("RunRangeSelection");
330 
331  for (const auto& runRangeSel : RunRangeSelectionVPSet) {
332  const auto tempRunRanges = runRangeSel.getParameter<std::vector<std::string> >("RunRanges");
333  if (tempRunRanges.empty()) {
334  throw cms::Exception("BadConfig") << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
335  << "RunRanges empty\n";
336  }
337 
340  long int temp;
341  for (const auto& iRunRange : tempRunRanges) {
342  if (iRunRange.find(':') == std::string::npos) {
344  temp = strtol(iRunRange.c_str(), nullptr, 0);
345  if (temp != -1)
346  first = temp;
347 
348  } else {
349  bool expected = false;
350  if (oldRunRangeSelectionWarning.compare_exchange_strong(expected, true)) {
351  edm::LogWarning("BadConfig")
352  << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap"
353  << "Config file contains old format for 'RunRangeSelection'. Only the start run\n"
354  << "number is used internally. The number of the last run is ignored and can be\n"
355  << "safely removed from the config file.\n";
356  }
357 
358  std::vector<std::string> tokens = edm::tokenize(iRunRange, ":");
360  temp = strtol(tokens[0].c_str(), nullptr, 0);
361  if (temp != -1)
362  first = temp;
363  }
364 
365  RunRanges.push_back(std::pair<cond::Time_t, cond::Time_t>(first, cond::timeTypeSpecs[cond::runnumber].endValue));
366  }
367 
368  for (unsigned int i = 0; i < RunRanges.size() - 1; ++i) {
369  RunRanges[i].second = RunRanges[i + 1].first - 1;
370  if (RunRanges[i].first > RunRanges[i].second) {
371  throw cms::Exception("BadConfig") << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
372  << "Inconsistency in 'RunRangeSelection' parameter set.";
373  }
374  }
375 
376  const auto selStrings = runRangeSel.getParameter<std::vector<std::string> >("selector");
377  for (const auto& iSel : selStrings) {
378  std::vector<std::string> decompSel(this->decompose(iSel, ','));
379 
380  if (decompSel.size() != 2) {
381  throw cms::Exception("BadConfig") << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
382  << iSel << " should have at least 2 ','-separated parts\n";
383  }
384 
385  std::vector<unsigned int> selParam = this->convertParamSel(decompSel[1]);
386  selector.clear();
387  selector.addSelection(decompSel[0], paramSelDummy);
388 
389  const auto& alis = selector.selectedAlignables();
390 
391  for (const auto& iAli : alis) {
392  if (iAli->alignmentParameters() == nullptr) {
393  throw cms::Exception("BadConfig")
394  << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
395  << "Run dependence configured for alignable of type "
396  << objectIdProvider().idToString(iAli->alignableObjectId()) << " at (" << iAli->globalPosition().x()
397  << "," << iAli->globalPosition().y() << "," << iAli->globalPosition().z() << "), "
398  << "but that has no parameters. Please check that all run "
399  << "dependent parameters are also selected for alignment.\n";
400  }
401 
402  for (const auto& iParam : selParam) {
403  AlignableToRunRangeRangeMap::const_iterator positionAli = theAlignableToRunRangeRangeMap.find(iAli);
404  if (positionAli != theAlignableToRunRangeRangeMap.end()) {
405  AlignmentParameters* AliParams = (*positionAli).first->alignmentParameters();
406  if (static_cast<int>(selParam[selParam.size() - 1]) >= AliParams->size()) {
407  throw cms::Exception("BadConfig") << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
408  << "mismatch in number of parameters\n";
409  }
410 
411  RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(iParam);
412  if (positionParam != (*positionAli).second.end()) {
413  throw cms::Exception("BadConfig") << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
414  << "RunRange range for parameter specified twice\n";
415  }
416  }
417 
419  }
420  }
421  }
422  }
423 
424  return theAlignableToRunRangeRangeMap.size();
425 }

References AlignmentParameterSelector::addSelection(), cond::TimeTypeSpecs::beginValue, AlignmentParameterSelector::clear(), convertParamSel(), decompose(), Exception, dqmdumpme::first, 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().

◆ convertParamSel()

std::vector< unsigned int > RunRangeDependentPedeLabeler::convertParamSel ( const std::string &  selString) const
private

Definition at line 307 of file RunRangeDependentPedeLabeler.cc.

307  {
308  std::vector<unsigned int> result;
309  for (std::string::size_type pos = 0; pos < selString.size(); ++pos) {
310  if (selString[pos] == '1')
311  result.push_back(pos);
312  }
313  return result;
314 }

References mps_fire::result.

Referenced by buildRunRangeDependencyMap().

◆ decompose()

std::vector< std::string > RunRangeDependentPedeLabeler::decompose ( const std::string &  s,
std::string::value_type  delimiter 
) const
private

Definition at line 288 of file RunRangeDependentPedeLabeler.cc.

289  {
290  std::vector<std::string> result;
291 
292  std::string::size_type previousPos = 0;
293  while (true) {
294  const std::string::size_type delimiterPos = s.find(delimiter, previousPos);
295  if (delimiterPos == std::string::npos) {
296  result.push_back(s.substr(previousPos)); // until end
297  break;
298  }
299  result.push_back(s.substr(previousPos, delimiterPos - previousPos));
300  previousPos = delimiterPos + 1; // +1: skip delimiter
301  }
302 
303  return result;
304 }

References makeHLTPrescaleTable::delimiter, mps_fire::result, and alignCSCRings::s.

Referenced by buildRunRangeDependencyMap().

◆ hasSplitParameters()

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 181 of file RunRangeDependentPedeLabeler.cc.

181  {
182  AlignableToRunRangeRangeMap::const_iterator positionAli = theAlignableToRunRangeRangeMap.find(alignable);
183  if (positionAli != theAlignableToRunRangeRangeMap.end())
184  return true;
185  return false;
186 }

References theAlignableToRunRangeRangeMap.

◆ lasBeamIdFromLabel()

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 247 of file RunRangeDependentPedeLabeler.cc.

247  {
248  const unsigned int aliLabel = this->alignableLabelFromLabel(label);
249  if (aliLabel < theMinLabel)
250  return 0; // error already given
251 
252  UintUintMap::const_iterator position = theLabelToLasBeamMap.find(aliLabel);
253  if (position != theLabelToLasBeamMap.end()) {
254  return position->second;
255  } else {
256  edm::LogError("LogicError") << "@SUB=RunRangeDependentPedeLabeler::lasBeamIdFromLabel"
257  << "Alignable label " << aliLabel << " not in map.";
258  return 0;
259  }
260 }

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

◆ lasBeamLabel()

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

Implements PedeLabelerBase.

Definition at line 107 of file RunRangeDependentPedeLabeler.cc.

107  {
108  UintUintMap::const_iterator position = theLasBeamToLabelMap.find(lasBeamId);
109  if (position != theLasBeamToLabelMap.end()) {
110  return position->second;
111  } else {
112  //throw cms::Exception("LogicError")
113  edm::LogError("LogicError") << "@SUB=RunRangeDependentPedeLabeler::lasBeamLabel"
114  << "No label for beam Id " << lasBeamId;
115  return 0;
116  }
117 }

References position, and theLasBeamToLabelMap.

◆ maxNumberOfParameterInstances()

unsigned int RunRangeDependentPedeLabeler::maxNumberOfParameterInstances ( ) const
inlineoverridevirtual

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

Implements PedeLabelerBase.

Definition at line 62 of file RunRangeDependentPedeLabeler.h.

◆ numberOfParameterInstances()

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 189 of file RunRangeDependentPedeLabeler.cc.

189  {
190  AlignableToRunRangeRangeMap::const_iterator positionAli = theAlignableToRunRangeRangeMap.find(alignable);
191  if (positionAli != theAlignableToRunRangeRangeMap.end()) {
192  size_t nRunRanges = 1;
193  if (param == -1) {
194  for (const auto& iParam : (*positionAli).second) {
195  nRunRanges = std::max(nRunRanges, iParam.second.size());
196  }
197  return nRunRanges;
198  } else {
199  RunRangeParamMap::const_iterator iParam = (*positionAli).second.find(param);
200  if (iParam != (*positionAli).second.end()) {
201  return iParam->second.size();
202  } else {
203  return 1;
204  }
205  }
206  }
207 
208  return 1;
209 }

References SiStripPI::max, and theAlignableToRunRangeRangeMap.

Referenced by buildReverseMap().

◆ parameterLabel() [1/2]

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 129 of file RunRangeDependentPedeLabeler.cc.

132  {
133  if (!alignable)
134  return 0;
135 
136  if (parNum >= theMaxNumParam) {
137  throw cms::Exception("Alignment") << "@SUB=RunRangeDependentPedeLabeler::parameterLabel"
138  << "Parameter number " << parNum << " out of range 0 <= num < " << theMaxNumParam;
139  }
140 
141  AlignableToIdMap::const_iterator position = theAlignableToIdMap.find(alignable);
142  if (position != theAlignableToIdMap.end()) {
143  AlignableToRunRangeRangeMap::const_iterator positionAli = theAlignableToRunRangeRangeMap.find(alignable);
144  if (positionAli != theAlignableToRunRangeRangeMap.end()) {
145  RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(parNum);
146  if (positionParam != (*positionAli).second.end()) {
147  int offset = 0;
148  const RunRangeVector& runRanges = (*positionParam).second;
149  for (const auto& iRunRange : runRanges) {
150  if (eventInfo.eventId().run() >= iRunRange.first && eventInfo.eventId().run() <= iRunRange.second) {
151  return position->second + offset * theParamInstanceOffset + parNum;
152  }
153  offset++;
154  }
155  const DetId detId(alignable->id());
156  edm::LogError("LogicError") << "@SUB=RunRangeDependentPedeLabeler::parameterLabel"
157  << "Instance for Alignable " << typeid(*alignable).name()
158  << " not in map, det/subdet/alignableStructureType = " << detId.det() << "/"
159  << detId.subdetId() << "/" << alignable->alignableObjectId() << " for run "
160  << eventInfo.eventId().run();
161  return 0;
162  } else {
163  return position->second + parNum;
164  }
165 
166  } else {
167  return position->second + parNum;
168  }
169  } else {
170  const DetId detId(alignable->id());
171  //throw cms::Exception("LogicError")
172  edm::LogError("LogicError") << "@SUB=RunRangeDependentPedeLabeler::parameterLabel"
173  << "Alignable " << typeid(*alignable).name()
174  << " not in map, det/subdet/alignableStructureType = " << detId.det() << "/"
175  << detId.subdetId() << "/" << alignable->alignableObjectId();
176  return 0;
177  }
178 }

References Alignable::alignableObjectId(), ZMuMuAnalysisNtupler_cff::eventInfo, Exception, Alignable::id(), hltrates_dqm_sourceclient-live_cfg::offset, position, theAlignableToIdMap, theAlignableToRunRangeRangeMap, PedeLabelerBase::theMaxNumParam, and PedeLabelerBase::theParamInstanceOffset.

◆ parameterLabel() [2/2]

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 120 of file RunRangeDependentPedeLabeler.cc.

120  {
121  if (parNum >= theMaxNumParam) {
122  throw cms::Exception("Alignment") << "@SUB=RunRangeDependentPedeLabeler::parameterLabel"
123  << "Parameter number " << parNum << " out of range 0 <= num < " << theMaxNumParam;
124  }
125  return aliLabel + parNum;
126 }

References Exception, and PedeLabelerBase::theMaxNumParam.

◆ paramNumFromLabel()

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

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

Implements PedeLabelerBase.

Definition at line 212 of file RunRangeDependentPedeLabeler.cc.

212  {
213  if (paramLabel < theMinLabel) {
214  edm::LogError("LogicError") << "@SUB=RunRangeDependentPedeLabeler::paramNumFromLabel"
215  << "Label " << paramLabel << " should be >= " << theMinLabel;
216  return 0;
217  }
219 }

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

Referenced by alignableLabelFromLabel(), and runRangeFromLabel().

◆ runRangeFromLabel()

const RunRangeDependentPedeLabeler::RunRange & RunRangeDependentPedeLabeler::runRangeFromLabel ( unsigned int  label) const
overridevirtual

Reimplemented from PedeLabelerBase.

Definition at line 268 of file RunRangeDependentPedeLabeler.cc.

268  {
270 
271  AlignableToRunRangeRangeMap::const_iterator positionAli = theAlignableToRunRangeRangeMap.find(ali);
272  if (positionAli == theAlignableToRunRangeRangeMap.end())
273  return theOpenRunRange;
274 
275  unsigned int firstLabel = alignableLabel(ali);
276  unsigned int runRangeIndex = (label - firstLabel) / theParamInstanceOffset;
277  unsigned int paramNum = this->paramNumFromLabel(label);
278 
279  RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(paramNum);
280  if (positionParam == (*positionAli).second.end()) {
281  return theOpenRunRange;
282  }
283 
284  return positionParam->second[runRangeIndex];
285 }

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

◆ runRangeIndexFromLabel()

unsigned int RunRangeDependentPedeLabeler::runRangeIndexFromLabel ( unsigned int  label) const
private

Definition at line 262 of file RunRangeDependentPedeLabeler.cc.

262  {
264  unsigned int firstLabel = alignableLabel(ali);
265  return (label - firstLabel) / theMaxNumParam;
266 }

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

Member Data Documentation

◆ theAlignableToIdMap

AlignableToIdMap RunRangeDependentPedeLabeler::theAlignableToIdMap
private

◆ theAlignableToRunRangeRangeMap

AlignableToRunRangeRangeMap RunRangeDependentPedeLabeler::theAlignableToRunRangeRangeMap
private

◆ theIdToAlignableMap

IdToAlignableMap RunRangeDependentPedeLabeler::theIdToAlignableMap
private

providing unique ID for alignable, space for param IDs

Definition at line 103 of file RunRangeDependentPedeLabeler.h.

Referenced by alignableFromLabel(), and buildReverseMap().

◆ theLabelToLasBeamMap

UintUintMap RunRangeDependentPedeLabeler::theLabelToLasBeamMap
private

labels for las beams

Definition at line 105 of file RunRangeDependentPedeLabeler.h.

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

◆ theLasBeamToLabelMap

UintUintMap RunRangeDependentPedeLabeler::theLasBeamToLabelMap
private

reverse map

Definition at line 104 of file RunRangeDependentPedeLabeler.h.

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

◆ theMaxNumberOfParameterInstances

unsigned int RunRangeDependentPedeLabeler::theMaxNumberOfParameterInstances
private

reverse of the above

Definition at line 106 of file RunRangeDependentPedeLabeler.h.

Referenced by buildReverseMap().

mps_fire.i
i
Definition: mps_fire.py:355
cond::TimeTypeSpecs::beginValue
Time_t beginValue
Definition: Time.h:41
RunRangeDependentPedeLabeler::RunRangeVector
std::vector< RunRange > RunRangeVector
Definition: RunRangeDependentPedeLabeler.h:79
makeHLTPrescaleTable.delimiter
delimiter
Definition: makeHLTPrescaleTable.py:181
Alignable
Definition: Alignable.h:27
pos
Definition: PixelAliasList.h:18
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
PedeLabelerBase::TopLevelAlignables::aliTracker_
AlignableTracker * aliTracker_
Definition: PedeLabelerBase.h:43
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
dqmdumpme.first
first
Definition: dqmdumpme.py:55
AlignmentParameters
Definition: AlignmentParameters.h:35
edm::tokenize
std::vector< std::string > tokenize(std::string const &input, std::string const &separator)
breaks the input string into tokens, delimited by the separator
Definition: Parse.cc:52
RunRangeDependentPedeLabeler::theIdToAlignableMap
IdToAlignableMap theIdToAlignableMap
providing unique ID for alignable, space for param IDs
Definition: RunRangeDependentPedeLabeler.h:103
config
Definition: config.py:1
DetId
Definition: DetId.h:17
alignCSCRings.s
s
Definition: alignCSCRings.py:92
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
cond::timeTypeSpecs
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:16
AlignableExtras::components
const Alignables & components() const
Definition: AlignableExtras.h:32
Alignable::alignableObjectId
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
RunRangeDependentPedeLabeler::AlignableToIdPair
AlignableToIdMap::value_type AlignableToIdPair
Definition: RunRangeDependentPedeLabeler.h:78
RunRangeDependentPedeLabeler::theLabelToLasBeamMap
UintUintMap theLabelToLasBeamMap
labels for las beams
Definition: RunRangeDependentPedeLabeler.h:105
PedeLabelerBase::RunRanges
align::RunRanges RunRanges
Definition: PedeLabelerBase.h:37
RunRangeDependentPedeLabeler::buildReverseMap
unsigned int buildReverseMap()
returns size of map
Definition: RunRangeDependentPedeLabeler.cc:473
RunRangeDependentPedeLabeler::numberOfParameterInstances
unsigned int numberOfParameterInstances(Alignable *alignable, int param=-1) const override
returns the number of instances for a given parameter
Definition: RunRangeDependentPedeLabeler.cc:189
PedeLabelerBase::objectIdProvider
const AlignableObjectId & objectIdProvider() const
Return tracker alignable object ID provider derived from the tracker's geometry.
Definition: PedeLabelerBase.h:118
edm::LogWarning
Definition: MessageLogger.h:141
ZMuMuAnalysisNtupler_cff.eventInfo
eventInfo
Definition: ZMuMuAnalysisNtupler_cff.py:15
edm::LogError
Definition: MessageLogger.h:183
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
RunRangeDependentPedeLabeler::alignableLabelFromLabel
unsigned int alignableLabelFromLabel(unsigned int label) const override
alignable label from parameter label (works also for alignable label...)
Definition: RunRangeDependentPedeLabeler.cc:222
RunRangeDependentPedeLabeler::theMaxNumberOfParameterInstances
unsigned int theMaxNumberOfParameterInstances
reverse of the above
Definition: RunRangeDependentPedeLabeler.h:106
Alignable::id
align::ID id() const
Return the ID of Alignable, i.e. DetId of 'first' component GeomDet(Unit).
Definition: Alignable.h:180
cond::runnumber
Definition: Time.h:19
cond::Time_t
unsigned long long Time_t
Definition: Time.h:14
PedeLabelerBase::theMaxNumParam
static const unsigned int theMaxNumParam
Definition: PedeLabelerBase.h:108
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
PedeLabelerBase::PedeLabelerBase
PedeLabelerBase(const TopLevelAlignables &alignables, const edm::ParameterSet &config)
constructor from three Alignables (null pointers allowed )
Definition: PedeLabelerBase.cc:28
PedeLabelerBase::TopLevelAlignables::aliMuon_
AlignableMuon * aliMuon_
Definition: PedeLabelerBase.h:44
RunRangeDependentPedeLabeler::convertParamSel
std::vector< unsigned int > convertParamSel(const std::string &selString) const
Definition: RunRangeDependentPedeLabeler.cc:307
PedeLabelerBase::TopLevelAlignables::aliExtras_
AlignableExtras * aliExtras_
Definition: PedeLabelerBase.h:45
RunRangeDependentPedeLabeler::alignableLabel
unsigned int alignableLabel(Alignable *alignable) const override
Return 32-bit unique label for alignable, 0 indicates failure.
Definition: RunRangeDependentPedeLabeler.cc:52
volumeBasedMagneticField_160812_cfi.paramLabel
paramLabel
Definition: volumeBasedMagneticField_160812_cfi.py:37
instance
static PFTauRenderPlugin instance
Definition: PFTauRenderPlugin.cc:70
RunRangeDependentPedeLabeler::theLasBeamToLabelMap
UintUintMap theLasBeamToLabelMap
reverse map
Definition: RunRangeDependentPedeLabeler.h:104
PedeLabelerBase::theParamInstanceOffset
static const unsigned int theParamInstanceOffset
Definition: PedeLabelerBase.h:109
RunRangeDependentPedeLabeler::theAlignableToIdMap
AlignableToIdMap theAlignableToIdMap
Definition: RunRangeDependentPedeLabeler.h:101
align::Alignables
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
PedeLabelerBase::theMinLabel
static const unsigned int theMinLabel
Definition: PedeLabelerBase.h:110
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
RunRangeDependentPedeLabeler::buildRunRangeDependencyMap
unsigned int buildRunRangeDependencyMap(AlignableTracker *aliTracker, AlignableMuon *aliMuon, AlignableExtras *extras, const edm::ParameterSet &config)
Definition: RunRangeDependentPedeLabeler.cc:316
Exception
Definition: hltDiff.cc:246
RunRangeDependentPedeLabeler::alignableFromLabel
Alignable * alignableFromLabel(unsigned int label) const override
Definition: RunRangeDependentPedeLabeler.cc:227
AlignmentParameters::size
int size(void) const
Get number of parameters.
Definition: AlignmentParameters.cc:131
RunRangeDependentPedeLabeler::theAlignableToRunRangeRangeMap
AlignableToRunRangeRangeMap theAlignableToRunRangeRangeMap
providing unique ID for alignable, space for param IDs
Definition: RunRangeDependentPedeLabeler.h:102
AlignableObjectId::idToString
const char * idToString(align::StructureType type) const
Definition: AlignableObjectId.cc:259
mps_fire.result
result
Definition: mps_fire.py:303
RunRangeDependentPedeLabeler::paramNumFromLabel
unsigned int paramNumFromLabel(unsigned int paramLabel) const override
parameter number, 0 <= .. < theMaxNumParam, belonging to unique parameter label
Definition: RunRangeDependentPedeLabeler.cc:212
PedeLabelerBase::theOpenRunRange
const RunRange theOpenRunRange
Definition: PedeLabelerBase.h:120
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:78
crabWrapper.key
key
Definition: crabWrapper.py:19
RunRangeDependentPedeLabeler::buildMap
unsigned int buildMap(const align::Alignables &)
returns size of map
Definition: RunRangeDependentPedeLabeler.cc:428
label
const char * label
Definition: PFTauDecayModeTools.cc:11
AlignmentParameterSelector
Definition: AlignmentParameterSelector.h:26
RunRangeDependentPedeLabeler::decompose
std::vector< std::string > decompose(const std::string &s, std::string::value_type delimiter) const
Definition: RunRangeDependentPedeLabeler.cc:288