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 ( const edm::ParameterSet pset)

Definition at line 10 of file ETLDeviceSim.cc.

10  :
11  geom_(nullptr),
12  MIPPerMeV_( 1.0/pset.getParameter<double>("meVPerMIP") ),
13  bxTime_(pset.getParameter<double>("bxTime") ),
14  tofDelay_(pset.getParameter<double>("tofDelay") ) {}
const MTDGeometry * geom_
Definition: ETLDeviceSim.h:38
T getParameter(std::string const &) const
float tofDelay_
Definition: ETLDeviceSim.h:42
float MIPPerMeV_
Definition: ETLDeviceSim.h:40

Member Function Documentation

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

Definition at line 27 of file ETLDeviceSim.h.

References hfClusterShapes_cfi::hits.

27 { }
void ETLDeviceSim::getEventSetup ( const edm::EventSetup evt)

Definition at line 16 of file ETLDeviceSim.cc.

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

16  {
17 
19  evs.get<MTDDigiGeometryRecord>().get(geom);
20  geom_ = geom.product();
21 
22 }
const MTDGeometry * geom_
Definition: ETLDeviceSim.h:38
T const * product() const
Definition: ESHandle.h:86
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.

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

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

Member Data Documentation

float ETLDeviceSim::bxTime_
private

Definition at line 41 of file ETLDeviceSim.h.

Referenced by getHitsResponse().

const MTDGeometry* ETLDeviceSim::geom_
private

Definition at line 38 of file ETLDeviceSim.h.

Referenced by getEventSetup(), and getHitsResponse().

float ETLDeviceSim::MIPPerMeV_
private

Definition at line 40 of file ETLDeviceSim.h.

Referenced by getHitsResponse().

float ETLDeviceSim::tofDelay_
private

Definition at line 42 of file ETLDeviceSim.h.

Referenced by getHitsResponse().