hpstr
The Heavy Photon Search Toolkit for Reconstruction (hpstr) provides an interface to physics data from the HPS experiment saved in the LCIO format and converts it into an ROOT based format.
Loading...
Searching...
No Matches
utilities.h
Go to the documentation of this file.
1#ifndef _UTILITIES_
2#define _UTILITIES_
3
4#include <EVENT/LCCollection.h>
5#include <EVENT/Track.h>
6#include <EVENT/ReconstructedParticle.h>
7#include <EVENT/Vertex.h>
8#include <EVENT/TrackerHit.h>
9#include <EVENT/TrackState.h>
10#include <EVENT/TrackerRawData.h>
11#include <EVENT/CalorimeterHit.h>
12#include <EVENT/Cluster.h>
13#include <IMPL/CalorimeterHitImpl.h>
14#include <IMPL/LCGenericObjectImpl.h>
15#include <IMPL/TrackerHitImpl.h>
16#include <IMPL/ClusterImpl.h>
17#include <UTIL/LCRelationNavigator.h>
18#include <UTIL/BitField64.h>
19
20#include <vector>
21#include <iostream>
22#include <fstream>
23#include <json.hpp>
24using json = nlohmann::json;
25
26//-----------//
27// hpstr //
28//-----------//
29#include "Collections.h"
30#include "Processor.h"
31#include "Particle.h"
32#include "Track.h"
33#include "Vertex.h"
34#include "RawSvtHit.h"
35#include "CalCluster.h"
36#include "CalHit.h"
37#include "Event.h"
38#include "TrackerHit.h"
39
40//-----------//
41// ROOT //
42//-----------//
43#include "TRefArray.h"
44
45namespace utils {
54 bool hasCollection(EVENT::LCEvent* lc_event,const std::string& collection);
55
62 Vertex* buildVertex(EVENT::Vertex* lc_vertex);
63
72 Particle* buildParticle(EVENT::ReconstructedParticle* lc_particle,
73 std::string trackstate_location,
74 EVENT::LCCollection* gbl_kink_data,
75 EVENT::LCCollection* track_data);
76
85 Track* buildTrack(EVENT::Track* lc_track,
86 std::string trackstate_location,
87 EVENT::LCCollection* gbl_kink_data,
88 EVENT::LCCollection* track_data);
89
90
99 bool IsSameTrack(Track* trk1, Track* trk2);
100
101 RawSvtHit* buildRawHit(EVENT::TrackerRawData* rawTracker_hit,
102 EVENT::LCCollection* raw_svt_hit_fits);
103
112 TrackerHit* buildTrackerHit(IMPL::TrackerHitImpl* lc_trackerHit,bool rotate=true, int type = 0);
113
120 CalCluster* buildCalCluster(EVENT::Cluster* lc_cluster);
121
133 bool addRawInfoTo3dHit(TrackerHit* tracker_hit,
134 IMPL::TrackerHitImpl* lc_tracker_hit,
135 EVENT::LCCollection* raw_svt_fits,
136 std::vector<RawSvtHit*>* rawHits = nullptr, int type = 0, bool storeRawHit = true);
137
138
147 bool isUsedByTrack(IMPL::TrackerHitImpl* lc_tracker_hit,
148 EVENT::Track* lc_track);
149
158 bool isUsedByTrack(TrackerHit* tracker_hit,
159 EVENT::Track* lc_track);
160
170 bool getParticlesFromVertex(Vertex* vtx, Particle* ele, Particle* pos);
171
177 static UTIL::BitField64 decoder("system:6,barrel:3,layer:4,module:12,sensor:1,side:32:-2,strip:12");
178
184 double getKalmanTrackL1Isolations(Track* track, std::vector<TrackerHit*>* siClusters);
185
191 void get2016KFMCTruthHitCodes(Track* ele_trk, Track* pos_trk, int& L1L2hitCode, int& L1hitCode, int& L2hitCode);
192
198 double v0_projection_to_target_significance(json v0proj_fits, int run, double &vtx_proj_x, double &vtx_proj_y,
199 double &vtx_proj_x_signif, double &vtx_proj_y_signif,
200 double &vtx_proj_x_centered, double &vtx_proj_y_centered,
201 double vtx_x, double vtx_y, double vtx_z,
202 double vtx_px, double vtx_py, double vtx_pz, bool debug = false);
203
204 double v0_projection_to_target_significance(json v0proj_fits, int run, double &vtx_proj_x, double &vtx_proj_y,
205 double &vtx_proj_x_signif, double &vtx_proj_y_signif, Vertex* vtx,
206 double &vtx_proj_x_err, double &vtx_proj_y_err,
207 double &vtx_proj_x_centered, double &vtx_proj_y_centered, bool debug = false);
208
209 // Print a side-by-side comparison of the manually-projected target position
210 // (computed from vtx position + momentum) vs the LCIO-stored values from the
211 // Vertex object (getTgtProjX/Y/SigmaX/SigmaY). Useful for validating consistency.
212 void debug_target_projection(double target_pos, Vertex* vtx);
213}
214
215#endif //UTILITIES
nlohmann::json json
Class that encapsulate calorimeter hit information.
Class defining methods used to access event information and data collections.
Class used to encapsulate information about a particle.
Base classes for all user event processing components to extend.
Class used to encapsulate raw svt hit information.
Class used to encapsulate track information.
Class used to encapsulate tracker hit information.
Class used to encapsulate Vertex information.
Definition Track.h:32
bool addRawInfoTo3dHit(TrackerHit *tracker_hit, IMPL::TrackerHitImpl *lc_tracker_hit, EVENT::LCCollection *raw_svt_fits, std::vector< RawSvtHit * > *rawHits=nullptr, int type=0, bool storeRawHit=true)
description
CalCluster * buildCalCluster(EVENT::Cluster *lc_cluster)
description
Definition utilities.cxx:95
Track * buildTrack(EVENT::Track *lc_track, std::string trackstate_location, EVENT::LCCollection *gbl_kink_data, EVENT::LCCollection *track_data)
description
Vertex * buildVertex(EVENT::Vertex *lc_vertex)
description
Definition utilities.cxx:27
bool hasCollection(EVENT::LCEvent *lc_event, const std::string &collection)
description
Definition utilities.cxx:18
void debug_target_projection(double target_pos, Vertex *vtx)
bool isUsedByTrack(IMPL::TrackerHitImpl *lc_tracker_hit, EVENT::Track *lc_track)
description
TrackerHit * buildTrackerHit(IMPL::TrackerHitImpl *lc_trackerHit, bool rotate=true, int type=0)
description
double getKalmanTrackL1Isolations(Track *track, std::vector< TrackerHit * > *siClusters)
description
static UTIL::BitField64 decoder("system:6,barrel:3,layer:4,module:12,sensor:1,side:32:-2,strip:12")
description
bool getParticlesFromVertex(Vertex *vtx, Particle *ele, Particle *pos)
description
Particle * buildParticle(EVENT::ReconstructedParticle *lc_particle, std::string trackstate_location, EVENT::LCCollection *gbl_kink_data, EVENT::LCCollection *track_data)
description
Definition utilities.cxx:47
void get2016KFMCTruthHitCodes(Track *ele_trk, Track *pos_trk, int &L1L2hitCode, int &L1hitCode, int &L2hitCode)
description
bool IsSameTrack(Track *trk1, Track *trk2)
description
double v0_projection_to_target_significance(json v0proj_fits, int run, double &vtx_proj_x, double &vtx_proj_y, double &vtx_proj_x_signif, double &vtx_proj_y_signif, double &vtx_proj_x_centered, double &vtx_proj_y_centered, double vtx_x, double vtx_y, double vtx_z, double vtx_px, double vtx_py, double vtx_pz, bool debug=false)
description
RawSvtHit * buildRawHit(EVENT::TrackerRawData *rawTracker_hit, EVENT::LCCollection *raw_svt_hit_fits)