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)
 
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 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)

Definition at line 8 of file ETLElectronicsSim.cc.

9  : geom_(nullptr),
10  debug_(pset.getUntrackedParameter<bool>("debug", false)),
11  bxTime_(pset.getParameter<double>("bxTime")),
12  integratedLum_(pset.getParameter<double>("IntegratedLuminosity")),
13  fluence_(pset.getParameter<std::string>("FluenceVsRadius")),
14  lgadGain_(pset.getParameter<std::string>("LGADGainVsFluence")),
15  timeRes2_(pset.getParameter<std::string>("TimeResolution2")),
16  adcNbits_(pset.getParameter<uint32_t>("adcNbits")),
17  tdcNbits_(pset.getParameter<uint32_t>("tdcNbits")),
18  adcSaturation_MIP_(pset.getParameter<double>("adcSaturation_MIP")),
21  adcThreshold_MIP_(pset.getParameter<double>("adcThreshold_MIP")),
22  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 25 of file ETLElectronicsSim.cc.

25  {
27  evs.get<MTDDigiGeometryRecord>().get(geom);
28  geom_ = geom.product();
29 }

References relativeConstraints::geom, geom_, edm::EventSetup::get(), and get.

◆ run()

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

Definition at line 31 of file ETLElectronicsSim.cc.

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

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 94 of file ETLElectronicsSim.cc.

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

References ecalLiteDTU::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 128 of file ETLElectronicsSim.cc.

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

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 61 of file ETLElectronicsSim.h.

Referenced by runTrivialShaper().

◆ adcLSB_MIP_

const float ETLElectronicsSim::adcLSB_MIP_
private

Definition at line 60 of file ETLElectronicsSim.h.

Referenced by runTrivialShaper().

◆ adcNbits_

const uint32_t ETLElectronicsSim::adcNbits_
private

Definition at line 56 of file ETLElectronicsSim.h.

◆ adcSaturation_MIP_

const float ETLElectronicsSim::adcSaturation_MIP_
private

Definition at line 59 of file ETLElectronicsSim.h.

◆ adcThreshold_MIP_

const float ETLElectronicsSim::adcThreshold_MIP_
private

Definition at line 62 of file ETLElectronicsSim.h.

Referenced by run(), and runTrivialShaper().

◆ bxTime_

const float ETLElectronicsSim::bxTime_
private

Definition at line 49 of file ETLElectronicsSim.h.

Referenced by run().

◆ debug_

const bool ETLElectronicsSim::debug_
private

Definition at line 48 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 51 of file ETLElectronicsSim.h.

Referenced by run().

◆ geom_

const MTDGeometry* ETLElectronicsSim::geom_
private

Definition at line 46 of file ETLElectronicsSim.h.

Referenced by getEventSetup(), and run().

◆ integratedLum_

const float ETLElectronicsSim::integratedLum_
private

Definition at line 50 of file ETLElectronicsSim.h.

Referenced by run().

◆ lgadGain_

const reco::FormulaEvaluator ETLElectronicsSim::lgadGain_
private

Definition at line 52 of file ETLElectronicsSim.h.

Referenced by run().

◆ tdcBitSaturation_

const uint32_t ETLElectronicsSim::tdcBitSaturation_
private

Definition at line 64 of file ETLElectronicsSim.h.

Referenced by runTrivialShaper().

◆ tdcNbits_

const uint32_t ETLElectronicsSim::tdcNbits_
private

Definition at line 56 of file ETLElectronicsSim.h.

◆ timeRes2_

const reco::FormulaEvaluator ETLElectronicsSim::timeRes2_
private

Definition at line 53 of file ETLElectronicsSim.h.

Referenced by run().

◆ toaLSB_ns_

const float ETLElectronicsSim::toaLSB_ns_
private

Definition at line 63 of file ETLElectronicsSim.h.

Referenced by runTrivialShaper().

ETLElectronicsSim::bxTime_
const float bxTime_
Definition: ETLElectronicsSim.h:49
MTDDigiGeometryRecord
Definition: MTDDigiGeometryRecord.h:15
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:50
ETLElectronicsSim::timeRes2_
const reco::FormulaEvaluator timeRes2_
Definition: ETLElectronicsSim.h:53
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
ETLElectronicsSim::adcThreshold_MIP_
const float adcThreshold_MIP_
Definition: ETLElectronicsSim.h:62
cuy.col
col
Definition: cuy.py:1010
ETLElectronicsSim::tdcNbits_
const uint32_t tdcNbits_
Definition: ETLElectronicsSim.h:56
TrackerGeomDet
Definition: TrackerGeomDet.h:6
ETLElectronicsSim::toaLSB_ns_
const float toaLSB_ns_
Definition: ETLElectronicsSim.h:63
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
ETLElectronicsSim::updateOutput
void updateOutput(ETLDigiCollection &coll, const ETLDataFrame &rawDataFrame) const
Definition: ETLElectronicsSim.cc:128
edm::SortedCollection::push_back
void push_back(T const &t)
Definition: SortedCollection.h:188
ETLElectronicsSim::fluence_
const reco::FormulaEvaluator fluence_
Definition: ETLElectronicsSim.h:51
ecalLiteDTU::adc
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
Definition: EcalLiteDTUSample.h:12
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:48
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
FTLDataFrameT::setSample
void setSample(int i, const S &sample)
Definition: FTLDataFrameT.h:58
edm::ESHandle
Definition: DTSurvey.h:22
ETLSample
wrapper for a data word
Definition: ETLSample.h:13
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
ETLDetId::geographicalId
ETLDetId geographicalId() const
Definition: ETLDetId.h:108
Point3DBase< float, LocalTag >
PixelTopology
Definition: PixelTopology.h:10
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
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:94
ETLElectronicsSim::adcLSB_MIP_
const float adcLSB_MIP_
Definition: ETLElectronicsSim.h:60
createfilelist.int
int
Definition: createfilelist.py:10
get
#define get
ETLElectronicsSim::adcSaturation_MIP_
const float adcSaturation_MIP_
Definition: ETLElectronicsSim.h:59
ETLElectronicsSim::adcNbits_
const uint32_t adcNbits_
Definition: ETLElectronicsSim.h:56
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:64
FTLDataFrameT::resize
void resize(size_t s)
allow to set size
Definition: FTLDataFrameT.h:51
ETLElectronicsSim::lgadGain_
const reco::FormulaEvaluator lgadGain_
Definition: ETLElectronicsSim.h:52
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:246
PixelTopology::localY
virtual float localY(float mpY) const =0
ETLElectronicsSim::geom_
const MTDGeometry * geom_
Definition: ETLElectronicsSim.h:46
ETLElectronicsSim::adcBitSaturation_
const uint32_t adcBitSaturation_
Definition: ETLElectronicsSim.h:61
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
FTLDataFrameT::size
int size() const
total number of samples in the digi
Definition: FTLDataFrameT.h:46
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
ETLElectronicsSim::dfSIZE
static constexpr int dfSIZE
Definition: ETLElectronicsSim.h:43