Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:55:25

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 DDREC_MATERIALSCAN_H
0014 #define DDREC_MATERIALSCAN_H
0015 
0016 // Framework include files
0017 #include "DDRec/MaterialManager.h"
0018 
0019 #include <memory>
0020 
0021 /// Namespace for the AIDA detector description toolkit
0022 namespace dd4hep {
0023 
0024   /// Forward declarations
0025   class Detector;
0026 
0027   /// Namespace for the reconstruction part of the AIDA detector description toolkit
0028   namespace rec {
0029 
0030     /// Class to perform material scans along a straight line
0031     /**
0032      *  Examples: from DDDetectors/compact/SiD.xml
0033      *  $> materialScan file:checkout/DDDetectors/compact/SiD.xml -interactive
0034      *
0035      *  1) Simple scan:
0036      *     root [0] gMaterialScan->print(5,5,0,5,5,400)
0037      *  2) Scan a given subdetector:
0038      *     root [0] de=gDD4hepUI->instance()->detector("LumiCal");
0039      *     root [1] gMaterialScan->setDetector(de);
0040      *     root [2] gMaterialScan->print(5,5,0,5,5,400)
0041      *  3) Scan by material:
0042      *     root [0] gMaterialScan->setMaterial("Silicon");
0043      *     root [1] gMaterialScan->print(5,5,0,5,5,400)
0044      *  4) Scan by region:
0045      *     root [0] gMaterialScan->setRegion("SiTrackerBarrelRegion");
0046      *     root [1] gMaterialScan->print(0,0,0,100,100,0)
0047      *
0048      *  \author  M.Frank
0049      *  \version 1.0
0050      *  \ingroup DD4HEP_REC
0051      */
0052     class MaterialScan  {
0053     private:
0054       
0055       /// Reference to detector setup
0056       Detector&                        m_detector;
0057       /// Material manager
0058       std::unique_ptr<MaterialManager> m_materialMgr;  //!
0059       /// Local cache: subdetector placements
0060       std::set<const TGeoNode*>        m_placements;
0061       /// Default constructor
0062       MaterialScan();
0063  
0064     public:
0065 
0066       /// Standard constructor for the master instance
0067       MaterialScan(Detector& description);
0068 
0069       /// Default destructor
0070       virtual ~MaterialScan();
0071 
0072       /// Set a specific detector volume to limit the scan (resets other selection criteria)
0073       void setDetector(DetElement detector);
0074       /// Set a specific detector volume to limit the scan (resets other selection criteria)
0075       void setDetector(const char* detector);
0076 
0077       /// Set a specific volume material to limit the scan (resets other selection criteria)
0078       void setMaterial(const char* material);
0079       /// Set a specific volume material to limit the scan (resets other selection criteria)
0080       void setMaterial(Material material);
0081 
0082       /// Set a specific region to limit the scan (resets other selection criteria)
0083       void setRegion(const char* region);
0084       /// Set a specific region to limit the scan (resets other selection criteria)
0085       void setRegion(Region region);
0086 
0087       /// Scan along a line and store the matrials internally
0088       const MaterialVec& scan(double x0, double y0, double z0, double x1, double y1, double z1, double epsilon=1e-4)  const;
0089 
0090       /// Scan along a line and print the materials traversed
0091       void print(const Vector3D& start, const Vector3D& end, double epsilon=1e-4)  const;
0092 
0093       /// Scan along a line and print the materials traversed
0094       void print(double x0, double y0, double z0,
0095                  double x1, double y1, double z1,
0096                  double epsilon=1e-4)  const;
0097     };
0098   }    // End namespace rec
0099 }      // End namespace dd4hep
0100 #endif // DDREC_MATERIALSCAN_H