Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef Alignment_CommonAlignmentAlgorithm_TkModuleGroupSelector_h
0002 #define Alignment_CommonAlignmentAlgorithm_TkModuleGroupSelector_h
0003 
0004 /**
0005  * \file TkModuleGroupSelector.cc
0006  *
0007  * Class provides an algorithm which assigns
0008  * runrange-dependent (IOV-dependent)
0009  * indices to groups of tracker modules.
0010  *
0011  *  \author Joerg Behr
0012  *  \date May 2013
0013  *  $Revision: 1.1.2.12 $
0014  *  $Date: 2013/05/29 07:59:38 $
0015  *  (last update by $Author: flucke $)
0016  *
0017  */
0018 
0019 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0020 #include "Alignment/CommonAlignment/interface/Alignable.h"
0021 
0022 #include <vector>
0023 #include <map>
0024 #include <list>
0025 
0026 class AlignableTracker;
0027 class AlignableMuon;
0028 class AlignableExtras;
0029 
0030 namespace edm {
0031   class EventSetup;
0032   class ParameterSet;
0033 }  // namespace edm
0034 
0035 class TkModuleGroupSelector {
0036 public:
0037   /// Constructor
0038   explicit TkModuleGroupSelector(AlignableTracker *aliTracker,
0039                                  const edm::ParameterSet &cfg,
0040                                  const std::vector<int> &sdets);
0041 
0042   /// Destructor
0043   virtual ~TkModuleGroupSelector(){};
0044 
0045   // Returns the number of parameters.
0046   unsigned int getNumberOfParameters() const;
0047 
0048   /// Total number of IOVs.
0049   unsigned int numIovs() const;
0050 
0051   /// First run of iov (0 if iovNum not treated).
0052   edm::RunNumber_t firstRunOfIOV(unsigned int iovNum) const;
0053 
0054   /// Index of parameter for given detId (detId not treated => < 0)
0055   /// and the given run.
0056   int getParameterIndexFromDetId(unsigned int detId, edm::RunNumber_t run) const;
0057 
0058 private:
0059   // Constructs the run-dependent module groups from configuration parameters.
0060   void createModuleGroups(AlignableTracker *aliTracker,
0061                           const edm::VParameterSet &granularityConfig,
0062                           const std::vector<edm::RunNumber_t> &defaultRunRange,
0063                           edm::RunNumber_t defaultReferenceRun);
0064 
0065   // Method used to test the provided configuration for unknown parameters
0066   void verifyParameterNames(const edm::ParameterSet &pset, unsigned int psetnr) const;
0067 
0068   // Method to test whether the split option has been turned on
0069   const bool testSplitOption(const edm::ParameterSet &pset) const;
0070 
0071   // Add modules to a specific group which is also created in this function.
0072   bool createGroup(unsigned int &Id,                             //id of the first run
0073                    const std::vector<edm::RunNumber_t> &range,   //run range
0074                    const std::list<Alignable *> &selected_alis,  //list of alignables for which a group is created
0075                    const edm::RunNumber_t refrun                 //reference run number
0076   );
0077 
0078   // Fill the container which is a map between the det id and the id of the group
0079   // to which the module belongs.
0080   void fillDetIdMap(const unsigned int detid, const unsigned int groupid);
0081 
0082   // Array with run boundaries which is a combination
0083   // of all defined run ranges of all specified module groups.
0084   std::vector<edm::RunNumber_t> globalRunRange_;
0085 
0086   // For a given module group the id of the first IOV.
0087   std::vector<unsigned int> firstId_;
0088 
0089   // Run range per module group
0090   std::vector<std::vector<edm::RunNumber_t> > runRange_;
0091 
0092   // Mapping between module id and module group id.
0093   std::map<unsigned int, unsigned int> mapDetIdGroupId_;
0094 
0095   // Total number of parameters.
0096   unsigned int nparameters_;
0097 
0098   // The ids of the subdetectors for which parameters are determined.
0099   std::vector<int> subdetids_;
0100 
0101   // Reference run per module group
0102   std::vector<edm::RunNumber_t> referenceRun_;
0103 };
0104 
0105 #endif