55 for (
int i = 0;
i !=
x.size(); totalX +=
x.sample(
i++).nominal_fC())
57 for (
int i = 0;
i !=
y.size(); totalY +=
y.sample(
i++).nominal_fC())
60 return totalX > totalY;
65 const std::vector<HBHEDataFrame>& udigi,
66 const std::vector<int>& RecHitIndex) {
67 bool Bits[4] = {
false,
false,
false,
false};
68 std::vector<HBHEDataFrame> digi(udigi);
69 std::sort(digi.begin(), digi.end(), compareDigiEnergy);
70 std::vector<double> PulseShape;
74 bool FoundLeadingChannel =
false;
75 for (std::vector<HBHEDataFrame>::const_iterator itDigi = digi.begin(); itDigi != digi.end(); itDigi++) {
76 if (!FoundLeadingChannel) {
78 LeadingPhi = itDigi->id().iphi();
79 DigiSize = (*itDigi).size();
81 PulseShape.resize(DigiSize, 0);
82 FoundLeadingChannel =
true;
84 if (
abs(LeadingPhi - itDigi->id().iphi()) < 2)
85 for (
int i = 0;
i != DigiSize;
i++)
86 PulseShape[
i] += itDigi->sample(
i).nominal_fC();
89 if (!RecHitIndex.empty()) {
90 double FracInLeader = -1;
94 double OuterEnergy = -1;
95 double TotalEnergy = 0;
98 for (
int i = 0;
i != DigiSize;
i++) {
99 if (PulseShape[
i] > PulseShape[PeakPosition])
101 TotalEnergy += PulseShape[
i];
104 if (PeakPosition < (DigiSize - 2)) {
105 R1 = PulseShape[PeakPosition + 1] / PulseShape[PeakPosition];
106 R2 = PulseShape[PeakPosition + 2] / PulseShape[PeakPosition + 1];
109 FracInLeader = PulseShape[PeakPosition] / TotalEnergy;
111 if ((PeakPosition > 0) && (PeakPosition < (DigiSize - 2))) {
112 OuterEnergy = 1. - ((PulseShape[PeakPosition - 1] + PulseShape[PeakPosition] + PulseShape[PeakPosition + 1] +
113 PulseShape[PeakPosition + 2]) /
127 if (R1 != -1 && R2 != -1)
129 if (FracInLeader != -1)
130 Bits[1] = (FracInLeader < FracLeaderMin_) || (FracInLeader >
FracLeaderMax_);
131 if (OuterEnergy != -1)
132 Bits[2] = (OuterEnergy < OuterMin_) || (OuterEnergy >
OuterMax_);
145 for (
unsigned int i = 0;
i != RecHitIndex.size();
i++) {
~HBHETimeProfileStatusBitSetter()
Abs< T >::type abs(const T &t)
void hbheSetTimeFlagsFromDigi(HBHERecHitCollection *, const std::vector< HBHEDataFrame > &, const std::vector< int > &)
HBHETimeProfileStatusBitSetter()