File indexing completed on 2025-08-06 08:19:07
0001 #ifndef G4EVAL_DSTEMULATOR_H
0002 #define G4EVAL_DSTEMULATOR_H
0003
0004
0005
0006
0007
0008
0009 #include "DSTCompressor.h"
0010
0011 #include <trackbase/ActsGeometry.h>
0012 #include <trackbase/TrkrDefs.h>
0013 #include <trackbase_historic/ActsTransformations.h>
0014
0015 #include <fun4all/SubsysReco.h>
0016
0017 #include <TRandom.h>
0018
0019 #include <map>
0020 #include <set>
0021 #include <string>
0022 #include <vector>
0023
0024 class PHG4Hit;
0025 class PHG4HitContainer;
0026 class PHG4Particle;
0027 class PHG4TruthInfoContainer;
0028 class SvtxTrack;
0029 class SvtxTrackMap;
0030 class TrackEvaluationContainerv1;
0031 class TrkrCluster;
0032 class TrkrClusterContainer;
0033 class TrkrClusterHitAssoc;
0034 class TrkrHitSetContainer;
0035 class TrkrHitTruthAssoc;
0036
0037 class TFile;
0038 class TNtuple;
0039
0040 class DSTEmulator : public SubsysReco
0041 {
0042 public:
0043
0044 DSTEmulator(const std::string& = "DSTEmulator",
0045 const std::string& filename = "DSTana.root",
0046 int nBits = 8,
0047 int sabotage = 0,
0048 bool compress = true);
0049
0050
0051 int Init(PHCompositeNode*) override;
0052
0053
0054 int InitRun(PHCompositeNode*) override;
0055
0056
0057 int process_event(PHCompositeNode*) override;
0058
0059
0060 int End(PHCompositeNode*) override;
0061
0062 private:
0063
0064 int load_nodes(PHCompositeNode*);
0065
0066
0067 void evaluate_tracks();
0068 float compress_dx(float in_val);
0069 float compress_dy(float in_val);
0070
0071 using G4HitSet = std::set<PHG4Hit*>;
0072 G4HitSet find_g4hits(TrkrDefs::cluskey) const;
0073 Acts::Vector3 getGlobalPosition(TrkrDefs::cluskey, TrkrCluster*) const;
0074
0075 std::pair<int, int> get_max_contributor(SvtxTrack*) const;
0076
0077
0078 int get_embed(PHG4Particle*) const;
0079
0080
0081 TrackEvaluationContainerv1* m_container = nullptr;
0082
0083
0084 TrkrHitSetContainer* m_hitsetcontainer = nullptr;
0085
0086
0087 TrkrClusterContainer* m_cluster_map = nullptr;
0088
0089
0090 TrkrClusterHitAssoc* m_cluster_hit_map = nullptr;
0091
0092
0093 TrkrHitTruthAssoc* m_hit_truth_map = nullptr;
0094
0095
0096 SvtxTrackMap* m_track_map = nullptr;
0097
0098
0099
0100 PHG4HitContainer* m_g4hits_tpc = nullptr;
0101 PHG4HitContainer* m_g4hits_intt = nullptr;
0102 PHG4HitContainer* m_g4hits_mvtx = nullptr;
0103 PHG4HitContainer* m_g4hits_micromegas = nullptr;
0104
0105
0106
0107 PHG4TruthInfoContainer* m_g4truthinfo = nullptr;
0108
0109
0110 using G4HitMap = std::map<TrkrDefs::cluskey, G4HitSet>;
0111 mutable G4HitMap m_g4hit_map;
0112
0113 ActsGeometry* m_tGeometry = nullptr;
0114 ActsTransformations m_transform;
0115
0116 TNtuple* _dst_data{};
0117
0118
0119 std::string _filename;
0120 TFile* _tfile;
0121
0122 DSTCompressor* m_compressor{};
0123
0124
0125 int nBits = 8;
0126
0127 int sabotage = 0;
0128
0129 TRandom rnd;
0130
0131 bool apply_compression = true;
0132 };
0133
0134 #endif