2#include "Conditions/SimpleTableCondition.h"
3#include "Framework/Configure/Parameters.h"
7#include "Tools/HgcrocEmulator.h"
10 double gain = 320. / 20. / 1024;
23 (700. + 25. * 20.) * (0.162 / 1000.) / 20.);
28 {
"PEDESTAL",
"MEAS_TIME",
"PAD_CAPACITANCE",
"TOT_MAX",
"DRAIN_RATE",
29 "GAIN",
"READOUT_THRESHOLD",
"TOA_THRESHOLD",
"TOT_THRESHOLD"});
42 50. * gain + 5 * 37 * 0.162 /
44 50. * gain + 50 * 37 * 0.162 /
49 hgcroc.seedGenerator(420);
50 hgcroc.condition(chip_conditions);
52 double readout_threshold = gain * 53.;
53 double tot_threshold = 15.76225;
55 float min_voltage_test{0.5};
56 float max_voltage_test{20.};
57 float voltage_step{0.1};
58 int num_voltages{int((max_voltage_test - min_voltage_test) / voltage_step)};
60 std::vector<float> time_tests{
69 unsigned int cell_id = 0x14002020;
71 TFile f(
"hgcroc_emulation.root",
"RECREATE");
72 TTree t(
"hgcroc",
"hgcroc");
76 bool readout, sim_totmode, digitized, digi_totmode;
78 t.Branch(
"sim_voltage", &voltage);
79 t.Branch(
"sim_time", &time);
80 t.Branch(
"sim_readout", &readout);
81 t.Branch(
"sim_totmode", &sim_totmode);
83 t.Branch(
"digitized", &digitized);
84 t.Branch(
"adc", &adc);
85 t.Branch(
"digi_totmode", &digi_totmode);
86 t.Branch(
"tdc", &tdc);
92 unsigned int last_digi = 0;
93 std::vector<std::pair<double, double>> the_pulse(1, {0., 0.});
94 for (
const float ti : time_tests) {
95 for (
int iv{0}; iv < num_voltages; iv++) {
96 voltage = min_voltage_test + iv * voltage_step;
98 readout = (voltage > readout_threshold);
99 sim_totmode = (voltage > tot_threshold);
101 the_pulse[0].first = voltage;
102 the_pulse[0].second = time;
104 std::vector<ldmx::HgcrocDigiCollection::Sample> digi_to_add;
105 digitized = hgcroc.digitize(cell_id, the_pulse, digi_to_add);
107 all_digis.
addDigi(cell_id, digi_to_add);
109 auto digi = all_digis.
getDigi(last_digi++);
111 digi_totmode = digi.
isTOT();
116 adc = digi.soi().adc_t();
Class that represents a digitized hit in a calorimeter cell readout by an HGCROC.
void setIdMask(unsigned int mask)
Set an AND mask to be applied to the id.
Class encapsulating parameters for configuring a processor.
void addParameter(const std::string &name, const T &value)
Add a parameter to the parameter list.
bool isTOT() const
Check if this DIGI is a TOT measurement.
Represents a collection of the digi hits readout by an HGCROC.
void setNumSamplesPerDigi(unsigned int n)
Set number of samples for each digi.
void setSampleOfInterestIndex(unsigned int n)
Set index of sample of interest.
void addDigi(unsigned int id, const std::vector< Sample > &digi)
Add samples to collection.
const HgcrocDigi getDigi(unsigned int digiIndex) const
Get samples for the input digi index.
Emulate the digitization procedure performed by the HGCROC.