LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
larg4::OpDetSensitiveDetector Class Reference

#include "OpDetSensitiveDetector.h"

Inheritance diagram for larg4::OpDetSensitiveDetector:

Public Member Functions

 OpDetSensitiveDetector (G4String name, bool useLitePhotons=false)
 
virtual ~OpDetSensitiveDetector ()
 
virtual void Initialize (G4HCofThisEvent *)
 
virtual void EndOfEvent (G4HCofThisEvent *)
 
virtual void clear ()
 
virtual G4bool ProcessHits (G4Step *, G4TouchableHistory *)
 
virtual void DrawAll ()
 
virtual void PrintAll ()
 

Private Member Functions

void AddPhoton (G4Step const *aStep, int OpDet)
 Adds the photon at the specified step with full information. More...
 
void AddLitePhoton (G4Step const *aStep, int OpDet)
 Adds the photon at the specified step with reduced information. More...
 

Private Attributes

bool const fUseLitePhotons
 Fill simplified lite photons instead of full information photons. More...
 
OpDetLookupfTheOpDetLookup
 
OpDetPhotonTablefThePhotonTable
 

Detailed Description

Definition at line 36 of file OpDetSensitiveDetector.h.

Constructor & Destructor Documentation

larg4::OpDetSensitiveDetector::OpDetSensitiveDetector ( G4String  name,
bool  useLitePhotons = false 
)

Definition at line 28 of file OpDetSensitiveDetector.cxx.

References fTheOpDetLookup, fThePhotonTable, larg4::OpDetLookup::Instance(), and larg4::OpDetPhotonTable::Instance().

30  : G4VSensitiveDetector(DetectorUniqueName), fUseLitePhotons(useLitePhotons)
31  {
32  // Register self with sensitive detector manager
33  G4SDManager::GetSDMpointer()->AddNewDetector(this);
34 
35  // Get instances of singleton classes
38  }
bool const fUseLitePhotons
Fill simplified lite photons instead of full information photons.
static OpDetLookup * Instance()
Definition: OpDetLookup.cxx:31
static OpDetPhotonTable * Instance(bool LitePhotons=false)
virtual larg4::OpDetSensitiveDetector::~OpDetSensitiveDetector ( )
inlinevirtual

Definition at line 40 of file OpDetSensitiveDetector.h.

References Initialize().

40 {}

Member Function Documentation

void larg4::OpDetSensitiveDetector::AddLitePhoton ( G4Step const *  aStep,
int  OpDet 
)
private

Adds the photon at the specified step with reduced information.

Definition at line 42 of file OpDetSensitiveDetector.cxx.

References larg4::OpDetPhotonTable::AddLitePhoton(), energy, and fThePhotonTable.

Referenced by ProcessHits().

43  {
44 
45  double const time = aStep->GetTrack()->GetGlobalTime();
46 
47  // the guideline: if it's VUV (~128 nm) is direct, otherwise it is reflected
48  double const energy = aStep->GetTrack()->GetVertexKineticEnergy() / CLHEP::eV;
49  bool const reflected = Wavelength(energy) > 200.0; // nm
50 
51  // Add this photon to the detected photons table
52  fThePhotonTable->AddLitePhoton(OpDet, static_cast<int>(time), 1, reflected);
53 
54  } // OpDetSensitiveDetector::AddLitePhoton()
double energy
Definition: plottest35.C:25
void AddLitePhoton(int opchannel, int time, int nphotons, bool Reflected=false)
void larg4::OpDetSensitiveDetector::AddPhoton ( G4Step const *  aStep,
int  OpDet 
)
private

Adds the photon at the specified step with full information.

Definition at line 58 of file OpDetSensitiveDetector.cxx.

References larg4::OpDetPhotonTable::AddPhoton(), sim::OnePhoton::Energy, sim::OnePhoton::FinalLocalPosition, fThePhotonTable, sim::OnePhoton::InitialPosition, sim::OnePhoton::SetInSD, sim::OnePhoton::Time, and track.

Referenced by ProcessHits().

59  {
60  sim::OnePhoton ThePhoton;
61 
62  // Get photon data to store in the hit
63 
64  ThePhoton.SetInSD = true;
65 
66  auto const& track = *(aStep->GetTrack());
67  auto const& startPos = track.GetVertexPosition();
68  ThePhoton.InitialPosition = {startPos.x(), startPos.y(), startPos.z()};
69 
70  //ThePhoton.Time = track.GetGlobalTime() - fGlobalTimeOffset;
71  ThePhoton.Time = track.GetGlobalTime();
72 
73  ThePhoton.Energy = track.GetVertexKineticEnergy();
74 
75  // Lookup which OpDet we are in
76  G4StepPoint const* preStepPoint = aStep->GetPreStepPoint();
77 
78  // Store relative position on the photon detector
79  G4ThreeVector worldPosition = preStepPoint->GetPosition();
80  G4ThreeVector localPosition =
81  preStepPoint->GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(
82  worldPosition);
83  ThePhoton.FinalLocalPosition = {
84  localPosition.x() / CLHEP::cm, localPosition.y() / CLHEP::cm, localPosition.z() / CLHEP::cm};
85 
86  // Add this photon to the detected photons table
87  fThePhotonTable->AddPhoton(OpDet, std::move(ThePhoton));
88 
89  } // OpDetSensitiveDetector::AddPhoton()
All information of a photon entering the sensitive optical detector volume.
Definition: SimPhotons.h:60
geo::Point_t InitialPosition
Scintillation position in world coordinates [cm].
Definition: SimPhotons.h:63
void AddPhoton(size_t opchannel, sim::OnePhoton &&photon, bool Reflected=false)
bool SetInSD
Whether the photon reaches the sensitive detector.
Definition: SimPhotons.h:84
geo::OpticalPoint_t FinalLocalPosition
Where photon enters the optical detector in local coordinates [cm].
Definition: SimPhotons.h:71
float Energy
Scintillation photon energy [GeV].
Definition: SimPhotons.h:78
Float_t track
Definition: plot.C:35
virtual void larg4::OpDetSensitiveDetector::clear ( )
inlinevirtual

Definition at line 47 of file OpDetSensitiveDetector.h.

References ProcessHits().

47 {}
virtual void larg4::OpDetSensitiveDetector::DrawAll ( )
inlinevirtual

Definition at line 53 of file OpDetSensitiveDetector.h.

53 {}
virtual void larg4::OpDetSensitiveDetector::EndOfEvent ( G4HCofThisEvent )
inlinevirtual

Definition at line 44 of file OpDetSensitiveDetector.h.

44 {}
void larg4::OpDetSensitiveDetector::Initialize ( G4HCofThisEvent )
virtual

Definition at line 112 of file OpDetSensitiveDetector.cxx.

References energy.

Referenced by ~OpDetSensitiveDetector().

112 {}
virtual void larg4::OpDetSensitiveDetector::PrintAll ( )
inlinevirtual

Definition at line 54 of file OpDetSensitiveDetector.h.

54 {}
G4bool larg4::OpDetSensitiveDetector::ProcessHits ( G4Step *  aStep,
G4TouchableHistory *   
)
virtual

Definition at line 93 of file OpDetSensitiveDetector.cxx.

References AddLitePhoton(), AddPhoton(), fTheOpDetLookup, fUseLitePhotons, and larg4::OpDetLookup::GetOpDet().

Referenced by clear().

94  {
95  // Lookup which OpDet we are in
96  int const OpDet = fTheOpDetLookup->GetOpDet(aStep->GetPreStepPoint()->GetPhysicalVolume());
97 
98  // Add this photon to the detected photons table
99  if (fUseLitePhotons)
100  AddLitePhoton(aStep, OpDet);
101  else
102  AddPhoton(aStep, OpDet);
103 
104  // Kill this photon track
105  aStep->GetTrack()->SetTrackStatus(fStopAndKill);
106 
107  return true;
108  }
bool const fUseLitePhotons
Fill simplified lite photons instead of full information photons.
void AddLitePhoton(G4Step const *aStep, int OpDet)
Adds the photon at the specified step with reduced information.
int GetOpDet(G4VPhysicalVolume const *)
Definition: OpDetLookup.cxx:44
void AddPhoton(G4Step const *aStep, int OpDet)
Adds the photon at the specified step with full information.

Member Data Documentation

OpDetLookup* larg4::OpDetSensitiveDetector::fTheOpDetLookup
private

Definition at line 60 of file OpDetSensitiveDetector.h.

Referenced by OpDetSensitiveDetector(), and ProcessHits().

OpDetPhotonTable* larg4::OpDetSensitiveDetector::fThePhotonTable
private

Definition at line 61 of file OpDetSensitiveDetector.h.

Referenced by AddLitePhoton(), AddPhoton(), and OpDetSensitiveDetector().

bool const larg4::OpDetSensitiveDetector::fUseLitePhotons
private

Fill simplified lite photons instead of full information photons.

Definition at line 58 of file OpDetSensitiveDetector.h.

Referenced by ProcessHits().


The documentation for this class was generated from the following files: