Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:56:34

0001 #ifndef RUNRANGEDEPENDENTPEDELABELER_H
0002 #define RUNRANGEDEPENDENTPEDELABELER_H
0003 
0004 /**
0005  * \class RunRangeDependentPedeLabeler
0006  *
0007  * provides labels for AlignmentParameters for pede
0008  *
0009  * \author    : Gero Flucke
0010  * date       : September 2007
0011  * $Date: 2011/02/16 13:12:41 $
0012  * $Revision: 1.1 $
0013  * (last update by $Author: mussgill $)
0014  */
0015 
0016 #include <vector>
0017 #include <map>
0018 
0019 #include <Alignment/MillePedeAlignmentAlgorithm/interface/PedeLabelerBase.h>
0020 
0021 #include "CondFormats/Common/interface/Time.h"
0022 
0023 #include "Alignment/CommonAlignment/interface/Utilities.h"
0024 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0025 
0026 namespace edm {
0027   class EventID;
0028 }
0029 
0030 /***************************************
0031 ****************************************/
0032 class RunRangeDependentPedeLabeler : public PedeLabelerBase {
0033 public:
0034   /// constructor from three Alignables (null pointers allowed )
0035   RunRangeDependentPedeLabeler(const PedeLabelerBase::TopLevelAlignables &alignables, const edm::ParameterSet &config);
0036   /** non-virtual destructor: do not inherit from this class **/
0037   ~RunRangeDependentPedeLabeler() override;
0038 
0039   /// uniqueId of Alignable, 0 if alignable not known
0040   /// between this ID and the next there is enough 'space' to add parameter
0041   /// numbers 0...nPar-1 to make unique IDs for the labels of active parameters
0042   unsigned int alignableLabel(const Alignable *alignable) const override;
0043   /// uniqueId of Alignable for a given parameter index and instance,
0044   /// 0 if alignable not known between this ID and the next there is enough
0045   /// 'space' to add parameter numbers 0...nPar-1 to make unique IDs for the
0046   /// labels of active parameters
0047   unsigned int alignableLabelFromParamAndInstance(const Alignable *alignable,
0048                                                   unsigned int param,
0049                                                   unsigned int instance) const override;
0050   unsigned int lasBeamLabel(unsigned int lasBeamId) const override;
0051   /// returns the label for a given alignable parameter number combination
0052   unsigned int parameterLabel(unsigned int aliLabel, unsigned int parNum) const override;
0053   /// returns the label for a given alignable parameter number combination
0054   /// in case the parameters are split into v
0055   unsigned int parameterLabel(Alignable *alignable,
0056                               unsigned int parNum,
0057                               const AlignmentAlgorithmBase::EventInfo &eventInfo,
0058                               const TrajectoryStateOnSurface &tsos) const override;
0059   /// returns true if the alignable has parameters that are split into various bins
0060   bool hasSplitParameters(Alignable *alignable) const override;
0061   /// returns the number of instances for a given parameter
0062   unsigned int numberOfParameterInstances(Alignable *alignable, int param = -1) const override;
0063   unsigned int maxNumberOfParameterInstances() const override { return theMaxNumberOfParameterInstances; }
0064 
0065   /// parameter number, 0 <= .. < theMaxNumParam, belonging to unique parameter label
0066   unsigned int paramNumFromLabel(unsigned int paramLabel) const override;
0067   /// alignable label from parameter label (works also for alignable label...)
0068   unsigned int alignableLabelFromLabel(unsigned int label) const override;
0069   /// Alignable from alignable or parameter label,
0070   /// null if no alignable (but error only if not las beam, either!)
0071   Alignable *alignableFromLabel(unsigned int label) const override;
0072   /// las beam id from las beam or parameter label
0073   /// zero and error if not a valid las beam label
0074   unsigned int lasBeamIdFromLabel(unsigned int label) const override;
0075   const RunRange &runRangeFromLabel(unsigned int label) const override;
0076 
0077 private:
0078   typedef std::map<Alignable *, unsigned int, AlignableComparator> AlignableToIdMap;
0079   typedef AlignableToIdMap::value_type AlignableToIdPair;
0080   typedef std::vector<RunRange> RunRangeVector;
0081   typedef std::map<unsigned int, RunRangeVector> RunRangeParamMap;
0082   typedef std::map<Alignable *, RunRangeParamMap, AlignableComparator> AlignableToRunRangeRangeMap;
0083   typedef AlignableToRunRangeRangeMap::value_type AlignableToRunRangeRangePair;
0084   typedef std::map<unsigned int, Alignable *> IdToAlignableMap;
0085   typedef std::map<unsigned int, unsigned int> UintUintMap;
0086 
0087   unsigned int runRangeIndexFromLabel(unsigned int label) const;
0088 
0089   std::vector<std::string> decompose(const std::string &s, std::string::value_type delimiter) const;
0090   std::vector<unsigned int> convertParamSel(const std::string &selString) const;
0091   unsigned int buildRunRangeDependencyMap(AlignableTracker *aliTracker,
0092                                           AlignableMuon *aliMuon,
0093                                           AlignableExtras *extras,
0094                                           const edm::ParameterSet &config);
0095 
0096   /// returns size of map
0097   unsigned int buildMap(const align::Alignables &);
0098   /// returns size of map
0099   unsigned int buildReverseMap();
0100 
0101   // data members
0102   AlignableToIdMap theAlignableToIdMap;  /// providing unique ID for alignable, space for param IDs
0103   AlignableToRunRangeRangeMap theAlignableToRunRangeRangeMap;  /// providing unique ID for alignable, space for param IDs
0104   IdToAlignableMap theIdToAlignableMap;                        /// reverse map
0105   UintUintMap theLasBeamToLabelMap;                            /// labels for las beams
0106   UintUintMap theLabelToLasBeamMap;                            /// reverse of the above
0107   unsigned int theMaxNumberOfParameterInstances;
0108 };
0109 
0110 #endif