LArSoft  v07_13_02
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, bool Reflected=false);
64  void AddLitePhoton( int opchannel, int time, int nphotons, bool Reflected=false);
65  void AddPhoton(std::map<int, std::map<int, int>>* StepPhotonTable, bool Reflected=false);
66  void AddLitePhotons(std::map<int, std::map<int, int>>* StepPhotonTable, bool Reflected=false) { AddPhoton(StepPhotonTable, Reflected); }
67 
68  std::vector<sim::SimPhotons >& GetPhotons(bool Reflected=false) { return (Reflected ? fReflectedDetectedPhotons : fDetectedPhotons); }
69  std::vector<sim::SimPhotons >& GetReflectedPhotons() { return GetPhotons(true); }
70  sim::SimPhotons& GetPhotonsForOpChannel(size_t opchannel);
71  sim::SimPhotons& GetReflectedPhotonsForOpChannel(size_t opchannel);
72 
73  std::map<int, std::map<int, int> > GetLitePhotons(bool Reflected=false) { return (Reflected ? fReflectedLitePhotons : fLitePhotons ); }
74  std::map<int, std::map<int, int> > GetReflectedLitePhotons() { return GetLitePhotons(true); }
75  std::map<int, int>& GetLitePhotonsForOpChannel(int opchannel) { return fLitePhotons[opchannel]; }
76  std::map<int, int>& GetReflectedLitePhotonsForOpChannel(int opchannel) { return fReflectedLitePhotons[opchannel]; }
77  void ClearTable(size_t nch=0);
78 
79  void AddOpDetBacktrackerRecord(sim::OpDetBacktrackerRecord soc, bool Reflected=false);
80  // std::vector<sim::OpDetBacktrackerRecord>& GetOpDetBacktrackerRecords(); //Replaced by YieldOpDetBacktrackerRecords()
81  std::vector<sim::OpDetBacktrackerRecord> YieldOpDetBacktrackerRecords();
82  std::vector<sim::OpDetBacktrackerRecord> YieldReflectedOpDetBacktrackerRecords();
83 
84 
85  void ClearEnergyDeposits();
86  void AddEnergyDeposit(int n_elec,int n_photon,
87  double energy,
88  float start_x,float start_y, float start_z,
89  float end_x,float end_y,float end_z,
90  double start_time,double end_time,
91  int trackid,int pdgcode,
92  std::string const& vol="EMPTY");
93  std::unordered_map<std::string, std::vector<sim::SimEnergyDeposit> > const& GetSimEnergyDeposits() const;
94  //std::vector<sim::SimEnergyDeposit> & GetSimEnergyDeposits();
95 
96  protected:
98 
99  private:
100 
101  void AddOpDetBacktrackerRecord(std::vector< sim::OpDetBacktrackerRecord > & RecordsCol,
102  std::map<int, int> &ChannelMap,
104 
105 
106  std::map<int, std::map<int,int> > fLitePhotons;
107  std::map<int, std::map<int,int> > fReflectedLitePhotons;
108  std::vector< sim::OpDetBacktrackerRecord > cOpDetBacktrackerRecordsCol; //analogous to scCol for electrons
109  std::vector< sim::OpDetBacktrackerRecord > cReflectedOpDetBacktrackerRecordsCol; //analogous to scCol for electrons
110  std::map<int, int> cOpChannelToSOCMap; //Where each OpChan is.
111  std::map<int, int> cReflectedOpChannelToSOCMap; //Where each OpChan is.
112  std::vector<sim::SimPhotons> fDetectedPhotons;
113  std::vector<sim::SimPhotons> fReflectedDetectedPhotons;
114 
115 
116  std::unordered_map<std::string, std::vector<sim::SimEnergyDeposit> > fSimEDepCol;
117 
118 
119  };
120 
121 }
122 
123 
124 #endif
std::map< int, std::map< int, int > > fLitePhotons
std::map< int, int > & GetReflectedLitePhotonsForOpChannel(int opchannel)
Geant4 interface.
std::map< int, std::map< int, int > > fReflectedLitePhotons
Energy deposited on a readout Optical Detector by simulated tracks.
void AddLitePhotons(std::map< int, std::map< int, int >> *StepPhotonTable, bool Reflected=false)
std::map< int, int > & GetLitePhotonsForOpChannel(int opchannel)
std::vector< sim::SimPhotons > & GetPhotons(bool Reflected=false)
std::map< int, std::map< int, int > > GetReflectedLitePhotons()
std::vector< sim::SimPhotons > fReflectedDetectedPhotons
double energy
Definition: plottest35.C:25
std::vector< sim::SimPhotons > & GetReflectedPhotons()
Monte Carlo Simulation.
std::vector< sim::OpDetBacktrackerRecord > cReflectedOpDetBacktrackerRecordsCol
std::unordered_map< std::string, std::vector< sim::SimEnergyDeposit > > fSimEDepCol
std::map< int, std::map< int, int > > GetLitePhotons(bool Reflected=false)
std::vector< sim::OpDetBacktrackerRecord > cOpDetBacktrackerRecordsCol
std::vector< sim::SimPhotons > fDetectedPhotons
std::map< int, int > cOpChannelToSOCMap
std::map< int, int > cReflectedOpChannelToSOCMap