CMS 3D CMS Logo

Public Member Functions | Private Types | Private Member Functions | Private Attributes

RunRangeDependentPedeLabeler Class Reference

#include <RunRangeDependentPedeLabeler.h>

Inheritance diagram for RunRangeDependentPedeLabeler:
PedeLabelerBase

List of all members.

Public Member Functions

AlignablealignableFromLabel (unsigned int label) const
unsigned int alignableLabel (Alignable *alignable) const
 Return 32-bit unique label for alignable, 0 indicates failure.
unsigned int alignableLabelFromLabel (unsigned int label) const
 alignable label from parameter label (works also for alignable label...)
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
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
unsigned int parameterLabel (Alignable *alignable, unsigned int parNum, const AlignmentAlgorithmBase::EventInfo &eventInfo, const TrajectoryStateOnSurface &tsos) const
unsigned int parameterLabel (unsigned int aliLabel, unsigned int parNum) const
 returns the label for a given alignable parameter number combination
unsigned int paramNumFromLabel (unsigned int paramLabel) const
 parameter number, 0 <= .. < theMaxNumParam, belonging to unique parameter label
 RunRangeDependentPedeLabeler (const PedeLabelerBase::TopLevelAlignables &alignables, const edm::ParameterSet &config)
 constructor from three Alignables (null pointers allowed )
const RunRangerunRangeFromLabel (unsigned int label) const
 ~RunRangeDependentPedeLabeler ()

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
unsigned int buildReverseMap ()
 returns size of map
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
IdToAlignableMap theIdToAlignableMap
 providing unique ID for alignable, space for param IDs
UintUintMap theLabelToLasBeamMap
 labels for las beams
UintUintMap theLasBeamToLabelMap
 reverse map

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().

  :PedeLabelerBase(alignables, config)
{
  std::vector<Alignable*> alis;
  alis.push_back(alignables.aliTracker_);
  alis.push_back(alignables.aliMuon_);

  if (alignables.aliExtras_) {
    align::Alignables allExtras = alignables.aliExtras_->components();
    for ( std::vector<Alignable*>::iterator it = allExtras.begin(); it != allExtras.end(); ++it ) {
      alis.push_back(*it);
    }
  }

  this->buildRunRangeDependencyMap(alignables.aliTracker_,
                                   alignables.aliMuon_,
                                   alignables.aliExtras_, 
                                   config);
  this->buildMap(alis);
}
RunRangeDependentPedeLabeler::~RunRangeDependentPedeLabeler ( )

non-virtual destructor: do not inherit from this class

Definition at line 50 of file RunRangeDependentPedeLabeler.cc.

{
}

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().

{
  const unsigned int aliLabel = this->alignableLabelFromLabel(label);
  if (aliLabel < theMinLabel) return 0; // error already given
  
  if (theIdToAlignableMap.empty()) const_cast<RunRangeDependentPedeLabeler*>(this)->buildReverseMap();
  IdToAlignableMap::const_iterator position = theIdToAlignableMap.find(aliLabel);
  if (position != theIdToAlignableMap.end()) {
    return position->second;
  } else {
    // error only if not in lasBeamMap:
    UintUintMap::const_iterator position = theLabelToLasBeamMap.find(aliLabel);
    if (position == theLabelToLasBeamMap.end()) {
      edm::LogError("LogicError") << "@SUB=RunRangeDependentPedeLabeler::alignableFromLabel"
                                  << "Alignable label " << aliLabel << " not in map.";
    }
    return 0;
  }
}
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().

{
  if (!alignable) return 0;

  AlignableToIdMap::const_iterator position = theAlignableToIdMap.find(alignable);
  if (position != theAlignableToIdMap.end()) {
    return position->second;
  } else {
    const DetId detId(alignable->id());
    //throw cms::Exception("LogicError") 
    edm::LogError("LogicError")
      << "@SUB=RunRangeDependentPedeLabeler::alignableLabel" << "Alignable "
      << typeid(*alignable).name() << " not in map, det/subdet/alignableStructureType = "
      << detId.det() << "/" << detId.subdetId() << "/" << alignable->alignableObjectId();
    return 0;
  }
}
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().

{
  return paramLabel - this->paramNumFromLabel(paramLabel);
}
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(), Exception, Alignable::id(), position, theAlignableToIdMap, theAlignableToRunRangeRangeMap, and PedeLabelerBase::theParamInstanceOffset.

{
  if (!alignable) return 0;
  
  AlignableToIdMap::const_iterator position = theAlignableToIdMap.find(alignable);
  if (position != theAlignableToIdMap.end()) {
    AlignableToRunRangeRangeMap::const_iterator positionAli = theAlignableToRunRangeRangeMap.find(alignable);
    if (positionAli != theAlignableToRunRangeRangeMap.end()) {
      RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(param);
      if (positionParam!=(*positionAli).second.end()) {
        if (instance>=(*positionParam).second.size()) {
          throw cms::Exception("Alignment") << "@SUB=RunRangeDependentPedeLabeler::alignableLabelFromParamAndRunRange" 
                                            << "RunRangeIdx out of bounds";
        }
        return position->second + instance * theParamInstanceOffset;
      } else {
        return position->second;
      }
    } else {
      return position->second;
    }
  } else {
    const DetId detId(alignable->id());
    //throw cms::Exception("LogicError") 
    edm::LogError("LogicError")
      << "@SUB=RunRangeDependentPedeLabeler::alignableLabel" << "Alignable "
      << typeid(*alignable).name() << " not in map, det/subdet/alignableStructureType = "
      << detId.det() << "/" << detId.subdetId() << "/" << alignable->alignableObjectId();
    return 0;
  }
}
unsigned int RunRangeDependentPedeLabeler::buildMap ( const std::vector< Alignable * > &  alis) [private]

returns size of map

Definition at line 455 of file RunRangeDependentPedeLabeler.cc.

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

Referenced by RunRangeDependentPedeLabeler().

{
  theAlignableToIdMap.clear(); // just in case of re-use...

  std::vector<Alignable*> allComps;
  
  for (std::vector<Alignable*>::const_iterator iAli = alis.begin(); iAli != alis.end(); ++iAli) {
    if (*iAli) {
      allComps.push_back(*iAli);
      (*iAli)->recursiveComponents(allComps);
    }
  }

  unsigned int id = theMinLabel;
  for (std::vector<Alignable*>::const_iterator iter = allComps.begin();
       iter != allComps.end(); ++iter) {
    theAlignableToIdMap.insert(AlignableToIdPair(*iter, id));
    id += theMaxNumParam;
  }
  
  // also care about las beams
  theLasBeamToLabelMap.clear(); // just in case of re-use...
  // FIXME: Temporarily hard code values stolen from 
  // https://twiki.cern.ch/twiki/bin/view/CMS/TkLasTrackBasedInterface#Beam_identifier .
  unsigned int beamIds[] = {  0,  10,  20,  30,  40,  50,  60,  70, // TEC+ R4
                              1,  11,  21,  31,  41,  51,  61,  71, // TEC+ R6
                            100, 110, 120, 130, 140, 150, 160, 170, // TEC- R4
                            101, 111, 121, 131, 141, 151, 161, 171, // TEC- R6
                            200, 210, 220, 230, 240, 250, 260, 270};// AT

  const size_t nBeams = sizeof(beamIds)/sizeof(beamIds[0]);
  for (size_t iBeam = 0; iBeam < nBeams; ++iBeam) {
    //edm::LogInfo("Alignment") << "Las beam " << beamIds[iBeam] << " gets label " << id << ".";
    theLasBeamToLabelMap[beamIds[iBeam]] = id;
    id += theMaxNumParam;
  }

  // return combined size
  return theAlignableToIdMap.size() + theLasBeamToLabelMap.size();
}
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.

{

  // alignables
  theIdToAlignableMap.clear();  // just in case of re-use...

  for (AlignableToIdMap::iterator it = theAlignableToIdMap.begin();
       it != theAlignableToIdMap.end(); ++it) {
    const unsigned int key = (*it).second;
    Alignable *ali = (*it).first;
    const unsigned int nInstances = this->numberOfParameterInstances(ali, -1);
    for (unsigned int iInstance=0;iInstance<nInstances;++iInstance) {
      theIdToAlignableMap[key+iInstance*theParamInstanceOffset] = ali;
    }
  }
  
  // las beams
  theLabelToLasBeamMap.clear(); // just in case of re-use...

  for (UintUintMap::const_iterator it = theLasBeamToLabelMap.begin();
       it != theLasBeamToLabelMap.end(); ++it) {
    theLabelToLasBeamMap[it->second] = it->first; //revert key/value
  }

  // return combined size
  return theIdToAlignableMap.size() + theLabelToLasBeamMap.size();
}
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(), AlignmentParameterSelector::clear(), convertParamSel(), decompose(), 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().

{
  static bool oldRunRangeSelectionWarning = false;

  theAlignableToRunRangeRangeMap.clear();

  AlignmentParameterSelector selector(aliTracker, aliMuon, aliExtras);
  
  std::vector<char> paramSelDummy(6, '1');
  
  const std::vector<edm::ParameterSet> RunRangeSelectionVPSet =
    config.getUntrackedParameter<std::vector<edm::ParameterSet> >("RunRangeSelection");
  
  for (std::vector<edm::ParameterSet>::const_iterator iter = RunRangeSelectionVPSet.begin();
       iter != RunRangeSelectionVPSet.end();
       ++iter) {
    
    const std::vector<std::string> tempRunRanges = (*iter).getParameter<std::vector<std::string> >("RunRanges");
    if (tempRunRanges.size()==0) {
      throw cms::Exception("BadConfig") << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
                                        << "RunRanges empty\n";
    }

    RunRangeVector RunRanges;
    cond::Time_t first;
    long int temp;
    for (std::vector<std::string>::const_iterator iRunRange = tempRunRanges.begin();
         iRunRange != tempRunRanges.end();
         ++iRunRange) {
      if ((*iRunRange).find(':')==std::string::npos) {
        
        first = cond::timeTypeSpecs[cond::runnumber].beginValue;
        temp = strtol((*iRunRange).c_str(), 0, 0);
        if (temp!=-1) first = temp;
        
      } else {
        
        if (!oldRunRangeSelectionWarning) {
          edm::LogWarning("BadConfig") << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap"
                                       << "Config file contains old format for 'RunRangeSelection'. Only the start run\n"
                                       << "number is used internally. The number of the last run is ignored and can be\n"
                                       << "safely removed from the config file.\n";
          oldRunRangeSelectionWarning = true;
        }

        std::vector<std::string> tokens = edm::tokenize(*iRunRange, ":");
        first = cond::timeTypeSpecs[cond::runnumber].beginValue;
        temp = strtol(tokens[0].c_str(), 0, 0);
        if (temp!=-1) first = temp;
        
      }
      
      RunRanges.push_back(std::pair<cond::Time_t,cond::Time_t>(first, cond::timeTypeSpecs[cond::runnumber].endValue));
    }
    
    for (unsigned int i = 0;i<RunRanges.size()-1;++i) {
      RunRanges[i].second = RunRanges[i+1].first - 1;
      if (RunRanges[i].first > RunRanges[i].second) {
        throw cms::Exception("BadConfig") << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
                                          << "Inconsistency in 'RunRangeSelection' parameter set.";
      }
    }
    
    const std::vector<std::string> selStrings = (*iter).getParameter<std::vector<std::string> >("selector");
    for (std::vector<std::string>::const_iterator iSel = selStrings.begin();
         iSel != selStrings.end();
         ++iSel) {
      std::vector<std::string> decompSel(this->decompose(*iSel, ','));
      
      if (decompSel.size()!=2) {
        throw cms::Exception("BadConfig") << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
                                          << *iSel <<" should have at least 2 ','-separated parts\n";
      }

      std::vector<unsigned int> selParam = this->convertParamSel(decompSel[1]);
      selector.clear();
      selector.addSelection(decompSel[0], paramSelDummy);

      const std::vector<Alignable*> &alis = selector.selectedAlignables();
      for (std::vector<Alignable*>::const_iterator iAli = alis.begin();
           iAli != alis.end();
           ++iAli) {
        for (std::vector<unsigned int>::const_iterator iParam = selParam.begin();
             iParam != selParam.end();
             ++iParam) {
          AlignableToRunRangeRangeMap::const_iterator positionAli = theAlignableToRunRangeRangeMap.find(*iAli);
          if (positionAli!=theAlignableToRunRangeRangeMap.end()) {
            
            AlignmentParameters *AliParams = (*positionAli).first->alignmentParameters();
            if (static_cast<int>(selParam[selParam.size()-1]) >= AliParams->size()) {
              throw cms::Exception("BadConfig") << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
                                                << "mismatch in number of parameters\n";
            }
            
            RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(*iParam);
            if (positionParam!=(*positionAli).second.end()) {
              throw cms::Exception("BadConfig") << "@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
                                                << "RunRange range for parameter specified twice\n";
            }
          }
          
          theAlignableToRunRangeRangeMap[*iAli][*iParam] = RunRanges;
        }
      }
    }
  }
  
  return theAlignableToRunRangeRangeMap.size();
}
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().

{
  std::vector<unsigned int> result;
  for (std::string::size_type pos = 0; pos < selString.size(); ++pos) {
    if (selString[pos]=='1') result.push_back(pos);
  }
  return result;
}
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().

{
  std::vector<std::string> result;

  std::string::size_type previousPos = 0;
  while (true) {
    const std::string::size_type delimiterPos = s.find(delimiter, previousPos);
    if (delimiterPos == std::string::npos) {
      result.push_back(s.substr(previousPos)); // until end
      break;
    }
    result.push_back(s.substr(previousPos, delimiterPos - previousPos));
    previousPos = delimiterPos + 1; // +1: skip delimiter
  }

  return result;
}
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.

{
  AlignableToRunRangeRangeMap::const_iterator positionAli = theAlignableToRunRangeRangeMap.find(alignable);
  if (positionAli != theAlignableToRunRangeRangeMap.end()) return true;
  return false;
}
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.

{
  const unsigned int aliLabel = this->alignableLabelFromLabel(label);
  if (aliLabel < theMinLabel) return 0; // error already given
  
  if (theLabelToLasBeamMap.empty()) const_cast<RunRangeDependentPedeLabeler*>(this)->buildReverseMap();
  UintUintMap::const_iterator position = theLabelToLasBeamMap.find(aliLabel);
  if (position != theLabelToLasBeamMap.end()) {
    return position->second;
  } else {
    edm::LogError("LogicError") << "@SUB=RunRangeDependentPedeLabeler::lasBeamIdFromLabel"
                                << "Alignable label " << aliLabel << " not in map.";
    return 0;
  }
}
unsigned int RunRangeDependentPedeLabeler::lasBeamLabel ( unsigned int  lasBeamId) const [virtual]

Implements PedeLabelerBase.

Definition at line 111 of file RunRangeDependentPedeLabeler.cc.

References position, and theLasBeamToLabelMap.

{
  UintUintMap::const_iterator position = theLasBeamToLabelMap.find(lasBeamId);
  if (position != theLasBeamToLabelMap.end()) {
    return position->second;
  } else {
    //throw cms::Exception("LogicError") 
    edm::LogError("LogicError") << "@SUB=RunRangeDependentPedeLabeler::lasBeamLabel"
                                << "No label for beam Id " << lasBeamId;
    return 0;
  }
}
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().

{
  AlignableToRunRangeRangeMap::const_iterator positionAli = theAlignableToRunRangeRangeMap.find(alignable);
  if (positionAli != theAlignableToRunRangeRangeMap.end()) {

    size_t nRunRanges = 1;
    if (param==-1) {
      for (RunRangeParamMap::const_iterator iParam = (*positionAli).second.begin();
           iParam != (*positionAli).second.end();
           ++iParam) {
        nRunRanges = std::max(nRunRanges, iParam->second.size());
      }
      return nRunRanges;
    } else {
      RunRangeParamMap::const_iterator iParam = (*positionAli).second.find(param);
      if (iParam != (*positionAli).second.end()) {
        return iParam->second.size();
      } else {
        return 1;
      }
    }
  }
  
  return 1;
}
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_, Exception, Alignable::id(), evf::evtn::offset(), position, edm::EventID::run(), theAlignableToIdMap, theAlignableToRunRangeRangeMap, PedeLabelerBase::theMaxNumParam, and PedeLabelerBase::theParamInstanceOffset.

{
  if (!alignable) return 0;
  
  if (parNum >= theMaxNumParam) {
    throw cms::Exception("Alignment") << "@SUB=RunRangeDependentPedeLabeler::parameterLabel" 
                                      << "Parameter number " << parNum 
                                      << " out of range 0 <= num < " << theMaxNumParam;
  }
  
  AlignableToIdMap::const_iterator position = theAlignableToIdMap.find(alignable);
  if (position != theAlignableToIdMap.end()) {

    AlignableToRunRangeRangeMap::const_iterator positionAli = theAlignableToRunRangeRangeMap.find(alignable);
    if (positionAli != theAlignableToRunRangeRangeMap.end()) {
      
      RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(parNum);
      if (positionParam!=(*positionAli).second.end()) {
        
        int offset = 0;
        const RunRangeVector & runRanges = (*positionParam).second;
        for (RunRangeVector::const_iterator iRunRange = runRanges.begin();
             iRunRange != runRanges.end();
             ++iRunRange) {
          if (eventInfo.eventId_.run() >= iRunRange->first &&
              eventInfo.eventId_.run() <= iRunRange->second) {
            return position->second + offset * theParamInstanceOffset + parNum;
          }
          offset++;
        }
        const DetId detId(alignable->id());
        edm::LogError("LogicError")
          << "@SUB=RunRangeDependentPedeLabeler::parameterLabel" << "Instance for Alignable "
          << typeid(*alignable).name() << " not in map, det/subdet/alignableStructureType = "
          << detId.det() << "/" << detId.subdetId() << "/" << alignable->alignableObjectId()
          << " for run " << eventInfo.eventId_.run();
        return 0;
      } else {
        return position->second + parNum;
      }

    } else {
      return position->second + parNum;
    }
  } else {
    const DetId detId(alignable->id());
    //throw cms::Exception("LogicError") 
    edm::LogError("LogicError")
      << "@SUB=RunRangeDependentPedeLabeler::parameterLabel" << "Alignable "
      << typeid(*alignable).name() << " not in map, det/subdet/alignableStructureType = "
      << detId.det() << "/" << detId.subdetId() << "/" << alignable->alignableObjectId();
    return 0;
  } 
}
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 Exception, and PedeLabelerBase::theMaxNumParam.

{
  if (parNum >= theMaxNumParam) {
    throw cms::Exception("Alignment") << "@SUB=RunRangeDependentPedeLabeler::parameterLabel" 
                                      << "Parameter number " << parNum 
                                      << " out of range 0 <= num < " << theMaxNumParam;
  }
  return aliLabel + parNum;
}
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().

{
  if (paramLabel < theMinLabel) {
    edm::LogError("LogicError") << "@SUB=RunRangeDependentPedeLabeler::paramNumFromLabel"
                                << "Label " << paramLabel << " should be >= " << theMinLabel;
    return 0;
  }
  return (paramLabel - theMinLabel) % 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.

{
  Alignable* ali = alignableFromLabel(label);

  AlignableToRunRangeRangeMap::const_iterator positionAli = theAlignableToRunRangeRangeMap.find(ali);
  if (positionAli==theAlignableToRunRangeRangeMap.end())
    return theOpenRunRange;
  
  unsigned int firstLabel = alignableLabel(ali);
  unsigned int runRangeIndex = (label-firstLabel)/theParamInstanceOffset;
  unsigned int paramNum = this->paramNumFromLabel(label);

  RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(paramNum);
  if (positionParam==(*positionAli).second.end()) {
    return theOpenRunRange;
  }
  
  return positionParam->second[runRangeIndex];
}
unsigned int RunRangeDependentPedeLabeler::runRangeIndexFromLabel ( unsigned int  label) const [private]

Definition at line 283 of file RunRangeDependentPedeLabeler.cc.

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

{
  Alignable* ali = alignableFromLabel(label);
  unsigned int firstLabel = alignableLabel(ali);
  return (label-firstLabel)/theMaxNumParam;
}

Member Data Documentation

providing unique ID for alignable, space for param IDs

Definition at line 104 of file RunRangeDependentPedeLabeler.h.

Referenced by alignableFromLabel(), and buildReverseMap().

labels for las beams

Definition at line 106 of file RunRangeDependentPedeLabeler.h.

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

reverse map

Definition at line 105 of file RunRangeDependentPedeLabeler.h.

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