Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G04DetectorConstruction Class Reference

Detector construction for laoding GDML geometry. More...

#include <G04DetectorConstruction.hh>

Inheritance diagram for G04DetectorConstruction:
Collaboration diagram for G04DetectorConstruction:

Public Member Functions

 G04DetectorConstruction (const G4GDMLParser &parser)
 
virtual G4VPhysicalVolumeConstruct ()
 
virtual void ConstructSDandField ()
 
- Public Member Functions inherited from G4VUserDetectorConstruction
 G4VUserDetectorConstruction ()
 
virtual ~G4VUserDetectorConstruction ()
 
virtual void CloneSD ()
 
virtual void CloneF ()
 
void RegisterParallelWorld (G4VUserParallelWorld *)
 
G4int ConstructParallelGeometries ()
 
void ConstructParallelSD ()
 
G4int GetNumberOfParallelWorld () const
 
G4VUserParallelWorldGetParallelWorld (G4int i) const
 

Additional Inherited Members

- Protected Member Functions inherited from G4VUserDetectorConstruction
void SetSensitiveDetector (const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
 
void SetSensitiveDetector (G4LogicalVolume *logVol, G4VSensitiveDetector *aSD)
 

Detailed Description

Detector construction for laoding GDML geometry.

Definition at line 43 of file G04DetectorConstruction.hh.

Constructor & Destructor Documentation

G04DetectorConstruction::G04DetectorConstruction ( const G4GDMLParser parser)

Definition at line 38 of file G04DetectorConstruction.cc.

40  fParser(parser)
41 {}

Member Function Documentation

G4VPhysicalVolume * G04DetectorConstruction::Construct ( void  )
virtual

Implements G4VUserDetectorConstruction.

Definition at line 45 of file G04DetectorConstruction.cc.

46 {
47  return fParser.GetWorldVolume();
48 }
G4VPhysicalVolume * GetWorldVolume(const G4String &setupName="Default") const

Here is the call graph for this function:

void G04DetectorConstruction::ConstructSDandField ( )
virtual

Reimplemented from G4VUserDetectorConstruction.

Definition at line 52 of file G04DetectorConstruction.cc.

53 {
54  //------------------------------------------------
55  // Sensitive detectors
56  //------------------------------------------------
57 
59 
60  G4String trackerChamberSDname = "Tracker";
61  G04SensitiveDetector* aTrackerSD =
62  new G04SensitiveDetector(trackerChamberSDname);
63  SDman->AddNewDetector( aTrackerSD );
64 
66  //
67  // Example how to retrieve Auxiliary Information for sensitive detector
68  //
69  const G4GDMLAuxMapType* auxmap = fParser.GetAuxMap();
70  G4cout << "Found " << auxmap->size()
71  << " volume(s) with auxiliary information."
72  << G4endl << G4endl;
73  for(G4GDMLAuxMapType::const_iterator iter=auxmap->begin();
74  iter!=auxmap->end(); iter++)
75  {
76  G4cout << "Volume " << ((*iter).first)->GetName()
77  << " has the following list of auxiliary information: "
78  << G4endl << G4endl;
79  for (G4GDMLAuxListType::const_iterator vit=(*iter).second.begin();
80  vit!=(*iter).second.end(); vit++)
81  {
82  G4cout << "--> Type: " << (*vit).type
83  << " Value: " << (*vit).value << G4endl;
84  }
85  }
86  G4cout << G4endl;
87 
88  // The same as above, but now we are looking for
89  // sensitive detectors setting them for the volumes
90 
91  for(G4GDMLAuxMapType::const_iterator iter=auxmap->begin();
92  iter!=auxmap->end(); iter++)
93  {
94  G4cout << "Volume " << ((*iter).first)->GetName()
95  << " has the following list of auxiliary information: "
96  << G4endl << G4endl;
97  for (G4GDMLAuxListType::const_iterator vit=(*iter).second.begin();
98  vit!=(*iter).second.end();vit++)
99  {
100  if ((*vit).type=="SensDet")
101  {
102  G4cout << "Attaching sensitive detector " << (*vit).value
103  << " to volume " << ((*iter).first)->GetName()
104  << G4endl << G4endl;
105 
106  G4VSensitiveDetector* mydet =
107  SDman->FindSensitiveDetector((*vit).value);
108  if(mydet)
109  {
110  G4LogicalVolume* myvol = (*iter).first;
111  myvol->SetSensitiveDetector(mydet);
112  }
113  else
114  {
115  G4cout << (*vit).value << " detector not found" << G4endl;
116  }
117  }
118  }
119  }
120 }
G4GLOB_DLL std::ostream G4cout
G4VSensitiveDetector * FindSensitiveDetector(G4String dName, G4bool warning=true)
Definition: G4SDManager.cc:128
void AddNewDetector(G4VSensitiveDetector *aSD)
Definition: G4SDManager.cc:71
const G4GDMLAuxMapType * GetAuxMap() const
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
#define G4endl
Definition: G4ios.hh:61
std::map< G4LogicalVolume *, G4GDMLAuxListType > G4GDMLAuxMapType
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)
Sensitive detector to be attached to the GDML geometry.

Here is the call graph for this function:


The documentation for this class was generated from the following files: