CMS 3D CMS Logo

Functions
CastorSimpleRecAlgoImpl Namespace Reference

Functions

template<class Digi , class RecHit >
bool corrSaturation (RecHit &rechit, const CastorCoder &coder, const CastorCalibrations &calibs, const Digi &digi, const int &maxADCvalue, const double &satCorrConst, int ifirst, int n)
 
template<class Digi >
bool isSaturated (const Digi &digi, const int &maxADCvalue, int ifirst, int n)
 
template<class Digi , class RecHit >
RecHit reco (const Digi &digi, const CastorCoder &coder, const CastorCalibrations &calibs, int ifirst, int n, bool slewCorrect, const CastorPulseContainmentCorrection *corr, CastorTimeSlew::BiasSetting slewFlavor)
 

Function Documentation

◆ corrSaturation()

template<class Digi , class RecHit >
bool CastorSimpleRecAlgoImpl::corrSaturation ( RecHit &  rechit,
const CastorCoder coder,
const CastorCalibrations calibs,
const Digi &  digi,
const int &  maxADCvalue,
const double &  satCorrConst,
int  ifirst,
int  n 
)
inline

Definition at line 109 of file CastorSimpleRecAlgo.cc.

116  {
117  // correction works only with 2 used TS
118  if (n != 2)
119  return false;
120 
121  // to avoid segmentation violation
122  if (ifirst + n > digi.size())
123  return false;
124 
125  // look if first TS is saturated not the second one
126  // in case the second one is saturated do no correction
127  if (digi[ifirst].adc() >= maxADCvalue && digi[ifirst + 1].adc() < maxADCvalue) {
128  float ampl = 0;
129 
130  CaloSamples tool;
131  coder.adc2fC(digi, tool);
132 
133  // get energy of first TS
134  int capid = digi[ifirst].capid();
135  float ta = tool[ifirst] - calibs.pedestal(capid); // pedestal subtraction
136  float ta1 = ta * calibs.gain(capid); // fC --> GeV
137 
138  // get energy of second TS
139  capid = digi[ifirst + 1].capid();
140  ta = tool[ifirst + 1] - calibs.pedestal(capid); // pedestal subtraction
141  float ta2 = ta * calibs.gain(capid); // fC --> GeV
142 
143  // use second TS to calc the first one
144  // check if recalculated TS ampl is
145  // realy greater than the saturated value
146  if (ta2 / satCorrConst <= ta1)
147  return false;
148 
149  // ampl = TS5 + TS4 => TS4 = TS5 / TSratio
150  // ampl = TS5 + TS5 / TSratio
151  ampl = ta2 + ta2 / satCorrConst;
152 
153  // reset energy of rechit
154  rechit.setEnergy(ampl);
155 
156  return true;
157  }
158 
159  return false;
160  }

References ecalLiteDTU::adc(), CastorCoder::adc2fC(), CastorCalibrations::gain(), castor_dqm_sourceclient-live_cfg::maxADCvalue, dqmiodumpmetadata::n, and CastorCalibrations::pedestal().

◆ isSaturated()

template<class Digi >
bool CastorSimpleRecAlgoImpl::isSaturated ( const Digi &  digi,
const int &  maxADCvalue,
int  ifirst,
int  n 
)
inline

◆ reco()

template<class Digi , class RecHit >
RecHit CastorSimpleRecAlgoImpl::reco ( const Digi &  digi,
const CastorCoder coder,
const CastorCalibrations calibs,
int  ifirst,
int  n,
bool  slewCorrect,
const CastorPulseContainmentCorrection corr,
CastorTimeSlew::BiasSetting  slewFlavor 
)
inline

Definition at line 32 of file CastorSimpleRecAlgo.cc.

39  {
40  CaloSamples tool;
41  coder.adc2fC(digi, tool);
42 
43  double ampl = 0;
44  int maxI = -1;
45  double maxA = -1e10;
46  float ta = 0;
47  double fc_ampl = 0;
48  for (int i = ifirst; i < tool.size() && i < n + ifirst; i++) {
49  int capid = digi[i].capid();
50  ta = (tool[i] - calibs.pedestal(capid)); // pedestal subtraction
51  fc_ampl += ta;
52  ta *= calibs.gain(capid); // fC --> GeV
53  ampl += ta;
54  if (ta > maxA) {
55  maxA = ta;
56  maxI = i;
57  }
58  }
59 
60  float time = -9999;
62  if (maxI == 0 || maxI == (tool.size() - 1)) {
63  // supress warning and use dummy time value for 2009 data
64  /*
65  edm::LogWarning("HCAL/CASTOR Pulse") << "CastorSimpleRecAlgo::reconstruct :"
66  << " Invalid max amplitude position, "
67  << " max Amplitude: "<< maxI
68  << " first: "<<ifirst
69  << " last: "<<(tool.size()-1)
70  << std::endl;
71  */
72  } else {
73  maxA = fabs(maxA);
74  int capid = digi[maxI - 1].capid();
75  float t0 = fabs((tool[maxI - 1] - calibs.pedestal(capid)) * calibs.gain(capid));
76  capid = digi[maxI + 1].capid();
77  float t2 = fabs((tool[maxI + 1] - calibs.pedestal(capid)) * calibs.gain(capid));
78  float wpksamp = (t0 + maxA + t2);
79  if (wpksamp != 0)
80  wpksamp = (maxA + 2.0 * t2) / wpksamp;
81  time = (maxI - digi.presamples()) * 25.0 + timeshift_ns_hf(wpksamp);
82 
83  if (corr != nullptr) {
84  // Apply phase-based amplitude correction:
85  ampl *= corr->getCorrection(fc_ampl);
86  // std::cout << fc_ampl << " --> " << corr->getCorrection(fc_ampl) << std::endl;
87  }
88 
89  if (slewCorrect)
90  time -= CastorTimeSlew::delay(std::max(1.0, fc_ampl), slewFlavor);
91  }
92  return RecHit(digi.id(), ampl, time);
93  }

References CastorCoder::adc2fC(), alignCSCRings::corr, CastorTimeSlew::delay(), CastorCalibrations::gain(), mps_fire::i, SiStripPI::max, findQualityFiles::maxI, dqmiodumpmetadata::n, CastorCalibrations::pedestal(), CaloSamples::size(), FrontierCondition_GT_autoExpress_cfi::t0, RandomServiceHelper::t2, ntuplemaker::time, and timeshift_ns_hf().

RandomServiceHelper.t2
t2
Definition: RandomServiceHelper.py:257
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
CastorCalibrations::pedestal
double pedestal(int fCapId) const
get pedestal for capid=0..3
Definition: CastorCalibrations.h:16
CastorTimeSlew::delay
static double delay(double fC, BiasSetting bias=Medium)
Returns the amount (ns) by which a pulse of the given number of fC will be delayed by the timeslew ef...
Definition: CastorTimeSlew.cc:9
CaloSamples::size
int size() const
get the size
Definition: CaloSamples.h:24
CastorCoder::adc2fC
virtual void adc2fC(const CastorDataFrame &df, CaloSamples &lf) const =0
findQualityFiles.maxI
int maxI
Definition: findQualityFiles.py:182
ecalLiteDTU::adc
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
Definition: EcalLiteDTUSample.h:12
FrontierCondition_GT_autoExpress_cfi.t0
t0
Definition: FrontierCondition_GT_autoExpress_cfi.py:148
alignCSCRings.corr
dictionary corr
Definition: alignCSCRings.py:124
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
CaloSamples
Definition: CaloSamples.h:14
CastorCalibrations::gain
double gain(int fCapId) const
get gain for capid=0..3
Definition: CastorCalibrations.h:14
castor_dqm_sourceclient-live_cfg.maxADCvalue
maxADCvalue
Definition: castor_dqm_sourceclient-live_cfg.py:69
ntuplemaker.time
time
Definition: ntuplemaker.py:310
timeshift_ns_hf
static float timeshift_ns_hf(float wpksamp)
Same as above, but for the HF PMTs.
Definition: CastorSimpleRecAlgo.cc:300