Public Member Functions | Private Member Functions | Private Attributes | List of all members
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.

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:33
static OpDetPhotonTable * Instance(bool LitePhotons=false)
virtual larg4::OpDetSensitiveDetector::~OpDetSensitiveDetector ( )
inlinevirtual

Definition at line 40 of file OpDetSensitiveDetector.h.

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 43 of file OpDetSensitiveDetector.cxx.

44  {
45 
46  double const time = aStep->GetTrack()->GetGlobalTime();
47 
48  // the guideline: if it's VUV (~128 nm) is direct, otherwise it is reflected
49  double const energy = aStep->GetTrack()->GetVertexKineticEnergy() / CLHEP::eV;
50  bool const reflected = Wavelength(energy) > 200.0; // nm
51 
52  // Add this photon to the detected photons table
53  fThePhotonTable->AddLitePhoton(OpDet, static_cast<int>(time), 1, reflected);
54 
55  } // OpDetSensitiveDetector::AddLitePhoton()
static constexpr double eV
Definition: Units.h:127
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 60 of file OpDetSensitiveDetector.cxx.

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

Definition at line 50 of file OpDetSensitiveDetector.h.

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

Definition at line 58 of file OpDetSensitiveDetector.h.

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

Definition at line 45 of file OpDetSensitiveDetector.h.

46  {}
void larg4::OpDetSensitiveDetector::Initialize ( G4HCofThisEvent *  )
virtual

Definition at line 116 of file OpDetSensitiveDetector.cxx.

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

Definition at line 61 of file OpDetSensitiveDetector.h.

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

Definition at line 96 of file OpDetSensitiveDetector.cxx.

97  {
98  // Lookup which OpDet we are in
99  int const OpDet = fTheOpDetLookup->GetOpDet(aStep->GetPreStepPoint()->GetPhysicalVolume());
100 
101  // Add this photon to the detected photons table
102  if (fUseLitePhotons)
103  AddLitePhoton(aStep, OpDet);
104  else
105  AddPhoton(aStep, OpDet);
106 
107  // Kill this photon track
108  aStep->GetTrack()->SetTrackStatus(fStopAndKill);
109 
110  return true;
111  }
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.
void AddPhoton(G4Step const *aStep, int OpDet)
Adds the photon at the specified step with full information.
int GetOpDet(G4VPhysicalVolume *)
Definition: OpDetLookup.cxx:48

Member Data Documentation

OpDetLookup* larg4::OpDetSensitiveDetector::fTheOpDetLookup
private

Definition at line 68 of file OpDetSensitiveDetector.h.

OpDetPhotonTable* larg4::OpDetSensitiveDetector::fThePhotonTable
private

Definition at line 69 of file OpDetSensitiveDetector.h.

bool const larg4::OpDetSensitiveDetector::fUseLitePhotons
private

Fill simplified lite photons instead of full information photons.

Definition at line 66 of file OpDetSensitiveDetector.h.


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