Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JSIRENE::JHits_t Struct Reference

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

#include <JSirene.hh>

Inheritance diagram for JSIRENE::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.
 

Detailed Description

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

Definition at line 137 of file JSirene.hh.

Member Function Documentation

◆ merge()

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

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

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

Parameters
Tmax_nsmaximal time difference [ns]

Definition at line 148 of file JSirene.hh.

149 {
150 using namespace std;
151
152 if (!this->empty()) {
153
154 sort(this->begin(), this->end());
155
156 iterator in = this->begin();
157 iterator out = this->begin();
158
159 out->id = 1; // set first hit identifier
160
161 while (++in != this->end()) {
162
163 if (out->pmt_id == in->pmt_id && in->t - out->t <= Tmax_ns) {
164
165 out->npe += in->npe; // accumulate number of photo-electrons
166
167 } else {
168
169 int id = out->id;
170
171 ++out; // increment desitination address
172
173 *out = *in; // copy first new hit
174
175 out->id = ++id; // set hit identifier
176 }
177 }
178
179 this->erase(++out, this->end()); // remove hits
180 }
181 }

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