File indexing completed on 2025-08-03 08:18:42
0001
0002
0003 #ifndef G4MAIN_PHG4RECO_H
0004 #define G4MAIN_PHG4RECO_H
0005
0006 #include <g4decayer/EDecayType.hh>
0007
0008 #include <fun4all/SubsysReco.h>
0009
0010 #include <phfield/PHFieldConfig.h>
0011
0012 #include <list>
0013 #include <string> // for string
0014
0015
0016 class G4RunManager;
0017 class G4TBMagneticFieldSetup;
0018 class G4UImanager;
0019 class G4UImessenger;
0020 class G4VisManager;
0021 class PHCompositeNode;
0022 class PHG4DisplayAction;
0023 class PHG4PhenixDetector;
0024 class PHG4PhenixEventAction;
0025 class PHG4PhenixStackingAction;
0026 class PHG4PhenixSteppingAction;
0027 class PHG4PhenixTrackingAction;
0028 class PHG4PrimaryGeneratorAction;
0029 class PHG4Subsystem;
0030 class PHG4UIsession;
0031
0032
0033
0034
0035
0036
0037 class PHG4Reco : public SubsysReco
0038 {
0039 public:
0040 enum DecayerOptions
0041 {
0042 kGEANTInternalDecayer = 0,
0043 kPYTHIA6Decayer = 1,
0044 kEvtGenDecayer = 2,
0045
0046 };
0047
0048
0049 explicit PHG4Reco(const std::string &name = "PHG4RECO");
0050
0051
0052 ~PHG4Reco() override;
0053
0054
0055 int Init(PHCompositeNode *) override;
0056
0057 int InitRun(PHCompositeNode *topNode) override;
0058
0059
0060 int process_event(PHCompositeNode *) override;
0061
0062
0063 int ResetEvent(PHCompositeNode *) override;
0064
0065
0066 void Print(const std::string &what = std::string()) const override;
0067
0068
0069 void registerSubsystem(PHG4Subsystem *subsystem)
0070 {
0071 m_SubsystemList.push_back(subsystem);
0072 }
0073
0074
0075 int ApplyCommand(const std::string &cmd);
0076
0077
0078 int StartGui();
0079
0080 int InitField(PHCompositeNode *topNode);
0081
0082
0083 void set_field(const float tesla)
0084 {
0085 m_MagneticField = tesla;
0086 }
0087
0088
0089
0090
0091 void set_field_map(const std::string &fmap, const PHFieldConfig::FieldConfigTypes dim)
0092 {
0093 m_FieldMapFile = fmap;
0094 m_FieldConfigType = dim;
0095 }
0096
0097
0098 void set_field_rescale(const float rescale) { m_MagneticFieldRescale = rescale; }
0099
0100 void set_force_decay(EDecayType force_decay_type)
0101 {
0102 m_ActiveForceDecayFlag = true;
0103 m_ForceDecayType = force_decay_type;
0104 }
0105
0106 void set_decayer(DecayerOptions type) { m_Decayer = type; }
0107
0108
0109 void export_geometry(bool b, const std::string &filename = "sPHENIXGeom.root")
0110 {
0111 m_ExportGeometry = b;
0112 m_ExportGeomFilename = filename;
0113 }
0114
0115
0116 void save_DST_geometry(bool b) { m_SaveDstGeometryFlag = b; }
0117 void SetWorldSizeX(const double sx) { m_WorldSize[0] = sx; }
0118 void SetWorldSizeY(const double sy) { m_WorldSize[1] = sy; }
0119 void SetWorldSizeZ(const double sz) { m_WorldSize[2] = sz; }
0120 double GetWorldSizeX() const { return m_WorldSize[0]; }
0121 double GetWorldSizeY() const { return m_WorldSize[1]; }
0122 double GetWorldSizeZ() const { return m_WorldSize[2]; }
0123 void SetWorldShape(const std::string &s) { m_WorldShape = s; }
0124 void SetWorldMaterial(const std::string &s) { m_WorldMaterial = s; }
0125 void SetPhysicsList(const std::string &s) { m_PhysicsList = s; }
0126 void set_rapidity_coverage(const double eta);
0127
0128 int setupInputEventNodeReader(PHCompositeNode *);
0129
0130 static void G4Seed(const unsigned int i);
0131
0132 PHG4Subsystem *getSubsystem(const std::string &name);
0133 PHG4DisplayAction *GetDisplayAction() { return m_DisplayAction; }
0134 void Dump_GDML(const std::string &filename);
0135 void Dump_G4_GDML(const std::string &filename);
0136
0137 void G4Verbosity(const int i);
0138
0139
0140 void setDisableUserActions(bool b = true) { m_disableUserActions = b; }
0141 void ApplyDisplayAction();
0142
0143 void CustomizeEvtGenDecay(const std::string &DecayFile)
0144 {
0145 EvtGenDecayFile = DecayFile;
0146 if (!EvtGenDecayFile.empty()) CustomizeDecay = true;
0147 }
0148
0149 private:
0150 static void g4guithread(void *ptr);
0151 int InitUImanager();
0152 void DefineMaterials();
0153 void DefineRegions();
0154
0155 float m_MagneticField{std::numeric_limits<float>::signaling_NaN()};
0156 float m_MagneticFieldRescale = 1.0;
0157 double m_WorldSize[3]{1000., 1000., 1000.};
0158
0159
0160 G4TBMagneticFieldSetup *m_Field = nullptr;
0161
0162
0163 G4RunManager *m_RunManager = nullptr;
0164
0165
0166 PHG4UIsession *m_UISession = nullptr;
0167
0168
0169 PHG4PhenixDetector *m_Detector = nullptr;
0170
0171
0172 PHG4PhenixEventAction *m_EventAction = nullptr;
0173
0174
0175 PHG4PhenixStackingAction *m_StackingAction = nullptr;
0176
0177
0178 PHG4PhenixSteppingAction *m_SteppingAction = nullptr;
0179
0180
0181 PHG4PhenixTrackingAction *m_TrackingAction = nullptr;
0182
0183
0184
0185 PHG4DisplayAction *m_DisplayAction = nullptr;
0186
0187
0188 PHG4PrimaryGeneratorAction *m_GeneratorAction = nullptr;
0189
0190
0191 std::list<PHG4Subsystem *> m_SubsystemList;
0192
0193
0194 G4VisManager *m_VisManager = nullptr;
0195
0196
0197 G4UImessenger *m_Fun4AllMessenger = nullptr;
0198
0199
0200 G4UImanager *m_UImanager = nullptr;
0201 double m_EtaCoverage = 1.0;
0202 PHFieldConfig::FieldConfigTypes m_FieldConfigType = PHFieldConfig::kFieldUniform;
0203 std::string m_FieldMapFile = "NONE";
0204 std::string m_WorldShape = "G4Tubs";
0205 std::string m_WorldMaterial = "G4_AIR";
0206 std::string m_PhysicsList = "FTFP_BERT";
0207
0208 bool m_ExportGeometry = false;
0209 std::string m_ExportGeomFilename = "sPHENIXGeom.root";
0210
0211
0212
0213 bool m_ActiveForceDecayFlag = false;
0214
0215 DecayerOptions m_Decayer = kEvtGenDecayer;
0216 std::string EvtGenDecayFile = "";
0217 bool CustomizeDecay = false;
0218
0219 EDecayType m_ForceDecayType = kAll;
0220
0221 bool m_SaveDstGeometryFlag = true;
0222 bool m_disableUserActions = false;
0223 };
0224
0225 #endif