Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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