1 #ifndef RecoParticleFlow_PFClusterProducer_ComputeClusterTime_h 2 #define RecoParticleFlow_PFClusterProducer_ComputeClusterTime_h 27 std::sort(t.begin(), t.end());
35 const auto startRef = *
start;
36 int c = count_if(
start, t.end(), [&](
float el) {
37 return el - startRef <= deltaT +
tolerance;
39 if (c > max_elements) {
41 auto last_el = find_if_not(
start, t.end(), [&](
float el) {
42 return el - startRef <= deltaT +
tolerance;
44 auto val = *(--last_el);
45 if (
std::abs(deltaT - (val - startRef)) < tolerance) {
46 tolerance =
std::abs(deltaT - (val - startRef));
49 end_el =
distance(t.begin(), last_el);
50 timeW = val - startRef;
57 float HalfTimeDiff = timeW * timeWidthBy;
60 int totSize = t.size();
62 for(
int ij=0; ij<=start_el; ++ij){
63 if(t[ij] > (t[start_el] - HalfTimeDiff) ){
64 for(
int kl=ij; kl<totSize; ++kl){
65 if(t[kl] < (t[end_el] + HalfTimeDiff) ){
75 if(num == 0)
return -99.;
float fixSizeHighestDensity(std::vector< float > &t, float deltaT=0.210, float timeWidthBy=0.5)
Abs< T >::type abs(const T &t)