Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:12:37

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 #ifndef DDALIGN_ALIGNMENTSCALIB_H
0014 #define DDALIGN_ALIGNMENTSCALIB_H
0015 
0016 // Framework includes
0017 #include <DD4hep/DetElement.h>
0018 #include <DD4hep/Alignments.h>
0019 #include <DD4hep/AlignmentData.h>
0020 #include <DD4hep/ConditionsMap.h>
0021 #include <DD4hep/AlignmentsCalculator.h>
0022 
0023 // C/C++ include files
0024 #include <set>
0025 #include <map>
0026 
0027 /// Namespace for the AIDA detector description toolkit
0028 namespace dd4hep {
0029 
0030   /// Namespace for implementation details of the AIDA detector description toolkit
0031   namespace align {
0032   
0033     /// Calib alignment dependencies from conditions
0034     /**
0035      *
0036      *   \author  M.Frank
0037      *   \version 1.0
0038      *   \date    31/01/2017
0039      *   \ingroup DD4HEP_DDALIGN
0040      */
0041     class AlignmentsCalib {
0042     public:
0043       /// Helper class to store information about alignment calibration items
0044       /**  Implementation details: Alignment context entry
0045        *
0046        *   \author  M.Frank
0047        *   \version 1.0
0048        *   \date    31/01/2017
0049        *   \ingroup DD4HEP_DDALIGN
0050        */
0051       class Entry;
0052       /// Shortcut definitions
0053       typedef std::map<Condition::key_type,Entry*>  UsedConditions;
0054 
0055     public:
0056       /// Reference to the detector description object
0057       Detector&                      description;
0058       /// Reference to the alignment manager object
0059       ConditionsMap& slice;
0060       /// Internal work stack of cached deltas
0061       UsedConditions             used;
0062 
0063     protected:      
0064       /// Implementation: Add a new entry to the transaction stack.
0065       std::pair<Condition::key_type,Entry*> _set(DetElement det, const Delta& delta);
0066 
0067     public:
0068       /// No default constructor
0069       AlignmentsCalib() = delete;
0070       /// No copy constructor
0071       AlignmentsCalib(const AlignmentsCalib& copy) = delete;
0072       /// Initializing constructor
0073       AlignmentsCalib(Detector& description, ConditionsMap& mapping);
0074       /// Default destructor
0075       virtual ~AlignmentsCalib() noexcept(false);
0076       /// No assignment operator
0077       AlignmentsCalib& operator=(const AlignmentsCalib& copy) = delete;
0078       /// No move assignment operator
0079       AlignmentsCalib& operator=(AlignmentsCalib&& copy) = delete;
0080 
0081       /// (1) Add a new entry to an existing DetElement structure.
0082       /**
0083        *  This call does several actions:
0084        *
0085        *  A check is performed if the alignment with this identifier
0086        *  already exists: if YES, continue with use(Alignment alignment).
0087        *  If NO, then:
0088        *  1) a Condition object is added using the given 'name'.
0089        *     This condition is added to the ConditionsManager's repository 
0090        *     and the ConditionsSlice. 
0091        *     'name' MUST denote a unique conditions identifier.
0092        *  1.1) A conditions key with the id 'name' is added to the DetElement's 
0093        *       conditions container.
0094        *
0095        * Note: has no effect on the real alignment conditions
0096        *  as long as the callbacks are not executed,
0097        *  which is triggered by the "commit" call.
0098        *  The delta is only cached locally.
0099        *
0100        *  The resulting alignment key is returned to the client. If NULL: Failure
0101        */
0102       Condition::key_type set(DetElement det, const Delta& delta);
0103 
0104       /// (2) Add a new entry to an existing DetElement structure.
0105       /**
0106        * Note: has no effect on the real alignment conditions
0107        *  as long as the callbacks are not executed,
0108        *  which is triggered by the "commit" call.
0109        *  The delta is only cached locally.
0110        *
0111        *  The alignment key is returned to the client. If NULL: Failure
0112        */
0113       Condition::key_type set(const std::string& path, const Delta& delta);
0114 
0115       /// Clear all delta data in the caches transaction stack.
0116       void clearDeltas();
0117 
0118       /// We clear the entire cached stack of used entries.
0119       void clear() noexcept(false);
0120 
0121       /// Convenience only: Access detector element by path
0122       DetElement detector(const std::string& path)  const;
0123 
0124       /// Commit all pending transactions. Returns number of altered entries
0125       AlignmentsCalculator::Result commit();
0126     };    
0127   }       /* End namespace align              */
0128 }         /* End namespace dd4hep                  */
0129 #endif // DDALIGN_ALIGNMENTSCALIB_H