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

do not use unsigned in algebra #14698

Merged
merged 1 commit into from May 31, 2016
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
11 changes: 6 additions & 5 deletions CalibCalorimetry/EcalLaserCorrection/src/EcalLaserDbService.cc
Expand Up @@ -190,9 +190,9 @@ float EcalLaserDbService::getLaserCorrection (DetId const & xid, edm::Timestamp
// interpolation

edm::TimeValue_t t = iTime.value();
edm::TimeValue_t t_i = 0, t_f = 0;
long long t_i = 0, t_f = 0;
float p_i = 0, p_f = 0;
edm::TimeValue_t lt_i = 0, lt_f = 0;
long long lt_i = 0, lt_f = 0;
float lp_i = 0, lp_f = 0;

if ( t >= timestamp.t1.value() && t < timestamp.t2.value() ) {
Expand Down Expand Up @@ -244,9 +244,10 @@ float EcalLaserDbService::getLaserCorrection (DetId const & xid, edm::Timestamp
}

if ( apdpnref != 0 && (t_i - t_f) != 0 && (lt_i - lt_f) != 0) {
float interpolatedLaserResponse = p_i/apdpnref + float(t-t_i)*(p_f-p_i)/(apdpnref*float(t_f-t_i));
float interpolatedLinearResponse = lp_i/apdpnref + float(t-lt_i)*(lp_f-lp_i)/(apdpnref*float(lt_f-lt_i)); // FIXED BY FC

long long tt = t; // never subtract two unsigned!
float interpolatedLaserResponse = p_i/apdpnref + float(tt-t_i)*(p_f-p_i)/(apdpnref*float(t_f-t_i));
float interpolatedLinearResponse = lp_i/apdpnref + float(tt-lt_i)*(lp_f-lp_i)/(apdpnref*float(lt_f-lt_i)); // FIXED BY FC

if(interpolatedLinearResponse >2.f || interpolatedLinearResponse <0.1f)
interpolatedLinearResponse=1.f;
if ( interpolatedLaserResponse <= 0. ) {
Expand Down