Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
JAANET::JHits_t Struct Reference

Auxiliary data structure for list of hits with hit merging capability. More...

#include <JHit_t.hh>

Inheritance diagram for JAANET::JHits_t:
std::vector< JHit_t >

Public Member Functions

void merge (const double Tmax_ns)
 Merge hits on same PMT that are within given time window. More...
 

Detailed Description

Auxiliary data structure for list of hits with hit merging capability.

Definition at line 104 of file JHit_t.hh.

Member Function Documentation

void JAANET::JHits_t::merge ( const double  Tmax_ns)
inline

Merge hits on same PMT that are within given time window.

The first hit has the sum of the number of photo-electrons of all hits within given time window. The hit identifiers are reset in ascending order, starting at one.

Parameters
Tmax_nsmaximal time difference [ns]

Definition at line 115 of file JHit_t.hh.

116  {
117  using namespace std;
118 
119  if (!this->empty()) {
120 
121  sort(this->begin(), this->end());
122 
123  iterator in = this->begin();
124  iterator out = this->begin();
125 
126  out->id = 1; // set first hit identifier
127 
128  while (++in != this->end()) {
129 
130  if (out->pmt_id == in->pmt_id && in->t - out->t <= Tmax_ns) {
131 
132  out->npe += in->npe;
133 
134  } else {
135 
136  int id = out->id;
137 
138  ++out; // increment desitination address
139 
140  *out = *in; // copy first new hit
141 
142  out->id = ++id; // set hit identifier
143  }
144  }
145 
146  this->erase(++out, this->end()); // remove hits
147  }
148  }

The documentation for this struct was generated from the following file: