CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HBHERecalibration Class Reference

#include <HBHERecalibration.h>

Public Member Functions

float getCorr (int ieta, int depth) const
 
 HBHERecalibration (float intlumi, float cutoff, std::string meanenergies)
 
int maxDepth () const
 
void setup (const std::vector< std::vector< int >> &m_segmentation, const HBHEDarkening *darkening)
 
 ~HBHERecalibration ()
 

Private Member Functions

void initialize ()
 

Private Attributes

std::vector< std::vector< float > > corr_
 
float cutoff_
 
const HBHEDarkeningdarkening_
 
std::vector< std::vector< int > > dsegm_
 
int ieta_shift_
 
float intlumi_
 
int max_depth_
 
std::vector< std::vector< float > > meanenergies_
 

Detailed Description

Definition at line 14 of file HBHERecalibration.h.

Constructor & Destructor Documentation

◆ HBHERecalibration()

HBHERecalibration::HBHERecalibration ( float  intlumi,
float  cutoff,
std::string  meanenergies 
)

Definition at line 7 of file HBHERecalibration.cc.

8  : intlumi_(intlumi),
10  ieta_shift_(0),
11  max_depth_(0),
13  darkening_(nullptr) {}

◆ ~HBHERecalibration()

HBHERecalibration::~HBHERecalibration ( )

Definition at line 15 of file HBHERecalibration.cc.

15 {}

Member Function Documentation

◆ getCorr()

float HBHERecalibration::getCorr ( int  ieta,
int  depth 
) const

Definition at line 40 of file HBHERecalibration.cc.

40  {
41  ieta = abs(ieta);
42  //shift ieta tower index to act as array index
43  ieta -= ieta_shift_;
44 
45  //shift depth index to act as array index (depth = 0 - not used!)
46  depth -= 1;
47 
48  //bounds check
49  if (ieta < 0 or ieta >= int(corr_.size()))
50  return 1.0;
51  if (depth < 0 or depth >= int(corr_[ieta].size()))
52  return 1.0;
53 
54  if (cutoff_ > 1 and corr_[ieta][depth] > cutoff_)
55  return cutoff_;
56  else
57  return corr_[ieta][depth];
58 }

References funct::abs(), corr_, cutoff_, LEDCalibrationChannels::depth, LEDCalibrationChannels::ieta, ieta_shift_, and findQualityFiles::size.

◆ initialize()

void HBHERecalibration::initialize ( )
private

Definition at line 60 of file HBHERecalibration.cc.

60  {
61  std::vector<std::vector<float>> vtmp(dsegm_.size(), std::vector<float>(max_depth_, 0.0));
62  auto dval =
63  vtmp; //conversion of meanenergies into depths-averaged values - denominator (including degradation for intlumi)
64  auto nval = vtmp; // conversion of meanenergies into depths-averaged values - numerator (no degradation)
65  corr_ = vtmp;
66 
67  //converting energy values from layers into depths
68  for (unsigned int ieta = 0; ieta < dsegm_.size(); ++ieta) {
69  //fill sum(means(layer,0)) and sum(means(layer,lumi)) for each depth
70  for (unsigned int ilay = 0; ilay < std::min(meanenergies_[ieta].size(), dsegm_[ieta].size()); ++ilay) {
71  int depth = dsegm_[ieta][ilay] - 1; // depth = 0 - not used!
72  nval[ieta][depth] += meanenergies_[ieta][ilay];
73  dval[ieta][depth] +=
74  meanenergies_[ieta][ilay] *
75  darkening_->degradation(intlumi_, ieta + ieta_shift_, ilay + 1); //be careful of eta and layer numbering
76  }
77 
78  //compute factors, w/ safety checks
79  for (int depth = 0; depth < max_depth_; ++depth) {
80  if (dval[ieta][depth] > 0)
81  corr_[ieta][depth] = nval[ieta][depth] / dval[ieta][depth];
82  else
83  corr_[ieta][depth] = 1.0;
84 
85  if (corr_[ieta][depth] < 1.0)
86  corr_[ieta][depth] = 1.0;
87  }
88  }
89 }

References corr_, darkening_, HBHEDarkening::degradation(), LEDCalibrationChannels::depth, dsegm_, LEDCalibrationChannels::ieta, ieta_shift_, intlumi_, max_depth_, meanenergies_, min(), and findQualityFiles::size.

Referenced by setup().

◆ maxDepth()

int HBHERecalibration::maxDepth ( ) const
inline

Definition at line 22 of file HBHERecalibration.h.

22 { return max_depth_; }

References max_depth_.

◆ setup()

void HBHERecalibration::setup ( const std::vector< std::vector< int >> &  m_segmentation,
const HBHEDarkening darkening 
)

Definition at line 17 of file HBHERecalibration.cc.

17  {
18  darkening_ = darkening;
20 
21  //infer eta bounds
22  int min_ieta = ieta_shift_ - 1;
23  int max_ieta = min_ieta + meanenergies_.size();
24  dsegm_.reserve(max_ieta - min_ieta);
25  for (int ieta = min_ieta; ieta < max_ieta; ++ieta) {
26  dsegm_.push_back(m_segmentation[ieta]);
27  //find maximum
28  for (unsigned lay = 0; lay < dsegm_.back().size(); ++lay) {
29  if (lay >= meanenergies_[0].size())
30  break;
31  int depth = dsegm_.back()[lay];
32  if (depth > max_depth_)
33  max_depth_ = depth;
34  }
35  }
36 
37  initialize();
38 }

References darkening_, LEDCalibrationChannels::depth, dsegm_, HBHEDarkening::get_ieta_shift(), LEDCalibrationChannels::ieta, ieta_shift_, initialize(), max_depth_, meanenergies_, and findQualityFiles::size.

Referenced by o2olib.O2OTool::execute().

Member Data Documentation

◆ corr_

std::vector<std::vector<float> > HBHERecalibration::corr_
private

Definition at line 36 of file HBHERecalibration.h.

Referenced by getCorr(), and initialize().

◆ cutoff_

float HBHERecalibration::cutoff_
private

Definition at line 30 of file HBHERecalibration.h.

Referenced by getCorr().

◆ darkening_

const HBHEDarkening* HBHERecalibration::darkening_
private

Definition at line 34 of file HBHERecalibration.h.

Referenced by initialize(), and setup().

◆ dsegm_

std::vector<std::vector<int> > HBHERecalibration::dsegm_
private

Definition at line 35 of file HBHERecalibration.h.

Referenced by initialize(), and setup().

◆ ieta_shift_

int HBHERecalibration::ieta_shift_
private

Definition at line 31 of file HBHERecalibration.h.

Referenced by getCorr(), initialize(), and setup().

◆ intlumi_

float HBHERecalibration::intlumi_
private

Definition at line 29 of file HBHERecalibration.h.

Referenced by initialize().

◆ max_depth_

int HBHERecalibration::max_depth_
private

Definition at line 32 of file HBHERecalibration.h.

Referenced by initialize(), maxDepth(), and setup().

◆ meanenergies_

std::vector<std::vector<float> > HBHERecalibration::meanenergies_
private

Definition at line 33 of file HBHERecalibration.h.

Referenced by initialize(), and setup().

HBHERecalibration::dsegm_
std::vector< std::vector< int > > dsegm_
Definition: HBHERecalibration.h:35
HBHERecalibration::darkening_
const HBHEDarkening * darkening_
Definition: HBHERecalibration.h:34
qjetsadder_cfi.cutoff
cutoff
Definition: qjetsadder_cfi.py:11
min
T min(T a, T b)
Definition: MathUtil.h:58
HBHEDarkening::get_ieta_shift
int get_ieta_shift() const
Definition: HBHEDarkening.h:49
HBHEDarkening::readDoseMap
static std::vector< std::vector< float > > readDoseMap(const std::string &fullpath)
Definition: HBHEDarkening.cc:32
HBHERecalibration::corr_
std::vector< std::vector< float > > corr_
Definition: HBHERecalibration.h:36
HBHERecalibration::intlumi_
float intlumi_
Definition: HBHERecalibration.h:29
HBHERecalibration::max_depth_
int max_depth_
Definition: HBHERecalibration.h:32
HBHERecalibration::ieta_shift_
int ieta_shift_
Definition: HBHERecalibration.h:31
HBHERecalibration::meanenergies_
std::vector< std::vector< float > > meanenergies_
Definition: HBHERecalibration.h:33
HBHERecalibration::cutoff_
float cutoff_
Definition: HBHERecalibration.h:30
HBHERecalibration::initialize
void initialize()
Definition: HBHERecalibration.cc:60
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
HBHEDarkening::degradation
float degradation(float intlumi, int ieta, int lay) const
Definition: HBHEDarkening.cc:98
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443