LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
OpDetPhotonTable.h
Go to the documentation of this file.
1 //
5 // Eddited by JStock <jason.stock@mines.sdsmt.edu>
7 //
8 // This class holds a collection of PMT hits to be stored
9 // into an event as produced by the fast scintillation process.
10 //
11 // When a scintillating particle is stepped, it may generate
12 // one or more detected photons in each optical detector,
13 // depending upon its location.
14 //
15 // For the fast scintillation process, the likelihood of generating
16 // a detected photo given a position in the detector is looked up.
17 // If one is detected, a hit in the relevant optical detector at
18 // an appropriate time (with ~20ns error bars for flight time) is
19 // stored in this table, which is eventually read out at the end
20 // of the event by LArG4_module and stored in the event.
21 //
22 // For slow scintillation / cerenkov processes, photons are
23 // generated and stepped about the detector, and if one steps
24 // into a volume designated at sensitive by Geant4, a simphoton
25 // is added to this table.
26 //
27 // The two sources can be distinguished by looking at the
28 // SetInSD flag of the OnePhoton object.
29 //
30 // Ben Jones, MIT, 11/10/12
31 //
32 //
33 //Changes have been made to this object to include the OpDetBacktrackerRecords for use in the photonbacktracker
34 
35 #include "Geant4/G4PhysicalVolumeStore.hh"
36 #include "Geant4/G4VPhysicalVolume.hh"
38 #include <map>
39 #include <unordered_map>
40 #include <string>
41 #include <memory>
42 #include <exception>
43 #ifndef OPDETPHOTONTABLE_h
44 #define OPDETPHOTONTABLE_h 1
45 
46 //#include "lardataobj/Simulation/SimEnergyDeposit.h"
47 
48 namespace sim
49 {
50  class OnePhoton;
51  class SimPhotons;
52  class SimPhotonsLite;
53  class SimEnergyDeposit;
54 }
55 
56 namespace larg4 {
58  {
59  public:
61  static OpDetPhotonTable * Instance(bool LitePhotons = false);
62 
63  void AddPhoton( size_t opchannel, sim::OnePhoton&& photon);
64  void AddPhoton( std::map<int, std::map<int, int>>* StepPhoton);
65 
66  std::vector<sim::SimPhotons >& GetPhotons();
67  sim::SimPhotons& GetPhotonsForOpChannel(size_t opchannel);
68 
69  std::map<int, std::map<int, int> > GetLitePhotons();
70  std::map<int, int>& GetLitePhotonsForOpChannel(int opchannel);
71  void ClearTable(size_t nch=0);
72 
73  void AddOpDetBacktrackerRecord(sim::OpDetBacktrackerRecord soc);
74  // std::vector<sim::OpDetBacktrackerRecord>& GetOpDetBacktrackerRecords(); //Replaced by YieldOpDetBacktrackerRecords()
75  std::vector<sim::OpDetBacktrackerRecord> YieldOpDetBacktrackerRecords();
76 
77  void ClearEnergyDeposits();
78  void AddEnergyDeposit(int n_elec,int n_photon,
79  double energy,
80  float start_x,float start_y, float start_z,
81  float end_x,float end_y,float end_z,
82  double start_time,double end_time,
83  int trackid,int pdgcode,
84  std::string vol="EMPTY");
85  std::unordered_map<std::string, std::vector<sim::SimEnergyDeposit> > & GetSimEnergyDeposits();
86  //std::vector<sim::SimEnergyDeposit> & GetSimEnergyDeposits();
87 
88  protected:
90 
91  private:
92 
93  std::map<int, std::map<int,int> > fLitePhotons;
94  std::vector< sim::OpDetBacktrackerRecord > cOpDetBacktrackerRecordsCol; //analogous to scCol for electrons
95  std::map<int, int> cOpChannelToSOCMap; //Where each OpChan is.
96  std::vector<sim::SimPhotons> fDetectedPhotons;
97 
98 
99  std::unordered_map<std::string, std::vector<sim::SimEnergyDeposit> > fSimEDepCol;
100 
101 
102  };
103 
104 }
105 
106 
107 #endif
std::map< int, std::map< int, int > > fLitePhotons
Geant4 interface.
Energy deposited on a readout Optical Detector by simulated tracks.
double energy
Definition: plottest35.C:25
Monte Carlo Simulation.
std::unordered_map< std::string, std::vector< sim::SimEnergyDeposit > > fSimEDepCol
std::vector< sim::OpDetBacktrackerRecord > cOpDetBacktrackerRecordsCol
std::vector< sim::SimPhotons > fDetectedPhotons
std::map< int, int > cOpChannelToSOCMap