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::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().

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

Definition at line 57 of file OOTPileupCorrData.h.

References apply().

57 {}
OOTPileupCorrData::OOTPileupCorrData ( )
inline

Definition at line 122 of file OOTPileupCorrData.h.

References validate().

122 {}

Member Function Documentation

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 40 of file OOTPileupCorrData.cc.

References Exception, mps_fire::i, readjustTiming_, requireFirstTS_, and requireNTS_.

Referenced by heavyIonTools.ConfigureHeavyIons::__call__(), editorTools.UserCodeTool::__call__(), HiCoreTools.RestrictInputToAOD::__call__(), coreTools.RunOnData::__call__(), trackTools.MakeAODTrackCandidates::__call__(), runJetUncertainties.RunJetUncertainties::__call__(), metTools.AddMETCollection::__call__(), heavyIonTools.ProductionDefaults::__call__(), editorTools.ChangeSource::__call__(), HiCoreTools.RemoveMCMatching::__call__(), cmsswVersionTools.PickRelValInputFiles::__call__(), coreTools.RemoveMCMatching::__call__(), trackTools.MakePATTrackCandidates::__call__(), trigTools.SwitchOnTrigger::__call__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties::__call__(), heavyIonTools.SelectionDefaults::__call__(), HiCoreTools.RemoveAllPATObjectsBut::__call__(), heavyIonTools.DisbaleMonteCarloDeps::__call__(), HiCoreTools.RemoveSpecificPATObjects::__call__(), trigTools.SwitchOnTriggerStandAlone::__call__(), trackTools.MakeTrackCandidates::__call__(), tauTools.AddTauCollection::__call__(), trigTools.SwitchOnTriggerMatching::__call__(), HiCoreTools.RemoveCleaning::__call__(), HiCoreTools.AddCleaning::__call__(), trigTools.SwitchOnTriggerMatchingStandAlone::__call__(), trigTools.SwitchOnTriggerMatchEmbedding::__call__(), jetTools.AddJetCollection::__call__(), jetTools.SwitchJetCollection::__call__(), jetTools.UpdateJetCollection::__call__(), jetTools.AddJetID::__call__(), jetTools.SetTagInfos::__call__(), and ~OOTPileupCorrData().

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

Definition at line 72 of file OOTPileupCorrData.h.

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

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

73  {
74  if (ts[tsTrig] > chargeLimit_)
75  {
76  const unsigned nLimits(iEtaLimits_.size());
77  if (nLimits)
78  {
79  const uint32_t uEta = std::abs(id.ieta());
80  const uint32_t* limits(&iEtaLimits_[0]);
81  unsigned which(0U);
82  for (; which<nLimits; ++which)
83  if (uEta < limits[which])
84  break;
85  corrs_[which].pucorrection(ts, tsTrig);
86  }
87  }
88  }
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
const OOTPileupCorrDataFcn& OOTPileupCorrData::getCorrectionByID ( const HcalDetId id) const
inline

Definition at line 90 of file OOTPileupCorrData.h.

References funct::abs(), corrs_, iEtaLimits_, mitigatedMETSequence_cff::U, and eostools::which().

91  {
92  const unsigned nLimits = iEtaLimits_.size();
93  unsigned which(0U);
94  if (nLimits)
95  {
96  const uint32_t uEta = std::abs(id.ieta());
97  const uint32_t* limits(&iEtaLimits_[0]);
98  for (; which<nLimits; ++which)
99  if (uEta < limits[which])
100  break;
101  }
102  return corrs_.at(which);
103  }
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
bool OOTPileupCorrData::inputIsEnergy ( ) const
inlineoverridevirtual

Implements AbsOOTPileupCorrection.

Definition at line 69 of file OOTPileupCorrData.h.

69 {return false;}
bool OOTPileupCorrData::isEqual ( const AbsOOTPileupCorrection otherBase) const
inlineoverrideprotectedvirtual

Implements AbsOOTPileupCorrection.

Definition at line 107 of file OOTPileupCorrData.h.

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

108  {
109  const OOTPileupCorrData& r =
110  static_cast<const OOTPileupCorrData&>(otherBase);
111  return corrs_ == r.corrs_ &&
112  iEtaLimits_ == r.iEtaLimits_ &&
113  chargeLimit_ == r.chargeLimit_ &&
115  requireNTS_ == r.requireNTS_ &&
117  }
std::vector< uint32_t > iEtaLimits_
std::vector< OOTPileupCorrDataFcn > corrs_
template<class Archive >
void OOTPileupCorrData::load ( Archive &  ar,
const unsigned   
)
inlineprivate

Definition at line 147 of file OOTPileupCorrData.h.

References Exception, readjustTiming_, and validate().

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

148  {
149  boost::serialization::base_object<AbsOOTPileupCorrection>(*this);
152  if (!validate()) throw cms::Exception(
153  "In OOTPileupCorrData::load: invalid data");
154  }
std::vector< uint32_t > iEtaLimits_
bool validate() const
std::vector< OOTPileupCorrDataFcn > corrs_
template<class Archive >
void OOTPileupCorrData::save ( Archive &  ar,
const unsigned   
) const
inlineprivate

Definition at line 137 of file OOTPileupCorrData.h.

References Exception, readjustTiming_, and validate().

Referenced by Vispa.Main.TabController.TabController::allowClose(), Vispa.Main.TabController.TabController::checkModificationTimestamp(), and SpecificationBuilder_cfi.Specification::saveAll().

138  {
139  if (!validate()) throw cms::Exception(
140  "In OOTPileupCorrData::save: invalid data");
141  boost::serialization::base_object<AbsOOTPileupCorrection>(*this);
144  }
std::vector< uint32_t > iEtaLimits_
bool validate() const
std::vector< OOTPileupCorrDataFcn > corrs_
bool OOTPileupCorrData::validate ( ) const
private

Definition at line 25 of file OOTPileupCorrData.cc.

References corrs_, mps_fire::i, and iEtaLimits_.

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

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

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 134 of file OOTPileupCorrData.h.

Member Data Documentation

double OOTPileupCorrData::chargeLimit_
private

Definition at line 129 of file OOTPileupCorrData.h.

Referenced by apply(), and isEqual().

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

Definition at line 127 of file OOTPileupCorrData.h.

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

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

Definition at line 128 of file OOTPileupCorrData.h.

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

uint8_t OOTPileupCorrData::readjustTiming_
private

Definition at line 132 of file OOTPileupCorrData.h.

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

int32_t OOTPileupCorrData::requireFirstTS_
private

Definition at line 130 of file OOTPileupCorrData.h.

Referenced by apply(), and isEqual().

int32_t OOTPileupCorrData::requireNTS_
private

Definition at line 131 of file OOTPileupCorrData.h.

Referenced by apply(), and isEqual().