CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
HGCalRadiationMap Class Reference

parses a txt file with dose/fluence parameters and provides functions for noise, etc. More...

#include <HGCalRadiationMap.h>

Inheritance diagram for HGCalRadiationMap:
HGCalSciNoiseMap HGCalSiNoiseMap< T > HGCalSiNoiseMap< HFNoseDetId > HGCalSiNoiseMap< HGCSiliconDetId >

Classes

struct  DoseParameters
 

Public Types

typedef std::map< std::pair< int, int >, DoseParametersdoseParametersMap
 

Public Member Functions

const unsigned int & algo ()
 
double computeRadius (const HGCScintillatorDetId &)
 
const HGCalDDDConstantsddd ()
 
const HGCalGeometrygeom ()
 
const doseParametersMapgetDoseMap ()
 
double getDoseValue (const int, const int, const double, bool logVal=false)
 
double getFluenceValue (const int, const int, const double, bool logVal=false)
 
 HGCalRadiationMap ()
 
void setDoseMap (const std::string &, const unsigned int)
 
void setFluenceScaleFactor (double val)
 
void setGeometry (const CaloSubdetectorGeometry *)
 
const HGCalTopologytopo ()
 
 ~HGCalRadiationMap ()
 

Private Member Functions

doseParametersMap readDosePars (const std::string &)
 

Private Attributes

unsigned int algo_
 
doseParametersMap doseMap_
 
double fluenceSFlog10_
 
const double grayToKrad_ = 0.1
 
const HGCalDDDConstantshgcalDDD_
 
const HGCalGeometryhgcalGeom_
 
const HGCalTopologyhgcalTopology_
 

Detailed Description

parses a txt file with dose/fluence parameters and provides functions for noise, etc.

Definition at line 14 of file HGCalRadiationMap.h.

Member Typedef Documentation

◆ doseParametersMap

typedef std::map<std::pair<int, int>, DoseParameters> HGCalRadiationMap::doseParametersMap

Definition at line 23 of file HGCalRadiationMap.h.

Constructor & Destructor Documentation

◆ HGCalRadiationMap()

HGCalRadiationMap::HGCalRadiationMap ( )

Definition at line 6 of file HGCalRadiationMap.cc.

6 : fluenceSFlog10_(0.) {}

◆ ~HGCalRadiationMap()

HGCalRadiationMap::~HGCalRadiationMap ( )
inline

Definition at line 23 of file HGCalRadiationMap.h.

23 {};

Member Function Documentation

◆ algo()

const unsigned int& HGCalRadiationMap::algo ( )
inline

Definition at line 35 of file HGCalRadiationMap.h.

References algo_.

Referenced by setDoseMap(), and HGCalSciNoiseMap::setDoseMap().

35 { return algo_; }

◆ computeRadius()

double HGCalRadiationMap::computeRadius ( const HGCScintillatorDetId cellId)

Definition at line 22 of file HGCalRadiationMap.cc.

References geom(), HGCalGeometry::getPosition(), funct::pow(), mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by HGCHEbackDigitizer::runRealisticDigitizer().

22  {
23  GlobalPoint global = geom()->getPosition(cellId);
24  return std::sqrt(std::pow(global.x(), 2) + std::pow(global.y(), 2));
25 }
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
T sqrt(T t)
Definition: SSEVec.h:19
GlobalPoint getPosition(const DetId &id, bool debug=false) const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
const HGCalGeometry * geom()

◆ ddd()

const HGCalDDDConstants* HGCalRadiationMap::ddd ( )
inline

Definition at line 38 of file HGCalRadiationMap.h.

References hgcalDDD_.

38 { return hgcalDDD_; }
const HGCalDDDConstants * hgcalDDD_

◆ geom()

const HGCalGeometry* HGCalRadiationMap::geom ( )
inline

Definition at line 36 of file HGCalRadiationMap.h.

References hgcalGeom_.

Referenced by computeRadius(), and setGeometry().

36 { return hgcalGeom_; }
const HGCalGeometry * hgcalGeom_

◆ getDoseMap()

const doseParametersMap& HGCalRadiationMap::getDoseMap ( )
inline

Definition at line 40 of file HGCalRadiationMap.h.

References doseMap_.

Referenced by HGCalSciNoiseMap::scaleByDose().

40 { return doseMap_; }
doseParametersMap doseMap_

◆ getDoseValue()

double HGCalRadiationMap::getDoseValue ( const int  subdet,
const int  layer,
const double  radius,
bool  logVal = false 
)

Definition at line 28 of file HGCalRadiationMap.cc.

References doseMap_, grayToKrad_, crabWrapper::key, phase1PixelTopology::layer, dqm-mbProfile::log, funct::pow(), alignCSCRings::r, diffTwoXMLs::r2, and CosmicsPD_Skims::radius.

Referenced by HGCalSciNoiseMap::scaleByDose().

28  {
29  std::pair<int, int> key(subdet, layer);
30 
31  if (doseMap_.find(key) == doseMap_.end()) {
32  return logVal ? -10. : 0.;
33  }
34 
35  double r(radius - doseMap_[key].doff_);
36  double r2(r * r);
37  double r3(r2 * r);
38  double r4(r3 * r);
39 
40  double cellDoseLog10 =
41  doseMap_[key].a_ + doseMap_[key].b_ * r + doseMap_[key].c_ * r2 + doseMap_[key].d_ * r3 + doseMap_[key].e_ * r4;
42 
43  return logVal ? cellDoseLog10 * M_LN10 + log(grayToKrad_) : std::pow(10, cellDoseLog10) * grayToKrad_;
44 }
constexpr std::array< uint8_t, layerIndexSize > layer
const double grayToKrad_
doseParametersMap doseMap_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ getFluenceValue()

double HGCalRadiationMap::getFluenceValue ( const int  subdet,
const int  layer,
const double  radius,
bool  logVal = false 
)

Definition at line 47 of file HGCalRadiationMap.cc.

References doseMap_, fluenceSFlog10_, crabWrapper::key, phase1PixelTopology::layer, funct::pow(), alignCSCRings::r, diffTwoXMLs::r2, and CosmicsPD_Skims::radius.

Referenced by HGCalSciNoiseMap::scaleByDose().

47  {
48  std::pair<int, int> key(subdet, layer);
49 
50  double r(radius - doseMap_[key].foff_);
51  double r2(r * r);
52  double r3(r2 * r);
53  double r4(r3 * r);
54 
55  double cellFluenceLog10 =
56  doseMap_[key].f_ + doseMap_[key].g_ * r + doseMap_[key].h_ * r2 + doseMap_[key].i_ * r3 + doseMap_[key].j_ * r4;
57  cellFluenceLog10 += fluenceSFlog10_;
58 
59  return logVal ? cellFluenceLog10 * M_LN10 : std::pow(10, cellFluenceLog10);
60 }
constexpr std::array< uint8_t, layerIndexSize > layer
doseParametersMap doseMap_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ readDosePars()

std::map< std::pair< int, int >, HGCalRadiationMap::DoseParameters > HGCalRadiationMap::readDosePars ( const std::string &  fullpath)
private

Definition at line 63 of file HGCalRadiationMap.cc.

References HGCalRadiationMap::DoseParameters::a_, HGCalRadiationMap::DoseParameters::b_, HGCalRadiationMap::DoseParameters::c_, HGCalRadiationMap::DoseParameters::d_, HGCalRadiationMap::DoseParameters::doff_, HGCalRadiationMap::DoseParameters::e_, Exception, HGCalRadiationMap::DoseParameters::f_, HGCalRadiationMap::DoseParameters::foff_, personalPlayback::fp, reco_skim_cfg_mod::fullpath, HGCalRadiationMap::DoseParameters::g_, HGCalRadiationMap::DoseParameters::h_, HGCalRadiationMap::DoseParameters::i_, timingPdfMaker::infile, HGCalRadiationMap::DoseParameters::j_, crabWrapper::key, phase1PixelTopology::layer, mps_splice::line, mps_fire::result, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by setDoseMap().

64  {
66 
67  //no dose file means no aging
68  if (fullpath.empty())
69  return result;
70 
72  std::ifstream infile(fp.fullPath());
73  if (!infile.is_open()) {
74  throw cms::Exception("FileNotFound") << "Unable to open '" << fullpath << "'" << std::endl;
75  }
77  while (getline(infile, line)) {
78  int subdet;
79  int layer;
80  DoseParameters dosePars;
81 
82  //space-separated
83  std::stringstream linestream(line);
84  linestream >> subdet >> layer >> dosePars.a_ >> dosePars.b_ >> dosePars.c_ >> dosePars.d_ >> dosePars.e_ >>
85  dosePars.doff_ >> dosePars.f_ >> dosePars.g_ >> dosePars.h_ >> dosePars.i_ >> dosePars.j_ >> dosePars.foff_;
86 
87  std::pair<int, int> key(subdet, layer);
88  result[key] = dosePars;
89  }
90  return result;
91 }
std::map< std::pair< int, int >, DoseParameters > doseParametersMap
constexpr std::array< uint8_t, layerIndexSize > layer

◆ setDoseMap()

void HGCalRadiationMap::setDoseMap ( const std::string &  fullpath,
const unsigned int  algo 
)

Definition at line 9 of file HGCalRadiationMap.cc.

References algo(), algo_, doseMap_, reco_skim_cfg_mod::fullpath, and readDosePars().

Referenced by HGCalSciNoiseMap::setDoseMap().

9  {
11  algo_ = algo;
12 }
doseParametersMap readDosePars(const std::string &)
const unsigned int & algo()
doseParametersMap doseMap_

◆ setFluenceScaleFactor()

void HGCalRadiationMap::setFluenceScaleFactor ( double  val)
inline

◆ setGeometry()

void HGCalRadiationMap::setGeometry ( const CaloSubdetectorGeometry geom)

Definition at line 15 of file HGCalRadiationMap.cc.

References HGCalTopology::dddConstants(), geom(), hgcalDDD_, hgcalGeom_, hgcalTopology_, and HGCalGeometry::topology().

Referenced by HGCHEbackDigitizer::runRealisticDigitizer().

15  {
16  hgcalGeom_ = static_cast<const HGCalGeometry*>(geom);
19 }
const HGCalGeometry * hgcalGeom_
const HGCalDDDConstants * hgcalDDD_
const HGCalTopology & topology() const
const HGCalTopology * hgcalTopology_
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:98
const HGCalGeometry * geom()

◆ topo()

const HGCalTopology* HGCalRadiationMap::topo ( )
inline

Definition at line 37 of file HGCalRadiationMap.h.

References hgcalTopology_.

37 { return hgcalTopology_; }
const HGCalTopology * hgcalTopology_

Member Data Documentation

◆ algo_

unsigned int HGCalRadiationMap::algo_
private

Definition at line 46 of file HGCalRadiationMap.h.

Referenced by algo(), and setDoseMap().

◆ doseMap_

doseParametersMap HGCalRadiationMap::doseMap_
private

Definition at line 50 of file HGCalRadiationMap.h.

Referenced by getDoseMap(), getDoseValue(), getFluenceValue(), and setDoseMap().

◆ fluenceSFlog10_

double HGCalRadiationMap::fluenceSFlog10_
private

Definition at line 53 of file HGCalRadiationMap.h.

Referenced by getFluenceValue(), and setFluenceScaleFactor().

◆ grayToKrad_

const double HGCalRadiationMap::grayToKrad_ = 0.1
private

Definition at line 52 of file HGCalRadiationMap.h.

Referenced by getDoseValue().

◆ hgcalDDD_

const HGCalDDDConstants* HGCalRadiationMap::hgcalDDD_
private

Definition at line 49 of file HGCalRadiationMap.h.

Referenced by ddd(), and setGeometry().

◆ hgcalGeom_

const HGCalGeometry* HGCalRadiationMap::hgcalGeom_
private

Definition at line 47 of file HGCalRadiationMap.h.

Referenced by geom(), and setGeometry().

◆ hgcalTopology_

const HGCalTopology* HGCalRadiationMap::hgcalTopology_
private

Definition at line 48 of file HGCalRadiationMap.h.

Referenced by setGeometry(), and topo().