9#include <top/modules/TOPLaserCalibratorCollector/TOPLaserCalibratorCollectorModule.h>
16#include <top/dataobjects/TOPDigit.h>
17#include <top/dataobjects/TOPRawDigit.h>
18#include <top/dataobjects/TOPSimHit.h>
30 setDescription(
"Collector module for the TOP ChannelT0 calibration and the quality monitoring using laser and pulser data");
36 addParam(
"pulserDeltaT",
m_pulserDeltaT,
"Approximate time difference between the two calpulses, in ns",
float(21.8));
40 If this option is used, useReferencePulse will be automatically set to false.");
51 auto hitTree =
new TTree(
"hitTree",
"hitTree");
52 hitTree->Branch<
short>(
"channel", &
m_channel);
53 hitTree->Branch<
short>(
"asic", &
m_asic);
56 hitTree->Branch<
short>(
"slot", &
m_slot);
57 hitTree->Branch<
float>(
"hitTime", &
m_hitTime);
58 hitTree->Branch<
float>(
"dVdt", &
m_dVdt);
59 hitTree->Branch<
float>(
"refTime", &
m_refTime);
61 hitTree->Branch<
float>(
"width", &
m_width);
62 hitTree->Branch<
short>(
"sample", &
m_sample);
63 hitTree->Branch<
short>(
"window", &
m_window);
64 hitTree->Branch<
int>(
"event", &
m_event);
82 float refTimes[16] = {0.};
83 std::vector<bool> refTimesValid(16,
true);
88 std::vector<float> calPulseTimes[16];
90 if (digit.getHitQuality() != TOPDigit::c_CalPulse or digit.getChannel() !=
m_refChannel)
92 calPulseTimes[digit.getModuleID() - 1].push_back(digit.getTime());
95 for (
int i = 0; i < 16; i++) {
96 refTimesValid[i] =
false;
97 auto& calTimes = calPulseTimes[i];
98 if (calTimes.size() < 2)
continue;
99 std::sort(calTimes.begin(), calTimes.end());
100 for (
unsigned k = 0; k < calTimes.size() - 1; k++) {
101 auto t1 = calTimes[k];
102 auto t2 = calTimes[k + 1];
105 refTimesValid[i] =
true;
117 if (digit.getHitQuality() == TOPDigit::c_Junk)
continue;
119 m_slot = digit.getModuleID();
120 m_asic = digit.getASICNumber();
123 m_dVdt = 0.5 * TMath::Sqrt(-2.*TMath::Log(0.5)) * digit.getPulseHeight() / digit.getPulseWidth();
134 m_width = digit.getPulseWidth();
137 const auto* simHit = digit.getRelated<
TOPSimHit>();
138 if (not simHit)
continue;
145 const auto* rawDigit = digit.getRelated<
TOPRawDigit>();
146 if (rawDigit)
m_window = rawDigit->getASICWindow();
147 m_sample = digit.getModulo256Sample();
void registerObject(const std::string &name, T *obj)
Register object with a name, takes ownership, do not access the pointer beyond prepare()
T * getObjectPtr(const std::string &name)
Calls the CalibObjManager to get the requested stored collector data.
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
short m_asicChannel
ASIC channel number (0-7)
TOPLaserCalibratorCollectorModule()
Constructor: Sets the description, the properties and the parameters of the module.
int m_refSlot
Reference slot (1-16).
short m_window
Window number (0-?
unsigned m_refChannel
Reference channel.
StoreArray< TOPDigit > m_TOPDigitArray
Required input array of TOPDigits.
bool m_storeMCTruth
Store the TOPSimHits information instead of the TOPDigit one.
float m_hitTime
Hit time with respect to the reference pulse (ns)
short m_channel
Channel number (0-511)
short m_asic
ASIC number (0-3 within boardstack)
float m_dVdt
Approximate dV/dt (ADC/ns)
int m_event
Consecutive event count.
float m_pulserDeltaTTolerance
Window around the nominal deltaT used to select a double pulse, in ns.
void collect() override
Main method, called for each event.
short m_slot
Slot number (1-16)
void prepare() override
Define histograms.
bool m_useReferencePulse
Use the electronic pulser as reference.
short m_boardstack
Boardstack number (0-3)
float m_refTime
Time of the reference pulse (ns)
bool m_refTimeValid
true when the time of the reference pulse is valid
float m_pulserDeltaT
Approximate time difference between the two calpulses, in ns.
float m_width
Hit pulse width (ns)
short m_sample
Sample number (0-?
float m_amplitude
Hit pulse amplitude (ADC)
Class to store unpacked raw data (hits in feature-extraction format) It provides also calculation of ...
Class to store simulated hits of Cherenkov photons on PMT's input for digitization module (TOPDigitiz...
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.