File indexing completed on 2025-08-05 08:13:29
0001
0002 #include <iostream>
0003
0004 using namespace std;
0005
0006 int Fun4All_G4_LeadBrick(const int nEvents = 10, const char *outfile = NULL)
0007 {
0008 gSystem->Load("libfun4all");
0009 gSystem->Load("libg4detectors");
0010 gSystem->Load("libg4testbench");
0011 gSystem->Load("libg4eval");
0012
0013
0014
0015
0016 Fun4AllServer *se = Fun4AllServer::instance();
0017 se->Verbosity(1);
0018
0019
0020 PHG4ParticleGun *gun = new PHG4ParticleGun("PGUN");
0021
0022 gun->set_name("proton");
0023
0024
0025 gun->set_vtx(0, 0, -100);
0026 gun->set_mom(0, 0, 120);
0027 se->registerSubsystem(gun);
0028
0029
0030 PHG4Reco *g4Reco = new PHG4Reco();
0031
0032 g4Reco->set_field(0);
0033
0034 g4Reco->SetWorldSizeX(200);
0035 g4Reco->SetWorldSizeY(200);
0036 g4Reco->SetWorldSizeZ(200);
0037
0038 g4Reco->SetWorldShape("G4BOX");
0039
0040 g4Reco->SetWorldMaterial("G4_AIR");
0041
0042 g4Reco->SetPhysicsList("FTFP_BERT");
0043
0044
0045 double xsize = 200.;
0046 double ysize = 200.;
0047 double zsize = 400.;
0048 PHG4BlockSubsystem *box = new PHG4BlockSubsystem("LeadBrick");
0049 box->set_double_param("size_x", 20);
0050 box->set_double_param("size_y", 20);
0051 box->set_double_param("size_z", 10);
0052 box->set_double_param("place_z", 0);
0053 box->set_string_param("material", "G4_Pb");
0054 box->SetActive(0);
0055 g4Reco->registerSubsystem(box);
0056
0057 for (int stave = 0; stave < 4; ++stave)
0058 {
0059 box = new PHG4BlockSubsystem("MVTX", stave);
0060 box->SuperDetector("MVTX");
0061 box->set_double_param("size_x", 2);
0062 box->set_double_param("size_y", 1);
0063 box->set_double_param("size_z", 50e-4);
0064 box->set_double_param("place_z", 10 * (stave + 1));
0065 box->set_string_param("material", "G4_Si");
0066 box->SetActive(1);
0067 g4Reco->registerSubsystem(box);
0068 }
0069
0070 PHG4TruthSubsystem *truth = new PHG4TruthSubsystem();
0071 g4Reco->registerSubsystem(truth);
0072
0073 se->registerSubsystem(g4Reco);
0074
0075
0076
0077
0078
0079
0080 PHG4DSTReader *ana = new PHG4DSTReader(
0081 string("LeadBrick_DSTReader.root"));
0082 ana->set_save_particle(true);
0083 ana->set_load_all_particle(false);
0084 ana->set_load_active_particle(true);
0085 ana->set_save_vertex(true);
0086 ana->AddNode("LeadBrick");
0087 ana->AddNode("MVTX");
0088 se->registerSubsystem(ana);
0089
0090
0091 Fun4AllInputManager *in = new Fun4AllDummyInputManager("JADE");
0092 se->registerInputManager(in);
0093
0094
0095
0096 if (nEvents > 0)
0097 {
0098 se->run(nEvents);
0099
0100 se->End();
0101 std::cout << "All done" << std::endl;
0102
0103
0104 delete se;
0105 gSystem->Exit(0);
0106 }
0107 return;
0108 }
0109
0110 PHG4ParticleGun *get_gun(const char *name = "PGUN")
0111 {
0112 Fun4AllServer *se = Fun4AllServer::instance();
0113 PHG4ParticleGun *pgun = (PHG4ParticleGun *) se->getSubsysReco(name);
0114 return pgun;
0115 }