forked from sPHENIX-Collaboration/coresoftware
/
DSTEmulator.h
137 lines (105 loc) · 3.26 KB
/
DSTEmulator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#ifndef G4EVAL_DSTEMULATOR_H
#define G4EVAL_DSTEMULATOR_H
/*!
* \file TrackEvaluation.h
* \author Hugo Pereira Da Costa <hugo.pereira-da-costa@cea.fr>
*/
#include <fun4all/SubsysReco.h>
#include <trackbase/TrkrDefs.h>
#include <trackbase/ActsSurfaceMaps.h>
#include <trackbase/ActsTrackingGeometry.h>
#include <trackbase_historic/ActsTransformations.h>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <TRandom.h>
#include "DSTCompressor.h"
class PHG4Hit;
class PHG4HitContainer;
class PHG4Particle;
class PHG4TruthInfoContainer;
class SvtxTrack;
class SvtxTrackMap;
class TrackEvaluationContainerv1;
class TrkrCluster;
class TrkrClusterContainer;
class TrkrClusterHitAssoc;
class TrkrHitSetContainer;
class TrkrHitTruthAssoc;
class TFile;
class TNtuple;
class DSTEmulator : public SubsysReco
{
public:
//! constructor
DSTEmulator( const std::string& = "DSTEmulator",
const std::string &filename = "DSTana.root",
int nBits = 8,
int sabotage = 0,
bool compress = true);
//! global initialization
int Init(PHCompositeNode*) override;
//! run initialization
int InitRun(PHCompositeNode*) override;
//! event processing
int process_event(PHCompositeNode*) override;
//! end of processing
int End(PHCompositeNode*) override;
private:
//! load nodes
int load_nodes( PHCompositeNode* );
//! evaluate tracks
void evaluate_tracks();
float compress_dx(float in_val);
float compress_dy(float in_val);
// get geant hits associated to a cluster
using G4HitSet = std::set<PHG4Hit*>;
G4HitSet find_g4hits( TrkrDefs::cluskey ) const;
Acts::Vector3D getGlobalPosition(TrkrCluster*) const;
//! get G4Particle id of max contributor to a given track
std::pair<int,int> get_max_contributor( SvtxTrack* ) const;
//! get embedded id for given g4track
int get_embed(PHG4Particle*) const;
//! evaluation node
TrackEvaluationContainerv1* m_container = nullptr;
//! hits
TrkrHitSetContainer* m_hitsetcontainer = nullptr;
//! clusters
TrkrClusterContainer* m_cluster_map = nullptr;
//! cluster to hit association
TrkrClusterHitAssoc* m_cluster_hit_map = nullptr;
//! hit to truth association
TrkrHitTruthAssoc* m_hit_truth_map = nullptr;
//! tracks
SvtxTrackMap* m_track_map = nullptr;
//!@name geant4 hits
//@{
PHG4HitContainer* m_g4hits_tpc = nullptr;
PHG4HitContainer* m_g4hits_intt = nullptr;
PHG4HitContainer* m_g4hits_mvtx = nullptr;
PHG4HitContainer* m_g4hits_micromegas = nullptr;
//@}
//! truth information
PHG4TruthInfoContainer* m_g4truthinfo = nullptr;
// map cluster keys to g4hits
using G4HitMap = std::map<TrkrDefs::cluskey,G4HitSet>;
mutable G4HitMap m_g4hit_map;
ActsSurfaceMaps *m_surfMaps = nullptr;
ActsTrackingGeometry *m_tGeometry = nullptr;
ActsTransformations m_transform;
TNtuple *_dst_data;
// output file
std::string _filename;
TFile *_tfile;
DSTCompressor* m_compressor;
// Number of bits for the integer representation after compression
int nBits = 8;
// replace the decompressed residuals by a large number
int sabotage = 0;
// random seed
TRandom rnd;
// switch to apply the compressed residuals to cluster positions
bool apply_compression = true;
};
#endif // G4EVAL_DSTEMULATOR_H