CMS 3D CMS Logo

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

#include <BTLDeviceSim.h>

Public Member Functions

 BTLDeviceSim (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

const float bxTime_
 
const MTDGeometrygeom_
 
const float LightCollEff_
 
const float LightCollSlopeL_
 
const float LightCollSlopeR_
 
const float LightYield_
 
const float PDE_
 
const MTDTopologytopo_
 

Detailed Description

Definition at line 23 of file BTLDeviceSim.h.

Constructor & Destructor Documentation

◆ BTLDeviceSim()

BTLDeviceSim::BTLDeviceSim ( const edm::ParameterSet pset)

Definition at line 14 of file BTLDeviceSim.cc.

15  : geom_(nullptr),
16  topo_(nullptr),
17  bxTime_(pset.getParameter<double>("bxTime")),
18  LightYield_(pset.getParameter<double>("LightYield")),
19  LightCollEff_(pset.getParameter<double>("LightCollectionEff")),
20  LightCollSlopeR_(pset.getParameter<double>("LightCollectionSlopeR")),
21  LightCollSlopeL_(pset.getParameter<double>("LightCollectionSlopeL")),
22  PDE_(pset.getParameter<double>("PhotonDetectionEff")) {}

Member Function Documentation

◆ getEvent()

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

Definition at line 27 of file BTLDeviceSim.h.

27 {}

◆ getEventSetup()

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

Definition at line 24 of file BTLDeviceSim.cc.

24  {
26  evs.get<MTDDigiGeometryRecord>().get(geom);
27  geom_ = geom.product();
28 
30  evs.get<MTDTopologyRcd>().get(mtdTopo);
31  topo_ = mtdTopo.product();
32 }

References relativeConstraints::geom, geom_, edm::EventSetup::get(), get, edm::ESHandle< T >::product(), and topo_.

◆ getHitsResponse()

void BTLDeviceSim::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 34 of file BTLDeviceSim.cc.

37  {
38  //loop over sorted simHits
39  for (auto const& hitRef : hitRefs) {
40  const int hitidx = std::get<0>(hitRef);
41  const uint32_t id = std::get<1>(hitRef);
42  const MTDDetId detId(id);
43  const PSimHit& hit = hits->at(hitidx);
44 
45  // --- Safety check on the detector ID
46  if (detId.det() != DetId::Forward || detId.mtdSubDetector() != 1)
47  continue;
48 
49  if (id == 0)
50  continue; // to be ignored at RECO level
51 
52  BTLDetId btlid(detId);
53  const int boundRef = btlid.modulesPerType(MTDTopologyMode::crysLayoutFromTopoMode(topo_->getMTDTopologyMode()));
54  DetId geoId = BTLDetId(btlid.mtdSide(), btlid.mtdRR(), btlid.module() + boundRef * (btlid.modType() - 1), 0, 1);
55  const MTDGeomDet* thedet = geom_->idToDet(geoId);
56 
57  if (thedet == nullptr) {
58  throw cms::Exception("BTLDeviceSim") << "GeographicalID: " << std::hex << geoId.rawId() << " (" << detId.rawId()
59  << ") is invalid!" << std::dec << std::endl;
60  }
61  const ProxyMTDTopology& topoproxy = static_cast<const ProxyMTDTopology&>(thedet->topology());
62  const RectangularMTDTopology& topo = static_cast<const RectangularMTDTopology&>(topoproxy.specificTopology());
63  // calculate the simhit row and column
64  const auto& pentry = hit.entryPoint();
65  Local3DPoint simscaled(0.1 * pentry.x(), 0.1 * pentry.y(), 0.1 * pentry.z()); // mm -> cm here is the switch
66  // translate from crystal-local coordinates to module-local coordinates to get the row and column
67  simscaled = topo.pixelToModuleLocalPoint(simscaled, btlid.row(topo.nrows()), btlid.column(topo.nrows()));
68  const auto& thepixel = topo.pixel(simscaled);
69  uint8_t row(thepixel.first), col(thepixel.second);
70 
71  if (btlid.row(topo.nrows()) != row || btlid.column(topo.nrows()) != col) {
72  edm::LogWarning("BTLDeviceSim") << "BTLDetId (row,column): (" << btlid.row(topo.nrows()) << ','
73  << btlid.column(topo.nrows()) << ") is not equal to "
74  << "topology (row,column): (" << uint32_t(row) << ',' << uint32_t(col)
75  << "), overriding to detid";
76  row = btlid.row(topo.nrows());
77  col = btlid.column(topo.nrows());
78  }
79 
80  // --- Store the detector element ID as a key of the MTDSimHitDataAccumulator map
81  auto simHitIt =
82  simHitAccumulator->emplace(mtd_digitizer::MTDCellId(id, row, col), mtd_digitizer::MTDCellInfo()).first;
83 
84  // --- Get the simHit energy and convert it from MeV to photo-electrons
85  float Npe = 1000. * hit.energyLoss() * LightYield_ * LightCollEff_ * PDE_;
86 
87  // --- Calculate the light propagation time to the crystal bases (labeled L and R)
88  double distR = 0.5 * topo.pitch().second - 0.1 * hit.localPosition().y();
89  double distL = 0.5 * topo.pitch().second + 0.1 * hit.localPosition().y();
90 
91  // This is for the layouts with bars along phi
94  distR = 0.5 * topo.pitch().first - 0.1 * hit.localPosition().x();
95  distL = 0.5 * topo.pitch().first + 0.1 * hit.localPosition().x();
96  }
97 
98  double tR = std::get<2>(hitRef) + LightCollSlopeR_ * distR;
99  double tL = std::get<2>(hitRef) + LightCollSlopeL_ * distL;
100 
101  // --- Accumulate in 15 buckets of 25ns (9 pre-samples, 1 in-time, 5 post-samples)
102  const int iBXR = std::floor(tR / bxTime_) + mtd_digitizer::kInTimeBX;
103  const int iBXL = std::floor(tL / bxTime_) + mtd_digitizer::kInTimeBX;
104 
105  // --- Right side
106  if (iBXR > 0 && iBXR < mtd_digitizer::kNumberOfBX) {
107  // Accumulate the energy of simHits in the same crystal
108  (simHitIt->second).hit_info[0][iBXR] += Npe;
109 
110  // Store the time of the first SimHit in the i-th BX
111  if ((simHitIt->second).hit_info[1][iBXR] == 0 || tR < (simHitIt->second).hit_info[1][iBXR])
112  (simHitIt->second).hit_info[1][iBXR] = tR - (iBXR - mtd_digitizer::kInTimeBX) * bxTime_;
113  }
114 
115  // --- Left side
116  if (iBXL > 0 && iBXL < mtd_digitizer::kNumberOfBX) {
117  // Accumulate the energy of simHits in the same crystal
118  (simHitIt->second).hit_info[2][iBXL] += Npe;
119 
120  // Store the time of the first SimHit in the i-th BX
121  if ((simHitIt->second).hit_info[3][iBXL] == 0 || tL < (simHitIt->second).hit_info[3][iBXL])
122  (simHitIt->second).hit_info[3][iBXL] = tL - (iBXL - mtd_digitizer::kInTimeBX) * bxTime_;
123  }
124 
125  } // hitRef loop
126 }

References BTLDetId::bar, BTLDetId::barphiflat, bxTime_, cuy::col, BTLDetId::column(), MTDTopologyMode::crysLayoutFromTopoMode(), TauDecayModes::dec, DetId::det(), Exception, DetId::Forward, geom_, MTDTopology::getMTDTopologyMode(), hfClusterShapes_cfi::hits, MTDGeometry::idToDet(), mtd_digitizer::kInTimeBX, mtd_digitizer::kNumberOfBX, LightCollEff_, LightCollSlopeL_, LightCollSlopeR_, LightYield_, BTLDetId::modType(), BTLDetId::module(), BTLDetId::modulesPerType(), MTDDetId::mtdRR(), MTDDetId::mtdSide(), MTDDetId::mtdSubDetector(), PDE_, DetId::rawId(), BTLDetId::row(), ProxyMTDTopology::specificTopology(), topo_, GeomDet::topology(), hit::x, and hit::y.

Member Data Documentation

◆ bxTime_

const float BTLDeviceSim::bxTime_
private

Definition at line 40 of file BTLDeviceSim.h.

Referenced by getHitsResponse().

◆ geom_

const MTDGeometry* BTLDeviceSim::geom_
private

Definition at line 37 of file BTLDeviceSim.h.

Referenced by getEventSetup(), and getHitsResponse().

◆ LightCollEff_

const float BTLDeviceSim::LightCollEff_
private

Definition at line 42 of file BTLDeviceSim.h.

Referenced by getHitsResponse().

◆ LightCollSlopeL_

const float BTLDeviceSim::LightCollSlopeL_
private

Definition at line 45 of file BTLDeviceSim.h.

Referenced by getHitsResponse().

◆ LightCollSlopeR_

const float BTLDeviceSim::LightCollSlopeR_
private

Definition at line 44 of file BTLDeviceSim.h.

Referenced by getHitsResponse().

◆ LightYield_

const float BTLDeviceSim::LightYield_
private

Definition at line 41 of file BTLDeviceSim.h.

Referenced by getHitsResponse().

◆ PDE_

const float BTLDeviceSim::PDE_
private

Definition at line 46 of file BTLDeviceSim.h.

Referenced by getHitsResponse().

◆ topo_

const MTDTopology* BTLDeviceSim::topo_
private

Definition at line 38 of file BTLDeviceSim.h.

Referenced by getEventSetup(), and getHitsResponse().

MTDDigiGeometryRecord
Definition: MTDDigiGeometryRecord.h:15
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
BTLDeviceSim::LightYield_
const float LightYield_
Definition: BTLDeviceSim.h:41
BTLDeviceSim::geom_
const MTDGeometry * geom_
Definition: BTLDeviceSim.h:37
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
hit::y
double y
Definition: SiStripHitEffFromCalibTree.cc:90
mtd_digitizer::MTDCellInfo
Definition: MTDDigitizerTypes.h:17
cuy.col
col
Definition: cuy.py:1010
TrackerGeomDet
Definition: TrackerGeomDet.h:6
BTLDeviceSim::bxTime_
const float bxTime_
Definition: BTLDeviceSim.h:40
ProxyMTDTopology::specificTopology
virtual const PixelTopology & specificTopology() const
Definition: ProxyMTDTopology.h:89
GeomDet::topology
virtual const Topology & topology() const
Definition: GeomDet.cc:67
MTDTopology::getMTDTopologyMode
int getMTDTopologyMode() const
Definition: MTDTopology.h:73
hit::x
double x
Definition: SiStripHitEffFromCalibTree.cc:89
mtd_digitizer::kNumberOfBX
constexpr int kNumberOfBX
Definition: MTDDigitizerTypes.h:41
DetId
Definition: DetId.h:17
MTDGeometry::idToDet
const MTDGeomDet * idToDet(DetId) const override
Definition: MTDGeometry.cc:171
BTLDetId
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0,...
Definition: BTLDetId.h:18
BTLDeviceSim::LightCollSlopeR_
const float LightCollSlopeR_
Definition: BTLDeviceSim.h:44
BTLDeviceSim::topo_
const MTDTopology * topo_
Definition: BTLDeviceSim.h:38
edm::ESHandle
Definition: DTSurvey.h:22
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
BTLDetId::CrysLayout::barphiflat
Point3DBase< float, LocalTag >
edm::LogWarning
Definition: MessageLogger.h:141
MTDTopologyRcd
Definition: MTDTopologyRcd.h:10
MTDTopologyMode::crysLayoutFromTopoMode
BTLDetId::CrysLayout crysLayoutFromTopoMode(const int &topoMode)
Definition: MTDTopologyMode.h:19
BTLDetId::CrysLayout::bar
mtd_digitizer::MTDCellId
Definition: MTDDigitizerTypes.h:26
BTLDeviceSim::LightCollSlopeL_
const float LightCollSlopeL_
Definition: BTLDeviceSim.h:45
get
#define get
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:246
BTLDeviceSim::LightCollEff_
const float LightCollEff_
Definition: BTLDeviceSim.h:42
PSimHit
Definition: PSimHit.h:15
DetId::Forward
Definition: DetId.h:30
mtd_digitizer::kInTimeBX
constexpr int kInTimeBX
Definition: MTDDigitizerTypes.h:42
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
BTLDeviceSim::PDE_
const float PDE_
Definition: BTLDeviceSim.h:46
hit
Definition: SiStripHitEffFromCalibTree.cc:88
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27