6 using namespace hgc_digi;
7 using namespace hgc_digi_utils;
10 : scaleByDose_(
false),
20 if (myCfg_.exists(
"keV2fC"))
21 keV2fC_ = myCfg_.getParameter<
double>(
"keV2fC");
27 .
template getParameter<std::vector<double>>(
"values");
30 if (myCfg_.existsAs<
double>(
"noise_fC")) {
32 noise_fC_.push_back(myCfg_.getParameter<
double>(
"noise_fC"));
33 }
else if (myCfg_.existsAs<std::vector<double>>(
"noise_fC")) {
34 const auto& noises = myCfg_.getParameter<std::vector<double>>(
"noise_fC");
35 noise_fC_ = std::vector<float>(noises.begin(), noises.end());
38 myCfg_.getParameter<
edm::ParameterSet>(
"noise_fC").
template getParameter<std::vector<double>>(
"values");
39 noise_fC_ = std::vector<float>(noises.begin(), noises.end());
42 myCfg_.getParameter<
edm::ParameterSet>(
"noise_fC").
template getParameter<uint32_t>(
"scaleByDoseAlgo");
54 myCfg_.getParameter<
edm::ParameterSet>(
"ileakParam").template getParameter<std::vector<double>>(
"ileakParam"));
56 myCfg_.getParameter<
edm::ParameterSet>(
"ileakParam").template getParameter<std::vector<double>>(
"ileakParam"));
60 myCfg_.getParameter<
edm::ParameterSet>(
"cceParams").template getParameter<std::vector<double>>(
"cceParamFine"),
64 myCfg_.getParameter<
edm::ParameterSet>(
"cceParams").template getParameter<std::vector<double>>(
"cceParamFine"),
71 myFEelectronics_->SetNoiseValues(
noise_fC_);
81 const double NoiseMean,
82 const double NoiseStd) {
93 const std::unordered_set<DetId>& validIds,
94 uint32_t digitizationType,
95 CLHEP::HepRandomEngine* engine) {
106 if (digitizationType == 0)
107 runSimple(digiColl, simData, theGeom, validIds, engine);
109 runDigitizer(digiColl, simData, theGeom, validIds, engine);
115 const std::unordered_set<DetId>& validIds,
116 CLHEP::HepRandomEngine* engine) {
124 std::array<double, samplesize_> cellNoiseArray;
126 cellNoiseArray[
i] = 0.0;
128 for (
const auto&
id : validIds) {
129 chargeColl.fill(0.
f);
131 HGCSimHitDataAccumulator::iterator it = simData.find(
id);
132 HGCCellInfo& cell = (simData.end() == it ? zeroData : it->second);
141 float cce(1.
f), noiseWidth(0.
f), lsbADC(-1.
f), maxADC(-1.
f);
144 uint32_t gainIdx = 0;
147 double tdcOnsetAuto = -1;
152 noiseWidth = siop.noise;
160 thrADC = siop.thrADC;
164 noiseWidth = siop.noise;
172 thrADC = siop.thrADC;
187 for (
size_t i = 0;
i < cell.
hit_info[0].size();
i++) {
198 noise = (float)cellNoiseArray[
i] * noiseWidth;
200 noise = CLHEP::RandGaussQ::shoot(engine, cellNoiseArray[
i], noiseWidth);
201 float totalCharge(rawCharge * cce +
noise);
202 if (totalCharge < 0.
f)
204 chargeColl[
i] = totalCharge;
208 DFr rawDataFrame(
id);
211 rawDataFrame, chargeColl, toa, adcPulse, engine, thrADC, lsbADC, gainIdx, maxADC, thickness, tdcOnsetAuto);
221 if (rawDataFrame.
size() <= itIdx + 2)
224 DFr dataFrame(rawDataFrame.
id());
229 if ((!rawDataFrame[itIdx].
threshold())) {
233 for (
int it = 0; it < 5; it++) {
234 dataFrame.setSample(it, rawDataFrame[itIdx - 2 + it]);
237 coll->push_back(dataFrame);
HGCalSiNoiseMap< HGCSiliconDetId > scal_
std::vector< double > cce_
void setDefaultADCPulseShape(const hgc_digi::FEADCPulseShape &adcPulse)
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
uint16_t *__restrict__ id
HGCalSiNoiseMap< HFNoseDetId > scalHFNose_
HGCDigitizerBase(const edm::ParameterSet &ps)
CTOR.
void GenerateGaussianNoise(CLHEP::HepRandomEngine *engine, const double NoiseMean, const double NoiseStd)
Gaussian Noise Generation Member Function.
static const size_t NoiseArrayLength_
void updateOutput(std::unique_ptr< DColl > &coll, const DFr &rawDataFrame)
prepares the output according to the number of time samples to produce
bool RandNoiseGenerationFlag_
std::unordered_map< uint32_t, HGCCellInfo > HGCSimHitDataAccumulator
void setCceParam(const std::vector< double > &parsFine, const std::vector< double > &parsThin, const std::vector< double > &parsThick)
set the cce parameters to use
std::unique_ptr< HGCFEElectronics< DFr > > myFEelectronics_
std::array< HGCSimData_t, nSamples > HGCSimHitData
void resize(size_t s)
allow to set size
derives from HGCalRadiation map to parse fluence parameters, provides Si-specific functions; see DN-1...
const hgc_digi::FEADCPulseShape & adcPulseForGain(GainRange_t gain)
virtual void runDigitizer(std::unique_ptr< DColl > &coll, hgc::HGCSimHitDataAccumulator &simData, const CaloSubdetectorGeometry *theGeom, const std::unordered_set< DetId > &validIds, CLHEP::HepRandomEngine *engine)=0
to be specialized by top class
std::vector< float > noise_fC_
std::array< HGCSimHitData, 2 > hit_info
if(conf_.getParameter< bool >("UseStripCablingDB"))
void setDoseMap(const std::string &, const unsigned int &)
overrides base class method with specifics for the configuration of the algo
double getTDCOnsetAuto(uint32_t gainIdx)
void addCellMetadata(HGCCellInfo &info, const HGCalGeometry *geom, const DetId &detid)
void setFluenceScaleFactor(double val)
const D & id() const
det id
double scaleByDoseFactor_
static const size_t samplesize_
bool thresholdFollowsMIP_
bool NoiseGeneration_Method_
DetId::Detector det() const
std::array< std::array< double, samplesize_ >, NoiseArrayLength_ > GaussianNoiseArray_
T getParameter(std::string const &) const
void setIleakParam(const std::vector< double > &pars)
set the ileak parameters to use
std::vector< double > & getLSBPerGain()
const SiCellOpCharacteristicsCore getSiCellOpCharacteristicsCore(const T &did, GainRange_t gain, int aimMIPtoADC)
returns the charge collection efficiency and noise if gain range is set to auto, it will find the mos...
std::vector< double > & getMaxADCPerGain()
void setGeometry(const CaloSubdetectorGeometry *, GainRange_t gain=GainRange_t::AUTO, int aimMIPtoADC=10)
specialization of the base class method which sets the geometry so that it can instantiate an operati...
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
models the behavior of the front-end electronics
int size() const
total number of samples in the digi