LArSoft  v09_90_00
Liquid Argon Software toolkit - https://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 #ifndef OPDETPHOTONTABLE_h
35 #define OPDETPHOTONTABLE_h 1
36 
37 #include <map>
38 #include <string>
39 #include <unordered_map>
40 #include <vector>
41 
45 
46 namespace larg4 {
48  public:
50  static OpDetPhotonTable* Instance(bool LitePhotons = false);
51 
52  void AddPhoton(size_t opchannel, sim::OnePhoton&& photon, bool Reflected = false);
53  void AddLitePhoton(int opchannel, int time, int nphotons, bool Reflected = false);
54  void AddPhoton(std::map<int, std::map<int, int>>* StepPhotonTable, bool Reflected = false);
55  void AddLitePhotons(std::map<int, std::map<int, int>>* StepPhotonTable, bool Reflected = false)
56  {
57  AddPhoton(StepPhotonTable, Reflected);
58  }
59 
60  std::vector<sim::SimPhotons>& GetPhotons(bool Reflected = false)
61  {
62  return (Reflected ? fReflectedDetectedPhotons : fDetectedPhotons);
63  }
64  std::vector<sim::SimPhotons>& GetReflectedPhotons() { return GetPhotons(true); }
65  sim::SimPhotons& GetPhotonsForOpChannel(size_t opchannel);
67 
68  std::map<int, std::map<int, int>> GetLitePhotons(bool Reflected = false)
69  {
70  return (Reflected ? fReflectedLitePhotons : fLitePhotons);
71  }
72  std::map<int, std::map<int, int>> GetReflectedLitePhotons() { return GetLitePhotons(true); }
73  std::map<int, int>& GetLitePhotonsForOpChannel(int opchannel)
74  {
75  return fLitePhotons[opchannel];
76  }
77  std::map<int, int>& GetReflectedLitePhotonsForOpChannel(int opchannel)
78  {
79  return fReflectedLitePhotons[opchannel];
80  }
81  void ClearTable(size_t nch = 0);
82 
83  void AddOpDetBacktrackerRecord(sim::OpDetBacktrackerRecord soc, bool Reflected = false);
84  // std::vector<sim::OpDetBacktrackerRecord>& GetOpDetBacktrackerRecords(); //Replaced by YieldOpDetBacktrackerRecords()
85  std::vector<sim::OpDetBacktrackerRecord> YieldOpDetBacktrackerRecords();
86  std::vector<sim::OpDetBacktrackerRecord> YieldReflectedOpDetBacktrackerRecords();
87 
88  void ClearEnergyDeposits();
89  void AddEnergyDeposit(int n_photon,
90  int n_elec,
91  double scint_yield,
92  double energy,
93  float start_x,
94  float start_y,
95  float start_z,
96  float end_x,
97  float end_y,
98  float end_z,
99  double start_time,
100  double end_time,
101  int trackid,
102  int pdgcode,
103  int g4trackid,
104  std::string const& vol = "EMPTY");
106  std::unordered_map<std::string, std::vector<sim::SimEnergyDeposit>> const&
107  GetSimEnergyDeposits() const;
109  std::unordered_map<std::string, std::vector<sim::SimEnergyDeposit>> YieldSimEnergyDeposits();
110  //std::vector<sim::SimEnergyDeposit> & GetSimEnergyDeposits();
111 
112  protected:
114 
115  private:
116  void AddOpDetBacktrackerRecord(std::vector<sim::OpDetBacktrackerRecord>& RecordsCol,
117  std::map<int, int>& ChannelMap,
119 
120  std::map<int, std::map<int, int>> fLitePhotons;
121  std::map<int, std::map<int, int>> fReflectedLitePhotons;
122  std::vector<sim::OpDetBacktrackerRecord>
123  cOpDetBacktrackerRecordsCol; //analogous to scCol for electrons
124  std::vector<sim::OpDetBacktrackerRecord>
125  cReflectedOpDetBacktrackerRecordsCol; //analogous to scCol for electrons
126  std::map<int, int> cOpChannelToSOCMap; //Where each OpChan is.
127  std::map<int, int> cReflectedOpChannelToSOCMap; //Where each OpChan is.
128  std::vector<sim::SimPhotons> fDetectedPhotons;
129  std::vector<sim::SimPhotons> fReflectedDetectedPhotons;
130 
131  std::unordered_map<std::string, std::vector<sim::SimEnergyDeposit>> fSimEDepCol;
132  };
133 
134 }
135 
136 #endif
std::vector< sim::OpDetBacktrackerRecord > YieldReflectedOpDetBacktrackerRecords()
All information of a photon entering the sensitive optical detector volume.
Definition: SimPhotons.h:60
std::map< int, int > & GetReflectedLitePhotonsForOpChannel(int opchannel)
Geant4 interface.
std::unordered_map< std::string, std::vector< sim::SimEnergyDeposit > > YieldSimEnergyDeposits()
Yields the map of energy deposits by volume name, and resets the internal one.
sim::SimPhotons & GetReflectedPhotonsForOpChannel(size_t opchannel)
std::vector< sim::SimPhotons > & GetReflectedPhotons()
Energy deposited on a readout Optical Detector by simulated tracks.
sim::SimPhotons & GetPhotonsForOpChannel(size_t opchannel)
void AddLitePhotons(std::map< int, std::map< int, int >> *StepPhotonTable, bool Reflected=false)
std::map< int, std::map< int, int > > fLitePhotons
std::map< int, int > & GetLitePhotonsForOpChannel(int opchannel)
std::vector< sim::SimPhotons > & GetPhotons(bool Reflected=false)
Simulation objects for optical detectors.
std::unordered_map< std::string, std::vector< sim::SimEnergyDeposit > > const & GetSimEnergyDeposits() const
Returns the map of energy deposits by volume name.
void AddPhoton(size_t opchannel, sim::OnePhoton &&photon, bool Reflected=false)
std::map< int, std::map< int, int > > GetReflectedLitePhotons()
std::vector< sim::OpDetBacktrackerRecord > cReflectedOpDetBacktrackerRecordsCol
std::vector< sim::SimPhotons > fReflectedDetectedPhotons
double energy
Definition: plottest35.C:25
void AddOpDetBacktrackerRecord(sim::OpDetBacktrackerRecord soc, bool Reflected=false)
void AddLitePhoton(int opchannel, int time, int nphotons, bool Reflected=false)
static OpDetPhotonTable * Instance(bool LitePhotons=false)
Collection of photons which recorded on one channel.
Definition: SimPhotons.h:127
std::vector< sim::OpDetBacktrackerRecord > YieldOpDetBacktrackerRecords()
std::unordered_map< std::string, std::vector< sim::SimEnergyDeposit > > fSimEDepCol
contains information for a single step in the detector simulation
std::vector< sim::OpDetBacktrackerRecord > cOpDetBacktrackerRecordsCol
std::map< int, std::map< int, int > > GetLitePhotons(bool Reflected=false)
void ClearTable(size_t nch=0)
void AddEnergyDeposit(int n_photon, int n_elec, double scint_yield, double energy, float start_x, float start_y, float start_z, float end_x, float end_y, float end_z, double start_time, double end_time, int trackid, int pdgcode, int g4trackid, std::string const &vol="EMPTY")
std::vector< sim::SimPhotons > fDetectedPhotons
std::map< int, std::map< int, int > > fReflectedLitePhotons
std::map< int, int > cOpChannelToSOCMap
std::map< int, int > cReflectedOpChannelToSOCMap