CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
HBHEDarkening Class Reference

#include <HBHEDarkening.h>

Classes

struct  LumiYear
 
struct  LumiYearComp
 

Public Member Functions

float degradation (float intlumi, int ieta, int lay) const
 
int get_ieta_shift () const
 
 HBHEDarkening (int ieta_shift, float drdA, float drdB, const std::map< int, std::vector< std::vector< float >>> &dosemaps, const std::vector< LumiYear > &years)
 
 ~HBHEDarkening ()
 

Static Public Member Functions

static std::vector< std::vector< float > > readDoseMap (const std::string &fullpath)
 

Private Member Functions

float degradationYear (const LumiYear &year, float intlumi, int ieta, int lay) const
 
float dose (int ieta, int lay, int energy) const
 
std::string getYearForLumi (float intlumi) const
 

Private Attributes

std::map< int, std::vector< std::vector< float > > > dosemaps_
 
float drdA_
 
float drdB_
 
int ieta_shift_
 
std::vector< LumiYearyears_
 

Detailed Description

Definition at line 17 of file HBHEDarkening.h.

Constructor & Destructor Documentation

◆ HBHEDarkening()

HBHEDarkening::HBHEDarkening ( int  ieta_shift,
float  drdA,
float  drdB,
const std::map< int, std::vector< std::vector< float >>> &  dosemaps,
const std::vector< LumiYear > &  years 
)

Definition at line 16 of file HBHEDarkening.cc.

21  : ieta_shift_(ieta_shift), drdA_(drdA), drdB_(drdB), dosemaps_(dosemaps), years_(years) {
22  //finish initializing years
23  std::sort(years_.begin(), years_.end());
24  //sum up int lumi
25  float sumlumi = 0.0;
26  for (auto& year : years_) {
27  sumlumi += year.intlumi_;
28  year.sumlumi_ = sumlumi;
29  }
30 }

References jetUpdater_cfi::sort, and years_.

◆ ~HBHEDarkening()

HBHEDarkening::~HBHEDarkening ( )
inline

Definition at line 45 of file HBHEDarkening.h.

45 {}

Member Function Documentation

◆ degradation()

float HBHEDarkening::degradation ( float  intlumi,
int  ieta,
int  lay 
) const

Definition at line 98 of file HBHEDarkening.cc.

98  {
99  ieta = abs(ieta);
100  //shift ieta tower index to act as array index
101  ieta -= ieta_shift_;
102  //shift layer index by 1 to act as array index
103  lay -= 1;
104 
105  //accumulate degradation over years
106  float response = 1.0;
107  std::string yearForLumi = getYearForLumi(intlumi);
108  assert(!yearForLumi.empty());
109 
110  for (const auto& year : years_) {
111  response *= degradationYear(year, intlumi, ieta, lay);
112  if (year.year_ == yearForLumi)
113  break;
114  }
115 
116  return response;
117 }

References funct::abs(), cms::cuda::assert(), degradationYear(), getYearForLumi(), LEDCalibrationChannels::ieta, ieta_shift_, AlCaHLTBitMon_QueryRunRegistry::string, and years_.

Referenced by HcalDigitizer::darkening(), HCalSD::getEnergyDeposit(), and HBHERecalibration::initialize().

◆ degradationYear()

float HBHEDarkening::degradationYear ( const LumiYear year,
float  intlumi,
int  ieta,
int  lay 
) const
private

Definition at line 80 of file HBHEDarkening.cc.

80  {
81  float doseToUse = dose(ieta, lay, year.energy_);
82  if (doseToUse == 0.0)
83  return 1.0;
84 
85  //apply dose rate dependence model to the provided year
86  //get krad/hr from Mrad/fb-1 and fb-1/hr
87  float decayConst = drdA_ * std::pow(1000 * doseToUse * year.lumirate_, drdB_);
88 
89  //determine if this is a partial year
90  float intlumiToUse = year.intlumi_;
91  if (intlumi < year.sumlumi_)
92  intlumiToUse = intlumi - (year.sumlumi_ - year.intlumi_);
93 
94  //calculate degradation
95  return std::exp(-(intlumiToUse * doseToUse) / decayConst);
96 }

References dose(), drdA_, drdB_, HBHEDarkening::LumiYear::energy_, JetChargeProducer_cfi::exp, LEDCalibrationChannels::ieta, HBHEDarkening::LumiYear::intlumi_, HBHEDarkening::LumiYear::lumirate_, funct::pow(), and HBHEDarkening::LumiYear::sumlumi_.

Referenced by degradation().

◆ dose()

float HBHEDarkening::dose ( int  ieta,
int  lay,
int  energy 
) const
private

Definition at line 51 of file HBHEDarkening.cc.

51  {
52  //existence check
53  const auto dosemapIt = dosemaps_.find(energy);
54  if (dosemapIt == dosemaps_.end())
55  return 0.0;
56 
57  //bounds check
58  const auto& dosemap = dosemapIt->second;
59  if (ieta < 0 or ieta >= int(dosemap.size()))
60  return 0.0;
61 
62  //bounds check
63  const auto& doserow = dosemap[ieta];
64  if (lay < 0 or lay >= int(doserow.size()))
65  return 0.0;
66 
67  return doserow[lay];
68 }

References dosemaps_, HCALHighEnergyHPDFilter_cfi::energy, and LEDCalibrationChannels::ieta.

Referenced by degradationYear().

◆ get_ieta_shift()

int HBHEDarkening::get_ieta_shift ( ) const
inline

Definition at line 49 of file HBHEDarkening.h.

49 { return ieta_shift_; }

References ieta_shift_.

Referenced by HBHERecalibration::setup().

◆ getYearForLumi()

std::string HBHEDarkening::getYearForLumi ( float  intlumi) const
private

Definition at line 70 of file HBHEDarkening.cc.

70  {
71  //compare based on sum lumi value
72  auto lb = std::lower_bound(years_.begin(), years_.end(), intlumi, LumiYearComp());
73  if (lb == years_.end() or lb->sumlumi_ < intlumi) {
74  throw cms::Exception("ValueError") << "HBHEDarkening: insufficient LHC run information provided to simulate "
75  << intlumi << "/fb - check the python config" << std::endl;
76  }
77  return lb->year_;
78 }

References Exception, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, or, and years_.

Referenced by degradation().

◆ readDoseMap()

std::vector< std::vector< float > > HBHEDarkening::readDoseMap ( const std::string &  fullpath)
static

Definition at line 32 of file HBHEDarkening.cc.

32  {
33  std::ifstream infile(fullpath.c_str());
34  if (!infile.is_open()) {
35  throw cms::Exception("FileNotFound") << "Unable to open '" << fullpath << "'" << std::endl;
36  }
38  std::vector<std::vector<float>> result;
39  while (getline(infile, line)) {
40  //space-separated
41  std::stringstream linestream(line);
42  std::vector<float> lineresult;
43  float doseval;
44  while (linestream >> doseval)
45  lineresult.push_back(doseval);
46  result.push_back(lineresult);
47  }
48  return result;
49 }

References Exception, reco_skim_cfg_mod::fullpath, timingPdfMaker::infile, mps_splice::line, mps_fire::result, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by HBHEDarkeningEP::produce().

Member Data Documentation

◆ dosemaps_

std::map<int, std::vector<std::vector<float> > > HBHEDarkening::dosemaps_
private

Definition at line 63 of file HBHEDarkening.h.

Referenced by dose().

◆ drdA_

float HBHEDarkening::drdA_
private

Definition at line 62 of file HBHEDarkening.h.

Referenced by degradationYear().

◆ drdB_

float HBHEDarkening::drdB_
private

Definition at line 62 of file HBHEDarkening.h.

Referenced by degradationYear().

◆ ieta_shift_

int HBHEDarkening::ieta_shift_
private

Definition at line 61 of file HBHEDarkening.h.

Referenced by degradation(), and get_ieta_shift().

◆ years_

std::vector<LumiYear> HBHEDarkening::years_
private

Definition at line 64 of file HBHEDarkening.h.

Referenced by degradation(), getYearForLumi(), and HBHEDarkening().

reco_skim_cfg_mod.fullpath
fullpath
Definition: reco_skim_cfg_mod.py:202
HBHEDarkening::dosemaps_
std::map< int, std::vector< std::vector< float > > > dosemaps_
Definition: HBHEDarkening.h:63
HBHEDarkening::drdA_
float drdA_
Definition: HBHEDarkening.h:62
HBHEDarkening::dose
float dose(int ieta, int lay, int energy) const
Definition: HBHEDarkening.cc:51
cms::cuda::assert
assert(be >=bs)
HBHEDarkening::years_
std::vector< LumiYear > years_
Definition: HBHEDarkening.h:64
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HBHEDarkening::drdB_
float drdB_
Definition: HBHEDarkening.h:62
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
HBHEDarkening::degradationYear
float degradationYear(const LumiYear &year, float intlumi, int ieta, int lay) const
Definition: HBHEDarkening.cc:80
HBHEDarkening::ieta_shift_
int ieta_shift_
Definition: HBHEDarkening.h:61
Exception
Definition: hltDiff.cc:245
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
timingPdfMaker.infile
infile
Definition: timingPdfMaker.py:350
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
mps_fire.result
result
Definition: mps_fire.py:311
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
HBHEDarkening::getYearForLumi
std::string getYearForLumi(float intlumi) const
Definition: HBHEDarkening.cc:70
mps_splice.line
line
Definition: mps_splice.py:76