CMS 3D CMS Logo

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

#include <BTLBarDeviceSim.h>

Public Member Functions

 BTLBarDeviceSim (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 BTLBarDeviceSim.h.

Constructor & Destructor Documentation

BTLBarDeviceSim::BTLBarDeviceSim ( const edm::ParameterSet pset)

Definition at line 14 of file BTLBarDeviceSim.cc.

14  :
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")) { }
T getParameter(std::string const &) const
const float LightCollEff_
const float LightCollSlopeL_
const MTDGeometry * geom_
const MTDTopology * topo_
const float LightYield_
const float PDE_
const float LightCollSlopeR_
const float bxTime_

Member Function Documentation

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

Definition at line 29 of file BTLBarDeviceSim.h.

References hfClusterShapes_cfi::hits.

29 { }
void BTLBarDeviceSim::getEventSetup ( const edm::EventSetup evt)

Definition at line 24 of file BTLBarDeviceSim.cc.

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

24  {
25 
27  evs.get<MTDDigiGeometryRecord>().get(geom);
28  geom_ = geom.product();
29 
31  evs.get<MTDTopologyRcd>().get(mtdTopo);
32  topo_ = mtdTopo.product();
33 
34 }
const MTDGeometry * geom_
const MTDTopology * topo_
T const * product() const
Definition: ESHandle.h:86
void BTLBarDeviceSim::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 36 of file BTLBarDeviceSim.cc.

References BTLDetId::bar, BTLDetId::barphiflat, bxTime_, cuy::col, BTLDetId::column(), TauDecayModes::dec, PSimHit::energyLoss(), PSimHit::entryPoint(), Exception, DetId::Forward, geom_, MTDTopology::getMTDTopologyMode(), MTDGeometry::idToDet(), createfilelist::int, LightCollEff_, LightCollSlopeL_, LightCollSlopeR_, LightYield_, PSimHit::localPosition(), BTLDetId::modType(), BTLDetId::module(), BTLDetId::modulesPerType(), MTDDetId::mtdRR(), MTDDetId::mtdSide(), RectangularMTDTopology::nrows(), PDE_, RectangularMTDTopology::pitch(), RectangularMTDTopology::pixel(), RectangularMTDTopology::pixelToModuleLocalPoint(), DetId::rawId(), BTLDetId::row(), ProxyMTDTopology::specificTopology(), topo_, GeomDet::topology(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

39  {
40 
41  //loop over sorted simHits
42  for (auto const& hitRef: hitRefs) {
43 
44  const int hitidx = std::get<0>(hitRef);
45  const uint32_t id = std::get<1>(hitRef);
46  const MTDDetId detId(id);
47  const PSimHit &hit = hits->at( hitidx );
48 
49  // --- Safety check on the detector ID
50  if ( detId.det()!=DetId::Forward || detId.mtdSubDetector()!=1 ) continue;
51 
52  if(id==0) continue; // to be ignored at RECO level
53 
54  BTLDetId btlid(detId);
55  const int boundRef = btlid.modulesPerType(static_cast<BTLDetId::CrysLayout>(topo_->getMTDTopologyMode()));
56  DetId geoId = BTLDetId(btlid.mtdSide(),btlid.mtdRR(),btlid.module()+boundRef*(btlid.modType()-1),0,1);
57  const MTDGeomDet* thedet = geom_->idToDet(geoId);
58 
59  if( thedet == nullptr ) {
60  throw cms::Exception("BTLBarDeviceSim") << "GeographicalID: " << std::hex
61  << geoId.rawId()
62  << " (" << detId.rawId()<< ") is invalid!" << std::dec
63  << std::endl;
64  }
65  const ProxyMTDTopology& topoproxy = static_cast<const ProxyMTDTopology&>(thedet->topology());
66  const RectangularMTDTopology& topo = static_cast<const RectangularMTDTopology&>(topoproxy.specificTopology());
67  // calculate the simhit row and column
68  const auto& pentry = hit.entryPoint();
69  Local3DPoint simscaled(0.1*pentry.x(),0.1*pentry.y(),0.1*pentry.z()); // mm -> cm here is the switch
70  // translate from crystal-local coordinates to module-local coordinates to get the row and column
71  simscaled = topo.pixelToModuleLocalPoint(simscaled,btlid.row(topo.nrows()),btlid.column(topo.nrows()));
72  const auto& thepixel = topo.pixel(simscaled);
73  uint8_t row(thepixel.first), col(thepixel.second);
74 
75  if( btlid.row(topo.nrows()) != row || btlid.column(topo.nrows()) != col ) {
76  edm::LogWarning("BTLBarDeviceSim")
77  << "BTLDetId (row,column): (" << btlid.row(topo.nrows()) << ',' << btlid.column(topo.nrows()) <<") is not equal to "
78  << "topology (row,column): (" << uint32_t(row) << ',' << uint32_t(col) <<"), overriding to detid";
79  row = btlid.row(topo.nrows());
80  col = btlid.column(topo.nrows());
81  }
82 
83 
84  // --- Store the detector element ID as a key of the MTDSimHitDataAccumulator map
85  auto simHitIt = simHitAccumulator->emplace(mtd_digitizer::MTDCellId(id,row,col),
87 
88  // --- Get the simHit energy and convert it from MeV to photo-electrons
89  float Npe = 1000.*hit.energyLoss()*LightYield_*LightCollEff_*PDE_;
90 
91  // --- Get the simHit time of arrival
92  float toa = std::get<2>(hitRef);
93 
94  if ( toa > bxTime_ || toa < 0 ) //just consider BX==0
95  continue;
96 
97  // --- Accumulate the energy of simHits in the same crystal for the BX==0
98  // this is to simulate the charge integration in a 25 ns window
99  (simHitIt->second).hit_info[0][0] += Npe;
100  (simHitIt->second).hit_info[0][1] += Npe;
101 
102  double distR = 0.5*topo.pitch().second - 0.1*hit.localPosition().y();
103  double distL = 0.5*topo.pitch().second + 0.1*hit.localPosition().y();
104 
105  // This is for the layout with bars along phi
108  )
109  {
110  distR = 0.5*topo.pitch().first - 0.1*hit.localPosition().x();
111  distL = 0.5*topo.pitch().first + 0.1*hit.localPosition().x();
112  }
113 
114  double tR = toa + LightCollSlopeR_*distR;
115  double tL = toa + LightCollSlopeL_*distL;
116 
117  // --- Store the time of the first SimHit
118  if ( (simHitIt->second).hit_info[1][0] == 0
119  || tR < (simHitIt->second).hit_info[1][0] )
120  (simHitIt->second).hit_info[1][0] = tR;
121 
122  if ( (simHitIt->second).hit_info[1][1] == 0
123  || tL < (simHitIt->second).hit_info[1][1] )
124  (simHitIt->second).hit_info[1][1] = tL;
125 
126  } // hitRef loop
127 
128 }
const float LightCollEff_
virtual const Topology & topology() const
Definition: GeomDet.cc:81
int getMTDTopologyMode() const
Definition: MTDTopology.h:74
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
T y() const
Definition: PV3DBase.h:63
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:184
const float LightCollSlopeL_
const MTDGeometry * geom_
Local3DPoint localPosition() const
Definition: PSimHit.h:52
virtual const PixelTopology & specificTopology() const
const MTDTopology * topo_
std::pair< float, float > pixel(const LocalPoint &p) const override
LocalPoint pixelToModuleLocalPoint(const LocalPoint &plp, int row, int col) const
const float LightYield_
Definition: DetId.h:18
const float PDE_
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
std::pair< float, float > pitch() const override
T x() const
Definition: PV3DBase.h:62
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:43
const float LightCollSlopeR_
const float bxTime_

Member Data Documentation

const float BTLBarDeviceSim::bxTime_
private

Definition at line 43 of file BTLBarDeviceSim.h.

Referenced by getHitsResponse().

const MTDGeometry* BTLBarDeviceSim::geom_
private

Definition at line 40 of file BTLBarDeviceSim.h.

Referenced by getEventSetup(), and getHitsResponse().

const float BTLBarDeviceSim::LightCollEff_
private

Definition at line 45 of file BTLBarDeviceSim.h.

Referenced by getHitsResponse().

const float BTLBarDeviceSim::LightCollSlopeL_
private

Definition at line 48 of file BTLBarDeviceSim.h.

Referenced by getHitsResponse().

const float BTLBarDeviceSim::LightCollSlopeR_
private

Definition at line 47 of file BTLBarDeviceSim.h.

Referenced by getHitsResponse().

const float BTLBarDeviceSim::LightYield_
private

Definition at line 44 of file BTLBarDeviceSim.h.

Referenced by getHitsResponse().

const float BTLBarDeviceSim::PDE_
private

Definition at line 49 of file BTLBarDeviceSim.h.

Referenced by getHitsResponse().

const MTDTopology* BTLBarDeviceSim::topo_
private

Definition at line 41 of file BTLBarDeviceSim.h.

Referenced by getEventSetup(), and getHitsResponse().