init_guid

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
#include "FWCore/Utilities/interface/Exception.h"

#include "boost/serialization/export.hpp"

#include "CondFormats/HcalObjects/interface/DummyOOTPileupCorrection.h"

void DummyOOTPileupCorrection::apply(const HcalDetId& /* id */,
                                     const double* inputCharge,
                                     const unsigned lenInputCharge,
                                     const BunchXParameter* /* bcParams */,
                                     unsigned /* lenBcParams */,
                                     unsigned /* firstTimeSlice */,
                                     unsigned /* nTimeSlices */,
                                     double* correctedCharge,
                                     const unsigned lenCorrectedCharge,
                                     bool* pulseShapeCorrApplied,
                                     bool* leakCorrApplied,
                                     bool* readjustTiming) const {
  // Check the arguments
  if (inputCharge == nullptr || correctedCharge == nullptr || lenCorrectedCharge < lenInputCharge ||
      pulseShapeCorrApplied == nullptr || leakCorrApplied == nullptr || readjustTiming == nullptr)
    throw cms::Exception("Invalid arguments in DummyOOTPileupCorrection::apply");

  // Perform the correction
  for (unsigned i = 0; i < lenInputCharge; ++i)
    correctedCharge[i] = scale_ * inputCharge[i];

  // Tell the code that runs after this which additional
  // corrections should be discarded
  *pulseShapeCorrApplied = false;
  *leakCorrApplied = false;

  // Tell the code that runs after this whether corrected
  // amplitudes should be used for timing calculations
  *readjustTiming = false;
}

bool DummyOOTPileupCorrection::isEqual(const AbsOOTPileupCorrection& otherBase) const {
  // Note the use of static_cast rather than dynamic_cast below.
  // static_cast works faster and it is guaranteed to succeed here.
  const DummyOOTPileupCorrection& r = static_cast<const DummyOOTPileupCorrection&>(otherBase);
  return descr_ == r.descr_ && scale_ == r.scale_;
}

BOOST_CLASS_EXPORT_IMPLEMENT(DummyOOTPileupCorrection)