Skip to content

Commit

Permalink
Merge pull request #30662 from lwang046/HcalSim-DelayQIE
Browse files Browse the repository at this point in the history
Hcal - QIEDelay in SIM
  • Loading branch information
cmsbuild authored Jul 17, 2020
2 parents 7ab664d + 6e57a6b commit 6cfc123
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 2 deletions.
1 change: 1 addition & 0 deletions SimCalorimetry/HcalSimAlgos/interface/HcalAmplifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class HcalAmplifier {

private:
void pe2fC(CaloSamples& frame) const;
void applyQIEdelay(CaloSamples& frame, int delayQIE) const;
void addPedestals(CaloSamples& frame, CLHEP::HepRandomEngine*) const;
void makeNoise(HcalGenericDetId::HcalGenericSubdetector hcalSubDet,
const HcalCalibrationWidths& width,
Expand Down
3 changes: 2 additions & 1 deletion SimCalorimetry/HcalSimAlgos/interface/HcalSimParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class HcalSimParameters : public CaloSimParameters {

int pixels(const DetId& detId) const;
bool doSiPMSmearing() const { return theSiPMSmearing; }

int delayQIE() const { return delayQIE_; }
double threshold_currentTDC() const { return threshold_currentTDC_; }
double sipmTau() const { return theSiPMTau; }
double sipmDarkCurrentuA(const DetId& detId) const;
Expand All @@ -61,6 +61,7 @@ class HcalSimParameters : public CaloSimParameters {
HcalTimeSmearSettings theSmearSettings;
double theSiPMTau;
double threshold_currentTDC_;
int delayQIE_;
};

#endif
28 changes: 28 additions & 0 deletions SimCalorimetry/HcalSimAlgos/src/HcalAmplifier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ void HcalAmplifier::amplify(CaloSamples& frame, CLHEP::HepRandomEngine* engine)
theIonFeedbackSim->addThermalNoise(frame, engine);
}
pe2fC(frame);

const HcalSimParameters& params = static_cast<const HcalSimParameters&>(theParameterMap->simParameters(frame.id()));
if (((frame.id().subdetId() == HcalGenericDetId::HcalGenBarrel) ||
(frame.id().subdetId() == HcalGenericDetId::HcalGenEndcap)) &&
params.delayQIE() > 0)
applyQIEdelay(frame, params.delayQIE());

// don't bother for blank signals
if (theTimeSlewSim && frame.size() > 4 && frame[4] > 1.e-6) {
theTimeSlewSim->delay(frame, engine, theTimeSlew);
Expand All @@ -60,6 +67,27 @@ void HcalAmplifier::pe2fC(CaloSamples& frame) const {
frame *= parameters.photoelectronsToAnalog(frame.id());
}

void HcalAmplifier::applyQIEdelay(CaloSamples& cs, int delayQIE) const {
DetId detId(cs.id());
int maxbin = cs.size();
int precisebin = cs.preciseSize();
CaloSamples data(detId, maxbin, precisebin); // make a temporary copy
data = cs;
data.setBlank();
data.resetPrecise();

for (int i = 0; i < precisebin; i++) {
if (i < 2 * delayQIE)
data.preciseAtMod(i) += 0.;
else
data.preciseAtMod(i) += cs.preciseAt(i - 2 * delayQIE);
int samplebin = (int)i * maxbin / precisebin;
data[samplebin] += data.preciseAt(i);
}

cs = data; // update the sample
}

void HcalAmplifier::addPedestals(CaloSamples& frame, CLHEP::HepRandomEngine* engine) const {
assert(theDbService != nullptr);
HcalGenericDetId hcalGenDetId(frame.id());
Expand Down
3 changes: 2 additions & 1 deletion SimCalorimetry/HcalSimAlgos/src/HcalSimParameters.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ HcalSimParameters::HcalSimParameters(const edm::ParameterSet& p)
theSiPMSmearing(p.getParameter<bool>("doSiPMSmearing")),
doTimeSmear_(p.getParameter<bool>("timeSmearing")),
theSiPMTau(p.getParameter<double>("sipmTau")),
threshold_currentTDC_(p.getParameter<double>("threshold_currentTDC")) {
threshold_currentTDC_(p.getParameter<double>("threshold_currentTDC")),
delayQIE_(p.getParameter<int>("delayQIE")) {
defaultTimeSmearing();

edm::LogInfo("HcalSimParameters:") << " doSiPMsmearing = " << theSiPMSmearing;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
doSiPMSmearing = cms.bool(False),
sipmTau = cms.double(0.),
threshold_currentTDC = cms.double(-999.),
delayQIE = cms.int32(-999),
),
hf2 = cms.PSet(
readoutFrameSize = cms.int32(4),
Expand All @@ -35,6 +36,7 @@
doSiPMSmearing = cms.bool(False),
sipmTau = cms.double(0.),
threshold_currentTDC = cms.double(-999.),
delayQIE = cms.int32(-999),
),
ho = cms.PSet(
readoutFrameSize = cms.int32(10),
Expand All @@ -53,6 +55,7 @@
doSiPMSmearing = cms.bool(False),
sipmTau = cms.double(5.),
threshold_currentTDC = cms.double(-999.),
delayQIE = cms.int32(-999),
),
hb = cms.PSet(
readoutFrameSize = cms.int32(10),
Expand All @@ -71,6 +74,7 @@
doSiPMSmearing = cms.bool(False),
sipmTau = cms.double(0.),
threshold_currentTDC = cms.double(-999.),
delayQIE = cms.int32(-999),
),
he = cms.PSet(
readoutFrameSize = cms.int32(10),
Expand All @@ -88,6 +92,7 @@
doSiPMSmearing = cms.bool(False),
sipmTau = cms.double(0.),
threshold_currentTDC = cms.double(-999.),
delayQIE = cms.int32(-999),
),
zdc = cms.PSet(
readoutFrameSize = cms.int32(10),
Expand All @@ -101,6 +106,7 @@
doSiPMSmearing = cms.bool(False),
sipmTau = cms.double(0.),
threshold_currentTDC = cms.double(-999.),
delayQIE = cms.int32(-999),
),
)

Expand Down

0 comments on commit 6cfc123

Please sign in to comment.