16 template <
class T_algo>
22 std::map<double, double>& m_ylookup) {
23 std::pair<double, double> thisxy, lastxy, laststoredxy;
24 std::pair<double, double> minxy = algoObject.calcpair(smin);
25 std::pair<double, double> maxxy = algoObject.calcpair(smax);
27 double slope = maxxy.second - minxy.second;
30 double sstep = min_sstep;
32 for (
double s = smin; lastxy.first < smax;
s += sstep) {
33 thisxy = algoObject.calcpair(
s);
35 double fracerror =
slope * (thisxy.second - laststoredxy.second) / thisxy.second;
36 double fracchange =
slope * (thisxy.second - lastxy.second) / thisxy.second;
38 bool store_cur_pair =
false;
39 bool store_prev_pair =
false;
43 sprintf(
str,
"%7.1f %7.1f (%8.3f %8.4f) %8.5f %8.5f",
44 s, sstep, thisxy.first, thisxy.second, fracerror, fracchange);
49 store_cur_pair =
true;
50 }
else if ((fracerror > 2 * max_fracerror) || (thisxy.first > smax)) {
51 if (sstep > min_sstep) {
54 sstep =
std::max(0.5 * sstep, min_sstep);
59 }
else if (lastxy.second == laststoredxy.second) {
60 store_cur_pair =
true;
67 store_prev_pair =
true;
70 fracerror =
slope * (thisxy.second - lastxy.second) / thisxy.second;
72 if (fracerror > 2 * max_fracerror) {
73 store_cur_pair =
true;
81 }
else if ((fracerror < 1.9 * max_fracerror) && (fracchange < 0.1 * max_fracerror) &&
82 (thisxy.first < 0.99 * smax)) {
87 if (thisxy.first > smax)
88 store_cur_pair =
true;
90 if (store_prev_pair) {
91 m_ylookup[lastxy.first] = lastxy.second;
92 laststoredxy = lastxy;
95 m_ylookup[thisxy.first] = thisxy.second;
96 laststoredxy = thisxy;
102 sprintf(
str,
" %c %c",
103 store_cur_pair ?
'C' :
' ',
104 store_prev_pair ?
'P' :
' ');
117 std::pair<double, double>
calcpair(
double);
const std::unique_ptr< HcalShapeIntegrator > integrator_
static const double slope[3]
void genlkupmap(double smin, double smax, double max_fracerror, double min_sstep, T_algo &algoObject, std::map< double, double > &m_ylookup)
std::pair< double, double > calcpair(double)
double integrationwindowns_
RecoFCcorFactorAlgo(int num_samples, double fixedphase_ns)
if(threadIdxLocalY==0 &&threadIdxLocalX==0)