26 theTracker(aliTracker), theMuon(aliMuon), theExtras(aliExtras), theSelectedAlignables(),
27 theRangesEta(), theRangesPhi(), theRangesR(), theRangesX(), theRangesY(), theRangesZ()
67 const std::vector<std::string> selections
68 = pSet.
getParameter<std::vector<std::string> >(
"alignParams");
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())
continue;
76 if (decompSel.size() < 2) {
77 throw cms::Exception(
"BadConfig") <<
"@SUB=AlignmentParameterSelector::addSelections"
78 << selections[iSel]<<
" from alignableParamSelector: "
79 <<
" should have at least 2 ','-separated parts";
80 }
else if (decompSel.size() > 2) {
102 for (std::vector<std::string>::const_iterator iParam = parameterNames.begin(),
103 iEnd = parameterNames.end(); iParam != iEnd; ++iParam) {
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";
158 for (std::vector<std::string>::const_iterator iParam = parameterNames.begin(),
159 iEnd = parameterNames.end(); iParam != iEnd; ++iParam) {
162 if (*iParam ==
"ladderRanges") {
164 }
else if (*iParam ==
"layerRanges") {
166 }
else if (*iParam ==
"moduleRanges") {
169 throw cms::Exception(
"BadConfig") <<
"[AlignmentParameterSelector::setPXBDetIdCuts] "
170 <<
"Unknown parameter '" << *iParam <<
"'.\n";
182 for (std::vector<std::string>::const_iterator iParam = parameterNames.begin(),
183 iEnd = parameterNames.end(); iParam != iEnd; ++iParam) {
186 if (*iParam ==
"bladeRanges") {
188 }
else if (*iParam ==
"diskRanges") {
190 }
else if (*iParam ==
"moduleRanges") {
192 }
else if (*iParam ==
"panelRanges") {
194 }
else if (*iParam ==
"sideRanges") {
197 throw cms::Exception(
"BadConfig") <<
"[AlignmentParameterSelector::setPXFDetIdCuts] "
198 <<
"Unknown parameter '" << *iParam <<
"'.\n";
210 for (std::vector<std::string>::const_iterator iParam = parameterNames.begin(),
211 iEnd = parameterNames.end(); iParam != iEnd; ++iParam) {
214 if (*iParam ==
"layerRanges") {
216 }
else if (*iParam ==
"moduleRanges") {
218 }
else if (*iParam ==
"stringRanges") {
220 }
else if (*iParam ==
"sideRanges") {
223 throw cms::Exception(
"BadConfig") <<
"[AlignmentParameterSelector::setTIBDetIdCuts] "
224 <<
"Unknown parameter '" << *iParam <<
"'.\n";
236 for (std::vector<std::string>::const_iterator iParam = parameterNames.begin(),
237 iEnd = parameterNames.end(); iParam != iEnd; ++iParam) {
240 if (*iParam ==
"diskRanges") {
242 }
else if (*iParam ==
"moduleRanges") {
244 }
else if (*iParam ==
"ringRanges") {
246 }
else if (*iParam ==
"sideRanges") {
249 throw cms::Exception(
"BadConfig") <<
"[AlignmentParameterSelector::setTIDDetIdCuts] "
250 <<
"Unknown parameter '" << *iParam <<
"'.\n";
262 for (std::vector<std::string>::const_iterator iParam = parameterNames.begin(),
263 iEnd = parameterNames.end(); iParam != iEnd; ++iParam) {
266 if (*iParam ==
"layerRanges") {
268 }
else if (*iParam ==
"moduleRanges") {
270 }
else if (*iParam ==
"sideRanges") {
272 }
else if (*iParam ==
"rodRanges") {
275 throw cms::Exception(
"BadConfig") <<
"[AlignmentParameterSelector::setTOBDetIdCuts] "
276 <<
"Unknown parameter '" << *iParam <<
"'.\n";
288 for (std::vector<std::string>::const_iterator iParam = parameterNames.begin(),
289 iEnd = parameterNames.end(); iParam != iEnd; ++iParam) {
292 if (*iParam ==
"wheelRanges") {
294 }
else if (*iParam ==
"petalRanges") {
296 }
else if (*iParam ==
"moduleRanges") {
298 }
else if (*iParam ==
"ringRanges") {
300 }
else if (*iParam ==
"sideRanges") {
303 throw cms::Exception(
"BadConfig") <<
"[AlignmentParameterSelector::setTECDetIdCuts] "
304 <<
"Unknown parameter '" << *iParam <<
"'.\n";
311 const std::vector<char> ¶mSel,
320 const std::vector<char> ¶mSel)
324 unsigned int numAli = 0;
329 if (name.find(
"Tracker") == 0) {
331 throw cms::Exception(
"BadConfig") <<
"[AlignmentParameterSelector::addSelection] "
332 <<
"Configuration requires access to AlignableTracker"
333 <<
" (for " << name <<
") that is not initialized";
341 else if (name ==
"AllDets") numAli += this->
addAllDets(paramSel);
342 else if (name ==
"AllRods") numAli += this->
addAllRods(paramSel);
343 else if (name ==
"AllLayers") numAli += this->
addAllLayers(paramSel);
345 else if (name ==
"AllAlignables") numAli += this->
addAllAlignables(paramSel);
363 else if (name ==
"PixelHalfBarrelDets") {
365 }
else if (name ==
"PixelHalfBarrelLadders") {
367 }
else if (name ==
"PixelHalfBarrelLayers") {
369 }
else if (name ==
"PixelHalfBarrels") {
382 else if (name ==
"PixelDets") {
385 }
else if (name ==
"PixelRods") {
388 }
else if (name ==
"PixelLayers") {
409 else if (name ==
"EndcapDets") {
412 }
else if (name ==
"EndcapPetals") {
415 }
else if (name ==
"EndcapLayers") {
422 else if (name ==
"StripDets") {
426 }
else if (name ==
"StripRods") {
430 }
else if (name ==
"StripLayers") {
439 else if (name.find(
"Muon") != std::string::npos) {
441 throw cms::Exception(
"BadConfig") <<
"[AlignmentParameterSelector::addSelection] "
442 <<
"Configuration requires access to AlignableMuon"
443 <<
" which is not initialized";
461 throw cms::Exception(
"BadConfig") <<
"[AlignmentParameterSelector::addSelection]"
462 <<
": Selection '" << name <<
"' invalid!";
469 else if (name.find(
"Extras") == 0) {
471 throw cms::Exception(
"BadConfig") <<
"[AlignmentParameterSelector::addSelection] "
472 <<
"Configuration requires access to AlignableExtras"
473 <<
" (for " << name <<
") that is not initialized";
481 throw cms::Exception(
"BadConfig") <<
"[AlignmentParameterSelector::addSelection]"
482 <<
": Selection '" << name <<
"' invalid!";
492 const std::vector<char> ¶mSel)
494 unsigned int numAli = 0;
497 for (align::Alignables::const_iterator iAli = alignables.begin();
498 iAli != alignables.end(); ++iAli) {
520 int type = typeLayer.first;
521 int layer = typeLayer.second;
583 const DetId detId(alignable->
id());
584 const int subdetId = detId.
subdetId();
591 !this->insideRanges<int>((detId.rawId()),
theDetIdRanges))
return true;
674 const std::vector<T> &
ranges,
679 if (ranges.size()%2 != 0) {
680 cms::Exception(
"BadConfig") <<
"@SUB=AlignmentParameterSelector::insideRanges"
681 <<
" need even number of entries in ranges instead of "
686 for (
unsigned int i = 0;
i < ranges.size();
i += 2) {
691 if (rangePhi1 <= valuePhi && valuePhi < rangePhi2) {
694 if (rangePhi2 < rangePhi1 && (rangePhi1 <= valuePhi || valuePhi < rangePhi2)) {
697 }
else if (ranges[
i] <= value && value < ranges[
i+1]) {
706 template<>
bool AlignmentParameterSelector::insideRanges<int>(
int value,
707 const std::vector<int> &
ranges,
710 if (
ranges.size()%2 != 0) {
711 cms::Exception(
"BadConfig") <<
"@SUB=AlignmentParameterSelector::insideRanges"
712 <<
" need even number of entries in ranges instead of "
717 for (
unsigned int i = 0;
i <
ranges.size();
i += 2) {
726 if (
std::find(values.begin(), values.end(),
value)!=values.end())
return true;
731 std::vector<std::string>
735 std::vector<std::string>
result;
740 if (delimiterPos == std::string::npos) {
741 result.push_back(s.substr(previousPos));
744 result.push_back(s.substr(previousPos, delimiterPos - previousPos));
745 previousPos = delimiterPos + 1;
760 std::vector<char>
result(selString.size());
763 result[pos] = selString[pos];
778 if (ss != std::string::npos) {
779 newName.erase(ss, 2);
786 if (ds != std::string::npos) {
787 newName.erase(ds, 2);
795 if (layers != std::string::npos && size - layers - 2 == 6
796 && isdigit(newName[size-1]) && isdigit(newName[size-2])) {
800 newName.erase(layers);
808 if (newName.rfind(
"Unit") != std::string::npos) {
810 if (uRph != std::string::npos) {
811 newName.erase(uRph + 4, 4);
815 if (uSte != std::string::npos) {
816 newName.erase(uSte + 4, 6);
821 if (newName != name) {
822 LogDebug(
"Alignment") <<
"@SUB=AlignmentParameterSelector::setSpecials"
823 << name <<
" becomes " << newName <<
", makes theOnlySS " <<
theOnlySS
835 unsigned int numAli = 0;
849 unsigned int numAli = 0;
863 unsigned int numAli = 0;
877 unsigned int numAli = 0;
T getParameter(std::string const &) const
align::ID id() const
Return the ID of Alignable, i.e. DetId of 'first' component GeomDet(Unit).
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)
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()
unsigned int addAllAlignables(const std::vector< char > ¶mSel)
AlignmentParameterSelector(AlignableTracker *aliTracker, AlignableMuon *aliMuon=0, AlignableExtras *aliExtras=0)
Constructor from tracker only or from tracker and muon.
bool insideRanges(T value, const std::vector< T > &ranges, bool isPhi=false) const
align::Alignables CSCChambers()
align::Alignables theSelectedAlignables
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
std::vector< int > thePetalRanges
unsigned int tidWheel(const DetId &id) const
unsigned int pxbModule(const DetId &id) const
align::Alignables DTStations()
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)
struct AlignmentParameterSelector::PXFDetIdRanges thePXFDetIdRanges
std::vector< int > theModuleRanges
std::vector< int > theExcludedDetIds
static int position[TOTALCHAMBERS][3]
std::vector< int > theDiskRanges
std::vector< int > theSideRanges
std::vector< int > theModuleRanges
const TrackerTopology * trackerTopology() const
Returns tracker topology.
void setGeometryCuts(const edm::ParameterSet &pSet)
unsigned int tibSide(const DetId &id) const
void clear()
remove all selected Alignables and geometrical restrictions
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()
struct AlignmentParameterSelector::PXBDetIdRanges thePXBDetIdRanges
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
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.
Container::value_type value_type
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
struct AlignmentParameterSelector::TIBDetIdRanges theTIBDetIdRanges
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
struct AlignmentParameterSelector::TOBDetIdRanges theTOBDetIdRanges
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)
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
std::vector< Alignable * > Alignables
unsigned int tobModule(const DetId &id) const
Alignables & innerBarrelLayers()
Return inner barrel layers.
std::vector< int > theModuleRanges
struct AlignmentParameterSelector::TECDetIdRanges theTECDetIdRanges
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
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
virtual Alignables components() const
Return vector of direct components.
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.
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
unsigned int tobLayer(const DetId &id) const
Alignables & pixelEndcapLayers()
Return pixel endcap layers.
unsigned int tecSide(const DetId &id) const
struct AlignmentParameterSelector::TIDDetIdRanges theTIDDetIdRanges
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)