CMS 3D CMS Logo

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

AlignmentParameterSelector Class Reference

#include <AlignmentParameterSelector.h>

List of all members.

Classes

struct  PXBDetIdRanges
struct  PXFDetIdRanges
struct  TECDetIdRanges
struct  TIBDetIdRanges
struct  TIDDetIdRanges
struct  TOBDetIdRanges

Public Member Functions

unsigned int addSelection (const std::string &name, const std::vector< char > &paramSel)
unsigned int addSelection (const std::string &name, const std::vector< char > &paramSel, const edm::ParameterSet &pSet)
 as addSelection with one argument, but overwriting geometrical restrictions
unsigned int addSelections (const edm::ParameterSet &pSet)
 AlignmentParameterSelector (AlignableTracker *aliTracker, AlignableMuon *aliMuon=0, AlignableExtras *aliExtras=0)
 Constructor from tracker only or from tracker and muon.
void clear ()
 remove all selected Alignables and geometrical restrictions
void clearGeometryCuts ()
 remove all geometrical restrictions
std::vector< char > convertParamSel (const std::string &selString) const
 Converting std::string into std::vector<char>
std::vector< std::string > decompose (const std::string &s, std::string::value_type delimiter) const
 Decomposing input string 's' into parts separated by 'delimiter'.
bool detUnitDeselected (const Alignable *alignable) const
 true if alignable is DetUnit deselected by Unit<Rphi/Stereo> selection
template<>
bool insideRanges (int value, const std::vector< int > &ranges, bool isPhi) const
template<>
bool insideRanges (int value, const std::vector< int > &ranges, bool) const
template<typename T >
bool insideRanges (T value, const std::vector< T > &ranges, bool isPhi=false) const
bool isMemberOfVector (int value, const std::vector< int > &values) const
 true if value is member of vector of values
bool layerDeselected (const Alignable *alignable) const
 true if layer is deselected via "Layers<N><M>" or "DS/SS"
bool outsideDetIdRanges (const Alignable *alignable) const
 true if DetId restrictions are not satisfied
bool outsideGeometricalRanges (const Alignable *alignable) const
 true if geometrical restrictions in eta, phi, r, x, y, z not satisfied
const align::AlignablesselectedAlignables () const
 vector of alignables selected so far
const std::vector< std::vector
< char > > & 
selectedParameters () const
 vector of selection 'strings' for alignables, parallel to selectedAlignables()
void setGeometryCuts (const edm::ParameterSet &pSet)
virtual ~AlignmentParameterSelector ()
 Destructor.

Protected Member Functions

unsigned int add (const align::Alignables &alignables, const std::vector< char > &paramSel)
 adding alignables which fulfil geometrical restrictions and special switches
unsigned int addAllAlignables (const std::vector< char > &paramSel)
unsigned int addAllDets (const std::vector< char > &paramSel)
 some helper methods
unsigned int addAllLayers (const std::vector< char > &paramSel)
unsigned int addAllRods (const std::vector< char > &paramSel)
void setPXBDetIdCuts (const edm::ParameterSet &pSet)
void setPXFDetIdCuts (const edm::ParameterSet &pSet)
void setTECDetIdCuts (const edm::ParameterSet &pSet)
void setTIBDetIdCuts (const edm::ParameterSet &pSet)
void setTIDDetIdCuts (const edm::ParameterSet &pSet)
void setTOBDetIdCuts (const edm::ParameterSet &pSet)

Private Types

enum  RphiOrStereoDetUnit { Stereo, Both, Rphi }

Private Member Functions

std::string setSpecials (const std::string &name)

Private Attributes

std::vector< int > theDetIdRanges
std::vector< int > theDetIds
 DetId restrictions in eta, phi, r, x, y, z to be applied for next addSelection.
std::vector< int > theExcludedDetIdRanges
std::vector< int > theExcludedDetIds
AlignableExtrastheExtras
int theMaxLayer
int theMinLayer
AlignableMuontheMuon
bool theOnlyDS
bool theOnlySS
struct
AlignmentParameterSelector::PXBDetIdRanges 
thePXBDetIdRanges
struct
AlignmentParameterSelector::PXFDetIdRanges 
thePXFDetIdRanges
std::vector< double > theRangesEta
 geometrical restrictions in eta, phi, r, x, y, z to be applied for next addSelection
std::vector< double > theRangesPhi
std::vector< double > theRangesR
std::vector< double > theRangesX
std::vector< double > theRangesY
std::vector< double > theRangesZ
RphiOrStereoDetUnit theRphiOrStereoDetUnit
align::Alignables theSelectedAlignables
std::vector< std::vector< char > > theSelectedParameters
bool theSelLayers
struct
AlignmentParameterSelector::TECDetIdRanges 
theTECDetIdRanges
struct
AlignmentParameterSelector::TIBDetIdRanges 
theTIBDetIdRanges
struct
AlignmentParameterSelector::TIDDetIdRanges 
theTIDDetIdRanges
struct
AlignmentParameterSelector::TOBDetIdRanges 
theTOBDetIdRanges
AlignableTrackertheTracker

Detailed Description

Author:
Gero Flucke (selection by strings taken from AlignableParameterBuilder)

Selecting Alignable's of the tracker by predefined strings, additional constraints on eta, phi, r, x, y or z are possible. Furthermore stores the 'selection' of selected AlignmentParameters.

Date:
2010/11/22 08:40:08
Revision:
1.10

(last update by

Author:
mussgill

)

Definition at line 26 of file AlignmentParameterSelector.h.


Member Enumeration Documentation

Enumerator:
Stereo 
Both 
Rphi 

Definition at line 190 of file AlignmentParameterSelector.h.


Constructor & Destructor Documentation

AlignmentParameterSelector::AlignmentParameterSelector ( AlignableTracker aliTracker,
AlignableMuon aliMuon = 0,
AlignableExtras aliExtras = 0 
) [explicit]

Constructor from tracker only or from tracker and muon.

Definition at line 29 of file AlignmentParameterSelector.cc.

References setSpecials().

                                                                                   :
  theTracker(aliTracker), theMuon(aliMuon), theExtras(aliExtras), theSelectedAlignables(), 
  theRangesEta(), theRangesPhi(), theRangesR(), theRangesX(), theRangesY(), theRangesZ()
{
  this->setSpecials(""); // init theOnlyDS, theOnlySS, theSelLayers, theMinLayer, theMaxLayer, theRphiOrStereoDetUnit
}
virtual AlignmentParameterSelector::~AlignmentParameterSelector ( ) [inline, virtual]

Destructor.

Definition at line 33 of file AlignmentParameterSelector.h.

{}

Member Function Documentation

unsigned int AlignmentParameterSelector::add ( const align::Alignables alignables,
const std::vector< char > &  paramSel 
) [protected]

adding alignables which fulfil geometrical restrictions and special switches

Definition at line 491 of file AlignmentParameterSelector.cc.

References detUnitDeselected(), layerDeselected(), outsideDetIdRanges(), outsideGeometricalRanges(), theSelectedAlignables, and theSelectedParameters.

Referenced by addAllAlignables(), addAllDets(), addAllLayers(), addAllRods(), and addSelection().

{
  unsigned int numAli = 0;

  // loop on Alignable objects
  for (align::Alignables::const_iterator iAli = alignables.begin();
       iAli != alignables.end(); ++iAli) {

    if (!this->layerDeselected(*iAli)             // check layers
        && !this->detUnitDeselected(*iAli)        // check detunit selection
        && !this->outsideGeometricalRanges(*iAli) // check geometrical ranges
        && !this->outsideDetIdRanges(*iAli)) {    // check DetId ranges
      // all fine, so add to output arrays
      theSelectedAlignables.push_back(*iAli);
      theSelectedParameters.push_back(paramSel);
      ++numAli;
    }
  }

  return numAli;
}
unsigned int AlignmentParameterSelector::addAllAlignables ( const std::vector< char > &  paramSel) [protected]

Definition at line 879 of file AlignmentParameterSelector.cc.

References add(), addAllDets(), addAllLayers(), addAllRods(), AlignableComposite::components(), and theTracker.

Referenced by addSelection().

{
  unsigned int numAli = 0;

  numAli += this->addAllDets(paramSel);
  numAli += this->addAllRods(paramSel);
  numAli += this->addAllLayers(paramSel);
  numAli += this->add(theTracker->components(), paramSel);

  return numAli;
}
unsigned int AlignmentParameterSelector::addAllDets ( const std::vector< char > &  paramSel) [protected]

some helper methods

Definition at line 837 of file AlignmentParameterSelector.cc.

References add(), AlignableTracker::barrelGeomDets(), AlignableTracker::endcapGeomDets(), AlignableTracker::pixelEndcapGeomDets(), AlignableTracker::pixelHalfBarrelGeomDets(), theTracker, and AlignableTracker::TIDGeomDets().

Referenced by addAllAlignables(), and addSelection().

{
  unsigned int numAli = 0;

  numAli += this->add(theTracker->barrelGeomDets(), paramSel);          // TIB+TOB
  numAli += this->add(theTracker->endcapGeomDets(), paramSel);          // TEC
  numAli += this->add(theTracker->TIDGeomDets(), paramSel);             // TID
  numAli += this->add(theTracker->pixelHalfBarrelGeomDets(), paramSel); // PixelBarrel
  numAli += this->add(theTracker->pixelEndcapGeomDets(), paramSel);     // PixelEndcap

  return numAli;
}
unsigned int AlignmentParameterSelector::addAllLayers ( const std::vector< char > &  paramSel) [protected]

Definition at line 865 of file AlignmentParameterSelector.cc.

References add(), AlignableTracker::barrelLayers(), AlignableTracker::endcapLayers(), AlignableTracker::pixelEndcapLayers(), AlignableTracker::pixelHalfBarrelLayers(), theTracker, and AlignableTracker::TIDLayers().

Referenced by addAllAlignables(), and addSelection().

{
  unsigned int numAli = 0;

  numAli += this->add(theTracker->barrelLayers(), paramSel);          // TIB+TOB    
  numAli += this->add(theTracker->pixelHalfBarrelLayers(), paramSel); // PixelBarrel
  numAli += this->add(theTracker->endcapLayers(), paramSel);          // TEC
  numAli += this->add(theTracker->TIDLayers(), paramSel);             // TID
  numAli += this->add(theTracker->pixelEndcapLayers(), paramSel);     // PixelEndcap

  return numAli;
}
unsigned int AlignmentParameterSelector::addAllRods ( const std::vector< char > &  paramSel) [protected]

Definition at line 851 of file AlignmentParameterSelector.cc.

References add(), AlignableTracker::barrelRods(), AlignableTracker::endcapPetals(), AlignableTracker::pixelEndcapPetals(), AlignableTracker::pixelHalfBarrelLadders(), theTracker, and AlignableTracker::TIDRings().

Referenced by addAllAlignables(), and addSelection().

{
  unsigned int numAli = 0;

  numAli += this->add(theTracker->barrelRods(), paramSel);             // TIB+TOB    
  numAli += this->add(theTracker->pixelHalfBarrelLadders(), paramSel); // PixelBarrel
  numAli += this->add(theTracker->endcapPetals(), paramSel);           // TEC        
  numAli += this->add(theTracker->TIDRings(), paramSel);               // TID        
  numAli += this->add(theTracker->pixelEndcapPetals(), paramSel);      // PixelEndcap

  return numAli;
}
unsigned int AlignmentParameterSelector::addSelection ( const std::string &  name,
const std::vector< char > &  paramSel 
)

add Alignables corresponding to predefined name, taking into account geometrical restrictions as defined in setSpecials, returns number of added alignables

Definition at line 319 of file AlignmentParameterSelector.cc.

References add(), addAllAlignables(), addAllDets(), addAllLayers(), addAllRods(), AlignableTracker::barrelGeomDets(), AlignableTracker::barrelLayers(), AlignableTracker::barrelRods(), AlignableComposite::components(), AlignableMuon::CSCChambers(), AlignableMuon::CSCEndcaps(), AlignableMuon::CSCLayers(), AlignableMuon::CSCRings(), AlignableMuon::CSCStations(), AlignableMuon::DTBarrel(), AlignableMuon::DTChambers(), AlignableMuon::DTLayers(), AlignableMuon::DTStations(), AlignableMuon::DTSuperLayers(), AlignableMuon::DTWheels(), AlignableTracker::endcapGeomDets(), AlignableTracker::endcapLayers(), AlignableTracker::endcapPetals(), AlignableTracker::endCaps(), Exception, AlignableTracker::innerBarrelGeomDets(), AlignableTracker::innerBarrelLayers(), AlignableTracker::innerBarrelRods(), AlignableTracker::innerHalfBarrels(), mergeVDriftHistosByStation::name, AlignableTracker::outerBarrelGeomDets(), AlignableTracker::outerBarrelLayers(), AlignableTracker::outerBarrelRods(), AlignableTracker::outerHalfBarrels(), AlignableTracker::pixelEndcapGeomDets(), AlignableTracker::pixelEndcapLayers(), AlignableTracker::pixelEndcapPetals(), AlignableTracker::pixelEndCaps(), AlignableTracker::pixelHalfBarrelGeomDets(), AlignableTracker::pixelHalfBarrelLadders(), AlignableTracker::pixelHalfBarrelLayers(), AlignableTracker::pixelHalfBarrels(), setSpecials(), AlignableTracker::subStructures(), AlignableExtras::subStructures(), theExtras, theMuon, theTracker, AlignableTracker::TIDGeomDets(), AlignableTracker::TIDLayers(), AlignableTracker::TIDRings(), and AlignableTracker::TIDs().

Referenced by addSelection(), addSelections(), MomentumDependentPedeLabeler::buildMomentumDependencyMap(), RunRangeDependentPedeLabeler::buildRunRangeDependencyMap(), and KalmanAlignmentAlgorithm::initializeAlignmentParameters().

{
  const std::string name(this->setSpecials(nameInput)); // possibly changing name

  unsigned int numAli = 0;

  // Generic Tracker Section
  if (name.find("Tracker") == 0) { // string starts with "Tracker"
    if (!theTracker) {
      throw cms::Exception("BadConfig") << "[AlignmentParameterSelector::addSelection] "
                                        << "Configuration requires access to AlignableTracker"
                                        << " (for " << name << ") that is not initialized";
    }
    const std::string substructName(name, 7); // erase "Tracker" at the beginning
    numAli += this->add(theTracker->subStructures(substructName), paramSel);
  }
  // Old hardcoded (i.e. deprecated) tracker section (NOTE: no check on theTracker != 0)
  else if (name == "AllDets")       numAli += this->addAllDets(paramSel);
  else if (name == "AllRods")       numAli += this->addAllRods(paramSel);
  else if (name == "AllLayers")     numAli += this->addAllLayers(paramSel);
  else if (name == "AllComponents") numAli += this->add(theTracker->components(), paramSel);
  else if (name == "AllAlignables") numAli += this->addAllAlignables(paramSel);
  //
  // TIB+TOB
  //
  else if (name == "BarrelRods")   numAli += this->add(theTracker->barrelRods(), paramSel);
  else if (name == "BarrelDets")   numAli += this->add(theTracker->barrelGeomDets(), paramSel);
  else if (name == "BarrelLayers") numAli += this->add(theTracker->barrelLayers(), paramSel);
  else if (name == "TOBDets")      numAli += this->add(theTracker->outerBarrelGeomDets(), paramSel);
  else if (name == "TOBRods")      numAli += this->add(theTracker->outerBarrelRods(), paramSel);
  else if (name == "TOBLayers")    numAli += this->add(theTracker->outerBarrelLayers(), paramSel);
  else if (name == "TOBHalfBarrels") numAli += this->add(theTracker->outerHalfBarrels(), paramSel);
  else if (name == "TIBDets")      numAli += this->add(theTracker->innerBarrelGeomDets(), paramSel);
  else if (name == "TIBRods")      numAli += this->add(theTracker->innerBarrelRods(), paramSel);
  else if (name == "TIBLayers")    numAli += this->add(theTracker->innerBarrelLayers(), paramSel);
  else if (name == "TIBHalfBarrels") numAli += this->add(theTracker->innerHalfBarrels(), paramSel);
  //
  // PXBarrel
  //
  else if (name == "PixelHalfBarrelDets") {
    numAli += this->add(theTracker->pixelHalfBarrelGeomDets(), paramSel);
  } else if (name == "PixelHalfBarrelLadders") {
    numAli += this->add(theTracker->pixelHalfBarrelLadders(), paramSel);
  } else if (name == "PixelHalfBarrelLayers") {
    numAli += this->add(theTracker->pixelHalfBarrelLayers(), paramSel);
  } else if (name == "PixelHalfBarrels") {
    numAli += this->add(theTracker->pixelHalfBarrels(), paramSel);
  }
  //
  // PXEndcap
  //
  else if (name == "PXECDets") numAli += this->add(theTracker->pixelEndcapGeomDets(), paramSel);
  else if (name == "PXECPetals") numAli += this->add(theTracker->pixelEndcapPetals(), paramSel);
  else if (name == "PXECLayers") numAli += this->add(theTracker->pixelEndcapLayers(), paramSel);
  else if (name == "PXEndCaps") numAli += this->add(theTracker->pixelEndCaps(), paramSel);
  //
  // Pixel Barrel+endcap
  //
  else if (name == "PixelDets") {
    numAli += this->add(theTracker->pixelHalfBarrelGeomDets(), paramSel);
    numAli += this->add(theTracker->pixelEndcapGeomDets(), paramSel);
  } else if (name == "PixelRods") {
    numAli += this->add(theTracker->pixelHalfBarrelLadders(), paramSel);
    numAli += this->add(theTracker->pixelEndcapPetals(), paramSel);
  } else if (name == "PixelLayers") {
    numAli += this->add(theTracker->pixelHalfBarrelLayers(), paramSel);
    numAli += this->add(theTracker->pixelEndcapLayers(), paramSel);
  }
  //
  // TID
  //
  else if (name == "TIDs")          numAli += this->add(theTracker->TIDs(), paramSel);
  else if (name == "TIDLayers")     numAli += this->add(theTracker->TIDLayers(), paramSel);
  else if (name == "TIDRings")      numAli += this->add(theTracker->TIDRings(), paramSel);
  else if (name == "TIDDets")       numAli += this->add(theTracker->TIDGeomDets(), paramSel);
  //
  // TEC
  //
  else if (name == "TECDets")       numAli += this->add(theTracker->endcapGeomDets(), paramSel);
  else if (name == "TECPetals")     numAli += this->add(theTracker->endcapPetals(), paramSel);
  else if (name == "TECLayers")     numAli += this->add(theTracker->endcapLayers(), paramSel);
  else if (name == "TECs")          numAli += this->add(theTracker->endCaps(), paramSel);
  //
  // StripEndcap (TID+TEC)
  //
  else if (name == "EndcapDets") {
    numAli += this->add(theTracker->TIDGeomDets(), paramSel);
    numAli += this->add(theTracker->endcapGeomDets(), paramSel); 
  } else if (name == "EndcapPetals") {
    numAli += this->add(theTracker->TIDRings(), paramSel);
    numAli += this->add(theTracker->endcapPetals(), paramSel);
  } else if (name == "EndcapLayers") {
    numAli += this->add(theTracker->TIDLayers(), paramSel);
    numAli += this->add(theTracker->endcapLayers(), paramSel);
  }
  //
  // Strip Barrel+endcap
  //
  else if (name == "StripDets") {
    numAli += this->add(theTracker->barrelGeomDets(), paramSel);
    numAli += this->add(theTracker->TIDGeomDets(), paramSel);
    numAli += this->add(theTracker->endcapGeomDets(), paramSel); 
  } else if (name == "StripRods") {
    numAli += this->add(theTracker->barrelRods(), paramSel);
    numAli += this->add(theTracker->TIDRings(), paramSel);
    numAli += this->add(theTracker->endcapPetals(), paramSel);
  } else if (name == "StripLayers") {
    numAli += this->add(theTracker->barrelLayers(), paramSel);
    numAli += this->add(theTracker->TIDLayers(), paramSel);
    numAli += this->add(theTracker->endcapLayers(), paramSel);
  }
  // Muon selection
  // Check if name contains muon and react if alignable muon not initialized
  else if (name.find("Muon") != std::string::npos) {
    if  (!theMuon) {
      throw cms::Exception("BadConfig") << "[AlignmentParameterSelector::addSelection] "
                                        << "Configuration requires access to AlignableMuon"
                                        << " which is not initialized";
    }
    else if (name == "MuonDTLayers")             add(theMuon->DTLayers(), paramSel);
    else if (name == "MuonDTSuperLayers")        add(theMuon->DTSuperLayers(), paramSel);
    else if (name == "MuonDTChambers")           add(theMuon->DTChambers(), paramSel);
    else if (name == "MuonDTStations")           add(theMuon->DTStations(), paramSel);
    else if (name == "MuonDTWheels")             add(theMuon->DTWheels(), paramSel);
    else if (name == "MuonBarrel")               add(theMuon->DTBarrel(), paramSel);
    else if (name == "MuonCSCLayers")            add(theMuon->CSCLayers(), paramSel);
    else if (name == "MuonCSCRings")             add(theMuon->CSCRings(), paramSel);
    else if (name == "MuonCSCChambers")          add(theMuon->CSCChambers(), paramSel);
    else if (name == "MuonCSCStations")          add(theMuon->CSCStations(), paramSel);
    else if (name == "MuonEndcaps")              add(theMuon->CSCEndcaps(), paramSel);

    // not found, but Muon
    else {
      throw cms::Exception("BadConfig") <<"[AlignmentParameterSelector::addSelection]"
                                        << ": Selection '" << name << "' invalid!";
    }
  }

  // Generic Extra Alignable Section
  else if (name.find("Extras") == 0) { // string starts with "Extras"
    if (!theExtras) {
      throw cms::Exception("BadConfig") << "[AlignmentParameterSelector::addSelection] "
                                        << "Configuration requires access to AlignableExtras"
                                        << " (for " << name << ") that is not initialized";
    }
    const std::string substructName(name, 6); // erase "Extras" at the beginning
    numAli += this->add(theExtras->subStructures(substructName), paramSel);
  }
  // end of "name.find("Extras") != std::string::npos"

  else {
    throw cms::Exception("BadConfig") <<"[AlignmentParameterSelector::addSelection]"
                                      << ": Selection '" << name << "' invalid!";
  }
  
  this->setSpecials(""); // reset

  return numAli;
}
unsigned int AlignmentParameterSelector::addSelection ( const std::string &  name,
const std::vector< char > &  paramSel,
const edm::ParameterSet pSet 
)

as addSelection with one argument, but overwriting geometrical restrictions

Definition at line 310 of file AlignmentParameterSelector.cc.

References addSelection(), and setGeometryCuts().

{
  this->setGeometryCuts(pSet);
  return this->addSelection(name, paramSel);
}
unsigned int AlignmentParameterSelector::addSelections ( const edm::ParameterSet pSet)

Add several selections defined by the PSet which must contain a vstring like e.g. vstring alignParams = { "PixelHalfBarrelLadders,111000,pixelSelection", "BarrelDSRods,111ff0", "BarrelSSRods,101ff0"} The e.g. '111ff0' is decoded into vector<char> and stored. Returns number of added selections or -1 if problems (then also an error is logged) If a string contains a third, comma separated part (e.g. ',pixelSelection'), a further PSet of that name is expected to select eta/phi/r/x/y/z-ranges.

Definition at line 64 of file AlignmentParameterSelector.cc.

References addSelection(), clearGeometryCuts(), convertParamSel(), decompose(), Exception, and edm::ParameterSet::getParameter().

Referenced by AlignmentParameterBuilder::addSelections(), HIPAlignmentAlgorithm::initialize(), and PedeSteerer::presigmas().

{

  const std::vector<std::string> selections
    = pSet.getParameter<std::vector<std::string> >("alignParams");
  
  unsigned int addedSets = 0;

  for (unsigned int iSel = 0; iSel < selections.size(); ++iSel) {
    std::vector<std::string> decompSel(this->decompose(selections[iSel], ','));
    if (decompSel.empty()) continue; // edm::LogError or even cms::Exception??

    if (decompSel.size() < 2) {
      throw cms::Exception("BadConfig") << "@SUB=AlignmentParameterSelector::addSelections"
                                        << selections[iSel]<<" from alignableParamSelector: "
                                        << " should have at least 2 ','-separated parts";
    } else if (decompSel.size() > 2) {
      const edm::ParameterSet geoSel(pSet.getParameter<edm::ParameterSet>(decompSel[2].c_str()));
      this->addSelection(decompSel[0], this->convertParamSel(decompSel[1]), geoSel);
    } else {
      this->clearGeometryCuts();
      this->addSelection(decompSel[0], this->convertParamSel(decompSel[1]));
    }
    
    ++addedSets;
  }

  return addedSets;
}
void AlignmentParameterSelector::clear ( )
void AlignmentParameterSelector::clearGeometryCuts ( )
std::vector< char > AlignmentParameterSelector::convertParamSel ( const std::string &  selString) const

Converting std::string into std::vector<char>

Definition at line 756 of file AlignmentParameterSelector.cc.

References pos, and query::result.

Referenced by addSelections(), and AlignmentProducer::simpleMisalignment_().

{

  // Convert selString into vector<char> of same length.
  // Note: Old implementation in AlignmentParameterBuilder was rigid in length,
  // expecting RigidBodyAlignmentParameters::N_PARAM.
  // But I prefer to be more general and allow other Alignables. It will throw anyway if
  // RigidBodyAlignmentParameters are build with wrong selection length.
  std::vector<char> result(selString.size());

  for (std::string::size_type pos = 0; pos < selString.size(); ++pos) {
    result[pos] = selString[pos];
  }

  return result;
}
std::vector< std::string > AlignmentParameterSelector::decompose ( const std::string &  s,
std::string::value_type  delimiter 
) const

Decomposing input string 's' into parts separated by 'delimiter'.

Definition at line 736 of file AlignmentParameterSelector.cc.

References query::result.

Referenced by AlignmentParameterBuilder::addAllSelections(), and addSelections().

{

  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 AlignmentParameterSelector::detUnitDeselected ( const Alignable alignable) const

true if alignable is DetUnit deselected by Unit<Rphi/Stereo> selection

Definition at line 545 of file AlignmentParameterSelector.cc.

References align::AlignableDetUnit, Alignable::alignableObjectId(), Both, Alignable::geomDetId(), Rphi, Stereo, sistripsummary::TEC, theRphiOrStereoDetUnit, SiStripDetId::TIB, SiStripDetId::TID, SiStripDetId::TOB, and DetId::Tracker.

Referenced by add().

{

  if (theRphiOrStereoDetUnit != Both && ali->alignableObjectId() == align::AlignableDetUnit) {
    const SiStripDetId detId(ali->geomDetId()); // do not know yet whether right type...
    if (detId.det() == DetId::Tracker 
        && (detId.subdetId() == SiStripDetId::TIB || detId.subdetId() == SiStripDetId::TID ||
            detId.subdetId() == SiStripDetId::TOB || detId.subdetId() == SiStripDetId::TEC)) {
      // We have a DetUnit in strip, so check for a selection of stereo/rphi (DetUnits in 1D layers are rphi):
      if ((theRphiOrStereoDetUnit == Stereo && !detId.stereo())
          || (theRphiOrStereoDetUnit == Rphi   &&  detId.stereo())) {
        return true;
      }
    }
  }

  return false; // do not deselect...
}
template<typename T >
bool AlignmentParameterSelector::insideRanges ( T  value,
const std::vector< T > &  ranges,
bool  isPhi = false 
) const

true if ranges.size() is even and ranges[i] <= value < ranges[i+1] for any even i ( => false if ranges.empty() == true), if(isPhi==true) takes into account phi periodicity for the integer specialized method, true is returned for ranges[i] <= value <= ranges[i+1] and isPhi is ignored

Definition at line 677 of file AlignmentParameterSelector.cc.

References Exception, and i.

{
  // might become templated on <double> ?

  if (ranges.size()%2 != 0) {
    cms::Exception("BadConfig") << "@SUB=AlignmentParameterSelector::insideRanges" 
                                << " need even number of entries in ranges instead of "
                                << ranges.size();
    return false;
  }

  for (unsigned int i = 0; i < ranges.size(); i += 2) {
    if (isPhi) { // mapping into (-pi,+pi] and checking for range including sign flip area
      Geom::Phi<double> rangePhi1(ranges[i]);
      Geom::Phi<double> rangePhi2(ranges[i+1]);
      Geom::Phi<double> valuePhi(value);
      if (rangePhi1 <= valuePhi && valuePhi < rangePhi2) { // 'normal'
        return true;
      }
      if (rangePhi2  < rangePhi1 && (rangePhi1 <= valuePhi || valuePhi < rangePhi2)) {// 'sign flip'
        return true;
      }
    } else if (ranges[i] <= value && value < ranges[i+1]) {
      return true;
    }
  }
  
  return false;
}
template<>
bool AlignmentParameterSelector::insideRanges ( int  value,
const std::vector< int > &  ranges,
bool  isPhi 
) const
template<>
bool AlignmentParameterSelector::insideRanges ( int  value,
const std::vector< int > &  ranges,
bool   
) const

Definition at line 710 of file AlignmentParameterSelector.cc.

References Exception, i, runregparse::ranges, and relativeConstraints::value.

{
  if (ranges.size()%2 != 0) {
    cms::Exception("BadConfig") << "@SUB=AlignmentParameterSelector::insideRanges" 
                                << " need even number of entries in ranges instead of "
                                << ranges.size();
    return false;
  }

  for (unsigned int i = 0; i < ranges.size(); i += 2) {
    if (ranges[i] <= value && value <= ranges[i+1]) return true;
  }
  
  return false;
}
bool AlignmentParameterSelector::isMemberOfVector ( int  value,
const std::vector< int > &  values 
) const

true if value is member of vector of values

Definition at line 728 of file AlignmentParameterSelector.cc.

References spr::find(), and relativeConstraints::value.

Referenced by outsideDetIdRanges().

{
  if (std::find(values.begin(), values.end(), value)!=values.end()) return true;
  return false;
}
bool AlignmentParameterSelector::layerDeselected ( const Alignable alignable) const

true if layer is deselected via "Layers<N><M>" or "DS/SS"

Definition at line 515 of file AlignmentParameterSelector.cc.

References abs, Alignable::id(), theMaxLayer, theOnlyDS, theOnlySS, theSelLayers, SiStripDetId::TIB, SiStripDetId::TOB, and TrackerAlignableId::typeAndLayerFromDetId().

Referenced by add().

{
  if (theOnlySS || theOnlyDS || theSelLayers) {
    TrackerAlignableId idProvider;
    std::pair<int,int> typeLayer = idProvider.typeAndLayerFromDetId(ali->id());
    int type  = typeLayer.first;
    int layer = typeLayer.second;
    
    // select on single/double sided barrel layers in TIB/TOB
    if (theOnlySS // only single sided
        && (std::abs(type) == SiStripDetId::TIB || std::abs(type) == SiStripDetId::TOB)
        && layer <= 2) {
      return true;
    }
    if (theOnlyDS // only double sided
        && (std::abs(type) == SiStripDetId::TIB || std::abs(type) == SiStripDetId::TOB)
        && layer > 2) {
      return true;
    }
    
    // reject layers
    if (theSelLayers && (layer < theMinLayer || layer > theMaxLayer)) {
      return true;
    }
  }
  
  return false; // do not deselect...
}
bool AlignmentParameterSelector::outsideDetIdRanges ( const Alignable alignable) const

true if DetId restrictions are not satisfied

Definition at line 580 of file AlignmentParameterSelector.cc.

References PXFDetId::blade(), PXFDetId::disk(), TIDDetId::diskNumber(), Alignable::id(), isMemberOfVector(), PXBDetId::ladder(), TIBDetId::layer(), TOBDetId::layer(), PXBDetId::layer(), PXFDetId::module(), TOBDetId::module(), PXBDetId::module(), TECDetId::module(), TIBDetId::module(), TIDDetId::moduleNumber(), PXFDetId::panel(), TECDetId::petalNumber(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, TIDDetId::ring(), TECDetId::ring(), TOBDetId::rodNumber(), PXFDetId::side(), TIBDetId::side(), TOBDetId::side(), TIDDetId::side(), TECDetId::side(), TIBDetId::stringNumber(), DetId::subdetId(), SiStripDetId::TEC, AlignmentParameterSelector::PXFDetIdRanges::theBladeRanges, theDetIdRanges, theDetIds, AlignmentParameterSelector::TIDDetIdRanges::theDiskRanges, AlignmentParameterSelector::PXFDetIdRanges::theDiskRanges, theExcludedDetIdRanges, theExcludedDetIds, AlignmentParameterSelector::PXBDetIdRanges::theLadderRanges, AlignmentParameterSelector::PXBDetIdRanges::theLayerRanges, AlignmentParameterSelector::TOBDetIdRanges::theLayerRanges, AlignmentParameterSelector::TIBDetIdRanges::theLayerRanges, AlignmentParameterSelector::TIBDetIdRanges::theModuleRanges, AlignmentParameterSelector::PXBDetIdRanges::theModuleRanges, AlignmentParameterSelector::TOBDetIdRanges::theModuleRanges, AlignmentParameterSelector::PXFDetIdRanges::theModuleRanges, AlignmentParameterSelector::TECDetIdRanges::theModuleRanges, AlignmentParameterSelector::TIDDetIdRanges::theModuleRanges, AlignmentParameterSelector::PXFDetIdRanges::thePanelRanges, AlignmentParameterSelector::TECDetIdRanges::thePetalRanges, thePXBDetIdRanges, thePXFDetIdRanges, AlignmentParameterSelector::TECDetIdRanges::theRingRanges, AlignmentParameterSelector::TIDDetIdRanges::theRingRanges, AlignmentParameterSelector::TOBDetIdRanges::theRodRanges, AlignmentParameterSelector::TIBDetIdRanges::theSideRanges, AlignmentParameterSelector::PXFDetIdRanges::theSideRanges, AlignmentParameterSelector::TECDetIdRanges::theSideRanges, AlignmentParameterSelector::TIDDetIdRanges::theSideRanges, AlignmentParameterSelector::TOBDetIdRanges::theSideRanges, AlignmentParameterSelector::TIBDetIdRanges::theStringRanges, theTECDetIdRanges, theTIBDetIdRanges, theTIDDetIdRanges, theTOBDetIdRanges, AlignmentParameterSelector::TECDetIdRanges::theWheelRanges, SiStripDetId::TIB, SiStripDetId::TID, SiStripDetId::TOB, align::Tracker, and TECDetId::wheel().

Referenced by add().

{
  //const DetId detId(alignable->geomDetId());
  const DetId detId(alignable->id());
  const int subdetId = detId.subdetId();
  
  if (!theDetIds.empty() &&
      !this->isMemberOfVector((detId.rawId()), theDetIds)) return true;
  if (!theDetIdRanges.empty() &&
      !this->insideRanges<int>((detId.rawId()), theDetIdRanges)) return true;
  if (!theExcludedDetIds.empty() &&
      this->isMemberOfVector((detId.rawId()), theExcludedDetIds)) return true;
  if (!theExcludedDetIdRanges.empty() &&
      this->insideRanges<int>((detId.rawId()), theExcludedDetIdRanges)) return true;

  if (detId.det()==DetId::Tracker) {
    
    if (subdetId==static_cast<int>(PixelSubdetector::PixelBarrel)) {
      const PXBDetId pxbDetId(detId);
      if (!thePXBDetIdRanges.theLadderRanges.empty() && 
          !this->insideRanges<int>(pxbDetId.ladder(), thePXBDetIdRanges.theLadderRanges)) return true;
      if (!thePXBDetIdRanges.theLayerRanges.empty() && 
          !this->insideRanges<int>(pxbDetId.layer(), thePXBDetIdRanges.theLayerRanges)) return true;
      if (!thePXBDetIdRanges.theModuleRanges.empty() && 
          !this->insideRanges<int>(pxbDetId.module(), thePXBDetIdRanges.theModuleRanges)) return true;
    }
    
    if (subdetId==static_cast<int>(PixelSubdetector::PixelEndcap)) {
      const PXFDetId pxfDetId(detId);
      if (!thePXFDetIdRanges.theBladeRanges.empty() && 
          !this->insideRanges<int>(pxfDetId.blade(), thePXFDetIdRanges.theBladeRanges)) return true;
      if (!thePXFDetIdRanges.theDiskRanges.empty() && 
          !this->insideRanges<int>(pxfDetId.disk(), thePXFDetIdRanges.theDiskRanges)) return true;
      if (!thePXFDetIdRanges.theModuleRanges.empty() && 
          !this->insideRanges<int>(pxfDetId.module(), thePXFDetIdRanges.theModuleRanges)) return true;
      if (!thePXFDetIdRanges.thePanelRanges.empty() && 
          !this->insideRanges<int>(pxfDetId.panel(), thePXFDetIdRanges.thePanelRanges)) return true;
      if (!thePXFDetIdRanges.theSideRanges.empty() && 
          !this->insideRanges<int>(pxfDetId.side(), thePXFDetIdRanges.theSideRanges)) return true;
    }
    
    if (subdetId==static_cast<int>(SiStripDetId::TIB)) {
      const TIBDetId tibDetId(detId);
      if (!theTIBDetIdRanges.theLayerRanges.empty() && 
          !this->insideRanges<int>(tibDetId.layer(), theTIBDetIdRanges.theLayerRanges)) return true;
      if (!theTIBDetIdRanges.theModuleRanges.empty() && 
          !this->insideRanges<int>(tibDetId.module(), theTIBDetIdRanges.theModuleRanges)) return true;
      if (!theTIBDetIdRanges.theSideRanges.empty() && 
          !this->insideRanges<int>(tibDetId.side(), theTIBDetIdRanges.theSideRanges)) return true;
      if (!theTIBDetIdRanges.theStringRanges.empty() && 
          !this->insideRanges<int>(tibDetId.stringNumber(), theTIBDetIdRanges.theStringRanges)) return true;
    }
    
    if (subdetId==static_cast<int>(SiStripDetId::TID)) {
      const TIDDetId tidDetId(detId);
      if (!theTIDDetIdRanges.theDiskRanges.empty() && 
          !this->insideRanges<int>(tidDetId.diskNumber(), theTIDDetIdRanges.theDiskRanges)) return true;
      if (!theTIDDetIdRanges.theModuleRanges.empty() && 
          !this->insideRanges<int>(tidDetId.moduleNumber(), theTIDDetIdRanges.theModuleRanges)) return true;
      if (!theTIDDetIdRanges.theRingRanges.empty() && 
          !this->insideRanges<int>(tidDetId.ring(), theTIDDetIdRanges.theRingRanges)) return true;
      if (!theTIDDetIdRanges.theSideRanges.empty() && 
          !this->insideRanges<int>(tidDetId.side(), theTIDDetIdRanges.theSideRanges)) return true;
    }
    
    if (subdetId==static_cast<int>(SiStripDetId::TOB)) {
      const TOBDetId tobDetId(detId);
      if (!theTOBDetIdRanges.theLayerRanges.empty() && 
          !this->insideRanges<int>(tobDetId.layer(), theTOBDetIdRanges.theLayerRanges)) return true;
      if (!theTOBDetIdRanges.theModuleRanges.empty() && 
          !this->insideRanges<int>(tobDetId.module(), theTOBDetIdRanges.theModuleRanges)) return true;
      if (!theTOBDetIdRanges.theRodRanges.empty() && 
          !this->insideRanges<int>(tobDetId.rodNumber(), theTOBDetIdRanges.theRodRanges)) return true;
      if (!theTOBDetIdRanges.theSideRanges.empty() && 
          !this->insideRanges<int>(tobDetId.side(), theTOBDetIdRanges.theSideRanges)) return true;
    }

    if (subdetId==static_cast<int>(SiStripDetId::TEC)) {
      const TECDetId tecDetId(detId);
      if (!theTECDetIdRanges.theWheelRanges.empty() && 
          !this->insideRanges<int>(tecDetId.wheel(), theTECDetIdRanges.theWheelRanges)) return true;
      if (!theTECDetIdRanges.thePetalRanges.empty() && 
          !this->insideRanges<int>(tecDetId.petalNumber(), theTECDetIdRanges.thePetalRanges)) return true;
      if (!theTECDetIdRanges.theModuleRanges.empty() && 
          !this->insideRanges<int>(tecDetId.module(), theTECDetIdRanges.theModuleRanges)) return true;
      if (!theTECDetIdRanges.theRingRanges.empty() && 
          !this->insideRanges<int>(tecDetId.ring(), theTECDetIdRanges.theRingRanges)) return true;
      if (!theTECDetIdRanges.theSideRanges.empty() && 
          !this->insideRanges<int>(tecDetId.side(), theTECDetIdRanges.theSideRanges)) return true;
    }
    
  }
  
  return false;
}
bool AlignmentParameterSelector::outsideGeometricalRanges ( const Alignable alignable) const

true if geometrical restrictions in eta, phi, r, x, y, z not satisfied

Definition at line 565 of file AlignmentParameterSelector.cc.

References Alignable::globalPosition(), position, theRangesEta, theRangesPhi, theRangesR, theRangesX, theRangesY, and theRangesZ.

Referenced by add().

{
  const align::PositionType& position(alignable->globalPosition());

  if (!theRangesEta.empty() && !this->insideRanges<double>((position.eta()),  theRangesEta)) return true;
  if (!theRangesPhi.empty() && !this->insideRanges<double>((position.phi()),  theRangesPhi, true))return true;
  if (!theRangesR.empty()   && !this->insideRanges<double>((position.perp()), theRangesR)) return true;
  if (!theRangesX.empty()   && !this->insideRanges<double>((position.x()),    theRangesX)) return true;
  if (!theRangesY.empty()   && !this->insideRanges<double>((position.y()),    theRangesY)) return true;
  if (!theRangesZ.empty()   && !this->insideRanges<double>((position.z()),    theRangesZ)) return true;
  
  return false;
}
const align::Alignables& AlignmentParameterSelector::selectedAlignables ( ) const [inline]
const std::vector<std::vector<char> >& AlignmentParameterSelector::selectedParameters ( void  ) const [inline]

vector of selection 'strings' for alignables, parallel to selectedAlignables()

Definition at line 38 of file AlignmentParameterSelector.h.

References theSelectedParameters.

Referenced by AlignmentParameterBuilder::addSelections(), and PedeSteerer::presigmas().

void AlignmentParameterSelector::setGeometryCuts ( const edm::ParameterSet pSet)

set geometrical restrictions to be applied on all following selections (slices defined by vdouble 'etaRanges', 'phiRanges', 'xRanges', 'yRanges', 'zRanges' and 'rRanges', empty array means no restriction)

Definition at line 95 of file AlignmentParameterSelector.cc.

References clearGeometryCuts(), Exception, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), edm::ParameterSet::getParameterSet(), setPXBDetIdCuts(), setPXFDetIdCuts(), setTECDetIdCuts(), setTIBDetIdCuts(), setTIDDetIdCuts(), setTOBDetIdCuts(), theDetIdRanges, theDetIds, theExcludedDetIdRanges, theExcludedDetIds, theRangesEta, theRangesPhi, theRangesR, theRangesX, theRangesY, and theRangesZ.

Referenced by addSelection().

{
  // Allow non-specified arrays to be interpreted as empty (i.e. no selection),
  // but take care that nothing unknown is configured (to fetch typos!). 

  this->clearGeometryCuts();
  const std::vector<std::string> parameterNames(pSet.getParameterNames());
  for (std::vector<std::string>::const_iterator iParam = parameterNames.begin(),
         iEnd = parameterNames.end(); iParam != iEnd; ++iParam) {

    // Calling swap is more efficient than assignment:
    if (*iParam == "etaRanges") {
      pSet.getParameter<std::vector<double> >(*iParam).swap(theRangesEta);
    } else if (*iParam == "phiRanges") {
      pSet.getParameter<std::vector<double> >(*iParam).swap(theRangesPhi);
    } else if (*iParam == "rRanges") {
      pSet.getParameter<std::vector<double> >(*iParam).swap(theRangesR);
    } else if (*iParam == "xRanges") {
      pSet.getParameter<std::vector<double> >(*iParam).swap(theRangesX);
    } else if (*iParam == "yRanges") {
      pSet.getParameter<std::vector<double> >(*iParam).swap(theRangesY);
    } else if (*iParam == "zRanges") {
      pSet.getParameter<std::vector<double> >(*iParam).swap(theRangesZ);
    } else if (*iParam == "detIds") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(theDetIds);
    } else if (*iParam == "detIdRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(theDetIdRanges);
    } else if (*iParam == "excludedDetIds") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(theExcludedDetIds);
    } else if (*iParam == "excludedDetIdRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(theExcludedDetIdRanges);
    } else if (*iParam == "pxbDetId") {
      const edm::ParameterSet & pxbDetIdPSet = pSet.getParameterSet(*iParam);
      this->setPXBDetIdCuts(pxbDetIdPSet);
    } else if (*iParam == "pxfDetId") {
      const edm::ParameterSet & pxfDetIdPSet = pSet.getParameterSet(*iParam);
      this->setPXFDetIdCuts(pxfDetIdPSet);
    } else if (*iParam == "tibDetId") {
      const edm::ParameterSet & tibDetIdPSet = pSet.getParameterSet(*iParam);
      this->setTIBDetIdCuts(tibDetIdPSet);
    } else if (*iParam == "tidDetId") {
      const edm::ParameterSet & tidDetIdPSet = pSet.getParameterSet(*iParam);
      this->setTIDDetIdCuts(tidDetIdPSet);
    } else if (*iParam == "tobDetId") {
      const edm::ParameterSet & tobDetIdPSet = pSet.getParameterSet(*iParam);
      this->setTOBDetIdCuts(tobDetIdPSet);
    } else if (*iParam == "tecDetId") {
      const edm::ParameterSet & tecDetIdPSet = pSet.getParameterSet(*iParam);
      this->setTECDetIdCuts(tecDetIdPSet);
    } else {
      throw cms::Exception("BadConfig") << "[AlignmentParameterSelector::setGeometryCuts] "
                                        << "Unknown parameter '" << *iParam << "'.\n";
    }
  }
}
void AlignmentParameterSelector::setPXBDetIdCuts ( const edm::ParameterSet pSet) [protected]

Definition at line 152 of file AlignmentParameterSelector.cc.

References Exception, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), AlignmentParameterSelector::PXBDetIdRanges::theLadderRanges, AlignmentParameterSelector::PXBDetIdRanges::theLayerRanges, AlignmentParameterSelector::PXBDetIdRanges::theModuleRanges, and thePXBDetIdRanges.

Referenced by setGeometryCuts().

{
  // Allow non-specified arrays to be interpreted as empty (i.e. no selection),
  // but take care that nothing unknown is configured (to fetch typos!). 

  const std::vector<std::string> parameterNames(pSet.getParameterNames());
  for (std::vector<std::string>::const_iterator iParam = parameterNames.begin(),
         iEnd = parameterNames.end(); iParam != iEnd; ++iParam) {

    // Calling swap is more efficient than assignment:
    if (*iParam == "ladderRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(thePXBDetIdRanges.theLadderRanges);
    } else if (*iParam == "layerRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(thePXBDetIdRanges.theLayerRanges);
    } else if (*iParam == "moduleRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(thePXBDetIdRanges.theModuleRanges);
    } else {
      throw cms::Exception("BadConfig") << "[AlignmentParameterSelector::setPXBDetIdCuts] "
                                        << "Unknown parameter '" << *iParam << "'.\n";
    }
  }
}
void AlignmentParameterSelector::setPXFDetIdCuts ( const edm::ParameterSet pSet) [protected]

Definition at line 176 of file AlignmentParameterSelector.cc.

References Exception, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), AlignmentParameterSelector::PXFDetIdRanges::theBladeRanges, AlignmentParameterSelector::PXFDetIdRanges::theDiskRanges, AlignmentParameterSelector::PXFDetIdRanges::theModuleRanges, AlignmentParameterSelector::PXFDetIdRanges::thePanelRanges, thePXFDetIdRanges, and AlignmentParameterSelector::PXFDetIdRanges::theSideRanges.

Referenced by setGeometryCuts().

{
  // Allow non-specified arrays to be interpreted as empty (i.e. no selection),
  // but take care that nothing unknown is configured (to fetch typos!). 

  const std::vector<std::string> parameterNames(pSet.getParameterNames());
  for (std::vector<std::string>::const_iterator iParam = parameterNames.begin(),
         iEnd = parameterNames.end(); iParam != iEnd; ++iParam) {

    // Calling swap is more efficient than assignment:
    if (*iParam == "bladeRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(thePXFDetIdRanges.theBladeRanges);
    } else if (*iParam == "diskRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(thePXFDetIdRanges.theDiskRanges);
    } else if (*iParam == "moduleRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(thePXFDetIdRanges.theModuleRanges);
    } else if (*iParam == "panelRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(thePXFDetIdRanges.thePanelRanges);
    } else if (*iParam == "sideRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(thePXFDetIdRanges.theSideRanges);
    } else {
      throw cms::Exception("BadConfig") << "[AlignmentParameterSelector::setPXFDetIdCuts] "
                                        << "Unknown parameter '" << *iParam << "'.\n";
    }
  }
}
std::string AlignmentParameterSelector::setSpecials ( const std::string &  name) [private]

Setting the special switches and returning input string, but after removing the 'special indicators' from it. Known specials are: "SS" anywhere in name: in TIB/TOB restrict to single sided Dets/Rods/Layers "DS" anywhere in name: in TIB/TOB restrict to double sided Dets/Rods/Layers "Layers14" at end of name: in tracker restrict to layers/disks 1 to 4, similar for other digits "UnitStereo" and "UnitRphi" anywhere in name: for a DetUnit in strip select only if stereo or rphi module (keep 'Unit' in name!)

Definition at line 775 of file AlignmentParameterSelector.cc.

References Both, LogDebug, Rphi, findQualityFiles::size, Stereo, theMaxLayer, theMinLayer, theOnlyDS, theOnlySS, theRphiOrStereoDetUnit, and theSelLayers.

Referenced by addSelection(), and AlignmentParameterSelector().

{
  // Use new string only, although direct erasing of found indicator causes problems for 'DSS',
  // but 'DSS' makes absolutely no sense!
  std::string newName(name); 

  const std::string::size_type ss = newName.rfind("SS");
  if (ss != std::string::npos) {
    newName.erase(ss, 2); // 2: length of 'SS'
    theOnlySS = true;
  } else {
    theOnlySS = false;
  }

  const std::string::size_type ds = newName.rfind("DS");
  if (ds != std::string::npos) {
    newName.erase(ds, 2); // 2: length of 'DS'
    theOnlyDS = true;
  } else {
    theOnlyDS = false;
  }
  
  const std::string::size_type size = newName.size();
  const std::string::size_type layers = newName.rfind("Layers");
  if (layers != std::string::npos && size - layers - 2 == 6 // 2 digits, 6: length of 'Layers'
      && isdigit(newName[size-1]) && isdigit(newName[size-2])) {
    theSelLayers = true;
    theMinLayer = newName[size-2] - '0';
    theMaxLayer = newName[size-1] - '0';
    newName.erase(layers);
  } else {
    theSelLayers = false;
    theMinLayer = -1;
    theMaxLayer = 99999;
  }

  theRphiOrStereoDetUnit = Both;
  if (newName.rfind("Unit") != std::string::npos) {
    const std::string::size_type uRph = newName.rfind("UnitRphi");
    if (uRph != std::string::npos) {
      newName.erase(uRph + 4, 4); // keep 'Unit' (4) and erase 'Rphi' (4)
      theRphiOrStereoDetUnit = Rphi;
    }
    const std::string::size_type uSte = newName.rfind("UnitStereo");
    if (uSte != std::string::npos) {
      newName.erase(uSte + 4, 6); // keep 'Unit' (4) and erase 'Stereo' (6)
      theRphiOrStereoDetUnit = Stereo;
    }
  }

  if (newName != name) {
    LogDebug("Alignment") << "@SUB=AlignmentParameterSelector::setSpecials"
                          << name << " becomes " << newName << ", makes theOnlySS " << theOnlySS
                          << ", theOnlyDS " << theOnlyDS << ", theSelLayers " << theSelLayers
                          << ", theMinLayer " << theMinLayer << ", theMaxLayer " << theMaxLayer
                          << ", theRphiOrStereoDetUnit " << theRphiOrStereoDetUnit;
  }

  return newName;
}
void AlignmentParameterSelector::setTECDetIdCuts ( const edm::ParameterSet pSet) [protected]

Definition at line 282 of file AlignmentParameterSelector.cc.

References Exception, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), AlignmentParameterSelector::TECDetIdRanges::theModuleRanges, AlignmentParameterSelector::TECDetIdRanges::thePetalRanges, AlignmentParameterSelector::TECDetIdRanges::theRingRanges, AlignmentParameterSelector::TECDetIdRanges::theSideRanges, theTECDetIdRanges, and AlignmentParameterSelector::TECDetIdRanges::theWheelRanges.

Referenced by setGeometryCuts().

{
  // Allow non-specified arrays to be interpreted as empty (i.e. no selection),
  // but take care that nothing unknown is configured (to fetch typos!). 

  const std::vector<std::string> parameterNames(pSet.getParameterNames());
  for (std::vector<std::string>::const_iterator iParam = parameterNames.begin(),
         iEnd = parameterNames.end(); iParam != iEnd; ++iParam) {

    // Calling swap is more efficient than assignment:
    if (*iParam == "wheelRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(theTECDetIdRanges.theWheelRanges);
    } else if (*iParam == "petalRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(theTECDetIdRanges.thePetalRanges);
    } else if (*iParam == "moduleRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(theTECDetIdRanges.theModuleRanges);
    } else if (*iParam == "ringRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(theTECDetIdRanges.theRingRanges);
    } else if (*iParam == "sideRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(theTECDetIdRanges.theSideRanges);
    } else {
      throw cms::Exception("BadConfig") << "[AlignmentParameterSelector::setTECDetIdCuts] "
                                        << "Unknown parameter '" << *iParam << "'.\n";
    }
  }
}
void AlignmentParameterSelector::setTIBDetIdCuts ( const edm::ParameterSet pSet) [protected]

Definition at line 204 of file AlignmentParameterSelector.cc.

References Exception, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), AlignmentParameterSelector::TIBDetIdRanges::theLayerRanges, AlignmentParameterSelector::TIBDetIdRanges::theModuleRanges, AlignmentParameterSelector::TIBDetIdRanges::theSideRanges, AlignmentParameterSelector::TIBDetIdRanges::theStringRanges, and theTIBDetIdRanges.

Referenced by setGeometryCuts().

{
  // Allow non-specified arrays to be interpreted as empty (i.e. no selection),
  // but take care that nothing unknown is configured (to fetch typos!). 

  const std::vector<std::string> parameterNames(pSet.getParameterNames());
  for (std::vector<std::string>::const_iterator iParam = parameterNames.begin(),
         iEnd = parameterNames.end(); iParam != iEnd; ++iParam) {

    // Calling swap is more efficient than assignment:
    if (*iParam == "layerRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(theTIBDetIdRanges.theLayerRanges);
    } else if (*iParam == "moduleRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(theTIBDetIdRanges.theModuleRanges);
    } else if (*iParam == "stringRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(theTIBDetIdRanges.theStringRanges);
    } else if (*iParam == "sideRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(theTIBDetIdRanges.theSideRanges);
    } else {
      throw cms::Exception("BadConfig") << "[AlignmentParameterSelector::setTIBDetIdCuts] "
                                        << "Unknown parameter '" << *iParam << "'.\n";
    }
  }
}
void AlignmentParameterSelector::setTIDDetIdCuts ( const edm::ParameterSet pSet) [protected]

Definition at line 230 of file AlignmentParameterSelector.cc.

References Exception, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), AlignmentParameterSelector::TIDDetIdRanges::theDiskRanges, AlignmentParameterSelector::TIDDetIdRanges::theModuleRanges, AlignmentParameterSelector::TIDDetIdRanges::theRingRanges, AlignmentParameterSelector::TIDDetIdRanges::theSideRanges, and theTIDDetIdRanges.

Referenced by setGeometryCuts().

{
  // Allow non-specified arrays to be interpreted as empty (i.e. no selection),
  // but take care that nothing unknown is configured (to fetch typos!). 

  const std::vector<std::string> parameterNames(pSet.getParameterNames());
  for (std::vector<std::string>::const_iterator iParam = parameterNames.begin(),
         iEnd = parameterNames.end(); iParam != iEnd; ++iParam) {

    // Calling swap is more efficient than assignment:
    if (*iParam == "diskRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(theTIDDetIdRanges.theDiskRanges);
    } else if (*iParam == "moduleRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(theTIDDetIdRanges.theModuleRanges);
    } else if (*iParam == "ringRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(theTIDDetIdRanges.theRingRanges);
    } else if (*iParam == "sideRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(theTIDDetIdRanges.theSideRanges);
    } else {
      throw cms::Exception("BadConfig") << "[AlignmentParameterSelector::setTIDDetIdCuts] "
                                        << "Unknown parameter '" << *iParam << "'.\n";
    }
  }
}
void AlignmentParameterSelector::setTOBDetIdCuts ( const edm::ParameterSet pSet) [protected]

Definition at line 256 of file AlignmentParameterSelector.cc.

References Exception, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), AlignmentParameterSelector::TOBDetIdRanges::theLayerRanges, AlignmentParameterSelector::TOBDetIdRanges::theModuleRanges, AlignmentParameterSelector::TOBDetIdRanges::theRodRanges, AlignmentParameterSelector::TOBDetIdRanges::theSideRanges, and theTOBDetIdRanges.

Referenced by setGeometryCuts().

{
  // Allow non-specified arrays to be interpreted as empty (i.e. no selection),
  // but take care that nothing unknown is configured (to fetch typos!). 

  const std::vector<std::string> parameterNames(pSet.getParameterNames());
  for (std::vector<std::string>::const_iterator iParam = parameterNames.begin(),
         iEnd = parameterNames.end(); iParam != iEnd; ++iParam) {

    // Calling swap is more efficient than assignment:
    if (*iParam == "layerRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(theTOBDetIdRanges.theLayerRanges);
    } else if (*iParam == "moduleRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(theTOBDetIdRanges.theModuleRanges);
    } else if (*iParam == "sideRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(theTOBDetIdRanges.theSideRanges);
    } else if (*iParam == "rodRanges") {
      pSet.getParameter<std::vector<int> >(*iParam).swap(theTOBDetIdRanges.theRodRanges);
    } else {
      throw cms::Exception("BadConfig") << "[AlignmentParameterSelector::setTOBDetIdCuts] "
                                        << "Unknown parameter '" << *iParam << "'.\n";
    }
  }
}

Member Data Documentation

std::vector<int> AlignmentParameterSelector::theDetIdRanges [private]

Definition at line 117 of file AlignmentParameterSelector.h.

Referenced by outsideDetIdRanges(), and setGeometryCuts().

std::vector<int> AlignmentParameterSelector::theDetIds [private]

DetId restrictions in eta, phi, r, x, y, z to be applied for next addSelection.

Definition at line 116 of file AlignmentParameterSelector.h.

Referenced by outsideDetIdRanges(), and setGeometryCuts().

Definition at line 119 of file AlignmentParameterSelector.h.

Referenced by outsideDetIdRanges(), and setGeometryCuts().

Definition at line 118 of file AlignmentParameterSelector.h.

Referenced by outsideDetIdRanges(), and setGeometryCuts().

Definition at line 103 of file AlignmentParameterSelector.h.

Referenced by addSelection().

Definition at line 189 of file AlignmentParameterSelector.h.

Referenced by layerDeselected(), and setSpecials().

Definition at line 188 of file AlignmentParameterSelector.h.

Referenced by setSpecials().

Definition at line 102 of file AlignmentParameterSelector.h.

Referenced by addSelection().

Definition at line 185 of file AlignmentParameterSelector.h.

Referenced by layerDeselected(), and setSpecials().

Definition at line 186 of file AlignmentParameterSelector.h.

Referenced by layerDeselected(), and setSpecials().

std::vector<double> AlignmentParameterSelector::theRangesEta [private]

geometrical restrictions in eta, phi, r, x, y, z to be applied for next addSelection

Definition at line 108 of file AlignmentParameterSelector.h.

Referenced by clearGeometryCuts(), outsideGeometricalRanges(), and setGeometryCuts().

std::vector<double> AlignmentParameterSelector::theRangesPhi [private]
std::vector<double> AlignmentParameterSelector::theRangesR [private]
std::vector<double> AlignmentParameterSelector::theRangesX [private]
std::vector<double> AlignmentParameterSelector::theRangesY [private]
std::vector<double> AlignmentParameterSelector::theRangesZ [private]

Definition at line 191 of file AlignmentParameterSelector.h.

Referenced by detUnitDeselected(), and setSpecials().

Definition at line 104 of file AlignmentParameterSelector.h.

Referenced by add(), clear(), and selectedAlignables().

std::vector<std::vector<char> > AlignmentParameterSelector::theSelectedParameters [private]

Definition at line 105 of file AlignmentParameterSelector.h.

Referenced by add(), clear(), and selectedParameters().

Definition at line 187 of file AlignmentParameterSelector.h.

Referenced by layerDeselected(), and setSpecials().