LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
LArG4Detector_service.h
Go to the documentation of this file.
1 //=============================================================================
2 // GDMLDetector_service.hh:
3 // GDMLDetectorService is the service that constructs the Geant 4 Geometry
4 // as specified in a gdml file.
5 // To use this service, all you need to do is put it in the services section
6 // of the fcl configuration file, like this:
7 //
8 // <pre>
9 // services: {
10 // ...
11 // user: {
12 // ...
13 // GDMLDetector :
14 // {
15 // category: "world"
16 // gdmlFileName_ : "ta_target.gdml"
17 // }
18 // }
19 // }
20 // </pre>
21 // Author: Hans Wenzel (Fermilab)
22 // Modified: David Rivera - add ability to set step limits for different volumes
23 //=============================================================================
24 // Include guard
25 #ifndef LARG4DETECTOR_SERVICE_HH
26 #define LARG4DETECTOR_SERVICE_HH
27 
29 
31 
32 namespace art {
33  class ProducesCollector;
34 }
35 
36 namespace fhicl {
37  class ParameterSet;
38 }
39 
40 class G4HCofThisEvent;
41 class G4LogicalVolume;
42 class G4VPhysicalVolume;
43 
44 #include "Geant4/G4Types.hh"
45 
46 #include <map>
47 #include <string>
48 #include <unordered_map>
49 #include <utility>
50 #include <vector>
51 
52 namespace larg4 {
53 
55  public:
57 
58  private:
59  std::vector<G4LogicalVolume*> doBuildLVs() override;
60  std::vector<G4VPhysicalVolume*> doPlaceToPVs(std::vector<G4LogicalVolume*>) override;
61 
62  // -- D.R. Set the step limits for specific volumes from the configuration file
63  void setStepLimits();
64 
65  // We need to add something to the art event, so we need these two methods:
66 
67  std::string instanceName(std::string const&) const;
68 
69  // Tell Art what we'll produce
70  void doCallArtProduces(art::ProducesCollector& collector) override;
71 
72  // Actually produce
73  void doFillEventWithArtHits(G4HCofThisEvent* hc) override;
74 
75  std::string gdmlFileName_; // name of the gdml file
76  bool checkOverlaps_; // enable/disable check of overlaps
77  bool
78  updateSimEnergyDeposits_; // enable/disable change of TrackID for Tracks where no MCParticle was created
79  bool
80  updateAuxDetHits_; // enable/disable change of TrackID for Tracks where no MCParticle was created
81  std::vector<std::string>
82  volumeNames_; // list of volume names for which step limits should be set
83  std::vector<float>
84  stepLimits_; // corresponding step limits to be set for each volume in the list of volumeNames, [mm]
85  size_t inputVolumes_; // number of stepLimits to be set
86  bool dumpMP_; // enable/disable dump of material properties
87 
88  std::vector<std::pair<std::string, std::string>> detectors_{};
89  std::map<std::string, G4double> overrideGDMLStepLimit_Map{};
90  std::unordered_map<std::string, float>
91  setGDMLVolumes_{}; // holds all <volume, steplimit> pairs set from the GDML file
92  };
93 }
94 
96 
97 #endif // LARG4DETECTOR_SERVICE_HH
Geant4 interface.
#define DECLARE_ART_SERVICE(svc, scope)
parameter set interface
std::vector< std::string > volumeNames_
std::vector< float > stepLimits_
Definition: MVAAlg.h:12