Jpp test-rotations-old-533-g2bdbdb559
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 139 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 150 of file JSirene.hh.

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

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