|
|
models the behavior of the front-end electronics
More...
#include <HGCFEElectronics.h>
|
float | getADClsb () |
| returns the LSB in MIP currently configured More...
|
|
float | getADCThreshold () |
|
hgc_digi::FEADCPulseShape & | getDefaultADCPulse () |
| getter for the default ADC pulse configured by python More...
|
|
int | getTargetMipValue () |
|
std::array< float, 3 > | getTDCForToAOnset () |
|
float | getTDClsb () |
|
float | getTDCOnset () |
|
float | getTimeJitter (float totalCharge, int thickness) |
|
| HGCFEElectronics (const edm::ParameterSet &ps) |
| CTOR. More...
|
|
void | runShaper (DFr &dataFrame, hgc::HGCSimHitData &chargeColl, hgc::HGCSimHitData &toa, CLHEP::HepRandomEngine *engine, uint32_t thrADC=0, float lsbADC=-1, uint32_t gainIdx=0, float maxADC=-1, int thickness=1) |
|
void | runShaper (DFr &dataFrame, hgc::HGCSimHitData &chargeColl, hgc::HGCSimHitData &toa, const hgc_digi::FEADCPulseShape &adcPulse, CLHEP::HepRandomEngine *engine, uint32_t thrADC=0, float lsbADC=-1, uint32_t gainIdx=0, float maxADC=-1, int thickness=1, float tdcOnsetAuto=-1) |
| switches according to the firmware version More...
|
|
void | runShaperWithToT (DFr &dataFrame, hgc::HGCSimHitData &chargeColl, hgc::HGCSimHitData &toa, CLHEP::HepRandomEngine *engine, uint32_t thrADC, float lsbADC, uint32_t gainIdx, float maxADC, int thickness, float tdcOnsetAuto) |
|
void | runShaperWithToT (DFr &dataFrame, hgc::HGCSimHitData &chargeColl, hgc::HGCSimHitData &toa, CLHEP::HepRandomEngine *engine, uint32_t thrADC, float lsbADC, uint32_t gainIdx, float maxADC, int thickness, float tdcOnsetAuto, const hgc_digi::FEADCPulseShape &adcPulse) |
| implements pulse shape and switch to time over threshold including deadtime More...
|
|
void | runSimpleShaper (DFr &dataFrame, hgc::HGCSimHitData &chargeColl, uint32_t thrADC, float lsbADC, uint32_t gainIdx, float maxADC) |
|
void | runSimpleShaper (DFr &dataFrame, hgc::HGCSimHitData &chargeColl, uint32_t thrADC, float lsbADC, uint32_t gainIdx, float maxADC, const hgc_digi::FEADCPulseShape &adcPulse) |
| applies a shape to each time sample and propagates the tails to the subsequent time samples More...
|
|
void | runTrivialShaper (DFr &dataFrame, hgc::HGCSimHitData &chargeColl, uint32_t thrADC, float lsbADC, uint32_t gainIdx, float maxADC) |
| converts charge to digis without pulse shape More...
|
|
void | setADClsb (float newLSB) |
|
void | SetNoiseValues (const std::vector< float > &noise_fC) |
|
uint32_t | toaMode () const |
| returns how ToT will be computed More...
|
|
| ~HGCFEElectronics () |
| DTOR. More...
|
|
template<class DFr>
class HGCFEElectronics< DFr >
models the behavior of the front-end electronics
Definition at line 24 of file HGCFEElectronics.h.
◆ HGCFEElectronicsFirmwareVersion
◆ HGCFEElectronicsTOTMode
◆ HGCFEElectronics()
CTOR.
Definition at line 11 of file HGCFEElectronics.cc.
30 if (ps.
exists(
"adcPulse")) {
32 for (
unsigned i = 0;
i <
temp.size(); ++
i) {
40 for (
unsigned i = 0;
i <
temp.size(); ++
i) {
44 if (ps.
exists(
"adcNbits")) {
53 if (ps.
exists(
"tdcNbits")) {
62 <<
" (NB lowered by 1 part in a million)" << std::endl;
64 if (ps.
exists(
"targetMIPvalue_ADC"))
66 if (ps.
exists(
"adcThreshold_fC"))
68 if (ps.
exists(
"tdcOnset_fC"))
70 if (ps.
exists(
"tdcForToAOnset_fC")) {
75 throw cms::Exception(
"BadConfiguration") <<
" HGCFEElectronics wrong size for ToA thresholds ";
78 if (ps.
exists(
"toaLSB_ns"))
80 if (ps.
exists(
"tdcChargeDrainParameterisation")) {
81 for (
auto val : ps.
getParameter<std::vector<double> >(
"tdcChargeDrainParameterisation")) {
85 if (ps.
exists(
"tdcResolutionInPs"))
90 if (ps.
exists(
"jitterNoise_ns")) {
95 throw cms::Exception(
"BadConfiguration") <<
" HGCFEElectronics wrong size for ToA jitterNoise ";
98 if (ps.
exists(
"jitterConstant_ns")) {
103 throw cms::Exception(
"BadConfiguration") <<
" HGCFEElectronics wrong size for ToA jitterConstant ";
References edm::ParameterSet::getParameter().
◆ ~HGCFEElectronics()
◆ getADClsb()
◆ getADCThreshold()
◆ getDefaultADCPulse()
◆ getTargetMipValue()
◆ getTDCForToAOnset()
◆ getTDClsb()
◆ getTDCOnset()
◆ getTimeJitter()
template<class DFr >
float HGCFEElectronics< DFr >::getTimeJitter |
( |
float |
totalCharge, |
|
|
int |
thickness |
|
) |
| |
|
inline |
◆ runShaper() [1/2]
◆ runShaper() [2/2]
template<class DFr >
void HGCFEElectronics< DFr >::runShaper |
( |
DFr & |
dataFrame, |
|
|
hgc::HGCSimHitData & |
chargeColl, |
|
|
hgc::HGCSimHitData & |
toa, |
|
|
const hgc_digi::FEADCPulseShape & |
adcPulse, |
|
|
CLHEP::HepRandomEngine * |
engine, |
|
|
uint32_t |
thrADC = 0 , |
|
|
float |
lsbADC = -1 , |
|
|
uint32_t |
gainIdx = 0 , |
|
|
float |
maxADC = -1 , |
|
|
int |
thickness = 1 , |
|
|
float |
tdcOnsetAuto = -1 |
|
) |
| |
|
inline |
switches according to the firmware version
Definition at line 37 of file HGCFEElectronics.h.
55 dataFrame, chargeColl, toa, engine, thrADC, lsbADC, gainIdx, maxADC,
thickness, tdcOnsetAuto,
adcPulse);
References hgcROCParameters_cfi::adcPulse, HGCFEElectronics< DFr >::fwVersion_, HGCFEElectronics< DFr >::runShaperWithToT(), HGCFEElectronics< DFr >::runSimpleShaper(), HGCFEElectronics< DFr >::runTrivialShaper(), HGCFEElectronics< DFr >::SIMPLE, Calorimetry_cff::thickness, and HGCFEElectronics< DFr >::WITHTOT.
Referenced by HGCFEElectronics< DFr >::runShaper().
◆ runShaperWithToT() [1/2]
Definition at line 134 of file HGCFEElectronics.h.
145 dataFrame, chargeColl, toa, engine, thrADC, lsbADC, gainIdx, maxADC,
thickness, tdcOnsetAuto,
adcPulse_);
References HGCFEElectronics< DFr >::adcPulse_, HGCFEElectronics< DFr >::runShaperWithToT(), and Calorimetry_cff::thickness.
◆ runShaperWithToT() [2/2]
template<class DFr >
void HGCFEElectronics< DFr >::runShaperWithToT |
( |
DFr & |
dataFrame, |
|
|
hgc::HGCSimHitData & |
chargeColl, |
|
|
hgc::HGCSimHitData & |
toa, |
|
|
CLHEP::HepRandomEngine * |
engine, |
|
|
uint32_t |
thrADC, |
|
|
float |
lsbADC, |
|
|
uint32_t |
gainIdx, |
|
|
float |
maxADC, |
|
|
int |
thickness, |
|
|
float |
tdcOnsetAuto, |
|
|
const hgc_digi::FEADCPulseShape & |
adcPulse |
|
) |
| |
implements pulse shape and switch to time over threshold including deadtime
Definition at line 207 of file HGCFEElectronics.cc.
225 constexpr
bool debug_state(
true);
227 constexpr
bool debug_state(
false);
230 bool debug = debug_state;
240 if (toaColl[fireBX] != 0.
f) {
241 timeToA = toaColl[fireBX];
244 timeToA = CLHEP::RandGaussQ::shoot(engine, timeToA, jitter);
247 if (timeToA >= 0.
f && timeToA <= 25.
f)
254 for (
int it = 0; it < (
int)(chargeColl.size()); ++it) {
260 if (tdcOnsetAuto < 0) {
264 float charge = chargeColl[it];
265 if (
charge < tdcOnsetAuto) {
276 edm::LogVerbatim(
"HGCFE") <<
"\t q=" <<
charge <<
" fC with <toa>=" << toa <<
" ns, triggers ToT @ " << it
282 float totalCharge(
charge), finalToA(toa), integTime(0);
287 float charge_offset = 0.f;
288 const float charge_kfC(totalCharge * 1
e-3);
300 const float charge_mod = charge_kfC - charge_offset;
301 const float newIntegTime =
306 const int newBusyBxs = std::floor(newIntegTime / 25.
f) + 1;
310 integTime = newIntegTime;
311 if (newBusyBxs == busyBxs)
317 edm::LogVerbatim(
"HGCFE") <<
"\t Intial busy estimate=" << integTime <<
" ns = " << newBusyBxs <<
" bxs"
320 edm::LogVerbatim(
"HGCFE") <<
"\t ...integrated charge overflows initial busy estimate, interating again"
325 busyBxs = newBusyBxs;
333 for (
int jt = 0; jt < it; ++jt) {
334 const unsigned int deltaT = (it - jt);
338 const float leakCharge = chargeColl[jt] *
adcPulse[deltaT + 2];
339 totalCharge += leakCharge;
341 finalToA += leakCharge *
pulseAvgT_[deltaT + 2];
344 edm::LogVerbatim(
"HGCFE") <<
"\t\t leaking " << chargeColl[jt] <<
" fC @ deltaT=-" << deltaT <<
" -> +"
345 << leakCharge <<
" with avgT=" <<
pulseAvgT_[deltaT + 2] << std::endl;
349 for (
int jt = it + 1; jt < it + busyBxs && jt < dataFrame.size(); ++jt) {
354 const float extraCharge = chargeColl[jt];
355 if (extraCharge == 0.
f)
358 edm::LogVerbatim(
"HGCFE") <<
"\t\t adding " << extraCharge <<
" fC @ deltaT=+" << (jt - it) << std::endl;
360 totalCharge += extraCharge;
362 finalToA += extraCharge * toaColl[jt];
367 finalToA /= totalCharge;
369 newCharge[it] = (totalCharge - tdcOnsetAuto);
372 edm::LogVerbatim(
"HGCFE") <<
"\t Final busy estimate=" << integTime <<
" ns = " << busyBxs <<
" bxs" << std::endl
373 <<
"\t Total integrated=" << totalCharge <<
" fC <toa>=" <<
toaFromToT[it]
374 <<
" (raw=" << finalToA <<
") ns " << std::endl;
377 if (it + busyBxs < (
int)(
newCharge.size())) {
378 const float deltaT2nextBx((busyBxs * 25 - integTime));
381 edm::LogVerbatim(
"HGCFE") <<
"\t Leaking remainder of TDC onset " << tdcOnsetAuto <<
" fC, to be dissipated in "
382 << deltaT2nextBx <<
" DeltaT/tau=" << deltaT2nextBx <<
" / "
384 << it + busyBxs <<
" bx (first free bx)" << std::endl;
385 newCharge[it + busyBxs] += tdcOnsetLeakage;
390 auto runChargeSharing = [&]() {
392 for (
int it = 0; it < (
int)(chargeColl.size()); ++it) {
398 for (ipulse =
start; ipulse < stop; ++ipulse) {
399 const int itoffset = it + ipulse - 2;
451 true,
true, gainIdx, (uint16_t)(timeToA /
toaLSB_ns_), (uint16_t)(std::floor(saturatedCharge /
tdcLSB_fC_)));
455 newSample.
set(
false,
true, gainIdx, 0, 0);
465 dataFrame.setSample(it, newSample);
469 std::ostringstream
msg;
470 dataFrame.print(
msg);
References gpuClustering::adc, hgcROCParameters_cfi::adcPulse, ALCARECOTkAlJpsiMuMu_cff::charge, debug, MillePedeFileConverter_cfg::e, f, myMath::fast_expf(), createfilelist::int, SiStripPI::max, min(), mps_check::msg, HGCSample::set(), HGCSample::setToAValid(), and Calorimetry_cff::thickness.
Referenced by HGCFEElectronics< DFr >::runShaper(), and HGCFEElectronics< DFr >::runShaperWithToT().
◆ runSimpleShaper() [1/2]
◆ runSimpleShaper() [2/2]
applies a shape to each time sample and propagates the tails to the subsequent time samples
Definition at line 149 of file HGCFEElectronics.cc.
159 for (
int it = 0; it < (
int)(chargeColl.size()); it++) {
160 const float charge(chargeColl[it]);
171 for (
int ipulse = -2; ipulse < (
int)(
adcPulse.size()) - 2; ipulse++) {
174 if (it + ipulse >= (
int)(dataFrame.size()))
191 newSample.
set(
adc > thrADC,
false, gainIdx, 0,
adc);
192 dataFrame.setSample(it, newSample);
199 std::ostringstream
msg;
200 dataFrame.print(
msg);
References gpuClustering::adc, hgcROCParameters_cfi::adcPulse, ALCARECOTkAlJpsiMuMu_cff::charge, debug, f, createfilelist::int, min(), mps_check::msg, and HGCSample::set().
Referenced by HGCFEElectronics< DFr >::runShaper(), and HGCFEElectronics< DFr >::runSimpleShaper().
◆ runTrivialShaper()
converts charge to digis without pulse shape
Definition at line 110 of file HGCFEElectronics.cc.
115 for (
int it = 0; it < (
int)(chargeColl.size()); it++)
129 for (
int it = 0; it < (
int)(chargeColl.size()); it++) {
131 const uint32_t
adc = std::floor(
std::min(chargeColl[it], maxADC) / lsbADC);
133 newSample.
set(
adc > thrADC,
false, gainIdx, 0,
adc);
134 dataFrame.setSample(it, newSample);
141 std::ostringstream
msg;
142 dataFrame.print(
msg);
References gpuClustering::adc, debug, MillePedeFileConverter_cfg::e, createfilelist::int, min(), mps_check::msg, and HGCSample::set().
Referenced by HGCFEElectronics< DFr >::runShaper().
◆ setADClsb()
◆ SetNoiseValues()
template<class DFr >
void HGCFEElectronics< DFr >::SetNoiseValues |
( |
const std::vector< float > & |
noise_fC | ) |
|
|
inline |
◆ toaMode()
◆ adcLSB_fC_
◆ adcPulse_
◆ adcSaturation_fC_
◆ adcThreshold_fC_
◆ busyFlags
◆ fwVersion_
◆ jitterConstant2_ns_
◆ jitterNoise2_ns_
◆ newCharge
◆ noise_fC_
◆ pulseAvgT_
◆ targetMIPvalue_ADC_
◆ tdcChargeDrainParameterisation_
◆ tdcForToAOnset_fC_
◆ tdcLSB_fC_
◆ tdcOnset_fC_
◆ tdcResolutionInNs_
◆ tdcSaturation_fC_
◆ thresholdFollowsMIP_
◆ toaFlags
◆ toaFromToT
◆ toaLSB_ns_
◆ toaMode_
◆ totFlags
std::array< float, 3 > jitterNoise2_ns_
hgc::HGCSimHitData toaFromToT
std::vector< float > tdcChargeDrainParameterisation_
uint16_t *__restrict__ uint16_t const *__restrict__ adc
void set(bool thr, bool mode, uint16_t gain, uint16_t toa, uint16_t data)
std::array< bool, hgc::nSamples > totFlags
std::array< bool, hgc::nSamples > toaFlags
void runSimpleShaper(DFr &dataFrame, hgc::HGCSimHitData &chargeColl, uint32_t thrADC, float lsbADC, uint32_t gainIdx, float maxADC, const hgc_digi::FEADCPulseShape &adcPulse)
applies a shape to each time sample and propagates the tails to the subsequent time samples
void runShaper(DFr &dataFrame, hgc::HGCSimHitData &chargeColl, hgc::HGCSimHitData &toa, const hgc_digi::FEADCPulseShape &adcPulse, CLHEP::HepRandomEngine *engine, uint32_t thrADC=0, float lsbADC=-1, uint32_t gainIdx=0, float maxADC=-1, int thickness=1, float tdcOnsetAuto=-1)
switches according to the firmware version
float getTimeJitter(float totalCharge, int thickness)
void setToAValid(bool toaFired)
void runTrivialShaper(DFr &dataFrame, hgc::HGCSimHitData &chargeColl, uint32_t thrADC, float lsbADC, uint32_t gainIdx, float maxADC)
converts charge to digis without pulse shape
bool exists(std::string const ¶meterName) const
checks if a parameter exists
void runShaperWithToT(DFr &dataFrame, hgc::HGCSimHitData &chargeColl, hgc::HGCSimHitData &toa, CLHEP::HepRandomEngine *engine, uint32_t thrADC, float lsbADC, uint32_t gainIdx, float maxADC, int thickness, float tdcOnsetAuto, const hgc_digi::FEADCPulseShape &adcPulse)
implements pulse shape and switch to time over threshold including deadtime
std::vector< float > noise_fC_
hgc::HGCSimHitData newCharge
std::array< float, 3 > jitterConstant2_ns_
hgc_digi::FEADCPulseShape pulseAvgT_
uint32_t targetMIPvalue_ADC_
std::array< float, 3 > tdcForToAOnset_fC_
Log< level::Info, true > LogVerbatim
T getParameter(std::string const &) const
Power< A, B >::type pow(const A &a, const B &b)
std::array< bool, hgc::nSamples > busyFlags
hgc_digi::FEADCPulseShape adcPulse_