27 : theTracker(aliTracker),
30 theSelectedAlignables(),
70 unsigned int addedSets = 0;
72 for (
unsigned int iSel = 0; iSel < selections.size(); ++iSel) {
73 std::vector<std::string> decompSel(this->
decompose(selections[iSel],
','));
74 if (decompSel.empty())
77 if (decompSel.size() < 2) {
78 throw cms::Exception(
"BadConfig") <<
"@SUB=AlignmentParameterSelector::addSelections" << selections[iSel]
79 <<
" from alignableParamSelector: "
80 <<
" should have at least 2 ','-separated parts";
81 }
else if (decompSel.size() > 2) {
102 for (std::vector<std::string>::const_iterator iParam = parameterNames.begin(), iEnd = parameterNames.end();
106 if (*iParam ==
"etaRanges") {
108 }
else if (*iParam ==
"phiRanges") {
110 }
else if (*iParam ==
"rRanges") {
112 }
else if (*iParam ==
"xRanges") {
114 }
else if (*iParam ==
"yRanges") {
116 }
else if (*iParam ==
"zRanges") {
118 }
else if (*iParam ==
"detIds") {
120 }
else if (*iParam ==
"detIdRanges") {
122 }
else if (*iParam ==
"excludedDetIds") {
124 }
else if (*iParam ==
"excludedDetIdRanges") {
126 }
else if (*iParam ==
"pxbDetId") {
129 }
else if (*iParam ==
"pxfDetId") {
132 }
else if (*iParam ==
"tibDetId") {
135 }
else if (*iParam ==
"tidDetId") {
138 }
else if (*iParam ==
"tobDetId") {
141 }
else if (*iParam ==
"tecDetId") {
145 throw cms::Exception(
"BadConfig") <<
"[AlignmentParameterSelector::setGeometryCuts] "
146 <<
"Unknown parameter '" << *iParam <<
"'.\n";
157 for (std::vector<std::string>::const_iterator iParam = parameterNames.begin(), iEnd = parameterNames.end();
161 if (*iParam ==
"ladderRanges") {
163 }
else if (*iParam ==
"layerRanges") {
165 }
else if (*iParam ==
"moduleRanges") {
168 throw cms::Exception(
"BadConfig") <<
"[AlignmentParameterSelector::setPXBDetIdCuts] "
169 <<
"Unknown parameter '" << *iParam <<
"'.\n";
180 for (std::vector<std::string>::const_iterator iParam = parameterNames.begin(), iEnd = parameterNames.end();
184 if (*iParam ==
"bladeRanges") {
186 }
else if (*iParam ==
"diskRanges") {
188 }
else if (*iParam ==
"moduleRanges") {
190 }
else if (*iParam ==
"panelRanges") {
192 }
else if (*iParam ==
"sideRanges") {
195 throw cms::Exception(
"BadConfig") <<
"[AlignmentParameterSelector::setPXFDetIdCuts] "
196 <<
"Unknown parameter '" << *iParam <<
"'.\n";
207 for (std::vector<std::string>::const_iterator iParam = parameterNames.begin(), iEnd = parameterNames.end();
211 if (*iParam ==
"layerRanges") {
213 }
else if (*iParam ==
"moduleRanges") {
215 }
else if (*iParam ==
"stringRanges") {
217 }
else if (*iParam ==
"sideRanges") {
220 throw cms::Exception(
"BadConfig") <<
"[AlignmentParameterSelector::setTIBDetIdCuts] "
221 <<
"Unknown parameter '" << *iParam <<
"'.\n";
232 for (std::vector<std::string>::const_iterator iParam = parameterNames.begin(), iEnd = parameterNames.end();
236 if (*iParam ==
"diskRanges") {
238 }
else if (*iParam ==
"moduleRanges") {
240 }
else if (*iParam ==
"ringRanges") {
242 }
else if (*iParam ==
"sideRanges") {
245 throw cms::Exception(
"BadConfig") <<
"[AlignmentParameterSelector::setTIDDetIdCuts] "
246 <<
"Unknown parameter '" << *iParam <<
"'.\n";
257 for (std::vector<std::string>::const_iterator iParam = parameterNames.begin(), iEnd = parameterNames.end();
261 if (*iParam ==
"layerRanges") {
263 }
else if (*iParam ==
"moduleRanges") {
265 }
else if (*iParam ==
"sideRanges") {
267 }
else if (*iParam ==
"rodRanges") {
270 throw cms::Exception(
"BadConfig") <<
"[AlignmentParameterSelector::setTOBDetIdCuts] "
271 <<
"Unknown parameter '" << *iParam <<
"'.\n";
282 for (std::vector<std::string>::const_iterator iParam = parameterNames.begin(), iEnd = parameterNames.end();
286 if (*iParam ==
"wheelRanges") {
288 }
else if (*iParam ==
"petalRanges") {
290 }
else if (*iParam ==
"moduleRanges") {
292 }
else if (*iParam ==
"ringRanges") {
294 }
else if (*iParam ==
"sideRanges") {
297 throw cms::Exception(
"BadConfig") <<
"[AlignmentParameterSelector::setTECDetIdCuts] "
298 <<
"Unknown parameter '" << *iParam <<
"'.\n";
305 const std::vector<char> ¶mSel,
315 unsigned int numAli = 0;
320 if (name.find(
"Tracker") == 0) {
322 throw cms::Exception(
"BadConfig") <<
"[AlignmentParameterSelector::addSelection] "
323 <<
"Configuration requires access to AlignableTracker"
324 <<
" (for " << name <<
") that is not initialized";
332 else if (name ==
"AllDets")
334 else if (name ==
"AllRods")
336 else if (name ==
"AllLayers")
338 else if (name ==
"AllComponents")
340 else if (name ==
"AllAlignables")
345 else if (name ==
"BarrelRods")
347 else if (name ==
"BarrelDets")
349 else if (name ==
"BarrelLayers")
351 else if (name ==
"TOBDets")
353 else if (name ==
"TOBRods")
355 else if (name ==
"TOBLayers")
357 else if (name ==
"TOBHalfBarrels")
359 else if (name ==
"TIBDets")
361 else if (name ==
"TIBRods")
363 else if (name ==
"TIBLayers")
365 else if (name ==
"TIBHalfBarrels")
370 else if (name ==
"PixelHalfBarrelDets") {
372 }
else if (name ==
"PixelHalfBarrelLadders") {
374 }
else if (name ==
"PixelHalfBarrelLayers") {
376 }
else if (name ==
"PixelHalfBarrels") {
382 else if (name ==
"PXECDets")
384 else if (name ==
"PXECPetals")
386 else if (name ==
"PXECLayers")
388 else if (name ==
"PXECHalfCylinders")
390 else if (name ==
"PXEndCaps")
395 else if (name ==
"PixelDets") {
398 }
else if (name ==
"PixelRods") {
401 }
else if (name ==
"PixelLayers") {
408 else if (name ==
"TIDs")
410 else if (name ==
"TIDLayers")
412 else if (name ==
"TIDRings")
414 else if (name ==
"TIDDets")
419 else if (name ==
"TECDets")
421 else if (name ==
"TECPetals")
423 else if (name ==
"TECLayers")
425 else if (name ==
"TECs")
430 else if (name ==
"EndcapDets") {
433 }
else if (name ==
"EndcapPetals") {
436 }
else if (name ==
"EndcapLayers") {
443 else if (name ==
"StripDets") {
447 }
else if (name ==
"StripRods") {
451 }
else if (name ==
"StripLayers") {
460 else if (name.find(
"Muon") != std::string::npos) {
462 throw cms::Exception(
"BadConfig") <<
"[AlignmentParameterSelector::addSelection] "
463 <<
"Configuration requires access to AlignableMuon"
464 <<
" which is not initialized";
465 }
else if (name ==
"MuonDTLayers")
467 else if (name ==
"MuonDTSuperLayers")
469 else if (name ==
"MuonDTChambers")
471 else if (name ==
"MuonDTStations")
473 else if (name ==
"MuonDTWheels")
475 else if (name ==
"MuonBarrel")
477 else if (name ==
"MuonCSCLayers")
479 else if (name ==
"MuonCSCRings")
481 else if (name ==
"MuonCSCChambers")
483 else if (name ==
"MuonCSCStations")
485 else if (name ==
"MuonEndcaps")
492 throw cms::Exception(
"BadConfig") <<
"[AlignmentParameterSelector::addSelection]"
493 <<
": Selection '" << name <<
"' invalid!";
500 else if (name.find(
"Extras") == 0) {
502 throw cms::Exception(
"BadConfig") <<
"[AlignmentParameterSelector::addSelection] "
503 <<
"Configuration requires access to AlignableExtras"
504 <<
" (for " << name <<
") that is not initialized";
512 throw cms::Exception(
"BadConfig") <<
"[AlignmentParameterSelector::addSelection]"
513 <<
": Selection '" << name <<
"' invalid!";
523 unsigned int numAli = 0;
526 for (align::Alignables::const_iterator iAli = alignables.begin(); iAli != alignables.end(); ++iAli) {
546 int type = typeLayer.first;
547 int layer = typeLayer.second;
608 const DetId detId(alignable->
id());
609 const int subdetId = detId.
subdetId();
723 template <
typename T>
727 if (ranges.size() % 2 != 0) {
728 cms::Exception(
"BadConfig") <<
"@SUB=AlignmentParameterSelector::insideRanges"
729 <<
" need even number of entries in ranges instead of " << ranges.size();
733 for (
unsigned int i = 0;
i < ranges.size();
i += 2) {
738 if (rangePhi1 <= valuePhi && valuePhi < rangePhi2) {
741 if (rangePhi2 < rangePhi1 && (rangePhi1 <= valuePhi || valuePhi < rangePhi2)) {
744 }
else if (ranges[
i] <= value && value < ranges[
i + 1]) {
754 bool AlignmentParameterSelector::insideRanges<int>(
int value,
const std::vector<int> &
ranges,
bool )
const {
755 if (
ranges.size() % 2 != 0) {
756 cms::Exception(
"BadConfig") <<
"@SUB=AlignmentParameterSelector::insideRanges"
757 <<
" need even number of entries in ranges instead of " <<
ranges.size();
761 for (
unsigned int i = 0;
i <
ranges.size();
i += 2) {
770 if (
std::find(values.begin(), values.end(),
value) != values.end())
778 std::vector<std::string>
result;
783 if (delimiterPos == std::string::npos) {
784 result.push_back(s.substr(previousPos));
787 result.push_back(s.substr(previousPos, delimiterPos - previousPos));
788 previousPos = delimiterPos + 1;
801 std::vector<char>
result(selString.size());
804 result[pos] = selString[pos];
817 if (ss != std::string::npos) {
818 newName.erase(ss, 2);
825 if (ds != std::string::npos) {
826 newName.erase(ds, 2);
834 if (layers != std::string::npos && size - layers - 2 == 6
835 && isdigit(newName[size - 1]) && isdigit(newName[size - 2])) {
839 newName.erase(layers);
847 if (newName.rfind(
"Unit") != std::string::npos) {
849 if (uRph != std::string::npos) {
850 newName.erase(uRph + 4, 4);
854 if (uSte != std::string::npos) {
855 newName.erase(uSte + 4, 6);
860 if (newName != name) {
861 LogDebug(
"Alignment") <<
"@SUB=AlignmentParameterSelector::setSpecials" << name <<
" becomes " << newName
862 <<
", makes theOnlySS " <<
theOnlySS <<
", theOnlyDS " <<
theOnlyDS <<
", theSelLayers "
872 unsigned int numAli = 0;
885 unsigned int numAli = 0;
898 unsigned int numAli = 0;
911 unsigned int numAli = 0;
align::ID id() const
Return the ID of Alignable, i.e. DetId of 'first' component GeomDet(Unit).
struct AlignmentParameterSelector::TOBDetIdRanges theTOBDetIdRanges
AlignableExtras * theExtras
bool outsideGeometricalRanges(const Alignable *alignable) const
true if geometrical restrictions in eta, phi, r, x, y, z not satisfied
Alignables & pixelHalfBarrelGeomDets()
Return pixel barrel GeomDets.
std::vector< double > theRangesPhi
void setTIDDetIdCuts(const edm::ParameterSet &pSet)
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
struct AlignmentParameterSelector::TECDetIdRanges theTECDetIdRanges
unsigned int tibLayer(const DetId &id) const
unsigned int tibString(const DetId &id) const
std::pair< int, int > typeAndLayerFromDetId(const DetId &detId, const TrackerTopology *tTopo) const
unsigned int tidRing(const DetId &id) const
align::Alignables DTLayers()
Methods to return specific of components.
AlignmentParameterSelector(AlignableTracker *aliTracker, AlignableMuon *aliMuon=nullptr, AlignableExtras *aliExtras=nullptr)
Constructor from tracker only or from tracker and muon.
unsigned int addAllAlignables(const std::vector< char > ¶mSel)
bool insideRanges(T value, const std::vector< T > &ranges, bool isPhi=false) const
align::Alignables CSCChambers()
align::Alignables theSelectedAlignables
static constexpr auto TID
void clearGeometryCuts()
remove all geometrical restrictions
unsigned int pxfDisk(const DetId &id) const
std::vector< int > theDetIdRanges
unsigned int tecRing(const DetId &id) const
ring id
std::vector< std::vector< char > > theSelectedParameters
align::Alignables DTBarrel()
unsigned int pxbLadder(const DetId &id) const
align::Alignables CSCStations()
Alignables & pixelHalfBarrelLayers()
Return pixel half barrel layers.
std::vector< int > theStringRanges
const Alignables & components() const override
Return vector of direct components.
std::vector< int > thePetalRanges
unsigned int tidWheel(const DetId &id) const
unsigned int pxbModule(const DetId &id) const
align::Alignables DTStations()
struct AlignmentParameterSelector::TIBDetIdRanges theTIBDetIdRanges
std::vector< int > theLadderRanges
Alignables barrelGeomDets()
Return inner and outer barrel GeomDets together.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< int > theModuleRanges
std::vector< int > theExcludedDetIds
std::vector< int > theDiskRanges
std::vector< int > theSideRanges
std::vector< int > theModuleRanges
constexpr std::array< uint8_t, layerIndexSize > layer
const TrackerTopology * trackerTopology() const
Return tracker topology used to build AlignableTracker.
void setGeometryCuts(const edm::ParameterSet &pSet)
struct AlignmentParameterSelector::TIDDetIdRanges theTIDDetIdRanges
unsigned int tibSide(const DetId &id) const
void clear()
remove all selected Alignables and geometrical restrictions
Container::value_type value_type
std::vector< int > theDetIds
DetId restrictions in eta, phi, r, x, y, z to be applied for next addSelection.
align::Alignables CSCEndcaps()
unsigned int tidSide(const DetId &id) const
std::vector< int > theModuleRanges
align::Alignables DTChambers()
Alignables & innerBarrelGeomDets()
Return inner barrel GeomDets.
void setPXBDetIdCuts(const edm::ParameterSet &pSet)
align::Alignables DTWheels()
std::vector< double > theRangesZ
Alignables & endCaps()
Return TECs.
unsigned int tidModule(const DetId &id) const
unsigned int addAllDets(const std::vector< char > ¶mSel)
some helper methods
void setTECDetIdCuts(const edm::ParameterSet &pSet)
Alignables & TIDGeomDets()
Return TID GeomDets.
unsigned int addAllLayers(const std::vector< char > ¶mSel)
unsigned int tobSide(const DetId &id) const
std::vector< int > theSideRanges
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
struct AlignmentParameterSelector::PXFDetIdRanges thePXFDetIdRanges
std::vector< std::string > decompose(const std::string &s, std::string::value_type delimiter) const
Decomposing input string 's' into parts separated by 'delimiter'.
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
Abs< T >::type abs(const T &t)
std::vector< int > theSideRanges
Alignables & outerBarrelRods()
Return outer barrel rods.
Alignables barrelRods()
Return inner and outer barrel rods.
std::vector< int > theLayerRanges
std::vector< std::string > getParameterNames() const
Alignables & pixelEndcapPetals()
Return pixel endcap petals.
static constexpr auto TOB
std::vector< int > theWheelRanges
AlignableTracker * theTracker
Alignables barrelLayers()
Return inner and outer barrel layers.
Alignables & endcapGeomDets()
Return endcap GeomDets.
unsigned int tibModule(const DetId &id) const
Alignables & pixelEndcapGeomDets()
Return pixel endcap GeomDets.
unsigned int pxfModule(const DetId &id) const
align::Alignables CSCLayers()
std::vector< int > theSideRanges
Alignables & TIDs()
Return TIDs.
unsigned int pxbLayer(const DetId &id) const
unsigned int tecModule(const DetId &id) const
RphiOrStereoDetUnit theRphiOrStereoDetUnit
std::vector< int > theRingRanges
unsigned int addAllRods(const std::vector< char > ¶mSel)
Detector identifier class for the strip tracker.
Alignables & outerBarrelLayers()
Return outer barrel layers.
void setPXFDetIdCuts(const edm::ParameterSet &pSet)
Alignables & outerBarrelGeomDets()
Return outer barrel GeomDets.
std::vector< int > theModuleRanges
std::vector< int > theBladeRanges
Alignables & TIDLayers()
Return TID layers.
std::vector< double > theRangesY
Alignables & TIDRings()
Return TID rings.
std::vector< int > theRodRanges
ParameterSet const & getParameterSet(std::string const &) const
Alignables & pixelHalfBarrels()
Return Pixel half barrels.
Alignables & pixelEndCaps()
Return TPEs.
align::Alignables DTSuperLayers()
Alignables & subStructures(const std::string &subStructName)
T getParameter(std::string const &) const
std::vector< double > theRangesEta
geometrical restrictions in eta, phi, r, x, y, z to be applied for next addSelection ...
std::vector< int > theExcludedDetIdRanges
std::vector< int > theDiskRanges
static constexpr auto TIB
std::vector< Alignable * > Alignables
unsigned int tobModule(const DetId &id) const
Alignables & innerBarrelLayers()
Return inner barrel layers.
std::vector< int > theModuleRanges
struct AlignmentParameterSelector::PXBDetIdRanges thePXBDetIdRanges
unsigned int addSelection(const std::string &name, const std::vector< char > ¶mSel)
align::Alignables CSCRings()
void setTOBDetIdCuts(const edm::ParameterSet &pSet)
std::vector< int > theRingRanges
static int position[264][3]
unsigned int add(const align::Alignables &alignables, const std::vector< char > ¶mSel)
adding alignables which fulfil geometrical restrictions and special switches
std::vector< char > convertParamSel(const std::string &selString) const
Converting std::string into std::vector<char>
unsigned int addSelections(const edm::ParameterSet &pSet)
Alignables & pixelHalfBarrelLadders()
Return pixel half barrel ladders (implemented as AlignableRods)
bool outsideDetIdRanges(const Alignable *alignable) const
true if DetId restrictions are not satisfied
unsigned int pxfSide(const DetId &id) const
bool isMemberOfVector(int value, const std::vector< int > &values) const
true if value is member of vector of values
unsigned int tecPetalNumber(const DetId &id) const
std::vector< double > theRangesR
std::vector< int > theLayerRanges
const PositionType & globalPosition() const
Return the global position of the object.
std::vector< int > theModuleRanges
std::vector< int > theSideRanges
Alignables & endcapPetals()
Return encap petals.
Alignables & innerHalfBarrels()
Return TIB half barrels.
unsigned int tobRod(const DetId &id) const
std::vector< int > thePanelRanges
std::vector< int > theLayerRanges
const AlignableTracker * alignableTracker() const
Constructor of the full muon geometry.
unsigned int tecWheel(const DetId &id) const
Alignables & endcapLayers()
Return endcap layers.
Alignables & pixelEndcapHalfCylinders()
Return pixel endcap half cylinders.
std::vector< double > theRangesX
const DetId & geomDetId() const
tuple size
Write out results.
unsigned int pxfPanel(const DetId &id) const
unsigned int pxfBlade(const DetId &id) const
static constexpr auto TEC
unsigned int tobLayer(const DetId &id) const
Alignables & pixelEndcapLayers()
Return pixel endcap layers.
unsigned int tecSide(const DetId &id) const
Alignables & outerHalfBarrels()
Return TOB half barrels.
bool layerDeselected(const Alignable *alignable) const
true if layer is deselected via "Layers<N><M>" or "DS/SS"
bool detUnitDeselected(const Alignable *alignable) const
true if alignable is DetUnit deselected by Unit<Rphi/Stereo> selection
Alignables & innerBarrelRods()
Return inner barrel rods.
std::string setSpecials(const std::string &name)
void setTIBDetIdCuts(const edm::ParameterSet &pSet)