Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TimeSlew modelling update #6103

Merged
merged 2 commits into from Oct 30, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
47 changes: 33 additions & 14 deletions SimCalorimetry/HcalSimAlgos/src/HcalTimeSlewSim.cc
Expand Up @@ -16,7 +16,7 @@ HcalTimeSlewSim::HcalTimeSlewSim(const CaloVSimParameterMap * parameterMap)
}



// not quite adequate to 25ns high-PU regime
double HcalTimeSlewSim::charge(const CaloSamples & samples) const
{
double totalCharge = 0.;
Expand Down Expand Up @@ -45,19 +45,38 @@ void HcalTimeSlewSim::delay(CaloSamples & samples, CLHEP::HepRandomEngine* engin
HcalTimeSlew::Slow :
HcalTimeSlew::Medium;

double totalCharge = charge(samples);
if(totalCharge <= 0.) totalCharge = 1.e-6; // protecion against negaive v.
double delay = HcalTimeSlew::delay(totalCharge, biasSetting);
// now, the smearing
const HcalSimParameters& params=static_cast<const HcalSimParameters&>(theParameterMap->simParameters(detId));
if (params.doTimeSmear()) {
double rms=params.timeSmearRMS(totalCharge);
double smearns=CLHEP::RandGaussQ::shoot(engine)*rms;

LogDebug("HcalTimeSlewSim") << "TimeSmear charge " << totalCharge << " rms " << rms << " delay " << delay << " smearns " << smearns;
delay+=smearns;
}
// double totalCharge = charge(samples);

int maxbin = samples.size();
CaloSamples data(detId, maxbin); // for a temporary copy
data = samples;

samples.offsetTime(delay);
for(int i = 0; i < samples.size()-1; ++i) {
double totalCharge = data[i]/0.6; // temporary change from total charge to approximation TS/0.6
// until we get more precise/reliable QIE8 simulation

if(totalCharge <= 0.) totalCharge = 1.e-6; // protecion against negaive v.
double delay = HcalTimeSlew::delay(totalCharge, biasSetting);
// now, the smearing still remains
const HcalSimParameters& params=static_cast<const HcalSimParameters&>(theParameterMap->simParameters(detId));
if (params.doTimeSmear()) {
double rms=params.timeSmearRMS(totalCharge);
double smearns=CLHEP::RandGaussQ::shoot(engine)*rms;

LogDebug("HcalTimeSlewSim") << "TimeSmear charge " << totalCharge << " rms " << rms << " delay " << delay << " smearns " << smearns;
delay+=smearns;
}

// samples.offsetTime(delay); -> replacing it with 1TS move

double t = i*25. - delay;
int firstbin = floor(t/25.);
double f = t/25. - firstbin;
int nextbin = firstbin + 1;
double v2 = (nextbin < 0 || nextbin >= maxbin) ? 0. : data[nextbin];
data[i] = v2*f;
data[i+1] = data[i+1] + (v2 - data[i]);
}
samples = data;
}
}