9#include <svd/modules/svdSimulation/SVD3SamplesEmulatorModule.h>
24 B2DEBUG(1,
"Constructor");
26 setDescription(
"This module takes the SVDShaperDigit as input and select three consecutive samples starting from the one choosen by the user. The modules creates a new StoreArray of the class ShaperDigit whit three samples only, selected from the original ShaperDigits. The three samples are stored in the first three positions of the APVSamples store array, and the last three are set to 0.");
31 addParam(
"StartingSample",
m_startingSample,
"Starting sample of the three samples (between 0 and 3, the default is 0)",
int(0));
33 std::string(
"SVDShaperDigit3Samples"));
36 "If you want to choose the starting sample manually set this parameter to True. Defauls is False.",
false);
38 "If you want to choose the relative shift sample manually set this parameter to True. Defauls is False, so the relative shift is taken from the original SVDEventInfoSim. Set this True and choose the right relative shift, if you are using data.",
41 "Set the relative shift manually. Default is 0",
int(-1));
62 B2FATAL(
"The starting sample must be between 0 and 3, you set = " <<
m_startingSample);
65 B2DEBUG(28,
"The starting sample from which to start to select the three samples: " <<
m_startingSample);
68 if (m_relativeShift < 0 || m_relativeShift > 12) {
69 B2FATAL(
"The relative shift must be between 0 and 12, you set = " <<
m_relativeShift);
74 "The starting sample has not been chosen. It will be chosen automatically from the information of the trigger bin in SVDEventInfo and relative shift set");
76 "If you want to choose the starting sample manually, set 'chooseStartingSample' parameter True, and 'StartingSample' parameter to the value of the starting sample you desire (between 0 and 3)");
79 "The relative shift and the starting sample have not been chosen. The starting sample will be obtained automatically from the information of the trigger bin and relative shift in SVDEventInfo");
81 "If you want to choose the starting sample manually, set 'chooseStartingSample' parameter True, and 'StartingSample' parameter to the value of the starting sample you desire (between 0 and 3)");
83 "If you want to choose the relative shift manually, set 'chooseRelativeShift' parameter True, and 'relativeShift' parameter to the value you desire (between 0 and 15)");
105 if (!
m_storeSVDEvtInfo.isValid()) B2ERROR(
"No valid SVDEventInfo object is present!");
112 B2FATAL(
"The DAQMode is = " << DAQMode <<
" The number of samples of the input shaperdigits is NOT 6!");
130 VxdID sensorID = shaper.getSensorID();
131 bool side = shaper.isUStrip();
132 int cellID = shaper.getCellID();
133 int8_t fadcT = shaper.getFADCTime();
141 threeSamples[3] = 0.;
142 threeSamples[4] = 0.;
143 threeSamples[5] = 0.;
146 threeSamples[0] = samples[startingSample];
147 threeSamples[1] = samples[startingSample + 1];
148 threeSamples[2] = samples[startingSample + 2];
149 threeSamples[3] = 0.;
150 threeSamples[4] = 0.;
151 threeSamples[5] = 0.;
153 ShaperDigit3Samples.
appendNew(sensorID, side, cellID, threeSamples, fadcT);
168 int nTriggerClocks = 0;
174 return floor(nTriggerClocks / 4);
@ c_ErrorIfAlreadyRegistered
If the object/array was already registered, produce an error (aborting initialisation).
void setDescription(const std::string &description)
Sets the description of the module.
virtual ~SVD3SamplesEmulatorModule()
if required
std::string m_shaperDigitInputName
name of the input ShaperDigits StoreArray
virtual void initialize() override
init the module
virtual void event() override
processes the event
StoreObjPtr< SVDEventInfo > m_storeSVDEvtInfo3samples
storage for SVDEventInfo object produced for 3 samples
virtual void endRun() override
end the run
virtual void terminate() override
terminates the module
bool m_chooseRelativeShift
Set it True if you want to choose the relative shift manually.
virtual void beginRun() override
initializes the module
std::string m_svdEventInfoName
Name of the input SVDEventInfo object.
std::string m_svdEventInfoOutName
Name of the output SVDEventInfo object.
int getFirstSample(const SVDModeByte modeByte)
return the starting sample
bool m_chooseStartingSample
Set it True if you want to choose the starting sample manually.
int m_relativeShift
Relative shift.
StoreArray< SVDShaperDigit > m_ShaperDigit
StoreArray with the 6-samples input shaperdigits with DAQMode = 2.
Int_t m_startingSample
Starting sample from which select the three samples of the initial six.
StoreObjPtr< SVDEventInfo > m_storeSVDEvtInfo
storage for SVDEventInfo object required for the module
SVD3SamplesEmulatorModule()
Constructor: Sets the description, the properties and the parameters of the module.
std::string m_outputArrayName
StoreArray with the 3-samples output shaperdigits, with DAQMode = 1.
Class to store SVD mode information.
void setDAQMode(baseType daqMode)
Set the daqMode id.
baseType getTriggerBin() const
Get the triggerBin id.
baseType getDAQMode() const
Get the daqMode id.
The SVD ShaperDigit class.
std::array< APVFloatSampleType, c_nAPVSamples > APVFloatSamples
array of APVFloatSampleType objects
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Accessor to arrays stored in the data store.
T * appendNew()
Construct a new T object at the end of the array.
Class to uniquely identify a any structure of the PXD and SVD.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.