CMS 3D CMS Logo

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

#include <MomentumDependentPedeLabeler.h>

Inheritance diagram for MomentumDependentPedeLabeler:
PedeLabelerBase

Public Member Functions

AlignablealignableFromLabel (unsigned int label) const override
 
unsigned int alignableLabel (const 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 (const 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...
 
 MomentumDependentPedeLabeler (const PedeLabelerBase::TopLevelAlignables &alignables, const edm::ParameterSet &config)
 constructor from three Alignables (null pointers allowed ) 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...
 
 ~MomentumDependentPedeLabeler () 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 const RunRangerunRangeFromLabel (unsigned int label) const
 
virtual ~PedeLabelerBase ()
 

Private Types

typedef std::map< Alignable *, unsigned int, AlignableComparatorAlignableToIdMap
 
typedef AlignableToIdMap::value_type AlignableToIdPair
 
typedef std::map< Alignable *, MomentumRangeParamMap, AlignableComparatorAlignableToMomentumRangeMap
 
typedef AlignableToMomentumRangeMap::value_type AlignableToMomentumRangePair
 
typedef std::map< unsigned int, Alignable * > IdToAlignableMap
 
typedef std::pair< float, float > MomentumRange
 
typedef std::map< unsigned int, MomentumRangeVectorMomentumRangeParamMap
 
typedef std::vector< MomentumRangeMomentumRangeVector
 
typedef std::map< unsigned int, unsigned int > UintUintMap
 

Private Member Functions

unsigned int buildMap (const align::Alignables &)
 returns size of map More...
 
unsigned int buildMomentumDependencyMap (AlignableTracker *aliTracker, AlignableMuon *aliMuon, AlignableExtras *extras, const edm::ParameterSet &config)
 
unsigned int buildReverseMap ()
 returns size of map More...
 
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
 

Private Attributes

AlignableToIdMap theAlignableToIdMap
 
AlignableToMomentumRangeMap theAlignableToMomentumRangeMap
 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
 
const MomentumRange theOpenMomentumRange
 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/03/05 20:12:23
Revision
1.1

(last update by

Author
mussgill

)

Definition at line 26 of file MomentumDependentPedeLabeler.h.

Member Typedef Documentation

◆ AlignableToIdMap

Definition at line 71 of file MomentumDependentPedeLabeler.h.

◆ AlignableToIdPair

typedef AlignableToIdMap::value_type MomentumDependentPedeLabeler::AlignableToIdPair
private

Definition at line 72 of file MomentumDependentPedeLabeler.h.

◆ AlignableToMomentumRangeMap

Definition at line 76 of file MomentumDependentPedeLabeler.h.

◆ AlignableToMomentumRangePair

typedef AlignableToMomentumRangeMap::value_type MomentumDependentPedeLabeler::AlignableToMomentumRangePair
private

Definition at line 77 of file MomentumDependentPedeLabeler.h.

◆ IdToAlignableMap

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

Definition at line 78 of file MomentumDependentPedeLabeler.h.

◆ MomentumRange

typedef std::pair<float, float> MomentumDependentPedeLabeler::MomentumRange
private

Definition at line 73 of file MomentumDependentPedeLabeler.h.

◆ MomentumRangeParamMap

Definition at line 75 of file MomentumDependentPedeLabeler.h.

◆ MomentumRangeVector

Definition at line 74 of file MomentumDependentPedeLabeler.h.

◆ UintUintMap

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

Definition at line 79 of file MomentumDependentPedeLabeler.h.

Constructor & Destructor Documentation

◆ MomentumDependentPedeLabeler()

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

constructor from three Alignables (null pointers allowed )

Definition at line 27 of file MomentumDependentPedeLabeler.cc.

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

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

◆ ~MomentumDependentPedeLabeler()

MomentumDependentPedeLabeler::~MomentumDependentPedeLabeler ( )
override

non-virtual destructor: do not inherit from this class

Definition at line 49 of file MomentumDependentPedeLabeler.cc.

49 {}

Member Function Documentation

◆ alignableFromLabel()

Alignable * MomentumDependentPedeLabeler::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 228 of file MomentumDependentPedeLabeler.cc.

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

228  {
229  const unsigned int aliLabel = this->alignableLabelFromLabel(label);
230  if (aliLabel < theMinLabel)
231  return nullptr; // error already given
232 
233  IdToAlignableMap::const_iterator position = theIdToAlignableMap.find(aliLabel);
234  if (position != theIdToAlignableMap.end()) {
235  return position->second;
236  } else {
237  // error only if not in lasBeamMap:
238  UintUintMap::const_iterator position = theLabelToLasBeamMap.find(aliLabel);
239  if (position == theLabelToLasBeamMap.end()) {
240  edm::LogError("LogicError") << "@SUB=MomentumDependentPedeLabeler::alignableFromLabel"
241  << "Alignable label " << aliLabel << " not in map.";
242  }
243  return nullptr;
244  }
245 }
unsigned int alignableLabelFromLabel(unsigned int label) const override
alignable label from parameter label (works also for alignable label...)
UintUintMap theLabelToLasBeamMap
labels for las beams
static const unsigned int theMinLabel
Log< level::Error, false > LogError
char const * label
static int position[264][3]
Definition: ReadPGInfo.cc:289
IdToAlignableMap theIdToAlignableMap
providing unique ID for alignable, space for param IDs

◆ alignableLabel()

unsigned int MomentumDependentPedeLabeler::alignableLabel ( const 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 53 of file MomentumDependentPedeLabeler.cc.

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

53  {
54  if (!alignable)
55  return 0;
56 
57  AlignableToIdMap::const_iterator position = theAlignableToIdMap.find(alignable);
58  if (position != theAlignableToIdMap.end()) {
59  return position->second;
60  } else {
61  const DetId detId(alignable->id());
62  //throw cms::Exception("LogicError")
63  edm::LogError("LogicError") << "@SUB=MomentumDependentPedeLabeler::alignableLabel"
64  << "Alignable " << typeid(*alignable).name()
65  << " not in map, det/subdet/alignableStructureType = " << detId.det() << "/"
66  << detId.subdetId() << "/" << alignable->alignableObjectId();
67  return 0;
68  }
69 }
Log< level::Error, false > LogError
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
Definition: DetId.h:17
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[264][3]
Definition: ReadPGInfo.cc:289

◆ alignableLabelFromLabel()

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

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

Implements PedeLabelerBase.

Definition at line 223 of file MomentumDependentPedeLabeler.cc.

References volumeBasedMagneticField_160812_cfi::paramLabel, and paramNumFromLabel().

Referenced by alignableFromLabel(), and lasBeamIdFromLabel().

223  {
224  return paramLabel - this->paramNumFromLabel(paramLabel);
225 }
unsigned int paramNumFromLabel(unsigned int paramLabel) const override
parameter number, 0 <= .. < theMaxNumParam, belonging to unique parameter label

◆ alignableLabelFromParamAndInstance()

unsigned int MomentumDependentPedeLabeler::alignableLabelFromParamAndInstance ( const 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 73 of file MomentumDependentPedeLabeler.cc.

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

75  {
76  if (!alignable)
77  return 0;
78 
79  AlignableToIdMap::const_iterator position = theAlignableToIdMap.find(alignable);
80  if (position != theAlignableToIdMap.end()) {
81  AlignableToMomentumRangeMap::const_iterator positionAli = theAlignableToMomentumRangeMap.find(alignable);
82  if (positionAli != theAlignableToMomentumRangeMap.end()) {
83  MomentumRangeParamMap::const_iterator positionParam = (*positionAli).second.find(param);
84  if (positionParam != (*positionAli).second.end()) {
85  if (instance >= (*positionParam).second.size()) {
86  throw cms::Exception("Alignment") << "@SUB=MomentumDependentPedeLabeler::alignableLabelFromParamAndMomentum"
87  << "iovIdx out of bounds";
88  }
89  return position->second + instance * theParamInstanceOffset;
90  } else {
91  return position->second;
92  }
93  } else {
94  return position->second;
95  }
96  } else {
97  const DetId detId(alignable->id());
98  //throw cms::Exception("LogicError")
99  edm::LogError("LogicError") << "@SUB=MomentumDependentPedeLabeler::alignableLabel"
100  << "Alignable " << typeid(*alignable).name()
101  << " not in map, det/subdet/alignableStructureType = " << detId.det() << "/"
102  << detId.subdetId() << "/" << alignable->alignableObjectId();
103  return 0;
104  }
105 }
static PFTauRenderPlugin instance
Log< level::Error, false > LogError
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
Definition: DetId.h:17
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:180
static const unsigned int theParamInstanceOffset
static int position[264][3]
Definition: ReadPGInfo.cc:289
AlignableToMomentumRangeMap theAlignableToMomentumRangeMap
providing unique ID for alignable, space for param IDs

◆ buildMap()

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

returns size of map

Definition at line 374 of file MomentumDependentPedeLabeler.cc.

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

Referenced by MomentumDependentPedeLabeler().

374  {
375  theAlignableToIdMap.clear(); // just in case of re-use...
376 
377  align::Alignables allComps;
378 
379  for (const auto &iAli : alis) {
380  if (iAli) {
381  allComps.push_back(iAli);
382  iAli->recursiveComponents(allComps);
383  }
384  }
385 
386  unsigned int id = theMinLabel;
387  for (const auto &iter : allComps) {
388  theAlignableToIdMap.insert(AlignableToIdPair(iter, id));
389  id += theMaxNumParam;
390  }
391 
392  // also care about las beams
393  theLasBeamToLabelMap.clear(); // just in case of re-use...
394  // FIXME: Temporarily hard code values stolen from
395  // https://twiki.cern.ch/twiki/bin/view/CMS/TkLasTrackBasedInterface#Beam_identifier .
396  unsigned int beamIds[] = {0, 10, 20, 30, 40, 50, 60, 70, // TEC+ R4
397  1, 11, 21, 31, 41, 51, 61, 71, // TEC+ R6
398  100, 110, 120, 130, 140, 150, 160, 170, // TEC- R4
399  101, 111, 121, 131, 141, 151, 161, 171, // TEC- R6
400  200, 210, 220, 230, 240, 250, 260, 270}; // AT
401 
402  const size_t nBeams = sizeof(beamIds) / sizeof(beamIds[0]);
403  for (size_t iBeam = 0; iBeam < nBeams; ++iBeam) {
404  //edm::LogInfo("Alignment") << "Las beam " << beamIds[iBeam] << " gets label " << id << ".";
405  theLasBeamToLabelMap[beamIds[iBeam]] = id;
406  id += theMaxNumParam;
407  }
408 
409  if (id > theParamInstanceOffset) { // 'overflow' per instance
410  throw cms::Exception("Alignment") << "@SUB=MomentumDependentPedeLabeler::buildMap: "
411  << "Too many labels per instance (" << id - 1 << ") leading to double use, "
412  << "increase PedeLabelerBase::theParamInstanceOffset!\n";
413  }
414  // return combined size
415  return theAlignableToIdMap.size() + theLasBeamToLabelMap.size();
416 }
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:31
AlignableToIdMap::value_type AlignableToIdPair

◆ buildMomentumDependencyMap()

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

Definition at line 292 of file MomentumDependentPedeLabeler.cc.

References convertParamSel(), decompose(), Exception, AlignableObjectId::idToString(), PedeLabelerBase::objectIdProvider(), collectionMerger::selector, AlignmentParameters::size(), theAlignableToMomentumRangeMap, and edm::tokenize().

Referenced by MomentumDependentPedeLabeler().

295  {
297 
298  AlignmentParameterSelector selector(aliTracker, aliMuon, aliExtras);
299 
300  std::vector<char> paramSelDumthe(6, '1');
301 
302  const auto parameterInstancesVPSet = config.getParameter<std::vector<edm::ParameterSet> >("parameterInstances");
303 
304  for (const auto &iter : parameterInstancesVPSet) {
305  const auto tempMomentumRanges = iter.getParameter<std::vector<std::string> >("momentumRanges");
306  if (tempMomentumRanges.empty()) {
307  throw cms::Exception("BadConfig") << "@SUB=MomentumDependentPedeLabeler::buildMomentumDependencyMap\n"
308  << "MomentumRanges empty\n";
309  }
310 
311  MomentumRangeVector MomentumRanges;
312  float lower;
313  float upper;
314  for (unsigned int iMomentum = 0; iMomentum < tempMomentumRanges.size(); ++iMomentum) {
315  std::vector<std::string> tokens = edm::tokenize(tempMomentumRanges[iMomentum], ":");
316 
317  lower = strtod(tokens[0].c_str(), nullptr);
318  upper = strtod(tokens[1].c_str(), nullptr);
319 
320  MomentumRanges.push_back(std::pair<float, float>(lower, upper));
321  }
322 
323  const auto selStrings = iter.getParameter<std::vector<std::string> >("selector");
324  for (const auto &iSel : selStrings) {
325  std::vector<std::string> decompSel(this->decompose(iSel, ','));
326 
327  if (decompSel.size() != 2) {
328  throw cms::Exception("BadConfig") << "@SUB=MomentumDependentPedeLabeler::buildMomentumDependencyMap\n"
329  << iSel << " should have at least 2 ','-separated parts\n";
330  }
331 
332  std::vector<unsigned int> selParam = this->convertParamSel(decompSel[1]);
333  selector.clear();
334  selector.addSelection(decompSel[0], paramSelDumthe);
335 
336  const auto &alis = selector.selectedAlignables();
337  for (const auto &iAli : alis) {
338  if (iAli->alignmentParameters() == nullptr) {
339  throw cms::Exception("BadConfig")
340  << "@SUB=MomentumDependentPedeLabeler::buildMomentumDependencyMap\n"
341  << "Momentum dependence configured for alignable of type "
342  << objectIdProvider().idToString(iAli->alignableObjectId()) << " at (" << iAli->globalPosition().x()
343  << "," << iAli->globalPosition().y() << "," << iAli->globalPosition().z() << "), "
344  << "but that has no parameters. Please check that all run "
345  << "momentum parameters are also selected for alignment.\n";
346  }
347 
348  for (const auto &iParam : selParam) {
349  AlignableToMomentumRangeMap::const_iterator positionAli = theAlignableToMomentumRangeMap.find(iAli);
350  if (positionAli != theAlignableToMomentumRangeMap.end()) {
351  AlignmentParameters *AliParams = (*positionAli).first->alignmentParameters();
352  if (static_cast<int>(selParam[selParam.size() - 1]) >= AliParams->size()) {
353  throw cms::Exception("BadConfig") << "@SUB=MomentumDependentPedeLabeler::buildMomentumDependencyMap\n"
354  << "mismatch in number of parameters\n";
355  }
356 
357  MomentumRangeParamMap::const_iterator positionParam = (*positionAli).second.find(iParam);
358  if (positionParam != (*positionAli).second.end()) {
359  throw cms::Exception("BadConfig") << "@SUB=MomentumDependentPedeLabeler::buildMomentumDependencyMap\n"
360  << "Momentum range for parameter specified twice\n";
361  }
362  }
363 
364  theAlignableToMomentumRangeMap[iAli][iParam] = MomentumRanges;
365  }
366  }
367  }
368  }
369 
370  return theAlignableToMomentumRangeMap.size();
371 }
Definition: config.py:1
int size(void) const
Get number of parameters.
std::vector< std::string > decompose(const std::string &s, std::string::value_type delimiter) const
std::vector< unsigned int > convertParamSel(const std::string &selString) const
const AlignableObjectId & objectIdProvider() const
Return tracker alignable object ID provider derived from the tracker&#39;s geometry.
const char * idToString(align::StructureType type) const
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
std::vector< MomentumRange > MomentumRangeVector
AlignableToMomentumRangeMap theAlignableToMomentumRangeMap
providing unique ID for alignable, space for param IDs

◆ buildReverseMap()

unsigned int MomentumDependentPedeLabeler::buildReverseMap ( )
private

returns size of map

Definition at line 419 of file MomentumDependentPedeLabeler.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, submitPVResolutionJobs::key, WZElectronSkims53X_cff::max, numberOfParameterInstances(), theAlignableToIdMap, theIdToAlignableMap, theLabelToLasBeamMap, theLasBeamToLabelMap, theMaxNumberOfParameterInstances, and PedeLabelerBase::theParamInstanceOffset.

Referenced by MomentumDependentPedeLabeler().

419  {
420  // alignables
421  theIdToAlignableMap.clear(); // just in case of re-use...
422 
423  for (const auto &it : theAlignableToIdMap) {
424  const unsigned int key = it.second;
425  Alignable *ali = it.first;
426  const unsigned int nInstances = this->numberOfParameterInstances(ali, -1);
428  for (unsigned int iInstance = 0; iInstance < nInstances; ++iInstance) {
429  theIdToAlignableMap[key + iInstance * theParamInstanceOffset] = ali;
430  }
431  }
432 
433  // las beams
434  theLabelToLasBeamMap.clear(); // just in case of re-use...
435 
436  for (const auto &it : theLasBeamToLabelMap) {
437  theLabelToLasBeamMap[it.second] = it.first; //revert key/value
438  }
439 
440  // return combined size
441  return theIdToAlignableMap.size() + theLabelToLasBeamMap.size();
442 }
UintUintMap theLabelToLasBeamMap
labels for las beams
key
prepare the HTCondor submission files and eventually submit them
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
IdToAlignableMap theIdToAlignableMap
providing unique ID for alignable, space for param IDs

◆ convertParamSel()

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

Definition at line 283 of file MomentumDependentPedeLabeler.cc.

References mps_fire::result.

Referenced by buildMomentumDependencyMap().

283  {
284  std::vector<unsigned int> result;
285  for (std::string::size_type pos = 0; pos < selString.size(); ++pos) {
286  if (selString[pos] == '1')
287  result.push_back(pos);
288  }
289  return result;
290 }
uint16_t size_type

◆ decompose()

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

Definition at line 264 of file MomentumDependentPedeLabeler.cc.

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

Referenced by buildMomentumDependencyMap().

265  {
266  std::vector<std::string> result;
267 
268  std::string::size_type previousPos = 0;
269  while (true) {
270  const std::string::size_type delimiterPos = s.find(delimiter, previousPos);
271  if (delimiterPos == std::string::npos) {
272  result.push_back(s.substr(previousPos)); // until end
273  break;
274  }
275  result.push_back(s.substr(previousPos, delimiterPos - previousPos));
276  previousPos = delimiterPos + 1; // +1: skip delimiter
277  }
278 
279  return result;
280 }
uint16_t size_type

◆ hasSplitParameters()

bool MomentumDependentPedeLabeler::hasSplitParameters ( Alignable alignable) const
overridevirtual

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

Implements PedeLabelerBase.

Definition at line 182 of file MomentumDependentPedeLabeler.cc.

References theAlignableToMomentumRangeMap.

182  {
183  AlignableToMomentumRangeMap::const_iterator positionAli = theAlignableToMomentumRangeMap.find(alignable);
184  if (positionAli != theAlignableToMomentumRangeMap.end())
185  return true;
186  return false;
187 }
AlignableToMomentumRangeMap theAlignableToMomentumRangeMap
providing unique ID for alignable, space for param IDs

◆ lasBeamIdFromLabel()

unsigned int MomentumDependentPedeLabeler::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 248 of file MomentumDependentPedeLabeler.cc.

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

248  {
249  const unsigned int aliLabel = this->alignableLabelFromLabel(label);
250  if (aliLabel < theMinLabel)
251  return 0; // error already given
252 
253  UintUintMap::const_iterator position = theLabelToLasBeamMap.find(aliLabel);
254  if (position != theLabelToLasBeamMap.end()) {
255  return position->second;
256  } else {
257  edm::LogError("LogicError") << "@SUB=MomentumDependentPedeLabeler::lasBeamIdFromLabel"
258  << "Alignable label " << aliLabel << " not in map.";
259  return 0;
260  }
261 }
unsigned int alignableLabelFromLabel(unsigned int label) const override
alignable label from parameter label (works also for alignable label...)
UintUintMap theLabelToLasBeamMap
labels for las beams
static const unsigned int theMinLabel
Log< level::Error, false > LogError
char const * label
static int position[264][3]
Definition: ReadPGInfo.cc:289

◆ lasBeamLabel()

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

Implements PedeLabelerBase.

Definition at line 108 of file MomentumDependentPedeLabeler.cc.

References position, and theLasBeamToLabelMap.

108  {
109  UintUintMap::const_iterator position = theLasBeamToLabelMap.find(lasBeamId);
110  if (position != theLasBeamToLabelMap.end()) {
111  return position->second;
112  } else {
113  //throw cms::Exception("LogicError")
114  edm::LogError("LogicError") << "@SUB=MomentumDependentPedeLabeler::lasBeamLabel"
115  << "No label for beam Id " << lasBeamId;
116  return 0;
117  }
118 }
Log< level::Error, false > LogError
UintUintMap theLasBeamToLabelMap
reverse map
static int position[264][3]
Definition: ReadPGInfo.cc:289

◆ maxNumberOfParameterInstances()

unsigned int MomentumDependentPedeLabeler::maxNumberOfParameterInstances ( ) const
inlineoverridevirtual

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

Implements PedeLabelerBase.

Definition at line 57 of file MomentumDependentPedeLabeler.h.

References theMaxNumberOfParameterInstances.

◆ numberOfParameterInstances()

unsigned int MomentumDependentPedeLabeler::numberOfParameterInstances ( Alignable alignable,
int  param = -1 
) const
overridevirtual

returns the number of instances for a given parameter

Implements PedeLabelerBase.

Definition at line 190 of file MomentumDependentPedeLabeler.cc.

References WZElectronSkims53X_cff::max, and theAlignableToMomentumRangeMap.

Referenced by buildReverseMap().

190  {
191  AlignableToMomentumRangeMap::const_iterator positionAli = theAlignableToMomentumRangeMap.find(alignable);
192  if (positionAli != theAlignableToMomentumRangeMap.end()) {
193  size_t nMomentums = 1;
194  if (param == -1) {
195  for (const auto &iParam : (*positionAli).second) {
196  nMomentums = std::max(nMomentums, iParam.second.size());
197  }
198  return nMomentums;
199  } else {
200  MomentumRangeParamMap::const_iterator iParam = (*positionAli).second.find(param);
201  if (iParam != (*positionAli).second.end()) {
202  return iParam->second.size();
203  } else {
204  return 1;
205  }
206  }
207  }
208 
209  return 1;
210 }
AlignableToMomentumRangeMap theAlignableToMomentumRangeMap
providing unique ID for alignable, space for param IDs

◆ parameterLabel() [1/2]

unsigned int MomentumDependentPedeLabeler::parameterLabel ( unsigned int  aliLabel,
unsigned int  parNum 
) const
overridevirtual

returns the label for a given alignable parameter number combination

Implements PedeLabelerBase.

Definition at line 121 of file MomentumDependentPedeLabeler.cc.

References Exception, and PedeLabelerBase::theMaxNumParam.

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

◆ parameterLabel() [2/2]

unsigned int MomentumDependentPedeLabeler::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 130 of file MomentumDependentPedeLabeler.cc.

References Alignable::alignableObjectId(), hcalRecHitTable_cff::detId, Exception, TrajectoryStateOnSurface::globalMomentum(), Alignable::id(), PV3DBase< T, PVType, FrameType >::mag(), HLT_IsoTrack_cff::offset, position, theAlignableToIdMap, theAlignableToMomentumRangeMap, PedeLabelerBase::theMaxNumParam, and PedeLabelerBase::theParamInstanceOffset.

133  {
134  if (!alignable)
135  return 0;
136 
137  if (parNum >= theMaxNumParam) {
138  throw cms::Exception("Alignment") << "@SUB=MomentumDependentPedeLabeler::parameterLabel"
139  << "Parameter number " << parNum << " out of range 0 <= num < " << theMaxNumParam;
140  }
141 
142  AlignableToIdMap::const_iterator position = theAlignableToIdMap.find(alignable);
143  if (position != theAlignableToIdMap.end()) {
144  AlignableToMomentumRangeMap::const_iterator positionAli = theAlignableToMomentumRangeMap.find(alignable);
145  if (positionAli != theAlignableToMomentumRangeMap.end()) {
146  MomentumRangeParamMap::const_iterator positionParam = (*positionAli).second.find(parNum);
147  if (positionParam != (*positionAli).second.end()) {
148  int offset = 0;
149  float mom = tsos.globalMomentum().mag();
150  const MomentumRangeVector &momentumRanges = (*positionParam).second;
151  for (const auto &iMomentum : momentumRanges) {
152  if (iMomentum.first <= mom && mom < iMomentum.second) {
153  return position->second + offset * theParamInstanceOffset + parNum;
154  }
155  offset++;
156  }
157  const DetId detId(alignable->id());
158  edm::LogError("LogicError") << "@SUB=MomentumDependentPedeLabeler::alignableLabel"
159  << "Alignable " << typeid(*alignable).name()
160  << " not in map, det/subdet/alignableStructureType = " << detId.det() << "/"
161  << detId.subdetId() << "/" << alignable->alignableObjectId();
162  return 0;
163  } else {
164  return position->second + parNum;
165  }
166 
167  } else {
168  return position->second + parNum;
169  }
170  } else {
171  const DetId detId(alignable->id());
172  //throw cms::Exception("LogicError")
173  edm::LogError("LogicError") << "@SUB=MomentumDependentPedeLabeler::alignableLabel"
174  << "Alignable " << typeid(*alignable).name()
175  << " not in map, det/subdet/alignableStructureType = " << detId.det() << "/"
176  << detId.subdetId() << "/" << alignable->alignableObjectId();
177  return 0;
178  }
179 }
Log< level::Error, false > LogError
static const unsigned int theMaxNumParam
T mag() const
Definition: PV3DBase.h:64
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
Definition: DetId.h:17
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:180
GlobalVector globalMomentum() const
static const unsigned int theParamInstanceOffset
std::vector< MomentumRange > MomentumRangeVector
static int position[264][3]
Definition: ReadPGInfo.cc:289
AlignableToMomentumRangeMap theAlignableToMomentumRangeMap
providing unique ID for alignable, space for param IDs

◆ paramNumFromLabel()

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

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

Implements PedeLabelerBase.

Definition at line 213 of file MomentumDependentPedeLabeler.cc.

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

Referenced by alignableLabelFromLabel().

213  {
214  if (paramLabel < theMinLabel) {
215  edm::LogError("LogicError") << "@SUB=MomentumDependentPedeLabeler::paramNumFromLabel"
216  << "Label " << paramLabel << " should be >= " << theMinLabel;
217  return 0;
218  }
220 }
static const unsigned int theMinLabel
Log< level::Error, false > LogError
static const unsigned int theParamInstanceOffset

Member Data Documentation

◆ theAlignableToIdMap

AlignableToIdMap MomentumDependentPedeLabeler::theAlignableToIdMap
private

◆ theAlignableToMomentumRangeMap

AlignableToMomentumRangeMap MomentumDependentPedeLabeler::theAlignableToMomentumRangeMap
private

providing unique ID for alignable, space for param IDs

Definition at line 95 of file MomentumDependentPedeLabeler.h.

Referenced by alignableLabelFromParamAndInstance(), buildMomentumDependencyMap(), hasSplitParameters(), numberOfParameterInstances(), and parameterLabel().

◆ theIdToAlignableMap

IdToAlignableMap MomentumDependentPedeLabeler::theIdToAlignableMap
private

providing unique ID for alignable, space for param IDs

Definition at line 96 of file MomentumDependentPedeLabeler.h.

Referenced by alignableFromLabel(), and buildReverseMap().

◆ theLabelToLasBeamMap

UintUintMap MomentumDependentPedeLabeler::theLabelToLasBeamMap
private

labels for las beams

Definition at line 98 of file MomentumDependentPedeLabeler.h.

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

◆ theLasBeamToLabelMap

UintUintMap MomentumDependentPedeLabeler::theLasBeamToLabelMap
private

reverse map

Definition at line 97 of file MomentumDependentPedeLabeler.h.

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

◆ theMaxNumberOfParameterInstances

unsigned int MomentumDependentPedeLabeler::theMaxNumberOfParameterInstances
private

◆ theOpenMomentumRange

const MomentumRange MomentumDependentPedeLabeler::theOpenMomentumRange
private

reverse of the above

Definition at line 99 of file MomentumDependentPedeLabeler.h.