14 #define TRG_SHORT_NAMES
15 #define TRGECLCLUSTER_SHORT_NAMES
16 #include <framework/gearbox/Unit.h>
18 #include "trg/ecl/TrgEclTiming.h"
25 TrgEclTiming::TrgEclTiming() : NofTopTC(3), Source(0)
40 void TrgEclTiming::Setup(std::vector<int> HitTCId, std::vector<double>HitTCEnergy, std::vector<double> HitTCTiming)
50 double EventTiming = 0;
54 }
else if (method == 1) {
66 double Fastest = 9999;
68 const int hit_size =
TCTiming.size();
70 for (
int ihit = 0; ihit < hit_size; ihit++) {
73 FastestTCId =
TCId[ihit];
77 if (FastestTCId < 81) {
Source = 1;}
78 else if (FastestTCId > 80 && FastestTCId < 513) {
Source = 2;}
91 const int hit_size =
TCTiming.size();
93 for (
int ihit = 0; ihit < hit_size; ihit++) {
100 if (maxTCId < 81) {
Source = 1;}
101 else if (maxTCId > 80 && maxTCId < 513) {
Source = 2;}
113 std::vector<double> maxEnergy;
114 std::vector<double> maxTiming;
121 maxEnergy.resize(NtopTC, 0);
122 maxTiming.resize(NtopTC, 0);
124 const int hit_size =
TCTiming.size();
126 double EventTiming = 0;
128 for (
int iNtopTC = 0; iNtopTC < NtopTC ; iNtopTC++) {
129 for (
int ihit = 0; ihit < hit_size; ihit++) {
131 if (maxEnergy[iNtopTC] <
TCEnergy[ihit]) {
132 maxEnergy[iNtopTC] =
TCEnergy[ihit];
133 maxTiming[iNtopTC] =
TCTiming[ihit];
134 maxTCId =
TCId[ihit];
136 }
else if (iNtopTC > 0) {
137 if (maxEnergy[iNtopTC - 1] >
TCEnergy[ihit] && maxEnergy[iNtopTC] <
TCEnergy[ihit]) {
138 maxEnergy[iNtopTC] =
TCEnergy[ihit];
139 maxTiming[iNtopTC] =
TCTiming[ihit];
143 E_sum += maxEnergy[iNtopTC];
144 EventTiming += maxEnergy[iNtopTC] * maxTiming[iNtopTC];
147 EventTiming /= E_sum;
149 if (maxTCId < 81) {
Source = 1;}
150 else if (maxTCId > 80 && maxTCId < 513) {
Source = 2;}