OpDetPhotonTable.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file OpDetPhotonTable.h
3 //
4 /// \author bjpjones@mit.edu
5 // Eddited by JStock <jason.stock@mines.sdsmt.edu>
6 ////////////////////////////////////////////////////////////////////////
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 <unordered_map>
39 #include <vector>
40 #include <string>
41 
45 
46 namespace larg4 {
48  {
49  public:
51  static OpDetPhotonTable * Instance(bool LitePhotons = false);
52 
53  void AddPhoton( size_t opchannel, sim::OnePhoton&& photon, bool Reflected=false);
54  void AddLitePhoton( int opchannel, int time, int nphotons, bool Reflected=false);
55  void AddPhoton(std::map<int, std::map<int, int>>* StepPhotonTable, bool Reflected=false);
56  void AddLitePhotons(std::map<int, std::map<int, int>>* StepPhotonTable, bool Reflected=false) { AddPhoton(StepPhotonTable, Reflected); }
57 
58  std::vector<sim::SimPhotons >& GetPhotons(bool Reflected=false) { return (Reflected ? fReflectedDetectedPhotons : fDetectedPhotons); }
59  std::vector<sim::SimPhotons >& GetReflectedPhotons() { return GetPhotons(true); }
60  sim::SimPhotons& GetPhotonsForOpChannel(size_t opchannel);
62 
63  std::map<int, std::map<int, int> > GetLitePhotons(bool Reflected=false) { return (Reflected ? fReflectedLitePhotons : fLitePhotons ); }
64  std::map<int, std::map<int, int> > GetReflectedLitePhotons() { return GetLitePhotons(true); }
65  std::map<int, int>& GetLitePhotonsForOpChannel(int opchannel) { return fLitePhotons[opchannel]; }
66  std::map<int, int>& GetReflectedLitePhotonsForOpChannel(int opchannel) { return fReflectedLitePhotons[opchannel]; }
67  void ClearTable(size_t nch=0);
68 
69  void AddOpDetBacktrackerRecord(sim::OpDetBacktrackerRecord soc, bool Reflected=false);
70  // std::vector<sim::OpDetBacktrackerRecord>& GetOpDetBacktrackerRecords(); //Replaced by YieldOpDetBacktrackerRecords()
71  std::vector<sim::OpDetBacktrackerRecord> YieldOpDetBacktrackerRecords();
72  std::vector<sim::OpDetBacktrackerRecord> YieldReflectedOpDetBacktrackerRecords();
73 
74 
75  void ClearEnergyDeposits();
76  void AddEnergyDeposit(int n_photon, int n_elec, double scint_yield,
77  double energy,
78  float start_x,float start_y, float start_z,
79  float end_x,float end_y,float end_z,
80  double start_time,double end_time,
81  int trackid,int pdgcode,
82  std::string const& vol="EMPTY");
83  /// Returns the map of energy deposits by volume name.
84  std::unordered_map<std::string, std::vector<sim::SimEnergyDeposit> > const& GetSimEnergyDeposits() const;
85  /// Yields the map of energy deposits by volume name, and resets the internal one.
86  std::unordered_map<std::string, std::vector<sim::SimEnergyDeposit> > YieldSimEnergyDeposits();
87  //std::vector<sim::SimEnergyDeposit> & GetSimEnergyDeposits();
88 
89  protected:
91 
92  private:
93 
94  void AddOpDetBacktrackerRecord(std::vector< sim::OpDetBacktrackerRecord > & RecordsCol,
95  std::map<int, int> &ChannelMap,
97 
98 
99  std::map<int, std::map<int,int> > fLitePhotons;
100  std::map<int, std::map<int,int> > fReflectedLitePhotons;
101  std::vector< sim::OpDetBacktrackerRecord > cOpDetBacktrackerRecordsCol; //analogous to scCol for electrons
102  std::vector< sim::OpDetBacktrackerRecord > cReflectedOpDetBacktrackerRecordsCol; //analogous to scCol for electrons
103  std::map<int, int> cOpChannelToSOCMap; //Where each OpChan is.
104  std::map<int, int> cReflectedOpChannelToSOCMap; //Where each OpChan is.
105  std::vector<sim::SimPhotons> fDetectedPhotons;
106  std::vector<sim::SimPhotons> fReflectedDetectedPhotons;
107 
108 
109  std::unordered_map<std::string, std::vector<sim::SimEnergyDeposit> > fSimEDepCol;
110 
111 
112  };
113 
114 }
115 
116 
117 #endif
std::vector< sim::OpDetBacktrackerRecord > YieldReflectedOpDetBacktrackerRecords()
std::map< int, std::map< int, int > > fLitePhotons
std::string string
Definition: nybbler.cc:12
All information of a photon entering the sensitive optical detector volume.
Definition: SimPhotons.h:64
std::map< int, int > & GetReflectedLitePhotonsForOpChannel(int opchannel)
Geant4 interface.
std::map< int, std::map< int, int > > fReflectedLitePhotons
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)
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, int > & GetLitePhotonsForOpChannel(int opchannel)
Simulation objects for optical detectors.
std::vector< sim::SimPhotons > & GetPhotons(bool Reflected=false)
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::SimPhotons > fReflectedDetectedPhotons
std::vector< sim::SimPhotons > & GetReflectedPhotons()
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)
std::vector< sim::OpDetBacktrackerRecord > cReflectedOpDetBacktrackerRecordsCol
Collection of photons which recorded on one channel.
Definition: SimPhotons.h:136
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
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, std::string const &vol="EMPTY")
std::map< int, std::map< int, int > > GetLitePhotons(bool Reflected=false)
std::vector< sim::OpDetBacktrackerRecord > cOpDetBacktrackerRecordsCol
void ClearTable(size_t nch=0)
std::vector< sim::SimPhotons > fDetectedPhotons
std::map< int, int > cOpChannelToSOCMap
std::map< int, int > cReflectedOpChannelToSOCMap