CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Attributes

PedeLabelerBase Class Reference

#include <PedeLabelerBase.h>

Inheritance diagram for PedeLabelerBase:
MomentumDependentPedeLabeler PedeLabeler RunRangeDependentPedeLabeler

List of all members.

Classes

class  TopLevelAlignables

Public Types

typedef
AlignmentAlgorithmBase::RunNumber 
RunNumber
typedef
AlignmentAlgorithmBase::RunRange 
RunRange
typedef std::vector< RunRangeRunRanges

Public Member Functions

virtual void addCalibrations (const std::vector< IntegratedCalibrationBase * > &iCals)
 tell labeler to treat also integrated calibrations
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...)
virtual unsigned int alignableLabelFromParamAndInstance (Alignable *alignable, unsigned int param, unsigned int instance) const =0
virtual unsigned int calibrationLabel (const IntegratedCalibrationBase *calib, unsigned int paramNum) const
 label for parameter 'paramNum' (counted from 0) of an integrated calibration
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
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*
virtual unsigned int numberOfParameterInstances (Alignable *alignable, int param=-1) const =0
 returns the number of instances for a given parameter
unsigned int parameterInstanceOffset () const
 offset in labels between consecutive parameter instances of Alignable*s
virtual unsigned int parameterLabel (unsigned int aliLabel, unsigned int parNum) const =0
 returns the label for a given alignable parameter number combination
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
 PedeLabelerBase (const TopLevelAlignables &alignables, const edm::ParameterSet &config)
 constructor from three Alignables (null pointers allowed )
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

Protected Attributes

const RunRange theOpenRunRange

Private Attributes

std::vector< std::pair
< IntegratedCalibrationBase
*, unsigned int > > 
theCalibrationLabels
 pairs of calibrations and their first label

Detailed Description

Baseclass for pede labelers

Original author: Andreas Mussgiller, January 2011

Date:
2012/08/10 09:01:11
Revision:
1.3

(last update by

Author:
flucke

)

Definition at line 32 of file PedeLabelerBase.h.


Member Typedef Documentation

Definition at line 36 of file PedeLabelerBase.h.

Definition at line 37 of file PedeLabelerBase.h.

typedef std::vector<RunRange> PedeLabelerBase::RunRanges

Definition at line 38 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.

  :theOpenRunRange(std::make_pair<RunNumber,RunNumber>(cond::timeTypeSpecs[cond::runnumber].beginValue,
                                                       cond::timeTypeSpecs[cond::runnumber].endValue))
{
  
}
virtual PedeLabelerBase::~PedeLabelerBase ( ) [inline, virtual]

Definition at line 55 of file PedeLabelerBase.h.

{}

Member Function Documentation

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

tell labeler to treat also integrated calibrations

Definition at line 106 of file PedeLabelerBase.cc.

References firstFreeLabel(), and theCalibrationLabels.

Referenced by MillePedeAlignmentAlgorithm::addCalibrations().

{
  unsigned int nextId = this->firstFreeLabel(); // so far next free label

  // Now foresee labels for new calibrations:
  for (auto iCal = iCals.begin(); iCal != iCals.end(); ++iCal) {
    if (*iCal) {
      theCalibrationLabels.push_back(std::make_pair(*iCal, nextId));
      nextId += (*iCal)->numParameters();
    } else {
      edm::LogError("LogicError")
        << "@SUB=PedeLabelerBase::addCalibrations" << "Ignoring nullPtr.";
    }
  }
}
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 MomentumDependentPedeLabeler, PedeLabeler, and RunRangeDependentPedeLabeler.

Referenced by 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 MomentumDependentPedeLabeler, PedeLabeler, and RunRangeDependentPedeLabeler.

Referenced by MillePedeAlignmentAlgorithm::addPxbSurvey(), MillePedeAlignmentAlgorithm::buildUserVariables(), PedeReader::checkAliParams(), PedeSteerer::hierarchyConstraint(), PedeSteerer::presigmasFile(), and PedeReader::setParameter().

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

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

Implemented in MomentumDependentPedeLabeler, PedeLabeler, and RunRangeDependentPedeLabeler.

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 MomentumDependentPedeLabeler, PedeLabeler, and RunRangeDependentPedeLabeler.

Referenced by PedeSteerer::fixParameter().

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 76 of file PedeLabelerBase.cc.

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

Referenced by MillePedeAlignmentAlgorithm::globalDerivativesCalibration().

{
  if (!calib) {
    throw cms::Exception("LogicError") << "PedeLabelerBase::calibrationLabel: "
                                       << "nullPtr passed!\n";
  }

  // loop on all known IntegratedCalibration's
  for (auto iCal = theCalibrationLabels.begin(); iCal != theCalibrationLabels.end(); ++iCal) {
    if (iCal->first == calib) { // found IntegratedCalibrationBase
      if (paramNum < iCal->first->numParameters()) {
        return iCal->second + paramNum;
      } else { // paramNum out of range!
        edm::LogError("LogicError")
          << "@SUB=PedeLabelerBase::calibrationLabel" << "IntegratedCalibration "
          << calib->name() << " has only " << iCal->first->numParameters()
          << " parameters, but " << paramNum << "requested!";
      }
    }
  }
  
  edm::LogError("LogicError")
    << "@SUB=PedeLabelerBase::calibrationLabel" << "IntegratedCalibration "
    << calib->name() << " not known or too few parameters.";
  
  return 0;
}
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 35 of file PedeLabelerBase.cc.

References edm::second(), and theCalibrationLabels.

Referenced by PedeReader::read().

{
  // Quick check whether label is in range of calibration labels:
  if (!theCalibrationLabels.empty() && label >= theCalibrationLabels.front().second) {
    // Loop on all known IntegratedCalibration's:
    for (auto iCal = theCalibrationLabels.begin(); iCal != theCalibrationLabels.end(); ++iCal) {
      if (label >= iCal->second && label < iCal->second + iCal->first->numParameters()) {
        // Label fits in range for this calibration, so return calibration
        // and subtract first label of this calibration from label.
        return std::make_pair(iCal->first, label - iCal->second);
      }
    }
    edm::LogError("LogicError") << "@SUB=PedeLabelerBase::calibrationParamFromLabel"
                                << "Label " << label << "larger than first calibration's label, "
                                << "but no calibration fits!";
  }

  // Return that nothing fits:
  return std::pair<IntegratedCalibrationBase*, unsigned int>(0,0);
}
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 57 of file PedeLabelerBase.cc.

References firstNonAlignableLabel(), and theCalibrationLabels.

Referenced by addCalibrations().

{
  unsigned int nextId = this->firstNonAlignableLabel();

  for (auto iCal = theCalibrationLabels.begin(); iCal != theCalibrationLabels.end(); ++iCal) {
    nextId += iCal->first->numParameters();
  }

  return nextId;
}
unsigned int PedeLabelerBase::firstNonAlignableLabel ( ) const [protected, virtual]

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

Definition at line 69 of file PedeLabelerBase.cc.

References maxNumberOfParameterInstances(), and parameterInstanceOffset().

Referenced by firstFreeLabel().

{
  
  return this->parameterInstanceOffset() * this->maxNumberOfParameterInstances() + 1;
}
virtual bool PedeLabelerBase::hasSplitParameters ( Alignable alignable) const [pure virtual]

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

Implemented in MomentumDependentPedeLabeler, PedeLabeler, and RunRangeDependentPedeLabeler.

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 MomentumDependentPedeLabeler, PedeLabeler, and RunRangeDependentPedeLabeler.

Referenced by 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 MomentumDependentPedeLabeler, PedeLabeler, and RunRangeDependentPedeLabeler.

Referenced by firstNonAlignableLabel().

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

returns the number of instances for a given parameter

Implemented in MomentumDependentPedeLabeler, PedeLabeler, and RunRangeDependentPedeLabeler.

Referenced by PedeSteerer::fixParameters().

unsigned int PedeLabelerBase::parameterInstanceOffset ( ) const [inline]

offset in labels between consecutive parameter instances of Alignable*s

Definition at line 86 of file PedeLabelerBase.h.

References theParamInstanceOffset.

Referenced by firstNonAlignableLabel().

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 MomentumDependentPedeLabeler, PedeLabeler, and RunRangeDependentPedeLabeler.

virtual unsigned int PedeLabelerBase::parameterLabel ( unsigned int  aliLabel,
unsigned int  parNum 
) const [pure virtual]
virtual unsigned int PedeLabelerBase::paramNumFromLabel ( unsigned int  paramLabel) const [pure virtual]

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

Implemented in MomentumDependentPedeLabeler, PedeLabeler, and RunRangeDependentPedeLabeler.

Referenced by PedeReader::setParameter().

virtual const RunRange& PedeLabelerBase::runRangeFromLabel ( unsigned int  label) const [inline, virtual]

Reimplemented in RunRangeDependentPedeLabeler.

Definition at line 103 of file PedeLabelerBase.h.

References theOpenRunRange.

Referenced by PedeReader::read().

                                                                      {
    return theOpenRunRange;
  }

Member Data Documentation

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

pairs of calibrations and their first label

Definition at line 127 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 unsigned int PedeLabelerBase::theParamInstanceOffset = 700000 [static]