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>(
"slot", &
m_slot);
54 hitTree->Branch<
float>(
"hitTime", &
m_hitTime);
55 hitTree->Branch<
float>(
"dVdt", &
m_dVdt);
56 hitTree->Branch<
float>(
"refTime", &
m_refTime);
58 hitTree->Branch<
float>(
"width", &
m_width);
59 hitTree->Branch<
short>(
"sample", &
m_sample);
60 hitTree->Branch<
short>(
"window", &
m_window);
61 hitTree->Branch<
int>(
"event", &
m_event);
64 registerObject<TTree>(
"hitTree", hitTree);
79 float refTimes[16] = {0.};
80 std::vector<bool> refTimesValid(16,
true);
85 std::vector<float> calPulseTimes[16];
87 if (digit.getHitQuality() != TOPDigit::c_CalPulse or digit.getChannel() !=
m_refChannel)
89 calPulseTimes[digit.getModuleID() - 1].push_back(digit.getTime());
92 for (
int i = 0; i < 16; i++) {
93 refTimesValid[i] =
false;
94 auto& calTimes = calPulseTimes[i];
95 if (calTimes.size() < 2)
continue;
96 std::sort(calTimes.begin(), calTimes.end());
97 for (
unsigned k = 0; k < calTimes.size() - 1; k++) {
98 auto t1 = calTimes[k];
99 auto t2 = calTimes[k + 1];
102 refTimesValid[i] =
true;
110 TTree* hitTree = getObjectPtr<TTree>(
"hitTree");
114 if (digit.getHitQuality() == TOPDigit::c_Junk)
continue;
116 m_slot = digit.getModuleID();
117 m_dVdt = 0.5 * TMath::Sqrt(-2.*TMath::Log(0.5)) * digit.getPulseHeight() / digit.getPulseWidth();
128 m_width = digit.getPulseWidth();
131 const auto* simHit = digit.getRelated<
TOPSimHit>();
132 if (not simHit)
continue;
139 const auto* rawDigit = digit.getRelated<
TOPRawDigit>();
140 if (rawDigit)
m_window = rawDigit->getASICWindow();
141 m_sample = digit.getModulo256Sample();
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...
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)
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 mathod, 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.
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.