CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Attributes | Private Attributes
ETLElectronicsSim Class Reference

#include <ETLElectronicsSim.h>

Public Member Functions

 ETLElectronicsSim (const edm::ParameterSet &pset, edm::ConsumesCollector iC)
 
void getEvent (const edm::Event &evt)
 
void getEventSetup (const edm::EventSetup &evt)
 
void run (const mtd::MTDSimHitDataAccumulator &input, ETLDigiCollection &output, CLHEP::HepRandomEngine *hre) const
 
void runTrivialShaper (ETLDataFrame &dataFrame, const mtd::MTDSimHitData &chargeColl, const mtd::MTDSimHitData &toa, const uint8_t row, const uint8_t column) const
 
void updateOutput (ETLDigiCollection &coll, const ETLDataFrame &rawDataFrame) const
 

Static Public Attributes

static constexpr int dfSIZE = 5
 

Private Attributes

const uint32_t adcBitSaturation_
 
const float adcLSB_MIP_
 
const uint32_t adcNbits_
 
const float adcSaturation_MIP_
 
const float adcThreshold_MIP_
 
const float bxTime_
 
const bool debug_
 
const reco::FormulaEvaluator fluence_
 
const MTDGeometrygeom_
 
const edm::ESGetToken< MTDGeometry, MTDDigiGeometryRecordgeomToken_
 
const float integratedLum_
 
const reco::FormulaEvaluator lgadGain_
 
const uint32_t tdcBitSaturation_
 
const uint32_t tdcNbits_
 
const reco::FormulaEvaluator timeRes2_
 
const float toaLSB_ns_
 

Detailed Description

Definition at line 25 of file ETLElectronicsSim.h.

Constructor & Destructor Documentation

◆ ETLElectronicsSim()

ETLElectronicsSim::ETLElectronicsSim ( const edm::ParameterSet pset,
edm::ConsumesCollector  iC 
)

Definition at line 9 of file ETLElectronicsSim.cc.

10  : geomToken_(iC.esConsumes()),
11  geom_(nullptr),
12  debug_(pset.getUntrackedParameter<bool>("debug", false)),
13  bxTime_(pset.getParameter<double>("bxTime")),
14  integratedLum_(pset.getParameter<double>("IntegratedLuminosity")),
15  fluence_(pset.getParameter<std::string>("FluenceVsRadius")),
16  lgadGain_(pset.getParameter<std::string>("LGADGainVsFluence")),
17  timeRes2_(pset.getParameter<std::string>("TimeResolution2")),
18  adcNbits_(pset.getParameter<uint32_t>("adcNbits")),
19  tdcNbits_(pset.getParameter<uint32_t>("tdcNbits")),
20  adcSaturation_MIP_(pset.getParameter<double>("adcSaturation_MIP")),
23  adcThreshold_MIP_(pset.getParameter<double>("adcThreshold_MIP")),
24  toaLSB_ns_(pset.getParameter<double>("toaLSB_ns")),

Member Function Documentation

◆ getEvent()

void ETLElectronicsSim::getEvent ( const edm::Event evt)
inline

Definition at line 29 of file ETLElectronicsSim.h.

29 {}

◆ getEventSetup()

void ETLElectronicsSim::getEventSetup ( const edm::EventSetup evt)

Definition at line 27 of file ETLElectronicsSim.cc.

27 { geom_ = &evs.getData(geomToken_); }

References geom_, geomToken_, and edm::EventSetup::getData().

◆ run()

void ETLElectronicsSim::run ( const mtd::MTDSimHitDataAccumulator input,
ETLDigiCollection output,
CLHEP::HepRandomEngine *  hre 
) const

Definition at line 29 of file ETLElectronicsSim.cc.

31  {
32  MTDSimHitData chargeColl, toa;
33 
34  std::vector<double> emptyV;
35  std::vector<double> radius(1);
36  std::vector<double> fluence(1);
37  std::vector<double> gain(1);
38 
39  for (MTDSimHitDataAccumulator::const_iterator it = input.begin(); it != input.end(); it++) {
40  chargeColl.fill(0.f);
41  toa.fill(0.f);
42 
43  ETLDetId detId = it->first.detid_;
44  DetId geoId = detId.geographicalId();
45  const MTDGeomDet* thedet = geom_->idToDet(geoId);
46  if (thedet == nullptr)
47  throw cms::Exception("EtlElectronicsSim") << "GeographicalID: " << std::hex << geoId.rawId() << " ("
48  << detId.rawId() << ") is invalid!" << std::dec << std::endl;
49  const PixelTopology& topo = static_cast<const PixelTopology&>(thedet->topology());
50 
51  Local3DPoint local_point(topo.localX(it->first.row_), topo.localY(it->first.column_), 0.);
52  const auto& global_point = thedet->toGlobal(local_point);
53 
54  for (size_t i = 0; i < it->second.hit_info[0].size(); i++) {
55  if ((it->second).hit_info[0][i] < adcThreshold_MIP_)
56  continue;
57 
58  // time of arrival
59  float finalToA = (it->second).hit_info[1][i];
60 
61  // calculate the LGAD gain as a function of the fluence at R = radius
62  radius[0] = global_point.perp();
63  fluence[0] = integratedLum_ * fluence_.evaluate(radius, emptyV);
64  gain[0] = lgadGain_.evaluate(fluence, emptyV);
65  if (gain[0] <= 0.)
66  throw cms::Exception("EtlElectronicsSim") << "Null or negative LGAD gain!" << std::endl;
67 
68  // Gaussian smearing of the time of arrival
69  double sigmaToA = sqrt(timeRes2_.evaluate(gain, emptyV));
70 
71  if (sigmaToA > 0.)
72  finalToA += CLHEP::RandGaussQ::shoot(hre, 0., sigmaToA);
73 
74  // fill the time and charge arrays
75  const unsigned int ibucket = std::floor(finalToA / bxTime_);
76  if ((i + ibucket) >= chargeColl.size())
77  continue;
78 
79  chargeColl[i + ibucket] += (it->second).hit_info[0][i];
80 
81  if (toa[i + ibucket] == 0. || (finalToA - ibucket * bxTime_) < toa[i + ibucket])
82  toa[i + ibucket] = finalToA - ibucket * bxTime_;
83  }
84 
85  // run the shaper to create a new data frame
86  ETLDataFrame rawDataFrame(it->first.detid_);
87  runTrivialShaper(rawDataFrame, chargeColl, toa, it->first.row_, it->first.column_);
88  updateOutput(output, rawDataFrame);
89  }
90 }

References adcThreshold_MIP_, bxTime_, TauDecayModes::dec, reco::FormulaEvaluator::evaluate(), Exception, f, fluence_, PedestalClient_cfi::gain, ETLDetId::geographicalId(), geom_, mps_fire::i, MTDGeometry::idToDet(), input, integratedLum_, lgadGain_, PixelTopology::localX(), PixelTopology::localY(), convertSQLitetoXML_cfg::output, CosmicsPD_Skims::radius, DetId::rawId(), runTrivialShaper(), mathSSE::sqrt(), timeRes2_, GeomDet::toGlobal(), GeomDet::topology(), and updateOutput().

◆ runTrivialShaper()

void ETLElectronicsSim::runTrivialShaper ( ETLDataFrame dataFrame,
const mtd::MTDSimHitData chargeColl,
const mtd::MTDSimHitData toa,
const uint8_t  row,
const uint8_t  column 
) const

Definition at line 92 of file ETLElectronicsSim.cc.

96  {
97  bool debug = debug_;
98 #ifdef EDM_ML_DEBUG
99  for (int it = 0; it < (int)(chargeColl.size()); it++)
100  debug |= (chargeColl[it] > adcThreshold_MIP_);
101 #endif
102 
103  if (debug)
104  edm::LogVerbatim("ETLElectronicsSim") << "[runTrivialShaper]" << std::endl;
105 
106  //set new ADCs
107  for (int it = 0; it < (int)(chargeColl.size()); it++) {
108  //brute force saturation, maybe could to better with an exponential like saturation
109  const uint32_t adc = std::min((uint32_t)std::floor(chargeColl[it] / adcLSB_MIP_), adcBitSaturation_);
110  const uint32_t tdc_time = std::min((uint32_t)std::floor(toa[it] / toaLSB_ns_), tdcBitSaturation_);
111  ETLSample newSample;
112  newSample.set(chargeColl[it] > adcThreshold_MIP_, false, tdc_time, adc, row, col);
113  dataFrame.setSample(it, newSample);
114 
115  if (debug)
116  edm::LogVerbatim("ETLElectronicsSim") << adc << " (" << chargeColl[it] << "/" << adcLSB_MIP_ << ") ";
117  }
118 
119  if (debug) {
120  std::ostringstream msg;
121  dataFrame.print(msg);
122  edm::LogVerbatim("ETLElectronicsSim") << msg.str() << std::endl;
123  }
124 }

References gpuClustering::adc, adcBitSaturation_, adcLSB_MIP_, adcThreshold_MIP_, cuy::col, debug, debug_, createfilelist::int, min(), mps_check::msg, FTLDataFrameT< D, S, DECODE >::print(), ETLSample::set(), FTLDataFrameT< D, S, DECODE >::setSample(), tdcBitSaturation_, and toaLSB_ns_.

Referenced by run().

◆ updateOutput()

void ETLElectronicsSim::updateOutput ( ETLDigiCollection coll,
const ETLDataFrame rawDataFrame 
) const

Definition at line 126 of file ETLElectronicsSim.cc.

126  {
127  int itIdx(9);
128  if (rawDataFrame.size() <= itIdx + 2)
129  return;
130 
131  ETLDataFrame dataFrame(rawDataFrame.id());
132  dataFrame.resize(dfSIZE);
133  bool putInEvent(false);
134  for (int it = 0; it < dfSIZE; ++it) {
135  dataFrame.setSample(it, rawDataFrame[itIdx - 2 + it]);
136  if (it == 2)
137  putInEvent = rawDataFrame[itIdx - 2 + it].threshold();
138  }
139 
140  if (putInEvent) {
141  coll.push_back(dataFrame);
142  }
143 }

References dfSIZE, FTLDataFrameT< D, S, DECODE >::id(), edm::SortedCollection< T, SORT >::push_back(), FTLDataFrameT< D, S, DECODE >::resize(), and FTLDataFrameT< D, S, DECODE >::size().

Referenced by run().

Member Data Documentation

◆ adcBitSaturation_

const uint32_t ETLElectronicsSim::adcBitSaturation_
private

Definition at line 62 of file ETLElectronicsSim.h.

Referenced by runTrivialShaper().

◆ adcLSB_MIP_

const float ETLElectronicsSim::adcLSB_MIP_
private

Definition at line 61 of file ETLElectronicsSim.h.

Referenced by runTrivialShaper().

◆ adcNbits_

const uint32_t ETLElectronicsSim::adcNbits_
private

Definition at line 57 of file ETLElectronicsSim.h.

◆ adcSaturation_MIP_

const float ETLElectronicsSim::adcSaturation_MIP_
private

Definition at line 60 of file ETLElectronicsSim.h.

◆ adcThreshold_MIP_

const float ETLElectronicsSim::adcThreshold_MIP_
private

Definition at line 63 of file ETLElectronicsSim.h.

Referenced by run(), and runTrivialShaper().

◆ bxTime_

const float ETLElectronicsSim::bxTime_
private

Definition at line 50 of file ETLElectronicsSim.h.

Referenced by run().

◆ debug_

const bool ETLElectronicsSim::debug_
private

Definition at line 49 of file ETLElectronicsSim.h.

Referenced by runTrivialShaper().

◆ dfSIZE

constexpr int ETLElectronicsSim::dfSIZE = 5
staticconstexpr

Definition at line 43 of file ETLElectronicsSim.h.

Referenced by updateOutput().

◆ fluence_

const reco::FormulaEvaluator ETLElectronicsSim::fluence_
private

Definition at line 52 of file ETLElectronicsSim.h.

Referenced by run().

◆ geom_

const MTDGeometry* ETLElectronicsSim::geom_
private

Definition at line 47 of file ETLElectronicsSim.h.

Referenced by getEventSetup(), and run().

◆ geomToken_

const edm::ESGetToken<MTDGeometry, MTDDigiGeometryRecord> ETLElectronicsSim::geomToken_
private

Definition at line 46 of file ETLElectronicsSim.h.

Referenced by getEventSetup().

◆ integratedLum_

const float ETLElectronicsSim::integratedLum_
private

Definition at line 51 of file ETLElectronicsSim.h.

Referenced by run().

◆ lgadGain_

const reco::FormulaEvaluator ETLElectronicsSim::lgadGain_
private

Definition at line 53 of file ETLElectronicsSim.h.

Referenced by run().

◆ tdcBitSaturation_

const uint32_t ETLElectronicsSim::tdcBitSaturation_
private

Definition at line 65 of file ETLElectronicsSim.h.

Referenced by runTrivialShaper().

◆ tdcNbits_

const uint32_t ETLElectronicsSim::tdcNbits_
private

Definition at line 57 of file ETLElectronicsSim.h.

◆ timeRes2_

const reco::FormulaEvaluator ETLElectronicsSim::timeRes2_
private

Definition at line 54 of file ETLElectronicsSim.h.

Referenced by run().

◆ toaLSB_ns_

const float ETLElectronicsSim::toaLSB_ns_
private

Definition at line 64 of file ETLElectronicsSim.h.

Referenced by runTrivialShaper().

ETLElectronicsSim::bxTime_
const float bxTime_
Definition: ETLElectronicsSim.h:50
FTLDataFrameT::print
void print(std::ostream &out=std::cout)
Definition: FTLDataFrameT.h:62
FTLDataFrameT::id
const D & id() const
det id
Definition: FTLDataFrameT.h:31
ETLElectronicsSim::integratedLum_
const float integratedLum_
Definition: ETLElectronicsSim.h:51
ETLElectronicsSim::timeRes2_
const reco::FormulaEvaluator timeRes2_
Definition: ETLElectronicsSim.h:54
mps_fire.i
i
Definition: mps_fire.py:428
input
static const std::string input
Definition: EdmProvDump.cc:48
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
min
T min(T a, T b)
Definition: MathUtil.h:58
gpuClustering::adc
uint16_t *__restrict__ uint16_t const *__restrict__ adc
Definition: gpuClusterChargeCut.h:20
ETLElectronicsSim::adcThreshold_MIP_
const float adcThreshold_MIP_
Definition: ETLElectronicsSim.h:63
cuy.col
col
Definition: cuy.py:1009
ETLElectronicsSim::tdcNbits_
const uint32_t tdcNbits_
Definition: ETLElectronicsSim.h:57
TrackerGeomDet
Definition: TrackerGeomDet.h:6
ETLElectronicsSim::toaLSB_ns_
const float toaLSB_ns_
Definition: ETLElectronicsSim.h:64
GeomDet::topology
virtual const Topology & topology() const
Definition: GeomDet.cc:67
mps_check.msg
tuple msg
Definition: mps_check.py:285
ETLSample::set
void set(bool thr, bool mode, uint16_t toa, uint16_t data, uint8_t row, uint8_t col)
Definition: ETLSample.h:48
ETLDetId
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:15
edm::ConsumesCollector::esConsumes
auto esConsumes()
Definition: ConsumesCollector.h:97
ETLElectronicsSim::updateOutput
void updateOutput(ETLDigiCollection &coll, const ETLDataFrame &rawDataFrame) const
Definition: ETLElectronicsSim.cc:126
edm::SortedCollection::push_back
void push_back(T const &t)
Definition: SortedCollection.h:188
ETLElectronicsSim::fluence_
const reco::FormulaEvaluator fluence_
Definition: ETLElectronicsSim.h:52
DetId
Definition: DetId.h:17
debug
#define debug
Definition: HDRShower.cc:19
MTDGeometry::idToDet
const MTDGeomDet * idToDet(DetId) const override
Definition: MTDGeometry.cc:171
mtd_digitizer::MTDSimHitData
std::array< MTDSimData_t, nSamples > MTDSimHitData
Definition: MTDDigitizerTypes.h:15
ETLElectronicsSim::debug_
const bool debug_
Definition: ETLElectronicsSim.h:49
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
FTLDataFrameT::setSample
void setSample(int i, const S &sample)
Definition: FTLDataFrameT.h:58
ETLSample
wrapper for a data word
Definition: ETLSample.h:13
ETLDetId::geographicalId
ETLDetId geographicalId() const
Definition: ETLDetId.h:108
Point3DBase< float, LocalTag >
PixelTopology
Definition: PixelTopology.h:10
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
ETLElectronicsSim::runTrivialShaper
void runTrivialShaper(ETLDataFrame &dataFrame, const mtd::MTDSimHitData &chargeColl, const mtd::MTDSimHitData &toa, const uint8_t row, const uint8_t column) const
Definition: ETLElectronicsSim.cc:92
ETLElectronicsSim::adcLSB_MIP_
const float adcLSB_MIP_
Definition: ETLElectronicsSim.h:61
createfilelist.int
int
Definition: createfilelist.py:10
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ETLElectronicsSim::adcSaturation_MIP_
const float adcSaturation_MIP_
Definition: ETLElectronicsSim.h:60
ETLElectronicsSim::adcNbits_
const uint32_t adcNbits_
Definition: ETLElectronicsSim.h:57
PedestalClient_cfi.gain
gain
Definition: PedestalClient_cfi.py:37
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
FTLDataFrameT
Readout digi for HGC.
Definition: FTLDataFrameT.h:14
ETLElectronicsSim::tdcBitSaturation_
const uint32_t tdcBitSaturation_
Definition: ETLElectronicsSim.h:65
FTLDataFrameT::resize
void resize(size_t s)
allow to set size
Definition: FTLDataFrameT.h:51
ETLElectronicsSim::lgadGain_
const reco::FormulaEvaluator lgadGain_
Definition: ETLElectronicsSim.h:53
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
reco::FormulaEvaluator::evaluate
double evaluate(V const &iVariables, P const &iParameters) const
Definition: FormulaEvaluator.h:73
Exception
Definition: hltDiff.cc:245
PixelTopology::localY
virtual float localY(float mpY) const =0
ETLElectronicsSim::geom_
const MTDGeometry * geom_
Definition: ETLElectronicsSim.h:47
ETLElectronicsSim::adcBitSaturation_
const uint32_t adcBitSaturation_
Definition: ETLElectronicsSim.h:62
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
PixelTopology::localX
virtual float localX(float mpX) const =0
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
ETLElectronicsSim::geomToken_
const edm::ESGetToken< MTDGeometry, MTDDigiGeometryRecord > geomToken_
Definition: ETLElectronicsSim.h:46
FTLDataFrameT::size
int size() const
total number of samples in the digi
Definition: FTLDataFrameT.h:46
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
ETLElectronicsSim::dfSIZE
static constexpr int dfSIZE
Definition: ETLElectronicsSim.h:43