23 const std::vector<const cluster::ClusterParamsAlg*>& clusters)
34 double time_difference = 0;
35 double max_time_difference = 0;
36 double max_charge = 0;
37 double charge_ratio = 1;
43 double prev_start_t = 0;
44 double prev_end_t = 0;
46 double max_hits_1 = 0;
47 double max_hits_2 = 0;
49 for (
auto const& c : clusters) {
51 auto charge = c->GetParams().sum_charge;
53 time_difference = c->GetParams().start_point.t - c->GetParams().end_point.t;
55 if (time_difference < 0) time_difference *= -1;
57 if (max_time_difference < time_difference) max_time_difference = time_difference;
59 if (max_charge < charge) max_charge = charge;
61 if (c->GetParams().N_Hits > max_hits_1) {
62 max_hits_2 = max_hits_1;
63 max_hits_1 = c->GetParams().N_Hits;
65 else if (c->GetParams().N_Hits > max_hits_2)
66 max_hits_2 = c->GetParams().N_Hits;
71 for (
size_t c_index = 0; c_index < clusters.size(); ++c_index) {
72 auto const& c = clusters[c_index];
74 double length = c->GetParams().length;
80 if (c->GetParams().start_point.t > c->GetParams().end_point.t) {
81 start_t = c->GetParams().end_point.t;
82 end_t = c->GetParams().start_point.t;
85 start_t = c->GetParams().start_point.t;
86 end_t = c->GetParams().end_point.t;
89 if (prev_start_t == 0) prev_start_t = start_t;
90 if (prev_end_t == 0) prev_end_t = end_t;
92 time_difference = end_t - start_t;
94 ratio *= time_difference / max_time_difference;
96 charge_ratio = max_hits_2 / max_hits_1;
98 if (c_index == (clusters.size() - 1)) ratio *= charge_ratio;
112 prev_start_t = start_t;
116 std::cout <<
"\nPLANE: " << c->Plane();
117 std::cout <<
"\nStart point: " << start_t << std::endl;
118 std::cout <<
"End Point: " << end_t << std::endl;
120 std::cout <<
"Time diff: " << time_difference << std::endl;
121 std::cout <<
"Max time diff: " << max_time_difference << std::endl;
122 std::cout <<
"Ratio for each cluster: " << ratio << std::endl;
124 std::cout <<
"Charge Ratio: " << charge_ratio << std::endl;
127 std::cout <<
"Length and Width: " << c->GetParams().length <<
", " << c->GetParams().width
133 std::cout <<
"**************************FOUND A MATCH . ratio is: " << ratio <<
"\n\n\n"
Class def header for a class CFAlgoTimeOverlap.