CMS 3D CMS Logo

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

MomentumDependentPedeLabeler Class Reference

#include <MomentumDependentPedeLabeler.h>

Inheritance diagram for MomentumDependentPedeLabeler:
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
 MomentumDependentPedeLabeler (const PedeLabelerBase::TopLevelAlignables &alignables, const edm::ParameterSet &config)
 constructor from three Alignables (null pointers allowed )
unsigned int numberOfParameterInstances (Alignable *alignable, int param=-1) const
 returns the number of instances for a given parameter
unsigned int parameterLabel (unsigned int aliLabel, unsigned int parNum) const
 returns the label for a given alignable parameter number combination
unsigned int parameterLabel (Alignable *alignable, unsigned int parNum, const AlignmentAlgorithmBase::EventInfo &eventInfo, const TrajectoryStateOnSurface &tsos) const
unsigned int paramNumFromLabel (unsigned int paramLabel) const
 parameter number, 0 <= .. < theMaxNumParam, belonging to unique parameter label
 ~MomentumDependentPedeLabeler ()

Private Types

typedef std::map< Alignable
*, unsigned int > 
AlignableToIdMap
typedef
AlignableToIdMap::value_type 
AlignableToIdPair
typedef std::map< Alignable
*, MomentumRangeParamMap
AlignableToMomentumRangeMap
typedef
AlignableToMomentumRangeMap::value_type 
AlignableToMomentumRangePair
typedef std::map< unsigned int,
Alignable * > 
IdToAlignableMap
typedef std::pair< float, float > MomentumRange
typedef std::map< unsigned int,
MomentumRangeVector
MomentumRangeParamMap
typedef std::vector
< MomentumRange
MomentumRangeVector
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 buildMomentumDependencyMap (AlignableTracker *aliTracker, AlignableMuon *aliMuon, AlignableExtras *extras, const edm::ParameterSet &config)
unsigned int buildReverseMap ()
 returns size of map
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
IdToAlignableMap theIdToAlignableMap
 providing unique ID for alignable, space for param IDs
UintUintMap theLabelToLasBeamMap
 labels for las beams
UintUintMap theLasBeamToLabelMap
 reverse map
const MomentumRange theOpenMomentumRange
 reverse of the above

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 25 of file MomentumDependentPedeLabeler.h.


Member Typedef Documentation

typedef std::map<Alignable*, unsigned int> MomentumDependentPedeLabeler::AlignableToIdMap [private]

Definition at line 71 of file MomentumDependentPedeLabeler.h.

typedef AlignableToIdMap::value_type MomentumDependentPedeLabeler::AlignableToIdPair [private]

Definition at line 72 of file MomentumDependentPedeLabeler.h.

Definition at line 76 of file MomentumDependentPedeLabeler.h.

typedef AlignableToMomentumRangeMap::value_type MomentumDependentPedeLabeler::AlignableToMomentumRangePair [private]

Definition at line 77 of file MomentumDependentPedeLabeler.h.

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

Definition at line 78 of file MomentumDependentPedeLabeler.h.

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

Definition at line 73 of file MomentumDependentPedeLabeler.h.

Definition at line 75 of file MomentumDependentPedeLabeler.h.

Definition at line 74 of file MomentumDependentPedeLabeler.h.

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

Definition at line 79 of file MomentumDependentPedeLabeler.h.


Constructor & Destructor Documentation

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

constructor from three Alignables (null pointers allowed )

Definition at line 26 of file MomentumDependentPedeLabeler.cc.

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

  :PedeLabelerBase(alignables, config),
   theOpenMomentumRange(std::pair<float,float>(0.0, 10000.0))
{
  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->buildMomentumDependencyMap(alignables.aliTracker_,
                                   alignables.aliMuon_,
                                   alignables.aliExtras_, 
                                   config);
  this->buildMap(alis);
}
MomentumDependentPedeLabeler::~MomentumDependentPedeLabeler ( )

non-virtual destructor: do not inherit from this class

Definition at line 51 of file MomentumDependentPedeLabeler.cc.

{
}

Member Function Documentation

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

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

{
  const unsigned int aliLabel = this->alignableLabelFromLabel(label);
  if (aliLabel < theMinLabel) return 0; // error already given
  
  if (theIdToAlignableMap.empty()) const_cast<MomentumDependentPedeLabeler*>(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=MomentumDependentPedeLabeler::alignableFromLabel"
                                  << "Alignable label " << aliLabel << " not in map.";
    }
    return 0;
  }
}
unsigned int MomentumDependentPedeLabeler::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 57 of file MomentumDependentPedeLabeler.cc.

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

{
  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=MomentumDependentPedeLabeler::alignableLabel" << "Alignable "
      << typeid(*alignable).name() << " not in map, det/subdet/alignableStructureType = "
      << detId.det() << "/" << detId.subdetId() << "/" << alignable->alignableObjectId();
    return 0;
  }
}
unsigned int MomentumDependentPedeLabeler::alignableLabelFromLabel ( unsigned int  label) const [virtual]

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

Implements PedeLabelerBase.

Definition at line 241 of file MomentumDependentPedeLabeler.cc.

References paramNumFromLabel().

Referenced by alignableFromLabel(), and lasBeamIdFromLabel().

{
  return paramLabel - this->paramNumFromLabel(paramLabel);
}
unsigned int MomentumDependentPedeLabeler::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 77 of file MomentumDependentPedeLabeler.cc.

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

{
  if (!alignable) return 0;
  
  AlignableToIdMap::const_iterator position = theAlignableToIdMap.find(alignable);
  if (position != theAlignableToIdMap.end()) {
    AlignableToMomentumRangeMap::const_iterator positionAli = theAlignableToMomentumRangeMap.find(alignable);
    if (positionAli != theAlignableToMomentumRangeMap.end()) {
      MomentumRangeParamMap::const_iterator positionParam = (*positionAli).second.find(param);
      if (positionParam!=(*positionAli).second.end()) {
        if (instance>=(*positionParam).second.size()) {
          throw cms::Exception("Alignment") << "@SUB=MomentumDependentPedeLabeler::alignableLabelFromParamAndMomentum" 
                                            << "iovIdx 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=MomentumDependentPedeLabeler::alignableLabel" << "Alignable "
      << typeid(*alignable).name() << " not in map, det/subdet/alignableStructureType = "
      << detId.det() << "/" << detId.subdetId() << "/" << alignable->alignableObjectId();
    return 0;
  }
}
unsigned int MomentumDependentPedeLabeler::buildMap ( const std::vector< Alignable * > &  alis) [private]

returns size of map

Definition at line 398 of file MomentumDependentPedeLabeler.cc.

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

Referenced by MomentumDependentPedeLabeler().

{
  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 MomentumDependentPedeLabeler::buildMomentumDependencyMap ( AlignableTracker aliTracker,
AlignableMuon aliMuon,
AlignableExtras extras,
const edm::ParameterSet config 
) [private]

Definition at line 314 of file MomentumDependentPedeLabeler.cc.

References AlignmentParameterSelector::addSelection(), AlignmentParameterSelector::clear(), convertParamSel(), decompose(), Exception, edm::ParameterSet::getParameter(), AlignmentParameterSelector::selectedAlignables(), AlignmentParameters::size(), theAlignableToMomentumRangeMap, edm::tokenize(), and pileupCalc::upper.

Referenced by MomentumDependentPedeLabeler().

{
  theAlignableToMomentumRangeMap.clear();
  
  AlignmentParameterSelector selector(aliTracker, aliMuon, aliExtras);
  
  std::vector<char> paramSelDumthe(6, '1');
  
  const std::vector<edm::ParameterSet> parameterInstancesVPSet =
    config.getParameter<std::vector<edm::ParameterSet> >("parameterInstances");
  
  for (std::vector<edm::ParameterSet>::const_iterator iter = parameterInstancesVPSet.begin();
       iter != parameterInstancesVPSet.end();
       ++iter) {

    const std::vector<std::string> tempMomentumRanges = (*iter).getParameter<std::vector<std::string> >("momentumRanges");
    if (tempMomentumRanges.size()==0) {
      throw cms::Exception("BadConfig") << "@SUB=MomentumDependentPedeLabeler::buildMomentumDependencyMap\n"
                                        << "MomentumRanges empty\n";
    }

    MomentumRangeVector MomentumRanges;
    float lower;
    float upper;
    for (unsigned int iMomentum=0;iMomentum<tempMomentumRanges.size();++iMomentum) {
      std::vector<std::string> tokens = edm::tokenize(tempMomentumRanges[iMomentum], ":");
      
      lower = strtod(tokens[0].c_str(), 0);
      upper = strtod(tokens[1].c_str(), 0);

      MomentumRanges.push_back(std::pair<float,float>(lower, upper));
    }
    
    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=MomentumDependentPedeLabeler::buildMomentumDependencyMap\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], paramSelDumthe);

      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) {
          AlignableToMomentumRangeMap::const_iterator positionAli = theAlignableToMomentumRangeMap.find(*iAli);
          if (positionAli!=theAlignableToMomentumRangeMap.end()) {
            
            AlignmentParameters *AliParams = (*positionAli).first->alignmentParameters();
            if (static_cast<int>(selParam[selParam.size()-1]) >= AliParams->size()) {
              throw cms::Exception("BadConfig") << "@SUB=MomentumDependentPedeLabeler::buildMomentumDependencyMap\n"
                                                << "mismatch in number of parameters\n";
            }
            
            MomentumRangeParamMap::const_iterator positionParam = (*positionAli).second.find(*iParam);
            if (positionParam!=(*positionAli).second.end()) {
              throw cms::Exception("BadConfig") << "@SUB=MomentumDependentPedeLabeler::buildMomentumDependencyMap\n"
                                                << "Momentum range for parameter specified twice\n";
            }
          }
          
          theAlignableToMomentumRangeMap[*iAli][*iParam] = MomentumRanges;
        }
      }
    }
  }
  
  return theAlignableToMomentumRangeMap.size();
}
unsigned int MomentumDependentPedeLabeler::buildReverseMap ( ) [private]

returns size of map

Definition at line 440 of file MomentumDependentPedeLabeler.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();
}
std::vector< unsigned int > MomentumDependentPedeLabeler::convertParamSel ( const std::string &  selString) const [private]

Definition at line 305 of file MomentumDependentPedeLabeler.cc.

References pos, and query::result.

Referenced by buildMomentumDependencyMap().

{
  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 > MomentumDependentPedeLabeler::decompose ( const std::string &  s,
std::string::value_type  delimiter 
) const [private]

Definition at line 285 of file MomentumDependentPedeLabeler.cc.

References query::result.

Referenced by buildMomentumDependencyMap().

{
  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 MomentumDependentPedeLabeler::hasSplitParameters ( Alignable alignable) const [virtual]

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

Implements PedeLabelerBase.

Definition at line 195 of file MomentumDependentPedeLabeler.cc.

References theAlignableToMomentumRangeMap.

{
  AlignableToMomentumRangeMap::const_iterator positionAli = theAlignableToMomentumRangeMap.find(alignable);
  if (positionAli != theAlignableToMomentumRangeMap.end()) return true;
  return false;
}
unsigned int MomentumDependentPedeLabeler::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 268 of file MomentumDependentPedeLabeler.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<MomentumDependentPedeLabeler*>(this)->buildReverseMap();
  UintUintMap::const_iterator position = theLabelToLasBeamMap.find(aliLabel);
  if (position != theLabelToLasBeamMap.end()) {
    return position->second;
  } else {
    edm::LogError("LogicError") << "@SUB=MomentumDependentPedeLabeler::lasBeamIdFromLabel"
                                << "Alignable label " << aliLabel << " not in map.";
    return 0;
  }
}
unsigned int MomentumDependentPedeLabeler::lasBeamLabel ( unsigned int  lasBeamId) const [virtual]

Implements PedeLabelerBase.

Definition at line 112 of file MomentumDependentPedeLabeler.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=MomentumDependentPedeLabeler::lasBeamLabel"
                                << "No label for beam Id " << lasBeamId;
    return 0;
  }
}
unsigned int MomentumDependentPedeLabeler::numberOfParameterInstances ( Alignable alignable,
int  param = -1 
) const [virtual]

returns the number of instances for a given parameter

Implements PedeLabelerBase.

Definition at line 203 of file MomentumDependentPedeLabeler.cc.

References max(), and theAlignableToMomentumRangeMap.

Referenced by buildReverseMap().

{
  AlignableToMomentumRangeMap::const_iterator positionAli = theAlignableToMomentumRangeMap.find(alignable);
  if (positionAli != theAlignableToMomentumRangeMap.end()) {

    size_t nMomentums = 1;
    if (param==-1) {
      for (MomentumRangeParamMap::const_iterator iParam = (*positionAli).second.begin();
           iParam != (*positionAli).second.end();
           ++iParam) {
        nMomentums = std::max(nMomentums, iParam->second.size());
      }
      return nMomentums;
    } else {
      MomentumRangeParamMap::const_iterator iParam = (*positionAli).second.find(param);
      if (iParam != (*positionAli).second.end()) {
        return iParam->second.size();
      } else {
        return 1;
      }
    }
  }
  
  return 1;
}
unsigned int MomentumDependentPedeLabeler::parameterLabel ( unsigned int  aliLabel,
unsigned int  parNum 
) const [virtual]

returns the label for a given alignable parameter number combination

Implements PedeLabelerBase.

Definition at line 126 of file MomentumDependentPedeLabeler.cc.

References Exception, and PedeLabelerBase::theMaxNumParam.

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

References Alignable::alignableObjectId(), Exception, TrajectoryStateOnSurface::globalMomentum(), Alignable::id(), PV3DBase< T, PVType, FrameType >::mag(), evf::evtn::offset(), position, edm::second(), theAlignableToIdMap, theAlignableToMomentumRangeMap, PedeLabelerBase::theMaxNumParam, and PedeLabelerBase::theParamInstanceOffset.

{
  if (!alignable) return 0;
  
  if (parNum >= theMaxNumParam) {
    throw cms::Exception("Alignment") << "@SUB=MomentumDependentPedeLabeler::parameterLabel" 
                                      << "Parameter number " << parNum 
                                      << " out of range 0 <= num < " << theMaxNumParam;
  }

  AlignableToIdMap::const_iterator position = theAlignableToIdMap.find(alignable);
  if (position != theAlignableToIdMap.end()) {

    AlignableToMomentumRangeMap::const_iterator positionAli = theAlignableToMomentumRangeMap.find(alignable);
    if (positionAli != theAlignableToMomentumRangeMap.end()) {
      
      MomentumRangeParamMap::const_iterator positionParam = (*positionAli).second.find(parNum);
      if (positionParam!=(*positionAli).second.end()) {
        
        int offset = 0;
        float mom = tsos.globalMomentum().mag();
        const MomentumRangeVector & momentumRanges = (*positionParam).second;
        for (MomentumRangeVector::const_iterator iMomentum = momentumRanges.begin();
             iMomentum != momentumRanges.end();
             ++iMomentum) {
          
          if (iMomentum->first<=mom && mom<iMomentum->second) {
            return position->second + offset * theParamInstanceOffset + parNum;
          }
          offset++;
        }
        const DetId detId(alignable->id());
        edm::LogError("LogicError")
          << "@SUB=MomentumDependentPedeLabeler::alignableLabel" << "Alignable "
          << typeid(*alignable).name() << " not in map, det/subdet/alignableStructureType = "
          << detId.det() << "/" << detId.subdetId() << "/" << alignable->alignableObjectId();
        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=MomentumDependentPedeLabeler::alignableLabel" << "Alignable "
      << typeid(*alignable).name() << " not in map, det/subdet/alignableStructureType = "
      << detId.det() << "/" << detId.subdetId() << "/" << alignable->alignableObjectId();
    return 0;
  } 
}
unsigned int MomentumDependentPedeLabeler::paramNumFromLabel ( unsigned int  paramLabel) const [virtual]

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

Implements PedeLabelerBase.

Definition at line 230 of file MomentumDependentPedeLabeler.cc.

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

Referenced by alignableLabelFromLabel().

{
  if (paramLabel < theMinLabel) {
    edm::LogError("LogicError") << "@SUB=MomentumDependentPedeLabeler::paramNumFromLabel"
                                << "Label " << paramLabel << " should be >= " << theMinLabel;
    return 0;
  }
  return (paramLabel - theMinLabel) % theParamInstanceOffset;
}

Member Data Documentation

providing unique ID for alignable, space for param IDs

Definition at line 94 of file MomentumDependentPedeLabeler.h.

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

providing unique ID for alignable, space for param IDs

Definition at line 95 of file MomentumDependentPedeLabeler.h.

Referenced by alignableFromLabel(), and buildReverseMap().

labels for las beams

Definition at line 97 of file MomentumDependentPedeLabeler.h.

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

reverse map

Definition at line 96 of file MomentumDependentPedeLabeler.h.

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

reverse of the above

Definition at line 98 of file MomentumDependentPedeLabeler.h.