Jpp 20.0.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JRECONSTRUCTION::JMuonStart Class Reference

Auxiliary class to determine start and end position of muon trajectory. More...

#include <JMuonStart.hh>

Inheritance diagram for JRECONSTRUCTION::JMuonStart:
JRECONSTRUCTION::JMuonStartParameters_t JFIT::JRegressor< JModel_t, JMinimiser_t > TObject

Classes

struct  input_type
 Input data type. More...
 

Public Types

typedef JRegressor< JEnergyJRegressor_t
 
typedef JModuleL0 module_type
 
typedef std::vector< module_typedetector_type
 

Public Member Functions

 JMuonStart (const JMuonStartParameters_t &parameters, const storage_type &storage, const JK40Rates &rates_Hz, const int debug=0)
 Constructor.
 
input_type getInput (const JModuleRouter &router, const JSummaryRouter &summary, const JDAQEvent &event, const JEvt &in, const coverage_type &coverage) const
 Get input data.
 
JEvt operator() (const input_type &input)
 Fit function.
 
void reset ()
 Reset fit parameters.
 
bool equals (const JMuonStartParameters_t &parameters) const
 Equality.
 
 ClassDef (JMuonStartParameters_t, 3)
 

Public Attributes

double roadWidth_m
 road width [m]
 
double R_Hz
 default rate [Hz]
 
size_t numberOfPrefits
 number of prefits
 
size_t numberOfPostfits
 number of postfits
 
double TMin_ns
 minimal time w.r.t. Cherenkov hypothesis [ns]
 
double TMax_ns
 maximal time w.r.t. Cherenkov hypothesis [ns]
 
double Pmin
 minimal probability
 
double Pmin1
 minimal probability single observation
 
double Pmin2
 minimal probability for twofold observations
 
int Nmax2
 maximal number for twofold observations
 

Private Attributes

const JK40Rates rates_Hz
 

Detailed Description

Auxiliary class to determine start and end position of muon trajectory.

Definition at line 73 of file JMuonStart.hh.

Member Typedef Documentation

◆ JRegressor_t

◆ module_type

◆ detector_type

Constructor & Destructor Documentation

◆ JMuonStart()

JRECONSTRUCTION::JMuonStart::JMuonStart ( const JMuonStartParameters_t & parameters,
const storage_type & storage,
const JK40Rates & rates_Hz,
const int debug = 0 )
inline

Constructor.

Parameters
parametersparameters
storagestorage
rates_HzK40 rates [Hz]
debugdebug

Definition at line 127 of file JMuonStart.hh.

130 :
131 JMuonStartParameters_t(parameters),
132 JRegressor_t(storage),
134 {
135 if (this->getRmax() < parameters.roadWidth_m) {
136 roadWidth_m = this->getRmax();
137 }
138
139 JRegressor_t::debug = debug;
140 }
int debug
debug level
Definition JSirene.cc:72
JRegressor< JEnergy > JRegressor_t
Definition JMuonStart.hh:78

Member Function Documentation

◆ getInput()

input_type JRECONSTRUCTION::JMuonStart::getInput ( const JModuleRouter & router,
const JSummaryRouter & summary,
const JDAQEvent & event,
const JEvt & in,
const coverage_type & coverage ) const
inline

Get input data.

Parameters
routermodule router
summarysummary data
eventevent
instart values
coveragecoverage
Returns
input data

Definition at line 153 of file JMuonStart.hh.

158 {
159 using namespace std;
160 using namespace JTRIGGER;
161
162 input_type input(event.getDAQEventHeader(), in, coverage);
163
164 const JBuildL0 <JHitR0> buildL0;
166
167 const JDAQTimeslice timeslice(event, true);
168
169 JSuperFrame2D<JHit> buffer;
170
171 for (JDAQTimeslice::const_iterator i = timeslice.begin(); i != timeslice.end(); ++i) {
172
173 if (router.hasModule(i->getModuleID())) {
174
175 buffer(*i, router.getModule(i->getModuleID()));
176
177 buildL0(buffer, back_inserter(data[i->getModuleID()]));
178 }
179 }
180
181 for (const auto& module : router.getReference()) {
182 if (!module.empty()) {
183 input.data.push_back(module_type(module, summary.getSummaryFrame(module.getID(), R_Hz), data[module.getID()]));
184 }
185 }
186
187 return input;
188 }
bool hasModule(const JObjectID &id) const
Has module.
const JModule & getModule(const JObjectID &id) const
Get module parameters.
const JClass_t & getReference() const
Get reference to object.
Definition JReference.hh:38
const JDAQSummaryFrame & getSummaryFrame(const JDAQModuleIdentifier &module) const
Get summary frame.
2-dimensional frame with time calibrated data from one optical module.
const JDAQEventHeader & getDAQEventHeader() const
Get DAQ event header.
Auxiliary classes and methods for triggering.

◆ operator()()

JEvt JRECONSTRUCTION::JMuonStart::operator() ( const input_type & input)
inline

Fit function.

Parameters
inputinput data
Returns
fit results

Definition at line 197 of file JMuonStart.hh.

198 {
199 using namespace std;
200 using namespace JPP;
201
202 JEvent event(JMUONSTART);
203
204 JEvt out;
205
206 // select start values
207
208 JEvt in = input.in;
209
210 sort(in.begin(), in.end(), qualitySorter);
211
212 if (numberOfPrefits != 0 && numberOfPrefits < in.size()) {
213
214 JEvt::iterator __end = next(in.begin(), numberOfPrefits);
215
216 if (numberOfPostfits > 0) {
217
218 __end = gridify(__end, in.end(), numberOfPostfits);
219 }
220
221 in.erase(__end, in.end());
222 }
223
224 if (!in.empty()) {
225 in.select(JHistory::is_event(in.begin()->getHistory()));
226 }
227
228 const JStart start(Pmin1, Pmin2, Nmax2);
229
230 struct JHit_t {
231
232 double getZ() const { return z; }
233 double getP() const { return p; }
234
235 double z;
236 double p;
237 double y1;
238 double yx;
239 };
240
241 for (JEvt::const_iterator track = in.begin(); track != in.end(); ++track) {
242
243 const JRotation3D R (getDirection(*track));
244 const JLine1Z tz(getPosition (*track).rotate(R), track->getT());
245
247
248 for (const auto& module : input.data) {
249
250 JPosition3D pos(module->getPosition());
251
252 pos.transform(R, tz.getPosition());
253
254 if (pos.getX() <= roadWidth_m) {
255
256 const double z = pos.getZ() - pos.getX() / getTanThetaC();
257 const double t = tz .getT() + (pos.getZ() + pos.getX() * getKappaC()) * getInverseSpeedOfLight();
258
259 const double p = module.getProbability(rates_Hz.getMultiplesRates(), T_ns + t);
260
261 double y1 = 0.0;
262 double yx = 0.0;
263
264 for (size_t i = 0; i != module->size(); ++i) {
265
266 if (module.getStatus(i)) {
267
268 JPMT pmt = module->getPMT(i);
269
270 pmt.transform(R, tz.getPosition());
271
272 const double npe = this->getY1(pmt);
273
274 y1 += npe;
275
276 if (count_if(module.begin(), module.end(), make_predicate(&JHitR0::getPMT, (JDAQHit::JPMT_t) i)) == 0) {
277 yx += npe;
278 }
279 }
280 }
281
282 data.push_back({ z, p, y1, yx });
283 }
284 }
285
286 double Zmin = 0.0; // start position
287 double Zmax = 0.0; // end position
288 double y1 = 0.0; // npe due to MIP between start and end position
289 double yx = 0.0; // npe due to MIP between start and end position that are not detected
290 double pb = 0.0; // background probability
291
292 if (!data.empty()) {
293
294 sort(data.begin(), data.end(), make_comparator(&JHit_t::getZ));
295
296 vector<JHit_t>::const_iterator q1 = start.find(data. begin(), data. end());
297 vector<JHit_t>::const_reverse_iterator q2 = start.find(data.rbegin(), data.rend());
298
299 if (q1 != data.end() && q2 != data.rend()) {
300
301 vector<JHit_t>::const_iterator p1 = q1; if (p1 != data. begin()) { --p1; }
302 vector<JHit_t>::const_reverse_iterator p2 = q2; if (p2 != data.rbegin()) { --p2; }
303
304 Zmin = 0.5 * (p1->getZ() + q1->getZ());
305 Zmax = 0.5 * (p2->getZ() + q2->getZ());
306
307 for (vector<JHit_t>::const_iterator i = q1; i != q2.base(); ++i) {
308 y1 += i->y1;
309 yx += i->yx;
310 pb += log(i->p > Pmin ? i->p : Pmin);
311 }
312 }
313 }
314
315 JFit fit = *track;
316
317 fit.push_back(event());
318
319 // move track
320
321 fit.move(Zmin, getSpeedOfLight());
322
323 out.push_back(fit);
324
325 // set additional values
326
327 out.rbegin()->setW(track->getW());
328 out.rbegin()->setW(JSTART_NPE_MIP_TOTAL, y1);
329 out.rbegin()->setW(JSTART_NPE_MIP_MISSED, yx);
330 out.rbegin()->setW(JSTART_LENGTH_METRES, Zmax - Zmin);
331 out.rbegin()->setW(JSTART_BACKGROUND_LOGP, pb);
332 out.rbegin()->setW(JPP_COVERAGE_ORIENTATION, input.coverage.orientation);
333 out.rbegin()->setW(JPP_COVERAGE_POSITION, input.coverage.position);
334 }
335
336 // apply default sorter
337
338 sort(out.begin(), out.end(), qualitySorter);
339
340 copy(input.in.begin(), input.in.end(), back_inserter(out));
341
342 return out;
343 }
TPaveText * p1
Data structure for PMT geometry, calibration and status.
Definition JPMT.hh:49
Data structure for fit of straight line paralel to z-axis.
Definition JLine1Z.hh:29
void transform(const JAxis3D &axis)
Transform axis to reference frame of given axis.
Definition JAxis3D.hh:359
Data structure for position in three dimensions.
JPosition3D & rotate(const JRotation3D &R)
Rotate.
JPMT_t getPMT() const
Get PMT.
Definition JHitR0.hh:60
unsigned char JPMT_t
PMT channel in FPGA.
Definition JDAQHit.hh:38
static const int JSTART_NPE_MIP_TOTAL
number of photo-electrons along the whole track from JMuonStart
static const int JPP_COVERAGE_POSITION
coverage of dynamic position calibration from any Jpp application
static const int JSTART_LENGTH_METRES
distance between projected positions on the track of optical modules for which the response does not ...
static const int JPP_COVERAGE_ORIENTATION
coverage of dynamic orientation calibration from any Jpp application
static const int JSTART_BACKGROUND_LOGP
summed logarithm of background probabilities from JMuonStart
static const int JSTART_NPE_MIP_MISSED
number of photo-electrons missed from JMuonStart
double getP(const double expval, bool hit)
Get Poisson probability to observe a hit or not for given expectation value for the number of hits.
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
double getKappaC()
Get average R-dependence of arrival time of Cherenkov light (a.k.a.
const double getInverseSpeedOfLight()
Get inverse speed of light.
double getTanThetaC()
Get average tangent of Cherenkov angle of water corresponding to group velocity.
const double getSpeedOfLight()
Get speed of light.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
JPosition3D getPosition(const JFit &fit)
Get position.
void copy(const JFIT::JEvt::const_iterator __begin, const JFIT::JEvt::const_iterator __end, Evt &out)
Copy tracks.
bool qualitySorter(const JFit &first, const JFit &second)
Comparison of fit results.
JDirection3D getDirection(const JFit &fit)
Get direction.
JEvt::iterator gridify(JEvt::iterator __begin, JEvt::iterator __end, const int N)
Gridify set of fits.
Acoustic event fit.
Acoustic single fit.
Auxiliary class to test history.
Definition JHistory.hh:157
int Nmax2
maximal number for twofold observations
double Pmin1
minimal probability single observation
double Pmin2
minimal probability for twofold observations
Auxiliary class for start or end point evaluation.
Definition JStart.hh:21
Auxiliary class to set-up Hit.
Definition JSirene.hh:58

◆ reset()

void JRECONSTRUCTION::JMuonStartParameters_t::reset ( )
inlineinherited

Reset fit parameters.

Definition at line 41 of file JMuonStartParameters_t.hh.

42 {
43 roadWidth_m = std::numeric_limits<double>::max();
44 R_Hz = 6.0e3;
47 TMin_ns = -25.0;
48 TMax_ns = +75.0;
49 Pmin = 0.0;
50 Pmin1 = 0.0;
51 Pmin2 = 0.0;
52 Nmax2 = 2;
53 }
double TMin_ns
minimal time w.r.t. Cherenkov hypothesis [ns]
double TMax_ns
maximal time w.r.t. Cherenkov hypothesis [ns]

◆ equals()

bool JRECONSTRUCTION::JMuonStartParameters_t::equals ( const JMuonStartParameters_t & parameters) const
inlineinherited

Equality.

Parameters
parametersfit parameters
Returns
true if equals; else false

Definition at line 61 of file JMuonStartParameters_t.hh.

62 {
63 return (this->roadWidth_m == parameters.roadWidth_m &&
64 this->R_Hz == parameters.R_Hz &&
65 this->numberOfPrefits == parameters.numberOfPrefits &&
66 this->numberOfPostfits == parameters.numberOfPostfits &&
67 this->TMin_ns == parameters.TMin_ns &&
68 this->TMax_ns == parameters.TMax_ns &&
69 this->Pmin == parameters.Pmin &&
70 this->Pmin1 == parameters.Pmin1 &&
71 this->Pmin2 == parameters.Pmin2 &&
72 this->Nmax2 == parameters.Nmax2);
73 }

◆ ClassDef()

JRECONSTRUCTION::JMuonStartParameters_t::ClassDef ( JMuonStartParameters_t ,
3  )
inherited

Member Data Documentation

◆ rates_Hz

const JK40Rates JRECONSTRUCTION::JMuonStart::rates_Hz
private

Definition at line 346 of file JMuonStart.hh.

◆ roadWidth_m

double JRECONSTRUCTION::JMuonStartParameters_t::roadWidth_m
inherited

road width [m]

Definition at line 77 of file JMuonStartParameters_t.hh.

◆ R_Hz

double JRECONSTRUCTION::JMuonStartParameters_t::R_Hz
inherited

default rate [Hz]

Definition at line 78 of file JMuonStartParameters_t.hh.

◆ numberOfPrefits

size_t JRECONSTRUCTION::JMuonStartParameters_t::numberOfPrefits
inherited

number of prefits

Definition at line 79 of file JMuonStartParameters_t.hh.

◆ numberOfPostfits

size_t JRECONSTRUCTION::JMuonStartParameters_t::numberOfPostfits
inherited

number of postfits

Definition at line 80 of file JMuonStartParameters_t.hh.

◆ TMin_ns

double JRECONSTRUCTION::JMuonStartParameters_t::TMin_ns
inherited

minimal time w.r.t. Cherenkov hypothesis [ns]

Definition at line 81 of file JMuonStartParameters_t.hh.

◆ TMax_ns

double JRECONSTRUCTION::JMuonStartParameters_t::TMax_ns
inherited

maximal time w.r.t. Cherenkov hypothesis [ns]

Definition at line 82 of file JMuonStartParameters_t.hh.

◆ Pmin

double JRECONSTRUCTION::JMuonStartParameters_t::Pmin
inherited

minimal probability

Definition at line 83 of file JMuonStartParameters_t.hh.

◆ Pmin1

double JRECONSTRUCTION::JMuonStartParameters_t::Pmin1
inherited

minimal probability single observation

Definition at line 84 of file JMuonStartParameters_t.hh.

◆ Pmin2

double JRECONSTRUCTION::JMuonStartParameters_t::Pmin2
inherited

minimal probability for twofold observations

Definition at line 85 of file JMuonStartParameters_t.hh.

◆ Nmax2

int JRECONSTRUCTION::JMuonStartParameters_t::Nmax2
inherited

maximal number for twofold observations

Definition at line 86 of file JMuonStartParameters_t.hh.


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