Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 09:58:00

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 
0014 #ifndef DD4HEP_DETECTORSELECTOR_H
0015 #define DD4HEP_DETECTORSELECTOR_H
0016 
0017 // Framework include files
0018 #include <DD4hep/Detector.h>
0019 
0020 /// Namespace for the AIDA detector description toolkit
0021 namespace dd4hep {
0022 
0023   /// View on Detector to select detectors according to certain criteria
0024   /** 
0025    * Usage:
0026    *
0027    *  Detector& lcd = ....;
0028    *  DetectorSelector selector(description);
0029    *  DetectorSelector::Result r = selector.detectors("tracker");
0030    *
0031    *  or multiple types:
0032    *  r = selector.detectors("tracker", "calorimeter");
0033    *
0034    *  or selections using DetType flags, e.g:
0035    *  select all barrel trackers but not the Vertex detector
0036    *  r = selector.detectors(  DetType::TRACKER | DetType::BARREL  , DetType::VERTEX ) ;
0037    *
0038    *  \author  M.Frank
0039    *  \version 1.0
0040    */
0041   class DetectorSelector {
0042   public: 
0043     /// Result set definition
0044     typedef std::vector<DetElement> Result;
0045 #ifndef __CINT__
0046     /// Reference to main detector description object
0047     Detector& description;
0048 #endif
0049 
0050   public:
0051 #ifndef __CINT__
0052     /// Default constructor
0053     DetectorSelector(Detector& _description) : description(_description)  {}
0054 #endif
0055     /// Default destructor
0056     ~DetectorSelector()  {}
0057 
0058     /// Access a set of subdetectors according to the sensitive type.
0059     /**
0060        Please note:
0061        - The sensitive type of a detector is set in the 'detector constructor'.
0062        - Not sensitive detector structures have the name 'passive'
0063        - Compounds (ie. nested detectors) are of type 'compound'
0064     */
0065     const Result& detectors(const std::string& type);
0066 
0067     /// Access a set of subdetectors according to several sensitive types.
0068     Result detectors(const std::string& type1,
0069                      const std::string& type2,
0070                      const std::string& type3="",
0071                      const std::string& type4="",
0072                      const std::string& type5="" );
0073 
0074     /** return a vector with all detectors that have all the type properties in
0075      *  includeFlag set but none of the properties given in excludeFlag
0076      */
0077     Result detectors(unsigned int includeFlag, 
0078                      unsigned int excludeFlag=0 ) const ;
0079   };
0080 
0081 } /* End namespace dd4hep        */
0082 #endif // DD4HEP_DETECTORSELECTOR_H