Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:44:34

0001 #ifndef Alignment_CommonAlignment_MisalignmentScenarioBuilder_h
0002 #define Alignment_CommonAlignment_MisalignmentScenarioBuilder_h
0003 
0004 /// \class MisalignmentScenarioBuilder
0005 ///
0006 /// $Date: 2011/09/19 11:44:50 $
0007 /// $Revision: 1.10 $
0008 ///
0009 /// $Author: mussgill $
0010 /// \author Frederic Ronga - CERN-PH-CMG
0011 
0012 #include <vector>
0013 
0014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0015 
0016 #include "Alignment/CommonAlignment/interface/AlignableModifier.h"
0017 #include "Alignment/CommonAlignment/interface/AlignableObjectId.h"
0018 #include "Alignment/CommonAlignment/interface/Utilities.h"
0019 
0020 /// Base class to build a scenario from configuration and apply to either tracker or muon.
0021 
0022 class MisalignmentScenarioBuilder {
0023 public:
0024   /// Constructor
0025   MisalignmentScenarioBuilder(AlignableObjectId::Geometry);
0026 
0027   /// Destructor
0028   virtual ~MisalignmentScenarioBuilder() = default;
0029 
0030   /// Apply misalignment scenario to the tracker (sub-system specific)
0031   virtual void applyScenario(const edm::ParameterSet& scenario) = 0;
0032 
0033 protected:  // Methods
0034   /// Decode movements defined in given parameter set for given set of alignables
0035   void decodeMovements_(const edm::ParameterSet&, const align::Alignables&);
0036 
0037   /// Decode movements defined in given parameter set for given set of alignables tagged by given name
0038   void decodeMovements_(const edm::ParameterSet&, const align::Alignables&, const std::string& levelName);
0039 
0040   /// Apply movements given by parameter set to given alignable
0041   void applyMovements_(Alignable* alignable, const edm::ParameterSet& pSet);
0042 
0043   /// Merge two sets of parameters into one (the first argument)
0044   void mergeParameters_(edm::ParameterSet& localSet, const edm::ParameterSet& globalSet) const;
0045 
0046   /// Propagate global parameters to sub-parameters
0047   void propagateParameters_(const edm::ParameterSet& pSet,
0048                             const std::string& globalName,
0049                             edm::ParameterSet& subSet) const;
0050 
0051   /// Get parameter set corresponding to given name from pSet
0052   /// returns empty parameter set if does not exist)
0053   edm::ParameterSet getParameterSet_(const std::string& name, const edm::ParameterSet& pSet) const;
0054 
0055   /// Get parameter set corresponding to given levelName and iComponent from pSet,
0056   /// any parameter set name like <levelName><m>, <levelName><m>_<n>, <levelName><m>_<n>_<o> etc.
0057   /// is accepted for iComponent == m, n or o. (returns empty parameter set if does not exist).
0058   edm::ParameterSet getParameterSet_(const std::string& levelName, int iComponent, const edm::ParameterSet& pSet) const;
0059 
0060   /// Check if given parameter exists in parameter set
0061   bool hasParameter_(const std::string& name, const edm::ParameterSet& pSet) const;
0062 
0063   /// Print all parameters and values for given set
0064   void printParameters_(const edm::ParameterSet& pSet, const bool showPsets = false) const;
0065 
0066   /// Check if given parameter is for a top-level structure
0067   virtual bool isTopLevel_(const std::string& parameterSetName) const;
0068 
0069   /// Check whether structure 'subStruct' could be part of 'largeStruct',
0070   /// defaults to true, but can be overwritten in derived classes to speed up recursive merging.
0071   virtual bool possiblyPartOf(const std::string& subStruct, const std::string& largeStruct) const;
0072 
0073   /// Get root name of a parameter set (e.g. 'Rod' in 'Rods' or 'Rod1')
0074   const std::string rootName_(const std::string& parameterSetName) const;
0075 
0076 protected:                        // Members
0077   edm::ParameterSet theScenario;  ///< Misalignment scenario to apply (from config file)
0078   AlignableModifier theModifier;  ///< Helper class for random movements
0079 
0080   int theModifierCounter{0};  ///< Counter for applied modification
0081 
0082   mutable std::string indent_;  ///< Depth in hierarchy
0083 
0084 private:
0085   const AlignableObjectId alignableObjectId_;
0086 };
0087 
0088 #endif