98#include "TRestDetectorHitsToSignalProcess.h"
145 SetName(
"hitsToSignalProcess-Default");
146 SetTitle(
"Default config");
148 cout <<
"Hits to signal metadata not found. Loading default values" << endl;
175 fGas = GetMetadata<TRestDetectorGas>();
176 if (
fGas !=
nullptr) {
178 RESTError <<
"A TRestDetectorGas definition was found but REST was not linked to Garfield libraries."
181 <<
"Please, remove the TRestDetectorGas definition, and add gas parameters inside the process "
182 "TRestDetectorHitsToSignalProcess"
188 this->
SetError(
"Attempt to use TRestDetectorGas without Garfield");
208 <<
"Drift velocity not defined. Please, define it in the process metadata or in TRestDetectorGas"
213 fReadout = GetMetadata<TRestDetectorReadout>();
216 this->
SetError(
"The readout was not properly initialized.");
233 cout <<
"Number of hits : " <<
fHitsEvent->GetNumberOfHits() << endl;
234 cout <<
"--------------------------" << endl;
237 for (
unsigned int hit = 0; hit <
fHitsEvent->GetNumberOfHits(); hit++) {
244 cout <<
"Hit : " << hit <<
" x : " << x <<
" y : " << y <<
" z : " << z <<
" t : " << t << endl;
247 for (
int p = 0; p <
fReadout->GetNumberOfReadoutPlanes(); p++) {
254 const bool isVeto = (channel->GetChannelType() ==
"veto");
259 RESTError <<
"TRestDetectorHitsToSignalProcess: Negative distance to readout plane. "
260 "This should not happen."
272 <<
"TRestDetectorHitsToSignalProcess: Negative velocity. This should not happen."
277 Double_t time = t + distance / velocity;
280 cout <<
"Module : " << moduleId <<
" Channel : " << channelId <<
" daq ID : " << daqId
285 cout <<
"Energy : " << energy <<
" time : " << time << endl;
289 " TRestDetectorHitsToSignalProcess: x %lf y %lf z %lf energy %lf t %lf "
290 "fDriftVelocity %lf fSampling %lf time %lf\n",
295 cout <<
"Drift velocity : " <<
fDriftVelocity <<
" mm/us" << endl;
301 RESTError <<
"TRestDetectorHitsToSignalProcess: Negative time. This should not happen. "
309 signal->SetSignalName(channel->GetChannelName());
310 signal->SetSignalType(channel->GetChannelType());
314 RESTDebug <<
"TRestDetectorHitsToSignalProcess. Readout channel not find for position ("
315 << x <<
", " << y <<
", " << z <<
")!" <<
RESTendl;
324 cout <<
"TRestDetectorHitsToSignalProcess : Number of signals added : "
326 cout <<
"TRestDetectorHitsToSignalProcess : Total signals integral : " <<
fSignalEvent->GetIntegral()
virtual void SetElectricField(double value)
Sets the electric field. Must be given in V/mm.
virtual Double_t GetElectricField() const
Returns the electric field in V/mm.
Double_t GetX(int n) const
Returns the X-coordinate of hit entry n in mm.
Double_t GetY(int n) const
Returns the Y-coordinate of hit entry n in mm.
Double_t GetZ(int n) const
Returns the Z-coordinate of hit entry n in mm.
A process to transform a x,y,z coordinate hits into daq identified physical time signals.
Double_t fSampling
The sampling rate in us.
void InitProcess() override
Process initialization. This process accesses the information inside TRestGeant4Metadata to identify ...
TRestDetectorHitsEvent * fHitsEvent
A pointer to the specific TRestDetectorHitsEvent output.
TRestDetectorGas * fGas
A pointer to the detector gas definition accessible to TRestRun.
TRestDetectorHitsToSignalProcess()
Default constructor.
Double_t fGasPressure
The gas pressure. If defined it will change the TRestDetectorGas pressure in atm.
TRestDetectorReadout * fReadout
A pointer to the detector readout definition available to TRestRun.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
~TRestDetectorHitsToSignalProcess()
Default destructor.
Double_t fDriftVelocity
The drift velocity in mm/us. If it is negative, it will be calculated from TRestDetectorGas.
TRestDetectorSignalEvent * fSignalEvent
A pointer to the specific TRestDetectorHitsEvent input.
void LoadDefaultConfig()
Function to load the default config in absence of RML input.
Double_t fElectricField
The electric field in V/mm. Used to calculate the drift velocity if TRestDetectorGas is defined.
void Initialize() override
Function to initialize input/output event members and define the section name.
Double_t GetDistanceTo(const TVector3 &pos) const
Returns the perpendicular distance to the readout plane from a given position pos.
A metadata class to generate/store a readout description.
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.
A base class for any REST event.
void SetEventInfo(TRestEvent *eve)
@ REST_Extreme
show everything
@ REST_Debug
+show the defined debug messages
constexpr double lightSpeed
Speed of light in m/s.