![]() |
|
|||
File indexing completed on 2025-02-23 09:19:37
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 /////////////////////////////////////////////////////////////////////////////// 0027 // File: CCalDetector.hh 0028 // Description: CCalDetector will provide the basic functionallity of a 0029 // detector factory. It has a construct method that describes 0030 // the construction sequence of the detector. It has a Name, 0031 // a file associated with it, and a collection of other 0032 // CCalDetectors that are supposed to be inside this one. 0033 /////////////////////////////////////////////////////////////////////////////// 0034 #ifndef CCalDetector_h 0035 #define CCalDetector_h 1 0036 0037 #include <iostream> 0038 #include <vector> 0039 #include "globals.hh" 0040 0041 //Forward declartion for the CCalDetectorTable typedef 0042 class CCalDetector; 0043 0044 //A table to hold a list of pointers to CMS Detectors 0045 typedef std::vector<CCalDetector*> CCalDetectorTable; 0046 0047 //////////////////// 0048 //At last the class 0049 class CCalDetector { 0050 0051 friend std::ostream& operator<<(std::ostream&, const CCalDetector&); 0052 0053 public: 0054 //////////////////////////////////////////////////////////////// 0055 //Constructor with a name and a filename. 0056 CCalDetector(const G4String &name); 0057 //////////////////////////////////////////////////////////////// 0058 //Destructor 0059 virtual ~CCalDetector(); 0060 0061 0062 //////////////////////////////////////////////////////////////// 0063 // Construction related methods 0064 0065 //This starts the detector construction 0066 void constructHierarchy() { construct();} 0067 void construct(); 0068 0069 0070 //////////////////////////////////////////////////////////////// 0071 //A method that allows to add a new detector inside this one. 0072 void addDetector(CCalDetector*); 0073 0074 0075 //////////////////////////////////////////////////////////////// 0076 //Other get methods 0077 G4String Name() const {return detectorName;} 0078 G4String baseFileName() const {return fileName;} 0079 G4String File() const {return fileName+".geom";} 0080 CCalDetector* getDaughter(G4int i) const {return theDetectorsInside[i];} 0081 G4int getNDaughters() const {return theDetectorsInside.size();} 0082 0083 0084 //////////////////////////////////////////////////////////////// 0085 //Local operators 0086 //Equality only checks name !!! 0087 G4bool operator==(const CCalDetector& left) const { 0088 return (detectorName==left.detectorName); 0089 } 0090 G4bool operator!=(const CCalDetector& left) const { 0091 return (detectorName!=left.detectorName); 0092 } 0093 0094 0095 protected: 0096 0097 //////////////////////////////////////////////////////////////// 0098 //Pure Virtual methods 0099 0100 //Should read a file and store the information inside the concrete 0101 //CCalDetector 0102 virtual G4int readFile() = 0; 0103 //Construct the daughters by calling the apropiate constructors 0104 virtual void constructDaughters() = 0; 0105 0106 //////////////////////////////////////////////////////////////// 0107 //Building related methods 0108 0109 //Builds the detector from a file 0110 G4int buildFromFile(); 0111 0112 protected: 0113 //////////////////////////////////////////////////////////////// 0114 //Data Members 0115 0116 G4String detectorName; //Detector name 0117 G4String fileName; //File name from it will be read 0118 G4String pathName; //Path in which to look for files 0119 0120 CCalDetectorTable theDetectorsInside; //A collection of CCalDetectors inside 0121 0122 G4int constructFlag; //True if this detector is to be built 0123 }; 0124 0125 #endif 0126 0127 0128
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |