Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef ALIGNMENT_COMMONALIGNMENT_INTERFACE_ALIGNABLECOMPOSITEBUILDER_H_
0002 #define ALIGNMENT_COMMONALIGNMENT_INTERFACE_ALIGNABLECOMPOSITEBUILDER_H_
0003 
0004 // Original Author:  Max Stark
0005 //         Created:  Wed, 10 Feb 2016 14:02:51 CET
0006 
0007 // alignment
0008 #include "Alignment/CommonAlignment/interface/AlignableMap.h"
0009 #include "Alignment/CommonAlignment/interface/AlignableComposite.h"
0010 #include "Alignment/CommonAlignment/interface/AlignableIndexer.h"
0011 #include "Alignment/CommonAlignment/interface/AlignmentLevel.h"
0012 #include "Alignment/CommonAlignment/interface/Utilities.h"
0013 
0014 class AlignableCompositeBuilder {
0015   //========================== PUBLIC METHODS =================================
0016 public:  //===================================================================
0017   AlignableCompositeBuilder(const TrackerTopology*, const TrackerGeometry*, const AlignableIndexer&);
0018   virtual ~AlignableCompositeBuilder() = default;
0019 
0020   /// Add all desired AlignmentLevels for a sub-detector to the builder before
0021   /// calling buildAll(), the order matters!
0022   /// Example for PixelBarrel-RunI geometry:
0023   /// -> PXBModule, PXBLadder, TPBLayer, TPBHalfBarrel, TPBBarrel
0024   void addAlignmentLevel(std::unique_ptr<AlignmentLevel> level);
0025 
0026   /// Resets the alignment-levels.
0027   void clearAlignmentLevels();
0028 
0029   /// Builds all composite Alignables according to the levels added before via
0030   /// addAlignmentLevel(). The Alignables were built from bottom- to the top-
0031   /// hierarchy, e.g. for PixelBarrel-RunI geometry:
0032   /// - PXBLadder     (with PXBModule as children)
0033   /// - TPBLayer      (with PXBLadder as children)
0034   /// - TPBHalfBarrel (with TPBLayer as children)
0035   /// - TPBBarrel     (with TPBHalfBarrel as children)
0036   /// Returns the number of composite Alignables which were built.
0037   unsigned int buildAll(AlignableMap&, bool update = false);
0038 
0039   /// Return tracker alignable object ID provider derived from the tracker's geometry
0040   const AlignableObjectId& objectIdProvider() const { return alignableObjectId_; }
0041 
0042   //========================= PRIVATE METHODS =================================
0043 private:  //==================================================================
0044   /// Builds the components for a given level in the hierarchy.
0045   unsigned int buildLevel(unsigned int parentLevel, AlignableMap&, std::ostringstream&, bool update = false);
0046 
0047   /// Calculates the theoretical max. number of components for a given level
0048   /// in the hierarchy.
0049   unsigned int maxNumComponents(unsigned int startLevel) const;
0050 
0051   /// Calculates the index of an Alignable within the hierarchy; unique for
0052   /// each component of a given structure-type.
0053   unsigned int getIndexOfStructure(align::ID, unsigned int level) const;
0054 
0055   //========================== PRIVATE DATA ===================================
0056   //===========================================================================
0057 
0058   // TODO: The AlignableCompositeBuilder is not 'common' as the package
0059   //       suggests, because it uses the TrackerTopology. If this class shall
0060   //       ever be used to build other kinds of alignables than tracker-
0061   //       alignables one has to add/implement something more general than
0062   //       the TrackerTopology
0063   const TrackerTopology* trackerTopology_;
0064   const AlignableObjectId alignableObjectId_;
0065 
0066   AlignableIndexer alignableIndexer_;
0067 
0068   align::AlignmentLevels alignmentLevels_;
0069 };
0070 
0071 #endif /* ALIGNMENT_COMMONALIGNMENT_INTERFACE_ALIGNABLECOMPOSITEBUILDER_H_ */