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_
 
float MIPPerMeV_
 
float tofDelay_
 

Detailed Description

Definition at line 18 of file ETLDeviceSim.h.

Constructor & Destructor Documentation

ETLDeviceSim::ETLDeviceSim ( const edm::ParameterSet pset)

Definition at line 7 of file ETLDeviceSim.cc.

7  :
8  MIPPerMeV_( 1.0/pset.getParameter<double>("meVPerMIP") ),
9  bxTime_(pset.getParameter<double>("bxTime") ),
10  tofDelay_(pset.getParameter<double>("tofDelay") ) {}
T getParameter(std::string const &) const
float tofDelay_
Definition: ETLDeviceSim.h:37
float MIPPerMeV_
Definition: ETLDeviceSim.h:35

Member Function Documentation

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

Definition at line 24 of file ETLDeviceSim.h.

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

Definition at line 26 of file ETLDeviceSim.h.

References hfClusterShapes_cfi::hits.

26 { }
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 13 of file ETLDeviceSim.cc.

References bxTime_, ALCARECOTkAlJpsiMuMu_cff::charge, f, DetId::Forward, mps_fire::i, MIPPerMeV_, HGCalUncalibRecHit_cfi::tdcOnset, and tofDelay_.

16  {
17 
18  bool weightToAbyEnergy(false);
19  float tdcOnset(0.f);
20 
21  const float refSpeed = 0.1*CLHEP::c_light;
22 
23  //loop over sorted hits
24  const int nchits = hitRefs.size();
25  for(int i=0; i<nchits; ++i) {
26  const int hitidx = std::get<0>(hitRefs[i]);
27  const uint32_t id = std::get<1>(hitRefs[i]);
28  const MTDDetId detId(id);
29 
30  // Safety check
31  if ( detId.det()!=DetId::Forward || detId.mtdSubDetector()!=2 ) continue;
32 
33  auto simHitIt = simHitAccumulator->emplace(id,mtd_digitizer::MTDCellInfo()).first;
34 
35  if(id==0) continue; // to be ignored at RECO level
36 
37  const float toa = std::get<2>(hitRefs[i]);
38  const PSimHit &hit = hits->at( hitidx );
39  const float charge = 1000.f*hit.energyLoss()*MIPPerMeV_;
40 
41  //distance to the center of the detector
42  const float dist2center( 0.1f*hit.entryPoint().mag() );
43 
44  //hit time: [time()]=ns [centerDist]=cm [refSpeed]=cm/ns + delay by 1ns
45  //accumulate in 15 buckets of 25ns (9 pre-samples, 1 in-time, 5 post-samples)
46  const float tof = toa-dist2center/refSpeed+tofDelay_ ;
47  const int itime = std::floor( tof/bxTime_ ) + 9;
48 
49  if(itime<0 || itime>14) continue;
50 
51  //check if time index is ok and store energy
52  if(itime >= (int)simHitIt->second.hit_info[0].size() ) continue;
53 
54  (simHitIt->second).hit_info[0][itime] += charge;
55  float accCharge=(simHitIt->second).hit_info[0][itime];
56 
57  //time-of-arrival (check how to be used)
58  if(weightToAbyEnergy) (simHitIt->second).hit_info[1][itime] += charge*tof;
59  else if((simHitIt->second).hit_info[1][itime]==0)
60  {
61  if( accCharge>tdcOnset )
62  {
63  //extrapolate linear using previous simhit if it concerns to the same DetId
64  float fireTDC=tof;
65  if(i>0)
66  {
67  uint32_t prev_id = std::get<1>(hitRefs[i-1]);
68  if(prev_id==id)
69  {
70  float prev_toa = std::get<2>(hitRefs[i-1]);
71  float prev_tof(prev_toa-dist2center/refSpeed+tofDelay_);
72  float deltaQ2TDCOnset = tdcOnset-((simHitIt->second).hit_info[0][itime]-charge);
73  float deltaQ = charge;
74  float deltaT = (tof-prev_tof);
75  fireTDC = deltaT*(deltaQ2TDCOnset/deltaQ)+prev_tof;
76  }
77  }
78 
79  (simHitIt->second).hit_info[1][itime]=fireTDC;
80 
81  }
82  }
83  }
84 
85 
86 }
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
double f[11][100]
float tofDelay_
Definition: ETLDeviceSim.h:37
float MIPPerMeV_
Definition: ETLDeviceSim.h:35

Member Data Documentation

float ETLDeviceSim::bxTime_
private

Definition at line 36 of file ETLDeviceSim.h.

Referenced by getHitsResponse().

float ETLDeviceSim::MIPPerMeV_
private

Definition at line 35 of file ETLDeviceSim.h.

Referenced by getHitsResponse().

float ETLDeviceSim::tofDelay_
private

Definition at line 37 of file ETLDeviceSim.h.

Referenced by getHitsResponse().