LArVoxelReadoutGeometry.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file LArVoxelReadoutGeometry.h
3 /// \brief Define the "parallel" geometry that's seen by the LAr Voxels.
4 ///
5 /// \author seligman@nevis.columbia.edu
6 ////////////////////////////////////////////////////////////////////////
7 ///
8 /// This class defines the parallel geometry that will be divided into
9 /// the three-dimensional voxels for the detector read-out.
10 ///
11 /// Why define a parallel geometry? Here are some reasons:
12 ///
13 /// - The regular LAr TPC is one large volume of liquid argon. When
14 /// Geant4 does its physics modeling, it can be unconstrained in
15 /// step size by the voxels. Only for readout would the steps be
16 /// sub-divided.
17 ///
18 /// - There may be more than one kind of readout, depending on a
19 /// detector's instrumentation (e.g., OpDets in addition to the wire
20 /// planes). It's possible that the voxelization appropriate for
21 /// the wire planes may not be an appropriate readout for the other
22 /// readouts. Geant4 allows the construction of multiple parallel
23 /// readouts, so this mechanism is relatively easy to extend for
24 /// each type of readout.
25 
26 #ifndef LArG4_LArVoxelReadoutGeometry_h
27 #define LArG4_LArVoxelReadoutGeometry_h
28 
29 #include "Geant4/G4String.hh"
30 #include "Geant4/G4Transform3D.hh"
31 #include "Geant4/G4UserLimits.hh"
32 #include "Geant4/G4VUserParallelWorld.hh"
35 
36 // Forward declarations
37 class G4PhysicalVolume;
38 
39 namespace larg4 {
40 
41  class LArVoxelReadoutGeometry : public G4VUserParallelWorld {
42  public:
43  /// Collection of all it takes to set up this object.
44  struct Setup_t {
45 
46  /// Set up data for `LArVoxelReadout`.
48 
49  }; // struct Setup_t
50 
51  /// Constructor: sets up all its LArVoxelReadout instances.
52  LArVoxelReadoutGeometry(const G4String name, Setup_t const& setupData);
53 
54  /// N.B. Sets the relevant DetectorClocksData and
55  /// DetectorPropertiesData for the event in flight. See
56  /// definition below.
57  class Sentry;
58 
59  /// The key method in this class; creates a parallel world view of
60  /// those volumes relevant to the LAr voxel readout. Required of
61  /// any class that inherits from G4VUserParallelWorld
62  void Construct() override;
63 
64  private:
65  G4VPhysicalVolume* FindNestedVolume(G4VPhysicalVolume* mother,
66  G4Transform3D& motherTransform,
67  G4Transform3D& daughterTransform,
68  std::string& daughterName,
69  unsigned int expectedNum);
70 
71  art::ServiceHandle<geo::Geometry const> fGeo; ///< Handle to the geometry
72  std::unique_ptr<G4UserLimits> fStepLimit; ///< G4 doesn't handle memory management,
73  ///< so we have to
74 
75  /// Data for `LArVoxelReadout` setup.
78  };
79 
80  // This is dirty, dirty. Sigh. Due to the limited interface of G4
81  // and the prevalent use of services in LArSoft, there isn't a much
82  // better alternative.
84  public:
86  detinfo::DetectorClocksData const& clockData,
87  detinfo::DetectorPropertiesData const& detProp) noexcept
88  : readout_{readout}
89  {
90  readout_->flarVoxelReadout->SetClockData(&clockData);
91  readout_->flarVoxelReadout->SetPropertiesData(&detProp);
92  }
93  ~Sentry() noexcept
94  {
95  readout_->flarVoxelReadout->SetClockData(nullptr);
96  readout_->flarVoxelReadout->SetPropertiesData(nullptr);
97  }
98 
99  private:
101  };
102 
103 } // namespace larg4
104 
105 #endif // LArG4_LArVoxelReadoutGeometry_h
static QCString name
Definition: declinfo.cpp:673
Collection of all it takes to set up this object.
Collection of what it takes to set a LArVoxelReadout up.
larg4::LArVoxelReadout::Setup_t fReadoutSetupData
std::string string
Definition: nybbler.cc:12
Geant4 interface.
larg4::LArVoxelReadout::Setup_t readoutSetup
Set up data for LArVoxelReadout.
larg4::LArVoxelReadout * flarVoxelReadout
Data for LArVoxelReadout setup.
art framework interface to geometry description
std::unique_ptr< G4UserLimits > fStepLimit
LArVoxelReadoutGeometry(const G4String name, Setup_t const &setupData)
Constructor: sets up all its LArVoxelReadout instances.
Sentry(LArVoxelReadoutGeometry *const readout, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp) noexcept
art::ServiceHandle< geo::Geometry const > fGeo
Handle to the geometry.
G4VPhysicalVolume * FindNestedVolume(G4VPhysicalVolume *mother, G4Transform3D &motherTransform, G4Transform3D &daughterTransform, std::string &daughterName, unsigned int expectedNum)
A Geant4 sensitive detector that accumulates voxel information.
Contains all timing reference information for the detector.
Transports energy depositions from GEANT4 to TPC channels.