1 #ifndef RECOTOOL_CFALGOTIMEOVERLAP_CXX 2 #define RECOTOOL_CFALGOTIMEOVERLAP_CXX 38 double time_difference = 0;
39 double max_time_difference = 0;
40 double max_charge = 0;
41 double charge_ratio = 1;
47 double prev_start_t = 0;
48 double prev_end_t = 0;
50 double max_hits_1 = 0;
51 double max_hits_2 = 0;
53 for(
auto const& c : clusters){
55 auto charge = c->GetParams().sum_charge ;
57 time_difference = c->GetParams().start_point.t - c->GetParams().end_point.t ;
59 if(time_difference < 0)
60 time_difference *= -1;
62 if(max_time_difference < time_difference)
63 max_time_difference = time_difference ;
65 if(max_charge < charge)
68 if(c->GetParams().N_Hits > max_hits_1) {
69 max_hits_2 = max_hits_1;
70 max_hits_1 = c->GetParams().N_Hits;
71 }
else if(c->GetParams().N_Hits > max_hits_2)
72 max_hits_2 = c->GetParams().N_Hits;
78 for(
size_t c_index=0; c_index<clusters.size(); ++c_index) {
79 auto const& c = clusters[c_index];
81 double length = c->GetParams().length ;
87 if(c->GetParams().start_point.t > c->GetParams().end_point.t){
88 start_t = c->GetParams().end_point.t ;
89 end_t = c->GetParams().start_point.t ;
92 start_t = c->GetParams().start_point.t ;
93 end_t = c->GetParams().end_point.t ;
97 prev_start_t = start_t ;
101 time_difference = end_t - start_t ;
103 ratio *= time_difference/max_time_difference ;
105 charge_ratio = max_hits_2 / max_hits_1;
107 if(c_index==(clusters.size()-1))
108 ratio *= charge_ratio ;
120 prev_start_t = start_t ;
124 std::cout<<
"\nPLANE: "<<c->Plane() ;
125 std::cout<<
"\nStart point: "<<start_t<<std::endl;
126 std::cout<<
"End Point: "<<end_t <<std::endl;
128 std::cout<<
"Time diff: "<<time_difference<<std::endl;
129 std::cout<<
"Max time diff: "<<max_time_difference<<std::endl;
130 std::cout<<
"Ratio for each cluster: "<<ratio<<std::endl;
132 std::cout<<
"Charge Ratio: "<<charge_ratio<<std::endl;
135 std::cout<<
"Length and Width: "<<c->GetParams().length<<
", "<<c->GetParams().width<<std::endl;
141 std::cout<<
"**************************FOUND A MATCH . ratio is: "<<ratio<<
"\n\n\n"<<std::endl;
Class def header for a class CFAlgoTimeOverlap.