CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Attributes
PedeLabelerBase Class Referenceabstract

#include <PedeLabelerBase.h>

Inheritance diagram for PedeLabelerBase:
MomentumDependentPedeLabeler PedeLabeler RunRangeDependentPedeLabeler

Classes

class  TopLevelAlignables
 

Public Types

using RunNumber = align::RunNumber
 
using RunRange = align::RunRange
 
using RunRanges = align::RunRanges
 

Public Member Functions

virtual void addCalibrations (const std::vector< IntegratedCalibrationBase * > &iCals)
 tell labeler to treat also integrated calibrations More...
 
const AlignableExtrasalignableExtras () const
 
virtual AlignablealignableFromLabel (unsigned int label) const =0
 
virtual unsigned int alignableLabel (Alignable *alignable) const =0
 
virtual unsigned int alignableLabelFromLabel (unsigned int label) const =0
 alignable label from parameter label (works also for alignable label...) More...
 
virtual unsigned int alignableLabelFromParamAndInstance (Alignable *alignable, unsigned int param, unsigned int instance) const =0
 
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
 
virtual bool hasSplitParameters (Alignable *alignable) const =0
 returns true if the alignable has parameters that are split into various bins More...
 
virtual unsigned int lasBeamIdFromLabel (unsigned int label) const =0
 
virtual unsigned int lasBeamLabel (unsigned int lasBeamId) const =0
 
virtual unsigned int maxNumberOfParameterInstances () const =0
 returns the maximum number of instances for any parameter of an Alignable* More...
 
virtual unsigned int numberOfParameterInstances (Alignable *alignable, int param=-1) const =0
 returns the number of instances for a given parameter More...
 
unsigned int parameterInstanceOffset () const
 offset in labels between consecutive parameter instances of Alignable*s More...
 
virtual unsigned int parameterLabel (unsigned int aliLabel, unsigned int parNum) const =0
 returns the label for a given alignable parameter number combination More...
 
virtual unsigned int parameterLabel (Alignable *alignable, unsigned int parNum, const AlignmentAlgorithmBase::EventInfo &eventInfo, const TrajectoryStateOnSurface &tsos) const =0
 
virtual unsigned int paramNumFromLabel (unsigned int paramLabel) const =0
 parameter number, 0 <= .. < theMaxNumParam, belonging to unique parameter label 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 ()
 

Static Public Attributes

static const unsigned int theMaxNumParam = RigidBodyAlignmentParameters::N_PARAM + 14
 
static const unsigned int theMinLabel = 1
 
static const unsigned int theParamInstanceOffset = 700000
 

Protected Member Functions

virtual unsigned int firstNonAlignableLabel () const
 
const AlignableObjectIdobjectIdProvider () const
 Return tracker alignable object ID provider derived from the tracker's geometry. More...
 

Protected Attributes

const RunRange theOpenRunRange
 

Private Attributes

const AlignableObjectId alignableObjectId_
 
std::vector< std::pair< IntegratedCalibrationBase *, unsigned int > > theCalibrationLabels
 pairs of calibrations and their first label More...
 
const TopLevelAlignables topLevelAlignables_
 

Detailed Description

Baseclass for pede labelers

Original author: Andreas Mussgiller, January 2011

Date
2011/02/18 17:08:13
Revision
1.2

(last update by

Author
mussgill

)

Definition at line 34 of file PedeLabelerBase.h.

Member Typedef Documentation

Definition at line 38 of file PedeLabelerBase.h.

Definition at line 39 of file PedeLabelerBase.h.

Definition at line 40 of file PedeLabelerBase.h.

Constructor & Destructor Documentation

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

constructor from three Alignables (null pointers allowed )

Definition at line 25 of file PedeLabelerBase.cc.

References PedeLabelerBase::TopLevelAlignables::aliMuon_, PedeLabelerBase::TopLevelAlignables::aliTracker_, and AlignableObjectId::commonObjectIdProvider().

26  :
27  theOpenRunRange(std::make_pair<RunNumber,RunNumber>(RunNumber(cond::timeTypeSpecs[cond::runnumber].beginValue), // since we know we have a runnumber here, we can
28  RunNumber(cond::timeTypeSpecs[cond::runnumber].endValue))), // simply convert the Time_t to make the compiler happy
29  topLevelAlignables_(alignables),
31  alignables.aliMuon_)}
32 {
33 
34 }
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:22
const TopLevelAlignables topLevelAlignables_
static AlignableObjectId commonObjectIdProvider(const AlignableObjectId &, const AlignableObjectId &)
const RunRange theOpenRunRange
align::RunNumber RunNumber
const AlignableObjectId alignableObjectId_
virtual PedeLabelerBase::~PedeLabelerBase ( )
inlinevirtual

Member Function Documentation

void PedeLabelerBase::addCalibrations ( const std::vector< IntegratedCalibrationBase * > &  iCals)
virtual

tell labeler to treat also integrated calibrations

Definition at line 109 of file PedeLabelerBase.cc.

References firstFreeLabel(), and theCalibrationLabels.

Referenced by ~PedeLabelerBase().

110 {
111  unsigned int nextId = this->firstFreeLabel(); // so far next free label
112 
113  // Now foresee labels for new calibrations:
114  for (auto iCal = iCals.begin(); iCal != iCals.end(); ++iCal) {
115  if (*iCal) {
116  theCalibrationLabels.push_back(std::make_pair(*iCal, nextId));
117  nextId += (*iCal)->numParameters();
118  } else {
119  edm::LogError("LogicError")
120  << "@SUB=PedeLabelerBase::addCalibrations" << "Ignoring nullPtr.";
121  }
122  }
123 }
std::vector< std::pair< IntegratedCalibrationBase *, unsigned int > > theCalibrationLabels
pairs of calibrations and their first label
virtual unsigned int firstFreeLabel() const
const AlignableExtras* PedeLabelerBase::alignableExtras ( ) const
inline

Definition at line 117 of file PedeLabelerBase.h.

References PedeLabelerBase::TopLevelAlignables::aliExtras_, and topLevelAlignables_.

const TopLevelAlignables topLevelAlignables_
virtual Alignable* PedeLabelerBase::alignableFromLabel ( unsigned int  label) const
pure virtual

Alignable from alignable or parameter label, null if no alignable (but error only if not las beam, either!)

Implemented in RunRangeDependentPedeLabeler, MomentumDependentPedeLabeler, and PedeLabeler.

Referenced by parameterInstanceOffset(), and PedeReader::setParameter().

virtual unsigned int PedeLabelerBase::alignableLabel ( Alignable alignable) const
pure virtual

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

Implemented in RunRangeDependentPedeLabeler, MomentumDependentPedeLabeler, and PedeLabeler.

Referenced by PedeReader::checkAliParams(), PedeSteerer::hierarchyConstraint(), PedeSteerer::presigmasFile(), PedeReader::setParameter(), and ~PedeLabelerBase().

virtual unsigned int PedeLabelerBase::alignableLabelFromLabel ( unsigned int  label) const
pure virtual

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

Implemented in RunRangeDependentPedeLabeler, MomentumDependentPedeLabeler, and PedeLabeler.

Referenced by parameterInstanceOffset().

virtual unsigned int PedeLabelerBase::alignableLabelFromParamAndInstance ( Alignable alignable,
unsigned int  param,
unsigned int  instance 
) const
pure 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

Implemented in RunRangeDependentPedeLabeler, MomentumDependentPedeLabeler, and PedeLabeler.

Referenced by PedeSteererWeakModeConstraints::constructConstraints(), PedeSteerer::fixParameter(), and ~PedeLabelerBase().

const AlignableMuon* PedeLabelerBase::alignableMuon ( ) const
inline

Definition at line 116 of file PedeLabelerBase.h.

References PedeLabelerBase::TopLevelAlignables::aliMuon_, and topLevelAlignables_.

116 { return topLevelAlignables_.aliMuon_; }
const TopLevelAlignables topLevelAlignables_
const AlignableTracker* PedeLabelerBase::alignableTracker ( ) const
inline

Definition at line 115 of file PedeLabelerBase.h.

References PedeLabelerBase::TopLevelAlignables::aliTracker_, and topLevelAlignables_.

const TopLevelAlignables topLevelAlignables_
unsigned int PedeLabelerBase::calibrationLabel ( const IntegratedCalibrationBase calib,
unsigned int  paramNum 
) const
virtual

label for parameter 'paramNum' (counted from 0) of an integrated calibration

Definition at line 79 of file PedeLabelerBase.cc.

References Exception, plotBeamSpotDB::first, IntegratedCalibrationBase::name(), and theCalibrationLabels.

Referenced by runRangeFromLabel().

81 {
82  if (!calib) {
83  throw cms::Exception("LogicError") << "PedeLabelerBase::calibrationLabel: "
84  << "nullPtr passed!\n";
85  }
86 
87  // loop on all known IntegratedCalibration's
88  for (auto iCal = theCalibrationLabels.begin(); iCal != theCalibrationLabels.end(); ++iCal) {
89  if (iCal->first == calib) { // found IntegratedCalibrationBase
90  if (paramNum < iCal->first->numParameters()) {
91  return iCal->second + paramNum;
92  } else { // paramNum out of range!
93  edm::LogError("LogicError")
94  << "@SUB=PedeLabelerBase::calibrationLabel" << "IntegratedCalibration "
95  << calib->name() << " has only " << iCal->first->numParameters()
96  << " parameters, but " << paramNum << "requested!";
97  }
98  }
99  }
100 
101  edm::LogError("LogicError")
102  << "@SUB=PedeLabelerBase::calibrationLabel" << "IntegratedCalibration "
103  << calib->name() << " not known or too few parameters.";
104 
105  return 0;
106 }
std::vector< std::pair< IntegratedCalibrationBase *, unsigned int > > theCalibrationLabels
pairs of calibrations and their first label
const std::string & name() const
name of this calibration
std::pair< IntegratedCalibrationBase *, unsigned int > PedeLabelerBase::calibrationParamFromLabel ( unsigned int  label) const
virtual

calibration and its parameter number from label, if label does not belong to any calibration return nullptr as pair.first

Definition at line 38 of file PedeLabelerBase.cc.

References edm::second(), and theCalibrationLabels.

Referenced by parameterInstanceOffset(), and PedeReader::read().

39 {
40  // Quick check whether label is in range of calibration labels:
41  if (!theCalibrationLabels.empty() && label >= theCalibrationLabels.front().second) {
42  // Loop on all known IntegratedCalibration's:
43  for (auto iCal = theCalibrationLabels.begin(); iCal != theCalibrationLabels.end(); ++iCal) {
44  if (label >= iCal->second && label < iCal->second + iCal->first->numParameters()) {
45  // Label fits in range for this calibration, so return calibration
46  // and subtract first label of this calibration from label.
47  return std::make_pair(iCal->first, label - iCal->second);
48  }
49  }
50  edm::LogError("LogicError") << "@SUB=PedeLabelerBase::calibrationParamFromLabel"
51  << "Label " << label << "larger than first calibration's label, "
52  << "but no calibration fits!";
53  }
54 
55  // Return that nothing fits:
56  return std::pair<IntegratedCalibrationBase*, unsigned int>(0,0);
57 }
std::vector< std::pair< IntegratedCalibrationBase *, unsigned int > > theCalibrationLabels
pairs of calibrations and their first label
U second(std::pair< T, U > const &p)
unsigned int PedeLabelerBase::firstFreeLabel ( ) const
virtual

first free label not yet used (for hacks within millepede...) valid only after last call to addCalibrations(..)

Definition at line 60 of file PedeLabelerBase.cc.

References firstNonAlignableLabel(), and theCalibrationLabels.

Referenced by addCalibrations(), and runRangeFromLabel().

61 {
62  unsigned int nextId = this->firstNonAlignableLabel();
63 
64  for (auto iCal = theCalibrationLabels.begin(); iCal != theCalibrationLabels.end(); ++iCal) {
65  nextId += iCal->first->numParameters();
66  }
67 
68  return nextId;
69 }
std::vector< std::pair< IntegratedCalibrationBase *, unsigned int > > theCalibrationLabels
pairs of calibrations and their first label
virtual unsigned int firstNonAlignableLabel() const
unsigned int PedeLabelerBase::firstNonAlignableLabel ( ) const
protectedvirtual

first free label after everything about Alignables and LAS beams (to be used for calibrations)

Definition at line 72 of file PedeLabelerBase.cc.

References maxNumberOfParameterInstances(), and parameterInstanceOffset().

Referenced by firstFreeLabel().

73 {
74 
75  return this->parameterInstanceOffset() * this->maxNumberOfParameterInstances() + 1;
76 }
virtual unsigned int maxNumberOfParameterInstances() const =0
returns the maximum number of instances for any parameter of an Alignable*
unsigned int parameterInstanceOffset() const
offset in labels between consecutive parameter instances of Alignable*s
virtual bool PedeLabelerBase::hasSplitParameters ( Alignable alignable) const
pure virtual

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

Implemented in RunRangeDependentPedeLabeler, MomentumDependentPedeLabeler, and PedeLabeler.

Referenced by ~PedeLabelerBase().

virtual unsigned int PedeLabelerBase::lasBeamIdFromLabel ( unsigned int  label) const
pure virtual

las beam id from las beam or parameter label zero and error if not a valid las beam label

Implemented in RunRangeDependentPedeLabeler, MomentumDependentPedeLabeler, and PedeLabeler.

Referenced by parameterInstanceOffset(), and PedeReader::setParameter().

virtual unsigned int PedeLabelerBase::lasBeamLabel ( unsigned int  lasBeamId) const
pure virtual
virtual unsigned int PedeLabelerBase::maxNumberOfParameterInstances ( ) const
pure virtual

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

Implemented in RunRangeDependentPedeLabeler, MomentumDependentPedeLabeler, and PedeLabeler.

Referenced by firstNonAlignableLabel(), PedeSteererWeakModeConstraints::PedeSteererWeakModeConstraints(), and ~PedeLabelerBase().

virtual unsigned int PedeLabelerBase::numberOfParameterInstances ( Alignable alignable,
int  param = -1 
) const
pure virtual

returns the number of instances for a given parameter

Implemented in RunRangeDependentPedeLabeler, MomentumDependentPedeLabeler, and PedeLabeler.

Referenced by PedeSteerer::fixParameters(), and ~PedeLabelerBase().

const AlignableObjectId& PedeLabelerBase::objectIdProvider ( ) const
inlineprotected

Return tracker alignable object ID provider derived from the tracker's geometry.

Definition at line 129 of file PedeLabelerBase.h.

References alignableObjectId_.

Referenced by MomentumDependentPedeLabeler::buildMomentumDependencyMap(), and RunRangeDependentPedeLabeler::buildRunRangeDependencyMap().

129 { return alignableObjectId_; }
const AlignableObjectId alignableObjectId_
unsigned int PedeLabelerBase::parameterInstanceOffset ( ) const
inline

offset in labels between consecutive parameter instances of Alignable*s

Definition at line 88 of file PedeLabelerBase.h.

References alignableFromLabel(), alignableLabelFromLabel(), calibrationParamFromLabel(), diffTwoXMLs::label, lasBeamIdFromLabel(), paramNumFromLabel(), and theParamInstanceOffset.

Referenced by firstNonAlignableLabel().

88 { return theParamInstanceOffset; }
static const unsigned int theParamInstanceOffset
virtual unsigned int PedeLabelerBase::parameterLabel ( unsigned int  aliLabel,
unsigned int  parNum 
) const
pure virtual
virtual unsigned int PedeLabelerBase::parameterLabel ( Alignable alignable,
unsigned int  parNum,
const AlignmentAlgorithmBase::EventInfo eventInfo,
const TrajectoryStateOnSurface tsos 
) const
pure virtual

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

Implemented in RunRangeDependentPedeLabeler, MomentumDependentPedeLabeler, and PedeLabeler.

virtual unsigned int PedeLabelerBase::paramNumFromLabel ( unsigned int  paramLabel) const
pure virtual

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

Implemented in RunRangeDependentPedeLabeler, MomentumDependentPedeLabeler, and PedeLabeler.

Referenced by parameterInstanceOffset(), and PedeReader::setParameter().

virtual const RunRange& PedeLabelerBase::runRangeFromLabel ( unsigned int  label) const
inlinevirtual

Reimplemented in RunRangeDependentPedeLabeler.

Definition at line 105 of file PedeLabelerBase.h.

References calibrationLabel(), firstFreeLabel(), and theOpenRunRange.

Referenced by PedeReader::read().

105  {
106  return theOpenRunRange;
107  }
const RunRange theOpenRunRange

Member Data Documentation

const AlignableObjectId PedeLabelerBase::alignableObjectId_
private

Definition at line 136 of file PedeLabelerBase.h.

Referenced by objectIdProvider().

std::vector<std::pair<IntegratedCalibrationBase*, unsigned int> > PedeLabelerBase::theCalibrationLabels
private

pairs of calibrations and their first label

Definition at line 139 of file PedeLabelerBase.h.

Referenced by addCalibrations(), calibrationLabel(), calibrationParamFromLabel(), and firstFreeLabel().

const unsigned int PedeLabelerBase::theMaxNumParam = RigidBodyAlignmentParameters::N_PARAM + 14
static
const unsigned int PedeLabelerBase::theMinLabel = 1
static
const RunRange PedeLabelerBase::theOpenRunRange
protected
const unsigned int PedeLabelerBase::theParamInstanceOffset = 700000
static
const TopLevelAlignables PedeLabelerBase::topLevelAlignables_
private

Definition at line 135 of file PedeLabelerBase.h.

Referenced by alignableExtras(), alignableMuon(), and alignableTracker().