d04706582f
Scales the default transverse width (xywidth 50->200 cm) and every layer thickness across the example/production geometries (run_pbwo4, example.py/ipynb, run_sampling configs, export_xsec) by the same factor, so the calo grows uniformly in x, y, and z. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
60 lines
1.7 KiB
C++
60 lines
1.7 KiB
C++
#include "GeometryDescriptor.hh"
|
|
#include "G4System.hh"
|
|
|
|
#include <cstdlib>
|
|
#include <iostream>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
int main(int argc, char** argv) {
|
|
int nEvents = 10;
|
|
double energy_GeV = 1.0;
|
|
|
|
int seed = -1;
|
|
if (const char* seedEnv = std::getenv("MINICALOSIM_SEED")) {
|
|
try {
|
|
std::size_t pos = 0;
|
|
std::string seedStr(seedEnv);
|
|
int parsed = std::stoi(seedStr, &pos);
|
|
if (pos == seedStr.size()) seed = parsed;
|
|
} catch (const std::exception&) {
|
|
// Not a valid integer; fall back to time-based seed.
|
|
}
|
|
}
|
|
|
|
if (argc > 3) {
|
|
std::cerr << "Usage: run_pbwo4 [nEvents] [energy_GeV]" << std::endl;
|
|
return 1;
|
|
}
|
|
if (argc >= 2) {
|
|
try {
|
|
nEvents = std::stoi(argv[1]);
|
|
if (nEvents <= 0) throw std::invalid_argument("must be positive");
|
|
} catch (const std::exception& e) {
|
|
std::cerr << "Invalid nEvents '" << argv[1] << "': " << e.what() << std::endl;
|
|
return 1;
|
|
}
|
|
}
|
|
if (argc == 3) {
|
|
try {
|
|
energy_GeV = std::stod(argv[2]);
|
|
if (energy_GeV <= 0) throw std::invalid_argument("must be positive");
|
|
} catch (const std::exception& e) {
|
|
std::cerr << "Invalid energy_GeV '" << argv[2] << "': " << e.what() << std::endl;
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
std::string outfile = "pbwo4_" + std::to_string(nEvents) + "events_hits.root";
|
|
|
|
GeometryDescriptor gd;
|
|
gd.addLayer(80.0, "G4_PbWO4", true, 10, 10);
|
|
|
|
G4System g4;
|
|
g4.init(gd, seed);
|
|
g4.run_batch(nEvents, {"e-"}, energy_GeV, energy_GeV, outfile);
|
|
|
|
std::cout << "Saved " << nEvents << " events to " << outfile << std::endl;
|
|
return 0;
|
|
}
|