Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-07-31 22:36:58

0001 #ifndef PEDELABELER_H
0002 #define PEDELABELER_H
0003 
0004 /**
0005  * \class PedeLabeler
0006  *
0007  * provides labels for AlignmentParameters for pede
0008  *
0009  * \author    : Gero Flucke
0010  * date       : September 2007
0011  * $Date: 2011/02/16 12:52:46 $
0012  * $Revision: 1.5 $
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 PedeLabeler : public PedeLabelerBase {
0027 public:
0028   /// constructor from three Alignables (null pointers allowed )
0029   PedeLabeler(const PedeLabelerBase::TopLevelAlignables &alignables, const edm::ParameterSet &config);
0030   /// destructor
0031   ~PedeLabeler() 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   unsigned int alignableLabelFromParamAndInstance(const Alignable *alignable,
0038                                                   unsigned int param,
0039                                                   unsigned int instance) const override;
0040   unsigned int lasBeamLabel(unsigned int lasBeamId) const override;
0041   unsigned int parameterLabel(unsigned int aliLabel, unsigned int parNum) const override;
0042   unsigned int parameterLabel(Alignable *alignable,
0043                               unsigned int parNum,
0044                               const AlignmentAlgorithmBase::EventInfo &eventInfo,
0045                               const TrajectoryStateOnSurface &tsos) const override {
0046     return parameterLabel(alignableLabel(alignable), parNum);
0047   }
0048   bool hasSplitParameters(Alignable *alignable) const override { return false; }
0049   unsigned int numberOfParameterInstances(Alignable *alignable, int param = -1) const override { return 1; }
0050   unsigned int maxNumberOfParameterInstances() const override { return 1; }
0051 
0052   /// parameter number, 0 <= .. < theMaxNumParam, belonging to unique parameter label
0053   unsigned int paramNumFromLabel(unsigned int paramLabel) const override;
0054   /// alignable label from parameter label (works also for alignable label...)
0055   unsigned int alignableLabelFromLabel(unsigned int label) const override;
0056   /// Alignable from alignable or parameter label,
0057   /// null if no alignable (but error only if not las beam, either!)
0058   Alignable *alignableFromLabel(unsigned int label) const override;
0059   /// las beam id from las beam or parameter label
0060   /// zero and error if not a valid las beam label
0061   unsigned int lasBeamIdFromLabel(unsigned int label) const override;
0062 
0063 private:
0064   typedef std::map<Alignable *, unsigned int, AlignableComparator> AlignableToIdMap;
0065   typedef AlignableToIdMap::value_type AlignableToIdPair;
0066   typedef std::map<unsigned int, Alignable *> IdToAlignableMap;
0067   typedef std::map<unsigned int, unsigned int> UintUintMap;
0068 
0069   /// returns size of map
0070   unsigned int buildMap(const align::Alignables &);
0071   /// returns size of map
0072   unsigned int buildReverseMap();
0073 
0074   // data members
0075   AlignableToIdMap theAlignableToIdMap;  /// providing unique ID for alignable, space for param IDs
0076   IdToAlignableMap theIdToAlignableMap;  /// reverse map
0077   UintUintMap theLasBeamToLabelMap;      /// labels for las beams
0078   UintUintMap theLabelToLasBeamMap;      /// reverse of the above
0079 };
0080 
0081 #endif