LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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 #include "Geant4/G4PhysicalVolumeStore.hh"
36 #include "Geant4/G4VPhysicalVolume.hh"
37 #include <map>
38 
39 #ifndef OpDetLOOKUP_h
40 #define OpDetLOOKUP_h 1
41 
42 
43 namespace larg4 {
45  {
46  public:
48  static OpDetLookup * Instance();
49 
50  void AddPhysicalVolume(G4VPhysicalVolume *);
51  int GetOpDet(G4VPhysicalVolume *);
52  int GetOpDet(std::string);
53  int GetN();
54  int FindClosestOpDet(G4VPhysicalVolume* vol, double& Distance);
55 
56  protected:
57  OpDetLookup();
58 
59  private:
60  std::map<std::string, int> fTheOpDetMap;
62 
63  };
64 
65 }
66 
67 
68 #endif
Geant4 interface.
std::map< std::string, int > fTheOpDetMap
Definition: OpDetLookup.h:60
void AddPhysicalVolume(G4VPhysicalVolume *)
Definition: OpDetLookup.cxx:94
static OpDetLookup * Instance()
Definition: OpDetLookup.cxx:31
int FindClosestOpDet(G4VPhysicalVolume *vol, double &Distance)
Definition: OpDetLookup.cxx:55
int GetOpDet(G4VPhysicalVolume *)
Definition: OpDetLookup.cxx:46