CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/Alignment/CommonAlignmentAlgorithm/interface/AlignmentParameterSelector.h

Go to the documentation of this file.
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> &paramSel);
00061   unsigned int addSelection(const std::string &name, const std::vector<char> &paramSel, 
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> &paramSel);
00088   unsigned int addAllDets(const std::vector<char> &paramSel);
00089   unsigned int addAllRods(const std::vector<char> &paramSel);
00090   unsigned int addAllLayers(const std::vector<char> &paramSel);
00091   unsigned int addAllAlignables(const std::vector<char> &paramSel);
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  private:
00101   AlignableTracker* theTracker;
00102   AlignableMuon*    theMuon;
00103   AlignableExtras*  theExtras;
00104   align::Alignables theSelectedAlignables;
00105   std::vector<std::vector<char> > theSelectedParameters;
00106 
00108   std::vector<double> theRangesEta;
00109   std::vector<double> theRangesPhi;
00110   std::vector<double> theRangesR;
00111   std::vector<double> theRangesX;
00112   std::vector<double> theRangesY;
00113   std::vector<double> theRangesZ;
00114 
00116   std::vector<int>    theDetIds;
00117   std::vector<int>    theDetIdRanges;
00118   std::vector<int>    theExcludedDetIds;
00119   std::vector<int>    theExcludedDetIdRanges;
00120   struct PXBDetIdRanges {
00121     std::vector<int>    theLadderRanges;
00122     std::vector<int>    theLayerRanges;
00123     std::vector<int>    theModuleRanges;
00124     void clear() {
00125       theLadderRanges.clear(); theLayerRanges.clear();
00126       theModuleRanges.clear();
00127     }
00128   }                   thePXBDetIdRanges;
00129   struct PXFDetIdRanges {
00130     std::vector<int>    theBladeRanges;
00131     std::vector<int>    theDiskRanges;
00132     std::vector<int>    theModuleRanges;
00133     std::vector<int>    thePanelRanges;
00134     std::vector<int>    theSideRanges;
00135     void clear() { 
00136       theBladeRanges.clear(); theDiskRanges.clear();
00137       theModuleRanges.clear(); thePanelRanges.clear();
00138       theSideRanges.clear();
00139     }
00140   }                   thePXFDetIdRanges;
00141   struct TIBDetIdRanges {
00142     std::vector<int>    theLayerRanges;
00143     std::vector<int>    theModuleRanges;
00144     std::vector<int>    theStringRanges;
00145     std::vector<int>    theSideRanges;
00146     void clear() { 
00147       theLayerRanges.clear(); theModuleRanges.clear();
00148       theSideRanges.clear(); theStringRanges.clear();
00149     }
00150   }                   theTIBDetIdRanges;
00151   struct TIDDetIdRanges {
00152     std::vector<int>    theDiskRanges; 
00153     std::vector<int>    theModuleRanges;
00154     std::vector<int>    theRingRanges;
00155     std::vector<int>    theSideRanges;  
00156     void clear() { 
00157       theDiskRanges.clear(); theModuleRanges.clear();
00158       theRingRanges.clear(); theSideRanges.clear();
00159     }
00160   }                   theTIDDetIdRanges;
00161   struct TOBDetIdRanges {
00162     std::vector<int>    theLayerRanges; 
00163     std::vector<int>    theModuleRanges;
00164     std::vector<int>    theRodRanges;  
00165     std::vector<int>    theSideRanges;
00166     void clear() { 
00167       theLayerRanges.clear(); theModuleRanges.clear();
00168       theRodRanges.clear(); theSideRanges.clear();
00169     }
00170   }                   theTOBDetIdRanges;  
00171   struct TECDetIdRanges {
00172     std::vector<int>    theWheelRanges; 
00173     std::vector<int>    thePetalRanges; 
00174     std::vector<int>    theModuleRanges;
00175     std::vector<int>    theRingRanges;
00176     std::vector<int>    theSideRanges;  
00177     void clear() { 
00178       theWheelRanges.clear(); thePetalRanges.clear();
00179       theModuleRanges.clear(); theRingRanges.clear();
00180       theSideRanges.clear();
00181     }
00182   }                   theTECDetIdRanges;
00183     
00184   // further switches used in add(...)
00185   bool theOnlyDS;
00186   bool theOnlySS;
00187   bool theSelLayers;
00188   int  theMinLayer;
00189   int  theMaxLayer;
00190   enum RphiOrStereoDetUnit { Stereo, Both, Rphi};
00191   RphiOrStereoDetUnit theRphiOrStereoDetUnit;
00199   std::string setSpecials(const std::string &name);
00200 
00201 };
00202 
00203 template<> bool
00204 AlignmentParameterSelector::insideRanges<int>(int value, const std::vector<int> &ranges,
00205                                               bool isPhi) const;
00206 
00207 #endif