10 const DetId& detid ) {
18 const DetId& detid ) {
26 waferTypeL = dddConst.waferTypeL(wafer);
27 isHalf = dddConst.isHalfCell(wafer,hid.cell());
29 info.
size = (isHalf ? 0.5 : 1.0);
35 const DetId& detid ) {
38 addCellMetadata(info,hc,detid);
41 addCellMetadata(info,hg,detid);
52 doTimeSamples_ = myCfg_.
getParameter<
bool >(
"doTimeSamples");
53 if(myCfg_.exists(
"keV2fC")) keV2fC_ = myCfg_.getParameter<
double>(
"keV2fC");
56 if( myCfg_.existsAs<std::vector<double> >(
"chargeCollectionEfficiencies" ) ) {
57 cce_ = myCfg_.getParameter<std::vector<double> >(
"chargeCollectionEfficiencies");
59 std::vector<double>().
swap(cce_);
62 if(myCfg_.existsAs<
double>(
"noise_fC")) {
64 noise_fC_[0] = myCfg_.getParameter<
double>(
"noise_fC");
65 }
else if ( myCfg_.existsAs<std::vector<double> >(
"noise_fC") ) {
66 const auto& noises = myCfg_.getParameter<std::vector<double> >(
"noise_fC");
68 noise_fC_.reserve(noises.size());
69 for(
auto noise : noises ) { noise_fC_.push_back( noise ); }
76 myFEelectronics_->SetNoiseValues(noise_fC_);
83 const std::unordered_set<DetId>& validIds,
85 CLHEP::HepRandomEngine* engine) {
86 if(digitizationType==0) runSimple(digiColl,simData,theGeom,validIds,engine);
87 else runDigitizer(digiColl,simData,theGeom,validIds,digitizationType,engine);
94 const std::unordered_set<DetId>& validIds,
95 CLHEP::HepRandomEngine* engine) {
103 for(
const auto&
id : validIds ) {
104 chargeColl.fill(0.
f);
106 HGCSimHitDataAccumulator::iterator it = simData.find(
id);
107 HGCCellInfo& cell = ( simData.end() == it ? zeroData : it->second );
108 addCellMetadata(cell,theGeom,
id);
120 float totalCharge=rawCharge;
125 totalCharge +=
std::max( (
float)CLHEP::RandGaussQ::shoot(engine,0.0,cell.
size*noise_fC_[cell.
thickness-1]) , 0.f );
126 if(totalCharge<0.
f) totalCharge=0.f;
128 chargeColl[
i]= totalCharge;
132 DFr rawDataFrame(
id );
134 myFEelectronics_->runShaper(rawDataFrame, chargeColl, toa, cell.
thickness, engine, cce_[cell.
thickness-1]);
136 myFEelectronics_->runShaper(rawDataFrame, chargeColl, toa, cell.
thickness, engine);
139 updateOutput(coll,rawDataFrame);
145 const DFr& rawDataFrame) {
147 if(rawDataFrame.size()<=itIdx+2)
return;
149 DFr dataFrame( rawDataFrame.id() );
151 bool putInEvent(
false);
152 for(
int it=0;it<5; it++) {
153 dataFrame.setSample(it, rawDataFrame[itIdx-2+it]);
154 if(it==2) putInEvent = rawDataFrame[itIdx-2+it].threshold();
158 coll->push_back(dataFrame);
T getParameter(std::string const &) const
void runSimple(std::unique_ptr< DColl > &coll, hgc::HGCSimHitDataAccumulator &simData, const CaloSubdetectorGeometry *theGeom, const std::unordered_set< DetId > &validIds, CLHEP::HepRandomEngine *engine)
a trivial digitization: sum energies and digitize without noise
void updateOutput(std::unique_ptr< DColl > &coll, const DFr &rawDataFrame)
prepares the output according to the number of time samples to produce
std::array< HGCSimHitData, 2 > hit_info
void swap(Association< C > &lhs, Association< C > &rhs)
std::array< HGCSimData_t, nSamples > HGCSimHitData
uint32_t rawId() const
get the raw id
std::unordered_map< uint32_t, HGCCellInfo > HGCSimHitDataAccumulator
void run(std::unique_ptr< DColl > &digiColl, hgc::HGCSimHitDataAccumulator &simData, const CaloSubdetectorGeometry *theGeom, const std::unordered_set< DetId > &validIds, uint32_t digitizationType, CLHEP::HepRandomEngine *engine)
steer digitization mode
const HGCalTopology & topology() const
int wafer() const
get the wafer #
HGCDigitizerBase(const edm::ParameterSet &ps)
CTOR.
const HGCalDDDConstants & dddConstants() const
models the behavior of the front-end electronics
Detector det() const
get the detector field from this detid