3 using namespace hgc_digi;
8 uint32_t digitizationType,
9 CLHEP::HepRandomEngine* engine) {
10 if(digitizationType==0) runSimple(digiColl,simData,engine);
11 else runDigitizer(digiColl,simData,digitizationType,engine);
17 CLHEP::HepRandomEngine* engine) {
19 for(HGCSimHitDataAccumulator::iterator it=simData.begin();
24 for(
size_t i=0;
i<it->second[0].size();
i++) {
25 double rawCharge((it->second)[0][
i]);
28 toa[
i]=(it->second)[1][
i];
30 toa[
i]=(it->second)[1][
i]/rawCharge;
34 double totalCharge=rawCharge;
38 totalCharge +=
std::max( CLHEP::RandGaussQ::shoot(engine,0,noise_fC_) , 0. );
39 if(totalCharge<0) totalCharge=0;
41 chargeColl[
i]= totalCharge;
45 DFr rawDataFrame( it->first );
46 myFEelectronics_->runShaper(rawDataFrame, chargeColl, toa, engine);
49 updateOutput(coll,rawDataFrame);
55 const DFr& rawDataFrame) {
57 if(rawDataFrame.size()<=itIdx+2)
return;
59 DFr dataFrame( rawDataFrame.id() );
61 bool putInEvent(
false);
63 for(
int it=0;it<5; it++) {
65 rawDataFrame[itIdx-2+it].
mode(),
66 rawDataFrame[itIdx-2+it].toa(),
67 rawDataFrame[itIdx-2+it].
data());
68 dataFrame.setSample(it, singleSample);
69 if(it==2) { putInEvent=rawDataFrame[itIdx-2+it].threshold(); }
71 if(putInEvent) coll->push_back(dataFrame);
void runSimple(std::auto_ptr< DColl > &coll, hgc::HGCSimHitDataAccumulator &simData, CLHEP::HepRandomEngine *engine)
a trivial digitization: sum energies and digitize without noise
std::array< HGCSimData_t, nSamples > HGCSimHitData
void updateOutput(std::auto_ptr< DColl > &coll, const DFr &rawDataFrame)
prepares the output according to the number of time samples to produce
void run(std::auto_ptr< DColl > &digiColl, hgc::HGCSimHitDataAccumulator &simData, uint32_t digitizationType, CLHEP::HepRandomEngine *engine)
steer digitization mode
char data[epos_bytes_allocation]
models the behavior of the front-end electronics
std::unordered_map< uint32_t, std::array< HGCSimHitData, 2 > > HGCSimHitDataAccumulator
void set(bool thr, bool mode, uint16_t toa, uint16_t data)