CMS 3D CMS Logo

HGCalSiNoiseMap.cc
Go to the documentation of this file.
2 
3 //
5  : encpScale_(840.),
6  encCommonNoiseSub_(sqrt(1.25)),
7  qe2fc_(1.60217646E-4),
8  ignoreFluence_(false),
9  ignoreCCE_(false),
10  ignoreNoise_(false) {
11  encsParam_.push_back({636., 15.6, 0.0328}); // q80fC: II order polynomial coefficients
12  chargeAtFullScaleADCPerGain_.push_back(80.); // the num of fC (charge) which corresponds to the max ADC value
13  encsParam_.push_back({1045., 8.74, 0.0685}); // q160fC
14  chargeAtFullScaleADCPerGain_.push_back(160.);
15  encsParam_.push_back({1915., 2.79, 0.0878}); // q320fC
16  chargeAtFullScaleADCPerGain_.push_back(320.);
17 
18  // adc has 10 bits -> 1024 counts at max ( >0 baseline to be handled)
19  for (auto i : chargeAtFullScaleADCPerGain_)
20  lsbPerGain_.push_back(i / 1024.);
21 
22  //fine sensors: 120 mum - 67: MPV of charge[number of e-]/mum for a mip in silicon; srouce PDG
23  const double mipEqfC_120 = 120. * 67. * qe2fc_;
24  mipEqfC_[0] = mipEqfC_120;
25  const double cellCapacitance_120 = 50;
26  cellCapacitance_[0] = cellCapacitance_120;
27  const double cellVolume_120 = 0.52 * (120.e-4);
28  cellVolume_[0] = cellVolume_120;
29 
30  //thin sensors: 200 mum
31  const double mipEqfC_200 = 200. * 70. * qe2fc_;
32  mipEqfC_[1] = mipEqfC_200;
33  const double cellCapacitance_200 = 65;
34  cellCapacitance_[1] = cellCapacitance_200;
35  const double cellVolume_200 = 1.18 * (200.e-4);
36  cellVolume_[1] = cellVolume_200;
37 
38  //thick sensors: 300 mum
39  const double mipEqfC_300 = 300. * 73. * qe2fc_;
40  mipEqfC_[2] = mipEqfC_300;
41  const double cellCapacitance_300 = 45;
42  cellCapacitance_[2] = cellCapacitance_300;
43  const double cellVolume_300 = 1.18 * (300.e-4);
44  cellVolume_[2] = cellVolume_300;
45 }
46 
47 //
48 void HGCalSiNoiseMap::setDoseMap(const std::string &fullpath, const unsigned int &algo) {
49  //decode bits in the algo word
50  ignoreFluence_ = ((algo >> FLUENCE) & 0x1);
51  ignoreCCE_ = ((algo >> CCE) & 0x1);
52  ignoreNoise_ = ((algo >> NOISE) & 0x1);
53 
54  //call base class method
55  HGCalRadiationMap::setDoseMap(fullpath, algo);
56 }
57 
58 //
61  int aimMIPtoADC) {
63 
64  //decode cell properties
65  int layer(cellId.layer());
66  unsigned int cellThick = cellId.type();
67  double cellCap(cellCapacitance_[cellThick]);
68  double cellVol(cellVolume_[cellThick]);
69 
70  //leakage current and CCE [muA]
71  if (ignoreFluence_) {
72  siop.fluence = 0;
73  siop.lnfluence = -1;
74  siop.ileak = exp(ileakParam_[1]) * cellVol * unitToMicro_;
75  siop.cce = 1;
76  } else {
77  if (getDoseMap().empty()) {
78  throw cms::Exception("BadConfiguration")
79  << " Fluence is required but no DoseMap has been passed to HGCalSiNoiseMap";
80  return siop;
81  }
82 
83  //compute the radius here
84  auto xy(ddd()->locateCell(
85  cellId.layer(), cellId.waferU(), cellId.waferV(), cellId.cellU(), cellId.cellV(), true, true));
86  double radius2 = std::pow(xy.first, 2) + std::pow(xy.second, 2); //in cm
87 
88  double radius = sqrt(radius2);
89  double radius3 = radius * radius2;
90  double radius4 = pow(radius2, 2);
91  radiiVec radii{{radius, radius2, radius3, radius4, 0., 0., 0., 0.}};
92  siop.fluence = getFluenceValue(cellId.subdet(), layer, radii);
93  siop.lnfluence = log(siop.fluence);
94  siop.ileak = exp(ileakParam_[0] * siop.lnfluence + ileakParam_[1]) * cellVol * unitToMicro_;
95 
96  if (ignoreCCE_) {
97  siop.cce = 1.0;
98  } else {
99  //lin+log parametrization
100  //cceParam_ are parameters as defined in equation (2) of DN-19-045
101  siop.cce = siop.fluence <= cceParam_[cellThick][0] ? 1. + cceParam_[cellThick][1] * siop.fluence
102  : (1. - cceParam_[cellThick][2] * siop.lnfluence) +
103  (cceParam_[cellThick][1] * cceParam_[cellThick][0] +
104  cceParam_[cellThick][2] * log(cceParam_[cellThick][0]));
105  siop.cce = std::max(0., siop.cce);
106  }
107  }
108 
109  //determine the gain to apply accounting for cce
110  //move computation to ROC level (one day)
111  double S(siop.cce * mipEqfC_[cellThick]);
112  if (gain == GainRange_t::AUTO) {
113  double desiredLSB(S / aimMIPtoADC);
114  std::vector<double> diffToPhysLSB = {fabs(desiredLSB - lsbPerGain_[GainRange_t::q80fC]),
115  fabs(desiredLSB - lsbPerGain_[GainRange_t::q160fC]),
116  fabs(desiredLSB - lsbPerGain_[GainRange_t::q320fC])};
117  size_t gainIdx = std::min_element(diffToPhysLSB.begin(), diffToPhysLSB.end()) - diffToPhysLSB.begin();
118  gain = HGCalSiNoiseMap::q80fC;
119  if (gainIdx == 1)
121  if (gainIdx == 2)
123  }
124 
125  //fill in the parameters of the struct
126  siop.gain = gain;
127  siop.mipfC = S;
128  siop.mipADC = std::floor(S / lsbPerGain_[gain]);
129  siop.thrADC = std::floor(S / 2. / lsbPerGain_[gain]);
130 
131  //build noise estimate
132  if (ignoreNoise_) {
133  siop.noise = 0.0;
134  } else {
135  double enc_s(encsParam_[gain][0] + encsParam_[gain][1] * cellCap + encsParam_[gain][2] * pow(cellCap, 2));
136  double enc_p(encpScale_ * sqrt(siop.ileak));
137  siop.noise = hypot(enc_p, enc_s * encCommonNoiseSub_) * qe2fc_;
138  }
139 
140  return siop;
141 }
double getFluenceValue(const int, const int, const radiiVec &, bool logVal=false)
std::array< double, 8 > radiiVec
const unsigned int & algo()
std::vector< std::vector< double > > cceParam_
std::vector< double > chargeAtFullScaleADCPerGain_
int waferU() const
int cellV() const
int cellU() const
get the cell #&#39;s in u,v or in x,y
void setDoseMap(const std::string &, const unsigned int &)
overrides base class method with specifics for the configuration of the algo
DetId::Detector subdet() const
get the subdetector
SiCellOpCharacteristics getSiCellOpCharacteristics(const HGCSiliconDetId &did, GainRange_t gain=GainRange_t::AUTO, int aimMIPtoADC=10)
returns the charge collection efficiency and noise if gain range is set to auto, it will find the mos...
int type() const
get the type
T sqrt(T t)
Definition: SSEVec.h:19
int layer() const
get the layer #
int waferV() const
std::array< double, 3 > cellCapacitance_
std::array< double, 3 > mipEqfC_
std::vector< std::vector< double > > encsParam_
const double encCommonNoiseSub_
double S(const TLorentzVector &, const TLorentzVector &)
Definition: Particle.cc:97
void setDoseMap(const std::string &, const unsigned int)
const double encpScale_
const HGCalDDDConstants * ddd()
const doseParametersMap & getDoseMap()
std::array< double, 3 > cellVolume_
const double unitToMicro_
const double qe2fc_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
std::vector< double > ileakParam_
std::vector< double > lsbPerGain_