CMS 3D CMS Logo

HGCalRadiationMap.cc
Go to the documentation of this file.
3 #include <fstream>
4 
5 //
6 void HGCalRadiationMap::setDoseMap(const std::string& fullpath, const unsigned int algo) {
8  algo_ = algo;
9 }
10 
11 //
13  hgcalGeom_ = static_cast<const HGCalGeometry*>(geom);
16 }
17 
18 //
19 double HGCalRadiationMap::getDoseValue(const int subdet, const int layer, const radiiVec& radius, bool logVal) {
20  std::pair<int, int> key(subdet, layer);
21  double cellDoseLog10 = doseMap_[key].a_ + doseMap_[key].b_ * radius[4] + doseMap_[key].c_ * radius[5] +
22  doseMap_[key].d_ * radius[6] + doseMap_[key].e_ * radius[7];
23  return logVal ? cellDoseLog10 * M_LN10 + log(grayToKrad_) : std::pow(10, cellDoseLog10) * grayToKrad_;
24 }
25 
26 //
27 double HGCalRadiationMap::getFluenceValue(const int subdet, const int layer, const radiiVec& radius, bool logVal) {
28  std::pair<int, int> key(subdet, layer);
29  double cellFluenceLog10 = doseMap_[key].f_ + doseMap_[key].g_ * radius[0] + doseMap_[key].h_ * radius[1] +
30  doseMap_[key].i_ * radius[2] + doseMap_[key].j_ * radius[3];
31  return logVal ? cellFluenceLog10 * M_LN10 : std::pow(10, cellFluenceLog10);
32 }
33 
34 //
36  const std::string& fullpath) {
38 
39  //no dose file means no aging
40  if (fullpath.empty())
41  return result;
42 
44  std::ifstream infile(fp.fullPath());
45  if (!infile.is_open()) {
46  throw cms::Exception("FileNotFound") << "Unable to open '" << fullpath << "'" << std::endl;
47  }
49  while (getline(infile, line)) {
50  int subdet;
51  int layer;
52  DoseParameters dosePars;
53 
54  //space-separated
55  std::stringstream linestream(line);
56  linestream >> subdet >> layer >> dosePars.a_ >> dosePars.b_ >> dosePars.c_ >> dosePars.d_ >> dosePars.e_ >>
57  dosePars.f_ >> dosePars.g_ >> dosePars.h_ >> dosePars.i_ >> dosePars.j_;
58 
59  std::pair<int, int> key(subdet, layer);
60  result[key] = dosePars;
61  }
62  return result;
63 }
radiiVec
std::array< double, 8 > radiiVec
Definition: HGCalRadiationMap.h:10
HGCalTopology::dddConstants
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:98
HGCalRadiationMap::readDosePars
doseParametersMap readDosePars(const std::string &)
Definition: HGCalRadiationMap.cc:35
HGCalRadiationMap::doseMap_
doseParametersMap doseMap_
Definition: HGCalRadiationMap.h:48
HGCalRadiationMap::getFluenceValue
double getFluenceValue(const int, const int, const radiiVec &, bool logVal=false)
Definition: HGCalRadiationMap.cc:27
reco_skim_cfg_mod.fullpath
fullpath
Definition: reco_skim_cfg_mod.py:202
HGCalRadiationMap::DoseParameters::a_
double a_
Definition: HGCalRadiationMap.h:20
HGCalRadiationMap::doseParametersMap
std::map< std::pair< int, int >, DoseParameters > doseParametersMap
Definition: HGCalRadiationMap.h:24
HGCalRadiationMap::algo
const unsigned int & algo()
Definition: HGCalRadiationMap.h:34
HGCalRadiationMap::geom
const HGCalGeometry * geom()
Definition: HGCalRadiationMap.h:35
HGCalRadiationMap::DoseParameters::d_
double d_
Definition: HGCalRadiationMap.h:20
HGCalRadiationMap::hgcalGeom_
const HGCalGeometry * hgcalGeom_
Definition: HGCalRadiationMap.h:45
personalPlayback.fp
fp
Definition: personalPlayback.py:523
HGCalRadiationMap::setGeometry
void setGeometry(const CaloSubdetectorGeometry *)
Definition: HGCalRadiationMap.cc:12
HGCalRadiationMap::DoseParameters::h_
double h_
Definition: HGCalRadiationMap.h:20
FileInPath.h
HGCalRadiationMap::DoseParameters::e_
double e_
Definition: HGCalRadiationMap.h:20
HGCalRadiationMap::hgcalDDD_
const HGCalDDDConstants * hgcalDDD_
Definition: HGCalRadiationMap.h:47
cmsdt::algo
algo
Definition: constants.h:164
edm::FileInPath
Definition: FileInPath.h:64
HGCalRadiationMap::DoseParameters::g_
double g_
Definition: HGCalRadiationMap.h:20
HGCalRadiationMap.h
HGCalRadiationMap::DoseParameters::c_
double c_
Definition: HGCalRadiationMap.h:20
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
HGCalRadiationMap::DoseParameters::f_
double f_
Definition: HGCalRadiationMap.h:20
HGCalGeometry::topology
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:112
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HGCalRadiationMap::grayToKrad_
const double grayToKrad_
Definition: HGCalRadiationMap.h:50
HGCalRadiationMap::setDoseMap
void setDoseMap(const std::string &, const unsigned int)
Definition: HGCalRadiationMap.cc:6
HGCalRadiationMap::DoseParameters::j_
double j_
Definition: HGCalRadiationMap.h:20
HGCalRadiationMap::DoseParameters::i_
double i_
Definition: HGCalRadiationMap.h:20
HGCalRadiationMap::getDoseValue
double getDoseValue(const int, const int, const radiiVec &, bool logVal=false)
Definition: HGCalRadiationMap.cc:19
HGCalRadiationMap::algo_
unsigned int algo_
Definition: HGCalRadiationMap.h:44
HGCalRadiationMap::DoseParameters
Definition: HGCalRadiationMap.h:18
Exception
Definition: hltDiff.cc:246
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
HGCalRadiationMap::hgcalTopology_
const HGCalTopology * hgcalTopology_
Definition: HGCalRadiationMap.h:46
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:30
mps_fire.result
result
Definition: mps_fire.py:303
HGCalRadiationMap::DoseParameters::b_
double b_
Definition: HGCalRadiationMap.h:20
mps_splice.line
line
Definition: mps_splice.py:76
crabWrapper.key
key
Definition: crabWrapper.py:19