5#include "TRestDetectorLightAttenuationProcess.h"
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++) {
62 const bool isVeto = (channel->GetChannelType() ==
"veto");
65 cout <<
"TRestDetectorLightAttenuationProcess::ProcessEvent() - "
66 "channel type is not 'veto'. "
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);
void AddHit(Double_t x, Double_t y, Double_t z, Double_t en, Double_t t=0, REST_HitType type=XYZ)
Adds a new hit to this event.
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.
Double_t fVetoEffectiveLightSpeed
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
Process one event.
Double_t fVetoLightAttenuationLength
Double_t GetDistanceTo(const TVector3 &pos) const
Returns the perpendicular distance to the readout plane from a given position pos.
TRestDetectorReadoutPlane * GetReadoutPlane(int p)
Returns a pointer to the readout plane by index.
std::tuple< Int_t, Int_t, Int_t > GetHitsDaqChannelAtReadoutPlane(const TVector3 &position, Int_t planeId=0)
Returns a tuple with the DaqID, ModuleID, ChannelID.
TRestDetectorReadoutChannel * GetReadoutChannelWithDaqID(int daqId)
Returns a pointer to the readout channel by daq id.
void BeginPrintProcess()
[name, cut range]
A base class for any REST event.
void SetEventInfo(TRestEvent *eve)