LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
OpDetLookup.h
Go to the documentation of this file.
1 //
6 // Provide a map between G4VPhysicalVolumes of OpDets and OpDet Numbers's.
7 //
8 // There are two places where optical detectors must be known about
9 // in larsoft: In the Geant4 volume store, where they are associated
10 // to G4SensitiveDetectors, and in the Geometry service, where their
11 // positions and cryostat associations are known for reconstruction.
12 //
13 // These geometries are built independently, and the OpDet's in each
14 // volume is not provided by the geometry specification.
15 //
16 // The main function of this class is to provide a link between the
17 // unlabelled G4PhysicalVolumes, and the OpDet objects organized into
18 // vectors in the Geomtry/CryostatGeo objects, accessible through the
19 // geo::Geometry service.
20 //
21 // Any physical volume in the gdml which has the specified opdet
22 // name (specified in the geometry service) is given a sensitive detector.
23 // This sensitive detector passes the volume to this service, which
24 // determines based on its position which element in the OpDetGeo collection
25 // it must correspond to.
26 //
27 // It is then renamed accordingly and the link between the two objects
28 // is stored in a map<string, int> which relates the new G4 name
29 // to a detector number in the geometry.
30 //
31 //
32 // Ben Jones, MIT, 06/04/2010
33 //
34 
35 #ifndef OpDetLOOKUP_h
36 #define OpDetLOOKUP_h 1
37 
38 #include <map>
39 #include <string>
40 
41 class G4VPhysicalVolume;
42 
43 namespace larg4 {
44  class OpDetLookup {
45  public:
46  static OpDetLookup* Instance();
47 
48  void AddPhysicalVolume(G4VPhysicalVolume*);
49  int GetOpDet(G4VPhysicalVolume const*);
50  int GetOpDet(std::string const&);
51  int GetN() const;
52  int FindClosestOpDet(G4VPhysicalVolume* vol, double& Distance);
53 
54  private:
55  OpDetLookup();
56 
57  std::map<std::string, int> fTheOpDetMap;
59  };
60 
61 }
62 
63 #endif
Geant4 interface.
std::map< std::string, int > fTheOpDetMap
Definition: OpDetLookup.h:57
int GetOpDet(G4VPhysicalVolume const *)
Definition: OpDetLookup.cxx:44
void AddPhysicalVolume(G4VPhysicalVolume *)
Definition: OpDetLookup.cxx:83
static OpDetLookup * Instance()
Definition: OpDetLookup.cxx:31
int FindClosestOpDet(G4VPhysicalVolume *vol, double &Distance)
Definition: OpDetLookup.cxx:51
int GetN() const
Definition: OpDetLookup.cxx:98