Jpp 20.0.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JEvtSupportkit.hh
Go to the documentation of this file.
1#ifndef __JRECONSTRUCTION__JEVTSUPPORTKIT__
2#define __JRECONSTRUCTION__JEVTSUPPORTKIT__
3
4#include <set>
5
9
10#include "JLang/JUUID.hh"
11
15
16
17/**
18 * \author mdejong
19 */
20namespace JRECONSTRUCTION {}
21namespace JPP { using namespace JRECONSTRUCTION; }
22
23/**
24 * Support.
25 */
26namespace JRECONSTRUCTION {
27
28 /**
29 * Copy tracks.
30 *
31 * \param __begin begin of input tracks
32 * \param __end end of input tracks
33 * \param out output tracks
34 */
35 inline void copy(const JFIT::JEvt::const_iterator __begin,
36 const JFIT::JEvt::const_iterator __end,
37 Evt& out)
38 {
39 using namespace std;
40 using namespace JPP;
41
42 struct : public set<JUUID> {
43
44 inline int get_index(const JUUID& element) const
45 {
46 const_iterator i = this->find(element);
47
48 if (i != this->end())
49 return std::distance(this->begin(), i);
50 else
51 return -1;
52 }
53 } uuid;
54
55 for (JFIT::JEvt::const_iterator fit = __begin; fit != __end; ++fit) {
56 uuid.insert(fit->getUUID());
57 }
58
59 for (JFIT::JEvt::const_iterator fit = __begin; fit != __end; ++fit) { // import reconstruction data
60
61 Trk trk;
62
63 trk.id = uuid.get_index(fit->getUUID());
64 trk.pos = Vec(fit->getX(), fit->getY(), fit->getZ());
65 trk.dir = Vec(fit->getDX(), fit->getDY(), fit->getDZ());
66 trk.t = fit->getT();
67 trk.E = fit->getE();
68 trk.lik = fit->getQ();
70 trk.status = (fit->getStatus() == COMPLETE_CHAIN ? TRK_ST_FINALSTATE : TRK_ST_UNDEFINED);
71
72 if (fit->hasParentUUID()) {
73 trk.mother_id = uuid.get_index(fit->getParentUUID());
74 }
75
76 for (JHistory::const_iterator i = fit->getHistory().begin(); i != fit->getHistory().end(); ++i) {
77 trk.rec_stages.push_back(i->type);
78 }
79
80 for (int i = 0; i != fit->getN(); ++i) {
81 trk.fitinf.push_back(fit->getW(i));
82 }
83
84 trk.error_matrix = fit->getV();
85
86 out.trks.push_back(trk);
87 }
88 }
89}
90
91#endif
Definition for fit results.
static const int JPP_RECONSTRUCTION_TYPE
KM3NeT Data Definitions v3.6.1-2-g905a24d https://git.km3net.de/common/km3net-dataformat.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
void copy(const JFIT::JEvt::const_iterator __begin, const JFIT::JEvt::const_iterator __end, Evt &out)
Copy tracks.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition Evt.hh:21
std::vector< Trk > trks
list of reconstructed tracks (can be several because of prefits,showers, etc).
Definition Evt.hh:39
Simple wrapper for UUID.
Definition JUUID.hh:24
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Definition Trk.hh:15
int status
MC status code, see km3net-dataformat/definitions/trkmembers.csv for values.
Definition Trk.hh:28
int id
track identifier
Definition Trk.hh:16
std::vector< double > error_matrix
(NxN) error covariance matrix for fit parameters (stored as linear vector)
Definition Trk.hh:34
std::vector< double > fitinf
place to store additional fit info, see km3net-dataformat/definitions/fitparameters....
Definition Trk.hh:32
Vec dir
track direction
Definition Trk.hh:18
std::vector< int > rec_stages
list of identifyers of succesfull fitting stages resulting in this track
Definition Trk.hh:26
double E
Energy [GeV] (either MC truth or reconstructed)
Definition Trk.hh:20
double t
track time [ns] (when the particle is at pos )
Definition Trk.hh:19
int rec_type
identifier of the fitting algorithm/chain/strategy, see km3net-dataformat/definitions/reconstruction....
Definition Trk.hh:25
int mother_id
MC id of the parent particle.
Definition Trk.hh:29
double lik
likelihood or lambda value (for aafit, lambda)
Definition Trk.hh:23
Vec pos
postion [m] of the track at time t
Definition Trk.hh:17
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition Vec.hh:13
static const int TRK_ST_FINALSTATE
for MC: the particle must be processed by detector simulation ('track_in' tag in evt files)....
Definition trkmembers.hh:15
static const int TRK_ST_UNDEFINED
status was not defined for this MC track (all reco tracks have this value)
Definition trkmembers.hh:14