CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 
unsigned int alignableLabel (Alignable *alignable) const
 Return 32-bit unique label for alignable, 0 indicates failure. More...
 
unsigned int alignableLabelFromLabel (unsigned int label) const
 alignable label from parameter label (works also for alignable label...) More...
 
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 More...
 
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 More...
 
unsigned int parameterLabel (unsigned int aliLabel, unsigned int parNum) const
 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
 
unsigned int paramNumFromLabel (unsigned int paramLabel) const
 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
 
 ~RunRangeDependentPedeLabeler ()
 
- Public Member Functions inherited from PedeLabelerBase
 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
*, RunRangeParamMap
AlignableToRunRangeRangeMap
 
typedef
AlignableToRunRangeRangeMap::value_type 
AlignableToRunRangeRangePair
 
typedef std::map< unsigned int,
Alignable * > 
IdToAlignableMap
 
typedef std::map< unsigned int,
RunRangeVector
RunRangeParamMap
 
typedef std::vector< RunRangeRunRangeVector
 
typedef std::map< unsigned int,
unsigned int > 
UintUintMap
 

Private Member Functions

unsigned int buildMap (const std::vector< Alignable * > &alis)
 returns size of map More...
 
unsigned int buildReverseMap ()
 returns size of map More...
 
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...
 

Additional Inherited Members

- Public Types inherited from PedeLabelerBase
typedef
AlignmentAlgorithmBase::RunNumber 
RunNumber
 
typedef
AlignmentAlgorithmBase::RunRange 
RunRange
 
typedef std::vector< RunRangeRunRanges
 
- 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 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

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

Definition at line 79 of file RunRangeDependentPedeLabeler.h.

typedef AlignableToIdMap::value_type RunRangeDependentPedeLabeler::AlignableToIdPair
private

Definition at line 80 of file RunRangeDependentPedeLabeler.h.

Definition at line 83 of file RunRangeDependentPedeLabeler.h.

typedef AlignableToRunRangeRangeMap::value_type RunRangeDependentPedeLabeler::AlignableToRunRangeRangePair
private

Definition at line 84 of file RunRangeDependentPedeLabeler.h.

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

Definition at line 85 of file RunRangeDependentPedeLabeler.h.

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

Definition at line 82 of file RunRangeDependentPedeLabeler.h.

Definition at line 81 of file RunRangeDependentPedeLabeler.h.

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

Definition at line 86 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 26 of file RunRangeDependentPedeLabeler.cc.

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

28  :PedeLabelerBase(alignables, config)
29 {
30  std::vector<Alignable*> alis;
31  alis.push_back(alignables.aliTracker_);
32  alis.push_back(alignables.aliMuon_);
33 
34  if (alignables.aliExtras_) {
35  align::Alignables allExtras = alignables.aliExtras_->components();
36  for ( std::vector<Alignable*>::iterator it = allExtras.begin(); it != allExtras.end(); ++it ) {
37  alis.push_back(*it);
38  }
39  }
40 
41  this->buildRunRangeDependencyMap(alignables.aliTracker_,
42  alignables.aliMuon_,
43  alignables.aliExtras_,
44  config);
45  this->buildMap(alis);
46 }
PedeLabelerBase(const TopLevelAlignables &alignables, const edm::ParameterSet &config)
constructor from three Alignables (null pointers allowed )
Alignables components() const
std::vector< Alignable * > Alignables
Definition: Utilities.h:28
unsigned int buildRunRangeDependencyMap(AlignableTracker *aliTracker, AlignableMuon *aliMuon, AlignableExtras *extras, const edm::ParameterSet &config)
unsigned int buildMap(const std::vector< Alignable * > &alis)
returns size of map
RunRangeDependentPedeLabeler::~RunRangeDependentPedeLabeler ( )

non-virtual destructor: do not inherit from this class

Definition at line 50 of file RunRangeDependentPedeLabeler.cc.

51 {
52 }

Member Function Documentation

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

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

Referenced by runRangeFromLabel(), and runRangeIndexFromLabel().

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

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

Referenced by runRangeFromLabel(), and runRangeIndexFromLabel().

57 {
58  if (!alignable) return 0;
59 
60  AlignableToIdMap::const_iterator position = theAlignableToIdMap.find(alignable);
61  if (position != theAlignableToIdMap.end()) {
62  return position->second;
63  } else {
64  const DetId detId(alignable->id());
65  //throw cms::Exception("LogicError")
66  edm::LogError("LogicError")
67  << "@SUB=RunRangeDependentPedeLabeler::alignableLabel" << "Alignable "
68  << typeid(*alignable).name() << " not in map, det/subdet/alignableStructureType = "
69  << detId.det() << "/" << detId.subdetId() << "/" << alignable->alignableObjectId();
70  return 0;
71  }
72 }
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:180
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
Definition: DetId.h:20
unsigned int RunRangeDependentPedeLabeler::alignableLabelFromLabel ( unsigned int  label) const
virtual

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

Implements PedeLabelerBase.

Definition at line 240 of file RunRangeDependentPedeLabeler.cc.

References paramNumFromLabel().

Referenced by alignableFromLabel(), and lasBeamIdFromLabel().

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

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

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

returns size of map

Definition at line 455 of file RunRangeDependentPedeLabeler.cc.

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

Referenced by RunRangeDependentPedeLabeler().

456 {
457  theAlignableToIdMap.clear(); // just in case of re-use...
458 
459  std::vector<Alignable*> allComps;
460 
461  for (std::vector<Alignable*>::const_iterator iAli = alis.begin(); iAli != alis.end(); ++iAli) {
462  if (*iAli) {
463  allComps.push_back(*iAli);
464  (*iAli)->recursiveComponents(allComps);
465  }
466  }
467 
468  unsigned int id = theMinLabel;
469  for (std::vector<Alignable*>::const_iterator iter = allComps.begin();
470  iter != allComps.end(); ++iter) {
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  // return combined size
493  return theAlignableToIdMap.size() + theLasBeamToLabelMap.size();
494 }
AlignableToIdMap::value_type AlignableToIdPair
static const unsigned int theMinLabel
static const unsigned int theMaxNumParam
UintUintMap theLasBeamToLabelMap
reverse map
unsigned int RunRangeDependentPedeLabeler::buildReverseMap ( )
private

returns size of map

Definition at line 497 of file RunRangeDependentPedeLabeler.cc.

References combine::key, numberOfParameterInstances(), theAlignableToIdMap, theIdToAlignableMap, theLabelToLasBeamMap, theLasBeamToLabelMap, and PedeLabelerBase::theParamInstanceOffset.

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

Definition at line 341 of file RunRangeDependentPedeLabeler.cc.

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

Referenced by RunRangeDependentPedeLabeler().

345 {
346  static bool oldRunRangeSelectionWarning = false;
347 
349 
350  AlignmentParameterSelector selector(aliTracker, aliMuon, aliExtras);
351 
352  std::vector<char> paramSelDummy(6, '1');
353 
354  const std::vector<edm::ParameterSet> RunRangeSelectionVPSet =
355  config.getUntrackedParameter<std::vector<edm::ParameterSet> >("RunRangeSelection");
356 
357  for (std::vector<edm::ParameterSet>::const_iterator iter = RunRangeSelectionVPSet.begin();
358  iter != RunRangeSelectionVPSet.end();
359  ++iter) {
360 
361  const std::vector<std::string> tempRunRanges = (*iter).getParameter<std::vector<std::string> >("RunRanges");
362  if (tempRunRanges.size()==0) {
363  throw cms::Exception("BadConfig") << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
364  << "RunRanges empty\n";
365  }
366 
369  long int temp;
370  for (std::vector<std::string>::const_iterator iRunRange = tempRunRanges.begin();
371  iRunRange != tempRunRanges.end();
372  ++iRunRange) {
373  if ((*iRunRange).find(':')==std::string::npos) {
374 
376  temp = strtol((*iRunRange).c_str(), 0, 0);
377  if (temp!=-1) first = temp;
378 
379  } else {
380 
381  if (!oldRunRangeSelectionWarning) {
382  edm::LogWarning("BadConfig") << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap"
383  << "Config file contains old format for 'RunRangeSelection'. Only the start run\n"
384  << "number is used internally. The number of the last run is ignored and can be\n"
385  << "safely removed from the config file.\n";
386  oldRunRangeSelectionWarning = true;
387  }
388 
389  std::vector<std::string> tokens = edm::tokenize(*iRunRange, ":");
391  temp = strtol(tokens[0].c_str(), 0, 0);
392  if (temp!=-1) first = temp;
393 
394  }
395 
396  RunRanges.push_back(std::pair<cond::Time_t,cond::Time_t>(first, cond::timeTypeSpecs[cond::runnumber].endValue));
397  }
398 
399  for (unsigned int i = 0;i<RunRanges.size()-1;++i) {
400  RunRanges[i].second = RunRanges[i+1].first - 1;
401  if (RunRanges[i].first > RunRanges[i].second) {
402  throw cms::Exception("BadConfig") << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
403  << "Inconsistency in 'RunRangeSelection' parameter set.";
404  }
405  }
406 
407  const std::vector<std::string> selStrings = (*iter).getParameter<std::vector<std::string> >("selector");
408  for (std::vector<std::string>::const_iterator iSel = selStrings.begin();
409  iSel != selStrings.end();
410  ++iSel) {
411  std::vector<std::string> decompSel(this->decompose(*iSel, ','));
412 
413  if (decompSel.size()!=2) {
414  throw cms::Exception("BadConfig") << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
415  << *iSel <<" should have at least 2 ','-separated parts\n";
416  }
417 
418  std::vector<unsigned int> selParam = this->convertParamSel(decompSel[1]);
419  selector.clear();
420  selector.addSelection(decompSel[0], paramSelDummy);
421 
422  const std::vector<Alignable*> &alis = selector.selectedAlignables();
423  for (std::vector<Alignable*>::const_iterator iAli = alis.begin();
424  iAli != alis.end();
425  ++iAli) {
426  for (std::vector<unsigned int>::const_iterator iParam = selParam.begin();
427  iParam != selParam.end();
428  ++iParam) {
429  AlignableToRunRangeRangeMap::const_iterator positionAli = theAlignableToRunRangeRangeMap.find(*iAli);
430  if (positionAli!=theAlignableToRunRangeRangeMap.end()) {
431 
432  AlignmentParameters *AliParams = (*positionAli).first->alignmentParameters();
433  if (static_cast<int>(selParam[selParam.size()-1]) >= AliParams->size()) {
434  throw cms::Exception("BadConfig") << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
435  << "mismatch in number of parameters\n";
436  }
437 
438  RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(*iParam);
439  if (positionParam!=(*positionAli).second.end()) {
440  throw cms::Exception("BadConfig") << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
441  << "RunRange range for parameter specified twice\n";
442  }
443  }
444 
445  theAlignableToRunRangeRangeMap[*iAli][*iParam] = RunRanges;
446  }
447  }
448  }
449  }
450 
451  return theAlignableToRunRangeRangeMap.size();
452 }
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:22
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
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
bool first
Definition: L1TdeRCT.cc:94
int size(void) const
Get number of parameters.
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:57
std::vector< RunRange > RunRanges
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
std::vector< unsigned int > RunRangeDependentPedeLabeler::convertParamSel ( const std::string &  selString) const
private

Definition at line 332 of file RunRangeDependentPedeLabeler.cc.

References pos, and query::result.

Referenced by buildRunRangeDependencyMap().

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

Definition at line 312 of file RunRangeDependentPedeLabeler.cc.

References query::result.

Referenced by buildRunRangeDependencyMap().

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

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

Implements PedeLabelerBase.

Definition at line 194 of file RunRangeDependentPedeLabeler.cc.

References theAlignableToRunRangeRangeMap.

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

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

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

Implements PedeLabelerBase.

Definition at line 111 of file RunRangeDependentPedeLabeler.cc.

References position, and theLasBeamToLabelMap.

112 {
113  UintUintMap::const_iterator position = theLasBeamToLabelMap.find(lasBeamId);
114  if (position != theLasBeamToLabelMap.end()) {
115  return position->second;
116  } else {
117  //throw cms::Exception("LogicError")
118  edm::LogError("LogicError") << "@SUB=RunRangeDependentPedeLabeler::lasBeamLabel"
119  << "No label for beam Id " << lasBeamId;
120  return 0;
121  }
122 }
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
UintUintMap theLasBeamToLabelMap
reverse map
unsigned int RunRangeDependentPedeLabeler::numberOfParameterInstances ( Alignable alignable,
int  param = -1 
) const
virtual

returns the number of instances for a given parameter

Implements PedeLabelerBase.

Definition at line 202 of file RunRangeDependentPedeLabeler.cc.

References max(), and theAlignableToRunRangeRangeMap.

Referenced by buildReverseMap().

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

returns the label for a given alignable parameter number combination

Implements PedeLabelerBase.

Definition at line 125 of file RunRangeDependentPedeLabeler.cc.

References edm::hlt::Exception, and PedeLabelerBase::theMaxNumParam.

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

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

Implements PedeLabelerBase.

Definition at line 136 of file RunRangeDependentPedeLabeler.cc.

References Alignable::alignableObjectId(), AlignmentAlgorithmBase::EventInfo::eventId_, edm::hlt::Exception, Alignable::id(), evf::evtn::offset(), position, edm::EventID::run(), theAlignableToIdMap, theAlignableToRunRangeRangeMap, PedeLabelerBase::theMaxNumParam, and PedeLabelerBase::theParamInstanceOffset.

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

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

Implements PedeLabelerBase.

Definition at line 229 of file RunRangeDependentPedeLabeler.cc.

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

Referenced by alignableLabelFromLabel(), and runRangeFromLabel().

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

Reimplemented from PedeLabelerBase.

Definition at line 291 of file RunRangeDependentPedeLabeler.cc.

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

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

Definition at line 283 of file RunRangeDependentPedeLabeler.cc.

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

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

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 104 of file RunRangeDependentPedeLabeler.h.

Referenced by alignableFromLabel(), and buildReverseMap().

UintUintMap RunRangeDependentPedeLabeler::theLabelToLasBeamMap
private

labels for las beams

Definition at line 106 of file RunRangeDependentPedeLabeler.h.

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

UintUintMap RunRangeDependentPedeLabeler::theLasBeamToLabelMap
private

reverse map

Definition at line 105 of file RunRangeDependentPedeLabeler.h.

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