Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:14

0001 #include "FWCore/Utilities/interface/Exception.h"
0002 
0003 #include "boost/serialization/export.hpp"
0004 
0005 #include "CondFormats/HcalObjects/interface/DummyOOTPileupCorrection.h"
0006 
0007 void DummyOOTPileupCorrection::apply(const HcalDetId& /* id */,
0008                                      const double* inputCharge,
0009                                      const unsigned lenInputCharge,
0010                                      const BunchXParameter* /* bcParams */,
0011                                      unsigned /* lenBcParams */,
0012                                      unsigned /* firstTimeSlice */,
0013                                      unsigned /* nTimeSlices */,
0014                                      double* correctedCharge,
0015                                      const unsigned lenCorrectedCharge,
0016                                      bool* pulseShapeCorrApplied,
0017                                      bool* leakCorrApplied,
0018                                      bool* readjustTiming) const {
0019   // Check the arguments
0020   if (inputCharge == nullptr || correctedCharge == nullptr || lenCorrectedCharge < lenInputCharge ||
0021       pulseShapeCorrApplied == nullptr || leakCorrApplied == nullptr || readjustTiming == nullptr)
0022     throw cms::Exception("Invalid arguments in DummyOOTPileupCorrection::apply");
0023 
0024   // Perform the correction
0025   for (unsigned i = 0; i < lenInputCharge; ++i)
0026     correctedCharge[i] = scale_ * inputCharge[i];
0027 
0028   // Tell the code that runs after this which additional
0029   // corrections should be discarded
0030   *pulseShapeCorrApplied = false;
0031   *leakCorrApplied = false;
0032 
0033   // Tell the code that runs after this whether corrected
0034   // amplitudes should be used for timing calculations
0035   *readjustTiming = false;
0036 }
0037 
0038 bool DummyOOTPileupCorrection::isEqual(const AbsOOTPileupCorrection& otherBase) const {
0039   // Note the use of static_cast rather than dynamic_cast below.
0040   // static_cast works faster and it is guaranteed to succeed here.
0041   const DummyOOTPileupCorrection& r = static_cast<const DummyOOTPileupCorrection&>(otherBase);
0042   return descr_ == r.descr_ && scale_ == r.scale_;
0043 }
0044 
0045 BOOST_CLASS_EXPORT_IMPLEMENT(DummyOOTPileupCorrection)