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 ( float  intlumi,
float  cutoff,
std::string  meanenergies 
)

Definition at line 7 of file HBHERecalibration.cc.

7  :
8  intlumi_(intlumi), cutoff_(cutoff), ieta_shift_(0), max_depth_(0),
10 {}
std::vector< std::vector< float > > meanenergies_
static std::vector< std::vector< float > > readDoseMap(const std::string &fullpath)
const HBHEDarkening * darkening_
HBHERecalibration::~HBHERecalibration ( )

Definition at line 12 of file HBHERecalibration.cc.

12 {}

Member Function Documentation

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

Definition at line 36 of file HBHERecalibration.cc.

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

36  {
37  ieta = abs(ieta);
38  //shift ieta tower index to act as array index
39  ieta -= ieta_shift_;
40 
41  //shift depth index to act as array index (depth = 0 - not used!)
42  depth -= 1;
43 
44  //bounds check
45  if(ieta<0 or ieta>=int(corr_.size())) return 1.0;
46  if(depth<0 or depth>=int(corr_[ieta].size())) return 1.0;
47 
48  if(cutoff_ > 1 and corr_[ieta][depth] > cutoff_) return cutoff_;
49  else return corr_[ieta][depth];
50 }
size
Write out results.
std::vector< std::vector< float > > corr_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void HBHERecalibration::initialize ( )
private

Definition at line 52 of file HBHERecalibration.cc.

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

Referenced by maxDepth(), and setup().

52  {
53  std::vector<std::vector<float>> vtmp(dsegm_.size(),std::vector<float>(max_depth_,0.0));
54  auto dval = vtmp; //conversion of meanenergies into depths-averaged values - denominator (including degradation for intlumi)
55  auto nval = vtmp; // conversion of meanenergies into depths-averaged values - numerator (no degradation)
56  corr_ = vtmp;
57 
58  //converting energy values from layers into depths
59  for (unsigned int ieta = 0; ieta < dsegm_.size(); ++ieta) {
60  //fill sum(means(layer,0)) and sum(means(layer,lumi)) for each depth
61  for(unsigned int ilay = 0; ilay < std::min(meanenergies_[ieta].size(),dsegm_[ieta].size()); ++ilay) {
62  int depth = dsegm_[ieta][ilay] - 1; // depth = 0 - not used!
63  nval[ieta][depth] += meanenergies_[ieta][ilay];
64  dval[ieta][depth] += meanenergies_[ieta][ilay]*darkening_->degradation(intlumi_,ieta+ieta_shift_,ilay+1); //be careful of eta and layer numbering
65  }
66 
67  //compute factors, w/ safety checks
68  for(int depth = 0; depth < max_depth_; ++depth){
69  if(dval[ieta][depth] > 0) corr_[ieta][depth] = nval[ieta][depth]/dval[ieta][depth];
70  else corr_[ieta][depth] = 1.0;
71 
72  if(corr_[ieta][depth] < 1.0) corr_[ieta][depth] = 1.0;
73  }
74  }
75 }
size
Write out results.
std::vector< std::vector< int > > dsegm_
std::vector< std::vector< float > > meanenergies_
std::vector< std::vector< float > > corr_
T min(T a, T b)
Definition: MathUtil.h:58
float degradation(float intlumi, int ieta, int lay) const
const HBHEDarkening * darkening_
int HBHERecalibration::maxDepth ( ) const
inline

Definition at line 22 of file HBHERecalibration.h.

References initialize(), and max_depth_.

22 { return max_depth_; }
void HBHERecalibration::setup ( const std::vector< std::vector< int >> &  m_segmentation,
const HBHEDarkening darkening 
)

Definition at line 14 of file HBHERecalibration.cc.

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

Referenced by o2olib.O2OTool::execute().

15 {
16  darkening_ = darkening;
18 
19  //infer eta bounds
20  int min_ieta = ieta_shift_ - 1;
21  int max_ieta = min_ieta + meanenergies_.size();
22  dsegm_.reserve(max_ieta - min_ieta);
23  for(int ieta = min_ieta; ieta < max_ieta; ++ieta){
24  dsegm_.push_back(m_segmentation[ieta]);
25  //find maximum
26  for(unsigned lay = 0; lay < dsegm_.back().size(); ++lay){
27  if(lay>=meanenergies_[0].size()) break;
28  int depth = dsegm_.back()[lay];
29  if(depth>max_depth_) max_depth_ = depth;
30  }
31  }
32 
33  initialize();
34 }
size
Write out results.
std::vector< std::vector< int > > dsegm_
std::vector< std::vector< float > > meanenergies_
int get_ieta_shift() const
Definition: HBHEDarkening.h:50
const HBHEDarkening * darkening_

Member Data Documentation

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

Definition at line 36 of file HBHERecalibration.h.

Referenced by getCorr(), and initialize().

float HBHERecalibration::cutoff_
private

Definition at line 30 of file HBHERecalibration.h.

Referenced by getCorr().

const HBHEDarkening* HBHERecalibration::darkening_
private

Definition at line 34 of file HBHERecalibration.h.

Referenced by initialize(), and setup().

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

Definition at line 35 of file HBHERecalibration.h.

Referenced by initialize(), and setup().

int HBHERecalibration::ieta_shift_
private

Definition at line 31 of file HBHERecalibration.h.

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

float HBHERecalibration::intlumi_
private

Definition at line 29 of file HBHERecalibration.h.

Referenced by initialize().

int HBHERecalibration::max_depth_
private

Definition at line 32 of file HBHERecalibration.h.

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

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

Definition at line 33 of file HBHERecalibration.h.

Referenced by initialize(), and setup().