Skip to content
Snippets Groups Projects
Commit e416bc79 authored by Marilena Bandieramonte's avatar Marilena Bandieramonte
Browse files

Merge branch 'documentation-and-configs' into 'master'

FullSimLight - Allow geometry filename to be overwritten from the command line

See merge request !180
parents c0b34b3b 02d34939
No related branches found
No related tags found
1 merge request!180FullSimLight - Allow geometry filename to be overwritten from the command line
......@@ -41,11 +41,11 @@ static const std::string fullSimLightShareDir=FULLSIMLIGHTSHAREDIR;
static std::string parMacroFileName = fullSimLightShareDir+"/macro.g4";
static bool parIsPerformance = false;
static bool parIsCustomUserActions = false;
static G4String geometryFileName ;
static G4String geometryFileName = "";
static std::string parPhysListName = "FTFP_BERT";
static bool parRunOverlapCheck = false;
bool isBatch = true;
static std::string parConfigFileName = "config.json";
static std::string parConfigFileName = "atlas-config.json";
......@@ -144,12 +144,12 @@ int main(int argc, char** argv) {
#endif
// 1. Physics list
if(!isBatch){
if(!isBatch)
{
simConfig::parse_json_file(parConfigFileName);
parPhysListName = simConfig::fsl.physicsList;
if(simConfig::fsl.eventGeneratorName=="Pythia")
{
#if USE_PYTHIA
......@@ -180,14 +180,11 @@ int main(int argc, char** argv) {
// 3. User action
if(!isBatch && simConfig::fsl.userActions.size()>0) parIsCustomUserActions = true;
FSLActionInitialization* actInit = new FSLActionInitialization(parIsPerformance,parIsCustomUserActions);
if(parIsCustomUserActions){
actInit->SetActions(
simConfig::fsl.userActions
);
actInit->SetActions(simConfig::fsl.userActions);
}
if(!isBatch)
......@@ -218,27 +215,23 @@ int main(int argc, char** argv) {
} else
{
// std::ifstream ifs(parConfigFileName);
// auto jf=json::parse(ifs);
// simConfig::fslConfig fsl;
// simConfig::regionConfig rc;
//read and store the configuration into the fslConfig struct
// simConfig::from_json(jf, fsl);
detector->SetGeometryFileName (simConfig::fsl.geometry);
if(geometryFileName=="" && simConfig::fsl.geometry==""){
G4cout << " *** ERROR : Geometry file is required. Please provide it in a json configuration file or via command line using the -g flag " << G4endl;
Help();
exit(-1);
}
//gives the possibility to override the geometry from the command line
if(geometryFileName!="") detector->SetGeometryFileName (geometryFileName);
else
detector->SetGeometryFileName (simConfig::fsl.geometry);
runManager->SetUserInitialization(detector);
if(simConfig::fsl.magFieldType=="Plugin")
{
detector->SetMagFieldPluginPath(simConfig::fsl.magFieldPlugin);
detector->SetMagFieldPluginPath(simConfig::fsl.magFieldPlugin);
}
//parse RegionsData
std::vector<std::string> Regions;
std::vector<std::vector<G4String>> RootLVNames;
......@@ -248,16 +241,7 @@ int main(int argc, char** argv) {
std::vector<double> gamma_cut;
for (const auto& element : simConfig::jf["Regions data"]){
// std::cout<<"RegionName: "<<element["RegionName"]<<std::endl;
// std::cout<<"RootLVNames: "<<element["RootLVNames"]<<std::endl;
// std::cout<<"GammaCut: "<<element["GammaCut"]<<std::endl;
// std::cout<<"ElectronCut: "<<element["ElectronCut"]<<std::endl;
// std::cout<<"PositronCut: "<<element["PositronCut"]<<std::endl;
// std::cout<<"ProtonCut: "<<element["ProtonCut"]<<std::endl;
//actually read the data and save them in a simConfig::regionConfig object (might be useful for the configuration later on)
simConfig::from_json(element, simConfig::rc);
Regions.push_back(simConfig::rc.regionName);
RootLVNames.push_back(simConfig::rc.rootLVNames);
......@@ -265,14 +249,7 @@ int main(int argc, char** argv) {
proton_cut.push_back(simConfig::rc.protonCut);
positron_cut.push_back(simConfig::rc.positronCut);
gamma_cut.push_back(simConfig::rc.gammaCut);
// std::cout<<"RegionName: "<<rc.regionName<<std::endl;
// std::cout<<"RootLVNames size: "<<rc.rootLVNames.size()<<std::endl;
// std::cout<<"GammaCut: "<<rc.gammaCut<<std::endl;
// std::cout<<"ElectronCut: "<<rc.electronCut<<std::endl;
// std::cout<<"PositronCut: "<<rc.positronCut<<std::endl;
// std::cout<<"ProtonCut: "<<rc.protonCut<<std::endl;
// std::cout<<"------------------------------------------------"<<std::endl;
}
detector->ConfigureRegionsFSL(Regions, RootLVNames, electron_cut, proton_cut, positron_cut, gamma_cut);
......
# How to build FullSimLight
# Prerequisites
FullSimLight depends on Geant4, Xerces-C and HDF5. Additionally, the user might want to install [Pythia8] (http://home.thep.lu.se/Pythia/ ) and [HepMC3](https://gitlab.cern.ch/hepmc/HepMC3) as optional dependencies.
# Standard build
FullSimLight can be built as part of the GeoModel build, by enabling the related configuration flag `GEOMODEL_BUILD_FULLSIMLIGHT`:
......@@ -35,7 +37,7 @@ ls ../install
## How to use a custom version of Xerces-C
The Geant4 GDML format depends on teh Xerces-C library. Therefore, different Geant4 releases can use different versions of the Xerecs-C library.
The Geant4 GDML format depends on the Xerces-C library. Therefore, different Geant4 releases can use different versions of the Xerces-C library.
If you want to build FullSimLight with a custom, locally installed Xerces-C library, you can pass the `XercesC_INCLUDE_DIR` and `XercesC_LIBRARY` variable to CMake while configuring the build of FullSimLight:
......
......@@ -7,6 +7,7 @@ If you still didn't clone the repository you can clone it recursively:
```c++
git clone --recursive https://gitlab.cern.ch/GeoModelDev/GeoModel.git
```
Alternatively, if you already cloned the GeoModel repository, it will be sufficient to type the following commands from the main repository folder:
```c++
......@@ -20,7 +21,7 @@ A flag is available to build the ATLAS extentions (by default OFF) and it should
cmake ../ -DGEOMODEL_BUILD_ATLASEXTENSIONS=ON
```
A configuration file {{atlas-conf.json}} with all the ATLAS specific customizations is provided with the ATLASExtensions and will be installed under {{<install>/share/FullSimLight/ATLAS}}. In order to run a Geant4 ATLAS with your favourite geometry tag you only have to run the following:
A configuration file **atlas-conf.json** with all the ATLAS specific customizations is provided with the ATLASExtensions and will be installed under **<install>/share/FullSimLight/ATLAS**. In order to run a Geant4 ATLAS with your favourite geometry tag you only have to run the following:
```c++
./fullSimLight -g geometry.db -c atlas-conf.json
```
......
......@@ -8,6 +8,8 @@ FullSimLight package consists of different tools based on [Geant4](https://geant
- gmgeantino: a tool to generate geantino maps from your input geometry
- gm2gdml: a tool to convert geometries and dump them in gdml format.
For instructions on how to build FullSimLight, please refer to the [Build FullSimLight ](https://geomodel.web.cern.ch/home/dev/build_fullsimlight/) page.
## Detector Construction
### Geometry:
......@@ -17,13 +19,15 @@ Use the -g flag to specify the name of the input geometry file.
### ATLAS Geometry Files:
The .gdml and .SQLite files of ATLAS geometry tags ATLAS-R2-2016-01-00-01 are available at:
At installation time an ATLAS geometry file and the ATLAS Magnetic field map file will be automatically downloaded and installed under *< path-to-install >/share/FullSimLight/ATLAS* if the user will activate the `GEOMODEL_INSTALL_FSLDATA` flag at compile time.
Additional .gdml and .SQLite files of ATLAS geometry tag ATLAS-R2-2016-01-00-01 are available at:
s
```bash
wget https://gitlab.cern.ch/GeoModelATLAS/geometry-data/raw/master/geometry/geometry-ATLAS-R2-2016-01-00-01.gdml
wget https://geomodel.web.cern.ch/atlas-geometry-data/geometry-ATLAS-R2-2016-01-00-01.db
```
For instructions on how to produce your own SQLite dump of your preferred ATLAS geometry tag, please have a look at the ATLAS Extensions section.
For instructions on how to produce your own SQLite dump of your preferred ATLAS geometry tag, please refet to the [ATLAS Extensions](https://geomodel.web.cern.ch/home/fullsimlight/atlas-extensions/) page.
## FullSimLight: run and options
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment