diff --git a/TrackerConditions/fcl/prolog.fcl b/TrackerConditions/fcl/prolog.fcl index b118786edd..0b9555c2fa 100644 --- a/TrackerConditions/fcl/prolog.fcl +++ b/TrackerConditions/fcl/prolog.fcl @@ -88,6 +88,7 @@ StrawPhysics : { StrawElectronics : { verbose : 0 useDb : false + overrideDbTimeOffsets : false defaultThresholddVdI : 8.43e6 thresholddVdI : [] diff --git a/TrackerConditions/inc/StrawElectronics.hh b/TrackerConditions/inc/StrawElectronics.hh index ddf489d756..baeb2f05b3 100644 --- a/TrackerConditions/inc/StrawElectronics.hh +++ b/TrackerConditions/inc/StrawElectronics.hh @@ -51,7 +51,7 @@ namespace mu2e { constexpr static const char* cxname = {"StrawElectronics"}; // construct with constants, then some values are computed and filled below - StrawElectronics( double tdeadAnalog, double tdeadDigital, double vsat, + StrawElectronics( bool overrideDbTimeOffsets, double tdeadAnalog, double tdeadDigital, double vsat, double snoise, double ADCLSB, int maxADC, unsigned nADCPackets, unsigned nADCpre, double ADCPeriod, double ADCOffset, unsigned maxtsep, @@ -79,6 +79,7 @@ namespace mu2e { double triggerHysteresis, double clusterLookbackTime) : ProditionsEntity(cxname), + _overrideDbTimeOffsets(overrideDbTimeOffsets), _tdeadAnalog(tdeadAnalog), _tdeadDigital(tdeadDigital), _vsat(vsat), _snoise(snoise), _ADCLSB(ADCLSB), _maxADC(maxADC), _nADCPackets(nADCPackets), _nADCpre(nADCpre), _ADCPeriod(ADCPeriod), _ADCOffset(ADCOffset), @@ -210,7 +211,10 @@ namespace mu2e { double getTimeOffsetStrawHV(size_t istraw) const { return _timeOffsetStrawHV[istraw]; } double getTimeOffsetStrawCal(size_t istraw)const { return _timeOffsetStrawCal[istraw]; } + bool overrideDbTimeOffsets() const { return _overrideDbTimeOffsets; } + private: + bool _overrideDbTimeOffsets; // for digitization we override Db parameters and zero all time offsets // generic waveform parameters std::array,npaths> _dVdI; // scale factor between charge and voltage (milliVolts/picoCoulombs) diff --git a/TrackerConditions/src/StrawElectronicsMaker.cc b/TrackerConditions/src/StrawElectronicsMaker.cc index d4d16fd111..8c8fc3da66 100644 --- a/TrackerConditions/src/StrawElectronicsMaker.cc +++ b/TrackerConditions/src/StrawElectronicsMaker.cc @@ -20,7 +20,8 @@ namespace mu2e { // creat this at the beginning since it must be used, // partially constructed, to complete the construction - auto ptr = std::make_shared(_config.deadTimeAnalog(), + auto ptr = std::make_shared( + _config.overrideDbTimeOffsets(), _config.deadTimeAnalog(), _config.deadTimeDigital(), _config.saturationVoltage(), _config.strawNoise(), _config.ADCLSB(), _config.maxADC(), _config.nADCPackets(), _config.nADCPresamples(), _config.ADCPeriod(), _config.ADCOffset(), @@ -273,13 +274,24 @@ namespace mu2e { std::array timeOffsetPanel; std::array timeOffsetStrawHV; std::array timeOffsetStrawCal; - for(size_t i=0; irowAt(i).delay(); - } - for(size_t i=0; irowAt(istraw).delayHv() + tps->rowAt(i).delayHv(); - timeOffsetStrawCal[i] = tdrs->rowAt(istraw).delayCal() + tps->rowAt(i).delayCal(); + + if (ptr->overrideDbTimeOffsets()){ + for(size_t i=0; irowAt(i).delay(); + } + for(size_t i=0; irowAt(istraw).delayHv() + tps->rowAt(i).delayHv(); + timeOffsetStrawCal[i] = tdrs->rowAt(istraw).delayCal() + tps->rowAt(i).delayCal(); + } } ptr->setOffsets( timeOffsetPanel, diff --git a/TrackerConditions/test/TrkPreampStrawRandomize.py b/TrackerConditions/test/TrkPreampStrawRandomize.py index 7b47acbcbf..b1ea143921 100644 --- a/TrackerConditions/test/TrkPreampStrawRandomize.py +++ b/TrackerConditions/test/TrkPreampStrawRandomize.py @@ -3,34 +3,54 @@ import sys import numpy as np +NPlanes = 36 +NPanels = 6 +NStraws = 96 +NUStraws = NPlanes*NPanels*NStraws + if len(sys.argv) < 7: - print("Usage: python TrkPreampStrawRandomize.py