All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OpDetLookup.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file OpDetLookup.h
3 //
4 /// \author bjpjones@mit.edu
5 ////////////////////////////////////////////////////////////////////////
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 {
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
std::map< std::string, int > fTheOpDetMap
Definition: OpDetLookup.h:60
void AddPhysicalVolume(G4VPhysicalVolume *)
Definition: OpDetLookup.cxx:96
static OpDetLookup * Instance()
Definition: OpDetLookup.cxx:33
int FindClosestOpDet(G4VPhysicalVolume *vol, double &Distance)
Definition: OpDetLookup.cxx:57
int GetOpDet(G4VPhysicalVolume *)
Definition: OpDetLookup.cxx:48