CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Member Functions | Private Attributes
ETLDeviceSim Class Reference

#include <ETLDeviceSim.h>

Public Member Functions

 ETLDeviceSim (const edm::ParameterSet &pset, edm::ConsumesCollector iC)
 
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_
 
const edm::ESGetToken< MTDGeometry, MTDDigiGeometryRecordgeomToken_
 
float MIPPerMeV_
 
float tofDelay_
 

Detailed Description

Definition at line 21 of file ETLDeviceSim.h.

Constructor & Destructor Documentation

◆ ETLDeviceSim()

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

Definition at line 15 of file ETLDeviceSim.cc.

16  : geomToken_(iC.esConsumes()),
17  geom_(nullptr),
18  MIPPerMeV_(1.0 / pset.getParameter<double>("meVPerMIP")),
19  bxTime_(pset.getParameter<double>("bxTime")),
20  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 22 of file ETLDeviceSim.cc.

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

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

◆ 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 24 of file ETLDeviceSim.cc.

27  {
28  using namespace geant_units::operators;
29 
30  //loop over sorted hits
31  const int nchits = hitRefs.size();
32  for (int i = 0; i < nchits; ++i) {
33  const int hitidx = std::get<0>(hitRefs[i]);
34  const uint32_t id = std::get<1>(hitRefs[i]);
35  const MTDDetId detId(id);
36 
37  // Safety check (this should never happen, it should be an exception
38  if (detId.det() != DetId::Forward || detId.mtdSubDetector() != 2) {
39  throw cms::Exception("ETLDeviceSim")
40  << "got a DetId that was not ETL: Det = " << detId.det() << " subDet = " << detId.mtdSubDetector();
41  }
42 
43  if (id == 0)
44  continue; // to be ignored at RECO level
45 
46  ETLDetId etlid(detId);
47  DetId geoId = ETLDetId(etlid.mtdSide(), etlid.mtdRR(), etlid.module(), etlid.modType());
48  const MTDGeomDet* thedet = geom_->idToDet(geoId);
49  if (thedet == nullptr) {
50  throw cms::Exception("ETLDeviceSim") << "GeographicalID: " << std::hex << geoId.rawId() << " (" << detId.rawId()
51  << ") is invalid!" << std::dec << std::endl;
52  }
53  const ProxyMTDTopology& topoproxy = static_cast<const ProxyMTDTopology&>(thedet->topology());
54  const RectangularMTDTopology& topo = static_cast<const RectangularMTDTopology&>(topoproxy.specificTopology());
55 
56  const float toa = std::get<2>(hitRefs[i]) + tofDelay_;
57  const PSimHit& hit = hits->at(hitidx);
58  const float charge = convertGeVToMeV(hit.energyLoss()) * MIPPerMeV_;
59 
60  // calculate the simhit row and column
61  const auto& pentry = hit.entryPoint();
62  // ETL is already in module-local coordinates so just scale to cm from mm
63  Local3DPoint simscaled(convertMmToCm(pentry.x()), convertMmToCm(pentry.y()), convertMmToCm(pentry.z()));
64  const auto& thepixel = topo.pixel(simscaled);
65  //The following lines check whether the pixel point is actually out of the active area.
66  //If that is the case it simply ignores the point but in the future some more sophisticated function could be applied.
67  const int ixbin = int(thepixel.first);
68  const int iybin = int(thepixel.second);
69  const float fractionX = thepixel.first - ixbin;
70  const float fractionY = thepixel.second - iybin;
71  if ((fractionX > 1.0 - topo.gapxInterpadFrac() || fractionX < topo.gapxInterpadFrac()) ||
72  (ixbin == 0 && fractionX < topo.gapxBorderFrac()) ||
73  (ixbin == topo.nrows() - 1 && fractionX > 1.0 - topo.gapxBorderFrac()))
74  continue;
75  if ((fractionY > 1.0 - topo.gapyInterpadFrac() || fractionY < topo.gapyInterpadFrac()) ||
76  (iybin == 0 && fractionY < topo.gapyBorderFrac()) ||
77  (iybin == topo.ncolumns() - 1 && fractionY > 1.0 - topo.gapyBorderFrac()))
78  continue;
79  const uint8_t row(thepixel.first), col(thepixel.second);
80 
81  auto simHitIt =
82  simHitAccumulator->emplace(mtd_digitizer::MTDCellId(id, row, col), mtd_digitizer::MTDCellInfo()).first;
83 
84  // Accumulate in 15 buckets of 25ns (9 pre-samples, 1 in-time, 5 post-samples)
85  const int itime = std::floor(toa / bxTime_) + 9;
86  if (itime < 0 || itime > 14)
87  continue;
88 
89  // Check if time index is ok and store energy
90  if (itime >= (int)simHitIt->second.hit_info[0].size())
91  continue;
92 
93  (simHitIt->second).hit_info[0][itime] += charge;
94 
95  // Store the time of the first SimHit in the right DataFrame bucket
96  const float tof = toa - (itime - 9) * bxTime_;
97 
98  if ((simHitIt->second).hit_info[1][itime] == 0. || tof < (simHitIt->second).hit_info[1][itime]) {
99  (simHitIt->second).hit_info[1][itime] = tof;
100  }
101  }
102 }

References bxTime_, ALCARECOTkAlJpsiMuMu_cff::charge, cuy::col, geant_units::operators::convertGeVToMeV(), geant_units::operators::convertMmToCm(), TauDecayModes::dec, DetId::det(), Exception, DetId::Forward, geom_, hfClusterShapes_cfi::hits, mps_fire::i, MTDGeometry::idToDet(), createfilelist::int, MIPPerMeV_, ETLDetId::modType(), ETLDetId::module(), MTDDetId::mtdRR(), MTDDetId::mtdSide(), MTDDetId::mtdSubDetector(), DetId::rawId(), ProxyMTDTopology::specificTopology(), and tofDelay_.

Member Data Documentation

◆ bxTime_

float ETLDeviceSim::bxTime_
private

Definition at line 39 of file ETLDeviceSim.h.

Referenced by getHitsResponse().

◆ geom_

const MTDGeometry* ETLDeviceSim::geom_
private

Definition at line 36 of file ETLDeviceSim.h.

Referenced by getEventSetup(), and getHitsResponse().

◆ geomToken_

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

Definition at line 35 of file ETLDeviceSim.h.

Referenced by getEventSetup().

◆ MIPPerMeV_

float ETLDeviceSim::MIPPerMeV_
private

Definition at line 38 of file ETLDeviceSim.h.

Referenced by getHitsResponse().

◆ tofDelay_

float ETLDeviceSim::tofDelay_
private

Definition at line 40 of file ETLDeviceSim.h.

Referenced by getHitsResponse().

mps_fire.i
i
Definition: mps_fire.py:428
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
ProxyMTDTopology::specificTopology
virtual const PixelTopology & specificTopology() const
Definition: ProxyMTDTopology.h:89
ETLDetId
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:15
geant_units::operators
Definition: GeantUnits.h:18
edm::ConsumesCollector::esConsumes
auto esConsumes()
Definition: ConsumesCollector.h:97
geant_units::operators::convertGeVToMeV
constexpr NumType convertGeVToMeV(NumType gev)
Definition: GeantUnits.h:92
DetId
Definition: DetId.h:17
MTDGeometry::idToDet
const MTDGeomDet * idToDet(DetId) const override
Definition: MTDGeometry.cc:171
ETLDeviceSim::geomToken_
const edm::ESGetToken< MTDGeometry, MTDDigiGeometryRecord > geomToken_
Definition: ETLDeviceSim.h:35
ETLDeviceSim::tofDelay_
float tofDelay_
Definition: ETLDeviceSim.h:40
Point3DBase< float, LocalTag >
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
ETLDeviceSim::bxTime_
float bxTime_
Definition: ETLDeviceSim.h:39
createfilelist.int
int
Definition: createfilelist.py:10
mtd_digitizer::MTDCellId
Definition: MTDDigitizerTypes.h:26
ETLDeviceSim::geom_
const MTDGeometry * geom_
Definition: ETLDeviceSim.h:36
RectangularMTDTopology
Definition: RectangularMTDTopology.h:39
ProxyMTDTopology
Definition: ProxyMTDTopology.h:28
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
MTDDetId
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
Exception
Definition: hltDiff.cc:245
geant_units::operators::convertMmToCm
constexpr NumType convertMmToCm(NumType millimeters)
Definition: GeantUnits.h:62
PSimHit
Definition: PSimHit.h:15
DetId::Forward
Definition: DetId.h:30
ETLDeviceSim::MIPPerMeV_
float MIPPerMeV_
Definition: ETLDeviceSim.h:38
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
hit
Definition: SiStripHitEffFromCalibTree.cc:88
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27