CMS 3D CMS Logo

AlignmentParameterSelector Class Reference

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

#include <Alignment/CommonAlignmentAlgorithm/interface/AlignmentParameterSelector.h>

List of all members.

Public Member Functions

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 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
unsigned int addSelections (const edm::ParameterSet &pSet)
 Add several selections defined by the PSet which must contain a vstring like e.g.
 AlignmentParameterSelector (AlignableTracker *aliTracker, AlignableMuon *aliMuon=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
bool insideRanges (double value, const std::vector< double > &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
bool layerDeselected (const Alignable *alignable) const
 true if layer is deselected via "Layers<N><M>" or "DS/SS"
bool outsideRanges (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)
 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)
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)

Private Types

enum  RphiOrStereoDetUnit { Stereo, Both, Rphi }

Private Member Functions

std::string setSpecials (const std::string &name)
 Setting the special switches and returning input string, but after removing the 'special indicators' from it.

Private Attributes

int theMaxLayer
int theMinLayer
AlignableMuontheMuon
bool theOnlyDS
bool theOnlySS
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
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
2008/02/12 19:15:35
Revision
1.8
(last update by
Author
flucke
)

Definition at line 24 of file AlignmentParameterSelector.h.


Member Enumeration Documentation

enum AlignmentParameterSelector::RphiOrStereoDetUnit [private]

Enumerator:
Stereo 
Both 
Rphi 

Definition at line 103 of file AlignmentParameterSelector.h.

00103 { Stereo, Both, Rphi};


Constructor & Destructor Documentation

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

Constructor from tracker only or from tracker and muon.

Definition at line 20 of file AlignmentParameterSelector.cc.

References setSpecials().

00020                                                                                                            :
00021   theTracker(aliTracker), theMuon(aliMuon), theSelectedAlignables(), 
00022   theRangesEta(), theRangesPhi(), theRangesR(), theRangesX(), theRangesY(), theRangesZ()
00023 {
00024   this->setSpecials(""); // init theOnlyDS, theOnlySS, theSelLayers, theMinLayer, theMaxLayer, theRphiOrStereoDetUnit
00025 }

virtual AlignmentParameterSelector::~AlignmentParameterSelector (  )  [inline, virtual]

Destructor.

Definition at line 30 of file AlignmentParameterSelector.h.

00030 {}


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 257 of file AlignmentParameterSelector.cc.

References detUnitDeselected(), outsideRanges(), theSelectedAlignables, and theSelectedParameters.

00259 {
00260   unsigned int numAli = 0;
00261 
00262   // loop on Alignable objects
00263   for (align::Alignables::const_iterator iAli = alignables.begin();
00264        iAli != alignables.end(); ++iAli) {
00265 
00266     if (!this->layerDeselected(*iAli)      // check layers
00267         && !this->detUnitDeselected(*iAli) // check detunit selection
00268         && !this->outsideRanges(*iAli)) {  // check ranges
00269       // all fine, so add to output arrays
00270       theSelectedAlignables.push_back(*iAli);
00271       theSelectedParameters.push_back(paramSel);
00272       ++numAli;
00273     }
00274   }
00275 
00276   return numAli;
00277 }

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

Definition at line 522 of file AlignmentParameterSelector.cc.

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

Referenced by addSelection().

00523 {
00524   unsigned int numAli = 0;
00525 
00526   numAli += this->addAllDets(paramSel);
00527   numAli += this->addAllRods(paramSel);
00528   numAli += this->addAllLayers(paramSel);
00529   numAli += this->add(theTracker->components(), paramSel);
00530 
00531   return numAli;
00532 }

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

some helper methods

Definition at line 480 of file AlignmentParameterSelector.cc.

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

Referenced by addAllAlignables(), and addSelection().

00481 {
00482   unsigned int numAli = 0;
00483 
00484   numAli += this->add(theTracker->barrelGeomDets(), paramSel);          // TIB+TOB
00485   numAli += this->add(theTracker->endcapGeomDets(), paramSel);          // TEC
00486   numAli += this->add(theTracker->TIDGeomDets(), paramSel);             // TID
00487   numAli += this->add(theTracker->pixelHalfBarrelGeomDets(), paramSel); // PixelBarrel
00488   numAli += this->add(theTracker->pixelEndcapGeomDets(), paramSel);     // PixelEndcap
00489 
00490   return numAli;
00491 }

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

Definition at line 508 of file AlignmentParameterSelector.cc.

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

Referenced by addAllAlignables(), and addSelection().

00509 {
00510   unsigned int numAli = 0;
00511 
00512   numAli += this->add(theTracker->barrelLayers(), paramSel);          // TIB+TOB    
00513   numAli += this->add(theTracker->pixelHalfBarrelLayers(), paramSel); // PixelBarrel
00514   numAli += this->add(theTracker->endcapLayers(), paramSel);          // TEC
00515   numAli += this->add(theTracker->TIDLayers(), paramSel);             // TID
00516   numAli += this->add(theTracker->pixelEndcapLayers(), paramSel);     // PixelEndcap
00517 
00518   return numAli;
00519 }

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

Definition at line 494 of file AlignmentParameterSelector.cc.

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

Referenced by addAllAlignables(), and addSelection().

00495 {
00496   unsigned int numAli = 0;
00497 
00498   numAli += this->add(theTracker->barrelRods(), paramSel);             // TIB+TOB    
00499   numAli += this->add(theTracker->pixelHalfBarrelLadders(), paramSel); // PixelBarrel
00500   numAli += this->add(theTracker->endcapPetals(), paramSel);           // TEC        
00501   numAli += this->add(theTracker->TIDRings(), paramSel);               // TID        
00502   numAli += this->add(theTracker->pixelEndcapPetals(), paramSel);      // PixelEndcap
00503 
00504   return numAli;
00505 }

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 91 of file AlignmentParameterSelector.cc.

References addSelection(), and setGeometryCuts().

00094 {
00095   this->setGeometryCuts(pSet);
00096   return this->addSelection(name, paramSel);
00097 }

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 100 of file AlignmentParameterSelector.cc.

References 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(), 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(), theMuon, theTracker, AlignableTracker::TIDGeomDets(), AlignableTracker::TIDLayers(), AlignableTracker::TIDRings(), and AlignableTracker::TIDs().

Referenced by addSelection(), addSelections(), and KalmanAlignmentAlgorithm::initializeAlignmentParameters().

00102 {
00103   const std::string name(this->setSpecials(nameInput)); // possibly changing name
00104 
00105   unsigned int numAli = 0;
00106 
00108   // Generic Tracker Section
00110   if (name.find("Tracker") == 0) { // string starts with "Tracker"
00111     if (!theTracker) {
00112       throw cms::Exception("BadConfig") << "[TrackerAlignmentSelector::addSelection] "
00113                                         << "Configuration requires access to AlignableTracker"
00114                                         << " (for " << name << ") that is not initialized";
00115     }
00116     const std::string substructName(name, 7); // erase "Tracker" at the beginning
00117     numAli += this->add(theTracker->subStructures(substructName), paramSel);
00118   }
00120   // Old hardcoded (i.e. deprecated) tracker section (NOTE: no check on theTracker != 0)
00122   else if (name == "AllDets")       numAli += this->addAllDets(paramSel);
00123   else if (name == "AllRods")       numAli += this->addAllRods(paramSel);
00124   else if (name == "AllLayers")     numAli += this->addAllLayers(paramSel);
00125   else if (name == "AllComponents") numAli += this->add(theTracker->components(), paramSel);
00126   else if (name == "AllAlignables") numAli += this->addAllAlignables(paramSel);
00127   //
00128   // TIB+TOB
00129   //
00130   else if (name == "BarrelRods")   numAli += this->add(theTracker->barrelRods(), paramSel);
00131   else if (name == "BarrelDets")   numAli += this->add(theTracker->barrelGeomDets(), paramSel);
00132   else if (name == "BarrelLayers") numAli += this->add(theTracker->barrelLayers(), paramSel);
00133   else if (name == "TOBDets")      numAli += this->add(theTracker->outerBarrelGeomDets(), paramSel);
00134   else if (name == "TOBRods")      numAli += this->add(theTracker->outerBarrelRods(), paramSel);
00135   else if (name == "TOBLayers")    numAli += this->add(theTracker->outerBarrelLayers(), paramSel);
00136   else if (name == "TOBHalfBarrels") numAli += this->add(theTracker->outerHalfBarrels(), paramSel);
00137   else if (name == "TIBDets")      numAli += this->add(theTracker->innerBarrelGeomDets(), paramSel);
00138   else if (name == "TIBRods")      numAli += this->add(theTracker->innerBarrelRods(), paramSel);
00139   else if (name == "TIBLayers")    numAli += this->add(theTracker->innerBarrelLayers(), paramSel);
00140   else if (name == "TIBHalfBarrels") numAli += this->add(theTracker->innerHalfBarrels(), paramSel);
00141   //
00142   // PXBarrel
00143   //
00144   else if (name == "PixelHalfBarrelDets") {
00145     numAli += this->add(theTracker->pixelHalfBarrelGeomDets(), paramSel);
00146   } else if (name == "PixelHalfBarrelLadders") {
00147     numAli += this->add(theTracker->pixelHalfBarrelLadders(), paramSel);
00148   } else if (name == "PixelHalfBarrelLayers") {
00149     numAli += this->add(theTracker->pixelHalfBarrelLayers(), paramSel);
00150   } else if (name == "PixelHalfBarrels") {
00151     numAli += this->add(theTracker->pixelHalfBarrels(), paramSel);
00152   }
00153   //
00154   // PXEndcap
00155   //
00156   else if (name == "PXECDets") numAli += this->add(theTracker->pixelEndcapGeomDets(), paramSel);
00157   else if (name == "PXECPetals") numAli += this->add(theTracker->pixelEndcapPetals(), paramSel);
00158   else if (name == "PXECLayers") numAli += this->add(theTracker->pixelEndcapLayers(), paramSel);
00159   else if (name == "PXEndCaps") numAli += this->add(theTracker->pixelEndCaps(), paramSel);
00160   //
00161   // Pixel Barrel+endcap
00162   //
00163   else if (name == "PixelDets") {
00164     numAli += this->add(theTracker->pixelHalfBarrelGeomDets(), paramSel);
00165     numAli += this->add(theTracker->pixelEndcapGeomDets(), paramSel);
00166   } else if (name == "PixelRods") {
00167     numAli += this->add(theTracker->pixelHalfBarrelLadders(), paramSel);
00168     numAli += this->add(theTracker->pixelEndcapPetals(), paramSel);
00169   } else if (name == "PixelLayers") {
00170     numAli += this->add(theTracker->pixelHalfBarrelLayers(), paramSel);
00171     numAli += this->add(theTracker->pixelEndcapLayers(), paramSel);
00172   }
00173   //
00174   // TID
00175   //
00176   else if (name == "TIDs")          numAli += this->add(theTracker->TIDs(), paramSel);
00177   else if (name == "TIDLayers")     numAli += this->add(theTracker->TIDLayers(), paramSel);
00178   else if (name == "TIDRings")      numAli += this->add(theTracker->TIDRings(), paramSel);
00179   else if (name == "TIDDets")       numAli += this->add(theTracker->TIDGeomDets(), paramSel);
00180   //
00181   // TEC
00182   //
00183   else if (name == "TECDets")       numAli += this->add(theTracker->endcapGeomDets(), paramSel);
00184   else if (name == "TECPetals")     numAli += this->add(theTracker->endcapPetals(), paramSel);
00185   else if (name == "TECLayers")     numAli += this->add(theTracker->endcapLayers(), paramSel);
00186   else if (name == "TECs")          numAli += this->add(theTracker->endCaps(), paramSel);
00187   //
00188   // StripEndcap (TID+TEC)
00189   //
00190   else if (name == "EndcapDets") {
00191     numAli += this->add(theTracker->TIDGeomDets(), paramSel);
00192     numAli += this->add(theTracker->endcapGeomDets(), paramSel); 
00193   } else if (name == "EndcapPetals") {
00194     numAli += this->add(theTracker->TIDRings(), paramSel);
00195     numAli += this->add(theTracker->endcapPetals(), paramSel);
00196   } else if (name == "EndcapLayers") {
00197     numAli += this->add(theTracker->TIDLayers(), paramSel);
00198     numAli += this->add(theTracker->endcapLayers(), paramSel);
00199   }
00200   //
00201   // Strip Barrel+endcap
00202   //
00203   else if (name == "StripDets") {
00204     numAli += this->add(theTracker->barrelGeomDets(), paramSel);
00205     numAli += this->add(theTracker->TIDGeomDets(), paramSel);
00206     numAli += this->add(theTracker->endcapGeomDets(), paramSel); 
00207   } else if (name == "StripRods") {
00208     numAli += this->add(theTracker->barrelRods(), paramSel);
00209     numAli += this->add(theTracker->TIDRings(), paramSel);
00210     numAli += this->add(theTracker->endcapPetals(), paramSel);
00211   } else if (name == "StripLayers") {
00212     numAli += this->add(theTracker->barrelLayers(), paramSel);
00213     numAli += this->add(theTracker->TIDLayers(), paramSel);
00214     numAli += this->add(theTracker->endcapLayers(), paramSel);
00215   }
00217   // Muon selection
00219   // Check if name contains muon and react if alignable muon not initialized
00220   else if (name.find("Muon") != std::string::npos) {
00221     if  (!theMuon) {
00222       throw cms::Exception("BadConfig") << "[TrackerAlignmentSelector::addSelection] "
00223                                         << "Configuration requires access to AlignableMuon"
00224                                         << " which is not initialized";
00225     }
00226     else if (name == "MuonDTLayers")             add(theMuon->DTLayers(), paramSel);
00227     else if (name == "MuonDTSuperLayers")        add(theMuon->DTSuperLayers(), paramSel);
00228     else if (name == "MuonDTChambers")           add(theMuon->DTChambers(), paramSel);
00229     else if (name == "MuonDTStations")           add(theMuon->DTStations(), paramSel);
00230     else if (name == "MuonDTWheels")             add(theMuon->DTWheels(), paramSel);
00231     else if (name == "MuonBarrel")               add(theMuon->DTBarrel(), paramSel);
00232     else if (name == "MuonCSCLayers")            add(theMuon->CSCLayers(), paramSel);
00233     else if (name == "MuonCSCRings")             add(theMuon->CSCRings(), paramSel);
00234     else if (name == "MuonCSCChambers")          add(theMuon->CSCChambers(), paramSel);
00235     else if (name == "MuonCSCStations")          add(theMuon->CSCStations(), paramSel);
00236     else if (name == "MuonEndcaps")              add(theMuon->CSCEndcaps(), paramSel);
00237 
00239     // not found, but Muon
00241     else {
00242       throw cms::Exception("BadConfig") <<"[AlignmentParameterSelector::addSelection]"
00243                                         << ": Selection '" << name << "' invalid!";
00244     }
00245   } // end of "name.find("Muon") != std::string::npos"
00246   else {
00247     throw cms::Exception("BadConfig") <<"[AlignmentParameterSelector::addSelection]"
00248                                       << ": Selection '" << name << "' invalid!";
00249   }
00250   
00251   this->setSpecials(""); // reset
00252 
00253   return numAli;
00254 }

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 47 of file AlignmentParameterSelector.cc.

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

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

00048 {
00049 
00050   const std::vector<std::string> selections
00051     = pSet.getParameter<std::vector<std::string> >("alignParams");
00052   
00053   unsigned int addedSets = 0;
00054 
00055   for (unsigned int iSel = 0; iSel < selections.size(); ++iSel) {
00056 
00057     std::vector<std::string> decompSel(this->decompose(selections[iSel], ','));
00058     if (decompSel.empty()) continue; // edm::LogError or even cms::Exception??
00059 
00060     if (decompSel.size() < 2) {
00061       throw cms::Exception("BadConfig") << "@SUB=AlignmentParameterSelector::addSelections"
00062                                         << selections[iSel]<<" from alignableParamSelector: "
00063                                         << " should have at least 2 ','-separated parts";
00064     } else if (decompSel.size() > 2) {
00065       const edm::ParameterSet geoSel(pSet.getParameter<edm::ParameterSet>(decompSel[2].c_str()));
00066       this->addSelection(decompSel[0], this->convertParamSel(decompSel[1]), geoSel);
00067     } else {
00068       this->clearGeometryCuts();
00069       this->addSelection(decompSel[0], this->convertParamSel(decompSel[1]));
00070     }
00071     
00072     ++addedSets;
00073   }
00074 
00075   return addedSets;
00076 }

void AlignmentParameterSelector::clear (  ) 

remove all selected Alignables and geometrical restrictions

Definition at line 28 of file AlignmentParameterSelector.cc.

References clearGeometryCuts(), theSelectedAlignables, and theSelectedParameters.

Referenced by HIPAlignmentAlgorithm::initialize(), KalmanAlignmentAlgorithm::initializeAlignmentParameters(), and PedeSteerer::presigmas().

00029 {
00030   theSelectedAlignables.clear();
00031   theSelectedParameters.clear();
00032   this->clearGeometryCuts();
00033 }

void AlignmentParameterSelector::clearGeometryCuts (  ) 

remove all geometrical restrictions

Definition at line 36 of file AlignmentParameterSelector.cc.

References theRangesEta, theRangesPhi, theRangesR, theRangesX, theRangesY, and theRangesZ.

Referenced by addSelections(), and clear().

00037 {
00038   theRangesEta.clear();
00039   theRangesPhi.clear();
00040   theRangesR.clear();
00041   theRangesX.clear();
00042   theRangesY.clear();
00043   theRangesZ.clear();
00044 }

std::vector< char > AlignmentParameterSelector::convertParamSel ( const std::string &  selString  )  const

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

Definition at line 399 of file AlignmentParameterSelector.cc.

References HLT_VtxMuL3::result.

Referenced by AlignmentProducer::simpleMisalignment_().

00400 {
00401 
00402   // Convert selString into vector<char> of same length.
00403   // Note: Old implementation in AlignmentParameterBuilder was rigid in length,
00404   // expecting RigidBodyAlignmentParameters::N_PARAM.
00405   // But I prefer to be more general and allow other Alignables. It will throw anyway if
00406   // RigidBodyAlignmentParameters are build with wrong selection length.
00407   std::vector<char> result(selString.size());
00408 
00409   for (std::string::size_type pos = 0; pos < selString.size(); ++pos) {
00410     result[pos] = selString[pos];
00411   }
00412 
00413   return result;
00414 }

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 379 of file AlignmentParameterSelector.cc.

References HLT_VtxMuL3::result.

00380 {
00381 
00382   std::vector<std::string> result;
00383 
00384   std::string::size_type previousPos = 0;
00385   while (true) {
00386     const std::string::size_type delimiterPos = s.find(delimiter, previousPos);
00387     if (delimiterPos == std::string::npos) {
00388       result.push_back(s.substr(previousPos)); // until end
00389       break;
00390     }
00391     result.push_back(s.substr(previousPos, delimiterPos - previousPos));
00392     previousPos = delimiterPos + 1; // +1: skip delimiter
00393   }
00394 
00395   return result;
00396 }

bool AlignmentParameterSelector::detUnitDeselected ( const Alignable alignable  )  const

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

Definition at line 310 of file AlignmentParameterSelector.cc.

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

Referenced by add().

00311 {
00312 
00313   if (theRphiOrStereoDetUnit != Both && ali->alignableObjectId() == align::AlignableDetUnit) {
00314     const SiStripDetId detId(ali->geomDetId()); // do not know yet whether right type...
00315     if (detId.det() == DetId::Tracker 
00316         && (detId.subdetId() == SiStripDetId::TIB || detId.subdetId() == SiStripDetId::TID ||
00317             detId.subdetId() == SiStripDetId::TOB || detId.subdetId() == SiStripDetId::TEC)) {
00318       // We have a DetUnit in strip, so check for a selection of stereo/rphi (DetUnits in 1D layers are rphi):
00319       if ((theRphiOrStereoDetUnit == Stereo && !detId.stereo())
00320           || (theRphiOrStereoDetUnit == Rphi   &&  detId.stereo())) {
00321         return true;
00322       }
00323     }
00324   }
00325 
00326   return false; // do not deselect...
00327 }

bool AlignmentParameterSelector::insideRanges ( double  value,
const std::vector< double > &  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

Definition at line 346 of file AlignmentParameterSelector.cc.

References Exception, and i.

Referenced by outsideRanges().

00348 {
00349   // might become templated on <double> ?
00350 
00351   if (ranges.size()%2 != 0) {
00352     cms::Exception("BadConfig") << "@SUB=AlignmentParameterSelector::insideRanges" 
00353                                 << " need even number of entries in ranges instead of "
00354                                 << ranges.size();
00355     return false;
00356   }
00357 
00358   for (unsigned int i = 0; i < ranges.size(); i += 2) {
00359     if (isPhi) { // mapping into (-pi,+pi] and checking for range including sign flip area
00360       Geom::Phi<double> rangePhi1(ranges[i]);
00361       Geom::Phi<double> rangePhi2(ranges[i+1]);
00362       Geom::Phi<double> valuePhi(value);
00363       if (rangePhi1 <= valuePhi && valuePhi < rangePhi2) { // 'normal'
00364         return true;
00365       }
00366       if (rangePhi2  < rangePhi1 && (rangePhi1 <= valuePhi || valuePhi < rangePhi2)) {// 'sign flip'
00367         return true;
00368       }
00369     } else if (ranges[i] <= value && value < ranges[i+1]) {
00370       return true;
00371     }
00372   }
00373 
00374   return false;
00375 }

bool AlignmentParameterSelector::layerDeselected ( const Alignable alignable  )  const

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

Definition at line 280 of file AlignmentParameterSelector.cc.

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

00281 {
00282   if (theOnlySS || theOnlyDS || theSelLayers) {
00283     TrackerAlignableId idProvider;
00284     std::pair<int,int> typeLayer = idProvider.typeAndLayerFromDetId(ali->id());
00285     int type  = typeLayer.first;
00286     int layer = typeLayer.second;
00287     
00288     // select on single/double sided barrel layers in TIB/TOB
00289     if (theOnlySS // only single sided
00290         && (std::abs(type) == SiStripDetId::TIB || std::abs(type) == SiStripDetId::TOB)
00291         && layer <= 2) {
00292       return true;
00293     }
00294     if (theOnlyDS // only double sided
00295         && (std::abs(type) == SiStripDetId::TIB || std::abs(type) == SiStripDetId::TOB)
00296         && layer > 2) {
00297       return true;
00298     }
00299     
00300     // reject layers
00301     if (theSelLayers && (layer < theMinLayer || layer > theMaxLayer)) {
00302       return true;
00303     }
00304   }
00305   
00306   return false; // do not deselect...
00307 }

bool AlignmentParameterSelector::outsideRanges ( const Alignable alignable  )  const

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

Definition at line 330 of file AlignmentParameterSelector.cc.

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

Referenced by add().

00331 {
00332 
00333   const align::PositionType& position(alignable->globalPosition());
00334 
00335   if (!theRangesEta.empty() && !this->insideRanges((position.eta()), theRangesEta)) return true;
00336   if (!theRangesPhi.empty() && !this->insideRanges((position.phi()), theRangesPhi,true))return true;
00337   if (!theRangesR.empty()   && !this->insideRanges((position.perp()),theRangesR)) return true;
00338   if (!theRangesX.empty()   && !this->insideRanges((position.x()),   theRangesX)) return true;
00339   if (!theRangesY.empty()   && !this->insideRanges((position.y()),   theRangesY)) return true;
00340   if (!theRangesZ.empty()   && !this->insideRanges((position.z()),   theRangesZ)) return true;
00341 
00342   return false;
00343 }

const align::Alignables& AlignmentParameterSelector::selectedAlignables (  )  const [inline]

vector of alignables selected so far

Definition at line 33 of file AlignmentParameterSelector.h.

References theSelectedAlignables.

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

00033 { return theSelectedAlignables; }

const std::vector<std::vector<char> >& AlignmentParameterSelector::selectedParameters ( void   )  const [inline]

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

Definition at line 35 of file AlignmentParameterSelector.h.

References theSelectedParameters.

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

00035 { return theSelectedParameters; }

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 79 of file AlignmentParameterSelector.cc.

References edm::ParameterSet::getParameter(), theRangesEta, theRangesPhi, theRangesR, theRangesX, theRangesY, and theRangesZ.

Referenced by addSelection().

00080 {
00081 
00082   theRangesEta = pSet.getParameter<std::vector<double> >("etaRanges");
00083   theRangesPhi = pSet.getParameter<std::vector<double> >("phiRanges");
00084   theRangesR   = pSet.getParameter<std::vector<double> >("rRanges"  );
00085   theRangesX   = pSet.getParameter<std::vector<double> >("xRanges"  );
00086   theRangesY   = pSet.getParameter<std::vector<double> >("yRanges"  );
00087   theRangesZ   = pSet.getParameter<std::vector<double> >("zRanges"  );
00088 }

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 418 of file AlignmentParameterSelector.cc.

References Both, ds, layers, LogDebug, translate::newName, Rphi, size, ss, Stereo, theMaxLayer, theMinLayer, theOnlyDS, theOnlySS, theRphiOrStereoDetUnit, and theSelLayers.

Referenced by addSelection(), and AlignmentParameterSelector().

00419 {
00420   // Use new string only, although direct erasing of found indicator causes problems for 'DSS',
00421   // but 'DSS' makes absolutely no sense!
00422   std::string newName(name); 
00423 
00424   const std::string::size_type ss = newName.rfind("SS");
00425   if (ss != std::string::npos) {
00426     newName.erase(ss, 2); // 2: length of 'SS'
00427     theOnlySS = true;
00428   } else {
00429     theOnlySS = false;
00430   }
00431 
00432   const std::string::size_type ds = newName.rfind("DS");
00433   if (ds != std::string::npos) {
00434     newName.erase(ds, 2); // 2: length of 'DS'
00435     theOnlyDS = true;
00436   } else {
00437     theOnlyDS = false;
00438   }
00439   
00440   const std::string::size_type size = newName.size();
00441   const std::string::size_type layers = newName.rfind("Layers");
00442   if (layers != std::string::npos && size - layers - 2 == 6 // 2 digits, 6: length of 'Layers'
00443       && isdigit(newName[size-1]) && isdigit(newName[size-2])) {
00444     theSelLayers = true;
00445     theMinLayer = newName[size-2] - '0';
00446     theMaxLayer = newName[size-1] - '0';
00447     newName.erase(layers);
00448   } else {
00449     theSelLayers = false;
00450     theMinLayer = -1;
00451     theMaxLayer = 99999;
00452   }
00453 
00454   theRphiOrStereoDetUnit = Both;
00455   if (newName.rfind("Unit") != std::string::npos) {
00456     const std::string::size_type uRph = newName.rfind("UnitRphi");
00457     if (uRph != std::string::npos) {
00458       newName.erase(uRph + 4, 4); // keep 'Unit' (4) and erase 'Rphi' (4)
00459       theRphiOrStereoDetUnit = Rphi;
00460     }
00461     const std::string::size_type uSte = newName.rfind("UnitStereo");
00462     if (uSte != std::string::npos) {
00463       newName.erase(uSte + 4, 6); // keep 'Unit' (4) and erase 'Stereo' (6)
00464       theRphiOrStereoDetUnit = Stereo;
00465     }
00466   }
00467 
00468   if (newName != name) {
00469     LogDebug("Alignment") << "@SUB=AlignmentParameterSelector::setSpecials"
00470                           << name << " becomes " << newName << ", makes theOnlySS " << theOnlySS
00471                           << ", theOnlyDS " << theOnlyDS << ", theSelLayers " << theSelLayers
00472                           << ", theMinLayer " << theMinLayer << ", theMaxLayer " << theMaxLayer
00473                           << ", theRphiOrStereoDetUnit " << theRphiOrStereoDetUnit;
00474   }
00475 
00476   return newName;
00477 }


Member Data Documentation

int AlignmentParameterSelector::theMaxLayer [private]

Definition at line 102 of file AlignmentParameterSelector.h.

Referenced by layerDeselected(), and setSpecials().

int AlignmentParameterSelector::theMinLayer [private]

Definition at line 101 of file AlignmentParameterSelector.h.

Referenced by setSpecials().

AlignableMuon* AlignmentParameterSelector::theMuon [private]

Definition at line 85 of file AlignmentParameterSelector.h.

Referenced by addSelection().

bool AlignmentParameterSelector::theOnlyDS [private]

Definition at line 98 of file AlignmentParameterSelector.h.

Referenced by layerDeselected(), and setSpecials().

bool AlignmentParameterSelector::theOnlySS [private]

Definition at line 99 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 90 of file AlignmentParameterSelector.h.

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

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

Definition at line 91 of file AlignmentParameterSelector.h.

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

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

Definition at line 92 of file AlignmentParameterSelector.h.

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

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

Definition at line 93 of file AlignmentParameterSelector.h.

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

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

Definition at line 94 of file AlignmentParameterSelector.h.

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

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

Definition at line 95 of file AlignmentParameterSelector.h.

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

RphiOrStereoDetUnit AlignmentParameterSelector::theRphiOrStereoDetUnit [private]

Definition at line 104 of file AlignmentParameterSelector.h.

Referenced by detUnitDeselected(), and setSpecials().

align::Alignables AlignmentParameterSelector::theSelectedAlignables [private]

Definition at line 86 of file AlignmentParameterSelector.h.

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

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

Definition at line 87 of file AlignmentParameterSelector.h.

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

bool AlignmentParameterSelector::theSelLayers [private]

Definition at line 100 of file AlignmentParameterSelector.h.

Referenced by layerDeselected(), and setSpecials().

AlignableTracker* AlignmentParameterSelector::theTracker [private]

Definition at line 84 of file AlignmentParameterSelector.h.

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


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:14:35 2009 for CMSSW by  doxygen 1.5.4