CMS 3D CMS Logo

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

#include <ETLDeviceSim.h>

Public Member Functions

 ETLDeviceSim (const edm::ParameterSet &pset)
 
void getEvent (const edm::Event &evt)
 
void getEventSetup (const edm::EventSetup &evt)
 
void getHitsResponse (const std::vector< std::tuple< int, uint32_t, float > > &hitRefs, const edm::Handle< edm::PSimHitContainer > &hits, mtd_digitizer::MTDSimHitDataAccumulator *simHitAccumulator, CLHEP::HepRandomEngine *hre)
 

Private Attributes

float bxTime_
 
const MTDGeometrygeom_
 
float MIPPerMeV_
 
float tofDelay_
 

Detailed Description

Definition at line 21 of file ETLDeviceSim.h.

Constructor & Destructor Documentation

◆ ETLDeviceSim()

ETLDeviceSim::ETLDeviceSim ( const edm::ParameterSet pset)

Definition at line 10 of file ETLDeviceSim.cc.

11  : geom_(nullptr),
12  MIPPerMeV_(1.0 / pset.getParameter<double>("meVPerMIP")),
13  bxTime_(pset.getParameter<double>("bxTime")),
14  tofDelay_(pset.getParameter<double>("tofDelay")) {}

Member Function Documentation

◆ getEvent()

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

Definition at line 25 of file ETLDeviceSim.h.

25 {}

◆ getEventSetup()

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

Definition at line 16 of file ETLDeviceSim.cc.

16  {
18  evs.get<MTDDigiGeometryRecord>().get(geom);
19  geom_ = geom.product();
20 }

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

◆ getHitsResponse()

void ETLDeviceSim::getHitsResponse ( const std::vector< std::tuple< int, uint32_t, float > > &  hitRefs,
const edm::Handle< edm::PSimHitContainer > &  hits,
mtd_digitizer::MTDSimHitDataAccumulator simHitAccumulator,
CLHEP::HepRandomEngine *  hre 
)

Definition at line 22 of file ETLDeviceSim.cc.

25  {
26  //loop over sorted hits
27  const int nchits = hitRefs.size();
28  for (int i = 0; i < nchits; ++i) {
29  const int hitidx = std::get<0>(hitRefs[i]);
30  const uint32_t id = std::get<1>(hitRefs[i]);
31  const MTDDetId detId(id);
32 
33  // Safety check (this should never happen, it should be an exception
34  if (detId.det() != DetId::Forward || detId.mtdSubDetector() != 2) {
35  throw cms::Exception("ETLDeviceSim")
36  << "got a DetId that was not ETL: Det = " << detId.det() << " subDet = " << detId.mtdSubDetector();
37  }
38 
39  if (id == 0)
40  continue; // to be ignored at RECO level
41 
42  ETLDetId etlid(detId);
43  DetId geoId = ETLDetId(etlid.mtdSide(), etlid.mtdRR(), etlid.module(), etlid.modType());
44  const MTDGeomDet* thedet = geom_->idToDet(geoId);
45  if (thedet == nullptr) {
46  throw cms::Exception("ETLDeviceSim") << "GeographicalID: " << std::hex << geoId.rawId() << " (" << detId.rawId()
47  << ") is invalid!" << std::dec << std::endl;
48  }
49  const PixelTopology& topo = static_cast<const PixelTopology&>(thedet->topology());
50 
51  const float toa = std::get<2>(hitRefs[i]) + tofDelay_;
52  const PSimHit& hit = hits->at(hitidx);
53  const float charge = 1000.f * hit.energyLoss() * MIPPerMeV_;
54 
55  // calculate the simhit row and column
56  const auto& pentry = hit.entryPoint();
57  // ETL is already in module-local coordinates so just scale to cm from mm
58  Local3DPoint simscaled(0.1 * pentry.x(), 0.1 * pentry.y(), 0.1 * pentry.z());
59  const auto& thepixel = topo.pixel(simscaled); // mm -> cm here is the switch
60  const uint8_t row(thepixel.first), col(thepixel.second);
61 
62  auto simHitIt =
63  simHitAccumulator->emplace(mtd_digitizer::MTDCellId(id, row, col), mtd_digitizer::MTDCellInfo()).first;
64 
65  // Accumulate in 15 buckets of 25ns (9 pre-samples, 1 in-time, 5 post-samples)
66  const int itime = std::floor(toa / bxTime_) + 9;
67  if (itime < 0 || itime > 14)
68  continue;
69 
70  // Check if time index is ok and store energy
71  if (itime >= (int)simHitIt->second.hit_info[0].size())
72  continue;
73 
74  (simHitIt->second).hit_info[0][itime] += charge;
75 
76  // Store the time of the first SimHit in the right DataFrame bucket
77  const float tof = toa - (itime - 9) * bxTime_;
78 
79  if ((simHitIt->second).hit_info[1][itime] == 0. || tof < (simHitIt->second).hit_info[1][itime]) {
80  (simHitIt->second).hit_info[1][itime] = tof;
81  }
82  }
83 }

References bxTime_, ALCARECOTkAlJpsiMuMu_cff::charge, cuy::col, TauDecayModes::dec, DetId::det(), Exception, DetId::Forward, geom_, hfClusterShapes_cfi::hits, mps_fire::i, MTDGeometry::idToDet(), MIPPerMeV_, ETLDetId::modType(), ETLDetId::module(), MTDDetId::mtdRR(), MTDDetId::mtdSide(), MTDDetId::mtdSubDetector(), PixelTopology::pixel(), DetId::rawId(), and tofDelay_.

Member Data Documentation

◆ bxTime_

float ETLDeviceSim::bxTime_
private

Definition at line 38 of file ETLDeviceSim.h.

Referenced by getHitsResponse().

◆ geom_

const MTDGeometry* ETLDeviceSim::geom_
private

Definition at line 35 of file ETLDeviceSim.h.

Referenced by getEventSetup(), and getHitsResponse().

◆ MIPPerMeV_

float ETLDeviceSim::MIPPerMeV_
private

Definition at line 37 of file ETLDeviceSim.h.

Referenced by getHitsResponse().

◆ tofDelay_

float ETLDeviceSim::tofDelay_
private

Definition at line 39 of file ETLDeviceSim.h.

Referenced by getHitsResponse().

MTDDigiGeometryRecord
Definition: MTDDigiGeometryRecord.h:15
mps_fire.i
i
Definition: mps_fire.py:355
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
mtd_digitizer::MTDCellInfo
Definition: MTDDigitizerTypes.h:17
cuy.col
col
Definition: cuy.py:1010
TrackerGeomDet
Definition: TrackerGeomDet.h:6
ETLDetId
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:15
DetId
Definition: DetId.h:17
MTDGeometry::idToDet
const MTDGeomDet * idToDet(DetId) const override
Definition: MTDGeometry.cc:171
ETLDeviceSim::tofDelay_
float tofDelay_
Definition: ETLDeviceSim.h:39
edm::ESHandle
Definition: DTSurvey.h:22
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
Point3DBase< float, LocalTag >
PixelTopology
Definition: PixelTopology.h:10
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
ETLDeviceSim::bxTime_
float bxTime_
Definition: ETLDeviceSim.h:38
mtd_digitizer::MTDCellId
Definition: MTDDigitizerTypes.h:26
ETLDeviceSim::geom_
const MTDGeometry * geom_
Definition: ETLDeviceSim.h:35
get
#define get
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
PixelTopology::pixel
virtual std::pair< float, float > pixel(const LocalPoint &p) const =0
MTDDetId
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
Exception
Definition: hltDiff.cc:246
PSimHit
Definition: PSimHit.h:15
DetId::Forward
Definition: DetId.h:30
ETLDeviceSim::MIPPerMeV_
float MIPPerMeV_
Definition: ETLDeviceSim.h:37
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
hit
Definition: SiStripHitEffFromCalibTree.cc:88
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27