SToGS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
SToGS_LoadFromDetectorFactory.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 
29 #include "SToGS_DetectorFactory.hh"
30 
32 {
33 }
34 
36 {
37  G4cout << G4endl << " ------ INF ------ from SToGS::LoadFromDetectorFactory::Construct " << fNameInFactory << G4endl;
38 
39  G4VPhysicalVolume *physiWorld = 0x0; SToGS::DetectorFactory *where_to_load = SToGS::DetectorFactory::GetFactory(fNameInFactory);
40  if ( where_to_load ) {
41  physiWorld = where_to_load->Get(fNameInFactory);
42  if ( physiWorld == 0x0 ) {
43  G4cout << "**** Cannot find setup " << fNameInFactory << " in Detector Factory " << where_to_load->GetFactoryName() << G4endl;
44  }
45  }
46  else G4cout << "**** Cannot load setup " << fNameInFactory << " from Detector Factory " << G4endl;
47 
48  G4cout << " ------ END ------ from SToGS::LoadFromDetectorFactory::Construct " << G4endl;
49 
50  return physiWorld;
51 }
52 
54 {
55  G4cout << " ------ INF ------ from SToGS::LoadFromDetectorFactory::ConstructSDandField " << fNameInFactory << G4endl;
56 
57  SToGS::DetectorFactory *where_to_load = SToGS::DetectorFactory::GetFactory(fNameInFactory);
58  if ( where_to_load ) {
59  where_to_load->GetAttributes(fNameInFactory,true,false); // assign amap, dmap
60  }
61  else
62  G4cout << "**** Cannot load setup " << fNameInFactory << " from Detector Factory " << G4endl;
63 
64  G4cout << " ------ END ------ from SToGS::LoadFromDetectorFactory::ConstructSDandField " << G4endl;
65 }
66 
68 {
69 }
70 
72 {
73  G4VPhysicalVolume *physiWorld = 0x0;
74 
76  if ( where_to_load == 0x0 ) {
77  where_to_load = SToGS::DetectorFactory::GetFactory("DetectorFactory/MyStore/");
78  }
79  if ( where_to_load ) {
80  physiWorld = where_to_load->MakeAnArrayFromFactory(fInputFile);
81  }
82  else
83  G4cout << "**** Cannot open file " << fInputFile << " Detector Factory " << G4endl;
84 
85  return physiWorld;
86 }
87 
88 
static DetectorFactory * GetFactory(G4String fullname)
get the specific factory for a full name to a file
virtual G4VPhysicalVolume * Construct()
it built only the detector part i.e. load the xml file and the dmap
virtual G4VPhysicalVolume * Get(G4String basename)
search for a detector in DetectorFactory
virtual G4VPhysicalVolume * MakeAnArrayFromFactory(G4String input_file)
built an array from the factory using the given input file
virtual G4VPhysicalVolume * Construct()
it built only the detector part i.e. load the xml file and the amap, dmap
virtual void GetAttributes(G4String basename, G4bool do_amap=true, G4bool do_dmap=false)
Read the amap file and apply atributes to the detector. if not found, it creates a deefault one from ...
Base Factory. This is a container of sub-factories.
G4String GetFactoryName() const
virtual void ConstructSDandField()
it set the sensitivity, colors and fields here