CMS 3D CMS Logo

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

#include <BTLTileDeviceSim.h>

Public Member Functions

 BTLTileDeviceSim (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 LightCollTime_
 
const float LightYield_
 
const float PDE_
 
const float smearLightCollTime_
 

Detailed Description

Definition at line 21 of file BTLTileDeviceSim.h.

Constructor & Destructor Documentation

BTLTileDeviceSim::BTLTileDeviceSim ( const edm::ParameterSet pset)

Definition at line 13 of file BTLTileDeviceSim.cc.

14  : geom_(nullptr),
15  bxTime_(pset.getParameter<double>("bxTime")),
16  LightYield_(pset.getParameter<double>("LightYield")),
17  LightCollEff_(pset.getParameter<double>("LightCollectionEff")),
18  LightCollTime_(pset.getParameter<double>("LightCollectionTime")),
19  smearLightCollTime_(pset.getParameter<double>("smearLightCollectionTime")),
20  PDE_(pset.getParameter<double>("PhotonDetectionEff")) {}
T getParameter(std::string const &) const
const float LightCollTime_
const float LightCollEff_
const float LightYield_
const float bxTime_
const float smearLightCollTime_
const MTDGeometry * geom_

Member Function Documentation

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

Definition at line 25 of file BTLTileDeviceSim.h.

References hfClusterShapes_cfi::hits.

25 {}
void BTLTileDeviceSim::getEventSetup ( const edm::EventSetup evt)
void BTLTileDeviceSim::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 28 of file BTLTileDeviceSim.cc.

References bxTime_, cuy::col, BTLDetId::column(), TauDecayModes::dec, PSimHit::energyLoss(), PSimHit::entryPoint(), Exception, DetId::Forward, geom_, MTDGeometry::idToDet(), BTLDetId::kTypeBoundariesReference, LightCollEff_, LightCollTime_, LightYield_, BTLDetId::modType(), BTLDetId::module(), MTDDetId::mtdRR(), MTDDetId::mtdSide(), RectangularMTDTopology::nrows(), PDE_, RectangularMTDTopology::pixel(), RectangularMTDTopology::pixelToModuleLocalPoint(), DetId::rawId(), BTLDetId::row(), smearLightCollTime_, ProxyMTDTopology::specificTopology(), and GeomDet::topology().

31  {
32  //loop over sorted simHits
33  for (auto const& hitRef : hitRefs) {
34  const int hitidx = std::get<0>(hitRef);
35  const uint32_t id = std::get<1>(hitRef);
36  const MTDDetId detId(id);
37  const PSimHit& hit = hits->at(hitidx);
38 
39  // --- Safety check on the detector ID
40  if (detId.det() != DetId::Forward || detId.mtdSubDetector() != 1)
41  continue;
42 
43  if (id == 0)
44  continue; // to be ignored at RECO level
45 
46  BTLDetId btlid(detId);
47  const int boundRef = BTLDetId::kTypeBoundariesReference[1];
48  DetId geoId = BTLDetId(btlid.mtdSide(), btlid.mtdRR(), btlid.module() + boundRef * (btlid.modType() - 1), 0, 1);
49  const MTDGeomDet* thedet = geom_->idToDet(geoId);
50 
51  if (thedet == nullptr) {
52  throw cms::Exception("BTLTileDeviceSim") << "GeographicalID: " << std::hex << geoId.rawId() << " ("
53  << detId.rawId() << ") is invalid!" << std::dec << std::endl;
54  }
55  const ProxyMTDTopology& topoproxy = static_cast<const ProxyMTDTopology&>(thedet->topology());
56  const RectangularMTDTopology& topo = static_cast<const RectangularMTDTopology&>(topoproxy.specificTopology());
57  // calculate the simhit row and column
58  const auto& pentry = hit.entryPoint();
59  Local3DPoint simscaled(0.1 * pentry.x(), 0.1 * pentry.y(), 0.1 * pentry.z()); // mm -> cm here is the switch
60  // translate from crystal-local coordinates to module-local coordinates to get the row and column
61  simscaled = topo.pixelToModuleLocalPoint(simscaled, btlid.row(topo.nrows()), btlid.column(topo.nrows()));
62  const auto& thepixel = topo.pixel(simscaled);
63  uint8_t row(thepixel.first), col(thepixel.second);
64 
65  if (btlid.row(topo.nrows()) != row || btlid.column(topo.nrows()) != col) {
66  edm::LogWarning("BTLTileDeviceSim")
67  << "BTLDetId (row,column): (" << btlid.row(topo.nrows()) << ',' << btlid.column(topo.nrows())
68  << ") is not equal to "
69  << "topology (row,column): (" << uint32_t(row) << ',' << uint32_t(col) << "), overriding to detid";
70  row = btlid.row(topo.nrows());
71  col = btlid.column(topo.nrows());
72  }
73 
74  // --- Store the detector element ID as a key of the MTDSimHitDataAccumulator map
75  auto simHitIt =
76  simHitAccumulator->emplace(mtd_digitizer::MTDCellId(id, row, col), mtd_digitizer::MTDCellInfo()).first;
77 
78  // --- Get the simHit energy and convert it from MeV to photo-electrons
79  float Npe = 1000. * hit.energyLoss() * LightYield_ * LightCollEff_ * PDE_;
80 
81  // --- Get the simHit time of arrival and add the light collection time
82  float toa = std::get<2>(hitRef) + LightCollTime_;
83 
84  if (smearLightCollTime_ > 0.)
85  toa += CLHEP::RandGaussQ::shoot(hre, 0., smearLightCollTime_);
86 
87  if (toa > bxTime_ || toa < 0) //just consider BX==0
88  continue;
89 
90  (simHitIt->second).hit_info[0][0] += Npe;
91 
92  // --- Store the time of the first SimHit
93  if ((simHitIt->second).hit_info[1][0] == 0 || toa < (simHitIt->second).hit_info[1][0])
94  (simHitIt->second).hit_info[1][0] = toa;
95 
96  } // hitRef loop
97 }
const float LightCollTime_
virtual const Topology & topology() const
Definition: GeomDet.cc:67
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
const float LightCollEff_
int nrows() const override
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
const MTDGeomDet * idToDet(DetId) const override
Definition: MTDGeometry.cc:160
const float LightYield_
virtual const PixelTopology & specificTopology() const
const float bxTime_
std::pair< float, float > pixel(const LocalPoint &p) const override
LocalPoint pixelToModuleLocalPoint(const LocalPoint &plp, int row, int col) const
Definition: DetId.h:17
const float smearLightCollTime_
static constexpr std::array< int, 4 > kTypeBoundariesReference
Definition: BTLDetId.h:31
float energyLoss() const
The energy deposit in the PSimHit, in ???.
Definition: PSimHit.h:79
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
Definition: BTLDetId.h:18
col
Definition: cuy.py:1010
const MTDGeometry * geom_
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:43

Member Data Documentation

const float BTLTileDeviceSim::bxTime_
private

Definition at line 37 of file BTLTileDeviceSim.h.

Referenced by getHitsResponse().

const MTDGeometry* BTLTileDeviceSim::geom_
private

Definition at line 35 of file BTLTileDeviceSim.h.

Referenced by getEventSetup(), and getHitsResponse().

const float BTLTileDeviceSim::LightCollEff_
private

Definition at line 39 of file BTLTileDeviceSim.h.

Referenced by getHitsResponse().

const float BTLTileDeviceSim::LightCollTime_
private

Definition at line 40 of file BTLTileDeviceSim.h.

Referenced by getHitsResponse().

const float BTLTileDeviceSim::LightYield_
private

Definition at line 38 of file BTLTileDeviceSim.h.

Referenced by getHitsResponse().

const float BTLTileDeviceSim::PDE_
private

Definition at line 42 of file BTLTileDeviceSim.h.

Referenced by getHitsResponse().

const float BTLTileDeviceSim::smearLightCollTime_
private

Definition at line 41 of file BTLTileDeviceSim.h.

Referenced by getHitsResponse().