CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends
OOTPileupCorrData Class Reference

#include <OOTPileupCorrData.h>

Inheritance diagram for OOTPileupCorrData:
AbsOOTPileupCorrection

Public Member Functions

void apply (const HcalDetId &id, const double *inputCharge, unsigned lenInputCharge, const BunchXParameter *bcParams, unsigned lenBcParams, unsigned firstTimeSlice, unsigned nTimeSlices, double *correctedCharge, unsigned lenCorrectedCharge, bool *pulseShapeCorrApplied, bool *leakCorrApplied, bool *readjustTiming) const override
 
void apply (const HcalDetId &id, double *ts, const int tsTrig) const
 
const OOTPileupCorrDataFcngetCorrectionByID (const HcalDetId &id) const
 
bool inputIsEnergy () const override
 
 OOTPileupCorrData (const std::vector< OOTPileupCorrDataFcn > &corrs, const std::vector< uint32_t > &iEtaLimits, double chargeLimit, int requireFirstTS, int requireNTS, bool readjustTiming)
 
 OOTPileupCorrData ()
 
 ~OOTPileupCorrData () override
 
- Public Member Functions inherited from AbsOOTPileupCorrection
bool operator!= (const AbsOOTPileupCorrection &r) const
 
bool operator== (const AbsOOTPileupCorrection &r) const
 
virtual ~AbsOOTPileupCorrection ()
 

Protected Member Functions

bool isEqual (const AbsOOTPileupCorrection &otherBase) const override
 

Private Member Functions

template<class Archive >
void load (Archive &ar, const unsigned)
 
template<class Archive >
void save (Archive &ar, const unsigned) const
 
bool validate () const
 

Private Attributes

double chargeLimit_
 
std::vector< OOTPileupCorrDataFcncorrs_
 
std::vector< uint32_t > iEtaLimits_
 
uint8_t readjustTiming_
 
int32_t requireFirstTS_
 
int32_t requireNTS_
 

Friends

class boost::serialization::access
 

Detailed Description

Definition at line 14 of file OOTPileupCorrData.h.

Constructor & Destructor Documentation

◆ OOTPileupCorrData() [1/2]

OOTPileupCorrData::OOTPileupCorrData ( const std::vector< OOTPileupCorrDataFcn > &  corrs,
const std::vector< uint32_t > &  iEtaLimits,
double  chargeLimit,
int  requireFirstTS,
int  requireNTS,
bool  readjustTiming 
)

Definition at line 7 of file OOTPileupCorrData.cc.

References Exception, and validate().

13  : corrs_(corrs),
14  iEtaLimits_(iEtaLimits),
15  chargeLimit_(chargeLimit),
16  requireFirstTS_(requireFirstTS),
17  requireNTS_(requireNTS),
18  readjustTiming_(readjustTiming) {
19  if (!validate())
20  throw cms::Exception("Invalid OOTPileupCorrData constructor arguments");
21 }
std::vector< uint32_t > iEtaLimits_
std::vector< OOTPileupCorrDataFcn > corrs_

◆ ~OOTPileupCorrData()

OOTPileupCorrData::~OOTPileupCorrData ( )
inlineoverride

Definition at line 58 of file OOTPileupCorrData.h.

58 {}

◆ OOTPileupCorrData() [2/2]

OOTPileupCorrData::OOTPileupCorrData ( )
inline

Definition at line 117 of file OOTPileupCorrData.h.

117 {}

Member Function Documentation

◆ apply() [1/2]

void OOTPileupCorrData::apply ( const HcalDetId id,
const double *  inputCharge,
unsigned  lenInputCharge,
const BunchXParameter *  bcParams,
unsigned  lenBcParams,
unsigned  firstTimeSlice,
unsigned  nTimeSlices,
double *  correctedCharge,
unsigned  lenCorrectedCharge,
bool *  pulseShapeCorrApplied,
bool *  leakCorrApplied,
bool *  readjustTiming 
) const
overridevirtual

Implements AbsOOTPileupCorrection.

Definition at line 37 of file OOTPileupCorrData.cc.

References apply(), Exception, mps_fire::i, and readjustTiming_.

Referenced by heavyIonTools.ConfigureHeavyIons::__call__(), coreTools.RunOnData::__call__(), trackTools.MakeAODTrackCandidates::__call__(), runJetUncertainties.RunJetUncertainties::__call__(), metTools.AddMETCollection::__call__(), heavyIonTools.ProductionDefaults::__call__(), cmsswVersionTools.PickRelValInputFiles::__call__(), coreTools.RemoveMCMatching::__call__(), trackTools.MakePATTrackCandidates::__call__(), trigTools.SwitchOnTrigger::__call__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties::__call__(), heavyIonTools.SelectionDefaults::__call__(), heavyIonTools.DisbaleMonteCarloDeps::__call__(), trigTools.SwitchOnTriggerStandAlone::__call__(), tauTools.AddTauCollection::__call__(), trackTools.MakeTrackCandidates::__call__(), trigTools.SwitchOnTriggerMatching::__call__(), trigTools.SwitchOnTriggerMatchingStandAlone::__call__(), trigTools.SwitchOnTriggerMatchEmbedding::__call__(), jetTools.AddJetCollection::__call__(), jetTools.SwitchJetCollection::__call__(), jetTools.UpdateJetCollection::__call__(), jetTools.AddJetID::__call__(), jetTools.SetTagInfos::__call__(), and apply().

48  {
49  // Check the arguments
50  if (inputCharge == nullptr || correctedCharge == nullptr || lenCorrectedCharge < lenInputCharge ||
51  pulseShapeCorrApplied == nullptr || leakCorrApplied == nullptr || readjustTiming == nullptr)
52  throw cms::Exception("Invalid arguments in OOTPileupCorrData::apply");
53 
54  for (unsigned i = 0; i < lenInputCharge; ++i)
55  correctedCharge[i] = inputCharge[i];
56 
57  // Check whether the charge corrections should actually be applied
58  const bool fixCharge = (requireFirstTS_ < 0 || requireFirstTS_ == static_cast<int32_t>(firstTimeSlice)) &&
59  (requireNTS_ < 0 || requireNTS_ == static_cast<int32_t>(nTimeSlices));
60  if (fixCharge)
61  apply(id, correctedCharge, firstTimeSlice);
62 
63  *pulseShapeCorrApplied = false;
64  *leakCorrApplied = fixCharge;
65  *readjustTiming = readjustTiming_;
66 }
void apply(const HcalDetId &id, const double *inputCharge, unsigned lenInputCharge, const BunchXParameter *bcParams, unsigned lenBcParams, unsigned firstTimeSlice, unsigned nTimeSlices, double *correctedCharge, unsigned lenCorrectedCharge, bool *pulseShapeCorrApplied, bool *leakCorrApplied, bool *readjustTiming) const override

◆ apply() [2/2]

void OOTPileupCorrData::apply ( const HcalDetId id,
double *  ts,
const int  tsTrig 
) const
inline

Definition at line 78 of file OOTPileupCorrData.h.

References funct::abs(), chargeLimit_, corrs_, hcalRecHitTable_cff::ieta, iEtaLimits_, TH2PolyOfflineMaps::limits, mitigatedMETSequence_cff::U, and eostools::which().

Referenced by heavyIonTools.ConfigureHeavyIons::__call__(), coreTools.RunOnData::__call__(), trackTools.MakeAODTrackCandidates::__call__(), runJetUncertainties.RunJetUncertainties::__call__(), metTools.AddMETCollection::__call__(), heavyIonTools.ProductionDefaults::__call__(), cmsswVersionTools.PickRelValInputFiles::__call__(), coreTools.RemoveMCMatching::__call__(), trackTools.MakePATTrackCandidates::__call__(), trigTools.SwitchOnTrigger::__call__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties::__call__(), heavyIonTools.SelectionDefaults::__call__(), heavyIonTools.DisbaleMonteCarloDeps::__call__(), trigTools.SwitchOnTriggerStandAlone::__call__(), tauTools.AddTauCollection::__call__(), trackTools.MakeTrackCandidates::__call__(), trigTools.SwitchOnTriggerMatching::__call__(), trigTools.SwitchOnTriggerMatchingStandAlone::__call__(), trigTools.SwitchOnTriggerMatchEmbedding::__call__(), jetTools.AddJetCollection::__call__(), jetTools.SwitchJetCollection::__call__(), jetTools.UpdateJetCollection::__call__(), jetTools.AddJetID::__call__(), and jetTools.SetTagInfos::__call__().

78  {
79  if (ts[tsTrig] > chargeLimit_) {
80  const unsigned nLimits(iEtaLimits_.size());
81  if (nLimits) {
82  const uint32_t uEta = std::abs(id.ieta());
83  const uint32_t* limits(&iEtaLimits_[0]);
84  unsigned which(0U);
85  for (; which < nLimits; ++which)
86  if (uEta < limits[which])
87  break;
88  corrs_[which].pucorrection(ts, tsTrig);
89  }
90  }
91  }
std::vector< uint32_t > iEtaLimits_
std::vector< OOTPileupCorrDataFcn > corrs_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
def which(cmd)
Definition: eostools.py:336

◆ getCorrectionByID()

const OOTPileupCorrDataFcn& OOTPileupCorrData::getCorrectionByID ( const HcalDetId id) const
inline

Definition at line 93 of file OOTPileupCorrData.h.

References funct::abs(), corrs_, hcalRecHitTable_cff::ieta, iEtaLimits_, TH2PolyOfflineMaps::limits, mitigatedMETSequence_cff::U, and eostools::which().

93  {
94  const unsigned nLimits = iEtaLimits_.size();
95  unsigned which(0U);
96  if (nLimits) {
97  const uint32_t uEta = std::abs(id.ieta());
98  const uint32_t* limits(&iEtaLimits_[0]);
99  for (; which < nLimits; ++which)
100  if (uEta < limits[which])
101  break;
102  }
103  return corrs_.at(which);
104  }
std::vector< uint32_t > iEtaLimits_
std::vector< OOTPileupCorrDataFcn > corrs_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
def which(cmd)
Definition: eostools.py:336

◆ inputIsEnergy()

bool OOTPileupCorrData::inputIsEnergy ( ) const
inlineoverridevirtual

Implements AbsOOTPileupCorrection.

Definition at line 75 of file OOTPileupCorrData.h.

75 { return false; }

◆ isEqual()

bool OOTPileupCorrData::isEqual ( const AbsOOTPileupCorrection otherBase) const
inlineoverrideprotectedvirtual

Implements AbsOOTPileupCorrection.

Definition at line 108 of file OOTPileupCorrData.h.

References chargeLimit_, corrs_, iEtaLimits_, alignCSCRings::r, readjustTiming_, requireFirstTS_, and requireNTS_.

108  {
109  const OOTPileupCorrData& r = static_cast<const OOTPileupCorrData&>(otherBase);
110  return corrs_ == r.corrs_ && iEtaLimits_ == r.iEtaLimits_ && chargeLimit_ == r.chargeLimit_ &&
111  requireFirstTS_ == r.requireFirstTS_ && requireNTS_ == r.requireNTS_ && readjustTiming_ == r.readjustTiming_;
112  }
std::vector< uint32_t > iEtaLimits_
std::vector< OOTPileupCorrDataFcn > corrs_

◆ load()

template<class Archive >
void OOTPileupCorrData::load ( Archive &  ar,
const unsigned   
)
inlineprivate

Definition at line 140 of file OOTPileupCorrData.h.

References chargeLimit_, corrs_, Exception, iEtaLimits_, readjustTiming_, requireFirstTS_, requireNTS_, and validate().

Referenced by MatrixToProcess.MatrixToProcess::getProcess(), MatrixToProcess.MatrixToProcess::listAll(), and ConfigBuilder.ConfigBuilder::prepare_FILTER().

140  {
141  boost::serialization::base_object<AbsOOTPileupCorrection>(*this);
143  if (!validate())
144  throw cms::Exception("In OOTPileupCorrData::load: invalid data");
145  }
std::vector< uint32_t > iEtaLimits_
std::vector< OOTPileupCorrDataFcn > corrs_

◆ save()

template<class Archive >
void OOTPileupCorrData::save ( Archive &  ar,
const unsigned   
) const
inlineprivate

Definition at line 132 of file OOTPileupCorrData.h.

References chargeLimit_, corrs_, Exception, iEtaLimits_, readjustTiming_, requireFirstTS_, requireNTS_, and validate().

Referenced by SpecificationBuilder_cfi.Specification::saveAll().

132  {
133  if (!validate())
134  throw cms::Exception("In OOTPileupCorrData::save: invalid data");
135  boost::serialization::base_object<AbsOOTPileupCorrection>(*this);
137  }
std::vector< uint32_t > iEtaLimits_
std::vector< OOTPileupCorrDataFcn > corrs_

◆ validate()

bool OOTPileupCorrData::validate ( ) const
private

Definition at line 23 of file OOTPileupCorrData.cc.

References corrs_, mps_fire::i, and iEtaLimits_.

Referenced by load(), OOTPileupCorrData(), and save().

23  {
24  const std::size_t nLimits(iEtaLimits_.size());
25  if (!nLimits)
26  return false;
27  if (nLimits >= static_cast<std::size_t>(UINT_MAX))
28  return false;
29  for (std::size_t i = 0; i < nLimits - 1; ++i)
30  if (!(iEtaLimits_[i] < iEtaLimits_[i + 1]))
31  return false;
32  if (corrs_.size() != nLimits + 1)
33  return false;
34  return true;
35 }
std::vector< uint32_t > iEtaLimits_
std::vector< OOTPileupCorrDataFcn > corrs_

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 129 of file OOTPileupCorrData.h.

Member Data Documentation

◆ chargeLimit_

double OOTPileupCorrData::chargeLimit_
private

Definition at line 124 of file OOTPileupCorrData.h.

Referenced by apply(), isEqual(), load(), and save().

◆ corrs_

std::vector<OOTPileupCorrDataFcn> OOTPileupCorrData::corrs_
private

Definition at line 122 of file OOTPileupCorrData.h.

Referenced by apply(), getCorrectionByID(), isEqual(), load(), save(), and validate().

◆ iEtaLimits_

std::vector<uint32_t> OOTPileupCorrData::iEtaLimits_
private

Definition at line 123 of file OOTPileupCorrData.h.

Referenced by apply(), getCorrectionByID(), isEqual(), load(), save(), and validate().

◆ readjustTiming_

uint8_t OOTPileupCorrData::readjustTiming_
private

Definition at line 127 of file OOTPileupCorrData.h.

Referenced by apply(), isEqual(), load(), and save().

◆ requireFirstTS_

int32_t OOTPileupCorrData::requireFirstTS_
private

Definition at line 125 of file OOTPileupCorrData.h.

Referenced by isEqual(), load(), and save().

◆ requireNTS_

int32_t OOTPileupCorrData::requireNTS_
private

Definition at line 126 of file OOTPileupCorrData.h.

Referenced by isEqual(), load(), and save().