1 #include "CLHEP/Units/GlobalPhysicalConstants.h" 8 MIPPerMeV_( 1.0/pset.getParameter<double>(
"meVPerMIP") ),
9 bxTime_(pset.getParameter<double>(
"bxTime") ),
10 tofDelay_(pset.getParameter<double>(
"tofDelay") ) {}
16 CLHEP::HepRandomEngine *hre){
18 bool weightToAbyEnergy(
false);
21 const float refSpeed = 0.1*CLHEP::c_light;
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]);
31 if ( detId.det()!=
DetId::Forward || detId.mtdSubDetector()!=2 )
continue;
37 const float toa = std::get<2>(hitRefs[
i]);
42 const float dist2center( 0.1
f*hit.entryPoint().mag() );
46 const float tof = toa-dist2center/refSpeed+
tofDelay_ ;
47 const int itime = std::floor( tof/
bxTime_ ) + 9;
49 if(itime<0 || itime>14)
continue;
52 if(itime >= (
int)simHitIt->second.hit_info[0].size() )
continue;
54 (simHitIt->second).hit_info[0][itime] += charge;
55 float accCharge=(simHitIt->second).hit_info[0][itime];
58 if(weightToAbyEnergy) (simHitIt->second).hit_info[1][itime] += charge*tof;
59 else if((simHitIt->second).hit_info[1][itime]==0)
61 if( accCharge>tdcOnset )
67 uint32_t prev_id = std::get<1>(hitRefs[
i-1]);
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);
74 float deltaT = (tof-prev_tof);
75 fireTDC = deltaT*(deltaQ2TDCOnset/deltaQ)+prev_tof;
79 (simHitIt->second).hit_info[1][itime]=fireTDC;
Detector identifier base class for the MIP Timing Layer.
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)
std::unordered_map< uint32_t, MTDCellInfo > MTDSimHitDataAccumulator
ETLDeviceSim(const edm::ParameterSet &pset)