5 #include "TRestDetectorLightAttenuationProcess.h"
12 if (fVetoLightAttenuationLength <= 0.0) {
13 cerr <<
"TRestDetectorLightAttenuationProcess::InitProcess() - "
14 "parameter 'vetoLightAttenuationLength' is not set. "
15 "Please set it in the rml file."
20 fReadout = GetMetadata<TRestDetectorReadout>();
22 if (fReadout ==
nullptr) {
23 cerr <<
"TRestDetectorLightAttenuationProcess::InitProcess() - "
24 "TRestDetectorReadout is not defined. "
25 "Please define it in the rml file."
30 fInputEvent =
nullptr;
38 for (
unsigned int hit = 0; hit < fInputEvent->GetNumberOfHits(); hit++) {
39 const TVector3& position = fInputEvent->GetPosition(hit);
40 const REST_HitType hitType = fInputEvent->GetType(hit);
41 const double energy = fInputEvent->GetEnergy(hit);
42 const double time = fInputEvent->GetTime(hit);
44 if (hitType != VETO) {
46 fOutputEvent->AddHit(position, energy, time, hitType);
53 double energyAttenuated = energy;
54 double timeDelayed = time;
55 for (
int p = 0; p < fReadout->GetNumberOfReadoutPlanes(); p++) {
56 auto [daqId, moduleId, channelId] = fReadout->GetHitsDaqChannelAtReadoutPlane(position, p);
60 auto channel = fReadout->GetReadoutChannelWithDaqID(daqId);
62 const bool isVeto = (channel->GetChannelType() ==
"veto");
65 cout <<
"TRestDetectorLightAttenuationProcess::ProcessEvent() - "
66 "channel type is not 'veto'. "
73 energyAttenuated = energy * TMath::Exp(-1.0 * distance / fVetoLightAttenuationLength);
74 timeDelayed = time + distance / fVetoEffectiveLightSpeed;
80 cerr <<
"TRestDetectorLightAttenuationProcess::ProcessEvent() - "
81 "no readout plane found for veto hit "
82 << position.X() <<
" " << position.Y() <<
" " << position.Z() <<
" with energy: " << energy
87 }
else if (count > 1) {
88 cerr <<
"TRestDetectorLightAttenuationProcess::ProcessEvent() - "
89 "more than one readout plane found for veto hit "
94 fOutputEvent->AddHit(position, energyAttenuated, timeDelayed, hitType);
103 RESTMetadata <<
"Veto effective light speed : " << fVetoEffectiveLightSpeed *
units(
"m/s") <<
" m/s"
105 RESTMetadata <<
"Veto light attenuation length : " << fVetoLightAttenuationLength *
units(
"cm") <<
" cm"
A process to include detector energy resolution in a TRestDetectorHitsEvent.
void InitProcess() override
To be executed at the beginning of the run (outside event loop)
void PrintMetadata() override
Implemented it in the derived metadata class to print out specific metadata information.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
Process one event.
Double_t GetDistanceTo(const TVector3 &pos) const
Returns the perpendicular distance to the readout plane from a given position pos.
A base class for any REST event.
void SetEventInfo(TRestEvent *eve)