File indexing completed on 2025-08-03 08:20:24
0001 #ifndef MACRO_G4ACTSGEOM_C
0002 #define MACRO_G4ACTSGEOM_C
0003
0004 #include <TROOT.h> // for R__LOAD_LIBRARY
0005
0006 R__LOAD_LIBRARY(libg4eval.so)
0007 R__LOAD_LIBRARY(libtrack_reco.so)
0008 R__LOAD_LIBRARY(libtpccalib.so)
0009
0010 #include <G4_Magnet.C>
0011 #include <G4_TrkrVariables.C> // for Enable::MVTX_APPLYMISALIGNMENT, INTT_USEG4SURVEYGEOM
0012 #include <GlobalVariables.C>
0013
0014 #pragma GCC diagnostic push
0015 #pragma GCC diagnostic ignored "-Wundefined-internal"
0016 #include <trackreco/MakeActsGeometry.h>
0017 #pragma GCC diagnostic pop
0018
0019 #include <fun4all/Fun4AllServer.h>
0020
0021 namespace ACTSGEOM
0022 {
0023
0024 unsigned int mvtxMisalignment = 1;
0025 unsigned int inttMisalignment = 1;
0026 unsigned int tpcMisalignment = 1;
0027 unsigned int tpotMisalignment = 1;
0028
0029 bool mvtx_applymisalignment = Enable::MVTX_APPLYMISALIGNMENT;
0030 bool inttsurvey = Enable::INTT_USEG4SURVEYGEOM;
0031
0032 void ActsGeomInit()
0033 {
0034 static bool wasCalled = false;
0035 if (wasCalled)
0036 {
0037 return;
0038 }
0039 wasCalled = true;
0040
0041 if (!Enable::MICROMEGAS)
0042 {
0043 G4MICROMEGAS::n_micromegas_layer = 0;
0044 }
0045
0046 MagnetFieldInit();
0047
0048
0049 auto se = Fun4AllServer::instance();
0050 int verbosity = Enable::VERBOSITY;
0051
0052
0053 MakeActsGeometry* geom = new MakeActsGeometry();
0054 geom->set_drift_velocity(G4TPC::tpc_drift_velocity_reco);
0055 geom->set_tpc_tzero(G4TPC::tpc_tzero_reco);
0056 geom->Verbosity(verbosity);
0057 for (int i = 0; i < 57; i++)
0058 {
0059 if (i < 3)
0060 {
0061 geom->misalignmentFactor(i, ACTSGEOM::mvtxMisalignment);
0062 }
0063 else if (i < 7)
0064 {
0065 geom->misalignmentFactor(i, ACTSGEOM::inttMisalignment);
0066 }
0067 else if (i < 55)
0068 {
0069 geom->misalignmentFactor(i, ACTSGEOM::tpcMisalignment);
0070 }
0071 else
0072 {
0073 geom->misalignmentFactor(i, ACTSGEOM::tpotMisalignment);
0074 }
0075 }
0076
0077 geom->loadMagField(G4TRACKING::init_acts_magfield);
0078 geom->setMagField(G4MAGNET::magfield_tracking);
0079 geom->setMagFieldRescale(G4MAGNET::magfield_rescale);
0080 std::cout << "ActsGeomInit: Mvtx apply misalignment? ACTSGEOM::mvtx_applymisalignment=" << ACTSGEOM::mvtx_applymisalignment << std::endl;
0081 geom->set_mvtx_applymisalign(ACTSGEOM::mvtx_applymisalignment);
0082 std::cout << "ActsGeomInit: Use survey geometry? ACTSGEOM::inttsurvey=" << ACTSGEOM::inttsurvey << std::endl;
0083 geom->set_intt_survey(ACTSGEOM::inttsurvey);
0084 se->registerSubsystem(geom);
0085 }
0086 }
0087
0088 #endif