00001 #ifndef ALIGNMENTPARAMETERSELECTOR_H 00002 #define ALIGNMENTPARAMETERSELECTOR_H 00003 00016 #include "Alignment/CommonAlignment/interface/Utilities.h" 00017 00018 class AlignableExtras; 00019 class AlignableTracker; 00020 class AlignableMuon; 00021 00022 namespace edm { 00023 class ParameterSet; 00024 } 00025 00026 class AlignmentParameterSelector { 00027 public: 00029 explicit AlignmentParameterSelector(AlignableTracker *aliTracker, AlignableMuon *aliMuon = 0, 00030 AlignableExtras *aliExtras = 0); 00031 00033 virtual ~AlignmentParameterSelector() {} 00034 00036 const align::Alignables& selectedAlignables() const { return theSelectedAlignables; } 00038 const std::vector<std::vector<char> >& selectedParameters() const { return theSelectedParameters; } 00040 void clear(); 00042 void clearGeometryCuts(); 00043 00052 unsigned int addSelections(const edm::ParameterSet &pSet); 00056 void setGeometryCuts(const edm::ParameterSet &pSet); 00059 unsigned int addSelection(const std::string &name, const std::vector<char> ¶mSel); 00061 unsigned int addSelection(const std::string &name, const std::vector<char> ¶mSel, 00062 const edm::ParameterSet &pSet); 00064 bool layerDeselected(const Alignable *alignable) const; 00066 bool detUnitDeselected(const Alignable *alignable) const; 00068 bool outsideGeometricalRanges(const Alignable *alignable) const; 00070 bool outsideDetIdRanges(const Alignable *alignable) const; 00075 template<typename T> bool insideRanges(T value, const std::vector<T> &ranges, 00076 bool isPhi = false) const; 00078 bool isMemberOfVector(int value, const std::vector<int> &values) const; 00080 std::vector<std::string> decompose(const std::string &s, std::string::value_type delimiter) const; 00082 std::vector<char> convertParamSel(const std::string &selString) const; 00083 00084 protected: 00086 unsigned int add(const align::Alignables &alignables, const std::vector<char> ¶mSel); 00088 unsigned int addAllDets(const std::vector<char> ¶mSel); 00089 unsigned int addAllRods(const std::vector<char> ¶mSel); 00090 unsigned int addAllLayers(const std::vector<char> ¶mSel); 00091 unsigned int addAllAlignables(const std::vector<char> ¶mSel); 00092 00093 void setPXBDetIdCuts(const edm::ParameterSet &pSet); 00094 void setPXFDetIdCuts(const edm::ParameterSet &pSet); 00095 void setTIBDetIdCuts(const edm::ParameterSet &pSet); 00096 void setTIDDetIdCuts(const edm::ParameterSet &pSet); 00097 void setTOBDetIdCuts(const edm::ParameterSet &pSet); 00098 void setTECDetIdCuts(const edm::ParameterSet &pSet); 00099 00100 const AlignableTracker* alignableTracker() const; 00101 00102 private: 00103 AlignableTracker* theTracker; 00104 AlignableMuon* theMuon; 00105 AlignableExtras* theExtras; 00106 align::Alignables theSelectedAlignables; 00107 std::vector<std::vector<char> > theSelectedParameters; 00108 00110 std::vector<double> theRangesEta; 00111 std::vector<double> theRangesPhi; 00112 std::vector<double> theRangesR; 00113 std::vector<double> theRangesX; 00114 std::vector<double> theRangesY; 00115 std::vector<double> theRangesZ; 00116 00118 std::vector<int> theDetIds; 00119 std::vector<int> theDetIdRanges; 00120 std::vector<int> theExcludedDetIds; 00121 std::vector<int> theExcludedDetIdRanges; 00122 struct PXBDetIdRanges { 00123 std::vector<int> theLadderRanges; 00124 std::vector<int> theLayerRanges; 00125 std::vector<int> theModuleRanges; 00126 void clear() { 00127 theLadderRanges.clear(); theLayerRanges.clear(); 00128 theModuleRanges.clear(); 00129 } 00130 } thePXBDetIdRanges; 00131 struct PXFDetIdRanges { 00132 std::vector<int> theBladeRanges; 00133 std::vector<int> theDiskRanges; 00134 std::vector<int> theModuleRanges; 00135 std::vector<int> thePanelRanges; 00136 std::vector<int> theSideRanges; 00137 void clear() { 00138 theBladeRanges.clear(); theDiskRanges.clear(); 00139 theModuleRanges.clear(); thePanelRanges.clear(); 00140 theSideRanges.clear(); 00141 } 00142 } thePXFDetIdRanges; 00143 struct TIBDetIdRanges { 00144 std::vector<int> theLayerRanges; 00145 std::vector<int> theModuleRanges; 00146 std::vector<int> theStringRanges; 00147 std::vector<int> theSideRanges; 00148 void clear() { 00149 theLayerRanges.clear(); theModuleRanges.clear(); 00150 theSideRanges.clear(); theStringRanges.clear(); 00151 } 00152 } theTIBDetIdRanges; 00153 struct TIDDetIdRanges { 00154 std::vector<int> theDiskRanges; 00155 std::vector<int> theModuleRanges; 00156 std::vector<int> theRingRanges; 00157 std::vector<int> theSideRanges; 00158 void clear() { 00159 theDiskRanges.clear(); theModuleRanges.clear(); 00160 theRingRanges.clear(); theSideRanges.clear(); 00161 } 00162 } theTIDDetIdRanges; 00163 struct TOBDetIdRanges { 00164 std::vector<int> theLayerRanges; 00165 std::vector<int> theModuleRanges; 00166 std::vector<int> theRodRanges; 00167 std::vector<int> theSideRanges; 00168 void clear() { 00169 theLayerRanges.clear(); theModuleRanges.clear(); 00170 theRodRanges.clear(); theSideRanges.clear(); 00171 } 00172 } theTOBDetIdRanges; 00173 struct TECDetIdRanges { 00174 std::vector<int> theWheelRanges; 00175 std::vector<int> thePetalRanges; 00176 std::vector<int> theModuleRanges; 00177 std::vector<int> theRingRanges; 00178 std::vector<int> theSideRanges; 00179 void clear() { 00180 theWheelRanges.clear(); thePetalRanges.clear(); 00181 theModuleRanges.clear(); theRingRanges.clear(); 00182 theSideRanges.clear(); 00183 } 00184 } theTECDetIdRanges; 00185 00186 // further switches used in add(...) 00187 bool theOnlyDS; 00188 bool theOnlySS; 00189 bool theSelLayers; 00190 int theMinLayer; 00191 int theMaxLayer; 00192 enum RphiOrStereoDetUnit { Stereo, Both, Rphi}; 00193 RphiOrStereoDetUnit theRphiOrStereoDetUnit; 00201 std::string setSpecials(const std::string &name); 00202 00203 }; 00204 00205 template<> bool 00206 AlignmentParameterSelector::insideRanges<int>(int value, const std::vector<int> &ranges, 00207 bool isPhi) const; 00208 00209 #endif