4 namespace HFTimingTrust
9 double timerr_hf(
double rectime,
double ampl);
11 template <
class T,
class V>
15 double rectime = rechit.time();
17 if (rectime>-100 && rectime<250) {
20 double ampl=0;
double sum=0;
int maxI = -1;
21 for (
int i=0;
i<digi.size();++
i) {
22 sum += digi.sample(
i).nominal_fC();
23 if (digi.sample(
i).nominal_fC()>ampl) {
24 ampl = digi.sample(
i).nominal_fC();
28 if (ampl>1 && maxI>0 && maxI<digi.size()-1) {
29 ampl = ampl + digi.sample(maxI-1).nominal_fC() + digi.sample(maxI+1).nominal_fC();
30 ampl -= (sum-ampl)*3.0/(digi.size()-3);
32 int timerr = (int)
timerr_hf(rectime,ampl);
34 if (timerr<0) status = 3;
35 else if (timerr<=level1) status = 0;
36 else if (timerr<=level2) status = 1;
50 3.42, 3.04, 9.18, 8.97, 8.49, 8.08, 8.01, 8.30, 8.75, 8.22, 7.21, 5.04, 2.98,
51 2.04, 1.22, 7.58, 7.79, 7.11, 6.93, 7.03, 7.27, 7.23, 6.53, 4.59, 2.40, 1.46,
52 1.31, 0.42, 5.95, 6.48, 6.29, 5.84, 5.97, 6.31, 6.00, 4.37, 2.37, 1.03, 0.72,
53 0.81, 0.27, 3.98, 5.57, 5.04, 5.10, 5.21, 5.18, 4.22, 2.23, 1.07, 0.66, 0.40,
54 0.48, 0.17, 2.51, 4.70, 4.28, 4.29, 4.36, 3.84, 2.40, 1.15, 0.68, 0.40, 0.24,
55 0.29, 0.11, 0.81, 3.71, 3.47, 3.48, 3.52, 2.58, 1.25, 0.71, 0.41, 0.26, 0.16,
56 0.16, 0.08, 0.27, 2.88, 2.63, 2.76, 2.33, 1.31, 0.72, 0.44, 0.27, 0.16, 0.11,
57 0.10, 0.06, 0.15, 2.11, 2.00, 1.84, 1.46, 0.79, 0.45, 0.26, 0.17, 0.10, 0.08,
58 0.05, 0.04, 0.10, 1.58, 1.49, 1.25, 0.90, 0.48, 0.29, 0.17, 0.10, 0.06, 0.06,
59 0.02, 0.03, 0.06, 1.26, 1.03, 0.77, 0.57, 0.30, 0.18, 0.11, 0.06, 0.04, 0.05,
60 0.01, 0.02, 0.04, 0.98, 0.66, 0.47, 0.39, 0.18, 0.11, 0.07, 0.04, 0.03, 0.04,
61 0.01, 0.02, 0.02, 0.86, 0.44, 0.30, 0.27, 0.11, 0.07, 0.04, 0.03, 0.02, 0.04,
62 0.01, 0.02, 0.02, 0.80, 0.30, 0.21, 0.17, 0.07, 0.04, 0.03, 0.02, 0.01, 0.04,
63 0.01, 0.02, 0.01, 0.76, 0.22, 0.17, 0.12, 0.05, 0.03, 0.02, 0.01, 0.01, 0.04,
64 0.01, 0.02, 0.01, 0.76, 0.17, 0.14, 0.09, 0.03, 0.02, 0.01, 0.01, 0.01, 0.04
71 if (rectime>0) tim=rectime-((int)(rectime/25))*25;
72 else tim=rectime-((int)(rectime/25))*25+25;
73 itim = (int) (tim/2.0);
76 static const double bampl[15]={3,5,8,12,19,30,47,73,115,182,287,452,712,1120,1766};
77 if (ampl>=bampl[14]) iampl=14;
79 for (
int i=1;
i<=14;
i++) {
87 index = itim + iampl*13;
94 v1 = y1 + (y2-y1)*(tim/2.0-(
float)itim);
101 if (itim==12) v2 = yy1;
104 v2 = yy1 + (yy2-yy1)*(tim/2.0-(
float)itim);
106 v1 = v1 + (v2-v1)*(ampl-bampl[iampl])/(bampl[iampl+1]-bampl[iampl]);
114 using namespace HFTimingTrust;
118 HFTimingTrustLevel1_ = 1;
119 HFTimingTrustLevel2_ = 4;
124 HFTimingTrustLevel1_ = level1;
125 HFTimingTrustLevel2_ = level2;
133 checkHFTimErr<HFRecHit, HFDataFrame>(rechit, digi, HFTimingTrustLevel1_, HFTimingTrustLevel2_);
void setHFTimingTrustFlag(HFRecHit &rechit, const HFDataFrame &digi)
void checkHFTimErr(T &rechit, const V &digi, int level1, int level2)
double timerr_hf(double rectime, double ampl)
static const float hfterrlut[195]