98#include "TRestDetectorHitsToSignalProcess.h"
143 SetName(
"hitsToSignalProcess-Default");
144 SetTitle(
"Default config");
146 cout <<
"Hits to signal metadata not found. Loading default values" << endl;
173 fGas = GetMetadata<TRestDetectorGas>();
174 if (
fGas !=
nullptr) {
176 RESTError <<
"A TRestDetectorGas definition was found but REST was not linked to Garfield libraries."
179 <<
"Please, remove the TRestDetectorGas definition, and add gas parameters inside the process "
180 "TRestDetectorHitsToSignalProcess"
183 if (!this->
GetError()) this->
SetError(
"Attempt to use TRestDetectorGas without Garfield");
198 fReadout = GetMetadata<TRestDetectorReadout>();
201 if (!this->
GetError()) this->
SetError(
"The readout was not properly initialized.");
215 cout <<
"Number of hits : " <<
fHitsEvent->GetNumberOfHits() << endl;
216 cout <<
"--------------------------" << endl;
219 for (
unsigned int hit = 0; hit <
fHitsEvent->GetNumberOfHits(); hit++) {
226 cout <<
"Hit : " << hit <<
" x : " << x <<
" y : " << y <<
" z : " << z <<
" t : " << t << endl;
229 Int_t channelId = -1;
243 cout <<
"Module : " << moduleId <<
" Channel : " << channelId <<
" daq ID : " << daqId
247 cout <<
"Energy : " << energy <<
" time : " << time << endl;
251 " TRestDetectorHitsToSignalProcess: x %lf y %lf z %lf energy %lf t %lf "
252 "fDriftVelocity %lf fSampling %lf time %lf\n",
256 cout <<
"Drift velocity : " <<
fDriftVelocity <<
" mm/us" << endl;
264 RESTDebug <<
"TRestDetectorHitsToSignalProcess. Readout channel not find for position ("
265 << x <<
", " << y <<
", " << z <<
")!" <<
RESTendl;
273 cout <<
"TRestDetectorHitsToSignalProcess : Number of signals added : "
275 cout <<
"TRestDetectorHitsToSignalProcess : Total signals integral : " <<
fSignalEvent->GetIntegral()
279 if (
fSignalEvent->GetNumberOfSignals() == 0)
return nullptr;
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.
void SetPressure(Double_t pressure) override
Defines the pressure of the gas.
Double_t GetDriftVelocity(Double_t E)
It returns the drift velocity in cm/us for a given electric field in V/cm.
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 accesible 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.
Int_t GetHitsDaqChannelAtReadoutPlane(const TVector3 &hitPosition, Int_t &moduleID, Int_t &channelID, Int_t planeId=0)
This method recovers the channel daq id corresponding to the (x,y,z) coordinates given by argument....
TRestDetectorReadoutPlane * GetReadoutPlaneWithID(int id)
Returns a pointer to the readout plane by ID.
Int_t GetNumberOfReadoutPlanes()
Returns the number of readout planes defined on the readout.
A base class for any REST event.
void SetEventInfo(TRestEvent *eve)
@ REST_Extreme
show everything
@ REST_Debug
+show the defined debug messages