Jpp 21.0.1
the software that should make you happy
Loading...
Searching...
No Matches
reconstruction.cc
Go to the documentation of this file.
2
3#include <atomic>
4#include <iostream>
5
7
8static std::atomic<int> jpp_major_version = 20;
9
10// This is the first JPP version were the track status is correctly filled
11static const int JPP_VERSION_TRK_STATUS = 18;
12
13void setup_from_meta_file(const char *filename)
14{
15 auto jpp_meta_version = get_jpp_version_from_file(filename);
16 jpp_major_version = get_jpp_major_version(jpp_meta_version);
17 if (jpp_major_version < 0)
18 {
19 std::cout << "Warning: cannot extract the major version from " << jpp_meta_version << ". Assuming this is a recent version" << std::endl;
21 }
22}
23
24bool has_all_reco_stages(const Trk &track)
25{
26 return track.status == TRK_ST_FINALSTATE;
27}
28
30{
31 return jpp_major_version < JPP_VERSION_TRK_STATUS ? (track.rec_stages.size() >= 5 && track.rec_stages.back() == JMUONENERGY) : has_all_reco_stages(track);
32}
33
38
43
44bool has_jppmuon_full_fit(const Trk &track)
45{
46 return has_jppmuon_fit(track) && has_jppmuon_all_reco_stages(track);
47}
48
49bool has_shower_full_fit(const Trk &track)
50{
51 return has_shower_fit(track) && has_jppshower_all_reco_stages(track);
52}
53
54bool has_aashower_full_fit(const Trk &track)
55{
56 return has_aashower_fit(track) && has_aashower_all_reco_stages(track);
57}
std::string get_jpp_version_from_file(const char *filename)
Reads the jpp version from file.
Definition meta_utils.cc:57
int get_jpp_major_version(const std::string &version_str)
Get the jpp major version.
Definition meta_utils.cc:63
bool has_jppmuon_full_fit(const Trk &track)
Test if track has a full jppmuon fit.
bool has_all_reco_stages(const Trk &track)
Test if the track has a full reconstruction chain.
bool has_aashower_all_reco_stages(const Trk &track)
Test whether given track has a full aashower chain.
static const int JPP_VERSION_TRK_STATUS
bool has_shower_full_fit(const Trk &track)
Test if the track has a full jppshower fit.
void setup_from_meta_file(const char *filename)
Setup information from file containing metadata.
bool has_jppshower_all_reco_stages(const Trk &track)
Test whether given track has a full jppshower chain.
bool has_jppmuon_all_reco_stages(const Trk &track)
Test whether given track has a full jppmuon chain.
static std::atomic< int > jpp_major_version
bool has_aashower_full_fit(const Trk &track)
Test if the track has a full aashower fit.
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Definition Trk.hh:15
int status
MC or reconstruction status code, see km3net-dataformat/definitions/trkmembers.csv for values.
Definition Trk.hh:28
std::vector< int > rec_stages
list of identifiers of successful fitting stages resulting in this track
Definition Trk.hh:26
Auxiliary methods for selection of reconstructed tracks.
bool has_aashower_fit(const Trk &track)
Test whether given track has default shower fit in history.
bool has_jppmuon_fit(const Trk &track)
Test whether given track has default muon fit in history.
bool has_shower_fit(const Trk &track)
Test whether given track has default shower fit in history.
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:17