Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:05

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 // TODO: update to C++17 style
0012 #include <atomic>
0013 #include <iostream>
0014 #include <map>
0015 #include <ostream>
0016 #include <vector>
0017 
0018 #include <stdint.h>
0019 
0020 namespace Acts {
0021 
0022 class RoiDescriptor {
0023  public:
0024   // iterator
0025   using roi_iterator = std::vector<const RoiDescriptor*>::const_iterator;
0026   /// convenient
0027   static constexpr bool FULLSCAN = true;
0028   static constexpr bool ROI = false;
0029 
0030   /**
0031    * @brief constructor
0032    * @param eta      eta of RoI
0033    * @param etaMinus eta at rear  of RoI
0034    * @param etaPlus  eta at front of RoI
0035    * @param phi      phi of RoI
0036    * @param phiMinus minimum phi of RoI
0037    * @param phiPlus  maximum phi of RoI
0038    * @param zed      zed of RoI
0039    * @param zedMinus zed at rear  of RoI
0040    * @param zedPlus  zed at front of RoI
0041    */
0042   RoiDescriptor(double eta, double etaMinus, double etaPlus, double phi,
0043                 double phiMinus, double phiPlus, double zed = 0,
0044                 double zedMinus = -s_zedWidthDefault,
0045                 double zedPlus = s_zedWidthDefault);
0046   // zedminus - s_zedWidthDefault = 225 //from ROIDescriptor
0047 
0048   /*
0049    *  need an explicit class copy constructor
0050    */
0051   RoiDescriptor(const RoiDescriptor& roi);
0052   RoiDescriptor& operator=(const RoiDescriptor& r);
0053 
0054   // Destructor
0055   ~RoiDescriptor();
0056 
0057   // Methods to retrieve data members
0058 
0059   double phi() const { return m_phi; }
0060   double eta() const { return m_eta; }
0061   double zed() const { return m_zed; }
0062 
0063   /// these quantities probably don't need to be used any more
0064   /// - they are implemented here only because we had them in
0065   ///   the original legacy interface
0066 
0067   double zedPlus() const {
0068     return m_zedPlus;
0069   }  //!< z at the most forward end of the RoI
0070   double zedMinus() const {
0071     return m_zedMinus;
0072   }  //!< z at the most backward end of the RoI
0073 
0074   double etaPlus() const { return m_etaPlus; }    //!< gets eta at zedPlus
0075   double etaMinus() const { return m_etaMinus; }  //!< gets eta at zMinus
0076 
0077   double phiPlus() const { return m_phiPlus; }    //!< gets phiPlus
0078   double phiMinus() const { return m_phiMinus; }  //!< gets phiMinus
0079 
0080   /// versioning
0081   int version() const { return m_version; }
0082   void version(int v) { m_version = v; }
0083 
0084   /// output
0085   // virtual operator std::string() const ;
0086 
0087   /// is this a full scan RoI?
0088   bool isFullscan() const { return m_fullscan; }
0089 
0090   /// SuperRoI compatibility methods
0091 
0092   /// am I a SuperRoi?
0093   bool composite() const { return m_composite; }
0094   void setComposite(bool b = true) { m_composite = b; }
0095 
0096   /// always manage constituents ???
0097   bool manageConstituents() const { return m_manageConstituents; }
0098   void manageConstituents(bool b) { m_manageConstituents = b; }
0099 
0100   /// number of constituents
0101   unsigned size() const { return m_roiDescriptors.size(); }
0102 
0103   /// find an RoiDescriptor constituent
0104   const RoiDescriptor* at(int i) const { return m_roiDescriptors.at(i); }
0105 
0106   /// clear the vector
0107   void clear() { m_roiDescriptors.clear(); }  // setComposite(false); }
0108 
0109   /// reserve elements in vector
0110   void reserve(std::size_t s) { m_roiDescriptors.reserve(s); }
0111 
0112   /// add a RoiDescriptor
0113   void push_back(const RoiDescriptor* roi) {
0114     m_roiDescriptors.push_back(roi);
0115     setComposite(true);
0116   }
0117 
0118   /// iterators
0119   roi_iterator begin() const { return m_roiDescriptors.begin(); }
0120   roi_iterator end() const { return m_roiDescriptors.end(); }
0121 
0122   /// return the gradients
0123   double dzdrMinus() const {
0124     return m_dzdrMinus;
0125   }  //!<  dz/dr at the rear of the RoI
0126   double dzdrPlus() const {
0127     return m_dzdrPlus;
0128   }  //!<  dz/dr at the front of the RoI
0129 
0130   double drdzMinus() const {
0131     return m_drdzMinus;
0132   }  //!<  dr/dz at the rear of the RoI
0133   double drdzPlus() const {
0134     return m_drdzPlus;
0135   }  //!<  dr/dz at the front of the RoI
0136 
0137   /// methods to calculate z position at the RoI boundary
0138   /// at a given radius
0139   double zedMin(double r) const;
0140   double zedMax(double r) const;
0141 
0142   double zedOuterPlus() const {
0143     return m_zedOuterPlus;
0144   }  //!< z at the most forward end of the RoI
0145   double zedOuterMinus() const {
0146     return m_zedOuterMinus;
0147   }  //!< z at the most backward end of the RoI
0148 
0149   double rhoMin(double z) const;
0150   double rhoMax(double z) const;
0151 
0152   static double zedWidthDefault() { return s_zedWidthDefault; }
0153 
0154   /// set default z-width (but only before any RoiDescriptor has been created)
0155   static void zedWidthDefault(double d);
0156 
0157   // fromn trig
0158   unsigned int roiId() const { return m_roiId; }
0159   unsigned int l1Id() const { return m_l1Id; }
0160   unsigned int roiWord() const { return m_roiWord; }
0161 
0162  private:
0163   /// default parameters - there may be better ways, but this will do
0164   static std::atomic<double> s_zedWidthDefault;
0165   /// to ensure default width is only set once at job startup
0166   static std::atomic<bool> s_firstInstanceCreated;
0167 
0168   float m_phi{};  //!< phi of RoI center
0169   float m_eta{};  //!< eta of RoI center
0170   float m_zed{};  //!< zed of RoI center
0171 
0172   float m_phiMinus{};  //!< most negative RoI in azimuthal
0173   float m_phiPlus{};   //!< most positive RoI in azimuthal
0174   float m_etaMinus{};  //!< eta of RoI at zedMinus
0175   float m_etaPlus{};   //!< eta of RoI at zedPlus
0176   float m_zedMinus{};  //!< z position at most negative position along the
0177                        //!< beamline
0178   float
0179       m_zedPlus{};  //!< z position at most positive position along the beamline
0180 
0181   float m_dzdrMinus{};  //!<  dz/dr at the rear of the RoI
0182   float m_dzdrPlus{};   //!<  dz/dr at the front of the RoI
0183 
0184   float m_drdzMinus{};  //!<  dr/dz at the rear of the RoI
0185   float m_drdzPlus{};   //!<  dr/dz at the front of the RoI
0186 
0187   float
0188       m_zedOuterMinus{};  //!< z at rear of RoI at the outer radius ( = 1100 mm)
0189   float
0190       m_zedOuterPlus{};  //!< z at front of RoI at the outer radius ( = 1100 mm)
0191 
0192   bool m_fullscan{};            //!< flag this as a full detector RoI
0193   bool m_composite{};           //!< flag this as a composite RoI
0194   bool m_manageConstituents{};  //!< flag to determine whether constituents
0195                                 //!< should be managed
0196 
0197   int m_version{};  //!< transient version identifier
0198 
0199   std::vector<const RoiDescriptor*> m_roiDescriptors;  //!< roi constituents
0200 
0201   // from trig
0202   unsigned int m_l1Id{0};     //!< lvl1 event number
0203   unsigned int m_roiId{0};    //!< RoI number
0204   unsigned int m_roiWord{0};  //!< lvl1 RoI word from which this RoI was
0205                               //!< initially constructed
0206 
0207   //   std::string str( const RoiDescriptor& d );                           //<!
0208   //   printing helper std::ostream& operator<<( std::ostream& m, const
0209   //   RoiDescriptor& d ); //<! printing helper (wraps above)
0210 };
0211 
0212 }  // namespace Acts