CMS 3D CMS Logo

HGCalRadiationMap.cc
Go to the documentation of this file.
3 #include <fstream>
4 
5 //
6 HGCalRadiationMap::HGCalRadiationMap() : fluenceSFlog10_(0.) {}
7 
8 //
9 void HGCalRadiationMap::setDoseMap(const std::string& fullpath, const unsigned int algo) {
11  algo_ = algo;
12 }
13 
14 //
16  hgcalGeom_ = static_cast<const HGCalGeometry*>(geom);
19 }
20 
21 //
23  GlobalPoint global = geom()->getPosition(cellId);
24  return std::sqrt(std::pow(global.x(), 2) + std::pow(global.y(), 2));
25 }
26 
27 //
28 double HGCalRadiationMap::getDoseValue(const int subdet, const int layer, const double radius, bool logVal) {
29  std::pair<int, int> key(subdet, layer);
30 
31  double r(radius - doseMap_[key].doff_);
32  double r2(r * r);
33  double r3(r2 * r);
34  double r4(r3 * r);
35 
36  double cellDoseLog10 =
37  doseMap_[key].a_ + doseMap_[key].b_ * r + doseMap_[key].c_ * r2 + doseMap_[key].d_ * r3 + doseMap_[key].e_ * r4;
38 
39  return logVal ? cellDoseLog10 * M_LN10 + log(grayToKrad_) : std::pow(10, cellDoseLog10) * grayToKrad_;
40 }
41 
42 //
43 double HGCalRadiationMap::getFluenceValue(const int subdet, const int layer, const double radius, bool logVal) {
44  std::pair<int, int> key(subdet, layer);
45 
46  double r(radius - doseMap_[key].foff_);
47  double r2(r * r);
48  double r3(r2 * r);
49  double r4(r3 * r);
50 
51  double cellFluenceLog10 =
52  doseMap_[key].f_ + doseMap_[key].g_ * r + doseMap_[key].h_ * r2 + doseMap_[key].i_ * r3 + doseMap_[key].j_ * r4;
53  cellFluenceLog10 += fluenceSFlog10_;
54 
55  return logVal ? cellFluenceLog10 * M_LN10 : std::pow(10, cellFluenceLog10);
56 }
57 
58 //
60  const std::string& fullpath) {
62 
63  //no dose file means no aging
64  if (fullpath.empty())
65  return result;
66 
68  std::ifstream infile(fp.fullPath());
69  if (!infile.is_open()) {
70  throw cms::Exception("FileNotFound") << "Unable to open '" << fullpath << "'" << std::endl;
71  }
73  while (getline(infile, line)) {
74  int subdet;
75  int layer;
76  DoseParameters dosePars;
77 
78  //space-separated
79  std::stringstream linestream(line);
80  linestream >> subdet >> layer >> dosePars.a_ >> dosePars.b_ >> dosePars.c_ >> dosePars.d_ >> dosePars.e_ >>
81  dosePars.doff_ >> dosePars.f_ >> dosePars.g_ >> dosePars.h_ >> dosePars.i_ >> dosePars.j_ >> dosePars.foff_;
82 
83  std::pair<int, int> key(subdet, layer);
84  result[key] = dosePars;
85  }
86  return result;
87 }
HGCalRadiationMap::HGCalRadiationMap
HGCalRadiationMap()
Definition: HGCalRadiationMap.cc:6
HGCalRadiationMap::DoseParameters::doff_
double doff_
Definition: HGCalRadiationMap.h:19
HGCalTopology::dddConstants
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:98
HGCalRadiationMap::readDosePars
doseParametersMap readDosePars(const std::string &)
Definition: HGCalRadiationMap.cc:59
HGCalRadiationMap::doseMap_
doseParametersMap doseMap_
Definition: HGCalRadiationMap.h:50
reco_skim_cfg_mod.fullpath
fullpath
Definition: reco_skim_cfg_mod.py:202
HGCalRadiationMap::DoseParameters::a_
double a_
Definition: HGCalRadiationMap.h:19
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
HGCalRadiationMap::doseParametersMap
std::map< std::pair< int, int >, DoseParameters > doseParametersMap
Definition: HGCalRadiationMap.h:23
HGCalRadiationMap::algo
const unsigned int & algo()
Definition: HGCalRadiationMap.h:35
HGCalRadiationMap::geom
const HGCalGeometry * geom()
Definition: HGCalRadiationMap.h:36
HGCalRadiationMap::getDoseValue
double getDoseValue(const int, const int, const double, bool logVal=false)
Definition: HGCalRadiationMap.cc:28
HGCalRadiationMap::DoseParameters::d_
double d_
Definition: HGCalRadiationMap.h:19
HGCalRadiationMap::hgcalGeom_
const HGCalGeometry * hgcalGeom_
Definition: HGCalRadiationMap.h:47
personalPlayback.fp
fp
Definition: personalPlayback.py:523
HGCalRadiationMap::setGeometry
void setGeometry(const CaloSubdetectorGeometry *)
Definition: HGCalRadiationMap.cc:15
HGCalRadiationMap::DoseParameters::h_
double h_
Definition: HGCalRadiationMap.h:19
FileInPath.h
HGCalRadiationMap::DoseParameters::e_
double e_
Definition: HGCalRadiationMap.h:19
HGCalRadiationMap::hgcalDDD_
const HGCalDDDConstants * hgcalDDD_
Definition: HGCalRadiationMap.h:49
cmsdt::algo
algo
Definition: constants.h:165
edm::FileInPath
Definition: FileInPath.h:64
HGCalRadiationMap::DoseParameters::g_
double g_
Definition: HGCalRadiationMap.h:19
HGCalRadiationMap.h
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HGCalRadiationMap::DoseParameters::c_
double c_
Definition: HGCalRadiationMap.h:19
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
HGCalRadiationMap::fluenceSFlog10_
double fluenceSFlog10_
Definition: HGCalRadiationMap.h:53
HGCalRadiationMap::DoseParameters::f_
double f_
Definition: HGCalRadiationMap.h:19
Point3DBase< float, GlobalTag >
HGCalGeometry::topology
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:111
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HGCalRadiationMap::grayToKrad_
const double grayToKrad_
Definition: HGCalRadiationMap.h:52
HGCalRadiationMap::setDoseMap
void setDoseMap(const std::string &, const unsigned int)
Definition: HGCalRadiationMap.cc:9
diffTwoXMLs.r2
r2
Definition: diffTwoXMLs.py:73
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
HGCalRadiationMap::DoseParameters::j_
double j_
Definition: HGCalRadiationMap.h:19
HGCalRadiationMap::DoseParameters::i_
double i_
Definition: HGCalRadiationMap.h:19
HGCalGeometry::getPosition
GlobalPoint getPosition(const DetId &id) const
Definition: HGCalGeometry.cc:198
HGCalRadiationMap::DoseParameters::foff_
double foff_
Definition: HGCalRadiationMap.h:19
alignCSCRings.r
r
Definition: alignCSCRings.py:93
HGCalRadiationMap::getFluenceValue
double getFluenceValue(const int, const int, const double, bool logVal=false)
Definition: HGCalRadiationMap.cc:43
HGCalRadiationMap::algo_
unsigned int algo_
Definition: HGCalRadiationMap.h:46
HGCScintillatorDetId
Definition: HGCScintillatorDetId.h:23
HGCalRadiationMap::DoseParameters
Definition: HGCalRadiationMap.h:16
Exception
Definition: hltDiff.cc:245
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
HGCalRadiationMap::hgcalTopology_
const HGCalTopology * hgcalTopology_
Definition: HGCalRadiationMap.h:48
HGCalRadiationMap::computeRadius
double computeRadius(const HGCScintillatorDetId &)
Definition: HGCalRadiationMap.cc:22
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
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
HGCalRadiationMap::DoseParameters::b_
double b_
Definition: HGCalRadiationMap.h:19
mps_splice.line
line
Definition: mps_splice.py:76
crabWrapper.key
key
Definition: crabWrapper.py:19