CMS 3D CMS Logo

HFPreRecAlgo.cc
Go to the documentation of this file.
1 #include <algorithm>
2 
4 
7 
11 
13  const int tsToUse,
14  const HcalCoder& coder,
15  const HcalCalibrations& calib) const {
16  // Scrap the trailing edge time for now -- until the front-end
17  // FPGA firmware is finalized and the description of the FPGA
18  // output becomes available
19  static const float timeFalling = HcalSpecialTimes::UNKNOWN_T_NOTDC;
20 
22 
24  coder.adc2fC(digi, cs);
25  const int nRead = cs.size();
26 
27  // Number of raw samples to store in HFQIE10Info
28  const int nStore = std::min(nRead, static_cast<int>(HFQIE10Info::N_RAW_MAX));
29 
30  if (sumAllTS_) {
31  // This branch is intended for use with cosmic runs
32  double charge = 0.0, energy = 0.0;
34 
35  for (int ts = 0; ts < nRead; ++ts) {
36  const QIE10DataFrame::Sample s(digi[ts]);
37  const int capid = s.capid();
38  const float q = cs[ts] - calib.pedestal(capid);
39  charge += q;
40  energy += q * calib.respcorrgain(capid);
41  if (ts < nStore)
42  raw[ts] = s.wideRaw();
43  }
44 
45  // Timing measurement does not appear to be useful here
46  const float timeRising = HcalSpecialTimes::UNKNOWN_T_NOTDC;
47 
48  // The following HFQIE10Info arguments correspond to SOI
49  // not stored in the raw data. Essentially, only charge
50  // and energy are meaningful.
51  result = HFQIE10Info(digi.id(), charge, energy, timeRising, timeFalling, raw, nStore, nStore);
52  } else if (0 <= tsToUse && tsToUse < nRead) {
53  const QIE10DataFrame::Sample s(digi[tsToUse]);
54  const int capid = s.capid();
55  const float charge = cs[tsToUse] - calib.pedestal(capid);
56  const float energy = charge * calib.respcorrgain(capid);
57  const float timeRising = HcalSpecialTimes::getTDCTime(s.le_tdc());
58 
59  // Figure out the window in the raw data
60  // that we want to store. This window will
61  // have the width given by "nStore" and
62  // will start at "shift".
63  int shift = 0;
64  if (nRead > static_cast<int>(HFQIE10Info::N_RAW_MAX)) {
65  // Try to center the window on "tsToUse"
66  const int winCenter = nStore / 2;
67  if (tsToUse > winCenter)
68  shift = tsToUse - winCenter;
69  if (shift + nStore > nRead)
70  shift = nRead - nStore;
71  }
72 
73  // Fill an array of raw values
75  for (int i = 0; i < nStore; ++i)
76  raw[i] = digi[i + shift].wideRaw();
77 
78  result = HFQIE10Info(digi.id(), charge, energy, timeRising, timeFalling, raw, nStore, tsToUse - shift);
79  }
80  return result;
81 }
HcalCalibrations.h
mps_fire.i
i
Definition: mps_fire.py:355
HcalCoder::adc2fC
virtual void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const =0
fwrapper::cs
unique_ptr< ClusterSequence > cs
Definition: fastjetfortran_madfks.cc:45
HFQIE10Info
Definition: HFQIE10Info.h:15
min
T min(T a, T b)
Definition: MathUtil.h:58
CaloSamples.h
HcalSpecialTimes.h
HcalCoder.h
data-class-funcs.q
q
Definition: data-class-funcs.py:169
HFPreRecAlgo::reconstruct
HFQIE10Info reconstruct(const QIE10DataFrame &digi, int tsToUse, const HcalCoder &coder, const HcalCalibrations &calibs) const
Definition: HFPreRecAlgo.cc:12
alignCSCRings.s
s
Definition: alignCSCRings.py:92
HcalSpecialTimes::getTDCTime
constexpr float getTDCTime(const int tdc)
Definition: HcalSpecialTimes.h:55
HcalSpecialTimes::UNKNOWN_T_NOTDC
constexpr float UNKNOWN_T_NOTDC
Definition: HcalSpecialTimes.h:42
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
HcalCalibrations
Definition: HcalCalibrations.h:9
calib
Definition: CalibElectron.h:12
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
QIE10DataFrame.h
CaloSamples
Definition: CaloSamples.h:14
HFQIE10Info::N_RAW_MAX
static const unsigned N_RAW_MAX
Definition: HFQIE10Info.h:20
HFQIE10Info::raw_type
QIE10DataFrame::Sample::wide_type raw_type
Definition: HFQIE10Info.h:18
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
QIE10DataFrame
Definition: QIE10DataFrame.h:11
QIE10DataFrame::Sample
Definition: QIE10DataFrame.h:20
HcalCoder
Definition: HcalCoder.h:19
HFPreRecAlgo::sumAllTS_
bool sumAllTS_
Definition: HFPreRecAlgo.h:22
mps_fire.result
result
Definition: mps_fire.py:303
HFPreRecAlgo.h
QIE10DataFrame::id
constexpr edm::DataFrame::id_type id() const
Definition: QIE10DataFrame.h:77