From 4b2c459bc91861733a06facb2840bd4d023bb0cc Mon Sep 17 00:00:00 2001 From: rakitha beminiwattha Date: Sat, 9 Sep 2017 23:20:16 -0500 Subject: [PATCH 001/443] trying to add cadmesh into remoll --- CMakeLists.txt | 7 ++++++- src/remollDetectorConstruction.cc | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1016dcd65..4cc80b19a 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,6 +48,9 @@ if(USE_BOOST) endif() endif() +#CADMesh +find_package(cadmesh) +#End of CADMesh #---------------------------------------------------------------------------- # Find Geant4 package, activating all available UI and Vis drivers by default @@ -108,9 +111,11 @@ file(GLOB libheaders ${PROJECT_SOURCE_DIR}/include/*.hh) # add_executable(remoll remoll.cc ${CMAKE_CURRENT_BINARY_DIR}/include/gitinfo.hh ${sources} ${headers} remollDict.cxx) add_library(remollroot SHARED ${CMAKE_CURRENT_BINARY_DIR}/include/gitinfo.hh ${libsources} ${libheaders} remollDict.cxx) -target_link_libraries(remoll ${Geant4_LIBRARIES} ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ) +#target_link_libraries(remoll ${Geant4_LIBRARIES} ${ROOT_LIBRARIES} ${Boost_LIBRARIES}) +target_link_libraries(remoll ${Geant4_LIBRARIES} ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${cadmesh_LIBRARIES}) target_link_libraries(remollroot ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ) + #---------------------------------------------------------------------------- # Copy all scripts to the build directory, i.e. the directory in which we # build remoll. This is so that we can run the executable directly because it diff --git a/src/remollDetectorConstruction.cc b/src/remollDetectorConstruction.cc index c279581e6..e67c5111e 100644 --- a/src/remollDetectorConstruction.cc +++ b/src/remollDetectorConstruction.cc @@ -37,6 +37,9 @@ // GDML export #include "G4GDMLParser.hh" +//CADMesh +#include "CADMesh.hh" + //visual #include "G4VisAttributes.hh" #include "G4Colour.hh" @@ -139,6 +142,10 @@ remollDetectorConstruction::~remollDetectorConstruction() { G4VPhysicalVolume* remollDetectorConstruction::Construct() { + //Testing CADMesh + G4ThreeVector offset = G4ThreeVector(-30*cm, 0, 0); + CADMesh * mesh = new CADMesh("../../models/cone.ply", mm, offset, false); + //end of CADMesh test remollIO* io = remollIO::GetInstance(); io->GrabGDMLFiles(fDetFileName); From fb27c8228aa19acf3d1877a92cfd30fe6c6ec279 Mon Sep 17 00:00:00 2001 From: rakitha beminiwattha Date: Sat, 9 Sep 2017 23:22:27 -0500 Subject: [PATCH 002/443] minor local changes to mac files. --- macros/runexample.mac | 2 +- macros/vis.mac | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/macros/runexample.mac b/macros/runexample.mac index d258e19b3..a322b03a3 100644 --- a/macros/runexample.mac +++ b/macros/runexample.mac @@ -68,4 +68,4 @@ #/tracking/verbose 2 -/run/beamOn 10000 +/run/beamOn 100 diff --git a/macros/vis.mac b/macros/vis.mac index c5409e692..d6cd2d8f6 100644 --- a/macros/vis.mac +++ b/macros/vis.mac @@ -2,8 +2,8 @@ /vis/open OGL 600x600-0+0 #/vis/open OGLIQt 1200x800 -#/remoll/setgeofile geometry_sculpt/mollerMother.gdml -/remoll/setgeofile geometry_dose/mollerMother.gdml +/remoll/setgeofile geometry_sculpt/mollerMother.gdml +#/remoll/setgeofile geometry_dose/mollerMother.gdml #/remoll/likekryptonite true From 5c47180a7488da7d4b23c1f4941ce1c9ae446f94 Mon Sep 17 00:00:00 2001 From: rakitha beminiwattha Date: Sat, 9 Sep 2017 23:20:16 -0500 Subject: [PATCH 003/443] trying to add cadmesh into remoll --- CMakeLists.txt | 6 +++++- src/remollDetectorConstruction.cc | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2afd757ff..4f5c35ef0 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,6 +58,9 @@ if(USE_BOOST) endif() endif() +#CADMesh +find_package(cadmesh) +#End of CADMesh #---------------------------------------------------------------------------- # Find Geant4 package, activating all available UI and Vis drivers by default @@ -119,7 +122,7 @@ file(GLOB headers ${PROJECT_SOURCE_DIR}/include/remoll*.hh) # add_library(remoll-lib SHARED ${sources} ${headers} ${CMAKE_CURRENT_BINARY_DIR}/include/gitinfo.hh remollDict.cxx) set_target_properties(remoll-lib PROPERTIES OUTPUT_NAME remoll) -target_link_libraries(remoll-lib ${Geant4_LIBRARIES} ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ) +target_link_libraries(remoll-lib ${Geant4_LIBRARIES} ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${cadmesh_LIBRARIES}) add_executable(remoll-bin remoll.cc) set_target_properties(remoll-bin PROPERTIES OUTPUT_NAME remoll) @@ -129,6 +132,7 @@ add_executable(reroot-bin reroot.cc) set_target_properties(reroot-bin PROPERTIES OUTPUT_NAME reroot) target_link_libraries(reroot-bin remoll-lib) + #---------------------------------------------------------------------------- # Copy all scripts to the build directory, i.e. the directory in which we # build remoll. This is so that we can run the executable directly because it diff --git a/src/remollDetectorConstruction.cc b/src/remollDetectorConstruction.cc index ac8f4159d..c05f383a0 100644 --- a/src/remollDetectorConstruction.cc +++ b/src/remollDetectorConstruction.cc @@ -34,6 +34,9 @@ // GDML export #include "G4GDMLParser.hh" +//CADMesh +#include "CADMesh.hh" + //visual #include "G4VisAttributes.hh" #include "G4Colour.hh" @@ -136,6 +139,10 @@ remollDetectorConstruction::~remollDetectorConstruction() { G4VPhysicalVolume* remollDetectorConstruction::Construct() { + //Testing CADMesh + G4ThreeVector offset = G4ThreeVector(-30*cm, 0, 0); + CADMesh * mesh = new CADMesh("../../models/cone.ply", mm, offset, false); + //end of CADMesh test remollIO* io = remollIO::GetInstance(); io->GrabGDMLFiles(fDetFileName); From 4e3484e68d3c49da651852cf1f6651c8db57d1b6 Mon Sep 17 00:00:00 2001 From: rakitha beminiwattha Date: Sat, 9 Sep 2017 23:22:27 -0500 Subject: [PATCH 004/443] minor local changes to mac files. --- macros/runexample.mac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/runexample.mac b/macros/runexample.mac index 87d09cd03..199847c94 100644 --- a/macros/runexample.mac +++ b/macros/runexample.mac @@ -70,4 +70,4 @@ #/tracking/verbose 2 -/run/beamOn 10000 +/run/beamOn 100 From e66e4eec4680dd348ae5cdbdbfcedce77f22bf6a Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 28 May 2018 13:50:04 -0400 Subject: [PATCH 005/443] Fixes to CMakeLists.txt to continue gracefully if CADMesh absent Use the following to attempt to find CADMesh and direct to location with cmake file ``` cmake -DUSE_CADMESH=1 -Dcadmesh_DIR=/usr/local/cadmesh/pro/lib/cmake/cadmesh-1.1.0/ .. ``` --- CMakeLists.txt | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c9cd74047..945339399 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,17 +50,28 @@ ROOT_GENERATE_DICTIONARY( if(USE_BOOST) find_package(Boost COMPONENTS iostreams) - include_directories(${Boost_INCLUDE_DIRS}) - link_directories(${Boost_LIBRARY_DIR}) - ADD_DEFINITIONS(-D__USE_BOOST) - if(Boost_IOSTREAMS_FOUND) - ADD_DEFINITIONS(-D__USE_BOOST_IOSTREAMS) + if(Boost_FOUND) + include_directories(${Boost_INCLUDE_DIRS}) + link_directories(${Boost_LIBRARY_DIR}) + ADD_DEFINITIONS(-D__USE_BOOST) + if(Boost_IOSTREAMS_FOUND) + ADD_DEFINITIONS(-D__USE_BOOST_IOSTREAMS) + endif() endif() endif() -#CADMesh -find_package(cadmesh) -#End of CADMesh +#---------------------------------------------------------------------------- +# Find CADMesh libraries +if(USE_CADMESH) + find_package(cadmesh) + if(cadmesh_FOUND) + # Pretty sure at some point cadmesh will update to use lowercase + include_directories(${CADMESH_INCLUDE_DIRS}) + include_directories(${cadmesh_INCLUDE_DIRS}) + link_directories(${cadmesh_LIBRARY_DIR}) + ADD_DEFINITIONS(-D__USE_CADMESH) + endif() +endif() #---------------------------------------------------------------------------- # Find Geant4 package, activating all available UI and Vis drivers by default From 776487684ac156de91ffd41beea84b873e9ba0d7 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 28 May 2018 14:03:08 -0400 Subject: [PATCH 006/443] Compile guards #ifdef __USE_CADMESH --- src/remollDetectorConstruction.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/remollDetectorConstruction.cc b/src/remollDetectorConstruction.cc index c05f383a0..eb77e8090 100644 --- a/src/remollDetectorConstruction.cc +++ b/src/remollDetectorConstruction.cc @@ -35,7 +35,9 @@ #include "G4GDMLParser.hh" //CADMesh +#ifdef __USE_CADMESH #include "CADMesh.hh" +#endif //visual #include "G4VisAttributes.hh" @@ -139,10 +141,11 @@ remollDetectorConstruction::~remollDetectorConstruction() { G4VPhysicalVolume* remollDetectorConstruction::Construct() { - //Testing CADMesh + #ifdef __USE_CADMESH G4ThreeVector offset = G4ThreeVector(-30*cm, 0, 0); CADMesh * mesh = new CADMesh("../../models/cone.ply", mm, offset, false); - //end of CADMesh test + #endif + remollIO* io = remollIO::GetInstance(); io->GrabGDMLFiles(fDetFileName); From 40ddf4765d325831e00b9b1d58ab95c106a3296e Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 28 May 2020 16:10:05 -0500 Subject: [PATCH 007/443] Add an implementation of a sieve with a few holes (and the unit 'in') The demo sieve has three constant diameter holes to demonstrate increasingly complex behavior: - hole 1: central phi, parallal to z - hole 2: offset in phi, parallel to z - hole 3: offset in phi, at angle with z All sectors have the same holes right now. Some remaining issues: the angle with z is as if the hole was centered in phi, even if the offset is non-zero. I was struggling with making that work correctly and gave up for now. --- geometry/upstream/sieve.gdml | 165 ++++++++++++++++++++++++++++++ src/remollDetectorConstruction.cc | 3 + 2 files changed, 168 insertions(+) create mode 100644 geometry/upstream/sieve.gdml diff --git a/geometry/upstream/sieve.gdml b/geometry/upstream/sieve.gdml new file mode 100644 index 000000000..0ff54b7ab --- /dev/null +++ b/geometry/upstream/sieve.gdml @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/remollDetectorConstruction.cc b/src/remollDetectorConstruction.cc index 7ad8c0480..3d477f12d 100644 --- a/src/remollDetectorConstruction.cc +++ b/src/remollDetectorConstruction.cc @@ -59,6 +59,9 @@ remollDetectorConstruction::remollDetectorConstruction(const G4String& name, con fWorldVolume(0), fWorldName(name) { + // Define some engineering units + new G4UnitDefinition("inch","in","Length",25.4*CLHEP::millimeter); + // If gdmlfile is non-empty if (gdmlfile.length() > 0) SetGDMLFile(gdmlfile); From 9c5d7012939dab08358b2e9a160a41ac4b3f533a Mon Sep 17 00:00:00 2001 From: Ciprian Gal Date: Tue, 12 Mar 2019 08:38:56 -0400 Subject: [PATCH 008/443] i'd rather we set wireframe in the auxvalues in the gdml files. this will be removed when i set the values properly in the geometry files --- src/remollDetectorConstruction.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/remollDetectorConstruction.cc b/src/remollDetectorConstruction.cc index 08996d706..81e8b5e9b 100644 --- a/src/remollDetectorConstruction.cc +++ b/src/remollDetectorConstruction.cc @@ -638,12 +638,12 @@ void remollDetectorConstruction::ParseAuxiliaryVisibilityInfo() motherVisAtt->SetForceWireframe(true); fWorldVolume->GetLogicalVolume()->SetVisAttributes(motherVisAtt); - // Set all immediate daughters of the world volume to wireframe - G4VisAttributes* daughterVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,1.0)); - daughterVisAtt->SetForceWireframe(true); - for (int i = 0; i < fWorldVolume->GetLogicalVolume()->GetNoDaughters(); i++) { - fWorldVolume->GetLogicalVolume()->GetDaughter(i)->GetLogicalVolume()->SetVisAttributes(daughterVisAtt); - } + // // Set all immediate daughters of the world volume to wireframe + // G4VisAttributes* daughterVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,1.0)); + // daughterVisAtt->SetForceWireframe(true); + // for (int i = 0; i < fWorldVolume->GetLogicalVolume()->GetNoDaughters(); i++) { + // fWorldVolume->GetLogicalVolume()->GetDaughter(i)->GetLogicalVolume()->SetVisAttributes(daughterVisAtt); + // } } void remollDetectorConstruction::ParseAuxiliarySensDetInfo() From d4fff2cddb4d1fdff47ef8e4f8d43c84e00d25fb Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 12 Jun 2020 00:14:17 -0500 Subject: [PATCH 009/443] add alpha to the Mother volumes so that you do not have to force wire on secondaty and tertiary volumes in the source code (cherry-pick f2245535e0f571777080d89163af7f56c8b8e27f, dropped subTargetRegion ~~ wdconinc) --- geometry/hall/hallDaughter_dump.gdml | 2 +- geometry/hall/hallDaughter_merged.gdml | 1 + geometry/hybrid/hybridDaughter_merged.gdml | 1 + geometry/upstream/upstreamDaughter_merged.gdml | 1 + src/remollDetectorConstruction.cc | 6 ------ 5 files changed, 4 insertions(+), 7 deletions(-) diff --git a/geometry/hall/hallDaughter_dump.gdml b/geometry/hall/hallDaughter_dump.gdml index ff4868381..61ac77d47 100644 --- a/geometry/hall/hallDaughter_dump.gdml +++ b/geometry/hall/hallDaughter_dump.gdml @@ -692,7 +692,7 @@ - + diff --git a/geometry/hall/hallDaughter_merged.gdml b/geometry/hall/hallDaughter_merged.gdml index ccb087219..bcdea18f1 100644 --- a/geometry/hall/hallDaughter_merged.gdml +++ b/geometry/hall/hallDaughter_merged.gdml @@ -214,6 +214,7 @@ + diff --git a/geometry/hybrid/hybridDaughter_merged.gdml b/geometry/hybrid/hybridDaughter_merged.gdml index 156e1ccf3..900339b3d 100644 --- a/geometry/hybrid/hybridDaughter_merged.gdml +++ b/geometry/hybrid/hybridDaughter_merged.gdml @@ -1615,6 +1615,7 @@ + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - -

- - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/geometry_Mainz/materialsOptical.xml b/geometry_Mainz/materialsOptical.xml deleted file mode 100644 index 07e35e64d..000000000 --- a/geometry_Mainz/materialsOptical.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/geometry_Mainz/matrices_Mainz.xml b/geometry_Mainz/matrices_Mainz.xml deleted file mode 100644 index b022fa308..000000000 --- a/geometry_Mainz/matrices_Mainz.xml +++ /dev/null @@ -1,6082 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/geometry_Mainz/matrices_Mainz_v2.xml b/geometry_Mainz/matrices_Mainz_v2.xml deleted file mode 100644 index b022fa308..000000000 --- a/geometry_Mainz/matrices_Mainz_v2.xml +++ /dev/null @@ -1,6082 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/geometry_Mainz/mollerMother.gdml b/geometry_Mainz/mollerMother.gdml deleted file mode 100644 index 1be976c75..000000000 --- a/geometry_Mainz/mollerMother.gdml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/geometry_Mainz/solids_Mainz.xml b/geometry_Mainz/solids_Mainz.xml deleted file mode 100644 index f16a1aee0..000000000 --- a/geometry_Mainz/solids_Mainz.xml +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - - - - - - - - - - -

-
- - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/geometry_Mainz/solids_Mainz_v2.xml b/geometry_Mainz/solids_Mainz_v2.xml deleted file mode 100644 index dfefb20c9..000000000 --- a/geometry_Mainz/solids_Mainz_v2.xml +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/geometry_Mainz/targetDaughter.gdml b/geometry_Mainz/targetDaughter.gdml deleted file mode 100644 index 6ba2064cc..000000000 --- a/geometry_Mainz/targetDaughter.gdml +++ /dev/null @@ -1,370 +0,0 @@ - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -&materials; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 5e2155b7af9d4c1265ad3247f797180bca22bc89 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 12 Jun 2020 12:50:11 -0500 Subject: [PATCH 011/443] dumpDaughter has been implemented in hallDaughter_dump --- geometry/dumpDaughter.gdml | 805 ------------------------------------- 1 file changed, 805 deletions(-) delete mode 100644 geometry/dumpDaughter.gdml diff --git a/geometry/dumpDaughter.gdml b/geometry/dumpDaughter.gdml deleted file mode 100644 index 9638ef2d8..000000000 --- a/geometry/dumpDaughter.gdml +++ /dev/null @@ -1,805 +0,0 @@ - - - - -]> - - - - - &matrices; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - &materials; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From bbbca4a995c682eebe7143d1f4f3bda851c17457 Mon Sep 17 00:00:00 2001 From: Sakib Rahman Date: Mon, 15 Jun 2020 15:07:47 -0400 Subject: [PATCH 012/443] Updating coil definitions with epoxy layers --- geometry/hybrid/hybridToroid.gdml | 2482 +++++++++++++++++++++---- geometry/upstream/upstreamToroid.gdml | 444 +++-- 2 files changed, 2472 insertions(+), 454 deletions(-) diff --git a/geometry/hybrid/hybridToroid.gdml b/geometry/hybrid/hybridToroid.gdml index 7986b0cb3..db32efba7 100644 --- a/geometry/hybrid/hybridToroid.gdml +++ b/geometry/hybrid/hybridToroid.gdml @@ -14,489 +14,2315 @@ + + + + + + + + + + + + - + + + + + + + + + + + +
+
+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + - - - + - - - + + + + + + + - - - - - + + + + + + + + + + - - + - - + + + + + + + - - - - - - + + + + + + + + + + - - - - - - + - - - - + + + + + + + - - - - - - + + + + + + + + + + - - - - - - + - - - - - - + + + + + + + - - - - - - + + + + + + + + + + - - - - - - + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + - - - - - - + + + + + + - - - - - - + + + + + + + - - - - - - + + + + + + + + + + - - - - - - + - - - - - - + + + + + + + + + - - - - - - + - - - - - - + + + + + + + - - - - - - + + + + + + + + + + - - - - - - + - - - - - - + + + + + + + + + - - - - - - + - - - - - - + + + + + + + - - - - - - + + + + + + + + + + - - - - - - + - - - - - - - - - -
-
- + + + + + + + + + - - - - - - - - + - + + + + + + + - + + + + + + + + + + + - + + + + + + + - + - + - + + + + + + - - - - - - - - - + + + + + + - - - + + + + + + + + + + + + + + + + + + + - + - + - + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + - + + + + + + + + + - + - + + + + + + - - - - - - - - - + + + + + + + + + + - - - - - - + + + + + + - + - + - + + + + + + - - - - - - - - - + + + + + + + + + + - - - + + + + + + - + - + - + + + + + + - - - - - - - - - + + + + + + + + + + - - - + + + + + + - + - + - + + + + + + - - - - - - - - - + + + + + + - - - + + + + + + + + + + + + + + + + + + + - + - + + + + + + - - - - - - - - - + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + - - - - + + + + - - - - + + + + - + - - - - + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -505,4 +2331,4 @@ - + \ No newline at end of file diff --git a/geometry/upstream/upstreamToroid.gdml b/geometry/upstream/upstreamToroid.gdml index 07b5f2b51..9ac2555f5 100644 --- a/geometry/upstream/upstreamToroid.gdml +++ b/geometry/upstream/upstreamToroid.gdml @@ -14,199 +14,391 @@ + + + + + + + + + + + + - - - - - - - - - - + + + + + + +
+
+ + + + + + + + + + + + + + + + + - - - - - + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + - - - - - + + + + + + - + + + - + + + + + + + + + + - + + + + + + - - - - - - - - - + + + + + + + + + + + - + + + + + + + + + + - + + + + + + - - - - - - - - - + + + + + + + + + + + - + + + + + + + + + + - + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + - + + - + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + - + + - + + + + + + - - - - - - - - - + + + + + + + + + + + - + + + + + + + + + + - + + + + + + - - - - - - - - - + + + + + + + + + + + - + + + + + + + + + + - + + + + + + - - - - - - - - - + + + + + + + + + + + - + + - + - - - - - - - - + + + + - - - + + + + - - - + + + + - - - + + + + - - - + + + + - - - + + + + + + + + + + + - - + + + - + + \ No newline at end of file From 338089a4945cf24f10de99d00758cd098d24c72b Mon Sep 17 00:00:00 2001 From: Sakib Date: Mon, 15 Jun 2020 18:45:53 -0400 Subject: [PATCH 013/443] Change COM to that for the segmented coil --- geometry/hybrid/hybridDaughter_merged.gdml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geometry/hybrid/hybridDaughter_merged.gdml b/geometry/hybrid/hybridDaughter_merged.gdml index 6bd1dd520..81612085d 100644 --- a/geometry/hybrid/hybridDaughter_merged.gdml +++ b/geometry/hybrid/hybridDaughter_merged.gdml @@ -615,7 +615,7 @@ - + From ac31e220d1cb15e66b38ec8fa3d879552babfafe Mon Sep 17 00:00:00 2001 From: Sakib Rahman Date: Sun, 21 Jun 2020 17:56:07 -0400 Subject: [PATCH 014/443] Commenting out existing upstream two bounce shield --- geometry/upstream/upstreamDaughter_merged.gdml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/geometry/upstream/upstreamDaughter_merged.gdml b/geometry/upstream/upstreamDaughter_merged.gdml index bdd63e3e1..2d2b82324 100644 --- a/geometry/upstream/upstreamDaughter_merged.gdml +++ b/geometry/upstream/upstreamDaughter_merged.gdml @@ -584,11 +584,13 @@ - + + From f2be5204522d79fcab2ac758ee1f4308d645abec Mon Sep 17 00:00:00 2001 From: Sakib Date: Mon, 22 Jun 2020 08:51:33 -0400 Subject: [PATCH 015/443] Switching back to the old collimator 1 and reducing the inner edge of collimator 2 to the minimum radial point of collimator 1 --- .../upstream/upstreamDaughter_merged.gdml | 301 ++++++++++++++++-- 1 file changed, 276 insertions(+), 25 deletions(-) diff --git a/geometry/upstream/upstreamDaughter_merged.gdml b/geometry/upstream/upstreamDaughter_merged.gdml index bdd63e3e1..a46e417d2 100644 --- a/geometry/upstream/upstreamDaughter_merged.gdml +++ b/geometry/upstream/upstreamDaughter_merged.gdml @@ -18,11 +18,12 @@ - + - + + @@ -30,20 +31,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + @@ -229,7 +283,184 @@ --> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --> - + - + + + + + + + + + + + + @@ -545,26 +788,34 @@ + + + + + + + - + --> + - + --> + - + --> + - + --> + From e36ebcbd80351dd070984b1dfa241de69900416e Mon Sep 17 00:00:00 2001 From: Sakib Date: Tue, 23 Jun 2020 12:22:46 -0400 Subject: [PATCH 016/443] Lifting the collimator 2 inner radius to match the projection from inner bore of collimator 1 --- .../upstream/upstreamDaughter_merged.gdml | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/geometry/upstream/upstreamDaughter_merged.gdml b/geometry/upstream/upstreamDaughter_merged.gdml index a46e417d2..a8e10c5ab 100644 --- a/geometry/upstream/upstreamDaughter_merged.gdml +++ b/geometry/upstream/upstreamDaughter_merged.gdml @@ -88,16 +88,16 @@ - - - - - - - - - - + + + + + + + + + + From 547e2c53f54a25b9576938a662177b772b4af0ea Mon Sep 17 00:00:00 2001 From: Sakib Date: Fri, 26 Jun 2020 12:58:51 -0400 Subject: [PATCH 017/443] Revert "Commenting out existing upstream two bounce shield" Putting it back in. Dimensions will be changed now. This reverts commit ac31e220d1cb15e66b38ec8fa3d879552babfafe. --- geometry/upstream/upstreamDaughter_merged.gdml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/geometry/upstream/upstreamDaughter_merged.gdml b/geometry/upstream/upstreamDaughter_merged.gdml index 2d2b82324..bdd63e3e1 100644 --- a/geometry/upstream/upstreamDaughter_merged.gdml +++ b/geometry/upstream/upstreamDaughter_merged.gdml @@ -584,13 +584,11 @@ - - From 4d8811966b687fe955a94c1cabde531cfaa2311a Mon Sep 17 00:00:00 2001 From: Sakib Date: Sat, 27 Jun 2020 17:35:20 -0400 Subject: [PATCH 018/443] Reducing the length of the mother volume to avoid minor overlaps --- geometry/upstream/upstreamToroid.gdml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geometry/upstream/upstreamToroid.gdml b/geometry/upstream/upstreamToroid.gdml index 9ac2555f5..e4821a9a1 100644 --- a/geometry/upstream/upstreamToroid.gdml +++ b/geometry/upstream/upstreamToroid.gdml @@ -109,7 +109,7 @@ - + From 628e67f1a96e3be4b391b318dfa4f64ec2cabc0c Mon Sep 17 00:00:00 2001 From: Sakib Date: Sat, 27 Jun 2020 19:04:57 -0400 Subject: [PATCH 019/443] Updating 2bounce shield defintion to be thicker and avoid minor overlaps --- geometry/upstream/upstreamBeampipe.gdml | 33 +++++++++++++++---------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/geometry/upstream/upstreamBeampipe.gdml b/geometry/upstream/upstreamBeampipe.gdml index 55f1ec493..d974d1990 100644 --- a/geometry/upstream/upstreamBeampipe.gdml +++ b/geometry/upstream/upstreamBeampipe.gdml @@ -5,13 +5,6 @@ - - - - - - - @@ -20,24 +13,38 @@ - - - + + + + + + + + + + + + + + +p + + - - + + - + From 2bc46d807a13522c0a41bca3eb034908aa779f34 Mon Sep 17 00:00:00 2001 From: Sakib Date: Sat, 27 Jun 2020 19:08:58 -0400 Subject: [PATCH 020/443] Updating 2bounce shield defintion to be thicker and avoid minor overlaps --- geometry/upstream/upstreamBeampipe.gdml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geometry/upstream/upstreamBeampipe.gdml b/geometry/upstream/upstreamBeampipe.gdml index d974d1990..e14e8672d 100644 --- a/geometry/upstream/upstreamBeampipe.gdml +++ b/geometry/upstream/upstreamBeampipe.gdml @@ -28,7 +28,7 @@ -p + From 513044842e110b891810474e85c8426610ce1795 Mon Sep 17 00:00:00 2001 From: Sakib Date: Sun, 28 Jun 2020 04:29:21 -0400 Subject: [PATCH 021/443] Adding an additional mm clearance between inner photon envelope and two bounce shield --- geometry/upstream/upstreamBeampipe.gdml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/geometry/upstream/upstreamBeampipe.gdml b/geometry/upstream/upstreamBeampipe.gdml index e14e8672d..0ff382e65 100644 --- a/geometry/upstream/upstreamBeampipe.gdml +++ b/geometry/upstream/upstreamBeampipe.gdml @@ -17,16 +17,16 @@ - + - + - + From a9fac510c34ab16a3122b7456bd283bf29b39ef5 Mon Sep 17 00:00:00 2001 From: Sakib Date: Sun, 28 Jun 2020 10:05:29 -0400 Subject: [PATCH 022/443] Lifting the inner radius of collimator 2 to 16 to give 1mm clearance from inner photon envelope --- .../upstream/upstreamDaughter_merged.gdml | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/geometry/upstream/upstreamDaughter_merged.gdml b/geometry/upstream/upstreamDaughter_merged.gdml index a46e417d2..afbbbd30d 100644 --- a/geometry/upstream/upstreamDaughter_merged.gdml +++ b/geometry/upstream/upstreamDaughter_merged.gdml @@ -88,16 +88,16 @@ - - - - - - - - - - + + + + + + + + + + From 23ce88680e5d6a4ebdca0cff9fe1fee7be77ed8b Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 2 Jul 2020 12:53:48 -0500 Subject: [PATCH 023/443] Rename macros/vis.mac to runexample_vis.mac since it's not a vis macro This should avoid confusion. Also added 1 beam event as a runexample. --- macros/{vis.mac => runexample_vis.mac} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename macros/{vis.mac => runexample_vis.mac} (98%) diff --git a/macros/vis.mac b/macros/runexample_vis.mac similarity index 98% rename from macros/vis.mac rename to macros/runexample_vis.mac index e8fa8db29..4d7a4203e 100644 --- a/macros/vis.mac +++ b/macros/runexample_vis.mac @@ -53,4 +53,4 @@ #/remoll/filename remollout_r5o_external_default.root -#/run/beamOn 100 +/run/beamOn 1 From 4add8fd7c84a625195c5a4e8dcfa75604ef1a661 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 2 Jul 2020 14:54:39 -0500 Subject: [PATCH 024/443] Remove mainz and 5open geometries --- geometry/detector_5open.gdml | 210 ---------------------------------- geometry/detector_mainz.gdml | 212 ----------------------------------- geometry/solids_5open.xml | 168 --------------------------- geometry/solids_mainz.xml | 130 --------------------- 4 files changed, 720 deletions(-) delete mode 100644 geometry/detector_5open.gdml delete mode 100644 geometry/detector_mainz.gdml delete mode 100644 geometry/solids_5open.xml delete mode 100644 geometry/solids_mainz.xml diff --git a/geometry/detector_5open.gdml b/geometry/detector_5open.gdml deleted file mode 100644 index c6a2f9735..000000000 --- a/geometry/detector_5open.gdml +++ /dev/null @@ -1,210 +0,0 @@ - - - - - -]> - - - - - - -&matrices; - -&materials; -&solids_5open; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/geometry/detector_mainz.gdml b/geometry/detector_mainz.gdml deleted file mode 100644 index 0c9c18446..000000000 --- a/geometry/detector_mainz.gdml +++ /dev/null @@ -1,212 +0,0 @@ - - - - - - ]> - - - - - - - &matrices; - - &materials; - &solids_mainz; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/geometry/solids_5open.xml b/geometry/solids_5open.xml deleted file mode 100644 index 902be8aaf..000000000 --- a/geometry/solids_5open.xml +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/geometry/solids_mainz.xml b/geometry/solids_mainz.xml deleted file mode 100644 index b1dcac3f3..000000000 --- a/geometry/solids_mainz.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From f0ecd138ae783c8373477bedd0c4512e90c1325a Mon Sep 17 00:00:00 2001 From: Ciprian Gal Date: Fri, 3 Jul 2020 16:09:35 -0400 Subject: [PATCH 025/443] cut on 1 detector look for those tracks in another --- analysis/cut1plot2.C | 206 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 206 insertions(+) create mode 100644 analysis/cut1plot2.C diff --git a/analysis/cut1plot2.C b/analysis/cut1plot2.C new file mode 100644 index 000000000..d6c6eb9fa --- /dev/null +++ b/analysis/cut1plot2.C @@ -0,0 +1,206 @@ +// Run commands in this order: +// +// //Start reroot +// >/path/to/build/reroot +// +// //Load in the script, and run it +// >.L cut1plot2.C +// > cut1plot2(, +// <1 for beam generator, 0 else>) + +#include "histogramUtilities.h" +#include "anaConst.h" + +TFile *fout; +string fileNm; +int beamGen(1); +long nTotEv(0); +int nFiles(0); +long currentEvNr(0); + +TH2F* dBL_xy[nSpecies][nDmg]; +TH1F* dBL_r[nSpecies][nDmg]; +TH1F* dBL_energy[nSpecies]; +TH2F* dCoil_rz[nSpecies][nDmg]; + +void initHisto(int); +void writeOutput(); +long processOne(string); +void process(); + +void cut1plot2(const string& finName = "./remollout.root", int beamGenerator=1, int overWriteFile=1){ + fileNm = finName; + beamGen = beamGenerator; + + initHisto(overWriteFile); + process(); + writeOutput(); +} + +void process(){ + + if(fileNm==""){ + cout<<"\t did not find input file. Quitting!"<>data){ + cout<<" processing: "<IsOpen() || fin->IsZombie()){ + cout<<"Problem: can't find file: "<Close(); + delete fin; + return 0; + } + TTree *t=(TTree*)fin->Get("T"); + if (t == 0) return 0; + Double_t rate=0; + remollEvent_t *ev=0; + remollBeamTarget_t *bm=0; + std::vector *part=0; + std::vector *hit=0; + //std::vector *sum; + t->SetBranchAddress("rate", &rate); + t->SetBranchAddress("bm", &bm); + t->SetBranchAddress("ev", &ev); + t->SetBranchAddress("part", &part); + t->SetBranchAddress("hit", &hit); + //t->SetBranchAddress("sum", &sum); + + long nEntries = t->GetEntries(); + cout<<"\tTotal events: "< procID; + int sector(-1); + + std::vector trackNr; + //for (Long64_t event = 0; event < 5; t->GetEntry(event++)) { + for (Long64_t event = 0; event < nEntries; t->GetEntry(event++)) { + currentEvNr++; + if( float(event+1)/nEntries*100 > currentProc){ + cout<<"at tree entry\t"<size();j++){ + + if(hit->at(j).det != 23) continue; + + if(std::isnan(rate) || std::isinf(rate)) continue; + if(rate==0) {rate=1;} + + int sp = spM[int(hit->at(j).pid)]-1; + if(sp==-1) continue; + + double kinE = hit->at(j).k; + double rr=hit->at(j).r; + double rdDmg[3]={rate,rate*kinE,0}; + double zz = hit->at(j).z; + + if( rr > 90 || zz<1500 || z>2500) continue; + for(int kk=0;kk<3;kk++) + dCoil_rz[sp][rdDmg[kk]]->Fill(rr,zz); + trackNr.push_back(hit->at(j).trackID); + } + + for(int j=0;jsize();j++){ + if(hit->at(j).det != 23) continue; + + if(std::isnan(rate) || std::isinf(rate)) continue; + if(rate==0) {rate=1;} + + int sp = spM[int(hit->at(j).pid)]-1; + if(sp==-1) continue; + + double kinE = hit->at(j).k; + double rr=hit->at(j).r; + + double rdDmg[3]={rate,rate*kinE,0}; + double xx = hit->at(j).x; + double yy = hit->at(j).y; + + if(hit->at(j).pz<0) continue; + + dBL_energy[sp]->Fill(kinE); + for(int kk=0;kk<3;kk++){ + dBL_xy[sp][rdDmg[kk]]->Fill(xx,yy); + dBL_r[sp][rdDmg[kk]]->Fill(rr); + } + + } + + fin->Close(); + delete fin; + return nEntries; +}; + + +void initHisto(int fileType){ + string foutNm = Form("%s_c1p2V0.root",fileNm.substr(0,fileNm.find_last_of(".")).c_str()); + + const string fTp[2]={"UPDATE","RECREATE"}; + cout<<"Will "<cd(); + for(int i=0;iScale(scaleFactor); + dBL_energy[i]->Write(); + + for(int j=0;jScale(scaleFactor); + dBL_xy[i][j]->Write(); + dBL_r[i][j]->Scale(scaleFactor); + dBL_r[i][j]->Write(); + dCoil_rz[i][j]->Scale(scaleFactor); + dCoil_rz[i][j]->Write(); + } + } + fout->Close(); +} From d0215a6ae2b263967644272ceae41df179215205 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 3 Jul 2020 17:23:22 -0500 Subject: [PATCH 026/443] Rotated sieve slits; detect secondaries, low energy neutrals, boundaryhits --- geometry/upstream/sieve.gdml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/geometry/upstream/sieve.gdml b/geometry/upstream/sieve.gdml index 0ff54b7ab..80775f63a 100644 --- a/geometry/upstream/sieve.gdml +++ b/geometry/upstream/sieve.gdml @@ -96,6 +96,9 @@ + + + @@ -104,6 +107,9 @@ + + + @@ -112,6 +118,9 @@ + + + @@ -123,6 +132,7 @@ + + - + + + + + + From eef9b3fa82b60145c473c25e6200bd443ab6e99e Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 3 Jul 2020 17:23:44 -0500 Subject: [PATCH 027/443] Sieve positions 'around' coll1 before coll2 --- geometry/positions.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/geometry/positions.xml b/geometry/positions.xml index 976b3fc8e..428f6b36e 100644 --- a/geometry/positions.xml +++ b/geometry/positions.xml @@ -57,5 +57,9 @@ detectors are placed --> + + + + From f74fee9abed347aa2fc43c2901d42425970b25f1 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 3 Jul 2020 17:24:10 -0500 Subject: [PATCH 028/443] Virtual sieve plane 60 in parallel world --- geometry/mollerParallel.gdml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/geometry/mollerParallel.gdml b/geometry/mollerParallel.gdml index e11ca3555..c7bc3797e 100644 --- a/geometry/mollerParallel.gdml +++ b/geometry/mollerParallel.gdml @@ -126,6 +126,13 @@ + + + + + + + @@ -201,6 +208,11 @@ + + + + + From aacc1a99ced633e1ce05da11fb36b1bae66f9fb1 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 3 Jul 2020 17:24:47 -0500 Subject: [PATCH 029/443] Insert sieve upstream at out of beam position --- geometry/upstream/upstreamDaughter_merged.gdml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/geometry/upstream/upstreamDaughter_merged.gdml b/geometry/upstream/upstreamDaughter_merged.gdml index bdd63e3e1..0b8da0436 100644 --- a/geometry/upstream/upstreamDaughter_merged.gdml +++ b/geometry/upstream/upstreamDaughter_merged.gdml @@ -3,11 +3,13 @@ + ]> + &positions; &matrices; @@ -576,6 +578,11 @@ + + + + + From 53c62a884cd37d58da4b0cca2318332ff87d0839 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 3 Jul 2020 17:25:59 -0500 Subject: [PATCH 030/443] Sieve in/out macros (shift by 200 mm), unit tests --- macros/sieve/sieve_in.mac | 2 ++ macros/sieve/sieve_out.mac | 2 ++ macros/tests/unit/test_sieve.mac | 24 ++++++++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 macros/sieve/sieve_in.mac create mode 100644 macros/sieve/sieve_out.mac create mode 100644 macros/tests/unit/test_sieve.mac diff --git a/macros/sieve/sieve_in.mac b/macros/sieve/sieve_in.mac new file mode 100644 index 000000000..6d15003f1 --- /dev/null +++ b/macros/sieve/sieve_in.mac @@ -0,0 +1,2 @@ +# Move the sieve 200 mm to beam axis +/remoll/geometry/relative_position USsieve (-200,0,0) diff --git a/macros/sieve/sieve_out.mac b/macros/sieve/sieve_out.mac new file mode 100644 index 000000000..88cddd749 --- /dev/null +++ b/macros/sieve/sieve_out.mac @@ -0,0 +1,2 @@ +# Move the sieve 200 mm off axis +/remoll/geometry/relative_position USsieve (200,0,0) diff --git a/macros/tests/unit/test_sieve.mac b/macros/tests/unit/test_sieve.mac new file mode 100644 index 000000000..850c48f1a --- /dev/null +++ b/macros/tests/unit/test_sieve.mac @@ -0,0 +1,24 @@ +/remoll/geometry/setfile geometry/mollerMother_merged.gdml +/remoll/parallel/setfile geometry/mollerParallel.gdml + +/run/initialize + +/remoll/geometry/printoverlaps + +/control/execute macros/load_magnetic_fieldmaps.mac + +/remoll/kryptonite/volume sieve_sector_logic + +/remoll/SD/enable_range 1000 1010 + +/remoll/evgen/set moller + +/control/execute macros/sieve/sieve_in.mac +/remoll/filename test_sieve_in.root +/remoll/seed 123456 +/run/beamOn 10 + +/control/execute macros/sieve/sieve_out.mac +/remoll/filename test_sieve_out.root +/remoll/seed 123456 +/run/beamOn 10 From bb96d1ded0053d2e3daf8788163711d34da2cf7f Mon Sep 17 00:00:00 2001 From: Ciprian Gal Date: Sat, 4 Jul 2020 07:09:35 -0400 Subject: [PATCH 031/443] fix det cuts. errors --- analysis/cut1plot2.C | 47 ++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/analysis/cut1plot2.C b/analysis/cut1plot2.C index d6c6eb9fa..91372aea9 100644 --- a/analysis/cut1plot2.C +++ b/analysis/cut1plot2.C @@ -103,7 +103,7 @@ long processOne(string fnm){ //pass find tracks that hit the coil for(int j=0;jsize();j++){ - if(hit->at(j).det != 23) continue; + if(hit->at(j).det <4001 || hit->at(j).det>4014) continue; if(std::isnan(rate) || std::isinf(rate)) continue; if(rate==0) {rate=1;} @@ -116,14 +116,16 @@ long processOne(string fnm){ double rdDmg[3]={rate,rate*kinE,0}; double zz = hit->at(j).z; - if( rr > 90 || zz<1500 || z>2500) continue; + if( rr > 90 || zz<1500 || zz>2500) continue; for(int kk=0;kk<3;kk++) - dCoil_rz[sp][rdDmg[kk]]->Fill(rr,zz); - trackNr.push_back(hit->at(j).trackID); + dCoil_rz[sp][kk]->Fill(zz,rr,rdDmg[kk]); + trackNr.push_back(hit->at(j).trid); } for(int j=0;jsize();j++){ - if(hit->at(j).det != 23) continue; + if(hit->at(j).det != 25) continue; + + if( find(trackNr.begin(),trackNr.end(),hit->at(j).trid) == trackNr.end() ) continue; if(std::isnan(rate) || std::isinf(rate)) continue; if(rate==0) {rate=1;} @@ -142,10 +144,12 @@ long processOne(string fnm){ dBL_energy[sp]->Fill(kinE); for(int kk=0;kk<3;kk++){ - dBL_xy[sp][rdDmg[kk]]->Fill(xx,yy); - dBL_r[sp][rdDmg[kk]]->Fill(rr); - } + dBL_xy[sp][kk]->Fill(xx,yy,rdDmg[kk]); + dBL_r[sp][kk]->Fill(rr,rdDmg[kk]); + } + } + } fin->Close(); @@ -165,20 +169,21 @@ void initHisto(int fileType){ dBL_energy[i] = new TH1F(Form("aC2_energy_%s",spH[i].c_str()), Form("energy distribution %s",spH[i].c_str()), 121,-8,4.1); - niceLogXBins(dBL_energy[i]); + niceLogXBins(dBL_energy[i]); - for(int j=0;j Date: Sat, 4 Jul 2020 07:46:43 -0400 Subject: [PATCH 032/443] add more plots --- analysis/cut1plot2.C | 76 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 68 insertions(+), 8 deletions(-) diff --git a/analysis/cut1plot2.C b/analysis/cut1plot2.C index 91372aea9..8a235141e 100644 --- a/analysis/cut1plot2.C +++ b/analysis/cut1plot2.C @@ -23,6 +23,13 @@ TH1F* dBL_r[nSpecies][nDmg]; TH1F* dBL_energy[nSpecies]; TH2F* dCoil_rz[nSpecies][nDmg]; +TH2F *dBL_thE[nSpecies][nDmg]; +TH2F *dBL_zE[nSpecies][nDmg]; +TH2F *dBL_thZ[nSpecies][nDmg]; + +TH2F *dBL_phE[nSpecies][nDmg]; +TH2F *dBL_phZ[nSpecies][nDmg]; + void initHisto(int); void writeOutput(); long processOne(string); @@ -92,6 +99,7 @@ long processOne(string fnm){ int sector(-1); std::vector trackNr; + std::vector zzAtCoil //for (Long64_t event = 0; event < 5; t->GetEntry(event++)) { for (Long64_t event = 0; event < nEntries; t->GetEntry(event++)) { currentEvNr++; @@ -100,10 +108,12 @@ long processOne(string fnm){ currentProc+=procStep; } trackNr.clear(); + zzAtCoil.clear(); //pass find tracks that hit the coil for(int j=0;jsize();j++){ - if(hit->at(j).det <4001 || hit->at(j).det>4014) continue; + //if(hit->at(j).det <4001 || hit->at(j).det>4014) continue; + if(hit->at(j).det != 4001 && hit->at(j).det != 4008) continue; if(std::isnan(rate) || std::isinf(rate)) continue; if(rate==0) {rate=1;} @@ -116,17 +126,23 @@ long processOne(string fnm){ double rdDmg[3]={rate,rate*kinE,0}; double zz = hit->at(j).z; - if( rr > 90 || zz<1500 || zz>2500) continue; + if( rr > 90 ) continue; + //if( rr > 90 || zz<1500 || zz>2500) continue; for(int kk=0;kk<3;kk++) dCoil_rz[sp][kk]->Fill(zz,rr,rdDmg[kk]); - trackNr.push_back(hit->at(j).trid); - } + + if( find(trackNr.begin(),trackNr.end(),hit->at(j).trid) == trackNr.end() ){ + trackNr.push_back(hit->at(j).trid); + zzAtCoil.push_back(zz); + } for(int j=0;jsize();j++){ if(hit->at(j).det != 25) continue; - if( find(trackNr.begin(),trackNr.end(),hit->at(j).trid) == trackNr.end() ) continue; - + std::vector::iterator it = find(trackNr.begin(),trackNr.end(),hit->at(j).trid); + if( it == trackNr.end() ) continue; + int index = std::distance(trackNr.begin(),it); + if(std::isnan(rate) || std::isinf(rate)) continue; if(rate==0) {rate=1;} @@ -139,6 +155,8 @@ long processOne(string fnm){ double rdDmg[3]={rate,rate*kinE,0}; double xx = hit->at(j).x; double yy = hit->at(j).y; + double th = atan2(sqrt(hit->at(j).px*hit->at(j).px + hit->at(j).py*hit->at(j).py),hit->at(j).pz); + double ph = atan2(hit->at(j).py,hit->at(j).px); if(hit->at(j).pz<0) continue; @@ -146,6 +164,11 @@ long processOne(string fnm){ for(int kk=0;kk<3;kk++){ dBL_xy[sp][kk]->Fill(xx,yy,rdDmg[kk]); dBL_r[sp][kk]->Fill(rr,rdDmg[kk]); + dBL_thE[sp][kk]->Fill(th,kinE/1000,rdDmg[k]); + dBL_phE[sp][kk]->Fill(ph,kinE/1000,rdDmg[k]); + dBL_thZ[sp][kk]->Fill(zzAtCoil[index],th,rdDmg[k]); + dBL_phZ[sp][kk]->Fill(zzAtCoil[index],ph,rdDmg[k]); + dBL_zE[sp][kk]->Fill(zzAtCoil[index],kinE/1000,rdDmg[k]); } } @@ -159,7 +182,7 @@ long processOne(string fnm){ void initHisto(int fileType){ - string foutNm = Form("%s_c1p2V0.root",fileNm.substr(0,fileNm.find_last_of(".")).c_str()); + string foutNm = Form("%s_c1p2V1.root",fileNm.substr(0,fileNm.find_last_of(".")).c_str()); const string fTp[2]={"UPDATE","RECREATE"}; cout<<"Will "<Write(); dCoil_rz[i][j]->Scale(scaleFactor); dCoil_rz[i][j]->Write(); + dBL_thE[i][j]->Scale(scaleFactor); + dBL_thE[i][j]->Write(); + dBL_thZ[i][j]->Scale(scaleFactor); + dBL_thZ[i][j]->Write(); + dBL_phE[i][j]->Scale(scaleFactor); + dBL_phE[i][j]->Write(); + dBL_phZ[i][j]->Scale(scaleFactor); + dBL_phZ[i][j]->Write(); + dBL_zE[i][j]->Scale(scaleFactor); + dBL_zE[i][j]->Write(); + } } fout->Close(); From 71b4d0cab2dc2b26581d32605c1f97a612503cb9 Mon Sep 17 00:00:00 2001 From: Ciprian Gal Date: Sat, 4 Jul 2020 08:45:52 -0400 Subject: [PATCH 033/443] fix errors --- analysis/cut1plot2.C | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/analysis/cut1plot2.C b/analysis/cut1plot2.C index 8a235141e..a1b53ce31 100644 --- a/analysis/cut1plot2.C +++ b/analysis/cut1plot2.C @@ -99,7 +99,7 @@ long processOne(string fnm){ int sector(-1); std::vector trackNr; - std::vector zzAtCoil + std::vector zzAtCoil; //for (Long64_t event = 0; event < 5; t->GetEntry(event++)) { for (Long64_t event = 0; event < nEntries; t->GetEntry(event++)) { currentEvNr++; @@ -135,6 +135,7 @@ long processOne(string fnm){ trackNr.push_back(hit->at(j).trid); zzAtCoil.push_back(zz); } + } for(int j=0;jsize();j++){ if(hit->at(j).det != 25) continue; @@ -164,11 +165,11 @@ long processOne(string fnm){ for(int kk=0;kk<3;kk++){ dBL_xy[sp][kk]->Fill(xx,yy,rdDmg[kk]); dBL_r[sp][kk]->Fill(rr,rdDmg[kk]); - dBL_thE[sp][kk]->Fill(th,kinE/1000,rdDmg[k]); - dBL_phE[sp][kk]->Fill(ph,kinE/1000,rdDmg[k]); - dBL_thZ[sp][kk]->Fill(zzAtCoil[index],th,rdDmg[k]); - dBL_phZ[sp][kk]->Fill(zzAtCoil[index],ph,rdDmg[k]); - dBL_zE[sp][kk]->Fill(zzAtCoil[index],kinE/1000,rdDmg[k]); + dBL_thE[sp][kk]->Fill(th,kinE/1000,rdDmg[kk]); + dBL_phE[sp][kk]->Fill(ph,kinE/1000,rdDmg[kk]); + dBL_thZ[sp][kk]->Fill(zzAtCoil[index],th,rdDmg[kk]); + dBL_phZ[sp][kk]->Fill(zzAtCoil[index],ph,rdDmg[kk]); + dBL_zE[sp][kk]->Fill(zzAtCoil[index],kinE/1000,rdDmg[kk]); } } @@ -178,7 +179,7 @@ long processOne(string fnm){ fin->Close(); delete fin; return nEntries; -}; +} void initHisto(int fileType){ @@ -217,11 +218,11 @@ void initHisto(int fileType){ 800,-3.2,3.2, 800,0,12); - dBL_thZ[i][j]= new TH2F(Form("aC2_thE_%s_Dmg%d",spH[i].c_str(),j), + dBL_thZ[i][j]= new TH2F(Form("aC2_thZ_%s_Dmg%d",spH[i].c_str(),j), Form("%s for %s;z at coil [mm];theta after Coll2 [rad]",dmgTit[j].c_str(),spTit[i].c_str()), 800,0,3200, 800,0,3.2); - dBL_phZ[i][j]= new TH2F(Form("aC2_phE_%s_Dmg%d",spH[i].c_str(),j), + dBL_phZ[i][j]= new TH2F(Form("aC2_phZ_%s_Dmg%d",spH[i].c_str(),j), Form("%s for %s;z at coil [mm];phi after Coll2 [rad]",dmgTit[j].c_str(),spTit[i].c_str()), 800,0,3200, 800,-3.2,3.2); From 986c667ac1639f051e4033b5d045741f9e4d51b8 Mon Sep 17 00:00:00 2001 From: Ciprian Gal Date: Sat, 4 Jul 2020 09:06:27 -0400 Subject: [PATCH 034/443] update plot ranges. change det --- analysis/cut1plot2.C | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/analysis/cut1plot2.C b/analysis/cut1plot2.C index 8a235141e..58dde5a12 100644 --- a/analysis/cut1plot2.C +++ b/analysis/cut1plot2.C @@ -137,7 +137,7 @@ long processOne(string fnm){ } for(int j=0;jsize();j++){ - if(hit->at(j).det != 25) continue; + if(hit->at(j).det != 26) continue; std::vector::iterator it = find(trackNr.begin(),trackNr.end(),hit->at(j).trid); if( it == trackNr.end() ) continue; @@ -210,26 +210,26 @@ void initHisto(int fileType){ dBL_thE[i][j]= new TH2F(Form("aC2_thE_%s_Dmg%d",spH[i].c_str(),j), Form("%s for %s;theta [rad];E[GeV]",dmgTit[j].c_str(),spTit[i].c_str()), - 800,0,3.2, - 800,0,12); + 800,0,1.5, + 800,0,0.5); dBL_phE[i][j]= new TH2F(Form("aC2_phE_%s_Dmg%d",spH[i].c_str(),j), Form("%s for %s;phi [rad];E[GeV]",dmgTit[j].c_str(),spTit[i].c_str()), 800,-3.2,3.2, - 800,0,12); + 800,0,0.5); dBL_thZ[i][j]= new TH2F(Form("aC2_thE_%s_Dmg%d",spH[i].c_str(),j), Form("%s for %s;z at coil [mm];theta after Coll2 [rad]",dmgTit[j].c_str(),spTit[i].c_str()), 800,0,3200, - 800,0,3.2); + 800,0,1.5); dBL_phZ[i][j]= new TH2F(Form("aC2_phE_%s_Dmg%d",spH[i].c_str(),j), Form("%s for %s;z at coil [mm];phi after Coll2 [rad]",dmgTit[j].c_str(),spTit[i].c_str()), - 800,0,3200, + 800,500,3200, 800,-3.2,3.2); dBL_zE[i][j]= new TH2F(Form("aC2_zE_%s_Dmg%d",spH[i].c_str(),j), Form("%s for %s;z at coil [mm];kinE after Coll2 [GeV]",dmgTit[j].c_str(),spTit[i].c_str()), - 800,0,3200, - 800,0,12); + 800,500,3200, + 800,0,0.5); } From f3fae988c80ef07610174f8b5b5e4d16205ca30a Mon Sep 17 00:00:00 2001 From: Ciprian Gal Date: Sat, 4 Jul 2020 11:52:36 -0400 Subject: [PATCH 035/443] fix bugs --- analysis/cut1plot2.C | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/analysis/cut1plot2.C b/analysis/cut1plot2.C index 6c12622da..649dbe9b0 100644 --- a/analysis/cut1plot2.C +++ b/analysis/cut1plot2.C @@ -112,8 +112,8 @@ long processOne(string fnm){ //pass find tracks that hit the coil for(int j=0;jsize();j++){ - //if(hit->at(j).det <4001 || hit->at(j).det>4014) continue; - if(hit->at(j).det != 4001 && hit->at(j).det != 4008) continue; + if(hit->at(j).det <4001 || hit->at(j).det>4014) continue; + //if(hit->at(j).det != 4001 && hit->at(j).det != 4008) continue; if(std::isnan(rate) || std::isinf(rate)) continue; if(rate==0) {rate=1;} @@ -126,8 +126,8 @@ long processOne(string fnm){ double rdDmg[3]={rate,rate*kinE,0}; double zz = hit->at(j).z; - if( rr > 90 ) continue; - //if( rr > 90 || zz<1500 || zz>2500) continue; + //if( rr > 90 ) continue; + if( rr > 90 || zz<1500 || zz>2500) continue; for(int kk=0;kk<3;kk++) dCoil_rz[sp][kk]->Fill(zz,rr,rdDmg[kk]); @@ -183,7 +183,7 @@ long processOne(string fnm){ void initHisto(int fileType){ - string foutNm = Form("%s_c1p2V1.root",fileNm.substr(0,fileNm.find_last_of(".")).c_str()); + string foutNm = Form("%s_c1p2V2.root",fileNm.substr(0,fileNm.find_last_of(".")).c_str()); const string fTp[2]={"UPDATE","RECREATE"}; cout<<"Will "< Date: Sat, 4 Jul 2020 12:00:34 -0400 Subject: [PATCH 036/443] vertex plots --- analysis/cut1plot2.C | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/analysis/cut1plot2.C b/analysis/cut1plot2.C index 649dbe9b0..4244d68e7 100644 --- a/analysis/cut1plot2.C +++ b/analysis/cut1plot2.C @@ -30,6 +30,9 @@ TH2F *dBL_thZ[nSpecies][nDmg]; TH2F *dBL_phE[nSpecies][nDmg]; TH2F *dBL_phZ[nSpecies][nDmg]; +TH1F *dBL_vZ[nSpecies]; +TH2F *dBL_vRZ[nSpecies]; + void initHisto(int); void writeOutput(); long processOne(string); @@ -126,8 +129,8 @@ long processOne(string fnm){ double rdDmg[3]={rate,rate*kinE,0}; double zz = hit->at(j).z; - //if( rr > 90 ) continue; - if( rr > 90 || zz<1500 || zz>2500) continue; + if( rr > 90 ) continue; + //if( rr > 90 || zz<1500 || zz>2500) continue; for(int kk=0;kk<3;kk++) dCoil_rz[sp][kk]->Fill(zz,rr,rdDmg[kk]); @@ -170,6 +173,8 @@ long processOne(string fnm){ dBL_thZ[sp][kk]->Fill(zzAtCoil[index],th,rdDmg[kk]); dBL_phZ[sp][kk]->Fill(zzAtCoil[index],ph,rdDmg[kk]); dBL_zE[sp][kk]->Fill(zzAtCoil[index],kinE/1000,rdDmg[kk]); + dBL_vZ[sp][kk]->Fill(hit->at(j).vz,rdDmg[kk]); + dBL_vRZ[sp][kk]->Fill(hit->at(j).vz,sqrt(hit->at(j).vx*hit->at(j).vx+hit->at(j).vy*hit->at(j).vy),rdDmg[kk]); } } @@ -183,7 +188,7 @@ long processOne(string fnm){ void initHisto(int fileType){ - string foutNm = Form("%s_c1p2V2.root",fileNm.substr(0,fileNm.find_last_of(".")).c_str()); + string foutNm = Form("%s_c1p2V3.root",fileNm.substr(0,fileNm.find_last_of(".")).c_str()); const string fTp[2]={"UPDATE","RECREATE"}; cout<<"Will "<Write(); dBL_zE[i][j]->Scale(scaleFactor); dBL_zE[i][j]->Write(); + dBL_vZ[i][j]->Scale(scaleFactor); + dBL_vZ[i][j]->Write(); + dBL_vRZ[i][j]->Scale(scaleFactor); + dBL_vRZ[i][j]->Write(); } } From 2e69efc723eedfc6e9581631fa2e3b6661124aaf Mon Sep 17 00:00:00 2001 From: Ciprian Gal Date: Mon, 6 Jul 2020 11:37:47 -0400 Subject: [PATCH 037/443] add energy separation for vertex plots --- analysis/cut1plot2.C | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/analysis/cut1plot2.C b/analysis/cut1plot2.C index 4244d68e7..6b85862a4 100644 --- a/analysis/cut1plot2.C +++ b/analysis/cut1plot2.C @@ -30,8 +30,9 @@ TH2F *dBL_thZ[nSpecies][nDmg]; TH2F *dBL_phE[nSpecies][nDmg]; TH2F *dBL_phZ[nSpecies][nDmg]; -TH1F *dBL_vZ[nSpecies]; -TH2F *dBL_vRZ[nSpecies]; +TH1F *dBL_vZ[nSpecies][nDmg]; +TH2F *dBL_vZE[nSpecies][nDmg]; +TH2F *dBL_vRZ[nSpecies][nDmg]; void initHisto(int); void writeOutput(); @@ -129,10 +130,11 @@ long processOne(string fnm){ double rdDmg[3]={rate,rate*kinE,0}; double zz = hit->at(j).z; - if( rr > 90 ) continue; - //if( rr > 90 || zz<1500 || zz>2500) continue; - for(int kk=0;kk<3;kk++) + //if( rr > 90 ) continue; + if( rr > 90 || zz<1500 || zz>2500) continue; + for(int kk=0;kk<3;kk++){ dCoil_rz[sp][kk]->Fill(zz,rr,rdDmg[kk]); + } if( find(trackNr.begin(),trackNr.end(),hit->at(j).trid) == trackNr.end() ){ trackNr.push_back(hit->at(j).trid); @@ -173,8 +175,9 @@ long processOne(string fnm){ dBL_thZ[sp][kk]->Fill(zzAtCoil[index],th,rdDmg[kk]); dBL_phZ[sp][kk]->Fill(zzAtCoil[index],ph,rdDmg[kk]); dBL_zE[sp][kk]->Fill(zzAtCoil[index],kinE/1000,rdDmg[kk]); - dBL_vZ[sp][kk]->Fill(hit->at(j).vz,rdDmg[kk]); + dBL_vZ[sp][kk]->Fill(hit->at(j).vz,rdDmg[kk]); dBL_vRZ[sp][kk]->Fill(hit->at(j).vz,sqrt(hit->at(j).vx*hit->at(j).vx+hit->at(j).vy*hit->at(j).vy),rdDmg[kk]); + dBL_vZE[sp][kk]->Fill(hit->at(j).vz,kinE,rdDmg[kk]); } } @@ -188,7 +191,7 @@ long processOne(string fnm){ void initHisto(int fileType){ - string foutNm = Form("%s_c1p2V3.root",fileNm.substr(0,fileNm.find_last_of(".")).c_str()); + string foutNm = Form("%s_c1p2V5.root",fileNm.substr(0,fileNm.find_last_of(".")).c_str()); const string fTp[2]={"UPDATE","RECREATE"}; cout<<"Will "<Write(); dBL_vZ[i][j]->Scale(scaleFactor); dBL_vZ[i][j]->Write(); + dBL_vZE[i][j]->Scale(scaleFactor); + dBL_vZE[i][j]->Write(); dBL_vRZ[i][j]->Scale(scaleFactor); dBL_vRZ[i][j]->Write(); From 76f6c2edeb6a140889f1f82bafada39719423fea Mon Sep 17 00:00:00 2001 From: Ciprian Gal Date: Mon, 6 Jul 2020 11:52:17 -0400 Subject: [PATCH 038/443] zoom in for th. azimuthal angle vs vz; linear energy --- analysis/cut1plot2.C | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/analysis/cut1plot2.C b/analysis/cut1plot2.C index 4244d68e7..f7a3cd64f 100644 --- a/analysis/cut1plot2.C +++ b/analysis/cut1plot2.C @@ -21,6 +21,7 @@ long currentEvNr(0); TH2F* dBL_xy[nSpecies][nDmg]; TH1F* dBL_r[nSpecies][nDmg]; TH1F* dBL_energy[nSpecies]; +TH1F* dBL_energyLin[nSpecies]; TH2F* dCoil_rz[nSpecies][nDmg]; TH2F *dBL_thE[nSpecies][nDmg]; @@ -29,6 +30,7 @@ TH2F *dBL_thZ[nSpecies][nDmg]; TH2F *dBL_phE[nSpecies][nDmg]; TH2F *dBL_phZ[nSpecies][nDmg]; +TH2F *dBL_phZc2[nSpecies][nDmg]; TH1F *dBL_vZ[nSpecies]; TH2F *dBL_vRZ[nSpecies]; @@ -164,7 +166,9 @@ long processOne(string fnm){ if(hit->at(j).pz<0) continue; + //if(kinE<30) continue; dBL_energy[sp]->Fill(kinE); + dBL_energyLin[sp]->Fill(kinE); for(int kk=0;kk<3;kk++){ dBL_xy[sp][kk]->Fill(xx,yy,rdDmg[kk]); dBL_r[sp][kk]->Fill(rr,rdDmg[kk]); @@ -172,6 +176,7 @@ long processOne(string fnm){ dBL_phE[sp][kk]->Fill(ph,kinE/1000,rdDmg[kk]); dBL_thZ[sp][kk]->Fill(zzAtCoil[index],th,rdDmg[kk]); dBL_phZ[sp][kk]->Fill(zzAtCoil[index],ph,rdDmg[kk]); + dBL_phZc2[sp][kk]->Fill(hit->at(j).vz,ph,rdDmg[kk]); dBL_zE[sp][kk]->Fill(zzAtCoil[index],kinE/1000,rdDmg[kk]); dBL_vZ[sp][kk]->Fill(hit->at(j).vz,rdDmg[kk]); dBL_vRZ[sp][kk]->Fill(hit->at(j).vz,sqrt(hit->at(j).vx*hit->at(j).vx+hit->at(j).vy*hit->at(j).vy),rdDmg[kk]); @@ -195,6 +200,9 @@ void initHisto(int fileType){ fout = new TFile(foutNm.c_str(),fTp[fileType].c_str()); for(int i=0;iScale(scaleFactor); dBL_energy[i]->Write(); + dBL_energyLin[i]->Scale(scaleFactor); + dBL_energyLin[i]->Write(); for(int j=0;jScale(scaleFactor); @@ -275,6 +289,8 @@ void writeOutput(){ dBL_phE[i][j]->Write(); dBL_phZ[i][j]->Scale(scaleFactor); dBL_phZ[i][j]->Write(); + dBL_phZc2[i][j]->Scale(scaleFactor); + dBL_phZc2[i][j]->Write(); dBL_zE[i][j]->Scale(scaleFactor); dBL_zE[i][j]->Write(); dBL_vZ[i][j]->Scale(scaleFactor); From 99952191ea27743cbf9f40b376e5af38c073c47d Mon Sep 17 00:00:00 2001 From: Ciprian Gal Date: Mon, 6 Jul 2020 15:02:43 -0400 Subject: [PATCH 039/443] energy at coil --- analysis/cut1plot2.C | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/analysis/cut1plot2.C b/analysis/cut1plot2.C index 3a928cbfd..ee458ca04 100644 --- a/analysis/cut1plot2.C +++ b/analysis/cut1plot2.C @@ -22,6 +22,8 @@ TH2F* dBL_xy[nSpecies][nDmg]; TH1F* dBL_r[nSpecies][nDmg]; TH1F* dBL_energy[nSpecies]; TH1F* dBL_energyLin[nSpecies]; +TH1F* dCoil_energy[nSpecies]; +TH1F* dCoil_energyLin[nSpecies]; TH2F* dCoil_rz[nSpecies][nDmg]; TH2F *dBL_thE[nSpecies][nDmg]; @@ -134,6 +136,8 @@ long processOne(string fnm){ //if( rr > 90 ) continue; if( rr > 90 || zz<1500 || zz>2500) continue; + dCoil_energy[sp]->Fill(kinE); + dCoil_energyLin[sp]->Fill(kinE); for(int kk=0;kk<3;kk++){ dCoil_rz[sp][kk]->Fill(zz,rr,rdDmg[kk]); } @@ -210,6 +214,14 @@ void initHisto(int fileType){ Form("energy distribution %s",spH[i].c_str()), 121,-8,4.1); niceLogXBins(dBL_energy[i]); + + dCoil_energyLin[i] = new TH1F(Form("aCoil_energyLin_%s",spH[i].c_str()), + Form("energy distribution %s",spH[i].c_str()), + 200,0,1000); + dCoil_energy[i] = new TH1F(Form("aCoil_energy_%s",spH[i].c_str()), + Form("energy distribution %s",spH[i].c_str()), + 121,-8,4.1); + niceLogXBins(dCoil_energy[i]); for(int j=0;jWrite(); dBL_energyLin[i]->Scale(scaleFactor); dBL_energyLin[i]->Write(); + dCoil_energy[i]->Scale(scaleFactor); + dCoil_energy[i]->Write(); + dCoil_energyLin[i]->Scale(scaleFactor); + dCoil_energyLin[i]->Write(); for(int j=0;jScale(scaleFactor); From d00febc6e536e9944e29002715ab19014d4280c8 Mon Sep 17 00:00:00 2001 From: Ciprian Gal Date: Tue, 7 Jul 2020 08:34:36 -0400 Subject: [PATCH 040/443] add folded xy --- analysis/cut1plot2.C | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/analysis/cut1plot2.C b/analysis/cut1plot2.C index ee458ca04..d796d7c7e 100644 --- a/analysis/cut1plot2.C +++ b/analysis/cut1plot2.C @@ -19,6 +19,7 @@ int nFiles(0); long currentEvNr(0); TH2F* dBL_xy[nSpecies][nDmg]; +TH2F* dBL_xyFold[nSpecies][nDmg]; TH1F* dBL_r[nSpecies][nDmg]; TH1F* dBL_energy[nSpecies]; TH1F* dBL_energyLin[nSpecies]; @@ -176,7 +177,12 @@ long processOne(string fnm){ dBL_energy[sp]->Fill(kinE); dBL_energyLin[sp]->Fill(kinE); for(int kk=0;kk<3;kk++){ + double phi = atan2(yy,xx); + double secPhi = fmod(phi,2*pi/7); + double xr = rr*cos(secPhi); + double yr = rr*sin(secPhi); dBL_xy[sp][kk]->Fill(xx,yy,rdDmg[kk]); + dBL_xyFold[sp][kk]->Fill(xr,yr,rdDmg[kk]); dBL_r[sp][kk]->Fill(rr,rdDmg[kk]); dBL_thE[sp][kk]->Fill(th,kinE/1000,rdDmg[kk]); dBL_phE[sp][kk]->Fill(ph,kinE/1000,rdDmg[kk]); @@ -200,7 +206,7 @@ long processOne(string fnm){ void initHisto(int fileType){ - string foutNm = Form("%s_c1p2V5.root",fileNm.substr(0,fileNm.find_last_of(".")).c_str()); + string foutNm = Form("%s_c1p2V7.root",fileNm.substr(0,fileNm.find_last_of(".")).c_str()); const string fTp[2]={"UPDATE","RECREATE"}; cout<<"Will "<Scale(scaleFactor); dBL_xy[i][j]->Write(); + dBL_xyFold[i][j]->Scale(scaleFactor); + dBL_xyFold[i][j]->Write(); dBL_r[i][j]->Scale(scaleFactor); dBL_r[i][j]->Write(); dCoil_rz[i][j]->Scale(scaleFactor); From ea11476a3f5fd9bdec265c1e19c7c4eae075e2e8 Mon Sep 17 00:00:00 2001 From: Ciprian Gal Date: Tue, 7 Jul 2020 11:47:05 -0400 Subject: [PATCH 041/443] look at incident power and power deposition --- analysis/firstHit.C | 218 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 218 insertions(+) create mode 100644 analysis/firstHit.C diff --git a/analysis/firstHit.C b/analysis/firstHit.C new file mode 100644 index 000000000..37958867a --- /dev/null +++ b/analysis/firstHit.C @@ -0,0 +1,218 @@ +// Run commands in this order: +// +// //Start reroot +// >/path/to/build/reroot +// +// //Load in the script, and run it +// >.L cut1plot2.C +// > cut1plot2(, +// <1 for beam generator, 0 else>) + +#include "histogramUtilities.h" +#include "anaConst.h" + +TFile *fout; +string fileNm; +int beamGen(1); +long nTotEv(0); +int nFiles(0); +long currentEvNr(0); + +//these are all for the hotspot +TH2F* dCoil_xy[nSpecies][nDmg]; +TH2F* dCoil_rz[nSpecies][nDmg]; + +TH2F* dCoil_EinEdep[nSpecies]; +TH1F* dCoil_Ein[nSpecies]; +TH1F* dCoil_EinLin[nSpecies]; + +void initHisto(int); +void writeOutput(); +long processOne(string); +void process(); + +void firstHit(const string& finName = "./remollout.root", int beamGenerator=1, int overWriteFile=1){ + fileNm = finName; + beamGen = beamGenerator; + + initHisto(overWriteFile); + process(); + writeOutput(); +} + +void process(){ + + if(fileNm==""){ + cout<<"\t did not find input file. Quitting!"<>data){ + cout<<" processing: "<IsOpen() || fin->IsZombie()){ + cout<<"Problem: can't find file: "<Close(); + delete fin; + return 0; + } + TTree *t=(TTree*)fin->Get("T"); + if (t == 0) return 0; + Double_t rate=0; + remollEvent_t *ev=0; + remollBeamTarget_t *bm=0; + std::vector *part=0; + std::vector *hit=0; + //std::vector *sum; + t->SetBranchAddress("rate", &rate); + t->SetBranchAddress("bm", &bm); + t->SetBranchAddress("ev", &ev); + t->SetBranchAddress("part", &part); + t->SetBranchAddress("hit", &hit); + //t->SetBranchAddress("sum", &sum); + + long nEntries = t->GetEntries(); + cout<<"\tTotal events: "< procID; + int sector(-1); + + std::vector firstHit; + std::vector species; + std::vector powerDep,kinE; + //for (Long64_t event = 0; event < 5; t->GetEntry(event++)) { + for (Long64_t event = 0; event < nEntries; t->GetEntry(event++)) { + currentEvNr++; + if( float(event+1)/nEntries*100 > currentProc){ + cout<<"at tree entry\t"<size();j++){ + + //if(hit->at(j).det <4001 || hit->at(j).det>4014) continue; + if(hit->at(j).det != 4001 && hit->at(j).det != 4008) continue; + + if(std::isnan(rate) || std::isinf(rate)) continue; + if(rate==0) {rate=1;} + + int sp = spM[int(hit->at(j).pid)]-1; + if(sp==-1) continue; + + int trid = hit->at(j).trid; + int foundUS(0); + for(int k=0;ksize() && foundUS==0;k++) + if(trid == hit->at(k).trid) + foundUS++; + if(!foundUS) continue; + + std::vector::iterator it = find(trackNr.begin(),trackNr.end(),trid); + if( it == trackNr.end() ){ + firstHit.push_back(trid); + kinE.push_back(hit->at(j).k); + species.push_back(sp); + + dCoil_Ein[sp]->Fill(hit->at(j).k); + dCoil_EinLin[sp]->Fill(hit->at(j).k); + dCoil_xy[sp][0]->Fill(hit->at(j).x,hit->at(j).y); + dCoil_xy[sp][1]->Fill(hit->at(j).x,hit->at(j).y,hit->at(j).k); + dCoil_rz[sp][0]->Fill(hit->at(j).z,hit->at(j).r); + dCoil_rz[sp][1]->Fill(hit->at(j).z,hit->at(j).r,hit->at(j).k); + }else{ + int index = std::distance(trackNr.begin(),it); + powerDep[index]+=hit->at(j).edep; + } + } + + for(int j=0;jFill(kinE[j],powerDep[j]); + } + + } + + fin->Close(); + delete fin; + return nEntries; +} + + +void initHisto(int fileType){ + string foutNm = Form("%s_Elarger30_c1p2V7.root",fileNm.substr(0,fileNm.find_last_of(".")).c_str()); + + const string fTp[2]={"UPDATE","RECREATE"}; + cout<<"Will "<cd(); + for(int i=0;iScale(scaleFactor); + dCoil_EinEdep[i]->Write(); + dCoil_Ein[i]->Scale(scaleFactor); + dCoil_Ein[i]->Write(); + dCoil_EinLin[i]->Scale(scaleFactor); + dCoil_EinLin[i]->Write(); + + for(int j=0;jScale(scaleFactor); + dCoil_xy[i]->Write(); + dCoil_rz[i]->Scale(scaleFactor); + dCoil_rz[i]->Write(); + } + } + fout->Close(); +} From 668d89f1de1b81f3757c1e34d391f27d3912a3d1 Mon Sep 17 00:00:00 2001 From: Ciprian Gal Date: Tue, 7 Jul 2020 12:09:57 -0400 Subject: [PATCH 042/443] fix bugs --- analysis/firstHit.C | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/analysis/firstHit.C b/analysis/firstHit.C index 37958867a..0e82fef03 100644 --- a/analysis/firstHit.C +++ b/analysis/firstHit.C @@ -108,6 +108,7 @@ long processOne(string fnm){ powerDep.clear(); kinE.clear(); species.clear(); + //pass find tracks that hit the coil for(int j=0;jsize();j++){ @@ -127,11 +128,12 @@ long processOne(string fnm){ foundUS++; if(!foundUS) continue; - std::vector::iterator it = find(trackNr.begin(),trackNr.end(),trid); - if( it == trackNr.end() ){ + std::vector::iterator it = find(firstHit.begin(),firstHit.end(),trid); + if( it == firstHit.end() ){ firstHit.push_back(trid); kinE.push_back(hit->at(j).k); species.push_back(sp); + powerDep.push_back(0); dCoil_Ein[sp]->Fill(hit->at(j).k); dCoil_EinLin[sp]->Fill(hit->at(j).k); @@ -140,12 +142,16 @@ long processOne(string fnm){ dCoil_rz[sp][0]->Fill(hit->at(j).z,hit->at(j).r); dCoil_rz[sp][1]->Fill(hit->at(j).z,hit->at(j).r,hit->at(j).k); }else{ - int index = std::distance(trackNr.begin(),it); + //cout<<"asdfas"<at(j).edep; } } + for(int j=0;jFill(kinE[j],powerDep[j]); } @@ -158,7 +164,7 @@ long processOne(string fnm){ void initHisto(int fileType){ - string foutNm = Form("%s_Elarger30_c1p2V7.root",fileNm.substr(0,fileNm.find_last_of(".")).c_str()); + string foutNm = Form("%s_firstHitV0.root",fileNm.substr(0,fileNm.find_last_of(".")).c_str()); const string fTp[2]={"UPDATE","RECREATE"}; cout<<"Will "<Write(); for(int j=0;jScale(scaleFactor); - dCoil_xy[i]->Write(); - dCoil_rz[i]->Scale(scaleFactor); - dCoil_rz[i]->Write(); + dCoil_xy[i][j]->Scale(scaleFactor); + dCoil_xy[i][j]->Write(); + dCoil_rz[i][j]->Scale(scaleFactor); + dCoil_rz[i][j]->Write(); } } fout->Close(); From 6119f68a337cc6cbd44206c861e33e97ea67ba8a Mon Sep 17 00:00:00 2001 From: Ciprian Gal Date: Tue, 7 Jul 2020 12:58:00 -0400 Subject: [PATCH 043/443] r at C2 z at coil --- analysis/cut1plot2.C | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/analysis/cut1plot2.C b/analysis/cut1plot2.C index d796d7c7e..1f5eae4dd 100644 --- a/analysis/cut1plot2.C +++ b/analysis/cut1plot2.C @@ -20,6 +20,7 @@ long currentEvNr(0); TH2F* dBL_xy[nSpecies][nDmg]; TH2F* dBL_xyFold[nSpecies][nDmg]; +TH2F* dBL_rzFold[nSpecies][nDmg]; TH1F* dBL_r[nSpecies][nDmg]; TH1F* dBL_energy[nSpecies]; TH1F* dBL_energyLin[nSpecies]; @@ -173,7 +174,7 @@ long processOne(string fnm){ if(hit->at(j).pz<0) continue; - //if(kinE<30) continue; + if(kinE<30) continue; dBL_energy[sp]->Fill(kinE); dBL_energyLin[sp]->Fill(kinE); for(int kk=0;kk<3;kk++){ @@ -181,8 +182,9 @@ long processOne(string fnm){ double secPhi = fmod(phi,2*pi/7); double xr = rr*cos(secPhi); double yr = rr*sin(secPhi); - dBL_xy[sp][kk]->Fill(xx,yy,rdDmg[kk]); dBL_xyFold[sp][kk]->Fill(xr,yr,rdDmg[kk]); + + dBL_xy[sp][kk]->Fill(xx,yy,rdDmg[kk]); dBL_r[sp][kk]->Fill(rr,rdDmg[kk]); dBL_thE[sp][kk]->Fill(th,kinE/1000,rdDmg[kk]); dBL_phE[sp][kk]->Fill(ph,kinE/1000,rdDmg[kk]); @@ -190,6 +192,7 @@ long processOne(string fnm){ dBL_phZ[sp][kk]->Fill(zzAtCoil[index],ph,rdDmg[kk]); dBL_phZc2[sp][kk]->Fill(hit->at(j).vz,ph,rdDmg[kk]); dBL_zE[sp][kk]->Fill(zzAtCoil[index],kinE/1000,rdDmg[kk]); + dBL_rzFold[sp][kk]->Fill(zzAtCoil[index],rr,rdDmg[kk]); dBL_vZ[sp][kk]->Fill(hit->at(j).vz,rdDmg[kk]); dBL_vRZ[sp][kk]->Fill(hit->at(j).vz,sqrt(hit->at(j).vx*hit->at(j).vx+hit->at(j).vy*hit->at(j).vy),rdDmg[kk]); dBL_vZE[sp][kk]->Fill(hit->at(j).vz,kinE,rdDmg[kk]); @@ -206,7 +209,7 @@ long processOne(string fnm){ void initHisto(int fileType){ - string foutNm = Form("%s_c1p2V7.root",fileNm.substr(0,fileNm.find_last_of(".")).c_str()); + string foutNm = Form("%s_Elarger30_c1p2V7.root",fileNm.substr(0,fileNm.find_last_of(".")).c_str()); const string fTp[2]={"UPDATE","RECREATE"}; cout<<"Will "<Write(); dCoil_rz[i][j]->Scale(scaleFactor); dCoil_rz[i][j]->Write(); + dBL_rzFold[i][j]->Scale(scaleFactor); + dBL_rzFold[i][j]->Write(); dBL_thE[i][j]->Scale(scaleFactor); dBL_thE[i][j]->Write(); dBL_thZ[i][j]->Scale(scaleFactor); From 8fc81df2cc53a2b8ca3922b2f02cf4a714861b71 Mon Sep 17 00:00:00 2001 From: Ciprian Gal Date: Tue, 7 Jul 2020 12:58:27 -0400 Subject: [PATCH 044/443] include moms in the eDep --- analysis/firstHit.C | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/analysis/firstHit.C b/analysis/firstHit.C index 0e82fef03..1420de488 100644 --- a/analysis/firstHit.C +++ b/analysis/firstHit.C @@ -96,7 +96,7 @@ long processOne(string fnm){ std::vector firstHit; std::vector species; - std::vector powerDep,kinE; + std::vector powerDep,kinE,xH,yH,zH; //for (Long64_t event = 0; event < 5; t->GetEntry(event++)) { for (Long64_t event = 0; event < nEntries; t->GetEntry(event++)) { currentEvNr++; @@ -108,7 +108,8 @@ long processOne(string fnm){ powerDep.clear(); kinE.clear(); species.clear(); - + xH.clear(); + yH.clear(); //pass find tracks that hit the coil for(int j=0;jsize();j++){ @@ -122,11 +123,16 @@ long processOne(string fnm){ if(sp==-1) continue; int trid = hit->at(j).trid; - int foundUS(0); - for(int k=0;ksize() && foundUS==0;k++) - if(trid == hit->at(k).trid) - foundUS++; - if(!foundUS) continue; + int mtrid = hit->at(j).mtrid; + int foundUS(-1); + for(int k=0;ksize() && foundUS==-1;k++) + if(trid == hit->at(k).trid && hit->at(k).det==26) + foundUS = trid; + else if(mtrid == hit->at(k).trid && hit->at(k).det==26) + foundUS = mtrid; + + if(foundUS==-1) continue; + trid = foundUS; std::vector::iterator it = find(firstHit.begin(),firstHit.end(),trid); if( it == firstHit.end() ){ @@ -134,16 +140,13 @@ long processOne(string fnm){ kinE.push_back(hit->at(j).k); species.push_back(sp); powerDep.push_back(0); + xh.push_back(hit->at(j).x); + yh.push_back(hit->at(j).x); + zh.push_back(hit->at(j).z); dCoil_Ein[sp]->Fill(hit->at(j).k); dCoil_EinLin[sp]->Fill(hit->at(j).k); - dCoil_xy[sp][0]->Fill(hit->at(j).x,hit->at(j).y); - dCoil_xy[sp][1]->Fill(hit->at(j).x,hit->at(j).y,hit->at(j).k); - dCoil_rz[sp][0]->Fill(hit->at(j).z,hit->at(j).r); - dCoil_rz[sp][1]->Fill(hit->at(j).z,hit->at(j).r,hit->at(j).k); - }else{ - //cout<<"asdfas"<at(j).edep; } @@ -151,8 +154,11 @@ long processOne(string fnm){ for(int j=0;jFill(kinE[j],powerDep[j]); + dCoil_xy[sp][0]->Fill(xH[j],yH[j]); + dCoil_xy[sp][1]->Fill(xH[j],yH[j],powerDep[j]); + dCoil_rz[sp][0]->Fill(zH[j],sqrt(xH[j]*xH[j]+yH[j]*yH[j])); + dCoil_rz[sp][1]->Fill(zH[j],sqrt(xH[j]*xH[j]+yH[j]*yH[j]),powerDet[j]); } } @@ -164,7 +170,7 @@ long processOne(string fnm){ void initHisto(int fileType){ - string foutNm = Form("%s_firstHitV0.root",fileNm.substr(0,fileNm.find_last_of(".")).c_str()); + string foutNm = Form("%s_coilW_firstHitV0.root",fileNm.substr(0,fileNm.find_last_of(".")).c_str()); const string fTp[2]={"UPDATE","RECREATE"}; cout<<"Will "< Date: Wed, 8 Jul 2020 20:16:03 -0400 Subject: [PATCH 045/443] Updating pe.cc to do new nomenclature and scans.root output - note, this needs to be generalized for non-position/angle scan variable output cases - Also adds a remollGenBeam.cc messenger command to move the raster reference position --- analysis/pe/pe.cc | 311 +++++++++++++++++++++++++++++++++++++------ src/remollGenBeam.cc | 1 + 2 files changed, 274 insertions(+), 38 deletions(-) diff --git a/analysis/pe/pe.cc b/analysis/pe/pe.cc index 34ceefe17..9f1f9a3b8 100644 --- a/analysis/pe/pe.cc +++ b/analysis/pe/pe.cc @@ -83,10 +83,12 @@ void pe(std::string file="tracking.root", int detid=50001) int LGaircounted = 0; int PMTbulkcounted = 0; int detSourcedPEs = 0; + double N_entries = 0; //TODO reading data into envelopes downstream could be sped up //by storing the data by Z instead of by hit + newTree->Branch("nentries", &N_entries); newTree->Branch("catpes", &catPEs); newTree->Branch("q", &Q); newTree->Branch("ref", &Ref); @@ -129,12 +131,12 @@ void pe(std::string file="tracking.root", int detid=50001) if (i<30 && hit.det == 50001){ } } - if (hit.det == detid) { + if (hit.det == detid+1) { // If any particle hits the quartz detector then tell the particle ID and mother ID (so we can keep track of deltas) PID.push_back(hit.pid); MTRID.push_back(hit.mtrid); } - if (hit.pid == 0 && hit.det == detid+700){ + if (hit.pid == 0 && hit.det == detid){ // This is an optical photon and we want to count ++ if it hits the PMT cathode peTRID.push_back(hit.trid); cathitx.push_back(hit.x); @@ -152,39 +154,39 @@ void pe(std::string file="tracking.root", int detid=50001) //std::cout << "electron TRID " << hit.trid << std::endl; // Make the electron hit info go into the appropriate detector branch // quartz - if (hit.det == detid && Qcounted==0) { + if (hit.det == detid+1 && Qcounted==0) { Q->push_back(QTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); Qcounted++; } // reflector air - if (hit.det == detid+100 && Refaircounted==0) { + if (hit.det == detid+2 && Refaircounted==0) { Refair->push_back(RefairTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); Refaircounted++; } // reflector skin - if (hit.det == detid+200) { + if (hit.det == detid+3) { Ref->push_back(RefTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); } // reflector volume - if (hit.det == detid+300) { + if (hit.det == detid+4) { RefX->push_back(RefXTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); } // light guide air - if (hit.det == detid+400 && LGaircounted==0) { + if (hit.det == detid+6 && LGaircounted==0) { LGair->push_back(LGairTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); LGaircounted++; } // light guide skin - if (hit.det == detid+500) { + if (hit.det == detid+5) { LG->push_back(LGTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); } // PMT bulk - if (hit.det == detid+600 && PMTbulkcounted==0) { + if (hit.det == detid+7 && PMTbulkcounted==0) { PMTbulk->push_back(PMTbulkTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); PMTbulkcounted++; } // PMT cathode - if (hit.det == detid+700) { + if (hit.det == detid) { PMTcat->push_back(PMTcatTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); } //break; //how is this useful?? I want to muliple count @@ -194,6 +196,7 @@ void pe(std::string file="tracking.root", int detid=50001) catPEs->push_back(catPEsTrim(DETID,PID,MTRID,(int)peTRID.size(),cathitx,cathity,cathitz)); detSourcedPEs=(int)peTRID.size(); elseX->push_back(elseXTrim(((int)peTRID.size()-detSourcedPEs),cathitx,cathity,cathitz)); + N_entries = oldTree->GetEntries(); if (catPEs->size() > 0){ newTree->Fill(); } @@ -228,11 +231,12 @@ void pe(std::string file="tracking.root", int detid=50001) newFile->Close(); } -void pePlots(int argcC, char **argvC, std::string fileP="tracking.root", int detid=50001, std::string variable="reflectorAngle", double varVal=11.5, std::string unit="deg") +//void pePlots(int argcC, char **argvC, std::string fileP="tracking.root", int detid=50001, std::string variable="reflectorAngle", double varVal=11.5, std::string unit="deg") +void pePlots(int argcC, char **argvC, std::string fileP="tracking.root", int detid=50001, double user_angle = 0.0, double user_x_pos = 0.0, double user_reflectivity = 0.9, double user_cerenkov = 1.0, double user_scintillation = 1.0, double user_z_pos = -11.0) { - TApplication theApp("App",&argcC,argvC); + //TApplication theApp("App",&argcC,argvC); - int dotpos = fileP.rfind("."); + int dotpos = fileP.rfind(".root"); std::ostringstream os; std::ostringstream os2; os << fileP.substr(0, dotpos) << "_PEs_"<<"det_"<cd(); // Is this necessary? //int nentries = (Int_t)newTree->GetEntries(); + // + double N_entries = 0; + Tmol->SetBranchAddress("nentries", &N_entries); + if (Tmol) { + Tmol->GetEntry(0); + } std::fstream file_out_rms; std::ofstream file_out_mean; std::ofstream file_out_res; @@ -268,6 +278,7 @@ void pePlots(int argcC, char **argvC, std::string fileP="tracking.root", int det double Mean[n_plots]; double Meanerror[n_plots]; TCanvas * c1[n_plots]; + std::string names[n_plots]={"Total Cathode Spectrum per event", "Cathode Spectrum from primary signal quartz electrons only", "Cathode Spectrum from quartz deltas", @@ -367,6 +378,7 @@ void pePlots(int argcC, char **argvC, std::string fileP="tracking.root", int det 1250.0, 100.0}; + for (int p=0;pcd(); @@ -387,14 +399,226 @@ void pePlots(int argcC, char **argvC, std::string fileP="tracking.root", int det Meanerror[p] = 1.0*Histo[p]->GetMeanError(); //Plot_Name,x_axis_units,x_number,y_number,y_uncertainty - if (p==1){ //then a primary electron hit the quartz and we want to see the spectrum - file_out_rms<AccessPathName("scans.root")) { + // Old file exists, read it and add new entries + old_file = TFile::Open("scans.root"); + old_file->GetObject("scans", oldtree); + new_file.cd(); + if (!oldtree) { + std::cout << "ERROR: Dead scans tree" ; + return; + } + newtree = oldtree->CloneTree(0); + int nent = oldtree->GetEntries(); + // TLeaf* angleL = oldtree->GetLeaf("angle"); + // TLeaf* x_posL = oldtree->GetLeaf("x_pos"); + + // Clear out prior instance if exists + bool prior = true; + if (oldtree->GetBranch("reflectivity")) { + oldtree->SetBranchAddress("reflectivity",&oldreflectivity); + newtree->SetBranchAddress("reflectivity",&reflectivity); + } + else { + newtree->Branch("reflectivity",&reflectivity); + prior = false; + } + if (oldtree->GetBranch("cerenkov")) { + oldtree->SetBranchAddress("cerenkov",&oldcerenkov); + newtree->SetBranchAddress("cerenkov",&cerenkov); + } + else { + newtree->Branch("cerenkov",&cerenkov); + prior = false; + } + if (oldtree->GetBranch("scintillation")) { + oldtree->SetBranchAddress("scintillation",&oldscintillation); + newtree->SetBranchAddress("scintillation",&scintillation); + } + else { + newtree->Branch("scintillation",&scintillation); + prior = false; + } + if (oldtree->GetBranch("z_pos")) { + oldtree->SetBranchAddress("z_pos",&oldz_pos); + newtree->SetBranchAddress("z_pos",&z_pos); + } + else { + newtree->Branch("z_pos",&z_pos); + prior = false; + } + oldtree->SetBranchAddress("angle",&oldangle); + oldtree->SetBranchAddress("x_pos",&oldx_pos); + oldtree->SetBranchAddress("avg_pes",&oldavg); + oldtree->SetBranchAddress("avg_pes_err",&oldavg_err); + oldtree->SetBranchAddress("rms_pes",&oldrms); + oldtree->SetBranchAddress("rms_pes_err",&oldrms_err); + oldtree->SetBranchAddress("res",&oldres); + oldtree->SetBranchAddress("nentries",&oldN_en); + newtree->SetBranchAddress("angle",&angle); + newtree->SetBranchAddress("x_pos",&x_pos); + newtree->SetBranchAddress("avg_pes",&avg); + newtree->SetBranchAddress("avg_pes_err",&avg_err); + newtree->SetBranchAddress("rms_pes",&rms); + newtree->SetBranchAddress("rms_pes_err",&rms_err); + newtree->SetBranchAddress("res",&res); + newtree->SetBranchAddress("nentries",&N_en); + for (int j = 0 ; j < nent ; j++ ) { + // x_posL->GetBranch()->GetEntry(j); + // angleL->GetBranch()->GetEntry(j); + oldtree->GetEntry(j); + + if (ref_x_pos == oldx_pos && ref_angle == oldangle && (!prior || (ref_reflectivity == oldreflectivity && ref_cerenkov == oldcerenkov && ref_scintillation == oldscintillation && ref_z_pos == oldz_pos))) { + //if (ref_x_pos == x_posL->GetValue() && ref_angle == angleL->GetValue()) + std::cout << "TEST 1" << std::endl; + continue; + } + x_pos = oldx_pos; + angle = oldangle; + avg = oldavg; + avg_err = oldavg_err; + rms = oldrms; + rms_err = oldrms_err; + res = oldres; + N_en = oldN_en; + reflectivity = oldreflectivity; + cerenkov = oldcerenkov; + scintillation = oldscintillation; + z_pos = oldz_pos; + if (!oldtree->GetBranch("reflectivity")) { + reflectivity = 0.9; + } + if (!oldtree->GetBranch("cerenkov")) { + cerenkov = 1.0; + } + if (!oldtree->GetBranch("scintillation")) { + scintillation = 1.0; + } + if (!oldtree->GetBranch("z_pos")) { + z_pos = -11.0; + } + newtree->Fill(); + } + + // Append current run to end + old_file->Close(); + gSystem->Exec("rm scans.root"); + delete old_file; + } + else { + // Old file doesn't exist, make a new one + new_file.cd(); + newtree = new TTree("scans","scans"); + + // Write new tree + newtree->Branch("angle",&angle); + newtree->Branch("x_pos",&x_pos); + newtree->Branch("avg_pes",&avg); + newtree->Branch("avg_pes_err",&avg_err); + newtree->Branch("rms_pes",&rms); + newtree->Branch("rms_pes_err",&rms_err); + newtree->Branch("res",&res); + newtree->Branch("nentries",&N_en); + newtree->Branch("reflectivity",&reflectivity); + newtree->Branch("cerenkov",&cerenkov); + newtree->Branch("scintillation",&scintillation); + newtree->Branch("z_pos",&z_pos); + } + + newtree->SetBranchAddress("angle",&angle); + newtree->SetBranchAddress("x_pos",&x_pos); + newtree->SetBranchAddress("avg_pes",&avg); + newtree->SetBranchAddress("avg_pes_err",&avg_err); + newtree->SetBranchAddress("rms_pes",&rms); + newtree->SetBranchAddress("rms_pes_err",&rms_err); + newtree->SetBranchAddress("res",&res); + newtree->SetBranchAddress("nentries",&N_en); + newtree->SetBranchAddress("reflectivity",&reflectivity); + newtree->SetBranchAddress("cerenkov",&cerenkov); + newtree->SetBranchAddress("scintillation",&scintillation); + newtree->SetBranchAddress("z_pos",&z_pos); + + angle = user_angle; + x_pos = user_x_pos; + file_out_rms<Exec("mv localTmp.root scans.root"); + + } + plotsFile->cd(); c1[p]->Write(); - c1[p]->SaveAs(/*plotsFolder+*/Form("%s_%03.2f_%02d.png",variable.c_str(),varVal,p)); + c1[p]->SaveAs(Form("%s_%d.png",fileP.substr(0,fileP.find(".root")).c_str(),p)); } file_out_rms.close(); @@ -405,20 +629,27 @@ void pePlots(int argcC, char **argvC, std::string fileP="tracking.root", int det plotsTree->Write("", TObject::kOverwrite); plotsTree->Print(); plotsFile->Close(); - theApp.Run(); + //theApp.Run(); } int main(int argc, char **argv) { std::string fileString = "tracking.root"; - std::string varString = "reflectorAngle"; - std::string unitString = "deg"; + double user_angle = 0.0; + double user_x_pos = 0.0; + double user_reflectivity = 0.9; + double user_cerenkov = 1.0; + double user_scintillation = 1.0; + double user_z_pos = -11.0; + //std::string varString = "reflectorAngle"; + //std::string unitString = "deg"; bool reana = true; int detid=50001; - double manipVar=11.5; - if (argc <= 1 || argc > 7) + //double manipVar=11.5; + if (argc <= 1 || argc > 9) { - std::cerr << "Usage: ./pe char*:filename int:detid char*:manipulateVariable float:variableValue bool:reanalyze(y or n)" << std::endl; + std::cerr << "Usage: ./pe char*:filename int:detNumber double:angle double:x_pos double:reflectivity double:cerenkov double:scintillation double:z_pos" << std::endl; + //std::cerr << "Usage: ./pe char*:filename int:detid char*:manipulateVariable float:variableValue bool:reanalyze(y or n)" << std::endl; exit(0); } if (argc >= 2) @@ -430,33 +661,37 @@ int main(int argc, char **argv) { detid = atoi(argv[2]); } - if (argc >=4) + if (argc >= 4) { - std::string varName(argv[3]); - varString = varName; + user_angle = atof(argv[3]); } - if (argc >=5) + if (argc >= 5) { - manipVar = atof(argv[4]); + user_x_pos = atof(argv[4]); } - if (argc >=6) + if (argc >= 6) { - std::string unitName(argv[5]); - unitString = unitName; + user_reflectivity = atof(argv[5]); } if (argc >=7) { - if (argv[6][0]=='n'){ - reana=false; - } + user_cerenkov = atof(argv[6]); + } + if (argc >=8) + { + user_scintillation = atof(argv[7]); + } + if (argc >=9) + { + user_z_pos = atof(argv[8]); } if (reana == true) { std::cout << "Running with file=" << fileString << ", detid=" << detid << std::endl; pe(fileString, detid); } - if (argc >=5){ + if (argc >=3){ std::cout << "Plotting previously analyzed file=" << fileString << " + PEs_det_" << detid << ".root" << std::endl; - pePlots(argc, argv, fileString, detid, varString, manipVar, unitString); + pePlots(argc, argv, fileString, detid, user_angle, user_x_pos, user_reflectivity, user_cerenkov, user_scintillation, user_z_pos); } } diff --git a/src/remollGenBeam.cc b/src/remollGenBeam.cc index db54316d0..e3d7e56eb 100644 --- a/src/remollGenBeam.cc +++ b/src/remollGenBeam.cc @@ -36,6 +36,7 @@ remollGenBeam::remollGenBeam() fSampType = kNoTargetVolume; fApplyMultScatt = true; + fThisGenMessenger->DeclarePropertyWithUnit("rasterRefZ","mm",fRasterRefZ,"Raster Origin Z: z unit"); fThisGenMessenger->DeclarePropertyWithUnit("origin","mm",fOriginMean,"origin position mean: x y z unit"); fThisGenMessenger->DeclareMethodWithUnit("x","mm",&remollGenBeam::SetOriginXMean,"origin x position mean"); fThisGenMessenger->DeclareMethodWithUnit("y","mm",&remollGenBeam::SetOriginYMean,"origin y position mean"); From 59c25ca355b6d999c2faa989662e2cb7c9ffcd12 Mon Sep 17 00:00:00 2001 From: Cameron Clarke Date: Wed, 8 Jul 2020 20:21:39 -0400 Subject: [PATCH 046/443] Adding scanning scripts and macro for optical property and PE studies --- macros/preserve_recreate-brad.mac | 68 +++++++++++++ scripts/scan.sh | 156 ++++++++++++++++++++++++++++++ 2 files changed, 224 insertions(+) create mode 100644 macros/preserve_recreate-brad.mac create mode 100755 scripts/scan.sh diff --git a/macros/preserve_recreate-brad.mac b/macros/preserve_recreate-brad.mac new file mode 100644 index 000000000..baa979c11 --- /dev/null +++ b/macros/preserve_recreate-brad.mac @@ -0,0 +1,68 @@ +# Recreating the Mainz beam test + +# These must be called before initialize +/remoll/setgeofile geometry_Mainz/mollerMother_Mainz.gdml +/remoll/physlist/parallel/disable +/remoll/physlist/optical/enable + +/process/optical/processActivation Cerenkov false +/process/optical/processActivation Scintillation false + +/process/optical/setTrackSecondariesFirst Cerenkov true +/process/optical/setTrackSecondariesFirst Scintillation true + +# This must be explicitly called +/run/initialize + +/process/optical/cerenkov/setTrackSecondariesFirst true +/process/optical/cerenkov/setMaxPhotons 2000 +/process/optical/scintillation/setTrackSecondariesFirst true +/process/optical/scintillation/setYieldFactor 1.0 +/process/optical/scintillation/setExcitationRatio 0.0 + +/remoll/SD/enable_all + +/remoll/printgeometry true + +#/remoll/scalefield map_directory/blockyHybrid_rm_3.0.txt 1.0 +#/remoll/magcurrent map_directory/blockyHybrid_rm_3.0.txt 1000.0 A + +# Raster and initial angle stuff +/remoll/oldras true +#/remoll/rasx 0 mm +#/remoll/rasy 10 mm + +#Set Beam Generator settings +/remoll/evgen/set beam +#/run/beamOn 0 + + +#---------------------------------------- + +# Kill tracks on interactions with W, Cu, and Pb +#/control/execute macros/kryptonite.mac + +/process/list + +# Electrons incident on quartz------------ + +#/process/optical/cerenkov/setMaxPhotons 0 +# (Quartz center, - 1/2 of quartz length, - full distance to PMT )/2 +# (-987.5-75 -1350 )/2 = 1206.25 +/remoll/evgen/beam/rasterRefZ 0.0 mm +/remoll/evgen/beam/origin 0.0 0.0 0.0 mm +/remoll/evgen/beam/th -11.5 deg +#/remoll/evgen/beam/x -1206.25 mm +#/remoll/evgen/beam/z 45.0 mm +#-11.5 degrees /remoll/evgen/beam/th -0.1047 +#/remoll/evgen/beam/direction -0.19937 0.0 0.97992 +#/remoll/evgen/beam/th -11.5 deg +/remoll/evgen/beam/rasx 0.0 mm +/remoll/evgen/beam/rasy 10.0 mm +/remoll/beamene 850 MeV + +/remoll/evgen/beam/partName e- + +/remoll/filename remollout_Mainz_0.0_degrees_0.0_x.root + +/run/beamOn 100000 diff --git a/scripts/scan.sh b/scripts/scan.sh new file mode 100755 index 000000000..0ae5bafa7 --- /dev/null +++ b/scripts/scan.sh @@ -0,0 +1,156 @@ +#!/bin/bash + +# Takes 5 arguments +# +# Fixed value of non-scanned variable - default = 0.0 +# Variable to scan ("angle" or "x") - default = "angle" +# Min of scanned variable - default = -30 +# Max of scanned variable - default = 30 +# Step size - default = 0.5 + +cd macros + +if [ "$#" -lt 1 ] ; then + echo " ERROR, requires at least one input + " + echo " usage: ./scan.sh fixed-non-scanned \"variable-to-scan\" min-of-scan (-30) max-of-scan (30) step-size (0.5) + Takes 9 arguments + + Fixed value of non-scanned variable - default = 0.0 + Variable to scan (\"angle\" or \"x\") - default = \"angle\" + Min of scanned variable - default = -30 + Max of scanned variable - default = 30 + Step size - default = 0.5 + Reflectivity of light guide - default = 0.9 + Cerenkov - default = 1.0 + Scintillation - default = 1.0 + z Position of beam origin - default = -11.0 + geometry file name - default = \"Mainz\"" + exit +fi +fixed="$1" +scanned="angle" +scanMin=-30.0 +scanMax=30.0 +scanStep=0.5 +reflectivity=0.9 +cerenkov=1 +scintillation=1 +#z_pos=-52.0 +z_pos=0.0 +geom="Mainz" +if [ "$#" -gt 1 ] ; then + scanned="$2" +fi +if [ "$#" -gt 2 ] ; then + scanMin=$3 +fi +if [ "$#" -gt 3 ] ; then + scanMax=$4 +fi +if [ "$#" -gt 4 ] ; then + scanStep=$5 +fi +if [ "$#" -gt 5 ] ; then + reflectivity=$6 +fi +if [ "$#" -gt 6 ] ; then + cerenkov=$(printf "%.0f" "$7") +fi +if [ "$#" -gt 7 ] ; then + scintillation=$(printf "%.0f" "$8") +fi +if [ "$#" -gt 8 ] ; then + z_pos=$9 +fi +if [ "$#" -gt 9 ] ; then + geom="${10}" +fi + +angle=0.0 +x_pos=0.0 + +numSteps=$(printf "%.0f" "$(bc -l <<< \(${scanMax}-\(${scanMin}\)\)/$scanStep)") +fixed=$(printf "%.1f" "$(bc -l <<< 1.0*$fixed)") +z_point=0.0 + +defaultName="qsimout.root" +outputName="qsimout.root" +name="0.0_degrees_0.0_x" + +cer="true" +scint="true" +if [[ $cerenkov > 0.0 ]] ; then + cer="true" +else + cer="false" +fi +if [[ $scintillation > 0.0 ]] ; then + scint="true" +else + scint="false" +fi + +#tmpFolder="${scanned}_${fixed}" +#if [ ! -d $tmpFolder ] ; then +# mkdir $tmpFolder +#fi + +for currentStep in `seq 0 $numSteps`; +do + point=$(printf "%.1f" "$(bc -l <<< \($scanMin+\(1.0*$currentStep*$scanStep\)\))") + if [[ "$scanned" == "angle" ]] ; then + x_pos=$fixed + angle=$point + fi + if [[ "$scanned" == "x" ]] ; then + x_pos=$point + angle=$fixed + fi + name="${angle}_degrees_${x_pos}_x_${z_pos}_z_${reflectivity}_ref_${cerenkov}_cer_${scintillation}_scint" + cp preserve_recreate-brad.mac recreate-brad_${geom}_${name}.mac + # FIXME This angle is hardcoded to the qsim-matching case!! + # 0.1994 = sin(11.5 degrees), $fixed is the distance from 0.0, + is farther towards PMT, further back away from +z axis + # 0.104528 = sin(6 degrees) + z_point=$(printf "%.1f" "$(bc -l <<< ${z_pos}+\($x_pos*0.1045\))") + # FIXME z_point and x offset relationships assume the detector is immediately downstream of the origin, and ideally centered at the middle of the lightguide + #z_point=$(printf "%.1f" "$(bc -l <<< -11.0-\($fixed*0.1994\))") + sed -i 's;'"/remoll/evgen/beam/th -11.5 deg"';'"/remoll/evgen/beam/th ${angle} deg"';g' recreate-brad_${geom}_${name}.mac + sed -i 's;'"/remoll/evgen/beam/origin 0.0 0.0 0.0 mm"';'"/remoll/evgen/beam/origin ${x_pos} 0.0 ${z_point} cm"';g' recreate-brad_${geom}_${name}.mac + + sed -i 's;'"/remoll/setgeofile geometry_Mainz/mollerMother_Mainz.gdml"';'"/remoll/setgeofile mollerMother_${geom}.gdml"';g' recreate-brad_${geom}_${name}.mac + + sed -i 's;'"/remoll/evgen/beam/rasterRefZ 0.0 mm"';'"/remoll/evgen/beam/rasterRefZ ${z_point} cm"';g' recreate-brad_${geom}_${name}.mac + + sed -i 's;'"/process/optical/processActivation Cerenkov false"';'"/process/optical/processActivation Cerenkov ${cer}"';g' recreate-brad_${geom}_${name}.mac + sed -i 's;'"/process/optical/processActivation Scintillation false"';'"/process/optical/processActivation Scintillation ${scint}"';g' recreate-brad_${geom}_${name}.mac + sed -i 's;'"Mainz_0.0_degrees_0.0_x.root"';'"${geom}_${name}.root"';g' recreate-brad_${geom}_${name}.mac + tmpFolder="out_${geom}_${name}" + if [ ! -d $tmpFolder ] ; then + mkdir $tmpFolder + fi + cd $tmpFolder + cp -p ../../build/remoll . + cp -p ../../geometry_Mainz/materialsOptical.xml . + cp -p ../../geometry_Mainz/*${geom}.* . + #FIXME This assumes I've hacked the matrices_${geom}.xml to only have 2 entries for mylar reflectivity... probably needs to be punted into the gdml generator code (which should also be added into this script for future optimization uses) + sed -i 's;'"2.00214948263953\*eV 0.9"';'"2.00214948263953\*eV ${reflectivity}"';g' matrices_${geom}.xml + sed -i 's;'"7.75389038185112\*eV 0.9"';'"7.75389038185112\*eV ${reflectivity}"';g' matrices_${geom}.xml + cp ../pe . + mv ../recreate-brad_${geom}_${name}.mac . + #source /share/apps/root-5.34.36-build/bin/thisroot.sh + ./remoll recreate-brad_${geom}_${name}.mac + #cd ../ + #./build/remoll macros/recreate-brad_${geom}_${name}.mac + #cd - + #source /share/apps/root-6.14.06-build/bin/thisroot.sh + #cd $tmpFolder + ./pe remollout_${geom}_${name}.root 540210 ${angle} ${x_pos} ${reflectivity} ${cerenkov} ${scintillation} ${z_point} + #../pe ../../remollout_${geom}_${name}.root 540210 ${reflectivity} ${cerenkov} ${scintillation} ${z_point} + #source /share/apps/root-5.34.36-build/bin/thisroot.sh + convert remollout_${geom}_${name}*.png remollout_${geom}_${name}.pdf + rm remollout_${geom}_${name}*.png + rm remollout_${geom}_${name}.root + rm remollout_${geom}_${name}_PEs_det_540210.root + cd - +done From 67819ffcd0c1030dabaf8fdaf53ee9a8484826ec Mon Sep 17 00:00:00 2001 From: Cameron Clarke Date: Mon, 13 Jul 2020 08:52:06 -0400 Subject: [PATCH 047/443] Updating scanning script for submitting jobs --- scripts/scan.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/scan.sh b/scripts/scan.sh index 0ae5bafa7..6bf117d31 100755 --- a/scripts/scan.sh +++ b/scripts/scan.sh @@ -8,8 +8,6 @@ # Max of scanned variable - default = 30 # Step size - default = 0.5 -cd macros - if [ "$#" -lt 1 ] ; then echo " ERROR, requires at least one input " @@ -133,7 +131,7 @@ do cp -p ../../build/remoll . cp -p ../../geometry_Mainz/materialsOptical.xml . cp -p ../../geometry_Mainz/*${geom}.* . - #FIXME This assumes I've hacked the matrices_${geom}.xml to only have 2 entries for mylar reflectivity... probably needs to be punted into the gdml generator code (which should also be added into this script for future optimization uses) + cp ../../geometry_Mainz/preserve_matrices_${geom}.xml matrices_${geom}.xml sed -i 's;'"2.00214948263953\*eV 0.9"';'"2.00214948263953\*eV ${reflectivity}"';g' matrices_${geom}.xml sed -i 's;'"7.75389038185112\*eV 0.9"';'"7.75389038185112\*eV ${reflectivity}"';g' matrices_${geom}.xml cp ../pe . From 2732381788c5e3abb0ccf1bebecd530ab8fd3130 Mon Sep 17 00:00:00 2001 From: Cameron Clarke Date: Wed, 15 Jul 2020 20:35:10 -0400 Subject: [PATCH 048/443] New PE script that uses a lookup table to estimate background (or signal.. WIP) PEs --- analysis/CMakeLists.txt | 1 + analysis/bkgd_pe/CMakeLists.txt | 74 ++ analysis/bkgd_pe/bkgd_pe.cc | 959 ++++++++++++++++++++++ analysis/bkgd_pe/include/bkgd_pe.hh | 230 ++++++ analysis/bkgd_pe/include/bkgd_peLinkDef.h | 31 + analysis/bkgd_pe/include/bkgd_petypes.hh | 148 ++++ 6 files changed, 1443 insertions(+) create mode 100755 analysis/bkgd_pe/CMakeLists.txt create mode 100644 analysis/bkgd_pe/bkgd_pe.cc create mode 100644 analysis/bkgd_pe/include/bkgd_pe.hh create mode 100644 analysis/bkgd_pe/include/bkgd_peLinkDef.h create mode 100644 analysis/bkgd_pe/include/bkgd_petypes.hh diff --git a/analysis/CMakeLists.txt b/analysis/CMakeLists.txt index d594d8e6d..c344ee330 100644 --- a/analysis/CMakeLists.txt +++ b/analysis/CMakeLists.txt @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 2.6 FATAL_ERROR) project(analysis) add_subdirectory(pe) +add_subdirectory(bkgd_pe) add_subdirectory(hallRad) add_subdirectory(pruneTreeEnvelope) add_subdirectory(rad_dose) diff --git a/analysis/bkgd_pe/CMakeLists.txt b/analysis/bkgd_pe/CMakeLists.txt new file mode 100755 index 000000000..dfb4ad5fe --- /dev/null +++ b/analysis/bkgd_pe/CMakeLists.txt @@ -0,0 +1,74 @@ +#---------------------------------------------------------------------------- +# Setup the project +# +cmake_minimum_required(VERSION 2.6 FATAL_ERROR) +project(bkgd_pe) + +# Default install path is the source directory +if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + message(STATUS " Install-prefix was at default -> forcing it to the source-dir" ) + message(STATUS " Use -DCMAKE_INSTALL_PREFIX=/usr/local to set to something else" ) + set (CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}" + CACHE PATH "default install path" FORCE ) +endif() + +# Use GNU install dirs +include(GNUInstallDirs) + +list(APPEND CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + +find_package(Remoll REQUIRED HINTS "${PROJECT_SOURCE_DIR}/../..") +include(${REMOLL_USE_FILE}) +list(APPEND CMAKE_INSTALL_RPATH "${REMOLL_LIBRARY_DIR}") + +list(APPEND CMAKE_INSTALL_RPATH "${REMOLL_LIBRARY_DIR}/../..") + +find_package(ROOT REQUIRED) +include(${ROOT_USE_FILE}) +list(APPEND CMAKE_INSTALL_RPATH "${ROOT_LIBRARY_DIR}") + + +#---------------------------------------------------------------------------- +# generate dictionaries +# +ROOT_GENERATE_DICTIONARY( + bkgd_peDict # path to dictionary to generate + "include/bkgd_petypes.hh" # list of classes to process + LINKDEF "include/bkgd_peLinkDef.h" # ROOT linkDef file + OPTIONS -p +) + +#---------------------------------------------------------------------------- +# +include_directories(${PROJECT_SOURCE_DIR}/include ${REMOLL_INCLUDE_DIR}) + +#---------------------------------------------------------------------------- +# Locate sources and headers for this project +# NB: headers are included so they will show up in IDEs +# +file(GLOB sources ${PROJECT_SOURCE_DIR}/src/bkgd_pe*.cc) +file(GLOB headers ${PROJECT_SOURCE_DIR}/include/bkgd_pe*.hh) + +#---------------------------------------------------------------------------- +# Add the executable, and link it to the Geant4 libraries +# +#---------------------------------------------------------------------------- +# Generate dictionaries as well (so we can write objects to ROOT files +# +add_library(bkgd_pe-lib SHARED ${sources} ${headers} bkgd_peDict.cxx) +set_target_properties(bkgd_pe-lib PROPERTIES OUTPUT_NAME bkgd_pe) +target_link_libraries(bkgd_pe-lib ${ROOT_LIBRARIES} ${REMOLL_LIBRARIES}) + +add_executable(bkgd_pe-bin bkgd_pe.cc) +set_target_properties(bkgd_pe-bin PROPERTIES OUTPUT_NAME bkgd_pe) +target_link_libraries(bkgd_pe-bin ${REMOLL_LIBRARIES} bkgd_pe-lib) + +#---------------------------------------------------------------------------- +# +add_custom_target(bkgd_pe DEPENDS bkgd_pe-bin) + +#---------------------------------------------------------------------------- +# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX +# +install(TARGETS bkgd_pe-bin DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(TARGETS bkgd_pe-lib DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/analysis/bkgd_pe/bkgd_pe.cc b/analysis/bkgd_pe/bkgd_pe.cc new file mode 100644 index 000000000..c66982224 --- /dev/null +++ b/analysis/bkgd_pe/bkgd_pe.cc @@ -0,0 +1,959 @@ +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "TTree.h" +#include "TFile.h" +#include "remolltypes.hh" +#include "bkgd_petypes.hh" +#include "bkgd_pe.hh" + +#define pi 3.141592653589793238462643383279502884L + +class bkgd { + public: + void do_pe(int, char**); + void set_plot_style(); + void get_lookuptable(); + void bkgd_pe_ana(); + void bkgd_pePlots(int, char **); + private: + std::string fileString = "tracking.root"; + std::string detName = "R5o"; + std::string anaStr = "backgrounds"; + double current = 85.0; + double user_angle = 0.0; + double user_x_pos = 0.0; + double user_reflectivity = 0.7; + double user_cerenkov = 1.0; + double user_scintillation = 1.0; + double user_z_pos = 0.0; + double N_entries = 0; + //std::string varString = "reflectorAngle"; + //std::string unitString = "deg"; + bool reana = true; + int detid=540210; + + TH2D* lookupTable; + TH2D* lookupTableReference; + TH2D* lookupTableLog; + TH2D* lookupTableFlat; +}; + +void bkgd::get_lookuptable() +{ + TFile* old_file; + TTree* oldtree; + /*double oldx_pos = 0.0; + double oldangle = 0.0; + double oldavg = 0.0; + double oldavg_err = 0.0; + double oldrms = 0.0; + double oldrms_err = 0.0; + double oldres = 0.0; + double oldN_en = 0.0; + double oldreflectivity = 0.0; + double oldcerenkov = 0.0; + double oldscintillation = 0.0; + double oldz_pos = 0.0;*/ + // FIXME + if (!gSystem->AccessPathName(Form("scans_%s.root",detName.c_str()))) { + // Old file exists, read it and add new entries + old_file = TFile::Open(Form("scans_%s.root",detName.c_str())); + old_file->GetObject("scans", oldtree); + if (!oldtree) { + std::cout << "ERROR: Dead scans tree" ; + return; + } + int nent = oldtree->GetEntries(); + } + // Draw a TGraph, GOFF mode, obtain the output vectors and loop over them, filling in a low/up bin edge array with the means of neighboring bin centers, if it's an edge then calculate distance from opposite side and add that off to the side. + // Include in cut avg_pes != 0 (i.e. not some glitch) + // Make a new TH2 hist with Nentries from tgraph and bin low/highs in angle and x_pos from above exercise + + TH1* tmpHist; + //TGraph* tmpGraph; + // + const Int_t refnPoints = oldtree->Draw("angle:10*abs(x_pos):avg_pes","avg_pes!=0","goff"); + //const Int_t nPoints = oldtree->Draw("angle:10*(x_pos)-960.0-215.0:avg_pes","angle>-23 && angle<23 && avg_pes!=0 && scintillation==1 && cerenkov==1 && reflectivity==0.7","goff"); + Double_t* ref_local_angle_points = oldtree->GetV1(); + Double_t* ref_local_x_pos_points = oldtree->GetV2(); + Double_t ref_x_pos = ref_local_x_pos_points[(int) refnPoints/2]; // Just take the first entry and hope it is good enough :/ + Double_t ref_angle = ref_local_angle_points[(int) refnPoints/2]; + std::cout<< "Using reference X = " << ref_x_pos << ", and reference angle = " << ref_angle << " to determine lookup table binning info" << std::endl; + + const Int_t nAngles = oldtree->Draw("angle",Form("10*abs(x_pos)==%f",ref_x_pos),"goff"); + //const Int_t nAngles = oldtree->Draw("angle","angle>-23 && angle<23 && x_pos==1.0 && avg_pes!=0 && scintillation==1 && cerenkov==1 && reflectivity==0.7","goff"); + Double_t* angle_points1 = oldtree->GetV1(); + Double_t* angle_points = new Double_t[nAngles+1]; + Int_t* angle_indices = new Int_t[nAngles]; + TMath::Sort(nAngles,angle_points1,angle_indices,kFALSE); + for (Int_t j = 0 ; j < nAngles; j++) { + angle_points[j] = angle_points1[angle_indices[j]]; + std::cout<< "Bin angle point = " << angle_points[j] << std::endl; + } + + const Int_t nXpos = oldtree->Draw("10*abs(x_pos)",Form("angle==%f",ref_angle),"goff"); + //const Int_t nXpos = oldtree->Draw("10*(x_pos)-960.0-215.0","angle==0.0 && avg_pes!=0 && scintillation==1 && cerenkov==1 && reflectivity==0.7","goff"); + Double_t* x_pos_points1 = oldtree->GetV1(); + Double_t* x_pos_points = new Double_t[nXpos+1]; + Int_t* x_pos_indices = new Int_t[nXpos]; + TMath::Sort(nXpos,x_pos_points1,x_pos_indices,kFALSE); + for (Int_t j = 0 ; j < nXpos; j++) { + x_pos_points[j] = x_pos_points1[x_pos_indices[j]]; + std::cout<< "Bin x point = " << x_pos_points[j] << std::endl; + } + x_pos_points[nXpos] = x_pos_points[nXpos-1] + ( x_pos_points[nXpos-1] - x_pos_points[nXpos-2] ); + angle_points[nAngles] = angle_points[nAngles-1] + ( angle_points[nAngles-1] - angle_points[nAngles-2] ); + std::cout<< "Last bin x point = " << x_pos_points[nXpos] << std::endl; + std::cout<< "Last bin angle point = " << angle_points[nAngles] << std::endl; + + lookupTable = new TH2D("lookupTable","lookupTable",nAngles,angle_points,nXpos,x_pos_points); + lookupTableReference = new TH2D("lookupTableReference","lookupTableReference",nAngles,angle_points,nXpos,x_pos_points); + lookupTableLog = new TH2D("lookupTableLog","lookupTableLog",nAngles,angle_points,nXpos,x_pos_points); + lookupTableFlat = new TH2D("lookupTableFlat","lookupTableFlat",nAngles,angle_points,nXpos,x_pos_points); + + const Int_t nPoints = oldtree->Draw("angle:10*abs(x_pos):avg_pes","avg_pes!=0","goff"); + Double_t* local_angle_points = oldtree->GetV1(); + Double_t* local_x_pos_points = oldtree->GetV2(); + Double_t* avg_pes_points = oldtree->GetV3(); + + for (Int_t i = 0 ; i < nPoints ; i++ ) { + std::cout<< "Filling lookup table with point: 10*abs(x_pos) = " << local_x_pos_points[i] << ", x bin " << lookupTable->GetYaxis()->FindBin(local_x_pos_points[i]) << ", angle = " << local_angle_points[i] << ", angle bin " << lookupTable->GetXaxis()->FindBin(local_angle_points[i]) << ", pe value = " << avg_pes_points[i] << std::endl; + lookupTable->Fill(local_angle_points[i],local_x_pos_points[i],avg_pes_points[i]); + lookupTableReference->Fill(local_angle_points[i],local_x_pos_points[i],avg_pes_points[i]); + lookupTableLog->Fill(local_angle_points[i],local_x_pos_points[i],TMath::Log(avg_pes_points[i])); + // Unweighted, so the weighted one can have its bins re-normalized if any are filled with more than one point (I know, it is cheating the definition of a histogram, but lookup tables are hard in ROOT). + lookupTableFlat->Fill(local_angle_points[i],local_x_pos_points[i],1); + } + Double_t localBinContent = 0.0; + Double_t localFlatBinContent = 0.0; + + for (Int_t i = 0 ; i < nPoints ; i++ ) { + //std::cout << "Angle bin = " << lookupTableReference->GetXaxis()->FindBin(local_angle_points[i]) << " x_pos bin = " << lookupTableReference->GetYaxis()->FindBin(local_x_pos_points[i]) << " of x = " << local_x_pos_points[i] << std::endl; + localBinContent = (Double_t)lookupTableReference->GetBinContent(lookupTableReference->GetXaxis()->FindBin(local_angle_points[i]),lookupTableReference->GetYaxis()->FindBin(local_x_pos_points[i])); + localFlatBinContent = (Double_t)lookupTableFlat->GetBinContent(lookupTableFlat->GetXaxis()->FindBin(local_angle_points[i]),lookupTableFlat->GetYaxis()->FindBin(local_x_pos_points[i])); + if (localFlatBinContent > 1) { + std::cout<< "Checking double-filling: was " << localBinContent << ", with " << localFlatBinContent << " points at 10*(x_pos) = " << local_x_pos_points[i] << ", angle = " << local_angle_points[i] << ", pe value = " << avg_pes_points[i] << std::endl; + // Normalize each bin the be the true average of whatever was thrown into it. + //lookupTable->SetBinContent(lookupTable->GetBin(lookupTable->GetXaxis()->FindBin(local_angle_points[i]),lookupTable->GetYaxis()->FindBin(local_x_pos_points[i])),avg_pes_points[i]); + lookupTable->SetBinContent(lookupTable->GetBin(lookupTable->GetXaxis()->FindBin(local_angle_points[i]),lookupTable->GetYaxis()->FindBin(local_x_pos_points[i])),localBinContent/localFlatBinContent); + //lookupTable->SetBinContent(local_angle_points[i],local_x_pos_points[i],localBinContent/localFlatBinContent); + std::cout << "now = " << (Double_t)lookupTable->GetBinContent(lookupTable->GetXaxis()->FindBin(local_angle_points[i]),lookupTable->GetYaxis()->FindBin(local_x_pos_points[i])) << std::endl ; + } + } + TCanvas * c1 = new TCanvas(); + c1->cd(); + lookupTableLog->SetName(Form("Look Up Table - Log(Avg PEs)")); + lookupTableLog->SetTitle(Form("Look Up Table - Log(Avg PEs)")); + lookupTableLog->SetXTitle(Form("Angle (degrees)")); + lookupTableLog->SetYTitle(Form("Radial hit position (mm)")); + lookupTableLog->Draw("COLZ"); + c1->SaveAs(Form("lookupTable_%s.pdf(",detName.c_str())); + TCanvas * c2 = new TCanvas(); + c2->cd(); + lookupTable->SetName(Form("Look Up Table - Log(Avg PEs)")); + lookupTable->SetTitle(Form("Look Up Table - Log(Avg PEs)")); + lookupTable->SetXTitle(Form("Angle (degrees)")); + lookupTable->SetYTitle(Form("Radial hit position (mm)")); + lookupTable->Draw("COLZ"); + c2->SaveAs(Form("lookupTable_%s.pdf)",detName.c_str())); + delete c1; + delete c2; +} + +void bkgd::set_plot_style() +{ + const Int_t NRGBs = 5; + const Int_t NCont = 255; + // See class TColor documentation and SetPalette() command + Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; + Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 }; + Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 }; + Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 }; + TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont); + gStyle->SetNumberContours(NCont); +} + + +void bkgd::bkgd_pe_ana() +{ + TTree::SetMaxTreeSize(Long64_t(1024)*1024*1024*200); //200 GB tree + Double_t asymmetry = 0.0; + Double_t rate = 0.0; + remollEvent_t *fEvent = 0; + /*double A, Am; + double xs; + double Q2, W2; + double thcom; + double beamp;*/ + std::vector < remollGenericDetectorHit_t > *fHit = 0; + std::vector < remollEventParticle_t > *fPart = 0; + int dotPos = fileString.rfind("."); + std::ostringstream os; + os << fileString.substr(0, dotPos) << "_PEs_"<<"det_"<Get("T"); + TFile *newFile = new TFile(fileName.c_str(),"RECREATE", "", 1); + + TTree* newTree = new TTree("T", "Tree of detector hits"); + oldTree->SetBranchAddress("ev", &fEvent); + oldTree->SetBranchAddress("rate", &rate); + oldTree->SetBranchAddress("hit", &fHit); + oldTree->SetBranchAddress("part", &fPart); + std::vector < simPEs_t > *simPEs = new std::vector < simPEs_t > ; + std::vector < simPEs_t > *simRPEs = new std::vector < simPEs_t > ; + std::vector < simPEs_t > *simAPEs = new std::vector < simPEs_t > ; + std::vector < catPEs_t > *catPEs = new std::vector < catPEs_t > ; + std::vector < Q_t > *Q = new std::vector < Q_t > ; + std::vector < Ref_t > *Ref = new std::vector < Ref_t > ; + std::vector < RefX_t > *RefX = new std::vector < RefX_t > ; + std::vector < Refair_t > *Refair = new std::vector < Refair_t > ; + std::vector < LG_t > *LG = new std::vector < LG_t > ; + std::vector < LGair_t > *LGair = new std::vector < LGair_t > ; + std::vector < PMTcat_t > *PMTcat = new std::vector < PMTcat_t > ; + std::vector < PMTbulk_t > *PMTbulk = new std::vector < PMTbulk_t > ; + std::vector < elseX_t > *elseX = new std::vector < elseX_t > ; + std::vector eTRID; + std::vector DETID; + std::vector PID; + std::vector MTRID; + std::vector peTRID; + double peNumber; + double peRateWeighting; + double peAsymmetryWeighting; + + int Qcounted = 0; + int Refaircounted = 0; + int LGaircounted = 0; + int PMTbulkcounted = 0; + int detSourcedPEs = 0; + double peN_entries = 0; + + //TODO reading data into envelopes downstream could be sped up + //by storing the data by Z instead of by hit + + newTree->Branch("nentries", &peN_entries); + newTree->Branch("simpes", &simPEs); + newTree->Branch("simRpes", &simRPEs); + newTree->Branch("simApes", &simAPEs); + newTree->Branch("catpes", &catPEs); + newTree->Branch("q", &Q); + newTree->Branch("ref", &Ref); + newTree->Branch("refx", &RefX); + newTree->Branch("refair", &Refair); + newTree->Branch("lg", &LG); + newTree->Branch("lgair", &LGair); + newTree->Branch("pmtcat", &PMTcat); + newTree->Branch("pmtbulk", &PMTbulk); + newTree->Branch("else", &elseX); + + Double_t lookup = 0.0; + Int_t lookupAngle = 0; + Int_t lookupXpos = 0; + + for (size_t j = 0; j < oldTree->GetEntries(); j++) + { + if (j%10000 == 0) + { + std::cerr << "\r" << j << "/" << oldTree->GetEntries() << " - " << (j*1.0)/oldTree->GetEntries() * 100 << "%"; + } + + oldTree->GetEntry(j); + remollEvent_t event = *fEvent; + //std::cout << "Hits: " << fHit->size() << std::endl; + //std::cout << "Parts: " << fPart->size() << std::endl; + //std::vector x, y, z, px, py, pz, p, e, m, vx, vy, vz; + std::vector cathitx, cathity, cathitz; + // Log which electron track IDs (and other info) hit which detectors, and which PE IDs hit the cathode and where + // Attribute all npe counts and cathode hit positions to all DETID branches that are hit during that event (in lieu of getting photon birth vertex properly down) + // int npe = 0; // do this as peTRID->Size(); + + for (size_t i = 0; i < fHit->size(); i++) + { + remollGenericDetectorHit_t hit = fHit->at(i); + //Count each optical photon hit in an entry, iff the primary electron hits a detector, also sum accidentals + // Make a root tree out of the amounts (and locations) of photon hits on the various detectors + // Each branch is a different detector that the electron can hit (quartz, wall, air, cathode, PMT, etc.) + // Store the electron hit location and energy, etc. for that hit + // Store the total number of photons that hit the cathode after that electron hit, and their cathode hit info + + // FIXME remove this condition to get results for ALL SIGNAL of any form, not just parent electron hits + if (anaStr == "backgrounds" && (hit.det==detid+4 || hit.det == detid+5) && hit.pid == 11 && hit.mtrid == 0){ // Then this is our primary signal of interest + // if you do mtrid == 1 then you get the delta rays! About a 1% contribution + eTRID.push_back(hit.trid); + DETID.push_back(hit.det); + // FIXME Assumes the detector is alligned along the x axis and so are all particles!! Fails for backscattered particles + lookupAngle = lookupTable->GetXaxis()->FindBin((180.0/TMath::Pi())*asin(((hit.px*abs(hit.x) + hit.py*abs(hit.y))/hit.r)/hit.p)); // Maintain sign convention on angles here... was just hit.px/hit.p before... + lookupXpos = lookupTable->GetYaxis()->FindBin(hit.r); + lookup = lookupTable->GetBinContent(lookupAngle,lookupXpos); + peNumber += lookup; + peRateWeighting += rate*lookup/current; + peAsymmetryWeighting += event.A*rate*lookup/current; + if ( lookup == 0.0 ) { + std::cout << "0 PEs" << std::endl; + } + std::cout << "PE Hit, rate = " << rate/current << ", Asymmetry = " << event.A << ", lookup pe value = " << lookup << ", bin number " << lookupTable->GetBin(lookupAngle,lookupXpos) << ", " << lookupAngle << ", " << lookupXpos << ", angle = " << (180.0/TMath::Pi())*asin(((hit.px*abs(hit.x) + hit.py*abs(hit.y))/hit.r)/hit.p) << ", abs(x_pos) = " << hit.r << ", which yields: " << peRateWeighting << std::endl; + } + if (anaStr == "signals" && (hit.det==detid+1) && hit.pid == 11 && hit.mtrid == 0){ // Then this is our primary signal of interest + // if you do mtrid == 1 then you get the delta rays! About a 1% contribution + eTRID.push_back(hit.trid); + DETID.push_back(hit.det); + lookup = 8.0; + if (detName == "R5o") lookup = 12.0; + peNumber += lookup; + peRateWeighting += rate*lookup/current; + peAsymmetryWeighting += event.A*rate*lookup/current; + } + if (hit.det == detid+1) { + // If any particle hits the quartz detector then tell the particle ID and mother ID (so we can keep track of deltas) + PID.push_back(hit.pid); + MTRID.push_back(hit.mtrid); + } + if (hit.pid == 0 && hit.det == detid){ + // This is an optical photon and we want to count ++ if it hits the PMT cathode + peTRID.push_back(hit.trid); + cathitx.push_back(hit.x); + cathity.push_back(hit.y); + cathitz.push_back(hit.z); + } + } + + for (size_t i = 0; i < fHit->size();i++) + { + remollGenericDetectorHit_t hit = fHit->at(i); + for (size_t k = 0; k < eTRID.size(); k++) + { + if (hit.trid == eTRID.at(k)) { // Then this electron hit a detector we should know about and store all of the info and cathode hits too + //std::cout << "electron TRID " << hit.trid << std::endl; + // Make the electron hit info go into the appropriate detector branch + // quartz + if (hit.det == detid+1 && Qcounted==0) { + Q->push_back(QTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); + Qcounted++; + } + // reflector air + if (hit.det == detid+2 && Refaircounted==0) { + Refair->push_back(RefairTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); + Refaircounted++; + } + // reflector skin + if (hit.det == detid+3) { + Ref->push_back(RefTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); + } + // reflector volume + if (hit.det == detid+4) { + RefX->push_back(RefXTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); + } + // light guide air + if (hit.det == detid+6 && LGaircounted==0) { + LGair->push_back(LGairTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); + LGaircounted++; + } + // light guide skin + if (hit.det == detid+5) { + LG->push_back(LGTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); + } + // PMT bulk + if (hit.det == detid+7 && PMTbulkcounted==0) { + PMTbulk->push_back(PMTbulkTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); + PMTbulkcounted++; + } + // PMT cathode + if (hit.det == detid) { + PMTcat->push_back(PMTcatTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); + } + //break; //how is this useful?? I want to muliple count + } + } + } + simPEs->push_back(simPEsTrim(DETID,PID,MTRID,peNumber,cathitx,cathity,cathitz)); + simRPEs->push_back(simPEsTrim(DETID,PID,MTRID,peRateWeighting,cathitx,cathity,cathitz)); + simAPEs->push_back(simPEsTrim(DETID,PID,MTRID,peAsymmetryWeighting,cathitx,cathity,cathitz)); + catPEs->push_back(catPEsTrim(DETID,PID,MTRID,(int)peTRID.size(),cathitx,cathity,cathitz)); + detSourcedPEs=(int)peTRID.size(); + elseX->push_back(elseXTrim(((int)peTRID.size()-detSourcedPEs),cathitx,cathity,cathitz)); + peN_entries = oldTree->GetEntries(); + // FIXME old logic requires hits on the cathode... new flat_parallel detecor just wants any hit + // if (catPEs->size() > 0){} + if (simPEs->size() > 0){ + newTree->Fill(); + } + peNumber=0.0; + peRateWeighting=0.0; + peAsymmetryWeighting=0.0; + Qcounted=0; + Refaircounted=0; + LGaircounted=0; + PMTbulkcounted=0; + detSourcedPEs=0; + eTRID.clear(); + catPEs->clear(); + simPEs->clear(); + simRPEs->clear(); + simAPEs->clear(); + elseX->clear(); + Q->clear(); + Refair->clear(); + Ref->clear(); + RefX->clear(); + LGair->clear(); + LG->clear(); + PMTbulk->clear(); + PMTcat->clear(); + cathitx.clear(); + cathity.clear(); + cathitz.clear(); + DETID.clear(); + PID.clear(); + MTRID.clear(); + peTRID.clear(); + } + newFile = newTree->GetCurrentFile(); + newTree->Write("", TObject::kOverwrite); + newTree->Print(); + old->Close(); + newFile->Close(); +} + +//void pePlots(int argcC, char **argvC, std::string fileString="tracking.root", int detid=540210, std::string variable="reflectorAngle", double varVal=11.5, std::string unit="deg") +void bkgd::bkgd_pePlots(int argcC, char **argvC) +{ + //TApplication theApp("App",&argcC,argvC); + + int dotpos = fileString.rfind(".root"); + std::ostringstream os; + std::ostringstream os2; + os << fileString.substr(0, dotpos) << "_PEs_"<<"det_"<Add(ttemp); + TFile *plotsFile = new TFile(fileNamePlots.c_str(),"RECREATE", "", 1); + TTree* plotsTree = new TTree("T", "Tree of plots"); + plotsFile->cd(); // Is this necessary? + //int nentries = (Int_t)newTree->GetEntries(); + // + Tmol->SetBranchAddress("nentries", &N_entries); + if (Tmol) { + Tmol->GetEntry(0); + } + std::fstream file_out_rms; + std::fstream file_out_integral; + std::ofstream file_out_mean; + std::ofstream file_out_res; + file_out_integral.open("int.csv",std::ofstream::out | std::ofstream::app); + file_out_rms.open("rms.csv",std::ofstream::out | std::ofstream::app); + file_out_mean.open("mean.csv",std::ofstream::out | std::ofstream::app); + file_out_res.open("res.csv",std::ofstream::out | std::ofstream::app); + + //gROOT->SetStyle("Plain"); + //gStyle->SetOptStat(0); + gStyle->SetOptStat("eMR"); + gStyle->SetNumberContours(255); + + set_plot_style(); + + const int n_plots = 15; + //TH1 *Histo[n_plots]; + double integral[n_plots]; + double RMS[n_plots]; + double RMSerror[n_plots]; + double Mean[n_plots]; + double Meanerror[n_plots]; + TCanvas * c1[n_plots]; + + std::string names[n_plots]={ + "Simulated Total Cathode Spectrum per event", + "Simulated Rate-weighted Total Cathode Spectrum per event", + "Simulated Asym-weighted Total Cathode Spectrum per event", + "Total Cathode Spectrum per event", + "Cathode Spectrum from primary signal quartz electrons only", + "Cathode Spectrum from quartz deltas", + "Cathode Spectrum from all non-primary quartz signals", + "e- hit radial hit spectrum on the reflector", // Consider adding photon xyz tracking too - would have to go beside the cathode xyz tracking feature + "e- hit radial hit spectrum on the quartz-reflector holder", + "Cathode Spectrum from the reflector air", + "e- hit radial spectrum on the light guide walls", + "Cathode Spectrum from the light guide air", + "e- hit radial spectrum in the PMT bulk", + "e- hit spectrum in the cathode", + "Cathode Spectrum from elsewhere"}; + std::string draws[n_plots]={ + "simpes.npes", + "simRpes.npes", + "simApes.npes", + "catpes.npes", + "catpes.npes", + "catpes.npes", + "catpes.npes", + "ref.r", + "refx.r", + "refair.npes", + "lg.r", + "lgair.npes", + "pmtbulk.r", + "pmtcat.r", + "else.npes"}; + std::string cuts[n_plots]={ + "simRpes.npes*(1==1)", + "", + "", + "", + Form("catpes.detids==%d && catpes.pids==11 && catpes.mtrids==0",detid), + Form("catpes.detids==%d && abs(catpes.pids)==11 && catpes.mtrids!=0",detid), + Form("catpes.detids==%d && catpes.mtrids!=0",detid), + "ref.npes*(ref.npes!=0)", + "refx.npes*(refx.npes!=0)", + "", + "lg.npes*(lg.npes!=0)", + "", + "", + "", + ""}; + std::string drawOpts[n_plots]={ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + ""}; + std::string xTitle[n_plots]={ + "Simulated PEs", + "Simulated Rate-weighted PEs", + "Simulated Asym-weighted PEs", + "PEs", + "PEs", + "PEs", + "PEs", + "PMT spectrum vs. Radial Hit Position (mm)", + "PMT spectrum vs. Radial Hit Position (mm)", + "PEs", + "PMT spectrum vs. Radial Hit Position (mm)", + "PEs", + "Radial Hit Position (mm)", + "Radial Hit Position (mm)", + "PEs"}; + std::string yTitle[n_plots]={ + "Spectrum", + "Spectrum", + "Spectrum", + "Spectrum", + "Spectrum", + "Spectrum", + "Spectrum", + "Counts Spectrum", + "Counts Spectrum", + "Spectrum", + "Counts Spectrum", + "Spectrum", + "Counts", + "Counts", + "Spectrum"}; + /* + int nbins[n_plots]={ + 100, + 10000, + 10000, + 100, + 100, + 100, + 100, + 100, + 100, + 100, + 100, + 100, + 100, + 100, + 100}; + double lowbin[n_plots]={ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 900.0, + 900.0, + 0.0, + 950.0, + 0.0, + 1050.0, + 1050.0, + 0.0}; + double highbin[n_plots]={ + 10.0, + 1.0e9. + 1.0e9, + 100.0, + 100.0, + 100.0, + 100.0, + 1200.0, + 1200.0, + 100.0, + 1200.0, + 100.0, + 1400.0, + 1250.0, + 100.0}; + */ + + + //for (int p=0;pcd(); + if (p < 3) c1[p]->SetLogy(); + //Histo[p]=new TH1F(Form("Histo[%d]",p),Form("%s; %s; %s",names[p].c_str(),xTitle[p].c_str(),yTitle[p].c_str()),nbins[p],lowbin[p],highbin[p]); + //Tmol->Draw(Form("%s>>Histo[%d]",draws[p].c_str(),p),Form("%s",cuts[p].c_str())); + Tmol->Draw(Form("%s",draws[p].c_str(),p),Form("%s",cuts[p].c_str()),Form("%s",drawOpts[p].c_str())); + TH1* htmp = (TH1*)gROOT->FindObject("htemp"); + + htmp->SetName(Form("Histo[%d]",p)); + htmp->SetTitle(Form("%s",names[p].c_str())); + htmp->SetXTitle(Form("%s",xTitle[p].c_str())); + htmp->SetYTitle(Form("%s",yTitle[p].c_str())); + + htmp->SetStats(1221); + integral[p] = 1.0*htmp->Integral(); + RMS[p] = 1.0*htmp->GetRMS(); + RMSerror[p] = 1.0*htmp->GetRMSError(); + Mean[p] = 1.0*htmp->GetMean(); + Meanerror[p] = 1.0*htmp->GetMeanError(); + + //Plot_Name,x_axis_units,x_number,y_number,y_uncertainty + // user_reflectivity = 0.9, double user_cerenkov = 1.0, double user_scintillation = 1.0, double user_z_pos = -11.0 + if (p==0){ //then we simulated PEs on the photocathode + //file_out_rms<AccessPathName("scans.root")) { + // Old file exists, read it and add new entries + old_file = TFile::Open("scans.root"); + old_file->GetObject("scans", oldtree); + new_file.cd(); + if (!oldtree) { + std::cout << "ERROR: Dead scans tree" ; + return; + } + newtree = oldtree->CloneTree(0); + int nent = oldtree->GetEntries(); + + // TLeaf* angleL = oldtree->GetLeaf("angle"); + // TLeaf* x_posL = oldtree->GetLeaf("x_pos"); + + // Clear out prior instance if exists + bool prior = true; + if (oldtree->GetBranch("reflectivity")) { + oldtree->SetBranchAddress("reflectivity",&oldreflectivity); + newtree->SetBranchAddress("reflectivity",&reflectivity); + } + else { + newtree->Branch("reflectivity",&reflectivity); + prior = false; + } + if (oldtree->GetBranch("cerenkov")) { + oldtree->SetBranchAddress("cerenkov",&oldcerenkov); + newtree->SetBranchAddress("cerenkov",&cerenkov); + } + else { + newtree->Branch("cerenkov",&cerenkov); + prior = false; + } + if (oldtree->GetBranch("scintillation")) { + oldtree->SetBranchAddress("scintillation",&oldscintillation); + newtree->SetBranchAddress("scintillation",&scintillation); + } + else { + newtree->Branch("scintillation",&scintillation); + prior = false; + } + if (oldtree->GetBranch("z_pos")) { + oldtree->SetBranchAddress("z_pos",&oldz_pos); + newtree->SetBranchAddress("z_pos",&z_pos); + } + else { + newtree->Branch("z_pos",&z_pos); + prior = false; + } + oldtree->SetBranchAddress("angle",&oldangle); + oldtree->SetBranchAddress("x_pos",&oldx_pos); + oldtree->SetBranchAddress("avg_pes",&oldavg); + oldtree->SetBranchAddress("avg_pes_err",&oldavg_err); + oldtree->SetBranchAddress("rms_pes",&oldrms); + oldtree->SetBranchAddress("rms_pes_err",&oldrms_err); + oldtree->SetBranchAddress("res",&oldres); + oldtree->SetBranchAddress("nentries",&oldN_en); + newtree->SetBranchAddress("angle",&angle); + newtree->SetBranchAddress("x_pos",&x_pos); + newtree->SetBranchAddress("avg_pes",&avg); + newtree->SetBranchAddress("avg_pes_err",&avg_err); + newtree->SetBranchAddress("rms_pes",&rms); + newtree->SetBranchAddress("rms_pes_err",&rms_err); + newtree->SetBranchAddress("res",&res); + newtree->SetBranchAddress("nentries",&N_en); + for (int j = 0 ; j < nent ; j++ ) { + // x_posL->GetBranch()->GetEntry(j); + // angleL->GetBranch()->GetEntry(j); + oldtree->GetEntry(j); + + if (ref_x_pos == oldx_pos && ref_angle == oldangle && (!prior || (ref_reflectivity == oldreflectivity && ref_cerenkov == oldcerenkov && ref_scintillation == oldscintillation && ref_z_pos == oldz_pos))) { + //if (ref_x_pos == x_posL->GetValue() && ref_angle == angleL->GetValue()) + std::cout << "TEST 1" << std::endl; + continue; + } + x_pos = oldx_pos; + angle = oldangle; + avg = oldavg; + avg_err = oldavg_err; + rms = oldrms; + rms_err = oldrms_err; + res = oldres; + N_en = oldN_en; + reflectivity = oldreflectivity; + cerenkov = oldcerenkov; + scintillation = oldscintillation; + z_pos = oldz_pos; + if (!oldtree->GetBranch("reflectivity")) { + reflectivity = 0.9; + } + if (!oldtree->GetBranch("cerenkov")) { + cerenkov = 1.0; + } + if (!oldtree->GetBranch("scintillation")) { + scintillation = 1.0; + } + if (!oldtree->GetBranch("z_pos")) { + z_pos = -11.0; + } + newtree->Fill(); + } + + // Append current run to end + old_file->Close(); + gSystem->Exec("rm scans.root"); + delete old_file; + } + else { + // Old file doesn't exist, make a new one + new_file.cd(); + newtree = new TTree("scans","scans"); + + // Write new tree + newtree->Branch("angle",&angle); + newtree->Branch("x_pos",&x_pos); + newtree->Branch("avg_pes",&avg); + newtree->Branch("avg_pes_err",&avg_err); + newtree->Branch("rms_pes",&rms); + newtree->Branch("rms_pes_err",&rms_err); + newtree->Branch("res",&res); + newtree->Branch("nentries",&N_en); + newtree->Branch("reflectivity",&reflectivity); + newtree->Branch("cerenkov",&cerenkov); + newtree->Branch("scintillation",&scintillation); + newtree->Branch("z_pos",&z_pos); + } + + newtree->SetBranchAddress("angle",&angle); + newtree->SetBranchAddress("x_pos",&x_pos); + newtree->SetBranchAddress("avg_pes",&avg); + newtree->SetBranchAddress("avg_pes_err",&avg_err); + newtree->SetBranchAddress("rms_pes",&rms); + newtree->SetBranchAddress("rms_pes_err",&rms_err); + newtree->SetBranchAddress("res",&res); + newtree->SetBranchAddress("nentries",&N_en); + newtree->SetBranchAddress("reflectivity",&reflectivity); + newtree->SetBranchAddress("cerenkov",&cerenkov); + newtree->SetBranchAddress("scintillation",&scintillation); + newtree->SetBranchAddress("z_pos",&z_pos); + + angle = user_angle; + x_pos = user_x_pos; + file_out_integral<Exec("mv localTmp.root scans.root"); + + } + plotsFile->cd(); + c1[p]->Write(); + c1[p]->SaveAs(Form("%s_%d_%d.png",fileString.substr(0,fileString.find(".root")).c_str(),detid,p)); + } + + file_out_integral.close(); + file_out_rms.close(); + file_out_mean.close(); + file_out_res.close(); + + plotsFile = plotsTree->GetCurrentFile(); + plotsTree->Write("", TObject::kOverwrite); + plotsTree->Print(); + plotsFile->Close(); + //theApp.Run(); +} + +void bkgd::do_pe(int argc, char **argv) +{ + if (argc <= 1 || argc > 9) + { + std::cerr << "Usage: ./bkgd_pe char*:filename int:detNumber char*:detName double:reflectivity double:cerenkov double:scintillation double:beamCurrent" << std::endl; + //std::cerr << "Usage: ./pe char*:filename int:detid char*:manipulateVariable float:variableValue bool:reanalyze(y or n)" << std::endl; + exit(0); + } + if (argc >= 2) + { + std::string fileName(argv[1]); + fileString = fileName; + } + if (argc >= 3) + { + detid = atoi(argv[2]); + } + if (argc >= 4) + { + std::string det_Name(argv[3]); + detName = det_Name; + } + if (argc >= 5) + { + std::string ana(argv[4]); + anaStr = ana; + } + if (argc >= 6) + { + user_reflectivity = atof(argv[5]); + } + if (argc >=7) + { + user_cerenkov = atof(argv[6]); + } + if (argc >=8) + { + user_scintillation = atof(argv[7]); + } + if (argc >=9) + { + current = atof(argv[8]); + } + + get_lookuptable(); + if (reana == true) { + std::cout << "Running with file=" << fileString << ", detid=" << detid << std::endl; + bkgd_pe_ana(); + } + if (argc >=1){ + std::cout << "Plotting previously analyzed file=" << fileString << " + PEs_det_" << detid << ".root" << std::endl; + bkgd_pePlots(argc, argv); + } +} + +int main(int argc, char **argv) +{ + bkgd ana; + ana.do_pe(argc, argv); + return 0; +} diff --git a/analysis/bkgd_pe/include/bkgd_pe.hh b/analysis/bkgd_pe/include/bkgd_pe.hh new file mode 100644 index 000000000..334da0ea8 --- /dev/null +++ b/analysis/bkgd_pe/include/bkgd_pe.hh @@ -0,0 +1,230 @@ +#include "remolltypes.hh" +#include "bkgd_petypes.hh" + +simPEs_t simPEsTrim(std::vector sourcedetids, std::vector quartzpids, std::vector quartzmtrids, double nPEs, std::vector cathitx, std::vector cathity, std::vector cathitz) +{ + simPEs_t newHit; + newHit.npes=nPEs; + newHit.detids=sourcedetids; + newHit.pids=quartzpids; + newHit.mtrids=quartzmtrids; + newHit.cathitx=cathitx; + newHit.cathity=cathity; + newHit.cathitz=cathitz; + return newHit; +} + +catPEs_t catPEsTrim(std::vector sourcedetids, std::vector quartzpids, std::vector quartzmtrids, size_t peLen, std::vector cathitx, std::vector cathity, std::vector cathitz) +{ + catPEs_t newHit; + newHit.npes=peLen; + newHit.detids=sourcedetids; + newHit.pids=quartzpids; + newHit.mtrids=quartzmtrids; + newHit.cathitx=cathitx; + newHit.cathity=cathity; + newHit.cathitz=cathitz; + return newHit; +} + +Q_t QTrim(remollGenericDetectorHit_t hit, size_t peLen, std::vector cathitx, std::vector cathity, std::vector cathitz) +{ + Q_t newHit; + newHit.det = hit.det; + newHit.x=hit.x; + newHit.y=hit.y; + newHit.z=hit.z; + newHit.r=hit.r; + newHit.px=hit.px; + newHit.py=hit.py; + newHit.pz=hit.pz; + newHit.p=hit.p; + newHit.e=hit.e; + newHit.m=hit.m; + newHit.vx=hit.vx; + newHit.vy=hit.vy; + newHit.vz=hit.vz; + newHit.npes=peLen; + newHit.cathitx=cathitx; + newHit.cathity=cathity; + newHit.cathitz=cathitz; + return newHit; +} + +Ref_t RefTrim(remollGenericDetectorHit_t hit, size_t peLen, std::vector cathitx, std::vector cathity, std::vector cathitz) +{ + Ref_t newHit; + newHit.det = hit.det; + newHit.x=hit.x; + newHit.y=hit.y; + newHit.z=hit.z; + newHit.r=hit.r; + newHit.px=hit.px; + newHit.py=hit.py; + newHit.pz=hit.pz; + newHit.p=hit.p; + newHit.e=hit.e; + newHit.m=hit.m; + newHit.vx=hit.vx; + newHit.vy=hit.vy; + newHit.vz=hit.vz; + newHit.npes=peLen; + newHit.cathitx=cathitx; + newHit.cathity=cathity; + newHit.cathitz=cathitz; + return newHit; +} + +RefX_t RefXTrim(remollGenericDetectorHit_t hit, size_t peLen, std::vector cathitx, std::vector cathity, std::vector cathitz) +{ + RefX_t newHit; + newHit.det = hit.det; + newHit.x=hit.x; + newHit.y=hit.y; + newHit.z=hit.z; + newHit.r=hit.r; + newHit.px=hit.px; + newHit.py=hit.py; + newHit.pz=hit.pz; + newHit.p=hit.p; + newHit.e=hit.e; + newHit.m=hit.m; + newHit.vx=hit.vx; + newHit.vy=hit.vy; + newHit.vz=hit.vz; + newHit.npes=peLen; + newHit.cathitx=cathitx; + newHit.cathity=cathity; + newHit.cathitz=cathitz; + return newHit; +} + +Refair_t RefairTrim(remollGenericDetectorHit_t hit, size_t peLen, std::vector cathitx, std::vector cathity, std::vector cathitz) +{ + Refair_t newHit; + newHit.det = hit.det; + newHit.x=hit.x; + newHit.y=hit.y; + newHit.z=hit.z; + newHit.r=hit.r; + newHit.px=hit.px; + newHit.py=hit.py; + newHit.pz=hit.pz; + newHit.p=hit.p; + newHit.e=hit.e; + newHit.m=hit.m; + newHit.vx=hit.vx; + newHit.vy=hit.vy; + newHit.vz=hit.vz; + newHit.npes=peLen; + newHit.cathitx=cathitx; + newHit.cathity=cathity; + newHit.cathitz=cathitz; + return newHit; +} + +LG_t LGTrim(remollGenericDetectorHit_t hit, size_t peLen, std::vector cathitx, std::vector cathity, std::vector cathitz) +{ + LG_t newHit; + newHit.det = hit.det; + newHit.x=hit.x; + newHit.y=hit.y; + newHit.z=hit.z; + newHit.r=hit.r; + newHit.px=hit.px; + newHit.py=hit.py; + newHit.pz=hit.pz; + newHit.p=hit.p; + newHit.e=hit.e; + newHit.m=hit.m; + newHit.vx=hit.vx; + newHit.vy=hit.vy; + newHit.vz=hit.vz; + newHit.npes=peLen; + newHit.cathitx=cathitx; + newHit.cathity=cathity; + newHit.cathitz=cathitz; + return newHit; +} + +LGair_t LGairTrim(remollGenericDetectorHit_t hit, size_t peLen, std::vector cathitx, std::vector cathity, std::vector cathitz) +{ + LGair_t newHit; + newHit.det = hit.det; + newHit.x=hit.x; + newHit.y=hit.y; + newHit.z=hit.z; + newHit.r=hit.r; + newHit.px=hit.px; + newHit.py=hit.py; + newHit.pz=hit.pz; + newHit.p=hit.p; + newHit.e=hit.e; + newHit.m=hit.m; + newHit.vx=hit.vx; + newHit.vy=hit.vy; + newHit.vz=hit.vz; + newHit.npes=peLen; + newHit.cathitx=cathitx; + newHit.cathity=cathity; + newHit.cathitz=cathitz; + return newHit; +} + +PMTcat_t PMTcatTrim(remollGenericDetectorHit_t hit, size_t peLen, std::vector cathitx, std::vector cathity, std::vector cathitz) +{ + PMTcat_t newHit; + newHit.det = hit.det; + newHit.x=hit.x; + newHit.y=hit.y; + newHit.z=hit.z; + newHit.r=hit.r; + newHit.px=hit.px; + newHit.py=hit.py; + newHit.pz=hit.pz; + newHit.p=hit.p; + newHit.e=hit.e; + newHit.m=hit.m; + newHit.vx=hit.vx; + newHit.vy=hit.vy; + newHit.vz=hit.vz; + newHit.npes=peLen; + newHit.cathitx=cathitx; + newHit.cathity=cathity; + newHit.cathitz=cathitz; + return newHit; +} + +PMTbulk_t PMTbulkTrim(remollGenericDetectorHit_t hit, size_t peLen, std::vector cathitx, std::vector cathity, std::vector cathitz) +{ + PMTbulk_t newHit; + newHit.det = hit.det; + newHit.x=hit.x; + newHit.y=hit.y; + newHit.z=hit.z; + newHit.r=hit.r; + newHit.px=hit.px; + newHit.py=hit.py; + newHit.pz=hit.pz; + newHit.p=hit.p; + newHit.e=hit.e; + newHit.m=hit.m; + newHit.vx=hit.vx; + newHit.vy=hit.vy; + newHit.vz=hit.vz; + newHit.npes=peLen; + newHit.cathitx=cathitx; + newHit.cathity=cathity; + newHit.cathitz=cathitz; + return newHit; +} + +elseX_t elseXTrim(int peLen, std::vector cathitx, std::vector cathity, std::vector cathitz) +{ + elseX_t newHit; + newHit.npes=peLen; + newHit.cathitx=cathitx; + newHit.cathity=cathity; + newHit.cathitz=cathitz; + return newHit; +} diff --git a/analysis/bkgd_pe/include/bkgd_peLinkDef.h b/analysis/bkgd_pe/include/bkgd_peLinkDef.h new file mode 100644 index 000000000..16cdf0c0e --- /dev/null +++ b/analysis/bkgd_pe/include/bkgd_peLinkDef.h @@ -0,0 +1,31 @@ +#if defined(__CINT__) || defined(__CLING__) + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ struct simPEs_t+; +#pragma link C++ struct catPEs_t+; +#pragma link C++ struct Q_t+; +#pragma link C++ struct Ref_t+; +#pragma link C++ struct RefX_t+; +#pragma link C++ struct Refair_t+; +#pragma link C++ struct LG_t+; +#pragma link C++ struct LGair_t+; +#pragma link C++ struct PMTcat_t+; +#pragma link C++ struct PMTbulk_t+; +#pragma link C++ struct elseX_t+; + +#pragma link C++ struct vector+; +#pragma link C++ struct vector+; +#pragma link C++ struct vector+; +#pragma link C++ struct vector+; +#pragma link C++ struct vector+; +#pragma link C++ struct vector+; +#pragma link C++ struct vector+; +#pragma link C++ struct vector+; +#pragma link C++ struct vector+; +#pragma link C++ struct vector+; +#pragma link C++ struct vector+; + +#endif diff --git a/analysis/bkgd_pe/include/bkgd_petypes.hh b/analysis/bkgd_pe/include/bkgd_petypes.hh new file mode 100644 index 000000000..e40de28de --- /dev/null +++ b/analysis/bkgd_pe/include/bkgd_petypes.hh @@ -0,0 +1,148 @@ +#ifndef __BKGD_PE_TYPES_HH +#define __BKGD_PE_TYPES_HH + +/* + bkgd_petypes.hh + + Generic data types which are classes. Used for passing IO + data around and useful enumerations in PE calculations +*/ + +//#if !defined(__CINT__) && !defined(__CLING__) +//#include +//#endif + +#define __RUNSTR_LEN 255 +#define __MAXFILE_LEN 1048576 // MB file size limit + +#include "TTimeStamp.h" + +// Event structure + +struct catPEs_t { // The full spectrum regardless of source + int npes; // PE counts per event + std::vector detids; // store the source det IDs too + std::vector mtrids; // store the source mtrids too + std::vector pids; // store the source pids too + std::vector cathitx, cathity, cathitz; //Cathode PE hit information +}; + +struct simPEs_t { // lookup table simulated Quartz Hits + double npes; + std::vector detids; // store the source det IDs too + std::vector mtrids; // store the source mtrids too + std::vector pids; // store the source pids too + std::vector cathitx, cathity, cathitz; //Cathode PE hit information +}; + +struct Q_t { // Quartz Hits + int npes; + int det; + double r; + double x; + double y; + double z; + double px, py, pz; + double p, e, m; + double vx, vy, vz; + std::vector cathitx, cathity, cathitz; //Cathode PE hit information +}; + +struct Ref_t { // Reflector Primary Hits + int npes; + int det; + double r; + double x; + double y; + double z; + double px, py, pz; + double p, e, m; + double vx, vy, vz; + std::vector cathitx, cathity, cathitz; //Cathode PE hit information +}; + +struct RefX_t { // Reflector Accidental Side Hits + int npes; + int det; + double r; + double x; + double y; + double z; + double px, py, pz; + double p, e, m; + double vx, vy, vz; + std::vector cathitx, cathity, cathitz; //Cathode PE hit information +}; + +struct Refair_t { // Reflector Air Volume Hits + int npes; + int det; + double r; + double x; + double y; + double z; + double px, py, pz; + double p, e, m; + double vx, vy, vz; + std::vector cathitx, cathity, cathitz; //Cathode PE hit information +}; + +struct LG_t { // Light Guide Hits + int npes; + int det; + double r; + double x; + double y; + double z; + double px, py, pz; + double p, e, m; + double vx, vy, vz; + std::vector cathitx, cathity, cathitz; //Cathode PE hit information +}; + +struct LGair_t { // Light Guide Air Volume Hits + int npes; + int det; + double r; + double x; + double y; + double z; + double px, py, pz; + double p, e, m; + double vx, vy, vz; + std::vector cathitx, cathity, cathitz; //Cathode PE hit information +}; + +struct PMTcat_t { // PMT Cathode Hits + int npes; + int det; + double r; + double x; + double y; + double z; + double px, py, pz; + double p, e, m; + double vx, vy, vz; + std::vector cathitx, cathity, cathitz; //Cathode PE hit information +}; + +struct PMTbulk_t { // PMT Bulk Volume Hits + int npes; + int det; + double r; + double x; + double y; + double z; + double px, py, pz; + double p, e, m; + double vx, vy, vz; + std::vector cathitx, cathity, cathitz; //Cathode PE hit information +}; + +struct elseX_t { // PMT Bulk Volume Hits + int npes; + std::vector cathitx, cathity, cathitz; //Cathode PE hit information +}; + + +#endif // __BKGD_PE_TYPES_HH From a0865b375577f42f75755a22198f2107145d4a55 Mon Sep 17 00:00:00 2001 From: Cameron Clarke Date: Wed, 15 Jul 2020 20:37:40 -0400 Subject: [PATCH 049/443] Some handy scripts for running through a ton of jobs quickly (not ifarm yet) --- macros/full-scan.sh | 88 +++++++++++++++++++++++ macros/scan.sh | 166 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 254 insertions(+) create mode 100755 macros/full-scan.sh create mode 100755 macros/scan.sh diff --git a/macros/full-scan.sh b/macros/full-scan.sh new file mode 100755 index 000000000..8a382a62e --- /dev/null +++ b/macros/full-scan.sh @@ -0,0 +1,88 @@ +#!/bin/bash + +geom="R5o" +if [ "$#" -lt 1 ] ; then + echo " ERROR, requires at least one input + " + echo " usage: ./full-scan.sh \"geometry = R5o\" [reflectivity = 0.7] [x step size (cm) = 1.0] [angle step size (degrees) = 0.1]" + exit +else + geom=$1 +fi + +reflectivity=0.7 +xPosStep=1.0 # 1 cm steps +angleStep=0.1 # 60 steps per x pos +if [ "$#" -gt 1 ] ; then + reflectivity=$2 +fi +if [ "$#" -gt 2 ] ; then + xPosStep=$3 +fi +if [ "$#" -gt 3 ] ; then + angleStep=$4 +fi +xPosMin=1040.0 # Reflector begin +xPosMax=1350.0 # PMT begin +angleMin=-6.0 # 3 degrees high +angleMax=0.0 # 3 degrees low +z_pos=0.0 +z_p=0.0 +lgAngle=6.0 + +user_ring="5.0" +det=540210 + +if [[ $geom == "R1" ]] ; then + user_ring="1" + det=140210 +elif [[ $geom == "R2" ]] ; then + user_ring="2" + det=240210 +elif [[ $geom == "R3" ]] ; then + user_ring="3" + det=340210 +elif [[ $geom == "R4" ]] ; then + user_ring="4" + det=440210 +elif [[ $geom == "R5o" ]] ; then + user_ring="5.0" + det=540210 +elif [[ $geom == "R5t" ]] ; then + user_ring="5.1" + det=540110 +elif [[ $geom == "R5c" ]] ; then + user_ring="5.2" + det=504010 +elif [[ $geom == "R6" ]] ; then + user_ring="6" + det=640210 +fi + +OLDIFS=$IFS +IFS="," +while read ring qR qL overlap qThick num2 num3 refL ref_angle lg_angle pmtR tilt pmtRad wallThickness extraPMT1 extraPMT2 z1 z2 +do + if [[ $ring != $user_ring ]] ; then + continue + fi + xPosMax=$(printf "%.2f" "$(bc -l <<< ${pmtR}-10.0)") + xPosMin=$(printf "%.2f" "$(bc -l <<< ${qR}+0.5*${qL}+5.0)") + lgAngle=$lg_angle + z_p=$(printf "%.2f" "$(bc -l <<< ${z1}-0.5*$qThick-$refL*s\(\(${ref_angle}-${lg_angle}\)*3.14159/180.0\))") + echo "$ring $xPosMin $xPosMax z = $z_p starting z = $z1 and second = $z2" +done < cadp.csv +IFS=$OLDIFS + + +# Rescale numbers to cm from mm +numSteps=$(printf "%.0f" "$(bc -l <<< 0.1*\(${xPosMax}-${xPosMin}\)/$xPosStep)") +echo "$numSteps steps" +for currentStep in `seq 0 $numSteps`; +do + x_pos=$(printf "%.1f" "$(bc -l <<< -0.1*$xPosMin-1.0*$currentStep*$xPosStep)") + z_pos=$(printf "%.1f" "$(bc -l <<< 0.1*$z_p-\(-1.0*$x_pos-0.1*$xPosMin\)*s\(${lgAngle}*3.14159/180.0\))") + + echo "$x_pos $z_pos" + ./scan.sh $x_pos angle $angleMin $angleMax $angleStep $reflectivity 1 1 $z_pos $geom $det & +done diff --git a/macros/scan.sh b/macros/scan.sh new file mode 100755 index 000000000..34b77204f --- /dev/null +++ b/macros/scan.sh @@ -0,0 +1,166 @@ +#!/bin/bash + +# Takes 5 arguments +# +# Fixed value of non-scanned variable - default = 0.0 +# Variable to scan ("angle" or "x") - default = "angle" +# Min of scanned variable - default = -30 +# Max of scanned variable - default = 30 +# Step size - default = 0.5 + +if [ "$#" -lt 1 ] ; then + echo " ERROR, requires at least one input + " + echo " usage: ./scan.sh fixed-non-scanned \"variable-to-scan\" min-of-scan (-30) max-of-scan (30) step-size (0.5) + Takes 11 arguments + + Fixed value of non-scanned variable - default = 0.0 + Variable to scan (\"angle\" or \"x\") - default = \"angle\" + Min of scanned variable - default = -30 + Max of scanned variable - default = 30 + Step size - default = 0.5 + Reflectivity of light guide - default = 0.9 + Cerenkov - default = 1.0 + Scintillation - default = 1.0 + z Position of beam origin - default = -11.0 + geometry file name - default = \"Mainz\" + det number - default = 540210" + exit +fi +fixed="$1" +scanned="angle" +scanMin=-30.0 +scanMax=30.0 +scanStep=0.5 +reflectivity=0.9 +cerenkov=1 +scintillation=1 +#z_pos=-52.0 +z_pos=0.0 +geom="Mainz" +det=540210 +if [ "$#" -gt 1 ] ; then + scanned="$2" +fi +if [ "$#" -gt 2 ] ; then + scanMin=$3 +fi +if [ "$#" -gt 3 ] ; then + scanMax=$4 +fi +if [ "$#" -gt 4 ] ; then + scanStep=$5 +fi +if [ "$#" -gt 5 ] ; then + reflectivity=$6 +fi +if [ "$#" -gt 6 ] ; then + cerenkov=$(printf "%.0f" "$7") +fi +if [ "$#" -gt 7 ] ; then + scintillation=$(printf "%.0f" "$8") +fi +if [ "$#" -gt 8 ] ; then + z_pos=$9 +fi +if [ "$#" -gt 9 ] ; then + geom="${10}" +fi +if [ "$#" -gt 10 ] ; then + det="${11}" +fi + +angle=0.0 +x_pos=0.0 + +numSteps=$(printf "%.0f" "$(bc -l <<< \(${scanMax}-\(${scanMin}\)\)/$scanStep)") +fixed=$(printf "%.1f" "$(bc -l <<< 1.0*$fixed)") +z_point=0.0 + +defaultName="qsimout.root" +outputName="qsimout.root" +name="0.0_degrees_0.0_x" + +cer="true" +scint="true" +if [[ $cerenkov > 0.0 ]] ; then + cer="true" +else + cer="false" +fi +if [[ $scintillation > 0.0 ]] ; then + scint="true" +else + scint="false" +fi + +#tmpFolder="${scanned}_${fixed}" +#if [ ! -d $tmpFolder ] ; then +# mkdir $tmpFolder +#fi + +for currentStep in `seq 0 $numSteps`; +do + point=$(printf "%.1f" "$(bc -l <<< \($scanMin+\(1.0*$currentStep*$scanStep\)\))") + if [[ "$scanned" == "angle" ]] ; then + x_pos=$fixed + angle=$point + fi + if [[ "$scanned" == "x" ]] ; then + x_pos=$point + angle=$fixed + fi + name="${angle}_degrees_${x_pos}_x_${z_pos}_z_${reflectivity}_ref_${cerenkov}_cer_${scintillation}_scint" + cp preserve_scans.mac scans_${geom}_${name}.mac + # FIXME This angle is hardcoded to the qsim-matching case!! + # 0.1994 = sin(11.5 degrees), $fixed is the distance from 0.0, + is farther towards PMT, further back away from +z axis + # 0.104528 = sin(6 degrees) + z_point=$z_pos + # FIXME doing z_pos as external input only now, for full detector array setting + #z_point=$(printf "%.1f" "$(bc -l <<< ${z_pos}+\($x_pos*0.1045\))") + # FIXME z_point and x offset relationships assume the detector is immediately downstream of the origin, and ideally centered at the middle of the lightguide + #z_point=$(printf "%.1f" "$(bc -l <<< -11.0-\($fixed*0.1994\))") + sed -i 's;'"/remoll/evgen/beam/th -11.5 deg"';'"/remoll/evgen/beam/th ${angle} deg"';g' scans_${geom}_${name}.mac + sed -i 's;'"/remoll/evgen/beam/origin 0.0 0.0 0.0 mm"';'"/remoll/evgen/beam/origin ${x_pos} 0.0 ${z_point} cm"';g' scans_${geom}_${name}.mac + + sed -i 's;'"/remoll/setgeofile geometry_Mainz/mollerMother_Mainz.gdml"';'"/remoll/setgeofile mollerMother_${geom}.gdml"';g' scans_${geom}_${name}.mac + + sed -i 's;'"/remoll/evgen/beam/rasterRefZ 0.0 mm"';'"/remoll/evgen/beam/rasterRefZ ${z_point} cm"';g' scans_${geom}_${name}.mac + + sed -i 's;'"/process/optical/processActivation Cerenkov false"';'"/process/optical/processActivation Cerenkov ${cer}"';g' scans_${geom}_${name}.mac + sed -i 's;'"/process/optical/processActivation Scintillation false"';'"/process/optical/processActivation Scintillation ${scint}"';g' scans_${geom}_${name}.mac + sed -i 's;'"Mainz_0.0_degrees_0.0_x.root"';'"${geom}_${name}.root"';g' scans_${geom}_${name}.mac + tmpFolder="scans/$geom/out_${geom}_${name}" + if [ ! -d scans/${geom} ] ; then + mkdir scans/${geom} + fi + if [ ! -d $tmpFolder ] ; then + mkdir $tmpFolder + fi + cd $tmpFolder + cp -p ../../../../build/remoll . + cp -p ../../../../geometry_Mainz/materialsOptical.xml . + cp -p ../../../../geometry_Mainz/*${geom}.* . + cp ../../../../geometry_Mainz/matrices_${geom}.xml matrices_${geom}.xml + sed -i 's;'"2.00214948263953\*eV 0.9"';'"2.00214948263953\*eV ${reflectivity}"';g' matrices_${geom}.xml + sed -i 's;'" \n Date: Sat, 18 Jul 2020 01:16:12 -0400 Subject: [PATCH 050/443] Added septapus shield. 6mm thick radially and 24 mm thick azimuthally. --- geometry/hybrid/hybridDaughter_merged.gdml | 8 +- geometry/hybrid/hybridToroid.gdml | 116 ++++++++++++++++++++- 2 files changed, 119 insertions(+), 5 deletions(-) diff --git a/geometry/hybrid/hybridDaughter_merged.gdml b/geometry/hybrid/hybridDaughter_merged.gdml index 81612085d..18695de40 100644 --- a/geometry/hybrid/hybridDaughter_merged.gdml +++ b/geometry/hybrid/hybridDaughter_merged.gdml @@ -70,10 +70,10 @@ - - - - + + + + diff --git a/geometry/hybrid/hybridToroid.gdml b/geometry/hybrid/hybridToroid.gdml index db32efba7..a2a49a6ec 100644 --- a/geometry/hybrid/hybridToroid.gdml +++ b/geometry/hybrid/hybridToroid.gdml @@ -44,6 +44,17 @@
+ + + + + +
+
+ + + + @@ -576,13 +587,20 @@ - + + + + + + + + @@ -590,6 +608,13 @@ + + + + + + + @@ -808,6 +833,13 @@ + + + + + + + @@ -1026,6 +1058,13 @@ + + + + + + + @@ -1244,6 +1283,13 @@ + + + + + + + @@ -1462,6 +1508,13 @@ + + + + + + + @@ -1680,6 +1733,13 @@ + + + + + + + @@ -1898,6 +1958,13 @@ + + + + + + + @@ -2143,6 +2210,12 @@ + + + + + + @@ -2173,6 +2246,12 @@ + + + + + + @@ -2203,6 +2282,12 @@ + + + + + + @@ -2233,6 +2318,12 @@ + + + + + + @@ -2263,6 +2354,12 @@ + + + + + + @@ -2293,6 +2390,12 @@ + + + + + + @@ -2323,6 +2426,17 @@ + + + + + + + + + + + From 229d1d397dcb3b57eb4c0b6afa12e5651752a222 Mon Sep 17 00:00:00 2001 From: Cameron Clarke Date: Mon, 20 Jul 2020 20:15:04 -0400 Subject: [PATCH 051/443] Updating scan scripts to do detector reflector angle/length optimization --- macros/preserve_ref_scans.mac | 67 ++++++++++ macros/preserve_scans.mac | 67 ++++++++++ macros/ref-scan.sh | 243 ++++++++++++++++++++++++++++++++++ macros/scan.sh | 23 +--- 4 files changed, 382 insertions(+), 18 deletions(-) create mode 100644 macros/preserve_ref_scans.mac create mode 100644 macros/preserve_scans.mac create mode 100755 macros/ref-scan.sh diff --git a/macros/preserve_ref_scans.mac b/macros/preserve_ref_scans.mac new file mode 100644 index 000000000..a0b83b3c6 --- /dev/null +++ b/macros/preserve_ref_scans.mac @@ -0,0 +1,67 @@ +# Recreating the Mainz beam test + +# These must be called before initialize +/remoll/setgeofile geometry_Mainz/mollerMother_Mainz.gdml +/remoll/physlist/parallel/disable +/remoll/physlist/optical/enable + +/process/optical/processActivation Cerenkov false +/process/optical/processActivation Scintillation false + +/process/optical/setTrackSecondariesFirst Cerenkov true +/process/optical/setTrackSecondariesFirst Scintillation true + +# This must be explicitly called +/run/initialize + +/process/optical/cerenkov/setTrackSecondariesFirst true +/process/optical/cerenkov/setMaxPhotons 2000 +/process/optical/scintillation/setTrackSecondariesFirst true +/process/optical/scintillation/setYieldFactor 1.0 +/process/optical/scintillation/setExcitationRatio 0.0 + +/remoll/SD/enable_all + +/remoll/printgeometry true + +#/remoll/scalefield map_directory/blockyHybrid_rm_3.0.txt 1.0 +#/remoll/magcurrent map_directory/blockyHybrid_rm_3.0.txt 1000.0 A + +# Raster and initial angle stuff +/remoll/oldras true +#/remoll/rasx 0 mm +#/remoll/rasy 10 mm + +#Set Beam Generator settings +/remoll/evgen/set beam +#/run/beamOn 0 + + +#---------------------------------------- + +# Kill tracks on interactions with W, Cu, and Pb +#/control/execute macros/kryptonite.mac + +/process/list + +# Electrons incident on quartz------------ + +#/process/optical/cerenkov/setMaxPhotons 0 +# (Quartz center, - 1/2 of quartz length, - full distance to PMT )/2 +# (-987.5-75 -1350 )/2 = 1206.25 +/remoll/evgen/beam/rasterRefZ 0.0 mm +/remoll/evgen/beam/origin 0.0 0.0 0.0 mm +/remoll/evgen/beam/th -11.5 deg +#/remoll/evgen/beam/x -1206.25 mm +#/remoll/evgen/beam/z 45.0 mm +#-11.5 degrees /remoll/evgen/beam/th -0.1047 +#/remoll/evgen/beam/direction -0.19937 0.0 0.97992 +/remoll/evgen/beam/rasx 25.0 mm +/remoll/evgen/beam/rasy 25.0 mm +/remoll/beamene 8000 MeV + +/remoll/evgen/beam/partName e- + +/remoll/filename remollout_Mainz_0.0_degrees_0.0_x.root + +/run/beamOn 100000 diff --git a/macros/preserve_scans.mac b/macros/preserve_scans.mac new file mode 100644 index 000000000..58d38a1db --- /dev/null +++ b/macros/preserve_scans.mac @@ -0,0 +1,67 @@ +# Recreating the Mainz beam test + +# These must be called before initialize +/remoll/setgeofile geometry_Mainz/mollerMother_Mainz.gdml +/remoll/physlist/parallel/disable +/remoll/physlist/optical/enable + +/process/optical/processActivation Cerenkov false +/process/optical/processActivation Scintillation false + +/process/optical/setTrackSecondariesFirst Cerenkov true +/process/optical/setTrackSecondariesFirst Scintillation true + +# This must be explicitly called +/run/initialize + +/process/optical/cerenkov/setTrackSecondariesFirst true +/process/optical/cerenkov/setMaxPhotons 2000 +/process/optical/scintillation/setTrackSecondariesFirst true +/process/optical/scintillation/setYieldFactor 1.0 +/process/optical/scintillation/setExcitationRatio 0.0 + +/remoll/SD/enable_all + +/remoll/printgeometry true + +#/remoll/scalefield map_directory/blockyHybrid_rm_3.0.txt 1.0 +#/remoll/magcurrent map_directory/blockyHybrid_rm_3.0.txt 1000.0 A + +# Raster and initial angle stuff +/remoll/oldras true +#/remoll/rasx 0 mm +#/remoll/rasy 10 mm + +#Set Beam Generator settings +/remoll/evgen/set beam +#/run/beamOn 0 + + +#---------------------------------------- + +# Kill tracks on interactions with W, Cu, and Pb +#/control/execute macros/kryptonite.mac + +/process/list + +# Electrons incident on quartz------------ + +#/process/optical/cerenkov/setMaxPhotons 0 +# (Quartz center, - 1/2 of quartz length, - full distance to PMT )/2 +# (-987.5-75 -1350 )/2 = 1206.25 +/remoll/evgen/beam/rasterRefZ 0.0 mm +/remoll/evgen/beam/origin 0.0 0.0 0.0 mm +/remoll/evgen/beam/th -11.5 deg +#/remoll/evgen/beam/x -1206.25 mm +#/remoll/evgen/beam/z 45.0 mm +#-11.5 degrees /remoll/evgen/beam/th -0.1047 +#/remoll/evgen/beam/direction -0.19937 0.0 0.97992 +/remoll/evgen/beam/rasx 2.5 mm +/remoll/evgen/beam/rasy 10.0 mm +/remoll/beamene 11000 MeV + +/remoll/evgen/beam/partName e- + +/remoll/filename remollout_Mainz_0.0_degrees_0.0_x.root + +/run/beamOn 100000 diff --git a/macros/ref-scan.sh b/macros/ref-scan.sh new file mode 100755 index 000000000..f14fb7898 --- /dev/null +++ b/macros/ref-scan.sh @@ -0,0 +1,243 @@ +#!/bin/bash + +# Takes 5 arguments +# +# Fixed value of non-scanned variable - default = 0.0 +# Variable to scan ("angle" or "x") - default = "angle" +# Min of scanned variable - default = -30 +# Max of scanned variable - default = 30 +# Step size - default = 0.5 + +if [ "$#" -lt 1 ] ; then + echo " ERROR, requires at least one input + " + echo " usage: ./ref-scan.sh fixed-non-scanned \"variable-to-scan\" min-of-scan (0) max-of-scan (30) step-size (1.0) + Takes 5 arguments + + Fixed value of non-scanned variable - default = 0.0 + Variable to scan (\"angle\" or \"x\") - default = \"angle\" + Min of scanned variable - default = 0 + Max of scanned variable - default = 30 + Step size - default = 1.0 + Reflectivity of light guide - default = 0.7 + Cerenkov - default = 1.0 + Scintillation - default = 1.0 + geometry file name - default = \"R5o\" + pass - default = 1 + det number - default = 540210" + exit +fi + +fixed="$1" +scanned="angle" +q_r=0.0 +scanMin=0.0 +scanMax=30.0 +scanStep=1.0 +reflectivity=0.7 +cerenkov=1 +scintillation=1 +geom="R5o" +det=540210 +pass="1" +if [ "$#" -gt 1 ] ; then + scanned="$2" +fi +if [ "$#" -gt 2 ] ; then + scanMin=$3 +fi +if [ "$#" -gt 3 ] ; then + scanMax=$4 +fi +if [ "$#" -gt 4 ] ; then + scanStep=$5 +fi +if [ "$#" -gt 5 ] ; then + reflectivity=$6 +fi +if [ "$#" -gt 6 ] ; then + cerenkov=$(printf "%.0f" "$7") +fi +if [ "$#" -gt 7 ] ; then + scintillation=$(printf "%.0f" "$8") +fi +if [ "$#" -gt 8 ] ; then + geom="${9}" +fi +if [ "$#" -gt 9 ] ; then + pass="${10}" +fi +user_ring="5.0" +script_ring="5" +if [[ $geom == "R1" ]] ; then + user_ring="1" + script_ring="1" + det=140210 +elif [[ $geom == "R2" ]] ; then + user_ring="2" + script_ring="2" + det=240210 +elif [[ $geom == "R3" ]] ; then + user_ring="3" + script_ring="3" + det=340210 +elif [[ $geom == "R4" ]] ; then + user_ring="4" + script_ring="4" + det=440210 +elif [[ $geom == "R5o" ]] ; then + user_ring="5.0" + script_ring="5" + det=540210 +elif [[ $geom == "R5t" ]] ; then + user_ring="5.1" + script_ring="5trans" + det=540110 +elif [[ $geom == "R5c" ]] ; then + user_ring="5.2" + script_ring="5closed" + det=504010 +elif [[ $geom == "R6" ]] ; then + user_ring="6" + script_ring="6" + det=640210 +fi + +if [ "$#" -gt 10 ] ; then + det="${11}" +fi + + + +tiltAngle=3.5 +lgAngle=2.5 +refAngle=18.0 +refLength=80.0 +z_p=0.0 +numSteps=$(printf "%.0f" "$(bc -l <<< \(${scanMax}-\(${scanMin}\)\)/$scanStep)") +fixed=$(printf "%.1f" "$(bc -l <<< 1.0*$fixed)") +z_point=0.0 + +defaultName="refScanOut.root" +outputName="refScanOut.root" +name="refScan_0.0_degrees_0.0_L" + +cer="true" +scint="true" +if [[ $cerenkov > 0.0 ]] ; then + cer="true" +else + cer="false" +fi +if [[ $scintillation > 0.0 ]] ; then + scint="true" +else + scint="false" +fi + + +for currentStep in `seq 0 $numSteps`; +do + point=$(printf "%.1f" "$(bc -l <<< \($scanMin+\(1.0*$currentStep*$scanStep\)\))") + if [[ "$scanned" == "angle" ]] ; then + refLength=$fixed + refAngle=$point + fi + if [[ "$scanned" == "x" ]] ; then + refLength=$point + refAngle=$fixed + fi + + + name="${refAngle}_degrees_${refLength}_L_${reflectivity}_ref_${cerenkov}_cer_${scintillation}_scint" + + cd ../../remoll-detector-generator/ + outString="" + OLDIFS=$IFS + IFS="," + while read ring qR qL overlap qThick num2 num3 refL ref_angle lg_angle pmtR tilt pmtRad wallThickness extraPMT1 extraPMT2 z1 z2 + do + if [[ $ring != $user_ring ]] ; then + outString="$outString +$ring,$qR,$qL,$overlap,$qThick,$num2,$num3,$refL,$ref_angle,$lg_angle,$pmtR,$tilt,$pmtRad,$wallThickness,$extraPMT1,$extraPMT2,$z1,$z2" + continue + fi + #xPosMax=$(printf "%.2f" "$(bc -l <<< ${pmtR}-10.0)") + #xPosMin=$(printf "%.2f" "$(bc -l <<< ${qR}+0.5*${qL}+5.0)") + z_p=$(printf "%.2f" "$(bc -l <<< ${z1}-0.55*$qThick)") + echo "$ring $xPosMin $xPosMax z = $z_p starting z = $z1 and second = $z2" + ref_angle=$refAngle + refL=$refLength + lg_angle=$lgAngle + tilt=$tiltAngle + q_r=$qR + outString="$outString +$ring,$qR,$qL,$overlap,$qThick,$num2,$num3,$refL,$ref_angle,$lg_angle,$pmtR,$tilt,$pmtRad,$wallThickness,$extraPMT1,$extraPMT2,$z1,$z2" + done < cadp_shortened.csv + IFS=$OLDIFS + + z_point=$z_p + + if [[ "$pass" == "1" ]] ; then + echo "$outString" > cadp_${geom}_${name}.csv + perl cadGeneratorV1.pl -F cadp_${geom}_${name}.csv + perl gdmlGeneratorV1_materials.pl -M detectorMotherP.csv -D parameter.csv -P qe.txt -U UVS_45total.txt -R MylarRef.txt -L ${script_ring} -T _${geom} + fi + cd - + + if [[ "$pass" == "1" ]] ; then + cp preserve_ref_scans.mac scans_${geom}_${name}.mac + sed -i 's;'"/remoll/evgen/beam/th -11.5 deg"';'"/remoll/evgen/beam/th -${tiltAngle} deg"';g' scans_${geom}_${name}.mac + sed -i 's;'"/remoll/evgen/beam/origin 0.0 0.0 0.0 mm"';'"/remoll/evgen/beam/origin -${q_r} 0.0 ${z_point} mm"';g' scans_${geom}_${name}.mac + + sed -i 's;'"/remoll/setgeofile geometry_Mainz/mollerMother_Mainz.gdml"';'"/remoll/setgeofile mollerMother_${geom}.gdml"';g' scans_${geom}_${name}.mac + + sed -i 's;'"/remoll/evgen/beam/rasterRefZ 0.0 mm"';'"/remoll/evgen/beam/rasterRefZ ${z_point} mm"';g' scans_${geom}_${name}.mac + + sed -i 's;'"/process/optical/processActivation Cerenkov false"';'"/process/optical/processActivation Cerenkov ${cer}"';g' scans_${geom}_${name}.mac + sed -i 's;'"/process/optical/processActivation Scintillation false"';'"/process/optical/processActivation Scintillation ${scint}"';g' scans_${geom}_${name}.mac + sed -i 's;'"Mainz_0.0_degrees_0.0_x.root"';'"${geom}_${name}.root"';g' scans_${geom}_${name}.mac + fi + + tmpFolder="scans/$geom/out_${geom}_${name}" + if [ ! -d scans ] ; then + mkdir scans + fi + if [ ! -d scans/${geom} ] ; then + mkdir scans/${geom} + fi + if [ ! -d $tmpFolder ] ; then + mkdir $tmpFolder + fi + cd $tmpFolder + if [[ "$pass" == "1" ]] ; then + cp -p ../../../../build/remoll . + cp -p ../../../../bin/remoll.sh . + mv ../../../../../remoll-detector-generator/cadp_${geom}_${name}.csv . + cp -p ../../../../../remoll-detector-generator/materialsOptical.xml . + mv ../../../../../remoll-detector-generator/*${geom}.* . + + sed -i 's;'" \n runscript_${geom}_${name}.sh + chmod 755 runscript_${geom}_${name}.sh + qsub runscript_${geom}_${name}.sh + fi + if [[ "$pass" == "2" ]] ; then + ./pe remollout_${geom}_${name}.root ${det} ${refAngle} ${refLength} ${reflectivity} ${cerenkov} ${scintillation} ${z_point} + convert remollout_${geom}_${name}*.png remollout_${geom}_${name}.pdf + rm remollout_${geom}_${name}*.png + rm remollout_${geom}_${name}.root + rm remollout_${geom}_${name}_PEs_det_${det}.root + fi + cd - +done + diff --git a/macros/scan.sh b/macros/scan.sh index 34b77204f..bb3b31016 100755 --- a/macros/scan.sh +++ b/macros/scan.sh @@ -94,11 +94,6 @@ else scint="false" fi -#tmpFolder="${scanned}_${fixed}" -#if [ ! -d $tmpFolder ] ; then -# mkdir $tmpFolder -#fi - for currentStep in `seq 0 $numSteps`; do point=$(printf "%.1f" "$(bc -l <<< \($scanMin+\(1.0*$currentStep*$scanStep\)\))") @@ -131,6 +126,9 @@ do sed -i 's;'"/process/optical/processActivation Scintillation false"';'"/process/optical/processActivation Scintillation ${scint}"';g' scans_${geom}_${name}.mac sed -i 's;'"Mainz_0.0_degrees_0.0_x.root"';'"${geom}_${name}.root"';g' scans_${geom}_${name}.mac tmpFolder="scans/$geom/out_${geom}_${name}" + if [ ! -d scans ] ; then + mkdir scans + fi if [ ! -d scans/${geom} ] ; then mkdir scans/${geom} fi @@ -138,26 +136,15 @@ do mkdir $tmpFolder fi cd $tmpFolder - cp -p ../../../../build/remoll . + cp -p ../../../../bin/remoll . cp -p ../../../../geometry_Mainz/materialsOptical.xml . cp -p ../../../../geometry_Mainz/*${geom}.* . cp ../../../../geometry_Mainz/matrices_${geom}.xml matrices_${geom}.xml - sed -i 's;'"2.00214948263953\*eV 0.9"';'"2.00214948263953\*eV ${reflectivity}"';g' matrices_${geom}.xml sed -i 's;'" \n Date: Wed, 22 Jul 2020 10:34:04 -0500 Subject: [PATCH 052/443] List of contributors added --- CONTRIBUTORS.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 CONTRIBUTORS.md diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md new file mode 100644 index 000000000..92555a18f --- /dev/null +++ b/CONTRIBUTORS.md @@ -0,0 +1,24 @@ +# Contributors + +This project would not have been possible without the hard work +of many contributors (in alphabetical order): + +- Kurtis Bartlett (kdbartlett) +- Raktiha Beminiwattha (rakithab) +- Devika Bhatta Pathak (devika123) +- Chanda Bindu (chandabindu) +- Cameron Clarke (cameronc137) +- Wouter Deconinck (wdconinc) +- Daniel De Layo (danieldelayo) +- Audrey Farrell (acfarrell) +- Catherine Feldman (catherinef37) +- Ciprian Gal (cipriangal) +- Valerie Gray (vmgray) +- Nicholas Hirlinger Saylor (hirlingersaylor) +- Dominic Lunde (dclunde) +- Juliette Mammei (jmammei) +- Scott Mundy (scmundy) +- Sakib Rahman (rahmans1) +- Seamus Riordan (seamusriordan) +- Rupesh Silwal (silwalr) +- Erik Stevenson (eriknstevenson) From 51bda6d82cd5c871149a31825a834827f0d8db59 Mon Sep 17 00:00:00 2001 From: vdoomra Date: Fri, 24 Jul 2020 16:10:01 -0400 Subject: [PATCH 053/443] beampipe_changes --- .../beampipe/downstream/beampipeDSMother.gdml | 61 ++++++++++++++++--- 1 file changed, 53 insertions(+), 8 deletions(-) diff --git a/geometry/beampipe/downstream/beampipeDSMother.gdml b/geometry/beampipe/downstream/beampipeDSMother.gdml index 40c9b39ec..f0905fa9a 100644 --- a/geometry/beampipe/downstream/beampipeDSMother.gdml +++ b/geometry/beampipe/downstream/beampipeDSMother.gdml @@ -12,7 +12,7 @@ lunit="mm"> - + @@ -47,15 +47,26 @@ - - - - - - + + + + + + + + + + + + + + + + + + - @@ -83,6 +94,27 @@ + + + + + + + + + + + + + + + + + + + + + @@ -103,6 +135,19 @@ + + + + + + + + + + + + + From cea38e46fe9c687ae43ca8411927efe9c0682647 Mon Sep 17 00:00:00 2001 From: vdoomra Date: Mon, 27 Jul 2020 19:30:30 -0400 Subject: [PATCH 054/443] beampipe_changes --- .../beampipe/downstream/beampipeDSMother.gdml | 75 ++++++++++++++++++- 1 file changed, 71 insertions(+), 4 deletions(-) diff --git a/geometry/beampipe/downstream/beampipeDSMother.gdml b/geometry/beampipe/downstream/beampipeDSMother.gdml index f0905fa9a..b96be9362 100644 --- a/geometry/beampipe/downstream/beampipeDSMother.gdml +++ b/geometry/beampipe/downstream/beampipeDSMother.gdml @@ -52,16 +52,45 @@ - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -108,11 +137,34 @@ - + + + + + + + + + + + + + + + + + + + + + + + + @@ -147,6 +199,21 @@ + + + + + + + + + + + + + + + From daeb77ffb0fcdec89dc5cf97a60c17c5484e9c02 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 28 Jul 2020 13:13:03 -0500 Subject: [PATCH 055/443] Reenable pion detectors in positions without overlap with bigger beampipe --- geometry/pion/GEM/pionDetectorGEM.gdml | 2 +- geometry/pion/GEM/pionDetectorGEMOpenSector.gdml | 2 +- geometry/pion/Lucite/pionDetectorLucite.gdml | 6 +++--- geometry/pion/Lucite/pionDetectorLuciteSector.gdml | 4 ++-- geometry/pion/TS/pionDetectorTS.gdml | 2 +- geometry/pion/TS/pionDetectorTSOpenSector.gdml | 4 ++-- geometry/pion/pionDetectorSystem.gdml | 6 ++---- geometry/pion/pionDetectorVirtualDet.gdml | 2 +- 8 files changed, 13 insertions(+), 15 deletions(-) diff --git a/geometry/pion/GEM/pionDetectorGEM.gdml b/geometry/pion/GEM/pionDetectorGEM.gdml index ff92e3a34..3c9b7e782 100644 --- a/geometry/pion/GEM/pionDetectorGEM.gdml +++ b/geometry/pion/GEM/pionDetectorGEM.gdml @@ -5,7 +5,7 @@ - + diff --git a/geometry/pion/GEM/pionDetectorGEMOpenSector.gdml b/geometry/pion/GEM/pionDetectorGEMOpenSector.gdml index 39f0bdaa8..9906ba540 100644 --- a/geometry/pion/GEM/pionDetectorGEMOpenSector.gdml +++ b/geometry/pion/GEM/pionDetectorGEMOpenSector.gdml @@ -6,7 +6,7 @@ - + diff --git a/geometry/pion/Lucite/pionDetectorLucite.gdml b/geometry/pion/Lucite/pionDetectorLucite.gdml index cc6aebf53..96db8fc37 100644 --- a/geometry/pion/Lucite/pionDetectorLucite.gdml +++ b/geometry/pion/Lucite/pionDetectorLucite.gdml @@ -30,10 +30,10 @@ - - + + - + diff --git a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml index fbec1758f..405e74a32 100644 --- a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml +++ b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml @@ -11,7 +11,7 @@ the radius along with the angle of the detector to increase the length in the longitudinal direction. --> - + - + diff --git a/geometry/pion/TS/pionDetectorTS.gdml b/geometry/pion/TS/pionDetectorTS.gdml index 80546669c..9436ff4e0 100644 --- a/geometry/pion/TS/pionDetectorTS.gdml +++ b/geometry/pion/TS/pionDetectorTS.gdml @@ -5,7 +5,7 @@ - + diff --git a/geometry/pion/TS/pionDetectorTSOpenSector.gdml b/geometry/pion/TS/pionDetectorTSOpenSector.gdml index 0fe2ee409..761c642d0 100644 --- a/geometry/pion/TS/pionDetectorTSOpenSector.gdml +++ b/geometry/pion/TS/pionDetectorTSOpenSector.gdml @@ -6,11 +6,11 @@ - + - + diff --git a/geometry/pion/pionDetectorSystem.gdml b/geometry/pion/pionDetectorSystem.gdml index bc29b8bb7..d4b637f95 100644 --- a/geometry/pion/pionDetectorSystem.gdml +++ b/geometry/pion/pionDetectorSystem.gdml @@ -81,19 +81,18 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + @@ -176,12 +226,8 @@ - - - - - + diff --git a/geometry/positions.xml b/geometry/positions.xml index 976b3fc8e..e6677c483 100644 --- a/geometry/positions.xml +++ b/geometry/positions.xml @@ -51,7 +51,10 @@ detectors are placed --> - + + + + From 6b410079892eab17fe8f030a26bb798563df5d22 Mon Sep 17 00:00:00 2001 From: vdoomra <68244726+vdoomra@users.noreply.github.com> Date: Sun, 2 Aug 2020 17:43:50 -0400 Subject: [PATCH 059/443] Add files via upload --- jlabSubmit1.py | 245 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 245 insertions(+) create mode 100644 jlabSubmit1.py diff --git a/jlabSubmit1.py b/jlabSubmit1.py new file mode 100644 index 000000000..5f53cdefd --- /dev/null +++ b/jlabSubmit1.py @@ -0,0 +1,245 @@ +#!/usr/bin/python +from subprocess import call +import sys, os, time, tarfile + +def main(): + +#FIXME Update these + email = "vdoomra@jlab.org" + + config = "test_run" + + identifier = raw_input("Please enter the identifier: ") + + sourceDir = "/work/halla/moller12gev/vdoomra" + #outDir = "/lustre/expphy/volatile/halla/parity/chandan/sim_out/"+identifier + outDir = "/lustre/expphy/volatile/halla/moller12gev/vdoomra"+config + if not os.path.exists(outDir): + os.makedirs(outDir) + nrEv = 500 #900000 + nrStart= 1 + nrStopActual = 4 #60 + nrStop = nrStopActual+1 #60 + + print('Running ' + str(nrEv*(nrStop - nrStart)) + ' events...') + + #jobName=config + '_' + identifier + '_' + val + "mm" + '_%03dkEv'%(nrEv/1000) + jobName=config + '_' + identifier + '_%02dkEv'%(nrEv/1000) + + ###tar exec+geometry + make_tarfile(sourceDir,config,identifier) + + for jobNr in range(nrStart,nrStop): # repeat for jobNr jobs + print("Starting job setup for jobID: " + str(jobNr)) + + jobFullName = jobName + '_%03d'%jobNr + outDirFull=outDir+"/"+jobFullName + createMacFiles(config, outDirFull, sourceDir, nrEv, jobNr, identifier) + + ###copy tarfile + call(["cp",sourceDir+"/rad_analysis/default.tar.gz", + outDir+"/"+jobFullName+"/default.tar.gz"]) + + createXMLfile(sourceDir,outDir,jobName,nrStart,nrStop,email,identifier) + + print "All done for config ",config,"_",identifier," for #s between ",nrStart, " and ", nrStopActual + + +def createMacFiles(config,outDirFull,sourceDir,nrEv,jobNr,identifier): + + if not os.path.exists(outDirFull+"/log"): + os.makedirs(outDirFull+"/log") + + f=open(outDirFull+"/"+"runexample_"+identifier+".mac",'w') + f.write("/remoll/setgeofile geometry/mollerMother_merged.gdml\n") + f.write("/remoll/physlist/register QGSP_BERT_HP\n") + f.write("/remoll/physlist/parallel/enable\n") + f.write("/remoll/parallel/setfile geometry/mollerParallel.gdml\n") + f.write("/run/numberOfThreads 10\n") + f.write("/run/initialize\n") + f.write("/remoll/addfield map_directory/hybridJLAB.txt\n") + f.write("/remoll/addfield map_directory/upstreamJLAB_1.25.txt\n") + #f.write("/remoll/evgen/set moller\n") + f.write("/remoll/evgen/set beam\n") + #f.write("/remoll/evgen/set elastic\n") + #f.write("/remoll/oldras false\n") + f.write("/remoll/evgen/beam/origin 0 0 -7.5 m\n") + f.write("/remoll/evgen/beam/rasx 5 mm\n") + f.write("/remoll/evgen/beam/rasy 5 mm\n") + f.write("/remoll/evgen/beam/corrx 0.065\n") + f.write("/remoll/evgen/beam/corry 0.065\n") + #f.write("/remoll/beam_corrph 0.02134\n") + #f.write("/remoll/beam_corrth 0.02134\n") + f.write("/remoll/evgen/beam/rasrefz -4.5 m\n") + f.write("/remoll/beamene 11 GeV\n") + f.write("/remoll/beamcurr 70 microampere\n") + f.write("/remoll/SD/disable_all\n") + f.write("/remoll/SD/enable 28\n") + f.write("/remoll/SD/detect lowenergyneutral 28\n") + f.write("/remoll/SD/detect secondaries 28\n") + f.write("/remoll/SD/detect boundaryhits 28\n") + + f.write("/remoll/SD/enable 55\n") + f.write("/remoll/SD/detect lowenergyneutral 55\n") + f.write("/remoll/SD/detect secondaries 55\n") + f.write("/remoll/SD/detect boundaryhits 55\n") + + f.write("/remoll/SD/enable 56\n") + f.write("/remoll/SD/detect lowenergyneutral 56\n") + f.write("/remoll/SD/detect secondaries 56\n") + f.write("/remoll/SD/detect boundaryhits 56\n") + + f.write("/remoll/SD/enable 57\n") + f.write("/remoll/SD/detect lowenergyneutral 57\n") + f.write("/remoll/SD/detect secondaries 57\n") + f.write("/remoll/SD/detect boundaryhits 57\n") + + f.write("/remoll/SD/enable 58\n") + f.write("/remoll/SD/detect lowenergyneutral 58\n") + f.write("/remoll/SD/detect secondaries 58\n") + f.write("/remoll/SD/detect boundaryhits 58\n") + + #f.write("/remoll/SD/enable 3340\n") + #f.write("/remoll/SD/detect lowenergyneutral 3340\n") + #f.write("/remoll/SD/detect secondaries 3340\n") + #f.write("/remoll/SD/detect boundaryhits 3340\n") + # f.write("/remoll/SD/enable 95\n") + # f.write("/remoll/SD/detect lowenergyneutral 95\n") + # f.write("/remoll/SD/detect secondaries 95\n") + # f.write("/remoll/SD/detect boundaryhits 95\n") + # f.write("/remoll/SD/enable 55\n") + # f.write("/remoll/SD/detect lowenergyneutral 55\n") + # f.write("/remoll/SD/detect secondaries 55\n") + # f.write("/remoll/SD/enable 56\n") + # f.write("/remoll/SD/detect lowenergyneutral 56\n") + # f.write("/remoll/SD/detect secondaries 56\n") + # f.write("/remoll/SD/enable 3333\n") + # f.write("/remoll/SD/detect lowenergyneutral 3333\n") + # f.write("/remoll/SD/detect secondaries 3333\n") + # f.write("/remoll/SD/detect boundaryhits 3333\n") + # f.write("/remoll/SD/enable 3334\n") + # f.write("/remoll/SD/detect lowenergyneutral 3334\n") + # f.write("/remoll/SD/detect secondaries 3334\n") + # f.write("/remoll/SD/detect boundaryhits 3334\n") + # f.write("/remoll/SD/enable 3335\n") + # f.write("/remoll/SD/detect lowenergyneutral 3335\n") + # f.write("/remoll/SD/detect secondaries 3335\n") + # f.write("/remoll/SD/detect boundaryhits 3335\n") + # f.write("/remoll/SD/enable 3336\n") + # f.write("/remoll/SD/detect lowenergyneutral 3336\n") + # f.write("/remoll/SD/detect secondaries 3336\n") + # f.write("/remoll/SD/detect boundaryhits 3336\n") + # f.write("/remoll/SD/enable 3337\n") + # f.write("/remoll/SD/detect lowenergyneutral 3337\n") + # f.write("/remoll/SD/detect secondaries 3337\n") + # f.write("/remoll/SD/detect boundaryhits 3337\n") + # f.write("/remoll/SD/enable 3338\n") + # f.write("/remoll/SD/detect lowenergyneutral 3338\n") + # f.write("/remoll/SD/detect secondaries 3338\n") + # f.write("/remoll/SD/detect boundaryhits 3338\n") + # f.write("/remoll/SD/enable 3339\n") + # f.write("/remoll/SD/detect lowenergyneutral 3339\n") + # f.write("/remoll/SD/detect secondaries 3339\n") + # f.write("/remoll/SD/detect boundaryhits 3339\n") + #f.write("/remoll/SD/enable 96\n") + #f.write("/remoll/SD/detect lowenergyneutral 96\n") + #f.write("/remoll/SD/detect secondaries 96\n") + #f.write("/remoll/SD/enable 97\n") + #f.write("/remoll/SD/detect lowenergyneutral 97\n") + #f.write("/remoll/SD/detect secondaries 97\n") + #f.write("/remoll/kryptonite/volume logicUSTracker\n") + #f.write("/remoll/kryptonite/volume logicDSTracker\n") + #f.write("/remoll/kryptonite/volume logicWasher_12\n") + f.write("/remoll/kryptonite/enable\n") + f.write("/process/list\n") + f.write("/remoll/filename remollout.root\n") + f.write("/run/beamOn "+str(nrEv)+"\n") + f.close() + return 0 + +def createXMLfile(sourceDir,outDir,jobName,nrStart,nrStop,email,identifier): + + if not os.path.exists(sourceDir+"/rad_analysis/jobs"): + os.makedirs(sourceDir+"/rad_analysis/jobs") + + f=open(sourceDir+"/rad_analysis/jobs/"+jobName+".xml","w") + f.write("\n") + f.write(" \n") + f.write(" \n") + + f.write(" \n") +# f.write(" \n") +# f.write(" \n") + + f.write(" \n") + f.write(" \n") + f.write(" \n") + + f.write(" \n") + + for number in range(nrStart,nrStop): # repeat for nr jobs + idName= outDir+"/"+jobName+'_%03d'%(number) + rootfile= outDir+"/remollout_"+identifier+'%d'%(number) + f.write(" \n") + f.write(" \n") + f.write(" \n") + + # f.write(" \n") + f.write(" \n") + f.write(" \n") + f.write(" \n") + f.write(" \n\n") + + f.write("\n") + f.close() + return 0 + +def make_tarfile(sourceDir,config,ident): + print "making geometry tarball" + if os.path.isfile(sourceDir+"/rad_analysis/default.tar.gz"): + os.remove(sourceDir+"/rad_analysis/default.tar.gz") + tar = tarfile.open(sourceDir+"/rad_analysis/default.tar.gz","w:gz") + tar.add(sourceDir+"/remoll/build/remoll",arcname="remoll") + tar.add(sourceDir+"/remoll/build/libremoll_rdict.pcm",arcname="libremoll_rdict.pcm") + tar.add(sourceDir+"/remoll/build/libremoll.so",arcname="libremoll.so") + #tar.add(sourceDir+"/rad_analysis/pruneTree",arcname="pruneTree") + #tar.add(sourceDir+"/macros/runexample_"+ident+".mac",arcname="runexample_"+ident+".mac") + #runexample overwrite could crash + tar.add(sourceDir+"/remoll/map_directory",arcname="map_directory") + #tar.add(sourceDir+"/remoll/geometry",arcname="geometry") + #tar.add(sourceDir+"/remoll/geometry/schema",arcname="geometry/schema") + tar.add(sourceDir+"/remoll/geometry/materials.xml",arcname="geometry/materials.xml") + tar.add(sourceDir+"/remoll/geometry/matrices.xml",arcname="geometry/matrices.xml") + tar.add(sourceDir+"/remoll/geometry/positions.xml",arcname="geometry/positions.xml") + tar.add(sourceDir+"/remoll/geometry/solids/world.xml",arcname="geometry/solids/world.xml") + tar.add(sourceDir+"/remoll/geometry/mollerParallel.gdml" ,arcname="geometry/mollerParallel.gdml") + tar.add(sourceDir+"/remoll/geometry/mollerMother_merged.gdml" ,arcname="geometry/mollerMother_merged.gdml") + tar.add(sourceDir+"/remoll/geometry/target/subTargetRegion.gdml" ,arcname="geometry/target/subTargetRegion.gdml") + tar.add(sourceDir+"/remoll/geometry/hall/hallDaughter_merged.gdml" ,arcname="geometry/hall/hallDaughter_merged.gdml") + tar.add(sourceDir+"/remoll/geometry/hall/hallDaughter_dump.gdml" ,arcname="geometry/hall/hallDaughter_dump.gdml") + tar.add(sourceDir+"/remoll/geometry/hall/subDumpDiffuser.gdml" ,arcname="geometry/hall/subDumpDiffuser.gdml") + tar.add(sourceDir+"/remoll/geometry/upstream/upstreamDaughter_merged.gdml" ,arcname="geometry/upstream/upstreamDaughter_merged.gdml") + tar.add(sourceDir+"/remoll/geometry/upstream/upstreamToroid.gdml" ,arcname="geometry/upstream/upstreamToroid.gdml") + tar.add(sourceDir+"/remoll/geometry/upstream/upstreamBeampipe.gdml" ,arcname="geometry/upstream/upstreamBeampipe.gdml") + tar.add(sourceDir+"/remoll/geometry/hybrid/hybridToroid.gdml" ,arcname="geometry/hybrid/hybridToroid.gdml") + tar.add(sourceDir+"/remoll/geometry/hybrid/hybridDaughter_merged.gdml" ,arcname="geometry/hybrid/hybridDaughter_merged.gdml") + tar.add(sourceDir+"/remoll/geometry/huts/lefthut.gdml" ,arcname="geometry/huts/lefthut.gdml") + tar.add(sourceDir+"/remoll/geometry/huts/righthut.gdml" ,arcname="geometry/huts/righthut.gdml") + tar.add(sourceDir+"/remoll/geometry/showermax/showerMaxGen.gdml" ,arcname="geometry/showermax/showerMaxGen.gdml") + tar.add(sourceDir+"/remoll/geometry/pion/pionDetectorSystem.gdml" ,arcname="geometry/pion/pionDetectorSystem.gdml") + tar.add(sourceDir+"/remoll/geometry/beampipe/downstream/beampipeDSMother.gdml" ,arcname="geometry/beampipe/downstream/beampipeDSMother.gdml") + + tar.close() + +if __name__ == '__main__': + main() + From 563f4a861c03ea6f8b268b5b5bce0ea82aa45642 Mon Sep 17 00:00:00 2001 From: Sakib Date: Mon, 3 Aug 2020 15:17:07 -0400 Subject: [PATCH 060/443] Reducing azimuthal width to 6mm from 24 mm --- geometry/hybrid/hybridToroid.gdml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/geometry/hybrid/hybridToroid.gdml b/geometry/hybrid/hybridToroid.gdml index a2a49a6ec..29336b1d8 100644 --- a/geometry/hybrid/hybridToroid.gdml +++ b/geometry/hybrid/hybridToroid.gdml @@ -45,15 +45,15 @@ - - - - + + + +
-
+
- + From 82bcf4834cf82cd271b735261de7de223c93a812 Mon Sep 17 00:00:00 2001 From: Cameron Clarke Date: Sat, 8 Aug 2020 19:59:25 -0400 Subject: [PATCH 061/443] Cleaning up structs in pe.cc. Correcting quartz detector id for cuts, and adding explicitly clear cuts to pe.cc to know if an electron hit the quartz for the reflector-photon-bounce case (possibly duplicate functionality depending on how root draw commands treat cuts on arrays) --- analysis/pe/include/pe.hh | 186 +----------------- analysis/pe/include/peLinkDef.h | 20 +- analysis/pe/include/petypes.hh | 98 +--------- analysis/pe/pe.cc | 325 +++++++++++++++++++------------- 4 files changed, 199 insertions(+), 430 deletions(-) diff --git a/analysis/pe/include/pe.hh b/analysis/pe/include/pe.hh index 51a2076f9..5ed7db3d0 100644 --- a/analysis/pe/include/pe.hh +++ b/analysis/pe/include/pe.hh @@ -1,10 +1,11 @@ #include "remolltypes.hh" #include "petypes.hh" -catPEs_t catPEsTrim(std::vector sourcedetids, std::vector quartzpids, std::vector quartzmtrids, size_t peLen, std::vector cathitx, std::vector cathity, std::vector cathitz) +catPEs_t catPEsTrim(int sourcedetid, std::vector sourcedetids, std::vector quartzpids, std::vector quartzmtrids, size_t peLen, std::vector cathitx, std::vector cathity, std::vector cathitz) { catPEs_t newHit; newHit.npes=peLen; + newHit.det=sourcedetid; newHit.detids=sourcedetids; newHit.pids=quartzpids; newHit.mtrids=quartzmtrids; @@ -14,10 +15,10 @@ catPEs_t catPEsTrim(std::vector sourcedetids, std::vector quartzpids, return newHit; } -Q_t QTrim(remollGenericDetectorHit_t hit, size_t peLen, std::vector cathitx, std::vector cathity, std::vector cathitz) +hitPEs_t hitPEsTrim(remollGenericDetectorHit_t hit, size_t peLen, std::vector cathitx, std::vector cathity, std::vector cathitz) { - Q_t newHit; - newHit.det = hit.det; + hitPEs_t newHit; + newHit.det=hit.det; newHit.x=hit.x; newHit.y=hit.y; newHit.z=hit.z; @@ -38,180 +39,3 @@ Q_t QTrim(remollGenericDetectorHit_t hit, size_t peLen, std::vector cath return newHit; } -Ref_t RefTrim(remollGenericDetectorHit_t hit, size_t peLen, std::vector cathitx, std::vector cathity, std::vector cathitz) -{ - Ref_t newHit; - newHit.det = hit.det; - newHit.x=hit.x; - newHit.y=hit.y; - newHit.z=hit.z; - newHit.r=hit.r; - newHit.px=hit.px; - newHit.py=hit.py; - newHit.pz=hit.pz; - newHit.p=hit.p; - newHit.e=hit.e; - newHit.m=hit.m; - newHit.vx=hit.vx; - newHit.vy=hit.vy; - newHit.vz=hit.vz; - newHit.npes=peLen; - newHit.cathitx=cathitx; - newHit.cathity=cathity; - newHit.cathitz=cathitz; - return newHit; -} - -RefX_t RefXTrim(remollGenericDetectorHit_t hit, size_t peLen, std::vector cathitx, std::vector cathity, std::vector cathitz) -{ - RefX_t newHit; - newHit.det = hit.det; - newHit.x=hit.x; - newHit.y=hit.y; - newHit.z=hit.z; - newHit.r=hit.r; - newHit.px=hit.px; - newHit.py=hit.py; - newHit.pz=hit.pz; - newHit.p=hit.p; - newHit.e=hit.e; - newHit.m=hit.m; - newHit.vx=hit.vx; - newHit.vy=hit.vy; - newHit.vz=hit.vz; - newHit.npes=peLen; - newHit.cathitx=cathitx; - newHit.cathity=cathity; - newHit.cathitz=cathitz; - return newHit; -} - -Refair_t RefairTrim(remollGenericDetectorHit_t hit, size_t peLen, std::vector cathitx, std::vector cathity, std::vector cathitz) -{ - Refair_t newHit; - newHit.det = hit.det; - newHit.x=hit.x; - newHit.y=hit.y; - newHit.z=hit.z; - newHit.r=hit.r; - newHit.px=hit.px; - newHit.py=hit.py; - newHit.pz=hit.pz; - newHit.p=hit.p; - newHit.e=hit.e; - newHit.m=hit.m; - newHit.vx=hit.vx; - newHit.vy=hit.vy; - newHit.vz=hit.vz; - newHit.npes=peLen; - newHit.cathitx=cathitx; - newHit.cathity=cathity; - newHit.cathitz=cathitz; - return newHit; -} - -LG_t LGTrim(remollGenericDetectorHit_t hit, size_t peLen, std::vector cathitx, std::vector cathity, std::vector cathitz) -{ - LG_t newHit; - newHit.det = hit.det; - newHit.x=hit.x; - newHit.y=hit.y; - newHit.z=hit.z; - newHit.r=hit.r; - newHit.px=hit.px; - newHit.py=hit.py; - newHit.pz=hit.pz; - newHit.p=hit.p; - newHit.e=hit.e; - newHit.m=hit.m; - newHit.vx=hit.vx; - newHit.vy=hit.vy; - newHit.vz=hit.vz; - newHit.npes=peLen; - newHit.cathitx=cathitx; - newHit.cathity=cathity; - newHit.cathitz=cathitz; - return newHit; -} - -LGair_t LGairTrim(remollGenericDetectorHit_t hit, size_t peLen, std::vector cathitx, std::vector cathity, std::vector cathitz) -{ - LGair_t newHit; - newHit.det = hit.det; - newHit.x=hit.x; - newHit.y=hit.y; - newHit.z=hit.z; - newHit.r=hit.r; - newHit.px=hit.px; - newHit.py=hit.py; - newHit.pz=hit.pz; - newHit.p=hit.p; - newHit.e=hit.e; - newHit.m=hit.m; - newHit.vx=hit.vx; - newHit.vy=hit.vy; - newHit.vz=hit.vz; - newHit.npes=peLen; - newHit.cathitx=cathitx; - newHit.cathity=cathity; - newHit.cathitz=cathitz; - return newHit; -} - -PMTcat_t PMTcatTrim(remollGenericDetectorHit_t hit, size_t peLen, std::vector cathitx, std::vector cathity, std::vector cathitz) -{ - PMTcat_t newHit; - newHit.det = hit.det; - newHit.x=hit.x; - newHit.y=hit.y; - newHit.z=hit.z; - newHit.r=hit.r; - newHit.px=hit.px; - newHit.py=hit.py; - newHit.pz=hit.pz; - newHit.p=hit.p; - newHit.e=hit.e; - newHit.m=hit.m; - newHit.vx=hit.vx; - newHit.vy=hit.vy; - newHit.vz=hit.vz; - newHit.npes=peLen; - newHit.cathitx=cathitx; - newHit.cathity=cathity; - newHit.cathitz=cathitz; - return newHit; -} - -PMTbulk_t PMTbulkTrim(remollGenericDetectorHit_t hit, size_t peLen, std::vector cathitx, std::vector cathity, std::vector cathitz) -{ - PMTbulk_t newHit; - newHit.det = hit.det; - newHit.x=hit.x; - newHit.y=hit.y; - newHit.z=hit.z; - newHit.r=hit.r; - newHit.px=hit.px; - newHit.py=hit.py; - newHit.pz=hit.pz; - newHit.p=hit.p; - newHit.e=hit.e; - newHit.m=hit.m; - newHit.vx=hit.vx; - newHit.vy=hit.vy; - newHit.vz=hit.vz; - newHit.npes=peLen; - newHit.cathitx=cathitx; - newHit.cathity=cathity; - newHit.cathitz=cathitz; - return newHit; -} - -elseX_t elseXTrim(int peLen, std::vector cathitx, std::vector cathity, std::vector cathitz) -{ - elseX_t newHit; - newHit.npes=peLen; - newHit.cathitx=cathitx; - newHit.cathity=cathity; - newHit.cathitz=cathitz; - return newHit; -} diff --git a/analysis/pe/include/peLinkDef.h b/analysis/pe/include/peLinkDef.h index 78279ed0f..3834ad5e2 100644 --- a/analysis/pe/include/peLinkDef.h +++ b/analysis/pe/include/peLinkDef.h @@ -5,25 +5,9 @@ #pragma link off all functions; #pragma link C++ struct catPEs_t+; -#pragma link C++ struct Q_t+; -#pragma link C++ struct Ref_t+; -#pragma link C++ struct RefX_t+; -#pragma link C++ struct Refair_t+; -#pragma link C++ struct LG_t+; -#pragma link C++ struct LGair_t+; -#pragma link C++ struct PMTcat_t+; -#pragma link C++ struct PMTbulk_t+; -#pragma link C++ struct elseX_t+; +#pragma link C++ struct hitPEs_t+; #pragma link C++ struct vector+; -#pragma link C++ struct vector+; -#pragma link C++ struct vector+; -#pragma link C++ struct vector+; -#pragma link C++ struct vector+; -#pragma link C++ struct vector+; -#pragma link C++ struct vector+; -#pragma link C++ struct vector+; -#pragma link C++ struct vector+; -#pragma link C++ struct vector+; +#pragma link C++ struct vector+; #endif diff --git a/analysis/pe/include/petypes.hh b/analysis/pe/include/petypes.hh index a49105cf8..6455bd54e 100644 --- a/analysis/pe/include/petypes.hh +++ b/analysis/pe/include/petypes.hh @@ -21,13 +21,14 @@ struct catPEs_t { // The full spectrum regardless of source int npes; // PE counts per event + int det; // store the source det ID too std::vector detids; // store the source det IDs too std::vector mtrids; // store the source mtrids too std::vector pids; // store the source pids too std::vector cathitx, cathity, cathitz; //Cathode PE hit information }; -struct Q_t { // Quartz Hits +struct hitPEs_t { // Quartz Hits int npes; int det; double r; @@ -40,101 +41,6 @@ struct Q_t { // Quartz Hits std::vector cathitx, cathity, cathitz; //Cathode PE hit information }; -struct Ref_t { // Reflector Primary Hits - int npes; - int det; - double r; - double x; - double y; - double z; - double px, py, pz; - double p, e, m; - double vx, vy, vz; - std::vector cathitx, cathity, cathitz; //Cathode PE hit information -}; - -struct RefX_t { // Reflector Accidental Side Hits - int npes; - int det; - double r; - double x; - double y; - double z; - double px, py, pz; - double p, e, m; - double vx, vy, vz; - std::vector cathitx, cathity, cathitz; //Cathode PE hit information -}; - -struct Refair_t { // Reflector Air Volume Hits - int npes; - int det; - double r; - double x; - double y; - double z; - double px, py, pz; - double p, e, m; - double vx, vy, vz; - std::vector cathitx, cathity, cathitz; //Cathode PE hit information -}; - -struct LG_t { // Light Guide Hits - int npes; - int det; - double r; - double x; - double y; - double z; - double px, py, pz; - double p, e, m; - double vx, vy, vz; - std::vector cathitx, cathity, cathitz; //Cathode PE hit information -}; - -struct LGair_t { // Light Guide Air Volume Hits - int npes; - int det; - double r; - double x; - double y; - double z; - double px, py, pz; - double p, e, m; - double vx, vy, vz; - std::vector cathitx, cathity, cathitz; //Cathode PE hit information -}; - -struct PMTcat_t { // PMT Cathode Hits - int npes; - int det; - double r; - double x; - double y; - double z; - double px, py, pz; - double p, e, m; - double vx, vy, vz; - std::vector cathitx, cathity, cathitz; //Cathode PE hit information -}; - -struct PMTbulk_t { // PMT Bulk Volume Hits - int npes; - int det; - double r; - double x; - double y; - double z; - double px, py, pz; - double p, e, m; - double vx, vy, vz; - std::vector cathitx, cathity, cathitz; //Cathode PE hit information -}; - -struct elseX_t { // PMT Bulk Volume Hits - int npes; - std::vector cathitx, cathity, cathitz; //Cathode PE hit information -}; #endif // __PE_TYPES_HH diff --git a/analysis/pe/pe.cc b/analysis/pe/pe.cc index 427f63f44..142100194 100644 --- a/analysis/pe/pe.cc +++ b/analysis/pe/pe.cc @@ -65,22 +65,24 @@ void pe(std::string file="tracking.root", int detid=50001) oldTree->SetBranchAddress("part", &fPart); std::vector < catPEs_t > *catPEs = new std::vector < catPEs_t > ; std::vector < catPEs_t > *refPEs = new std::vector < catPEs_t > ; - std::vector < Q_t > *Q = new std::vector < Q_t > ; - std::vector < Ref_t > *Ref = new std::vector < Ref_t > ; - std::vector < RefX_t > *RefX = new std::vector < RefX_t > ; - std::vector < Refair_t > *Refair = new std::vector < Refair_t > ; - std::vector < LG_t > *LG = new std::vector < LG_t > ; - std::vector < LGair_t > *LGair = new std::vector < LGair_t > ; - std::vector < PMTcat_t > *PMTcat = new std::vector < PMTcat_t > ; - std::vector < PMTbulk_t > *PMTbulk = new std::vector < PMTbulk_t > ; - std::vector < elseX_t > *elseX = new std::vector < elseX_t > ; + std::vector < hitPEs_t > *Q = new std::vector < hitPEs_t > ; + std::vector < hitPEs_t > *Ref = new std::vector < hitPEs_t > ; + std::vector < hitPEs_t > *RefX = new std::vector < hitPEs_t > ; + std::vector < hitPEs_t > *Refair = new std::vector < hitPEs_t > ; + std::vector < hitPEs_t > *LG = new std::vector < hitPEs_t > ; + std::vector < hitPEs_t > *LGair = new std::vector < hitPEs_t > ; + std::vector < hitPEs_t > *PMTcat = new std::vector < hitPEs_t > ; + std::vector < hitPEs_t > *PMTbulk = new std::vector < hitPEs_t > ; + std::vector < catPEs_t > *elseX = new std::vector < catPEs_t > ; std::vector eTRID; std::vector refTRID; std::vector DETID; std::vector PID; std::vector MTRID; std::vector peTRID; - int refHit = 0; + int refSourceDetID = 0; + int sourceDetID = 0; + double refHit = 0; int Qcounted = 0; int Refaircounted = 0; int LGaircounted = 0; @@ -131,6 +133,10 @@ void pe(std::string file="tracking.root", int detid=50001) if (hit.pid == 11 && hit.mtrid == 0){ // Then this is our primary signal of interest // if you do mtrid == 1 then you get the delta rays! About a 1% contribution + if (hit.det == detid+1) { + refSourceDetID = hit.det; + } + sourceDetID = hit.det; eTRID.push_back(hit.trid); DETID.push_back(hit.det); if (i<30 && hit.det == 50001){ @@ -167,7 +173,7 @@ void pe(std::string file="tracking.root", int detid=50001) //std::cout<< "Checking cathode hit track ID = " << peTRID.at(l) << " Against hit track ID = " << hit.trid << std::endl; if (hit.trid == peTRID.at(l)) { //std::cout<< "Cathode hit - Match found" << std::endl; - refHit++; + refHit = refHit+0.5; // Because of how this loop works... looping over the hits will get a positive track==ref+PMT hit twice (so only add 1/2 per identified hit) } } } @@ -179,63 +185,65 @@ void pe(std::string file="tracking.root", int detid=50001) // Make the electron hit info go into the appropriate detector branch // quartz if (hit.det == detid+1 && Qcounted==0) { - Q->push_back(QTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); + Q->push_back(hitPEsTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); Qcounted++; } // reflector air if (hit.det == detid+2 && Refaircounted==0) { - Refair->push_back(RefairTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); + Refair->push_back(hitPEsTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); Refaircounted++; } // reflector skin if (hit.det == detid+3) { - Ref->push_back(RefTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); + Ref->push_back(hitPEsTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); } // reflector volume if (hit.det == detid+4) { - RefX->push_back(RefXTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); + RefX->push_back(hitPEsTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); } // light guide air if (hit.det == detid+6 && LGaircounted==0) { - LGair->push_back(LGairTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); + LGair->push_back(hitPEsTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); LGaircounted++; } // light guide skin if (hit.det == detid+5) { - LG->push_back(LGTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); + LG->push_back(hitPEsTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); } // PMT bulk if (hit.det == detid+7 && PMTbulkcounted==0) { - PMTbulk->push_back(PMTbulkTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); + PMTbulk->push_back(hitPEsTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); PMTbulkcounted++; } // PMT cathode if (hit.det == detid) { - PMTcat->push_back(PMTcatTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); + PMTcat->push_back(hitPEsTrim(hit,peTRID.size(),cathitx,cathity,cathitz)); } //break; //how is this useful?? I want to muliple count } } } - if (refHit>=1) { - refPEs->push_back(catPEsTrim(DETID,PID,MTRID,refHit,cathitx,cathity,cathitz)); + if (refHit>=1.0) { + refPEs->push_back(catPEsTrim(refSourceDetID,DETID,PID,MTRID,(int)refHit,cathitx,cathity,cathitz)); } else { - refPEs->push_back(catPEsTrim(DETID,PID,MTRID,0,cathitx,cathity,cathitz)); + refPEs->push_back(catPEsTrim(refSourceDetID,DETID,PID,MTRID,0,cathitx,cathity,cathitz)); } refHit=0; - catPEs->push_back(catPEsTrim(DETID,PID,MTRID,(int)peTRID.size(),cathitx,cathity,cathitz)); + catPEs->push_back(catPEsTrim(sourceDetID,DETID,PID,MTRID,(int)peTRID.size(),cathitx,cathity,cathitz)); detSourcedPEs=(int)peTRID.size(); - elseX->push_back(elseXTrim(((int)peTRID.size()-detSourcedPEs),cathitx,cathity,cathitz)); + elseX->push_back(catPEsTrim(sourceDetID,DETID,PID,MTRID,((int)peTRID.size()-detSourcedPEs),cathitx,cathity,cathitz)); N_entries = oldTree->GetEntries(); - if (catPEs->size() > 0){ + //if (catPEs->size() > 0){ newTree->Fill(); - } + //} Qcounted=0; Refaircounted=0; LGaircounted=0; PMTbulkcounted=0; detSourcedPEs=0; + refSourceDetID=0; + sourceDetID=0; eTRID.clear(); refTRID.clear(); refPEs->clear(); @@ -259,13 +267,14 @@ void pe(std::string file="tracking.root", int detid=50001) } newFile = newTree->GetCurrentFile(); newTree->Write("", TObject::kOverwrite); - newTree->Print(); + //newTree->Print(); old->Close(); newFile->Close(); } //void pePlots(int argcC, char **argvC, std::string fileP="tracking.root", int detid=50001, std::string variable="reflectorAngle", double varVal=11.5, std::string unit="deg") -void pePlots(int argcC, char **argvC, std::string fileP="tracking.root", int detid=50001, double user_angle = 0.0, double user_x_pos = 0.0, double user_reflectivity = 0.9, double user_cerenkov = 1.0, double user_scintillation = 1.0, double user_z_pos = -11.0) +//void pePlots(int argcC, char **argvC, std::string fileP="tracking.root", int detid=50001, double user_angle = 0.0, double user_x_pos = 0.0, double user_reflectivity = 0.9, double user_cerenkov = 1.0, double user_scintillation = 1.0, double user_z_pos = -11.0) +void pePlots(std::string fileP, int detid, std::vector &argNames, std::vector &argValues) { //TApplication theApp("App",&argcC,argvC); @@ -345,10 +354,10 @@ void pePlots(int argcC, char **argvC, std::string fileP="tracking.root", int det "pmtcat.r", "else.npes"}; std::string cuts[n_plots]={"", - "", - Form("catpes.detids==%d && catpes.pids==11 && catpes.mtrids==0",detid), - Form("catpes.detids==%d && abs(catpes.pids)==11 && catpes.mtrids!=0",detid), - Form("catpes.detids==%d && catpes.mtrids!=0",detid), + Form("ref.det==%d",detid+4), + Form("catpes.detids==%d && catpes.pids==11 && catpes.mtrids==0",detid+1), + Form("catpes.detids==%d && abs(catpes.pids)==11 && catpes.mtrids!=0",detid+1), + Form("catpes.detids==%d && catpes.mtrids!=0",detid+1), "ref.npes*(ref.npes!=0)", "refx.npes*(refx.npes!=0)", "", @@ -357,6 +366,20 @@ void pePlots(int argcC, char **argvC, std::string fileP="tracking.root", int det "", "", ""}; + std::string drawOpts[n_plots]={ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + ""}; std::string xTitle[n_plots]={"PEs", "PEs", "PEs", @@ -426,24 +449,40 @@ void pePlots(int argcC, char **argvC, std::string fileP="tracking.root", int det 100.0}; - for (int p=0;pcd(); - c1[p]->SetLogy(); - Histo[p]=new TH1F(Form("Histo[%d]",p),Form("%s; %s; %s",names[p].c_str(),xTitle[p].c_str(),yTitle[p].c_str()),nbins[p],lowbin[p],highbin[p]); + //Histo[p]=new TH1F(Form("Histo[%d]",p),Form("%s; %s; %s",names[p].c_str(),xTitle[p].c_str(),yTitle[p].c_str()),nbins[p],lowbin[p],highbin[p]); //Histo[p]=new TH1F(); //Histo[p]->SetName(Form("Histo[%d]",p)); - Tmol->Draw(Form("%s>>Histo[%d]",draws[p].c_str(),p),Form("%s",cuts[p].c_str())); + //Tmol->Draw(Form("%s>>Histo[%d]",draws[p].c_str(),p),Form("%s",cuts[p].c_str())); + Tmol->Draw(Form("%s",draws[p].c_str(),p),Form("%s",cuts[p].c_str()),Form("%s",drawOpts[p].c_str())); + TH1* htmp = (TH1*)gROOT->FindObject("htemp"); + + htmp->SetName(Form("Histo[%d]",p)); + htmp->SetTitle(Form("%s",names[p].c_str())); + htmp->SetXTitle(Form("%s",xTitle[p].c_str())); + htmp->SetYTitle(Form("%s",yTitle[p].c_str())); + + htmp->SetStats(1221); //Histo[p]->SetTitle(Form("%s",names[p].c_str())); //Histo[p]->SetXTitle(Form("PEs/radius hit position; Spectrum")); //Histo[p]->SetYTitle(Form("Spectrum")); - Histo[p]->SetStats(1111); - RMS[p] = 1.0*Histo[p]->GetRMS(); - RMSerror[p] = 1.0*Histo[p]->GetRMSError(); - Mean[p] = 1.0*Histo[p]->GetMean(); - Meanerror[p] = 1.0*Histo[p]->GetMeanError(); + //Histo[p]->SetStats(1111); + //RMS[p] = 1.0*Histo[p]->GetRMS(); + //RMSerror[p] = 1.0*Histo[p]->GetRMSError(); + //Mean[p] = 1.0*Histo[p]->GetMean(); + //Meanerror[p] = 1.0*Histo[p]->GetMeanError(); + htmp->SetStats(1111); + RMS[p] = 1.0*htmp->GetRMS(); + RMSerror[p] = 1.0*htmp->GetRMSError(); + Mean[p] = 1.0*htmp->GetMean(); + Meanerror[p] = 1.0*htmp->GetMeanError(); + if (Mean[p]>0){ + c1[p]->SetLogy(); + } //Plot_Name,x_axis_units,x_number,y_number,y_uncertainty // user_reflectivity = 0.9, double user_cerenkov = 1.0, double user_scintillation = 1.0, double user_z_pos = -11.0 @@ -454,40 +493,46 @@ void pePlots(int argcC, char **argvC, std::string fileP="tracking.root", int det //file_out_res< ref_argValues(argValues); + std::vector new_argValues(argValues); + std::vector old_argValues(argValues); + //std::cout<<"TEST " << argValues.at(2); + std::fill(new_argValues.begin(),new_argValues.end(),0.0); + std::fill(old_argValues.begin(),old_argValues.end(),0.0); + /*double ref_x_pos = user_x_pos; double ref_angle = user_angle; double ref_reflectivity = user_reflectivity; double ref_cerenkov = user_cerenkov; double ref_scintillation = user_scintillation; - double ref_z_pos = user_z_pos; + double ref_z_pos = user_z_pos;*/ - double oldx_pos = 0.0; - double oldangle = 0.0; double oldavg = 0.0; double oldavg_err = 0.0; double oldrms = 0.0; double oldrms_err = 0.0; double oldres = 0.0; double oldN_en = 0.0; + /*double oldx_pos = 0.0; + double oldangle = 0.0; double oldreflectivity = 0.0; double oldcerenkov = 0.0; double oldscintillation = 0.0; - double oldz_pos = 0.0; + double oldz_pos = 0.0;*/ - double x_pos = 0.0; - double angle = 0.0; double avg = 0.0; double avg_err = 0.0; double rms = 0.0; double rms_err = 0.0; double res = 0.0; double N_en = 0.0; + /*double new_x_pos = 0.0; + double angle = 0.0; double reflectivity = 0.0; double cerenkov = 0.0; double scintillation = 0.0; - double z_pos = 0.0; + double z_pos = 0.0;*/ - std::cout << "X = " << ref_x_pos << ", angle = " << ref_angle <GetEntries(); // TLeaf* angleL = oldtree->GetLeaf("angle"); - // TLeaf* x_posL = oldtree->GetLeaf("x_pos"); - - // Clear out prior instance if exists - bool prior = true; - if (oldtree->GetBranch("reflectivity")) { - oldtree->SetBranchAddress("reflectivity",&oldreflectivity); - newtree->SetBranchAddress("reflectivity",&reflectivity); - } - else { - newtree->Branch("reflectivity",&reflectivity); - prior = false; - } - if (oldtree->GetBranch("cerenkov")) { - oldtree->SetBranchAddress("cerenkov",&oldcerenkov); - newtree->SetBranchAddress("cerenkov",&cerenkov); - } - else { - newtree->Branch("cerenkov",&cerenkov); - prior = false; - } - if (oldtree->GetBranch("scintillation")) { - oldtree->SetBranchAddress("scintillation",&oldscintillation); - newtree->SetBranchAddress("scintillation",&scintillation); - } - else { - newtree->Branch("scintillation",&scintillation); - prior = false; + // TLeaf* x_posL = oldtree->GetLeaf("new_x_pos"); + + // Clear out prior instance if exists - will replace again later, putting it at the end of the list + //bool prior = false; + int match = 0; + for ( int k = 0 ; k < argNames.size() ; k++ ) { + oldtree->SetBranchAddress(argNames.at(k).c_str(),&old_argValues.at(k)); + newtree->SetBranchAddress(argNames.at(k).c_str(),&argValues.at(k)); } - if (oldtree->GetBranch("z_pos")) { - oldtree->SetBranchAddress("z_pos",&oldz_pos); - newtree->SetBranchAddress("z_pos",&z_pos); - } - else { - newtree->Branch("z_pos",&z_pos); - prior = false; - } - oldtree->SetBranchAddress("angle",&oldangle); - oldtree->SetBranchAddress("x_pos",&oldx_pos); + /*oldtree->SetBranchAddress("angle",&oldangle); + oldtree->SetBranchAddress("new_x_pos",&oldx_pos); + oldtree->SetBranchAddress("reflectivity",&oldreflectivity); + oldtree->SetBranchAddress("cerenkov",&oldcerenkov); + oldtree->SetBranchAddress("scintillation",&oldscintillation); + oldtree->SetBranchAddress("z_pos",&oldz_pos);*/ oldtree->SetBranchAddress("avg_pes",&oldavg); oldtree->SetBranchAddress("avg_pes_err",&oldavg_err); oldtree->SetBranchAddress("rms_pes",&oldrms); oldtree->SetBranchAddress("rms_pes_err",&oldrms_err); oldtree->SetBranchAddress("res",&oldres); oldtree->SetBranchAddress("nentries",&oldN_en); - newtree->SetBranchAddress("angle",&angle); - newtree->SetBranchAddress("x_pos",&x_pos); + /*newtree->SetBranchAddress("angle",&angle); + newtree->SetBranchAddress("new_x_pos",&new_x_pos); + newtree->SetBranchAddress("reflectivity",&reflectivity); + newtree->SetBranchAddress("cerenkov",&cerenkov); + newtree->SetBranchAddress("scintillation",&scintillation); + newtree->SetBranchAddress("z_pos",&z_pos);*/ newtree->SetBranchAddress("avg_pes",&avg); newtree->SetBranchAddress("avg_pes_err",&avg_err); newtree->SetBranchAddress("rms_pes",&rms); newtree->SetBranchAddress("rms_pes_err",&rms_err); newtree->SetBranchAddress("res",&res); newtree->SetBranchAddress("nentries",&N_en); + for (int j = 0 ; j < nent ; j++ ) { // x_posL->GetBranch()->GetEntry(j); // angleL->GetBranch()->GetEntry(j); oldtree->GetEntry(j); - if (ref_x_pos == oldx_pos && ref_angle == oldangle && (!prior || (ref_reflectivity == oldreflectivity && ref_cerenkov == oldcerenkov && ref_scintillation == oldscintillation && ref_z_pos == oldz_pos))) { + for ( int k = 0 ; k < argNames.size() ; k++ ) { + if ( old_argValues.at(k) == ref_argValues.at(k) ) { + match++; + } + new_argValues.at(k) = ref_argValues.at(k); + } + if (match == argNames.size()) continue; + /*if (ref_x_pos == oldx_pos && ref_angle == oldangle && ref_reflectivity == oldreflectivity && ref_cerenkov == oldcerenkov && ref_scintillation == oldscintillation && ref_z_pos == oldz_pos) { + prior = true; //if (ref_x_pos == x_posL->GetValue() && ref_angle == angleL->GetValue()) std::cout << "TEST 1" << std::endl; - continue; - } - x_pos = oldx_pos; - angle = oldangle; + if (prior) { + continue; + } + }*/ avg = oldavg; avg_err = oldavg_err; rms = oldrms; rms_err = oldrms_err; res = oldres; N_en = oldN_en; + /*new_x_pos = oldx_pos; + angle = oldangle; reflectivity = oldreflectivity; cerenkov = oldcerenkov; scintillation = oldscintillation; - z_pos = oldz_pos; - if (!oldtree->GetBranch("reflectivity")) { - reflectivity = 0.9; - } - if (!oldtree->GetBranch("cerenkov")) { - cerenkov = 1.0; - } - if (!oldtree->GetBranch("scintillation")) { - scintillation = 1.0; - } - if (!oldtree->GetBranch("z_pos")) { - z_pos = -11.0; - } + z_pos = oldz_pos;*/ newtree->Fill(); } @@ -608,39 +633,41 @@ void pePlots(int argcC, char **argvC, std::string fileP="tracking.root", int det newtree = new TTree("scans","scans"); // Write new tree - newtree->Branch("angle",&angle); - newtree->Branch("x_pos",&x_pos); + for ( int k = 0 ; k < argNames.size() ; k++ ) { + newtree->Branch(argNames.at(k).c_str(),&new_argValues.at(k)); + } + /*newtree->Branch("angle",&angle); + newtree->Branch("x_pos",&new_x_pos); + newtree->Branch("reflectivity",&reflectivity); + newtree->Branch("cerenkov",&cerenkov); + newtree->Branch("scintillation",&scintillation); + newtree->Branch("z_pos",&z_pos);*/ newtree->Branch("avg_pes",&avg); newtree->Branch("avg_pes_err",&avg_err); newtree->Branch("rms_pes",&rms); newtree->Branch("rms_pes_err",&rms_err); newtree->Branch("res",&res); newtree->Branch("nentries",&N_en); - newtree->Branch("reflectivity",&reflectivity); - newtree->Branch("cerenkov",&cerenkov); - newtree->Branch("scintillation",&scintillation); - newtree->Branch("z_pos",&z_pos); } - newtree->SetBranchAddress("angle",&angle); - newtree->SetBranchAddress("x_pos",&x_pos); + for ( int k = 0 ; k < argNames.size() ; k++ ) { + newtree->SetBranchAddress(argNames.at(k).c_str(),&new_argValues.at(k)); + new_argValues.at(k) = argValues.at(k); + std::cout << argNames.at(k) << " = " << argValues.at(k) << ", "; + } + std::cout<SetBranchAddress("angle",&angle); + newtree->SetBranchAddress("x_pos",&new_x_pos); + newtree->SetBranchAddress("reflectivity",&reflectivity); + newtree->SetBranchAddress("cerenkov",&cerenkov); + newtree->SetBranchAddress("scintillation",&scintillation); + newtree->SetBranchAddress("z_pos",&z_pos);*/ newtree->SetBranchAddress("avg_pes",&avg); newtree->SetBranchAddress("avg_pes_err",&avg_err); newtree->SetBranchAddress("rms_pes",&rms); newtree->SetBranchAddress("rms_pes_err",&rms_err); newtree->SetBranchAddress("res",&res); newtree->SetBranchAddress("nentries",&N_en); - newtree->SetBranchAddress("reflectivity",&reflectivity); - newtree->SetBranchAddress("cerenkov",&cerenkov); - newtree->SetBranchAddress("scintillation",&scintillation); - newtree->SetBranchAddress("z_pos",&z_pos); - - angle = user_angle; - x_pos = user_x_pos; - file_out_rms< 9) + if (argc <= 1) { - std::cerr << "Usage: ./pe char*:filename int:detNumber double:angle double:x_pos double:reflectivity double:cerenkov double:scintillation double:z_pos" << std::endl; + std::cerr << "Usage: ./pe char*:filename int:detNumber [list of: VariableName=Value (char*=double)]" << std::endl; + //std::cerr << "Usage: ./pe char*:filename int:detNumber double:angle double:x_pos double:reflectivity double:cerenkov double:scintillation double:z_pos" << std::endl; //std::cerr << "Usage: ./pe char*:filename int:detid char*:manipulateVariable float:variableValue bool:reanalyze(y or n)" << std::endl; exit(0); } @@ -717,6 +753,23 @@ int main(int argc, char **argv) { detid = atoi(argv[2]); } + + int argN = 4; + std::string argi = ""; + std::vector argNames; + std::vector argValues; + while (argN <= argc) { + argi = argv[argN-1]; + if (argi.find("=") != argi.size()) { + argNames.push_back(argi.substr(0,argi.find("="))); + argValues.push_back(atof(argi.substr(argi.find("=")+1, argi.size() - argi.find("=") ).c_str())); + } + else { + continue; + } + argN++; + } + /* if (argc >= 4) { user_angle = atof(argv[3]); @@ -741,13 +794,15 @@ int main(int argc, char **argv) { user_z_pos = atof(argv[8]); } + */ if (reana == true) { std::cout << "Running with file=" << fileString << ", detid=" << detid << std::endl; pe(fileString, detid); } if (argc >=3){ std::cout << "Plotting previously analyzed file=" << fileString << " + PEs_det_" << detid << ".root" << std::endl; - pePlots(argc, argv, fileString, detid, user_angle, user_x_pos, user_reflectivity, user_cerenkov, user_scintillation, user_z_pos); + //pePlots(argc, argv, fileString, detid, argNames, argValues, user_angle, user_x_pos, user_reflectivity, user_cerenkov, user_scintillation, user_z_pos); + pePlots(fileString, detid, argNames, argValues); } } From c57861a0394e9772fd8e07320738f3d9f932bc71 Mon Sep 17 00:00:00 2001 From: Cameron Clarke Date: Sat, 8 Aug 2020 20:31:43 -0400 Subject: [PATCH 062/443] Script updates to work with new pe.cc --- macros/preserve_ref_scans.mac | 2 +- macros/ref-scan.sh | 2 +- macros/scan.sh | 68 +++++++++++++++++++++++++++-------- macros/sub-ref-scan.sh | 14 ++++---- 4 files changed, 63 insertions(+), 23 deletions(-) diff --git a/macros/preserve_ref_scans.mac b/macros/preserve_ref_scans.mac index 7a79833f4..823f70098 100644 --- a/macros/preserve_ref_scans.mac +++ b/macros/preserve_ref_scans.mac @@ -64,4 +64,4 @@ /remoll/filename remollout_Mainz_0.0_degrees_0.0_x.root -/run/beamOn 10000 +/run/beamOn 5000 diff --git a/macros/ref-scan.sh b/macros/ref-scan.sh index f14fb7898..3db1f5890 100755 --- a/macros/ref-scan.sh +++ b/macros/ref-scan.sh @@ -232,7 +232,7 @@ source remoll.sh qsub runscript_${geom}_${name}.sh fi if [[ "$pass" == "2" ]] ; then - ./pe remollout_${geom}_${name}.root ${det} ${refAngle} ${refLength} ${reflectivity} ${cerenkov} ${scintillation} ${z_point} + ./pe remollout_${geom}_${name}.root ${det} angle\=${refAngle} reflength\=${refLength} reflectivity\=${reflectivity} cerenkov\=${cerenkov} scintillation\=${scintillation} z_pos\=${z_point} convert remollout_${geom}_${name}*.png remollout_${geom}_${name}.pdf rm remollout_${geom}_${name}*.png rm remollout_${geom}_${name}.root diff --git a/macros/scan.sh b/macros/scan.sh index bb3b31016..639dc1ec1 100755 --- a/macros/scan.sh +++ b/macros/scan.sh @@ -11,8 +11,10 @@ if [ "$#" -lt 1 ] ; then echo " ERROR, requires at least one input " + echo " Assumes you have already created the geometry (in ../../remoll-detector-generator/) with the correct parameters and name you want before proceding + " echo " usage: ./scan.sh fixed-non-scanned \"variable-to-scan\" min-of-scan (-30) max-of-scan (30) step-size (0.5) - Takes 11 arguments + Takes 12 arguments Fixed value of non-scanned variable - default = 0.0 Variable to scan (\"angle\" or \"x\") - default = \"angle\" @@ -24,6 +26,7 @@ if [ "$#" -lt 1 ] ; then Scintillation - default = 1.0 z Position of beam origin - default = -11.0 geometry file name - default = \"Mainz\" + pass - default = 1 det number - default = 540210" exit fi @@ -39,6 +42,7 @@ scintillation=1 z_pos=0.0 geom="Mainz" det=540210 +pass="1" if [ "$#" -gt 1 ] ; then scanned="$2" fi @@ -66,8 +70,28 @@ fi if [ "$#" -gt 9 ] ; then geom="${10}" fi +if [[ $geom == "R1" ]] ; then + det=140210 +elif [[ $geom == "R2" ]] ; then + det=240210 +elif [[ $geom == "R3" ]] ; then + det=340210 +elif [[ $geom == "R4" ]] ; then + det=440210 +elif [[ $geom == "R5o" ]] ; then + det=540210 +elif [[ $geom == "R5t" ]] ; then + det=540110 +elif [[ $geom == "R5c" ]] ; then + det=504010 +elif [[ $geom == "R6" ]] ; then + det=640210 +fi if [ "$#" -gt 10 ] ; then - det="${11}" + pass="${11}" +fi +if [ "$#" -gt 11 ] ; then + det="${12}" fi angle=0.0 @@ -136,18 +160,32 @@ do mkdir $tmpFolder fi cd $tmpFolder - cp -p ../../../../bin/remoll . - cp -p ../../../../geometry_Mainz/materialsOptical.xml . - cp -p ../../../../geometry_Mainz/*${geom}.* . - cp ../../../../geometry_Mainz/matrices_${geom}.xml matrices_${geom}.xml - sed -i 's;'" \n \n runscript_${geom}_${name}.sh + chmod 755 runscript_${geom}_${name}.sh + qsub runscript_${geom}_${name}.sh + fi + if [[ "$pass" == "2" ]] ; then + ./pe remollout_${geom}_${name}.root ${det} angle\=${angle} x_pos\=${x_pos} reflectivity\=${reflectivity} cerenkov\=${cerenkov} scintillation\=${scintillation} z_pos\=${z_point} + convert remollout_${geom}_${name}*.png remollout_${geom}_${name}.pdf + rm remollout_${geom}_${name}*.png + rm remollout_${geom}_${name}.root + rm remollout_${geom}_${name}_PEs_det_${det}.root + rm remollout_${geom}_${name}_PEs_det_${det}_plots.root + fi cd - done diff --git a/macros/sub-ref-scan.sh b/macros/sub-ref-scan.sh index a9959d3e8..893e7c191 100755 --- a/macros/sub-ref-scan.sh +++ b/macros/sub-ref-scan.sh @@ -150,13 +150,14 @@ do refAngle=$fixed fi - for wStep in `seq 0 9`; + for wStep in `seq 0 4`; + #for wStep in `seq 0 9`; do for lStep in `seq 0 9`; do - for thetaStepSeq in `seq 0 14`; + for thetaStepSeq in `seq 0 10`; do - thetaSubRef=$(printf "%.1f" "$(bc -l <<< \(-10.0+\(1.0*$thetaStepSeq*2.5\)\))") + thetaSubRef=$(printf "%.1f" "$(bc -l <<< \(-9.0+\(1.0*$thetaStepSeq*3.0\)\))") for phiStepSeq in `seq 0 12`; do phiSubRef=$(printf "%.1f" "$(bc -l <<< \(-30.0+\(1.0*$phiStepSeq*5.0\)\))") @@ -253,11 +254,12 @@ source remoll.sh qsub runscript_${geom}_${name}.sh fi if [[ "$pass" == "2" ]] ; then - ./pe remollout_${geom}_${name}.root ${det} ${refAngle} ${refLength} ${reflectivity} ${cerenkov} ${scintillation} ${z_point} + ./pe remollout_${geom}_${name}.root ${det} angle\=${refAngle} reflength\=${refLength} reflectivity\=${reflectivity} cerenkov\=${cerenkov} scintillation\=${scintillation} z_pos\=${z_point} length_step\=$lStep width_step\=$wStep theta\=$thetaSubRef phi\=$phiSubRef convert remollout_${geom}_${name}*.png remollout_${geom}_${name}.pdf rm remollout_${geom}_${name}*.png - rm remollout_${geom}_${name}.root - rm remollout_${geom}_${name}_PEs_det_${det}.root + #rm remollout_${geom}_${name}.root + rm remollout_${geom}_${name}_*.root + #rm remollout_${geom}_${name}_PEs_det_${det}.root fi cd - done From ad50f63e2341bd6bcb178bd71511f3624d7ab297 Mon Sep 17 00:00:00 2001 From: Cameron Clarke Date: Sun, 9 Aug 2020 12:50:57 -0400 Subject: [PATCH 063/443] Updating some pe.cc cuts and allowing all PNGs to print even if the cuts fail --- analysis/pe/pe.cc | 488 ++++++++++++++++++++++++---------------------- 1 file changed, 250 insertions(+), 238 deletions(-) diff --git a/analysis/pe/pe.cc b/analysis/pe/pe.cc index 142100194..9892bb3e5 100644 --- a/analysis/pe/pe.cc +++ b/analysis/pe/pe.cc @@ -134,13 +134,18 @@ void pe(std::string file="tracking.root", int detid=50001) if (hit.pid == 11 && hit.mtrid == 0){ // Then this is our primary signal of interest // if you do mtrid == 1 then you get the delta rays! About a 1% contribution if (hit.det == detid+1) { + // If the hit is quartz, indicate that quartz is the source of all PEs refSourceDetID = hit.det; + sourceDetID = hit.det; } - sourceDetID = hit.det; + if (refSourceDetID != detid+1) { + // If the no hit has been quartz yet then update it to be whatever the current hit is, this will be overwritten by the above condition if quartz is a secondary hit somehow + refSourceDetID = hit.det; + sourceDetID = hit.det; + } + //sourceDetID = hit.det; // If placed here it would wipe out the parent particle's initial hit if it hits quartz and then onto something else... non-ideal eTRID.push_back(hit.trid); DETID.push_back(hit.det); - if (i<30 && hit.det == 50001){ - } } if (hit.det == detid+1) { // If any particle hits the quartz detector then tell the particle ID and mother ID (so we can keep track of deltas) @@ -354,10 +359,13 @@ void pePlots(std::string fileP, int detid, std::vector &argNames, s "pmtcat.r", "else.npes"}; std::string cuts[n_plots]={"", - Form("ref.det==%d",detid+4), - Form("catpes.detids==%d && catpes.pids==11 && catpes.mtrids==0",detid+1), - Form("catpes.detids==%d && abs(catpes.pids)==11 && catpes.mtrids!=0",detid+1), - Form("catpes.detids==%d && catpes.mtrids!=0",detid+1), + Form("refpes.det==%d",detid+1), + //Form("catpes.detids==%d && catpes.pids==11 && catpes.mtrids==0",detid+1), + Form("catpes.det==%d && catpes.pids==11 && catpes.mtrids==0",detid+1), + //Form("catpes.detids==%d && abs(catpes.pids)==11 && catpes.mtrids!=0",detid+1), + Form("catpes.det==%d && abs(catpes.pids)==11 && catpes.mtrids!=0",detid+1), + //`Form("catpes.detids==%d && catpes.mtrids!=0",detid+1), + Form("catpes.det==%d && catpes.mtrids!=0",detid+1), "ref.npes*(ref.npes!=0)", "refx.npes*(refx.npes!=0)", "", @@ -449,137 +457,222 @@ void pePlots(std::string fileP, int detid, std::vector &argNames, s 100.0}; - for (int p=0;p<2;p++){//n_plots;p++){ + int nGoodEntries = 0; + for (int p=0;pcd(); //Histo[p]=new TH1F(Form("Histo[%d]",p),Form("%s; %s; %s",names[p].c_str(),xTitle[p].c_str(),yTitle[p].c_str()),nbins[p],lowbin[p],highbin[p]); //Histo[p]=new TH1F(); //Histo[p]->SetName(Form("Histo[%d]",p)); //Tmol->Draw(Form("%s>>Histo[%d]",draws[p].c_str(),p),Form("%s",cuts[p].c_str())); - Tmol->Draw(Form("%s",draws[p].c_str(),p),Form("%s",cuts[p].c_str()),Form("%s",drawOpts[p].c_str())); - TH1* htmp = (TH1*)gROOT->FindObject("htemp"); - - htmp->SetName(Form("Histo[%d]",p)); - htmp->SetTitle(Form("%s",names[p].c_str())); - htmp->SetXTitle(Form("%s",xTitle[p].c_str())); - htmp->SetYTitle(Form("%s",yTitle[p].c_str())); - - htmp->SetStats(1221); - - //Histo[p]->SetTitle(Form("%s",names[p].c_str())); - //Histo[p]->SetXTitle(Form("PEs/radius hit position; Spectrum")); - //Histo[p]->SetYTitle(Form("Spectrum")); - - //Histo[p]->SetStats(1111); - //RMS[p] = 1.0*Histo[p]->GetRMS(); - //RMSerror[p] = 1.0*Histo[p]->GetRMSError(); - //Mean[p] = 1.0*Histo[p]->GetMean(); - //Meanerror[p] = 1.0*Histo[p]->GetMeanError(); - htmp->SetStats(1111); - RMS[p] = 1.0*htmp->GetRMS(); - RMSerror[p] = 1.0*htmp->GetRMSError(); - Mean[p] = 1.0*htmp->GetMean(); - Meanerror[p] = 1.0*htmp->GetMeanError(); - if (Mean[p]>0){ - c1[p]->SetLogy(); - } + nGoodEntries = Tmol->Draw(Form("%s",draws[p].c_str(),p),Form("%s",cuts[p].c_str()),Form("%s",drawOpts[p].c_str())); + if (nGoodEntries>0) { + TH1* htmp = (TH1*)gROOT->FindObject("htemp"); + + htmp->SetName(Form("Histo[%d]",p)); + htmp->SetTitle(Form("%s",names[p].c_str())); + htmp->SetXTitle(Form("%s",xTitle[p].c_str())); + htmp->SetYTitle(Form("%s",yTitle[p].c_str())); + + htmp->SetStats(1221); + + //Histo[p]->SetTitle(Form("%s",names[p].c_str())); + //Histo[p]->SetXTitle(Form("PEs/radius hit position; Spectrum")); + //Histo[p]->SetYTitle(Form("Spectrum")); + + //Histo[p]->SetStats(1111); + //RMS[p] = 1.0*Histo[p]->GetRMS(); + //RMSerror[p] = 1.0*Histo[p]->GetRMSError(); + //Mean[p] = 1.0*Histo[p]->GetMean(); + //Meanerror[p] = 1.0*Histo[p]->GetMeanError(); + htmp->SetStats(1111); + RMS[p] = 1.0*htmp->GetRMS(); + RMSerror[p] = 1.0*htmp->GetRMSError(); + Mean[p] = 1.0*htmp->GetMean(); + Meanerror[p] = 1.0*htmp->GetMeanError(); + if (Mean[p]>0){ + c1[p]->SetLogy(); + } - //Plot_Name,x_axis_units,x_number,y_number,y_uncertainty - // user_reflectivity = 0.9, double user_cerenkov = 1.0, double user_scintillation = 1.0, double user_z_pos = -11.0 - if (p==0){ //then a primary electron hit the quartz and we want to see the spectrum - //file_out_rms< ref_argValues(argValues); - std::vector new_argValues(argValues); - std::vector old_argValues(argValues); - //std::cout<<"TEST " << argValues.at(2); - std::fill(new_argValues.begin(),new_argValues.end(),0.0); - std::fill(old_argValues.begin(),old_argValues.end(),0.0); - /*double ref_x_pos = user_x_pos; - double ref_angle = user_angle; - double ref_reflectivity = user_reflectivity; - double ref_cerenkov = user_cerenkov; - double ref_scintillation = user_scintillation; - double ref_z_pos = user_z_pos;*/ - - double oldavg = 0.0; - double oldavg_err = 0.0; - double oldrms = 0.0; - double oldrms_err = 0.0; - double oldres = 0.0; - double oldN_en = 0.0; - /*double oldx_pos = 0.0; - double oldangle = 0.0; - double oldreflectivity = 0.0; - double oldcerenkov = 0.0; - double oldscintillation = 0.0; - double oldz_pos = 0.0;*/ - - double avg = 0.0; - double avg_err = 0.0; - double rms = 0.0; - double rms_err = 0.0; - double res = 0.0; - double N_en = 0.0; - /*double new_x_pos = 0.0; - double angle = 0.0; - double reflectivity = 0.0; - double cerenkov = 0.0; - double scintillation = 0.0; - double z_pos = 0.0;*/ - - //std::cout << "X = " << ref_x_pos << ", angle = " << ref_angle <AccessPathName("scans.root")) { - // Old file exists, read it and add new entries - old_file = TFile::Open("scans.root"); - old_file->GetObject("scans", oldtree); + //Plot_Name,x_axis_units,x_number,y_number,y_uncertainty + // user_reflectivity = 0.9, double user_cerenkov = 1.0, double user_scintillation = 1.0, double user_z_pos = -11.0 + if (p==0){ //then a primary electron hit the quartz and we want to see the spectrum + //file_out_rms< ref_argValues(argValues); + std::vector new_argValues(argValues); + std::vector old_argValues(argValues); + //std::cout<<"TEST " << argValues.at(2); + std::fill(new_argValues.begin(),new_argValues.end(),0.0); + std::fill(old_argValues.begin(),old_argValues.end(),0.0); + /*double ref_x_pos = user_x_pos; + double ref_angle = user_angle; + double ref_reflectivity = user_reflectivity; + double ref_cerenkov = user_cerenkov; + double ref_scintillation = user_scintillation; + double ref_z_pos = user_z_pos;*/ + + double oldavg = 0.0; + double oldavg_err = 0.0; + double oldrms = 0.0; + double oldrms_err = 0.0; + double oldres = 0.0; + double oldN_en = 0.0; + /*double oldx_pos = 0.0; + double oldangle = 0.0; + double oldreflectivity = 0.0; + double oldcerenkov = 0.0; + double oldscintillation = 0.0; + double oldz_pos = 0.0;*/ + + double avg = 0.0; + double avg_err = 0.0; + double rms = 0.0; + double rms_err = 0.0; + double res = 0.0; + double N_en = 0.0; + /*double new_x_pos = 0.0; + double angle = 0.0; + double reflectivity = 0.0; + double cerenkov = 0.0; + double scintillation = 0.0; + double z_pos = 0.0;*/ + + //std::cout << "X = " << ref_x_pos << ", angle = " << ref_angle <AccessPathName("scans.root")) { + // Old file exists, read it and add new entries + old_file = TFile::Open("scans.root"); + old_file->GetObject("scans", oldtree); + new_file.cd(); + if (!oldtree) { + std::cout << "ERROR: Dead scans tree" ; + return; + } + newtree = oldtree->CloneTree(0); + int nent = oldtree->GetEntries(); + + // TLeaf* angleL = oldtree->GetLeaf("angle"); + // TLeaf* x_posL = oldtree->GetLeaf("new_x_pos"); + + // Clear out prior instance if exists - will replace again later, putting it at the end of the list + //bool prior = false; + int match = 0; + for ( int k = 0 ; k < argNames.size() ; k++ ) { + oldtree->SetBranchAddress(argNames.at(k).c_str(),&old_argValues.at(k)); + newtree->SetBranchAddress(argNames.at(k).c_str(),&argValues.at(k)); + } + /*oldtree->SetBranchAddress("angle",&oldangle); + oldtree->SetBranchAddress("new_x_pos",&oldx_pos); + oldtree->SetBranchAddress("reflectivity",&oldreflectivity); + oldtree->SetBranchAddress("cerenkov",&oldcerenkov); + oldtree->SetBranchAddress("scintillation",&oldscintillation); + oldtree->SetBranchAddress("z_pos",&oldz_pos);*/ + oldtree->SetBranchAddress("avg_pes",&oldavg); + oldtree->SetBranchAddress("avg_pes_err",&oldavg_err); + oldtree->SetBranchAddress("rms_pes",&oldrms); + oldtree->SetBranchAddress("rms_pes_err",&oldrms_err); + oldtree->SetBranchAddress("res",&oldres); + oldtree->SetBranchAddress("nentries",&oldN_en); + /*newtree->SetBranchAddress("angle",&angle); + newtree->SetBranchAddress("new_x_pos",&new_x_pos); + newtree->SetBranchAddress("reflectivity",&reflectivity); + newtree->SetBranchAddress("cerenkov",&cerenkov); + newtree->SetBranchAddress("scintillation",&scintillation); + newtree->SetBranchAddress("z_pos",&z_pos);*/ + newtree->SetBranchAddress("avg_pes",&avg); + newtree->SetBranchAddress("avg_pes_err",&avg_err); + newtree->SetBranchAddress("rms_pes",&rms); + newtree->SetBranchAddress("rms_pes_err",&rms_err); + newtree->SetBranchAddress("res",&res); + newtree->SetBranchAddress("nentries",&N_en); + + for (int j = 0 ; j < nent ; j++ ) { + // x_posL->GetBranch()->GetEntry(j); + // angleL->GetBranch()->GetEntry(j); + oldtree->GetEntry(j); + + for ( int k = 0 ; k < argNames.size() ; k++ ) { + if ( old_argValues.at(k) == ref_argValues.at(k) ) { + match++; + } + new_argValues.at(k) = ref_argValues.at(k); + } + if (match == argNames.size()) continue; + /*if (ref_x_pos == oldx_pos && ref_angle == oldangle && ref_reflectivity == oldreflectivity && ref_cerenkov == oldcerenkov && ref_scintillation == oldscintillation && ref_z_pos == oldz_pos) { + prior = true; + //if (ref_x_pos == x_posL->GetValue() && ref_angle == angleL->GetValue()) + std::cout << "TEST 1" << std::endl; + if (prior) { + continue; + } + }*/ + avg = oldavg; + avg_err = oldavg_err; + rms = oldrms; + rms_err = oldrms_err; + res = oldres; + N_en = oldN_en; + /*new_x_pos = oldx_pos; + angle = oldangle; + reflectivity = oldreflectivity; + cerenkov = oldcerenkov; + scintillation = oldscintillation; + z_pos = oldz_pos;*/ + newtree->Fill(); + } + + // Append current run to end + old_file->Close(); + gSystem->Exec("rm scans.root"); + delete old_file; } - newtree = oldtree->CloneTree(0); - int nent = oldtree->GetEntries(); + else { + // Old file doesn't exist, make a new one + new_file.cd(); + newtree = new TTree("scans","scans"); - // TLeaf* angleL = oldtree->GetLeaf("angle"); - // TLeaf* x_posL = oldtree->GetLeaf("new_x_pos"); + // Write new tree + for ( int k = 0 ; k < argNames.size() ; k++ ) { + newtree->Branch(argNames.at(k).c_str(),&new_argValues.at(k)); + } + /*newtree->Branch("angle",&angle); + newtree->Branch("x_pos",&new_x_pos); + newtree->Branch("reflectivity",&reflectivity); + newtree->Branch("cerenkov",&cerenkov); + newtree->Branch("scintillation",&scintillation); + newtree->Branch("z_pos",&z_pos);*/ + newtree->Branch("avg_pes",&avg); + newtree->Branch("avg_pes_err",&avg_err); + newtree->Branch("rms_pes",&rms); + newtree->Branch("rms_pes_err",&rms_err); + newtree->Branch("res",&res); + newtree->Branch("nentries",&N_en); + } - // Clear out prior instance if exists - will replace again later, putting it at the end of the list - //bool prior = false; - int match = 0; for ( int k = 0 ; k < argNames.size() ; k++ ) { - oldtree->SetBranchAddress(argNames.at(k).c_str(),&old_argValues.at(k)); - newtree->SetBranchAddress(argNames.at(k).c_str(),&argValues.at(k)); + newtree->SetBranchAddress(argNames.at(k).c_str(),&new_argValues.at(k)); + new_argValues.at(k) = argValues.at(k); + std::cout << argNames.at(k) << " = " << argValues.at(k) << ", "; } - /*oldtree->SetBranchAddress("angle",&oldangle); - oldtree->SetBranchAddress("new_x_pos",&oldx_pos); - oldtree->SetBranchAddress("reflectivity",&oldreflectivity); - oldtree->SetBranchAddress("cerenkov",&oldcerenkov); - oldtree->SetBranchAddress("scintillation",&oldscintillation); - oldtree->SetBranchAddress("z_pos",&oldz_pos);*/ - oldtree->SetBranchAddress("avg_pes",&oldavg); - oldtree->SetBranchAddress("avg_pes_err",&oldavg_err); - oldtree->SetBranchAddress("rms_pes",&oldrms); - oldtree->SetBranchAddress("rms_pes_err",&oldrms_err); - oldtree->SetBranchAddress("res",&oldres); - oldtree->SetBranchAddress("nentries",&oldN_en); + std::cout<SetBranchAddress("angle",&angle); - newtree->SetBranchAddress("new_x_pos",&new_x_pos); - newtree->SetBranchAddress("reflectivity",&reflectivity); - newtree->SetBranchAddress("cerenkov",&cerenkov); - newtree->SetBranchAddress("scintillation",&scintillation); - newtree->SetBranchAddress("z_pos",&z_pos);*/ + newtree->SetBranchAddress("x_pos",&new_x_pos); + newtree->SetBranchAddress("reflectivity",&reflectivity); + newtree->SetBranchAddress("cerenkov",&cerenkov); + newtree->SetBranchAddress("scintillation",&scintillation); + newtree->SetBranchAddress("z_pos",&z_pos);*/ newtree->SetBranchAddress("avg_pes",&avg); newtree->SetBranchAddress("avg_pes_err",&avg_err); newtree->SetBranchAddress("rms_pes",&rms); @@ -587,126 +680,45 @@ void pePlots(std::string fileP, int detid, std::vector &argNames, s newtree->SetBranchAddress("res",&res); newtree->SetBranchAddress("nentries",&N_en); - for (int j = 0 ; j < nent ; j++ ) { - // x_posL->GetBranch()->GetEntry(j); - // angleL->GetBranch()->GetEntry(j); - oldtree->GetEntry(j); + avg = Mean[p]; + avg_err = Meanerror[p]; + rms = RMS[p]; + rms_err = RMSerror[p]; + res = Mean[p]/RMS[p]; + N_en = (double)N_entries; + /*angle = user_angle; + new_x_pos = user_x_pos; + reflectivity = user_reflectivity; + cerenkov = user_cerenkov; + scintillation = user_scintillation; + z_pos = user_z_pos;*/ + + file_out_rms<Fill(); - } + newtree->Fill(); + newtree->Write("scans",TObject::kOverwrite); + new_file.Close(); - // Append current run to end - old_file->Close(); - gSystem->Exec("rm scans.root"); - delete old_file; - } - else { - // Old file doesn't exist, make a new one - new_file.cd(); - newtree = new TTree("scans","scans"); + gSystem->Exec("mv localTmp.root scans.root"); - // Write new tree - for ( int k = 0 ; k < argNames.size() ; k++ ) { - newtree->Branch(argNames.at(k).c_str(),&new_argValues.at(k)); - } - /*newtree->Branch("angle",&angle); - newtree->Branch("x_pos",&new_x_pos); - newtree->Branch("reflectivity",&reflectivity); - newtree->Branch("cerenkov",&cerenkov); - newtree->Branch("scintillation",&scintillation); - newtree->Branch("z_pos",&z_pos);*/ - newtree->Branch("avg_pes",&avg); - newtree->Branch("avg_pes_err",&avg_err); - newtree->Branch("rms_pes",&rms); - newtree->Branch("rms_pes_err",&rms_err); - newtree->Branch("res",&res); - newtree->Branch("nentries",&N_en); } - - for ( int k = 0 ; k < argNames.size() ; k++ ) { - newtree->SetBranchAddress(argNames.at(k).c_str(),&new_argValues.at(k)); - new_argValues.at(k) = argValues.at(k); - std::cout << argNames.at(k) << " = " << argValues.at(k) << ", "; + if (p==1) { + file_out_ref_rms<SetBranchAddress("angle",&angle); - newtree->SetBranchAddress("x_pos",&new_x_pos); - newtree->SetBranchAddress("reflectivity",&reflectivity); - newtree->SetBranchAddress("cerenkov",&cerenkov); - newtree->SetBranchAddress("scintillation",&scintillation); - newtree->SetBranchAddress("z_pos",&z_pos);*/ - newtree->SetBranchAddress("avg_pes",&avg); - newtree->SetBranchAddress("avg_pes_err",&avg_err); - newtree->SetBranchAddress("rms_pes",&rms); - newtree->SetBranchAddress("rms_pes_err",&rms_err); - newtree->SetBranchAddress("res",&res); - newtree->SetBranchAddress("nentries",&N_en); - - avg = Mean[p]; - avg_err = Meanerror[p]; - rms = RMS[p]; - rms_err = RMSerror[p]; - res = Mean[p]/RMS[p]; - N_en = (double)N_entries; - /*angle = user_angle; - new_x_pos = user_x_pos; - reflectivity = user_reflectivity; - cerenkov = user_cerenkov; - scintillation = user_scintillation; - z_pos = user_z_pos;*/ - - file_out_rms<Exec("mv localTmp.root scans.root"); - - } - if (p ==1 ) { - file_out_ref_rms<cd(); + c1[p]->Write(); + c1[p]->SaveAs(Form("%s_%d.png",fileP.substr(0,fileP.find(".root")).c_str(),p)); } - plotsFile->cd(); - c1[p]->Write(); - c1[p]->SaveAs(Form("%s_%d.png",fileP.substr(0,fileP.find(".root")).c_str(),p)); } file_out_ref_rms.close(); From a4bcee7ea51d65ae618cf30e3b403997c082e693 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 9 Aug 2020 19:07:44 -0500 Subject: [PATCH 064/443] Combined concrete [20cm] and lead [20cm] donut in front of pion --- geometry/donut/donutConcreteLead.gdml | 116 ++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 geometry/donut/donutConcreteLead.gdml diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml new file mode 100644 index 000000000..f57970dd6 --- /dev/null +++ b/geometry/donut/donutConcreteLead.gdml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 1480f7924685409bbf666c8d1ced0ca6f7bf4c0c Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 10 Aug 2020 13:33:36 -0500 Subject: [PATCH 065/443] [remollBeamTarget] Allow running without target volumes This is useful when using the beam generator on parts of the geometry, not the full experiment. --- src/remollBeamTarget.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/remollBeamTarget.cc b/src/remollBeamTarget.cc index 584855941..d69255828 100644 --- a/src/remollBeamTarget.cc +++ b/src/remollBeamTarget.cc @@ -190,14 +190,12 @@ remollVertex remollBeamTarget::SampleVertex(SampType_t samp) if (fTargetMother == 0) { G4cerr << "ERROR: " << __PRETTY_FUNCTION__ << " line " << __LINE__ << ": " << "No target mother volume defined!" << G4endl; - exit(1); } // Check if target volume exists if (fTargetVolumes.size() == 0) { G4cerr << "ERROR: " << __PRETTY_FUNCTION__ << " line " << __LINE__ << ": " << "No target volume defined!" << G4endl; - exit(1); } // Sample raster x and y positions on target From 09f4a1c1de7307e5fdba8e5593501a4261be67d8 Mon Sep 17 00:00:00 2001 From: Vassu Doomra Date: Tue, 11 Aug 2020 12:33:09 -0400 Subject: [PATCH 066/443] parallel_changes --- geometry/mollerParallel.gdml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geometry/mollerParallel.gdml b/geometry/mollerParallel.gdml index c832b7e8f..8795a1704 100644 --- a/geometry/mollerParallel.gdml +++ b/geometry/mollerParallel.gdml @@ -37,7 +37,7 @@ rmax="307" rmin="0" z="1" lunit="mm"/> From d2db86c2e1130841842bebdea6f01cf74d947d1a Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 18 Aug 2020 13:54:44 -0500 Subject: [PATCH 067/443] [GenBeam] /remoll/beamene sets kinetic energy, not total energy --- src/remollGenBeam.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/remollGenBeam.cc b/src/remollGenBeam.cc index db54316d0..50a2735f6 100644 --- a/src/remollGenBeam.cc +++ b/src/remollGenBeam.cc @@ -135,8 +135,8 @@ void remollGenBeam::SamplePhysics(remollVertex * /*vert*/, remollEvent *evt) G4ParticleDefinition* particle = particleTable->FindParticle(fParticleName); // Get initial beam energy instead of using other sampling - double E = fBeamTarg->fBeamEnergy; double m = particle->GetPDGMass(); + double E = fBeamTarg->fBeamEnergy + m; double p = sqrt(E*E - m*m); // Start from mean position From 4c5bd63224c96bd8b2dc825f79c6e04805cddaeb Mon Sep 17 00:00:00 2001 From: Cameron Clarke Date: Sat, 22 Aug 2020 05:24:57 -0400 Subject: [PATCH 068/443] Updating scan scripts --- analysis/bkgd_pe/bkgd_pe.cc | 25 ++++++++------ macros/full-scan.sh | 18 ++++++---- macros/preserve_scans.mac | 4 +-- macros/ref-scan.sh | 5 +-- macros/scan.sh | 65 ++++++++++++++++++++++--------------- 5 files changed, 70 insertions(+), 47 deletions(-) diff --git a/analysis/bkgd_pe/bkgd_pe.cc b/analysis/bkgd_pe/bkgd_pe.cc index c66982224..747006d60 100644 --- a/analysis/bkgd_pe/bkgd_pe.cc +++ b/analysis/bkgd_pe/bkgd_pe.cc @@ -44,7 +44,8 @@ class bkgd { std::string fileString = "tracking.root"; std::string detName = "R5o"; std::string anaStr = "backgrounds"; - double current = 85.0; + double current = 65.0; + double degeneracy = 50.0; double user_angle = 0.0; double user_x_pos = 0.0; double user_reflectivity = 0.7; @@ -312,22 +313,22 @@ void bkgd::bkgd_pe_ana() lookupXpos = lookupTable->GetYaxis()->FindBin(hit.r); lookup = lookupTable->GetBinContent(lookupAngle,lookupXpos); peNumber += lookup; - peRateWeighting += rate*lookup/current; - peAsymmetryWeighting += event.A*rate*lookup/current; + peRateWeighting += rate*lookup/(current*degeneracy); + peAsymmetryWeighting += event.A*rate*lookup/(current*degeneracy); if ( lookup == 0.0 ) { std::cout << "0 PEs" << std::endl; } - std::cout << "PE Hit, rate = " << rate/current << ", Asymmetry = " << event.A << ", lookup pe value = " << lookup << ", bin number " << lookupTable->GetBin(lookupAngle,lookupXpos) << ", " << lookupAngle << ", " << lookupXpos << ", angle = " << (180.0/TMath::Pi())*asin(((hit.px*abs(hit.x) + hit.py*abs(hit.y))/hit.r)/hit.p) << ", abs(x_pos) = " << hit.r << ", which yields: " << peRateWeighting << std::endl; + std::cout << "PE Hit, rate = " << rate/(current*degeneracy) << ", Asymmetry = " << event.A << ", lookup pe value = " << lookup << ", bin number " << lookupTable->GetBin(lookupAngle,lookupXpos) << ", " << lookupAngle << ", " << lookupXpos << ", angle = " << (180.0/TMath::Pi())*asin(((hit.px*abs(hit.x) + hit.py*abs(hit.y))/hit.r)/hit.p) << ", abs(x_pos) = " << hit.r << ", which yields: " << peRateWeighting << std::endl; } if (anaStr == "signals" && (hit.det==detid+1) && hit.pid == 11 && hit.mtrid == 0){ // Then this is our primary signal of interest // if you do mtrid == 1 then you get the delta rays! About a 1% contribution eTRID.push_back(hit.trid); DETID.push_back(hit.det); - lookup = 8.0; - if (detName == "R5o") lookup = 12.0; + lookup = 15.0; + if (detName == "R5o") lookup = 25.0; peNumber += lookup; - peRateWeighting += rate*lookup/current; - peAsymmetryWeighting += event.A*rate*lookup/current; + peRateWeighting += rate*lookup/(current*degeneracy); + peAsymmetryWeighting += event.A*rate*lookup/(current*degeneracy); } if (hit.det == detid+1) { // If any particle hits the quartz detector then tell the particle ID and mother ID (so we can keep track of deltas) @@ -898,9 +899,9 @@ void bkgd::bkgd_pePlots(int argcC, char **argvC) void bkgd::do_pe(int argc, char **argv) { - if (argc <= 1 || argc > 9) + if (argc <= 1 || argc > 10) { - std::cerr << "Usage: ./bkgd_pe char*:filename int:detNumber char*:detName double:reflectivity double:cerenkov double:scintillation double:beamCurrent" << std::endl; + std::cerr << "Usage: ./bkgd_pe char*:filename int:detNumber char*:detName char*:analysis (backgrounds or signals) double:reflectivity double:cerenkov double:scintillation double:beamCurrent double:degeneracy (Number of duplicate sample jobs)" << std::endl; //std::cerr << "Usage: ./pe char*:filename int:detid char*:manipulateVariable float:variableValue bool:reanalyze(y or n)" << std::endl; exit(0); } @@ -939,6 +940,10 @@ void bkgd::do_pe(int argc, char **argv) { current = atof(argv[8]); } + if (argc >=10) + { + degeneracy = atof(argv[9]); + } get_lookuptable(); if (reana == true) { diff --git a/macros/full-scan.sh b/macros/full-scan.sh index 8a382a62e..2a58ec854 100755 --- a/macros/full-scan.sh +++ b/macros/full-scan.sh @@ -4,23 +4,27 @@ geom="R5o" if [ "$#" -lt 1 ] ; then echo " ERROR, requires at least one input " - echo " usage: ./full-scan.sh \"geometry = R5o\" [reflectivity = 0.7] [x step size (cm) = 1.0] [angle step size (degrees) = 0.1]" + echo " usage: ./full-scan.sh \"geometry = R5o\" [analysis pass = 1] [reflectivity = 0.7] [x step size (cm) = 1.0] [angle step size (degrees) = 0.1]" exit else geom=$1 fi -reflectivity=0.7 +analysis=1 # Submit jobs = 1, analyze jobs = 2 +reflectivity=0.8 xPosStep=1.0 # 1 cm steps angleStep=0.1 # 60 steps per x pos if [ "$#" -gt 1 ] ; then - reflectivity=$2 + analysis=$2 fi if [ "$#" -gt 2 ] ; then - xPosStep=$3 + reflectivity=$3 fi if [ "$#" -gt 3 ] ; then - angleStep=$4 + xPosStep=$4 +fi +if [ "$#" -gt 4 ] ; then + angleStep=$5 fi xPosMin=1040.0 # Reflector begin xPosMax=1350.0 # PMT begin @@ -71,7 +75,7 @@ do lgAngle=$lg_angle z_p=$(printf "%.2f" "$(bc -l <<< ${z1}-0.5*$qThick-$refL*s\(\(${ref_angle}-${lg_angle}\)*3.14159/180.0\))") echo "$ring $xPosMin $xPosMax z = $z_p starting z = $z1 and second = $z2" -done < cadp.csv +done < cadp_shortened.csv IFS=$OLDIFS @@ -84,5 +88,5 @@ do z_pos=$(printf "%.1f" "$(bc -l <<< 0.1*$z_p-\(-1.0*$x_pos-0.1*$xPosMin\)*s\(${lgAngle}*3.14159/180.0\))") echo "$x_pos $z_pos" - ./scan.sh $x_pos angle $angleMin $angleMax $angleStep $reflectivity 1 1 $z_pos $geom $det & + ./scan.sh $x_pos angle $angleMin $angleMax $angleStep $reflectivity 1 1 $z_pos $geom ${analysis} $det & done diff --git a/macros/preserve_scans.mac b/macros/preserve_scans.mac index 58d38a1db..fcdc757b8 100644 --- a/macros/preserve_scans.mac +++ b/macros/preserve_scans.mac @@ -58,10 +58,10 @@ #/remoll/evgen/beam/direction -0.19937 0.0 0.97992 /remoll/evgen/beam/rasx 2.5 mm /remoll/evgen/beam/rasy 10.0 mm -/remoll/beamene 11000 MeV +/remoll/beamene 8000 MeV /remoll/evgen/beam/partName e- /remoll/filename remollout_Mainz_0.0_degrees_0.0_x.root -/run/beamOn 100000 +/run/beamOn 10000 diff --git a/macros/ref-scan.sh b/macros/ref-scan.sh index 3db1f5890..f9bc3940f 100755 --- a/macros/ref-scan.sh +++ b/macros/ref-scan.sh @@ -232,11 +232,12 @@ source remoll.sh qsub runscript_${geom}_${name}.sh fi if [[ "$pass" == "2" ]] ; then + cp ../../../../analysis/bin/pe . ./pe remollout_${geom}_${name}.root ${det} angle\=${refAngle} reflength\=${refLength} reflectivity\=${reflectivity} cerenkov\=${cerenkov} scintillation\=${scintillation} z_pos\=${z_point} convert remollout_${geom}_${name}*.png remollout_${geom}_${name}.pdf rm remollout_${geom}_${name}*.png - rm remollout_${geom}_${name}.root - rm remollout_${geom}_${name}_PEs_det_${det}.root + #rm remollout_${geom}_${name}.root + #rm remollout_${geom}_${name}_PEs_det_${det}.root fi cd - done diff --git a/macros/scan.sh b/macros/scan.sh index 639dc1ec1..0266c8904 100755 --- a/macros/scan.sh +++ b/macros/scan.sh @@ -90,6 +90,7 @@ fi if [ "$#" -gt 10 ] ; then pass="${11}" fi +secondpass="$pass" if [ "$#" -gt 11 ] ; then det="${12}" fi @@ -130,25 +131,27 @@ do angle=$fixed fi name="${angle}_degrees_${x_pos}_x_${z_pos}_z_${reflectivity}_ref_${cerenkov}_cer_${scintillation}_scint" - cp preserve_scans.mac scans_${geom}_${name}.mac - # FIXME This angle is hardcoded to the qsim-matching case!! - # 0.1994 = sin(11.5 degrees), $fixed is the distance from 0.0, + is farther towards PMT, further back away from +z axis - # 0.104528 = sin(6 degrees) - z_point=$z_pos - # FIXME doing z_pos as external input only now, for full detector array setting - #z_point=$(printf "%.1f" "$(bc -l <<< ${z_pos}+\($x_pos*0.1045\))") - # FIXME z_point and x offset relationships assume the detector is immediately downstream of the origin, and ideally centered at the middle of the lightguide - #z_point=$(printf "%.1f" "$(bc -l <<< -11.0-\($fixed*0.1994\))") - sed -i 's;'"/remoll/evgen/beam/th -11.5 deg"';'"/remoll/evgen/beam/th ${angle} deg"';g' scans_${geom}_${name}.mac - sed -i 's;'"/remoll/evgen/beam/origin 0.0 0.0 0.0 mm"';'"/remoll/evgen/beam/origin ${x_pos} 0.0 ${z_point} cm"';g' scans_${geom}_${name}.mac + if [[ "$pass" == "1" ]] ; then + cp preserve_scans.mac scans_${geom}_${name}.mac + # FIXME This angle is hardcoded to the qsim-matching case!! + # 0.1994 = sin(11.5 degrees), $fixed is the distance from 0.0, + is farther towards PMT, further back away from +z axis + # 0.104528 = sin(6 degrees) + z_point=$z_pos + # FIXME doing z_pos as external input only now, for full detector array setting + #z_point=$(printf "%.1f" "$(bc -l <<< ${z_pos}+\($x_pos*0.1045\))") + # FIXME z_point and x offset relationships assume the detector is immediately downstream of the origin, and ideally centered at the middle of the lightguide + #z_point=$(printf "%.1f" "$(bc -l <<< -11.0-\($fixed*0.1994\))") + sed -i 's;'"/remoll/evgen/beam/th -11.5 deg"';'"/remoll/evgen/beam/th ${angle} deg"';g' scans_${geom}_${name}.mac + sed -i 's;'"/remoll/evgen/beam/origin 0.0 0.0 0.0 mm"';'"/remoll/evgen/beam/origin ${x_pos} 0.0 ${z_point} cm"';g' scans_${geom}_${name}.mac - sed -i 's;'"/remoll/setgeofile geometry_Mainz/mollerMother_Mainz.gdml"';'"/remoll/setgeofile mollerMother_${geom}.gdml"';g' scans_${geom}_${name}.mac + sed -i 's;'"/remoll/setgeofile geometry_Mainz/mollerMother_Mainz.gdml"';'"/remoll/setgeofile mollerMother_${geom}.gdml"';g' scans_${geom}_${name}.mac - sed -i 's;'"/remoll/evgen/beam/rasterRefZ 0.0 mm"';'"/remoll/evgen/beam/rasterRefZ ${z_point} cm"';g' scans_${geom}_${name}.mac + sed -i 's;'"/remoll/evgen/beam/rasterRefZ 0.0 mm"';'"/remoll/evgen/beam/rasterRefZ ${z_point} cm"';g' scans_${geom}_${name}.mac - sed -i 's;'"/process/optical/processActivation Cerenkov false"';'"/process/optical/processActivation Cerenkov ${cer}"';g' scans_${geom}_${name}.mac - sed -i 's;'"/process/optical/processActivation Scintillation false"';'"/process/optical/processActivation Scintillation ${scint}"';g' scans_${geom}_${name}.mac - sed -i 's;'"Mainz_0.0_degrees_0.0_x.root"';'"${geom}_${name}.root"';g' scans_${geom}_${name}.mac + sed -i 's;'"/process/optical/processActivation Cerenkov false"';'"/process/optical/processActivation Cerenkov ${cer}"';g' scans_${geom}_${name}.mac + sed -i 's;'"/process/optical/processActivation Scintillation false"';'"/process/optical/processActivation Scintillation ${scint}"';g' scans_${geom}_${name}.mac + sed -i 's;'"Mainz_0.0_degrees_0.0_x.root"';'"${geom}_${name}.root"';g' scans_${geom}_${name}.mac + fi tmpFolder="scans/$geom/out_${geom}_${name}" if [ ! -d scans ] ; then mkdir scans @@ -160,8 +163,25 @@ do mkdir $tmpFolder fi cd $tmpFolder - if [[ "$pass" == "1" ]] ; then - cp -p ../../../../bin/remoll . + if [[ "$pass" == "2" ]] ; then + if [[ ! -f remollout_${geom}_${name}.pdf ]] ; then + cp ../../../../analysis/bin/pe . + if [[ ! -f remollout_${geom}_${name}.root ]] ; then + echo "Error, no remollout_${geom}_${name}.root file, retrying analysis" + secondpass="1" + else + ./pe remollout_${geom}_${name}.root ${det} angle\=${angle} x_pos\=${x_pos} reflectivity\=${reflectivity} cerenkov\=${cerenkov} scintillation\=${scintillation} z_pos\=${z_point} + convert remollout_${geom}_${name}*.png remollout_${geom}_${name}.pdf + rm remollout_${geom}_${name}*.png + #rm remollout_${geom}_${name}.root + rm remollout_${geom}_${name}_PEs_det_${det}.root + rm remollout_${geom}_${name}_PEs_det_${det}_plots.root + fi + fi + fi + if [[ "$pass" == "1" || "$secondpass" == "1" ]] ; then + cp -p ../../../../build/remoll . + cp -p ../../../../bin/remoll.sh . cp -p ../../../../geometry_Mainz/materialsOptical.xml . cp -p ../../../../geometry_Mainz/*${geom}.* . cp ../../../../geometry_Mainz/matrices_${geom}.xml matrices_${geom}.xml @@ -179,13 +199,6 @@ source remoll.sh chmod 755 runscript_${geom}_${name}.sh qsub runscript_${geom}_${name}.sh fi - if [[ "$pass" == "2" ]] ; then - ./pe remollout_${geom}_${name}.root ${det} angle\=${angle} x_pos\=${x_pos} reflectivity\=${reflectivity} cerenkov\=${cerenkov} scintillation\=${scintillation} z_pos\=${z_point} - convert remollout_${geom}_${name}*.png remollout_${geom}_${name}.pdf - rm remollout_${geom}_${name}*.png - rm remollout_${geom}_${name}.root - rm remollout_${geom}_${name}_PEs_det_${det}.root - rm remollout_${geom}_${name}_PEs_det_${det}_plots.root - fi cd - + secondpass="$pass" done From c04ccfa5ffa8af46f8937cd59486f157651bcb9c Mon Sep 17 00:00:00 2001 From: Cameron Clarke Date: Sat, 22 Aug 2020 07:38:33 -0400 Subject: [PATCH 069/443] Correcting PE plot reflector bounce counter. now simply count reflector hits for a known PE track ID --- analysis/pe/include/pe.hh | 5 +- analysis/pe/include/petypes.hh | 1 + analysis/pe/pe.cc | 96 ++++++++++++++++++++++++++++------ 3 files changed, 85 insertions(+), 17 deletions(-) diff --git a/analysis/pe/include/pe.hh b/analysis/pe/include/pe.hh index 5ed7db3d0..07ea9ee35 100644 --- a/analysis/pe/include/pe.hh +++ b/analysis/pe/include/pe.hh @@ -1,10 +1,13 @@ #include "remolltypes.hh" #include "petypes.hh" -catPEs_t catPEsTrim(int sourcedetid, std::vector sourcedetids, std::vector quartzpids, std::vector quartzmtrids, size_t peLen, std::vector cathitx, std::vector cathity, std::vector cathitz) +catPEs_t catPEsTrim(int sourcedetid, std::vector sourcedetids, std::vector quartzpids, std::vector quartzmtrids, size_t peLen, double all_bounces, double ref_bounces, double lg_bounces, std::vector cathitx, std::vector cathity, std::vector cathitz) { catPEs_t newHit; newHit.npes=peLen; + newHit.all_bounces=all_bounces; + newHit.ref_bounces=ref_bounces; + newHit.lg_bounces=lg_bounces; newHit.det=sourcedetid; newHit.detids=sourcedetids; newHit.pids=quartzpids; diff --git a/analysis/pe/include/petypes.hh b/analysis/pe/include/petypes.hh index 6455bd54e..68126aaa6 100644 --- a/analysis/pe/include/petypes.hh +++ b/analysis/pe/include/petypes.hh @@ -21,6 +21,7 @@ struct catPEs_t { // The full spectrum regardless of source int npes; // PE counts per event + double all_bounces, ref_bounces, lg_bounces; int det; // store the source det ID too std::vector detids; // store the source det IDs too std::vector mtrids; // store the source mtrids too diff --git a/analysis/pe/pe.cc b/analysis/pe/pe.cc index 9892bb3e5..e0cef2d3d 100644 --- a/analysis/pe/pe.cc +++ b/analysis/pe/pe.cc @@ -65,6 +65,7 @@ void pe(std::string file="tracking.root", int detid=50001) oldTree->SetBranchAddress("part", &fPart); std::vector < catPEs_t > *catPEs = new std::vector < catPEs_t > ; std::vector < catPEs_t > *refPEs = new std::vector < catPEs_t > ; + std::vector < catPEs_t > *bouncePEs = new std::vector < catPEs_t > ; std::vector < hitPEs_t > *Q = new std::vector < hitPEs_t > ; std::vector < hitPEs_t > *Ref = new std::vector < hitPEs_t > ; std::vector < hitPEs_t > *RefX = new std::vector < hitPEs_t > ; @@ -76,6 +77,7 @@ void pe(std::string file="tracking.root", int detid=50001) std::vector < catPEs_t > *elseX = new std::vector < catPEs_t > ; std::vector eTRID; std::vector refTRID; + std::vector lgTRID; std::vector DETID; std::vector PID; std::vector MTRID; @@ -88,6 +90,9 @@ void pe(std::string file="tracking.root", int detid=50001) int LGaircounted = 0; int PMTbulkcounted = 0; int detSourcedPEs = 0; + double all_bounces = 0; + double ref_bounces = 0; + double lg_bounces = 0; double N_entries = 0; //TODO reading data into envelopes downstream could be sped up @@ -96,6 +101,7 @@ void pe(std::string file="tracking.root", int detid=50001) newTree->Branch("nentries", &N_entries); newTree->Branch("catpes", &catPEs); newTree->Branch("refpes", &refPEs); + newTree->Branch("bouncepes", &bouncePEs); newTree->Branch("q", &Q); newTree->Branch("ref", &Ref); newTree->Branch("refx", &RefX); @@ -152,6 +158,9 @@ void pe(std::string file="tracking.root", int detid=50001) PID.push_back(hit.pid); MTRID.push_back(hit.mtrid); } + if (hit.pid == 0 && ( hit.det == detid+5 || hit.det == detid+3 ) ){ // 5 = LG, 3 = other side of reflector... + lgTRID.push_back(hit.trid); + } if (hit.pid == 0 && hit.det == detid+4){ refTRID.push_back(hit.trid); } @@ -168,19 +177,42 @@ void pe(std::string file="tracking.root", int detid=50001) for (size_t i = 0; i < fHit->size();i++) { remollGenericDetectorHit_t hit = fHit->at(i); - for (size_t k = 0; k < refTRID.size(); k++) + for (size_t k = 0; k < peTRID.size(); k++) { - //std::cout<< "Checking reflector hit track ID = " << refTRID.at(k) << " Against hit track ID = " << hit.trid << std::endl; - if (hit.pid==0 && hit.trid == refTRID.at(k)) { - //std::cout<< "Reflector hit - Match found" << std::endl; - for (size_t l = 0; l < peTRID.size(); l++) + //std::cout<< "Checking cathode hit track ID = " << peTRID.at(k) << " Against hit track ID = " << hit.trid << std::endl; + if (hit.pid==0 && hit.trid == peTRID.at(k)) { + if (hit.det == detid+3 || hit.det == detid+5) + { // FIXME Explicitly count bounces + //std::cout<< "Lightguide or other side of reflector hit - Match found" << std::endl; + lg_bounces = lg_bounces +1.0; + all_bounces = all_bounces+1.0; // Because of how this loop works... looping over the hits will get a positive track==lg+PMT hit twice (so only add 1/2 per identified hit) + } + if (hit.det == detid+4) { - //std::cout<< "Checking cathode hit track ID = " << peTRID.at(l) << " Against hit track ID = " << hit.trid << std::endl; - if (hit.trid == peTRID.at(l)) { - //std::cout<< "Cathode hit - Match found" << std::endl; - refHit = refHit+0.5; // Because of how this loop works... looping over the hits will get a positive track==ref+PMT hit twice (so only add 1/2 per identified hit) + ref_bounces = ref_bounces+1.0; + all_bounces = all_bounces+1.0; + refHit = refHit+1.0; // Because of how this loop works... looping over the hits will get a positive track==ref+PMT hit twice (so only add 1/2 per identified hit) + } + //std::cout<< "Cathode hit - Match found" << std::endl; + /*for (size_t l = 0; l < lgTRID.size(); l++) + { // FIXME Implicitly count bounces + //std::cout<< "Checking lg hit track ID = " << lgTRID.at(l) << " Against hit track ID = " << hit.trid << std::endl; + if (hit.trid == lgTRID.at(l) && hit.trid == peTRID.at(k) && hit.det != detid) { + //std::cout<< "Lightguide or other side of reflector hit - Match found" << std::endl; + lg_bounces = lg_bounces +1.0; + all_bounces = all_bounces+1.0; // Because of how this loop works... looping over the hits will get a positive track==lg+PMT hit twice (so only add 1/2 per identified hit) } } + for (size_t l = 0; l < refTRID.size(); l++) + { + //std::cout<< "Checking ref hit track ID = " << refTRID.at(l) << " Against hit track ID = " << hit.trid << std::endl; + if (hit.trid == refTRID.at(l) && hit.trid == peTRID.at(k) && hit.det != detid) { + //std::cout<< "Reflector hit - Match found" << std::endl; + ref_bounces = ref_bounces+1.0; + all_bounces = all_bounces+1.0; + refHit = refHit+1.0; // Because of how this loop works... looping over the hits will get a positive track==ref+PMT hit twice (so only add 1/2 per identified hit) + } + }*/ } } for (size_t k = 0; k < eTRID.size(); k++) @@ -229,16 +261,23 @@ void pe(std::string file="tracking.root", int detid=50001) } } if (refHit>=1.0) { - refPEs->push_back(catPEsTrim(refSourceDetID,DETID,PID,MTRID,(int)refHit,cathitx,cathity,cathitz)); + refPEs->push_back(catPEsTrim(refSourceDetID,DETID,PID,MTRID,(int)refHit,0,0,0,cathitx,cathity,cathitz)); } else { - refPEs->push_back(catPEsTrim(refSourceDetID,DETID,PID,MTRID,0,cathitx,cathity,cathitz)); + refPEs->push_back(catPEsTrim(refSourceDetID,DETID,PID,MTRID,0,0,0,0,cathitx,cathity,cathitz)); } refHit=0; - catPEs->push_back(catPEsTrim(sourceDetID,DETID,PID,MTRID,(int)peTRID.size(),cathitx,cathity,cathitz)); detSourcedPEs=(int)peTRID.size(); - elseX->push_back(catPEsTrim(sourceDetID,DETID,PID,MTRID,((int)peTRID.size()-detSourcedPEs),cathitx,cathity,cathitz)); - N_entries = oldTree->GetEntries(); + catPEs->push_back(catPEsTrim(sourceDetID,DETID,PID,MTRID,detSourcedPEs,0,0,0,cathitx,cathity,cathitz)); + bouncePEs->push_back(catPEsTrim(sourceDetID,DETID,PID,MTRID,detSourcedPEs,all_bounces/detSourcedPEs,ref_bounces/detSourcedPEs,lg_bounces/detSourcedPEs,cathitx,cathity,cathitz)); + if (sourceDetID == detid+1) { + // If it is a quartz sourced hit then proceed empty, else add number of PEs + elseX->push_back(catPEsTrim(sourceDetID,DETID,PID,MTRID,0,0,0,0,cathitx,cathity,cathitz)); + } + else { + elseX->push_back(catPEsTrim(sourceDetID,DETID,PID,MTRID,detSourcedPEs,0,0,0,cathitx,cathity,cathitz)); + } + N_entries = (double)oldTree->GetEntries(); //if (catPEs->size() > 0){ newTree->Fill(); //} @@ -249,10 +288,15 @@ void pe(std::string file="tracking.root", int detid=50001) detSourcedPEs=0; refSourceDetID=0; sourceDetID=0; + all_bounces=0; + ref_bounces=0; + lg_bounces=0; eTRID.clear(); + lgTRID.clear(); refTRID.clear(); refPEs->clear(); catPEs->clear(); + bouncePEs->clear(); elseX->clear(); Q->clear(); Refair->clear(); @@ -324,7 +368,7 @@ void pePlots(std::string fileP, int detid, std::vector &argNames, s set_plot_style(); - const int n_plots = 13; + const int n_plots = 16; TH1F *Histo[n_plots]; double RMS[n_plots]; double RMSerror[n_plots]; @@ -333,10 +377,13 @@ void pePlots(std::string fileP, int detid, std::vector &argNames, s TCanvas * c1[n_plots]; std::string names[n_plots]={"Total Cathode Spectrum per event", - "Reflector bounces Cathode PEs", + "Reflector bounced Cathode PEs", "Cathode Spectrum from primary signal quartz electrons only", "Cathode Spectrum from quartz deltas", "Cathode Spectrum from all non-primary quartz signals", + "Number of bounces for a Cathode PE off of ref plus LG", + "Number of bounces for a Cathode PE off of ref", + "Number of bounces for a Cathode PE off of LG", "e- hit radial hit spectrum on the reflector", // Consider adding photon xyz tracking too - would have to go beside the cathode xyz tracking feature "e- hit radial hit spectrum on the quartz-reflector holder", "Cathode Spectrum from the reflector air", @@ -350,6 +397,9 @@ void pePlots(std::string fileP, int detid, std::vector &argNames, s "catpes.npes", "catpes.npes", "catpes.npes", + "bouncepes.all_bounces", + "bouncepes.ref_bounces", + "bouncepes.lg_bounces", "ref.r", "refx.r", "refair.npes", @@ -366,6 +416,9 @@ void pePlots(std::string fileP, int detid, std::vector &argNames, s Form("catpes.det==%d && abs(catpes.pids)==11 && catpes.mtrids!=0",detid+1), //`Form("catpes.detids==%d && catpes.mtrids!=0",detid+1), Form("catpes.det==%d && catpes.mtrids!=0",detid+1), + "", + "", + "", "ref.npes*(ref.npes!=0)", "refx.npes*(refx.npes!=0)", "", @@ -387,12 +440,18 @@ void pePlots(std::string fileP, int detid, std::vector &argNames, s "", "", "", + "", + "", + "", ""}; std::string xTitle[n_plots]={"PEs", "PEs", "PEs", "PEs", "PEs", + "Bounces", + "Bounces", + "Bounces", "PMT spectrum vs. Radial Hit Position (mm)", "PMT spectrum vs. Radial Hit Position (mm)", "PEs", @@ -406,6 +465,9 @@ void pePlots(std::string fileP, int detid, std::vector &argNames, s "Spectrum", "Spectrum", "Spectrum", + "Bounce Counter", + "Bounce Counter", + "Bounce Counter", "Counts Spectrum", "Counts Spectrum", "Spectrum", @@ -414,6 +476,7 @@ void pePlots(std::string fileP, int detid, std::vector &argNames, s "Counts", "Counts", "Spectrum"}; + /* int nbins[n_plots]={100, 100, 100, @@ -455,6 +518,7 @@ void pePlots(std::string fileP, int detid, std::vector &argNames, s 1400.0, 1250.0, 100.0}; + */ int nGoodEntries = 0; From ce29e860dd89a6a37911c1b8f768cd61bfe23410 Mon Sep 17 00:00:00 2001 From: Cameron Clarke Date: Mon, 24 Aug 2020 06:45:01 -0400 Subject: [PATCH 070/443] Adding more analyses to pe.cc output rootfile --- analysis/pe/pe.cc | 558 +++++++++++++++++----------- geometry_Mainz/materialsOptical.xml | 64 +++- macros/ref-scan.sh | 1 + 3 files changed, 405 insertions(+), 218 deletions(-) diff --git a/analysis/pe/pe.cc b/analysis/pe/pe.cc index e0cef2d3d..9ebf4836d 100644 --- a/analysis/pe/pe.cc +++ b/analysis/pe/pe.cc @@ -65,6 +65,8 @@ void pe(std::string file="tracking.root", int detid=50001) oldTree->SetBranchAddress("part", &fPart); std::vector < catPEs_t > *catPEs = new std::vector < catPEs_t > ; std::vector < catPEs_t > *refPEs = new std::vector < catPEs_t > ; + std::vector < catPEs_t > *lgPEs = new std::vector < catPEs_t > ; + std::vector < catPEs_t > *straightPEs = new std::vector < catPEs_t > ; std::vector < catPEs_t > *bouncePEs = new std::vector < catPEs_t > ; std::vector < hitPEs_t > *Q = new std::vector < hitPEs_t > ; std::vector < hitPEs_t > *Ref = new std::vector < hitPEs_t > ; @@ -85,11 +87,15 @@ void pe(std::string file="tracking.root", int detid=50001) int refSourceDetID = 0; int sourceDetID = 0; double refHit = 0; + double lgHit = 0; + double straightHit = 0; int Qcounted = 0; int Refaircounted = 0; int LGaircounted = 0; int PMTbulkcounted = 0; int detSourcedPEs = 0; + int refSourced = 0; + int lgSourced = 0; double all_bounces = 0; double ref_bounces = 0; double lg_bounces = 0; @@ -101,6 +107,8 @@ void pe(std::string file="tracking.root", int detid=50001) newTree->Branch("nentries", &N_entries); newTree->Branch("catpes", &catPEs); newTree->Branch("refpes", &refPEs); + newTree->Branch("lgpes", &lgPEs); + newTree->Branch("straightpes", &straightPEs); newTree->Branch("bouncepes", &bouncePEs); newTree->Branch("q", &Q); newTree->Branch("ref", &Ref); @@ -119,6 +127,8 @@ void pe(std::string file="tracking.root", int detid=50001) } refHit = 0; + lgHit = 0; + straightHit = 0; oldTree->GetEntry(j); //std::cout << "Hits: " << fHit->size() << std::endl; //std::cout << "Parts: " << fPart->size() << std::endl; @@ -185,35 +195,38 @@ void pe(std::string file="tracking.root", int detid=50001) { // FIXME Explicitly count bounces //std::cout<< "Lightguide or other side of reflector hit - Match found" << std::endl; lg_bounces = lg_bounces +1.0; - all_bounces = all_bounces+1.0; // Because of how this loop works... looping over the hits will get a positive track==lg+PMT hit twice (so only add 1/2 per identified hit) + all_bounces = all_bounces+1.0; } if (hit.det == detid+4) { ref_bounces = ref_bounces+1.0; all_bounces = all_bounces+1.0; - refHit = refHit+1.0; // Because of how this loop works... looping over the hits will get a positive track==ref+PMT hit twice (so only add 1/2 per identified hit) } //std::cout<< "Cathode hit - Match found" << std::endl; - /*for (size_t l = 0; l < lgTRID.size(); l++) + for (size_t l = 0; l < lgTRID.size(); l++) { // FIXME Implicitly count bounces //std::cout<< "Checking lg hit track ID = " << lgTRID.at(l) << " Against hit track ID = " << hit.trid << std::endl; - if (hit.trid == lgTRID.at(l) && hit.trid == peTRID.at(k) && hit.det != detid) { - //std::cout<< "Lightguide or other side of reflector hit - Match found" << std::endl; - lg_bounces = lg_bounces +1.0; - all_bounces = all_bounces+1.0; // Because of how this loop works... looping over the hits will get a positive track==lg+PMT hit twice (so only add 1/2 per identified hit) + if (hit.trid == lgTRID.at(l) && hit.trid == peTRID.at(k) && hit.det == detid) { + //std::cout<< "Lightguide or other side of reflector hit track matches PE track and hit == cathode - Match found, PE from light guide verified" << std::endl; + lgHit = lgHit+1.0; + lgSourced = 1; } } for (size_t l = 0; l < refTRID.size(); l++) { //std::cout<< "Checking ref hit track ID = " << refTRID.at(l) << " Against hit track ID = " << hit.trid << std::endl; - if (hit.trid == refTRID.at(l) && hit.trid == peTRID.at(k) && hit.det != detid) { - //std::cout<< "Reflector hit - Match found" << std::endl; - ref_bounces = ref_bounces+1.0; - all_bounces = all_bounces+1.0; - refHit = refHit+1.0; // Because of how this loop works... looping over the hits will get a positive track==ref+PMT hit twice (so only add 1/2 per identified hit) + if (hit.trid == refTRID.at(l) && hit.trid == peTRID.at(k) && hit.det == detid) { + //std::cout<< "Reflector hit track matches PE track and hit == cathode - Match found, PE from reflector verified" << std::endl; + refHit = refHit+1.0; + refSourced = 1; } - }*/ + } + if (!refSourced && !lgSourced && hit.det == detid) { + straightHit = straightHit+1.0; + } } + refSourced = 0; + lgSourced = 0; } for (size_t k = 0; k < eTRID.size(); k++) { @@ -263,12 +276,18 @@ void pe(std::string file="tracking.root", int detid=50001) if (refHit>=1.0) { refPEs->push_back(catPEsTrim(refSourceDetID,DETID,PID,MTRID,(int)refHit,0,0,0,cathitx,cathity,cathitz)); } - else { - refPEs->push_back(catPEsTrim(refSourceDetID,DETID,PID,MTRID,0,0,0,0,cathitx,cathity,cathitz)); + if (lgHit>=1.0) { + lgPEs->push_back(catPEsTrim(refSourceDetID,DETID,PID,MTRID,(int)lgHit,0,0,0,cathitx,cathity,cathitz)); + } + if (straightHit>=1.0) { + straightPEs->push_back(catPEsTrim(refSourceDetID,DETID,PID,MTRID,(int)straightHit,0,0,0,cathitx,cathity,cathitz)); } refHit=0; + lgHit=0; + straightHit=0; detSourcedPEs=(int)peTRID.size(); catPEs->push_back(catPEsTrim(sourceDetID,DETID,PID,MTRID,detSourcedPEs,0,0,0,cathitx,cathity,cathitz)); + // FIXME: Bounces here are avg per event... but could store a vector or push back one number of bounces per PE and then the histogram would have entries == number of PEs bouncePEs->push_back(catPEsTrim(sourceDetID,DETID,PID,MTRID,detSourcedPEs,all_bounces/detSourcedPEs,ref_bounces/detSourcedPEs,lg_bounces/detSourcedPEs,cathitx,cathity,cathitz)); if (sourceDetID == detid+1) { // If it is a quartz sourced hit then proceed empty, else add number of PEs @@ -295,6 +314,8 @@ void pe(std::string file="tracking.root", int detid=50001) lgTRID.clear(); refTRID.clear(); refPEs->clear(); + lgPEs->clear(); + straightPEs->clear(); catPEs->clear(); bouncePEs->clear(); elseX->clear(); @@ -368,16 +389,19 @@ void pePlots(std::string fileP, int detid, std::vector &argNames, s set_plot_style(); - const int n_plots = 16; + const int n_plots = 18; TH1F *Histo[n_plots]; double RMS[n_plots]; double RMSerror[n_plots]; double Mean[n_plots]; double Meanerror[n_plots]; + double Nentries[n_plots]; TCanvas * c1[n_plots]; std::string names[n_plots]={"Total Cathode Spectrum per event", - "Reflector bounced Cathode PEs", + "Quartz sourced, Reflector bounced Cathode PEs", + "Quartz sourced, Lightguide bounced Cathode PEs", + "Quartz sourced, No bounce straight shot Cathode PEs", "Cathode Spectrum from primary signal quartz electrons only", "Cathode Spectrum from quartz deltas", "Cathode Spectrum from all non-primary quartz signals", @@ -394,6 +418,8 @@ void pePlots(std::string fileP, int detid, std::vector &argNames, s "Cathode Spectrum from elsewhere"}; std::string draws[n_plots]={"catpes.npes", "refpes.npes", + "lgpes.npes", + "straightpes.npes", "catpes.npes", "catpes.npes", "catpes.npes", @@ -410,6 +436,8 @@ void pePlots(std::string fileP, int detid, std::vector &argNames, s "else.npes"}; std::string cuts[n_plots]={"", Form("refpes.det==%d",detid+1), + Form("lgpes.det==%d",detid+1), + Form("straightpes.det==%d",detid+1), //Form("catpes.detids==%d && catpes.pids==11 && catpes.mtrids==0",detid+1), Form("catpes.det==%d && catpes.pids==11 && catpes.mtrids==0",detid+1), //Form("catpes.detids==%d && abs(catpes.pids)==11 && catpes.mtrids!=0",detid+1), @@ -443,12 +471,16 @@ void pePlots(std::string fileP, int detid, std::vector &argNames, s "", "", "", + "", + "", ""}; std::string xTitle[n_plots]={"PEs", "PEs", "PEs", "PEs", "PEs", + "PEs", + "PEs", "Bounces", "Bounces", "Bounces", @@ -465,6 +497,8 @@ void pePlots(std::string fileP, int detid, std::vector &argNames, s "Spectrum", "Spectrum", "Spectrum", + "Spectrum", + "Spectrum", "Bounce Counter", "Bounce Counter", "Bounce Counter", @@ -522,14 +556,276 @@ void pePlots(std::string fileP, int detid, std::vector &argNames, s int nGoodEntries = 0; + + std::vector ref_argValues(argValues); + std::vector new_argValues(argValues); + std::vector old_argValues(argValues); + //std::cout<<"TEST " << argValues.at(2); + std::fill(new_argValues.begin(),new_argValues.end(),0.0); + std::fill(old_argValues.begin(),old_argValues.end(),0.0); + /*double ref_x_pos = user_x_pos; + double ref_angle = user_angle; + double ref_reflectivity = user_reflectivity; + double ref_cerenkov = user_cerenkov; + double ref_scintillation = user_scintillation; + double ref_z_pos = user_z_pos; + double oldx_pos = 0.0; + double oldangle = 0.0; + double oldreflectivity = 0.0; + double oldcerenkov = 0.0; + double oldscintillation = 0.0; + double oldz_pos = 0.0;*/ + + // Avg will include all PEs: regardless of where the electron that sourced it came from or what surfaces it bounced off of + double oldavg = 0.0; + double oldavg_err = 0.0; + double oldrms = 0.0; + double oldrms_err = 0.0; + double oldres = 0.0; + double oldN_en = 0.0; + // Quartz-electron hitting sourced PEs: which bounce off of LG, Ref, nothing, or agnostic + double oldavg_Qsourced_refHit = 0.0; + double oldavg_Qsourced_lgHit = 0.0; + double oldavg_Qsourced_straightHit = 0.0; + double oldavg_Qsourced_primaries = 0.0; + // Per-event averaged number of bounces off of surfaces before hitting PMT cathode + // FIXME Could fill per-PE instead of avg per event if wanted + double oldavg_allbounce = 0.0; + double oldavg_refbounce = 0.0; + double oldavg_lgbounce = 0.0; + + // NEW fills + double avg = 0.0; + double avg_err = 0.0; + double rms = 0.0; + double rms_err = 0.0; + double res = 0.0; + double N_en = 0.0; + + double avg_Qsourced_refHit = 0.0; + double avg_Qsourced_lgHit = 0.0; + double avg_Qsourced_straightHit = 0.0; + double avg_Qsourced_primaries = 0.0; + + double avg_allbounce = 0.0; + double avg_refbounce = 0.0; + double avg_lgbounce = 0.0; + + /*double new_x_pos = 0.0; + double angle = 0.0; + double reflectivity = 0.0; + double cerenkov = 0.0; + double scintillation = 0.0; + double z_pos = 0.0;*/ + + //std::cout << "X = " << ref_x_pos << ", angle = " << ref_angle <AccessPathName("scans.root")) { + // Old file exists, read it and add new entries + old_file = TFile::Open("scans.root"); + old_file->GetObject("scans", oldtree); + new_file.cd(); + if (!oldtree) { + std::cout << "ERROR: Dead scans tree" ; + return; + } + newtree = oldtree->CloneTree(0); + int nent = oldtree->GetEntries(); + + // TLeaf* angleL = oldtree->GetLeaf("angle"); + // TLeaf* x_posL = oldtree->GetLeaf("new_x_pos"); + + // Clear out prior instance if exists - will replace again later, putting it at the end of the list + //bool prior = false; + int match = 0; + for ( int k = 0 ; k < argNames.size() ; k++ ) { + oldtree->SetBranchAddress(argNames.at(k).c_str(),&old_argValues.at(k)); + newtree->SetBranchAddress(argNames.at(k).c_str(),&argValues.at(k)); + } + /*oldtree->SetBranchAddress("angle",&oldangle); + oldtree->SetBranchAddress("new_x_pos",&oldx_pos); + oldtree->SetBranchAddress("reflectivity",&oldreflectivity); + oldtree->SetBranchAddress("cerenkov",&oldcerenkov); + oldtree->SetBranchAddress("scintillation",&oldscintillation); + oldtree->SetBranchAddress("z_pos",&oldz_pos);*/ + oldtree->SetBranchAddress("avg_pes",&oldavg); + oldtree->SetBranchAddress("avg_pes_err",&oldavg_err); + oldtree->SetBranchAddress("rms_pes",&oldrms); + oldtree->SetBranchAddress("rms_pes_err",&oldrms_err); + oldtree->SetBranchAddress("res",&oldres); + oldtree->SetBranchAddress("nentries",&oldN_en); + + oldtree->SetBranchAddress("avg_Qsourced_refHit_pes", &oldavg_Qsourced_refHit); + oldtree->SetBranchAddress("avg_Qsourced_lgHit_pes", &oldavg_Qsourced_lgHit); + oldtree->SetBranchAddress("avg_Qsourced_straightHit_pes", &oldavg_Qsourced_straightHit); + oldtree->SetBranchAddress("avg_Qsourced_primaries_pes", &oldavg_Qsourced_primaries); + + oldtree->SetBranchAddress("avg_all_bounces", &oldavg_allbounce); + oldtree->SetBranchAddress("avg_ref_bounces", &oldavg_refbounce); + oldtree->SetBranchAddress("avg_lg_bounces", &oldavg_lgbounce); + /*newtree->SetBranchAddress("angle",&angle); + newtree->SetBranchAddress("new_x_pos",&new_x_pos); + newtree->SetBranchAddress("reflectivity",&reflectivity); + newtree->SetBranchAddress("cerenkov",&cerenkov); + newtree->SetBranchAddress("scintillation",&scintillation); + newtree->SetBranchAddress("z_pos",&z_pos);*/ + newtree->SetBranchAddress("avg_pes",&avg); + newtree->SetBranchAddress("avg_pes_err",&avg_err); + newtree->SetBranchAddress("rms_pes",&rms); + newtree->SetBranchAddress("rms_pes_err",&rms_err); + newtree->SetBranchAddress("res",&res); + newtree->SetBranchAddress("nentries",&N_en); + + newtree->SetBranchAddress("avg_Qsourced_refHit_pes", &avg_Qsourced_refHit); + newtree->SetBranchAddress("avg_Qsourced_lgHit_pes", &avg_Qsourced_lgHit); + newtree->SetBranchAddress("avg_Qsourced_straightHit_pes", &avg_Qsourced_straightHit); + newtree->SetBranchAddress("avg_Qsourced_primaries_pes", &avg_Qsourced_primaries); + + newtree->SetBranchAddress("avg_all_bounces", &avg_allbounce); + newtree->SetBranchAddress("avg_ref_bounces", &avg_refbounce); + newtree->SetBranchAddress("avg_lg_bounces", &avg_lgbounce); + + for (int j = 0 ; j < nent ; j++ ) { + // x_posL->GetBranch()->GetEntry(j); + // angleL->GetBranch()->GetEntry(j); + oldtree->GetEntry(j); + + for ( int k = 0 ; k < argNames.size() ; k++ ) { + if ( old_argValues.at(k) == ref_argValues.at(k) ) { + match++; + } + new_argValues.at(k) = ref_argValues.at(k); + } + if (match == argNames.size()) continue; + /*if (ref_x_pos == oldx_pos && ref_angle == oldangle && ref_reflectivity == oldreflectivity && ref_cerenkov == oldcerenkov && ref_scintillation == oldscintillation && ref_z_pos == oldz_pos) { + prior = true; + //if (ref_x_pos == x_posL->GetValue() && ref_angle == angleL->GetValue()) + std::cout << "TEST 1" << std::endl; + if (prior) { + continue; + } + }*/ + avg = oldavg; + avg_err = oldavg_err; + rms = oldrms; + rms_err = oldrms_err; + res = oldres; + N_en = oldN_en; + + avg_Qsourced_refHit = oldavg_Qsourced_refHit; + avg_Qsourced_lgHit = oldavg_Qsourced_lgHit; + avg_Qsourced_straightHit = oldavg_Qsourced_straightHit; + avg_Qsourced_primaries = oldavg_Qsourced_primaries; + + avg_allbounce = oldavg_allbounce; + avg_refbounce = oldavg_refbounce; + avg_lgbounce = oldavg_lgbounce; + + /*new_x_pos = oldx_pos; + angle = oldangle; + reflectivity = oldreflectivity; + cerenkov = oldcerenkov; + scintillation = oldscintillation; + z_pos = oldz_pos;*/ + newtree->Fill(); + } + + // Append current run to end + old_file->Close(); + gSystem->Exec("rm scans.root"); + delete old_file; + } + else { + // Old file doesn't exist, make a new one + new_file.cd(); + newtree = new TTree("scans","scans"); + + // Write new tree + for ( int k = 0 ; k < argNames.size() ; k++ ) { + newtree->Branch(argNames.at(k).c_str(),&new_argValues.at(k)); + } + /*newtree->Branch("angle",&angle); + newtree->Branch("x_pos",&new_x_pos); + newtree->Branch("reflectivity",&reflectivity); + newtree->Branch("cerenkov",&cerenkov); + newtree->Branch("scintillation",&scintillation); + newtree->Branch("z_pos",&z_pos);*/ + newtree->Branch("avg_pes",&avg); + newtree->Branch("avg_pes_err",&avg_err); + newtree->Branch("rms_pes",&rms); + newtree->Branch("rms_pes_err",&rms_err); + newtree->Branch("res",&res); + newtree->Branch("nentries",&N_en); + + newtree->Branch("avg_Qsourced_refHit_pes", &avg_Qsourced_refHit); + newtree->Branch("avg_Qsourced_lgHit_pes", &avg_Qsourced_lgHit); + newtree->Branch("avg_Qsourced_straightHit_pes", &avg_Qsourced_straightHit); + newtree->Branch("avg_Qsourced_primaries_pes", &avg_Qsourced_primaries); + + newtree->Branch("avg_all_bounces", &avg_allbounce); + newtree->Branch("avg_ref_bounces", &avg_refbounce); + newtree->Branch("avg_lg_bounces", &avg_lgbounce); + } + + for ( int k = 0 ; k < argNames.size() ; k++ ) { + newtree->SetBranchAddress(argNames.at(k).c_str(),&new_argValues.at(k)); + new_argValues.at(k) = argValues.at(k); + std::cout << argNames.at(k) << " = " << argValues.at(k) << ", "; + } + std::cout<SetBranchAddress("angle",&angle); + newtree->SetBranchAddress("x_pos",&new_x_pos); + newtree->SetBranchAddress("reflectivity",&reflectivity); + newtree->SetBranchAddress("cerenkov",&cerenkov); + newtree->SetBranchAddress("scintillation",&scintillation); + newtree->SetBranchAddress("z_pos",&z_pos);*/ + newtree->SetBranchAddress("avg_pes",&avg); + newtree->SetBranchAddress("avg_pes_err",&avg_err); + newtree->SetBranchAddress("rms_pes",&rms); + newtree->SetBranchAddress("rms_pes_err",&rms_err); + newtree->SetBranchAddress("res",&res); + newtree->SetBranchAddress("nentries",&N_en); + + newtree->SetBranchAddress("avg_Qsourced_refHit_pes", &avg_Qsourced_refHit); + newtree->SetBranchAddress("avg_Qsourced_lgHit_pes", &avg_Qsourced_lgHit); + newtree->SetBranchAddress("avg_Qsourced_straightHit_pes", &avg_Qsourced_straightHit); + newtree->SetBranchAddress("avg_Qsourced_primaries_pes", &avg_Qsourced_primaries); + + newtree->SetBranchAddress("avg_all_bounces", &avg_allbounce); + newtree->SetBranchAddress("avg_ref_bounces", &avg_refbounce); + newtree->SetBranchAddress("avg_lg_bounces", &avg_lgbounce); + + // DONE scans.root setup + // Clean up defaults, don't just copy prior good entry if appending new data to existing scans.root + + avg = 0.0; + avg_err = 0.0; + rms = 0.0; + rms_err = 0.0; + res = 0.0; + N_en = 0.0; + avg_Qsourced_refHit = 0.0; + avg_Qsourced_lgHit = 0.0; + avg_Qsourced_straightHit = 0.0; + avg_Qsourced_primaries = 0.0; + avg_allbounce = 0.0; + avg_refbounce = 0.0; + avg_lgbounce = 0.0; + for (int p=0;pcd(); - //Histo[p]=new TH1F(Form("Histo[%d]",p),Form("%s; %s; %s",names[p].c_str(),xTitle[p].c_str(),yTitle[p].c_str()),nbins[p],lowbin[p],highbin[p]); + //Histo[p]=new TH1F(Form("Histo[%d]",p),Form("%s; %s; %s",names[p].c_str(),xTitle[p].c_str(),yTitle[p].c_str()),nbins[p],lowbin[p],highbin[p]); //Histo[p]=new TH1F(); //Histo[p]->SetName(Form("Histo[%d]",p)); - //Tmol->Draw(Form("%s>>Histo[%d]",draws[p].c_str(),p),Form("%s",cuts[p].c_str())); + //Tmol->Draw(Form("%s>>Histo[%d]",draws[p].c_str(),p),Form("%s",cuts[p].c_str())); nGoodEntries = Tmol->Draw(Form("%s",draws[p].c_str(),p),Form("%s",cuts[p].c_str()),Form("%s",drawOpts[p].c_str())); if (nGoodEntries>0) { TH1* htmp = (TH1*)gROOT->FindObject("htemp"); @@ -555,6 +851,7 @@ void pePlots(std::string fileP, int detid, std::vector &argNames, s RMSerror[p] = 1.0*htmp->GetRMSError(); Mean[p] = 1.0*htmp->GetMean(); Meanerror[p] = 1.0*htmp->GetMeanError(); + Nentries[p] = 1.0*htmp->GetEntries(); if (Mean[p]>0){ c1[p]->SetLogy(); } @@ -567,189 +864,12 @@ void pePlots(std::string fileP, int detid, std::vector &argNames, s //file_out_mean< ref_argValues(argValues); - std::vector new_argValues(argValues); - std::vector old_argValues(argValues); - //std::cout<<"TEST " << argValues.at(2); - std::fill(new_argValues.begin(),new_argValues.end(),0.0); - std::fill(old_argValues.begin(),old_argValues.end(),0.0); - /*double ref_x_pos = user_x_pos; - double ref_angle = user_angle; - double ref_reflectivity = user_reflectivity; - double ref_cerenkov = user_cerenkov; - double ref_scintillation = user_scintillation; - double ref_z_pos = user_z_pos;*/ - - double oldavg = 0.0; - double oldavg_err = 0.0; - double oldrms = 0.0; - double oldrms_err = 0.0; - double oldres = 0.0; - double oldN_en = 0.0; - /*double oldx_pos = 0.0; - double oldangle = 0.0; - double oldreflectivity = 0.0; - double oldcerenkov = 0.0; - double oldscintillation = 0.0; - double oldz_pos = 0.0;*/ - - double avg = 0.0; - double avg_err = 0.0; - double rms = 0.0; - double rms_err = 0.0; - double res = 0.0; - double N_en = 0.0; - /*double new_x_pos = 0.0; - double angle = 0.0; - double reflectivity = 0.0; - double cerenkov = 0.0; - double scintillation = 0.0; - double z_pos = 0.0;*/ - - //std::cout << "X = " << ref_x_pos << ", angle = " << ref_angle <AccessPathName("scans.root")) { - // Old file exists, read it and add new entries - old_file = TFile::Open("scans.root"); - old_file->GetObject("scans", oldtree); - new_file.cd(); - if (!oldtree) { - std::cout << "ERROR: Dead scans tree" ; - return; - } - newtree = oldtree->CloneTree(0); - int nent = oldtree->GetEntries(); - - // TLeaf* angleL = oldtree->GetLeaf("angle"); - // TLeaf* x_posL = oldtree->GetLeaf("new_x_pos"); - - // Clear out prior instance if exists - will replace again later, putting it at the end of the list - //bool prior = false; - int match = 0; - for ( int k = 0 ; k < argNames.size() ; k++ ) { - oldtree->SetBranchAddress(argNames.at(k).c_str(),&old_argValues.at(k)); - newtree->SetBranchAddress(argNames.at(k).c_str(),&argValues.at(k)); - } - /*oldtree->SetBranchAddress("angle",&oldangle); - oldtree->SetBranchAddress("new_x_pos",&oldx_pos); - oldtree->SetBranchAddress("reflectivity",&oldreflectivity); - oldtree->SetBranchAddress("cerenkov",&oldcerenkov); - oldtree->SetBranchAddress("scintillation",&oldscintillation); - oldtree->SetBranchAddress("z_pos",&oldz_pos);*/ - oldtree->SetBranchAddress("avg_pes",&oldavg); - oldtree->SetBranchAddress("avg_pes_err",&oldavg_err); - oldtree->SetBranchAddress("rms_pes",&oldrms); - oldtree->SetBranchAddress("rms_pes_err",&oldrms_err); - oldtree->SetBranchAddress("res",&oldres); - oldtree->SetBranchAddress("nentries",&oldN_en); - /*newtree->SetBranchAddress("angle",&angle); - newtree->SetBranchAddress("new_x_pos",&new_x_pos); - newtree->SetBranchAddress("reflectivity",&reflectivity); - newtree->SetBranchAddress("cerenkov",&cerenkov); - newtree->SetBranchAddress("scintillation",&scintillation); - newtree->SetBranchAddress("z_pos",&z_pos);*/ - newtree->SetBranchAddress("avg_pes",&avg); - newtree->SetBranchAddress("avg_pes_err",&avg_err); - newtree->SetBranchAddress("rms_pes",&rms); - newtree->SetBranchAddress("rms_pes_err",&rms_err); - newtree->SetBranchAddress("res",&res); - newtree->SetBranchAddress("nentries",&N_en); - - for (int j = 0 ; j < nent ; j++ ) { - // x_posL->GetBranch()->GetEntry(j); - // angleL->GetBranch()->GetEntry(j); - oldtree->GetEntry(j); - - for ( int k = 0 ; k < argNames.size() ; k++ ) { - if ( old_argValues.at(k) == ref_argValues.at(k) ) { - match++; - } - new_argValues.at(k) = ref_argValues.at(k); - } - if (match == argNames.size()) continue; - /*if (ref_x_pos == oldx_pos && ref_angle == oldangle && ref_reflectivity == oldreflectivity && ref_cerenkov == oldcerenkov && ref_scintillation == oldscintillation && ref_z_pos == oldz_pos) { - prior = true; - //if (ref_x_pos == x_posL->GetValue() && ref_angle == angleL->GetValue()) - std::cout << "TEST 1" << std::endl; - if (prior) { - continue; - } - }*/ - avg = oldavg; - avg_err = oldavg_err; - rms = oldrms; - rms_err = oldrms_err; - res = oldres; - N_en = oldN_en; - /*new_x_pos = oldx_pos; - angle = oldangle; - reflectivity = oldreflectivity; - cerenkov = oldcerenkov; - scintillation = oldscintillation; - z_pos = oldz_pos;*/ - newtree->Fill(); - } - - // Append current run to end - old_file->Close(); - gSystem->Exec("rm scans.root"); - delete old_file; - } - else { - // Old file doesn't exist, make a new one - new_file.cd(); - newtree = new TTree("scans","scans"); - - // Write new tree - for ( int k = 0 ; k < argNames.size() ; k++ ) { - newtree->Branch(argNames.at(k).c_str(),&new_argValues.at(k)); - } - /*newtree->Branch("angle",&angle); - newtree->Branch("x_pos",&new_x_pos); - newtree->Branch("reflectivity",&reflectivity); - newtree->Branch("cerenkov",&cerenkov); - newtree->Branch("scintillation",&scintillation); - newtree->Branch("z_pos",&z_pos);*/ - newtree->Branch("avg_pes",&avg); - newtree->Branch("avg_pes_err",&avg_err); - newtree->Branch("rms_pes",&rms); - newtree->Branch("rms_pes_err",&rms_err); - newtree->Branch("res",&res); - newtree->Branch("nentries",&N_en); - } - - for ( int k = 0 ; k < argNames.size() ; k++ ) { - newtree->SetBranchAddress(argNames.at(k).c_str(),&new_argValues.at(k)); - new_argValues.at(k) = argValues.at(k); - std::cout << argNames.at(k) << " = " << argValues.at(k) << ", "; - } - std::cout<SetBranchAddress("angle",&angle); - newtree->SetBranchAddress("x_pos",&new_x_pos); - newtree->SetBranchAddress("reflectivity",&reflectivity); - newtree->SetBranchAddress("cerenkov",&cerenkov); - newtree->SetBranchAddress("scintillation",&scintillation); - newtree->SetBranchAddress("z_pos",&z_pos);*/ - newtree->SetBranchAddress("avg_pes",&avg); - newtree->SetBranchAddress("avg_pes_err",&avg_err); - newtree->SetBranchAddress("rms_pes",&rms); - newtree->SetBranchAddress("rms_pes_err",&rms_err); - newtree->SetBranchAddress("res",&res); - newtree->SetBranchAddress("nentries",&N_en); - avg = Mean[p]; avg_err = Meanerror[p]; rms = RMS[p]; rms_err = RMSerror[p]; res = Mean[p]/RMS[p]; - N_en = (double)N_entries; + N_en = Nentries[p]; // (double)N_entries; // N_entries = number of events in simulation /*angle = user_angle; new_x_pos = user_x_pos; reflectivity = user_reflectivity; @@ -761,30 +881,50 @@ void pePlots(std::string fileP, int detid, std::vector &argNames, s std::cout<Exec("mv localTmp.root scans.root"); - } if (p==1) { file_out_ref_rms<cd(); c1[p]->Write(); c1[p]->SaveAs(Form("%s_%d.png",fileP.substr(0,fileP.find(".root")).c_str(),p)); + + //std::cout << "TEST 2 X = " << x_pos << ", angle = " << angle <Fill(); + newtree->Write("scans",TObject::kOverwrite); + new_file.Close(); + + gSystem->Exec("mv localTmp.root scans.root"); + file_out_ref_rms.close(); file_out_ref_mean.close(); file_out_ref_res.close(); diff --git a/geometry_Mainz/materialsOptical.xml b/geometry_Mainz/materialsOptical.xml index 07e35e64d..e1ab08090 100644 --- a/geometry_Mainz/materialsOptical.xml +++ b/geometry_Mainz/materialsOptical.xml @@ -29,6 +29,24 @@ + + + + + + + + + + + + + + + + + + @@ -42,20 +60,48 @@ - - + + - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -66,8 +112,8 @@ - - - + + + diff --git a/macros/ref-scan.sh b/macros/ref-scan.sh index f9bc3940f..94d58fc9b 100755 --- a/macros/ref-scan.sh +++ b/macros/ref-scan.sh @@ -233,6 +233,7 @@ source remoll.sh fi if [[ "$pass" == "2" ]] ; then cp ../../../../analysis/bin/pe . + echo "./pe remollout_${geom}_${name}.root ${det} angle\=${refAngle} reflength\=${refLength} reflectivity\=${reflectivity} cerenkov\=${cerenkov} scintillation\=${scintillation} z_pos\=${z_point}" ./pe remollout_${geom}_${name}.root ${det} angle\=${refAngle} reflength\=${refLength} reflectivity\=${reflectivity} cerenkov\=${cerenkov} scintillation\=${scintillation} z_pos\=${z_point} convert remollout_${geom}_${name}*.png remollout_${geom}_${name}.pdf rm remollout_${geom}_${name}*.png From c204537258297461cb2cca4320252d05989c9559 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 30 Aug 2020 20:31:31 -0500 Subject: [PATCH 071/443] Gui: updated detectors, field map, etc. --- macros/gui.mac | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/macros/gui.mac b/macros/gui.mac index f88854805..d56a6fe87 100644 --- a/macros/gui.mac +++ b/macros/gui.mac @@ -23,11 +23,7 @@ # Geometry menu : /gui/addMenu geom "1. Geometry" /gui/addButton geom geometry/mollerMother.gdml "/remoll/geometry/setfile geometry/mollerMother.gdml" -/gui/addButton geom geometry/mollerMother_dump.gdml "/remoll/geometry/setfile geometry/mollerMother_dump.gdml" -/gui/addButton geom geometry/mollerMother_empty.gdml "/remoll/geometry/setfile geometry/mollerMother_empty.gdml" /gui/addButton geom geometry/mollerMother_merged.gdml "/remoll/geometry/setfile geometry/mollerMother_merged.gdml" -/gui/addButton geom geometry/mollerMother_trackingOnly.gdml "/remoll/geometry/setfile geometry/mollerMother_trackingOnly.gdml" -/gui/addButton geom geometry/mollerMother_showerMaxOnly.gdml "/remoll/geometry/setfile geometry/mollerMother_showerMaxOnly.gdml" /gui/addButton geom geometry/pionDetectorLucite.gdml "/remoll/geometry/setfile geometry/pion/Lucite/pionDetectorLucite_world.gdml" /gui/addButton geom geometry/showerMaxDetector.gdml "/remoll/geometry/setfile geometry/showerMaxDetector.gdml" /gui/addButton geom geometry/mollerParallel.gdml "/remoll/parallel/setfile geometry/mollerParallel.gdml" @@ -54,32 +50,30 @@ # # Viewer menu : /gui/addMenu view "4. Viewer" -#/gui/addButton view "My viewer" "/control/execute vis/myVis.mac" -#/gui/addButton view "OIX viewer" "/control/execute vis/OIX.mac" -#/gui/addButton view "X viewer" "/control/execute vis/X.mac" /gui/addButton view "Qt viewer (immediate)" "/control/execute vis/IQt.mac" -/gui/addButton view "Qt viewer (stored)" "/control/execute vis/SQt.mac" -/gui/addButton view "Draw real world" "/vis/drawVolume world" -/gui/addButton view "Draw all worlds" "/vis/drawVolume worlds" -/gui/addButton view "Set style solid" "/vis/viewer/set/style s" -/gui/addButton view "Set style wire" "/vis/viewer/set/style w" +/gui/addButton view "Qt viewer (stored)" "/control/execute vis/SQt.mac" +/gui/addButton view "Load vis settings" "/control/execute vis/vis.mac" +/gui/addButton view "Load cutaway settings" "/control/execute vis/cutaway.mac" +/gui/addButton view "Draw real world" "/vis/drawVolume world" +/gui/addButton view "Draw all worlds" "/vis/drawVolume worlds" +/gui/addButton view "Set style surface" "/vis/viewer/set/style surface" +/gui/addButton view "Set style wireframe" "/vis/viewer/set/style wireframe" /gui/addButton view "Hide tracks behind objects" "/vis/viewer/set/hiddenMarker true" /gui/addButton view "Show tracks behind objects" "/vis/viewer/set/hiddenMarker false" -/gui/addButton view "Front view" "/vis/viewer/set/viewpointThetaPhi 180 0 deg" -/gui/addButton view "Back view" "/vis/viewer/set/viewpointThetaPhi 0 0 deg" -/gui/addButton view "Side 1 view" "/vis/viewer/set/viewpointThetaPhi 90 180 deg" -/gui/addButton view "Side 2 view" "/vis/viewer/set/viewpointThetaPhi -90 180 deg" -/gui/addButton view "Top view" "/vis/viewer/set/viewpointThetaPhi 90 90 deg" -/gui/addButton view "Cutaway" "/control/execute vis/cutaway.mac" -/gui/addButton view "Mag fields" "/vis/scene/add/magneticField 50" -/gui/addButton view "Update view" "/vis/viewer/update" -/gui/addButton view "Update scene" "/vis/scene/notifyHandlers" -/gui/addButton view "Reset scene" "/control/execute vis/vis.mac" +/gui/addButton view "Front view (+Z)" "/vis/viewer/set/viewpointThetaPhi 180 0 deg" +/gui/addButton view "Back view (-Z)" "/vis/viewer/set/viewpointThetaPhi 0 0 deg" +/gui/addButton view "Side 1 view (+X)" "/vis/viewer/set/viewpointThetaPhi 90 180 deg" +/gui/addButton view "Side 2 view (-X)" "/vis/viewer/set/viewpointThetaPhi -90 180 deg" +/gui/addButton view "Top view (-Y) "/vis/viewer/set/viewpointThetaPhi 90 90 deg" +/gui/addButton view "Mag fields" "/vis/scene/add/magneticField 50" +/gui/addButton view "Refresh viewer (retraverse graphical data)" "/vis/viewer/refresh" +/gui/addButton view "Update viewer (interaction or end-of-file)" "/vis/viewer/update" +/gui/addButton view "Flush viewer (= refresh + update)" "/vis/viewer/flush" +/gui/addButton view "Update scene" "/vis/scene/notifyHandlers" # # Run menu : /gui/addMenu field "5. Fields" -/gui/addButton field "blockyHybrid_rm_3.0" "/remoll/addfield map_directory/blockyHybrid_rm_3.0.txt" -/gui/addButton field "blockyUpstream_rm_1.1" "/remoll/addfield map_directory/blockyUpstream_rm_1.1.txt" +/gui/addButton field "Load fieldmaps" "/control/execute macros/load_magnetic_fieldmaps.mac" # # Generator menu : /gui/addMenu gen "6. Generator" From 8c83c42fa66f8222d54a10a6bb8fa24a1ac65363 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 31 Aug 2020 10:19:47 -0500 Subject: [PATCH 072/443] Remove two unused quantities from pion detector lucite --- geometry/pion/Lucite/pionDetectorLucite.gdml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/geometry/pion/Lucite/pionDetectorLucite.gdml b/geometry/pion/Lucite/pionDetectorLucite.gdml index 96db8fc37..f3182f293 100644 --- a/geometry/pion/Lucite/pionDetectorLucite.gdml +++ b/geometry/pion/Lucite/pionDetectorLucite.gdml @@ -104,10 +104,6 @@ value="pionDetectorLuciteReflectorThickness/cos(pionDetectorLuciteReflectorTheta)"/> - - &matrices; From 8cadb6c292f30aab30eec04c3510745df561e082 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 31 Aug 2020 17:00:39 -0500 Subject: [PATCH 073/443] [donut] polycone referenced to US face --- geometry/donut/donutConcreteLead.gdml | 42 +++++++++------------------ 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index f57970dd6..70dea4d9b 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -24,50 +24,34 @@ + z="0"/> + z="donutConcreteThickness"/> - - - - - - - From 2cdd68ae985affb2503ce19167eb7e6c6a545ccf Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 31 Aug 2020 17:04:31 -0500 Subject: [PATCH 074/443] [pion] lucite system is now 30 cm thick --- geometry/pion/Lucite/pionDetectorLuciteSector.gdml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml index 405e74a32..f2d30799d 100644 --- a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml +++ b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml @@ -20,7 +20,7 @@ you modify the angle below so as to avoid overlaps between this volume and the trigger scintillator and volumes. --> - + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - + + + + - - - - - - - - - - - - + - - - - - - - - - - - - - - - - + - + - + - + - + From c5887946c3481b282fbf1386a9fb3f72929a8d3d Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 31 Aug 2020 17:05:29 -0500 Subject: [PATCH 076/443] Include donut and move pion to US face --- geometry/mollerMother_merged.gdml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/geometry/mollerMother_merged.gdml b/geometry/mollerMother_merged.gdml index 097e33505..b2dd48d82 100644 --- a/geometry/mollerMother_merged.gdml +++ b/geometry/mollerMother_merged.gdml @@ -95,11 +95,16 @@ - + + + + + + - + From 8c2b114c38554e7b19d80b72318623c2194e8a09 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 31 Aug 2020 17:06:05 -0500 Subject: [PATCH 077/443] New positions according to MOLLER CD1 review --- geometry/positions.xml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/geometry/positions.xml b/geometry/positions.xml index 976b3fc8e..dda67ab06 100644 --- a/geometry/positions.xml +++ b/geometry/positions.xml @@ -40,12 +40,16 @@ - + + + + + - + - + @@ -53,8 +57,8 @@ detectors are placed --> - - + + From c8ca3b45f812b93e88cfd70d9086fbfefce2a678 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 31 Aug 2020 17:07:14 -0500 Subject: [PATCH 078/443] Standalone world with only pion detector system --- geometry/pion/pionDetectorSystem_world.gdml | 35 +++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 geometry/pion/pionDetectorSystem_world.gdml diff --git a/geometry/pion/pionDetectorSystem_world.gdml b/geometry/pion/pionDetectorSystem_world.gdml new file mode 100644 index 000000000..d998ee686 --- /dev/null +++ b/geometry/pion/pionDetectorSystem_world.gdml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 989f9fc3c6cb25130635f93564affa8a45540819 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 31 Aug 2020 17:16:51 -0500 Subject: [PATCH 079/443] Harmonize mollerMother_merged and mollerMother_parametrized. Only difference is now the presence of the main detector array. --- geometry/mollerMother_merged.gdml | 14 ++---- geometry/mollerMother_parametrized.gdml | 64 ++++++++++++++++++------- 2 files changed, 52 insertions(+), 26 deletions(-) diff --git a/geometry/mollerMother_merged.gdml b/geometry/mollerMother_merged.gdml index b2dd48d82..f8bcbffa7 100644 --- a/geometry/mollerMother_merged.gdml +++ b/geometry/mollerMother_merged.gdml @@ -56,7 +56,6 @@ - @@ -64,14 +63,12 @@ - - - - --> + - - - + + @@ -106,7 +102,7 @@ - + diff --git a/geometry/mollerMother_parametrized.gdml b/geometry/mollerMother_parametrized.gdml index 4598fb0ab..c53f9d959 100644 --- a/geometry/mollerMother_parametrized.gdml +++ b/geometry/mollerMother_parametrized.gdml @@ -21,35 +21,52 @@ - + + + - + - - + + + + + + + + + - + - - + + - + - - + + + + + + + + + + @@ -59,17 +76,30 @@ - + - - + + + - + - - - + + + + + + + + + + + + + + + From 94bfe9b08fc991a449f5b1ab07f44bbebe6c4da9 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 31 Aug 2020 22:51:01 -0500 Subject: [PATCH 080/443] Tapered lead --- geometry/donut/donutConcreteLead.gdml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 70dea4d9b..c300f7b72 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -10,17 +10,17 @@ - + - + - + - - + + Date: Mon, 31 Aug 2020 22:51:21 -0500 Subject: [PATCH 081/443] [pion] radial outward for further downstream z --- geometry/pion/Lucite/pionDetectorLuciteSector.gdml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml index f2d30799d..2525b5dc3 100644 --- a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml +++ b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml @@ -50,7 +50,7 @@ lucite blocks. This means that the position of the inner edge must be augmented with half the height (radial dimension) of the lucite blocks. --> - + From e0e0bbd52cf29a4f209db1dfa0a2ea906d1bc07f Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 1 Sep 2020 14:20:27 -0500 Subject: [PATCH 082/443] [showermax] updated geometry for z = 24.5 m Inner radius = 102 cm Outer radius = 118 cm Azimuthal size = 26.5 cm --- geometry/showermax/showerMaxGen.gdml | 40 ++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/geometry/showermax/showerMaxGen.gdml b/geometry/showermax/showerMaxGen.gdml index 1a6a12eec..0e2365bce 100644 --- a/geometry/showermax/showerMaxGen.gdml +++ b/geometry/showermax/showerMaxGen.gdml @@ -5,29 +5,31 @@ + + - - + + - - + + - - + + @@ -39,9 +41,11 @@ -
- - +
+
+ + + @@ -3713,10 +3717,23 @@ + + + + + + + + + + + + + - \ No newline at end of file + From 07d30b8ff6a7e08d8e5eb1683503620f3a027188 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 1 Sep 2020 21:57:47 -0500 Subject: [PATCH 083/443] [donut] inner radius at showermax inner radius --- geometry/donut/donutConcreteLead.gdml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index c300f7b72..9c472d360 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -10,17 +10,17 @@ - - - - + + + + - - - - + + + + Date: Wed, 2 Sep 2020 09:29:53 -0500 Subject: [PATCH 084/443] [donut] place in air, not vacuum --- geometry/donut/donutConcreteLead.gdml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 9c472d360..ec9052265 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -75,7 +75,7 @@ - + From f558b8aa8a84b524bb7ecebfc60b9c9246c12871 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 3 Sep 2020 14:33:45 -0500 Subject: [PATCH 085/443] [pion] Moved pion lucite inner edge to 105.5 cm --- geometry/pion/Lucite/pionDetectorLuciteSector.gdml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml index 2525b5dc3..c15061289 100644 --- a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml +++ b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml @@ -50,7 +50,7 @@ lucite blocks. This means that the position of the inner edge must be augmented with half the height (radial dimension) of the lucite blocks. --> - + From 09da956bb9e74c05490c1125c86dd09caeaf79c9 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 3 Sep 2020 15:46:18 -0500 Subject: [PATCH 086/443] [donut] virtual det 8016,17,18 for concrete, 8019,20,21 for lead --- geometry/donut/donutConcreteLead.gdml | 103 ++++++++++++++++++++++++-- 1 file changed, 96 insertions(+), 7 deletions(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index ec9052265..8193ac18b 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -8,6 +8,9 @@ + + + @@ -23,12 +26,10 @@ - + - + @@ -46,32 +47,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + From 6debf0414814357a8d03cd62f04a1b224719dcfa Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 3 Sep 2020 16:25:37 -0500 Subject: [PATCH 087/443] [donut] updated positions after mistake corrected --- geometry/donut/donutConcreteLead.gdml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 8193ac18b..43cb8dff0 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -13,17 +13,17 @@ - - - - + + + + - - - - + + + + From 042bacd268a175a27dd61580b0c030ef083b0b4f Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 3 Sep 2020 16:25:57 -0500 Subject: [PATCH 088/443] [pion] Lucite inner radius increased --- geometry/pion/Lucite/pionDetectorLuciteSector.gdml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml index c15061289..27e79f295 100644 --- a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml +++ b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml @@ -50,7 +50,7 @@ lucite blocks. This means that the position of the inner edge must be augmented with half the height (radial dimension) of the lucite blocks. --> - + From 4f7132d6406f60da760848aacddab418a32cc8b0 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 3 Sep 2020 20:19:41 -0500 Subject: [PATCH 089/443] [donut] Move donut out another 15 mm --- geometry/donut/donutConcreteLead.gdml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 43cb8dff0..314b61abe 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -13,17 +13,17 @@ - - - - + + + + - - - - + + + + From 41ed46a6ac52037a6561f579fd7a6220f898509b Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 3 Sep 2020 20:19:56 -0500 Subject: [PATCH 090/443] [pion] move lucite out 10 mm --- geometry/pion/Lucite/pionDetectorLuciteSector.gdml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml index 27e79f295..679b20469 100644 --- a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml +++ b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml @@ -50,7 +50,7 @@ lucite blocks. This means that the position of the inner edge must be augmented with half the height (radial dimension) of the lucite blocks. --> - + From ac5cbb6c4838ae60cd4ac69089e938ae15e72af2 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 4 Sep 2020 13:08:08 -0500 Subject: [PATCH 091/443] [geometry] Added generator repositories as submodules --- .gitmodules | 6 ++++++ geometry/generators/CoilGenerator | 1 + geometry/generators/remoll-detector-generator | 1 + 3 files changed, 8 insertions(+) create mode 100644 .gitmodules create mode 160000 geometry/generators/CoilGenerator create mode 160000 geometry/generators/remoll-detector-generator diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..80a86bdac --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "geometry/generators/CoilGenerator"] + path = geometry/generators/CoilGenerator + url = https://github.com/rahmans1/CoilGenerator +[submodule "geometry/generators/remoll-detector-generator"] + path = geometry/generators/remoll-detector-generator + url = https://github.com/JeffersonLab/remoll-detector-generator.git diff --git a/geometry/generators/CoilGenerator b/geometry/generators/CoilGenerator new file mode 160000 index 000000000..2a77a0650 --- /dev/null +++ b/geometry/generators/CoilGenerator @@ -0,0 +1 @@ +Subproject commit 2a77a06508fe7c9029cf81ae54ba756132945370 diff --git a/geometry/generators/remoll-detector-generator b/geometry/generators/remoll-detector-generator new file mode 160000 index 000000000..425314488 --- /dev/null +++ b/geometry/generators/remoll-detector-generator @@ -0,0 +1 @@ +Subproject commit 425314488c7d1d6f887ab765158633ece055ab96 From aba2eeea34e8e6c964eb4795e43e88b04a3dc68e Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 4 Sep 2020 13:24:02 -0500 Subject: [PATCH 092/443] [geometry] showermax generator: updated size and positions of showermax --- geometry/generators/CoilGenerator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geometry/generators/CoilGenerator b/geometry/generators/CoilGenerator index 2a77a0650..98a68f443 160000 --- a/geometry/generators/CoilGenerator +++ b/geometry/generators/CoilGenerator @@ -1 +1 @@ -Subproject commit 2a77a06508fe7c9029cf81ae54ba756132945370 +Subproject commit 98a68f443a789d326ff11db697d392861cc07ef4 From 2cda9ddf6006eba27339a70193a99c517d5248e0 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 4 Sep 2020 13:38:24 -0500 Subject: [PATCH 093/443] [geometry] Back to a showermax geometry that comes out of the generator --- geometry/showermax/showerMaxGen.gdml | 82 +++++++++++----------------- 1 file changed, 33 insertions(+), 49 deletions(-) diff --git a/geometry/showermax/showerMaxGen.gdml b/geometry/showermax/showerMaxGen.gdml index 0e2365bce..dce6bad0d 100644 --- a/geometry/showermax/showerMaxGen.gdml +++ b/geometry/showermax/showerMaxGen.gdml @@ -5,15 +5,13 @@ - - - + @@ -21,7 +19,7 @@ - + @@ -29,7 +27,7 @@ - + @@ -44,7 +42,7 @@
- + @@ -3717,160 +3715,146 @@ - - - - - - - - - - - - - From e39f47197e42296cc0126cfcd2c1b0f755d74203 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 4 Sep 2020 13:42:37 -0500 Subject: [PATCH 094/443] [geometry] Updated CoilGenerator submodule --- geometry/generators/CoilGenerator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geometry/generators/CoilGenerator b/geometry/generators/CoilGenerator index 98a68f443..4345fd19b 160000 --- a/geometry/generators/CoilGenerator +++ b/geometry/generators/CoilGenerator @@ -1 +1 @@ -Subproject commit 98a68f443a789d326ff11db697d392861cc07ef4 +Subproject commit 4345fd19b08763fa628272eeba40f3ace7c6cf2a From bdf0af34d4310a7819bfc9956555e079f941ccb3 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 4 Sep 2020 13:48:16 -0500 Subject: [PATCH 095/443] [geometry] Update to submodule generator --- geometry/generators/CoilGenerator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geometry/generators/CoilGenerator b/geometry/generators/CoilGenerator index 98a68f443..4345fd19b 160000 --- a/geometry/generators/CoilGenerator +++ b/geometry/generators/CoilGenerator @@ -1 +1 @@ -Subproject commit 98a68f443a789d326ff11db697d392861cc07ef4 +Subproject commit 4345fd19b08763fa628272eeba40f3ace7c6cf2a From f2b63b1b0dd90abbcea86bb21dabffed23f3fd35 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 4 Sep 2020 13:49:03 -0500 Subject: [PATCH 096/443] [geometry] Updated showermax model out of the generator. --- geometry/showermax/showerMaxGen.gdml | 82 +++++++++++----------------- 1 file changed, 33 insertions(+), 49 deletions(-) diff --git a/geometry/showermax/showerMaxGen.gdml b/geometry/showermax/showerMaxGen.gdml index 0e2365bce..dce6bad0d 100644 --- a/geometry/showermax/showerMaxGen.gdml +++ b/geometry/showermax/showerMaxGen.gdml @@ -5,15 +5,13 @@ - - - + @@ -21,7 +19,7 @@ - + @@ -29,7 +27,7 @@ - + @@ -44,7 +42,7 @@
- + @@ -3717,160 +3715,146 @@ - - - - - - - - - - - - - From 6ec7e82a50b59cc6150195d113a6250ee4aae051 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 8 Sep 2020 13:10:09 -0500 Subject: [PATCH 097/443] [pion] Tilted lucite detector and 109.5 cm inner radius --- geometry/pion/Lucite/pionDetectorLuciteSector.gdml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml index 679b20469..17bd0cff1 100644 --- a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml +++ b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml @@ -43,14 +43,14 @@ PMT radially outward; -90.0 degrees is with the PMT radially inward. --> - + - + From 3e2bcbbb6810146e06cb6a2708fbcddbd4d71fba Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 8 Sep 2020 13:10:49 -0500 Subject: [PATCH 098/443] [pion] lucite height 12.5 cm --- geometry/pion/Lucite/pionDetectorLucite.gdml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geometry/pion/Lucite/pionDetectorLucite.gdml b/geometry/pion/Lucite/pionDetectorLucite.gdml index f3182f293..4ee19b299 100644 --- a/geometry/pion/Lucite/pionDetectorLucite.gdml +++ b/geometry/pion/Lucite/pionDetectorLucite.gdml @@ -33,7 +33,7 @@ - + From cb33da06ea1107388add6bdc100e1e67cd520d8c Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 8 Sep 2020 13:11:09 -0500 Subject: [PATCH 099/443] [donut] profile better matched to track direction --- geometry/donut/donutConcreteLead.gdml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 314b61abe..200effabb 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -13,17 +13,17 @@ - - - - + + + + - - - - + + + + From 72fd89eab5f193eec30f818175fb464aad092044 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 9 Sep 2020 16:31:18 -0500 Subject: [PATCH 100/443] [geometry] add new geometry generator repos as submodule --- .gitmodules | 9 ++++++--- geometry/generators/CoilGenerator | 1 - geometry/generators/remoll-coil-generator | 1 + geometry/generators/remoll-showermax-generator | 1 + 4 files changed, 8 insertions(+), 4 deletions(-) delete mode 160000 geometry/generators/CoilGenerator create mode 160000 geometry/generators/remoll-coil-generator create mode 160000 geometry/generators/remoll-showermax-generator diff --git a/.gitmodules b/.gitmodules index 80a86bdac..2efd22eb8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,9 @@ -[submodule "geometry/generators/CoilGenerator"] - path = geometry/generators/CoilGenerator - url = https://github.com/rahmans1/CoilGenerator +[submodule "geometry/generators/remoll-coil-generator"] + path = geometry/generators/remoll-coil-generator + url = https://github.com/jeffersonlab/remoll-coil-generator.git [submodule "geometry/generators/remoll-detector-generator"] path = geometry/generators/remoll-detector-generator url = https://github.com/JeffersonLab/remoll-detector-generator.git +[submodule "geometry/generators/remoll-showermax-generator"] + path = geometry/generators/remoll-showermax-generator + url = https://github.com/jeffersonlab/remoll-showermax-generator.git diff --git a/geometry/generators/CoilGenerator b/geometry/generators/CoilGenerator deleted file mode 160000 index 4345fd19b..000000000 --- a/geometry/generators/CoilGenerator +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4345fd19b08763fa628272eeba40f3ace7c6cf2a diff --git a/geometry/generators/remoll-coil-generator b/geometry/generators/remoll-coil-generator new file mode 160000 index 000000000..f95ce58fb --- /dev/null +++ b/geometry/generators/remoll-coil-generator @@ -0,0 +1 @@ +Subproject commit f95ce58fb7e5eddaa51048d58fe628b84ed40955 diff --git a/geometry/generators/remoll-showermax-generator b/geometry/generators/remoll-showermax-generator new file mode 160000 index 000000000..bf83286e3 --- /dev/null +++ b/geometry/generators/remoll-showermax-generator @@ -0,0 +1 @@ +Subproject commit bf83286e34193422d4177069ab37b275e1f5cdf1 From 062074c985848f33342a1b06a435a21204b82f63 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 11 Sep 2020 11:00:33 -0500 Subject: [PATCH 101/443] [geometry] remoll-showermax-generator to new master --- geometry/generators/remoll-showermax-generator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geometry/generators/remoll-showermax-generator b/geometry/generators/remoll-showermax-generator index bf83286e3..3d6117c29 160000 --- a/geometry/generators/remoll-showermax-generator +++ b/geometry/generators/remoll-showermax-generator @@ -1 +1 @@ -Subproject commit bf83286e34193422d4177069ab37b275e1f5cdf1 +Subproject commit 3d6117c298ed04054a889063b2ac0f103c3d7655 From 4838bb69d18b7680bc7a141c299a6076d2934b3b Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 11 Sep 2020 14:50:50 -0500 Subject: [PATCH 102/443] [pion] lucite detector with multiple PMTs (fun stuff) --- geometry/pion/Lucite/pionDetectorLucite.gdml | 69 ++++++++++++-------- 1 file changed, 41 insertions(+), 28 deletions(-) diff --git a/geometry/pion/Lucite/pionDetectorLucite.gdml b/geometry/pion/Lucite/pionDetectorLucite.gdml index f3182f293..f0ed55db2 100644 --- a/geometry/pion/Lucite/pionDetectorLucite.gdml +++ b/geometry/pion/Lucite/pionDetectorLucite.gdml @@ -63,6 +63,11 @@ + + + + + @@ -130,11 +135,10 @@ rmax="pionDetectorLucitePMTDiameter/2.0" z="pionDetectorLucitePMTHousingHeight" deltaphi="360.0" aunit="deg"/> - + @@ -390,8 +394,8 @@ z="(-pionDetectorLuciteLightGuideHeight+pionDetectorLuciteLightGuideEntryDetectorThickness)/2.0"/> @@ -407,10 +411,10 @@ theta="pionDetectorLuciteLightGuideTheta" phi="90.0*deg" x1="SCALE_UP*(pionDetectorLuciteReflectorWidth+2.0*pionDetectorLuciteLightGuideThickness)" x2="SCALE_UP*(pionDetectorLuciteReflectorWidth+2.0*pionDetectorLuciteLightGuideThickness)" - x3="SCALE_UP*(pionDetectorLucitePMTDiameter+2.0*pionDetectorLuciteLightGuideThickness)" - x4="SCALE_UP*(pionDetectorLucitePMTDiameter+2.0*pionDetectorLuciteLightGuideThickness)" + x3="SCALE_UP*(numberOfPMTsInX*pionDetectorLucitePMTDiameter+2.0*pionDetectorLuciteLightGuideThickness)" + x4="SCALE_UP*(numberOfPMTsInX*pionDetectorLucitePMTDiameter+2.0*pionDetectorLuciteLightGuideThickness)" y1="SCALE_UP*(pionDetectorLuciteReflectorDepth+2.0*pionDetectorLuciteLightGuideThickness)" - y2="SCALE_UP*(pionDetectorLucitePMTDiameter+2.0*pionDetectorLuciteLightGuideThickness)" + y2="SCALE_UP*(numberOfPMTsInZ*pionDetectorLucitePMTDiameter+2.0*pionDetectorLuciteLightGuideThickness)" z="SCALE_UP*(pionDetectorLuciteLightGuideHeight+pionDetectorLucitePMTThickness)"/> @@ -704,18 +708,27 @@ +pionDetectorLuciteLightGuideHeight/2.0"/> - - - - - + + + + + + + + + + From dccdbaac29cc654cfe925c6dd48596a56efb7bb9 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 11 Sep 2020 17:55:37 -0500 Subject: [PATCH 103/443] [geometry] tracking detector reorg --- geometry/mollerMother_merged.gdml | 10 ++- geometry/mollerMother_parametrized.gdml | 10 ++- geometry/tracking/daughterGEM1.gdml | 73 ----------------- geometry/tracking/daughterGEM2.gdml | 73 ----------------- geometry/tracking/daughterGEM3.gdml | 73 ----------------- geometry/tracking/daughterGEM4.gdml | 74 ----------------- geometry/tracking/trackingDaughter.gdml | 103 +++++++----------------- 7 files changed, 45 insertions(+), 371 deletions(-) delete mode 100644 geometry/tracking/daughterGEM1.gdml delete mode 100644 geometry/tracking/daughterGEM2.gdml delete mode 100644 geometry/tracking/daughterGEM3.gdml delete mode 100644 geometry/tracking/daughterGEM4.gdml diff --git a/geometry/mollerMother_merged.gdml b/geometry/mollerMother_merged.gdml index f8bcbffa7..7001c7f62 100644 --- a/geometry/mollerMother_merged.gdml +++ b/geometry/mollerMother_merged.gdml @@ -63,10 +63,16 @@ - + - + + + + + + + diff --git a/geometry/mollerMother_parametrized.gdml b/geometry/mollerMother_parametrized.gdml index c53f9d959..c47f118b2 100644 --- a/geometry/mollerMother_parametrized.gdml +++ b/geometry/mollerMother_parametrized.gdml @@ -63,10 +63,16 @@ - + - + + + + + + + diff --git a/geometry/tracking/daughterGEM1.gdml b/geometry/tracking/daughterGEM1.gdml deleted file mode 100644 index 16db945c2..000000000 --- a/geometry/tracking/daughterGEM1.gdml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - -

- - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/geometry/tracking/daughterGEM2.gdml b/geometry/tracking/daughterGEM2.gdml deleted file mode 100644 index 19a89cf1f..000000000 --- a/geometry/tracking/daughterGEM2.gdml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - -

- - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/geometry/tracking/daughterGEM3.gdml b/geometry/tracking/daughterGEM3.gdml deleted file mode 100644 index 775b33557..000000000 --- a/geometry/tracking/daughterGEM3.gdml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - -

- - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/geometry/tracking/daughterGEM4.gdml b/geometry/tracking/daughterGEM4.gdml deleted file mode 100644 index 1be47f505..000000000 --- a/geometry/tracking/daughterGEM4.gdml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - -

- - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/geometry/tracking/trackingDaughter.gdml b/geometry/tracking/trackingDaughter.gdml index 1add7af8b..11c00c5c7 100644 --- a/geometry/tracking/trackingDaughter.gdml +++ b/geometry/tracking/trackingDaughter.gdml @@ -4,14 +4,8 @@ xsi:noNamespaceSchemaLocation="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd"> - - - - - - - - + + @@ -29,10 +23,8 @@ - - - - + + @@ -59,9 +51,12 @@ - + + + + - + @@ -135,76 +130,36 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - + - + - + - + - + - - - - - - - - - - + From 8a3058b5094b45f90c156a55e9613155676a1fc2 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sat, 12 Sep 2020 13:31:18 -0500 Subject: [PATCH 104/443] [showermax] submodule updated master: reduce overlap --- geometry/generators/remoll-showermax-generator | 2 +- geometry/showermax/showerMaxGen.gdml | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/geometry/generators/remoll-showermax-generator b/geometry/generators/remoll-showermax-generator index 3d6117c29..852bd5a5b 160000 --- a/geometry/generators/remoll-showermax-generator +++ b/geometry/generators/remoll-showermax-generator @@ -1 +1 @@ -Subproject commit 3d6117c298ed04054a889063b2ac0f103c3d7655 +Subproject commit 852bd5a5b808bdf018358739338db2e3951c9cd1 diff --git a/geometry/showermax/showerMaxGen.gdml b/geometry/showermax/showerMaxGen.gdml index dce6bad0d..8eb02d5ae 100644 --- a/geometry/showermax/showerMaxGen.gdml +++ b/geometry/showermax/showerMaxGen.gdml @@ -43,12 +43,19 @@

- + + + + + + + + - - + + From bf312543afd024c0aad75c2e5f75008703d132c3 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sat, 12 Sep 2020 14:06:06 -0500 Subject: [PATCH 105/443] [geometry] tracking system inner radius 650 mm; no more trackingCenter used --- geometry/mollerMother.gdml | 11 +++++++++-- geometry/mollerMother_dump.gdml | 9 ++++++++- geometry/positions.xml | 8 ++------ geometry/tracking/trackingDaughter.gdml | 6 +++--- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/geometry/mollerMother.gdml b/geometry/mollerMother.gdml index 95fe8182b..4aaf92d60 100644 --- a/geometry/mollerMother.gdml +++ b/geometry/mollerMother.gdml @@ -28,9 +28,16 @@ - + + + + + + + + - + diff --git a/geometry/mollerMother_dump.gdml b/geometry/mollerMother_dump.gdml index 69a0c1034..367e41d42 100644 --- a/geometry/mollerMother_dump.gdml +++ b/geometry/mollerMother_dump.gdml @@ -42,9 +42,16 @@ --> + - + + + + + + + diff --git a/geometry/positions.xml b/geometry/positions.xml index dda67ab06..c50af4fe1 100644 --- a/geometry/positions.xml +++ b/geometry/positions.xml @@ -18,13 +18,9 @@ - - - - - - + + diff --git a/geometry/tracking/trackingDaughter.gdml b/geometry/tracking/trackingDaughter.gdml index 11c00c5c7..b19b89704 100644 --- a/geometry/tracking/trackingDaughter.gdml +++ b/geometry/tracking/trackingDaughter.gdml @@ -54,13 +54,13 @@ - - + + + rmin="650" rmax="1900" z="100" lunit="mm"/> From 63c167dd2db484839c0cd247d626501e85d8f33c Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sat, 12 Sep 2020 14:19:49 -0500 Subject: [PATCH 106/443] [geometry] showermax mother volume slightly larger inner radius --- geometry/generators/remoll-showermax-generator | 2 +- geometry/showermax/showerMaxGen.gdml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/geometry/generators/remoll-showermax-generator b/geometry/generators/remoll-showermax-generator index 852bd5a5b..f725e2213 160000 --- a/geometry/generators/remoll-showermax-generator +++ b/geometry/generators/remoll-showermax-generator @@ -1 +1 @@ -Subproject commit 852bd5a5b808bdf018358739338db2e3951c9cd1 +Subproject commit f725e2213929233ed656e6d359d82f9087018983 diff --git a/geometry/showermax/showerMaxGen.gdml b/geometry/showermax/showerMaxGen.gdml index 8eb02d5ae..502782c69 100644 --- a/geometry/showermax/showerMaxGen.gdml +++ b/geometry/showermax/showerMaxGen.gdml @@ -57,7 +57,7 @@ - + From 42405ec59d51042bd506a60afc4212c8029a575c Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sat, 12 Sep 2020 14:21:21 -0500 Subject: [PATCH 107/443] [geometry] position updates per dwg A09005-15-00-0000, 07/16/20 CD1 Locked --- geometry/positions.xml | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/geometry/positions.xml b/geometry/positions.xml index c50af4fe1..1b8e4d80e 100644 --- a/geometry/positions.xml +++ b/geometry/positions.xml @@ -20,7 +20,9 @@ + + @@ -34,18 +36,19 @@ - - + + + - - - + + + - - + + + - + @@ -53,8 +56,8 @@ detectors are placed --> - - + + From eed5c17faa830d4fb4d712973c1bac12b1e0a572 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sat, 12 Sep 2020 14:22:27 -0500 Subject: [PATCH 108/443] [gui] add parametrized detector menu option --- macros/gui.mac | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/gui.mac b/macros/gui.mac index d56a6fe87..86ab162e3 100644 --- a/macros/gui.mac +++ b/macros/gui.mac @@ -24,6 +24,7 @@ /gui/addMenu geom "1. Geometry" /gui/addButton geom geometry/mollerMother.gdml "/remoll/geometry/setfile geometry/mollerMother.gdml" /gui/addButton geom geometry/mollerMother_merged.gdml "/remoll/geometry/setfile geometry/mollerMother_merged.gdml" +/gui/addButton geom geometry/mollerMother_parametrized.gdml "/remoll/geometry/setfile geometry/mollerMother_parametrized.gdml" /gui/addButton geom geometry/pionDetectorLucite.gdml "/remoll/geometry/setfile geometry/pion/Lucite/pionDetectorLucite_world.gdml" /gui/addButton geom geometry/showerMaxDetector.gdml "/remoll/geometry/setfile geometry/showerMaxDetector.gdml" /gui/addButton geom geometry/mollerParallel.gdml "/remoll/parallel/setfile geometry/mollerParallel.gdml" From 23a0d6d62febccff4635245b29b1577f18679bae Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 13 Sep 2020 17:03:18 -0500 Subject: [PATCH 109/443] [geometry] tracking detectors in open sectors --- geometry/tracking/trackingDaughter.gdml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/geometry/tracking/trackingDaughter.gdml b/geometry/tracking/trackingDaughter.gdml index b19b89704..caa108bb9 100644 --- a/geometry/tracking/trackingDaughter.gdml +++ b/geometry/tracking/trackingDaughter.gdml @@ -137,10 +137,10 @@ + x="GEMPositionRadius*cos((i-0.5)*PHI)" + y="GEMPositionRadius*sin((i-0.5)*PHI)"/> + z="-(i-0.5)*PHI"/> From afbd84c70aa78cc12bf739044d6f8e611669bfa0 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 13 Sep 2020 17:53:56 -0500 Subject: [PATCH 110/443] [geometry] pion TS and GEM in open sector 2 --- .../pion/GEM/pionDetectorGEMOpenSector.gdml | 20 +++++++++---------- .../pion/TS/pionDetectorTSOpenSector.gdml | 16 +++++++-------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/geometry/pion/GEM/pionDetectorGEMOpenSector.gdml b/geometry/pion/GEM/pionDetectorGEMOpenSector.gdml index 9906ba540..05a8e76bf 100644 --- a/geometry/pion/GEM/pionDetectorGEMOpenSector.gdml +++ b/geometry/pion/GEM/pionDetectorGEMOpenSector.gdml @@ -3,8 +3,8 @@ - - + + @@ -18,10 +18,10 @@ + rmin="pionDetectorGEMInnerRadius" + rmax="pionDetectorGEMOuterRadius" + z="pionDetectorGEMLength" + startphi="-PHI/2.0" deltaphi="PHI" aunit="deg"/> - + @@ -43,14 +43,14 @@ - + - + - + diff --git a/geometry/pion/TS/pionDetectorTSOpenSector.gdml b/geometry/pion/TS/pionDetectorTSOpenSector.gdml index 761c642d0..93b1470a6 100644 --- a/geometry/pion/TS/pionDetectorTSOpenSector.gdml +++ b/geometry/pion/TS/pionDetectorTSOpenSector.gdml @@ -3,8 +3,8 @@ - - + + @@ -18,10 +18,10 @@ + rmin="pionDetectorTSInnerRadius" + rmax="pionDetectorTSOuterRadius" + z="pionDetectorTSLength" + startphi="-PHI/2.0" deltaphi="PHI" aunit="deg"/> - + - + From 5b030e7c5e08573a2c5619b35fec4db78eacbfe7 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 13 Sep 2020 18:58:17 -0500 Subject: [PATCH 111/443] [gui] viewer > vertical section view, without stuff in the back --- macros/gui.mac | 2 ++ vis/section.mac | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 vis/section.mac diff --git a/macros/gui.mac b/macros/gui.mac index d56a6fe87..762d35250 100644 --- a/macros/gui.mac +++ b/macros/gui.mac @@ -54,6 +54,8 @@ /gui/addButton view "Qt viewer (stored)" "/control/execute vis/SQt.mac" /gui/addButton view "Load vis settings" "/control/execute vis/vis.mac" /gui/addButton view "Load cutaway settings" "/control/execute vis/cutaway.mac" +/gui/addButton view "Clear cutaway planes" "/vis/viewer/clearCutawayPlanes" +/gui/addButton view "Vertical section view" "/control/execute vis/section.mac" /gui/addButton view "Draw real world" "/vis/drawVolume world" /gui/addButton view "Draw all worlds" "/vis/drawVolume worlds" /gui/addButton view "Set style surface" "/vis/viewer/set/style surface" diff --git a/vis/section.mac b/vis/section.mac new file mode 100644 index 000000000..0bd01d32b --- /dev/null +++ b/vis/section.mac @@ -0,0 +1,5 @@ +/vis/viewer/clearCutawayPlanes +/vis/viewer/set/cutawayMode intersection +/vis/viewer/addCutawayPlane 0.0 0.0 0.0 mm 1.0 0.0 0.0 +/vis/viewer/addCutawayPlane 1.0 0.0 0.0 mm -1.0 0.0 0.0 +/vis/viewer/set/style wireframe From 827de69ad498ef3272127499849de4495d0c0c62 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 13 Sep 2020 18:59:53 -0500 Subject: [PATCH 112/443] [geometry] world volume alpha to 0.1 --- geometry/mollerMother_merged.gdml | 1 + geometry/mollerMother_parametrized.gdml | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/geometry/mollerMother_merged.gdml b/geometry/mollerMother_merged.gdml index 097e33505..7f16ee631 100644 --- a/geometry/mollerMother_merged.gdml +++ b/geometry/mollerMother_merged.gdml @@ -23,6 +23,7 @@ + diff --git a/geometry/mollerMother_parametrized.gdml b/geometry/mollerMother_parametrized.gdml index 4598fb0ab..fe7762d38 100644 --- a/geometry/mollerMother_parametrized.gdml +++ b/geometry/mollerMother_parametrized.gdml @@ -21,8 +21,9 @@ - + + From f9cff7daea585fd6b59247e72ce42e8ead7fdcec Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 18 Sep 2020 14:50:48 -0500 Subject: [PATCH 113/443] [geometry] parallel world tracking planes: 500 mm is 0.500 m --- geometry/positions.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/geometry/positions.xml b/geometry/positions.xml index 1b8e4d80e..1cb583554 100644 --- a/geometry/positions.xml +++ b/geometry/positions.xml @@ -20,9 +20,9 @@ - + - + From b3b99e2e99672b339042b0de002f6c0221216450 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sat, 19 Sep 2020 12:40:08 -0500 Subject: [PATCH 114/443] [geometry] smaller world: x="75000" y="50000" z="125000" lunit="mm" --- geometry/hall/hallDaughter_acceptanceDefinition.gdml | 4 ++-- geometry/hall/hallDaughter_dump.gdml | 6 +++--- geometry/hall/hallDaughter_merged.gdml | 4 ++-- geometry/hall/hallDaughter_noShlds.gdml | 4 ++-- geometry/solids/world.xml | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/geometry/hall/hallDaughter_acceptanceDefinition.gdml b/geometry/hall/hallDaughter_acceptanceDefinition.gdml index afd2f931e..43f322ec3 100644 --- a/geometry/hall/hallDaughter_acceptanceDefinition.gdml +++ b/geometry/hall/hallDaughter_acceptanceDefinition.gdml @@ -11,8 +11,8 @@ &matrices; - - + + diff --git a/geometry/hall/hallDaughter_dump.gdml b/geometry/hall/hallDaughter_dump.gdml index 3150cc3b0..f84710909 100644 --- a/geometry/hall/hallDaughter_dump.gdml +++ b/geometry/hall/hallDaughter_dump.gdml @@ -12,9 +12,9 @@ &matrices; - - - + + + diff --git a/geometry/hall/hallDaughter_merged.gdml b/geometry/hall/hallDaughter_merged.gdml index 79f35310c..da7fe89f1 100644 --- a/geometry/hall/hallDaughter_merged.gdml +++ b/geometry/hall/hallDaughter_merged.gdml @@ -11,8 +11,8 @@ &matrices; - - + + diff --git a/geometry/hall/hallDaughter_noShlds.gdml b/geometry/hall/hallDaughter_noShlds.gdml index afd2f931e..43f322ec3 100644 --- a/geometry/hall/hallDaughter_noShlds.gdml +++ b/geometry/hall/hallDaughter_noShlds.gdml @@ -11,8 +11,8 @@ &matrices; - - + + diff --git a/geometry/solids/world.xml b/geometry/solids/world.xml index 2d8452a57..28cdde052 100644 --- a/geometry/solids/world.xml +++ b/geometry/solids/world.xml @@ -1,8 +1,8 @@ - + - + From 3f908ab79749b6328f378c9e17ac81bc16915874 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sat, 19 Sep 2020 12:45:53 -0500 Subject: [PATCH 115/443] [geometry] make SBS bunker daughter volume transparent --- geometry/electronics/subSBSbunker.gdml | 1 + 1 file changed, 1 insertion(+) diff --git a/geometry/electronics/subSBSbunker.gdml b/geometry/electronics/subSBSbunker.gdml index 429eafaef..b2aeaf835 100644 --- a/geometry/electronics/subSBSbunker.gdml +++ b/geometry/electronics/subSBSbunker.gdml @@ -90,6 +90,7 @@ + From 5c7701528272becd56df5c5d75defae36fc556ea Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sat, 19 Sep 2020 12:54:35 -0500 Subject: [PATCH 116/443] [geometry] make target vacuum detectors transparent --- geometry/target/subTargetRegion.gdml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/geometry/target/subTargetRegion.gdml b/geometry/target/subTargetRegion.gdml index 23b9adcb4..e98ab66f7 100644 --- a/geometry/target/subTargetRegion.gdml +++ b/geometry/target/subTargetRegion.gdml @@ -305,6 +305,7 @@ + @@ -313,6 +314,7 @@ + @@ -321,6 +323,7 @@ + @@ -331,6 +334,7 @@ + @@ -342,6 +346,7 @@ + @@ -352,6 +357,7 @@ + @@ -362,6 +368,7 @@ + @@ -372,6 +379,7 @@ + @@ -383,6 +391,7 @@ + @@ -393,6 +402,7 @@ + From 1d4824f77a64ba45d255c96506aa2e50f33a7002 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sat, 19 Sep 2020 13:02:16 -0500 Subject: [PATCH 117/443] [geometry] make left and right hut daughter volumes and vacuum dets transparent --- geometry/huts/lefthut.gdml | 3 +++ geometry/huts/righthut.gdml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/geometry/huts/lefthut.gdml b/geometry/huts/lefthut.gdml index c75aaa057..06f51b29d 100644 --- a/geometry/huts/lefthut.gdml +++ b/geometry/huts/lefthut.gdml @@ -65,6 +65,7 @@ + @@ -76,6 +77,7 @@ + @@ -85,6 +87,7 @@ + diff --git a/geometry/huts/righthut.gdml b/geometry/huts/righthut.gdml index eec8c80af..05300f09e 100644 --- a/geometry/huts/righthut.gdml +++ b/geometry/huts/righthut.gdml @@ -66,6 +66,7 @@ + @@ -76,6 +77,7 @@ + @@ -85,6 +87,7 @@ + From 9e592dbad2e4c0292655fe3ace2ad6deab64ccf2 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sat, 19 Sep 2020 14:14:50 -0500 Subject: [PATCH 118/443] [geometry] pion GEM and TS replicated volume: avoid identical radial edges... The replicavol in the phi direction cannot have its volumes fill the mother volume exactly, so we need to only use 0.99 times the phi range. --- geometry/pion/GEM/pionDetectorGEMOpenSector.gdml | 4 ++-- geometry/pion/TS/pionDetectorTSOpenSector.gdml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/geometry/pion/GEM/pionDetectorGEMOpenSector.gdml b/geometry/pion/GEM/pionDetectorGEMOpenSector.gdml index 05a8e76bf..7606cee2d 100644 --- a/geometry/pion/GEM/pionDetectorGEMOpenSector.gdml +++ b/geometry/pion/GEM/pionDetectorGEMOpenSector.gdml @@ -4,7 +4,7 @@ - + @@ -21,7 +21,7 @@ rmin="pionDetectorGEMInnerRadius" rmax="pionDetectorGEMOuterRadius" z="pionDetectorGEMLength" - startphi="-PHI/2.0" deltaphi="PHI" aunit="deg"/> + startphi="-0.5*PHI/2.0" deltaphi="0.5*PHI" aunit="deg"/> - + @@ -21,7 +21,7 @@ rmin="pionDetectorTSInnerRadius" rmax="pionDetectorTSOuterRadius" z="pionDetectorTSLength" - startphi="-PHI/2.0" deltaphi="PHI" aunit="deg"/> + startphi="-0.5*PHI/2.0" deltaphi="0.5*PHI" aunit="deg"/> Date: Sun, 20 Sep 2020 19:11:47 -0500 Subject: [PATCH 119/443] [geometry] Fix old pion detector position refs in unused mothers --- geometry/mollerMother.gdml | 2 +- geometry/mollerMother_dump.gdml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/geometry/mollerMother.gdml b/geometry/mollerMother.gdml index 4aaf92d60..2458d6cc1 100644 --- a/geometry/mollerMother.gdml +++ b/geometry/mollerMother.gdml @@ -49,7 +49,7 @@ - + diff --git a/geometry/mollerMother_dump.gdml b/geometry/mollerMother_dump.gdml index 367e41d42..44f2f1cd4 100644 --- a/geometry/mollerMother_dump.gdml +++ b/geometry/mollerMother_dump.gdml @@ -71,7 +71,7 @@ - + From 1895f87ce9afa87119585e95c1ebecbb509df091 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 20 Sep 2020 19:13:24 -0500 Subject: [PATCH 120/443] [gitignore] random state files --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index c2e860a32..158dc458a 100755 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,8 @@ G4Worker?_run*evt*.rndm run*evt*.rndm currentEvent.rndm currentRun.rndm +*.state +*.rndm # output from createHTML _remoll_*.html From da9628d7820db3a120640b293c88f31bc254468b Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 20 Sep 2020 19:13:52 -0500 Subject: [PATCH 121/443] [remollIO] save random state to *.state, not *.rndm which has diff format --- include/remollIO.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/remollIO.hh b/include/remollIO.hh index 50be0ed26..83d980bf7 100644 --- a/include/remollIO.hh +++ b/include/remollIO.hh @@ -62,7 +62,7 @@ class remollSeed_t: public TObject { // Save function for use in ROOT tree int Save() const { std::stringstream name; - name << "run" << fRunNo << "evt" << fEvtNo << ".rndm"; + name << "run" << fRunNo << "evt" << fEvtNo << ".state"; std::ofstream file(name.str()); file << fSeed; return fSeed.Length(); From 84d500af2ccd2652f46afc1a862d33b42da74fe0 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 20 Sep 2020 19:14:43 -0500 Subject: [PATCH 122/443] [scripts] conversion from random state to input file for resetting engine --- scripts/convert-mixmaxrng-state.sh | 77 ++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100755 scripts/convert-mixmaxrng-state.sh diff --git a/scripts/convert-mixmaxrng-state.sh b/scripts/convert-mixmaxrng-state.sh new file mode 100755 index 000000000..905f027ab --- /dev/null +++ b/scripts/convert-mixmaxrng-state.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +if [ $# -lt 1 ] ; then + echo "Convert the MixMaxRNG engine state stream format into rndm file format." + echo "Usage (to stdout): `basename $0` [infile]" + exit +fi + +# Convert file format like +# +#MixMaxRng-begin 30331785 +#58933861902009719 +#1785835428502820402 +#1423853375428307990 +#177508786414027104 +#605196243949405736 +#861701010447754611 +#2250242789326832084 +#1084033761752659819 +#1855444124088891051 +#242731982633356449 +#808181319309293506 +#1276833616859972515 +#632930668351273437 +#1854356059141373284 +#1573087033096440666 +#1508189008866546922 +#2274580468617938516 +#1 +#1826895464979352203 +#MixMaxRng-end +# +# written by +# +#std::ostream & MixMaxRng::put ( std::ostream& os ) const +#{ +# char beginMarker[] = "MixMaxRng-begin"; +# char endMarker[] = "MixMaxRng-end"; +# +# int pr = os.precision(24); +# os << beginMarker << " "; +# os << theSeed << "\n"; +# for (int i=0; i Date: Sun, 20 Sep 2020 19:15:56 -0500 Subject: [PATCH 123/443] [unit tests] simulate 10 events, verify correctly playing them backwards --- macros/tests/unit/test_rng_engine.C | 4 ++ macros/tests/unit/test_rng_engine.mac | 57 +++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 macros/tests/unit/test_rng_engine.C create mode 100644 macros/tests/unit/test_rng_engine.mac diff --git a/macros/tests/unit/test_rng_engine.C b/macros/tests/unit/test_rng_engine.C new file mode 100644 index 000000000..330427ec1 --- /dev/null +++ b/macros/tests/unit/test_rng_engine.C @@ -0,0 +1,4 @@ +{ + TFile f("remollout.root"); + T->Scan("seed.Save()"); +} diff --git a/macros/tests/unit/test_rng_engine.mac b/macros/tests/unit/test_rng_engine.mac new file mode 100644 index 000000000..defd1a6ff --- /dev/null +++ b/macros/tests/unit/test_rng_engine.mac @@ -0,0 +1,57 @@ +# Store random state to events +/run/storeRndmStatToEvent 1 + +# Ensure rndm1 directory exists +/control/shell mkdir -p rndm1 +/random/setDirectoryName rndm1 +# Store random state to files +/random/setSavingFlag 1 +/random/saveEachEventFlag 1 + +# Run 10 events +/run/initialize +/run/beamOn 10 + +# Write all random states for run 1 +/control/shell build/reroot -l -q macros/tests/unit/test_rng_engine.C + +# Ensure rndm1 directory exists +/control/shell mkdir -p rndm2 +/random/setDirectoryName rndm2 + +# Convert random state for event 5 +# Note: resetEngineFromEachEvent reads from current directory +/control/shell scripts/convert-mixmaxrng-state.sh run0evt9.state > run1evt0.rndm +/control/shell scripts/convert-mixmaxrng-state.sh run0evt8.state > run1evt1.rndm +/control/shell scripts/convert-mixmaxrng-state.sh run0evt7.state > run1evt2.rndm +/control/shell scripts/convert-mixmaxrng-state.sh run0evt6.state > run1evt3.rndm +/control/shell scripts/convert-mixmaxrng-state.sh run0evt5.state > run1evt4.rndm +/control/shell scripts/convert-mixmaxrng-state.sh run0evt4.state > run1evt5.rndm +/control/shell scripts/convert-mixmaxrng-state.sh run0evt3.state > run1evt6.rndm +/control/shell scripts/convert-mixmaxrng-state.sh run0evt2.state > run1evt7.rndm +/control/shell scripts/convert-mixmaxrng-state.sh run0evt1.state > run1evt8.rndm +/control/shell scripts/convert-mixmaxrng-state.sh run0evt0.state > run1evt9.rndm + +# Reset engine for each event +/random/resetEngineFromEachEvent 1 + +# Run 10 events +/run/beamOn 10 + +# Write all random states for run 1 +/control/shell build/reroot -l -q macros/tests/unit/test_rng_engine.C + +# Compare random states on all events +/control/shell diff --ignore-matching-lines ^MixMaxRng-begin run0evt0.state run1evt9.state +/control/shell diff --ignore-matching-lines ^MixMaxRng-begin run0evt1.state run1evt8.state +/control/shell diff --ignore-matching-lines ^MixMaxRng-begin run0evt2.state run1evt7.state +/control/shell diff --ignore-matching-lines ^MixMaxRng-begin run0evt3.state run1evt6.state +/control/shell diff --ignore-matching-lines ^MixMaxRng-begin run0evt4.state run1evt5.state +/control/shell diff --ignore-matching-lines ^MixMaxRng-begin run0evt5.state run1evt4.state +/control/shell diff --ignore-matching-lines ^MixMaxRng-begin run0evt6.state run1evt3.state +/control/shell diff --ignore-matching-lines ^MixMaxRng-begin run0evt7.state run1evt2.state +/control/shell diff --ignore-matching-lines ^MixMaxRng-begin run0evt8.state run1evt1.state +/control/shell diff --ignore-matching-lines ^MixMaxRng-begin run0evt9.state run1evt0.state + +# Clean up +# rm -rf *.rndm *.state rndm1 rndm2 From 0edda451695f51b234ad1af537166d455913cd2f Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 20 Sep 2020 22:17:20 -0500 Subject: [PATCH 124/443] [remollIO] seed.Save() returns 1, so T->Draw("hit.r*seed.Save()") is still a useful --- include/remollIO.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/remollIO.hh b/include/remollIO.hh index 83d980bf7..255b7e7ee 100644 --- a/include/remollIO.hh +++ b/include/remollIO.hh @@ -65,7 +65,7 @@ class remollSeed_t: public TObject { name << "run" << fRunNo << "evt" << fEvtNo << ".state"; std::ofstream file(name.str()); file << fSeed; - return fSeed.Length(); + return 1; }; ClassDef(remollSeed_t,1); }; From 47c6affb9601b2f9168217aa2b6327f07de13ec8 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 20 Sep 2020 22:22:36 -0500 Subject: [PATCH 125/443] [scripts] convert wildcard pattern of state files to sequence of run.rndm files --- scripts/convert-mixmaxrng-states-to-runs.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 scripts/convert-mixmaxrng-states-to-runs.sh diff --git a/scripts/convert-mixmaxrng-states-to-runs.sh b/scripts/convert-mixmaxrng-states-to-runs.sh new file mode 100755 index 000000000..6a55288b3 --- /dev/null +++ b/scripts/convert-mixmaxrng-states-to-runs.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +dir=`dirname $0` +dir=`realpath $dir` + +run=0 +while [ $# -gt 0 ] ; do + $dir/convert-mixmaxrng-state.sh $1 > run${run}evt0.rndm + let run=run+1 + shift +done From f03055bf320986c509087f9ee580dc44672bf815 Mon Sep 17 00:00:00 2001 From: Ciprian Gal Date: Mon, 21 Sep 2020 11:42:57 -0400 Subject: [PATCH 126/443] move detector down and reduce outer radius. change some names to fall in line with scheme --- geometry/hall/hallDaughter_dump.gdml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/geometry/hall/hallDaughter_dump.gdml b/geometry/hall/hallDaughter_dump.gdml index 3150cc3b0..da5c30db2 100644 --- a/geometry/hall/hallDaughter_dump.gdml +++ b/geometry/hall/hallDaughter_dump.gdml @@ -225,7 +225,8 @@ - + - + @@ -602,7 +603,7 @@ - + From 03556a757728b6b8878cbb1e5301bd522a9289cd Mon Sep 17 00:00:00 2001 From: Ciprian Gal Date: Mon, 21 Sep 2020 11:43:41 -0400 Subject: [PATCH 127/443] we should not run events by default in the vizualizer macro --- macros/runexample_vis.mac | 3 --- 1 file changed, 3 deletions(-) diff --git a/macros/runexample_vis.mac b/macros/runexample_vis.mac index 4d7a4203e..bdba56986 100644 --- a/macros/runexample_vis.mac +++ b/macros/runexample_vis.mac @@ -51,6 +51,3 @@ #/remoll/evgen/external/startEvent 0 #/remoll/evgen/external/zOffset -28550.0 #/remoll/filename remollout_r5o_external_default.root - - -/run/beamOn 1 From a3d6b368e10a5694c35eb4f2e6efb67e9a9e0a1c Mon Sep 17 00:00:00 2001 From: vdoomra <68244726+vdoomra@users.noreply.github.com> Date: Tue, 22 Sep 2020 00:07:08 -0400 Subject: [PATCH 128/443] Update beampipeDSMother.gdml --- .../beampipe/downstream/beampipeDSMother.gdml | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/geometry/beampipe/downstream/beampipeDSMother.gdml b/geometry/beampipe/downstream/beampipeDSMother.gdml index b96be9362..84e767e8f 100644 --- a/geometry/beampipe/downstream/beampipeDSMother.gdml +++ b/geometry/beampipe/downstream/beampipeDSMother.gdml @@ -4,9 +4,16 @@ xsi:noNamespaceSchemaLocation="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd"> + + + + + + + @@ -84,6 +91,11 @@ + + + + + @@ -105,6 +117,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -154,6 +190,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -207,6 +268,10 @@ + + + + From 7cb6cc0a535959a7e1d12b9db3943d57b2d39f57 Mon Sep 17 00:00:00 2001 From: vdoomra <68244726+vdoomra@users.noreply.github.com> Date: Tue, 22 Sep 2020 19:16:42 -0400 Subject: [PATCH 129/443] Update beampipeDSMother.gdml --- .../beampipe/downstream/beampipeDSMother.gdml | 70 ++++++++++++------- 1 file changed, 43 insertions(+), 27 deletions(-) diff --git a/geometry/beampipe/downstream/beampipeDSMother.gdml b/geometry/beampipe/downstream/beampipeDSMother.gdml index 84e767e8f..3b4e90f5d 100644 --- a/geometry/beampipe/downstream/beampipeDSMother.gdml +++ b/geometry/beampipe/downstream/beampipeDSMother.gdml @@ -4,15 +4,20 @@ xsi:noNamespaceSchemaLocation="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd"> + + + + + - + - + - - - - - - - - - - - - - - - - - @@ -194,25 +182,53 @@ - - + + + - - + + + - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + From 4300997ea4594a5a266ca0075e722f32fb194eab Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 25 Sep 2020 14:46:20 -0500 Subject: [PATCH 130/443] [gui] Menu button to load events from files --- macros/gui.mac | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/gui.mac b/macros/gui.mac index 762d35250..b11f9a1c2 100644 --- a/macros/gui.mac +++ b/macros/gui.mac @@ -90,6 +90,7 @@ # # Run menu : /gui/addMenu run "7. Run" +/gui/addButton run "Load from files" "/random/resetEngineFromEachEvent 1" /gui/addButton run "beamOn 1" "/run/beamOn 1" /gui/addButton run "beamOn 2" "/run/beamOn 2" /gui/addButton run "beamOn 5" "/run/beamOn 5" From f5dd2ac6bf433a6a6bf2776904d06ddf965cd538 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 25 Sep 2020 14:56:48 -0500 Subject: [PATCH 131/443] [doc] README.replay.md as instructions to replay previous events --- README.replay.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 README.replay.md diff --git a/README.replay.md b/README.replay.md new file mode 100644 index 000000000..ba458e4b1 --- /dev/null +++ b/README.replay.md @@ -0,0 +1,52 @@ +## Replaying simulated events + +These instructions explain how to replay exactly some previously simulated events. + +### Run the original large-N simulations + +Not every simulation output file can automatically be used to replay certian events. + +You must enable storing the random seed status for each event with the following flag enabled: +``` +/run/storeRndmStatToEvent 1 +``` + +### Select events of interest + +Now, we select a small-ish number of events in the ROOT tree. You will need to use `reroot` for this. + +Example: + +Suppose you have identified that all events in the following histogram are of interest for replaying: +``` +T->Draw("hit.r","hit.det==8001 && hit.pid!=22 && hit.trid>2 && hit.r<1100*mm") +``` +You can now tell ROOT to write out the random engine state files for those events: +``` +T->Draw("hit.r*seed.Save()","hit.det==8001 && hit.pid!=22 && hit.trid>2 && hit.r<1100*mm") +``` +The `seed.Save()` function always just returns 1, and writes the random engine state files. + +You should end up with a bunch of files with names like `run0evt118.state`. + +### Convert random state file format + +Next, we convert the state files into a different file format and set them up to go to individual runs. This will allow you to click through them one by one. +``` +scripts/convert-mixmaxrng-states-to-runs.sh run0evt*.state +``` +You should end up with a bunch of files with names like `run0evt0.rndm`, `run1evt0.rndm`, etc. They will all be event number 0 in consecutive runs. + +Note that the wildcard will sort alphabetically, not by event number, so it will sort `run0evt225.state` before `run0evt31.state`. That is the order that the `run0evt0.rndm`, `run1evt0.rndm` files will be in. + +### Replay the events in remoll + +Finally, start remoll interactively and execute exactly the same setup as in the first step: same geometry, physics list, etc. + +Before starting an actual event simulation, tell it to load the `run0evt0.rndm`, `run1evt0.rndm` files with +``` +/random/resetEngineFromEachEvent 1 +``` +Now you can rerun each event again with `/run/beamOn 1`, or the play button on the graphical interface. Whenever it is starting a new run (of 1 event, in this case) and a new event, it will first check for the `run0evt0.rndm`, `run1evt0.rndm` files. + +Note: If you click play beyond the end of any stored events, it will just generate regular random events (and it will not warn you about this). From a49b2d815e8328f93f70d8521afe4c43c31b05c0 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 25 Sep 2020 15:57:29 -0500 Subject: [PATCH 132/443] Updated pion macro: load magnetic fields by macro --- macros/pion/pion_rates_at_lucite_plane.mac | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/macros/pion/pion_rates_at_lucite_plane.mac b/macros/pion/pion_rates_at_lucite_plane.mac index 586525039..3d50a44a6 100644 --- a/macros/pion/pion_rates_at_lucite_plane.mac +++ b/macros/pion/pion_rates_at_lucite_plane.mac @@ -10,8 +10,7 @@ /run/initialize # Magnetic fields -/remoll/addfield map_directory/blockyHybrid_rm_3.0.txt -/remoll/addfield map_directory/blockyUpstream_rm_1.1.txt +/control/execute macros/load_magnetic_fieldmaps.mac # Make interactions with W, Cu, and Pb # realistic rather than pure absorbers From a8d1afccb4b709eb61194d6ca4ebfcd80fe0aa56 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 25 Sep 2020 16:57:19 -0500 Subject: [PATCH 133/443] [vis] filters: HideAllGamma, ShowOnlyPionDetectorHits --- vis/vis.mac | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/vis/vis.mac b/vis/vis.mac index 4f11b397d..6d830d029 100644 --- a/vis/vis.mac +++ b/vis/vis.mac @@ -75,6 +75,18 @@ # /vis/modeling/trajectories/select MollerStyle +# +# Create filters +# +/vis/filtering/trajectories/create/particleFilter HideAllGamma +/vis/filtering/trajectories/HideAllGamma/add gamma +/vis/filtering/trajectories/HideAllGamma/invert true +/vis/filtering/trajectories/HideAllGamma/active 0 + +/vis/filtering/trajectories/create/encounteredVolumeFilter ShowOnlyPionDetectorHits +/vis/filtering/trajectories/ShowOnlyPionDetectorHits/add pionDetectorLuciteAllPlanesWedgeGlue_physical +/vis/filtering/trajectories/ShowOnlyPionDetectorHits/active 0 + # # Event action # From 026871b014d6650712ac4ae28cf429bb59ae1d40 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 25 Sep 2020 17:02:41 -0500 Subject: [PATCH 134/443] [vis] HideAllGamma -> HideAllGammas --- vis/vis.mac | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vis/vis.mac b/vis/vis.mac index 6d830d029..b16c1e069 100644 --- a/vis/vis.mac +++ b/vis/vis.mac @@ -78,10 +78,10 @@ # # Create filters # -/vis/filtering/trajectories/create/particleFilter HideAllGamma -/vis/filtering/trajectories/HideAllGamma/add gamma -/vis/filtering/trajectories/HideAllGamma/invert true -/vis/filtering/trajectories/HideAllGamma/active 0 +/vis/filtering/trajectories/create/particleFilter HideAllGammas +/vis/filtering/trajectories/HideAllGammas/add gamma +/vis/filtering/trajectories/HideAllGammas/invert true +/vis/filtering/trajectories/HideAllGammas/active 0 /vis/filtering/trajectories/create/encounteredVolumeFilter ShowOnlyPionDetectorHits /vis/filtering/trajectories/ShowOnlyPionDetectorHits/add pionDetectorLuciteAllPlanesWedgeGlue_physical From a976e85c58f355454603b91885e97ab91235438b Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 25 Sep 2020 17:04:04 -0500 Subject: [PATCH 135/443] [gui] Filter menu with HideAllGammas and ShowOnlyPionDetectorHits --- macros/gui.mac | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/macros/gui.mac b/macros/gui.mac index b11f9a1c2..e960e9372 100644 --- a/macros/gui.mac +++ b/macros/gui.mac @@ -73,12 +73,19 @@ /gui/addButton view "Flush viewer (= refresh + update)" "/vis/viewer/flush" /gui/addButton view "Update scene" "/vis/scene/notifyHandlers" # +# Filter menu : +/gui/addMenu filter "5. Filters" +/gui/addButton filter "HideAllGammas ON" "/vis/filtering/trajectories/HideAllGammas/active 1" +/gui/addButton filter "HideAllGammas OFF" "/vis/filtering/trajectories/HideAllGammas/active 0" +/gui/addButton filter "ShowOnlyPionDetectorHits ON" "/vis/filtering/trajectories/ShowOnlyPionDetectorHits/active 1" +/gui/addButton filter "ShowOnlyPionDetectorHits OFF" "/vis/filtering/trajectories/ShowOnlyPionDetectorHits/active 0" +# # Run menu : -/gui/addMenu field "5. Fields" +/gui/addMenu field "6. Fields" /gui/addButton field "Load fieldmaps" "/control/execute macros/load_magnetic_fieldmaps.mac" # # Generator menu : -/gui/addMenu gen "6. Generator" +/gui/addMenu gen "7. Generator" /gui/addButton gen "Moller" "/remoll/evgen/set moller" /gui/addButton gen "Beam" "/remoll/evgen/set beam" /gui/addButton gen "Beam/pi-" "/remoll/evgen/beam/partName pi-" @@ -89,7 +96,7 @@ # # Run menu : -/gui/addMenu run "7. Run" +/gui/addMenu run "8. Run" /gui/addButton run "Load from files" "/random/resetEngineFromEachEvent 1" /gui/addButton run "beamOn 1" "/run/beamOn 1" /gui/addButton run "beamOn 2" "/run/beamOn 2" From ff24d494e92fc25b2dbe8c405b65f31e1c6962de Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 25 Sep 2020 17:07:40 -0500 Subject: [PATCH 136/443] [gui] increase OGL display limit, show/hide individual steps --- macros/gui.mac | 3 +++ 1 file changed, 3 insertions(+) diff --git a/macros/gui.mac b/macros/gui.mac index e960e9372..61a29b437 100644 --- a/macros/gui.mac +++ b/macros/gui.mac @@ -52,6 +52,7 @@ /gui/addMenu view "4. Viewer" /gui/addButton view "Qt viewer (immediate)" "/control/execute vis/IQt.mac" /gui/addButton view "Qt viewer (stored)" "/control/execute vis/SQt.mac" +/gui/addButton view "Display limit 1M" "/vis/ogl/set/displayListLimit 1000000" /gui/addButton view "Load vis settings" "/control/execute vis/vis.mac" /gui/addButton view "Load cutaway settings" "/control/execute vis/cutaway.mac" /gui/addButton view "Clear cutaway planes" "/vis/viewer/clearCutawayPlanes" @@ -62,6 +63,8 @@ /gui/addButton view "Set style wireframe" "/vis/viewer/set/style wireframe" /gui/addButton view "Hide tracks behind objects" "/vis/viewer/set/hiddenMarker true" /gui/addButton view "Show tracks behind objects" "/vis/viewer/set/hiddenMarker false" +/gui/addButton view "Hide individual steps" "/vis/modeling/trajectories/MollerStyle/default/setDrawStepPts false" +/gui/addButton view "Show individual steps" "/vis/modeling/trajectories/MollerStyle/default/setDrawStepPts true" /gui/addButton view "Front view (+Z)" "/vis/viewer/set/viewpointThetaPhi 180 0 deg" /gui/addButton view "Back view (-Z)" "/vis/viewer/set/viewpointThetaPhi 0 0 deg" /gui/addButton view "Side 1 view (+X)" "/vis/viewer/set/viewpointThetaPhi 90 180 deg" From 03078844da1e3e5d53309ebe55cfa94866caec1c Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 25 Sep 2020 17:14:25 -0500 Subject: [PATCH 137/443] [vis] enable rich trajectories for filters to work --- vis/vis.mac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vis/vis.mac b/vis/vis.mac index b16c1e069..6faeb830e 100644 --- a/vis/vis.mac +++ b/vis/vis.mac @@ -31,7 +31,7 @@ # # Declare that trajectories and hits should be added to the scene # -/vis/scene/add/trajectories +/vis/scene/add/trajectories smooth rich /vis/scene/add/hits # From ba6b9042f2b0356d8099cc0f833fb5d7a4d8506b Mon Sep 17 00:00:00 2001 From: vdoomra <68244726+vdoomra@users.noreply.github.com> Date: Mon, 28 Sep 2020 12:21:37 -0400 Subject: [PATCH 138/443] Update beampipeDSMother.gdml --- .../beampipe/downstream/beampipeDSMother.gdml | 57 +++++++++---------- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/geometry/beampipe/downstream/beampipeDSMother.gdml b/geometry/beampipe/downstream/beampipeDSMother.gdml index 3b4e90f5d..6ff839a37 100644 --- a/geometry/beampipe/downstream/beampipeDSMother.gdml +++ b/geometry/beampipe/downstream/beampipeDSMother.gdml @@ -2,19 +2,9 @@ - - - - - - - - - - + - @@ -96,10 +86,9 @@ - - - - + + + @@ -185,49 +174,56 @@ - + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + @@ -286,6 +282,7 @@ + From e750eca38acd619ed3bdc62fcaecf1b9df3a134f Mon Sep 17 00:00:00 2001 From: vdoomra <68244726+vdoomra@users.noreply.github.com> Date: Mon, 28 Sep 2020 15:44:13 -0400 Subject: [PATCH 139/443] Update beampipeDSMother.gdml --- .../beampipe/downstream/beampipeDSMother.gdml | 36 ++++++++----------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/geometry/beampipe/downstream/beampipeDSMother.gdml b/geometry/beampipe/downstream/beampipeDSMother.gdml index 6ff839a37..9cf1285ca 100644 --- a/geometry/beampipe/downstream/beampipeDSMother.gdml +++ b/geometry/beampipe/downstream/beampipeDSMother.gdml @@ -2,9 +2,7 @@ - - - + @@ -173,58 +171,54 @@ - - + + - - + - - + - + - - + - - + - - + - + - - + + + - - + + From 3e3a83e6cc707de694e73e0e05698f6c6e56ea9e Mon Sep 17 00:00:00 2001 From: vdoomra <68244726+vdoomra@users.noreply.github.com> Date: Mon, 28 Sep 2020 18:06:02 -0400 Subject: [PATCH 140/443] Update beampipeDSMother.gdml --- .../beampipe/downstream/beampipeDSMother.gdml | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/geometry/beampipe/downstream/beampipeDSMother.gdml b/geometry/beampipe/downstream/beampipeDSMother.gdml index 9cf1285ca..22dd5356e 100644 --- a/geometry/beampipe/downstream/beampipeDSMother.gdml +++ b/geometry/beampipe/downstream/beampipeDSMother.gdml @@ -5,7 +5,7 @@ - + - + @@ -112,7 +112,7 @@ - + @@ -172,43 +172,43 @@ - + - + - + - + - - + + - + - - + + @@ -216,7 +216,7 @@ - + From 24eacc5093827a75f6f775ed8833138ceee67e3f Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 29 Sep 2020 10:59:14 -0500 Subject: [PATCH 141/443] [random,io] store random engine state for each event by default --- macros/tests/unit/test_rng_engine.mac | 4 ++-- src/remollRunAction.cc | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/macros/tests/unit/test_rng_engine.mac b/macros/tests/unit/test_rng_engine.mac index defd1a6ff..d78376bb1 100644 --- a/macros/tests/unit/test_rng_engine.mac +++ b/macros/tests/unit/test_rng_engine.mac @@ -1,5 +1,5 @@ -# Store random state to events -/run/storeRndmStatToEvent 1 +# Disable storing random state to events to fail this test +#/run/storeRndmStatToEvent 0 # Ensure rndm1 directory exists /control/shell mkdir -p rndm1 diff --git a/src/remollRunAction.cc b/src/remollRunAction.cc index aefd24006..9e064a8ad 100644 --- a/src/remollRunAction.cc +++ b/src/remollRunAction.cc @@ -33,6 +33,9 @@ remollRunAction::remollRunAction() // Create timer fTimer = new G4Timer(); + + // Store random status before primary particle generation + G4RunManager::GetRunManager()->StoreRandomNumberStatusToG4Event(1); } remollRunAction::~remollRunAction() From 1ea67cf514d900addff34811a8aea954d56555e6 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 29 Sep 2020 11:02:39 -0500 Subject: [PATCH 142/443] [doc] indicate default is to store random engine status --- README.replay.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.replay.md b/README.replay.md index ba458e4b1..a800906a7 100644 --- a/README.replay.md +++ b/README.replay.md @@ -4,9 +4,9 @@ These instructions explain how to replay exactly some previously simulated event ### Run the original large-N simulations -Not every simulation output file can automatically be used to replay certian events. +Not every simulation output file can automatically be used to replay certain events. -You must enable storing the random seed status for each event with the following flag enabled: +You must enable storing the random seed status for each event. This is done by default on recent versions of remoll, but on older versions you will need to run with the following flag enabled: ``` /run/storeRndmStatToEvent 1 ``` From 980dcee93f9ff8f77af31dcc42acf30a8084a324 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 29 Sep 2020 11:11:55 -0500 Subject: [PATCH 143/443] [donut] bugfix: G4_CONCRETE to G4_Pb for 0.1 mm thin face detectors --- geometry/donut/donutConcreteLead.gdml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 200effabb..dcfaa9177 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -133,7 +133,7 @@ - + @@ -141,7 +141,7 @@ - + From 71d711ceb1747d46ec5789c4b656a48d86feea0e Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 29 Sep 2020 11:17:48 -0500 Subject: [PATCH 144/443] [geomtery] pion system: G4_Galactic -> G4_AIR --- geometry/pion/Calorimeter/pionDetectorCalorimeter.gdml | 4 ++-- geometry/pion/GEM/pionDetectorGEM.gdml | 2 +- geometry/pion/Lucite/pionDetectorLucite.gdml | 2 +- geometry/pion/Lucite/pionDetectorLuciteSector.gdml | 4 ++-- geometry/pion/TS/pionDetectorTS.gdml | 2 +- geometry/pion/TS/pionDetectorTSOpenSector.gdml | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/geometry/pion/Calorimeter/pionDetectorCalorimeter.gdml b/geometry/pion/Calorimeter/pionDetectorCalorimeter.gdml index 5d234fc8e..738273958 100644 --- a/geometry/pion/Calorimeter/pionDetectorCalorimeter.gdml +++ b/geometry/pion/Calorimeter/pionDetectorCalorimeter.gdml @@ -64,7 +64,7 @@ - + @@ -92,7 +92,7 @@ - + diff --git a/geometry/pion/GEM/pionDetectorGEM.gdml b/geometry/pion/GEM/pionDetectorGEM.gdml index 3c9b7e782..01a07a7c3 100644 --- a/geometry/pion/GEM/pionDetectorGEM.gdml +++ b/geometry/pion/GEM/pionDetectorGEM.gdml @@ -36,7 +36,7 @@ - + diff --git a/geometry/pion/Lucite/pionDetectorLucite.gdml b/geometry/pion/Lucite/pionDetectorLucite.gdml index ad0d49e7d..f86ee1e2f 100644 --- a/geometry/pion/Lucite/pionDetectorLucite.gdml +++ b/geometry/pion/Lucite/pionDetectorLucite.gdml @@ -648,7 +648,7 @@ - + diff --git a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml index 17bd0cff1..809a82048 100644 --- a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml +++ b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml @@ -72,7 +72,7 @@ - + @@ -87,7 +87,7 @@ - + diff --git a/geometry/pion/TS/pionDetectorTS.gdml b/geometry/pion/TS/pionDetectorTS.gdml index 9436ff4e0..589169e48 100644 --- a/geometry/pion/TS/pionDetectorTS.gdml +++ b/geometry/pion/TS/pionDetectorTS.gdml @@ -30,7 +30,7 @@ - + diff --git a/geometry/pion/TS/pionDetectorTSOpenSector.gdml b/geometry/pion/TS/pionDetectorTSOpenSector.gdml index fd4eaa0f1..678882830 100644 --- a/geometry/pion/TS/pionDetectorTSOpenSector.gdml +++ b/geometry/pion/TS/pionDetectorTSOpenSector.gdml @@ -32,7 +32,7 @@ - + @@ -43,7 +43,7 @@ - + From 955f83801af02ed14c163402766f70cc95f0d48c Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 29 Sep 2020 18:13:55 -0500 Subject: [PATCH 145/443] [geometry] removed old mollerMother, renamed merged to default --- geometry/mollerMother.gdml | 88 ++++++++++++++++------ geometry/mollerMother_dump.gdml | 84 --------------------- geometry/mollerMother_merged.gdml | 120 ------------------------------ 3 files changed, 67 insertions(+), 225 deletions(-) delete mode 100644 geometry/mollerMother_dump.gdml delete mode 100644 geometry/mollerMother_merged.gdml diff --git a/geometry/mollerMother.gdml b/geometry/mollerMother.gdml index 2458d6cc1..167165793 100644 --- a/geometry/mollerMother.gdml +++ b/geometry/mollerMother.gdml @@ -7,7 +7,7 @@ - + &positions; @@ -19,15 +19,51 @@ - - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -40,35 +76,45 @@ - + + - + - - + + + - + - - + + - - + + - - - + + + + + + + + + - + - - + + diff --git a/geometry/mollerMother_dump.gdml b/geometry/mollerMother_dump.gdml deleted file mode 100644 index 44f2f1cd4..000000000 --- a/geometry/mollerMother_dump.gdml +++ /dev/null @@ -1,84 +0,0 @@ - - - - -]> - - - - - &positions; - - - - - - - &world; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/geometry/mollerMother_merged.gdml b/geometry/mollerMother_merged.gdml deleted file mode 100644 index 167165793..000000000 --- a/geometry/mollerMother_merged.gdml +++ /dev/null @@ -1,120 +0,0 @@ - - - - -]> - - - - - &positions; - - - - - - - &world; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 73818d63494757082e61699c9de82ecd59c14941 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 29 Sep 2020 18:21:30 -0500 Subject: [PATCH 146/443] [gui] clarify geometry menu --- macros/gui.mac | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/macros/gui.mac b/macros/gui.mac index 4a29df074..39e4869da 100644 --- a/macros/gui.mac +++ b/macros/gui.mac @@ -22,12 +22,11 @@ # # Geometry menu : /gui/addMenu geom "1. Geometry" -/gui/addButton geom geometry/mollerMother.gdml "/remoll/geometry/setfile geometry/mollerMother.gdml" -/gui/addButton geom geometry/mollerMother_merged.gdml "/remoll/geometry/setfile geometry/mollerMother_merged.gdml" -/gui/addButton geom geometry/mollerMother_parametrized.gdml "/remoll/geometry/setfile geometry/mollerMother_parametrized.gdml" -/gui/addButton geom geometry/pionDetectorLucite.gdml "/remoll/geometry/setfile geometry/pion/Lucite/pionDetectorLucite_world.gdml" -/gui/addButton geom geometry/showerMaxDetector.gdml "/remoll/geometry/setfile geometry/showerMaxDetector.gdml" -/gui/addButton geom geometry/mollerParallel.gdml "/remoll/parallel/setfile geometry/mollerParallel.gdml" +/gui/addButton geom "MOLLER Parallel" "/remoll/parallel/setfile geometry/mollerParallel.gdml" +/gui/addButton geom "MOLLER Experiment" "/remoll/geometry/setfile geometry/mollerMother.gdml" +/gui/addButton geom "MOLLER Experiment (w. dets)" "/remoll/geometry/setfile geometry/mollerMother_parametrized.gdml" +/gui/addButton geom "Only pion system" "/remoll/geometry/setfile geometry/pion/Lucite/pionDetectorLucite_world.gdml" +/gui/addButton geom "Only showermax" "/remoll/geometry/setfile geometry/showerMaxDetector.gdml" # # Initialize menu : /gui/addMenu phys "2. Physics" From 118bcdf97a4891d458dcab246ab2ea0ab277b133 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 29 Sep 2020 19:05:03 -0500 Subject: [PATCH 147/443] [parallel] default to mollerParallel.gdml, instead of blank --- src/remollParallelConstruction.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/remollParallelConstruction.cc b/src/remollParallelConstruction.cc index 0a60f776c..fa5d9483e 100644 --- a/src/remollParallelConstruction.cc +++ b/src/remollParallelConstruction.cc @@ -16,7 +16,7 @@ //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... remollParallelConstruction::remollParallelConstruction(const G4String& name, const G4String& gdmlfile) : G4VUserParallelWorld(name), - fGDMLPath("geometry"),fGDMLFile(""), + fGDMLPath("geometry"),fGDMLFile("mollerParallel.gdml"), fGDMLParser(0), fGDMLValidate(false), fGDMLOverlapCheck(false), From 377a7149cf01641d07445483d3dc357a2e881f9b Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 30 Sep 2020 12:37:44 -0500 Subject: [PATCH 148/443] [geometry] removed more unused mother volumes --- geometry/mollerMother_5open.gdml | 40 --------- .../mollerMother_acceptanceDefinition.gdml | 55 ------------- ...ther_acceptanceDefinition_includeCol4.gdml | 54 ------------ geometry/mollerMother_black.gdml | 82 ------------------- 4 files changed, 231 deletions(-) delete mode 100644 geometry/mollerMother_5open.gdml delete mode 100644 geometry/mollerMother_acceptanceDefinition.gdml delete mode 100644 geometry/mollerMother_acceptanceDefinition_includeCol4.gdml delete mode 100644 geometry/mollerMother_black.gdml diff --git a/geometry/mollerMother_5open.gdml b/geometry/mollerMother_5open.gdml deleted file mode 100644 index 40be70be2..000000000 --- a/geometry/mollerMother_5open.gdml +++ /dev/null @@ -1,40 +0,0 @@ - - - - -]> - - - - - &positions; - - - - - - - &world; - - - - - - - - - - - - - - - - - - - - - - diff --git a/geometry/mollerMother_acceptanceDefinition.gdml b/geometry/mollerMother_acceptanceDefinition.gdml deleted file mode 100644 index e85bf7b27..000000000 --- a/geometry/mollerMother_acceptanceDefinition.gdml +++ /dev/null @@ -1,55 +0,0 @@ - - - - -]> - - - - - &positions; - - - - - - - &world; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/geometry/mollerMother_acceptanceDefinition_includeCol4.gdml b/geometry/mollerMother_acceptanceDefinition_includeCol4.gdml deleted file mode 100644 index 55553dbb5..000000000 --- a/geometry/mollerMother_acceptanceDefinition_includeCol4.gdml +++ /dev/null @@ -1,54 +0,0 @@ - - - - -]> - - - - - &positions; - - - - - - - &world; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/geometry/mollerMother_black.gdml b/geometry/mollerMother_black.gdml deleted file mode 100644 index 602f94472..000000000 --- a/geometry/mollerMother_black.gdml +++ /dev/null @@ -1,82 +0,0 @@ - - - - -]> - - - - - - - - - - -&matrices; - -&materials; - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 0c0c4b06df44f59856ab3b08c794d61fdcf28b60 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 30 Sep 2020 16:12:26 -0500 Subject: [PATCH 149/443] [messenger] accept /remoll/parallel/setfile witout filename to unset --- src/remollParallelConstruction.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/remollParallelConstruction.cc b/src/remollParallelConstruction.cc index fa5d9483e..9a97acf73 100644 --- a/src/remollParallelConstruction.cc +++ b/src/remollParallelConstruction.cc @@ -39,7 +39,9 @@ remollParallelConstruction::remollParallelConstruction(const G4String& name, con "setfile", &remollParallelConstruction::SetGDMLFile, "Set parallel geometry GDML file") - .SetStates(G4State_PreInit); + .SetStates(G4State_PreInit) + .SetDefaultValue("") + .command->GetParameter(0)->SetOmittable(true); fParallelMessenger->DeclareProperty( "verbose", fVerboseLevel, From 5f7ae9e739be1cee0a2f519b8ad245bad8684d05 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 30 Sep 2020 16:14:34 -0500 Subject: [PATCH 150/443] [gui] Geometry > No parallel --- macros/gui.mac | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/gui.mac b/macros/gui.mac index 4a29df074..40a482536 100644 --- a/macros/gui.mac +++ b/macros/gui.mac @@ -28,6 +28,7 @@ /gui/addButton geom geometry/pionDetectorLucite.gdml "/remoll/geometry/setfile geometry/pion/Lucite/pionDetectorLucite_world.gdml" /gui/addButton geom geometry/showerMaxDetector.gdml "/remoll/geometry/setfile geometry/showerMaxDetector.gdml" /gui/addButton geom geometry/mollerParallel.gdml "/remoll/parallel/setfile geometry/mollerParallel.gdml" +/gui/addButton geom "No parallel" "/remoll/parallel/setfile " # # Initialize menu : /gui/addMenu phys "2. Physics" From 5b1e4314c3818698603fcee86702721ca61ed4e9 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 30 Sep 2020 16:24:03 -0500 Subject: [PATCH 151/443] [macros] disable parallel world in pion studies macros --- macros/pion/pionDetectorLucite.mac | 1 + macros/pionDetectorLucite.in | 1 + 2 files changed, 2 insertions(+) diff --git a/macros/pion/pionDetectorLucite.mac b/macros/pion/pionDetectorLucite.mac index eafc7c73d..fb2ca1aa6 100644 --- a/macros/pion/pionDetectorLucite.mac +++ b/macros/pion/pionDetectorLucite.mac @@ -2,6 +2,7 @@ # This must be called before initialize /remoll/geometry/setfile geometry/pion/Lucite/pionDetectorLucite_world.gdml +/remoll/parallel/setfile # Enable optical physics /remoll/physlist/parallel/disable diff --git a/macros/pionDetectorLucite.in b/macros/pionDetectorLucite.in index 831e122e3..9c03d7358 100644 --- a/macros/pionDetectorLucite.in +++ b/macros/pionDetectorLucite.in @@ -1,5 +1,6 @@ # This must be called before initialize /remoll/geometry/setfile geometry/pionDetectorLucite_world.gdml +/remoll/parallel/setfile # Enable optical physics /remoll/physlist/optical/enable From 9a0569cbe8619c740ec809c6763fbeb066bcf6b3 Mon Sep 17 00:00:00 2001 From: Yug34 Date: Fri, 2 Oct 2020 03:59:46 +0530 Subject: [PATCH 152/443] Added remollSearchPath.hh --- CMakeLists.txt | 8 ++++ include/remollSearchPath.hh | 86 +++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 include/remollSearchPath.hh diff --git a/CMakeLists.txt b/CMakeLists.txt index 43a13e494..1fa9a4f45 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -383,6 +383,14 @@ install(FILES ${PROJECT_SOURCE_DIR}/cmake/scripts/RemollUseFile.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/remoll) +#---------------------------------------------------------------------------- +# remollSearchPath + +link_libraries(stdc++fs) +add_definitions( + -DCMAKE_INSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\" + -DCMAKE_INSTALL_FULL_DATADIR=\"${CMAKE_INSTALL_FULL_DATADIR}\" +) #---------------------------------------------------------------------------- # uninstall diff --git a/include/remollSearchPath.hh b/include/remollSearchPath.hh new file mode 100644 index 000000000..416726ec3 --- /dev/null +++ b/include/remollSearchPath.hh @@ -0,0 +1,86 @@ +#ifndef __REMOLLSEARCHPATH_HH +#define __REMOLLSEARCHPATH_HH + +/*! + -------------------------------------------------------------------------------------------- + remollSearchPath + + Header-only file to search for files inside + the remoll directory. + -------------------------------------------------------------------------------------------- + +Usage: + remollSearchPath mySearchPath; + mySearchPath.add("macros"); //< Adds the macros directory to the list of directories the next line will search for gui.mac in + mySearchPath("gui.mac"); //< Returns the canonical path of gui.mac as a std::string + + The add() function by default adds CMAKE_INSTALL_PREFIX, CMAKE_INSTALL_FULL_DATADIR + and the current working directory to the list of directories the operator() will search in. + -------------------------------------------------------------------------------------------- +*/ + +#include +#include "experimental/filesystem" + +namespace fs = std::experimental::filesystem; + +class remollSearchPath +{ +private: + std::vector fSearchPath; +public: + remollSearchPath(); + virtual ~remollSearchPath(); + + void add(const std::string& path); + const std::string operator() (const std::string& filename); +}; + +remollSearchPath::remollSearchPath() +{ + fSearchPath.push_back(fs::path(get_current_dir_name())); //< add cwd to the search path + fSearchPath.push_back(fs::path(CMAKE_INSTALL_PREFIX)); //< add CMAKE_INSTALL_PREFIX to search path + fSearchPath.push_back(fs::path(CMAKE_INSTALL_FULL_DATADIR)); //< add CMAKE_INSTALL_FULL_DATADIR to search path +} + +remollSearchPath::~remollSearchPath() {} + +void remollSearchPath::add(const std::string& path) +{ + // If directory to search in is inside CMAKE_INSTALL_PREFIX + if(fs::exists(fs::path(std::string(CMAKE_INSTALL_PREFIX) + "/" + path))) { + fSearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_PREFIX) + "/" + path)); + } + // If directory to search in is inside CMAKE_INSTALL_FULL_DATADIR + else if(fs::exists(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/" + path))) { + fSearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/" + path)); + } + // If directory to search in is inside the current working directory + else if(fs::exists(fs::path(get_current_dir_name()) / path)) { + fSearchPath.push_back(fs::path(get_current_dir_name()) / path); + } + // Path not relative to CMAKE_INSTALL_PREFIX, CMAKE_INSTALL_FULL_DATADIR + // or the current working directory + // path is probably an absolute path + else if (fs::exists(fs::path(path))) { + fSearchPath.push_back(fs::path(path)); + } +} + +const std::string remollSearchPath::operator() (const std::string& filename) +{ + // If the file you are looking for exists inside any of the + // directories inside fSearchPath, return the filename prefixed with + // the directory for which the full path exists + for (auto path: fSearchPath) { + if(fs::exists(path / filename)) { + return (path / filename).string(); + } + } + + // File not found in any of the search directories, + // return the filename + return std::string(filename); /* and pray everything work */ +} + +#endif //__REMOLLSEARCHPATH_HH From 39e41a06e5841931c35f217aedad09985993f5c4 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 5 Oct 2020 14:06:39 -0500 Subject: [PATCH 153/443] [donut] Implementation of pion lead donut holding frame (stainless I-beam portal) --- geometry/donut/donutConcreteLead.gdml | 75 +++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index dcfaa9177..0fbb802dd 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -30,12 +30,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +

+
+ + + + + + + + + + + + + + +
+
+ + @@ -101,6 +146,15 @@ + + + + + + + + + @@ -167,6 +221,27 @@ + + + + + + + + + + + + + + + + + + + + + From e538efbd54fbb69d8d3f097f395dbf738d955738 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 5 Oct 2020 14:11:53 -0500 Subject: [PATCH 154/443] [donut] Change mother volume from disk to xtru box --- geometry/donut/donutConcreteLead.gdml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 0fbb802dd..f3ef21feb 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -4,9 +4,9 @@ - - - + + + @@ -81,11 +81,14 @@
- - - - + + + + + +
+
+ From edcfdb32229da57fd2fd5148d262bc32455b6d49 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 5 Oct 2020 17:13:11 -0500 Subject: [PATCH 155/443] [donut] put the hole in the donut system --- geometry/donut/donutConcreteLead.gdml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index f3ef21feb..90e4652fb 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -7,6 +7,7 @@ + @@ -81,7 +82,7 @@
- + @@ -89,6 +90,15 @@
+ + + + + + + + From c88ee214d2dcea046d2439ac276980cdc91b386a Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 6 Oct 2020 12:21:22 -0500 Subject: [PATCH 156/443] [geometry] support unit 'in' in gdml files --- src/remollDetectorConstruction.cc | 3 +++ src/remollParallelConstruction.cc | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/remollDetectorConstruction.cc b/src/remollDetectorConstruction.cc index b7153d675..2a029fce7 100644 --- a/src/remollDetectorConstruction.cc +++ b/src/remollDetectorConstruction.cc @@ -63,6 +63,9 @@ remollDetectorConstruction::remollDetectorConstruction(const G4String& name, con // If gdmlfile is non-empty if (gdmlfile.length() > 0) SetGDMLFile(gdmlfile); + // New units + new G4UnitDefinition("inch","in","Length",25.4*CLHEP::millimeter); + // Create GDML parser fGDMLParser = new G4GDMLParser(); diff --git a/src/remollParallelConstruction.cc b/src/remollParallelConstruction.cc index 0a60f776c..892f05d8d 100644 --- a/src/remollParallelConstruction.cc +++ b/src/remollParallelConstruction.cc @@ -31,6 +31,9 @@ remollParallelConstruction::remollParallelConstruction(const G4String& name, con // Create GDML parser fGDMLParser = new G4GDMLParser(); + // New units + new G4UnitDefinition("inch","in","Length",25.4*CLHEP::millimeter); + // Create parallel geometry messenger fParallelMessenger = new G4GenericMessenger(this, "/remoll/parallel/", From 436eedb31b8bf75b3fdd8737e37bd960a30045e4 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 6 Oct 2020 12:22:48 -0500 Subject: [PATCH 157/443] [donut] frame with W 16 x 67 beams per Dave Kashy --- geometry/donut/donutConcreteLead.gdml | 51 ++++++++++++++------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 90e4652fb..833c336f7 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -5,8 +5,8 @@ - - + + @@ -32,15 +32,16 @@ - + - - - + + + + - + @@ -52,32 +53,32 @@ - - - - + + + + - - - - + + + +
- - - - + + + + - - - - + + + +
@@ -246,12 +247,12 @@ - + - + From 7f93a45ed02f07df82af9a8561bf4fbf5881ac03 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 6 Oct 2020 12:37:10 -0500 Subject: [PATCH 158/443] [geometry] missing header for unit 'in' --- src/remollParallelConstruction.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/remollParallelConstruction.cc b/src/remollParallelConstruction.cc index 892f05d8d..168503356 100644 --- a/src/remollParallelConstruction.cc +++ b/src/remollParallelConstruction.cc @@ -9,6 +9,7 @@ #include #include #include +#include "G4UnitsTable.hh" #include "remollGenericDetector.hh" #include "remollIO.hh" From 632089afaad4d8b27a460204f5dea2e01915ed47 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 6 Oct 2020 18:02:23 -0500 Subject: [PATCH 159/443] [gui] bugfix for Top view (-Y) --- macros/gui.mac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/gui.mac b/macros/gui.mac index 4a29df074..55ad9251a 100644 --- a/macros/gui.mac +++ b/macros/gui.mac @@ -70,7 +70,7 @@ /gui/addButton view "Back view (-Z)" "/vis/viewer/set/viewpointThetaPhi 0 0 deg" /gui/addButton view "Side 1 view (+X)" "/vis/viewer/set/viewpointThetaPhi 90 180 deg" /gui/addButton view "Side 2 view (-X)" "/vis/viewer/set/viewpointThetaPhi -90 180 deg" -/gui/addButton view "Top view (-Y) "/vis/viewer/set/viewpointThetaPhi 90 90 deg" +/gui/addButton view "Top view (-Y)" "/vis/viewer/set/viewpointThetaPhi 90 90 deg" /gui/addButton view "Mag fields" "/vis/scene/add/magneticField 50" /gui/addButton view "Refresh viewer (retraverse graphical data)" "/vis/viewer/refresh" /gui/addButton view "Update viewer (interaction or end-of-file)" "/vis/viewer/update" From 0299f9940537866b8463e90da6936e2113be3836 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 6 Oct 2020 22:57:42 -0500 Subject: [PATCH 160/443] [travis-ci] run release macros only on master --- .travis.yml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8a3665ed8..79e2aa0af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,12 +41,25 @@ jobs: echo "=== scripts/tests/test_macros.sh ${suite} ===" ; mkdir -p ${PWD}/logfiles ${PWD}/rootfiles ; time docker run --rm -v ${PWD}/rootfiles:/jlab/remoll/rootfiles -v ${PWD}/logfiles:/jlab/remoll/logfiles -t jeffersonlab/remoll:$TRAVIS_BRANCH sh -c " - scripts/tests/test_macros.sh ${suite} && - scripts/tests/targz_macros.sh ${suite} && - scripts/tests/watermark.sh ${suite} - " ; + scripts/tests/test_macros.sh ${suite} + " ; done ; ls -al ${PWD}/logfiles ${PWD}/rootfiles + - script: + - if [ "$TRAVIS_BRANCH" == "master" ]; then + for suite in release ; do + echo "=== scripts/tests/test_macros.sh ${suite} ===" ; + mkdir -p ${PWD}/logfiles ${PWD}/rootfiles ; + time docker run --rm -v ${PWD}/rootfiles:/jlab/remoll/rootfiles -v ${PWD}/logfiles:/jlab/remoll/logfiles -t jeffersonlab/remoll:$TRAVIS_BRANCH sh -c " + scripts/tests/test_macros.sh ${suite} && + scripts/tests/targz_macros.sh ${suite} && + scripts/tests/watermark.sh ${suite} + " ; + done ; + ls -al ${PWD}/logfiles ${PWD}/rootfiles ; + else + echo "Not + fi notifications: slack: From 22d182233dc4e46c0dc6f4e7e7c5ff75b85e3280 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 6 Oct 2020 23:00:07 -0500 Subject: [PATCH 161/443] [travis-ci] shorter commit macros --- macros/tests/commit/test_beam.mac | 27 +++-------------------- macros/tests/commit/test_elastic.mac | 8 ++----- macros/tests/commit/test_elasticAl.mac | 8 ++----- macros/tests/commit/test_elasticAl_DS.mac | 8 ++----- macros/tests/commit/test_elasticAl_US.mac | 8 ++----- macros/tests/commit/test_inelastic.mac | 8 ++----- macros/tests/commit/test_inelasticAl.mac | 8 ++----- macros/tests/commit/test_moller.mac | 8 ++----- macros/tests/commit/test_pion.mac | 8 ++----- macros/tests/commit/test_power.mac | 3 +-- macros/tests/commit/test_raster.mac | 8 ++----- 11 files changed, 22 insertions(+), 80 deletions(-) diff --git a/macros/tests/commit/test_beam.mac b/macros/tests/commit/test_beam.mac index 7e894b30e..b3e957d22 100644 --- a/macros/tests/commit/test_beam.mac +++ b/macros/tests/commit/test_beam.mac @@ -1,7 +1,6 @@ # This must be called before initialize /remoll/geometry/setfile geometry/mollerMother.gdml /remoll/parallel/setfile geometry/mollerParallel.gdml -/remoll/physlist/parallel/enable # This must be explicitly called /run/initialize @@ -17,37 +16,17 @@ # Beam energy /remoll/beamene 11 GeV - +# Beam generator /remoll/evgen/set beam -#/remoll/evgen/set moller -#/remoll/evgen/thcommin 30.0 deg -#/remoll/evgen/thcommax 150.0 deg -#/remoll/evgen/set elastic -#/remoll/evgen/emin 80.0 MeV -#/remoll/evgen/set inelastic -#/remoll/evgen/set pion -#/remoll/piontype pi- -#/remoll/evgen/set pion_LUND -#/remoll/evgen/set inelasticAl -#/remoll/evgen/set quasielasticAl -#/remoll/evgen/set elasticAl - -# Generation limits -# theta -/remoll/evgen/thmin 0.5 deg -/remoll/evgen/thmax 3.0 deg # Beam current for rate /remoll/beamcurr 85 microampere -# Make interactions with W, Cu, and Pb -# realistic rather than pure absorbers -/control/execute macros/kryptonite.mac - +# Seed /remoll/seed 123456 # Output /remoll/filename test_beam.root # Shoot -/run/beamOn 1000 +/run/beamOn 100 diff --git a/macros/tests/commit/test_elastic.mac b/macros/tests/commit/test_elastic.mac index ac6664455..956b17e8f 100644 --- a/macros/tests/commit/test_elastic.mac +++ b/macros/tests/commit/test_elastic.mac @@ -1,7 +1,6 @@ # This must be called before initialize /remoll/geometry/setfile geometry/mollerMother.gdml /remoll/parallel/setfile geometry/mollerParallel.gdml -/remoll/physlist/parallel/enable # This must be explicitly called /run/initialize @@ -40,14 +39,11 @@ # Beam current for rate /remoll/beamcurr 85 microampere -# Make interactions with W, Cu, and Pb -# realistic rather than pure absorbers -/control/execute macros/kryptonite.mac - +# Seed /remoll/seed 123456 # Output /remoll/filename test_elastic.root # Shoot -/run/beamOn 1000 +/run/beamOn 100 diff --git a/macros/tests/commit/test_elasticAl.mac b/macros/tests/commit/test_elasticAl.mac index 67f90ecf6..a74f20e2f 100644 --- a/macros/tests/commit/test_elasticAl.mac +++ b/macros/tests/commit/test_elasticAl.mac @@ -1,7 +1,6 @@ # This must be called before initialize /remoll/geometry/setfile geometry/mollerMother.gdml /remoll/parallel/setfile geometry/mollerParallel.gdml -/remoll/physlist/parallel/enable # This must be explicitly called /run/initialize @@ -29,14 +28,11 @@ # Beam current for rate /remoll/beamcurr 85 microampere -# Make interactions with W, Cu, and Pb -# realistic rather than pure absorbers -/control/execute macros/kryptonite.mac - +# Seed /remoll/seed 123456 # Output /remoll/filename test_elasticAl.root # Shoot -/run/beamOn 10000 +/run/beamOn 100 diff --git a/macros/tests/commit/test_elasticAl_DS.mac b/macros/tests/commit/test_elasticAl_DS.mac index 50580287a..44e833d76 100644 --- a/macros/tests/commit/test_elasticAl_DS.mac +++ b/macros/tests/commit/test_elasticAl_DS.mac @@ -1,7 +1,6 @@ # This must be called before initialize /remoll/geometry/setfile geometry/mollerMother.gdml /remoll/parallel/setfile geometry/mollerParallel.gdml -/remoll/physlist/parallel/enable # This must be explicitly called /run/initialize @@ -31,14 +30,11 @@ # Beam current for rate /remoll/beamcurr 85 microampere -# Make interactions with W, Cu, and Pb -# realistic rather than pure absorbers -/control/execute macros/kryptonite.mac - +# Seed /remoll/seed 123456 # Output /remoll/filename test_elasticAl_DS.root # Shoot -/run/beamOn 10000 +/run/beamOn 100 diff --git a/macros/tests/commit/test_elasticAl_US.mac b/macros/tests/commit/test_elasticAl_US.mac index 6b2d29e4b..0d53244a7 100644 --- a/macros/tests/commit/test_elasticAl_US.mac +++ b/macros/tests/commit/test_elasticAl_US.mac @@ -1,7 +1,6 @@ # This must be called before initialize /remoll/geometry/setfile geometry/mollerMother.gdml /remoll/parallel/setfile geometry/mollerParallel.gdml -/remoll/physlist/parallel/enable # This must be explicitly called /run/initialize @@ -31,14 +30,11 @@ # Beam current for rate /remoll/beamcurr 85 microampere -# Make interactions with W, Cu, and Pb -# realistic rather than pure absorbers -/control/execute macros/kryptonite.mac - +# Seed /remoll/seed 123456 # Output /remoll/filename test_elasticAl_US.root # Shoot -/run/beamOn 10000 +/run/beamOn 100 diff --git a/macros/tests/commit/test_inelastic.mac b/macros/tests/commit/test_inelastic.mac index 7efd556b3..3e22473f7 100644 --- a/macros/tests/commit/test_inelastic.mac +++ b/macros/tests/commit/test_inelastic.mac @@ -1,7 +1,6 @@ # This must be called before initialize /remoll/geometry/setfile geometry/mollerMother.gdml /remoll/parallel/setfile geometry/mollerParallel.gdml -/remoll/physlist/parallel/enable # This must be explicitly called /run/initialize @@ -40,14 +39,11 @@ # Beam current for rate /remoll/beamcurr 85 microampere -# Make interactions with W, Cu, and Pb -# realistic rather than pure absorbers -/control/execute macros/kryptonite.mac - +# Seed /remoll/seed 123456 # Output /remoll/filename test_inelastic.root # Shoot -/run/beamOn 1000 +/run/beamOn 100 diff --git a/macros/tests/commit/test_inelasticAl.mac b/macros/tests/commit/test_inelasticAl.mac index eb4ab9057..4317717f3 100644 --- a/macros/tests/commit/test_inelasticAl.mac +++ b/macros/tests/commit/test_inelasticAl.mac @@ -1,7 +1,6 @@ # This must be called before initialize /remoll/geometry/setfile geometry/mollerMother.gdml /remoll/parallel/setfile geometry/mollerParallel.gdml -/remoll/physlist/parallel/enable # This must be explicitly called /run/initialize @@ -40,14 +39,11 @@ # Beam current for rate /remoll/beamcurr 85 microampere -# Make interactions with W, Cu, and Pb -# realistic rather than pure absorbers -/control/execute macros/kryptonite.mac - +# Seed /remoll/seed 123456 # Output /remoll/filename test_inelasticAl.root # Shoot -/run/beamOn 1000 +/run/beamOn 100 diff --git a/macros/tests/commit/test_moller.mac b/macros/tests/commit/test_moller.mac index b31198495..9343c5831 100644 --- a/macros/tests/commit/test_moller.mac +++ b/macros/tests/commit/test_moller.mac @@ -1,7 +1,6 @@ # This must be called before initialize /remoll/geometry/setfile geometry/mollerMother.gdml /remoll/parallel/setfile geometry/mollerParallel.gdml -/remoll/physlist/parallel/enable # This must be explicitly called /run/initialize @@ -40,14 +39,11 @@ # Beam current for rate /remoll/beamcurr 85 microampere -# Make interactions with W, Cu, and Pb -# realistic rather than pure absorbers -/control/execute macros/kryptonite.mac - +# Seed /remoll/seed 123456 # Output /remoll/filename test_moller.root # Shoot -/run/beamOn 1000 +/run/beamOn 100 diff --git a/macros/tests/commit/test_pion.mac b/macros/tests/commit/test_pion.mac index 021248939..4f97ab2c9 100644 --- a/macros/tests/commit/test_pion.mac +++ b/macros/tests/commit/test_pion.mac @@ -1,7 +1,6 @@ # This must be called before initialize /remoll/geometry/setfile geometry/mollerMother.gdml /remoll/parallel/setfile geometry/mollerParallel.gdml -/remoll/physlist/parallel/enable # This must be explicitly called /run/numberOfThreads 1 @@ -41,14 +40,11 @@ # Beam current for rate /remoll/beamcurr 85 microampere -# Make interactions with W, Cu, and Pb -# realistic rather than pure absorbers -/control/execute macros/kryptonite.mac - +# Seed /remoll/seed 123456 # Output /remoll/filename test_pion.root # Shoot -/run/beamOn 1000 +/run/beamOn 100 diff --git a/macros/tests/commit/test_power.mac b/macros/tests/commit/test_power.mac index 581ab89f6..d664abf98 100644 --- a/macros/tests/commit/test_power.mac +++ b/macros/tests/commit/test_power.mac @@ -1,7 +1,6 @@ # This must be called before initialize /remoll/geometry/setfile geometry/mollerMother.gdml /remoll/parallel/setfile geometry/mollerParallel.gdml -/remoll/physlist/parallel/enable # This must be explicitly called /run/initialize @@ -18,4 +17,4 @@ /remoll/filename test_power.root # Shoot -/run/beamOn 10000 +/run/beamOn 100 diff --git a/macros/tests/commit/test_raster.mac b/macros/tests/commit/test_raster.mac index 05d81c0d5..8c73dc499 100644 --- a/macros/tests/commit/test_raster.mac +++ b/macros/tests/commit/test_raster.mac @@ -1,7 +1,6 @@ # This must be called before initialize /remoll/geometry/setfile geometry/mollerMother.gdml /remoll/parallel/setfile geometry/mollerParallel.gdml -/remoll/physlist/parallel/enable # This must be explicitly called /run/initialize @@ -52,14 +51,11 @@ # Beam current for rate /remoll/beamcurr 85 microampere -# Make interactions with W, Cu, and Pb -# realistic rather than pure absorbers -/control/execute macros/kryptonite.mac - +# Seed /remoll/seed 123456 # Output /remoll/filename test_raster.root # Shoot -/run/beamOn 1000 +/run/beamOn 100 From a4996d73666e056a015a61db52e876cb419c35c1 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 6 Oct 2020 23:00:22 -0500 Subject: [PATCH 162/443] [travis-ci] streamline release macros --- macros/tests/release/test_moller.mac | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/macros/tests/release/test_moller.mac b/macros/tests/release/test_moller.mac index 3a40ed168..83887d0e2 100644 --- a/macros/tests/release/test_moller.mac +++ b/macros/tests/release/test_moller.mac @@ -1,7 +1,6 @@ # This must be called before initialize /remoll/geometry/setfile geometry/mollerMother.gdml /remoll/parallel/setfile geometry/mollerParallel.gdml -/remoll/physlist/parallel/enable # This must be explicitly called /run/initialize @@ -40,10 +39,7 @@ # Beam current for rate /remoll/beamcurr 85 microampere -# Make interactions with W, Cu, and Pb -# realistic rather than pure absorbers -/control/execute macros/kryptonite.mac - +# Seed /remoll/seed 123456 # Output From edeea7457eb8f54058565c03472480316156dc26 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 6 Oct 2020 23:00:52 -0500 Subject: [PATCH 163/443] [travis-ci] provide time summary at end --- scripts/tests/test_macros.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/tests/test_macros.sh b/scripts/tests/test_macros.sh index 970f52a3f..44cf1df56 100755 --- a/scripts/tests/test_macros.sh +++ b/scripts/tests/test_macros.sh @@ -61,6 +61,11 @@ if [ "$suite" == "valgrind" ] ; then echo fi +# Accumulate timing information +mkdir -p ${logfiles} +rm -rf ${logfiles}/time.log +export TIME="%E real,\t%U user,\t%S sys,\t%C" +time="time -a -o ${logfiles}/time.log" # Run test suite macros as requested for macro in ${macros}/${macroglob} ; do @@ -72,7 +77,7 @@ for macro in ${macros}/${macroglob} ; do # Run remoll macro mkdir -p ${logfiles} - time $prefix remoll ${macro} 2>&1 | tee ${logfiles}/${name}.log + $time $prefix remoll ${macro} 2>&1 | tee ${logfiles}/${name}.log # Unit tests do not have output if [ "$suite" == "unit" ] ; then @@ -95,7 +100,8 @@ for macro in ${macros}/${macroglob} ; do echo "Starting analysis..." | tee ${logfiles}/analysis/${name}.log for rootmacro in ${analysis1}/${analysisglob} ${analysis2}/${analysisglob} ; do echo "Running analysis macro `basename ${rootmacro} .C`..." - time reroot -q -b -l "${rootmacro}+(\"${rootfiles}\",\"${name}\")" 2>&1 | tee -a ${logfiles}/analysis/${name}.log + $time reroot -q -b -l "${rootmacro}+(\"${rootfiles}\",\"${name}\")" 2>&1 | tee -a ${logfiles}/analysis/${name}.log done done +cat ${logfiles}/time.log From 80012a20febccd0f5f92952c5cec8241ec33cb47 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 6 Oct 2020 23:02:03 -0500 Subject: [PATCH 164/443] Warn only when reused DetNo in gdml have different volume name --- src/remollDetectorConstruction.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/remollDetectorConstruction.cc b/src/remollDetectorConstruction.cc index 2a029fce7..6c38e1e27 100644 --- a/src/remollDetectorConstruction.cc +++ b/src/remollDetectorConstruction.cc @@ -835,13 +835,20 @@ void remollDetectorConstruction::ParseAuxiliarySensDetInfo() bool enabled = (det_no > 0)? false : true; det_no = std::abs(det_no); + // Allow detector number sharing + auto it_detnoshared = NextAuxWithType(list.begin(), list.end(), "DetNoShared"); + bool detnoshared = false; + if (it_detnoshared != list.end()) + if (it_detnoshared->value == "true") + detnoshared = true; + // Construct detector name std::stringstream det_name_ss; det_name_ss << "remoll/det_" << det_no; std::string det_name = det_name_ss.str(); - // Check for duplication - if (detnomap.count(det_no) != 0) { + // Check for duplication when not a shared detector number + if (!detnoshared && detnomap.count(det_no) != 0 && detnomap[det_no]->GetName() != myvol->GetName()) { G4cerr << "remoll: DetNo " << det_no << " for " << myvol->GetName() << G4endl; G4cerr << "remoll: already used by " << detnomap[det_no]->GetName() << G4endl; } From 02b35a54f7a182981570f73fc9cd4d36fff45a2b Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 6 Oct 2020 23:12:53 -0500 Subject: [PATCH 165/443] [macros] remaining refs to mollerMother_merged -> mollerMother.gdml --- macros/envelope_data.mac | 2 +- macros/hepmc/ee_ee_hepmc.mac | 2 +- macros/hepmc/ee_ee_moller.mac | 2 +- macros/hepmc/ep_ep_elastic.mac | 2 +- macros/hepmc/ep_ep_hepmc.mac | 2 +- macros/issues/issue179.mac | 2 +- macros/issues/issue186_set1.mac | 2 +- macros/issues/issue186_set2.mac | 2 +- macros/issues/issue186_set3.mac | 2 +- macros/issues/issue186_set4.mac | 2 +- macros/issues/issue186_set5.mac | 2 +- macros/runBeam.mac | 2 +- macros/runEE.mac | 2 +- macros/runEPpion.mac | 2 +- macros/runexample.mac | 2 +- macros/runexample_envelope.mac | 2 +- macros/runexample_vis.mac | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/macros/envelope_data.mac b/macros/envelope_data.mac index b1c5a725e..557be7035 100644 --- a/macros/envelope_data.mac +++ b/macros/envelope_data.mac @@ -4,7 +4,7 @@ /tracking/storeTrajectory 1 # This must be called before initialize -/remoll/setgeofile geometry/mollerMother_merged.gdml +/remoll/setgeofile geometry/mollerMother.gdml # This must be explicitly called /run/initialize diff --git a/macros/hepmc/ee_ee_hepmc.mac b/macros/hepmc/ee_ee_hepmc.mac index d761c4670..71a0e99f0 100644 --- a/macros/hepmc/ee_ee_hepmc.mac +++ b/macros/hepmc/ee_ee_hepmc.mac @@ -1,4 +1,4 @@ -/remoll/geometry/setfile geometry/mollerMother_merged.gdml +/remoll/geometry/setfile geometry/mollerMother.gdml /remoll/parallel/setfile geometry/mollerParallel.gdml /remoll/physlist/parallel/enable diff --git a/macros/hepmc/ee_ee_moller.mac b/macros/hepmc/ee_ee_moller.mac index e9e065674..cbcabdd2a 100644 --- a/macros/hepmc/ee_ee_moller.mac +++ b/macros/hepmc/ee_ee_moller.mac @@ -1,4 +1,4 @@ -/remoll/geometry/setfile geometry/mollerMother_merged.gdml +/remoll/geometry/setfile geometry/mollerMother.gdml /remoll/parallel/setfile geometry/mollerParallel.gdml /remoll/physlist/parallel/enable diff --git a/macros/hepmc/ep_ep_elastic.mac b/macros/hepmc/ep_ep_elastic.mac index 6297fa8b3..624692857 100644 --- a/macros/hepmc/ep_ep_elastic.mac +++ b/macros/hepmc/ep_ep_elastic.mac @@ -1,4 +1,4 @@ -/remoll/geometry/setfile geometry/mollerMother_merged.gdml +/remoll/geometry/setfile geometry/mollerMother.gdml /remoll/parallel/setfile geometry/mollerParallel.gdml /remoll/physlist/parallel/enable diff --git a/macros/hepmc/ep_ep_hepmc.mac b/macros/hepmc/ep_ep_hepmc.mac index 913fc56ca..44197bcb4 100644 --- a/macros/hepmc/ep_ep_hepmc.mac +++ b/macros/hepmc/ep_ep_hepmc.mac @@ -1,4 +1,4 @@ -/remoll/geometry/setfile geometry/mollerMother_merged.gdml +/remoll/geometry/setfile geometry/mollerMother.gdml /remoll/parallel/setfile geometry/mollerParallel.gdml /remoll/physlist/parallel/enable diff --git a/macros/issues/issue179.mac b/macros/issues/issue179.mac index c3a316230..5c10ab729 100644 --- a/macros/issues/issue179.mac +++ b/macros/issues/issue179.mac @@ -1,4 +1,4 @@ -/remoll/setgeofile geometry/mollerMother_merged.gdml +/remoll/setgeofile geometry/mollerMother.gdml /run/initialize /remoll/addfield map_directory/blockyHybrid_rm_3.0.txt /remoll/addfield map_directory/blockyUpstream_rm_1.1.txt diff --git a/macros/issues/issue186_set1.mac b/macros/issues/issue186_set1.mac index 1fa6f0db6..0350941c1 100644 --- a/macros/issues/issue186_set1.mac +++ b/macros/issues/issue186_set1.mac @@ -1,4 +1,4 @@ -/remoll/setgeofile geometry/mollerMother_merged.gdml +/remoll/setgeofile geometry/mollerMother.gdml /run/initialize /remoll/addfield map_directory/blockyHybrid_rm_3.0.txt /remoll/addfield map_directory/blockyUpstream_rm_1.1.txt diff --git a/macros/issues/issue186_set2.mac b/macros/issues/issue186_set2.mac index 9d2b64f6d..00ecbf22a 100644 --- a/macros/issues/issue186_set2.mac +++ b/macros/issues/issue186_set2.mac @@ -1,4 +1,4 @@ -/remoll/setgeofile geometry/mollerMother_merged.gdml +/remoll/setgeofile geometry/mollerMother.gdml /run/initialize /remoll/addfield map_directory/blockyHybrid_rm_3.0.txt /remoll/addfield map_directory/blockyUpstream_rm_1.1.txt diff --git a/macros/issues/issue186_set3.mac b/macros/issues/issue186_set3.mac index 218991f96..d5f9bd118 100644 --- a/macros/issues/issue186_set3.mac +++ b/macros/issues/issue186_set3.mac @@ -1,4 +1,4 @@ -/remoll/setgeofile geometry/mollerMother_merged.gdml +/remoll/setgeofile geometry/mollerMother.gdml /run/initialize /remoll/addfield map_directory/blockyHybrid_rm_3.0.txt /remoll/addfield map_directory/blockyUpstream_rm_1.1.txt diff --git a/macros/issues/issue186_set4.mac b/macros/issues/issue186_set4.mac index 34d237524..6262d9965 100644 --- a/macros/issues/issue186_set4.mac +++ b/macros/issues/issue186_set4.mac @@ -1,4 +1,4 @@ -/remoll/setgeofile geometry/mollerMother_merged.gdml +/remoll/setgeofile geometry/mollerMother.gdml /run/initialize /remoll/addfield map_directory/blockyHybrid_rm_3.0.txt /remoll/addfield map_directory/blockyUpstream_rm_1.1.txt diff --git a/macros/issues/issue186_set5.mac b/macros/issues/issue186_set5.mac index 9cadfa933..be7c6aba1 100644 --- a/macros/issues/issue186_set5.mac +++ b/macros/issues/issue186_set5.mac @@ -1,4 +1,4 @@ -/remoll/setgeofile geometry/mollerMother_merged.gdml +/remoll/setgeofile geometry/mollerMother.gdml /run/initialize /remoll/addfield map_directory/blockyHybrid_rm_3.0.txt /remoll/addfield map_directory/blockyUpstream_rm_1.1.txt diff --git a/macros/runBeam.mac b/macros/runBeam.mac index b069108c1..39fc0138d 100644 --- a/macros/runBeam.mac +++ b/macros/runBeam.mac @@ -1,4 +1,4 @@ -/remoll/setgeofile geometry/mollerMother_merged.gdml +/remoll/setgeofile geometry/mollerMother.gdml /remoll/physlist/register QGSP_BERT_HP /remoll/physlist/parallel/enable /remoll/parallel/setfile geometry/mollerParallel.gdml diff --git a/macros/runEE.mac b/macros/runEE.mac index 03836866f..d125b20c1 100644 --- a/macros/runEE.mac +++ b/macros/runEE.mac @@ -1,4 +1,4 @@ -/remoll/setgeofile geometry/mollerMother_merged.gdml +/remoll/setgeofile geometry/mollerMother.gdml /remoll/physlist/register QGSP_BERT_HP /remoll/physlist/parallel/enable /remoll/parallel/setfile geometry/mollerParallel.gdml diff --git a/macros/runEPpion.mac b/macros/runEPpion.mac index 50efba104..955bcb939 100644 --- a/macros/runEPpion.mac +++ b/macros/runEPpion.mac @@ -1,4 +1,4 @@ -/remoll/setgeofile geometry/mollerMother_merged.gdml +/remoll/setgeofile geometry/mollerMother.gdml /remoll/physlist/register QGSP_BERT_HP /remoll/physlist/parallel/enable /remoll/parallel/setfile geometry/mollerParallel.gdml diff --git a/macros/runexample.mac b/macros/runexample.mac index 718f90053..36bfe7650 100644 --- a/macros/runexample.mac +++ b/macros/runexample.mac @@ -4,7 +4,7 @@ #/tracking/storeTrajectory 1 # This must be called before initialize -/remoll/geometry/setfile geometry/mollerMother_merged.gdml +/remoll/geometry/setfile geometry/mollerMother.gdml # Parallel world geometry is optional - detector 28 (the primary detector array's idealize vacuum detector) is included in this parallel world now. /remoll/parallel/setfile geometry/mollerParallel.gdml diff --git a/macros/runexample_envelope.mac b/macros/runexample_envelope.mac index b4a781db1..34fcc52a0 100644 --- a/macros/runexample_envelope.mac +++ b/macros/runexample_envelope.mac @@ -1,6 +1,6 @@ # Macrofile # This must be called before initialize -/remoll/setgeofile geometry/mollerMother_merged.gdml +/remoll/setgeofile geometry/mollerMother.gdml # This must be explicitly called /run/initialize /remoll/tracking/set 0 diff --git a/macros/runexample_vis.mac b/macros/runexample_vis.mac index bdba56986..65cb4dec0 100644 --- a/macros/runexample_vis.mac +++ b/macros/runexample_vis.mac @@ -4,7 +4,7 @@ /remoll/physlist/optical/enable # This is the current working geometry -/remoll/setgeofile geometry/mollerMother_merged.gdml +/remoll/setgeofile geometry/mollerMother.gdml #/remoll/likekryptonite true From 0f6daf95e5c3f2fd72b1fd026dde4fc1a9ad9d77 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 7 Oct 2020 08:20:04 -0500 Subject: [PATCH 166/443] [travis-ci] Hanging line fixed --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 79e2aa0af..3fa7487c5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -56,9 +56,7 @@ jobs: scripts/tests/watermark.sh ${suite} " ; done ; - ls -al ${PWD}/logfiles ${PWD}/rootfiles ; - else - echo "Not + ls -al ${PWD}/logfiles ${PWD}/rootfiles ; fi notifications: From 7bf6d6d7858504c82fbb4c9ff8b5d933c0b5a8c2 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 7 Oct 2020 09:05:29 -0500 Subject: [PATCH 167/443] [docker] Include time command since sometimes not found as bash builtin --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index addc6e4f1..8c6afbd28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ FROM jeffersonlab/jlabce:2.3-mt # Install libgcj and pdftk RUN wget -q https://copr.fedorainfracloud.org/coprs/robert/gcj/repo/epel-7/robert-gcj-epel-7.repo -P /etc/yum.repos.d && \ wget -q https://copr.fedorainfracloud.org/coprs/robert/pdftk/repo/epel-7/robert-pdftk-epel-7.repo -P /etc/yum.repos.d && \ - yum install -q -y pdftk ghostscript + yum install -q -y pdftk ghostscript time # Add Tini entry point ENV TINI_VERSION v0.19.0 From cf90554f39c6e625d1ccc7593f1b5241d19b3194 Mon Sep 17 00:00:00 2001 From: Fatemeh Gorgannejad Date: Tue, 13 Oct 2020 08:56:56 -0500 Subject: [PATCH 168/443] q --- geometry/pion/Lucite/pionDetectorLucite.gdml | 12 +++--- .../pion/Lucite/pionDetectorLuciteSector.gdml | 4 +- geometry/pion/pionDetectorSystem.gdml | 8 ++-- geometry/pion/pionDetectorSystem_world.gdml | 2 +- geometry/positions.xml | 4 +- macros/pion/pion_rates_at_lucite_plane.mac | 37 +++++++++---------- 6 files changed, 33 insertions(+), 34 deletions(-) diff --git a/geometry/pion/Lucite/pionDetectorLucite.gdml b/geometry/pion/Lucite/pionDetectorLucite.gdml index f86ee1e2f..8d28d4114 100644 --- a/geometry/pion/Lucite/pionDetectorLucite.gdml +++ b/geometry/pion/Lucite/pionDetectorLucite.gdml @@ -8,7 +8,7 @@ - + @@ -49,8 +49,8 @@ - - + + @@ -58,7 +58,7 @@ - + @@ -69,7 +69,7 @@ - + diff --git a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml index 809a82048..3038daa21 100644 --- a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml +++ b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml @@ -20,7 +20,7 @@ you modify the angle below so as to avoid overlaps between this volume and the trigger scintillator and volumes. --> - + - + - - - + + + @@ -24,7 +24,7 @@ - + diff --git a/geometry/pion/pionDetectorSystem_world.gdml b/geometry/pion/pionDetectorSystem_world.gdml index d998ee686..96f0f20be 100644 --- a/geometry/pion/pionDetectorSystem_world.gdml +++ b/geometry/pion/pionDetectorSystem_world.gdml @@ -3,7 +3,7 @@ - + diff --git a/geometry/positions.xml b/geometry/positions.xml index 1cb583554..7e2d274af 100644 --- a/geometry/positions.xml +++ b/geometry/positions.xml @@ -45,8 +45,8 @@ - - + + diff --git a/macros/pion/pion_rates_at_lucite_plane.mac b/macros/pion/pion_rates_at_lucite_plane.mac index 3d50a44a6..42a0a5a0e 100644 --- a/macros/pion/pion_rates_at_lucite_plane.mac +++ b/macros/pion/pion_rates_at_lucite_plane.mac @@ -41,7 +41,7 @@ /remoll/filename pion_rates_at_lucite_plane_evgen_pion_1k.root # Number of events -/run/beamOn 1000 +/run/beamOn 10000 ### 2. moller electrons @@ -61,44 +61,43 @@ /remoll/filename pion_rates_at_lucite_plane_evgen_moller_1k.root # Number of events -/run/beamOn 1000 +/run/beamOn 10000 ### 3. ep elastic electrons -/remoll/evgen/set elastic +#/remoll/evgen/set elastic +#/remoll/evgen/emin 0.0 MeV +#/remoll/evgen/emax 11.0 GeV -/remoll/evgen/emin 0.0 MeV -/remoll/evgen/emax 11.0 GeV - -/remoll/evgen/thmin 0.5 deg -/remoll/evgen/thmax 3.0 deg +#/remoll/evgen/thmin 0.5 deg +#/remoll/evgen/thmax 3.0 deg # Specify random number seed -/remoll/seed 1234 +#/remoll/seed 1234 # Filename -/remoll/filename pion_rates_at_lucite_plane_evgen_ep_elastic_1k.root +#/remoll/filename pion_rates_at_lucite_plane_evgen_ep_elastic_1k.root # Number of events -/run/beamOn 1000 +#/run/beamOn 1000 ### 4. ep inelastic electrons -/remoll/evgen/set inelastic +#/remoll/evgen/set inelastic -/remoll/evgen/emin 0.0 MeV -/remoll/evgen/emax 11.0 GeV +#/remoll/evgen/emin 0.0 MeV +#/remoll/evgen/emax 11.0 GeV -/remoll/evgen/thmin 0.5 deg -/remoll/evgen/thmax 3.0 deg +#/remoll/evgen/thmin 0.5 deg +#/remoll/evgen/thmax 3.0 deg # Specify random number seed -/remoll/seed 1234 +#/remoll/seed 1234 # Filename -/remoll/filename pion_rates_at_lucite_plane_evgen_ep_inelastic_1k.root +#/remoll/filename pion_rates_at_lucite_plane_evgen_ep_inelastic_1k.root # Number of events -/run/beamOn 1000 +#/run/beamOn 1000 From 553107ae67437e0757f30fa4d8347d96c71ffa2e Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 19 Oct 2020 09:47:53 -0500 Subject: [PATCH 169/443] [donut] for showermax radius 101 - 117 cm per email w/ Dustin Oct 9, 2020 --- geometry/donut/donutConcreteLead.gdml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 833c336f7..2d3ffae47 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -14,17 +14,17 @@ - - - - + + + + - - - - + + + + From 29eafad4d0efc0765f667f027db84cf5ec32a421 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 19 Oct 2020 09:48:35 -0500 Subject: [PATCH 170/443] [showermax] radius 101 - 117 cm per email w/ Dustin Oct 9, 2020 --- geometry/showermax/showerMaxGen.gdml | 56 ++++++++++++++-------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/geometry/showermax/showerMaxGen.gdml b/geometry/showermax/showerMaxGen.gdml index 502782c69..bb67ce373 100644 --- a/geometry/showermax/showerMaxGen.gdml +++ b/geometry/showermax/showerMaxGen.gdml @@ -3724,142 +3724,142 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + From 77aeeda4e79adaa27237e526a65bb4a8303956a1 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 19 Oct 2020 17:34:28 -0500 Subject: [PATCH 171/443] [gdml] reference to defined position needs `positionref` tag --- geometry/hybrid/hybridDaughter_merged.gdml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geometry/hybrid/hybridDaughter_merged.gdml b/geometry/hybrid/hybridDaughter_merged.gdml index 18695de40..7b933da6c 100644 --- a/geometry/hybrid/hybridDaughter_merged.gdml +++ b/geometry/hybrid/hybridDaughter_merged.gdml @@ -255,7 +255,7 @@ - + From a4a7a17131b702ccd035674c9a69018e9a75e2ee Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 19 Oct 2020 17:55:28 -0500 Subject: [PATCH 172/443] [gdml] validation fixes in showermax, also https://github.com/JeffersonLab/remoll-showermax-generator/commit/b7352dc995e4e22478aa49091ea06043fd89b4ee --- .../generators/remoll-showermax-generator | 2 +- geometry/showermax/showerMaxGen.gdml | 65 ++++++++++--------- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/geometry/generators/remoll-showermax-generator b/geometry/generators/remoll-showermax-generator index f725e2213..b7352dc99 160000 --- a/geometry/generators/remoll-showermax-generator +++ b/geometry/generators/remoll-showermax-generator @@ -1 +1 @@ -Subproject commit f725e2213929233ed656e6d359d82f9087018983 +Subproject commit b7352dc995e4e22478aa49091ea06043fd89b4ee diff --git a/geometry/showermax/showerMaxGen.gdml b/geometry/showermax/showerMaxGen.gdml index 502782c69..7b4a0a760 100644 --- a/geometry/showermax/showerMaxGen.gdml +++ b/geometry/showermax/showerMaxGen.gdml @@ -7,6 +7,9 @@ + + + @@ -48,8 +51,8 @@ - - + + @@ -146,7 +149,6 @@ - @@ -207,6 +209,7 @@ + @@ -276,7 +279,6 @@ - @@ -337,6 +339,7 @@ + @@ -406,7 +409,6 @@ - @@ -467,6 +469,7 @@ + @@ -536,7 +539,6 @@ - @@ -597,6 +599,7 @@ + @@ -666,7 +669,6 @@ - @@ -727,6 +729,7 @@ + @@ -796,7 +799,6 @@ - @@ -857,6 +859,7 @@ + @@ -926,7 +929,6 @@ - @@ -987,6 +989,7 @@ + @@ -1056,7 +1059,6 @@ - @@ -1117,6 +1119,7 @@ + @@ -1186,7 +1189,6 @@ - @@ -1247,6 +1249,7 @@ + @@ -1316,7 +1319,6 @@ - @@ -1377,6 +1379,7 @@ + @@ -1446,7 +1449,6 @@ - @@ -1507,6 +1509,7 @@ + @@ -1576,7 +1579,6 @@ - @@ -1637,6 +1639,7 @@ + @@ -1706,7 +1709,6 @@ - @@ -1767,6 +1769,7 @@ + @@ -1836,7 +1839,6 @@ - @@ -1897,6 +1899,7 @@ + @@ -1966,7 +1969,6 @@ - @@ -2027,6 +2029,7 @@ + @@ -2096,7 +2099,6 @@ - @@ -2157,6 +2159,7 @@ + @@ -2226,7 +2229,6 @@ - @@ -2287,6 +2289,7 @@ + @@ -2356,7 +2359,6 @@ - @@ -2417,6 +2419,7 @@ + @@ -2486,7 +2489,6 @@ - @@ -2547,6 +2549,7 @@ + @@ -2616,7 +2619,6 @@ - @@ -2677,6 +2679,7 @@ + @@ -2746,7 +2749,6 @@ - @@ -2807,6 +2809,7 @@ + @@ -2876,7 +2879,6 @@ - @@ -2937,6 +2939,7 @@ + @@ -3006,7 +3009,6 @@ - @@ -3067,6 +3069,7 @@ + @@ -3136,7 +3139,6 @@ - @@ -3197,6 +3199,7 @@ + @@ -3266,7 +3269,6 @@ - @@ -3327,6 +3329,7 @@ + @@ -3396,7 +3399,6 @@ - @@ -3457,6 +3459,7 @@ + @@ -3526,7 +3529,6 @@ - @@ -3587,6 +3589,7 @@ + @@ -3656,7 +3659,6 @@ - @@ -3717,11 +3719,11 @@ + - @@ -3862,6 +3864,7 @@ + From a9a140f6e2771574d3aed2915620fe63e2788145 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 19 Oct 2020 22:47:23 -0500 Subject: [PATCH 173/443] [gdml] position/rotation take unit, not lunit/aunit --- geometry/huts/lefthut.gdml | 14 +++++++------- geometry/huts/righthut.gdml | 14 +++++++------- geometry/hybrid/hybridDaughter_merged.gdml | 8 ++++---- geometry/target/subTargetRegion.gdml | 14 +++++++------- geometry/upstream/upstreamToroid.gdml | 14 +++++++------- 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/geometry/huts/lefthut.gdml b/geometry/huts/lefthut.gdml index 06f51b29d..19cba7622 100644 --- a/geometry/huts/lefthut.gdml +++ b/geometry/huts/lefthut.gdml @@ -37,7 +37,7 @@ - + @@ -91,32 +91,32 @@ - + - + - + - + - + - + diff --git a/geometry/huts/righthut.gdml b/geometry/huts/righthut.gdml index 05300f09e..bff199e32 100644 --- a/geometry/huts/righthut.gdml +++ b/geometry/huts/righthut.gdml @@ -37,7 +37,7 @@ - + @@ -91,32 +91,32 @@ - + - + - + - + - + - + diff --git a/geometry/hybrid/hybridDaughter_merged.gdml b/geometry/hybrid/hybridDaughter_merged.gdml index 18695de40..382f7b0fc 100644 --- a/geometry/hybrid/hybridDaughter_merged.gdml +++ b/geometry/hybrid/hybridDaughter_merged.gdml @@ -561,14 +561,14 @@ - - + + - - + + diff --git a/geometry/target/subTargetRegion.gdml b/geometry/target/subTargetRegion.gdml index e98ab66f7..a5e8db577 100644 --- a/geometry/target/subTargetRegion.gdml +++ b/geometry/target/subTargetRegion.gdml @@ -54,7 +54,7 @@ - + @@ -129,7 +129,7 @@ - + - - + + @@ -150,7 +150,7 @@ - + @@ -169,7 +169,7 @@ - + - + - + @@ -165,7 +165,7 @@ - + @@ -198,7 +198,7 @@ - + @@ -231,7 +231,7 @@ - + @@ -264,7 +264,7 @@ - + @@ -297,7 +297,7 @@ - + @@ -330,7 +330,7 @@ - + From 11cb3d57378cf348fc88b6bb1cdc73e63d23306a Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 19 Oct 2020 22:48:24 -0500 Subject: [PATCH 174/443] [gdml] materials required between define and solids --- .../beampipe/downstream/beampipeDSMother.gdml | 3 ++ .../beampipe/premoller/beampipeRaster.gdml | 3 ++ geometry/huts/lefthut.gdml | 4 ++- geometry/showermax/showerMaxGen.gdml | 29 +++++++++---------- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/geometry/beampipe/downstream/beampipeDSMother.gdml b/geometry/beampipe/downstream/beampipeDSMother.gdml index 40c9b39ec..bdab418b7 100644 --- a/geometry/beampipe/downstream/beampipeDSMother.gdml +++ b/geometry/beampipe/downstream/beampipeDSMother.gdml @@ -6,6 +6,9 @@ + + + + + + + + + @@ -87,7 +90,6 @@ - diff --git a/geometry/showermax/showerMaxGen.gdml b/geometry/showermax/showerMaxGen.gdml index 7b4a0a760..da84293ad 100644 --- a/geometry/showermax/showerMaxGen.gdml +++ b/geometry/showermax/showerMaxGen.gdml @@ -8,8 +8,21 @@ + + + + + + + + + + + + + @@ -64,22 +77,6 @@ - - - - - - - - - - - - - - - - From 23a643c4c15bdc7866a223feaaa6a11823b4359b Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 19 Oct 2020 22:49:20 -0500 Subject: [PATCH 175/443] [gdml] xtru requires xOffset, yOffset, scalingFactor --- geometry/donut/donutConcreteLead.gdml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 833c336f7..3b53cbf96 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -88,8 +88,8 @@ -
-
+
+
From 5be405d04183b0c392abac317c30fa07bfb0e3c3 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 19 Oct 2020 22:50:41 -0500 Subject: [PATCH 176/443] [gdml] auxiliary must come after all physvols --- geometry/donut/donutConcreteLead.gdml | 36 +++++++++---------- geometry/hall/hallDaughter_dump.gdml | 4 +-- geometry/hall/subDumpDiffuser.gdml | 3 +- geometry/huts/lefthut.gdml | 1 + geometry/hybrid/hybridDaughter_merged.gdml | 2 +- geometry/mollerMother.gdml | 2 +- geometry/target/subTargetRegion.gdml | 2 +- .../upstream/upstreamDaughter_merged.gdml | 3 +- geometry/upstream/upstreamToroid.gdml | 2 +- 9 files changed, 28 insertions(+), 27 deletions(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 3b53cbf96..31adbd295 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -188,16 +188,16 @@ - - - - - + - + + + + + @@ -219,49 +219,49 @@ - - - - - + - + + + + + - + - + - + - + - + - + diff --git a/geometry/hall/hallDaughter_dump.gdml b/geometry/hall/hallDaughter_dump.gdml index 2895cecde..a32a48d9d 100644 --- a/geometry/hall/hallDaughter_dump.gdml +++ b/geometry/hall/hallDaughter_dump.gdml @@ -593,7 +593,6 @@ - @@ -716,8 +715,7 @@ - - + diff --git a/geometry/hall/subDumpDiffuser.gdml b/geometry/hall/subDumpDiffuser.gdml index f211a0522..17580c8c6 100644 --- a/geometry/hall/subDumpDiffuser.gdml +++ b/geometry/hall/subDumpDiffuser.gdml @@ -145,7 +145,6 @@ - @@ -156,6 +155,8 @@ + + diff --git a/geometry/huts/lefthut.gdml b/geometry/huts/lefthut.gdml index d3ed45148..f94f8ff6a 100644 --- a/geometry/huts/lefthut.gdml +++ b/geometry/huts/lefthut.gdml @@ -121,6 +121,7 @@ + diff --git a/geometry/hybrid/hybridDaughter_merged.gdml b/geometry/hybrid/hybridDaughter_merged.gdml index 382f7b0fc..25b91426b 100644 --- a/geometry/hybrid/hybridDaughter_merged.gdml +++ b/geometry/hybrid/hybridDaughter_merged.gdml @@ -545,7 +545,6 @@ - @@ -673,6 +672,7 @@ + diff --git a/geometry/mollerMother.gdml b/geometry/mollerMother.gdml index 167165793..4402f39a5 100644 --- a/geometry/mollerMother.gdml +++ b/geometry/mollerMother.gdml @@ -23,7 +23,6 @@ - @@ -110,6 +109,7 @@ + diff --git a/geometry/target/subTargetRegion.gdml b/geometry/target/subTargetRegion.gdml index a5e8db577..f44561c8b 100644 --- a/geometry/target/subTargetRegion.gdml +++ b/geometry/target/subTargetRegion.gdml @@ -422,7 +422,6 @@ - @@ -530,6 +529,7 @@ + diff --git a/geometry/upstream/upstreamDaughter_merged.gdml b/geometry/upstream/upstreamDaughter_merged.gdml index a144143e1..cfaa56f54 100644 --- a/geometry/upstream/upstreamDaughter_merged.gdml +++ b/geometry/upstream/upstreamDaughter_merged.gdml @@ -782,7 +782,6 @@ - @@ -841,6 +840,8 @@ + + diff --git a/geometry/upstream/upstreamToroid.gdml b/geometry/upstream/upstreamToroid.gdml index c32a834a9..26b9c6144 100644 --- a/geometry/upstream/upstreamToroid.gdml +++ b/geometry/upstream/upstreamToroid.gdml @@ -401,4 +401,4 @@ - \ No newline at end of file + From 10d4273b40e8ef44501adebf0da80ab1ad339dd4 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 19 Oct 2020 22:51:04 -0500 Subject: [PATCH 177/443] [gdml] no local schema --- geometry/electronics/subSBSbunker.gdml | 2 +- geometry/hall/subDumpDiffuser.gdml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/geometry/electronics/subSBSbunker.gdml b/geometry/electronics/subSBSbunker.gdml index b2aeaf835..0d587b098 100644 --- a/geometry/electronics/subSBSbunker.gdml +++ b/geometry/electronics/subSBSbunker.gdml @@ -5,7 +5,7 @@ ]> - + diff --git a/geometry/hall/subDumpDiffuser.gdml b/geometry/hall/subDumpDiffuser.gdml index 17580c8c6..455e52386 100644 --- a/geometry/hall/subDumpDiffuser.gdml +++ b/geometry/hall/subDumpDiffuser.gdml @@ -2,7 +2,7 @@ + xsi:noNamespaceSchemaLocation="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd"> From 186632e575e4f1bf35348109337918727db50a81 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 19 Oct 2020 22:51:22 -0500 Subject: [PATCH 178/443] [gdml] auxiliary must come after physvols --- geometry/electronics/subSBSbunker.gdml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/geometry/electronics/subSBSbunker.gdml b/geometry/electronics/subSBSbunker.gdml index 0d587b098..266a59068 100644 --- a/geometry/electronics/subSBSbunker.gdml +++ b/geometry/electronics/subSBSbunker.gdml @@ -90,7 +90,6 @@ - @@ -128,7 +127,7 @@ - + From c7b3ec9d5ad5d928287e1948d36831f4afd079f7 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 19 Oct 2020 22:51:49 -0500 Subject: [PATCH 179/443] [gdml] reusing names forbidden --- geometry/hall/hallDaughter_dump.gdml | 4 ++-- geometry/hybrid/hybridDaughter_merged.gdml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/geometry/hall/hallDaughter_dump.gdml b/geometry/hall/hallDaughter_dump.gdml index a32a48d9d..e08deabb1 100644 --- a/geometry/hall/hallDaughter_dump.gdml +++ b/geometry/hall/hallDaughter_dump.gdml @@ -411,7 +411,7 @@ - @@ -422,7 +422,7 @@ z="dumpWaterTank_length"/> - + diff --git a/geometry/hybrid/hybridDaughter_merged.gdml b/geometry/hybrid/hybridDaughter_merged.gdml index 25b91426b..d8b70ed02 100644 --- a/geometry/hybrid/hybridDaughter_merged.gdml +++ b/geometry/hybrid/hybridDaughter_merged.gdml @@ -654,12 +654,12 @@ - + - + From 35c4c055408b408862d12b5ddc3dda5cf7dc9947 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 19 Oct 2020 22:52:11 -0500 Subject: [PATCH 180/443] [gdml] position with ref must be positionref --- geometry/hybrid/hybridDaughter_merged.gdml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geometry/hybrid/hybridDaughter_merged.gdml b/geometry/hybrid/hybridDaughter_merged.gdml index d8b70ed02..d778324e9 100644 --- a/geometry/hybrid/hybridDaughter_merged.gdml +++ b/geometry/hybrid/hybridDaughter_merged.gdml @@ -255,7 +255,7 @@ - + From 732989ea2bcd0f9674d6145e47d582d75e30db70 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 19 Oct 2020 22:53:53 -0500 Subject: [PATCH 181/443] [generators] TF1 unused, unmaintained, single thread, and throws errors --- include/remollGenTF1.hh | 82 ----- src/remollGenTF1.cc | 468 ---------------------------- src/remollPrimaryGeneratorAction.cc | 2 - 3 files changed, 552 deletions(-) delete mode 100644 include/remollGenTF1.hh delete mode 100644 src/remollGenTF1.cc diff --git a/include/remollGenTF1.hh b/include/remollGenTF1.hh deleted file mode 100644 index 3a4fbaa34..000000000 --- a/include/remollGenTF1.hh +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef __REMOLLGENTF1_HH -#define __REMOLLGENTF1_HH -/*! - * Event generator matching MOLLER output at detector plane - * - * Cameron Clarke - * April 25, 2018 - * -*/ - -#include "G4Event.hh" - -#include "remollVEventGen.hh" -#include "Randomize.hh" -#include "G4AutoLock.hh" - -#include -// For the TH1Fs -#include -#include -#include -#include -#include -#include - -#include - -class TFile; -class TTree; -struct remollEvent_t; -struct remollGenericDetectorHit_t; - - -class remollGenTF1 : public remollVEventGen { - public: - remollGenTF1(); - virtual ~remollGenTF1(); - void GeneratePrimaries(G4Event* anEvent); - double RadSpectrum(); - void PrintEventGen(); - - private: - void SamplePhysics(remollVertex *, remollEvent *); - - void SetRing(G4int num); - void SetRadOffset(G4bool offset); - void SetGenFunctionFile(G4String filename); - void SetSector(int secnum); - void SetScatteringType(G4String input); - - void distAnalysis(); - void getHist(G4String fname); - void fitHist(G4String type); - static double elasticFit(double *x, double *par); - static double inelasticFit(double *x, double *par); - static double lorentzFit(double *x, double *par); - - double fZpos; - - - TFile* fFile; - TF1* fFunc; - TF1* fMollerFunc; - TF1* fElasticFunc; - TF1* fInelasticFunc; - G4String fType; - G4int fRing; - G4int fSector; - TH1F* fMollerHist; - TH1F* fElasticHist; - TH1F* fInelasticHist; - G4double r_t; - public: - G4double fXmin, fXmax, fYmin, fYmax; - G4double fZ; - G4double fDeltaPh_min, fDeltaPh_max; - G4double fR_min, fR_max; - G4bool fBoffsetR; - -}; - -#endif//__REMOLLGENTF1_HH diff --git a/src/remollGenTF1.cc b/src/remollGenTF1.cc deleted file mode 100644 index f4449d6cb..000000000 --- a/src/remollGenTF1.cc +++ /dev/null @@ -1,468 +0,0 @@ -/* remollGenTF1.cc - * - * Updated June 2018 - * - * Reads functions of radius from external root file and generates particles according to those functions. - * Default functions are inside remollGenFunctions.root, and include moller, elastic, and inelastic scattering - * for the whole array as well as for sectors 1, 2, and 3. - * - */ -#include "remollGenTF1.hh" - -#include "remollEvent.hh" -#include "remollVertex.hh" -#include "remollBeamTarget.hh" - -#include "G4GenericMessenger.hh" -#include "G4Material.hh" -#include "G4VPhysicalVolume.hh" -#include "G4LogicalVolume.hh" -#include "G4PhysicalConstants.hh" - -#include "remolltypes.hh" - - -#include "CLHEP/Random/RandFlat.h" -#include "CLHEP/Random/RandGauss.h" -#include -#include -#include -#include -// For the TF1s -#include "TROOT.h" -#include "TFile.h" -#include "TTree.h" -#include "TH1F.h" -#include "TF1.h" -#include "TMath.h" - - -G4Mutex inFileMutex2 = G4MUTEX_INITIALIZER; //files are being read so mutex is needed - -remollGenTF1::remollGenTF1() -: remollVEventGen("TF1"), - fFile(0), - fFunc(0),fMollerFunc(0), - fElasticFunc(0), - fInelasticFunc(0), - fType(), - fRing(1), fSector(0) -{ - fApplyMultScatt = true; - r_t = G4RandFlat::shoot(600,1200); - fZpos = (28.5*m - 0.52*m); - fThisGenMessenger->DeclarePropertyWithUnit("rmax","mm",fR_max,"Maximum generation radial hit position (mm) for Remoll generator"); - fThisGenMessenger->DeclarePropertyWithUnit("rmin","mm",fR_min,"Minimum generation radial hit position (mm) for Remoll generator"); - fThisGenMessenger->DeclarePropertyWithUnit("deltaphmax","deg",fDeltaPh_max,"Upward Phi spread limit"); - fThisGenMessenger->DeclarePropertyWithUnit("deltaphmin","deg",fDeltaPh_min,"Downward Phi spread limit"); - fThisGenMessenger->DeclareProperty("BoffsetR",fBoffsetR,"Boolean for offsetting detector to the side (and flat radial distribution if R_max =/= 0)"); - fThisGenMessenger->DeclareProperty("sector",fSector,"Integer sector number for Remoll generator"); - fThisGenMessenger->DeclareProperty("ring",fRing,"Integer ring number for Remoll generator"); - fThisGenMessenger->DeclareMethod("setFileFunction",&remollGenTF1::SetGenFunctionFile,"ROOT filename:function name"); - fThisGenMessenger->DeclareMethod("scattType",&remollGenTF1::SetScatteringType,"Scattering type: moller, elastic, inelastic, or all"); - fThisGenMessenger->DeclareMethod("sector",&remollGenTF1::SetSector,"Sector number: 1,2,or 3, or 0 for all"); - fThisGenMessenger->DeclareMethod("radOffset",&remollGenTF1::SetRadOffset,"Radial offset to center detectors: boolean"); - fThisGenMessenger->DeclareMethod("ring",&remollGenTF1::SetRing,"Detector ring number (1-6)"); - SetScatteringType("all"); - SetSector(0); - SetRadOffset(false); - SetGenFunctionFile("remollGenFunctions.root:elastic_0"); -} - -remollGenTF1::~remollGenTF1() { - if (fFile){ - fFile->Close(); - } - fFunc = 0; - fMollerFunc = 0; - fElasticFunc = 0; - fInelasticFunc = 0; -} - -void remollGenTF1::PrintEventGen() -{ - remollVEventGen::PrintEventGen(); - G4cout << "r hits (Remoll generator) =[" << fR_min/mm << "," << fR_max/mm << "] mm" << G4endl; - G4cout << "phi spread (remoll generator) = [" << fDeltaPh_min/deg << "," << fDeltaPh_max/deg << "] deg" << G4endl; -} - -void remollGenTF1::SetRing(G4int num){ fRing = num; } - -void remollGenTF1::SetRadOffset(G4bool offset){ fBoffsetR = offset; } - -void remollGenTF1::SetScatteringType(G4String input){ fType = input; } - -void remollGenTF1::SetSector(const G4int secnum){ fSector = secnum; } - -void remollGenTF1::SetGenFunctionFile(G4String input) { - if(input == "genDefault"){ //input for generating input files using moller, elastic, and inelastic generators and then performing fits to use as TF1 input - G4cerr << "Reading generated default output files." << G4endl; - distAnalysis(); - return; - } - - if (!input.contains(":")){ - G4cerr << "Improper formatting for user input. Please ensure your macro commands include '/remoll/evgen/TF1/setFileFunction :'" << G4endl; - return; - } - - std::stringstream ss; - ss << input; - - G4String filename; - G4String funcname; - - std::getline(ss, filename, ':'); - std::getline(ss, funcname, ':'); - - G4cout << "File name read as " << filename << G4endl; - G4cout << "Function name read as " << funcname << G4endl; - - G4AutoLock inFileLock(&inFileMutex2); - - G4cout << "Setting the external file to " << filename << G4endl; - - if (fFile) { - fFile->Close(); - fFunc = 0; - } - - fFile = new TFile(filename); - if (! fFile){ - G4cerr << "Could not open function file " << filename << G4endl; - return; - } - - fFile->GetObject(funcname,fFunc); - if (! fFunc){ - G4cerr << "could not find function in file " << filename << G4endl; - return; - } - inFileLock.unlock(); -} - -void remollGenTF1::SamplePhysics(remollVertex * /*vert*/, remollEvent *evt) -{ - if (!fFunc){ - G4cerr << "No Function set before SamplePhysics was called" << G4endl; - return; - } - double xPos, yPos, zPos, zOffset; - fE_min = 2.0*GeV; - fE_max = 11.0*GeV; - - fTh_min = -0*deg;//FIXME Needs justification, what about the angle about the z axis that this points as well, is that phi, or is phi the start position about z? - fTh_max = 2.5*deg; - - fR_min = 0.0*mm; - fR_max = 0.0*mm; - - fPh_min = 0.0*deg; - fPh_max = 360.0*deg; - - fDeltaPh_min = -2.0*deg; - fDeltaPh_max = 2.0*deg; - -// fRing = 5; -// fSector = 0; //FIXME what are the sector options? What do they refer to? -// fBoffsetR = false; - -// zPos = fZ; - - // Get initial Remoll energy instead of using other sampling - double E = G4RandFlat::shoot( fE_min, fE_max ); - double mass = electron_mass_c2; - double p = sqrt(E*E - mass*mass); - - double pX, pY, pZ; - double randTheta, randDeltaPhi, randPhi; - - randTheta = G4RandFlat::shoot( fTh_min, fTh_max ); - randPhi = G4RandFlat::shoot(fPh_min,fPh_max); - randDeltaPhi = G4RandFlat::shoot(fDeltaPh_min,fDeltaPh_max); // FIXME define min/max angle spread in phi direction - pX = cos(randPhi)*sin(randTheta)*p + sin(randPhi)*sin(randDeltaPhi)*p; - pY = sin(randPhi)*sin(randTheta)*p - cos(randPhi)*sin(randDeltaPhi)*p; - pZ = cos(randDeltaPhi)*cos(randTheta)*p; -//get radial distribution from remoll, radius is along x-axis - double radialOffset[6][3] = {{710,710,710}, - {755,755,755}, - {817.5,817.5,817.5}, - {892.5,892.5,892.5}, - {1017.5,987.5,1030}, - {1150,1150,1150}}; - double rad = RadSpectrum(); - zOffset = -1*500; //FIXME arbitrary z offset for Moller distribution propagation - affects air showering noise - zPos = (28500 + zOffset); //FIXME arbitrary z offset for Moller distribution propagation - affects air showering noise - double xHitPos = (rad*cos(randPhi)- 1*((fBoffsetR)? radialOffset[fRing][fSector] : 0.0)); // Putting the offset here means that the detector and distribution will still make circles, just where the edge of the circle now passes the origin - double yHitPos = rad*sin(randPhi); - xPos = xHitPos - (-1*zOffset)*sin(randTheta)*cos(randPhi) - (-1*zOffset)*sin(randPhi)*sin(randDeltaPhi); - yPos = yHitPos - (-1*zOffset)*sin(randTheta)*sin(randPhi) + (-1*zOffset)*cos(randPhi)*sin(randDeltaPhi); - - - assert( E > 0.0 ); - assert( E > mass ); - - evt->ProduceNewParticle( G4ThreeVector(xPos, yPos, zPos), - G4ThreeVector(pX, pY, pZ ), - "e-" ); - evt->fBeamE = E; - evt->fBeamMomentum = evt->fBeamMomentum.unit()*p; - // Override Beam Target creating a spread in z vertex, by overwriting the remollVEventGen.cc functionality - // where it asks the remollBeamTarget to treat the vertex as beam target spread. Adds (+=) the vector fVertexPos - // to the particle position vector defined when particle is defined, happening in PolishEvent() method - evt->fVertexPos.setZ( 0.0 ); - - evt->SetEffCrossSection(0.0); - evt->SetAsymmetry(0.0); - evt->SetQ2(0.0); - evt->SetW2(0.0); - -} - -double remollGenTF1::RadSpectrum(){ - //generate radius from TF1, radius in millimeters! - if (fR_max>0.0 && fBoffsetR==true) { - double flatRad = G4RandFlat::shoot(fR_min,fR_max); - return flatRad; - } - - //Randomly generate the distribution using the Metropolis algorithm - double r, a, u; - //r_t is the previous hit, r is the proposed new hit, a is their relative - //probabilities, and u is the deciding probability. - r = G4RandGauss::shoot(r_t,100); //generate proposed r with gaussian around previous - - if (fType == "all" && !fFile){ - a = (fMollerFunc->Eval(r) + fElasticFunc->Eval(r) + fInelasticFunc->Eval(r)) / (fMollerFunc->Eval(r_t) + fElasticFunc->Eval(r_t) + fInelasticFunc->Eval(r_t)); - }else{ - a = fFunc->Eval(r) / fFunc->Eval(r_t); - } - u = G4RandFlat::shoot(0.0,1.0); - if (u <= a) - r_t = r; - return r_t; -} - -void remollGenTF1::distAnalysis(){ - //takes input of remoll output files using moller, elastic, and inelastic generators - //Pulls hit radius data from the root files and puts it into histograms, and then fits - //those histograms with parameterized functions that are output into remollGenFunctions.root - if (fType == "moller" || fType == "all"){ - G4String fname("remollout_moller.root"); - getHist(fname); - fitHist("moller"); - if(fType == "moller") - fFunc = fMollerFunc; - }if (fType == "elastic" || fType == "all"){ - getHist("remollout_elastic.root"); - fitHist("elastic"); - if (fType == "elastic") - fFunc = fElasticFunc; - }if (fType == "inelastic" || fType == "all"){ - getHist("remollout_inelastic.root"); - fitHist("inelastic"); - if (fType == "inelastic") - fFunc = fInelasticFunc; - } -} - - -void remollGenTF1::getHist(G4String fname){ - G4AutoLock inFileLock(&inFileMutex2); - - G4cout << "Opening file " << fname << G4endl; - TFile *file = new TFile(fname); - if (!file){ - G4cerr << "File not found." << G4endl; - exit(1); - } - TTree *T = (TTree*)(file->Get("T")); - if (!T){ - G4cerr << "TTree T not found" << G4endl; - exit(1); - } - TH1F* rad = new TH1F("rad","hit.r",120,600,1200); - - rad->GetXaxis()->SetTitle("Radius (mm)"); - rad->GetYaxis()->SetTitle("Rate (GeV/5 mm)"); - - int entries = T->GetEntries(); - double rate; - std::vector* Hit = new std::vector; - - if (T->GetBranch("hit")){ - T->SetBranchAddress("hit", &Hit); - }else{ - G4cerr << "Could not find branch hit in input file" << G4endl; - } - if (T->GetBranch("rate")){ - T->SetBranchAddress("rate",&rate); - }else{ - G4cerr << "Could not find branch rate in input file" << G4endl; - } - std::cerr << "Total entries to read: " << entries << std::endl; - for(int i = 0; i < entries; i++){ - T->GetEntry(i); - for (size_t j = 0; j < Hit->size(); j++){ - remollGenericDetectorHit_t hit = Hit->at(j);//create local copy of hit - if (hit.det == 28 && hit.r > 600 && hit.r < 1200 && (hit.pid == 11 || hit.pid == -11)){ - if (fSector == 0){ - rad->Fill(hit.r,rate); - continue; - } - - //determine sector number (conditions provided by Seamus) - double secphi; - double eigth = 360.0/56.0; - if (atan2(hit.y,hit.x)>0){ - secphi = fmod(atan2(hit.y,hit.x),2.0*3.14159/7.0)*180/3.14159; - } - else{ - secphi = fmod(atan2(hit.y,hit.x)+2.0*3.14159,2.0*3.14159/7.0)*180/3.14159; - } - - if((secphi < eigth || secphi > 7*eigth) && fSector == 1) - rad->Fill(hit.r,rate); - if (((eigth < secphi && secphi < 3.0*eigth) || (5.0*eigth < secphi && secphi < 7.0*eigth)) && fSector == 2) - rad->Fill(hit.r,rate); - if ((3.0*eigth < secphi && secphi < 5.0*eigth) && fSector == 3) - rad->Fill(hit.r,rate); - } - } - } - rad->Scale(1e7/entries); - rad->SetDirectory(0); - file->Close(); - inFileLock.unlock(); - if (fname == "remollout_moller.root"){ - fMollerHist = rad; - }else if (fname == "remollout_elastic.root"){ - fElasticHist = rad; - }else if ( fname == "remollout_inelastic.root"){ - fInelasticHist = rad; - } - return; - -} - -void remollGenTF1::fitHist(G4String type){ - TF1* fit; - - //fit histograms of all sectors - if (type == "moller"){ - TH1F* rad = fMollerHist; - G4cerr << "Fitting moller sector " << fSector << G4endl; - fit = new TF1("mol","gaus",600,1200); - rad->GetXaxis()->SetRange(rad->FindBin(900),rad->FindBin(1100)); - double max = rad->GetMaximum(); - double mean = rad->GetBinCenter(rad->GetMaximumBin()); - double FWHM = rad->GetBinCenter(rad->FindLastBinAbove(max/2.0)) - rad->GetBinCenter(rad->FindFirstBinAbove(max/2.0)); - fit->SetParameters(max,FWHM/2,mean); - rad->Fit("mol","NM"); - fMollerFunc = fit; - return; - } - - else if (type == "elastic"){ - TH1F* rad = fElasticHist; - G4cerr << "Fitting elastic sector " << fSector << G4endl; - - fit = new TF1("el", remollGenTF1::elasticFit, 600,1200,6); - - rad->GetXaxis()->SetRange(rad->FindBin(700),rad->FindBin(800)); - - double max = rad->GetMaximum(); - double mean = rad->GetBinCenter(rad->GetMaximumBin()); - double FWHM = rad->GetBinCenter(rad->FindLastBinAbove(max/2.0)) - rad->GetBinCenter(rad->FindFirstBinAbove(max/2.0)); - fit->SetParameter(0,max); - fit->SetParameter(2,mean); - fit->SetParameter(1,FWHM/2); - - //Adjust range to only quadratic range - rad->GetXaxis()->SetRange(rad->FindBin(800),rad->FindBin(1100)); - - //fit->SetParameter(3,8e6); - double b = rad->GetBinCenter(rad->GetMinimumBin()); - double c = rad->GetMinimum(); - double a = rad->GetBinContent(rad->FindBin(b+110))/12100; - - fit->SetParameter(3, a); - fit->SetParameter(4, c); - fit->SetParameter(5, b); - - - rad->GetXaxis()->SetRange(rad->FindBin(600),rad->FindBin(1200)); - rad->Fit(fit,"QMN"); - fit->SetParameters(fit->GetParameters()); - rad->Fit(fit,"MN"); - fElasticFunc = fit; - return; - } - - else if (type == "inelastic"){ - G4cerr << "Fitting inelastic sector "<< fSector << G4endl; - TH1F* rad = fInelasticHist; - fit = new TF1("in",remollGenTF1::inelasticFit,600,1200,5); - - - rad->GetXaxis()->SetRange(0,rad->FindBin(800)); - double max = rad->GetMaximum(); - double mean = rad->GetBinCenter(rad->GetMaximumBin()); - double HWHM = abs(mean - rad->GetBinCenter(rad->FindFirstBinAbove(max/2.0))); - double stddev = 2*HWHM / (2*sqrt(2*log(2))); - fit->SetParameter(0,max); - fit->SetParameter(1,mean); - fit->SetParameter(2,stddev); - - //a*x^-b - rad->GetXaxis()->SetRange(rad->FindBin(mean),rad->FindBin(1200)); - double x1 = 950.0; - double x2 = 1100.0; - double y1 = rad->GetBinContent(rad->FindBin(x1)); - double y2 = rad->GetBinContent(rad->FindBin(x2)); - double b = log(y1/y2) / log(x2/x1); - double a = y1 / pow(x1,-1*b); - fit->SetParameter(3,a); - fit->SetParameter(4,b); - - rad->GetXaxis()->SetRange(0,120); - - rad->Fit(fit,"NMWP"); - fInelasticFunc = fit; - return; - } - return; -} -double remollGenTF1::lorentzFit(double *x, double *par){ - return (0.5*par[0]*par[1]/TMath::Pi())/TMath::Max(1.0e-10,(x[0]-par[2])*(x[0]-par[2]) + 0.25*par[1]*par[1]); -} - -double remollGenTF1::elasticFit(double *x, double *par){ - if (x[0] > 1200 || x[0] < 600) - return 0.0; - double q = 0.0; - double l = lorentzFit(x,par); - - q = (TMath::Abs(par[3])*(x[0]-par[5])*(x[0]-par[5])-par[4]); - if (l < q && x[0] > par[2]){ - return q; - }else{ - return l; - } - return 0.0; -} - -double remollGenTF1::inelasticFit(double *x, double *par){ - double arg = (fabs(par[2])>1e-6)? (x[0] - (par[1]))/par[2] : 0.0; - double g = par[0]*exp(-0.5*arg*arg)/(par[2]*sqrt(2.0*TMath::Pi())); - double e = 0; - if (x[0] > (par[1])) - e = par[3]/TMath::Power(x[0],par[4]);/* + par[5];*/ - if (g > e){ - return g; - } - else{ - return e; - } - return 0.0; -} diff --git a/src/remollPrimaryGeneratorAction.cc b/src/remollPrimaryGeneratorAction.cc index 38a898579..439dca14c 100644 --- a/src/remollPrimaryGeneratorAction.cc +++ b/src/remollPrimaryGeneratorAction.cc @@ -27,7 +27,6 @@ #include "remollGenpInelastic.hh" #include "remollGenPion.hh" #include "remollGenBeam.hh" -#include "remollGenTF1.hh" #include "remollGen12CElastic.hh" #include "remollGenFlat.hh" #include "remollGenExternal.hh" @@ -53,7 +52,6 @@ remollPrimaryGeneratorAction::remollPrimaryGeneratorAction() fEvGenMap["pion"] = new remollGenPion(); fEvGenMap["beam"] = new remollGenBeam(); fEvGenMap["flat"] = new remollGenFlat(); - fEvGenMap["TF1"] = new remollGenTF1(); fEvGenMap["elasticAl"] = new remollGenAl(0); fEvGenMap["quasielasticAl"] = new remollGenAl(1); fEvGenMap["inelasticAl"] = new remollGenAl(2); From 2e60fd08fa93a416992c3b1e3dbe17f9e0528177 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 19 Oct 2020 23:15:46 -0500 Subject: [PATCH 182/443] [gdml] avoid reusing names --- geometry/hall/hallDaughter_dump.gdml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/geometry/hall/hallDaughter_dump.gdml b/geometry/hall/hallDaughter_dump.gdml index e08deabb1..7f0fa26dd 100644 --- a/geometry/hall/hallDaughter_dump.gdml +++ b/geometry/hall/hallDaughter_dump.gdml @@ -411,7 +411,7 @@ - @@ -422,7 +422,7 @@ z="dumpWaterTank_length"/> - + From 271df99e0e5425a801aeb0db1c9f4b02aa2ec8eb Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 19 Oct 2020 23:15:58 -0500 Subject: [PATCH 183/443] [gdml] avoid reusing names --- geometry/donut/donutConcreteLead.gdml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 31adbd295..ae5d56cc0 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -235,22 +235,22 @@ - + - + - + - + From d7b058d73f6d6af587d32c31cd9b8c1248d2a155 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 19 Oct 2020 23:20:46 -0500 Subject: [PATCH 184/443] [unit] fix error in unit test for polarization --- macros/tests/unit/test_polarization.mac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/tests/unit/test_polarization.mac b/macros/tests/unit/test_polarization.mac index 7f4c9ced6..3865db61e 100644 --- a/macros/tests/unit/test_polarization.mac +++ b/macros/tests/unit/test_polarization.mac @@ -4,7 +4,7 @@ /control/execute macros/load_magnetic_fieldmaps.mac -/remoll/gen moller +/remoll/evgen/set moller /remoll/field/equationtype 2 /run/beamOn 100 From 0aa5da3f23941c749e87244b5d9e0b9368151363 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 19 Oct 2020 23:21:08 -0500 Subject: [PATCH 185/443] [unit] unit tests are run in container where reroot is in path, not build --- macros/tests/unit/test_rng_engine.mac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/tests/unit/test_rng_engine.mac b/macros/tests/unit/test_rng_engine.mac index d78376bb1..32bb85a4f 100644 --- a/macros/tests/unit/test_rng_engine.mac +++ b/macros/tests/unit/test_rng_engine.mac @@ -13,7 +13,7 @@ /run/beamOn 10 # Write all random states for run 1 -/control/shell build/reroot -l -q macros/tests/unit/test_rng_engine.C +/control/shell reroot -l -q macros/tests/unit/test_rng_engine.C # Ensure rndm1 directory exists /control/shell mkdir -p rndm2 @@ -39,7 +39,7 @@ /run/beamOn 10 # Write all random states for run 1 -/control/shell build/reroot -l -q macros/tests/unit/test_rng_engine.C +/control/shell reroot -l -q macros/tests/unit/test_rng_engine.C # Compare random states on all events /control/shell diff --ignore-matching-lines ^MixMaxRng-begin run0evt0.state run1evt9.state From 5a039704c30a7fc78ac305aa994cb3fcafd3cf7c Mon Sep 17 00:00:00 2001 From: Yug34 Date: Tue, 20 Oct 2020 18:02:28 +0530 Subject: [PATCH 186/443] Static rewrite for remollSearchPath.hh --- CMakeLists.txt | 4 ++- include/remollSearchPath.hh | 60 ++++++------------------------------- remoll.cc | 6 ++-- src/remollSearchPath.cc | 57 +++++++++++++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 54 deletions(-) create mode 100644 src/remollSearchPath.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fa9a4f45..d6d8249bb 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,9 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") endif() endif() +# For remollSearchPath.hh +# should be able to use target_link_libraries() here +link_libraries(stdc++fs) #---------------------------------------------------------------------------- # Locate sources and headers for this project @@ -386,7 +389,6 @@ install(FILES #---------------------------------------------------------------------------- # remollSearchPath -link_libraries(stdc++fs) add_definitions( -DCMAKE_INSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\" -DCMAKE_INSTALL_FULL_DATADIR=\"${CMAKE_INSTALL_FULL_DATADIR}\" diff --git a/include/remollSearchPath.hh b/include/remollSearchPath.hh index 416726ec3..5acfb6fcf 100644 --- a/include/remollSearchPath.hh +++ b/include/remollSearchPath.hh @@ -8,7 +8,6 @@ Header-only file to search for files inside the remoll directory. -------------------------------------------------------------------------------------------- - Usage: remollSearchPath mySearchPath; mySearchPath.add("macros"); //< Adds the macros directory to the list of directories the next line will search for gui.mac in @@ -21,66 +20,25 @@ Usage: #include #include "experimental/filesystem" +#include "iostream" namespace fs = std::experimental::filesystem; class remollSearchPath { private: + static remollSearchPath* fInstance; std::vector fSearchPath; -public: remollSearchPath(); - virtual ~remollSearchPath(); +public: + static remollSearchPath* getInstance(); + virtual ~remollSearchPath(); void add(const std::string& path); - const std::string operator() (const std::string& filename); -}; - -remollSearchPath::remollSearchPath() -{ - fSearchPath.push_back(fs::path(get_current_dir_name())); //< add cwd to the search path - fSearchPath.push_back(fs::path(CMAKE_INSTALL_PREFIX)); //< add CMAKE_INSTALL_PREFIX to search path - fSearchPath.push_back(fs::path(CMAKE_INSTALL_FULL_DATADIR)); //< add CMAKE_INSTALL_FULL_DATADIR to search path -} - -remollSearchPath::~remollSearchPath() {} - -void remollSearchPath::add(const std::string& path) -{ - // If directory to search in is inside CMAKE_INSTALL_PREFIX - if(fs::exists(fs::path(std::string(CMAKE_INSTALL_PREFIX) + "/" + path))) { - fSearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_PREFIX) + "/" + path)); - } - // If directory to search in is inside CMAKE_INSTALL_FULL_DATADIR - else if(fs::exists(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/" + path))) { - fSearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/" + path)); - } - // If directory to search in is inside the current working directory - else if(fs::exists(fs::path(get_current_dir_name()) / path)) { - fSearchPath.push_back(fs::path(get_current_dir_name()) / path); + std::string operator() (const std::string& filename); + static std::string resolve(const std::string& filename) { + return remollSearchPath::getInstance()->operator()(filename); } - // Path not relative to CMAKE_INSTALL_PREFIX, CMAKE_INSTALL_FULL_DATADIR - // or the current working directory - // path is probably an absolute path - else if (fs::exists(fs::path(path))) { - fSearchPath.push_back(fs::path(path)); - } -} - -const std::string remollSearchPath::operator() (const std::string& filename) -{ - // If the file you are looking for exists inside any of the - // directories inside fSearchPath, return the filename prefixed with - // the directory for which the full path exists - for (auto path: fSearchPath) { - if(fs::exists(path / filename)) { - return (path / filename).string(); - } - } - - // File not found in any of the search directories, - // return the filename - return std::string(filename); /* and pray everything work */ -} +}; #endif //__REMOLLSEARCHPATH_HH diff --git a/remoll.cc b/remoll.cc index 79d19f8e1..794da5348 100644 --- a/remoll.cc +++ b/remoll.cc @@ -27,6 +27,8 @@ typedef G4RunManager RunManager; #include "remollDetectorConstruction.hh" #include "remollParallelConstruction.hh" +#include "remollSearchPath.hh" + #include "G4VisExecutive.hh" #include "G4UIExecutive.hh" @@ -152,8 +154,8 @@ int main(int argc, char** argv) { { // Run in batch mode // Copy contents of macro into buffer to be written out into ROOT file - remollRun::GetRunData()->SetMacroFile(macro); - UImanager->ExecuteMacroFile(macro); + remollRun::GetRunData()->SetMacroFile((remollSearchPath::resolve(macro)).c_str()); + UImanager->ExecuteMacroFile((remollSearchPath::resolve(macro)).c_str()); } else { // Define UI session for interactive mode G4UIExecutive* ui = new G4UIExecutive(argc,argv,session); diff --git a/src/remollSearchPath.cc b/src/remollSearchPath.cc new file mode 100644 index 000000000..650c9314d --- /dev/null +++ b/src/remollSearchPath.cc @@ -0,0 +1,57 @@ +#include "remollSearchPath.hh" + +remollSearchPath* remollSearchPath::fInstance = nullptr; + +remollSearchPath::remollSearchPath() +{ + // add CMAKE_INSTALL_FULL_DATADIR, CMAKE_INSTALL_PREFIX and CWD to search path + fSearchPath.push_back(fs::path(get_current_dir_name())); + fSearchPath.push_back(fs::path(CMAKE_INSTALL_PREFIX)); + fSearchPath.push_back(fs::path(CMAKE_INSTALL_FULL_DATADIR)); +} + +remollSearchPath *remollSearchPath::getInstance() { + if (!fInstance) { + fInstance = new remollSearchPath(); + } + return fInstance; +} + +remollSearchPath::~remollSearchPath() {} + +void remollSearchPath::add(const std::string& path) +{ + // If directory to search in is inside CMAKE_INSTALL_PREFIX + if(fs::exists(fs::path(std::string(CMAKE_INSTALL_PREFIX) + "/" + path))) { + fSearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_PREFIX) + "/" + path)); + } + // If directory to search in is inside CMAKE_INSTALL_FULL_DATADIR + else if(fs::exists(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/" + path))) { + fSearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/" + path)); + } + // If directory to search in is inside the current working directory + else if(fs::exists(fs::path(get_current_dir_name()) / path)) { + fSearchPath.push_back(fs::path(get_current_dir_name()) / path); + } + // Path not relative to CMAKE_INSTALL_PREFIX, CMAKE_INSTALL_FULL_DATADIR or CWD + // path is probably an absolute path + else if (fs::exists(fs::path(path))) { + fSearchPath.push_back(fs::path(path)); + } +} + +std::string remollSearchPath::operator() (const std::string& filename) +{ + // If the file you are looking for exists inside any of the + // directories inside fSearchPath, return the filename prefixed with + // the directory for which the full path exists + for (auto path: fSearchPath) { + if(fs::exists(path / filename)) { + return (path / filename).string(); + } + } + + // File not found in any of the search directories, + // return the filename + return std::string(filename); /* and pray everything work */ +} From 248ba84e33babae3fd6c1abe64063dfd92f82ce2 Mon Sep 17 00:00:00 2001 From: Yug34 Date: Tue, 20 Oct 2020 18:42:47 +0530 Subject: [PATCH 187/443] Added remollSearchPath::resolve() for c_str arguments --- include/remollSearchPath.hh | 10 +++++++++- remoll.cc | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/remollSearchPath.hh b/include/remollSearchPath.hh index 5acfb6fcf..b618488ec 100644 --- a/include/remollSearchPath.hh +++ b/include/remollSearchPath.hh @@ -20,7 +20,7 @@ Usage: #include #include "experimental/filesystem" -#include "iostream" +#include "cstring" namespace fs = std::experimental::filesystem; @@ -39,6 +39,14 @@ public: static std::string resolve(const std::string& filename) { return remollSearchPath::getInstance()->operator()(filename); } + // So now it shouldn't matter if you do (remollSearchPath::resolve(macro)).c_str() + // or remollSearchPath::resolve(macro.c_str()) + // It will return the same thing + static const char* resolve(const char* filename) { + char* file = (char*) malloc((strlen(filename) + 1) * sizeof(char)); + strcpy(file, remollSearchPath::getInstance()->operator()(std::string(filename)).c_str()); + return file; + } }; #endif //__REMOLLSEARCHPATH_HH diff --git a/remoll.cc b/remoll.cc index 794da5348..3f846a6a7 100644 --- a/remoll.cc +++ b/remoll.cc @@ -156,6 +156,8 @@ int main(int argc, char** argv) { // Copy contents of macro into buffer to be written out into ROOT file remollRun::GetRunData()->SetMacroFile((remollSearchPath::resolve(macro)).c_str()); UImanager->ExecuteMacroFile((remollSearchPath::resolve(macro)).c_str()); + // ^Can do the same by using: + // UImanager->ExecuteMacroFile(remollSearchPath::resolve(macro.c_str())); } else { // Define UI session for interactive mode G4UIExecutive* ui = new G4UIExecutive(argc,argv,session); From bd17bb98b04800cfd318df9b3e0eb560a3e499ed Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 20 Oct 2020 10:45:22 -0500 Subject: [PATCH 188/443] [gdml] Updated coil generator outputs to avoid validation errors --- geometry/generators/remoll-coil-generator | 2 +- geometry/hybrid/hybridToroid.gdml | 158 +++++++++++----------- geometry/upstream/upstreamToroid.gdml | 140 +++++++++---------- 3 files changed, 150 insertions(+), 150 deletions(-) diff --git a/geometry/generators/remoll-coil-generator b/geometry/generators/remoll-coil-generator index f95ce58fb..3212c9e1f 160000 --- a/geometry/generators/remoll-coil-generator +++ b/geometry/generators/remoll-coil-generator @@ -1 +1 @@ -Subproject commit f95ce58fb7e5eddaa51048d58fe628b84ed40955 +Subproject commit 3212c9e1fa40103171e7e419f2d1765f10e29b30 diff --git a/geometry/hybrid/hybridToroid.gdml b/geometry/hybrid/hybridToroid.gdml index 29336b1d8..f7ba7b09c 100644 --- a/geometry/hybrid/hybridToroid.gdml +++ b/geometry/hybrid/hybridToroid.gdml @@ -60,8 +60,8 @@ -
-
+
+
@@ -86,8 +86,8 @@ -
-
+
+
@@ -112,8 +112,8 @@ -
-
+
+
@@ -138,8 +138,8 @@ -
-
+
+
@@ -164,8 +164,8 @@ -
-
+
+
@@ -190,8 +190,8 @@ -
-
+
+
@@ -216,8 +216,8 @@ -
-
+
+
@@ -242,8 +242,8 @@ -
-
+
+
@@ -268,8 +268,8 @@ -
-
+
+
@@ -316,8 +316,8 @@ -
-
+
+
@@ -364,8 +364,8 @@ -
-
+
+
@@ -412,8 +412,8 @@ -
-
+
+
@@ -460,8 +460,8 @@ -
-
+
+
@@ -508,8 +508,8 @@ -
-
+
+
@@ -556,8 +556,8 @@ -
-
+
+
@@ -631,7 +631,7 @@ - + @@ -664,7 +664,7 @@ - + @@ -697,7 +697,7 @@ - + @@ -730,7 +730,7 @@ - + @@ -751,7 +751,7 @@ - + @@ -772,7 +772,7 @@ - + @@ -793,7 +793,7 @@ - + @@ -856,7 +856,7 @@ - + @@ -889,7 +889,7 @@ - + @@ -922,7 +922,7 @@ - + @@ -955,7 +955,7 @@ - + @@ -976,7 +976,7 @@ - + @@ -997,7 +997,7 @@ - + @@ -1018,7 +1018,7 @@ - + @@ -1081,7 +1081,7 @@ - + @@ -1114,7 +1114,7 @@ - + @@ -1147,7 +1147,7 @@ - + @@ -1180,7 +1180,7 @@ - + @@ -1201,7 +1201,7 @@ - + @@ -1222,7 +1222,7 @@ - + @@ -1243,7 +1243,7 @@ - + @@ -1306,7 +1306,7 @@ - + @@ -1339,7 +1339,7 @@ - + @@ -1372,7 +1372,7 @@ - + @@ -1405,7 +1405,7 @@ - + @@ -1426,7 +1426,7 @@ - + @@ -1447,7 +1447,7 @@ - + @@ -1468,7 +1468,7 @@ - + @@ -1531,7 +1531,7 @@ - + @@ -1564,7 +1564,7 @@ - + @@ -1597,7 +1597,7 @@ - + @@ -1630,7 +1630,7 @@ - + @@ -1651,7 +1651,7 @@ - + @@ -1672,7 +1672,7 @@ - + @@ -1693,7 +1693,7 @@ - + @@ -1756,7 +1756,7 @@ - + @@ -1789,7 +1789,7 @@ - + @@ -1822,7 +1822,7 @@ - + @@ -1855,7 +1855,7 @@ - + @@ -1876,7 +1876,7 @@ - + @@ -1897,7 +1897,7 @@ - + @@ -1918,7 +1918,7 @@ - + @@ -1981,7 +1981,7 @@ - + @@ -2014,7 +2014,7 @@ - + @@ -2047,7 +2047,7 @@ - + @@ -2080,7 +2080,7 @@ - + @@ -2101,7 +2101,7 @@ - + @@ -2122,7 +2122,7 @@ - + @@ -2143,7 +2143,7 @@ - + diff --git a/geometry/upstream/upstreamToroid.gdml b/geometry/upstream/upstreamToroid.gdml index 26b9c6144..0947432bb 100644 --- a/geometry/upstream/upstreamToroid.gdml +++ b/geometry/upstream/upstreamToroid.gdml @@ -36,8 +36,8 @@ -
-
+
+
@@ -62,8 +62,8 @@ -
-
+
+
@@ -88,8 +88,8 @@ -
-
+
+
@@ -127,26 +127,26 @@ - - - - + - + + + + - - - - + + + + @@ -160,26 +160,26 @@ - - - - + - + + + + - - - - + + + + @@ -193,26 +193,26 @@ - - - - + - + + + + - - - - + + + + @@ -226,26 +226,26 @@ - - - - + - + + + + - - - - + + + + @@ -259,26 +259,26 @@ - - - - + - + + + + - - - - + + + + @@ -292,26 +292,26 @@ - - - - + - + + + + - - - - + + + + @@ -325,32 +325,31 @@ - - - - + - + + + + - - - - + + + + - @@ -393,6 +392,7 @@ + From 7c182ce8565544e986df6d407cce4718d1d74259 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 20 Oct 2020 10:51:04 -0500 Subject: [PATCH 189/443] [showermax] Updated generator for showermax geometry --- .../generators/remoll-showermax-generator | 2 +- geometry/showermax/showerMaxGen.gdml | 94 +++++++++---------- 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/geometry/generators/remoll-showermax-generator b/geometry/generators/remoll-showermax-generator index f725e2213..5c0331884 160000 --- a/geometry/generators/remoll-showermax-generator +++ b/geometry/generators/remoll-showermax-generator @@ -1 +1 @@ -Subproject commit f725e2213929233ed656e6d359d82f9087018983 +Subproject commit 5c0331884032f92712a35d8e5bef93672ff1ca73 diff --git a/geometry/showermax/showerMaxGen.gdml b/geometry/showermax/showerMaxGen.gdml index bb67ce373..e53845a2f 100644 --- a/geometry/showermax/showerMaxGen.gdml +++ b/geometry/showermax/showerMaxGen.gdml @@ -7,6 +7,22 @@ + + + + + + + + + + + + + + + + @@ -48,8 +64,8 @@ - - + + @@ -61,22 +77,6 @@ - - - - - - - - - - - - - - - - @@ -146,7 +146,6 @@ - @@ -207,6 +206,7 @@ + @@ -276,7 +276,6 @@ - @@ -337,6 +336,7 @@ + @@ -406,7 +406,6 @@ - @@ -467,6 +466,7 @@ + @@ -536,7 +536,6 @@ - @@ -597,6 +596,7 @@ + @@ -666,7 +666,6 @@ - @@ -727,6 +726,7 @@ + @@ -796,7 +796,6 @@ - @@ -857,6 +856,7 @@ + @@ -926,7 +926,6 @@ - @@ -987,6 +986,7 @@ + @@ -1056,7 +1056,6 @@ - @@ -1117,6 +1116,7 @@ + @@ -1186,7 +1186,6 @@ - @@ -1247,6 +1246,7 @@ + @@ -1316,7 +1316,6 @@ - @@ -1377,6 +1376,7 @@ + @@ -1446,7 +1446,6 @@ - @@ -1507,6 +1506,7 @@ + @@ -1576,7 +1576,6 @@ - @@ -1637,6 +1636,7 @@ + @@ -1706,7 +1706,6 @@ - @@ -1767,6 +1766,7 @@ + @@ -1836,7 +1836,6 @@ - @@ -1897,6 +1896,7 @@ + @@ -1966,7 +1966,6 @@ - @@ -2027,6 +2026,7 @@ + @@ -2096,7 +2096,6 @@ - @@ -2157,6 +2156,7 @@ + @@ -2226,7 +2226,6 @@ - @@ -2287,6 +2286,7 @@ + @@ -2356,7 +2356,6 @@ - @@ -2417,6 +2416,7 @@ + @@ -2486,7 +2486,6 @@ - @@ -2547,6 +2546,7 @@ + @@ -2616,7 +2616,6 @@ - @@ -2677,6 +2676,7 @@ + @@ -2746,7 +2746,6 @@ - @@ -2807,6 +2806,7 @@ + @@ -2876,7 +2876,6 @@ - @@ -2937,6 +2936,7 @@ + @@ -3006,7 +3006,6 @@ - @@ -3067,6 +3066,7 @@ + @@ -3136,7 +3136,6 @@ - @@ -3197,6 +3196,7 @@ + @@ -3266,7 +3266,6 @@ - @@ -3327,6 +3326,7 @@ + @@ -3396,7 +3396,6 @@ - @@ -3457,6 +3456,7 @@ + @@ -3526,7 +3526,6 @@ - @@ -3587,6 +3586,7 @@ + @@ -3656,7 +3656,6 @@ - @@ -3717,11 +3716,11 @@ + - @@ -3862,6 +3861,7 @@ + From bc213cfdbbf6db021d7fd699815fcb969a6ad181 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 20 Oct 2020 11:18:02 -0500 Subject: [PATCH 190/443] [gdml] rename element to symbol, as name clashes with materials --- geometry/materials.xml | 160 ++++++++++++++++++++--------------------- 1 file changed, 78 insertions(+), 82 deletions(-) diff --git a/geometry/materials.xml b/geometry/materials.xml index 4eb286c4d..9ffc9d6e8 100644 --- a/geometry/materials.xml +++ b/geometry/materials.xml @@ -9,7 +9,7 @@ - + @@ -21,7 +21,7 @@ - + @@ -33,7 +33,7 @@ - + @@ -48,13 +48,13 @@ - + - + @@ -68,17 +68,13 @@ - + - - - - - + @@ -91,7 +87,7 @@ - + @@ -106,7 +102,7 @@ - + @@ -130,7 +126,7 @@ - + @@ -151,7 +147,7 @@ - + @@ -159,7 +155,7 @@ - + @@ -178,7 +174,7 @@ - + @@ -186,7 +182,7 @@ - + @@ -196,7 +192,7 @@ - + @@ -213,7 +209,7 @@ - + @@ -226,7 +222,7 @@ - + @@ -272,8 +268,8 @@ --> - - + + - - - + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -426,8 +422,8 @@ - - + + building with boost enabled.") include_directories(${Boost_INCLUDE_DIRS}) @@ -99,6 +99,12 @@ if(Boost_FOUND) message(STATUS "Boost::iostreams found --> building with boost::iostreams enabled.") ADD_DEFINITIONS(-D__USE_BOOST_IOSTREAMS) endif() + if(Boost_FILESYSTEM_FOUND) + message(STATUS "Boost::filesystem found --> building with boost::filesystem enabled.") + ADD_DEFINITIONS(-D__USE_BOOST_FILESYSTEM) + endif() +else() + message(STATUS "Boost not found.") endif() diff --git a/Dockerfile b/Dockerfile index addc6e4f1..ebe90b4ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ FROM jeffersonlab/jlabce:2.3-mt # Install libgcj and pdftk RUN wget -q https://copr.fedorainfracloud.org/coprs/robert/gcj/repo/epel-7/robert-gcj-epel-7.repo -P /etc/yum.repos.d && \ wget -q https://copr.fedorainfracloud.org/coprs/robert/pdftk/repo/epel-7/robert-pdftk-epel-7.repo -P /etc/yum.repos.d && \ - yum install -q -y pdftk ghostscript + yum install -q -y pdftk ghostscript boost-devel # Add Tini entry point ENV TINI_VERSION v0.19.0 diff --git a/include/remollSearchPath.hh b/include/remollSearchPath.hh index 43d3a313a..6fe41b0ff 100644 --- a/include/remollSearchPath.hh +++ b/include/remollSearchPath.hh @@ -19,10 +19,22 @@ Usage: */ #include + +#if defined(__cpp_lib_filesystem) +#include +namespace fs = std::filesystem; +#elif defined(__cpp_lib_experimental_filesystem) #include "experimental/filesystem" +namespace fs = std::experimental::filesystem; +#elif defined(__USE_BOOST_FILESYSTEM) +#include +namespace fs = boost::filesystem; +#else +#define NO_FS_SUPPORT +#endif + #include "cstring" -namespace fs = std::experimental::filesystem; class remollSearchPath { @@ -39,12 +51,6 @@ public: static std::string resolve(const std::string& filename) { return remollSearchPath::getInstance()->operator()(filename); } - // So now it shouldn't matter if you do (remollSearchPath::resolve(macro)).c_str() - // or remollSearchPath::resolve(macro.c_str()) - // It will return the same thing - static const char* resolve(const char* filename) { - remollSearchPath::resolve(std::string(filename)).c_str(); - } }; #endif //__REMOLLSEARCHPATH_HH From 6d0d3bac986282eeafe42b6ce999ed59aa98f819 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 2 Nov 2020 13:46:49 -0600 Subject: [PATCH 196/443] [donut] updated mounting frame: rotated I-beams, now aluminum --- geometry/donut/donutConcreteLead.gdml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 48618b5c7..e67b12e3d 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -37,7 +37,9 @@ - + + + @@ -161,11 +163,11 @@ - + - + @@ -237,23 +239,23 @@ - - + + - - + + - - + + - - + + From 59256719b4967f6a68e6eec539fcd7473a74d0b8 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 3 Nov 2020 11:27:59 -0600 Subject: [PATCH 197/443] [donut] frame will use Al6061-T6 --- geometry/donut/donutConcreteLead.gdml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index e67b12e3d..86488e996 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -49,6 +49,28 @@ + + + + + + + @@ -163,7 +185,7 @@ - + From 9bd442130fbaa6f42d8e5c4eb32c12d0166721b8 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 3 Nov 2020 11:28:31 -0600 Subject: [PATCH 198/443] [donut] frame dimensions from Ryan --- geometry/donut/donutConcreteLead.gdml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 86488e996..181849e64 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -42,10 +42,10 @@ - - - - + + + + From f8bb3459f3fc6b6e8410ff8ca9817f65c0a66e46 Mon Sep 17 00:00:00 2001 From: Yug34 Date: Tue, 3 Nov 2020 22:59:41 +0530 Subject: [PATCH 199/443] remollSearchPath.patch --- Dockerfile | 2 +- include/remollDetectorConstruction.hh | 3 +++ include/remollParallelConstruction.hh | 3 +++ remoll.cc | 9 ++++++--- src/remollDetectorConstruction.cc | 2 +- src/remollMagneticField.cc | 6 ++++-- src/remollParallelConstruction.cc | 4 ++-- src/remollSearchPath.cc | 6 ++++++ 8 files changed, 26 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index ebe90b4ed..5301eb259 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ FROM jeffersonlab/jlabce:2.3-mt # Install libgcj and pdftk RUN wget -q https://copr.fedorainfracloud.org/coprs/robert/gcj/repo/epel-7/robert-gcj-epel-7.repo -P /etc/yum.repos.d && \ wget -q https://copr.fedorainfracloud.org/coprs/robert/pdftk/repo/epel-7/robert-pdftk-epel-7.repo -P /etc/yum.repos.d && \ - yum install -q -y pdftk ghostscript boost-devel + yum install -q -y pdftk ghostscript time boost-devel # Add Tini entry point ENV TINI_VERSION v0.19.0 diff --git a/include/remollDetectorConstruction.hh b/include/remollDetectorConstruction.hh index 66acccf30..0c8d5f09f 100644 --- a/include/remollDetectorConstruction.hh +++ b/include/remollDetectorConstruction.hh @@ -9,6 +9,8 @@ #include #include +#include "remollSearchPath.hh" + class G4Tubs; class G4LogicalVolume; class G4VPhysicalVolume; @@ -57,6 +59,7 @@ class remollDetectorConstruction : public G4VUserDetectorConstruction G4String fGDMLFile; void SetGDMLFile(G4String gdmlfile) { + gdmlfile = remollSearchPath::resolve(gdmlfile); size_t i = gdmlfile.rfind('/'); if (i != std::string::npos) { fGDMLPath = gdmlfile.substr(0,i); diff --git a/include/remollParallelConstruction.hh b/include/remollParallelConstruction.hh index 696183795..043c3888b 100644 --- a/include/remollParallelConstruction.hh +++ b/include/remollParallelConstruction.hh @@ -3,6 +3,8 @@ #include +#include "remollSearchPath.hh" + class G4LogicalVolume; class G4VPhysicalVolume; class G4GDMLParser; @@ -30,6 +32,7 @@ class remollParallelConstruction : public G4VUserParallelWorld G4String fGDMLFile; void SetGDMLFile(G4String gdmlfile) { + gdmlfile = remollSearchPath::resolve(gdmlfile); size_t i = gdmlfile.rfind('/'); if (i != std::string::npos) { fGDMLPath = gdmlfile.substr(0,i); diff --git a/remoll.cc b/remoll.cc index 3f846a6a7..c23207bd0 100644 --- a/remoll.cc +++ b/remoll.cc @@ -154,15 +154,18 @@ int main(int argc, char** argv) { { // Run in batch mode // Copy contents of macro into buffer to be written out into ROOT file + UImanager->SetMacroSearchPath(CMAKE_INSTALL_PREFIX); + UImanager->ParseMacroSearchPath(); remollRun::GetRunData()->SetMacroFile((remollSearchPath::resolve(macro)).c_str()); UImanager->ExecuteMacroFile((remollSearchPath::resolve(macro)).c_str()); - // ^Can do the same by using: - // UImanager->ExecuteMacroFile(remollSearchPath::resolve(macro.c_str())); } else { // Define UI session for interactive mode G4UIExecutive* ui = new G4UIExecutive(argc,argv,session); - if (ui->IsGUI()) + if (ui->IsGUI()) { + UImanager->SetMacroSearchPath(CMAKE_INSTALL_PREFIX); + UImanager->ParseMacroSearchPath(); UImanager->ApplyCommand("/control/execute macros/gui.mac"); + } ui->SessionStart(); delete ui; } diff --git a/src/remollDetectorConstruction.cc b/src/remollDetectorConstruction.cc index b7153d675..9004eebe5 100644 --- a/src/remollDetectorConstruction.cc +++ b/src/remollDetectorConstruction.cc @@ -61,7 +61,7 @@ remollDetectorConstruction::remollDetectorConstruction(const G4String& name, con fWorldName(name) { // If gdmlfile is non-empty - if (gdmlfile.length() > 0) SetGDMLFile(gdmlfile); + if (gdmlfile.length() > 0) SetGDMLFile("geometry/mollerMother.gdml"); // Create GDML parser fGDMLParser = new G4GDMLParser(); diff --git a/src/remollMagneticField.cc b/src/remollMagneticField.cc index a6ff71160..66906c654 100644 --- a/src/remollMagneticField.cc +++ b/src/remollMagneticField.cc @@ -8,6 +8,8 @@ #include "G4SystemOfUnits.hh" #include "G4PhysicalConstants.hh" +#include "remollSearchPath.hh" + #include #include @@ -25,9 +27,9 @@ #include #endif -remollMagneticField::remollMagneticField( G4String filename ){ +remollMagneticField::remollMagneticField( G4String filename ){ - fFilename = filename; + fFilename = remollSearchPath::resolve(filename); // Initialize grid variables for( int cidx = kR; cidx < kZ; cidx++ ){ diff --git a/src/remollParallelConstruction.cc b/src/remollParallelConstruction.cc index 0a60f776c..d2aab9974 100644 --- a/src/remollParallelConstruction.cc +++ b/src/remollParallelConstruction.cc @@ -16,7 +16,7 @@ //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... remollParallelConstruction::remollParallelConstruction(const G4String& name, const G4String& gdmlfile) : G4VUserParallelWorld(name), - fGDMLPath("geometry"),fGDMLFile(""), + fGDMLPath(""),fGDMLFile(""), fGDMLParser(0), fGDMLValidate(false), fGDMLOverlapCheck(false), @@ -26,7 +26,7 @@ remollParallelConstruction::remollParallelConstruction(const G4String& name, con fWorldName(name) { // If gdmlfile is non-empty - if (gdmlfile.length() > 0) fGDMLFile = gdmlfile; + if (gdmlfile.length() > 0) SetGDMLFile("geometry/mollerParallel.gdml"); // Create GDML parser fGDMLParser = new G4GDMLParser(); diff --git a/src/remollSearchPath.cc b/src/remollSearchPath.cc index 650c9314d..0a789f7be 100644 --- a/src/remollSearchPath.cc +++ b/src/remollSearchPath.cc @@ -5,9 +5,11 @@ remollSearchPath* remollSearchPath::fInstance = nullptr; remollSearchPath::remollSearchPath() { // add CMAKE_INSTALL_FULL_DATADIR, CMAKE_INSTALL_PREFIX and CWD to search path + #ifndef NO_FS_SUPPORT fSearchPath.push_back(fs::path(get_current_dir_name())); fSearchPath.push_back(fs::path(CMAKE_INSTALL_PREFIX)); fSearchPath.push_back(fs::path(CMAKE_INSTALL_FULL_DATADIR)); + #endif } remollSearchPath *remollSearchPath::getInstance() { @@ -21,6 +23,7 @@ remollSearchPath::~remollSearchPath() {} void remollSearchPath::add(const std::string& path) { +#ifndef NO_FS_SUPPORT // If directory to search in is inside CMAKE_INSTALL_PREFIX if(fs::exists(fs::path(std::string(CMAKE_INSTALL_PREFIX) + "/" + path))) { fSearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_PREFIX) + "/" + path)); @@ -38,6 +41,7 @@ void remollSearchPath::add(const std::string& path) else if (fs::exists(fs::path(path))) { fSearchPath.push_back(fs::path(path)); } +#endif } std::string remollSearchPath::operator() (const std::string& filename) @@ -45,11 +49,13 @@ std::string remollSearchPath::operator() (const std::string& filename) // If the file you are looking for exists inside any of the // directories inside fSearchPath, return the filename prefixed with // the directory for which the full path exists +#ifndef NO_FS_SUPPORT for (auto path: fSearchPath) { if(fs::exists(path / filename)) { return (path / filename).string(); } } +#endif // File not found in any of the search directories, // return the filename From d327b10cf1f44184e1869fe3f0de841e87a6761a Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 3 Nov 2020 15:59:05 -0600 Subject: [PATCH 200/443] [donut] larger system size for frame --- geometry/donut/donutConcreteLead.gdml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 181849e64..76f9c611b 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -6,7 +6,7 @@ - + From 3f3f50fb35a70e58917ed55bf668b3a80ba43818 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 3 Nov 2020 15:59:40 -0600 Subject: [PATCH 201/443] [donut] frame height and width per Ryan --- geometry/donut/donutConcreteLead.gdml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 76f9c611b..91a93f107 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -41,11 +41,11 @@ - - + + - - + + From 4b7c40bae1330070a6ba125499e19a0a61ec6b8c Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 3 Nov 2020 16:00:09 -0600 Subject: [PATCH 202/443] [donut] documentation --- geometry/donut/donutConcreteLead.gdml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 91a93f107..240ad102b 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -280,11 +280,13 @@ + + From 6615a6fc45752029d6a88c8e4090d869deb88fe2 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 3 Nov 2020 16:00:20 -0600 Subject: [PATCH 203/443] [donut] frame struts --- geometry/donut/donutConcreteLead.gdml | 73 +++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 240ad102b..5def47453 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -46,6 +46,10 @@ + + + + @@ -107,6 +111,37 @@
+ + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + @@ -192,6 +227,10 @@ + + + + @@ -280,6 +319,40 @@ + + + + + + + + + + + + + + + + + + + + + + From dc7dafb85cbe86fefa6ce4cb448ad6d824cad159 Mon Sep 17 00:00:00 2001 From: vdoomra <68244726+vdoomra@users.noreply.github.com> Date: Tue, 3 Nov 2020 19:52:04 -0500 Subject: [PATCH 204/443] Update beampipeDSMother.gdml --- .../beampipe/downstream/beampipeDSMother.gdml | 169 +++++++++++++++++- 1 file changed, 166 insertions(+), 3 deletions(-) diff --git a/geometry/beampipe/downstream/beampipeDSMother.gdml b/geometry/beampipe/downstream/beampipeDSMother.gdml index 22dd5356e..2f36de4e7 100644 --- a/geometry/beampipe/downstream/beampipeDSMother.gdml +++ b/geometry/beampipe/downstream/beampipeDSMother.gdml @@ -4,8 +4,12 @@ xsi:noNamespaceSchemaLocation="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd"> - - + + + + + + + + + + + + + + + + + + + + + + @@ -175,43 +197,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + @@ -219,6 +364,24 @@ + + + + + + + + + + + + + + + + + + From d00a63f4db308169d5ecdad4c8cfc3b1ee2b05c8 Mon Sep 17 00:00:00 2001 From: Yug34 Date: Thu, 5 Nov 2020 22:29:10 +0530 Subject: [PATCH 205/443] remollSearchPath fix --- Dockerfile | 4 ---- src/remollDetectorConstruction.cc | 9 ++++++--- src/remollParallelConstruction.cc | 5 ++++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 51393a2f3..5301eb259 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,10 +24,6 @@ FROM jeffersonlab/jlabce:2.3-mt RUN wget -q https://copr.fedorainfracloud.org/coprs/robert/gcj/repo/epel-7/robert-gcj-epel-7.repo -P /etc/yum.repos.d && \ wget -q https://copr.fedorainfracloud.org/coprs/robert/pdftk/repo/epel-7/robert-pdftk-epel-7.repo -P /etc/yum.repos.d && \ yum install -q -y pdftk ghostscript time boost-devel -<<<<<<< HEAD -======= - ->>>>>>> bb88a3699846057b8bcd024db8caff66694985ef # Add Tini entry point ENV TINI_VERSION v0.19.0 diff --git a/src/remollDetectorConstruction.cc b/src/remollDetectorConstruction.cc index ef07534ab..e656fe5b5 100644 --- a/src/remollDetectorConstruction.cc +++ b/src/remollDetectorConstruction.cc @@ -49,8 +49,8 @@ remollDetectorConstruction::remollDetectorConstruction(const G4String& name, con fGDMLParser(0), fGDMLValidate(false), fGDMLOverlapCheck(false), - fGDMLPath("geometry"), - fGDMLFile("mollerMother.gdml"), + fGDMLPath(""), + fGDMLFile(""), fMessenger(0), fGeometryMessenger(0), fUserLimitsMessenger(0), @@ -60,8 +60,11 @@ remollDetectorConstruction::remollDetectorConstruction(const G4String& name, con fWorldVolume(0), fWorldName(name) { + SetGDMLFile("geometry/mollerMother.gdml"); // If gdmlfile is non-empty - if (gdmlfile.length() > 0) SetGDMLFile("geometry/mollerMother.gdml"); + if (gdmlfile.length() > 0) { + SetGDMLFile(gdmlfile); + } // New units new G4UnitDefinition("inch","in","Length",25.4*CLHEP::millimeter); diff --git a/src/remollParallelConstruction.cc b/src/remollParallelConstruction.cc index b512865c3..717ec2c80 100644 --- a/src/remollParallelConstruction.cc +++ b/src/remollParallelConstruction.cc @@ -26,8 +26,11 @@ remollParallelConstruction::remollParallelConstruction(const G4String& name, con fWorldVolume(0), fWorldName(name) { + SetGDMLFile("geometry/mollerParallel.gdml"); // If gdmlfile is non-empty - if (gdmlfile.length() > 0) SetGDMLFile("geometry/mollerParallel.gdml"); + if (gdmlfile.length() > 0) { + SetGDMLFile(gdmlfile); + } // Create GDML parser fGDMLParser = new G4GDMLParser(); From 5e20ec47f2d5c637a05e1a3ecfe49f48210713f2 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 5 Nov 2020 12:43:15 -0600 Subject: [PATCH 206/443] Docker-image workflow to replace defunct travis-ci Currently only runs on develop branch, needs a ${{ }} for the branch name on docker push. Also needs to push to latest for master branch. --- .github/workflows/docker-image.yml | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 000000000..000e2f54b --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,37 @@ +name: Build Docker Images + +on: + push: + branches: [ develop ] + +jobs: + push_to_registry: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + context: . + file: Dockerfile + tags: jeffersonlab/remoll:develop + push: true + - + name: Image digest + run: echo ${{ steps.docker_build.outputs.digest }} From 17adccdf66b56cbe179a3bc215e771c3ac38873b Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 5 Nov 2020 16:39:56 -0600 Subject: [PATCH 207/443] [donut] corrected strut positions --- geometry/donut/donutConcreteLead.gdml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 5def47453..42455d10b 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -49,7 +49,7 @@ - + From acba37f97d860f783f7222de5fa3346fcb6f6151 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 5 Nov 2020 16:40:57 -0600 Subject: [PATCH 208/443] [donut] aluminum inner and outer sleeve around concrete and lead --- geometry/donut/donutConcreteLead.gdml | 55 +++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 42455d10b..9449493b1 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -26,6 +26,9 @@ + + + @@ -187,6 +190,16 @@ z="donutConcreteThickness-donutVirtualDetectorThickness"/> + + + + + + + + @@ -215,6 +228,16 @@ z="donutLeadThickness-donutVirtualDetectorThickness"/> + + + + + + + + @@ -262,6 +285,14 @@ + + + + + + + + @@ -293,6 +324,14 @@ + + + + + + + + @@ -358,12 +397,28 @@ + + + + + + + + + + + + + + + + From ffb8707a73a0f145273809bf437cb6ec8033e795 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 5 Nov 2020 16:44:45 -0600 Subject: [PATCH 209/443] [donut] support structure (ribbed flange) --- geometry/donut/donutConcreteLead.gdml | 374 ++++++++++++++++++++++++++ 1 file changed, 374 insertions(+) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 9449493b1..15450eba6 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -53,6 +53,18 @@ + + + + + + + + + + + + @@ -238,6 +250,208 @@ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + +
+
+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + +
+
+ + + + + + + +
+
+ + + + + + + @@ -333,6 +547,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -420,6 +692,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 874f61c14d2270f4ecf4e9440bbea0b8d0ae363d Mon Sep 17 00:00:00 2001 From: Sakib Rahman Date: Sun, 8 Nov 2020 12:14:49 -0500 Subject: [PATCH 210/443] Changing the magnetic field offset back to 0 to accomodate new field maps which will be in hall coordinates --- src/remollMagneticField.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/remollMagneticField.cc b/src/remollMagneticField.cc index 66906c654..a33b69112 100644 --- a/src/remollMagneticField.cc +++ b/src/remollMagneticField.cc @@ -42,7 +42,7 @@ remollMagneticField::remollMagneticField( G4String filename ){ // Default offset for field maps in reference frame with // the hall pivot at z = 0. - fZoffset = -5000.0; + fZoffset = 0.0; fInit = false; fMagCurrent0 = -1e9; From 428301396a2641d743501a4610e3e8dc46a7e935 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 11 Nov 2020 12:35:27 -0600 Subject: [PATCH 211/443] [remollMagneticField] name is different from filename --- include/remollMagneticField.hh | 1 + src/remollMagneticField.cc | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/remollMagneticField.hh b/include/remollMagneticField.hh index b4977ab4d..70cf1ebd4 100644 --- a/include/remollMagneticField.hh +++ b/include/remollMagneticField.hh @@ -64,6 +64,7 @@ class remollMagneticField : public G4MagneticField { } private: + G4String fName; G4String fFilename; G4int fN[__NDIM]; diff --git a/src/remollMagneticField.cc b/src/remollMagneticField.cc index 66906c654..01fecd6cf 100644 --- a/src/remollMagneticField.cc +++ b/src/remollMagneticField.cc @@ -29,6 +29,7 @@ remollMagneticField::remollMagneticField( G4String filename ){ + fName = filename; fFilename = remollSearchPath::resolve(filename); // Initialize grid variables @@ -62,12 +63,12 @@ G4String remollMagneticField::GetName(){ return G4String(""); } - return fFilename; + return fName; } void remollMagneticField::SetFieldScale(G4double s){ fFieldScale = s; - G4cout << fFilename << " scale set to " << s << G4endl; + G4cout << fName << " scale set to " << s << G4endl; return; } @@ -76,7 +77,7 @@ void remollMagneticField::SetMagnetCurrent(G4double s){ SetFieldScale(s/fMagCurrent0); } else { G4cerr << "Warning: " << __FILE__ << " line " << __LINE__ - << ": Field current not specified in map " << fFilename << " - Ignoring and proceeding " << G4endl; + << ": Field current not specified in map " << fName << " - Ignoring and proceeding " << G4endl; } return; } @@ -94,7 +95,7 @@ void remollMagneticField::InitializeGrid() { exit(1); } - G4cout << "Initializing field map grid for " << fFilename << G4endl; + G4cout << "Initializing field map grid for " << fName << G4endl; G4int cidx, ridx, pidx, zidx; for( cidx = kR; cidx <= kZ; cidx++ ){ @@ -115,7 +116,7 @@ void remollMagneticField::InitializeGrid() { } // end of r } // end coordinate index - G4cout << "Map grid for " << fFilename << " initialized" << G4endl; + G4cout << "Map grid for " << fName << " initialized" << G4endl; return; } From 43b9104d8ef135c1b85f716434d1e36c746d0cb9 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 11 Nov 2020 12:40:09 -0600 Subject: [PATCH 212/443] [remollMagneticField] /remoll/field/value should print in T, not kT --- src/remollGlobalField.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/remollGlobalField.cc b/src/remollGlobalField.cc index 1487217f7..dd3c047e9 100644 --- a/src/remollGlobalField.cc +++ b/src/remollGlobalField.cc @@ -252,7 +252,7 @@ void remollGlobalField::PrintFieldValue(const G4ThreeVector& r) GetFieldValue(p, B); G4cout << "At r" << r << " [m]: B = "; for (int i = 0; i < __GLOBAL_NDIM; i++) { - G4cout << B[i] << " "; + G4cout << B[i]/tesla << " "; } G4cout << "T" << G4endl; } From ac20a14f4a9d8fb08f71018414dab80142682b7a Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 2 Jul 2020 14:43:20 -0400 Subject: [PATCH 213/443] Recently, having LIBGL_ALWAYS_INDIRECT set on the farm causes crashes This notifies the users when LIBGL_ALWAYS_INDIRECT is set (to any value), and provides info on how to unset the variable. Historical note: In about 2016/2017 this environment variable was used to fix a visualization crash on the farm. Many may still have lines in their login scripts to set this variable. --- remoll.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/remoll.cc b/remoll.cc index c23207bd0..6ac8d1bce 100644 --- a/remoll.cc +++ b/remoll.cc @@ -63,6 +63,14 @@ int main(int argc, char** argv) { gROOT->Reset(); #endif + // Warn if LIBGL_ALWAYS_INDIRECT is set + if (std::getenv("LIBGL_ALWAYS_INDIRECT")) { + G4cerr << "remoll: Environment variable LIBGL_ALWAYS_INDIRECT is set." << G4endl; + G4cerr << "remoll: This may interfere with visualization. Unset wih:" << G4endl; + G4cerr << "remoll: tcsh> unsetenv LIBGL_ALWAYS_INDIRECT" << G4endl; + G4cerr << "remoll: bash> unset LIBGL_ALWAYS_INDIRECT" << G4endl; + } + // Initialize the random seed G4long seed = time(0) + (int) getpid(); // Open /dev/urandom From 0acd0699b8b82cdc7924d562580540aa4cc97c21 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 11 Nov 2020 18:13:26 -0500 Subject: [PATCH 214/443] [remollSearchPath] avoid operator/= and use string path combinations --- src/remollSearchPath.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/remollSearchPath.cc b/src/remollSearchPath.cc index 0a789f7be..ee7196a5b 100644 --- a/src/remollSearchPath.cc +++ b/src/remollSearchPath.cc @@ -33,7 +33,7 @@ void remollSearchPath::add(const std::string& path) fSearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/" + path)); } // If directory to search in is inside the current working directory - else if(fs::exists(fs::path(get_current_dir_name()) / path)) { + else if(fs::exists(fs::path(std::string(get_current_dir_name()) + "/" + path))) { fSearchPath.push_back(fs::path(get_current_dir_name()) / path); } // Path not relative to CMAKE_INSTALL_PREFIX, CMAKE_INSTALL_FULL_DATADIR or CWD @@ -51,8 +51,9 @@ std::string remollSearchPath::operator() (const std::string& filename) // the directory for which the full path exists #ifndef NO_FS_SUPPORT for (auto path: fSearchPath) { - if(fs::exists(path / filename)) { - return (path / filename).string(); + fs::path test(path.string() + "/" + filename); + if(fs::exists(test)) { + return test.string(); } } #endif From bc4fe73470de9d25ed831189e4d9824fa74fbe0c Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 11 Nov 2020 19:24:05 -0600 Subject: [PATCH 215/443] [workflows] reenable unit test suites --- .github/workflows/docker-image.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 000e2f54b..433043b51 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -35,3 +35,27 @@ jobs: - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} + test_geometry: + name: Geometry test suite ${{ matrix.suite }} + strategy: + matrix: + suite: [validate,overlap] + runs-on: ubuntu-latest + container: + image: docker://jeffersonlab/remoll:develop + steps: + - name: Geometry test suite ${{ matrix.suite }} + run: | + scripts/tests/test_geometries.sh ${{ matrix.suite }} + test_running: + name: Running test suite ${{ matrix.suite }} + strategy: + matrix: + suite: [unit,commit] + runs-on: ubuntu-latest + container: + image: docker://jeffersonlab/remoll:develop + steps: + - name: Geometry test suite ${{ matrix.suite }} + run: | + scripts/tests/test_macros.sh ${{ matrix.suite }} From 3d607f07971ce3df53c7ebad538b8ecda008016c Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 11 Nov 2020 19:24:37 -0600 Subject: [PATCH 216/443] [workflows] build-test against cvmfs not functional --- .github/workflows/build-test.yml | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 .github/workflows/build-test.yml diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml deleted file mode 100644 index 5dbb6caff..000000000 --- a/.github/workflows/build-test.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Build Test - -on: [push, pull_request] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: eic/setup-cvmfs@main - - uses: eic/setup-spack@main - with: - environment: eic - - name: Build - run: | - source ${SPACK_ROOT}/share/spack/setup-env.sh - spack load root geant4 - mkdir build && cmake -B build && make -C build install - - name: Test - run: | - build/remoll macros/runexample.mac From 351a66e513b02f18258d82e45d892379d5c2427f Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 11 Nov 2020 19:50:02 -0600 Subject: [PATCH 217/443] [workflows] wait with test until pushed to docker hub --- .github/workflows/docker-image.yml | 40 +++++++++++++++++------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 433043b51..e8b429aff 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -8,23 +8,18 @@ jobs: push_to_registry: runs-on: ubuntu-latest steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v2 - - - name: Set up QEMU + - name: Set up QEMU uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - - - name: Login to DockerHub + - name: Login to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push + - name: Build and push id: docker_build uses: docker/build-push-action@v2 with: @@ -32,30 +27,41 @@ jobs: file: Dockerfile tags: jeffersonlab/remoll:develop push: true - - - name: Image digest + - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} + test_geometry: - name: Geometry test suite ${{ matrix.suite }} + name: Running geometry test suite ${{ matrix.suite }} + needs: push_to_registry strategy: matrix: suite: [validate,overlap] runs-on: ubuntu-latest container: image: docker://jeffersonlab/remoll:develop + volumes: + - rootfiles:/jlab/remoll/rootfiles + - logfiles:/jlab/remoll/logfiles steps: - - name: Geometry test suite ${{ matrix.suite }} + - uses: actions/checkout@v2 + - name: Running geometry test suite ${{ matrix.suite }} run: | scripts/tests/test_geometries.sh ${{ matrix.suite }} - test_running: - name: Running test suite ${{ matrix.suite }} + + test_macros: + name: Running macros test suite ${{ matrix.suite }} + needs: push_to_registry strategy: matrix: suite: [unit,commit] runs-on: ubuntu-latest container: image: docker://jeffersonlab/remoll:develop + volumes: + - rootfiles:/jlab/remoll/rootfiles + - logfiles:/jlab/remoll/logfiles steps: - - name: Geometry test suite ${{ matrix.suite }} + - uses: actions/checkout@v2 + - name: Running macros test suite ${{ matrix.suite }} run: | scripts/tests/test_macros.sh ${{ matrix.suite }} From 7bda17ea1131a61e8edf8873b1c17758d392cd81 Mon Sep 17 00:00:00 2001 From: Chandan Ghosh Date: Thu, 12 Nov 2020 12:22:41 -0500 Subject: [PATCH 218/443] updated merged and extended collimator 1-2design --- .../upstream/upstreamDaughter_merged.gdml | 319 ++---------------- 1 file changed, 35 insertions(+), 284 deletions(-) diff --git a/geometry/upstream/upstreamDaughter_merged.gdml b/geometry/upstream/upstreamDaughter_merged.gdml index cfaa56f54..82cc137ed 100644 --- a/geometry/upstream/upstreamDaughter_merged.gdml +++ b/geometry/upstream/upstreamDaughter_merged.gdml @@ -10,8 +10,6 @@ &matrices; - - @@ -23,7 +21,7 @@ - + @@ -31,73 +29,22 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - + + + + + + + + + + @@ -283,185 +230,7 @@ --> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -472,13 +241,13 @@ - - - - - + + + + + - --> + @@ -688,24 +458,13 @@ - + - - - - - - - - - - - @@ -782,40 +540,35 @@ + - - - - - - - + - --> - + - --> - + - --> - + + ---> @@ -840,8 +593,6 @@ - - From d4cd5fdb116526f0a9c9c38729099ec8f92c4187 Mon Sep 17 00:00:00 2001 From: Sakib Rahman Date: Thu, 12 Nov 2020 12:48:40 -0600 Subject: [PATCH 219/443] Adding some comments. --- geometry/pion/pionDetectorSystem.gdml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geometry/pion/pionDetectorSystem.gdml b/geometry/pion/pionDetectorSystem.gdml index 295bbe58b..8bc58bfbf 100644 --- a/geometry/pion/pionDetectorSystem.gdml +++ b/geometry/pion/pionDetectorSystem.gdml @@ -7,7 +7,7 @@ - + From 44c05cf116f3df5637390f1951c9b7c860de9354 Mon Sep 17 00:00:00 2001 From: Fatemeh Gorgannejad Date: Mon, 16 Nov 2020 12:27:04 -0600 Subject: [PATCH 220/443] Correct a unit --- geometry/pion/pionDetectorSystem.gdml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geometry/pion/pionDetectorSystem.gdml b/geometry/pion/pionDetectorSystem.gdml index 8bc58bfbf..cd3aca52f 100644 --- a/geometry/pion/pionDetectorSystem.gdml +++ b/geometry/pion/pionDetectorSystem.gdml @@ -9,7 +9,7 @@ - + From f0c95d4b2cee5fc6a19aa6bc22f4f67b208a2949 Mon Sep 17 00:00:00 2001 From: vdoomra <68244726+vdoomra@users.noreply.github.com> Date: Mon, 16 Nov 2020 17:04:48 -0500 Subject: [PATCH 221/443] Update beampipeDSMother.gdml --- .../beampipe/downstream/beampipeDSMother.gdml | 655 +++++++++--------- 1 file changed, 335 insertions(+), 320 deletions(-) diff --git a/geometry/beampipe/downstream/beampipeDSMother.gdml b/geometry/beampipe/downstream/beampipeDSMother.gdml index 2f36de4e7..1f4a6d671 100644 --- a/geometry/beampipe/downstream/beampipeDSMother.gdml +++ b/geometry/beampipe/downstream/beampipeDSMother.gdml @@ -1,23 +1,23 @@ - - - - - - - - - - - - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd"> + + + + + + + + + + + + @@ -52,411 +52,426 @@ - + - + - + - + - + - + - - - - - - - - - - - - + + + + + + + + + + + + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - - + - - - - + + + + - - - - - + - - - - + + + + - - - - - + - - - - + + + + - - - - + + + + + + - - - - + + + + + + + - - - - + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - + + - - - - + + - - - - + + - - - - + + - - - - + + - - - - + + - - - - + + - - - + + - - - - + + + + + + + + - - - - + + + + - - - - + + + + + + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - + + + + + - - - - - + + + + + - - - - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - - + + + + + - - - + + + + - - - + + + - + - + - - - + + + From 95641f727b9b99227e4b9c753b0211a474b63538 Mon Sep 17 00:00:00 2001 From: Chandan Ghosh Date: Tue, 17 Nov 2020 12:50:40 -0500 Subject: [PATCH 222/443] Changed position of an Auxiliary tag --- geometry/upstream/upstreamDaughter_merged.gdml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/geometry/upstream/upstreamDaughter_merged.gdml b/geometry/upstream/upstreamDaughter_merged.gdml index 82cc137ed..23cb814a6 100644 --- a/geometry/upstream/upstreamDaughter_merged.gdml +++ b/geometry/upstream/upstreamDaughter_merged.gdml @@ -540,14 +540,12 @@ - - --> @@ -568,8 +566,6 @@ --> - - @@ -593,6 +589,8 @@ + + From a19d17b3e1dfee62f6cc5f8c35cb9b64f611c41c Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 18 Nov 2020 19:37:34 -0600 Subject: [PATCH 223/443] [CMakeLists] new magnetic field maps --- CMakeLists.txt | 117 ++++++++++++++++++++++++------------------------- 1 file changed, 57 insertions(+), 60 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ce1491d01..678ec68ac 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -314,74 +314,71 @@ set(REMOLL_LOCATION /group/halla/www/hallaweb/html/12GeV/Moller/downloads/remoll set(REMOLL_DOWNLOADS http://hallaweb.jlab.org/12GeV/Moller/downloads/remoll/) set(REMOLL_MAP_DIR ${PROJECT_SOURCE_DIR}/map_directory) if(EXISTS ${REMOLL_LOCATION}) - message(STATUS "Copying files directly from directory...") + message(STATUS "Fieldmaps will be copied from directory...") set(REMOLL_DOWNLOADS file://${REMOLL_LOCATION}) else() message(STATUS "Fieldmaps will be downloaded from web...") endif() -file(DOWNLOAD - ${REMOLL_DOWNLOADS}/hybridJLAB.txt - ${REMOLL_MAP_DIR}/hybridJLAB.txt - EXPECTED_MD5 c2da18fd7ab80cc4abe7eafc487963dc - ) -file(DOWNLOAD - ${REMOLL_DOWNLOADS}/upstreamJLAB_1.25.txt - ${REMOLL_MAP_DIR}/upstreamJLAB_1.25.txt - EXPECTED_MD5 af06ed35516c17640e89ba3aa0f5b200 - ) -file(DOWNLOAD - ${REMOLL_DOWNLOADS}/hybridJLAB_v2.txt - ${REMOLL_MAP_DIR}/hybridJLAB_v2.txt - EXPECTED_MD5 4a0d1abc9b80cf5f2c3dd495a1133e26 - ) -file(DOWNLOAD - ${REMOLL_DOWNLOADS}/segmentedJLAB_v2.txt - ${REMOLL_MAP_DIR}/segmentedJLAB_v2.txt - EXPECTED_MD5 2a21b540f6496e3f554302f369646bbb - ) -file(DOWNLOAD - ${REMOLL_DOWNLOADS}/upstreamJLAB_v2.txt - ${REMOLL_MAP_DIR}/upstreamJLAB_v2.txt - EXPECTED_MD5 bed73f2ea44135c52222bc8e767e1954 - ) -install(FILES - ${REMOLL_MAP_DIR}/hybridJLAB.txt - ${REMOLL_MAP_DIR}/upstreamJLAB_1.25.txt - ${REMOLL_MAP_DIR}/hybridJLAB_v2.txt - ${REMOLL_MAP_DIR}/segmentedJLAB_v2.txt - ${REMOLL_MAP_DIR}/upstreamJLAB_v2.txt - DESTINATION ${CMAKE_INSTALL_DATADIR}/remoll) +if(Boost_IOSTREAMS_FOUND) + message(STATUS "Gzipped fieldmaps will be made available...") +endif() +# for i in *.txt ; do echo `md5sum $i|awk '{print$1}'`:`md5sum $i.gz|awk '{print$1}'`:$i ; done +set(REMOLL_MAPS +ca69d4a4397ae3a944f603b91dfbe586:36e2aa90d39e4ad9be4f747a522baa69:V1DHy.3.txt +eb802b9d8569669b5aa674fc56c52a24:df7f4dd87c894c5eef878b248ef14c3e:V1DSg.3.txt +b1b8f2845dc5cd420c6ff49ae7760a60:6002f6f5f092346cb2bdedac046d1905:V1U.2a.txt +259459226a5cacc1d62ba295534645e2:95c6193ea30c03316068e3d67d3ec32b:V2DHy.1.txt +c71758450b063ab83e95a7ba8c590885:a5ba5c81c0c6590d43fac1cbd3f2d7a0:V2DSg.1a.txt +c2ac33287df1bf20bfedcb4d4a96c8d5:3a31416eb7659248f7a2ba582d43a6fe:V2DSg.1b.txt +70e2bbed1831816957e953bba48f01d5:2fd1cd2785db92f9c880b675890460b5:V2U.1a.txt +e55ffd8aba96cbf24962155d3c7f75e4:0172016c988867b0928258d79cd1c865:V2U.1b.txt +) +set(REMOLL_MAPS_EXTRA +b4bfef8f362e0df66f166b4e76a6847e:57a7719eb877572751f4c4b481d6a788:blockyHybrid_rm_3.0.txt +7df29e47413c8dd69fd179298f11b717:9120bc05099a144916467b6ea17e39f8:blockyUpstream_rm_1.1_noscale.txt +3e2338e1ba74b03da37545e98931f5f3:75dfcd912e74f42543892fed8271fa7c:blockyUpstream_rm_1.1.txt +c2da18fd7ab80cc4abe7eafc487963dc:112a466bf5dc2ef4dd24b935767a0540:hybridJLAB.txt +4a0d1abc9b80cf5f2c3dd495a1133e26:a8f5875a4ef0c27c63f31cf7395b13f0:hybridJLAB_v2.txt +0f6e9a3a8392d01c63f1609afc4e4c09:996a6581de9d3c331398bb85ef955a15:hybridSymmetric_sensR_0.0.txt +78fad2ffa5b5ae129df11bdf0ce25333:f21fb19507197baba3658885315c9a6e:hybridSymmetric_sensR_0.1.txt +2a21b540f6496e3f554302f369646bbb:fb95664f9bdba1c22ad28eb21bd1c9fb:segmentedJLAB_v2.txt +af06ed35516c17640e89ba3aa0f5b200:b8009dc61a17eea1d884f0c746f6922c:upstreamJLAB_1.25.txt +bed73f2ea44135c52222bc8e767e1954:f50ce73289174ada019977f2dec87cb6:upstreamJLAB_v2.txt +4ca3d968cadd85a89b86148411eda678:ce0a41b96a5937978aa9f30155fab610:upstreamSymmetric_sensR_0.0.txt +849d9dc5abab0842fc13fef7f4918648:4a8c457385f179a036fffca4ae8e2cb0:upstreamSymmetric_sensR_0.1.txt +) if(ADDITIONAL_FIELDS) - message(STATUS "Ensuring additional fields are available") - file(DOWNLOAD - ${REMOLL_DOWNLOADS}/blockyUpstream_rm_1.1.txt - ${REMOLL_MAP_DIR}/blockyUpstream_rm_1.1.txt - EXPECTED_MD5 3e2338e1ba74b03da37545e98931f5f3 - ) - file(DOWNLOAD - ${REMOLL_DOWNLOADS}/blockyHybrid_rm_3.0.txt - ${REMOLL_MAP_DIR}/blockyHybrid_rm_3.0.txt - EXPECTED_MD5 b4bfef8f362e0df66f166b4e76a6847e - ) - file(DOWNLOAD - ${REMOLL_DOWNLOADS}/upstreamSymmetric_sensR_0.1.txt - ${REMOLL_MAP_DIR}/upstreamSymmetric_sensR_0.1.txt - EXPECTED_MD5 849d9dc5abab0842fc13fef7f4918648 - ) - file(DOWNLOAD - ${REMOLL_DOWNLOADS}/hybridSymmetric_sensR_0.1.txt - ${REMOLL_MAP_DIR}/hybridSymmetric_sensR_0.1.txt - EXPECTED_MD5 78fad2ffa5b5ae129df11bdf0ce25333 - ) - install(FILES - ${REMOLL_MAP_DIR}/blockyHybrid_rm_3.0.txt - ${REMOLL_MAP_DIR}/blockyUpstream_rm_1.1.txt - ${REMOLL_MAP_DIR}/upstreamSymmetric_sensR_0.1.txt - ${REMOLL_MAP_DIR}/hybridSymmetric_sensR_0.1.txt - DESTINATION ${CMAKE_INSTALL_DATADIR}/remoll) + message(STATUS "Ensuring additional fields are available.") else() message(STATUS "Download additional fields with '-DADDITIONAL_FIELDS=ON'.") + set(REMOLL_MAPS_EXTRA "") endif() +foreach(MAP IN LISTS REMOLL_MAPS REMOLL_MAPS_EXTRA) + set(REGEX "^(.*):(.*):(.*)$") + # Hash 1: txt file, Hash 2: txt.gz file + string(REGEX REPLACE ${REGEX} "\\1" HASH1 ${MAP}) + string(REGEX REPLACE ${REGEX} "\\2" HASH2 ${MAP}) + string(REGEX REPLACE ${REGEX} "\\3" FILE ${MAP}) + if(Boost_IOSTREAMS_FOUND) + file(DOWNLOAD + ${REMOLL_DOWNLOADS}/${FILE}.gz + ${REMOLL_MAP_DIR}/${FILE}.gz + EXPECTED_MD5 ${HASH2} + ) + install(FILES + ${REMOLL_MAP_DIR}/${FILE}.gz + DESTINATION ${CMAKE_INSTALL_DATADIR}/remoll) + else() + file(DOWNLOAD + ${REMOLL_DOWNLOADS}/${FILE} + ${REMOLL_MAP_DIR}/${FILE} + EXPECTED_MD5 ${HASH1} + ) + install(FILES + ${REMOLL_MAP_DIR}/${FILE} + DESTINATION ${CMAKE_INSTALL_DATADIR}/remoll) + endif() +endforeach() #---------------------------------------------------------------------------- From 2babb33fc7e51b1cb4adeb6b3a8fa1cb62dbda52 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 18 Nov 2020 19:38:52 -0600 Subject: [PATCH 224/443] [remollMagneticField] transparently try to load .gz version of maps --- src/remollMagneticField.cc | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/src/remollMagneticField.cc b/src/remollMagneticField.cc index 01fecd6cf..71e578994 100644 --- a/src/remollMagneticField.cc +++ b/src/remollMagneticField.cc @@ -144,11 +144,36 @@ void remollMagneticField::ReadFieldMap(){ boost::iostreams::filtering_istream inputfile; // If the filename has .gz somewhere (hopefully the end) if (fFilename.find(".gz") != std::string::npos) { - // Add gzip decompressor to stream - inputfile.push(boost::iostreams::gzip_decompressor()); + boost::iostreams::file_source source_gz(fFilename); + if (source_gz.is_open()) { + // Add gzip decompressor to stream + inputfile.push(boost::iostreams::gzip_decompressor()); + // Set file as source + inputfile.push(source_gz); + } else { + G4cerr << "Unable to open input file " << fFilename << G4endl; + exit(1); + } + } else { + // Try to add .gz at end of filename + boost::iostreams::file_source source_gz(fFilename + ".gz"); + if (source_gz.is_open()) { + // Add gzip decompressor to stream + inputfile.push(boost::iostreams::gzip_decompressor()); + // Set file as source + inputfile.push(source_gz); + } else { + // Try to load filename without gz + boost::iostreams::file_source source_txt(fFilename); + if (source_txt.is_open()) { + // Set file as source + inputfile.push(source_txt); + } else { + G4cerr << "Unable to open input file " << fFilename << G4endl; + exit(1); + } + } } - // Set file as source - inputfile.push(boost::iostreams::file_source(fFilename)); #else // Create STL ifstream std::ifstream inputfile; From 75b6178939a6cfc31526bd0d62a42988f98ec5d7 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 25 Nov 2020 21:19:51 -0600 Subject: [PATCH 225/443] [evgen] rename SampType_t to SamplingType_t --- include/remollBeamTarget.hh | 3 +-- include/remollVEventGen.hh | 6 ++++-- include/remolltypes.hh | 6 +++++- src/remollBeamTarget.cc | 8 ++++---- src/remollGenBeam.cc | 2 +- src/remollGenExternal.cc | 3 ++- src/remollVEventGen.cc | 4 ++-- 7 files changed, 19 insertions(+), 13 deletions(-) diff --git a/include/remollBeamTarget.hh b/include/remollBeamTarget.hh index 5857ae1de..f61a1e5d3 100644 --- a/include/remollBeamTarget.hh +++ b/include/remollBeamTarget.hh @@ -64,8 +64,7 @@ class remollBeamTarget { G4double GetEffLumin(); - - remollVertex SampleVertex(SampType_t); + remollVertex SampleVertex(SamplingType_t); G4double fBeamEnergy; G4double fBeamCurrent; diff --git a/include/remollVEventGen.hh b/include/remollVEventGen.hh index d4eca30bc..e5eba3b6c 100644 --- a/include/remollVEventGen.hh +++ b/include/remollVEventGen.hh @@ -44,7 +44,9 @@ class remollVEventGen { fBeamTarg = bt; } - void SetSampType( SampType_t st ) { fSampType = st; } + void SetSamplingType(SamplingType_t type) { fSamplingType = type; } + SamplingType_t GetSamplingType() const { return fSamplingType; } + void SetDoMultScatt( G4bool multscatt ){ fApplyMultScatt = multscatt; } void SetEmin(double emin) { fE_min = emin; } @@ -90,7 +92,7 @@ public: protected: - SampType_t fSampType; + SamplingType_t fSamplingType; G4bool fApplyMultScatt; private: diff --git a/include/remolltypes.hh b/include/remolltypes.hh index c7bb40f0e..ef00f838f 100644 --- a/include/remolltypes.hh +++ b/include/remolltypes.hh @@ -17,7 +17,11 @@ #include "TTimeStamp.h" -enum SampType_t { kNoTargetVolume, kActiveTargetVolume, kAllTargetVolumes }; +enum SamplingType_t { + kNoTargetVolume, + kActiveTargetVolume, + kAllTargetVolumes +}; struct filedata_t { char filename[__RUNSTR_LEN]; diff --git a/src/remollBeamTarget.cc b/src/remollBeamTarget.cc index d69255828..e7b0b6f05 100644 --- a/src/remollBeamTarget.cc +++ b/src/remollBeamTarget.cc @@ -176,13 +176,13 @@ void remollBeamTarget::SetActiveTargetVolume(G4String name) //////////////////////////////////////////////////////////////////////////////////////////// // Sampling functions -remollVertex remollBeamTarget::SampleVertex(SampType_t samp) +remollVertex remollBeamTarget::SampleVertex(SamplingType_t sampling_type) { // Create vertex remollVertex vertex; // No sampling required - if (samp == kNoTargetVolume) { + if (sampling_type == kNoTargetVolume) { return vertex; } @@ -208,7 +208,7 @@ remollVertex remollBeamTarget::SampleVertex(SampType_t samp) // Figure out how far along the target we got G4double total_effective_length = 0; - switch( samp ){ + switch (sampling_type) { case kActiveTargetVolume: total_effective_length = fActiveTargetEffectiveLength; break; @@ -257,7 +257,7 @@ remollVertex remollBeamTarget::SampleVertex(SampType_t samp) // Find position in this volume (if we are in it) G4double effective_position_in_volume; G4double actual_position_in_volume; - switch( samp ){ + switch (sampling_type) { case kActiveTargetVolume: if ((*it)->GetLogicalVolume()->GetName() == fActiveTargetVolume ){ // This is the active volume, and we only sample here diff --git a/src/remollGenBeam.cc b/src/remollGenBeam.cc index 50a2735f6..03e9ef21c 100644 --- a/src/remollGenBeam.cc +++ b/src/remollGenBeam.cc @@ -33,7 +33,7 @@ remollGenBeam::remollGenBeam() fRasterRefZ(-4.5*m), fParticleName("e-") { - fSampType = kNoTargetVolume; + fSamplingType = kNoTargetVolume; fApplyMultScatt = true; fThisGenMessenger->DeclarePropertyWithUnit("origin","mm",fOriginMean,"origin position mean: x y z unit"); diff --git a/src/remollGenExternal.cc b/src/remollGenExternal.cc index bd5833b39..11095090e 100644 --- a/src/remollGenExternal.cc +++ b/src/remollGenExternal.cc @@ -26,7 +26,8 @@ remollGenExternal::remollGenExternal() fEvent(0), fHit(0), fzOffset(0), fDetectorID(28), fLoopID(1) { - fSampType = kNoTargetVolume; + fSamplingType = kNoTargetVolume; + // Add to generic messenger fThisGenMessenger->DeclareMethod("file",&remollGenExternal::SetGenExternalFile,"External generator event filename"); fThisGenMessenger->DeclareMethod("zOffset",&remollGenExternal::SetGenExternalZOffset,"External generator zOffset"); diff --git a/src/remollVEventGen.cc b/src/remollVEventGen.cc index 753862e1d..61f5f0ca1 100644 --- a/src/remollVEventGen.cc +++ b/src/remollVEventGen.cc @@ -49,7 +49,7 @@ remollVEventGen::remollVEventGen(const G4String name) // Create specific event generator messenger fThisGenMessenger = new G4GenericMessenger(this,"/remoll/evgen/" + name + "/","Remoll " + name + " generator properties"); - fSampType = kActiveTargetVolume; + fSamplingType = kActiveTargetVolume; fApplyMultScatt = false; } @@ -85,7 +85,7 @@ void remollVEventGen::SetNumberOfParticles(G4int n) remollEvent* remollVEventGen::GenerateEvent() { // Set up beam/target vertex - remollVertex vert = fBeamTarg->SampleVertex(fSampType); + remollVertex vert = fBeamTarg->SampleVertex(fSamplingType); ///////////////////////////////////////////////////////////////////// // Create and initialize values for event From e482be21286c50ffa0c3b65f8cd35f1ed51fc9a3 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 25 Nov 2020 21:20:15 -0600 Subject: [PATCH 226/443] [beam] set beam generator cross section to 1 --- src/remollGenBeam.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/remollGenBeam.cc b/src/remollGenBeam.cc index 03e9ef21c..b9580779a 100644 --- a/src/remollGenBeam.cc +++ b/src/remollGenBeam.cc @@ -177,7 +177,7 @@ void remollGenBeam::SamplePhysics(remollVertex * /*vert*/, remollEvent *evt) fParticleName, evt->fBeamPolarization); - evt->SetEffCrossSection(0.0); + evt->SetEffCrossSection(1.0); evt->SetAsymmetry(0.0); evt->SetQ2(0.0); From 662cec03a80b1c2442a153a13200dd5968ab6303 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 25 Nov 2020 22:42:50 -0600 Subject: [PATCH 227/443] [evgen] GetEffLumin returns beam frequency if kNoTargetVolume --- include/remollBeamTarget.hh | 2 +- src/remollBeamTarget.cc | 8 ++++++-- src/remollPrimaryGeneratorAction.cc | 5 +++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/remollBeamTarget.hh b/include/remollBeamTarget.hh index f61a1e5d3..303ceee03 100644 --- a/include/remollBeamTarget.hh +++ b/include/remollBeamTarget.hh @@ -62,7 +62,7 @@ class remollBeamTarget { remollBeamTarget(); virtual ~remollBeamTarget(); - G4double GetEffLumin(); + G4double GetEffLumin(SamplingType_t); remollVertex SampleVertex(SamplingType_t); diff --git a/src/remollBeamTarget.cc b/src/remollBeamTarget.cc index e7b0b6f05..1d0f45288 100644 --- a/src/remollBeamTarget.cc +++ b/src/remollBeamTarget.cc @@ -82,8 +82,12 @@ remollBeamTarget::~remollBeamTarget() delete fMS; } -G4double remollBeamTarget::GetEffLumin(){ - return fEffectiveMaterialLength*fBeamCurrent/(e_SI*coulomb); +G4double remollBeamTarget::GetEffLumin(SamplingType_t sampling_type) +{ + if (sampling_type == kNoTargetVolume) + return fBeamCurrent / (e_SI*coulomb); // no length, just frequency + else + return fBeamCurrent / (e_SI*coulomb) * fEffectiveMaterialLength; } void remollBeamTarget::PrintTargetInfo() diff --git a/src/remollPrimaryGeneratorAction.cc b/src/remollPrimaryGeneratorAction.cc index 439dca14c..50f3873f3 100644 --- a/src/remollPrimaryGeneratorAction.cc +++ b/src/remollPrimaryGeneratorAction.cc @@ -204,11 +204,12 @@ void remollPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) G4double nthrown = remollRun::GetRunData()->GetNthrown(); // Calculate rate + SamplingType_t sampling_type = fEventGen->GetSamplingType(); if (fEvent->fRate == 0) { // If the rate is set to 0 then calculate it using the cross section - fEvent->fRate = fEvent->fEffXs * fBeamTarg->GetEffLumin() / nthrown; + fEvent->fRate = fEvent->fEffXs * fBeamTarg->GetEffLumin(sampling_type) / nthrown; } else { // For LUND - calculate rate and cross section - fEvent->fEffXs = fEvent->fRate * nthrown / fBeamTarg->GetEffLumin(); + fEvent->fEffXs = fEvent->fRate * nthrown / fBeamTarg->GetEffLumin(sampling_type); fEvent->fRate = fEvent->fRate / nthrown; } From 5cba69ae3fb2885474e8f7dfe41e826a5db6feef Mon Sep 17 00:00:00 2001 From: Chandan Ghosh Date: Fri, 4 Dec 2020 00:09:44 -0500 Subject: [PATCH 228/443] Added BariteConcrete and Marble for shielding purposes --- geometry/materials.xml | 80 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/geometry/materials.xml b/geometry/materials.xml index 9ffc9d6e8..0215c0fbe 100644 --- a/geometry/materials.xml +++ b/geometry/materials.xml @@ -473,4 +473,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From f6827a23e3d7343430ef4a942bc027d0de9a57f9 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 6 Dec 2020 11:49:48 -0600 Subject: [PATCH 229/443] [searchpath] do not use fs::path when NO_FS_SUPPORT --- include/remollSearchPath.hh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/remollSearchPath.hh b/include/remollSearchPath.hh index 6fe41b0ff..ede301080 100644 --- a/include/remollSearchPath.hh +++ b/include/remollSearchPath.hh @@ -40,7 +40,9 @@ class remollSearchPath { private: static remollSearchPath* fInstance; + #ifndef NO_FS_SUPPORT std::vector fSearchPath; + #endif remollSearchPath(); public: From 32434ac8c4f2625d2b1c49747c9a6c1e9a94b13e Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 6 Dec 2020 11:50:12 -0600 Subject: [PATCH 230/443] [searchpath] #include --- include/remollSearchPath.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/remollSearchPath.hh b/include/remollSearchPath.hh index ede301080..28d4a383d 100644 --- a/include/remollSearchPath.hh +++ b/include/remollSearchPath.hh @@ -33,7 +33,7 @@ namespace fs = boost::filesystem; #define NO_FS_SUPPORT #endif -#include "cstring" +#include class remollSearchPath From cdb41bb1e5ccea7860ed71a7c4674719b2cdf831 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 6 Dec 2020 11:51:46 -0600 Subject: [PATCH 231/443] [searchpath] #include system libraries in < > --- include/remollSearchPath.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/remollSearchPath.hh b/include/remollSearchPath.hh index 28d4a383d..43e12d502 100644 --- a/include/remollSearchPath.hh +++ b/include/remollSearchPath.hh @@ -24,7 +24,7 @@ Usage: #include namespace fs = std::filesystem; #elif defined(__cpp_lib_experimental_filesystem) -#include "experimental/filesystem" +#include namespace fs = std::experimental::filesystem; #elif defined(__USE_BOOST_FILESYSTEM) #include From bb274f71e24f54a29dacc9188f1d60a0109dd72a Mon Sep 17 00:00:00 2001 From: Sakib Rahman Date: Sun, 6 Dec 2020 21:28:31 -0500 Subject: [PATCH 232/443] Redefining the upstream 2bounce shield. --- geometry/upstream/upstreamBeampipe.gdml | 18 ++++++++++-------- geometry/upstream/upstreamDaughter_merged.gdml | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/geometry/upstream/upstreamBeampipe.gdml b/geometry/upstream/upstreamBeampipe.gdml index 0ff382e65..468af4c20 100644 --- a/geometry/upstream/upstreamBeampipe.gdml +++ b/geometry/upstream/upstreamBeampipe.gdml @@ -15,18 +15,20 @@ - + - - - + + + - + - - - + + + diff --git a/geometry/upstream/upstreamDaughter_merged.gdml b/geometry/upstream/upstreamDaughter_merged.gdml index 23cb814a6..636c5f6ce 100644 --- a/geometry/upstream/upstreamDaughter_merged.gdml +++ b/geometry/upstream/upstreamDaughter_merged.gdml @@ -75,7 +75,7 @@ - + From 4c66ee769cd79c3f918d9472c27dead0c67762a4 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 6 Dec 2020 20:50:33 -0600 Subject: [PATCH 233/443] [workflows] source /etc/profile in docker --- .github/workflows/docker-image.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index e8b429aff..c370750b4 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -46,6 +46,7 @@ jobs: - uses: actions/checkout@v2 - name: Running geometry test suite ${{ matrix.suite }} run: | + source /etc/profile scripts/tests/test_geometries.sh ${{ matrix.suite }} test_macros: @@ -64,4 +65,6 @@ jobs: - uses: actions/checkout@v2 - name: Running macros test suite ${{ matrix.suite }} run: | + source /etc/profile scripts/tests/test_macros.sh ${{ matrix.suite }} + From d7f417368994d60a3a897b470b12ef4841186405 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 7 Dec 2020 15:56:43 -0600 Subject: [PATCH 234/443] [workflows] use docker meta --- .github/workflows/docker-image.yml | 68 ++++++++++++------------------ 1 file changed, 26 insertions(+), 42 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index c370750b4..564ac8c90 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -2,7 +2,11 @@ name: Build Docker Images on: push: - branches: [ develop ] + branches: + - '**' + tags: + - 'v*' + pull_request: jobs: push_to_registry: @@ -10,11 +14,27 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + - name: Docker meta + id: docker_meta + uses: crazy-max/ghaction-docker-meta@v1 + with: + images: jeffersonlab/remoll + tag-semver: | + {{version}} + {{major}}.{{minor}} - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- - name: Login to DockerHub + if: github.event_name != 'pull_request' uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} @@ -25,46 +45,10 @@ jobs: with: context: . file: Dockerfile - tags: jeffersonlab/remoll:develop - push: true + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.labels }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} - - test_geometry: - name: Running geometry test suite ${{ matrix.suite }} - needs: push_to_registry - strategy: - matrix: - suite: [validate,overlap] - runs-on: ubuntu-latest - container: - image: docker://jeffersonlab/remoll:develop - volumes: - - rootfiles:/jlab/remoll/rootfiles - - logfiles:/jlab/remoll/logfiles - steps: - - uses: actions/checkout@v2 - - name: Running geometry test suite ${{ matrix.suite }} - run: | - source /etc/profile - scripts/tests/test_geometries.sh ${{ matrix.suite }} - - test_macros: - name: Running macros test suite ${{ matrix.suite }} - needs: push_to_registry - strategy: - matrix: - suite: [unit,commit] - runs-on: ubuntu-latest - container: - image: docker://jeffersonlab/remoll:develop - volumes: - - rootfiles:/jlab/remoll/rootfiles - - logfiles:/jlab/remoll/logfiles - steps: - - uses: actions/checkout@v2 - - name: Running macros test suite ${{ matrix.suite }} - run: | - source /etc/profile - scripts/tests/test_macros.sh ${{ matrix.suite }} - From 312b9b57b6dbfb2abdd98182278e015cc3396204 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 7 Dec 2020 16:10:30 -0600 Subject: [PATCH 235/443] [workflows] ubuntu-20.04 --- .github/workflows/docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 564ac8c90..d4d2e3fb3 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -10,7 +10,7 @@ on: jobs: push_to_registry: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Checkout uses: actions/checkout@v2 From e91a09a6a893f86aa59cab6be7ed4c522b438177 Mon Sep 17 00:00:00 2001 From: Chandan Ghosh Date: Mon, 7 Dec 2020 20:08:35 -0500 Subject: [PATCH 236/443] bug-fix issue #382 --- geometry/beampipe/downstream/beampipeDSMother.gdml | 13 ++++++------- geometry/hybrid/hybridDaughter_merged.gdml | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/geometry/beampipe/downstream/beampipeDSMother.gdml b/geometry/beampipe/downstream/beampipeDSMother.gdml index bdab418b7..3630fccc3 100644 --- a/geometry/beampipe/downstream/beampipeDSMother.gdml +++ b/geometry/beampipe/downstream/beampipeDSMother.gdml @@ -13,19 +13,18 @@ - - + - - + + - - + + @@ -55,7 +54,7 @@ - + diff --git a/geometry/hybrid/hybridDaughter_merged.gdml b/geometry/hybrid/hybridDaughter_merged.gdml index d778324e9..7e99e4424 100644 --- a/geometry/hybrid/hybridDaughter_merged.gdml +++ b/geometry/hybrid/hybridDaughter_merged.gdml @@ -394,7 +394,7 @@ - + From 331e6b136901382475dd732da6be6729e17a302d Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 8 Dec 2020 15:36:59 -0600 Subject: [PATCH 237/443] [pion] Pb shield layer downstream of lucite --- geometry/pion/Lucite/pionDetectorLucite.gdml | 22 +++++++++++++++++++ .../pion/Lucite/pionDetectorLuciteSector.gdml | 15 +++++++++++-- .../pion/Lucite/pionDetectorLucite_world.gdml | 7 ++++++ 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/geometry/pion/Lucite/pionDetectorLucite.gdml b/geometry/pion/Lucite/pionDetectorLucite.gdml index 8d28d4114..40c3d6e7f 100644 --- a/geometry/pion/Lucite/pionDetectorLucite.gdml +++ b/geometry/pion/Lucite/pionDetectorLucite.gdml @@ -29,6 +29,8 @@ + + @@ -74,6 +76,8 @@ + + + + + + + + + + diff --git a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml index 3038daa21..c1ee20462 100644 --- a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml +++ b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml @@ -20,7 +20,7 @@ you modify the angle below so as to avoid overlaps between this volume and the trigger scintillator and volumes. --> - + + + + + diff --git a/geometry/pion/Lucite/pionDetectorLucite_world.gdml b/geometry/pion/Lucite/pionDetectorLucite_world.gdml index 7611cb814..4304933c3 100644 --- a/geometry/pion/Lucite/pionDetectorLucite_world.gdml +++ b/geometry/pion/Lucite/pionDetectorLucite_world.gdml @@ -4,6 +4,7 @@ + @@ -24,6 +25,12 @@ + + + + + + From af9ec865ef5f668422be67cd8a45d198a48c3339 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 8 Dec 2020 21:00:48 -0600 Subject: [PATCH 238/443] [pion] shield variables --- geometry/pion/Lucite/pionDetectorLucite.gdml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/geometry/pion/Lucite/pionDetectorLucite.gdml b/geometry/pion/Lucite/pionDetectorLucite.gdml index 40c3d6e7f..7c58964f0 100644 --- a/geometry/pion/Lucite/pionDetectorLucite.gdml +++ b/geometry/pion/Lucite/pionDetectorLucite.gdml @@ -29,8 +29,6 @@ - - @@ -42,6 +40,11 @@ + + + + + + z="pionDetectorLuciteShieldDSHeight"/> Date: Tue, 8 Dec 2020 21:01:20 -0600 Subject: [PATCH 239/443] [pion] move TS/GEM downstream a bit --- geometry/pion/Lucite/pionDetectorLuciteSector.gdml | 4 ++-- geometry/pion/pionDetectorSystem.gdml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml index c1ee20462..b28d489a0 100644 --- a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml +++ b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml @@ -78,7 +78,7 @@ + z="-0.25*2.54*cm"/> @@ -88,7 +88,7 @@ + z="+0.65*2.54*cm"/> diff --git a/geometry/pion/pionDetectorSystem.gdml b/geometry/pion/pionDetectorSystem.gdml index cd3aca52f..27b172620 100644 --- a/geometry/pion/pionDetectorSystem.gdml +++ b/geometry/pion/pionDetectorSystem.gdml @@ -9,9 +9,9 @@ - - - + + + From d9b78cf23c63ecdd38bbecb074df3147cd8ba2e5 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 9 Dec 2020 20:43:27 -0600 Subject: [PATCH 240/443] [cmake] do not force cxx standard (even though we use 17 constructs) --- CMakeLists.txt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ce1491d01..94e48cbea 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,11 +20,6 @@ include(CMakeEnv) # Use GNU install dirs include(GNUInstallDirs) -# Request C++11 standard -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED True) -set(CMAKE_CXX_EXTENSIONS False) - # MAC specific variable if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(CMAKE_MACOSX_RPATH ON) From 33d4c5b0ba1e4df8896f34a374407cbd81200818 Mon Sep 17 00:00:00 2001 From: Yug34 Date: Thu, 10 Dec 2020 18:23:05 +0530 Subject: [PATCH 241/443] gui.mac now loads through any directory --- remoll.cc | 13 +++++++++++-- src/remollSearchPath.cc | 3 +++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/remoll.cc b/remoll.cc index c23207bd0..4fe028583 100644 --- a/remoll.cc +++ b/remoll.cc @@ -162,10 +162,19 @@ int main(int argc, char** argv) { // Define UI session for interactive mode G4UIExecutive* ui = new G4UIExecutive(argc,argv,session); if (ui->IsGUI()) { - UImanager->SetMacroSearchPath(CMAKE_INSTALL_PREFIX); + UImanager->SetMacroSearchPath(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/macros"); + G4cout << std::string(CMAKE_INSTALL_FULL_DATADIR) << G4endl; // = /usr/local/share + G4cout << std::string(remollSearchPath::resolve("/remoll/macros/gui.mac")) << G4endl; UImanager->ParseMacroSearchPath(); - UImanager->ApplyCommand("/control/execute macros/gui.mac"); + //UImanager->ExecuteMacroFile((remollSearchPath::resolve("macros/gui.mac")).c_str()); + UImanager->ExecuteMacroFile((remollSearchPath::resolve(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/macros/gui.mac")).c_str()); + //UImanager->ApplyCommand("/control/execute macros/gui.mac"); } +// if (ui->IsGUI()) { +// UImanager->SetMacroSearchPath(CMAKE_INSTALL_PREFIX); +// UImanager->ParseMacroSearchPath(); +// UImanager->ApplyCommand("/control/execute macros/gui.mac"); +// } ui->SessionStart(); delete ui; } diff --git a/src/remollSearchPath.cc b/src/remollSearchPath.cc index 0a789f7be..25dc61e24 100644 --- a/src/remollSearchPath.cc +++ b/src/remollSearchPath.cc @@ -27,6 +27,9 @@ void remollSearchPath::add(const std::string& path) // If directory to search in is inside CMAKE_INSTALL_PREFIX if(fs::exists(fs::path(std::string(CMAKE_INSTALL_PREFIX) + "/" + path))) { fSearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_PREFIX) + "/" + path)); + } + else if(fs::exists(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/" + path))) { + fSearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/" + path)); } // If directory to search in is inside CMAKE_INSTALL_FULL_DATADIR else if(fs::exists(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/" + path))) { From 4f8660e868f4e24dbaf9d60c3b68ef5ef5d76c4a Mon Sep 17 00:00:00 2001 From: Yug34 Date: Thu, 10 Dec 2020 18:56:23 +0530 Subject: [PATCH 242/443] remoll macros/runexample.mac works everywhere --- src/remollSearchPath.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/remollSearchPath.cc b/src/remollSearchPath.cc index 25dc61e24..69ba900f8 100644 --- a/src/remollSearchPath.cc +++ b/src/remollSearchPath.cc @@ -57,6 +57,9 @@ std::string remollSearchPath::operator() (const std::string& filename) if(fs::exists(path / filename)) { return (path / filename).string(); } + else if(fs::exists(path / "remoll" / filename)) { + return (path / "remoll" / filename).string(); + } } #endif From 0018b13da4eb691df98a04dad15c60e541222527 Mon Sep 17 00:00:00 2001 From: Yug34 Date: Thu, 10 Dec 2020 23:12:44 +0530 Subject: [PATCH 243/443] RemollSearchPath fix --- remoll.cc | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/remoll.cc b/remoll.cc index 4fe028583..7070a22b3 100644 --- a/remoll.cc +++ b/remoll.cc @@ -154,7 +154,7 @@ int main(int argc, char** argv) { { // Run in batch mode // Copy contents of macro into buffer to be written out into ROOT file - UImanager->SetMacroSearchPath(CMAKE_INSTALL_PREFIX); + UImanager->SetMacroSearchPath(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/macros"); UImanager->ParseMacroSearchPath(); remollRun::GetRunData()->SetMacroFile((remollSearchPath::resolve(macro)).c_str()); UImanager->ExecuteMacroFile((remollSearchPath::resolve(macro)).c_str()); @@ -163,18 +163,12 @@ int main(int argc, char** argv) { G4UIExecutive* ui = new G4UIExecutive(argc,argv,session); if (ui->IsGUI()) { UImanager->SetMacroSearchPath(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/macros"); - G4cout << std::string(CMAKE_INSTALL_FULL_DATADIR) << G4endl; // = /usr/local/share - G4cout << std::string(remollSearchPath::resolve("/remoll/macros/gui.mac")) << G4endl; + G4cout << std::string(CMAKE_INSTALL_FULL_DATADIR) << G4endl; + G4cout << std::string(remollSearchPath::resolve("macros/gui.mac")) << G4endl; UImanager->ParseMacroSearchPath(); - //UImanager->ExecuteMacroFile((remollSearchPath::resolve("macros/gui.mac")).c_str()); - UImanager->ExecuteMacroFile((remollSearchPath::resolve(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/macros/gui.mac")).c_str()); + UImanager->ExecuteMacroFile((remollSearchPath::resolve("macros/gui.mac")).c_str()); //UImanager->ApplyCommand("/control/execute macros/gui.mac"); } -// if (ui->IsGUI()) { -// UImanager->SetMacroSearchPath(CMAKE_INSTALL_PREFIX); -// UImanager->ParseMacroSearchPath(); -// UImanager->ApplyCommand("/control/execute macros/gui.mac"); -// } ui->SessionStart(); delete ui; } From 8bb8da8caa1ab80065f716a3d16d9e0ae6ed4072 Mon Sep 17 00:00:00 2001 From: Yug34 Date: Thu, 10 Dec 2020 23:15:00 +0530 Subject: [PATCH 244/443] remollSearchPath clean up --- remoll.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/remoll.cc b/remoll.cc index 7070a22b3..b27183751 100644 --- a/remoll.cc +++ b/remoll.cc @@ -163,11 +163,8 @@ int main(int argc, char** argv) { G4UIExecutive* ui = new G4UIExecutive(argc,argv,session); if (ui->IsGUI()) { UImanager->SetMacroSearchPath(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/macros"); - G4cout << std::string(CMAKE_INSTALL_FULL_DATADIR) << G4endl; - G4cout << std::string(remollSearchPath::resolve("macros/gui.mac")) << G4endl; UImanager->ParseMacroSearchPath(); UImanager->ExecuteMacroFile((remollSearchPath::resolve("macros/gui.mac")).c_str()); - //UImanager->ApplyCommand("/control/execute macros/gui.mac"); } ui->SessionStart(); delete ui; From 4c97c1e59ae52e7c04084dc45b82a38635cc3c60 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 10 Dec 2020 11:58:54 -0600 Subject: [PATCH 245/443] [workflows] push PR images to docker hub --- .github/workflows/docker-image.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index d4d2e3fb3..11cb5b273 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -34,7 +34,6 @@ jobs: restore-keys: | ${{ runner.os }}-buildx- - name: Login to DockerHub - if: github.event_name != 'pull_request' uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} @@ -45,7 +44,6 @@ jobs: with: context: . file: Dockerfile - push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.docker_meta.outputs.tags }} labels: ${{ steps.docker_meta.outputs.labels }} cache-from: type=local,src=/tmp/.buildx-cache From c2319c489b93eea0e91558da0e29659b1989bdad Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 15 Dec 2020 14:36:51 -0600 Subject: [PATCH 246/443] [pion] avoid replicavol and use loop --- geometry/pion/GEM/pionDetectorGEMOpenSector.gdml | 11 +++++++++-- geometry/pion/Lucite/pionDetectorLuciteSector.gdml | 11 +++++++++-- geometry/pion/TS/pionDetectorTSOpenSector.gdml | 11 +++++++++-- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/geometry/pion/GEM/pionDetectorGEMOpenSector.gdml b/geometry/pion/GEM/pionDetectorGEMOpenSector.gdml index 7606cee2d..5363c904d 100644 --- a/geometry/pion/GEM/pionDetectorGEMOpenSector.gdml +++ b/geometry/pion/GEM/pionDetectorGEMOpenSector.gdml @@ -3,6 +3,7 @@ + @@ -45,14 +46,20 @@ - + + + + + + + diff --git a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml index 809a82048..44f4fa507 100644 --- a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml +++ b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml @@ -3,6 +3,7 @@ + @@ -89,14 +90,20 @@ - + + + + + + + diff --git a/geometry/pion/TS/pionDetectorTSOpenSector.gdml b/geometry/pion/TS/pionDetectorTSOpenSector.gdml index 678882830..58accfb16 100644 --- a/geometry/pion/TS/pionDetectorTSOpenSector.gdml +++ b/geometry/pion/TS/pionDetectorTSOpenSector.gdml @@ -3,6 +3,7 @@ + @@ -45,14 +46,20 @@ - + + + + + + + From 3f74f35b2f3164a9ddad792ee118d82bb8c2270d Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 15 Dec 2020 15:39:20 -0600 Subject: [PATCH 247/443] [pion] Inner radial shield for lucite --- geometry/pion/Lucite/pionDetectorLucite.gdml | 32 +++++++++++++++++-- .../pion/Lucite/pionDetectorLuciteSector.gdml | 8 +++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/geometry/pion/Lucite/pionDetectorLucite.gdml b/geometry/pion/Lucite/pionDetectorLucite.gdml index 7c58964f0..56a5a6160 100644 --- a/geometry/pion/Lucite/pionDetectorLucite.gdml +++ b/geometry/pion/Lucite/pionDetectorLucite.gdml @@ -41,10 +41,15 @@ - - + + + + + + + + + + + + + + + + + + diff --git a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml index b28d489a0..98399ccce 100644 --- a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml +++ b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml @@ -94,6 +94,14 @@ y="-(pionDetectorLuciteSectorAngleBase+pionDetectorLuciteSectorAnglePitch)"/> + + + + + From 92a88148db6c7de2766a3c1c9eb2be6e66d45e5f Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 17 Dec 2020 13:17:18 -0600 Subject: [PATCH 248/443] [DetectorConstruction] only print det no overlap when verbose --- src/remollDetectorConstruction.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/remollDetectorConstruction.cc b/src/remollDetectorConstruction.cc index 6c38e1e27..f5a4c1a15 100644 --- a/src/remollDetectorConstruction.cc +++ b/src/remollDetectorConstruction.cc @@ -849,8 +849,10 @@ void remollDetectorConstruction::ParseAuxiliarySensDetInfo() // Check for duplication when not a shared detector number if (!detnoshared && detnomap.count(det_no) != 0 && detnomap[det_no]->GetName() != myvol->GetName()) { - G4cerr << "remoll: DetNo " << det_no << " for " << myvol->GetName() << G4endl; - G4cerr << "remoll: already used by " << detnomap[det_no]->GetName() << G4endl; + if (fVerboseLevel > 0) { + G4cerr << "remoll: DetNo " << det_no << " for " << myvol->GetName() << G4endl; + G4cerr << "remoll: already used by " << detnomap[det_no]->GetName() << G4endl; + } } // Try to find sensitive detector From d6ca12e9a57c12c6dc1a777e531f4c2a74d6524f Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 17 Dec 2020 13:56:57 -0600 Subject: [PATCH 249/443] [CMakeLists] retire the hybrid maps when downloading --- CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 678ec68ac..fb8407329 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -324,16 +324,16 @@ if(Boost_IOSTREAMS_FOUND) endif() # for i in *.txt ; do echo `md5sum $i|awk '{print$1}'`:`md5sum $i.gz|awk '{print$1}'`:$i ; done set(REMOLL_MAPS -ca69d4a4397ae3a944f603b91dfbe586:36e2aa90d39e4ad9be4f747a522baa69:V1DHy.3.txt -eb802b9d8569669b5aa674fc56c52a24:df7f4dd87c894c5eef878b248ef14c3e:V1DSg.3.txt b1b8f2845dc5cd420c6ff49ae7760a60:6002f6f5f092346cb2bdedac046d1905:V1U.2a.txt -259459226a5cacc1d62ba295534645e2:95c6193ea30c03316068e3d67d3ec32b:V2DHy.1.txt -c71758450b063ab83e95a7ba8c590885:a5ba5c81c0c6590d43fac1cbd3f2d7a0:V2DSg.1a.txt -c2ac33287df1bf20bfedcb4d4a96c8d5:3a31416eb7659248f7a2ba582d43a6fe:V2DSg.1b.txt 70e2bbed1831816957e953bba48f01d5:2fd1cd2785db92f9c880b675890460b5:V2U.1a.txt e55ffd8aba96cbf24962155d3c7f75e4:0172016c988867b0928258d79cd1c865:V2U.1b.txt +eb802b9d8569669b5aa674fc56c52a24:df7f4dd87c894c5eef878b248ef14c3e:V1DSg.3.txt +c71758450b063ab83e95a7ba8c590885:a5ba5c81c0c6590d43fac1cbd3f2d7a0:V2DSg.1a.txt +c2ac33287df1bf20bfedcb4d4a96c8d5:3a31416eb7659248f7a2ba582d43a6fe:V2DSg.1b.txt ) set(REMOLL_MAPS_EXTRA +ca69d4a4397ae3a944f603b91dfbe586:36e2aa90d39e4ad9be4f747a522baa69:V1DHy.3.txt +259459226a5cacc1d62ba295534645e2:95c6193ea30c03316068e3d67d3ec32b:V2DHy.1.txt b4bfef8f362e0df66f166b4e76a6847e:57a7719eb877572751f4c4b481d6a788:blockyHybrid_rm_3.0.txt 7df29e47413c8dd69fd179298f11b717:9120bc05099a144916467b6ea17e39f8:blockyUpstream_rm_1.1_noscale.txt 3e2338e1ba74b03da37545e98931f5f3:75dfcd912e74f42543892fed8271fa7c:blockyUpstream_rm_1.1.txt From af3d9c58d7aeeffcac4d236c78101bbe026eca71 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 17 Dec 2020 13:57:45 -0600 Subject: [PATCH 250/443] [fields] load new field map as default --- macros/load_magnetic_fieldmaps.mac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/load_magnetic_fieldmaps.mac b/macros/load_magnetic_fieldmaps.mac index f39b6cb4e..f7d7c0e3e 100644 --- a/macros/load_magnetic_fieldmaps.mac +++ b/macros/load_magnetic_fieldmaps.mac @@ -4,5 +4,5 @@ # consider loading this macro with # /control/execute macros/load_magnetic_field.mac -/remoll/addfield map_directory/segmentedJLAB_v2.txt -/remoll/addfield map_directory/upstreamJLAB_v2.txt +/remoll/addfield map_directory/V1DSg.3.txt +/remoll/addfield map_directory/V1U.2a.txt From c64994848322f9712111c315efaba8828b792f4e Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 17 Dec 2020 14:40:47 -0600 Subject: [PATCH 251/443] [MagneticField] change default z offset to 0 --- src/remollMagneticField.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/remollMagneticField.cc b/src/remollMagneticField.cc index 71e578994..a5d16ebaa 100644 --- a/src/remollMagneticField.cc +++ b/src/remollMagneticField.cc @@ -43,7 +43,7 @@ remollMagneticField::remollMagneticField( G4String filename ){ // Default offset for field maps in reference frame with // the hall pivot at z = 0. - fZoffset = -5000.0; + fZoffset = 0.0; fInit = false; fMagCurrent0 = -1e9; From 9dd657886f2c084677393e3f00b665fc8760e73c Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 17 Dec 2020 19:46:56 -0600 Subject: [PATCH 252/443] [donut] support fins for downstream beampile (overlaps) --- geometry/donut/donutConcreteLead.gdml | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 15450eba6..fc7c6da63 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -3,6 +3,8 @@ + + @@ -65,6 +67,12 @@ + + + + + + @@ -452,6 +460,20 @@ rmax="donutLeadOuterRadiusDS+donutSleeveThickness+donutBotSupportThickness" z="donutConcreteThickness+donutLeadThickness"/> + + + + + + + + + + + +
+
+ @@ -605,6 +627,11 @@ + + + + + @@ -794,6 +821,13 @@ + + + + + + + From 10f9eae67e54628a6caa88149d11a16a6757b0e3 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 17 Dec 2020 19:47:36 -0600 Subject: [PATCH 253/443] [donut] add flare to central donut mother volume to allow for fins --- geometry/donut/donutConcreteLead.gdml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index fc7c6da63..c12f6322e 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -10,6 +10,9 @@ + + + @@ -178,10 +181,21 @@ - + + + + + + + + + + + From 3d11e793735d2dd4b1e65a34ea63d4155b762b29 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 17 Dec 2020 19:48:04 -0600 Subject: [PATCH 254/443] [pion] avoid overlap with hall floor --- geometry/donut/donutConcreteLead.gdml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index c12f6322e..8095316a5 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -8,8 +8,8 @@ - + From 1b47dbcc54e837b9631e4c7fd8cd2047eb449512 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 17 Dec 2020 19:48:29 -0600 Subject: [PATCH 255/443] [donut] inner radius can be closer to DS beam pipe --- geometry/donut/donutConcreteLead.gdml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 8095316a5..6a324a896 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -8,8 +8,8 @@ - + From 965d212776a816ec67dc47939b5fa72447747cbe Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 17 Dec 2020 19:48:52 -0600 Subject: [PATCH 256/443] [donut] units in inches for clarity --- geometry/donut/donutConcreteLead.gdml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 6a324a896..ce4eef5fd 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -32,7 +32,7 @@ - + @@ -60,13 +60,13 @@ - + - + From c7a0d4722be992ef3b84f86dfb879fa540566c9f Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 17 Dec 2020 19:49:15 -0600 Subject: [PATCH 257/443] [donut] beams are to be 16.375" high (FIXME) --- geometry/donut/donutConcreteLead.gdml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index ce4eef5fd..79086e766 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -45,8 +45,8 @@ - + From 4dc10f2ad5fe71cbcbe62fc2d40e497bff405c35 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 17 Dec 2020 21:48:13 -0600 Subject: [PATCH 258/443] [donut] +x is closed sector, and put 7 beam pipe support fins --- geometry/donut/donutConcreteLead.gdml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 79086e766..7a7c9c30c 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -835,10 +835,10 @@ - + - + From de2984edd825eedf1d468d34a17d68b2335932a6 Mon Sep 17 00:00:00 2001 From: Cameron Clarke Date: Wed, 30 Dec 2020 16:59:00 -0500 Subject: [PATCH 259/443] Cleaning up some late changes, preparing for a fresh clone and cleanup --- macros/detector_vis.mac | 62 ++++++++++++++++++++++++++++ macros/full-scan.sh | 2 +- macros/getMax.C | 80 ++++++++++++++++++++++++++++++++++++ macros/produce.sh | 62 ++++++++++++++++++++++++++++ vis/detector_vis.mac | 89 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 294 insertions(+), 1 deletion(-) create mode 100644 macros/detector_vis.mac create mode 100644 macros/getMax.C create mode 100755 macros/produce.sh create mode 100644 vis/detector_vis.mac diff --git a/macros/detector_vis.mac b/macros/detector_vis.mac new file mode 100644 index 000000000..9019f1b8a --- /dev/null +++ b/macros/detector_vis.mac @@ -0,0 +1,62 @@ +# Use this open statement to create an OpenGL view: +/vis/open OGL 600x600-0+0 + +#/remoll/physlist/parallel/disable +#/remoll/physlist/optical/enable +/remoll/physlist/parallel/enable +/remoll/physlist/optical/disable + +# This is the current working geometry +/remoll/setgeofile geometry/mollerMother_merged.gdml + +#/remoll/likekryptonite true + +#Below the this energy, the tracks are killed +#/remoll/minEnergyCut 0 MeV + +#/remoll/setphysicslist QGSP_BERT_EMV + +/run/initialize + +/remoll/SD/enable_all + +#/remoll/beamene 11.0 GeV +/remoll/beamene 855 MeV +/remoll/beamcurr 50 microampere +#/remoll/optical true +#/remoll/addfield CLEO_rm.dat +/control/execute vis/vis.mac +#/gun/position 0.0 0.0 -0.1 m +#/gun/momentum 0.5 1.0 2.0 GeV + +# Raster is on by default with 5x5mm +/remoll/rasx 5 mm +/remoll/rasy 5 mm + +## Beam generator +/remoll/evgen/set beam +#/remoll/evgen/beam/origin -987.5,0.0,-150.0 mm +/remoll/evgen/beam/origin -987.5 -1.0 21850.0 mm +/remoll/evgen/beam/rasterRefZ 21850 mm +#/remoll/evgen/beam/x -987.5 mm +/remoll/evgen/beam/direction -0.0523 0.0 0.9986 +/remoll/evgen/beam/rasx 105.0 mm +/remoll/evgen/beam/rasy 78.0 mm +/remoll/evgen/beam/partName e- +#/remoll/evgen/beam/x -987.5 mm +#/remoll/evgen/beam/z -150.0 mm +#/remoll/evgen/beam/px -0.0523 +#/remoll/evgen/beam/pz 0.9986 +/remoll/filename remollout_r5o_beam_default.root + + +## External Generator +#/remoll/evgen/set external +#/remoll/evgen/external/file remoll_moller_envelope_noCol4_noCoils_500k_LGtest_det28.root +#/remoll/evgen/external/detid 28 +#/remoll/evgen/external/startEvent 0 +#/remoll/evgen/external/zOffset -28550.0 +#/remoll/filename remollout_r5o_external_default.root + + +#/run/beamOn 100 diff --git a/macros/full-scan.sh b/macros/full-scan.sh index 2a58ec854..836d284f8 100755 --- a/macros/full-scan.sh +++ b/macros/full-scan.sh @@ -75,7 +75,7 @@ do lgAngle=$lg_angle z_p=$(printf "%.2f" "$(bc -l <<< ${z1}-0.5*$qThick-$refL*s\(\(${ref_angle}-${lg_angle}\)*3.14159/180.0\))") echo "$ring $xPosMin $xPosMax z = $z_p starting z = $z1 and second = $z2" -done < cadp_shortened.csv +done < cadp.csv IFS=$OLDIFS diff --git a/macros/getMax.C b/macros/getMax.C new file mode 100644 index 000000000..140ecc6fb --- /dev/null +++ b/macros/getMax.C @@ -0,0 +1,80 @@ +void getMax(TString fName = "scans.root") { + TFile* fFile = TFile::Open(fName); + if (!fFile) { + std::cout<< "ERROR: No file named " << fName << std::endl; + return; + } + TChain* scans = (TChain*) fFile->Get("scans"); + TCanvas * c1 = new TCanvas(); + + Double_t old_integral = 0.095; + Double_t new_integral = 0.095; + + //(5 tiles of x width, 10 tiles of y length, and fill with the Theta chosen above) + TH2F * improvementHistOld = new TH2F ("ImprovementOld","Original Yield", 5, 0, 5, 10, 0 , 10); + TH2F * improvementHist = new TH2F ("Improvement","Improvement", 5, 0, 5, 10, 0 , 10); + TH2F * oldHist_Theta = new TH2F ("OldThetas","Original Thetas", 5, 0, 5, 10, 0 , 10); + TH2F * oldHist_Phi = new TH2F ("OldPhis","Original Phis", 5, 0, 5, 10, 0 , 10); + TH2F * newHist_Theta = new TH2F ("OptimalThetas","Optimal Thetas", 5, 0, 5, 10, 0 , 10); + TH2F * newHist_Phi = new TH2F ("OptimalPhis","Optimal Phis", 5, 0, 5, 10, 0 , 10); + + c1->cd(1); + for (Int_t i = 0 ; i < 5; i++ ) { + for (Int_t j = 0 ; j < 10; j++ ) { + std::cout<< "Step " << i << " " << j << std::endl; + scans->Draw("theta:phi",Form("avg_pes*(width_step==%d && length_step==%d)",i,j),"COLZ"); + + //c1->SaveAs("test.pdf"); + TH2* hTemp = (TH2*) gROOT->FindObject("htemp"); + Int_t max_bin = hTemp->GetMaximumBin(); + Double_t max_value = hTemp->GetBinContent(max_bin); + new_integral += max_value - 0.095; + Int_t xBin, yBin, zBin; + hTemp->GetBinXYZ(max_bin,xBin,yBin,zBin); + std::cout<< "Max bin = " << max_bin << ", and value = " << hTemp->GetBinContent(max_bin) << std::endl; + std::cout<< "Phi max = " << hTemp->GetXaxis()->GetBinCenter(xBin) << std::endl; + std::cout<< "Theta max = " << hTemp->GetYaxis()->GetBinCenter(yBin) << std::endl; + newHist_Theta->Fill(i,j,hTemp->GetYaxis()->GetBinCenter(yBin)); + newHist_Phi->Fill(i,j,hTemp->GetXaxis()->GetBinCenter(xBin)); + + scans->Draw("theta:phi",Form("avg_pes*(phi==0 && theta==0 && width_step==%d && length_step==%d)",i,j),"COLZ"); + + //c1->SaveAs("test.pdf"); + hTemp = (TH2*) gROOT->FindObject("htemp"); + if (!hTemp) {continue;} + Int_t old_max_bin = hTemp->GetMaximumBin(); + Double_t old_max_value = hTemp->GetBinContent(old_max_bin); + old_integral += old_max_value - 0.095; + Int_t old_xBin, old_yBin, old_zBin; + hTemp->GetBinXYZ(old_max_bin,old_xBin,old_yBin,old_zBin); + std::cout<< "Old Max bin = " << old_max_bin << ", and value = " << hTemp->GetBinContent(old_max_bin) << std::endl; + std::cout<< "Old Phi max = " << hTemp->GetXaxis()->GetBinCenter(old_xBin) << std::endl; + std::cout<< "Old Theta max = " << hTemp->GetYaxis()->GetBinCenter(old_yBin) << std::endl; + + std::cout<< "Improvement factor = " << max_value/old_max_value << std::endl; + improvementHistOld->Fill(i,j,old_max_value); + improvementHist->Fill(i,j,max_value/old_max_value); + oldHist_Theta->Fill(i,j,hTemp->GetYaxis()->GetBinCenter(old_yBin)); + oldHist_Phi->Fill(i,j,hTemp->GetXaxis()->GetBinCenter(old_xBin)); + max_value = 0.0; + old_max_value = 0.0; + } + } + std::cout<< "\n"; + std::cout<< "\n"; + std::cout<< "Old integral = " << 2*old_integral << ", and new integral = " << 2*new_integral << std::endl; + std::cout<< "Improvement factor = " << new_integral/old_integral << std::endl; + + TCanvas * c2 = new TCanvas(); + c2->Divide(2,2); + c2->cd(1); + improvementHistOld->Draw("COLZ"); + c2->cd(2); + improvementHist->Draw("COLZ"); + c2->cd(3); + newHist_Theta->Draw("COLZ"); + c2->cd(4); + newHist_Phi->Draw("COLZ"); + c2->SaveAs("test2.pdf"); +} + diff --git a/macros/produce.sh b/macros/produce.sh new file mode 100755 index 000000000..77a4751e2 --- /dev/null +++ b/macros/produce.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# Takes 5 arguments +# +# Fixed value of non-scanned variable - default = 0.0 +# Variable to scan ("angle" or "x") - default = "angle" +# Min of scanned variable - default = -30 +# Max of scanned variable - default = 30 +# Step size - default = 0.5 + +if [ "$#" -lt 1 ] ; then + echo " ERROR, requires at least one input + " + echo " usage: ./produce.sh numberRepeat macroName.mac" + exit +fi + +num=0 +macro="detector_runexample.mac" +if [ "$#" -ge 1 ] ; then + num=$1 +fi +if [ "$#" -ge 2 ] ; then + macro="$2" +fi +if [ "$#" -ge 3 ] ; then + stub="$3" +else + stub="sim" +fi + + +for currentStep in `seq 1 $num`; +do + tmpFolder="produce/out_${stub}_${currentStep}" + if [ ! -d produce ] ; then + mkdir produce + fi + if [ ! -d $tmpFolder ] ; then + mkdir $tmpFolder + fi + cd $tmpFolder + cp -p ../../../build/remoll . + cp -p ../../../bin/remoll.sh . + + cp ../../${macro} . + ln -s ../../../geometry geometry + ln -s ../../../macros macros + ln -s ../../../map_directory map_directory + echo "#!/bin/bash +# +#$ -cwd +#$ -j y +#$ -S /bin/bash +source remoll.sh +./remoll ${macro} + " > runscript_${num}.sh + chmod 755 runscript_${num}.sh + qsub runscript_${num}.sh + cd - +done + diff --git a/vis/detector_vis.mac b/vis/detector_vis.mac new file mode 100644 index 000000000..786697244 --- /dev/null +++ b/vis/detector_vis.mac @@ -0,0 +1,89 @@ +# +# Create a new empty scene +# +/vis/scene/create + +# +# Draw both real and parallel worlds +# +/vis/drawVolume worlds + +# +# Declare that the world volume should be added to the scene +# +/vis/scene/add/volume +# +# +# Attach scene to scenehandler +# +/vis/sceneHandler/attach + +# Add axis (has to be after /vis/scene/create ) +# +/vis/scene/add/axes 0 0 0 100 cm + + +# +# Draw a picture that has just the detector (no trajectories or hits). +# +/vis/viewer/flush + +# +# Declare that trajectories and hits should be added to the scene +# +/vis/scene/add/trajectories +/vis/scene/add/hits + +# +# Set camera +# +/vis/viewer/reset +# Specify view angle: +#updated setting +/vis/viewer/set/viewpointThetaPhi 90. 0. +#old value +#/vis/viewer/set/viewpointThetaPhi 35 15 deg +#/vis/viewer/zoom 2.0 + +# +# Set surface +# +/vis/viewer/set/style surface + +#updated setting from PREX vis.mac +/vis/viewer/set/viewpointThetaPhi 90 180 deg +#/vis/viewer/panTo 100 3000 cm +/vis/viewer/zoom 5.0 +/vis/viewer/set/lightsThetaPhi 40 50 +#New cutaway plane setting +#/vis/viewer/set/cutawayMode intersection +#/vis/viewer/addCutawayPlane 0.0 0.0 0.0 m 1.0 0.0 0.0 +/vis/viewer/addCutawayPlane 0.0 0.0 0.0 m 0.0 -1.0 0.0 +#/vis/viewer/addCutawayPlane 0.25 0.0 0.0 m -1.0 0.0 0.0 +#old value +#/vis/viewer/set/lightsMove with-camera +# + +# +# Create style +# +/vis/modeling/trajectories/create/drawByParticleID MollerStyle +/vis/modeling/trajectories/MollerStyle/set e- red +/vis/modeling/trajectories/MollerStyle/set e+ blue +/vis/modeling/trajectories/MollerStyle/set gamma green +/vis/modeling/trajectories/MollerStyle/set neutron white +/vis/modeling/trajectories/MollerStyle/set opticalphoton yellow +/vis/modeling/trajectories/MollerStyle/set proton magenta +# +/vis/modeling/trajectories/select MollerStyle + +# +# Event action +# +/vis/scene/endOfEventAction accumulate + +# +# Run action +# +/vis/scene/endOfRunAction refresh + From c467ed03cb2d77a52d23043fe7c03130cb237b6f Mon Sep 17 00:00:00 2001 From: Cameron Clarke Date: Thu, 31 Dec 2020 21:29:05 -0500 Subject: [PATCH 260/443] Changing geometry_Mainz folder to more apt geometry_sandbox name. The idea is it is still gdml geometries, but not ones that should ever be used as the main MOLLER experiment geometry. Also catching a few late changes to the old "Mainz" detector geometry --- geometry_Mainz/detector_Mainz.gdml | 202 ---------------- geometry_Mainz/solids_Mainz.xml | 133 ----------- geometry_sandbox/detector_Mainz.gdml | 226 ++++++++++++++++++ .../detector_Mainz_v2.gdml | 0 .../materials.xml | 0 .../materialsOptical.xml | 0 geometry_sandbox/materialsOptical_Mainz.xml | 125 ++++++++++ .../matrices_Mainz.xml | 14 +- .../matrices_Mainz_v2.xml | 2 +- .../mollerMother.gdml | 6 +- geometry_sandbox/mollerMother_Mainz.gdml | 43 ++++ geometry_sandbox/solids_Mainz.xml | 177 ++++++++++++++ .../solids_Mainz_v2.xml | 0 .../targetDaughter.gdml | 0 14 files changed, 587 insertions(+), 341 deletions(-) delete mode 100644 geometry_Mainz/detector_Mainz.gdml delete mode 100644 geometry_Mainz/solids_Mainz.xml create mode 100644 geometry_sandbox/detector_Mainz.gdml rename {geometry_Mainz => geometry_sandbox}/detector_Mainz_v2.gdml (100%) rename {geometry_Mainz => geometry_sandbox}/materials.xml (100%) rename {geometry_Mainz => geometry_sandbox}/materialsOptical.xml (100%) create mode 100644 geometry_sandbox/materialsOptical_Mainz.xml rename {geometry_Mainz => geometry_sandbox}/matrices_Mainz.xml (99%) rename {geometry_Mainz => geometry_sandbox}/matrices_Mainz_v2.xml (99%) rename {geometry_Mainz => geometry_sandbox}/mollerMother.gdml (92%) create mode 100644 geometry_sandbox/mollerMother_Mainz.gdml create mode 100644 geometry_sandbox/solids_Mainz.xml rename {geometry_Mainz => geometry_sandbox}/solids_Mainz_v2.xml (100%) rename {geometry_Mainz => geometry_sandbox}/targetDaughter.gdml (100%) diff --git a/geometry_Mainz/detector_Mainz.gdml b/geometry_Mainz/detector_Mainz.gdml deleted file mode 100644 index 62429a652..000000000 --- a/geometry_Mainz/detector_Mainz.gdml +++ /dev/null @@ -1,202 +0,0 @@ - - - - - - ]> - - - - - - - &matrices_Mainz; - - &materials; - &solids_Mainz; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/geometry_Mainz/solids_Mainz.xml b/geometry_Mainz/solids_Mainz.xml deleted file mode 100644 index f16a1aee0..000000000 --- a/geometry_Mainz/solids_Mainz.xml +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/geometry_sandbox/detector_Mainz.gdml b/geometry_sandbox/detector_Mainz.gdml new file mode 100644 index 000000000..42a1c415b --- /dev/null +++ b/geometry_sandbox/detector_Mainz.gdml @@ -0,0 +1,226 @@ + + + + + +]> + + + + + + +&matrices_Mainz; + +&materials; +&solids_Mainz; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/geometry_Mainz/detector_Mainz_v2.gdml b/geometry_sandbox/detector_Mainz_v2.gdml similarity index 100% rename from geometry_Mainz/detector_Mainz_v2.gdml rename to geometry_sandbox/detector_Mainz_v2.gdml diff --git a/geometry_Mainz/materials.xml b/geometry_sandbox/materials.xml similarity index 100% rename from geometry_Mainz/materials.xml rename to geometry_sandbox/materials.xml diff --git a/geometry_Mainz/materialsOptical.xml b/geometry_sandbox/materialsOptical.xml similarity index 100% rename from geometry_Mainz/materialsOptical.xml rename to geometry_sandbox/materialsOptical.xml diff --git a/geometry_sandbox/materialsOptical_Mainz.xml b/geometry_sandbox/materialsOptical_Mainz.xml new file mode 100644 index 000000000..0d1926048 --- /dev/null +++ b/geometry_sandbox/materialsOptical_Mainz.xml @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/geometry_Mainz/matrices_Mainz.xml b/geometry_sandbox/matrices_Mainz.xml similarity index 99% rename from geometry_Mainz/matrices_Mainz.xml rename to geometry_sandbox/matrices_Mainz.xml index b022fa308..b96bd9eec 100644 --- a/geometry_Mainz/matrices_Mainz.xml +++ b/geometry_sandbox/matrices_Mainz.xml @@ -3887,7 +3887,9 @@ 7.75292132725114*eV 0.626332 7.75340582427197*eV 0.622443 7.75389038185113*eV 0.618527"/> - + - \ No newline at end of file + + + + + + + + + diff --git a/geometry_Mainz/matrices_Mainz_v2.xml b/geometry_sandbox/matrices_Mainz_v2.xml similarity index 99% rename from geometry_Mainz/matrices_Mainz_v2.xml rename to geometry_sandbox/matrices_Mainz_v2.xml index b022fa308..c52e22d6c 100644 --- a/geometry_Mainz/matrices_Mainz_v2.xml +++ b/geometry_sandbox/matrices_Mainz_v2.xml @@ -6079,4 +6079,4 @@ 7.75292132725114*eV 0.39013 7.75340582427197*eV 0.29228 7.75389038185113*eV 0.288638"/> - \ No newline at end of file + diff --git a/geometry_Mainz/mollerMother.gdml b/geometry_sandbox/mollerMother.gdml similarity index 92% rename from geometry_Mainz/mollerMother.gdml rename to geometry_sandbox/mollerMother.gdml index 1be976c75..c02a5d333 100644 --- a/geometry_Mainz/mollerMother.gdml +++ b/geometry_sandbox/mollerMother.gdml @@ -29,14 +29,14 @@ - + - + diff --git a/geometry_sandbox/mollerMother_Mainz.gdml b/geometry_sandbox/mollerMother_Mainz.gdml new file mode 100644 index 000000000..6f13a1226 --- /dev/null +++ b/geometry_sandbox/mollerMother_Mainz.gdml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/geometry_sandbox/solids_Mainz.xml b/geometry_sandbox/solids_Mainz.xml new file mode 100644 index 000000000..305ff003b --- /dev/null +++ b/geometry_sandbox/solids_Mainz.xml @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/geometry_Mainz/solids_Mainz_v2.xml b/geometry_sandbox/solids_Mainz_v2.xml similarity index 100% rename from geometry_Mainz/solids_Mainz_v2.xml rename to geometry_sandbox/solids_Mainz_v2.xml diff --git a/geometry_Mainz/targetDaughter.gdml b/geometry_sandbox/targetDaughter.gdml similarity index 100% rename from geometry_Mainz/targetDaughter.gdml rename to geometry_sandbox/targetDaughter.gdml From 0b534a97aaa84478488fddf202d2caf79fafb6c6 Mon Sep 17 00:00:00 2001 From: Cameron Clarke Date: Sun, 3 Jan 2021 11:47:07 -0500 Subject: [PATCH 261/443] Updating pe_studies scripts in their own unique folder with relative paths mostly sorted out --- analysis/bkgd_pe/bkgd_pe.cc | 60 +++-- analysis/pe_studies/README.md | 25 ++ .../pe_studies/active-SD-mollerParallel.gdml | 225 ++++++++++++++++ .../pe_studies/macros}/detector_vis.mac | 0 .../macros}/preserve_recreate-brad.mac | 2 +- .../pe_studies/macros}/preserve_ref_scans.mac | 2 +- .../pe_studies/macros}/preserve_scans.mac | 2 +- .../macros/runexample_epelastic_parallel.mac | 181 +++++++++++++ .../runexample_epinelastic_parallel.mac | 181 +++++++++++++ .../macros/runexample_moller_parallel.mac | 181 +++++++++++++ .../macros/runexample_test-det28_parallel.mac | 35 +++ .../pe_studies/scripts}/full-scan.sh | 47 +++- .../pe_studies/scripts}/getMax.C | 0 analysis/pe_studies/scripts/produce.sh | 94 +++++++ .../pe_studies/scripts/ref-scan.sh | 106 ++++---- .../pe_studies/scripts}/scan.sh | 41 +-- analysis/pe_studies/scripts/sub-ref-scan.sh | 232 +++++++++++++++++ macros/produce.sh | 62 ----- macros/ref-scan.sh | 245 ------------------ 19 files changed, 1303 insertions(+), 418 deletions(-) create mode 100644 analysis/pe_studies/README.md create mode 100644 analysis/pe_studies/active-SD-mollerParallel.gdml rename {macros => analysis/pe_studies/macros}/detector_vis.mac (100%) rename {macros => analysis/pe_studies/macros}/preserve_recreate-brad.mac (96%) rename {macros => analysis/pe_studies/macros}/preserve_ref_scans.mac (96%) rename {macros => analysis/pe_studies/macros}/preserve_scans.mac (96%) create mode 100644 analysis/pe_studies/macros/runexample_epelastic_parallel.mac create mode 100644 analysis/pe_studies/macros/runexample_epinelastic_parallel.mac create mode 100644 analysis/pe_studies/macros/runexample_moller_parallel.mac create mode 100644 analysis/pe_studies/macros/runexample_test-det28_parallel.mac rename {macros => analysis/pe_studies/scripts}/full-scan.sh (53%) rename {macros => analysis/pe_studies/scripts}/getMax.C (100%) create mode 100755 analysis/pe_studies/scripts/produce.sh rename macros/sub-ref-scan.sh => analysis/pe_studies/scripts/ref-scan.sh (68%) rename {macros => analysis/pe_studies/scripts}/scan.sh (80%) create mode 100755 analysis/pe_studies/scripts/sub-ref-scan.sh delete mode 100755 macros/produce.sh delete mode 100755 macros/ref-scan.sh diff --git a/analysis/bkgd_pe/bkgd_pe.cc b/analysis/bkgd_pe/bkgd_pe.cc index 747006d60..c50fead67 100644 --- a/analysis/bkgd_pe/bkgd_pe.cc +++ b/analysis/bkgd_pe/bkgd_pe.cc @@ -35,9 +35,9 @@ class bkgd { public: - void do_pe(int, char**); + int do_pe(int, char**); void set_plot_style(); - void get_lookuptable(); + int get_lookuptable(); void bkgd_pe_ana(); void bkgd_pePlots(int, char **); private: @@ -64,7 +64,7 @@ class bkgd { TH2D* lookupTableFlat; }; -void bkgd::get_lookuptable() +int bkgd::get_lookuptable() { TFile* old_file; TTree* oldtree; @@ -87,10 +87,14 @@ void bkgd::get_lookuptable() old_file->GetObject("scans", oldtree); if (!oldtree) { std::cout << "ERROR: Dead scans tree" ; - return; + return 0; } int nent = oldtree->GetEntries(); } + else { + Printf("Error, no scans_%s.root file available, please place the look-up-table data there",detName.c_str()); + return 0; + } // Draw a TGraph, GOFF mode, obtain the output vectors and loop over them, filling in a low/up bin edge array with the means of neighboring bin centers, if it's an edge then calculate distance from opposite side and add that off to the side. // Include in cut avg_pes != 0 (i.e. not some glitch) // Make a new TH2 hist with Nentries from tgraph and bin low/highs in angle and x_pos from above exercise @@ -176,14 +180,15 @@ void bkgd::get_lookuptable() c1->SaveAs(Form("lookupTable_%s.pdf(",detName.c_str())); TCanvas * c2 = new TCanvas(); c2->cd(); - lookupTable->SetName(Form("Look Up Table - Log(Avg PEs)")); - lookupTable->SetTitle(Form("Look Up Table - Log(Avg PEs)")); + lookupTable->SetName(Form("Look Up Table - Avg PEs")); + lookupTable->SetTitle(Form("Look Up Table - Avg PEs")); lookupTable->SetXTitle(Form("Angle (degrees)")); lookupTable->SetYTitle(Form("Radial hit position (mm)")); lookupTable->Draw("COLZ"); c2->SaveAs(Form("lookupTable_%s.pdf)",detName.c_str())); delete c1; delete c2; + return 1; } void bkgd::set_plot_style() @@ -215,7 +220,7 @@ void bkgd::bkgd_pe_ana() std::vector < remollEventParticle_t > *fPart = 0; int dotPos = fileString.rfind("."); std::ostringstream os; - os << fileString.substr(0, dotPos) << "_PEs_"<<"det_"<Get("T"); @@ -318,7 +323,7 @@ void bkgd::bkgd_pe_ana() if ( lookup == 0.0 ) { std::cout << "0 PEs" << std::endl; } - std::cout << "PE Hit, rate = " << rate/(current*degeneracy) << ", Asymmetry = " << event.A << ", lookup pe value = " << lookup << ", bin number " << lookupTable->GetBin(lookupAngle,lookupXpos) << ", " << lookupAngle << ", " << lookupXpos << ", angle = " << (180.0/TMath::Pi())*asin(((hit.px*abs(hit.x) + hit.py*abs(hit.y))/hit.r)/hit.p) << ", abs(x_pos) = " << hit.r << ", which yields: " << peRateWeighting << std::endl; + std::cout << anaStr << " PE Hit, rate = " << rate/(current*degeneracy) << ", Asymmetry = " << event.A << ", lookup pe value = " << lookup << ", bin number " << lookupTable->GetBin(lookupAngle,lookupXpos) << ", " << lookupAngle << ", " << lookupXpos << ", angle = " << (180.0/TMath::Pi())*asin(((hit.px*abs(hit.x) + hit.py*abs(hit.y))/hit.r)/hit.p) << ", abs(x_pos) = " << hit.r << ", which yields: " << peRateWeighting << std::endl; } if (anaStr == "signals" && (hit.det==detid+1) && hit.pid == 11 && hit.mtrid == 0){ // Then this is our primary signal of interest // if you do mtrid == 1 then you get the delta rays! About a 1% contribution @@ -449,8 +454,8 @@ void bkgd::bkgd_pePlots(int argcC, char **argvC) int dotpos = fileString.rfind(".root"); std::ostringstream os; std::ostringstream os2; - os << fileString.substr(0, dotpos) << "_PEs_"<<"det_"<cd(); c1[p]->Write(); - c1[p]->SaveAs(Form("%s_%d_%d.png",fileString.substr(0,fileString.find(".root")).c_str(),detid,p)); + c1[p]->SaveAs(Form("%s_%s_%d_%d.png",fileString.substr(0,fileString.find(".root")).c_str(),anaStr.c_str(),detid,p)); } file_out_integral.close(); @@ -897,7 +902,7 @@ void bkgd::bkgd_pePlots(int argcC, char **argvC) //theApp.Run(); } -void bkgd::do_pe(int argc, char **argv) +int bkgd::do_pe(int argc, char **argv) { if (argc <= 1 || argc > 10) { @@ -945,20 +950,23 @@ void bkgd::do_pe(int argc, char **argv) degeneracy = atof(argv[9]); } - get_lookuptable(); + int success = get_lookuptable(); + if (!success){ + return 0; + } if (reana == true) { - std::cout << "Running with file=" << fileString << ", detid=" << detid << std::endl; + std::cout << "Running with file=" << fileString << ", analysis=" << anaStr << ", detid=" << detid << std::endl; bkgd_pe_ana(); } if (argc >=1){ - std::cout << "Plotting previously analyzed file=" << fileString << " + PEs_det_" << detid << ".root" << std::endl; + std::cout << "Plotting previously analyzed file=" << fileString << " + " << anaStr << " + PEs_det_" << detid << ".root" << std::endl; bkgd_pePlots(argc, argv); } + return 1; } int main(int argc, char **argv) { bkgd ana; - ana.do_pe(argc, argv); - return 0; + return ana.do_pe(argc, argv); } diff --git a/analysis/pe_studies/README.md b/analysis/pe_studies/README.md new file mode 100644 index 000000000..7ba58bd01 --- /dev/null +++ b/analysis/pe_studies/README.md @@ -0,0 +1,25 @@ +Glitches: +- /share/library will refuse to show up unless you qlogin to compute-0-0 and ls it directly +- Similarly, you need to log in to compute-0-0 and execute remoll at least once by hand to get all the libraries in place + +Once remoll is built add these two lines into bin/remoll.sh to get it to work properly + export PATH="/share/library":${PATH} + export LD_LIBRARY_PATH="/share/library/":${LD_LIBRARY_PATH} + +== Available Analyses == + +=== Look up table prediction of signal to background ratios in MOLLER detectors === +* First, produce a flux at the detector array to sample from +\*\* Run scripts/produce.sh for moller, epelastic, and epinelastic - 5 million events (50x 100k jobs) is a good high statistics goal +\*\* Note that mocha.physics.umass.edu often segfaults jobs, and so you may need to redo some of them by hand +\*\* Then hadd moller.root out\_moller\_\*/remollout\_\*.root +\*\* Again for epelastic and epinelastic +\*\* Move these sample files to the folder of choice for doing subsequent analysis +* Run scripts/full-scan.sh to create a look up table of light guide PE yields for the geometry +* Then run bkgd_pe on the flux sample root files you have to generate outputs + + + + +Always check for segfault failed runs before proceeding. +Delete core-dump failed rootfiles and when confident with results also delete the root files systematically to save disk space. diff --git a/analysis/pe_studies/active-SD-mollerParallel.gdml b/analysis/pe_studies/active-SD-mollerParallel.gdml new file mode 100644 index 000000000..4cad12b4f --- /dev/null +++ b/analysis/pe_studies/active-SD-mollerParallel.gdml @@ -0,0 +1,225 @@ + + + + +]> + + + + + &positions; + + + + + + + + &world; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/macros/detector_vis.mac b/analysis/pe_studies/macros/detector_vis.mac similarity index 100% rename from macros/detector_vis.mac rename to analysis/pe_studies/macros/detector_vis.mac diff --git a/macros/preserve_recreate-brad.mac b/analysis/pe_studies/macros/preserve_recreate-brad.mac similarity index 96% rename from macros/preserve_recreate-brad.mac rename to analysis/pe_studies/macros/preserve_recreate-brad.mac index baa979c11..87ba63d4b 100644 --- a/macros/preserve_recreate-brad.mac +++ b/analysis/pe_studies/macros/preserve_recreate-brad.mac @@ -1,7 +1,7 @@ # Recreating the Mainz beam test # These must be called before initialize -/remoll/setgeofile geometry_Mainz/mollerMother_Mainz.gdml +/remoll/setgeofile geometry_sandbox/mollerMother_Mainz.gdml /remoll/physlist/parallel/disable /remoll/physlist/optical/enable diff --git a/macros/preserve_ref_scans.mac b/analysis/pe_studies/macros/preserve_ref_scans.mac similarity index 96% rename from macros/preserve_ref_scans.mac rename to analysis/pe_studies/macros/preserve_ref_scans.mac index 823f70098..d7ebadf7d 100644 --- a/macros/preserve_ref_scans.mac +++ b/analysis/pe_studies/macros/preserve_ref_scans.mac @@ -1,7 +1,7 @@ # Recreating the Mainz beam test # These must be called before initialize -/remoll/setgeofile geometry_Mainz/mollerMother_Mainz.gdml +/remoll/setgeofile geometry_sandbox/mollerMother_Mainz.gdml /remoll/physlist/parallel/disable /remoll/physlist/optical/enable diff --git a/macros/preserve_scans.mac b/analysis/pe_studies/macros/preserve_scans.mac similarity index 96% rename from macros/preserve_scans.mac rename to analysis/pe_studies/macros/preserve_scans.mac index fcdc757b8..5b73ac5ee 100644 --- a/macros/preserve_scans.mac +++ b/analysis/pe_studies/macros/preserve_scans.mac @@ -1,7 +1,7 @@ # Recreating the Mainz beam test # These must be called before initialize -/remoll/setgeofile geometry_Mainz/mollerMother_Mainz.gdml +/remoll/setgeofile geometry_sandbox/mollerMother_Mainz.gdml /remoll/physlist/parallel/disable /remoll/physlist/optical/enable diff --git a/analysis/pe_studies/macros/runexample_epelastic_parallel.mac b/analysis/pe_studies/macros/runexample_epelastic_parallel.mac new file mode 100644 index 000000000..1eb095bc2 --- /dev/null +++ b/analysis/pe_studies/macros/runexample_epelastic_parallel.mac @@ -0,0 +1,181 @@ +# Example file + +# store tracks +#/tracking/storeTrajectory 1 + +# This must be called before initialize +/remoll/geometry/setfile geometry/mollerMother_merged.gdml +# Parallel world geometry is optional - detector 28 (the primary detector array's idealize vacuum detector) is included in this parallel world now. +/remoll/parallel/setfile geometry/mollerParallel.gdml + +#/remoll/physlist/register QGSP_BERT_HP +/remoll/physlist/parallel/enable +# if optical physics is turned on it will only work if parallel physics is not turned on. +#/remoll/physlist/optical/enable + +# This must be explicitly called +/run/initialize + +/remoll/SD/disable_all +/remoll/SD/enable 104011 +/remoll/SD/enable 104017 +/remoll/SD/enable 104015 +/remoll/SD/enable 104014 +/remoll/SD/enable 140111 +/remoll/SD/enable 140117 +/remoll/SD/enable 140115 +/remoll/SD/enable 140114 +/remoll/SD/enable 140211 +/remoll/SD/enable 140217 +/remoll/SD/enable 140215 +/remoll/SD/enable 140214 +/remoll/SD/enable 204011 +/remoll/SD/enable 204017 +/remoll/SD/enable 204015 +/remoll/SD/enable 204014 +/remoll/SD/enable 240111 +/remoll/SD/enable 240117 +/remoll/SD/enable 240115 +/remoll/SD/enable 240114 +/remoll/SD/enable 240211 +/remoll/SD/enable 240217 +/remoll/SD/enable 240215 +/remoll/SD/enable 240214 +/remoll/SD/enable 304011 +/remoll/SD/enable 304017 +/remoll/SD/enable 304015 +/remoll/SD/enable 304014 +/remoll/SD/enable 340111 +/remoll/SD/enable 340117 +/remoll/SD/enable 340115 +/remoll/SD/enable 340114 +/remoll/SD/enable 340211 +/remoll/SD/enable 340217 +/remoll/SD/enable 340215 +/remoll/SD/enable 340214 +/remoll/SD/enable 404011 +/remoll/SD/enable 404017 +/remoll/SD/enable 404015 +/remoll/SD/enable 404014 +/remoll/SD/enable 440111 +/remoll/SD/enable 440117 +/remoll/SD/enable 440115 +/remoll/SD/enable 440114 +/remoll/SD/enable 440211 +/remoll/SD/enable 440217 +/remoll/SD/enable 440215 +/remoll/SD/enable 440214 +/remoll/SD/enable 504001 +/remoll/SD/enable 504007 +/remoll/SD/enable 504005 +/remoll/SD/enable 504004 +/remoll/SD/enable 504011 +/remoll/SD/enable 504017 +/remoll/SD/enable 504015 +/remoll/SD/enable 504014 +/remoll/SD/enable 504021 +/remoll/SD/enable 504027 +/remoll/SD/enable 504025 +/remoll/SD/enable 504024 +/remoll/SD/enable 540101 +/remoll/SD/enable 540107 +/remoll/SD/enable 540105 +/remoll/SD/enable 540104 +/remoll/SD/enable 540111 +/remoll/SD/enable 540117 +/remoll/SD/enable 540115 +/remoll/SD/enable 540114 +/remoll/SD/enable 540121 +/remoll/SD/enable 540127 +/remoll/SD/enable 540125 +/remoll/SD/enable 540124 +/remoll/SD/enable 540201 +/remoll/SD/enable 540207 +/remoll/SD/enable 540205 +/remoll/SD/enable 540204 +/remoll/SD/enable 540211 +/remoll/SD/enable 540217 +/remoll/SD/enable 540215 +/remoll/SD/enable 540214 +/remoll/SD/enable 540221 +/remoll/SD/enable 540227 +/remoll/SD/enable 540225 +/remoll/SD/enable 540224 +/remoll/SD/enable 604011 +/remoll/SD/enable 604017 +/remoll/SD/enable 604015 +/remoll/SD/enable 604014 +/remoll/SD/enable 640111 +/remoll/SD/enable 640117 +/remoll/SD/enable 640115 +/remoll/SD/enable 640114 +/remoll/SD/enable 640211 +/remoll/SD/enable 640217 +/remoll/SD/enable 640215 +/remoll/SD/enable 640214 + +/control/execute macros/load_magnetic_fieldmaps.mac + +# Raster and initial angle stuff +/remoll/oldras true +/remoll/rasx 5 mm +/remoll/rasy 5 mm +#/remoll/beam_x0 0 mm +#/remoll/beam_y0 0 mm +# initial angle +#/remoll/beam_th0 0 mrad +#/remoll/beam_ph0 0 mrad +# gaussian spread widths +#/remoll/beam_dth 0 mrad +#/remoll/beam_dph 0 mrad + +#/remoll/evgen/set beam +# To hit Ring 5 open in septant 4 +#/remoll/evgen/beam/x -1300 mm +#/remoll/evgen/beam/rasx -30 mm +#/remoll/evgen/beam/origin -987.5 0 -50 mm +#/remoll/evgen/beam/direction (-0.0523,0,0.9986) +# Mainz test energy +#/remoll/beamene 855 MeV + +/remoll/evgen/set elastic +#/remoll/evgen/thcommin 30.0 deg +#/remoll/evgen/thcommax 150.0 deg +#/remoll/evgen/set elastic +#/remoll/evgen/thmin 0.1 deg +#/remoll/evgen/thmax 2.0 deg +#/remoll/evgen/emin 80.0 MeV +#/remoll/evgen/set inelastic +#/remoll/evgen/set pion +#/remoll/piontype pi+ +#/remoll/evgen/set pion_LUND +#/remoll/evgen/set inelasticAl +#/remoll/evgen/set quasielasticAl +#/remoll/evgen/set elasticAl +#/remoll/evgen/set external +#/remoll/externalfile remollout.root +#/remoll/externaldetid 4051 + +#/remoll/evgen/beamPolarization +L +#/remoll/field/equationtype 2 +#/remoll/field/steppertype 2 +#/remoll/field/print + +/remoll/beamene 11 GeV + +/remoll/beamcurr 65 microampere + +# Make interactions with W, Cu, and Pb +# realistic rather than pure absorbers +/control/execute macros/kryptonite.mac + +/process/list + +# Specify random number seed +#/remoll/seed 123456 + +/remoll/filename remollout_parallel_epelastic.root + +#/tracking/verbose 2 +/remoll/printtargetinfo +/run/beamOn 100000 diff --git a/analysis/pe_studies/macros/runexample_epinelastic_parallel.mac b/analysis/pe_studies/macros/runexample_epinelastic_parallel.mac new file mode 100644 index 000000000..478e3b870 --- /dev/null +++ b/analysis/pe_studies/macros/runexample_epinelastic_parallel.mac @@ -0,0 +1,181 @@ +# Example file + +# store tracks +#/tracking/storeTrajectory 1 + +# This must be called before initialize +/remoll/geometry/setfile geometry/mollerMother_merged.gdml +# Parallel world geometry is optional - detector 28 (the primary detector array's idealize vacuum detector) is included in this parallel world now. +/remoll/parallel/setfile geometry/mollerParallel.gdml + +#/remoll/physlist/register QGSP_BERT_HP +/remoll/physlist/parallel/enable +# if optical physics is turned on it will only work if parallel physics is not turned on. +#/remoll/physlist/optical/enable + +# This must be explicitly called +/run/initialize + +/remoll/SD/disable_all +/remoll/SD/enable 104011 +/remoll/SD/enable 104017 +/remoll/SD/enable 104015 +/remoll/SD/enable 104014 +/remoll/SD/enable 140111 +/remoll/SD/enable 140117 +/remoll/SD/enable 140115 +/remoll/SD/enable 140114 +/remoll/SD/enable 140211 +/remoll/SD/enable 140217 +/remoll/SD/enable 140215 +/remoll/SD/enable 140214 +/remoll/SD/enable 204011 +/remoll/SD/enable 204017 +/remoll/SD/enable 204015 +/remoll/SD/enable 204014 +/remoll/SD/enable 240111 +/remoll/SD/enable 240117 +/remoll/SD/enable 240115 +/remoll/SD/enable 240114 +/remoll/SD/enable 240211 +/remoll/SD/enable 240217 +/remoll/SD/enable 240215 +/remoll/SD/enable 240214 +/remoll/SD/enable 304011 +/remoll/SD/enable 304017 +/remoll/SD/enable 304015 +/remoll/SD/enable 304014 +/remoll/SD/enable 340111 +/remoll/SD/enable 340117 +/remoll/SD/enable 340115 +/remoll/SD/enable 340114 +/remoll/SD/enable 340211 +/remoll/SD/enable 340217 +/remoll/SD/enable 340215 +/remoll/SD/enable 340214 +/remoll/SD/enable 404011 +/remoll/SD/enable 404017 +/remoll/SD/enable 404015 +/remoll/SD/enable 404014 +/remoll/SD/enable 440111 +/remoll/SD/enable 440117 +/remoll/SD/enable 440115 +/remoll/SD/enable 440114 +/remoll/SD/enable 440211 +/remoll/SD/enable 440217 +/remoll/SD/enable 440215 +/remoll/SD/enable 440214 +/remoll/SD/enable 504001 +/remoll/SD/enable 504007 +/remoll/SD/enable 504005 +/remoll/SD/enable 504004 +/remoll/SD/enable 504011 +/remoll/SD/enable 504017 +/remoll/SD/enable 504015 +/remoll/SD/enable 504014 +/remoll/SD/enable 504021 +/remoll/SD/enable 504027 +/remoll/SD/enable 504025 +/remoll/SD/enable 504024 +/remoll/SD/enable 540101 +/remoll/SD/enable 540107 +/remoll/SD/enable 540105 +/remoll/SD/enable 540104 +/remoll/SD/enable 540111 +/remoll/SD/enable 540117 +/remoll/SD/enable 540115 +/remoll/SD/enable 540114 +/remoll/SD/enable 540121 +/remoll/SD/enable 540127 +/remoll/SD/enable 540125 +/remoll/SD/enable 540124 +/remoll/SD/enable 540201 +/remoll/SD/enable 540207 +/remoll/SD/enable 540205 +/remoll/SD/enable 540204 +/remoll/SD/enable 540211 +/remoll/SD/enable 540217 +/remoll/SD/enable 540215 +/remoll/SD/enable 540214 +/remoll/SD/enable 540221 +/remoll/SD/enable 540227 +/remoll/SD/enable 540225 +/remoll/SD/enable 540224 +/remoll/SD/enable 604011 +/remoll/SD/enable 604017 +/remoll/SD/enable 604015 +/remoll/SD/enable 604014 +/remoll/SD/enable 640111 +/remoll/SD/enable 640117 +/remoll/SD/enable 640115 +/remoll/SD/enable 640114 +/remoll/SD/enable 640211 +/remoll/SD/enable 640217 +/remoll/SD/enable 640215 +/remoll/SD/enable 640214 + +/control/execute macros/load_magnetic_fieldmaps.mac + +# Raster and initial angle stuff +/remoll/oldras true +/remoll/rasx 5 mm +/remoll/rasy 5 mm +#/remoll/beam_x0 0 mm +#/remoll/beam_y0 0 mm +# initial angle +#/remoll/beam_th0 0 mrad +#/remoll/beam_ph0 0 mrad +# gaussian spread widths +#/remoll/beam_dth 0 mrad +#/remoll/beam_dph 0 mrad + +#/remoll/evgen/set beam +# To hit Ring 5 open in septant 4 +#/remoll/evgen/beam/x -1300 mm +#/remoll/evgen/beam/rasx -30 mm +#/remoll/evgen/beam/origin -987.5 0 -50 mm +#/remoll/evgen/beam/direction (-0.0523,0,0.9986) +# Mainz test energy +#/remoll/beamene 855 MeV + +/remoll/evgen/set inelastic +#/remoll/evgen/thcommin 30.0 deg +#/remoll/evgen/thcommax 150.0 deg +#/remoll/evgen/set elastic +#/remoll/evgen/thmin 0.1 deg +#/remoll/evgen/thmax 2.0 deg +#/remoll/evgen/emin 80.0 MeV +#/remoll/evgen/set inelastic +#/remoll/evgen/set pion +#/remoll/piontype pi+ +#/remoll/evgen/set pion_LUND +#/remoll/evgen/set inelasticAl +#/remoll/evgen/set quasielasticAl +#/remoll/evgen/set elasticAl +#/remoll/evgen/set external +#/remoll/externalfile remollout.root +#/remoll/externaldetid 4051 + +#/remoll/evgen/beamPolarization +L +#/remoll/field/equationtype 2 +#/remoll/field/steppertype 2 +#/remoll/field/print + +/remoll/beamene 11 GeV + +/remoll/beamcurr 65 microampere + +# Make interactions with W, Cu, and Pb +# realistic rather than pure absorbers +/control/execute macros/kryptonite.mac + +/process/list + +# Specify random number seed +#/remoll/seed 123456 + +/remoll/filename remollout_parallel_epinelastic.root + +#/tracking/verbose 2 +/remoll/printtargetinfo +/run/beamOn 100000 diff --git a/analysis/pe_studies/macros/runexample_moller_parallel.mac b/analysis/pe_studies/macros/runexample_moller_parallel.mac new file mode 100644 index 000000000..3f223e144 --- /dev/null +++ b/analysis/pe_studies/macros/runexample_moller_parallel.mac @@ -0,0 +1,181 @@ +# Example file + +# store tracks +#/tracking/storeTrajectory 1 + +# This must be called before initialize +/remoll/geometry/setfile geometry/mollerMother_merged.gdml +# Parallel world geometry is optional - detector 28 (the primary detector array's idealize vacuum detector) is included in this parallel world now. +/remoll/parallel/setfile geometry/mollerParallel.gdml + +#/remoll/physlist/register QGSP_BERT_HP +/remoll/physlist/parallel/enable +# if optical physics is turned on it will only work if parallel physics is not turned on. +#/remoll/physlist/optical/enable + +# This must be explicitly called +/run/initialize + +/remoll/SD/disable_all +/remoll/SD/enable 104011 +/remoll/SD/enable 104017 +/remoll/SD/enable 104015 +/remoll/SD/enable 104014 +/remoll/SD/enable 140111 +/remoll/SD/enable 140117 +/remoll/SD/enable 140115 +/remoll/SD/enable 140114 +/remoll/SD/enable 140211 +/remoll/SD/enable 140217 +/remoll/SD/enable 140215 +/remoll/SD/enable 140214 +/remoll/SD/enable 204011 +/remoll/SD/enable 204017 +/remoll/SD/enable 204015 +/remoll/SD/enable 204014 +/remoll/SD/enable 240111 +/remoll/SD/enable 240117 +/remoll/SD/enable 240115 +/remoll/SD/enable 240114 +/remoll/SD/enable 240211 +/remoll/SD/enable 240217 +/remoll/SD/enable 240215 +/remoll/SD/enable 240214 +/remoll/SD/enable 304011 +/remoll/SD/enable 304017 +/remoll/SD/enable 304015 +/remoll/SD/enable 304014 +/remoll/SD/enable 340111 +/remoll/SD/enable 340117 +/remoll/SD/enable 340115 +/remoll/SD/enable 340114 +/remoll/SD/enable 340211 +/remoll/SD/enable 340217 +/remoll/SD/enable 340215 +/remoll/SD/enable 340214 +/remoll/SD/enable 404011 +/remoll/SD/enable 404017 +/remoll/SD/enable 404015 +/remoll/SD/enable 404014 +/remoll/SD/enable 440111 +/remoll/SD/enable 440117 +/remoll/SD/enable 440115 +/remoll/SD/enable 440114 +/remoll/SD/enable 440211 +/remoll/SD/enable 440217 +/remoll/SD/enable 440215 +/remoll/SD/enable 440214 +/remoll/SD/enable 504001 +/remoll/SD/enable 504007 +/remoll/SD/enable 504005 +/remoll/SD/enable 504004 +/remoll/SD/enable 504011 +/remoll/SD/enable 504017 +/remoll/SD/enable 504015 +/remoll/SD/enable 504014 +/remoll/SD/enable 504021 +/remoll/SD/enable 504027 +/remoll/SD/enable 504025 +/remoll/SD/enable 504024 +/remoll/SD/enable 540101 +/remoll/SD/enable 540107 +/remoll/SD/enable 540105 +/remoll/SD/enable 540104 +/remoll/SD/enable 540111 +/remoll/SD/enable 540117 +/remoll/SD/enable 540115 +/remoll/SD/enable 540114 +/remoll/SD/enable 540121 +/remoll/SD/enable 540127 +/remoll/SD/enable 540125 +/remoll/SD/enable 540124 +/remoll/SD/enable 540201 +/remoll/SD/enable 540207 +/remoll/SD/enable 540205 +/remoll/SD/enable 540204 +/remoll/SD/enable 540211 +/remoll/SD/enable 540217 +/remoll/SD/enable 540215 +/remoll/SD/enable 540214 +/remoll/SD/enable 540221 +/remoll/SD/enable 540227 +/remoll/SD/enable 540225 +/remoll/SD/enable 540224 +/remoll/SD/enable 604011 +/remoll/SD/enable 604017 +/remoll/SD/enable 604015 +/remoll/SD/enable 604014 +/remoll/SD/enable 640111 +/remoll/SD/enable 640117 +/remoll/SD/enable 640115 +/remoll/SD/enable 640114 +/remoll/SD/enable 640211 +/remoll/SD/enable 640217 +/remoll/SD/enable 640215 +/remoll/SD/enable 640214 + +/control/execute macros/load_magnetic_fieldmaps.mac + +# Raster and initial angle stuff +/remoll/oldras true +/remoll/rasx 5 mm +/remoll/rasy 5 mm +#/remoll/beam_x0 0 mm +#/remoll/beam_y0 0 mm +# initial angle +#/remoll/beam_th0 0 mrad +#/remoll/beam_ph0 0 mrad +# gaussian spread widths +#/remoll/beam_dth 0 mrad +#/remoll/beam_dph 0 mrad + +#/remoll/evgen/set beam +# To hit Ring 5 open in septant 4 +#/remoll/evgen/beam/x -1300 mm +#/remoll/evgen/beam/rasx -30 mm +#/remoll/evgen/beam/origin -987.5 0 -50 mm +#/remoll/evgen/beam/direction (-0.0523,0,0.9986) +# Mainz test energy +#/remoll/beamene 855 MeV + +/remoll/evgen/set moller +#/remoll/evgen/thcommin 30.0 deg +#/remoll/evgen/thcommax 150.0 deg +#/remoll/evgen/set elastic +#/remoll/evgen/thmin 0.1 deg +#/remoll/evgen/thmax 2.0 deg +#/remoll/evgen/emin 80.0 MeV +#/remoll/evgen/set inelastic +#/remoll/evgen/set pion +#/remoll/piontype pi+ +#/remoll/evgen/set pion_LUND +#/remoll/evgen/set inelasticAl +#/remoll/evgen/set quasielasticAl +#/remoll/evgen/set elasticAl +#/remoll/evgen/set external +#/remoll/externalfile remollout.root +#/remoll/externaldetid 4051 + +#/remoll/evgen/beamPolarization +L +#/remoll/field/equationtype 2 +#/remoll/field/steppertype 2 +#/remoll/field/print + +/remoll/beamene 11 GeV + +/remoll/beamcurr 65 microampere + +# Make interactions with W, Cu, and Pb +# realistic rather than pure absorbers +/control/execute macros/kryptonite.mac + +/process/list + +# Specify random number seed +#/remoll/seed 123456 + +/remoll/filename remollout_parallel_moller.root + +#/tracking/verbose 2 +/remoll/printtargetinfo +/run/beamOn 100000 diff --git a/analysis/pe_studies/macros/runexample_test-det28_parallel.mac b/analysis/pe_studies/macros/runexample_test-det28_parallel.mac new file mode 100644 index 000000000..b667f625b --- /dev/null +++ b/analysis/pe_studies/macros/runexample_test-det28_parallel.mac @@ -0,0 +1,35 @@ +# This must be called before initialize +/remoll/geometry/setfile geometry/mollerMother_merged.gdml +# Parallel world geometry is optional - detector 28 (the primary detector array's idealize vacuum detector) is included in this parallel world now. +/remoll/parallel/setfile geometry/mollerParallelOrig.gdml + +/remoll/physlist/parallel/enable + +# This must be explicitly called +/run/initialize + +/remoll/SD/disable_all +/remoll/SD/enable 28 +#/remoll/SD/enable 540211 +#/remoll/SD/enable 540217 +#/remoll/SD/enable 540215 +#/remoll/SD/enable 540214 + +/control/execute macros/load_magnetic_fieldmaps.mac + +# Raster and initial angle stuff +#/remoll/oldras false +/remoll/oldras true +/remoll/rasx 5 mm +/remoll/rasy 5 mm + +/remoll/evgen/set moller +/remoll/beamene 11 GeV +/remoll/beamcurr 65 microampere +/control/execute macros/kryptonite.mac +/process/list + +/remoll/filename remollout_testParallel.root + +/remoll/printtargetinfo +/run/beamOn 10000 diff --git a/macros/full-scan.sh b/analysis/pe_studies/scripts/full-scan.sh similarity index 53% rename from macros/full-scan.sh rename to analysis/pe_studies/scripts/full-scan.sh index 836d284f8..6d627c07f 100755 --- a/macros/full-scan.sh +++ b/analysis/pe_studies/scripts/full-scan.sh @@ -4,7 +4,11 @@ geom="R5o" if [ "$#" -lt 1 ] ; then echo " ERROR, requires at least one input " - echo " usage: ./full-scan.sh \"geometry = R5o\" [analysis pass = 1] [reflectivity = 0.7] [x step size (cm) = 1.0] [angle step size (degrees) = 0.1]" + echo " This script will generate a geometry from the csv file you feed with the geometry name you give (smart look up which ring to use, read the script for a list) - it then executes scan.sh once for each step in the length along the light guide you chose. + " + echo " This is intended to be used to produce look up tables for background/signal comparisons for MOLLER detectors that have already been optimized. + " + echo " usage: ./full-scan.sh \"geometry = R5o\" [analysis pass = 1] [reflectivity = 0.7] [x step size (cm) = 1.0] [angle step size (degrees) = 0.1] [csv file = \"cadp.csv\"]" exit else geom=$1 @@ -14,6 +18,7 @@ analysis=1 # Submit jobs = 1, analyze jobs = 2 reflectivity=0.8 xPosStep=1.0 # 1 cm steps angleStep=0.1 # 60 steps per x pos +csv="cadp.csv" if [ "$#" -gt 1 ] ; then analysis=$2 fi @@ -26,6 +31,9 @@ fi if [ "$#" -gt 4 ] ; then angleStep=$5 fi +if [ "$#" -gt 5 ] ; then + csv=$6 +fi xPosMin=1040.0 # Reflector begin xPosMax=1350.0 # PMT begin angleMin=-6.0 # 3 degrees high @@ -37,37 +45,49 @@ lgAngle=6.0 user_ring="5.0" det=540210 +script_ring="5" if [[ $geom == "R1" ]] ; then user_ring="1" + script_ring="1" det=140210 elif [[ $geom == "R2" ]] ; then user_ring="2" + script_ring="2" det=240210 elif [[ $geom == "R3" ]] ; then user_ring="3" + script_ring="3" det=340210 elif [[ $geom == "R4" ]] ; then user_ring="4" + script_ring="4" det=440210 elif [[ $geom == "R5o" ]] ; then user_ring="5.0" + script_ring="5" det=540210 elif [[ $geom == "R5t" ]] ; then user_ring="5.1" + script_ring="5trans" det=540110 elif [[ $geom == "R5c" ]] ; then user_ring="5.2" + script_ring="5closed" det=504010 elif [[ $geom == "R6" ]] ; then user_ring="6" + script_ring="6" det=640210 fi +outString="" OLDIFS=$IFS IFS="," while read ring qR qL overlap qThick num2 num3 refL ref_angle lg_angle pmtR tilt pmtRad wallThickness extraPMT1 extraPMT2 z1 z2 do if [[ $ring != $user_ring ]] ; then + outString="$outString +$ring,$qR,$qL,$overlap,$qThick,$num2,$num3,$refL,$ref_angle,$lg_angle,$pmtR,$tilt,$pmtRad,$wallThickness,$extraPMT1,$extraPMT2,$z1,$z2" continue fi xPosMax=$(printf "%.2f" "$(bc -l <<< ${pmtR}-10.0)") @@ -75,9 +95,22 @@ do lgAngle=$lg_angle z_p=$(printf "%.2f" "$(bc -l <<< ${z1}-0.5*$qThick-$refL*s\(\(${ref_angle}-${lg_angle}\)*3.14159/180.0\))") echo "$ring $xPosMin $xPosMax z = $z_p starting z = $z1 and second = $z2" -done < cadp.csv + outString="$outString +$ring,$qR,$qL,$overlap,$qThick,$num2,$num3,$refL,$ref_angle,$lg_angle,$pmtR,$tilt,$pmtRad,$wallThickness,$extraPMT1,$extraPMT2,$z1,$z2" +done < $csv IFS=$OLDIFS +if [[ ! -f ../../geometry_sandbox/mollerMother_${geom}.gdml ]] ; then + if [[ "$analysis" == "1" ]] ; then + cd ../../../remoll-detector-generator/ + echo "$outString" > cadp_${geom}.csv + perl cadGeneratorV1.pl -F cadp_${geom}.csv + perl gdmlGeneratorV1_materials.pl -M detectorMotherP.csv -D parameter.csv -P qe.txt -U UVS_45total.txt -R MylarRef.txt -L ${script_ring} -T _${geom} + cd - + mv ../../../remoll-detector-generator/*_${geom}.* ../../geometry_sandbox/ + mv ../../../remoll-detector-generator/cadp_${geom}.csv ../../geometry_sandbox/ + fi +fi # Rescale numbers to cm from mm numSteps=$(printf "%.0f" "$(bc -l <<< 0.1*\(${xPosMax}-${xPosMin}\)/$xPosStep)") @@ -88,5 +121,13 @@ do z_pos=$(printf "%.1f" "$(bc -l <<< 0.1*$z_p-\(-1.0*$x_pos-0.1*$xPosMin\)*s\(${lgAngle}*3.14159/180.0\))") echo "$x_pos $z_pos" - ./scan.sh $x_pos angle $angleMin $angleMax $angleStep $reflectivity 1 1 $z_pos $geom ${analysis} $det & + ./scripts/scan.sh $x_pos angle $angleMin $angleMax $angleStep $reflectivity 1 1 $z_pos $geom ${analysis} $det & done + +if [[ ! -f results ]] ; then + mkdir results +fi +if [[ ! -f results/bkgd_pe ]] ; then + cp ../build/bkgd_pe/bkgd_pe results/bkgd_pe +fi + diff --git a/macros/getMax.C b/analysis/pe_studies/scripts/getMax.C similarity index 100% rename from macros/getMax.C rename to analysis/pe_studies/scripts/getMax.C diff --git a/analysis/pe_studies/scripts/produce.sh b/analysis/pe_studies/scripts/produce.sh new file mode 100755 index 000000000..b83d4b911 --- /dev/null +++ b/analysis/pe_studies/scripts/produce.sh @@ -0,0 +1,94 @@ +#!/bin/bash + +# Takes 5 arguments +# +# Fixed value of non-scanned variable - default = 0.0 +# Variable to scan ("angle" or "x") - default = "angle" +# Min of scanned variable - default = -30 +# Max of scanned variable - default = 30 +# Step size - default = 0.5 + +if [ "$#" -lt 1 ] ; then + echo " ERROR, requires at least one input + " + echo " This script generates a geometry from cadp.csv (passed as an argument), then pulls the flat-parallel world version of that geometry into the standard position inside remoll/geometry_sandbox, and then generates a flux of particles incident on that geometry for use in later downstream flux simulations + " + echo " usage: ./produce.sh numberRepeat (no path, just name)macroName.mac nameStub cadp.csv" + exit +fi + +num=0 +macro="detector_runexample.mac" +if [ "$#" -ge 1 ] ; then + num=$1 +fi +if [ "$#" -ge 2 ] ; then + macro="$2" +fi +if [ "$#" -ge 3 ] ; then + stub="$3" +else + stub="produce" +fi +if [ "$#" -ge 4 ] ; then + csv="$4" +else + csv="cadp.csv" +fi + +cd ../../../remoll-detector-generator/ +outString="" +OLDIFS=$IFS +IFS="," +while read ring qR qL overlap qThick num2 num3 refL ref_angle lg_angle pmtR tilt pmtRad wallThickness extraPMT1 extraPMT2 z1 z2 +do + if [[ $outString == "" ]]; then + echo "test 1 " + outString="$ring,$qR,$qL,$overlap,$qThick,$num2,$num3,$refL,$ref_angle,$lg_angle,$pmtR,$tilt,$pmtRad,$wallThickness,$extraPMT1,$extraPMT2,$z1,$z2" + else + echo "test 2 " + outString="$outString +$ring,$qR,$qL,$overlap,$qThick,$num2,$num3,$refL,$ref_angle,$lg_angle,$pmtR,$tilt,$pmtRad,$wallThickness,$extraPMT1,$extraPMT2,$z1,$z2" + fi +done < $csv +IFS=$OLDIFS + +echo "$outString" > cadp_${stub}.csv +perl cadGeneratorV1.pl -F cadp_${stub}.csv +perl gdmlGeneratorV1_materials_reflector.pl -M detectorMotherP.csv -D parameter.csv -P qe.txt -U UVS_45total.txt -R MylarRef.txt -T _${stub} +cd - +mv -f ../../../remoll-detector-generator/cadp_${stub}.csv . +cp -f ../../../remoll-detector-generator/flat_*${stub}.* ../../geometry/flat_segmented_detector_produce.gdml +# Local saved geometry file with the "flat" geometry turned on +cp -f active-SD-mollerParallel.gdml ../../geometry/mollerParallel.gdml + +for currentStep in `seq 1 $num`; +do + tmpFolder="produce/out_${stub}_${currentStep}" + if [ ! -d produce ] ; then + mkdir produce + fi + if [ ! -d $tmpFolder ] ; then + mkdir $tmpFolder + fi + cd $tmpFolder + cp -p ../../../../build/remoll . + cp -p ../../../../bin/remoll.sh . + + cp -p ../../macros/${macro} . + ln -s ../../../../geometry geometry + ln -s ../../../../macros macros + ln -s ../../../../map_directory map_directory + echo "#!/bin/bash +# +#$ -cwd +#$ -j y +#$ -S /bin/bash +source remoll.sh +./remoll ${macro} + " > runscript_${currentStep}.sh + chmod 755 runscript_${currentStep}.sh + qsub runscript_${currentStep}.sh + cd - +done + diff --git a/macros/sub-ref-scan.sh b/analysis/pe_studies/scripts/ref-scan.sh similarity index 68% rename from macros/sub-ref-scan.sh rename to analysis/pe_studies/scripts/ref-scan.sh index 893e7c191..01cdc11c3 100755 --- a/macros/sub-ref-scan.sh +++ b/analysis/pe_studies/scripts/ref-scan.sh @@ -11,8 +11,10 @@ if [ "$#" -lt 1 ] ; then echo " ERROR, requires at least one input " + echo " This script generates geometry from cadp.csv (with options for which ring) and makes a series of analyses at various reflector lengths and angles + " echo " usage: ./ref-scan.sh fixed-non-scanned \"variable-to-scan\" min-of-scan (0) max-of-scan (30) step-size (1.0) - Takes 5 arguments + Takes 10 arguments Fixed value of non-scanned variable - default = 0.0 Variable to scan (\"angle\" or \"x\") - default = \"angle\" @@ -24,7 +26,7 @@ if [ "$#" -lt 1 ] ; then Scintillation - default = 1.0 geometry file name - default = \"R5o\" pass - default = 1 - det number - default = 540210" + det number (optional, automatic) - default = 540210" exit fi @@ -102,7 +104,7 @@ elif [[ $geom == "R6" ]] ; then script_ring="6" det=640210 fi - +secondpass="$pass" if [ "$#" -gt 10 ] ; then det="${11}" fi @@ -110,10 +112,7 @@ fi tiltAngle=3.5 -lgAngle=2.5 refAngle=18.0 -thetaSubRef=0.0 -phiSubRef=0.0 refLength=80.0 z_p=0.0 numSteps=$(printf "%.0f" "$(bc -l <<< \(${scanMax}-\(${scanMin}\)\)/$scanStep)") @@ -150,27 +149,10 @@ do refAngle=$fixed fi - for wStep in `seq 0 4`; - #for wStep in `seq 0 9`; - do - for lStep in `seq 0 9`; - do - for thetaStepSeq in `seq 0 10`; - do - thetaSubRef=$(printf "%.1f" "$(bc -l <<< \(-9.0+\(1.0*$thetaStepSeq*3.0\)\))") - for phiStepSeq in `seq 0 12`; - do - phiSubRef=$(printf "%.1f" "$(bc -l <<< \(-30.0+\(1.0*$phiStepSeq*5.0\)\))") - #for thetaStepSeq in `seq 4 4`; - #do - # thetaSubRef=$(printf "%.1f" "$(bc -l <<< \(-10.0+\(1.0*$thetaStepSeq*2.5\)\))") - # for phiStepSeq in `seq 6 6`; - # do - # phiSubRef=$(printf "%.1f" "$(bc -l <<< \(-30.0+\(1.0*$phiStepSeq*5.0\)\))") name="${refAngle}_degrees_${refLength}_L_${reflectivity}_ref_${cerenkov}_cer_${scintillation}_scint" - cd ../../remoll-detector-generator/ + cd ../../../remoll-detector-generator/ outString="" OLDIFS=$IFS IFS="," @@ -184,15 +166,14 @@ $ring,$qR,$qL,$overlap,$qThick,$num2,$num3,$refL,$ref_angle,$lg_angle,$pmtR,$til #xPosMax=$(printf "%.2f" "$(bc -l <<< ${pmtR}-10.0)") #xPosMin=$(printf "%.2f" "$(bc -l <<< ${qR}+0.5*${qL}+5.0)") z_p=$(printf "%.2f" "$(bc -l <<< ${z1}-0.55*$qThick)") - echo "$ring $xPosMin $xPosMax z = $z_p starting z = $z1 and second = $z2" + #echo "$ring $xPosMin $xPosMax z = $z_p starting z = $z1 and second = $z2" ref_angle=$refAngle refL=$refLength - lg_angle=$lgAngle - tilt=$tiltAngle + tiltAngle=$tilt q_r=$qR outString="$outString $ring,$qR,$qL,$overlap,$qThick,$num2,$num3,$refL,$ref_angle,$lg_angle,$pmtR,$tilt,$pmtRad,$wallThickness,$extraPMT1,$extraPMT2,$z1,$z2" - done < cadp_shortened.csv + done < cadp.csv IFS=$OLDIFS z_point=$z_p @@ -200,48 +181,61 @@ $ring,$qR,$qL,$overlap,$qThick,$num2,$num3,$refL,$ref_angle,$lg_angle,$pmtR,$til if [[ "$pass" == "1" ]] ; then echo "$outString" > cadp_${geom}_${name}.csv perl cadGeneratorV1.pl -F cadp_${geom}_${name}.csv - perl gdmlGeneratorV1_materials_reflector.pl -M detectorMotherP.csv -D parameter.csv -P qe.txt -U UVS_45total.txt -R MylarRef.txt -L ${script_ring} -T _${geom} -i $lStep -j $wStep -t $thetaSubRef -p $phiSubRef + perl gdmlGeneratorV1_materials.pl -M detectorMotherP.csv -D parameter.csv -P qe.txt -U UVS_45total.txt -R MylarRef.txt -L ${script_ring} -T _${geom} fi cd - if [[ "$pass" == "1" ]] ; then - cp preserve_ref_scans.mac scans_${geom}_${name}.mac - sed -i 's;'"/remoll/evgen/beam/th -11.5 deg"';'"/remoll/evgen/beam/th -${tiltAngle} deg"';g' scans_${geom}_${name}.mac - sed -i 's;'"/remoll/evgen/beam/origin 0.0 0.0 0.0 mm"';'"/remoll/evgen/beam/origin -${q_r} 0.0 ${z_point} mm"';g' scans_${geom}_${name}.mac + cp macros/preserve_ref_scans.mac macros/scans_${geom}_${name}.mac + sed -i 's;'"/remoll/evgen/beam/th -11.5 deg"';'"/remoll/evgen/beam/th -${tiltAngle} deg"';g' macros/scans_${geom}_${name}.mac + sed -i 's;'"/remoll/evgen/beam/origin 0.0 0.0 0.0 mm"';'"/remoll/evgen/beam/origin -${q_r} 0.0 ${z_point} mm"';g' macros/scans_${geom}_${name}.mac - sed -i 's;'"/remoll/setgeofile geometry_Mainz/mollerMother_Mainz.gdml"';'"/remoll/setgeofile mollerMother_${geom}.gdml"';g' scans_${geom}_${name}.mac + sed -i 's;'"/remoll/setgeofile geometry_sandbox/mollerMother_Mainz.gdml"';'"/remoll/setgeofile mollerMother_${geom}.gdml"';g' macros/scans_${geom}_${name}.mac - sed -i 's;'"/remoll/evgen/beam/rasterRefZ 0.0 mm"';'"/remoll/evgen/beam/rasterRefZ ${z_point} mm"';g' scans_${geom}_${name}.mac + sed -i 's;'"/remoll/evgen/beam/rasterRefZ 0.0 mm"';'"/remoll/evgen/beam/rasterRefZ ${z_point} mm"';g' macros/scans_${geom}_${name}.mac - sed -i 's;'"/process/optical/processActivation Cerenkov false"';'"/process/optical/processActivation Cerenkov ${cer}"';g' scans_${geom}_${name}.mac - sed -i 's;'"/process/optical/processActivation Scintillation false"';'"/process/optical/processActivation Scintillation ${scint}"';g' scans_${geom}_${name}.mac - sed -i 's;'"Mainz_0.0_degrees_0.0_x.root"';'"${geom}_${name}.root"';g' scans_${geom}_${name}.mac + sed -i 's;'"/process/optical/processActivation Cerenkov false"';'"/process/optical/processActivation Cerenkov ${cer}"';g' macros/scans_${geom}_${name}.mac + sed -i 's;'"/process/optical/processActivation Scintillation false"';'"/process/optical/processActivation Scintillation ${scint}"';g' macros/scans_${geom}_${name}.mac + sed -i 's;'"Mainz_0.0_degrees_0.0_x.root"';'"${geom}_${name}.root"';g' macros/scans_${geom}_${name}.mac fi - tmpFolder="scans/sub/${geom}/out_${geom}_${wStep}_widthStep_${lStep}_lengthStep_${thetaSubRef}_theta_${phiSubRef}_phi_${name}" - if [ ! -d scans ] ; then - mkdir scans - fi - if [ ! -d scans/sub ] ; then - mkdir scans/sub + tmpFolder="ref-scans/$geom/out_${geom}_${name}" + if [ ! -d ref-scans ] ; then + mkdir ref-scans fi - if [ ! -d scans/sub/${geom} ] ; then - mkdir scans/sub/${geom} + if [ ! -d ref-scans/${geom} ] ; then + mkdir ref-scans/${geom} fi if [ ! -d $tmpFolder ] ; then mkdir $tmpFolder fi cd $tmpFolder + if [[ "$pass" == "2" ]] ; then + if [[ ! -f remollout_${geom}_${name}.pdf ]] ; then + cp ../../../../../analysis/bin/pe . + if [[ ! -f remollout_${geom}_${name}.root ]] ; then + echo "Error, no remollout_${geom}_${name}.root file, retrying analysis" + secondpass="1" + else + echo "./pe remollout_${geom}_${name}.root ${det} angle\=${refAngle} reflength\=${refLength} reflectivity\=${reflectivity} cerenkov\=${cerenkov} scintillation\=${scintillation} z_pos\=${z_point}" + ./pe remollout_${geom}_${name}.root ${det} angle\=${refAngle} reflength\=${refLength} reflectivity\=${reflectivity} cerenkov\=${cerenkov} scintillation\=${scintillation} z_pos\=${z_point} + convert remollout_${geom}_${name}*.png remollout_${geom}_${name}.pdf + rm remollout_${geom}_${name}*.png + #rm remollout_${geom}_${name}.root + rm remollout_${geom}_${name}_PEs_det_${det}.root + rm remollout_${geom}_${name}_PEs_det_${det}_plots.root + fi + fi + fi if [[ "$pass" == "1" ]] ; then cp -p ../../../../../build/remoll . cp -p ../../../../../bin/remoll.sh . - mv ../../../../../../remoll-detector-generator/cadp_${geom}_${name}.csv . cp -p ../../../../../../remoll-detector-generator/materialsOptical.xml . + mv ../../../../../../remoll-detector-generator/cadp_${geom}_${name}.csv . mv ../../../../../../remoll-detector-generator/*${geom}.* . - sed -i 's;'" \n runscript_${geom}_${name}.sh chmod 755 runscript_${geom}_${name}.sh - qsub runscript_${geom}_${name}.sh fi - if [[ "$pass" == "2" ]] ; then - ./pe remollout_${geom}_${name}.root ${det} angle\=${refAngle} reflength\=${refLength} reflectivity\=${reflectivity} cerenkov\=${cerenkov} scintillation\=${scintillation} z_pos\=${z_point} length_step\=$lStep width_step\=$wStep theta\=$thetaSubRef phi\=$phiSubRef - convert remollout_${geom}_${name}*.png remollout_${geom}_${name}.pdf - rm remollout_${geom}_${name}*.png - #rm remollout_${geom}_${name}.root - rm remollout_${geom}_${name}_*.root - #rm remollout_${geom}_${name}_PEs_det_${det}.root + if [[ "$pass" == "1" || "$secondpass" == "1" ]] ; then + qsub runscript_${geom}_${name}.sh fi cd - - done - done - done - done + secondpass="$pass" done - diff --git a/macros/scan.sh b/analysis/pe_studies/scripts/scan.sh similarity index 80% rename from macros/scan.sh rename to analysis/pe_studies/scripts/scan.sh index 0266c8904..068d13f24 100755 --- a/macros/scan.sh +++ b/analysis/pe_studies/scripts/scan.sh @@ -11,7 +11,9 @@ if [ "$#" -lt 1 ] ; then echo " ERROR, requires at least one input " - echo " Assumes you have already created the geometry (in ../../remoll-detector-generator/) with the correct parameters and name you want before proceding + echo " This script assumes a geometry exists in remoll/geometry_sandbox and then computes the PEs for a given detector due to a beam of electrons hitting the detector + " + echo " Assumes you have already created the geometry (in ../../../remoll-detector-generator/) with the correct parameters and name you want before proceding " echo " usage: ./scan.sh fixed-non-scanned \"variable-to-scan\" min-of-scan (-30) max-of-scan (30) step-size (0.5) Takes 12 arguments @@ -132,7 +134,7 @@ do fi name="${angle}_degrees_${x_pos}_x_${z_pos}_z_${reflectivity}_ref_${cerenkov}_cer_${scintillation}_scint" if [[ "$pass" == "1" ]] ; then - cp preserve_scans.mac scans_${geom}_${name}.mac + cp macros/preserve_scans.mac macros/scans_${geom}_${name}.mac # FIXME This angle is hardcoded to the qsim-matching case!! # 0.1994 = sin(11.5 degrees), $fixed is the distance from 0.0, + is farther towards PMT, further back away from +z axis # 0.104528 = sin(6 degrees) @@ -141,16 +143,16 @@ do #z_point=$(printf "%.1f" "$(bc -l <<< ${z_pos}+\($x_pos*0.1045\))") # FIXME z_point and x offset relationships assume the detector is immediately downstream of the origin, and ideally centered at the middle of the lightguide #z_point=$(printf "%.1f" "$(bc -l <<< -11.0-\($fixed*0.1994\))") - sed -i 's;'"/remoll/evgen/beam/th -11.5 deg"';'"/remoll/evgen/beam/th ${angle} deg"';g' scans_${geom}_${name}.mac - sed -i 's;'"/remoll/evgen/beam/origin 0.0 0.0 0.0 mm"';'"/remoll/evgen/beam/origin ${x_pos} 0.0 ${z_point} cm"';g' scans_${geom}_${name}.mac + sed -i 's;'"/remoll/evgen/beam/th -11.5 deg"';'"/remoll/evgen/beam/th ${angle} deg"';g' macros/scans_${geom}_${name}.mac + sed -i 's;'"/remoll/evgen/beam/origin 0.0 0.0 0.0 mm"';'"/remoll/evgen/beam/origin ${x_pos} 0.0 ${z_point} cm"';g' macros/scans_${geom}_${name}.mac - sed -i 's;'"/remoll/setgeofile geometry_Mainz/mollerMother_Mainz.gdml"';'"/remoll/setgeofile mollerMother_${geom}.gdml"';g' scans_${geom}_${name}.mac + sed -i 's;'"/remoll/setgeofile geometry_sandbox/mollerMother_Mainz.gdml"';'"/remoll/setgeofile mollerMother_${geom}.gdml"';g' macros/scans_${geom}_${name}.mac - sed -i 's;'"/remoll/evgen/beam/rasterRefZ 0.0 mm"';'"/remoll/evgen/beam/rasterRefZ ${z_point} cm"';g' scans_${geom}_${name}.mac + sed -i 's;'"/remoll/evgen/beam/rasterRefZ 0.0 mm"';'"/remoll/evgen/beam/rasterRefZ ${z_point} cm"';g' macros/scans_${geom}_${name}.mac - sed -i 's;'"/process/optical/processActivation Cerenkov false"';'"/process/optical/processActivation Cerenkov ${cer}"';g' scans_${geom}_${name}.mac - sed -i 's;'"/process/optical/processActivation Scintillation false"';'"/process/optical/processActivation Scintillation ${scint}"';g' scans_${geom}_${name}.mac - sed -i 's;'"Mainz_0.0_degrees_0.0_x.root"';'"${geom}_${name}.root"';g' scans_${geom}_${name}.mac + sed -i 's;'"/process/optical/processActivation Cerenkov false"';'"/process/optical/processActivation Cerenkov ${cer}"';g' macros/scans_${geom}_${name}.mac + sed -i 's;'"/process/optical/processActivation Scintillation false"';'"/process/optical/processActivation Scintillation ${scint}"';g' macros/scans_${geom}_${name}.mac + sed -i 's;'"Mainz_0.0_degrees_0.0_x.root"';'"${geom}_${name}.root"';g' macros/scans_${geom}_${name}.mac fi tmpFolder="scans/$geom/out_${geom}_${name}" if [ ! -d scans ] ; then @@ -165,11 +167,12 @@ do cd $tmpFolder if [[ "$pass" == "2" ]] ; then if [[ ! -f remollout_${geom}_${name}.pdf ]] ; then - cp ../../../../analysis/bin/pe . + cp ../../../../../analysis/bin/pe . if [[ ! -f remollout_${geom}_${name}.root ]] ; then echo "Error, no remollout_${geom}_${name}.root file, retrying analysis" secondpass="1" else + echo "./pe remollout_${geom}_${name}.root ${det} angle\=${angle} x_pos\=${x_pos} reflectivity\=${reflectivity} cerenkov\=${cerenkov} scintillation\=${scintillation} z_pos\=${z_point}" ./pe remollout_${geom}_${name}.root ${det} angle\=${angle} x_pos\=${x_pos} reflectivity\=${reflectivity} cerenkov\=${cerenkov} scintillation\=${scintillation} z_pos\=${z_point} convert remollout_${geom}_${name}*.png remollout_${geom}_${name}.pdf rm remollout_${geom}_${name}*.png @@ -179,15 +182,15 @@ do fi fi fi - if [[ "$pass" == "1" || "$secondpass" == "1" ]] ; then - cp -p ../../../../build/remoll . - cp -p ../../../../bin/remoll.sh . - cp -p ../../../../geometry_Mainz/materialsOptical.xml . - cp -p ../../../../geometry_Mainz/*${geom}.* . - cp ../../../../geometry_Mainz/matrices_${geom}.xml matrices_${geom}.xml + if [[ "$pass" == "1" ]] ; then + cp -p ../../../../../build/remoll . + cp -p ../../../../../bin/remoll.sh . + cp -p ../../../../../geometry_sandbox/materialsOptical.xml . + cp -p ../../../../../geometry_sandbox/*${geom}.* . + cp -p ../../../../../geometry_sandbox/matrices_${geom}.xml matrices_${geom}.xml sed -i 's;'" \n runscript_${geom}_${name}.sh chmod 755 runscript_${geom}_${name}.sh + fi + if [[ "$pass" == "1" || "$secondpass" == "1" ]] ; then qsub runscript_${geom}_${name}.sh fi cd - diff --git a/analysis/pe_studies/scripts/sub-ref-scan.sh b/analysis/pe_studies/scripts/sub-ref-scan.sh new file mode 100755 index 000000000..87de06425 --- /dev/null +++ b/analysis/pe_studies/scripts/sub-ref-scan.sh @@ -0,0 +1,232 @@ +#!/bin/bash + +if [ "$#" -lt 1 ] ; then + echo " ERROR, requires at least one input + " + echo " This script generates geometry from cadp.csv (with options for which ring) and makes a series of analyses at various reflector lengths and angles. + " + echo " This one will also scan across sub-segments of the reflector, and therefore takes much longer and is a more consuming analysis to undertake. The specific technique is to make the reflector only a small segment of it's full self, with the orientation of that subsegment scanned. The non-reflector bounced flux will be counted in each analysis, so it is a good idea to measure the non-reflector signal explicitly and subtract it from each of this analysis for sanity. The segmentation scale is hardcoded in here, but can be changed if you like. Also note that the detector is symmetric about the YZ plane, so only half the segments in the Y direction (width) must be simulated. + " + echo " usage: ./sub-ref-scan.sh reflectivity=0.7 Cerenkov=1.0 Scintillation=1.0 geometry=R5o analysis-pass=1 det-number=540210 + Takes 6 arguments + + Reflectivity of light guide - default = 0.7 + Cerenkov - default = 1.0 + Scintillation - default = 1.0 + geometry file name - default = \"R5o\" + pass - default = 1 + det number (optional, automatic) - default = 540210" + exit +fi + +tiltAngle=3.5 +refAngle=18.0 +thetaSubRef=0.0 +phiSubRef=0.0 +refLength=80.0 +z_p=0.0 +z_point=0.0 +q_r=0.0 +reflectivity=0.7 +cerenkov=1 +scintillation=1 +geom="R5o" +det=540210 +pass="1" +if [ "$#" -gt 0 ] ; then + reflectivity=$1 +fi +if [ "$#" -gt 1 ] ; then + cerenkov=$(printf "%.0f" "$2") +fi +if [ "$#" -gt 2 ] ; then + scintillation=$(printf "%.0f" "$3") +fi +if [ "$#" -gt 3 ] ; then + geom="${4}" +fi +if [ "$#" -gt 4 ] ; then + pass="${5}" +fi +user_ring="5.0" +script_ring="5" +if [[ $geom == "R1" ]] ; then + user_ring="1" + script_ring="1" + det=140210 +elif [[ $geom == "R2" ]] ; then + user_ring="2" + script_ring="2" + det=240210 +elif [[ $geom == "R3" ]] ; then + user_ring="3" + script_ring="3" + det=340210 +elif [[ $geom == "R4" ]] ; then + user_ring="4" + script_ring="4" + det=440210 +elif [[ $geom == "R5o" ]] ; then + user_ring="5.0" + script_ring="5" + det=540210 +elif [[ $geom == "R5t" ]] ; then + user_ring="5.1" + script_ring="5trans" + det=540110 +elif [[ $geom == "R5c" ]] ; then + user_ring="5.2" + script_ring="5closed" + det=504010 +elif [[ $geom == "R6" ]] ; then + user_ring="6" + script_ring="6" + det=640210 +fi +secondpass="$pass" +if [ "$#" -gt 5 ] ; then + det="${6}" +fi + + +defaultName="refScanOut.root" +outputName="refScanOut.root" +name="refScan_0.0_degrees_0.0_L" + +cer="true" +scint="true" +if [[ $cerenkov > 0.0 ]] ; then + cer="true" +else + cer="false" +fi +if [[ $scintillation > 0.0 ]] ; then + scint="true" +else + scint="false" +fi + + +for wStep in `seq 0 4`; +#for wStep in `seq 0 9`; +do + for lStep in `seq 0 9`; + do + for thetaStepSeq in `seq 0 10`; + do + thetaSubRef=$(printf "%.1f" "$(bc -l <<< \(-9.0+\(1.0*$thetaStepSeq*3.0\)\))") + for phiStepSeq in `seq 0 12`; + do + phiSubRef=$(printf "%.1f" "$(bc -l <<< \(-30.0+\(1.0*$phiStepSeq*5.0\)\))") + #for thetaStepSeq in `seq 4 4`; + #do + # thetaSubRef=$(printf "%.1f" "$(bc -l <<< \(-10.0+\(1.0*$thetaStepSeq*2.5\)\))") + # for phiStepSeq in `seq 6 6`; + # do + # phiSubRef=$(printf "%.1f" "$(bc -l <<< \(-30.0+\(1.0*$phiStepSeq*5.0\)\))") + + +cd ../../../remoll-detector-generator/ +outString="" +OLDIFS=$IFS +IFS="," +while read ring qR qL overlap qThick num2 num3 refL ref_angle lg_angle pmtR tilt pmtRad wallThickness extraPMT1 extraPMT2 z1 z2 +do + if [[ $ring != $user_ring ]] ; then + outString="$outString +$ring,$qR,$qL,$overlap,$qThick,$num2,$num3,$refL,$ref_angle,$lg_angle,$pmtR,$tilt,$pmtRad,$wallThickness,$extraPMT1,$extraPMT2,$z1,$z2" + continue + fi + refAngle=$ref_angle + refLength=$refL + tiltAngle=$tilt + #xPosMax=$(printf "%.2f" "$(bc -l <<< ${pmtR}-10.0)") + #xPosMin=$(printf "%.2f" "$(bc -l <<< ${qR}+0.5*${qL}+5.0)") + z_p=$(printf "%.2f" "$(bc -l <<< ${z1}-0.55*$qThick)") + #echo "$ring $xPosMin $xPosMax z = $z_p starting z = $z1 and second = $z2" + q_r=$qR + outString="$outString +$ring,$qR,$qL,$overlap,$qThick,$num2,$num3,$refL,$ref_angle,$lg_angle,$pmtR,$tilt,$pmtRad,$wallThickness,$extraPMT1,$extraPMT2,$z1,$z2" +done < cadp.csv +IFS=$OLDIFS + +z_point=$z_p +name="${refAngle}_degrees_${refLength}_L_${reflectivity}_ref_${cerenkov}_cer_${scintillation}_scint" + +if [[ "$pass" == "1" ]] ; then + echo "$outString" > cadp_${geom}_${name}.csv + perl cadGeneratorV1.pl -F cadp_${geom}_${name}.csv + perl gdmlGeneratorV1_materials_reflector.pl -M detectorMotherP.csv -D parameter.csv -P qe.txt -U UVS_45total.txt -R MylarRef.txt -L ${script_ring} -T _${geom} -i $lStep -j $wStep -t $thetaSubRef -p $phiSubRef +fi +cd - + +if [[ "$pass" == "1" ]] ; then + cp macros/preserve_ref_scans.mac macros/scans_${geom}_${name}.mac + sed -i 's;'"/remoll/evgen/beam/th -11.5 deg"';'"/remoll/evgen/beam/th -${tiltAngle} deg"';g' macros/scans_${geom}_${name}.mac + sed -i 's;'"/remoll/evgen/beam/origin 0.0 0.0 0.0 mm"';'"/remoll/evgen/beam/origin -${q_r} 0.0 ${z_point} mm"';g' macros/scans_${geom}_${name}.mac + + sed -i 's;'"/remoll/setgeofile geometry_sandbox/mollerMother_Mainz.gdml"';'"/remoll/setgeofile mollerMother_${geom}.gdml"';g' macros/scans_${geom}_${name}.mac + + sed -i 's;'"/remoll/evgen/beam/rasterRefZ 0.0 mm"';'"/remoll/evgen/beam/rasterRefZ ${z_point} mm"';g' macros/scans_${geom}_${name}.mac + + sed -i 's;'"/process/optical/processActivation Cerenkov false"';'"/process/optical/processActivation Cerenkov ${cer}"';g' macros/scans_${geom}_${name}.mac + sed -i 's;'"/process/optical/processActivation Scintillation false"';'"/process/optical/processActivation Scintillation ${scint}"';g' macros/scans_${geom}_${name}.mac + sed -i 's;'"Mainz_0.0_degrees_0.0_x.root"';'"${geom}_${name}.root"';g' macros/scans_${geom}_${name}.mac +fi + +tmpFolder="sub-scans/${geom}/out_${geom}_${wStep}_widthStep_${lStep}_lengthStep_${thetaSubRef}_theta_${phiSubRef}_phi_${name}" +if [ ! -d sub-scans ] ; then + mkdir sub-scans +fi +if [ ! -d sub-scans/${geom} ] ; then + mkdir sub-scans/${geom} +fi +if [ ! -d $tmpFolder ] ; then + mkdir $tmpFolder +fi +cd $tmpFolder +if [[ "$pass" == "2" ]] ; then + if [[ ! -f remollout_${geom}_${name}.pdf ]] ; then + cp ../../../../../analysis/bin/pe . + if [[ ! -f remollout_${geom}_${name}.root ]] ; then + echo "Error, no remollout_${geom}_${name}.root file, retrying analysis" + secondpass="1" + else + echo "./pe remollout_${geom}_${name}.root ${det} angle\=${refAngle} reflength\=${refLength} reflectivity\=${reflectivity} cerenkov\=${cerenkov} scintillation\=${scintillation} z_pos\=${z_point} length_step\=$lStep width_step\=$wStep theta\=$thetaSubRef phi\=$phiSubRef" + ./pe remollout_${geom}_${name}.root ${det} angle\=${refAngle} reflength\=${refLength} reflectivity\=${reflectivity} cerenkov\=${cerenkov} scintillation\=${scintillation} z_pos\=${z_point} length_step\=$lStep width_step\=$wStep theta\=$thetaSubRef phi\=$phiSubRef + convert remollout_${geom}_${name}*.png remollout_${geom}_${name}.pdf + rm remollout_${geom}_${name}*.png + #rm remollout_${geom}_${name}.root + rm remollout_${geom}_${name}_PEs_det_${det}.root + rm remollout_${geom}_${name}_PEs_det_${det}_plots.root + fi + fi +fi +if [[ "$pass" == "1" ]] ; then + cp -p ../../../../../build/remoll . + cp -p ../../../../../bin/remoll.sh . + cp -p ../../../../../../remoll-detector-generator/materialsOptical.xml . + mv ../../../../../../remoll-detector-generator/cadp_${geom}_${name}.csv . + mv ../../../../../../remoll-detector-generator/*${geom}.* . + sed -i 's;'" \n runscript_${geom}_${name}.sh + chmod 755 runscript_${geom}_${name}.sh +fi +if [[ "$pass" == "1" || "$secondpass" == "1" ]] ; then + qsub runscript_${geom}_${name}.sh +fi +cd - +secondpass="$pass" + done + done + done +done diff --git a/macros/produce.sh b/macros/produce.sh deleted file mode 100755 index 77a4751e2..000000000 --- a/macros/produce.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash - -# Takes 5 arguments -# -# Fixed value of non-scanned variable - default = 0.0 -# Variable to scan ("angle" or "x") - default = "angle" -# Min of scanned variable - default = -30 -# Max of scanned variable - default = 30 -# Step size - default = 0.5 - -if [ "$#" -lt 1 ] ; then - echo " ERROR, requires at least one input - " - echo " usage: ./produce.sh numberRepeat macroName.mac" - exit -fi - -num=0 -macro="detector_runexample.mac" -if [ "$#" -ge 1 ] ; then - num=$1 -fi -if [ "$#" -ge 2 ] ; then - macro="$2" -fi -if [ "$#" -ge 3 ] ; then - stub="$3" -else - stub="sim" -fi - - -for currentStep in `seq 1 $num`; -do - tmpFolder="produce/out_${stub}_${currentStep}" - if [ ! -d produce ] ; then - mkdir produce - fi - if [ ! -d $tmpFolder ] ; then - mkdir $tmpFolder - fi - cd $tmpFolder - cp -p ../../../build/remoll . - cp -p ../../../bin/remoll.sh . - - cp ../../${macro} . - ln -s ../../../geometry geometry - ln -s ../../../macros macros - ln -s ../../../map_directory map_directory - echo "#!/bin/bash -# -#$ -cwd -#$ -j y -#$ -S /bin/bash -source remoll.sh -./remoll ${macro} - " > runscript_${num}.sh - chmod 755 runscript_${num}.sh - qsub runscript_${num}.sh - cd - -done - diff --git a/macros/ref-scan.sh b/macros/ref-scan.sh deleted file mode 100755 index 94d58fc9b..000000000 --- a/macros/ref-scan.sh +++ /dev/null @@ -1,245 +0,0 @@ -#!/bin/bash - -# Takes 5 arguments -# -# Fixed value of non-scanned variable - default = 0.0 -# Variable to scan ("angle" or "x") - default = "angle" -# Min of scanned variable - default = -30 -# Max of scanned variable - default = 30 -# Step size - default = 0.5 - -if [ "$#" -lt 1 ] ; then - echo " ERROR, requires at least one input - " - echo " usage: ./ref-scan.sh fixed-non-scanned \"variable-to-scan\" min-of-scan (0) max-of-scan (30) step-size (1.0) - Takes 5 arguments - - Fixed value of non-scanned variable - default = 0.0 - Variable to scan (\"angle\" or \"x\") - default = \"angle\" - Min of scanned variable - default = 0 - Max of scanned variable - default = 30 - Step size - default = 1.0 - Reflectivity of light guide - default = 0.7 - Cerenkov - default = 1.0 - Scintillation - default = 1.0 - geometry file name - default = \"R5o\" - pass - default = 1 - det number - default = 540210" - exit -fi - -fixed="$1" -scanned="angle" -q_r=0.0 -scanMin=0.0 -scanMax=30.0 -scanStep=1.0 -reflectivity=0.7 -cerenkov=1 -scintillation=1 -geom="R5o" -det=540210 -pass="1" -if [ "$#" -gt 1 ] ; then - scanned="$2" -fi -if [ "$#" -gt 2 ] ; then - scanMin=$3 -fi -if [ "$#" -gt 3 ] ; then - scanMax=$4 -fi -if [ "$#" -gt 4 ] ; then - scanStep=$5 -fi -if [ "$#" -gt 5 ] ; then - reflectivity=$6 -fi -if [ "$#" -gt 6 ] ; then - cerenkov=$(printf "%.0f" "$7") -fi -if [ "$#" -gt 7 ] ; then - scintillation=$(printf "%.0f" "$8") -fi -if [ "$#" -gt 8 ] ; then - geom="${9}" -fi -if [ "$#" -gt 9 ] ; then - pass="${10}" -fi -user_ring="5.0" -script_ring="5" -if [[ $geom == "R1" ]] ; then - user_ring="1" - script_ring="1" - det=140210 -elif [[ $geom == "R2" ]] ; then - user_ring="2" - script_ring="2" - det=240210 -elif [[ $geom == "R3" ]] ; then - user_ring="3" - script_ring="3" - det=340210 -elif [[ $geom == "R4" ]] ; then - user_ring="4" - script_ring="4" - det=440210 -elif [[ $geom == "R5o" ]] ; then - user_ring="5.0" - script_ring="5" - det=540210 -elif [[ $geom == "R5t" ]] ; then - user_ring="5.1" - script_ring="5trans" - det=540110 -elif [[ $geom == "R5c" ]] ; then - user_ring="5.2" - script_ring="5closed" - det=504010 -elif [[ $geom == "R6" ]] ; then - user_ring="6" - script_ring="6" - det=640210 -fi - -if [ "$#" -gt 10 ] ; then - det="${11}" -fi - - - -tiltAngle=3.5 -lgAngle=2.5 -refAngle=18.0 -refLength=80.0 -z_p=0.0 -numSteps=$(printf "%.0f" "$(bc -l <<< \(${scanMax}-\(${scanMin}\)\)/$scanStep)") -fixed=$(printf "%.1f" "$(bc -l <<< 1.0*$fixed)") -z_point=0.0 - -defaultName="refScanOut.root" -outputName="refScanOut.root" -name="refScan_0.0_degrees_0.0_L" - -cer="true" -scint="true" -if [[ $cerenkov > 0.0 ]] ; then - cer="true" -else - cer="false" -fi -if [[ $scintillation > 0.0 ]] ; then - scint="true" -else - scint="false" -fi - - -for currentStep in `seq 0 $numSteps`; -do - point=$(printf "%.1f" "$(bc -l <<< \($scanMin+\(1.0*$currentStep*$scanStep\)\))") - if [[ "$scanned" == "angle" ]] ; then - refLength=$fixed - refAngle=$point - fi - if [[ "$scanned" == "x" ]] ; then - refLength=$point - refAngle=$fixed - fi - - - name="${refAngle}_degrees_${refLength}_L_${reflectivity}_ref_${cerenkov}_cer_${scintillation}_scint" - - cd ../../remoll-detector-generator/ - outString="" - OLDIFS=$IFS - IFS="," - while read ring qR qL overlap qThick num2 num3 refL ref_angle lg_angle pmtR tilt pmtRad wallThickness extraPMT1 extraPMT2 z1 z2 - do - if [[ $ring != $user_ring ]] ; then - outString="$outString -$ring,$qR,$qL,$overlap,$qThick,$num2,$num3,$refL,$ref_angle,$lg_angle,$pmtR,$tilt,$pmtRad,$wallThickness,$extraPMT1,$extraPMT2,$z1,$z2" - continue - fi - #xPosMax=$(printf "%.2f" "$(bc -l <<< ${pmtR}-10.0)") - #xPosMin=$(printf "%.2f" "$(bc -l <<< ${qR}+0.5*${qL}+5.0)") - z_p=$(printf "%.2f" "$(bc -l <<< ${z1}-0.55*$qThick)") - echo "$ring $xPosMin $xPosMax z = $z_p starting z = $z1 and second = $z2" - ref_angle=$refAngle - refL=$refLength - lg_angle=$lgAngle - tilt=$tiltAngle - q_r=$qR - outString="$outString -$ring,$qR,$qL,$overlap,$qThick,$num2,$num3,$refL,$ref_angle,$lg_angle,$pmtR,$tilt,$pmtRad,$wallThickness,$extraPMT1,$extraPMT2,$z1,$z2" - done < cadp_shortened.csv - IFS=$OLDIFS - - z_point=$z_p - - if [[ "$pass" == "1" ]] ; then - echo "$outString" > cadp_${geom}_${name}.csv - perl cadGeneratorV1.pl -F cadp_${geom}_${name}.csv - perl gdmlGeneratorV1_materials.pl -M detectorMotherP.csv -D parameter.csv -P qe.txt -U UVS_45total.txt -R MylarRef.txt -L ${script_ring} -T _${geom} - fi - cd - - - if [[ "$pass" == "1" ]] ; then - cp preserve_ref_scans.mac scans_${geom}_${name}.mac - sed -i 's;'"/remoll/evgen/beam/th -11.5 deg"';'"/remoll/evgen/beam/th -${tiltAngle} deg"';g' scans_${geom}_${name}.mac - sed -i 's;'"/remoll/evgen/beam/origin 0.0 0.0 0.0 mm"';'"/remoll/evgen/beam/origin -${q_r} 0.0 ${z_point} mm"';g' scans_${geom}_${name}.mac - - sed -i 's;'"/remoll/setgeofile geometry_Mainz/mollerMother_Mainz.gdml"';'"/remoll/setgeofile mollerMother_${geom}.gdml"';g' scans_${geom}_${name}.mac - - sed -i 's;'"/remoll/evgen/beam/rasterRefZ 0.0 mm"';'"/remoll/evgen/beam/rasterRefZ ${z_point} mm"';g' scans_${geom}_${name}.mac - - sed -i 's;'"/process/optical/processActivation Cerenkov false"';'"/process/optical/processActivation Cerenkov ${cer}"';g' scans_${geom}_${name}.mac - sed -i 's;'"/process/optical/processActivation Scintillation false"';'"/process/optical/processActivation Scintillation ${scint}"';g' scans_${geom}_${name}.mac - sed -i 's;'"Mainz_0.0_degrees_0.0_x.root"';'"${geom}_${name}.root"';g' scans_${geom}_${name}.mac - fi - - tmpFolder="scans/$geom/out_${geom}_${name}" - if [ ! -d scans ] ; then - mkdir scans - fi - if [ ! -d scans/${geom} ] ; then - mkdir scans/${geom} - fi - if [ ! -d $tmpFolder ] ; then - mkdir $tmpFolder - fi - cd $tmpFolder - if [[ "$pass" == "1" ]] ; then - cp -p ../../../../build/remoll . - cp -p ../../../../bin/remoll.sh . - mv ../../../../../remoll-detector-generator/cadp_${geom}_${name}.csv . - cp -p ../../../../../remoll-detector-generator/materialsOptical.xml . - mv ../../../../../remoll-detector-generator/*${geom}.* . - - sed -i 's;'" \n runscript_${geom}_${name}.sh - chmod 755 runscript_${geom}_${name}.sh - qsub runscript_${geom}_${name}.sh - fi - if [[ "$pass" == "2" ]] ; then - cp ../../../../analysis/bin/pe . - echo "./pe remollout_${geom}_${name}.root ${det} angle\=${refAngle} reflength\=${refLength} reflectivity\=${reflectivity} cerenkov\=${cerenkov} scintillation\=${scintillation} z_pos\=${z_point}" - ./pe remollout_${geom}_${name}.root ${det} angle\=${refAngle} reflength\=${refLength} reflectivity\=${reflectivity} cerenkov\=${cerenkov} scintillation\=${scintillation} z_pos\=${z_point} - convert remollout_${geom}_${name}*.png remollout_${geom}_${name}.pdf - rm remollout_${geom}_${name}*.png - #rm remollout_${geom}_${name}.root - #rm remollout_${geom}_${name}_PEs_det_${det}.root - fi - cd - -done - From 418f58f93a0e23293e6dc280e357f79def2836eb Mon Sep 17 00:00:00 2001 From: Cameron Clarke Date: Mon, 4 Jan 2021 22:01:48 -0500 Subject: [PATCH 262/443] Updating scripts again, this time including one that handles bkgd_pe (the analysis of the actual rates combining the lookup tables for light guides with the simulated flux) and updating the "sub-ref-scan.sh" to properly handle potential segfaults and keep track of thousands of need-to-be analyzed jobs (in a ham fisted, but mostly effective way) --- analysis/pe_studies/scripts/do_all_rates.sh | 95 +++++++++++++++++++++ analysis/pe_studies/scripts/full-scan.sh | 2 +- analysis/pe_studies/scripts/scan.sh | 2 +- analysis/pe_studies/scripts/sub-ref-scan.sh | 79 ++++++++++++++--- 4 files changed, 162 insertions(+), 16 deletions(-) create mode 100755 analysis/pe_studies/scripts/do_all_rates.sh diff --git a/analysis/pe_studies/scripts/do_all_rates.sh b/analysis/pe_studies/scripts/do_all_rates.sh new file mode 100755 index 000000000..803a1f67a --- /dev/null +++ b/analysis/pe_studies/scripts/do_all_rates.sh @@ -0,0 +1,95 @@ +#!/bin/bash + +if [[ ! -d results ]] ; then + mkdir results +fi +if [[ ! -f results/bkgd_pe ]] ; then + cp -p ../build/bkgd_pe/bkgd_pe results/bkgd_pe +fi +if [[ ! -d results/pdfs ]] ; then + mkdir results/pdfs +fi +if [[ ! -f results/scans_R5o.root ]] ; then + echo "Error: No results/scans_R5o.root exists, trying to do the hadd now. But please verify files are in the \"results\" folder and try again + " + hadd -f scans_R5o.root scans/R5o/out_R5o*/scans.root + mv scans_R5o.root results/scans_R5o.root + exit +fi + +if [ "$#" -lt 3 ] ; then + echo " ERROR, requires at least three inputs, of the names of the ROOT files for sampling rates out of (give the name of the file, not the relative path, sorry) + " + echo " This script will loop over all 6 rings of the MOLLER detector and generate bkgd_pe outputs for moller, epelastic, and epinelastic generators. + " + echo " Warning: This script assumes that there are outputs from \"scripts/produce.sh\" living in the \"results\" folder, as well as results of \"scripts/full-scan.sh\" for each ring R1, R2, R3, R4, R5o (assumes open = trans = closed), and R6, all named as \"scans_R\#.root\" + " + echo " usage: ./do_all_rates.sh mollerRootFileName epelasticRootFileName epinelasticRootFileName [rootFile hadd multiplicity=50.0] [beamCurrent=65.0] [reflectivity=0.7] [cerenkov=1] [scintillation=1]" + exit +else + moller=$1 +fi +if [ "$#" -ge 2 ] ; then + epelastic=$2 +fi +if [ "$#" -ge 3 ] ; then + epinelastic=$3 +fi +if [ "$#" -ge 4 ] ; then + repeatCount=$4 +fi +if [ "$#" -ge 5 ] ; then + beamCurrent=$5 +fi +if [ "$#" -ge 6 ] ; then + reflectivity=$6 +fi +if [ "$#" -ge 7 ] ; then + cer=$7 +fi +if [ "$#" -ge 8 ] ; then + scint=$8 +fi + +cd results + +detectorNumberArray=("104010" "204010" "304010" "404010" "504000" "504010" "504020" "604010" "140110" "240110" "340110" "440110" "540100" "540110" "540120" "640110" "140210" "240210" "340210" "440210" "540200" "540210" "540220" "640210") +detectorNameArray=("R1" "R2" "R3" "R4" "R5o" "R5o" "R5o" "R6" "R1" "R2" "R3" "R4" "R5o" "R5o" "R5o" "R6" "R1" "R2" "R3" "R4" "R5o" "R5o" "R5o" "R6") +analysesArray=("$moller" "$epelastic" "$epinelastic") +# Treat open, trans, and closed as identical geometry for now... seems to be true anyway + +if [[ ! -f $moller ]] ; then + echo "Error: This script is working out of $pwd folder, and $moller does not exist in this \"results\" folder, please place it there and try again. Note that the script input should be the root file name, not the path to it (sorry). + " +fi +if [[ ! -f $epelastic ]] ; then + echo "Error: This script is working out of $pwd folder, and $epelastic does not exist in this \"results\" folder, please place it there and try again. Note that the script input should be the root file name, not the path to it (sorry). + " +fi +if [[ ! -f $epinelastic ]] ; then + echo "Error: This script is working out of $pwd folder, and $epinelastic does not exist in this \"results\" folder, please place it there and try again. Note that the script input should be the root file name, not the path to it (sorry). + " +fi + +for ana in ${analysesArray[@]}; do + for i in ${!detectorNumberArray[@]}; do + if [[ -f scans_${detectorNameArray[${i}]}.root ]] ; then + ./bkgd_pe $ana ${detectorNumberArray[${i}]} ${detectorNameArray[${i}]} signals $reflectivity $cer $scint $beamCurrent $repeatCount + convert ${ana%".root"}_signals_${detectorNumberArray[${i}]}*.png ${ana%".root"}_signals_${detectorNumberArray[${i}]}.pdf + rm *.png + else + echo "No scans_${detectorNameArray[${i}]}.root, skipping to try the next ring" + fi + done + for i in ${!detectorNumberArray[@]}; do + if [[ -f scans_${detectorNameArray[${i}]}.root ]] ; then + ./bkgd_pe $ana ${detectorNumberArray[${i}]} ${detectorNameArray[${i}]} backgrounds $reflectivity $cer $scint $beamCurrent $repeatCount + convert ${ana%".root"}_backgrounds_${detectorNumberArray[${i}]}*.png ${ana%".root"}_backgrounds_${detectorNumberArray[${i}]}.pdf + rm *.png + else + echo "No scans_${detectorNameArray[${i}]}.root, skipping to try the next ring" + fi + done +done +cd - +mv results/*.pdf results/pdfs/ diff --git a/analysis/pe_studies/scripts/full-scan.sh b/analysis/pe_studies/scripts/full-scan.sh index 6d627c07f..4d5e6d176 100755 --- a/analysis/pe_studies/scripts/full-scan.sh +++ b/analysis/pe_studies/scripts/full-scan.sh @@ -124,7 +124,7 @@ do ./scripts/scan.sh $x_pos angle $angleMin $angleMax $angleStep $reflectivity 1 1 $z_pos $geom ${analysis} $det & done -if [[ ! -f results ]] ; then +if [[ ! -d results ]] ; then mkdir results fi if [[ ! -f results/bkgd_pe ]] ; then diff --git a/analysis/pe_studies/scripts/scan.sh b/analysis/pe_studies/scripts/scan.sh index 068d13f24..fee5b4f13 100755 --- a/analysis/pe_studies/scripts/scan.sh +++ b/analysis/pe_studies/scripts/scan.sh @@ -176,7 +176,7 @@ do ./pe remollout_${geom}_${name}.root ${det} angle\=${angle} x_pos\=${x_pos} reflectivity\=${reflectivity} cerenkov\=${cerenkov} scintillation\=${scintillation} z_pos\=${z_point} convert remollout_${geom}_${name}*.png remollout_${geom}_${name}.pdf rm remollout_${geom}_${name}*.png - #rm remollout_${geom}_${name}.root + rm remollout_${geom}_${name}.root rm remollout_${geom}_${name}_PEs_det_${det}.root rm remollout_${geom}_${name}_PEs_det_${det}_plots.root fi diff --git a/analysis/pe_studies/scripts/sub-ref-scan.sh b/analysis/pe_studies/scripts/sub-ref-scan.sh index 87de06425..a4ce1b712 100755 --- a/analysis/pe_studies/scripts/sub-ref-scan.sh +++ b/analysis/pe_studies/scripts/sub-ref-scan.sh @@ -84,6 +84,8 @@ elif [[ $geom == "R6" ]] ; then det=640210 fi secondpass="$pass" +missing=0 +started=0 if [ "$#" -gt 5 ] ; then det="${6}" fi @@ -106,9 +108,16 @@ else scint="false" fi +# On the first pass just do the loop once (started == 0) +# Then, if $pass == 2 the $missing number could be > 0, in which case loop again +while (( $missing!=0 )) || (( $started==0 )) ; +do + missing=0 + started=1 +#for wStep in `seq 0 4`; +# seq 0 to 9 is redundant, as there is a symmetry about the midplane where width = 4.5 for wStep in `seq 0 4`; -#for wStep in `seq 0 9`; do for lStep in `seq 0 9`; do @@ -118,12 +127,6 @@ do for phiStepSeq in `seq 0 12`; do phiSubRef=$(printf "%.1f" "$(bc -l <<< \(-30.0+\(1.0*$phiStepSeq*5.0\)\))") - #for thetaStepSeq in `seq 4 4`; - #do - # thetaSubRef=$(printf "%.1f" "$(bc -l <<< \(-10.0+\(1.0*$thetaStepSeq*2.5\)\))") - # for phiStepSeq in `seq 6 6`; - # do - # phiSubRef=$(printf "%.1f" "$(bc -l <<< \(-30.0+\(1.0*$phiStepSeq*5.0\)\))") cd ../../../remoll-detector-generator/ @@ -156,7 +159,7 @@ name="${refAngle}_degrees_${refLength}_L_${reflectivity}_ref_${cerenkov}_cer_${s if [[ "$pass" == "1" ]] ; then echo "$outString" > cadp_${geom}_${name}.csv perl cadGeneratorV1.pl -F cadp_${geom}_${name}.csv - perl gdmlGeneratorV1_materials_reflector.pl -M detectorMotherP.csv -D parameter.csv -P qe.txt -U UVS_45total.txt -R MylarRef.txt -L ${script_ring} -T _${geom} -i $lStep -j $wStep -t $thetaSubRef -p $phiSubRef + perl gdmlGeneratorV1_materials.pl -M detectorMotherP.csv -D parameter.csv -P qe.txt -U UVS_45total.txt -R MylarRef.txt -L ${script_ring} -T _${geom} -i $lStep -j $wStep -t $thetaSubRef -p $phiSubRef fi cd - @@ -188,15 +191,19 @@ cd $tmpFolder if [[ "$pass" == "2" ]] ; then if [[ ! -f remollout_${geom}_${name}.pdf ]] ; then cp ../../../../../analysis/bin/pe . - if [[ ! -f remollout_${geom}_${name}.root ]] ; then - echo "Error, no remollout_${geom}_${name}.root file, retrying analysis" - secondpass="1" + if [[ ! -f finished.txt ]] ; then + #if [[ ! -f remollout_${geom}_${name}.root ]] ; then + echo "Not finished with ${geom} ${name}: ${wStep} widthStep, ${lStep} lengthStep, ${thetaSubRef} theta, ${phiSubRef} phi, will retry analysis" + let missing=$missing+1 + #echo "$missing" + # Do missing check instead + #secondpass="1" else echo "./pe remollout_${geom}_${name}.root ${det} angle\=${refAngle} reflength\=${refLength} reflectivity\=${reflectivity} cerenkov\=${cerenkov} scintillation\=${scintillation} z_pos\=${z_point} length_step\=$lStep width_step\=$wStep theta\=$thetaSubRef phi\=$phiSubRef" ./pe remollout_${geom}_${name}.root ${det} angle\=${refAngle} reflength\=${refLength} reflectivity\=${reflectivity} cerenkov\=${cerenkov} scintillation\=${scintillation} z_pos\=${z_point} length_step\=$lStep width_step\=$wStep theta\=$thetaSubRef phi\=$phiSubRef convert remollout_${geom}_${name}*.png remollout_${geom}_${name}.pdf rm remollout_${geom}_${name}*.png - #rm remollout_${geom}_${name}.root + rm remollout_${geom}_${name}.root rm remollout_${geom}_${name}_PEs_det_${det}.root rm remollout_${geom}_${name}_PEs_det_${det}_plots.root fi @@ -217,11 +224,24 @@ if [[ "$pass" == "1" ]] ; then #$ -j y #$ -S /bin/bash source remoll.sh -./remoll scans_${geom}_${name}.mac +echo \" +Doing ${geom} ${name} job +\" +while [[ ! -f remollout_${geom}_${name}.root ]] ; +do + echo \"Executing ./remoll scans_${geom}_${name}.mac + \" + ./remoll scans_${geom}_${name}.mac + rm core.* +done +echo \"Done, touching finished.txt to signal pass 2 to work +\" +touch finished.txt " > runscript_${geom}_${name}.sh chmod 755 runscript_${geom}_${name}.sh fi -if [[ "$pass" == "1" || "$secondpass" == "1" ]] ; then +#if [[ "$pass" == "1" || "$secondpass" == "1" ]] ; then +if [[ "$pass" == "1" ]] ; then qsub runscript_${geom}_${name}.sh fi cd - @@ -230,3 +250,34 @@ secondpass="$pass" done done done +if [[ "$pass" == "1" ]] ; then + echo "Pass 1 finished, feel free to rerun immediately with pass 2 (will loop until all jobs finish)" + missing=0 +fi +if (( $missing!=0 )) ; then + echo "Pass 2 finished, waiting on $missing incomplete jobs for another pass + " + echo "Sleeping for 10 minutes" + sleep 60 + echo "Sleeping for 9 minutes" + sleep 60 + echo "Sleeping for 8 minutes" + sleep 60 + echo "Sleeping for 7 minutes" + sleep 60 + echo "Sleeping for 6 minutes" + sleep 60 + echo "Sleeping for 5 minutes" + sleep 60 + echo "Sleeping for 4 minutes" + sleep 60 + echo "Sleeping for 3 minutes" + sleep 60 + echo "Sleeping for 2 minutes" + sleep 60 + echo "Sleeping for 1 minutes" + sleep 57 + echo "Retrying analysis" + sleep 3 +fi +done From 96c7b8c6d03f11e68e0a12b78477d4058d522813 Mon Sep 17 00:00:00 2001 From: Cameron Clarke Date: Mon, 4 Jan 2021 22:58:07 -0500 Subject: [PATCH 263/443] Update README.md Adding notes so that another person can replicated my results. --- analysis/pe_studies/README.md | 84 ++++++++++++++++++++++++++++------- 1 file changed, 69 insertions(+), 15 deletions(-) diff --git a/analysis/pe_studies/README.md b/analysis/pe_studies/README.md index 7ba58bd01..883500cc0 100644 --- a/analysis/pe_studies/README.md +++ b/analysis/pe_studies/README.md @@ -1,25 +1,79 @@ -Glitches: -- /share/library will refuse to show up unless you qlogin to compute-0-0 and ls it directly -- Similarly, you need to log in to compute-0-0 and execute remoll at least once by hand to get all the libraries in place +# Known glitches on UMass Mocha cluster: +* /share/library will refuse to show up unless you qlogin to compute-0-0 and ls it directly +* Similarly, you need to log in to compute-0-0 and execute remoll at least once by hand to get all the libraries in place -Once remoll is built add these two lines into bin/remoll.sh to get it to work properly - export PATH="/share/library":${PATH} - export LD_LIBRARY_PATH="/share/library/":${LD_LIBRARY_PATH} +Once remoll is built add these two lines into bin/remoll.sh to get it to work properly: -== Available Analyses == +`export PATH="/share/library":${PATH}` -=== Look up table prediction of signal to background ratios in MOLLER detectors === +`export LD_LIBRARY_PATH="/share/library/":${LD_LIBRARY_PATH}` + +- - - + +# Available Detector Optimization Analyses + +## 'scripts' Folder +The 'scripts' folder contains any bash scripts that greatly simplify the job of scanning parameters of various rings and optimizing detectors after any change in upstream electron transport, and serve as a template for further studies that can be done. + +Each script within the scripts folder is intended to be executed from the pe_studies folder -> `./scripts/full-scan.sh [args]`, and each of them has been set up so that all of the relative paths and needed executables are automatically referenced correctly or moved into the correct places (and if not, then a useful message is printed explaining what went wrong and how to fix it by hand). + +All of the scripts assume that you are using the UMass Mocha compute cluster's SGE qsub system. This system has some issues (listed above), which have had semi-reasonable work-arounds developed that do work (but require additional effort to get right). + +'scripts' contents: +### produce.sh +Usage `./scripts/produce.sh numberRepeat (no path, just name)macroName.mac nameStub cadp.csv` + +This script generates the flux at the downstream "flat" idealized detector array (where each individual sub-segment of each detector has been flattened and projected onto the x-y axis, and all detectors are separate, but with the same numbering system as the full detector system), which allows later sampling from that accepted flux (see full-scan.sh) + +The arguments are as follows: +* numberRepeat: "50" is a good default and is the number of separate simulation jobs to execute. Ideally we want around 5 million events for the main generators to get reasonable statistics, but this takes days if done in just one job. Splitting that into 50 jobs of 100k events each (the default contained in the macros/runexample_...parallel.mac macros) is ideal. +* macroName.mac: "runexample_moller_parallel.mac" (or epelastic or epinelastic) are the pre-written macros which should work. Note that these macros depend on the "flat" parallel world gdml file, which is also generated by this script and copied into the correct place. These sample macros are adequate, though please note which magnetic fields are used, as well as the GDML geometry, raster selection, and kryptonite settings. These choices were somewhat arbitrary when the macros were committed. +* nameStub: "moller" (or epelastic or epinelastic) are what you should probably use here. This field is just to avoid having to parse whatever macro's name is given and is used as the remollout_NAME.root output. +* cadp.csv: "cadp.csv" is the usual name of the csv file that will be used in the perl scripts in the remoll-detector-generator scripts. The file is assumed to live inside that repository, and that repository is assumed to be parallel to the current install of remoll (three levels up). + +Once you have generated the outputs, please make sure that none of the individual jobs have segfaulted or failed in any way. If they have then just go and manually re-run that failed job. + +Once all of the jobs are done the easiest thing to do is execute `hadd -f moller.root out_moller_*/remollout_parallel_moller.root`, which merges them all into one. Because of the way that remoll samples and assigns relative weights, it is important for you to know the uA beam current that was assumed while simulating and the number of individual jobs that were `hadd` together. The rates in any one remoll job are self normalized so that that one job stands alone. `hadd` multiple jobs together will then multiply the rates higher by the multiplicity of separate jobs. Similarly if you want the rate in Hz/uA you need to later divide by the number of uA (which is 65 uA in the sameple macros given). + +### scan.sh +Usage: `./scripts/scan.sh fixed-non-scanned "variable-to-scan" min-of-scan (-30) max-of-scan (30) step-size (0.5)` + +This script assumes that a "Geometry name" suffix'ed set of GDML files has been placed in the geometry_sandbox folder of remoll, and that the user wants to scan shooting at different positions or angles onto the light guide. The angles, x position, and z position of the beam generator are passed in as arguments. Practically speaking this script needs to just be called from within the `scripts/full-scan.sh` script, which knows to produce the GDML files itself and read the cadp.csv file to know what x and z points to shoot the beam from. The analysis requires 2 passes, to simulate and then analyze the sim outputs. And the outputs come in the scans.root output file that contains several metrics, including average number of pes and it's RMS, as well as number of bounces against the reflector, lightguide, and both, as well as the input command line parameters. + +The arguments are as follows: +* fixed-non-scanned: "0.0" is the default number here, which decides the fixed value of the fixed "variable-to-scan" determined in the next argument. +* variable-to-scan: Typing "angle" or "x" here refers to whether the scan is over "angle" or "x", with the other variable held fixed, at the value given in the previous argument. Angle is in degrees, and x is in cm. +* min-of-scan: "-30" is the default number here, which is the minimum value of the scanned variable (in degrees, or cm, if angle or x is scanned, respectively). +* max-of-scan: "30" is similarly the max. +* step-size: "0.5" is the default step size, and determines the steps between min and max (can be any double). +* Reflectivity: "0.9" is the default reflectivity. This variable edits the material properties in the gdml files before beginning the simulation. +* Cerenkov: "1.0" is a boolean (it's bash... 1.0 means it is turned on, and 0.0 means it is turned off. Really anything other than 0.0 will turn it on) to edit the macro file and turn cerenkov on or off. The Macro is assumed to be macros/preserve_scans.mac (and can be editted by the user if wanted.) +* Scintillation: "1.0" is a boolean (it's bash... 1.0 means it is turned on, and 0.0 means it is turned off. Really anything other than 0.0 will turn it on) to edit the macro file and turn scintillation on or off. The Macro is assumed to be macros/preserve_scans.mac (and can be editted by the user if wanted.) +* z position of the beam origin: "0" is the default starting point, defining the origin of the beam (plus raster) that is used to spray the detector. This number will be edited within the script to adjust for the angle of the light guide and reflector so that the beam starts as close to the detector as possible. This number should be determined empirically using the macros/detector_vis.mac macro (probably needs to be in the higher remoll macros folder to get picked up correctly). The full-scan.sh and ref-scan.sh scripts have their own ways of determining what this number should be (also was determined partially empirically). +* Geometry name: "Mainz" or "R5o" or "R1", etc. are names that are used to determing the GDML files used (as well as the detector number based on ring name, though det number is the final paramter that can be passed in by hand). +* Pass: "1" or "2". "1" means it is the first pass, when the simulation jobs are submitted. "2" means the `pe` analysis pass, where the outputs are analyzed (and if pass 1 segfaulted it will resubmit the job. This is convenient for relatively small numbers of jobs, but when it gets to the thousands something better like the sub-ref-scan.sh approach is preferable). +* detector: "540210" is the detector number, which can be determined automatically if the "Geometry name" input was a ring number ("R1", "R2" ... "R5o", "R6"), but must be passed by hand for unique GDML geometry names. +### full-scan.sh +This is a script that wraps around scan.sh to produce a lookup table's worth of angle and light guide length (x) hits. The results can be `hadd` together to be fed as input into the `scripts/do_all_rates.sh` calculation that generates the `scripts/produce.sh` convoluted signal and background results. + +### do_all_rates.sh +This script assumes several files are already in place and will complain if they are not in the right places or with the right names. Do `scripts/produce.sh` and `scripts/full-scan.sh` first to properly prepare for getting the lightguide backgrounds lookup table folded into the MOLLER flux for final numbers. Please note that the "signal" size has been assumed at 12 PEs vs 25 PEs for rings 1,2,3,4, and 6, vs 5, respectively. The "background" signal is entirely determined by the lookup table coming from the `scripts/full-scan.sh` analysis. +### ref-scan.sh +This is a script that will allow you to scan the reflector length and reflector angle parameters to determine the ideal size and angle of the reflector segment for ideal light collection. Parameters for cerenkov and scintillation can be turned on and off to help understand what is happening. With some care, the relflectivity of the reflector section and the light guide section could be separated from eachother and this can be used to determine the impact of blackening in the light guide section (you would need to edit the material property names or values by hand in the GDML files copied into this analysis in order for that test to be feasible, though it has been done before. See the logic surrounding the Reflectivity parameter in these scripts for guidance on how to achieve this) +### sub-ref-scan.sh +This script executes similarly to `scripts/ref-scan.sh`, but it loops over sub-segments of the reflector, allowing fine tuning of a fresnel-type mirror, for optimal light collection. This is just one easiest way that the light guides and reflectors can be studied in addition to the default flat segments we have started with. + +## Look up table prediction of signal to background ratios in MOLLER detectors === * First, produce a flux at the detector array to sample from -\*\* Run scripts/produce.sh for moller, epelastic, and epinelastic - 5 million events (50x 100k jobs) is a good high statistics goal -\*\* Note that mocha.physics.umass.edu often segfaults jobs, and so you may need to redo some of them by hand -\*\* Then hadd moller.root out\_moller\_\*/remollout\_\*.root -\*\* Again for epelastic and epinelastic -\*\* Move these sample files to the folder of choice for doing subsequent analysis + * Run scripts/produce.sh for moller, epelastic, and epinelastic - 5 million events (50x 100k jobs) is a good high statistics goal + * Note that mocha.physics.umass.edu often segfaults jobs, and so you may need to redo some of them by hand + * Then hadd moller.root out\_moller\_\*/remollout\_\*.root + * Again for epelastic and epinelastic + * Move these sample files to the folder of choice for doing subsequent analysis * Run scripts/full-scan.sh to create a look up table of light guide PE yields for the geometry * Then run bkgd_pe on the flux sample root files you have to generate outputs - - +## Final notes Always check for segfault failed runs before proceeding. Delete core-dump failed rootfiles and when confident with results also delete the root files systematically to save disk space. From dce01a1a77fb6fa298193b5697c59c0a74c495af Mon Sep 17 00:00:00 2001 From: Cameron Clarke Date: Thu, 7 Jan 2021 15:38:32 -0500 Subject: [PATCH 264/443] Updating the sub-ref-scan.sh analysis step and README.md --- analysis/pe_studies/README.md | 4 ++++ analysis/pe_studies/scripts/getMax.C | 16 ++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/analysis/pe_studies/README.md b/analysis/pe_studies/README.md index 883500cc0..e50d9be93 100644 --- a/analysis/pe_studies/README.md +++ b/analysis/pe_studies/README.md @@ -62,6 +62,10 @@ This script assumes several files are already in place and will complain if they This is a script that will allow you to scan the reflector length and reflector angle parameters to determine the ideal size and angle of the reflector segment for ideal light collection. Parameters for cerenkov and scintillation can be turned on and off to help understand what is happening. With some care, the relflectivity of the reflector section and the light guide section could be separated from eachother and this can be used to determine the impact of blackening in the light guide section (you would need to edit the material property names or values by hand in the GDML files copied into this analysis in order for that test to be feasible, though it has been done before. See the logic surrounding the Reflectivity parameter in these scripts for guidance on how to achieve this) ### sub-ref-scan.sh This script executes similarly to `scripts/ref-scan.sh`, but it loops over sub-segments of the reflector, allowing fine tuning of a fresnel-type mirror, for optimal light collection. This is just one easiest way that the light guides and reflectors can be studied in addition to the default flat segments we have started with. +### getMax.C +This script assumes you have produced a sub-ref-scan.sh analysis (which by the way takes a really long time, like 4 days worth of simulation time at 30 jobs at a time). Once that analysis is done you should hadd all of its scans.root files into one single file and feed that file into the getMax.C scripst as the first argument. The second argument should be a double == to the value of the mean PE counts when there is NO reflector section at all (i.e. it is the amount of PEs from photons that never hit the reflector section in the first place, which are duplicate counted for each independent simulation of sub-segments). + +Setting up a no-reflector simulation should be as simple as taking one of the many job outputs from sub-ref-scan.sh and changing the geometry to comment out the reflector_540210 (or whatever detector number) component (not reflectorSkin though, that is the other-walls of the reflector section). ## Look up table prediction of signal to background ratios in MOLLER detectors === * First, produce a flux at the detector array to sample from diff --git a/analysis/pe_studies/scripts/getMax.C b/analysis/pe_studies/scripts/getMax.C index 140ecc6fb..71d20db9e 100644 --- a/analysis/pe_studies/scripts/getMax.C +++ b/analysis/pe_studies/scripts/getMax.C @@ -1,4 +1,4 @@ -void getMax(TString fName = "scans.root") { +void getMax(TString fName = "scans.root",Double_t baseline = 0.0) { TFile* fFile = TFile::Open(fName); if (!fFile) { std::cout<< "ERROR: No file named " << fName << std::endl; @@ -7,8 +7,8 @@ void getMax(TString fName = "scans.root") { TChain* scans = (TChain*) fFile->Get("scans"); TCanvas * c1 = new TCanvas(); - Double_t old_integral = 0.095; - Double_t new_integral = 0.095; + Double_t old_integral = baseline; + Double_t new_integral = baseline; //(5 tiles of x width, 10 tiles of y length, and fill with the Theta chosen above) TH2F * improvementHistOld = new TH2F ("ImprovementOld","Original Yield", 5, 0, 5, 10, 0 , 10); @@ -28,7 +28,7 @@ void getMax(TString fName = "scans.root") { TH2* hTemp = (TH2*) gROOT->FindObject("htemp"); Int_t max_bin = hTemp->GetMaximumBin(); Double_t max_value = hTemp->GetBinContent(max_bin); - new_integral += max_value - 0.095; + new_integral += max_value - baseline; Int_t xBin, yBin, zBin; hTemp->GetBinXYZ(max_bin,xBin,yBin,zBin); std::cout<< "Max bin = " << max_bin << ", and value = " << hTemp->GetBinContent(max_bin) << std::endl; @@ -44,7 +44,7 @@ void getMax(TString fName = "scans.root") { if (!hTemp) {continue;} Int_t old_max_bin = hTemp->GetMaximumBin(); Double_t old_max_value = hTemp->GetBinContent(old_max_bin); - old_integral += old_max_value - 0.095; + old_integral += old_max_value - baseline; Int_t old_xBin, old_yBin, old_zBin; hTemp->GetBinXYZ(old_max_bin,old_xBin,old_yBin,old_zBin); std::cout<< "Old Max bin = " << old_max_bin << ", and value = " << hTemp->GetBinContent(old_max_bin) << std::endl; @@ -75,6 +75,10 @@ void getMax(TString fName = "scans.root") { newHist_Theta->Draw("COLZ"); c2->cd(4); newHist_Phi->Draw("COLZ"); - c2->SaveAs("test2.pdf"); + int dotPos = ((std::string)fName).rfind(".root"); + std::ostringstream os; + os << ((std::string)fName).substr(0, dotPos) << ".pdf"; + std::string fileName = os.str(); + c2->SaveAs(fileName.c_str()); } From 6d493584042fb4effe6285cc586907225cc82d47 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 8 Jan 2021 10:18:36 -0600 Subject: [PATCH 265/443] [beam] /remoll/evgen/beam/isotropic to generate isotropic beams --- include/remollGenBeam.hh | 4 ++++ src/remollGenBeam.cc | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/include/remollGenBeam.hh b/include/remollGenBeam.hh index cfea33922..578bc5a8c 100644 --- a/include/remollGenBeam.hh +++ b/include/remollGenBeam.hh @@ -48,6 +48,7 @@ class remollGenBeam : public remollVEventGen { void SetDirectionZ(double dz); void SetDirectionPh(double ph); void SetDirectionTh(double th); + void SetDirectionIsotropic(); void SetCorrelationX(double cx); void SetCorrelationY(double cy); @@ -65,6 +66,9 @@ class remollGenBeam : public remollVEventGen { G4ThreeVector fOriginSpread; EOriginModel fOriginModelX, fOriginModelY, fOriginModelZ; G4ThreeVector fDirection; + G4bool fIsotropic; + G4double fIsotropicThetaMin; + G4double fIsotropicThetaMax; G4ThreeVector fCorrelation; G4ThreeVector fPolarization; diff --git a/src/remollGenBeam.cc b/src/remollGenBeam.cc index b9580779a..ec662634d 100644 --- a/src/remollGenBeam.cc +++ b/src/remollGenBeam.cc @@ -27,6 +27,9 @@ remollGenBeam::remollGenBeam() fOriginModelY(kOriginModelFlat), fOriginModelZ(kOriginModelFlat), fDirection(0.0,0.0,1.0), + fIsotropic(false), + fIsotropicThetaMin(0.0), + fIsotropicThetaMax(2.0*pi), fCorrelation(0.0653*mrad/mm,0.0653*mrad/mm,0.0), fPolarization(0.0,0.0,0.0), fRaster(5*mm,5*mm,0.0), @@ -55,6 +58,9 @@ remollGenBeam::remollGenBeam() fThisGenMessenger->DeclareMethod("pz",&remollGenBeam::SetDirectionZ,"direction z (vector will be normalized before use)"); fThisGenMessenger->DeclareMethodWithUnit("th","deg",&remollGenBeam::SetDirectionTh,"direction vector theta angle"); fThisGenMessenger->DeclareMethodWithUnit("ph","deg",&remollGenBeam::SetDirectionPh,"direction vector phi angle"); + fThisGenMessenger->DeclareProperty("isotropic",fIsotropic,"direction is isotropic"); + fThisGenMessenger->DeclarePropertyWithUnit("isotropic_theta_min","deg",fIsotropicThetaMin,"minimum theta in isotropic direction"); + fThisGenMessenger->DeclarePropertyWithUnit("isotropic_theta_max","deg",fIsotropicThetaMax,"maximum theta in isotropic direction"); fThisGenMessenger->DeclareProperty("polarization",fPolarization,"polarization vector (will be normalized): x y z"); fThisGenMessenger->DeclareMethod("sx",&remollGenBeam::SetPolarizationX,"x component of polarization"); @@ -145,6 +151,14 @@ void remollGenBeam::SamplePhysics(remollVertex * /*vert*/, remollEvent *evt) // Start from mean direction G4ThreeVector direction(fDirection.unit()); + // Add direction range + if (fIsotropic) { + double th = acos(G4RandFlat::shoot(cos(fIsotropicThetaMax), cos(fIsotropicThetaMin))); + double ph = G4RandFlat::shoot(0.0, 2.0*pi); + direction.setTheta(th); + direction.setPhi(ph); + } + // Add a spread based on chosen model G4ThreeVector spread = GetSpread(fOriginSpread, fOriginModelX, fOriginModelY, fOriginModelZ); From 18f0b1407d579973cdee0f5523ed1e1bc9469c48 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 8 Jan 2021 10:21:03 -0600 Subject: [PATCH 266/443] [beam] /remoll/evgen/beam/originshift to move origin along direction --- include/remollGenBeam.hh | 1 + src/remollGenBeam.cc | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/remollGenBeam.hh b/include/remollGenBeam.hh index cfea33922..9a3726aab 100644 --- a/include/remollGenBeam.hh +++ b/include/remollGenBeam.hh @@ -65,6 +65,7 @@ class remollGenBeam : public remollVEventGen { G4ThreeVector fOriginSpread; EOriginModel fOriginModelX, fOriginModelY, fOriginModelZ; G4ThreeVector fDirection; + G4double fOriginShift; G4ThreeVector fCorrelation; G4ThreeVector fPolarization; diff --git a/src/remollGenBeam.cc b/src/remollGenBeam.cc index b9580779a..bd1a15ed2 100644 --- a/src/remollGenBeam.cc +++ b/src/remollGenBeam.cc @@ -27,6 +27,7 @@ remollGenBeam::remollGenBeam() fOriginModelY(kOriginModelFlat), fOriginModelZ(kOriginModelFlat), fDirection(0.0,0.0,1.0), + fOriginShift(0.0), fCorrelation(0.0653*mrad/mm,0.0653*mrad/mm,0.0), fPolarization(0.0,0.0,0.0), fRaster(5*mm,5*mm,0.0), @@ -56,6 +57,8 @@ remollGenBeam::remollGenBeam() fThisGenMessenger->DeclareMethodWithUnit("th","deg",&remollGenBeam::SetDirectionTh,"direction vector theta angle"); fThisGenMessenger->DeclareMethodWithUnit("ph","deg",&remollGenBeam::SetDirectionPh,"direction vector phi angle"); + fThisGenMessenger->DeclarePropertyWithUnit("originshift","mm",fOriginShift,"origin shift along direction vector: s unit"); + fThisGenMessenger->DeclareProperty("polarization",fPolarization,"polarization vector (will be normalized): x y z"); fThisGenMessenger->DeclareMethod("sx",&remollGenBeam::SetPolarizationX,"x component of polarization"); fThisGenMessenger->DeclareMethod("sy",&remollGenBeam::SetPolarizationY,"y component of polarization"); @@ -165,6 +168,9 @@ void remollGenBeam::SamplePhysics(remollVertex * /*vert*/, remollEvent *evt) origin += raster; origin += spread; + // Add shift to origin + origin += fOriginShift * direction; + // Override target sampling evt->fBeamE = E; evt->fBeamMomentum = p * direction; From 65f5bcd37c5e0cd9e93e590392fc46d9c961ec73 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 8 Jan 2021 10:22:21 -0600 Subject: [PATCH 267/443] [beam] if partname unknown, warn and exit instead of null pointer --- src/remollGenBeam.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/remollGenBeam.cc b/src/remollGenBeam.cc index b9580779a..7ef6c93f8 100644 --- a/src/remollGenBeam.cc +++ b/src/remollGenBeam.cc @@ -108,7 +108,14 @@ void remollGenBeam::SetPolarizationX(double sx){ fPolarization.setX(sx); } void remollGenBeam::SetPolarizationY(double sy){ fPolarization.setY(sy); } void remollGenBeam::SetPolarizationZ(double sz){ fPolarization.setZ(sz); } -void remollGenBeam::SetPartName(G4String& name){ fParticleName = name; } +void remollGenBeam::SetPartName(G4String& name){ + G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable(); + G4ParticleDefinition* particle = particleTable->FindParticle(name); + if (particle) fParticleName = name; + else { + G4cerr << "remollGenBeam: particle " << name << " not recognized." << G4endl; + exit(-1); + } G4double remollGenBeam::GetSpread(G4double spread, EOriginModel model) { From 3def7923ae0d96f967eaac10a5e185b571ee12b0 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 8 Jan 2021 10:22:53 -0600 Subject: [PATCH 268/443] [beam] missing closing brace --- src/remollGenBeam.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/remollGenBeam.cc b/src/remollGenBeam.cc index 7ef6c93f8..8a1ea3adc 100644 --- a/src/remollGenBeam.cc +++ b/src/remollGenBeam.cc @@ -116,6 +116,7 @@ void remollGenBeam::SetPartName(G4String& name){ G4cerr << "remollGenBeam: particle " << name << " not recognized." << G4endl; exit(-1); } +} G4double remollGenBeam::GetSpread(G4double spread, EOriginModel model) { From 763d58bbdce2c5881b7483524089b7056f63bd38 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 8 Jan 2021 10:40:56 -0600 Subject: [PATCH 269/443] [vis] turn off smooth trajectory due to endless memory leak warnings --- vis/vis.mac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vis/vis.mac b/vis/vis.mac index 6faeb830e..774cde3bb 100644 --- a/vis/vis.mac +++ b/vis/vis.mac @@ -31,7 +31,7 @@ # # Declare that trajectories and hits should be added to the scene # -/vis/scene/add/trajectories smooth rich +/vis/scene/add/trajectories rich /vis/scene/add/hits # From f24c7d42bd9ead5205f49b6c5d651eaa6f25e78b Mon Sep 17 00:00:00 2001 From: vdoomra <68244726+vdoomra@users.noreply.github.com> Date: Mon, 11 Jan 2021 14:52:48 -0500 Subject: [PATCH 270/443] Update beampipeDSMother.gdml --- .../beampipe/downstream/beampipeDSMother.gdml | 146 +++++++++--------- 1 file changed, 73 insertions(+), 73 deletions(-) diff --git a/geometry/beampipe/downstream/beampipeDSMother.gdml b/geometry/beampipe/downstream/beampipeDSMother.gdml index 1f4a6d671..337404d9a 100644 --- a/geometry/beampipe/downstream/beampipeDSMother.gdml +++ b/geometry/beampipe/downstream/beampipeDSMother.gdml @@ -4,8 +4,8 @@ xsi:noNamespaceSchemaLocation="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd"> - - + + - - - + + + - + - + @@ -74,12 +74,12 @@ - + - + @@ -88,17 +88,17 @@ - + - + - + @@ -113,15 +113,15 @@ - + - + - + - + @@ -156,50 +156,50 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -207,7 +207,7 @@ - + @@ -215,7 +215,7 @@ - + @@ -223,7 +223,7 @@ - + @@ -231,7 +231,7 @@ - + @@ -240,7 +240,7 @@ - + @@ -248,7 +248,7 @@ - + @@ -256,15 +256,15 @@ - + - + - + - + @@ -289,29 +289,29 @@ - - + + - - + + - - + + - - + + - - + + - - - + + + @@ -320,8 +320,8 @@ - - + + @@ -332,8 +332,8 @@ - - + + @@ -355,8 +355,8 @@ - - + + @@ -373,8 +373,8 @@ - - + + @@ -391,8 +391,8 @@ - - + + @@ -409,8 +409,8 @@ - - + + @@ -426,8 +426,8 @@ - - + + @@ -444,8 +444,8 @@ - - + + @@ -457,12 +457,12 @@ - - + + - - + + From df6b3121f8cf29bbab029fa0246bb9dd9733b548 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 11 Jan 2021 14:04:15 -0600 Subject: [PATCH 271/443] [pion] fix light leakage at corners near PMT --- geometry/pion/Lucite/pionDetectorLucite.gdml | 75 +++++++++++++------- 1 file changed, 51 insertions(+), 24 deletions(-) diff --git a/geometry/pion/Lucite/pionDetectorLucite.gdml b/geometry/pion/Lucite/pionDetectorLucite.gdml index f86ee1e2f..0681fcc5e 100644 --- a/geometry/pion/Lucite/pionDetectorLucite.gdml +++ b/geometry/pion/Lucite/pionDetectorLucite.gdml @@ -120,22 +120,31 @@ - + - - - + @@ -440,7 +449,7 @@ - + + - + - + @@ -644,30 +654,47 @@ - + + + + + + + + - - - + + + - + - + + + + + + + + + + + + + + - - - - + z="(-pionDetectorLucitePMTHousingHeight+pionDetectorLucitePMTThickness)/2.0"/> @@ -713,9 +740,9 @@ So we set to = from + 1 and use steps of 2 to get the same outcome. --> - - - + + - + @@ -216,12 +216,19 @@ - + - + + + + + + + + From 285387d01380e4dff97fa57685563276fa1c8731 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 22 Jan 2021 16:42:49 -0600 Subject: [PATCH 273/443] jlabSubmit1.py to jobs --- jlabSubmit1.py => jobs/jlabSubmit1.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename jlabSubmit1.py => jobs/jlabSubmit1.py (100%) diff --git a/jlabSubmit1.py b/jobs/jlabSubmit1.py similarity index 100% rename from jlabSubmit1.py rename to jobs/jlabSubmit1.py From 55b5626cd78070dde41b329f0b27693d6bdc0960 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 22 Jan 2021 20:12:53 -0600 Subject: [PATCH 274/443] [pion] take wedge height into account for reflector base width --- geometry/pion/Lucite/pionDetectorLucite.gdml | 22 ++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/geometry/pion/Lucite/pionDetectorLucite.gdml b/geometry/pion/Lucite/pionDetectorLucite.gdml index 0681fcc5e..e67149f8c 100644 --- a/geometry/pion/Lucite/pionDetectorLucite.gdml +++ b/geometry/pion/Lucite/pionDetectorLucite.gdml @@ -305,8 +305,10 @@ Date: Fri, 29 Jan 2021 18:34:32 -0600 Subject: [PATCH 275/443] [DetectorConstruction] use sensdet value to avoid duplicate detector number --- src/remollDetectorConstruction.cc | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/remollDetectorConstruction.cc b/src/remollDetectorConstruction.cc index f5a4c1a15..eac496989 100644 --- a/src/remollDetectorConstruction.cc +++ b/src/remollDetectorConstruction.cc @@ -809,7 +809,7 @@ void remollDetectorConstruction::ParseAuxiliarySensDetInfo() G4cout << "Beginning sensitive detector assignment" << G4endl; // Duplication map - std::map detnomap; + std::map> detnomap; // Loop over all volumes with auxiliary tags const G4GDMLAuxMapType* auxmap = fGDMLParser->GetAuxMap(); @@ -827,6 +827,8 @@ void remollDetectorConstruction::ParseAuxiliarySensDetInfo() auto it_sensdet = NextAuxWithType(list.begin(), list.end(), "SensDet"); if (it_sensdet != list.end()) { + G4String sens_det = it_sensdet->value; + // Find first aux list entry with type DetNo auto it_detno = NextAuxWithType(list.begin(), list.end(), "DetNo"); if (it_detno != list.end()) { @@ -835,24 +837,17 @@ void remollDetectorConstruction::ParseAuxiliarySensDetInfo() bool enabled = (det_no > 0)? false : true; det_no = std::abs(det_no); - // Allow detector number sharing - auto it_detnoshared = NextAuxWithType(list.begin(), list.end(), "DetNoShared"); - bool detnoshared = false; - if (it_detnoshared != list.end()) - if (it_detnoshared->value == "true") - detnoshared = true; - // Construct detector name std::stringstream det_name_ss; det_name_ss << "remoll/det_" << det_no; std::string det_name = det_name_ss.str(); // Check for duplication when not a shared detector number - if (!detnoshared && detnomap.count(det_no) != 0 && detnomap[det_no]->GetName() != myvol->GetName()) { - if (fVerboseLevel > 0) { - G4cerr << "remoll: DetNo " << det_no << " for " << myvol->GetName() << G4endl; - G4cerr << "remoll: already used by " << detnomap[det_no]->GetName() << G4endl; - } + if (detnomap.count(det_no) != 0 && detnomap[det_no].first != sens_det) { + std::string sens_det2 = detnomap[det_no].first; + G4LogicalVolume* myvol2 = detnomap[det_no].second; + G4cerr << "remoll: Detector number " << det_no << " (" << sens_det << ") " << myvol->GetName() << G4endl; + G4cerr << "remoll: already used by " << det_no << " (" << sens_det2 << ") " << myvol2->GetName() << G4endl; } // Try to find sensitive detector @@ -874,11 +869,11 @@ void remollDetectorConstruction::ParseAuxiliarySensDetInfo() // Register detector with SD manager SDman->AddNewDetector(remollsd); - detnomap[det_no] = myvol; + detnomap[det_no] = std::make_pair(sens_det, myvol); // Register detector with remollIO remollIO* io = remollIO::GetInstance(); - io->RegisterDetector(myvol->GetName(), it_sensdet->value, det_no); + io->RegisterDetector(myvol->GetName(), sens_det, det_no); } From 5b3dd179f82b251e507d456245a2ee07d920b1a3 Mon Sep 17 00:00:00 2001 From: Jonathon Mott Date: Sat, 30 Jan 2021 16:41:00 -0500 Subject: [PATCH 276/443] Updated some of the scripts and added for feature to generate the geometry automatically. The README.md for pe_studies was also updated. --- analysis/pe_studies/README.md | 5 +- analysis/pe_studies/macros/detector_vis.mac | 2 +- .../scripts/generate-baseline-geometries.sh | 72 +++++++++++++++++++ analysis/pe_studies/scripts/ref-scan.sh | 4 +- 4 files changed, 79 insertions(+), 4 deletions(-) create mode 100755 analysis/pe_studies/scripts/generate-baseline-geometries.sh diff --git a/analysis/pe_studies/README.md b/analysis/pe_studies/README.md index e50d9be93..99839d429 100644 --- a/analysis/pe_studies/README.md +++ b/analysis/pe_studies/README.md @@ -31,12 +31,14 @@ The arguments are as follows: * nameStub: "moller" (or epelastic or epinelastic) are what you should probably use here. This field is just to avoid having to parse whatever macro's name is given and is used as the remollout_NAME.root output. * cadp.csv: "cadp.csv" is the usual name of the csv file that will be used in the perl scripts in the remoll-detector-generator scripts. The file is assumed to live inside that repository, and that repository is assumed to be parallel to the current install of remoll (three levels up). +In order for the flux that is produced to be useful, edit mollerParallel.gdml to only have the detectors you want. The flat parameterized detector from the detector perl scripts should be used to interface with the full-scan.sh. + Once you have generated the outputs, please make sure that none of the individual jobs have segfaulted or failed in any way. If they have then just go and manually re-run that failed job. Once all of the jobs are done the easiest thing to do is execute `hadd -f moller.root out_moller_*/remollout_parallel_moller.root`, which merges them all into one. Because of the way that remoll samples and assigns relative weights, it is important for you to know the uA beam current that was assumed while simulating and the number of individual jobs that were `hadd` together. The rates in any one remoll job are self normalized so that that one job stands alone. `hadd` multiple jobs together will then multiply the rates higher by the multiplicity of separate jobs. Similarly if you want the rate in Hz/uA you need to later divide by the number of uA (which is 65 uA in the sameple macros given). ### scan.sh -Usage: `./scripts/scan.sh fixed-non-scanned "variable-to-scan" min-of-scan (-30) max-of-scan (30) step-size (0.5)` +Usage: `./scripts/scan.sh fixed-non-scanned "variable-to-scan" min-of-scan (-30) max-of-scan (30) step-size (0.5) Reflectivity Cerenkov Scintillation z_position Pass Detector` This script assumes that a "Geometry name" suffix'ed set of GDML files has been placed in the geometry_sandbox folder of remoll, and that the user wants to scan shooting at different positions or angles onto the light guide. The angles, x position, and z position of the beam generator are passed in as arguments. Practically speaking this script needs to just be called from within the `scripts/full-scan.sh` script, which knows to produce the GDML files itself and read the cadp.csv file to know what x and z points to shoot the beam from. The analysis requires 2 passes, to simulate and then analyze the sim outputs. And the outputs come in the scans.root output file that contains several metrics, including average number of pes and it's RMS, as well as number of bounces against the reflector, lightguide, and both, as well as the input command line parameters. @@ -60,6 +62,7 @@ This is a script that wraps around scan.sh to produce a lookup table's worth of This script assumes several files are already in place and will complain if they are not in the right places or with the right names. Do `scripts/produce.sh` and `scripts/full-scan.sh` first to properly prepare for getting the lightguide backgrounds lookup table folded into the MOLLER flux for final numbers. Please note that the "signal" size has been assumed at 12 PEs vs 25 PEs for rings 1,2,3,4, and 6, vs 5, respectively. The "background" signal is entirely determined by the lookup table coming from the `scripts/full-scan.sh` analysis. ### ref-scan.sh This is a script that will allow you to scan the reflector length and reflector angle parameters to determine the ideal size and angle of the reflector segment for ideal light collection. Parameters for cerenkov and scintillation can be turned on and off to help understand what is happening. With some care, the relflectivity of the reflector section and the light guide section could be separated from eachother and this can be used to determine the impact of blackening in the light guide section (you would need to edit the material property names or values by hand in the GDML files copied into this analysis in order for that test to be feasible, though it has been done before. See the logic surrounding the Reflectivity parameter in these scripts for guidance on how to achieve this) +This script is run similarly to scan.sh. For instructions on general parameters to enter, input ./scripts/ref-scan.sh ### sub-ref-scan.sh This script executes similarly to `scripts/ref-scan.sh`, but it loops over sub-segments of the reflector, allowing fine tuning of a fresnel-type mirror, for optimal light collection. This is just one easiest way that the light guides and reflectors can be studied in addition to the default flat segments we have started with. ### getMax.C diff --git a/analysis/pe_studies/macros/detector_vis.mac b/analysis/pe_studies/macros/detector_vis.mac index 9019f1b8a..711c393b6 100644 --- a/analysis/pe_studies/macros/detector_vis.mac +++ b/analysis/pe_studies/macros/detector_vis.mac @@ -25,7 +25,7 @@ /remoll/beamcurr 50 microampere #/remoll/optical true #/remoll/addfield CLEO_rm.dat -/control/execute vis/vis.mac +/control/execute ../../vis/vis.mac #/gun/position 0.0 0.0 -0.1 m #/gun/momentum 0.5 1.0 2.0 GeV diff --git a/analysis/pe_studies/scripts/generate-baseline-geometries.sh b/analysis/pe_studies/scripts/generate-baseline-geometries.sh new file mode 100755 index 000000000..0d36e40bc --- /dev/null +++ b/analysis/pe_studies/scripts/generate-baseline-geometries.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +# Takes 5 arguments +# +# Fixed value of non-scanned variable - default = 0.0 +# Variable to scan ("angle" or "x") - default = "angle" +# Min of scanned variable - default = -30 +# Max of scanned variable - default = 30 +# Step size - default = 0.5 + +if [ "$#" -lt 1 ] ; then + echo " ERROR, requires at least one input + " + echo " This script generates geometry from cadp.csv - feed it as an argument either \"all\" or the ring name you want to specifically create (\"R5o\", etc.) + " + exit +fi + + +geom=$1 +user_ring="5.0" +script_ring="5" +if [[ $geom == "R1" ]] ; then + user_ring="1" + script_ring="1" +elif [[ $geom == "R2" ]] ; then + user_ring="2" + script_ring="2" +elif [[ $geom == "R3" ]] ; then + user_ring="3" + script_ring="3" +elif [[ $geom == "R4" ]] ; then + user_ring="4" + script_ring="4" +elif [[ $geom == "R5o" ]] ; then + user_ring="5.0" + script_ring="5" +elif [[ $geom == "R5t" ]] ; then + user_ring="5.1" + script_ring="5trans" +elif [[ $geom == "R5c" ]] ; then + user_ring="5.2" + script_ring="5closed" +elif [[ $geom == "R6" ]] ; then + user_ring="6" + script_ring="6" +fi + +cd ../../../remoll-detector-generator/ +outString="" +OLDIFS=$IFS +IFS="," +while read ring qR qL overlap qThick num2 num3 refL ref_angle lg_angle pmtR tilt pmtRad wallThickness extraPMT1 extraPMT2 z1 z2 +do + if [[ $ring != $user_ring ]] ; then + outString="$outString + $ring,$qR,$qL,$overlap,$qThick,$num2,$num3,$refL,$ref_angle,$lg_angle,$pmtR,$tilt,$pmtRad,$wallThickness,$extraPMT1,$extraPMT2,$z1,$z2" + continue + fi + outString="$outString + $ring,$qR,$qL,$overlap,$qThick,$num2,$num3,$refL,$ref_angle,$lg_angle,$pmtR,$tilt,$pmtRad,$wallThickness,$extraPMT1,$extraPMT2,$z1,$z2" +done < cadp.csv +IFS=$OLDIFS + +echo "$outString" > cadp_${geom}.csv +perl cadGeneratorV1.pl -F cadp_${geom}.csv +perl gdmlGeneratorV1_materials.pl -M detectorMotherP.csv -D parameter.csv -P qe.txt -U UVS_45total.txt -R MylarRef.txt -L ${script_ring} -T _${geom} + +cd - +cp -p ../../../remoll-detector-generator/materialsOptical.xml ../../geometry_sandbox +mv ../../../remoll-detector-generator/cadp_${geom}.csv ../../geometry_sandbox +mv ../../../remoll-detector-generator/*${geom}.* ../../geometry_sandbox diff --git a/analysis/pe_studies/scripts/ref-scan.sh b/analysis/pe_studies/scripts/ref-scan.sh index 01cdc11c3..6158794a1 100755 --- a/analysis/pe_studies/scripts/ref-scan.sh +++ b/analysis/pe_studies/scripts/ref-scan.sh @@ -2,7 +2,7 @@ # Takes 5 arguments # -# Fixed value of non-scanned variable - default = 0.0 +# Fixed value of non-scanned variable - default = 80.0 # Variable to scan ("angle" or "x") - default = "angle" # Min of scanned variable - default = -30 # Max of scanned variable - default = 30 @@ -16,7 +16,7 @@ if [ "$#" -lt 1 ] ; then echo " usage: ./ref-scan.sh fixed-non-scanned \"variable-to-scan\" min-of-scan (0) max-of-scan (30) step-size (1.0) Takes 10 arguments - Fixed value of non-scanned variable - default = 0.0 + Fixed value of non-scanned variable - default = 80.0 Variable to scan (\"angle\" or \"x\") - default = \"angle\" Min of scanned variable - default = 0 Max of scanned variable - default = 30 From 25e116da1e3c3ad68f07b66e630d3b44c83f31d1 Mon Sep 17 00:00:00 2001 From: Yug34 Date: Fri, 5 Feb 2021 00:48:00 +0530 Subject: [PATCH 277/443] Fix: Locating map files correctly --- CMakeLists.txt | 2 +- macros/runexample.mac | 2 +- remoll.cc | 7 +++++-- src/remollMagneticField.cc | 7 +++++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 444960212..857dc4c1b 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -362,7 +362,7 @@ foreach(MAP IN LISTS REMOLL_MAPS REMOLL_MAPS_EXTRA) ) install(FILES ${REMOLL_MAP_DIR}/${FILE}.gz - DESTINATION ${CMAKE_INSTALL_DATADIR}/remoll) + DESTINATION ${CMAKE_INSTALL_DATADIR}/remoll/map_directory) else() file(DOWNLOAD ${REMOLL_DOWNLOADS}/${FILE} diff --git a/macros/runexample.mac b/macros/runexample.mac index 36bfe7650..e08bb0922 100644 --- a/macros/runexample.mac +++ b/macros/runexample.mac @@ -71,7 +71,7 @@ # Make interactions with W, Cu, and Pb # realistic rather than pure absorbers -/control/execute macros/kryptonite.mac +# /control/execute macros/kryptonite.mac /process/list diff --git a/remoll.cc b/remoll.cc index 77d2e6f60..66e72415a 100644 --- a/remoll.cc +++ b/remoll.cc @@ -157,12 +157,15 @@ int main(int argc, char** argv) { G4cout << "remoll: see also https://github.com/JeffersonLab/remoll/issues/130" << G4endl; #endif + // Define UI session for interactive mode + G4String searchpath = std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll"; + searchpath += ":" + std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/macros"; if (macro.size()) { // Run in batch mode // Copy contents of macro into buffer to be written out into ROOT file - UImanager->SetMacroSearchPath(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/macros"); + UImanager->SetMacroSearchPath(searchpath); UImanager->ParseMacroSearchPath(); remollRun::GetRunData()->SetMacroFile((remollSearchPath::resolve(macro)).c_str()); UImanager->ExecuteMacroFile((remollSearchPath::resolve(macro)).c_str()); @@ -170,7 +173,7 @@ int main(int argc, char** argv) { // Define UI session for interactive mode G4UIExecutive* ui = new G4UIExecutive(argc,argv,session); if (ui->IsGUI()) { - UImanager->SetMacroSearchPath(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/macros"); + UImanager->SetMacroSearchPath(searchpath); UImanager->ParseMacroSearchPath(); UImanager->ExecuteMacroFile((remollSearchPath::resolve("macros/gui.mac")).c_str()); } diff --git a/src/remollMagneticField.cc b/src/remollMagneticField.cc index a5d16ebaa..6265b5003 100644 --- a/src/remollMagneticField.cc +++ b/src/remollMagneticField.cc @@ -30,7 +30,7 @@ remollMagneticField::remollMagneticField( G4String filename ){ fName = filename; - fFilename = remollSearchPath::resolve(filename); + fFilename = filename; // Initialize grid variables for( int cidx = kR; cidx < kZ; cidx++ ){ @@ -144,6 +144,7 @@ void remollMagneticField::ReadFieldMap(){ boost::iostreams::filtering_istream inputfile; // If the filename has .gz somewhere (hopefully the end) if (fFilename.find(".gz") != std::string::npos) { + fFilename = remollSearchPath::resolve(fFilename); boost::iostreams::file_source source_gz(fFilename); if (source_gz.is_open()) { // Add gzip decompressor to stream @@ -156,7 +157,8 @@ void remollMagneticField::ReadFieldMap(){ } } else { // Try to add .gz at end of filename - boost::iostreams::file_source source_gz(fFilename + ".gz"); + fFilename = remollSearchPath::resolve(fFilename + ".gz"); + boost::iostreams::file_source source_gz(fFilename); if (source_gz.is_open()) { // Add gzip decompressor to stream inputfile.push(boost::iostreams::gzip_decompressor()); @@ -183,6 +185,7 @@ void remollMagneticField::ReadFieldMap(){ exit(1); } // Set file as source + fFilename = remollSearchPath::resolve(fFilename); inputfile.open(fFilename.data()); #endif From 7544f85c2f8d30ced00989853b70c9f3b27b21c3 Mon Sep 17 00:00:00 2001 From: Yug34 Date: Fri, 5 Feb 2021 00:52:12 +0530 Subject: [PATCH 278/443] Uncommented a line --- macros/runexample.mac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/runexample.mac b/macros/runexample.mac index e08bb0922..36bfe7650 100644 --- a/macros/runexample.mac +++ b/macros/runexample.mac @@ -71,7 +71,7 @@ # Make interactions with W, Cu, and Pb # realistic rather than pure absorbers -# /control/execute macros/kryptonite.mac +/control/execute macros/kryptonite.mac /process/list From 5a7a2429e407d04512ad4013fdd7c9472cd908ab Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 4 Feb 2021 15:29:29 -0500 Subject: [PATCH 279/443] [hotfix] avoid boost::iostreams --- CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 444960212..8d7f1d993 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,7 +92,7 @@ if(Boost_FOUND) ADD_DEFINITIONS(-D__USE_BOOST) if(Boost_IOSTREAMS_FOUND) message(STATUS "Boost::iostreams found --> building with boost::iostreams enabled.") - ADD_DEFINITIONS(-D__USE_BOOST_IOSTREAMS) + #ADD_DEFINITIONS(-D__USE_BOOST_IOSTREAMS) endif() if(Boost_FILESYSTEM_FOUND) message(STATUS "Boost::filesystem found --> building with boost::filesystem enabled.") @@ -363,7 +363,8 @@ foreach(MAP IN LISTS REMOLL_MAPS REMOLL_MAPS_EXTRA) install(FILES ${REMOLL_MAP_DIR}/${FILE}.gz DESTINATION ${CMAKE_INSTALL_DATADIR}/remoll) - else() + endif() + #else() file(DOWNLOAD ${REMOLL_DOWNLOADS}/${FILE} ${REMOLL_MAP_DIR}/${FILE} @@ -372,7 +373,7 @@ foreach(MAP IN LISTS REMOLL_MAPS REMOLL_MAPS_EXTRA) install(FILES ${REMOLL_MAP_DIR}/${FILE} DESTINATION ${CMAKE_INSTALL_DATADIR}/remoll) - endif() + #endif() endforeach() From 5909ee4a53fb11db215d2c7db0da2381ff73d47e Mon Sep 17 00:00:00 2001 From: Yug34 Date: Thu, 18 Feb 2021 00:20:32 +0530 Subject: [PATCH 280/443] Correctly set map directory as source --- src/remollMagneticField.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/remollMagneticField.cc b/src/remollMagneticField.cc index 6265b5003..de1f551a3 100644 --- a/src/remollMagneticField.cc +++ b/src/remollMagneticField.cc @@ -185,7 +185,7 @@ void remollMagneticField::ReadFieldMap(){ exit(1); } // Set file as source - fFilename = remollSearchPath::resolve(fFilename); + fFilename = remollSearchPath::resolve(std::string(fFilename)); inputfile.open(fFilename.data()); #endif From 76d5b2721c3941c1180ce25dad72f5807a0c7396 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 19 Feb 2021 13:04:08 -0600 Subject: [PATCH 281/443] [donut] Allow for unequal outer concrete/lead radii --- geometry/donut/donutConcreteLead.gdml | 77 +++++++++++++++++---------- 1 file changed, 48 insertions(+), 29 deletions(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 7a7c9c30c..dbbe14be4 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -307,10 +307,9 @@ - + + +
@@ -322,12 +321,12 @@ y="(donutIBeamFrameHeightTop-donutTopSupportThickness)"/> -
@@ -340,18 +339,18 @@ y="(donutIBeamFrameHeightTop-donutTopSupportThickness)"/> -
- + + -
@@ -426,12 +428,12 @@ y="(donutIBeamFrameHeightBot+donutBotSupportThickness)"/> -
@@ -444,18 +446,18 @@ y="(donutIBeamFrameHeightBot+donutBotSupportThickness)"/> -
- + + - + + + + + - + @@ -636,9 +645,13 @@ - + - + + + + + @@ -780,8 +793,11 @@ - - + + + + + @@ -831,8 +847,11 @@ - - + + + + + From a5a68815f3932b49285910a01142f67267ec8fe1 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 19 Feb 2021 14:05:09 -0600 Subject: [PATCH 282/443] [donut] Allow for unequal outer concrete/lead radii --- geometry/donut/donutConcreteLead.gdml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index dbbe14be4..ac6e42580 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -307,9 +307,9 @@ - + - +
@@ -324,7 +324,7 @@ + y="sqrt((max(donutLeadOuterRadiusUS,donutConcreteOuterRadiusDS)-0.1+donutSleeveThickness+donutTopSupportThickness)^2-(donutTopSupportInnerRibDistance/2)^2)+donutTopSupportThickness/2"/> + y="sqrt((max(donutLeadOuterRadiusUS,donutConcreteOuterRadiusDS)-0.1+donutSleeveThickness+donutTopSupportThickness)^2-(donutTopSupportOuterRibDistance/2)^2)+donutTopSupportThickness/2"/> + y="-(donutLeadOuterRadiusUS+donutSleeveThickness+donutBotSupportThickness)-0.1"/> + y="-(donutConcreteOuterRadiusDS+donutSleeveThickness+donutBotSupportThickness)-0.1"/>
@@ -431,7 +431,7 @@ + y="-sqrt((max(donutLeadOuterRadiusUS,donutConcreteOuterRadiusDS)-0.1+donutSleeveThickness+donutBotSupportThickness)^2-(donutBotSupportInnerRibDistance/2)^2)-donutBotSupportThickness/2"/> + y="-sqrt((max(donutLeadOuterRadiusUS,donutConcreteOuterRadiusDS)-0.1+donutSleeveThickness+donutBotSupportThickness)^2-(donutBotSupportOuterRibDistance/2)^2)-donutBotSupportThickness/2"/> - - + + + From 24b555afc3ec6889e644ec774807d1816f370bd0 Mon Sep 17 00:00:00 2001 From: Chandan Ghosh Date: Mon, 22 Feb 2021 14:12:33 -0500 Subject: [PATCH 283/443] modified collimator 5 to avoid interception with moller particles --- geometry/hybrid/hybridToroid.gdml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/geometry/hybrid/hybridToroid.gdml b/geometry/hybrid/hybridToroid.gdml index f7ba7b09c..4b69643b3 100644 --- a/geometry/hybrid/hybridToroid.gdml +++ b/geometry/hybrid/hybridToroid.gdml @@ -35,10 +35,10 @@ - + - +
@@ -2445,4 +2445,4 @@ - \ No newline at end of file + From f20afd30d02180e8672fca3e6418d726b52164a7 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 22 Feb 2021 16:54:28 -0600 Subject: [PATCH 284/443] [donut] allow for shifting concrete and lead independently --- geometry/donut/donutConcreteLead.gdml | 190 ++++++++++++++------------ 1 file changed, 99 insertions(+), 91 deletions(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index ac6e42580..1e2bb533f 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -18,28 +18,26 @@ + + + + - - - - - - @@ -199,19 +197,19 @@ - - + + - + + z="donutConcreteStart+donutVirtualDetectorThickness"/> @@ -221,35 +219,35 @@ rmax="donutConcreteOuterRadiusDS -donutVirtualDetectorThickness/donutConcreteThickness *(donutConcreteOuterRadiusDS-donutConcreteOuterRadiusUS)" - z="donutConcreteThickness-donutVirtualDetectorThickness"/> - + z="donutConcreteEnd-donutVirtualDetectorThickness"/> + - - + + - - + + - - + + - + + z="donutLeadStart+donutVirtualDetectorThickness"/> @@ -259,18 +257,18 @@ rmax="donutLeadOuterRadiusDS -donutVirtualDetectorThickness/donutLeadThickness *(donutLeadOuterRadiusDS-donutLeadOuterRadiusUS)" - z="donutLeadThickness-donutVirtualDetectorThickness"/> - + z="donutLeadEnd-donutVirtualDetectorThickness"/> + - - + + - - + + @@ -304,48 +302,55 @@ y="-(donutIBeamFrameHeightTop-donutTopSupportThickness)/2"/> - - - - - - - + + + + + + +
- - - - - - -
- - - - - - -
@@ -355,22 +360,22 @@ + z="donutConcreteStart"/> + z="donutConcreteEnd"/> + z="donutLeadStart"/> + z="donutLeadEnd"/> @@ -404,55 +409,55 @@ y="-(donutIBeamFrameHeightBot+donutBotSupportThickness)/2"/> - - - - - - -
- - - - - - -
- - - - - - -
@@ -462,35 +467,44 @@ + z="donutConcreteStart"/> + z="donutConcreteEnd"/> + z="donutLeadStart"/> + z="donutLeadEnd"/> - - - - - - - - - + + + + + + + + +
@@ -722,29 +736,23 @@ - - - - - - From 97bf5daf33a4e91235ae40688b00e8c0b13f7959 Mon Sep 17 00:00:00 2001 From: Yug34 <53560276+Yug34@users.noreply.github.com> Date: Wed, 24 Feb 2021 00:37:09 +0530 Subject: [PATCH 285/443] [searchPath] Fix map directory --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 67a9fe865..9ae2295e6 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -372,7 +372,7 @@ foreach(MAP IN LISTS REMOLL_MAPS REMOLL_MAPS_EXTRA) ) install(FILES ${REMOLL_MAP_DIR}/${FILE} - DESTINATION ${CMAKE_INSTALL_DATADIR}/remoll) + DESTINATION ${CMAKE_INSTALL_DATADIR}/remoll/map_directory) #endif() endforeach() From 10547646306ed0189250a241babba8719875df71 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 25 Feb 2021 14:04:47 -0600 Subject: [PATCH 286/443] [docker] tini `-s` first instead of after `--` --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5301eb259..b8b00618a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -56,6 +56,6 @@ RUN ln -sf $REMOLL/bin/remoll.sh /etc/profile.d/remoll.sh COPY docker/jlab.sh /jlab/${JLAB_VERSION}/ce/jlab.sh # Entry point loads the environment -ENTRYPOINT ["/tini", "--", "bash", "-c", "source /etc/profile && \"$@\"", "-s"] +ENTRYPOINT ["/tini", "-s", "--", "bash", "-c", "source /etc/profile && \"$@\""] CMD ["remoll"] From 517f67760a7e1e1c14711c0f55f3522ac238339a Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 24 Feb 2021 15:38:23 -0600 Subject: [PATCH 287/443] [target] solid target ladder --- geometry/target/targetLadder.gdml | 234 ++++++++++++++++++++++++++++++ 1 file changed, 234 insertions(+) create mode 100644 geometry/target/targetLadder.gdml diff --git a/geometry/target/targetLadder.gdml b/geometry/target/targetLadder.gdml new file mode 100644 index 000000000..2b02bfa0d --- /dev/null +++ b/geometry/target/targetLadder.gdml @@ -0,0 +1,234 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 1de500f266794317349d0673a02360033b0b53c9 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 4 Mar 2021 11:51:47 -0600 Subject: [PATCH 288/443] [pion] shield DS and IN into pionDetectorLuciteSector --- geometry/pion/Lucite/pionDetectorLucite.gdml | 53 ----------------- .../pion/Lucite/pionDetectorLuciteSector.gdml | 57 ++++++++++++++++++- 2 files changed, 54 insertions(+), 56 deletions(-) diff --git a/geometry/pion/Lucite/pionDetectorLucite.gdml b/geometry/pion/Lucite/pionDetectorLucite.gdml index 56a5a6160..8d28d4114 100644 --- a/geometry/pion/Lucite/pionDetectorLucite.gdml +++ b/geometry/pion/Lucite/pionDetectorLucite.gdml @@ -40,16 +40,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml index 98399ccce..bc508f23b 100644 --- a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml +++ b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml @@ -51,6 +51,23 @@ with half the height (radial dimension) of the lucite blocks. --> + + + + + + + + + + + + + + @@ -67,10 +84,44 @@ rmax="pionDetectorLuciteOuterRadius" z="pionDetectorLuciteLength" startphi="0" deltaphi="360.0" aunit="deg"/> + + + - + + + + + + + + + + + + + + @@ -85,7 +136,7 @@ - + @@ -95,7 +146,7 @@ - + From ff91c2d935b25fa6cabb6be4cce4e43af4e6a307 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 8 Mar 2021 21:10:15 -0600 Subject: [PATCH 289/443] [donut] center support flange at concrete/lead interface --- geometry/donut/donutConcreteLead.gdml | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index 1e2bb533f..d4689a7b5 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -275,7 +275,7 @@ + z="donutLeadEnd-donutConcreteStart"/> @@ -382,7 +382,7 @@ + z="donutLeadEnd-donutConcreteStart"/> @@ -758,24 +758,24 @@ - + - + - + - + - + @@ -812,24 +812,24 @@ - + - + - + - + - + From c9122f7cafda7739d85e532f0803a340c92a3d4b Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 11 Mar 2021 18:38:21 -0600 Subject: [PATCH 290/443] [run_data] fprintf->G4cerr; std::string fRunPath, fHostName --- include/remollRunData.hh | 4 ++-- src/remollRunData.cc | 21 +++++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/include/remollRunData.hh b/include/remollRunData.hh index 3c87f01a0..a76f9fd5b 100644 --- a/include/remollRunData.hh +++ b/include/remollRunData.hh @@ -51,9 +51,9 @@ class remollRunData : public TObject { long int fSeed; double fBeamE; char fGenName[__RUNSTR_LEN]; + std::string fRunPath; - char fHostName[__RUNSTR_LEN]; - char fRunPath[__RUNSTR_LEN]; + std::string fHostName; remollTextFile fMacro; std::vector fGDMLFiles; diff --git a/src/remollRunData.cc b/src/remollRunData.cc index 02feca767..0e341e4be 100644 --- a/src/remollRunData.cc +++ b/src/remollRunData.cc @@ -29,13 +29,22 @@ void remollRunData::Init() fNthrown = 0; fBeamE = 0; strcpy(fGenName, "default"); - if(gethostname(fHostName,__RUNSTR_LEN) == -1){ - fprintf(stderr, "%s line %d: ERROR could not get hostname\n", __PRETTY_FUNCTION__ , __LINE__ ); - fprintf(stderr, "%s\n",strerror(errno)); + const unsigned int length = 128; + + char hostname[length]; + if (gethostname(hostname, length) == -1) { + G4cerr << "Error: " << __PRETTY_FUNCTION__ << " line " << __LINE__ << ": " + << "could not get hostname" << G4endl; + } else { + fHostName = hostname; } - if(getcwd(fRunPath,__RUNSTR_LEN) == NULL){ - fprintf(stderr, "%s line %d: ERROR could not get current working directory\n", __PRETTY_FUNCTION__ , __LINE__ ); - fprintf(stderr, "%s\n",strerror(errno)); + + char runpath[length]; + if (getcwd(runpath, length) == NULL) { + G4cerr << "Error: " << __PRETTY_FUNCTION__ << " line " << __LINE__ << ": " + << "could not get current working directory" << G4endl; + } else { + fRunPath = runpath; } } From e92295601b236ee323a5cebad13d78e4e40ffbb9 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 11 Mar 2021 18:40:40 -0600 Subject: [PATCH 291/443] [run_data] store gGitInfo in fGitInfo; ClassDef version ++ --- include/remollRunData.hh | 3 ++- src/remollRunData.cc | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/remollRunData.hh b/include/remollRunData.hh index a76f9fd5b..d4473038a 100644 --- a/include/remollRunData.hh +++ b/include/remollRunData.hh @@ -45,6 +45,7 @@ class remollRunData : public TObject { void Print(); + std::string fGitInfo; TTimeStamp fRunTime; long int fNthrown; @@ -60,7 +61,7 @@ class remollRunData : public TObject { std::vector fMagData; - ClassDef(remollRunData, 1); + ClassDef(remollRunData, 2); }; #endif//__REMOLLRUNDATA_HH diff --git a/src/remollRunData.cc b/src/remollRunData.cc index 0e341e4be..33d08cda3 100644 --- a/src/remollRunData.cc +++ b/src/remollRunData.cc @@ -29,6 +29,8 @@ void remollRunData::Init() fNthrown = 0; fBeamE = 0; strcpy(fGenName, "default"); + fGitInfo = gGitInfo; + const unsigned int length = 128; char hostname[length]; @@ -52,7 +54,7 @@ void remollRunData::Print() { G4cout << "git repository info" << G4endl; G4cout << "-------------------------------------------------" << G4endl; - G4cout << gGitInfo << G4endl; + G4cout << fGitInfo << G4endl; G4cout << "-------------------------------------------------" << G4endl; G4cout << "Run at " << fRunTime.AsString("ls") << " on " << fHostName << G4endl; G4cout << "Run Path " << fRunPath << G4endl;; From 5b6bf267882b42e148460e471b436d6fa2a46be8 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 11 Mar 2021 18:42:07 -0600 Subject: [PATCH 292/443] [run_data] remove fGenName (is in macro) --- include/remollRunData.hh | 3 --- src/remollPrimaryGeneratorAction.cc | 2 -- src/remollRunData.cc | 3 --- 3 files changed, 8 deletions(-) diff --git a/include/remollRunData.hh b/include/remollRunData.hh index d4473038a..e60690fc3 100644 --- a/include/remollRunData.hh +++ b/include/remollRunData.hh @@ -28,8 +28,6 @@ class remollRunData : public TObject { void Init(); - void SetGenName(const char *n){ strcpy(fGenName, n); } - const char *GetGenName(){ return fGenName; } void SetBeamE(double E){ fBeamE = E; } void SetSeed(unsigned long int seed){ fSeed = seed; } @@ -51,7 +49,6 @@ class remollRunData : public TObject { long int fNthrown; long int fSeed; double fBeamE; - char fGenName[__RUNSTR_LEN]; std::string fRunPath; std::string fHostName; diff --git a/src/remollPrimaryGeneratorAction.cc b/src/remollPrimaryGeneratorAction.cc index 50f3873f3..201607f57 100644 --- a/src/remollPrimaryGeneratorAction.cc +++ b/src/remollPrimaryGeneratorAction.cc @@ -131,8 +131,6 @@ void remollPrimaryGeneratorAction::SetGenerator(G4String& genname) if (fEventGen) { fEventGen->SetBeamTarget(fBeamTarg); } - - remollRun::GetRunData()->SetGenName(genname.data()); } void remollPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) diff --git a/src/remollRunData.cc b/src/remollRunData.cc index 33d08cda3..1e20952e7 100644 --- a/src/remollRunData.cc +++ b/src/remollRunData.cc @@ -17,7 +17,6 @@ remollRunData::remollRunData() fSeed = 0; fNthrown = -1; fBeamE = -1e9; - fGenName[0] = '\0'; fHostName[0] = '\0'; } @@ -28,7 +27,6 @@ void remollRunData::Init() { fNthrown = 0; fBeamE = 0; - strcpy(fGenName, "default"); fGitInfo = gGitInfo; const unsigned int length = 128; @@ -60,7 +58,6 @@ void remollRunData::Print() G4cout << "Run Path " << fRunPath << G4endl;; G4cout << "N generated = " << fNthrown << G4endl; G4cout << "Beam Energy = " << fBeamE << "GeV" << G4endl; - G4cout << "Generator = " << fGenName << G4endl; G4cout << "Field maps:" << G4endl; for (unsigned int i = 0; i < fMagData.size(); i++ ){ From c97cb3e7e7a94e28daa011fd064676ecd2c467b0 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 11 Mar 2021 18:42:46 -0600 Subject: [PATCH 293/443] [run_data] std::string fHostName needs no null termination --- src/remollRunData.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/remollRunData.cc b/src/remollRunData.cc index 1e20952e7..4b8cd195b 100644 --- a/src/remollRunData.cc +++ b/src/remollRunData.cc @@ -17,7 +17,6 @@ remollRunData::remollRunData() fSeed = 0; fNthrown = -1; fBeamE = -1e9; - fHostName[0] = '\0'; } remollRunData::~remollRunData(){ From a2901c20e196698167ea1a5911cb5389b22063bd Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 11 Mar 2021 18:43:17 -0600 Subject: [PATCH 294/443] [run_data] no TGeoManager needed --- include/remollRunData.hh | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/remollRunData.hh b/include/remollRunData.hh index e60690fc3..60324fb2e 100644 --- a/include/remollRunData.hh +++ b/include/remollRunData.hh @@ -15,8 +15,6 @@ * stream */ -class TGeoManager; - class remollRunData : public TObject { using TObject::Print; public: From 9202b98920c27d9627d7717de268ea3a45d50a64 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 11 Mar 2021 18:44:53 -0600 Subject: [PATCH 295/443] [run_data] ctor/dtor simplification --- include/remollRunData.hh | 4 ++-- src/remollRunData.cc | 10 ---------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/include/remollRunData.hh b/include/remollRunData.hh index 60324fb2e..bdea15d10 100644 --- a/include/remollRunData.hh +++ b/include/remollRunData.hh @@ -18,8 +18,8 @@ class remollRunData : public TObject { using TObject::Print; public: - remollRunData(); - virtual ~remollRunData(); + remollRunData() { }; + virtual ~remollRunData() { }; unsigned long long int GetNthrown(){ return fNthrown; } void SetNthrown(unsigned long long int n){ fNthrown = n; } diff --git a/src/remollRunData.cc b/src/remollRunData.cc index 4b8cd195b..4afbba78a 100644 --- a/src/remollRunData.cc +++ b/src/remollRunData.cc @@ -12,16 +12,6 @@ // External objects extern const char* const gGitInfo; -remollRunData::remollRunData() -{ - fSeed = 0; - fNthrown = -1; - fBeamE = -1e9; -} - -remollRunData::~remollRunData(){ -} - void remollRunData::Init() { fNthrown = 0; From 26139317a7cd0e29e019c0fe1b8976206db8426c Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 11 Mar 2021 18:45:22 -0600 Subject: [PATCH 296/443] [run_data] remove fBeamE --- include/remollRunData.hh | 1 - src/remollRunData.cc | 2 -- 2 files changed, 3 deletions(-) diff --git a/include/remollRunData.hh b/include/remollRunData.hh index bdea15d10..e214e8cfa 100644 --- a/include/remollRunData.hh +++ b/include/remollRunData.hh @@ -46,7 +46,6 @@ class remollRunData : public TObject { long int fNthrown; long int fSeed; - double fBeamE; std::string fRunPath; std::string fHostName; diff --git a/src/remollRunData.cc b/src/remollRunData.cc index 4afbba78a..212c4bdba 100644 --- a/src/remollRunData.cc +++ b/src/remollRunData.cc @@ -15,7 +15,6 @@ extern const char* const gGitInfo; void remollRunData::Init() { fNthrown = 0; - fBeamE = 0; fGitInfo = gGitInfo; const unsigned int length = 128; @@ -46,7 +45,6 @@ void remollRunData::Print() G4cout << "Run at " << fRunTime.AsString("ls") << " on " << fHostName << G4endl; G4cout << "Run Path " << fRunPath << G4endl;; G4cout << "N generated = " << fNthrown << G4endl; - G4cout << "Beam Energy = " << fBeamE << "GeV" << G4endl; G4cout << "Field maps:" << G4endl; for (unsigned int i = 0; i < fMagData.size(); i++ ){ From da04a3baecb315cc152d6db3d3dde5f1b21d4f19 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 11 Mar 2021 18:46:09 -0600 Subject: [PATCH 297/443] [run_data] init fSeed to 0 --- src/remollRunData.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/remollRunData.cc b/src/remollRunData.cc index 212c4bdba..3c0ab1eba 100644 --- a/src/remollRunData.cc +++ b/src/remollRunData.cc @@ -15,6 +15,8 @@ extern const char* const gGitInfo; void remollRunData::Init() { fNthrown = 0; + fSeed = 0; + fGitInfo = gGitInfo; const unsigned int length = 128; @@ -43,7 +45,7 @@ void remollRunData::Print() G4cout << fGitInfo << G4endl; G4cout << "-------------------------------------------------" << G4endl; G4cout << "Run at " << fRunTime.AsString("ls") << " on " << fHostName << G4endl; - G4cout << "Run Path " << fRunPath << G4endl;; + G4cout << "Run path " << fRunPath << G4endl; G4cout << "N generated = " << fNthrown << G4endl; G4cout << "Field maps:" << G4endl; From 0dc20aa5c480bb0c45711d88309c5c96b0093c81 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 11 Mar 2021 18:47:45 -0600 Subject: [PATCH 298/443] [run_data] reorg of header; added some getters; private member fields --- include/remollRunData.hh | 54 +++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/include/remollRunData.hh b/include/remollRunData.hh index e214e8cfa..03a10b777 100644 --- a/include/remollRunData.hh +++ b/include/remollRunData.hh @@ -21,39 +21,59 @@ class remollRunData : public TObject { remollRunData() { }; virtual ~remollRunData() { }; - unsigned long long int GetNthrown(){ return fNthrown; } - void SetNthrown(unsigned long long int n){ fNthrown = n; } + void Init(); - void Init(); + void Print(); + private: + std::vector fMagData; + public: + void AddMagData(filedata_t d) { fMagData.push_back(d); } - void SetBeamE(double E){ fBeamE = E; } - void SetSeed(unsigned long int seed){ fSeed = seed; } + private: + remollTextFile fMacro; + public: + void SetMacroFile(const char *fn) { fMacro = remollTextFile(fn); } - void AddMagData(filedata_t d){fMagData.push_back(d);} - void SetMacroFile(const char *fn){ fMacro = remollTextFile(fn); } + private: + std::vector fGDMLFiles; + public: void AddGDMLFile(const char *fn); + remollTextFile GetGDMLFile(int i) const { return fGDMLFiles[i]; } void ClearGDMLFiles(){ fGDMLFiles.clear(); } - void RecreateGDML(const char *adir = NULL, bool clobber = false); - remollTextFile GetGDMLFile(int i){ return fGDMLFiles[i]; } + private: + long int fNthrown; + public: + void SetNthrown(unsigned long long int n) { fNthrown = n; } + unsigned long long int GetNthrown() const { return fNthrown; } - void Print(); + private: + long int fSeed; + public: + void SetSeed(unsigned long int seed) { fSeed = seed; } + unsigned long long int GetSeed() const { return fSeed; } + private: std::string fGitInfo; + public: + std::string GetGitInfo() const { return fGitInfo; } + + private: TTimeStamp fRunTime; + public: + TTimeStamp GetRunTime() const { return fRunTime; } - long int fNthrown; - long int fSeed; + private: std::string fRunPath; + public: + std::string GetRunPath() const { return fRunPath; } + private: std::string fHostName; - - remollTextFile fMacro; - std::vector fGDMLFiles; - - std::vector fMagData; + public: + std::string GetHostName() const { return fHostName; } ClassDef(remollRunData, 2); }; From a9d0e441e4812d4718432af7ec172ee1b4e14a0e Mon Sep 17 00:00:00 2001 From: Yug34 Date: Fri, 12 Mar 2021 16:52:42 +0530 Subject: [PATCH 299/443] [searchPath] Changed the order of dirs in which remoll looks for files --- src/remollSearchPath.cc | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/remollSearchPath.cc b/src/remollSearchPath.cc index b64263567..af2a048f4 100644 --- a/src/remollSearchPath.cc +++ b/src/remollSearchPath.cc @@ -24,26 +24,26 @@ remollSearchPath::~remollSearchPath() {} void remollSearchPath::add(const std::string& path) { #ifndef NO_FS_SUPPORT - // If directory to search in is inside CMAKE_INSTALL_PREFIX - if(fs::exists(fs::path(std::string(CMAKE_INSTALL_PREFIX) + "/" + path))) { - fSearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_PREFIX) + "/" + path)); - } - else if(fs::exists(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/" + path))) { - fSearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/" + path)); - } - // If directory to search in is inside CMAKE_INSTALL_FULL_DATADIR - else if(fs::exists(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/" + path))) { - fSearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/" + path)); - } - // If directory to search in is inside the current working directory - else if(fs::exists(fs::path(std::string(get_current_dir_name()) + "/" + path))) { - fSearchPath.push_back(fs::path(get_current_dir_name()) / path); - } - // Path not relative to CMAKE_INSTALL_PREFIX, CMAKE_INSTALL_FULL_DATADIR or CWD - // path is probably an absolute path - else if (fs::exists(fs::path(path))) { - fSearchPath.push_back(fs::path(path)); - } + // Check if path is an absolute path + if (fs::exists(fs::path(path))) { + fSearchPath.push_back(fs::path(path)); + } + // Check if the directory to search in is inside the current working directory + else if(fs::exists(fs::path(std::string(get_current_dir_name()) + "/" + path))) { + fSearchPath.push_back(fs::path(get_current_dir_name()) / path); + } + // Check if directory to search in is inside CMAKE_INSTALL_PREFIX + if(fs::exists(fs::path(std::string(CMAKE_INSTALL_PREFIX) + "/" + path))) { + fSearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_PREFIX) + "/" + path)); + } + // Check if directory to search in is inside CMAKE_INSTALL_FULL_DATADIR + else if(fs::exists(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/" + path))) { + SearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/" + path)); + } + // Check if directory to search in is inside CMAKE_INSTALL_FULL_DATADIR/remoll/ + else(fs::exists(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/" + path))) { + fSearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/" + path)); + } #endif } From 904e1956071c3dbb7bfc63c691d5c84a502c5d0f Mon Sep 17 00:00:00 2001 From: Yug34 Date: Fri, 12 Mar 2021 16:56:00 +0530 Subject: [PATCH 300/443] Fixed syntax error --- src/remollSearchPath.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/remollSearchPath.cc b/src/remollSearchPath.cc index af2a048f4..ace38b216 100644 --- a/src/remollSearchPath.cc +++ b/src/remollSearchPath.cc @@ -41,7 +41,7 @@ void remollSearchPath::add(const std::string& path) SearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/" + path)); } // Check if directory to search in is inside CMAKE_INSTALL_FULL_DATADIR/remoll/ - else(fs::exists(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/" + path))) { + else if (fs::exists(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/" + path))) { fSearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/" + path)); } #endif From a56b535d09e658fab5da6797f7819e1b3bd25ae4 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 12 Mar 2021 16:29:58 -0600 Subject: [PATCH 301/443] [workflows] push if github.event_name != 'pull_request' --- .github/workflows/docker-image.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 11cb5b273..d4d2e3fb3 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -34,6 +34,7 @@ jobs: restore-keys: | ${{ runner.os }}-buildx- - name: Login to DockerHub + if: github.event_name != 'pull_request' uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} @@ -44,6 +45,7 @@ jobs: with: context: . file: Dockerfile + push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.docker_meta.outputs.tags }} labels: ${{ steps.docker_meta.outputs.labels }} cache-from: type=local,src=/tmp/.buildx-cache From 18d876d7d699ad5e0f02c28c3b215814d991035b Mon Sep 17 00:00:00 2001 From: Sakib Rahman Date: Fri, 12 Mar 2021 18:11:05 -0500 Subject: [PATCH 302/443] Bringing in Chandan's downstream cylinders from feature-envelope branch --- geometry/hybridDaughter_merged.gdml | 711 +++++++ geometry/hybridToroid.gdml | 2743 +++++++++++++++++++++++++++ 2 files changed, 3454 insertions(+) create mode 100644 geometry/hybridDaughter_merged.gdml create mode 100644 geometry/hybridToroid.gdml diff --git a/geometry/hybridDaughter_merged.gdml b/geometry/hybridDaughter_merged.gdml new file mode 100644 index 000000000..c79a5456e --- /dev/null +++ b/geometry/hybridDaughter_merged.gdml @@ -0,0 +1,711 @@ + + + + +]> + + + + + &matrices; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +&materials; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + +
+
+ + + + + + + +
+
+ + + + + + + +
+
+ + + + + + + +
+
+ + + + + + + +
+
+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/geometry/hybridToroid.gdml b/geometry/hybridToroid.gdml new file mode 100644 index 000000000..c4b37cc94 --- /dev/null +++ b/geometry/hybridToroid.gdml @@ -0,0 +1,2743 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From d331121fbf37361b37bbebd9a4b92d1d41f4b249 Mon Sep 17 00:00:00 2001 From: Sakib Rahman Date: Fri, 12 Mar 2021 18:19:31 -0500 Subject: [PATCH 303/443] Revert "Bringing in Chandan's downstream cylinders from feature-envelope branch" This reverts commit 18d876d7d699ad5e0f02c28c3b215814d991035b. --- geometry/hybridDaughter_merged.gdml | 711 ------- geometry/hybridToroid.gdml | 2743 --------------------------- 2 files changed, 3454 deletions(-) delete mode 100644 geometry/hybridDaughter_merged.gdml delete mode 100644 geometry/hybridToroid.gdml diff --git a/geometry/hybridDaughter_merged.gdml b/geometry/hybridDaughter_merged.gdml deleted file mode 100644 index c79a5456e..000000000 --- a/geometry/hybridDaughter_merged.gdml +++ /dev/null @@ -1,711 +0,0 @@ - - - - -]> - - - - - &matrices; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -&materials; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - -
-
- - - - - - - -
-
- - - - - - - -
-
- - - - - - - -
-
- - - - - - - -
-
- - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/geometry/hybridToroid.gdml b/geometry/hybridToroid.gdml deleted file mode 100644 index c4b37cc94..000000000 --- a/geometry/hybridToroid.gdml +++ /dev/null @@ -1,2743 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - -
-
- - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From e992d59f92d332783ddcea1c78554496426fff06 Mon Sep 17 00:00:00 2001 From: Sakib Rahman Date: Fri, 12 Mar 2021 18:23:24 -0500 Subject: [PATCH 304/443] Bringing in Chandan's downstream cylinders from feature-envelope branch --- geometry/hybrid/hybridDaughter_merged.gdml | 40 ++- geometry/hybrid/hybridToroid.gdml | 323 ++++++++++++++++++++- 2 files changed, 343 insertions(+), 20 deletions(-) diff --git a/geometry/hybrid/hybridDaughter_merged.gdml b/geometry/hybrid/hybridDaughter_merged.gdml index 7e99e4424..c79a5456e 100644 --- a/geometry/hybrid/hybridDaughter_merged.gdml +++ b/geometry/hybrid/hybridDaughter_merged.gdml @@ -77,7 +77,7 @@ - + @@ -143,9 +143,23 @@ - + + + + + + + + + + @@ -481,12 +495,21 @@ - + - + + + + + + + + + + - + @@ -607,11 +630,16 @@ - + + diff --git a/geometry/hybrid/hybridToroid.gdml b/geometry/hybrid/hybridToroid.gdml index 4b69643b3..c4b37cc94 100644 --- a/geometry/hybrid/hybridToroid.gdml +++ b/geometry/hybrid/hybridToroid.gdml @@ -54,6 +54,14 @@ + + + + + + + + @@ -589,18 +597,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -2210,12 +2349,12 @@ - + @@ -2246,12 +2385,12 @@ - + @@ -2282,12 +2421,12 @@ - + @@ -2318,12 +2457,12 @@ - + @@ -2354,12 +2493,12 @@ - + @@ -2390,12 +2529,12 @@ - + @@ -2426,7 +2565,7 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 6d3fc759f59193ddd953285c689193b6b5408e76 Mon Sep 17 00:00:00 2001 From: Sakib Rahman Date: Fri, 12 Mar 2021 18:42:53 -0500 Subject: [PATCH 305/443] Bringing in Naz's upstream shield optimizations --- .../inner_upstream_nose_shield_beampipe.gdml | 105 ++++++++++++++++++ geometry/upstream/upstreamBeampipe.gdml | 4 +- .../upstream_nose_shield_beampipe.gdml | 64 +++++++++++ 3 files changed, 171 insertions(+), 2 deletions(-) create mode 100755 geometry/upstream/inner_upstream_nose_shield_beampipe.gdml create mode 100755 geometry/upstream/upstream_nose_shield_beampipe.gdml diff --git a/geometry/upstream/inner_upstream_nose_shield_beampipe.gdml b/geometry/upstream/inner_upstream_nose_shield_beampipe.gdml new file mode 100755 index 000000000..01fa28c3c --- /dev/null +++ b/geometry/upstream/inner_upstream_nose_shield_beampipe.gdml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/geometry/upstream/upstreamBeampipe.gdml b/geometry/upstream/upstreamBeampipe.gdml index 468af4c20..b8e7a5668 100644 --- a/geometry/upstream/upstreamBeampipe.gdml +++ b/geometry/upstream/upstreamBeampipe.gdml @@ -25,10 +25,10 @@ - + - + diff --git a/geometry/upstream/upstream_nose_shield_beampipe.gdml b/geometry/upstream/upstream_nose_shield_beampipe.gdml new file mode 100755 index 000000000..143baed3e --- /dev/null +++ b/geometry/upstream/upstream_nose_shield_beampipe.gdml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 2d3d53716b0a260d701804633c8b72d5edb562f2 Mon Sep 17 00:00:00 2001 From: Sakib Date: Sat, 13 Mar 2021 01:02:40 -0500 Subject: [PATCH 306/443] Adding the inner and outer nose-shield designed by Naz --- geometry/upstream/upstreamDaughter_merged.gdml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/geometry/upstream/upstreamDaughter_merged.gdml b/geometry/upstream/upstreamDaughter_merged.gdml index f4427ffe3..ecaacb636 100644 --- a/geometry/upstream/upstreamDaughter_merged.gdml +++ b/geometry/upstream/upstreamDaughter_merged.gdml @@ -82,6 +82,14 @@ + + + + + + + + &materials; @@ -597,6 +605,16 @@ + + + + + + + + + + From c6c342032b314e61769e82b88207850b73fd333c Mon Sep 17 00:00:00 2001 From: Yug34 Date: Sat, 13 Mar 2021 12:13:43 +0530 Subject: [PATCH 307/443] [searchPath] Fixed errors --- src/remollSearchPath.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/remollSearchPath.cc b/src/remollSearchPath.cc index ace38b216..cf01c9aef 100644 --- a/src/remollSearchPath.cc +++ b/src/remollSearchPath.cc @@ -33,12 +33,12 @@ void remollSearchPath::add(const std::string& path) fSearchPath.push_back(fs::path(get_current_dir_name()) / path); } // Check if directory to search in is inside CMAKE_INSTALL_PREFIX - if(fs::exists(fs::path(std::string(CMAKE_INSTALL_PREFIX) + "/" + path))) { + else if(fs::exists(fs::path(std::string(CMAKE_INSTALL_PREFIX) + "/" + path))) { fSearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_PREFIX) + "/" + path)); } // Check if directory to search in is inside CMAKE_INSTALL_FULL_DATADIR else if(fs::exists(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/" + path))) { - SearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/" + path)); + fSearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/" + path)); } // Check if directory to search in is inside CMAKE_INSTALL_FULL_DATADIR/remoll/ else if (fs::exists(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/" + path))) { From cd43f29baaab2f986efb332d10680ab695f25792 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 14 Mar 2021 23:12:20 -0500 Subject: [PATCH 308/443] [workflows] push to user/repo; allow failed login --- .github/workflows/docker-image.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index d4d2e3fb3..ef896f1bf 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -18,7 +18,7 @@ jobs: id: docker_meta uses: crazy-max/ghaction-docker-meta@v1 with: - images: jeffersonlab/remoll + images: ${{ github.repository }} tag-semver: | {{version}} {{major}}.{{minor}} @@ -34,18 +34,20 @@ jobs: restore-keys: | ${{ runner.os }}-buildx- - name: Login to DockerHub + id: docker_login if: github.event_name != 'pull_request' uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + continue-on-error: true - name: Build and push id: docker_build uses: docker/build-push-action@v2 with: context: . file: Dockerfile - push: ${{ github.event_name != 'pull_request' }} + push: ${{ steps.docker_login.outcome == 'success' && github.event_name != 'pull_request' }} tags: ${{ steps.docker_meta.outputs.tags }} labels: ${{ steps.docker_meta.outputs.labels }} cache-from: type=local,src=/tmp/.buildx-cache From a60ff317d6495be540b45e1f818e6ca63ebe7094 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 22 Mar 2021 15:34:55 -0500 Subject: [PATCH 309/443] [filter] ShowOnlyCharged added in GUI --- macros/gui.mac | 2 ++ vis/vis.mac | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/macros/gui.mac b/macros/gui.mac index 58dca1bd1..92de97c7c 100644 --- a/macros/gui.mac +++ b/macros/gui.mac @@ -81,6 +81,8 @@ /gui/addMenu filter "5. Filters" /gui/addButton filter "HideAllGammas ON" "/vis/filtering/trajectories/HideAllGammas/active 1" /gui/addButton filter "HideAllGammas OFF" "/vis/filtering/trajectories/HideAllGammas/active 0" +/gui/addButton filter "ShowOnlyCharged ON" "/vis/filtering/trajectories/ShowOnlyCharged/active 1" +/gui/addButton filter "ShowOnlyCharged OFF" "/vis/filtering/trajectories/ShowOnlyCharged/active 0" /gui/addButton filter "ShowOnlyPionDetectorHits ON" "/vis/filtering/trajectories/ShowOnlyPionDetectorHits/active 1" /gui/addButton filter "ShowOnlyPionDetectorHits OFF" "/vis/filtering/trajectories/ShowOnlyPionDetectorHits/active 0" # diff --git a/vis/vis.mac b/vis/vis.mac index 774cde3bb..2ee8e7537 100644 --- a/vis/vis.mac +++ b/vis/vis.mac @@ -83,6 +83,11 @@ /vis/filtering/trajectories/HideAllGammas/invert true /vis/filtering/trajectories/HideAllGammas/active 0 +/vis/filtering/trajectories/create/chargeFilter ShowOnlyCharged +/vis/filtering/trajectories/ShowOnlyCharged/add 0 +/vis/filtering/trajectories/ShowOnlyCharged/invert true +/vis/filtering/trajectories/ShowOnlyCharged/active 0 + /vis/filtering/trajectories/create/encounteredVolumeFilter ShowOnlyPionDetectorHits /vis/filtering/trajectories/ShowOnlyPionDetectorHits/add pionDetectorLuciteAllPlanesWedgeGlue_physical /vis/filtering/trajectories/ShowOnlyPionDetectorHits/active 0 From ba65f03084413e0a218b1e81cc40285d57ea3848 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 23 Mar 2021 21:39:05 -0400 Subject: [PATCH 310/443] [magneticfield] field at maximum extent value must fail --- src/remollMagneticField.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/remollMagneticField.cc b/src/remollMagneticField.cc index de1f551a3..e6a887a49 100644 --- a/src/remollMagneticField.cc +++ b/src/remollMagneticField.cc @@ -455,14 +455,14 @@ void remollMagneticField::GetFieldValue(const G4double Point[4], G4double *Bfiel } // Check that the point is within the defined region - if( r > fMax[kR] || r < fMin[kR] || - z > fMax[kZ] || z < fMin[kZ] ){ + if( r >= fMax[kR] || r < fMin[kR] || + z >= fMax[kZ] || z < fMin[kZ] ){ return; } // Ensure we're going to get our grid indices correct - assert( fMin[kR] <= r && r <= fMax[kR] ); - assert( fMin[kZ] <= z && z <= fMax[kZ] ); + assert( fMin[kR] <= r && r < fMax[kR] ); + assert( fMin[kZ] <= z && z < fMax[kZ] ); // 2. Next calculate phi (slower) G4double phi = atan2(Point[1],Point[0]); @@ -501,12 +501,12 @@ void remollMagneticField::GetFieldValue(const G4double Point[4], G4double *Bfiel // Check that the point is within the defined region // before interpolation. If it is outside, the field is zero - if( lphi > fFileMax[kPhi] || lphi < fFileMin[kPhi] ){ + if( lphi >= fFileMax[kPhi] || lphi < fFileMin[kPhi] ){ return; } // Ensure we're going to get our grid indices correct - assert( fFileMin[kPhi] <= lphi && lphi <= fFileMax[kPhi] ); + assert( fFileMin[kPhi] <= lphi && lphi < fFileMax[kPhi] ); // 3. Get interoplation variables From 1a36b857ca12143a667226017b9f34e2f616f4c5 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 23 Mar 2021 22:02:05 -0400 Subject: [PATCH 311/443] [cmake] filter out -O? optimizations from root-config --cflags --- cmake/modules/FindROOT.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/modules/FindROOT.cmake b/cmake/modules/FindROOT.cmake index b5eab412c..faabdbdcd 100644 --- a/cmake/modules/FindROOT.cmake +++ b/cmake/modules/FindROOT.cmake @@ -86,6 +86,7 @@ if(NOT ROOT_CONFIG_EXEC) ) # Remove include directories from compiler flags; they are handled separately string(REGEX REPLACE "-I[^ ]*" "" _cxx_flags "${_cxx_flags}") + string(REGEX REPLACE "-O[^ ]*" "" _cxx_flags "${_cxx_flags}") set(ROOT_CXX_FLAGS "${_cxx_flags}" CACHE STRING "ROOT C++ compiler flags" FORCE) mark_as_advanced(ROOT_CXX_FLAGS) unset(_cxx_flags) From c3be196ee0355b10ca79cf262ed4f94045afcfda Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 25 Mar 2021 14:47:32 -0500 Subject: [PATCH 312/443] [CMakeLists] download new larger fieldmaps and make default --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ae2295e6..785100312 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -319,14 +319,16 @@ if(Boost_IOSTREAMS_FOUND) endif() # for i in *.txt ; do echo `md5sum $i|awk '{print$1}'`:`md5sum $i.gz|awk '{print$1}'`:$i ; done set(REMOLL_MAPS +1c79bc83e4da5e9d5e44338e28ce6ebe:c7591d167ca56e871e8e5eeecab2872c:V2DSg.9.75cm.txt +f768447f761b9bf01af7c57e249d1d8a:94ec0017b21fc56d9d8084d68e479fd5:V2U.1a.50cm.txt +) +set(REMOLL_MAPS_EXTRA b1b8f2845dc5cd420c6ff49ae7760a60:6002f6f5f092346cb2bdedac046d1905:V1U.2a.txt 70e2bbed1831816957e953bba48f01d5:2fd1cd2785db92f9c880b675890460b5:V2U.1a.txt e55ffd8aba96cbf24962155d3c7f75e4:0172016c988867b0928258d79cd1c865:V2U.1b.txt eb802b9d8569669b5aa674fc56c52a24:df7f4dd87c894c5eef878b248ef14c3e:V1DSg.3.txt c71758450b063ab83e95a7ba8c590885:a5ba5c81c0c6590d43fac1cbd3f2d7a0:V2DSg.1a.txt c2ac33287df1bf20bfedcb4d4a96c8d5:3a31416eb7659248f7a2ba582d43a6fe:V2DSg.1b.txt -) -set(REMOLL_MAPS_EXTRA ca69d4a4397ae3a944f603b91dfbe586:36e2aa90d39e4ad9be4f747a522baa69:V1DHy.3.txt 259459226a5cacc1d62ba295534645e2:95c6193ea30c03316068e3d67d3ec32b:V2DHy.1.txt b4bfef8f362e0df66f166b4e76a6847e:57a7719eb877572751f4c4b481d6a788:blockyHybrid_rm_3.0.txt From 3f499e260e9d7a925ad21b272f954db85ea03ca5 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 25 Mar 2021 14:47:55 -0500 Subject: [PATCH 313/443] [macros] use new larger fieldmaps in load_magnetic_fieldmaps.mac --- macros/load_magnetic_fieldmaps.mac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros/load_magnetic_fieldmaps.mac b/macros/load_magnetic_fieldmaps.mac index f7d7c0e3e..90134de00 100644 --- a/macros/load_magnetic_fieldmaps.mac +++ b/macros/load_magnetic_fieldmaps.mac @@ -4,5 +4,5 @@ # consider loading this macro with # /control/execute macros/load_magnetic_field.mac -/remoll/addfield map_directory/V1DSg.3.txt -/remoll/addfield map_directory/V1U.2a.txt +/remoll/addfield map_directory/V2U.1a.50cm.txt +/remoll/addfield map_directory/V2DSg.9.75cm.txt From bfd322a232c212b012d9a435278605daae961d7c Mon Sep 17 00:00:00 2001 From: Chandan Ghosh Date: Fri, 26 Mar 2021 15:21:35 -0400 Subject: [PATCH 314/443] Removed old downstream twobounce pipe and add new two-bounce shield --- geometry/hybrid/hybridDaughter_merged.gdml | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/geometry/hybrid/hybridDaughter_merged.gdml b/geometry/hybrid/hybridDaughter_merged.gdml index 7e99e4424..632fdc8fd 100644 --- a/geometry/hybrid/hybridDaughter_merged.gdml +++ b/geometry/hybrid/hybridDaughter_merged.gdml @@ -68,16 +68,7 @@ - - - - - - - - - - + @@ -144,8 +135,8 @@ - - + + @@ -484,7 +475,7 @@ - + From e2a65a85e5fa9c5016f49cab7bf9f6a066131b21 Mon Sep 17 00:00:00 2001 From: Chandan Ghosh Date: Fri, 26 Mar 2021 17:06:00 -0400 Subject: [PATCH 315/443] Removed Septapus and implemented new epoxy shieldings; Collimator 5 handles and collimator 6 --- geometry/hybrid/hybridToroid.gdml | 273 ++++++++++++++++++------------ 1 file changed, 167 insertions(+), 106 deletions(-) diff --git a/geometry/hybrid/hybridToroid.gdml b/geometry/hybrid/hybridToroid.gdml index 4b69643b3..5603d1e82 100644 --- a/geometry/hybrid/hybridToroid.gdml +++ b/geometry/hybrid/hybridToroid.gdml @@ -44,17 +44,6 @@
- - - - - -
-
- - - - @@ -589,30 +578,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - + @@ -833,13 +883,6 @@ - - - - - - - @@ -1058,13 +1101,6 @@ - - - - - - - @@ -1283,13 +1319,6 @@ - - - - - - - @@ -1508,13 +1537,6 @@ - - - - - - - @@ -1733,13 +1755,6 @@ - - - - - - - @@ -1958,13 +1973,6 @@ - - - - - - - @@ -2210,12 +2218,6 @@ - - - - - - @@ -2246,12 +2248,6 @@ - - - - - - @@ -2282,12 +2278,6 @@ - - - - - - @@ -2318,12 +2308,6 @@ - - - - - - @@ -2354,12 +2338,6 @@ - - - - - - @@ -2390,12 +2368,6 @@ - - - - - - @@ -2426,17 +2398,106 @@ - - - - + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From f07661825e1692dc11acd8e500f5d2c389200d98 Mon Sep 17 00:00:00 2001 From: Chandan Ghosh Date: Fri, 26 Mar 2021 17:07:09 -0400 Subject: [PATCH 316/443] Changed names of some elements for better understanding of the code --- geometry/hybrid/hybridDaughter_merged.gdml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/geometry/hybrid/hybridDaughter_merged.gdml b/geometry/hybrid/hybridDaughter_merged.gdml index 632fdc8fd..2bedd0dab 100644 --- a/geometry/hybrid/hybridDaughter_merged.gdml +++ b/geometry/hybrid/hybridDaughter_merged.gdml @@ -68,7 +68,7 @@ - + @@ -134,7 +134,7 @@ - + @@ -471,13 +471,13 @@ - + - + - - + + @@ -599,8 +599,8 @@ - - + + From bcd013dd3bb00f684d9917649aa78a7482f72612 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 28 Mar 2021 19:19:09 -0500 Subject: [PATCH 317/443] [showermax] updated geometry from remoll-showermax-generator --- geometry/showermax/showerMaxGen.gdml | 1271 +++++++++++++++++++------- 1 file changed, 919 insertions(+), 352 deletions(-) diff --git a/geometry/showermax/showerMaxGen.gdml b/geometry/showermax/showerMaxGen.gdml index e53845a2f..ed8fece3e 100644 --- a/geometry/showermax/showerMaxGen.gdml +++ b/geometry/showermax/showerMaxGen.gdml @@ -26,24 +26,24 @@ - - + + - - + + - - + + @@ -51,29 +51,36 @@ - - - - + + + +
- - + + + + + + + + - + + - + - + - + @@ -103,6 +110,11 @@ + + + + + @@ -146,39 +158,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -188,22 +215,22 @@ - + - + - + - + @@ -233,6 +260,11 @@ + + + + + @@ -276,39 +308,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -318,22 +365,22 @@ - + - + - + - + @@ -363,6 +410,11 @@ + + + + + @@ -406,39 +458,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -448,22 +515,22 @@ - + - + - + - + @@ -493,6 +560,11 @@ + + + + + @@ -536,39 +608,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -578,22 +665,22 @@ - + - + - + - + @@ -623,6 +710,11 @@ + + + + + @@ -666,39 +758,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -708,22 +815,22 @@ - + - + - + - + @@ -753,6 +860,11 @@ + + + + + @@ -796,39 +908,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -838,22 +965,22 @@ - + - + - + - + @@ -883,6 +1010,11 @@ + + + + + @@ -926,39 +1058,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -968,22 +1115,22 @@ - + - + - + - + @@ -1013,6 +1160,11 @@ + + + + + @@ -1056,39 +1208,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -1098,22 +1265,22 @@ - + - + - + - + @@ -1143,6 +1310,11 @@ + + + + + @@ -1186,39 +1358,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -1228,22 +1415,22 @@ - + - + - + - + @@ -1273,6 +1460,11 @@ + + + + + @@ -1316,39 +1508,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -1358,22 +1565,22 @@ - + - + - + - + @@ -1403,6 +1610,11 @@ + + + + + @@ -1446,39 +1658,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -1488,22 +1715,22 @@ - + - + - + - + @@ -1533,6 +1760,11 @@ + + + + + @@ -1576,39 +1808,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -1618,22 +1865,22 @@ - + - + - + - + @@ -1663,6 +1910,11 @@ + + + + + @@ -1706,39 +1958,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -1748,22 +2015,22 @@ - + - + - + - + @@ -1793,6 +2060,11 @@ + + + + + @@ -1836,39 +2108,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -1878,22 +2165,22 @@ - + - + - + - + @@ -1923,6 +2210,11 @@ + + + + + @@ -1966,39 +2258,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -2008,22 +2315,22 @@ - + - + - + - + @@ -2053,6 +2360,11 @@ + + + + + @@ -2096,39 +2408,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -2138,22 +2465,22 @@ - + - + - + - + @@ -2183,6 +2510,11 @@ + + + + + @@ -2226,39 +2558,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -2268,22 +2615,22 @@ - + - + - + - + @@ -2313,6 +2660,11 @@ + + + + + @@ -2356,39 +2708,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -2398,22 +2765,22 @@ - + - + - + - + @@ -2443,6 +2810,11 @@ + + + + + @@ -2486,39 +2858,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -2528,22 +2915,22 @@ - + - + - + - + @@ -2573,6 +2960,11 @@ + + + + + @@ -2616,39 +3008,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -2658,22 +3065,22 @@ - + - + - + - + @@ -2703,6 +3110,11 @@ + + + + + @@ -2746,39 +3158,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -2788,22 +3215,22 @@ - + - + - + - + @@ -2833,6 +3260,11 @@ + + + + + @@ -2876,39 +3308,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -2918,22 +3365,22 @@ - + - + - + - + @@ -2963,6 +3410,11 @@ + + + + + @@ -3006,39 +3458,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -3048,22 +3515,22 @@ - + - + - + - + @@ -3093,6 +3560,11 @@ + + + + + @@ -3136,39 +3608,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -3178,22 +3665,22 @@ - + - + - + - + @@ -3223,6 +3710,11 @@ + + + + + @@ -3266,39 +3758,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -3308,22 +3815,22 @@ - + - + - + - + @@ -3353,6 +3860,11 @@ + + + + + @@ -3396,39 +3908,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -3438,22 +3965,22 @@ - + - + - + - + @@ -3483,6 +4010,11 @@ + + + + + @@ -3526,39 +4058,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -3568,22 +4115,22 @@ - + - + - + - + @@ -3613,6 +4160,11 @@ + + + + + @@ -3656,39 +4208,54 @@ + + + + + - + - + - + - + + + + + + + + + + + - + - + - + @@ -3698,22 +4265,22 @@ - + - + - + - + @@ -3723,142 +4290,142 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + From 072f3fcb84d2a5d638329da301a307b0e201923e Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 28 Mar 2021 19:19:47 -0500 Subject: [PATCH 318/443] [detector construction] enable overlap check; print warning only when validate --- src/remollDetectorConstruction.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/remollDetectorConstruction.cc b/src/remollDetectorConstruction.cc index 7ac7c2655..a43fca4bb 100644 --- a/src/remollDetectorConstruction.cc +++ b/src/remollDetectorConstruction.cc @@ -48,7 +48,7 @@ remollDetectorConstruction::remollDetectorConstruction(const G4String& name, con : fVerboseLevel(0), fGDMLParser(0), fGDMLValidate(false), - fGDMLOverlapCheck(false), + fGDMLOverlapCheck(true), fGDMLPath(""), fGDMLFile(""), fMessenger(0), @@ -523,14 +523,14 @@ G4VPhysicalVolume* remollDetectorConstruction::ParseGDMLFile() // Clear parser fGDMLParser->Clear(); - // Print GDML warning - PrintGDMLWarning(); - // Print parsing options G4cout << "Reading " << fGDMLFile << G4endl; G4cout << "- schema validation " << (fGDMLValidate? "on": "off") << G4endl; G4cout << "- overlap check " << (fGDMLOverlapCheck? "on": "off") << G4endl; + // Print GDML warning when validation + if (fGDMLValidate) PrintGDMLWarning(); + // Get remollIO instance before chdir since remollIO creates root file remollIO* io = remollIO::GetInstance(); From 3e5526c3ad2d7b5a3afa1a7522ab541069e06857 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 30 Mar 2021 14:22:03 -0500 Subject: [PATCH 319/443] [io] option -o set the default output filename on CLI --- include/remollIO.hh | 4 ++-- remoll.cc | 12 +++++++++++- src/remollIO.cc | 8 ++++---- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/include/remollIO.hh b/include/remollIO.hh index 255b7e7ee..6ea8f8643 100644 --- a/include/remollIO.hh +++ b/include/remollIO.hh @@ -75,13 +75,13 @@ class remollIO { // Singleton pointer static remollIO* gInstance; // Private constructor - remollIO(); + remollIO(const G4String& outputfile); public: // Public destructor virtual ~remollIO(); // Static instance getter - static remollIO* GetInstance(); + static remollIO* GetInstance(const G4String& outputfile = "remollout.root"); void SetFilename(const G4String& name) { fFilename = name; } G4String GetFilename() const { return fFilename; } diff --git a/remoll.cc b/remoll.cc index 66e72415a..430291fa3 100644 --- a/remoll.cc +++ b/remoll.cc @@ -19,6 +19,8 @@ typedef G4RunManager RunManager; #include "G4Version.hh" #include "G4UImanager.hh" +#include "remollIO.hh" + #include "remollRun.hh" #include "remollRunData.hh" @@ -44,7 +46,7 @@ typedef G4RunManager RunManager; namespace { void PrintUsage() { G4cerr << "Usage: " << G4endl; - G4cerr << " remoll [-g geometry] [-m macro] [-u UIsession] [-r seed] "; + G4cerr << " remoll [-g geometry] [-m macro] [-u UIsession] [-r seed] [-o outputfile] "; #ifdef G4MULTITHREADED G4cerr << "[-t nThreads] "; #endif @@ -88,6 +90,7 @@ int main(int argc, char** argv) { G4String session; G4String geometry_gdmlfile; G4String parallel_gdmlfile; + G4String outputfile; #ifdef G4MULTITHREADED G4int threads = 0; #endif @@ -98,6 +101,7 @@ int main(int argc, char** argv) { else if (G4String(argv[i]) == "-p") parallel_gdmlfile = argv[++i]; else if (G4String(argv[i]) == "-u") session = argv[++i]; else if (G4String(argv[i]) == "-r") seed = atol(argv[++i]); + else if (G4String(argv[i]) == "-o") outputfile = argv[++i]; #ifdef G4MULTITHREADED else if (G4String(argv[i]) == "-t") threads = atoi(argv[++i]); #endif @@ -120,6 +124,12 @@ int main(int argc, char** argv) { // Set the default random seed G4Random::setTheSeed(seed); + // Create remoll IO object with output file name + if (outputfile.size() > 0) + remollIO::GetInstance(outputfile); + else + remollIO::GetInstance(); + // Detector geometry G4String material_name = "material"; remollDetectorConstruction* detector = new remollDetectorConstruction(material_name, geometry_gdmlfile); diff --git a/src/remollIO.cc b/src/remollIO.cc index e5908be3a..4c3465d67 100644 --- a/src/remollIO.cc +++ b/src/remollIO.cc @@ -31,15 +31,15 @@ ClassImp(remollSeed_t) // Singleton remollIO* remollIO::gInstance = 0; -remollIO* remollIO::GetInstance() { +remollIO* remollIO::GetInstance(const G4String& outputfile) { if (gInstance == 0) { - gInstance = new remollIO(); + gInstance = new remollIO(outputfile); } return gInstance; } -remollIO::remollIO() -: fFile(0),fTree(0),fFilename("remollout.root"),fRate(0) +remollIO::remollIO(const G4String& outputfile) +: fFile(0),fTree(0),fFilename(outputfile),fRate(0) { // Create generic messenger fMessenger = new G4GenericMessenger(this,"/remoll/","Remoll properties"); From 10f752147a5962a944a38a38f332ee45e9b57725 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 5 Apr 2021 17:10:07 -0500 Subject: [PATCH 320/443] [target] put target ladder in the scattering chamber --- geometry/target/subTargetRegion.gdml | 37 ++------------------ geometry/target/target12C.gdml | 51 ---------------------------- 2 files changed, 2 insertions(+), 86 deletions(-) delete mode 100644 geometry/target/target12C.gdml diff --git a/geometry/target/subTargetRegion.gdml b/geometry/target/subTargetRegion.gdml index f44561c8b..16455991e 100644 --- a/geometry/target/subTargetRegion.gdml +++ b/geometry/target/subTargetRegion.gdml @@ -227,27 +227,6 @@ - - - - - - - - - - - - - - - - - - - - - @@ -428,19 +407,8 @@ - - - - - - - - - - - - - + + @@ -530,7 +498,6 @@ - diff --git a/geometry/target/target12C.gdml b/geometry/target/target12C.gdml deleted file mode 100644 index 836e95d86..000000000 --- a/geometry/target/target12C.gdml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 5f185c3bd61f630185b6954c1cd437b4057991e1 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 5 Apr 2021 17:11:00 -0500 Subject: [PATCH 321/443] [multiple scattering] flexiblity in number of materials --- include/remollMultScatt.hh | 34 ++++---- src/remollMultScatt.cc | 173 +++++++++++++++---------------------- 2 files changed, 84 insertions(+), 123 deletions(-) diff --git a/include/remollMultScatt.hh b/include/remollMultScatt.hh index ddb5b4bd4..f2af2b4aa 100644 --- a/include/remollMultScatt.hh +++ b/include/remollMultScatt.hh @@ -59,35 +59,36 @@ ------------------------------------------------- */ -#define MAT_MAX 50 +#include +#include class remollMultScatt { public: remollMultScatt(); - remollMultScatt( double p, double t, double A, double Z ); - remollMultScatt( double p, int nmat, double t[], double A[], double Z[] ); + remollMultScatt(double p, const std::tuple& m); + remollMultScatt(double p, const std::vector>& m); - void Init( double p, double t, double A, double Z ); - void Init( double p, int nmat, double t[], double A[], double Z[] ); + void Init(double p, const std::tuple& m); + void Init(double p, const std::vector>& m); virtual ~remollMultScatt() {;} double J0(double x); double CalcMSDistPlane( double theta); - double CalcMSDistPlane( double theta, double p, int, double t[], double A[], double Z[] ); - double CalcMSDistPlane( double theta, double p, double t, double A, double Z ); + double CalcMSDistPlane( double theta, double p, const std::vector>& m); + double CalcMSDistPlane( double theta, double p, const std::tuple& m); - double CalcMSDist( double theta); - double CalcMSDist( double theta, double p, int, double t[], double A[], double Z[] ); - double CalcMSDist( double theta, double p, double t, double A, double Z ); + double CalcMSDist(double theta); + double CalcMSDist(double theta, double p, const std::vector>& m); + double CalcMSDist(double theta, double p, const std::tuple& m); double GenerateMS(); - double GenerateMS( double p, double t, double A, double Z ); - double GenerateMS( double p, int nmat, double t[], double A[], double Z[] ); + double GenerateMS(double p, const std::tuple& m); + double GenerateMS(double p, const std::vector>& m); double GenerateMSPlane(); - double GenerateMSPlane( double p, double t, double A, double Z ); - double GenerateMSPlane( double p, int nmat, double t[], double A[], double Z[] ); + double GenerateMSPlane(double p, const std::tuple& m); + double GenerateMSPlane(double p, const std::vector>& m); double GetPDGTh(){ return fthpdg; } @@ -96,11 +97,8 @@ class remollMultScatt { bool fInit, fReturnZero; double fErf2sig; - int fNmat; double fp; - double ft[MAT_MAX]; - double fA[MAT_MAX]; - double fZ[MAT_MAX]; + std::vector> fm; double fth; double fthpdg; diff --git a/src/remollMultScatt.cc b/src/remollMultScatt.cc index 5d1020939..5cd22ee97 100644 --- a/src/remollMultScatt.cc +++ b/src/remollMultScatt.cc @@ -13,87 +13,68 @@ remollMultScatt::remollMultScatt() { InitInternal(); - - return; } -remollMultScatt::remollMultScatt( double p, int nmat, double t[], double A[], double Z[] ){ +remollMultScatt::remollMultScatt(double p, const std::vector>& m) +: remollMultScatt() { /* p - electron momentum - nmat - number of materials - t - Thickness - A - Mass number - Z - Atomic number + (t, - Thickness + A, - Mass number + Z) - Atomic number */ - InitInternal(); - remollMultScatt(); - Init( p, nmat, t, A, Z ); - return; + Init(p, m); } -remollMultScatt::remollMultScatt( double p, double t, double A, double Z ){ +remollMultScatt::remollMultScatt(double p, const std::tuple& m) { /* p - electron momentum - nmat - number of materials - t - Thickness - A - Mass number - Z - Atomic number + (t, - Thickness + A, - Mass number + Z) - Atomic number */ InitInternal(); - Init( p, t, A, Z ); - - return; + Init(p, m); } void remollMultScatt::InitInternal(){ fInit = false; fErf2sig = erf(2.0/sqrt(2.0)); - fNmat = 0; } -void remollMultScatt::Init( double p, int nmat, double t[], double A[], double Z[] ){ - /* +void remollMultScatt::Init(double p, const std::vector>& m) { + /* Load materials and calculate necessary variables to generate distributions p - electron momentum - nmat - number of materials - t - Thickness - A - Mass number - Z - Atomic number + (t, - Thickness + A, - Mass number + Z) - Atomic number */ - int i; - - if( nmat >= MAT_MAX ){ - fprintf(stderr, "%s %s line %d: Too many materials. Limited by MAT_MAX (%d)\n", - __FILE__, __FUNCTION__, __LINE__, MAT_MAX ); - return; - } - - fNmat = nmat; - fReturnZero = false; fInit = false; fp = p; - for( i = 0; i < nmat; i++ ){ - assert( !std::isnan(t[i]) && !std::isinf(t[i]) && - !std::isnan(A[i]) && !std::isinf(A[i]) && - !std::isnan(Z[i]) && !std::isinf(Z[i]) ); + fm.resize(m.size()); + for (size_t i = 0; i < m.size(); i++) { + assert( !std::isnan(std::get<0>(m[i])) && !std::isinf(std::get<0>(m[i])) && + !std::isnan(std::get<1>(m[i])) && !std::isinf(std::get<1>(m[i])) && + !std::isnan(std::get<2>(m[i])) && !std::isinf(std::get<2>(m[i])) ); - ft[i] = t[i]; - fA[i] = A[i]; - fZ[i] = Z[i]; + fm[i] = m[i]; } double radsum = 0.0; - double X0; - for( i = 0; i < nmat; i++ ){ - X0 = (716.4*g/cm2)*A[i]/(Z[i]*(Z[i]+1.0)*log(287.0/sqrt(Z[i]))); - radsum += t[i]/X0; + for (size_t i = 0; i < m.size(); i++) { + double t = std::get<0>(m[i]); + double A = std::get<1>(m[i]); + double Z = std::get<2>(m[i]); + double X0 = (716.4*g/cm2)*A/(Z*(Z+1.0)*log(287.0/sqrt(Z))); + radsum += t/X0; } // First work out characteristic gaussian spread. @@ -107,14 +88,15 @@ void remollMultScatt::Init( double p, int nmat, double t[], double A[], double Z fthpdg = thpdg; // First calculate b - - double expb_num, expb_den; double bsum = 0.0; - for( i = 0; i < fNmat; i++ ){ - expb_num = (6680.0*cm2/g)*ft[i]*(fZ[i]+1.0)*pow(fZ[i],1.0/3.0); - expb_den = fA[i]*(1.0+3.34*pow(fZ[i]/137.0,2.0)); + for (size_t i = 0; i < fm.size(); i++) { + double t = std::get<0>(fm[i]); + double A = std::get<1>(fm[i]); + double Z = std::get<2>(fm[i]); + expb_num = (6680.0*cm2/g)*t*(Z+1.0)*pow(Z,1.0/3.0); + expb_den = A*(1.0+3.34*pow(Z/137.0,2.0)); bsum += expb_num/expb_den; } @@ -124,18 +106,9 @@ void remollMultScatt::Init( double p, int nmat, double t[], double A[], double Z /* Added bsum < 0 check to this if statement otherwise if target material is set to vacuum for beam on target case b would be nan and exit the simulation - Rakitha Fri Aug 21 12:19:37 EDT 2015 */ - if( fNmat == 0 || bsum < 0 || log(bsum) < 1.0){ + if (fm.size() == 0 || bsum < 0 || log(bsum) < 1.0) { fInit = true; fReturnZero = true; - - /* - fprintf(stderr, "%s line %d: WARNING sum of b is %f\n", __FILE__, __LINE__, bsum ); - for( i = 0; i < fNmat; i++ ){ - fprintf(stderr, "\tThickness mat %d: %f g/cm2\n", i, ft[i] ); - } - fprintf(stderr, "Too little material - disabling MS for this configuration\n"); - */ - return; } @@ -158,13 +131,14 @@ void remollMultScatt::Init( double p, int nmat, double t[], double A[], double Z // Change of variables - double chi2, chi2_num, chi2_den; - - chi2 = 0.0; + double chi2 = 0.0; - for( i = 0; i < fNmat; i++ ){ - chi2_num = 4.0*3.14159*e_squared*e_squared*ft[i]*fZ[i]*(fZ[i]+1.0); - chi2_den = fp*fp*(A[i]*g/mole); + for (size_t i = 0; i < fm.size(); i++) { + double t = std::get<0>(fm[i]); + double A = std::get<1>(fm[i]); + double Z = std::get<2>(fm[i]); + double chi2_num = 4.0*3.14159*e_squared*e_squared*t*Z*(Z+1.0); + double chi2_den = fp*fp*(A*g/mole); chi2 += chi2_num/chi2_den; } @@ -202,27 +176,21 @@ void remollMultScatt::Init( double p, int nmat, double t[], double A[], double Z return; } -void remollMultScatt::Init( double p, double t, double A, double Z ){ +void remollMultScatt::Init(double p, const std::tuple& m) { /* p - electron momentum, [GeV] - nmat - number of materials - t - Thickness [g/cm2] - A - Mass number - Z - Atomic number + (t, - Thickness [g/cm2] + A, - Mass number + Z) - Atomic number */ - - double tt[] = {t}; - double tA[] = {A}; - double tZ[] = {Z}; - - Init( p, 1, tt, tA, tZ ); - return; + std::vector> tm(1, m); + Init(p, tm); } double remollMultScatt::J0(double x) { // Returns J0 for any real x // Stolen from ROOT in TMath.cxx - + double ax,z; double xx,y,result,result1,result2; const double p1 = 57568490574.0, p2 = -13362590354.0, p3 = 651619640.7; @@ -277,7 +245,7 @@ double remollMultScatt::solvelogeq(double b){ int n = 0; double f, df; - + // Fix at 100 iterations while( n < MAX_ITER && fabs(thisB-lastB)>err ){ assert(thisB > 0.0); @@ -382,20 +350,19 @@ double remollMultScatt::intsimpson_fn( double th, int n ){ return sum/fact; } -double remollMultScatt::CalcMSDistPlane( double theta, double p, double t, double A, double Z ){ - Init( p, t, A, Z ); +double remollMultScatt::CalcMSDistPlane( double theta, double p, const std::tuple& m) { + Init(p, m); return CalcMSDistPlane(theta); } -double remollMultScatt::CalcMSDistPlane( double theta, double p, int nmat, double t[], double A[], double Z[] ){ - Init( p, nmat, t, A, Z ); +double remollMultScatt::CalcMSDistPlane( double theta, double p, const std::vector>& m) { + Init(p, m); return CalcMSDistPlane(theta); } -double remollMultScatt::CalcMSDistPlane( double theta){ +double remollMultScatt::CalcMSDistPlane( double theta) { /* p - electron momentum - nmat - number of materials t - Thickness A - Mass number Z - Atomic number @@ -430,13 +397,13 @@ double remollMultScatt::CalcMSDistPlane( double theta){ return retval; } -double remollMultScatt::CalcMSDist( double theta, double p, double t, double A, double Z ){ - Init( p, t, A, Z ); +double remollMultScatt::CalcMSDist( double theta, double p, const std::tuple& m) { + Init(p, m); return CalcMSDist(theta); } -double remollMultScatt::CalcMSDist( double theta, double p, int nmat, double t[], double A[], double Z[] ){ - Init( p, nmat, t, A, Z ); +double remollMultScatt::CalcMSDist( double theta, double p, const std::vector>& m) { + Init(p, m); assert( !std::isnan(theta)); return CalcMSDist(theta); } @@ -512,27 +479,25 @@ double remollMultScatt::GenerateMSPlane(){ return -1e9; } -double remollMultScatt::GenerateMSPlane( double p, int nmat, double t[], double A[], double Z[] ){ +double remollMultScatt::GenerateMSPlane(double p, const std::vector>& m) { /* p - electron momentum, [GeV] - nmat - number of materials t - Thickness [g/cm2] A - Mass number Z - Atomic number */ - Init(p, nmat, t, A, Z); + Init(p, m); return GenerateMSPlane(); } -double remollMultScatt::GenerateMSPlane( double p, double t, double A, double Z ){ +double remollMultScatt::GenerateMSPlane(double p, const std::tuple& m) { /* p - electron momentum - nmat - number of materials t - Thickness A - Mass number Z - Atomic number */ - Init(p, t, A, Z); + Init(p, m); return GenerateMSPlane(); } @@ -553,26 +518,24 @@ double remollMultScatt::GenerateMS(){ return thisth; } -double remollMultScatt::GenerateMS( double p, int nmat, double t[], double A[], double Z[] ){ +double remollMultScatt::GenerateMS(double p, const std::vector>& m) { /* p - electron momentum - nmat - number of materials - t - Thickness + t - Thickness A - Mass number Z - Atomic number */ - Init(p, nmat, t, A, Z); + Init(p, m); return GenerateMS(); } -double remollMultScatt::GenerateMS( double p, double t, double A, double Z ){ +double remollMultScatt::GenerateMS(double p, const std::tuple& m) { /* p - electron momentum - nmat - number of materials t - Thickness A - Mass number Z - Atomic number */ - Init(p, t, A, Z); + Init(p, m); return GenerateMS(); } From 229d16451205439537307e3f5b0db14cf9ddf86a Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 5 Apr 2021 17:11:42 -0500 Subject: [PATCH 322/443] [target] support for multiple target assemblies; box shaped targets --- include/remollBeamTarget.hh | 30 +++++-- src/remollBeamTarget.cc | 157 +++++++++++++++++++++++++----------- 2 files changed, 133 insertions(+), 54 deletions(-) diff --git a/include/remollBeamTarget.hh b/include/remollBeamTarget.hh index 303ceee03..f80e12de7 100644 --- a/include/remollBeamTarget.hh +++ b/include/remollBeamTarget.hh @@ -34,9 +34,12 @@ class remollBeamTarget { private: // Static geometry objects - static G4String fActiveTargetVolume; - static std::vector fTargetVolumes; - static G4VPhysicalVolume* fTargetMother; + static G4String fActiveTargetMotherName; + static G4String fActiveTargetVolumeName; + static size_t fActiveTargetMother; + static size_t fActiveTargetVolume; + static std::vector fTargetMothers; + static std::vector> fTargetVolumes; // Effective lengths are weighted by density (i.e. in 1/cm^2) static G4double fTotalTargetEffectiveLength; @@ -45,15 +48,28 @@ class remollBeamTarget { static G4double fMotherTargetAbsolutePosition; static G4double fActiveTargetRelativePosition; + public: static void UpdateInfo(); public: // Static geometry functions - static void ResetTargetVolumes(){ fTargetVolumes.clear(); fTargetMother = 0; UpdateInfo(); } - static void SetMotherVolume( G4VPhysicalVolume *v ){ fTargetMother = v; UpdateInfo(); } - static void AddTargetVolume( G4VPhysicalVolume *v ){ fTargetVolumes.push_back(v); UpdateInfo(); } - static std::vector GetTargetVolumes(){ return fTargetVolumes; } + static void ResetTargetVolumes() { + fTargetVolumes.clear(); + fTargetMothers.clear(); + } + static void AddMotherVolume(G4VPhysicalVolume *v) { + fTargetMothers.push_back(v); + fTargetVolumes.resize(fTargetMothers.size()); + fActiveTargetMother = fTargetMothers.size() - 1; + } + static void AddTargetVolume(G4VPhysicalVolume *v) { + fTargetVolumes[fActiveTargetMother].push_back(v); + } + static std::vector GetTargetVolumes() { + return fTargetVolumes[fActiveTargetMother]; + } + void SetActiveTargetMother(G4String name); void SetActiveTargetVolume(G4String name); void PrintTargetInfo(); diff --git a/src/remollBeamTarget.cc b/src/remollBeamTarget.cc index 1d0f45288..542b9d1b0 100644 --- a/src/remollBeamTarget.cc +++ b/src/remollBeamTarget.cc @@ -1,3 +1,4 @@ +#include "G4Box.hh" #include "G4Tubs.hh" #include "G4VPhysicalVolume.hh" #include "G4LogicalVolume.hh" @@ -30,9 +31,12 @@ namespace { G4Mutex remollBeamTargetMutex = G4MUTEX_INITIALIZER; } // Initialize static geometry objects -G4String remollBeamTarget::fActiveTargetVolume = "h2Targ"; -G4VPhysicalVolume* remollBeamTarget::fTargetMother = 0; -std::vector remollBeamTarget::fTargetVolumes; +G4String remollBeamTarget::fActiveTargetMotherName = "TargetLH2_logical_PV"; +G4String remollBeamTarget::fActiveTargetVolumeName = "targetLH2_LH2Volume_logical"; +size_t remollBeamTarget::fActiveTargetMother = 0; +size_t remollBeamTarget::fActiveTargetVolume = 0; +std::vector remollBeamTarget::fTargetMothers; +std::vector> remollBeamTarget::fTargetVolumes; G4double remollBeamTarget::fActiveTargetEffectiveLength = -1e9; G4double remollBeamTarget::fMotherTargetAbsolutePosition = -1e9; @@ -92,24 +96,33 @@ G4double remollBeamTarget::GetEffLumin(SamplingType_t sampling_type) void remollBeamTarget::PrintTargetInfo() { - for (std::vector::iterator - it = fTargetVolumes.begin(); it != fTargetVolumes.end(); it++) { + for (auto mother = fTargetMothers.begin(); + mother != fTargetMothers.end(); + mother++) { - // Try to cast the target volume into its tubs solid - G4LogicalVolume* volume = (*it)->GetLogicalVolume(); - G4Material* material = volume->GetMaterial(); - G4VSolid* solid = volume->GetSolid(); + auto i_mother = mother - fTargetMothers.begin(); + + G4cout << "Target mother " << (*mother)->GetName() << ":" << G4endl; - G4cout << "Target volume " << (*it)->GetName() << ":" << G4endl; - G4cout << " volume: " << volume->GetName() << G4endl; - G4cout << " material: " << material->GetName() << G4endl; - G4cout << " solid: " << solid->GetName() << G4endl; + for (auto daughter = fTargetVolumes[i_mother].begin(); + daughter != fTargetVolumes[i_mother].end(); + daughter++) { + + G4LogicalVolume* volume = (*daughter)->GetLogicalVolume(); + G4Material* material = volume->GetMaterial(); + G4VSolid* solid = volume->GetSolid(); + + G4cout << " Target volume " << (*daughter)->GetName() << ":" << G4endl; + G4cout << " volume: " << volume->GetName() << G4endl; + G4cout << " material: " << material->GetName() << G4endl; + G4cout << " solid: " << solid->GetName() << G4endl; - if( (*it)->GetLogicalVolume()->GetName() == fActiveTargetVolume ){ - G4cout << " active volume: " << fActiveTargetVolume << G4endl; } } + SetActiveTargetMother(fActiveTargetMotherName); + SetActiveTargetVolume(fActiveTargetVolumeName); + G4cout << "Final target parameters: " << G4endl; G4cout << " active target effective length: " << fActiveTargetEffectiveLength << G4endl; G4cout << " active target relative position: " << fActiveTargetRelativePosition << G4endl; @@ -126,28 +139,33 @@ void remollBeamTarget::UpdateInfo() fTotalTargetEffectiveLength = 0.0; // Can't calculate anything without mother, let's hope we find one later on - if (!fTargetMother) { + if (fTargetMothers.size() == 0) { return; } - fMotherTargetAbsolutePosition = fTargetMother->GetTranslation().z(); - for (std::vector::iterator - it = fTargetVolumes.begin(); it != fTargetVolumes.end(); it++) { + // Get absolute position + fMotherTargetAbsolutePosition = fTargetMothers[fActiveTargetMother]->GetTranslation().z() - 4500; + + for (auto it = fTargetVolumes[fActiveTargetMother].begin(); + it != fTargetVolumes[fActiveTargetMother].end(); + it++) { // Try to cast the target volume into its tubs solid G4LogicalVolume* volume = (*it)->GetLogicalVolume(); G4Material* material = volume->GetMaterial(); G4VSolid* solid = volume->GetSolid(); + G4Tubs* tubs = dynamic_cast(solid); + G4Box* box = dynamic_cast(solid); // Assume everything is non-nested tubes - if( !tubs ){ + if (!tubs && !box) { G4cerr << "ERROR: " << __PRETTY_FUNCTION__ << " line " << __LINE__ << - ": Target volume not made of G4Tubs" << G4endl; - exit(1); + ": Target volume " << (*it)->GetLogicalVolume()->GetName() << " not made of G4Tubs or G4Box" << G4endl; + continue; // exit(1); } - if( (*it)->GetLogicalVolume()->GetName() == fActiveTargetVolume ){ + if (it == fTargetVolumes[fActiveTargetMother].begin() + fActiveTargetVolume) { if( fActiveTargetEffectiveLength >= 0.0 ){ G4cerr << "ERROR: " << __PRETTY_FUNCTION__ << " line " << __LINE__ << @@ -155,24 +173,57 @@ void remollBeamTarget::UpdateInfo() exit(1); } - fActiveTargetEffectiveLength = tubs->GetZHalfLength()*2.0 + G4double z_half_length = 0; + if (tubs) z_half_length = tubs->GetZHalfLength(); + if (box) z_half_length = box->GetZHalfLength(); + + fActiveTargetEffectiveLength = z_half_length*2.0 * material->GetDensity(); fActiveTargetRelativePosition = (*it)->GetTranslation().z(); - fTotalTargetEffectiveLength += tubs->GetZHalfLength()*2.0 + fTotalTargetEffectiveLength += z_half_length*2.0 * material->GetDensity(); } } } +void remollBeamTarget::SetActiveTargetMother(G4String name) +{ + G4AutoLock lock(&remollBeamTargetMutex); + + for (auto mother = fTargetMothers.begin(); + mother != fTargetMothers.end(); + mother++) { + + if ((*mother)->GetName() == name) { + fActiveTargetMother = mother - fTargetMothers.begin(); + } + + } + + lock.unlock(); + + UpdateInfo(); +} + void remollBeamTarget::SetActiveTargetVolume(G4String name) { G4AutoLock lock(&remollBeamTargetMutex); - fActiveTargetVolume = name; + + for (auto daughter = fTargetVolumes[fActiveTargetMother].begin(); + daughter != fTargetVolumes[fActiveTargetMother].end(); + daughter++) { + + if ((*daughter)->GetName() == name) { + fActiveTargetVolume = daughter - fTargetVolumes[fActiveTargetMother].begin(); + } + + } lock.unlock(); + UpdateInfo(); } @@ -187,17 +238,19 @@ remollVertex remollBeamTarget::SampleVertex(SamplingType_t sampling_type) // No sampling required if (sampling_type == kNoTargetVolume) { + G4cerr << "ERROR: " << __PRETTY_FUNCTION__ << " line " << __LINE__ << ": " << + "kNoTargetVolume!" << G4endl; return vertex; } // Check if target mother volume exists - if (fTargetMother == 0) { + if (fTargetMothers.size() == 0) { G4cerr << "ERROR: " << __PRETTY_FUNCTION__ << " line " << __LINE__ << ": " << "No target mother volume defined!" << G4endl; } // Check if target volume exists - if (fTargetVolumes.size() == 0) { + if (fTargetVolumes[fActiveTargetMother].size() == 0) { G4cerr << "ERROR: " << __PRETTY_FUNCTION__ << " line " << __LINE__ << ": " << "No target volume defined!" << G4endl; } @@ -237,14 +290,12 @@ remollVertex remollBeamTarget::SampleVertex(SamplingType_t sampling_type) // Start with no multiple scattering materials loaded: // this may seem like something that can be made static, // but it's probably not worth it since only called once per event. - int nmsmat = 0; - double msthick[__MAX_MAT]; - double msA[__MAX_MAT]; - double msZ[__MAX_MAT]; + std::vector> ms; // Figure out the material we are in and the radiation length we traversed - for (std::vector::iterator - it = fTargetVolumes.begin(); it != fTargetVolumes.end() && !found_active_volume; it++ ){ + for (auto it = fTargetVolumes[fActiveTargetMother].begin(); + it != fTargetVolumes[fActiveTargetMother].end() && !found_active_volume; + it++) { // Relative position of this target volume in mother volume G4double volume_relative_position = (*it)->GetTranslation().z(); @@ -253,17 +304,29 @@ remollVertex remollBeamTarget::SampleVertex(SamplingType_t sampling_type) G4LogicalVolume* volume = (*it)->GetLogicalVolume(); G4Material* material = volume->GetMaterial(); G4VSolid* solid = volume->GetSolid(); + G4Tubs* tubs = dynamic_cast(solid); + G4Box* box = dynamic_cast(solid); + + if (!tubs && !box) { + G4cerr << "ERROR: " << __PRETTY_FUNCTION__ << " line " << __LINE__ << + ": Target volume " << (*it)->GetLogicalVolume()->GetName() << " not made of G4Tubs or G4Box" << G4endl; + continue; // exit(1); + } + + G4double z_half_length = 0; + if (box) z_half_length = box->GetZHalfLength(); + if (tubs) z_half_length = tubs->GetZHalfLength(); // Effective length of this target volume - G4double effective_length = tubs->GetZHalfLength()*2.0 * material->GetDensity(); + G4double effective_length = z_half_length*2.0 * material->GetDensity(); // Find position in this volume (if we are in it) G4double effective_position_in_volume; G4double actual_position_in_volume; switch (sampling_type) { case kActiveTargetVolume: - if ((*it)->GetLogicalVolume()->GetName() == fActiveTargetVolume ){ + if (it == fTargetVolumes[fActiveTargetMother].begin() + fActiveTargetVolume) { // This is the active volume, and we only sample here found_active_volume = true; actual_position_in_volume = effective_position/material->GetDensity(); @@ -311,7 +374,7 @@ remollVertex remollBeamTarget::SampleVertex(SamplingType_t sampling_type) fRadiationLength = cumulative_radiation_length; fVer = G4ThreeVector( rasx, rasy, fMotherTargetAbsolutePosition - + volume_relative_position - tubs->GetZHalfLength() + + volume_relative_position - z_half_length + actual_position_in_volume ); G4double masssum = 0.0; @@ -324,10 +387,10 @@ remollVertex remollBeamTarget::SampleVertex(SamplingType_t sampling_type) // but it does - SPR 2/5/13. assert( atomvec ); masssum += (*elvec)[i]->GetA()*atomvec[i]; - msthick[nmsmat] = material->GetDensity()*actual_position_in_volume*fracvec[i]; - msA[nmsmat] = (*elvec)[i]->GetA()*mole/g; - msZ[nmsmat] = (*elvec)[i]->GetZ(); - nmsmat++; + double t = material->GetDensity()*actual_position_in_volume*fracvec[i]; + double A = (*elvec)[i]->GetA()*mole/g; + double Z = (*elvec)[i]->GetZ(); + ms.push_back(std::make_tuple(t,A,Z)); } // Effective material length for luminosity calculation @@ -337,10 +400,10 @@ remollVertex remollBeamTarget::SampleVertex(SamplingType_t sampling_type) const G4ElementVector *elvec = material->GetElementVector(); const G4double *fracvec = material->GetFractionVector(); for( unsigned int i = 0; i < elvec->size(); i++ ){ - msthick[nmsmat] = effective_length*fracvec[i]; - msA[nmsmat] = (*elvec)[i]->GetA()*mole/g; - msZ[nmsmat] = (*elvec)[i]->GetZ(); - nmsmat++; + double t = effective_length*fracvec[i]; + double A = (*elvec)[i]->GetA()*mole/g; + double Z = (*elvec)[i]->GetZ(); + ms.push_back(std::make_tuple(t,A,Z)); } } } @@ -361,8 +424,8 @@ remollVertex remollBeamTarget::SampleVertex(SamplingType_t sampling_type) // Sample multiple scattering angles G4double msth = 0, msph = 0; - if( nmsmat > 0 ){ - fMS->Init( fBeamEnergy, nmsmat, msthick, msA, msZ ); + if (ms.size() > 0) { + fMS->Init(fBeamEnergy, ms); msth = fMS->GenerateMSPlane(); msph = fMS->GenerateMSPlane(); } From 98a9a6b1d9c76a68372fa8ffe8abc6cec934963c Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 5 Apr 2021 17:12:16 -0500 Subject: [PATCH 323/443] [construction] load target volumes correctly --- src/remollDetectorConstruction.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/remollDetectorConstruction.cc b/src/remollDetectorConstruction.cc index a43fca4bb..080b7e687 100644 --- a/src/remollDetectorConstruction.cc +++ b/src/remollDetectorConstruction.cc @@ -621,7 +621,7 @@ void remollDetectorConstruction::ParseAuxiliaryTargetInfo() // Found target mother logical volume G4LogicalVolume* mother_logical_volume = logical_volume; if (fVerboseLevel > 0) - G4cout << "Found target mother logical volume " + G4cout << "Found target system mother logical volume " << mother_logical_volume->GetName() << "." << G4endl; // Now find target mother physical volume @@ -633,15 +633,14 @@ void remollDetectorConstruction::ParseAuxiliaryTargetInfo() // Mutex lock before writing static structures in remollBeamTarget G4AutoLock lock(&remollDetectorConstructionMutex); - remollBeamTarget::ResetTargetVolumes(); - remollBeamTarget::SetMotherVolume(mother_physical_volume); + remollBeamTarget::AddMotherVolume(mother_physical_volume); if (fVerboseLevel > 0) G4cout << "Found target mother physical volume " << mother_physical_volume->GetName() << "." << G4endl; } else { G4cout << "Target mother logical volume does not occur " - << "*exactly once* as a physical volume." << G4endl; + << "*exactly once as a physical volume." << G4endl; exit(-1); } @@ -689,6 +688,8 @@ void remollDetectorConstruction::ParseAuxiliaryTargetInfo() } // loop over auxiliary tags in volume to find "TargetSystem" } // loop over volumes with auxiliary tags to find "TargetSystem" + + remollBeamTarget::UpdateInfo(); } void remollDetectorConstruction::ParseAuxiliaryUserLimits() From fe68b0fe83f51479760e9a0f62c4ab6be530ad57 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 5 Apr 2021 17:17:49 -0500 Subject: [PATCH 324/443] [target] Additional target ladder macros --- macros/target/AlDummy1DS.mac | 1 + macros/target/AlDummy1US.mac | 1 + macros/target/AlDummy2DS.mac | 1 + macros/target/AlDummy2US.mac | 1 + macros/target/AlDummyHoleDS.mac | 1 + macros/target/AlDummyHoleUS.mac | 1 + macros/target/LH2.mac | 1 + macros/target/Optics1.mac | 1 + macros/target/Optics2.mac | 1 + 9 files changed, 9 insertions(+) create mode 100644 macros/target/AlDummy1DS.mac create mode 100644 macros/target/AlDummy1US.mac create mode 100644 macros/target/AlDummy2DS.mac create mode 100644 macros/target/AlDummy2US.mac create mode 100644 macros/target/AlDummyHoleDS.mac create mode 100644 macros/target/AlDummyHoleUS.mac create mode 100644 macros/target/LH2.mac create mode 100644 macros/target/Optics1.mac create mode 100644 macros/target/Optics2.mac diff --git a/macros/target/AlDummy1DS.mac b/macros/target/AlDummy1DS.mac new file mode 100644 index 000000000..36e24af43 --- /dev/null +++ b/macros/target/AlDummy1DS.mac @@ -0,0 +1 @@ +/remoll/geometry/absolute_position targetLadder (0,350,0) diff --git a/macros/target/AlDummy1US.mac b/macros/target/AlDummy1US.mac new file mode 100644 index 000000000..926d02954 --- /dev/null +++ b/macros/target/AlDummy1US.mac @@ -0,0 +1 @@ +/remoll/geometry/absolute_position targetLadder (0,280,0) diff --git a/macros/target/AlDummy2DS.mac b/macros/target/AlDummy2DS.mac new file mode 100644 index 000000000..8cb071ab5 --- /dev/null +++ b/macros/target/AlDummy2DS.mac @@ -0,0 +1 @@ +/remoll/geometry/absolute_position targetLadder (0,490,0) diff --git a/macros/target/AlDummy2US.mac b/macros/target/AlDummy2US.mac new file mode 100644 index 000000000..b2a2e8f29 --- /dev/null +++ b/macros/target/AlDummy2US.mac @@ -0,0 +1 @@ +/remoll/geometry/absolute_position targetLadder (0,420,0) diff --git a/macros/target/AlDummyHoleDS.mac b/macros/target/AlDummyHoleDS.mac new file mode 100644 index 000000000..cedcbb6da --- /dev/null +++ b/macros/target/AlDummyHoleDS.mac @@ -0,0 +1 @@ +/remoll/geometry/absolute_position targetLadder (0,210,0) diff --git a/macros/target/AlDummyHoleUS.mac b/macros/target/AlDummyHoleUS.mac new file mode 100644 index 000000000..5fa06ce9e --- /dev/null +++ b/macros/target/AlDummyHoleUS.mac @@ -0,0 +1 @@ +/remoll/geometry/absolute_position targetLadder (0,140,0) diff --git a/macros/target/LH2.mac b/macros/target/LH2.mac new file mode 100644 index 000000000..e43e00a41 --- /dev/null +++ b/macros/target/LH2.mac @@ -0,0 +1 @@ +/remoll/geometry/absolute_position targetLadder (0,0,0) diff --git a/macros/target/Optics1.mac b/macros/target/Optics1.mac new file mode 100644 index 000000000..59a980104 --- /dev/null +++ b/macros/target/Optics1.mac @@ -0,0 +1 @@ +/remoll/geometry/absolute_position targetLadder (0,560,0) diff --git a/macros/target/Optics2.mac b/macros/target/Optics2.mac new file mode 100644 index 000000000..85014fa23 --- /dev/null +++ b/macros/target/Optics2.mac @@ -0,0 +1 @@ +/remoll/geometry/absolute_position targetLadder (0,630,0) From db551cd85fd874c7a4f17815d91d7d1bdb9c1377 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 5 Apr 2021 17:24:37 -0500 Subject: [PATCH 325/443] [macros] examples to run on AlDummy1US and Optics1 --- macros/runexample_AlDummy1US.mac | 29 ++++++++++++++++++++ macros/runexample_C12.mac | 45 -------------------------------- macros/runexample_Optics1.mac | 28 ++++++++++++++++++++ 3 files changed, 57 insertions(+), 45 deletions(-) create mode 100644 macros/runexample_AlDummy1US.mac delete mode 100644 macros/runexample_C12.mac create mode 100644 macros/runexample_Optics1.mac diff --git a/macros/runexample_AlDummy1US.mac b/macros/runexample_AlDummy1US.mac new file mode 100644 index 000000000..0001cbde6 --- /dev/null +++ b/macros/runexample_AlDummy1US.mac @@ -0,0 +1,29 @@ +# Example file + +# This must be called before initialize +/remoll/geometry/setfile geometry/mollerMother.gdml +/remoll/parallel/setfile geometry/mollerParallel.gdml + +# This must be explicitly called +/run/initialize + +# Set target ladder position +/control/execute macros/target/AlDummy1US.mac + +# Load magnetic fields +/control/execute macros/load_magnetic_fieldmaps.mac + +# Raster and initial angle stuff +/remoll/oldras true +/remoll/rasx 5 mm +/remoll/rasy 5 mm + +/remoll/evgen/set elasticAl + +/remoll/beamcurr 85 microampere + +/remoll/seed 123456 + +/remoll/printtargetinfo +/run/beamOn 100 + diff --git a/macros/runexample_C12.mac b/macros/runexample_C12.mac deleted file mode 100644 index 766f42ebd..000000000 --- a/macros/runexample_C12.mac +++ /dev/null @@ -1,45 +0,0 @@ -# Example file - -# This must be called before initialize -/remoll/setgeofile geometry_sculpt/mollerMother.gdml - -# This must be explicitly called -/run/initialize - -/control/execute macros/load_magnetic_fieldmaps.mac - -# Raster and initial angle stuff -/remoll/rasx 0 mm -/remoll/rasy 0 mm -#/remoll/beam_x0 0 mm -#/remoll/beam_y0 0 mm -# initial angle -#/remoll/beam_th0 0 mrad -#/remoll/beam_ph0 0 mrad -# gaussian spread widths -#/remoll/beam_dth 0 mrad -#/remoll/beam_dph 0 mrad - -/remoll/gen carbon -/remoll/thmin 0.1 deg -/remoll/thmax 2.0 deg - -/remoll/beamcurr 85 microampere - -#Enable optical photons and processes -#/remoll/optical true - -# Make interactions with W, Cu, and Pb -# realistic rather than pure absorbers -#/remoll/krypt true - -# Specify random number seed -/remoll/seed 123456 - -#/tracking/storeTrajectory 1 -#/tracking/verbose 2 -#/run/verbose 2 - -/remoll/filename Rootfiles/remoll_C12_noras_4GEMRes75um_det28z.root -/run/beamOn 1000000 - diff --git a/macros/runexample_Optics1.mac b/macros/runexample_Optics1.mac new file mode 100644 index 000000000..2ddc25b31 --- /dev/null +++ b/macros/runexample_Optics1.mac @@ -0,0 +1,28 @@ +# Example file + +# This must be called before initialize +/remoll/geometry/setfile geometry/mollerMother.gdml +/remoll/parallel/setfile geometry/mollerParallel.gdml + +# This must be explicitly called +/run/initialize + +# Set target ladder position +/control/execute macros/target/Optics1.mac + +# Load magnetic fields +/control/execute macros/load_magnetic_fieldmaps.mac + +# Raster and initial angle stuff +/remoll/rasx 0 mm +/remoll/rasy 0 mm + +/remoll/evgen/set carbon + +/remoll/beamcurr 85 microampere + +/remoll/seed 123456 + +/remoll/printtargetinfo +/run/beamOn 100 + From 1476a58cecfd970d6d4fd5975e38b8aae3e14d49 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 5 Apr 2021 20:55:16 -0500 Subject: [PATCH 326/443] [target] use short target tags instead of volume names --- geometry/target/targetLadder.gdml | 72 +++++++++++++++++++++---------- include/remollBeamTarget.hh | 15 ++++--- macros/runexample_AlDummy1US.mac | 11 +++-- macros/target/AlDummy1US.mac | 2 + macros/target/Optics1.mac | 2 + src/remollBeamTarget.cc | 63 +++++++++++++++------------ src/remollDetectorConstruction.cc | 10 ++++- src/remollGenpElastic.cc | 10 ++--- 8 files changed, 119 insertions(+), 66 deletions(-) diff --git a/geometry/target/targetLadder.gdml b/geometry/target/targetLadder.gdml index 2b02bfa0d..52b68dff2 100644 --- a/geometry/target/targetLadder.gdml +++ b/geometry/target/targetLadder.gdml @@ -44,18 +44,18 @@ - - - - - - + + + + + + @@ -79,16 +79,21 @@ - + + + + + + - + - + @@ -97,27 +102,37 @@ - + - + - + + + + + + - + - + + + + + + - + @@ -126,7 +141,7 @@ - + @@ -135,7 +150,7 @@ - + @@ -144,31 +159,44 @@ - + - + + + + + + - + - + + + + + - + + + + + diff --git a/include/remollBeamTarget.hh b/include/remollBeamTarget.hh index f80e12de7..5d23db51c 100644 --- a/include/remollBeamTarget.hh +++ b/include/remollBeamTarget.hh @@ -38,8 +38,8 @@ class remollBeamTarget { static G4String fActiveTargetVolumeName; static size_t fActiveTargetMother; static size_t fActiveTargetVolume; - static std::vector fTargetMothers; - static std::vector> fTargetVolumes; + static std::vector> fTargetMothers; + static std::vector>> fTargetVolumes; // Effective lengths are weighted by density (i.e. in 1/cm^2) static G4double fTotalTargetEffectiveLength; @@ -57,15 +57,15 @@ class remollBeamTarget { fTargetVolumes.clear(); fTargetMothers.clear(); } - static void AddMotherVolume(G4VPhysicalVolume *v) { - fTargetMothers.push_back(v); + static void AddMotherVolume(G4VPhysicalVolume *v, const G4String& tag) { + fTargetMothers.push_back(std::make_pair(v,tag)); fTargetVolumes.resize(fTargetMothers.size()); fActiveTargetMother = fTargetMothers.size() - 1; } - static void AddTargetVolume(G4VPhysicalVolume *v) { - fTargetVolumes[fActiveTargetMother].push_back(v); + static void AddTargetVolume(G4VPhysicalVolume *v, const G4String& tag) { + fTargetVolumes[fActiveTargetMother].push_back(std::make_pair(v,tag)); } - static std::vector GetTargetVolumes() { + static std::vector> GetTargetVolumes() { return fTargetVolumes[fActiveTargetMother]; } @@ -93,6 +93,7 @@ class remollBeamTarget { private: G4GenericMessenger* fMessenger; + G4GenericMessenger* fMessengerTarget; G4Material *fDefaultMat; diff --git a/macros/runexample_AlDummy1US.mac b/macros/runexample_AlDummy1US.mac index 0001cbde6..dc7740adc 100644 --- a/macros/runexample_AlDummy1US.mac +++ b/macros/runexample_AlDummy1US.mac @@ -9,6 +9,9 @@ # Set target ladder position /control/execute macros/target/AlDummy1US.mac +#/control/execute macros/target/AlDummy1DS.mac +#/control/execute macros/target/AlDummy2US.mac +#/control/execute macros/target/AlDummy2DS.mac # Load magnetic fields /control/execute macros/load_magnetic_fieldmaps.mac @@ -18,12 +21,14 @@ /remoll/rasx 5 mm /remoll/rasy 5 mm -/remoll/evgen/set elasticAl +#/remoll/evgen/set elasticAl +/remoll/evgen/set inelasticAl +#/remoll/evgen/set quasielasticAl +#/remoll/evgen/set moller /remoll/beamcurr 85 microampere /remoll/seed 123456 -/remoll/printtargetinfo +/remoll/target/print /run/beamOn 100 - diff --git a/macros/target/AlDummy1US.mac b/macros/target/AlDummy1US.mac index 926d02954..a473767ff 100644 --- a/macros/target/AlDummy1US.mac +++ b/macros/target/AlDummy1US.mac @@ -1 +1,3 @@ /remoll/geometry/absolute_position targetLadder (0,280,0) +/remoll/target/mother AlDummy1US +/remoll/target/volume USAl diff --git a/macros/target/Optics1.mac b/macros/target/Optics1.mac index 59a980104..b68c4c31f 100644 --- a/macros/target/Optics1.mac +++ b/macros/target/Optics1.mac @@ -1 +1,3 @@ /remoll/geometry/absolute_position targetLadder (0,560,0) +/remoll/target/mother Optics1 +/remoll/target/volume DSC diff --git a/src/remollBeamTarget.cc b/src/remollBeamTarget.cc index 542b9d1b0..6f0e016c5 100644 --- a/src/remollBeamTarget.cc +++ b/src/remollBeamTarget.cc @@ -24,19 +24,17 @@ #include -#define __MAX_MAT 100 - #include "G4Threading.hh" #include "G4AutoLock.hh" namespace { G4Mutex remollBeamTargetMutex = G4MUTEX_INITIALIZER; } // Initialize static geometry objects -G4String remollBeamTarget::fActiveTargetMotherName = "TargetLH2_logical_PV"; -G4String remollBeamTarget::fActiveTargetVolumeName = "targetLH2_LH2Volume_logical"; +G4String remollBeamTarget::fActiveTargetMotherName = "LH2"; +G4String remollBeamTarget::fActiveTargetVolumeName = "LH2"; size_t remollBeamTarget::fActiveTargetMother = 0; size_t remollBeamTarget::fActiveTargetVolume = 0; -std::vector remollBeamTarget::fTargetMothers; -std::vector> remollBeamTarget::fTargetVolumes; +std::vector> remollBeamTarget::fTargetMothers; +std::vector>> remollBeamTarget::fTargetVolumes; G4double remollBeamTarget::fActiveTargetEffectiveLength = -1e9; G4double remollBeamTarget::fMotherTargetAbsolutePosition = -1e9; @@ -60,8 +58,6 @@ remollBeamTarget::remollBeamTarget() // Create generic messenger fMessenger = new G4GenericMessenger(this,"/remoll/","Remoll properties"); - fMessenger->DeclareMethod("targname",&remollBeamTarget::SetActiveTargetVolume,"Target name").SetStates(G4State_Idle); - fMessenger->DeclareMethod("printtargetinfo",&remollBeamTarget::PrintTargetInfo).SetStates(G4State_Idle); fMessenger->DeclarePropertyWithUnit("beamcurr","microampere",fBeamCurrent,"Beam current"); fMessenger->DeclarePropertyWithUnit("beamene","GeV",fBeamEnergy,"Beam energy"); @@ -78,10 +74,16 @@ remollBeamTarget::remollBeamTarget() fMessenger->DeclarePropertyWithUnit("beam_corrth","deg",fCorrTh,"beam correlated angle (vertical)"); fMessenger->DeclarePropertyWithUnit("beam_dph","deg",fdPh,"beam gaussian spread in x (horizontal)"); fMessenger->DeclarePropertyWithUnit("beam_dth","deg",fdTh,"beam gaussian spread in y (vertical)"); + + fMessengerTarget = new G4GenericMessenger(this,"/remoll/target/","Remoll target properties"); + fMessengerTarget->DeclareMethod("mother",&remollBeamTarget::SetActiveTargetMother,"Set target mother name").SetStates(G4State_Idle); + fMessengerTarget->DeclareMethod("volume",&remollBeamTarget::SetActiveTargetVolume,"Set target volume name").SetStates(G4State_Idle); + fMessengerTarget->DeclareMethod("print",&remollBeamTarget::PrintTargetInfo).SetStates(G4State_Idle); } remollBeamTarget::~remollBeamTarget() { + delete fMessengerTarget; delete fMessenger; delete fMS; } @@ -102,20 +104,17 @@ void remollBeamTarget::PrintTargetInfo() auto i_mother = mother - fTargetMothers.begin(); - G4cout << "Target mother " << (*mother)->GetName() << ":" << G4endl; + G4cout << "Target mother " << (*mother).second << ":" << G4endl; for (auto daughter = fTargetVolumes[i_mother].begin(); daughter != fTargetVolumes[i_mother].end(); daughter++) { - G4LogicalVolume* volume = (*daughter)->GetLogicalVolume(); + G4LogicalVolume* volume = (*daughter).first->GetLogicalVolume(); G4Material* material = volume->GetMaterial(); - G4VSolid* solid = volume->GetSolid(); - G4cout << " Target volume " << (*daughter)->GetName() << ":" << G4endl; - G4cout << " volume: " << volume->GetName() << G4endl; - G4cout << " material: " << material->GetName() << G4endl; - G4cout << " solid: " << solid->GetName() << G4endl; + G4cout << " Target volume " << (*daughter).second << ":"; + G4cout << " material: " << material->GetName() << G4endl; } } @@ -123,10 +122,14 @@ void remollBeamTarget::PrintTargetInfo() SetActiveTargetMother(fActiveTargetMotherName); SetActiveTargetVolume(fActiveTargetVolumeName); + G4cout << "Current active target: " << G4endl; + G4cout << "Target mother = " << fActiveTargetMotherName << G4endl; + G4cout << "Target volume = " << fActiveTargetVolumeName << G4endl; + G4cout << "Final target parameters: " << G4endl; - G4cout << " active target effective length: " << fActiveTargetEffectiveLength << G4endl; - G4cout << " active target relative position: " << fActiveTargetRelativePosition << G4endl; - G4cout << " total active length: " << fTotalTargetEffectiveLength << G4endl; + G4cout << " total target effective length: " << fTotalTargetEffectiveLength/(gram/cm2) << " gram/cm2" << G4endl; + G4cout << " active target effective length: " << fActiveTargetEffectiveLength/(gram/cm2) << " gram/cm2" << G4endl; + G4cout << " active target relative position: " << fActiveTargetRelativePosition/mm << " mm" << G4endl; } void remollBeamTarget::UpdateInfo() @@ -144,14 +147,15 @@ void remollBeamTarget::UpdateInfo() } // Get absolute position - fMotherTargetAbsolutePosition = fTargetMothers[fActiveTargetMother]->GetTranslation().z() - 4500; + fMotherTargetAbsolutePosition = fTargetMothers[fActiveTargetMother].first->GetTranslation().z() - 4500; for (auto it = fTargetVolumes[fActiveTargetMother].begin(); it != fTargetVolumes[fActiveTargetMother].end(); it++) { // Try to cast the target volume into its tubs solid - G4LogicalVolume* volume = (*it)->GetLogicalVolume(); + G4VPhysicalVolume* physvol = (*it).first; + G4LogicalVolume* volume = physvol->GetLogicalVolume(); G4Material* material = volume->GetMaterial(); G4VSolid* solid = volume->GetSolid(); @@ -161,7 +165,7 @@ void remollBeamTarget::UpdateInfo() // Assume everything is non-nested tubes if (!tubs && !box) { G4cerr << "ERROR: " << __PRETTY_FUNCTION__ << " line " << __LINE__ << - ": Target volume " << (*it)->GetLogicalVolume()->GetName() << " not made of G4Tubs or G4Box" << G4endl; + ": Target volume " << volume->GetName() << " not made of G4Tubs or G4Box" << G4endl; continue; // exit(1); } @@ -180,7 +184,7 @@ void remollBeamTarget::UpdateInfo() fActiveTargetEffectiveLength = z_half_length*2.0 * material->GetDensity(); - fActiveTargetRelativePosition = (*it)->GetTranslation().z(); + fActiveTargetRelativePosition = physvol->GetTranslation().z(); fTotalTargetEffectiveLength += z_half_length*2.0 * material->GetDensity(); @@ -197,7 +201,8 @@ void remollBeamTarget::SetActiveTargetMother(G4String name) mother != fTargetMothers.end(); mother++) { - if ((*mother)->GetName() == name) { + if ((*mother).second == name) { + fActiveTargetMotherName = name; fActiveTargetMother = mother - fTargetMothers.begin(); } @@ -216,7 +221,8 @@ void remollBeamTarget::SetActiveTargetVolume(G4String name) daughter != fTargetVolumes[fActiveTargetMother].end(); daughter++) { - if ((*daughter)->GetName() == name) { + if ((*daughter).second == name) { + fActiveTargetVolumeName = name; fActiveTargetVolume = daughter - fTargetVolumes[fActiveTargetMother].begin(); } @@ -297,11 +303,14 @@ remollVertex remollBeamTarget::SampleVertex(SamplingType_t sampling_type) it != fTargetVolumes[fActiveTargetMother].end() && !found_active_volume; it++) { + // Target volume + G4VPhysicalVolume* physvol = (*it).first; + // Relative position of this target volume in mother volume - G4double volume_relative_position = (*it)->GetTranslation().z(); + G4double volume_relative_position = physvol->GetTranslation().z(); // Try to cast the target volume into its tubs solid - G4LogicalVolume* volume = (*it)->GetLogicalVolume(); + G4LogicalVolume* volume = physvol->GetLogicalVolume(); G4Material* material = volume->GetMaterial(); G4VSolid* solid = volume->GetSolid(); @@ -310,7 +319,7 @@ remollVertex remollBeamTarget::SampleVertex(SamplingType_t sampling_type) if (!tubs && !box) { G4cerr << "ERROR: " << __PRETTY_FUNCTION__ << " line " << __LINE__ << - ": Target volume " << (*it)->GetLogicalVolume()->GetName() << " not made of G4Tubs or G4Box" << G4endl; + ": Target volume " << volume->GetName() << " not made of G4Tubs or G4Box" << G4endl; continue; // exit(1); } diff --git a/src/remollDetectorConstruction.cc b/src/remollDetectorConstruction.cc index 080b7e687..eda7ab71d 100644 --- a/src/remollDetectorConstruction.cc +++ b/src/remollDetectorConstruction.cc @@ -618,6 +618,9 @@ void remollDetectorConstruction::ParseAuxiliaryTargetInfo() // Treat auxiliary type "TargetSystem" only if ((*vit).type != "TargetSystem") continue; + // Target system name + G4String mother_tag = (*vit).value; + // Found target mother logical volume G4LogicalVolume* mother_logical_volume = logical_volume; if (fVerboseLevel > 0) @@ -633,7 +636,7 @@ void remollDetectorConstruction::ParseAuxiliaryTargetInfo() // Mutex lock before writing static structures in remollBeamTarget G4AutoLock lock(&remollDetectorConstructionMutex); - remollBeamTarget::AddMotherVolume(mother_physical_volume); + remollBeamTarget::AddMotherVolume(mother_physical_volume, mother_tag); if (fVerboseLevel > 0) G4cout << "Found target mother physical volume " @@ -674,10 +677,13 @@ void remollDetectorConstruction::ParseAuxiliaryTargetInfo() // If the logical volume is tagged as "TargetSamplingVolume" if ((*vit2).type != "TargetSamplingVolume") continue; + // Target system name + G4String target_tag = (*vit2).value; + // Add target volume G4cout << "Adding target sampling volume " << target_logical_volume->GetName() << "." << G4endl; - remollBeamTarget::AddTargetVolume(target_physical_volume); + remollBeamTarget::AddTargetVolume(target_physical_volume, target_tag); } // loop over auxiliary tags in volume to find "TargetSamplingVolume" diff --git a/src/remollGenpElastic.cc b/src/remollGenpElastic.cc index 918aaa49f..64fa57ad2 100644 --- a/src/remollGenpElastic.cc +++ b/src/remollGenpElastic.cc @@ -39,16 +39,16 @@ void remollGenpElastic::SamplePhysics(remollVertex *vert, remollEvent *evt){ double beamE = fBeamTarg->fBeamEnergy; double Ekin = beamE - electron_mass_c2; - std::vector targVols = fBeamTarg->GetTargetVolumes(); + auto targVols = fBeamTarg->GetTargetVolumes(); bool bypass_target = false; - std::vector::iterator it = targVols.begin(); + auto it = targVols.begin(); if( targVols.size() > 0 ){ - while( (*it)->GetLogicalVolume()->GetMaterial()->GetName() != "G4_lH2" + while( (*it).first->GetLogicalVolume()->GetMaterial()->GetName() != "G4_lH2" && it != targVols.end() ){ it++; } - if( (*it)->GetLogicalVolume()->GetMaterial()->GetName() != "G4_lH2" ){ + if( (*it).first->GetLogicalVolume()->GetMaterial()->GetName() != "G4_lH2" ){ G4cerr << __FILE__ << " line " << __LINE__ << ": WARNING could not find target" << G4endl; bypass_target = true; } @@ -66,7 +66,7 @@ void remollGenpElastic::SamplePhysics(remollVertex *vert, remollEvent *evt){ double bt; if( !bypass_target ){ - bt = (4.0/3.0)*(fBeamTarg->fTravelledLength/(*it)->GetLogicalVolume()->GetMaterial()->GetRadlen() + bt = (4.0/3.0)*(fBeamTarg->fTravelledLength/(*it).first->GetLogicalVolume()->GetMaterial()->GetRadlen() + int_bt); } else { bt = 0.0; From afc02bf9763782a3464085f96d3cc4ef88cbf309 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 5 Apr 2021 20:55:34 -0500 Subject: [PATCH 327/443] /remoll/target/print instead of printtargetinfo --- macros/runexample_Optics1.mac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/runexample_Optics1.mac b/macros/runexample_Optics1.mac index 2ddc25b31..edb700046 100644 --- a/macros/runexample_Optics1.mac +++ b/macros/runexample_Optics1.mac @@ -23,6 +23,6 @@ /remoll/seed 123456 -/remoll/printtargetinfo +/remoll/target/print /run/beamOn 100 From db19aa4cd59fb66fb580febeee5813028abbb24e Mon Sep 17 00:00:00 2001 From: Yug34 Date: Wed, 7 Apr 2021 02:54:37 +0530 Subject: [PATCH 328/443] [io] remoll runs, but does not produce output for illegal/bad file name --- macros/runexample.mac | 2 ++ remoll.cc | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/macros/runexample.mac b/macros/runexample.mac index 36bfe7650..8ef7f92bf 100644 --- a/macros/runexample.mac +++ b/macros/runexample.mac @@ -78,7 +78,9 @@ # Specify random number seed /remoll/seed 123456 +# Still need to comment this out in every macro file: /remoll/filename remollout.root +# ^The PR does not override this^ #/tracking/verbose 2 /remoll/printtargetinfo diff --git a/remoll.cc b/remoll.cc index 430291fa3..8f897149a 100644 --- a/remoll.cc +++ b/remoll.cc @@ -101,7 +101,21 @@ int main(int argc, char** argv) { else if (G4String(argv[i]) == "-p") parallel_gdmlfile = argv[++i]; else if (G4String(argv[i]) == "-u") session = argv[++i]; else if (G4String(argv[i]) == "-r") seed = atol(argv[++i]); - else if (G4String(argv[i]) == "-o") outputfile = argv[++i]; + else if (G4String(argv[i]) == "-o") { + outputfile = argv[++i]; + + const std::string illegalChars = "$?<>:*\?\\\'\""; + + for(auto ch : illegalChars) { + if (outputfile.find(ch) != std::string::npos) { + G4cerr << "==================Filename Error: ==================" << G4endl; + G4cerr << "Output file name cannot have " << ch << " in the name, aborting" << G4endl; + G4cerr << "====================================================" << G4endl; + + return 1; + } + } + } #ifdef G4MULTITHREADED else if (G4String(argv[i]) == "-t") threads = atoi(argv[++i]); #endif From f3d21fa4f64b0a3f50ee473d946b324f5408b493 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 7 Apr 2021 10:49:44 -0500 Subject: [PATCH 329/443] [target] rename AlDummyHoleDS.mac to AlHoleDS.mac --- macros/target/AlDummyHoleDS.mac | 2 ++ macros/target/{AlDummyHoleUS.mac => AlHoleUS.mac} | 0 2 files changed, 2 insertions(+) rename macros/target/{AlDummyHoleUS.mac => AlHoleUS.mac} (100%) diff --git a/macros/target/AlDummyHoleDS.mac b/macros/target/AlDummyHoleDS.mac index cedcbb6da..639298318 100644 --- a/macros/target/AlDummyHoleDS.mac +++ b/macros/target/AlDummyHoleDS.mac @@ -1 +1,3 @@ /remoll/geometry/absolute_position targetLadder (0,210,0) +/remoll/target/mother AlHoleDS +/remoll/target/volume DSAl diff --git a/macros/target/AlDummyHoleUS.mac b/macros/target/AlHoleUS.mac similarity index 100% rename from macros/target/AlDummyHoleUS.mac rename to macros/target/AlHoleUS.mac From 8374ee147803f8e792474fb9530869970b198094 Mon Sep 17 00:00:00 2001 From: Sakib Rahman Date: Thu, 8 Apr 2021 12:42:57 -0400 Subject: [PATCH 330/443] Resolving conflict with develop --- geometry/hybrid/hybridDaughter_merged.gdml | 55 +-- geometry/hybrid/hybridToroid.gdml | 392 +++++---------------- 2 files changed, 88 insertions(+), 359 deletions(-) diff --git a/geometry/hybrid/hybridDaughter_merged.gdml b/geometry/hybrid/hybridDaughter_merged.gdml index c79a5456e..2bedd0dab 100644 --- a/geometry/hybrid/hybridDaughter_merged.gdml +++ b/geometry/hybrid/hybridDaughter_merged.gdml @@ -68,16 +68,7 @@ - - - - - - - - - - + @@ -143,25 +134,11 @@ - - + - - - - - - @@ -494,22 +471,13 @@ - - - + + + - - - - - - - - - - + @@ -630,16 +598,11 @@ - - - + + + - diff --git a/geometry/hybrid/hybridToroid.gdml b/geometry/hybrid/hybridToroid.gdml index c4b37cc94..5603d1e82 100644 --- a/geometry/hybrid/hybridToroid.gdml +++ b/geometry/hybrid/hybridToroid.gdml @@ -44,25 +44,6 @@

- - - - - -
-
- - - - - - - - - - - - @@ -597,125 +578,78 @@ - - + - + - - - - - - - - - - - - - - - - - - - - - + - + - + - - - - - + + + + - - - - - - - - - - - - + - - - - - - - - - - - - - - - - + - + - + - + - + - + - + - + + - + - + - + - + - + - + + @@ -724,22 +658,6 @@ - - - - - - - @@ -747,13 +665,6 @@ - - - - - - - @@ -972,13 +883,6 @@ - - - - - - - @@ -1197,13 +1101,6 @@ - - - - - - - @@ -1422,13 +1319,6 @@ - - - - - - - @@ -1647,13 +1537,6 @@ - - - - - - - @@ -1872,13 +1755,6 @@ - - - - - - - @@ -2097,13 +1973,6 @@ - - - - - - - @@ -2349,12 +2218,6 @@ - @@ -2385,12 +2248,6 @@ - @@ -2421,12 +2278,6 @@ - @@ -2457,12 +2308,6 @@ - @@ -2493,12 +2338,6 @@ - @@ -2529,12 +2368,6 @@ - @@ -2565,173 +2398,106 @@ - - - - - - - - - - - - - - - - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - - + + + + From 489afc30af7e4832ea6c70a6f36a9e90fe8caeec Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sat, 10 Apr 2021 17:06:14 -0500 Subject: [PATCH 331/443] [fields] Cubic magnetic field interpolation routine --- include/remollGlobalField.hh | 1 + include/remollMagneticField.hh | 68 ++++++++++++- src/remollGlobalField.cc | 13 +++ src/remollMagneticField.cc | 175 +++++++++++++++++++++++++++++---- 4 files changed, 237 insertions(+), 20 deletions(-) diff --git a/include/remollGlobalField.hh b/include/remollGlobalField.hh index 0c0e31111..351640f4a 100644 --- a/include/remollGlobalField.hh +++ b/include/remollGlobalField.hh @@ -27,6 +27,7 @@ class remollGlobalField : public G4MagneticField { void AddNewField(G4String& name); + void SetInterpolationType(const G4String& name, const G4String& type); void SetZOffset(const G4String& name, G4double offset); void SetFieldScale(const G4String& name, G4double scale); void SetMagnetCurrent(const G4String& name, G4double current); diff --git a/include/remollMagneticField.hh b/include/remollMagneticField.hh index 70cf1ebd4..c6902b7db 100644 --- a/include/remollMagneticField.hh +++ b/include/remollMagneticField.hh @@ -14,7 +14,7 @@ */ class remollMagneticField : public G4MagneticField { - /*! + /*! * Moller spectrometer magnetic field class * * Use trilinear interpolation in cylindrical coordinates @@ -36,7 +36,12 @@ class remollMagneticField : public G4MagneticField { * */ + private: + + enum EInterpolationType {kLinear, kCubic}; + public: + remollMagneticField( G4String ); virtual ~remollMagneticField(); @@ -84,6 +89,67 @@ class remollMagneticField : public G4MagneticField { G4double fMagCurrent0; // Scale overall field by this amount G4bool fInit; + + private: + + EInterpolationType fInterpolationType; + + public: + + void SetInterpolationType(EInterpolationType type) { + fInterpolationType = type; + } + void SetInterpolationType(const G4String& type) { + if (type == "linear") SetInterpolationType(kLinear); + if (type == "cubic") SetInterpolationType(kCubic); + } + EInterpolationType GetInterpolationType() const { + return fInterpolationType; + } + + private: + + static const char kLinearMap[8][3]; + static const char kCubicMap[64][3]; + + double _linearInterpolate(const double p[2 << 0], double x) const { + return p[0] + x * (p[1] - p[0]); + } + double _bilinearInterpolate(const double p[2 << 1], const double x[2]) const { + double c[2]; + c[0] = _linearInterpolate(&(p[0]), x[0]); + c[1] = _linearInterpolate(&(p[2]), x[0]); + return _linearInterpolate(c, x[1]); + } + double _trilinearInterpolate(const double p[2 << 2], const double x[3]) const { + double c[2]; + c[0] = _bilinearInterpolate(&(p[0]), &(x[0])); + c[1] = _bilinearInterpolate(&(p[4]), &(x[0])); + return _linearInterpolate(c, x[2]); + } + + double _cubicInterpolate(const double p[4 << 0], double x) const { + return p[1] + + 0.5 * x * (p[2] - p[0] + + x * (2. * p[0] - 5. * p[1] + 4. * p[2] - p[3] + + x * (3. * (p[1] - p[2]) + p[3] - p[0]))); + } + double _bicubicInterpolate(const double p[4 << 1], const double x[2]) const { + double c[4]; + c[0] = _cubicInterpolate(&(p[0]), x[1]); + c[1] = _cubicInterpolate(&(p[4]), x[1]); + c[2] = _cubicInterpolate(&(p[8]), x[1]); + c[3] = _cubicInterpolate(&(p[12]), x[1]); + return _cubicInterpolate(c, x[0]); + } + double _tricubicInterpolate(const double p[4 << 2], const double x[3]) const { + double c[4]; + c[0] = _bicubicInterpolate(&(p[0]), &(x[1])); + c[1] = _bicubicInterpolate(&(p[16]), &(x[1])); + c[2] = _bicubicInterpolate(&(p[32]), &(x[1])); + c[3] = _bicubicInterpolate(&(p[48]), &(x[1])); + return _cubicInterpolate(c, x[0]); + } }; diff --git a/src/remollGlobalField.cc b/src/remollGlobalField.cc index dd3c047e9..987763e0e 100644 --- a/src/remollGlobalField.cc +++ b/src/remollGlobalField.cc @@ -79,6 +79,7 @@ remollGlobalField::remollGlobalField() fGlobalFieldMessenger->DeclareProperty("deltachord",fDeltaChord,"Set delta chord for the chord finder"); fGlobalFieldMessenger->DeclareProperty("deltaonestep",fDeltaOneStep,"Set delta one step for the field manager"); fGlobalFieldMessenger->DeclareProperty("deltaintersection",fMinStep,"Set delta intersection for the field manager"); + fGlobalFieldMessenger->DeclareMethod("interpolation",&remollGlobalField::SetInterpolationType,"Set magnetic field interpolation type"); fGlobalFieldMessenger->DeclareMethod("zoffset",&remollGlobalField::SetZOffset,"Set magnetic field z offset"); fGlobalFieldMessenger->DeclareMethod("scale",&remollGlobalField::SetFieldScale,"Scale magnetic field by factor"); fGlobalFieldMessenger->DeclareMethod("current",&remollGlobalField::SetMagnetCurrent,"Scale magnetic field by current"); @@ -288,6 +289,18 @@ void remollGlobalField::SetZOffset(const G4String& name, G4double offset) } } +void remollGlobalField::SetInterpolationType(const G4String& name, const G4String& type) +{ + remollMagneticField *field = GetFieldByName(name); + if (field) { + G4AutoLock lock(&remollGlobalFieldMutex); + field->SetInterpolationType(type); + } else { + G4cerr << "WARNING " << __FILE__ << " line " << __LINE__ + << ": field " << name << " interpolation type failed" << G4endl; + } +} + void remollGlobalField::SetFieldScale(const G4String& name, G4double scale) { remollMagneticField *field = GetFieldByName(name); diff --git a/src/remollMagneticField.cc b/src/remollMagneticField.cc index e6a887a49..1d7e47fa8 100644 --- a/src/remollMagneticField.cc +++ b/src/remollMagneticField.cc @@ -27,8 +27,88 @@ #include #endif -remollMagneticField::remollMagneticField( G4String filename ){ - +// Set location of cell vertices +// Note the different endianness +const char remollMagneticField::kLinearMap[8][3] = { + {0, 0, 0}, // 00 + {1, 0, 0}, + {0, 1, 0}, + {1, 1, 0}, + {0, 0, 1}, // 04 + {1, 0, 1}, + {0, 1, 1}, + {1, 1, 1}, +}; +const char remollMagneticField::kCubicMap[64][3] = { + {-1, -1, -1}, // 00 + {-1, -1, 0}, + {-1, -1, 1}, + {-1, -1, 2}, + {-1, 0, -1}, // 04 + {-1, 0, 0}, + {-1, 0, 1}, + {-1, 0, 2}, + {-1, 1, -1}, // 08 + {-1, 1, 0}, + {-1, 1, 1}, + {-1, 1, 2}, + {-1, 2, -1}, // 12 + {-1, 2, 0}, + {-1, 2, 1}, + {-1, 2, 2}, + {0, -1, -1}, // 16 + {0, -1, 0}, + {0, -1, 1}, + {0, -1, 2}, + {0, 0, -1}, // 20 + {0, 0, 0}, + {0, 0, 1}, + {0, 0, 2}, + {0, 1, -1}, // 24 + {0, 1, 0}, + {0, 1, 1}, + {0, 1, 2}, + {0, 2, -1}, // 28 + {0, 2, 0}, + {0, 2, 1}, + {0, 2, 2}, + {1, -1, -1}, // 22 + {1, -1, 0}, + {1, -1, 1}, + {1, -1, 2}, + {1, 0, -1}, // 26 + {1, 0, 0}, + {1, 0, 1}, + {1, 0, 2}, + {1, 1, -1}, // 40 + {1, 1, 0}, + {1, 1, 1}, + {1, 1, 2}, + {1, 2, -1}, // 44 + {1, 2, 0}, + {1, 2, 1}, + {1, 2, 2}, + {2, -1, -1}, // 48 + {2, -1, 0}, + {2, -1, 1}, + {2, -1, 2}, + {2, 0, -1}, // 52 + {2, 0, 0}, + {2, 0, 1}, + {2, 0, 2}, + {2, 1, -1}, // 56 + {2, 1, 0}, + {2, 1, 1}, + {2, 1, 2}, + {2, 2, -1}, // 60 + {2, 2, 0}, + {2, 2, 1}, + {2, 2, 2}, +}; + +remollMagneticField::remollMagneticField( G4String filename ) +: fInterpolationType(kLinear) +{ fName = filename; fFilename = filename; @@ -509,7 +589,8 @@ void remollMagneticField::GetFieldValue(const G4double Point[4], G4double *Bfiel assert( fFileMin[kPhi] <= lphi && lphi < fFileMax[kPhi] ); - // 3. Get interoplation variables + // 3. Get interpolation variables + // the N-1 here is fencepost problem G4double x[__NDIM] = {0}; G4double didx[__NDIM] = {0}; @@ -520,30 +601,86 @@ void remollMagneticField::GetFieldValue(const G4double Point[4], G4double *Bfiel // Cast these to integers for indexing and check G4int idx[__NDIM] = {0}; for(int cidx = 0; cidx < __NDIM; cidx++ ){ idx[cidx] = (G4int) didx[cidx]; } - assert( 0 <= idx[kR] && idx[kR] < fN[kR] ); assert( 0 <= idx[kPhi] && idx[kPhi] < fN[kPhi] ); assert( 0 <= idx[kZ] && idx[kZ] < fN[kZ] ); + // Flag edge cases and treat at best as linear + EInterpolationType type = fInterpolationType; + if (idx[kR] == 0 || idx[kR] == fN[kR] - 2) type = kLinear; + if (idx[kZ] == 0 || idx[kZ] == fN[kZ] - 2) type = kLinear; + + // number of cell vertices + size_t n = 64; + const char (*map)[3] = kCubicMap; + switch (fInterpolationType) { + case kLinear: + map = kLinearMap; + n = 8; + break; + case kCubic: + map = kCubicMap; + n = 64; + break; + } + + // values of cell vertices + G4double values_linear[__NDIM][64]; /* make large enough, TODO thread_local */ + for (size_t i = 0; i < 8; i++) { + for (size_t cidx = 0; cidx < __NDIM; cidx++) { + values_linear[cidx][i] = + fBFieldData[cidx] + [idx[kR] + kLinearMap[i][kR]] + [idx[kPhi] + kLinearMap[i][kPhi]] + [idx[kZ] + kLinearMap[i][kZ]]; + } + } + G4double values_cubic[__NDIM][64]; /* make large enough, TODO thread_local */ + for (size_t i = 0; i < 64; i++) { + for (size_t cidx = 0; cidx < __NDIM; cidx++) { + if (idx[kR] == 0 || idx[kR] == fN[kR] - 1 || idx[kZ] == 0 || idx[kZ] == fN[kZ] - 1) + values_cubic[cidx][i] = 0; + else + values_cubic[cidx][i] = + fBFieldData[cidx] + [idx[kR] + kCubicMap[i][kR]] + [(idx[kPhi] + kCubicMap[i][kPhi]) % (fN[kPhi]-1)] // wrap around + [idx[kZ] + kCubicMap[i][kZ]]; + } + } + // Interpolate G4double Bint[__NDIM] = {0}; for(int cidx = 0; cidx < __NDIM; cidx++ ){ - G4double c00, c10, c01, c11; - c00 = fBFieldData[cidx][idx[kR]][idx[kPhi]][idx[kZ]]*(1.0-x[kR]) - + fBFieldData[cidx][idx[kR]+1][idx[kPhi]][idx[kZ]]*x[kR]; - c10 = fBFieldData[cidx][idx[kR]][idx[kPhi]+1][idx[kZ]]*(1.0-x[kR]) - + fBFieldData[cidx][idx[kR]+1][idx[kPhi]+1][idx[kZ]]*x[kR]; - c01 = fBFieldData[cidx][idx[kR]][idx[kPhi]][idx[kZ]+1]*(1.0-x[kR]) - + fBFieldData[cidx][idx[kR]+1][idx[kPhi]][idx[kZ]+1]*x[kR]; - c11 = fBFieldData[cidx][idx[kR]][idx[kPhi]+1][idx[kZ]+1]*(1.0-x[kR]) - + fBFieldData[cidx][idx[kR]+1][idx[kPhi]+1][idx[kZ]+1]*x[kR]; - - G4double c0, c1; - c0 = c00*(1.0-x[kPhi]) + c10*x[kPhi]; - c1 = c01*(1.0-x[kPhi]) + c11*x[kPhi]; - - Bint[cidx] = c0*(1.0-x[kZ])+c1*x[kZ]; + G4double c00, c10, c01, c11; + c00 = fBFieldData[cidx][idx[kR]][idx[kPhi]][idx[kZ]]*(1.0-x[kR]) + + fBFieldData[cidx][idx[kR]+1][idx[kPhi]][idx[kZ]]*x[kR]; + c10 = fBFieldData[cidx][idx[kR]][idx[kPhi]+1][idx[kZ]]*(1.0-x[kR]) + + fBFieldData[cidx][idx[kR]+1][idx[kPhi]+1][idx[kZ]]*x[kR]; + c01 = fBFieldData[cidx][idx[kR]][idx[kPhi]][idx[kZ]+1]*(1.0-x[kR]) + + fBFieldData[cidx][idx[kR]+1][idx[kPhi]][idx[kZ]+1]*x[kR]; + c11 = fBFieldData[cidx][idx[kR]][idx[kPhi]+1][idx[kZ]+1]*(1.0-x[kR]) + + fBFieldData[cidx][idx[kR]+1][idx[kPhi]+1][idx[kZ]+1]*x[kR]; + + G4double c0 = c00*(1.0-x[kPhi]) + c10*x[kPhi]; + G4double c1 = c01*(1.0-x[kPhi]) + c11*x[kPhi]; + + Bint[cidx] = c0*(1.0-x[kZ])+c1*x[kZ]; + G4cout << Bint[cidx] << ": "; + +// switch (fInterpolationType) { +// case kLinear: { + G4cout << _trilinearInterpolate(values_linear[cidx], x) / Bint[cidx] << " "; + Bint[cidx] = _trilinearInterpolate(values_linear[cidx], x); +// break; +// } +// case kCubic: { + G4cout << _tricubicInterpolate(values_cubic[cidx], x) / Bint[cidx] << G4endl; + Bint[cidx] = _tricubicInterpolate(values_cubic[cidx], x); +// break; +// } +// } } G4ThreeVector Bcart = G4ThreeVector(Bint[kR], Bint[kPhi], Bint[kZ]); From 1e2d87c10c4bc324ec6912eaba9302c12409a48d Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sat, 10 Apr 2021 17:29:36 -0500 Subject: [PATCH 332/443] [fields] deal with edge cases more gracefully, fall back to linear --- src/remollMagneticField.cc | 59 ++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 35 deletions(-) diff --git a/src/remollMagneticField.cc b/src/remollMagneticField.cc index 1d7e47fa8..718000ace 100644 --- a/src/remollMagneticField.cc +++ b/src/remollMagneticField.cc @@ -107,7 +107,7 @@ const char remollMagneticField::kCubicMap[64][3] = { }; remollMagneticField::remollMagneticField( G4String filename ) -: fInterpolationType(kLinear) +: fInterpolationType(kCubic) { fName = filename; fFilename = filename; @@ -607,13 +607,15 @@ void remollMagneticField::GetFieldValue(const G4double Point[4], G4double *Bfiel // Flag edge cases and treat at best as linear EInterpolationType type = fInterpolationType; - if (idx[kR] == 0 || idx[kR] == fN[kR] - 2) type = kLinear; - if (idx[kZ] == 0 || idx[kZ] == fN[kZ] - 2) type = kLinear; + if (idx[kR] == 0 || idx[kR] == fN[kR] - 2 + || idx[kZ] == 0 || idx[kZ] == fN[kZ] - 2) { + type = kLinear; + } // number of cell vertices size_t n = 64; const char (*map)[3] = kCubicMap; - switch (fInterpolationType) { + switch (type) { case kLinear: map = kLinearMap; n = 8; @@ -625,27 +627,14 @@ void remollMagneticField::GetFieldValue(const G4double Point[4], G4double *Bfiel } // values of cell vertices - G4double values_linear[__NDIM][64]; /* make large enough, TODO thread_local */ - for (size_t i = 0; i < 8; i++) { - for (size_t cidx = 0; cidx < __NDIM; cidx++) { - values_linear[cidx][i] = - fBFieldData[cidx] - [idx[kR] + kLinearMap[i][kR]] - [idx[kPhi] + kLinearMap[i][kPhi]] - [idx[kZ] + kLinearMap[i][kZ]]; - } - } - G4double values_cubic[__NDIM][64]; /* make large enough, TODO thread_local */ - for (size_t i = 0; i < 64; i++) { + G4double values[__NDIM][64]; /* make large enough, TODO thread_local */ + for (size_t i = 0; i < n; i++) { for (size_t cidx = 0; cidx < __NDIM; cidx++) { - if (idx[kR] == 0 || idx[kR] == fN[kR] - 1 || idx[kZ] == 0 || idx[kZ] == fN[kZ] - 1) - values_cubic[cidx][i] = 0; - else - values_cubic[cidx][i] = + values[cidx][i] = fBFieldData[cidx] - [idx[kR] + kCubicMap[i][kR]] - [(idx[kPhi] + kCubicMap[i][kPhi]) % (fN[kPhi]-1)] // wrap around - [idx[kZ] + kCubicMap[i][kZ]]; + [idx[kR] + map[i][kR]] + [(idx[kPhi] + map[i][kPhi]) % (fN[kPhi]-1)] // wrap around + [idx[kZ] + map[i][kZ]]; } } @@ -669,18 +658,18 @@ void remollMagneticField::GetFieldValue(const G4double Point[4], G4double *Bfiel Bint[cidx] = c0*(1.0-x[kZ])+c1*x[kZ]; G4cout << Bint[cidx] << ": "; -// switch (fInterpolationType) { -// case kLinear: { - G4cout << _trilinearInterpolate(values_linear[cidx], x) / Bint[cidx] << " "; - Bint[cidx] = _trilinearInterpolate(values_linear[cidx], x); -// break; -// } -// case kCubic: { - G4cout << _tricubicInterpolate(values_cubic[cidx], x) / Bint[cidx] << G4endl; - Bint[cidx] = _tricubicInterpolate(values_cubic[cidx], x); -// break; -// } -// } + switch (fInterpolationType) { + case kLinear: { + G4cout << _trilinearInterpolate(values[cidx], x) / Bint[cidx] << "L" << G4endl; + Bint[cidx] = _trilinearInterpolate(values[cidx], x); + break; + } + case kCubic: { + G4cout << _tricubicInterpolate(values[cidx], x) / Bint[cidx] << G4endl; + Bint[cidx] = _tricubicInterpolate(values[cidx], x); + break; + } + } } G4ThreeVector Bcart = G4ThreeVector(Bint[kR], Bint[kPhi], Bint[kZ]); From 57cd0ce572efd47cdefecf7ea0a6aed5a678cf2c Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 11 Apr 2021 20:30:14 -0500 Subject: [PATCH 333/443] [fields] phi wraparound, remove debugging info --- src/remollMagneticField.cc | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/src/remollMagneticField.cc b/src/remollMagneticField.cc index 718000ace..b7910bea1 100644 --- a/src/remollMagneticField.cc +++ b/src/remollMagneticField.cc @@ -633,7 +633,7 @@ void remollMagneticField::GetFieldValue(const G4double Point[4], G4double *Bfiel values[cidx][i] = fBFieldData[cidx] [idx[kR] + map[i][kR]] - [(idx[kPhi] + map[i][kPhi]) % (fN[kPhi]-1)] // wrap around + [(idx[kPhi] + map[i][kPhi] + fN[kPhi] - 1) % (fN[kPhi]-1)] // wrap around [idx[kZ] + map[i][kZ]]; } } @@ -642,30 +642,12 @@ void remollMagneticField::GetFieldValue(const G4double Point[4], G4double *Bfiel G4double Bint[__NDIM] = {0}; for(int cidx = 0; cidx < __NDIM; cidx++ ){ - G4double c00, c10, c01, c11; - c00 = fBFieldData[cidx][idx[kR]][idx[kPhi]][idx[kZ]]*(1.0-x[kR]) - + fBFieldData[cidx][idx[kR]+1][idx[kPhi]][idx[kZ]]*x[kR]; - c10 = fBFieldData[cidx][idx[kR]][idx[kPhi]+1][idx[kZ]]*(1.0-x[kR]) - + fBFieldData[cidx][idx[kR]+1][idx[kPhi]+1][idx[kZ]]*x[kR]; - c01 = fBFieldData[cidx][idx[kR]][idx[kPhi]][idx[kZ]+1]*(1.0-x[kR]) - + fBFieldData[cidx][idx[kR]+1][idx[kPhi]][idx[kZ]+1]*x[kR]; - c11 = fBFieldData[cidx][idx[kR]][idx[kPhi]+1][idx[kZ]+1]*(1.0-x[kR]) - + fBFieldData[cidx][idx[kR]+1][idx[kPhi]+1][idx[kZ]+1]*x[kR]; - - G4double c0 = c00*(1.0-x[kPhi]) + c10*x[kPhi]; - G4double c1 = c01*(1.0-x[kPhi]) + c11*x[kPhi]; - - Bint[cidx] = c0*(1.0-x[kZ])+c1*x[kZ]; - G4cout << Bint[cidx] << ": "; - - switch (fInterpolationType) { + switch (type) { case kLinear: { - G4cout << _trilinearInterpolate(values[cidx], x) / Bint[cidx] << "L" << G4endl; Bint[cidx] = _trilinearInterpolate(values[cidx], x); break; } case kCubic: { - G4cout << _tricubicInterpolate(values[cidx], x) / Bint[cidx] << G4endl; Bint[cidx] = _tricubicInterpolate(values[cidx], x); break; } From 2597bcf2fe6ed270a18a0e847af1fd3cc720971f Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 13 Apr 2021 16:00:30 -0500 Subject: [PATCH 334/443] Hotfix: set parallel world overlap check to true to avoid segfault Ref: https://bugzilla-geant4.kek.jp/show_bug.cgi?id=2358 --- src/remollDetectorConstruction.cc | 3 ++- src/remollParallelConstruction.cc | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/remollDetectorConstruction.cc b/src/remollDetectorConstruction.cc index a43fca4bb..206b0564f 100644 --- a/src/remollDetectorConstruction.cc +++ b/src/remollDetectorConstruction.cc @@ -547,7 +547,8 @@ G4VPhysicalVolume* remollDetectorConstruction::ParseGDMLFile() // Parse GDML file fGDMLParser->SetOverlapCheck(fGDMLOverlapCheck); - // hide output if not validating or checking ovelaps + // hide output if not validating or checking overlaps + // https://bugzilla-geant4.kek.jp/show_bug.cgi?id=2358 if (! fGDMLOverlapCheck && ! fGDMLValidate) G4cout.setstate(std::ios_base::failbit); fGDMLParser->Read(fGDMLFile,fGDMLValidate); diff --git a/src/remollParallelConstruction.cc b/src/remollParallelConstruction.cc index 717ec2c80..80efced9e 100644 --- a/src/remollParallelConstruction.cc +++ b/src/remollParallelConstruction.cc @@ -20,7 +20,7 @@ remollParallelConstruction::remollParallelConstruction(const G4String& name, con fGDMLPath(""),fGDMLFile(""), fGDMLParser(0), fGDMLValidate(false), - fGDMLOverlapCheck(false), + fGDMLOverlapCheck(true), fVerboseLevel(0), fParallelMessenger(0), fWorldVolume(0), @@ -152,7 +152,8 @@ G4VPhysicalVolume* remollParallelConstruction::ParseGDMLFile() // Parse GDML file fGDMLParser->SetOverlapCheck(fGDMLOverlapCheck); - // hide output if not validating or checking ovelaps + // hide output if not validating or checking overlaps + // https://bugzilla-geant4.kek.jp/show_bug.cgi?id=2358 if (! fGDMLOverlapCheck && ! fGDMLValidate) G4cout.setstate(std::ios_base::failbit); fGDMLParser->Read(fGDMLFile,fGDMLValidate); From 97f06225ea1e23ac6ab1e7f23d1de988d5f9368b Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 13 Apr 2021 17:32:12 -0500 Subject: [PATCH 335/443] [fields] change back to linear by default --- src/remollMagneticField.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/remollMagneticField.cc b/src/remollMagneticField.cc index b7910bea1..83f15eb95 100644 --- a/src/remollMagneticField.cc +++ b/src/remollMagneticField.cc @@ -107,7 +107,7 @@ const char remollMagneticField::kCubicMap[64][3] = { }; remollMagneticField::remollMagneticField( G4String filename ) -: fInterpolationType(kCubic) +: fInterpolationType(kLinear) { fName = filename; fFilename = filename; From 9e29d1b0479c1af401847d5d4cc14e93bb1f7c04 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 13 Apr 2021 19:33:48 -0500 Subject: [PATCH 336/443] [fields] test script to compare linear/cubic interpolation --- macros/tests/unit/test_fields_cubic.mac | 54 +++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 macros/tests/unit/test_fields_cubic.mac diff --git a/macros/tests/unit/test_fields_cubic.mac b/macros/tests/unit/test_fields_cubic.mac new file mode 100644 index 000000000..bdd38ef99 --- /dev/null +++ b/macros/tests/unit/test_fields_cubic.mac @@ -0,0 +1,54 @@ +/run/numberOfThreads 1 +/run/initialize + +/control/execute macros/load_magnetic_fieldmaps.mac + +/remoll/field/interpolation map_directory/V2DSg.9.75cm.txt linear +#0.35 -180 8.5 0.00357702902439 0.000508489642332 0.00792856854346 +/remoll/field/value 0.3500 0.0 8.50 +/remoll/field/value 0.3502 0.0 8.51 +/remoll/field/value 0.3504 0.0 8.52 +/remoll/field/value 0.3506 0.0 8.53 +/remoll/field/value 0.3508 0.0 8.54 +/remoll/field/value 0.3510 0.0 8.55 +/remoll/field/value 0.3512 0.0 8.56 +/remoll/field/value 0.3514 0.0 8.57 +/remoll/field/value 0.3516 0.0 8.58 +/remoll/field/value 0.3518 0.0 8.59 +/remoll/field/value 0.3520 0.0 8.60 +#0.352 -180 8.6 8.3868756498e-05 0.0241781282489 0.00052352054301 +/remoll/field/value 0.3522 0.0 8.61 +/remoll/field/value 0.3524 0.0 8.62 +/remoll/field/value 0.3526 0.0 8.63 +/remoll/field/value 0.3528 0.0 8.64 +/remoll/field/value 0.3530 0.0 8.65 +/remoll/field/value 0.3532 0.0 8.66 +/remoll/field/value 0.3534 0.0 8.67 +/remoll/field/value 0.3536 0.0 8.68 +/remoll/field/value 0.3538 0.0 8.69 +/remoll/field/value 0.3540 0.0 8.70 + +/remoll/field/interpolation map_directory/V2DSg.9.75cm.txt cubic +#0.35 -180 8.5 0.00357702902439 0.000508489642332 0.00792856854346 +/remoll/field/value 0.3500 0.0 8.50 +/remoll/field/value 0.3502 0.0 8.51 +/remoll/field/value 0.3504 0.0 8.52 +/remoll/field/value 0.3506 0.0 8.53 +/remoll/field/value 0.3508 0.0 8.54 +/remoll/field/value 0.3510 0.0 8.55 +/remoll/field/value 0.3512 0.0 8.56 +/remoll/field/value 0.3514 0.0 8.57 +/remoll/field/value 0.3516 0.0 8.58 +/remoll/field/value 0.3518 0.0 8.59 +/remoll/field/value 0.3520 0.0 8.60 +#0.352 -180 8.6 8.3868756498e-05 0.0241781282489 0.00052352054301 +/remoll/field/value 0.3522 0.0 8.61 +/remoll/field/value 0.3524 0.0 8.62 +/remoll/field/value 0.3526 0.0 8.63 +/remoll/field/value 0.3528 0.0 8.64 +/remoll/field/value 0.3530 0.0 8.65 +/remoll/field/value 0.3532 0.0 8.66 +/remoll/field/value 0.3534 0.0 8.67 +/remoll/field/value 0.3536 0.0 8.68 +/remoll/field/value 0.3538 0.0 8.69 +/remoll/field/value 0.3540 0.0 8.70 From 871537c0804825d143f12b28a7abc07eb480d8e8 Mon Sep 17 00:00:00 2001 From: Yug34 Date: Wed, 14 Apr 2021 22:00:24 +0530 Subject: [PATCH 337/443] [io] cleanup --- macros/runexample.mac | 2 -- remoll.cc | 15 +-------------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/macros/runexample.mac b/macros/runexample.mac index 8ef7f92bf..36bfe7650 100644 --- a/macros/runexample.mac +++ b/macros/runexample.mac @@ -78,9 +78,7 @@ # Specify random number seed /remoll/seed 123456 -# Still need to comment this out in every macro file: /remoll/filename remollout.root -# ^The PR does not override this^ #/tracking/verbose 2 /remoll/printtargetinfo diff --git a/remoll.cc b/remoll.cc index 8f897149a..cda93f053 100644 --- a/remoll.cc +++ b/remoll.cc @@ -101,21 +101,8 @@ int main(int argc, char** argv) { else if (G4String(argv[i]) == "-p") parallel_gdmlfile = argv[++i]; else if (G4String(argv[i]) == "-u") session = argv[++i]; else if (G4String(argv[i]) == "-r") seed = atol(argv[++i]); - else if (G4String(argv[i]) == "-o") { - outputfile = argv[++i]; + else if (G4String(argv[i]) == "-o") outputfile = argv[++i]; - const std::string illegalChars = "$?<>:*\?\\\'\""; - - for(auto ch : illegalChars) { - if (outputfile.find(ch) != std::string::npos) { - G4cerr << "==================Filename Error: ==================" << G4endl; - G4cerr << "Output file name cannot have " << ch << " in the name, aborting" << G4endl; - G4cerr << "====================================================" << G4endl; - - return 1; - } - } - } #ifdef G4MULTITHREADED else if (G4String(argv[i]) == "-t") threads = atoi(argv[++i]); #endif From 6ad67eeb7980f82874f714026346921620f60429 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 19 Apr 2021 17:52:44 -0500 Subject: [PATCH 338/443] [fields] New magnetic field maps per @rahmans --- CMakeLists.txt | 6 ++++-- macros/load_magnetic_fieldmaps.mac | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 785100312..0373c171d 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -319,10 +319,12 @@ if(Boost_IOSTREAMS_FOUND) endif() # for i in *.txt ; do echo `md5sum $i|awk '{print$1}'`:`md5sum $i.gz|awk '{print$1}'`:$i ; done set(REMOLL_MAPS -1c79bc83e4da5e9d5e44338e28ce6ebe:c7591d167ca56e871e8e5eeecab2872c:V2DSg.9.75cm.txt -f768447f761b9bf01af7c57e249d1d8a:94ec0017b21fc56d9d8084d68e479fd5:V2U.1a.50cm.txt +b8b30b803bae42f69135323ff40fe7db:99bf3fae83677c6c2f3e09a871682b2e:V2U.1a.50cm.parallel.txt +d5f568675ca29e295c1013617a2dc092:b3e031ce9d97fa5331ec39e8903817e6:V2DSg.9.75cm.parallel.txt ) set(REMOLL_MAPS_EXTRA +1c79bc83e4da5e9d5e44338e28ce6ebe:c7591d167ca56e871e8e5eeecab2872c:V2DSg.9.75cm.txt +f768447f761b9bf01af7c57e249d1d8a:94ec0017b21fc56d9d8084d68e479fd5:V2U.1a.50cm.txt b1b8f2845dc5cd420c6ff49ae7760a60:6002f6f5f092346cb2bdedac046d1905:V1U.2a.txt 70e2bbed1831816957e953bba48f01d5:2fd1cd2785db92f9c880b675890460b5:V2U.1a.txt e55ffd8aba96cbf24962155d3c7f75e4:0172016c988867b0928258d79cd1c865:V2U.1b.txt diff --git a/macros/load_magnetic_fieldmaps.mac b/macros/load_magnetic_fieldmaps.mac index 90134de00..13f00da71 100644 --- a/macros/load_magnetic_fieldmaps.mac +++ b/macros/load_magnetic_fieldmaps.mac @@ -4,5 +4,5 @@ # consider loading this macro with # /control/execute macros/load_magnetic_field.mac -/remoll/addfield map_directory/V2U.1a.50cm.txt -/remoll/addfield map_directory/V2DSg.9.75cm.txt +/remoll/addfield map_directory/V2U.1a.50cm.parallel.txt +/remoll/addfield map_directory/V2DSg.9.75cm.parallel.txt From 8f22d8c9d90bc6c28de4731868c014c75e3b3e29 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 19 Apr 2021 18:41:44 -0500 Subject: [PATCH 339/443] [remoll] Print 'main' seed for remoll at startup --- remoll.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remoll.cc b/remoll.cc index cda93f053..e28f6139b 100644 --- a/remoll.cc +++ b/remoll.cc @@ -102,7 +102,6 @@ int main(int argc, char** argv) { else if (G4String(argv[i]) == "-u") session = argv[++i]; else if (G4String(argv[i]) == "-r") seed = atol(argv[++i]); else if (G4String(argv[i]) == "-o") outputfile = argv[++i]; - #ifdef G4MULTITHREADED else if (G4String(argv[i]) == "-t") threads = atoi(argv[++i]); #endif @@ -123,6 +122,7 @@ int main(int argc, char** argv) { #endif // Set the default random seed + G4cout << G4endl << "remoll: Random seed: " << seed << G4endl; G4Random::setTheSeed(seed); // Create remoll IO object with output file name From f93fb3ee6573eb033d8ef5b6abf6d55b77705c04 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 19 Apr 2021 21:49:18 -0500 Subject: [PATCH 340/443] [fields] general cleanup of magnetic field class --- include/remollMagneticField.hh | 26 ++- src/remollGlobalField.cc | 49 +++-- src/remollMagneticField.cc | 318 ++++++++++----------------------- 3 files changed, 130 insertions(+), 263 deletions(-) diff --git a/include/remollMagneticField.hh b/include/remollMagneticField.hh index c6902b7db..b61e99ffe 100644 --- a/include/remollMagneticField.hh +++ b/include/remollMagneticField.hh @@ -42,25 +42,21 @@ class remollMagneticField : public G4MagneticField { public: - remollMagneticField( G4String ); - virtual ~remollMagneticField(); + remollMagneticField(const G4String&); + virtual ~remollMagneticField() { }; void GetFieldValue(const G4double Point[4], G4double *Bfield) const; - void InitializeGrid(); - void ReadFieldMap(); + void SetFieldScale(G4double scale) { fFieldScale = scale; } + void SetRefCurrent(G4double current) { fRefCurrent = current; } + void SetCurrent(G4double current) { SetFieldScale(current/fRefCurrent); } - void SetFieldScale(G4double s); - void SetMagnetCurrent(G4double s); + void SetZoffset(G4double z) { fZoffset = z; } - void SetZoffset(G4double z){ fZoffset= z; } - - G4String GetName(); + const G4String& GetName() const { return fName; } enum Coord_t { kR, kPhi, kZ }; - G4bool IsInit(){ return fInit; } - G4bool IsInBoundingBox(const G4double* p) const { if (p[2] - fZoffset < fMin[kZ] || p[2] - fZoffset > fMax[kZ]) return false; if (p[0] < -fMax[kR] || p[0] > fMax[kR]) return false; @@ -72,8 +68,8 @@ class remollMagneticField : public G4MagneticField { G4String fName; G4String fFilename; - G4int fN[__NDIM]; - G4double fMin[__NDIM], fMax[__NDIM]; + size_t fN[__NDIM]; + G4double fUnit[__NDIM], fMin[__NDIM], fMax[__NDIM], fStep[__NDIM]; G4double fFileMin[__NDIM], fFileMax[__NDIM]; G4int fNxtant; // Number of *tants (septants, or whatever) @@ -86,9 +82,7 @@ class remollMagneticField : public G4MagneticField { G4double fZMapOffset, fPhiMapOffset; G4double fFieldScale; // Scale overall field by this amount - G4double fMagCurrent0; // Scale overall field by this amount - - G4bool fInit; + G4double fRefCurrent; // Reference current for magnetic field private: diff --git a/src/remollGlobalField.cc b/src/remollGlobalField.cc index 987763e0e..0526646d8 100644 --- a/src/remollGlobalField.cc +++ b/src/remollGlobalField.cc @@ -195,46 +195,39 @@ void remollGlobalField::AddNewField(G4String& name) // If this field has already been loaded if (GetFieldByName(name) != 0) return; - + // Load new field remollMagneticField *thisfield = new remollMagneticField(name); - if (thisfield->IsInit()) { - fFields.push_back(thisfield); - - if (fVerboseLevel > 0) - G4cout << __FUNCTION__ << ": field " << name << " was added." << G4endl; - - // Add file data to output data stream + fFields.push_back(thisfield); - remollRunData *rd = remollRun::GetRunData(); + if (fVerboseLevel > 0) + G4cout << __FUNCTION__ << ": field " << name << " was added." << G4endl; - // FIXME disabled TMD5 functionality as long as CentOS 7.2 is common - // due to kernel bug when running singularity containers + // Add file data to output data stream + remollRunData *rd = remollRun::GetRunData(); - //TMD5 *md5 = TMD5::FileChecksum(name.data()); + // FIXME disabled TMD5 functionality as long as CentOS 7.2 is common + // due to kernel bug when running singularity containers - filedata_t fdata; + //TMD5 *md5 = TMD5::FileChecksum(name.data()); - strcpy(fdata.filename, name.data()); - strcpy(fdata.hashsum, "no hash" ); // md5->AsString() ); + filedata_t fdata; - //G4cout << "MD5 checksum " << md5->AsString() << G4endl; + strcpy(fdata.filename, name.data()); + strcpy(fdata.hashsum, "no hash" ); // md5->AsString() ); - //delete md5; + //G4cout << "MD5 checksum " << md5->AsString() << G4endl; - struct stat fs; - stat(name.data(), &fs); - fdata.timestamp = TTimeStamp( fs.st_mtime ); + //delete md5; - if (fVerboseLevel > 0) - G4cout << __FUNCTION__ << ": field timestamp = " << fdata.timestamp << G4endl; + struct stat fs; + stat(name.data(), &fs); + fdata.timestamp = TTimeStamp( fs.st_mtime ); - rd->AddMagData(fdata); + if (fVerboseLevel > 0) + G4cout << __FUNCTION__ << ": field timestamp = " << fdata.timestamp << G4endl; - } else { - G4cerr << "WARNING " << __FILE__ << " line " << __LINE__ - << ": field " << name << " was not initialized." << G4endl; - } + rd->AddMagData(fdata); } remollMagneticField* remollGlobalField::GetFieldByName(const G4String& name) const @@ -318,7 +311,7 @@ void remollGlobalField::SetMagnetCurrent(const G4String& name, G4double current) remollMagneticField *field = GetFieldByName(name); if (field) { G4AutoLock lock(&remollGlobalFieldMutex); - field->SetMagnetCurrent(current); + field->SetRefCurrent(current); } else { G4cerr << "WARNING " << __FILE__ << " line " << __LINE__ << ": field " << name << " scaling failed" << G4endl; diff --git a/src/remollMagneticField.cc b/src/remollMagneticField.cc index 83f15eb95..97a9b9641 100644 --- a/src/remollMagneticField.cc +++ b/src/remollMagneticField.cc @@ -106,119 +106,32 @@ const char remollMagneticField::kCubicMap[64][3] = { {2, 2, 2}, }; -remollMagneticField::remollMagneticField( G4String filename ) -: fInterpolationType(kLinear) +remollMagneticField::remollMagneticField(const G4String& filename) +: fName(filename), + fFilename(filename), + fN{0,0,0}, + fUnit{m,degree,m}, + fMin{0.0}, + fMax{0.0}, + fStep{0.0}, + fFileMin{0.0}, + fFileMax{0.0}, + fNxtant(0), + fPhi0(0.0), + fPhiLow(0.0), + fxtantSize(0.0), + fZoffset(0.0), + fPhiOffset(0.0), + fFieldScale(1.0), + fRefCurrent(0.0), + fInterpolationType(kLinear) { - fName = filename; - fFilename = filename; - - // Initialize grid variables - for( int cidx = kR; cidx < kZ; cidx++ ){ - fN[cidx] = -1; - fMin[cidx] = -1e9; - fMax[cidx] = -2e9; - } - - fPhi0 = -1e9; - - // Default offset for field maps in reference frame with - // the hall pivot at z = 0. - fZoffset = 0.0; - - fInit = false; - fMagCurrent0 = -1e9; - - fFieldScale = 1.0; - - ReadFieldMap(); -} - -remollMagneticField::~remollMagneticField(){ -} - -G4String remollMagneticField::GetName(){ - if( !fInit ){ - G4cerr << "WARNING " << __FILE__ << " line " << __LINE__ - << ": access uninitialized field." << G4endl; - return G4String(""); - } - - return fName; -} - -void remollMagneticField::SetFieldScale(G4double s){ - fFieldScale = s; - G4cout << fName << " scale set to " << s << G4endl; - return; -} - -void remollMagneticField::SetMagnetCurrent(G4double s){ - if( fMagCurrent0 > 0.0 ){ - SetFieldScale(s/fMagCurrent0); - } else { - G4cerr << "Warning: " << __FILE__ << " line " << __LINE__ - << ": Field current not specified in map " << fName << " - Ignoring and proceeding " << G4endl; - } - return; -} - - -void remollMagneticField::InitializeGrid() { - /*! - * Dynamically size 3D vectors to what we need to store the file - * These should already be set from values read in from the fieldmap - */ - - if( fN[kR] <= 0 || fN[kPhi] <= 0 || fN[kZ] <= 0 ){ - G4cerr << "Error " << __FILE__ << " line " << __LINE__ - << ": grid size invalid. Aborting" << G4endl; - exit(1); - } - - G4cout << "Initializing field map grid for " << fName << G4endl; - G4int cidx, ridx, pidx, zidx; - - for( cidx = kR; cidx <= kZ; cidx++ ){ - // Set up storage space for table - fBFieldData[cidx].clear(); - fBFieldData[cidx].resize(fN[kR]); - - for( ridx = 0; ridx < fN[kR]; ridx++) { - fBFieldData[cidx][ridx].resize(fN[kPhi]); - - for( pidx=0; pidx> fN[cidx] >> fMin[cidx] >> fMax[cidx]) { - G4cout << "N,min,max[" << cidx << "] = " << fN[cidx] << "," - << fMin[cidx] << "," << fMax[cidx] << G4endl; + fMin[cidx] *= fUnit[cidx]; + fMax[cidx] *= fUnit[cidx]; + fStep[cidx] = (fMax[cidx] - fMin[cidx]) / (fN[cidx] - 1); + G4cout << "N,min,max,step[" << cidx << "] = " << fN[cidx] << "," + << fMin[cidx] << "," << fMax[cidx] << "," << fStep[cidx] << G4endl; } else { - G4cerr << "Error " << __FILE__ << " line " << __LINE__ + G4cerr << "Error " << __FILE__ << " line " << __LINE__ << ": File " << fFilename << " contains unreadable header. Aborting" << G4endl; exit(1); } } + // Read in grid offsets getline(inputfile,inputline); if (std::istringstream(inputline) >> fPhiMapOffset >> fZMapOffset) { G4cout << "PhiMapOffset,ZMapOffset = " << fPhiMapOffset << "," @@ -302,37 +219,36 @@ void remollMagneticField::ReadFieldMap(){ exit(1); } - fPhiMapOffset *= deg; - fZMapOffset *= m; + fPhiMapOffset *= fUnit[kPhi]; + fZMapOffset *= fUnit[kZ]; + // Read in extants getline(inputfile,inputline); if (std::istringstream(inputline) >> fNxtant) { G4cout << "Nxtant = " << fNxtant << G4endl; } else { - G4cerr << "Error " << __FILE__ << " line " << __LINE__ + G4cerr << "Error " << __FILE__ << " line " << __LINE__ << ": File " << fFilename << " contains unreadable header. Aborting" << G4endl; exit(1); } - G4cout << __PRETTY_FUNCTION__ << ": N xtants = " << fNxtant << G4endl; fxtantSize = 2.0*pi/fNxtant; ////////////////////////////////////////////////////////////////////// getline(inputfile,inputline); - if (std::istringstream(inputline) >> fMagCurrent0) { - G4cout << "MagCurrent0 = " << fMagCurrent0 << G4endl; + if (std::istringstream(inputline) >> fRefCurrent) { + G4cout << "RefCurrent = " << fRefCurrent << G4endl; } else { G4cerr << "Error " << __FILE__ << " line " << __LINE__ << ": File " << fFilename << " contains unreadable header. Aborting" << G4endl; exit(1); } - G4cout << __PRETTY_FUNCTION__ << ": field current = " << fMagCurrent0 << " A" << G4endl; // Sanity check on header data if( !( fMin[kR] >= 0.0 && fMin[kR] < fMax[kR] && - -180.0 <= fMin[kPhi] && fMin[kPhi] <= 180.0 && - -180.0 <= fMax[kPhi] && fMax[kPhi] <= 180.0 && + -180.0*deg <= fMin[kPhi] && fMin[kPhi] <= 180.0*deg && + -180.0*deg <= fMax[kPhi] && fMax[kPhi] <= 180.0*deg && fMin[kPhi] < fMax[kPhi] && fMin[kZ] < fMax[kZ] && fN[kR] > 0 && fN[kPhi] > 0 && fN[kZ] > 0 && @@ -341,32 +257,22 @@ void remollMagneticField::ReadFieldMap(){ ){ G4cerr << "Error " << __FILE__ << " line " << __LINE__ << ": File " << fFilename << " contains invalid header data. Aborting" << G4endl; - G4cerr<<"fMin[kR] >= 0.0: "<= 0.0)<<" "<= 0.0: "<= 0.0)<<" "< 0: "< 0 )<<" "< 0: "< 0 )<<" "< 0: "< 0 )<<" "< 0: "< 0 )<<" "<>(fN[kPhi], + std::vector(fN[kZ], 0.0))); + } - for( zidx = 0; zidx < fN[kZ]; zidx++ ){ - for( pidx = 0; pidx < fN[kPhi]; pidx++ ){ - for( ridx = 0; ridx < fN[kR]; ridx++ ){ + // Read in values + G4int nlines = 0; + for (size_t zidx = 0; zidx < fN[kZ]; zidx++) { + for (size_t pidx = 0; pidx < fN[kPhi]; pidx++) { + for (size_t ridx = 0; ridx < fN[kR]; ridx++) { getline(inputfile,inputline); // Read in field values and assign units - if (std::istringstream(inputline) >> raw_R_m >> raw_Phi_deg >> raw_Z_m >> br >> bp >> bz) { + G4double r, phi, z, bx, by, bz; + if (std::istringstream(inputline) >> r >> phi >> z >> bx >> by >> bz) { nlines++; } else { G4cerr << "Error " << __FILE__ << " line " << __LINE__ @@ -436,76 +351,37 @@ void remollMagneticField::ReadFieldMap(){ exit(1); } - //////////////////////////////////////////////////////////////////// - // This checks that we're reading in properly framed data - // This can probably be condensed - if( ridx == 0 ){ - if( fabs(raw_R_m*m - fMin[kR]) > eps ){ - G4cerr << "Error " << __FILE__ << " line " << __LINE__ - << ": File " << fFilename << " contains bad data framing in R. Aborting" << G4endl; - G4cerr << "Index ("<< ridx << ", " << pidx << ", " << zidx << ") Expected " << fMin[kR]/m << " read " << raw_R_m << G4endl; - exit(1); - } - } - if( pidx == 0 ){ - if( fabs(raw_Phi_deg*deg - fFileMin[kPhi]) > eps ){ - G4cerr << "Error " << __FILE__ << " line " << __LINE__ - << ": File " << fFilename << " contains bad data framing in Phi. Aborting" << G4endl; - G4cerr << "Index ("<< ridx << ", " << pidx << ", " << zidx << ") Expected " << fFileMin[kPhi]/degree << " read " << raw_Phi_deg << G4endl; - exit(1); - } - } - if( zidx == 0 ){ - if( fabs(raw_Z_m*m - fFileMin[kZ]) > eps ){ - G4cerr << "Error " << __FILE__ << " line " << __LINE__ - << ": File " << fFilename << " contains bad data framing in Z. Aborting" << G4endl; - G4cerr << "Index ("<< ridx << ", " << pidx << ", " << zidx << ") Expected " << fFileMin[kZ]/m << " read " << raw_Z_m << G4endl; - exit(1); - } - } - if( ridx == fN[kR]-1 ){ - if( fabs(raw_R_m*m - fMax[kR]) > eps ){ - G4cerr << "Error " << __FILE__ << " line " << __LINE__ - << ": File " << fFilename << " contains bad data framing in R. Aborting" << G4endl; - G4cerr << "Index ("<< ridx << ", " << pidx << ", " << zidx << ") Expected " << fMax[kR]/m << " read " << raw_R_m << G4endl; - exit(1); - } + // Check that we're reading in properly framed data + if( fabs(r*fUnit[kR] - (fMin[kR] + ridx * fStep[kR]) ) > eps ){ + G4cerr << "Error " << __FILE__ << " line " << __LINE__ + << ": File " << fFilename << " contains bad data framing in R. Aborting" << G4endl; + G4cerr << "Index ("<< ridx << ", " << pidx << ", " << zidx << ") Expected " << (fMin[kR] + ridx * fStep[kR])/m << " read " << r << G4endl; + exit(1); } - if( pidx == fN[kPhi]-1 ){ - if( fabs(raw_Phi_deg*deg - fFileMax[kPhi]) > eps ){ - G4cerr << "Error " << __FILE__ << " line " << __LINE__ - << ": File " << fFilename << " contains bad data framing in Phi. Aborting" << G4endl; - G4cerr << "Index ("<< ridx << ", " << pidx << ", " << zidx << ") Expected " << fFileMax[kPhi]/m << " read " << raw_Phi_deg << G4endl; - exit(1); - } + + if( fabs(phi*fUnit[kPhi] - (fFileMin[kPhi] + pidx * fStep[kPhi]) ) > eps ){ + G4cerr << "Error " << __FILE__ << " line " << __LINE__ + << ": File " << fFilename << " contains bad data framing in Phi. Aborting" << G4endl; + G4cerr << "Index ("<< ridx << ", " << pidx << ", " << zidx << ") Expected " << fFileMin[kPhi]/degree << " read " << phi << G4endl; + exit(1); } - if( zidx == fN[kZ]-1 ){ - if( fabs(raw_Z_m*m - fFileMax[kZ]) > eps ){ - G4cerr << "Error " << __FILE__ << " line " << __LINE__ - << ": File " << fFilename << " contains bad data framing in Z. Aborting" << G4endl; - G4cerr << "Index ("<< ridx << ", " << pidx << ", " << zidx << ") Expected " << fFileMax[kZ]/m << " read " << raw_Z_m << G4endl; - exit(1); - } + if( fabs(z*fUnit[kZ] - (fFileMin[kZ] + zidx * fStep[kZ]) ) > eps ){ + G4cerr << "Error " << __FILE__ << " line " << __LINE__ + << ": File " << fFilename << " contains bad data framing in Z. Aborting" << G4endl; + G4cerr << "Index ("<< ridx << ", " << pidx << ", " << zidx << ") Expected " << fFileMin[kZ]/m << " read " << z << G4endl; + exit(1); } - //////////////////////////////////////////////////////////////////// - - /* convert to proper units */ - //G4double val_R = raw_R_m*m; - //G4double val_Z = raw_Z_m*m; - //G4double val_Phi = raw_Phi_deg*degree; // Set the grid values to the values which have been read-in - fBFieldData[kR][ridx][pidx][zidx] = br*tesla; - fBFieldData[kPhi][ridx][pidx][zidx] = bp*tesla; - fBFieldData[kZ][ridx][pidx][zidx] = bz*tesla; + fBFieldData[0][ridx][pidx][zidx] = bx*tesla; + fBFieldData[1][ridx][pidx][zidx] = by*tesla; + fBFieldData[2][ridx][pidx][zidx] = bz*tesla; } } } - fInit = true; G4cout << "... done reading " << nlines << " lines." << G4endl<< G4endl; - } void remollMagneticField::GetFieldValue(const G4double Point[4], G4double *Bfield ) const @@ -540,10 +416,6 @@ void remollMagneticField::GetFieldValue(const G4double Point[4], G4double *Bfiel return; } - // Ensure we're going to get our grid indices correct - assert( fMin[kR] <= r && r < fMax[kR] ); - assert( fMin[kZ] <= z && z < fMax[kZ] ); - // 2. Next calculate phi (slower) G4double phi = atan2(Point[1],Point[0]); @@ -599,8 +471,10 @@ void remollMagneticField::GetFieldValue(const G4double Point[4], G4double *Bfiel x[kZ] = modf( ( z - fMin[kZ] )*(fN[kZ]-1)/( fMax[kZ] - fMin[kZ] ), &(didx[kZ]) ); // Cast these to integers for indexing and check - G4int idx[__NDIM] = {0}; - for(int cidx = 0; cidx < __NDIM; cidx++ ){ idx[cidx] = (G4int) didx[cidx]; } + size_t idx[__NDIM] = {0}; + for (size_t cidx = 0; cidx < __NDIM; cidx++) { + idx[cidx] = size_t(didx[cidx]); + } assert( 0 <= idx[kR] && idx[kR] < fN[kR] ); assert( 0 <= idx[kPhi] && idx[kPhi] < fN[kPhi] ); assert( 0 <= idx[kZ] && idx[kZ] < fN[kZ] ); @@ -611,6 +485,11 @@ void remollMagneticField::GetFieldValue(const G4double Point[4], G4double *Bfiel || idx[kZ] == 0 || idx[kZ] == fN[kZ] - 2) { type = kLinear; } + G4int phi_wrap = INT_MAX; + if (fNxtant == 1 && fxtantSize > 1.9*pi) { + phi_wrap = fN[kPhi] - 1; + } else if (idx[kPhi] == 0 || idx[kPhi] == fN[kPhi] - 2) { + } // number of cell vertices size_t n = 64; @@ -633,35 +512,36 @@ void remollMagneticField::GetFieldValue(const G4double Point[4], G4double *Bfiel values[cidx][i] = fBFieldData[cidx] [idx[kR] + map[i][kR]] - [(idx[kPhi] + map[i][kPhi] + fN[kPhi] - 1) % (fN[kPhi]-1)] // wrap around + [(idx[kPhi] + map[i][kPhi] + fN[kPhi] - 1) % phi_wrap] // wrap around [idx[kZ] + map[i][kZ]]; } } // Interpolate G4double Bint[__NDIM] = {0}; + G4ThreeVector Bcart(Bint[0], Bint[1], Bint[2]); for(int cidx = 0; cidx < __NDIM; cidx++ ){ - switch (type) { case kLinear: { - Bint[cidx] = _trilinearInterpolate(values[cidx], x); + Bcart[cidx] = Bint[cidx] = _trilinearInterpolate(values[cidx], x); break; } case kCubic: { - Bint[cidx] = _tricubicInterpolate(values[cidx], x); + Bcart[cidx] = Bint[cidx] = _tricubicInterpolate(values[cidx], x); break; } } } - G4ThreeVector Bcart = G4ThreeVector(Bint[kR], Bint[kPhi], Bint[kZ]); - Bcart.rotateZ(lphi + fPhiMapOffset); // this changes coordinates from Br, Bphi to Bx, By - // Now we are cartesian, which is what we need to feed Geant4 (yay) + // rotate by local phi, offset, and xtant + Bcart.rotateZ(lphi + fPhiMapOffset + xtant*fxtantSize); + + // scale field + Bcart *= fFieldScale; - Bcart.rotateZ(xtant*fxtantSize); // rotate into our xtant - Bfield[0] = Bcart.x()*fFieldScale; - Bfield[1] = Bcart.y()*fFieldScale; - Bfield[2] = Bcart.z()*fFieldScale; + Bfield[0] = Bcart.x(); + Bfield[1] = Bcart.y(); + Bfield[2] = Bcart.z(); } From 382fe4b414731fb3ca4c96c9f5c44a10fa55e837 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 20 Apr 2021 10:24:40 -0500 Subject: [PATCH 341/443] [fields] improve performance for field lookups, focus on addition --- include/remollMagneticField.hh | 3 ++- src/remollGlobalField.cc | 20 ++++---------------- src/remollMagneticField.cc | 33 ++++++++++++++++++++++----------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/include/remollMagneticField.hh b/include/remollMagneticField.hh index b61e99ffe..31a0af0f8 100644 --- a/include/remollMagneticField.hh +++ b/include/remollMagneticField.hh @@ -45,7 +45,8 @@ class remollMagneticField : public G4MagneticField { remollMagneticField(const G4String&); virtual ~remollMagneticField() { }; - void GetFieldValue(const G4double Point[4], G4double *Bfield) const; + void AddFieldValue(const G4double point[4], G4double *field) const; + void GetFieldValue(const G4double point[4], G4double *field) const; void SetFieldScale(G4double scale) { fFieldScale = scale; } void SetRefCurrent(G4double current) { fRefCurrent = current; } diff --git a/src/remollGlobalField.cc b/src/remollGlobalField.cc index 0526646d8..c8b37f40e 100644 --- a/src/remollGlobalField.cc +++ b/src/remollGlobalField.cc @@ -251,23 +251,11 @@ void remollGlobalField::PrintFieldValue(const G4ThreeVector& r) G4cout << "T" << G4endl; } -void remollGlobalField::GetFieldValue(const G4double p[], G4double *resB) const +void remollGlobalField::GetFieldValue(const G4double p[], G4double *field) const { - G4double Bsum [__GLOBAL_NDIM] = {0}; - - std::vector::const_iterator it = fFields.begin(); - for (it = fFields.begin(); it != fFields.end(); it++) { - G4double thisB[__GLOBAL_NDIM] = {0}; - (*it)->GetFieldValue(p, thisB); - - for (int i = 0; i < __GLOBAL_NDIM; i++) { - Bsum[i] += thisB[i]; - } - } - - for (int i = 0; i < __GLOBAL_NDIM; i++) { - resB[i] = Bsum[i]; - } + // Field is initialized to zero before passing to this function + for (auto it = fFields.begin(); it != fFields.end(); it++) + (*it)->GetFieldValue(p, field); } void remollGlobalField::SetZOffset(const G4String& name, G4double offset) diff --git a/src/remollMagneticField.cc b/src/remollMagneticField.cc index 97a9b9641..bbc48a509 100644 --- a/src/remollMagneticField.cc +++ b/src/remollMagneticField.cc @@ -384,10 +384,20 @@ remollMagneticField::remollMagneticField(const G4String& filename) G4cout << "... done reading " << nlines << " lines." << G4endl<< G4endl; } -void remollMagneticField::GetFieldValue(const G4double Point[4], G4double *Bfield ) const +void remollMagneticField::GetFieldValue(const G4double point[4], G4double *field ) const +{ + // set to zero + field[0] = 0.0; + field[1] = 0.0; + field[2] = 0.0; + // add values + AddFieldValue(point, field); +} + +void remollMagneticField::AddFieldValue(const G4double point[4], G4double *field ) const { // Check the bounding box - if (! IsInBoundingBox(Point)) return; + if (! IsInBoundingBox(point)) return; // First we have to translate into polar or cylindric coordinates // since the field maps are given in cylindric coordinates and the @@ -397,15 +407,15 @@ void remollMagneticField::GetFieldValue(const G4double Point[4], G4double *Bfiel // back to the field manager // 1. First calculate r and z - G4double r = sqrt(Point[0]*Point[0] + Point[1]*Point[1]); - G4double z = Point[2] - fZoffset; + G4double r = sqrt(point[0]*point[0] + point[1]*point[1]); + G4double z = point[2] - fZoffset; // Check that the point is a valid number if( std::isnan(r) || std::isinf(r) || std::isnan(z) || std::isinf(z) ){ G4cerr << __FILE__ << " line " << __LINE__ << ": ERROR bad conversion to cylindrical coordinates" << G4endl; - G4cerr << "Point ( " << Point[0]/m << ", " << Point[1]/m << ", " << Point[2]/m << " ) m" << G4endl; + G4cerr << "Point ( " << point[0]/m << ", " << point[1]/m << ", " << point[2]/m << " ) m" << G4endl; exit(1); } @@ -417,13 +427,13 @@ void remollMagneticField::GetFieldValue(const G4double Point[4], G4double *Bfiel } // 2. Next calculate phi (slower) - G4double phi = atan2(Point[1],Point[0]); + G4double phi = atan2(point[1],point[0]); // Check that the point is a valid number if( std::isnan(phi) || std::isinf(phi) ){ G4cerr << __FILE__ << " line " << __LINE__ << ": ERROR bad conversion to cylindrical coordinates" << G4endl; - G4cerr << "Point ( " << Point[0]/m << ", " << Point[1]/m << ", " << Point[2]/m << " ) m" << G4endl; + G4cerr << "Point ( " << point[0]/m << ", " << point[1]/m << ", " << point[2]/m << " ) m" << G4endl; exit(1); } @@ -506,7 +516,7 @@ void remollMagneticField::GetFieldValue(const G4double Point[4], G4double *Bfiel } // values of cell vertices - G4double values[__NDIM][64]; /* make large enough, TODO thread_local */ + thread_local G4double values[__NDIM][64]; for (size_t i = 0; i < n; i++) { for (size_t cidx = 0; cidx < __NDIM; cidx++) { values[cidx][i] = @@ -539,9 +549,10 @@ void remollMagneticField::GetFieldValue(const G4double Point[4], G4double *Bfiel // scale field Bcart *= fFieldScale; - Bfield[0] = Bcart.x(); - Bfield[1] = Bcart.y(); - Bfield[2] = Bcart.z(); + // add to original field + field[0] += Bcart.x(); + field[1] += Bcart.y(); + field[2] += Bcart.z(); } From 27a5489f0e0dc14395180d24bf02eb2a963b8f04 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 21 Apr 2021 15:14:18 -0500 Subject: [PATCH 342/443] [CMakeLists.txt] forgotten conflict resolution --- CMakeLists.txt | 6 ------ 1 file changed, 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a22005f81..43141f5ef 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -226,16 +226,10 @@ install(FILES ${headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) #---------------------------------------------------------------------------- # executables # -<<<<<<< HEAD -add_library(remoll-lib SHARED ${sources} ${headers} ${CMAKE_CURRENT_BINARY_DIR}/include/gitinfo.hh remollDict.cxx) -set_target_properties(remoll-lib PROPERTIES OUTPUT_NAME remoll) -target_link_libraries(remoll-lib ${Geant4_LIBRARIES} ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${cadmesh_LIBRARIES}) -======= file(GLOB exefiles *.cc) foreach(file ${exefiles}) get_filename_component(filename ${file} NAME_WE) string(TOLOWER ${filename} filelower) ->>>>>>> upstream/develop add_executable(${filelower} ${file}) From ef482598eaa903ce37d1f19b95cb411d0d437c20 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 21 Apr 2021 22:08:56 -0500 Subject: [PATCH 343/443] [CMakeLists] better cadmesh detection --- CMakeLists.txt | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 43141f5ef..9c1ca431a 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,14 +104,38 @@ endif() #---------------------------------------------------------------------------- # Find CADMesh libraries -if(USE_CADMESH) - find_package(cadmesh) - if(cadmesh_FOUND) - # Pretty sure at some point cadmesh will update to use lowercase - include_directories(${CADMESH_INCLUDE_DIRS}) - include_directories(${cadmesh_INCLUDE_DIRS}) - link_directories(${cadmesh_LIBRARY_DIR}) - ADD_DEFINITIONS(-D__USE_CADMESH) +set(cadmesh_LIBRARIES "") +find_package(cadmesh) +if(cadmesh_FOUND) + # Pretty sure at some point cadmesh will update to use lowercase + include_directories(${CADMESH_INCLUDE_DIRS}) + include_directories(${cadmesh_INCLUDE_DIRS}) + link_directories(${cadmesh_LIBRARY_DIR}) + ADD_DEFINITIONS(-D__USE_CADMESH) + + find_path(TETGEN_INCLUDE_DIRS tetgen.h + PATHS + $ENV{TETGEN_PATH} + $ENV{TETGEN_PATH}/tetgen + /usr/local/include + /usr/include) + find_library(TETGEN_LIBRARIES NAMES tetgen tet + PATHS + $ENV{TETGEN_PATH} + $ENV{TETGEN_PATH}/tetgen + /usr/local/lib + /usr/lib) + if(TETGEN_INCLUDE_DIRS) + if(TETGEN_LIBRARIES) + include_directories(${TETGEN_INCLUDE_DIRS}) + ADD_DEFINITIONS(-D__USE_CADMESH_TETGEN) + endif() + endif() + + find_package(assimp QUIET) + if(assimp_FOUND) + include_directories(${ASSIMP_INCLUDE_DIRS}) + ADD_DEFINITIONS(-D__USE_CADMESH_ASSIMP) endif() endif() @@ -212,6 +236,7 @@ target_link_libraries(lib${PROJECT_NAME} ${Boost_LIBRARIES} ${HEPMC_LIBRARIES} ${PYTHIA6_LIBRARIES} + ${cadmesh_LIBRARIES} ) install(TARGETS lib${PROJECT_NAME} From 54cc0b683fc55e862ac223dc2562e64997661f20 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 21 Apr 2021 22:11:18 -0500 Subject: [PATCH 344/443] [DetectorConstruction] /remoll/geometry/addmesh support --- include/remollDetectorConstruction.hh | 5 +++++ src/remollDetectorConstruction.cc | 30 +++++++++++++++++++++------ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/include/remollDetectorConstruction.hh b/include/remollDetectorConstruction.hh index 0c8d5f09f..cf97e1067 100644 --- a/include/remollDetectorConstruction.hh +++ b/include/remollDetectorConstruction.hh @@ -112,6 +112,11 @@ class remollDetectorConstruction : public G4VUserDetectorConstruction void InitKryptoniteMaterials(); + private: + + std::vector fMeshPVs; + + void AddMeshFile(G4String filename, G4ThreeVector position); public: diff --git a/src/remollDetectorConstruction.cc b/src/remollDetectorConstruction.cc index 1c94506eb..c752d7426 100644 --- a/src/remollDetectorConstruction.cc +++ b/src/remollDetectorConstruction.cc @@ -16,6 +16,7 @@ #include "G4PhysicalVolumeStore.hh" #include "G4LogicalVolumeStore.hh" #include "G4LogicalVolume.hh" +#include "G4PVPlacement.hh" #include "globals.hh" #include "G4RunManager.hh" @@ -31,7 +32,7 @@ //CADMesh #ifdef __USE_CADMESH -#include "CADMesh.hh" +#include #endif // visual @@ -176,6 +177,11 @@ remollDetectorConstruction::remollDetectorConstruction(const G4String& name, con &remollDetectorConstruction::RelativeRotation, "Rotate a volume relative to current orientation [deg]") .SetStates(G4State_PreInit,G4State_Idle); + fGeometryMessenger->DeclareMethod( + "addmesh", + &remollDetectorConstruction::AddMeshFile, + "Add mesh file (stl, ply, obj)") + .SetStates(G4State_Idle); // Create user limits messenger fUserLimitsMessenger = new G4GenericMessenger(this, @@ -375,6 +381,23 @@ remollDetectorConstruction::~remollDetectorConstruction() delete fUserLimitsMessenger; } +void remollDetectorConstruction::AddMeshFile(G4String filename, G4ThreeVector position) +{ + G4String material = "G4_Galactic"; + G4ThreeVector rotation(0.0,0.0,0.0); + #ifdef __USE_CADMESH + auto mesh = CADMesh::TessellatedMesh::FromSTL(filename); + G4VSolid* solid = mesh->GetSolid(); + G4Material* mat = G4NistManager::Instance()->FindOrBuildMaterial(material); + G4LogicalVolume* lv = new G4LogicalVolume(solid, mat, filename); + G4RotationMatrix rot(rotation.x(), rotation.y(), rotation.z()); + G4Transform3D tf(rot, position); + fMeshPVs.push_back(new G4PVPlacement(tf, filename, lv, fWorldVolume, false, 0, false)); + #else + G4cerr << __FILE__ << " line " << __LINE__ << ": Warning - meshes not supported." << G4endl; + #endif +} + void remollDetectorConstruction::AbsolutePosition(G4String name, G4ThreeVector position) { // Units @@ -919,11 +942,6 @@ void remollDetectorConstruction::ParseAuxiliarySensDetInfo() G4VPhysicalVolume* remollDetectorConstruction::Construct() { - #ifdef __USE_CADMESH - G4ThreeVector offset = G4ThreeVector(-30*cm, 0, 0); - CADMesh * mesh = new CADMesh("../../models/cone.ply", mm, offset, false); - #endif - // Parse GDML file fWorldVolume = ParseGDMLFile(); From 8140a3d57622779bca5c554cdb8c74fd3b14353a Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 22 Apr 2021 22:48:06 -0500 Subject: [PATCH 345/443] [DetectorConstruction] multiple mesh solid support --- include/remollDetectorConstruction.hh | 2 +- src/remollDetectorConstruction.cc | 29 +++++++++++++++++---------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/include/remollDetectorConstruction.hh b/include/remollDetectorConstruction.hh index cf97e1067..484cc3230 100644 --- a/include/remollDetectorConstruction.hh +++ b/include/remollDetectorConstruction.hh @@ -116,7 +116,7 @@ class remollDetectorConstruction : public G4VUserDetectorConstruction std::vector fMeshPVs; - void AddMeshFile(G4String filename, G4ThreeVector position); + void AddMesh(const G4String& filename); public: diff --git a/src/remollDetectorConstruction.cc b/src/remollDetectorConstruction.cc index c752d7426..07b552723 100644 --- a/src/remollDetectorConstruction.cc +++ b/src/remollDetectorConstruction.cc @@ -179,8 +179,8 @@ remollDetectorConstruction::remollDetectorConstruction(const G4String& name, con .SetStates(G4State_PreInit,G4State_Idle); fGeometryMessenger->DeclareMethod( "addmesh", - &remollDetectorConstruction::AddMeshFile, - "Add mesh file (stl, ply, obj)") + &remollDetectorConstruction::AddMesh, + "Add mesh file (ascii stl, ascii ply, ascii obj)") .SetStates(G4State_Idle); // Create user limits messenger @@ -374,6 +374,7 @@ void remollDetectorConstruction::SetUserMinRange(G4String name, G4String value_u remollDetectorConstruction::~remollDetectorConstruction() { + for (auto pv: fMeshPVs) delete pv; delete fGDMLParser; delete fMessenger; delete fGeometryMessenger; @@ -381,18 +382,24 @@ remollDetectorConstruction::~remollDetectorConstruction() delete fUserLimitsMessenger; } -void remollDetectorConstruction::AddMeshFile(G4String filename, G4ThreeVector position) +void remollDetectorConstruction::AddMesh(const G4String& filename) { - G4String material = "G4_Galactic"; - G4ThreeVector rotation(0.0,0.0,0.0); + G4Material* material = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic"); #ifdef __USE_CADMESH + // Read mesh auto mesh = CADMesh::TessellatedMesh::FromSTL(filename); - G4VSolid* solid = mesh->GetSolid(); - G4Material* mat = G4NistManager::Instance()->FindOrBuildMaterial(material); - G4LogicalVolume* lv = new G4LogicalVolume(solid, mat, filename); - G4RotationMatrix rot(rotation.x(), rotation.y(), rotation.z()); - G4Transform3D tf(rot, position); - fMeshPVs.push_back(new G4PVPlacement(tf, filename, lv, fWorldVolume, false, 0, false)); + + // Extract solids + for (auto solid: mesh->GetSolids()) { + auto lv = new G4LogicalVolume(solid, material, filename); + lv->SetVisAttributes(G4Colour(0.0,1.0,0.0,1.0)); + auto pv = new G4PVPlacement(G4Transform3D(), filename, lv, fWorldVolume, false, 0, false); + fMeshPVs.push_back(pv); + } + + // Reoptimize geometry + G4RunManager* run_manager = G4RunManager::GetRunManager(); + run_manager->GeometryHasBeenModified(); #else G4cerr << __FILE__ << " line " << __LINE__ << ": Warning - meshes not supported." << G4endl; #endif From 6573630fa2e7d7540c5866ffb5605f3467cc090d Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 22 Apr 2021 22:49:26 -0500 Subject: [PATCH 346/443] [mesh] load meshes from cad (needs separate downloads) --- macros/load_meshes.mac | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 macros/load_meshes.mac diff --git a/macros/load_meshes.mac b/macros/load_meshes.mac new file mode 100644 index 000000000..69b2ce374 --- /dev/null +++ b/macros/load_meshes.mac @@ -0,0 +1,11 @@ +/remoll/geometry/addmesh geometry/meshes/JL0091832_small.stl +/remoll/geometry/addmesh geometry/meshes/JL0094043_small.stl +/remoll/geometry/addmesh geometry/meshes/JL0094629_small.stl +/remoll/geometry/addmesh geometry/meshes/JL0094773_small.stl +/remoll/geometry/addmesh geometry/meshes/JL0094866_small.stl +/remoll/geometry/addmesh geometry/meshes/JL0095703_small.stl +/remoll/geometry/addmesh geometry/meshes/JL0096533_small.stl +/remoll/geometry/addmesh geometry/meshes/JL0096597_small.stl +/remoll/geometry/addmesh geometry/meshes/JL0096636_small.stl +/remoll/geometry/addmesh geometry/meshes/JL0096676_small.stl +#/remoll/geometry/addmesh geometry/meshes/JL0096772_small.stl From 49093fb7b72421878b90a0493938f48977577106 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 22 Apr 2021 23:14:58 -0500 Subject: [PATCH 347/443] [targets] complete target macros for all targets --- macros/target/AlDummy1DS.mac | 2 ++ macros/target/AlDummy2DS.mac | 2 ++ macros/target/AlDummy2US.mac | 2 ++ macros/target/AlDummyHoleUS.mac | 3 +++ macros/target/AlHoleUS.mac | 2 ++ macros/target/LH2.mac | 2 ++ macros/target/Optics2.mac | 2 ++ 7 files changed, 15 insertions(+) create mode 100644 macros/target/AlDummyHoleUS.mac diff --git a/macros/target/AlDummy1DS.mac b/macros/target/AlDummy1DS.mac index 36e24af43..b887226ea 100644 --- a/macros/target/AlDummy1DS.mac +++ b/macros/target/AlDummy1DS.mac @@ -1 +1,3 @@ /remoll/geometry/absolute_position targetLadder (0,350,0) +/remoll/target/mother AlDummy1DS +/remoll/target/volume DSAl diff --git a/macros/target/AlDummy2DS.mac b/macros/target/AlDummy2DS.mac index 8cb071ab5..41419cc01 100644 --- a/macros/target/AlDummy2DS.mac +++ b/macros/target/AlDummy2DS.mac @@ -1 +1,3 @@ /remoll/geometry/absolute_position targetLadder (0,490,0) +/remoll/target/mother AlDummy2DS +/remoll/target/volume DSAl diff --git a/macros/target/AlDummy2US.mac b/macros/target/AlDummy2US.mac index b2a2e8f29..1f0fa73e1 100644 --- a/macros/target/AlDummy2US.mac +++ b/macros/target/AlDummy2US.mac @@ -1 +1,3 @@ /remoll/geometry/absolute_position targetLadder (0,420,0) +/remoll/target/mother AlDummy2US +/remoll/target/volume USAl diff --git a/macros/target/AlDummyHoleUS.mac b/macros/target/AlDummyHoleUS.mac new file mode 100644 index 000000000..bf302211a --- /dev/null +++ b/macros/target/AlDummyHoleUS.mac @@ -0,0 +1,3 @@ +/remoll/geometry/absolute_position targetLadder (0,140,0) +/remoll/target/mother AlHoleUS +/remoll/target/volume USAl diff --git a/macros/target/AlHoleUS.mac b/macros/target/AlHoleUS.mac index 5fa06ce9e..bf302211a 100644 --- a/macros/target/AlHoleUS.mac +++ b/macros/target/AlHoleUS.mac @@ -1 +1,3 @@ /remoll/geometry/absolute_position targetLadder (0,140,0) +/remoll/target/mother AlHoleUS +/remoll/target/volume USAl diff --git a/macros/target/LH2.mac b/macros/target/LH2.mac index e43e00a41..d7507df8c 100644 --- a/macros/target/LH2.mac +++ b/macros/target/LH2.mac @@ -1 +1,3 @@ /remoll/geometry/absolute_position targetLadder (0,0,0) +/remoll/target/mother LH2 +/remoll/target/volume LH2 diff --git a/macros/target/Optics2.mac b/macros/target/Optics2.mac index 85014fa23..2f0b72c07 100644 --- a/macros/target/Optics2.mac +++ b/macros/target/Optics2.mac @@ -1 +1,3 @@ /remoll/geometry/absolute_position targetLadder (0,630,0) +/remoll/target/mother Optics2 +/remoll/target/volume USC From bc4d7a8dcc853d4761b06a5dc0148d7defd5ea77 Mon Sep 17 00:00:00 2001 From: Sakib Rahman Date: Sat, 24 Apr 2021 14:16:05 -0400 Subject: [PATCH 348/443] Example macros to prune remoll output trees based on selected events so that they can be used as source for remoll external generator --- analysis/copytree/README.md | 19 ++++++ analysis/copytree/copytree_allbr.C | 54 +++++++++++++++++ analysis/copytree/copytree_selectbr.C | 83 +++++++++++++++++++++++++++ 3 files changed, 156 insertions(+) create mode 100644 analysis/copytree/README.md create mode 100755 analysis/copytree/copytree_allbr.C create mode 100755 analysis/copytree/copytree_selectbr.C diff --git a/analysis/copytree/README.md b/analysis/copytree/README.md new file mode 100644 index 000000000..db1956b3d --- /dev/null +++ b/analysis/copytree/README.md @@ -0,0 +1,19 @@ +Two examples of pruning remoll output trees are provided. + + + +copytree_allbr.C - copies the entire structure for selected events +copytree_selectbr.C - copies specific branches and prunes them farther based on additional cuts for selected events + + + + +Usage: + + + +./reroot -q -b copytree_selectbr.C'("input.root", "output.root")' + + + +In the specific example shown here, the output can be fed to remoll external generator for ferrous bellows studies. diff --git a/analysis/copytree/copytree_allbr.C b/analysis/copytree/copytree_allbr.C new file mode 100755 index 000000000..59194235a --- /dev/null +++ b/analysis/copytree/copytree_allbr.C @@ -0,0 +1,54 @@ +using namespace ROOT; + +Int_t isValid(std::vector *); + +int copytree_allbr(TString source, TString out){ + +TChain T("T"); +T.Add(Form("%s", source.Data())); // Adding source file +Int_t nEvents= T.GetEntries(); // Number of primary events +std::cout << "Analyzing "<< nEvents << "events" << std::endl; + +TFile f(Form("%s", out.Data()), "RECREATE"); +auto *tree = T.CloneTree(0); + +remollEvent_t *fEvent=0; +std::vector *fHit=0; + +T.SetBranchAddress("ev", &fEvent); +T.SetBranchAddress("hit", &fHit); + + +for (size_t j=0;j< nEvents;j++){ + T.GetEntry(j); + + if(isValid(fHit)){ // identify events for which track id 1 hits bellows + tree->Fill(); + } +} + +tree->Print(); +tree->Write(); + + +return 0; +} + + + +Int_t isValid(std::vector *fHit){ + +Int_t found=0; +// return true if there is atleast one hit on one of the bellows with track id 1 for an individual event +for (size_t i=0;isize();i++){ + remollGenericDetectorHit_t hit=fHit->at(i); + if ((hit.det>=70 && hit.det <=76) && hit.trid==1){ + found=1; + break; + } +} + +return found; + +} + diff --git a/analysis/copytree/copytree_selectbr.C b/analysis/copytree/copytree_selectbr.C new file mode 100755 index 000000000..1793e9490 --- /dev/null +++ b/analysis/copytree/copytree_selectbr.C @@ -0,0 +1,83 @@ +using namespace ROOT; + +Int_t isValid(std::vector *); + +int copytree_selectbr_V2(TString source, TString out){ + +TChain T("T"); +T.Add(Form("%s", source.Data())); +Int_t nEvents= T.GetEntries(); +std::cout << "Analyzing "<< nEvents << "events" << std::endl; + +// Only need event and hit branch for remollExternalGenerator +remollEvent_t *oevent=0; +std::vector *ohit=0; +TFile f(Form("%s", out.Data()), "RECREATE"); +auto *tree = new TTree("T", "outputtree"); +auto *br_event = tree->Branch("ev", &oevent); +auto *br_hit = tree->Branch("hit", &ohit); + +remollEvent_t *fEvent=0; +std::vector *fHit=0; +T.SetBranchAddress("ev", &fEvent); +T.SetBranchAddress("hit", &fHit); + +std::map unique; + +for (size_t j=0;j< nEvents;j++){ + T.GetEntry(j); + + // identify events for which track id 1 hits one of the bellows + if(isValid(fHit)){ + oevent = fEvent; + unique[5547]=0; + unique[28]=0; + unique[70]=0; + unique[71]=0; + unique[72]=0; + unique[73]=0; + unique[74]=0; + unique[75]=0; + unique[76]=0; + + for(size_t i=0;isize();i++){ + remollGenericDetectorHit_t hit=fHit->at(i); + + // only record the hits with track id 1. Record the first hit on each detector as the hit for each primary track is already time ordered. + if(hit.trid!=1 || unique[hit.det]!=0 ) continue; + unique[hit.det]++; + ohit->push_back(hit); + + } + + tree->Fill(); + ohit->clear(); // must clear output hit collection vector before loading the next event + + } +} + +tree->Print(); +tree->Write(); + + +return 0; +} + + + +Int_t isValid(std::vector *fHit){ + +Int_t found=0; +// return true if there is atleast one hit on one of the bellows with track id 1 for an individual event +for (size_t i=0;isize();i++){ + remollGenericDetectorHit_t hit=fHit->at(i); + if ((hit.det>=70 && hit.det <=76) && hit.trid==1){ + found=1; + break; + } +} + +return found; + +} + From 308cb2ab68770dfcace0018ebc524602e0fd510f Mon Sep 17 00:00:00 2001 From: Sakib Rahman Date: Sat, 24 Apr 2021 15:03:10 -0400 Subject: [PATCH 349/443] Typo correction --- analysis/copytree/copytree_selectbr.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/analysis/copytree/copytree_selectbr.C b/analysis/copytree/copytree_selectbr.C index 1793e9490..8311b9724 100755 --- a/analysis/copytree/copytree_selectbr.C +++ b/analysis/copytree/copytree_selectbr.C @@ -2,7 +2,7 @@ using namespace ROOT; Int_t isValid(std::vector *); -int copytree_selectbr_V2(TString source, TString out){ +int copytree_selectbr(TString source, TString out){ TChain T("T"); T.Add(Form("%s", source.Data())); From b6bf4f2e1bda60253c81189b3d78cbea88ce56a6 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sat, 24 Apr 2021 16:37:05 -0500 Subject: [PATCH 350/443] [genExternal] Make ROOT interface static and guard with mutexes --- include/remollGenExternal.hh | 12 +++++++----- src/remollGenExternal.cc | 19 +++++++++++++------ 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/include/remollGenExternal.hh b/include/remollGenExternal.hh index 6fa1e2c79..08fd37a64 100644 --- a/include/remollGenExternal.hh +++ b/include/remollGenExternal.hh @@ -52,14 +52,16 @@ class remollGenExternal : public remollVEventGen { private: void SamplePhysics(remollVertex *, remollEvent *); + // External event file and tree, entry number - TFile* fFile; - TTree* fTree; - Int_t fEntry, fEntries; + static TFile* fFile; + static TTree* fTree; + static Int_t fEntry, fEntries; // Event and hit structures - remollEvent_t* fEvent; - std::vector* fHit; + static remollEvent_t* fEvent; + static std::vector* fHit; + G4double fzOffset; // Detector ID to consider diff --git a/src/remollGenExternal.cc b/src/remollGenExternal.cc index 11095090e..320ce9051 100644 --- a/src/remollGenExternal.cc +++ b/src/remollGenExternal.cc @@ -19,11 +19,15 @@ G4Mutex inFileMutex = G4MUTEX_INITIALIZER; +TFile* remollGenExternal::fFile = 0; +TTree* remollGenExternal::fTree = 0; +remollEvent_t* remollGenExternal::fEvent = 0; +std::vector* remollGenExternal::fHit = 0; +Int_t remollGenExternal::fEntry = 0; +Int_t remollGenExternal::fEntries = 0; + remollGenExternal::remollGenExternal() : remollVEventGen("external"), - fFile(0), fTree(0), - fEntry(0), fEntries(0), - fEvent(0), fHit(0), fzOffset(0), fDetectorID(28), fLoopID(1) { fSamplingType = kNoTargetVolume; @@ -38,6 +42,7 @@ remollGenExternal::remollGenExternal() remollGenExternal::~remollGenExternal() { G4AutoLock inFileLock(&inFileMutex); + // Close file which deletes tree if (fFile) { fFile->Close(); @@ -48,6 +53,7 @@ remollGenExternal::~remollGenExternal() void remollGenExternal::SetGenExternalFile(G4String& filename) { G4AutoLock inFileLock(&inFileMutex); + G4cout << "Setting the external file to " << filename << " from " << fFile << G4endl; // Close previous file if (fFile) { @@ -68,9 +74,8 @@ void remollGenExternal::SetGenExternalFile(G4String& filename) G4cerr << "Could not find tree T in event file (SetGenExternalFile)" << filename << G4endl; return; } - inFileLock.unlock(); - // Get number of entries + // Nunber of entries fEntries = fTree->GetEntries(); // Initialize tree @@ -92,6 +97,8 @@ void remollGenExternal::SetGenExternalFile(G4String& filename) void remollGenExternal::SamplePhysics(remollVertex* /* vert */, remollEvent* evt) { + G4AutoLock inFileLock(&inFileMutex); + // Check whether three exists if (! fTree) { G4cerr << "Could not find tree T in event file (SamplePhysics)" << G4endl; @@ -106,7 +113,7 @@ void remollGenExternal::SamplePhysics(remollVertex* /* vert */, remollEvent* evt if (fEntry >= fEntries) fEntry = 0; fTree->GetEntry(fEntry++); - + /* event tree removed by Cameron 11/15/2018 * // Weighting completely handled by event file * evt->SetEffCrossSection(fEvent->xs*microbarn); From 0ef81287dad5663ec155cfb0f43037477b226333 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sat, 24 Apr 2021 17:23:58 -0500 Subject: [PATCH 351/443] [vis] added horizontal XZ plane section view to gui --- macros/gui.mac | 3 ++- vis/section.mac | 5 ----- vis/section_yz.mac | 7 +++++++ 3 files changed, 9 insertions(+), 6 deletions(-) delete mode 100644 vis/section.mac create mode 100644 vis/section_yz.mac diff --git a/macros/gui.mac b/macros/gui.mac index 92de97c7c..a2ce51468 100644 --- a/macros/gui.mac +++ b/macros/gui.mac @@ -57,7 +57,8 @@ /gui/addButton view "Load vis settings" "/control/execute vis/vis.mac" /gui/addButton view "Load cutaway settings" "/control/execute vis/cutaway.mac" /gui/addButton view "Clear cutaway planes" "/vis/viewer/clearCutawayPlanes" -/gui/addButton view "Vertical section view" "/control/execute vis/section.mac" +/gui/addButton view "YZ section view" "/control/execute vis/section_yz.mac" +/gui/addButton view "XZ section view" "/control/execute vis/section_xz.mac" /gui/addButton view "Draw real world" "/vis/drawVolume world" /gui/addButton view "Draw all worlds" "/vis/drawVolume worlds" /gui/addButton view "Set style surface" "/vis/viewer/set/style surface" diff --git a/vis/section.mac b/vis/section.mac deleted file mode 100644 index 0bd01d32b..000000000 --- a/vis/section.mac +++ /dev/null @@ -1,5 +0,0 @@ -/vis/viewer/clearCutawayPlanes -/vis/viewer/set/cutawayMode intersection -/vis/viewer/addCutawayPlane 0.0 0.0 0.0 mm 1.0 0.0 0.0 -/vis/viewer/addCutawayPlane 1.0 0.0 0.0 mm -1.0 0.0 0.0 -/vis/viewer/set/style wireframe diff --git a/vis/section_yz.mac b/vis/section_yz.mac new file mode 100644 index 000000000..94645cd5f --- /dev/null +++ b/vis/section_yz.mac @@ -0,0 +1,7 @@ +/vis/viewer/clearCutawayPlanes +/vis/viewer/set/cutawayMode intersection +/vis/viewer/addCutawayPlane -1.0 0.0 0.0 mm +1.0 0.0 0.0 +/vis/viewer/addCutawayPlane +1.0 0.0 0.0 mm -1.0 0.0 0.0 +/vis/viewer/set/style wireframe +/vis/viewer/set/upVector 0.0 1.0 0.0 +/vis/viewer/set/viewpointThetaPhi 90 180 deg From 27f41a7daf6fd7db5218b32d6b711b1dffd22f60 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 25 Apr 2021 13:16:19 -0500 Subject: [PATCH 352/443] [genExternal] enable event branch reading --- src/remollGenExternal.cc | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/src/remollGenExternal.cc b/src/remollGenExternal.cc index 320ce9051..206215f59 100644 --- a/src/remollGenExternal.cc +++ b/src/remollGenExternal.cc @@ -85,14 +85,13 @@ void remollGenExternal::SetGenExternalFile(G4String& filename) G4cerr << "Could not find branch hit in event file " << filename << G4endl; return; } -/* event tree removed by Cameron 11/15/2018 -* if (fTree->GetBranch("ev")) { -* fTree->SetBranchAddress("ev", &fEvent); -* } else { -* G4cerr << "Could not find branch ev in event file " << filename << G4endl; -* return; -* } -*/ + + if (fTree->GetBranch("ev")) { + fTree->SetBranchAddress("ev", &fEvent); + } else { + G4cerr << "Could not find branch ev in event file " << filename << G4endl; + return; + } } void remollGenExternal::SamplePhysics(remollVertex* /* vert */, remollEvent* evt) @@ -114,17 +113,12 @@ void remollGenExternal::SamplePhysics(remollVertex* /* vert */, remollEvent* evt fEntry = 0; fTree->GetEntry(fEntry++); -/* event tree removed by Cameron 11/15/2018 -* // Weighting completely handled by event file -* evt->SetEffCrossSection(fEvent->xs*microbarn); -* evt->SetQ2(fEvent->Q2); -* evt->SetW2(fEvent->W2); -* evt->SetAsymmetry(fEvent->A*ppb); -*/ - evt->SetEffCrossSection(619.5*microbarn); - evt->SetQ2(0.0); - evt->SetW2(4e15); - evt->SetAsymmetry(-42.0*ppb); + // Weighting completely handled by event file + evt->SetEffCrossSection(fEvent->xs*microbarn); + evt->SetQ2(fEvent->Q2); + evt->SetW2(fEvent->W2); + evt->SetAsymmetry(fEvent->A*ppb); + // Loop over all hits in this event for (size_t i = 0; i < fHit->size(); i++) { // Create local copy of this hit From 9cac023031d0b73088352c0da7eef8b341bb5ad4 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 25 Apr 2021 14:05:53 -0500 Subject: [PATCH 353/443] [fields] GetFieldValue needs to initialize field when not debug --- src/remollGlobalField.cc | 7 +++++-- src/remollMagneticField.cc | 7 +++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/remollGlobalField.cc b/src/remollGlobalField.cc index c8b37f40e..f8ae0883e 100644 --- a/src/remollGlobalField.cc +++ b/src/remollGlobalField.cc @@ -253,9 +253,12 @@ void remollGlobalField::PrintFieldValue(const G4ThreeVector& r) void remollGlobalField::GetFieldValue(const G4double p[], G4double *field) const { - // Field is initialized to zero before passing to this function + // Field is not initialized to zero by geant4 + field[0] = 0.0; + field[1] = 0.0; + field[2] = 0.0; for (auto it = fFields.begin(); it != fFields.end(); it++) - (*it)->GetFieldValue(p, field); + (*it)->AddFieldValue(p, field); } void remollGlobalField::SetZOffset(const G4String& name, G4double offset) diff --git a/src/remollMagneticField.cc b/src/remollMagneticField.cc index bbc48a509..c38c2c957 100644 --- a/src/remollMagneticField.cc +++ b/src/remollMagneticField.cc @@ -528,16 +528,15 @@ void remollMagneticField::AddFieldValue(const G4double point[4], G4double *field } // Interpolate - G4double Bint[__NDIM] = {0}; - G4ThreeVector Bcart(Bint[0], Bint[1], Bint[2]); + G4ThreeVector Bcart(0.0,0.0,0.0); for(int cidx = 0; cidx < __NDIM; cidx++ ){ switch (type) { case kLinear: { - Bcart[cidx] = Bint[cidx] = _trilinearInterpolate(values[cidx], x); + Bcart[cidx] = _trilinearInterpolate(values[cidx], x); break; } case kCubic: { - Bcart[cidx] = Bint[cidx] = _tricubicInterpolate(values[cidx], x); + Bcart[cidx] = _tricubicInterpolate(values[cidx], x); break; } } From 83aa46cdc2150f2ed722749614436d4580645e51 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 28 Apr 2021 15:13:59 -0500 Subject: [PATCH 354/443] [meshes] Ignore stl (so no one uploads one to github, ever) --- geometry/meshes/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 geometry/meshes/.gitignore diff --git a/geometry/meshes/.gitignore b/geometry/meshes/.gitignore new file mode 100644 index 000000000..1567411f9 --- /dev/null +++ b/geometry/meshes/.gitignore @@ -0,0 +1 @@ +*.stl From 2ed6bd5e4a479efe430bab8f9c0da364d042e2b5 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 28 Apr 2021 15:40:14 -0500 Subject: [PATCH 355/443] [vis] XZ and YZ section view macros and menu entries --- macros/gui.mac | 3 ++- vis/section.mac | 5 ----- vis/section_yz.mac | 7 +++++++ 3 files changed, 9 insertions(+), 6 deletions(-) delete mode 100644 vis/section.mac create mode 100644 vis/section_yz.mac diff --git a/macros/gui.mac b/macros/gui.mac index 92de97c7c..a2ce51468 100644 --- a/macros/gui.mac +++ b/macros/gui.mac @@ -57,7 +57,8 @@ /gui/addButton view "Load vis settings" "/control/execute vis/vis.mac" /gui/addButton view "Load cutaway settings" "/control/execute vis/cutaway.mac" /gui/addButton view "Clear cutaway planes" "/vis/viewer/clearCutawayPlanes" -/gui/addButton view "Vertical section view" "/control/execute vis/section.mac" +/gui/addButton view "YZ section view" "/control/execute vis/section_yz.mac" +/gui/addButton view "XZ section view" "/control/execute vis/section_xz.mac" /gui/addButton view "Draw real world" "/vis/drawVolume world" /gui/addButton view "Draw all worlds" "/vis/drawVolume worlds" /gui/addButton view "Set style surface" "/vis/viewer/set/style surface" diff --git a/vis/section.mac b/vis/section.mac deleted file mode 100644 index 0bd01d32b..000000000 --- a/vis/section.mac +++ /dev/null @@ -1,5 +0,0 @@ -/vis/viewer/clearCutawayPlanes -/vis/viewer/set/cutawayMode intersection -/vis/viewer/addCutawayPlane 0.0 0.0 0.0 mm 1.0 0.0 0.0 -/vis/viewer/addCutawayPlane 1.0 0.0 0.0 mm -1.0 0.0 0.0 -/vis/viewer/set/style wireframe diff --git a/vis/section_yz.mac b/vis/section_yz.mac new file mode 100644 index 000000000..8b5c5df85 --- /dev/null +++ b/vis/section_yz.mac @@ -0,0 +1,7 @@ +/vis/viewer/clearCutawayPlanes +/vis/viewer/set/cutawayMode intersection +/vis/viewer/addCutawayPlane -1.0 0.0 0.0 mm +1.0 0.0 0.0 +/vis/viewer/addCutawayPlane +1.0 0.0 0.0 mm -1.0 0.0 0.0 +/vis/viewer/set/style wireframe +/vis/viewer/set/upVector 0.0 1.0 0.0 +/vis/viewer/set/viewpointThetaPhi 90 180 deg From 1395a0eb09a267ba3f4e292bfd74240c67d3bf29 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 28 Apr 2021 16:05:54 -0500 Subject: [PATCH 356/443] [vis] XZ section view macro --- vis/section_xz.mac | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 vis/section_xz.mac diff --git a/vis/section_xz.mac b/vis/section_xz.mac new file mode 100644 index 000000000..63f958654 --- /dev/null +++ b/vis/section_xz.mac @@ -0,0 +1,7 @@ +/vis/viewer/clearCutawayPlanes +/vis/viewer/set/cutawayMode intersection +/vis/viewer/addCutawayPlane 0.0 0.0 -1.0 mm 0.0 +1.0 0.0 +/vis/viewer/addCutawayPlane 0.0 0.0 +1.0 mm 0.0 -1.0 0.0 +/vis/viewer/set/style wireframe +/vis/viewer/set/upVector 1.0 0.0 0.0 +/vis/viewer/set/viewpointThetaPhi 90 90 deg From 09e33d5556ace58c83dcd14ee73c8025c29332a6 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 28 Apr 2021 17:03:45 -0500 Subject: [PATCH 357/443] [meshes] macro to compare with cad, creates svg images --- macros/compare_with_cad.mac | 50 +++++++++++++++++++++++++++++++++++++ macros/load_mesh.mac | 6 +++++ macros/load_meshes.mac | 27 ++++++++++++-------- 3 files changed, 72 insertions(+), 11 deletions(-) create mode 100644 macros/compare_with_cad.mac create mode 100644 macros/load_mesh.mac diff --git a/macros/compare_with_cad.mac b/macros/compare_with_cad.mac new file mode 100644 index 000000000..d2104766a --- /dev/null +++ b/macros/compare_with_cad.mac @@ -0,0 +1,50 @@ +/remoll/geometry/setfile geometry/mollerMother.gdml +/remoll/parallel/setfile geometry/mollerParallel.gdml + +/run/initialize + +/control/execute macros/load_meshes.mac + +/control/execute vis/SQt.mac + +/control/execute vis/section_xz.mac +/vis/viewer/zoomTo 40 +/vis/viewer/set/targetPoint 0 0 -10 m +/vis/ogl/export section_xz_-10.svg +/vis/viewer/set/targetPoint 0 0 -5 m +/vis/ogl/export section_xz_-05.svg +/vis/viewer/set/targetPoint 0 0 0 m +/vis/ogl/export section_xz_00.svg +/vis/viewer/set/targetPoint 0 0 5 m +/vis/ogl/export section_xz_05.svg +/vis/viewer/set/targetPoint 0 0 10 m +/vis/ogl/export section_xz_10.svg +/vis/viewer/set/targetPoint 0 0 15 m +/vis/ogl/export section_xz_15.svg +/vis/viewer/set/targetPoint 0 0 20 m +/vis/ogl/export section_xz_20.svg +/vis/viewer/set/targetPoint 0 0 25 m +/vis/ogl/export section_xz_25.svg +/vis/viewer/set/targetPoint 0 0 30 m +/vis/ogl/export section_xz_30.svg + +/control/execute vis/section_yz.mac +/vis/viewer/zoomTo 40 +/vis/viewer/set/targetPoint 0 0 -10 m +/vis/ogl/export section_yz_-10.svg +/vis/viewer/set/targetPoint 0 0 -5 m +/vis/ogl/export section_yz_-05.svg +/vis/viewer/set/targetPoint 0 0 0 m +/vis/ogl/export section_yz_00.svg +/vis/viewer/set/targetPoint 0 0 5 m +/vis/ogl/export section_yz_05.svg +/vis/viewer/set/targetPoint 0 0 10 m +/vis/ogl/export section_yz_10.svg +/vis/viewer/set/targetPoint 0 0 15 m +/vis/ogl/export section_yz_15.svg +/vis/viewer/set/targetPoint 0 0 20 m +/vis/ogl/export section_yz_20.svg +/vis/viewer/set/targetPoint 0 0 25 m +/vis/ogl/export section_yz_25.svg +/vis/viewer/set/targetPoint 0 0 30 m +/vis/ogl/export section_yz_30.svg diff --git a/macros/load_mesh.mac b/macros/load_mesh.mac new file mode 100644 index 000000000..60a30e900 --- /dev/null +++ b/macros/load_mesh.mac @@ -0,0 +1,6 @@ +/control/echo {mesh} +/control/alias url https://hallaweb.jlab.org/12GeV/Moller/downloads/remoll/cad +/control/alias dir geometry/meshes +/control/shell mkdir -p {dir} +/control/shell wget -N -c -P {dir} {url}/{mesh} +/remoll/geometry/addmesh {dir}/{mesh} diff --git a/macros/load_meshes.mac b/macros/load_meshes.mac index 69b2ce374..ec7e50f89 100644 --- a/macros/load_meshes.mac +++ b/macros/load_meshes.mac @@ -1,11 +1,16 @@ -/remoll/geometry/addmesh geometry/meshes/JL0091832_small.stl -/remoll/geometry/addmesh geometry/meshes/JL0094043_small.stl -/remoll/geometry/addmesh geometry/meshes/JL0094629_small.stl -/remoll/geometry/addmesh geometry/meshes/JL0094773_small.stl -/remoll/geometry/addmesh geometry/meshes/JL0094866_small.stl -/remoll/geometry/addmesh geometry/meshes/JL0095703_small.stl -/remoll/geometry/addmesh geometry/meshes/JL0096533_small.stl -/remoll/geometry/addmesh geometry/meshes/JL0096597_small.stl -/remoll/geometry/addmesh geometry/meshes/JL0096636_small.stl -/remoll/geometry/addmesh geometry/meshes/JL0096676_small.stl -#/remoll/geometry/addmesh geometry/meshes/JL0096772_small.stl +# This loads the small meshes +/control/foreach macros/load_mesh.mac mesh "JL0094043_small.stl JL0095703_small.stl JL0096597_small.stl JL0096636_small.stl JL0094866_small.stl JL0096772_small.stl JL0091832_small.stl JL0096533_small.stl JL0094773_small.stl JL0096752_small.stl JL0097012_small.stl JL0109771_small.stl" + +# Below are larger meshes (slow, needs memory) + +# JL0096676_small.stl: dump tunnel utilities +/control/foreach macros/load_mesh.mac mesh "JL0096676_small.stl" + +# JL0094629_small.stl: hybrid toroid +/control/foreach macros/load_mesh.mac mesh "JL0094629_small.stl" + +# Below are envelopes (slow, needs memory) + +# JL0100741_small.stl: envelopes +#/control/foreach macros/load_mesh.mac mesh "JL0100741_small.stl" + From c4740603dbcbaadde2f0b4af0cd29c62b7b5b163 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 28 Apr 2021 17:19:47 -0500 Subject: [PATCH 358/443] [detectorConstruction] delete mesh solids and logical volumes --- src/remollDetectorConstruction.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/remollDetectorConstruction.cc b/src/remollDetectorConstruction.cc index 07b552723..3702ca531 100644 --- a/src/remollDetectorConstruction.cc +++ b/src/remollDetectorConstruction.cc @@ -374,7 +374,13 @@ void remollDetectorConstruction::SetUserMinRange(G4String name, G4String value_u remollDetectorConstruction::~remollDetectorConstruction() { - for (auto pv: fMeshPVs) delete pv; + for (auto pv: fMeshPVs) { + auto lv = pv->GetLogicalVolume(); + auto solid = lv->GetSolid(); + delete solid; + delete lv; + delete pv; + } delete fGDMLParser; delete fMessenger; delete fGeometryMessenger; From 1992ff0efb775068d3131756653097201f51ef30 Mon Sep 17 00:00:00 2001 From: Sakib Rahman Date: Fri, 30 Apr 2021 17:04:12 -0400 Subject: [PATCH 359/443] Adding option to add zoffset to input distribution --- src/remollGenExternal.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/remollGenExternal.cc b/src/remollGenExternal.cc index 206215f59..e0322f02a 100644 --- a/src/remollGenExternal.cc +++ b/src/remollGenExternal.cc @@ -133,10 +133,11 @@ void remollGenExternal::SamplePhysics(remollVertex* /* vert */, remollEvent* evt G4String particlename = particle->GetParticleName(); // Throw new particle - evt->ProduceNewParticle( - G4ThreeVector(hit.x, hit.y, hit.z + fzOffset), - G4ThreeVector(hit.px, hit.py, hit.pz), - particlename); + G4ThreeVector r(hit.x,hit.y,hit.z); + G4ThreeVector p(hit.px,hit.py,hit.pz); + r += fZOffset*p.unit(); + evt->ProduceNewParticle(r,p,particlename); + number_of_particles++; } From 334667f990d8f8bb3ac1787485a24d5ec1f67e37 Mon Sep 17 00:00:00 2001 From: Sakib Rahman Date: Fri, 30 Apr 2021 17:13:44 -0400 Subject: [PATCH 360/443] Fix typo in variable name --- src/remollGenExternal.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/remollGenExternal.cc b/src/remollGenExternal.cc index e0322f02a..51bda8be4 100644 --- a/src/remollGenExternal.cc +++ b/src/remollGenExternal.cc @@ -135,7 +135,7 @@ void remollGenExternal::SamplePhysics(remollVertex* /* vert */, remollEvent* evt // Throw new particle G4ThreeVector r(hit.x,hit.y,hit.z); G4ThreeVector p(hit.px,hit.py,hit.pz); - r += fZOffset*p.unit(); + r += fzOffset*p.unit(); evt->ProduceNewParticle(r,p,particlename); number_of_particles++; From f3d332c2ef020f538f4cf2f1e03388e0bb68e71d Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 6 May 2021 12:50:25 -0500 Subject: [PATCH 361/443] [CMakeLists] find_package(cadmesh QUIET) to avoid complaints --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c1ca431a..7fb2771ec 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,7 +105,7 @@ endif() #---------------------------------------------------------------------------- # Find CADMesh libraries set(cadmesh_LIBRARIES "") -find_package(cadmesh) +find_package(cadmesh QUIET) if(cadmesh_FOUND) # Pretty sure at some point cadmesh will update to use lowercase include_directories(${CADMESH_INCLUDE_DIRS}) From 84b45e2f88aae654182529dc884783a9ff511087 Mon Sep 17 00:00:00 2001 From: Fatemeh Gorgannejad Date: Fri, 7 May 2021 09:26:26 -0500 Subject: [PATCH 362/443] Removing overlaps between pion detector system and donut sysytem. --- geometry/pion/GEM/pionDetectorGEM.gdml | 4 ++-- geometry/pion/GEM/pionDetectorGEMOpenSector.gdml | 4 ++-- geometry/pion/Lucite/pionDetectorLucite.gdml | 3 +++ geometry/pion/Lucite/pionDetectorLuciteSector.gdml | 2 +- geometry/pion/TS/pionDetectorTS.gdml | 2 +- geometry/pion/TS/pionDetectorTSOpenSector.gdml | 4 ++-- geometry/pion/pionDetectorSystem.gdml | 2 +- 7 files changed, 12 insertions(+), 9 deletions(-) diff --git a/geometry/pion/GEM/pionDetectorGEM.gdml b/geometry/pion/GEM/pionDetectorGEM.gdml index 01a07a7c3..8eb9ecf07 100644 --- a/geometry/pion/GEM/pionDetectorGEM.gdml +++ b/geometry/pion/GEM/pionDetectorGEM.gdml @@ -4,8 +4,8 @@ - - + + diff --git a/geometry/pion/GEM/pionDetectorGEMOpenSector.gdml b/geometry/pion/GEM/pionDetectorGEMOpenSector.gdml index 5363c904d..6b87bda03 100644 --- a/geometry/pion/GEM/pionDetectorGEMOpenSector.gdml +++ b/geometry/pion/GEM/pionDetectorGEMOpenSector.gdml @@ -7,11 +7,11 @@ - + - + diff --git a/geometry/pion/Lucite/pionDetectorLucite.gdml b/geometry/pion/Lucite/pionDetectorLucite.gdml index 27edd465e..04f16ef7a 100644 --- a/geometry/pion/Lucite/pionDetectorLucite.gdml +++ b/geometry/pion/Lucite/pionDetectorLucite.gdml @@ -510,6 +510,9 @@ + + + diff --git a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml index c1f363683..f3cd8722d 100644 --- a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml +++ b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml @@ -12,7 +12,7 @@ the radius along with the angle of the detector to increase the length in the longitudinal direction. --> - + - + From e131fa473aec3d0416754d7b7487ab5e88db836c Mon Sep 17 00:00:00 2001 From: Chandan Ghosh Date: Fri, 7 May 2021 13:28:25 -0400 Subject: [PATCH 363/443] New collimator 2 design to avoid edge scattering --- .../upstream/upstreamDaughter_merged.gdml | 237 ++++++++++++++---- 1 file changed, 182 insertions(+), 55 deletions(-) diff --git a/geometry/upstream/upstreamDaughter_merged.gdml b/geometry/upstream/upstreamDaughter_merged.gdml index ecaacb636..22584c3c5 100644 --- a/geometry/upstream/upstreamDaughter_merged.gdml +++ b/geometry/upstream/upstreamDaughter_merged.gdml @@ -34,8 +34,8 @@ + - @@ -61,7 +61,8 @@ - + + - - + + + + + + + rmin2="COLL2_R2_D" startphi="-SEPTANT/4" z="COLL2_THICK_Cu+DELTAT*2"/> @@ -350,88 +355,195 @@ - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - @@ -402,8 +393,8 @@ v4x="103*tan(SEPTANT*pi/(4*180))" v4y="103" v5x="33*tan(SEPTANT*pi/(4*180.))+52*tan(0.5*pi/180.)" v5y="33" v6x="-(33*tan(SEPTANT*pi/(4*180.))+52*tan(0.5*pi/180.))" v6y="33" - v7x="-(52*tan(0.5*pi/180.)+105*tan(SEPTANT*pi/(4*180.)))" v7y="105" - v8x="52*tan(0.5*pi/180.)+105*tan(SEPTANT*pi/(4*180.))" v8y="105" + v7x="-(105*tan(SEPTANT*pi/(4*180.))+52*tan(0.5*pi/180.))" v7y="105" + v8x="105*tan(SEPTANT*pi/(4*180.))+52*tan(0.5*pi/180.)" v8y="105" dz="26" lunit="mm"/> @@ -680,22 +671,22 @@ - --> + - --> + - --> + - --> + From 76ab93e9dcde488f3ae610cc0628aa45c0d156d8 Mon Sep 17 00:00:00 2001 From: Sakib Rahman Date: Fri, 7 May 2021 23:27:28 -0400 Subject: [PATCH 365/443] Changing the length of the upstream outer nose shield from 100 mm to 75.569 mm to avoid geometric overlap. --- geometry/upstream/upstreamDaughter_merged.gdml | 2 +- geometry/upstream/upstream_nose_shield_beampipe.gdml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/geometry/upstream/upstreamDaughter_merged.gdml b/geometry/upstream/upstreamDaughter_merged.gdml index ecaacb636..acb073041 100644 --- a/geometry/upstream/upstreamDaughter_merged.gdml +++ b/geometry/upstream/upstreamDaughter_merged.gdml @@ -82,7 +82,7 @@ - + diff --git a/geometry/upstream/upstream_nose_shield_beampipe.gdml b/geometry/upstream/upstream_nose_shield_beampipe.gdml index 143baed3e..f5533a61b 100755 --- a/geometry/upstream/upstream_nose_shield_beampipe.gdml +++ b/geometry/upstream/upstream_nose_shield_beampipe.gdml @@ -17,15 +17,15 @@ - - + + - - + + From df81cffd57025199b9461ece2032fca4351165f3 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sat, 8 May 2021 12:51:56 -0500 Subject: [PATCH 366/443] [CMakeLists] find boost QUIET also OPTIONAL_COMPONENTS --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7fb2771ec..ed8a852ab 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,7 +84,7 @@ list(APPEND sources ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Dict.cxx) #---------------------------------------------------------------------------- # Boost # -find_package(Boost QUIET COMPONENTS iostreams filesystem) +find_package(Boost QUIET OPTIONAL_COMPONENTS iostreams filesystem) if(Boost_FOUND) message(STATUS "Boost found --> building with boost enabled.") include_directories(${Boost_INCLUDE_DIRS}) From 9de9ccfe202f5bd8662328744a88f47dcb7bbca6 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 11 May 2021 14:20:15 -0500 Subject: [PATCH 367/443] New dockerfile base image --- Dockerfile | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/Dockerfile b/Dockerfile index b8b00618a..6882bf0e2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,21 +18,7 @@ # cd `readlink -f .` # -FROM jeffersonlab/jlabce:2.3-mt - -# Install libgcj and pdftk -RUN wget -q https://copr.fedorainfracloud.org/coprs/robert/gcj/repo/epel-7/robert-gcj-epel-7.repo -P /etc/yum.repos.d && \ - wget -q https://copr.fedorainfracloud.org/coprs/robert/pdftk/repo/epel-7/robert-pdftk-epel-7.repo -P /etc/yum.repos.d && \ - yum install -q -y pdftk ghostscript time boost-devel - -# Add Tini entry point -ENV TINI_VERSION v0.19.0 -ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini -RUN chmod +x /tini - -# Set JLab CE version -ENV JLAB_VERSION=2.3 -ENV JLAB_ROOT=/jlab +FROM jeffersonlab/remoll-builder:main # Set remoll location ENV REMOLL=/jlab/remoll @@ -48,14 +34,6 @@ RUN source /etc/profile && \ make install && \ make clean -# Environment through /etc/profile -RUN ln -sf $REMOLL/bin/remoll.csh /etc/profile.d/remoll.csh -RUN ln -sf $REMOLL/bin/remoll.sh /etc/profile.d/remoll.sh - -# Override JLab CE environment for container use -COPY docker/jlab.sh /jlab/${JLAB_VERSION}/ce/jlab.sh - # Entry point loads the environment -ENTRYPOINT ["/tini", "-s", "--", "bash", "-c", "source /etc/profile && \"$@\""] - +ENTRYPOINT ["/bin/bash", "-c", "source $REMOLL/bin/remoll.sh && \"$@\"", "--"] CMD ["remoll"] From 8ac33f0271ebf0c7a5342dfd30405877380e2ee9 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 11 May 2021 14:21:32 -0500 Subject: [PATCH 368/443] [docker] source /etc/profile first --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6882bf0e2..6e3c22abd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,5 +35,5 @@ RUN source /etc/profile && \ make clean # Entry point loads the environment -ENTRYPOINT ["/bin/bash", "-c", "source $REMOLL/bin/remoll.sh && \"$@\"", "--"] +ENTRYPOINT ["/bin/bash", "-c", "source /etc/profile && source $REMOLL/bin/remoll.sh && \"$@\"", "--"] CMD ["remoll"] From c4f2578a1673167cdd1c34fdcda031f03a733952 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 12 May 2021 16:26:36 -0500 Subject: [PATCH 369/443] [tests] /remoll/printtargetinfo -> /remoll/target/print --- macros/tests/unit/test_target.mac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/tests/unit/test_target.mac b/macros/tests/unit/test_target.mac index f8b1746fe..46949b1f3 100644 --- a/macros/tests/unit/test_target.mac +++ b/macros/tests/unit/test_target.mac @@ -1,5 +1,5 @@ /run/initialize /remoll/targname USAlTarg -/remoll/printtargetinfo +/remoll/target/print /run/beamOn 1 From a200d75e16d4b519bd388b7b38993cf38c13a9d2 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 13 May 2021 13:58:16 -0500 Subject: [PATCH 370/443] [targets] define LH2 target with tag LH2, not DSAl; and other way round --- geometry/target/targetLadder.gdml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/geometry/target/targetLadder.gdml b/geometry/target/targetLadder.gdml index 52b68dff2..65d637e68 100644 --- a/geometry/target/targetLadder.gdml +++ b/geometry/target/targetLadder.gdml @@ -53,13 +53,13 @@ - + - + From dff2706d7a797c43835dd1bd2b80ba0371efd668 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 13 May 2021 14:30:29 -0500 Subject: [PATCH 371/443] [BeamTarget] unused fActiveTargetRelativePosition removed --- src/remollBeamTarget.cc | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/remollBeamTarget.cc b/src/remollBeamTarget.cc index 6f0e016c5..576aa67a0 100644 --- a/src/remollBeamTarget.cc +++ b/src/remollBeamTarget.cc @@ -38,7 +38,6 @@ std::vector>> remollBeamTarge G4double remollBeamTarget::fActiveTargetEffectiveLength = -1e9; G4double remollBeamTarget::fMotherTargetAbsolutePosition = -1e9; -G4double remollBeamTarget::fActiveTargetRelativePosition = -1e9; G4double remollBeamTarget::fTotalTargetEffectiveLength = 0.0; remollBeamTarget::remollBeamTarget() @@ -129,7 +128,6 @@ void remollBeamTarget::PrintTargetInfo() G4cout << "Final target parameters: " << G4endl; G4cout << " total target effective length: " << fTotalTargetEffectiveLength/(gram/cm2) << " gram/cm2" << G4endl; G4cout << " active target effective length: " << fActiveTargetEffectiveLength/(gram/cm2) << " gram/cm2" << G4endl; - G4cout << " active target relative position: " << fActiveTargetRelativePosition/mm << " mm" << G4endl; } void remollBeamTarget::UpdateInfo() @@ -138,7 +136,6 @@ void remollBeamTarget::UpdateInfo() fActiveTargetEffectiveLength = -1e9; fMotherTargetAbsolutePosition = -1e9; - fActiveTargetRelativePosition = -1e9; fTotalTargetEffectiveLength = 0.0; // Can't calculate anything without mother, let's hope we find one later on @@ -184,8 +181,6 @@ void remollBeamTarget::UpdateInfo() fActiveTargetEffectiveLength = z_half_length*2.0 * material->GetDensity(); - fActiveTargetRelativePosition = physvol->GetTranslation().z(); - fTotalTargetEffectiveLength += z_half_length*2.0 * material->GetDensity(); } @@ -348,7 +343,7 @@ remollVertex remollBeamTarget::SampleVertex(SamplingType_t sampling_type) break; case kAllTargetVolumes: - if( effective_position - cumulative_effective_length < effective_length ){ + if (effective_position - cumulative_effective_length < effective_length) { // This is the volume where our sample landed found_active_volume = true; effective_position_in_volume = (effective_position - cumulative_effective_length); From 40b44202428c504fa84baf3d6492e9d86925d06d Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 13 May 2021 14:30:48 -0500 Subject: [PATCH 372/443] [BeamTarget] unused fActiveTargetRelativePosition removed --- include/remollBeamTarget.hh | 1 - 1 file changed, 1 deletion(-) diff --git a/include/remollBeamTarget.hh b/include/remollBeamTarget.hh index 5d23db51c..a3addfa2f 100644 --- a/include/remollBeamTarget.hh +++ b/include/remollBeamTarget.hh @@ -46,7 +46,6 @@ class remollBeamTarget { static G4double fActiveTargetEffectiveLength; // Positions are in physical distances (i.e. in cm) static G4double fMotherTargetAbsolutePosition; - static G4double fActiveTargetRelativePosition; public: static void UpdateInfo(); From 58a6c11c41a85b9c587fe17e25bcbab4e2d93cb5 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 13 May 2021 14:31:41 -0500 Subject: [PATCH 373/443] [BeamTarget] clean logic in effective active/total target lengths --- src/remollBeamTarget.cc | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/remollBeamTarget.cc b/src/remollBeamTarget.cc index 576aa67a0..89bf3aa39 100644 --- a/src/remollBeamTarget.cc +++ b/src/remollBeamTarget.cc @@ -163,26 +163,18 @@ void remollBeamTarget::UpdateInfo() if (!tubs && !box) { G4cerr << "ERROR: " << __PRETTY_FUNCTION__ << " line " << __LINE__ << ": Target volume " << volume->GetName() << " not made of G4Tubs or G4Box" << G4endl; - continue; // exit(1); + exit(1); } - if (it == fTargetVolumes[fActiveTargetMother].begin() + fActiveTargetVolume) { - - if( fActiveTargetEffectiveLength >= 0.0 ){ - G4cerr << "ERROR: " << __PRETTY_FUNCTION__ << " line " << __LINE__ << - ": Multiply defined target volumes" << G4endl; - exit(1); - } + G4double z_half_length = 0; + if (tubs) z_half_length = tubs->GetZHalfLength(); + if (box) z_half_length = box->GetZHalfLength(); - G4double z_half_length = 0; - if (tubs) z_half_length = tubs->GetZHalfLength(); - if (box) z_half_length = box->GetZHalfLength(); + fTotalTargetEffectiveLength += 2.0 * z_half_length * material->GetDensity(); - fActiveTargetEffectiveLength = z_half_length*2.0 - * material->GetDensity(); + if (it == fTargetVolumes[fActiveTargetMother].begin() + fActiveTargetVolume) { - fTotalTargetEffectiveLength += z_half_length*2.0 - * material->GetDensity(); + fActiveTargetEffectiveLength = 2.0 * z_half_length * material->GetDensity(); } } } From 1823d2cc51360e163b09751c804e47d997c19f0d Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 13 May 2021 22:24:41 -0500 Subject: [PATCH 374/443] [target] Move LH2 between USAl and DSAl (ordering important) --- geometry/target/targetLadder.gdml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/geometry/target/targetLadder.gdml b/geometry/target/targetLadder.gdml index 65d637e68..10ce6c4bc 100644 --- a/geometry/target/targetLadder.gdml +++ b/geometry/target/targetLadder.gdml @@ -65,13 +65,18 @@ - - - + + + + From 5c921477bfb8cc539b453a29670042d5cb641cc4 Mon Sep 17 00:00:00 2001 From: chandabindu Date: Thu, 20 May 2021 16:53:46 -0400 Subject: [PATCH 375/443] Modified Collimator 2 geometry to have better simulation efficiencies --- .../upstream/upstreamDaughter_merged.gdml | 687 ++++++++++++------ 1 file changed, 474 insertions(+), 213 deletions(-) diff --git a/geometry/upstream/upstreamDaughter_merged.gdml b/geometry/upstream/upstreamDaughter_merged.gdml index 8ea2feaa5..00c7066c4 100644 --- a/geometry/upstream/upstreamDaughter_merged.gdml +++ b/geometry/upstream/upstreamDaughter_merged.gdml @@ -56,6 +56,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -307,13 +352,6 @@ - - - @@ -326,13 +364,6 @@ - - - @@ -343,198 +374,141 @@ - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - + + + + - - - - - + + + + + + + + + + + + + + + + - - - - - + + + + - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + - + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + - - + + From b003a9e9ac3d9480d7e2d22487a56c52f6914f05 Mon Sep 17 00:00:00 2001 From: chandabindu Date: Thu, 20 May 2021 17:33:35 -0400 Subject: [PATCH 376/443] added new Collimator 4 and hybrid wall dimension and locations. Implemented a temporary beampipe under the Pb wall. --- geometry/hybrid/hybridDaughter_merged.gdml | 795 ++++++++++++++++----- 1 file changed, 625 insertions(+), 170 deletions(-) diff --git a/geometry/hybrid/hybridDaughter_merged.gdml b/geometry/hybrid/hybridDaughter_merged.gdml index 2bedd0dab..37a770ce1 100644 --- a/geometry/hybrid/hybridDaughter_merged.gdml +++ b/geometry/hybrid/hybridDaughter_merged.gdml @@ -25,19 +25,15 @@ - - - - - - - - - - + + + + + + - + - - - + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -119,19 +118,6 @@ - - - - - - - - - - - - - @@ -139,94 +125,167 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - + + + - - - - + + + + + + + + + + + + + + + - - - - + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - + + + + @@ -240,14 +299,19 @@ - - + - - - - - + + + + + + + + + + + @@ -400,13 +464,375 @@ - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -417,13 +843,33 @@ - + + + + + + + + + + + + + + + + + + - + - - + + + + + @@ -610,11 +1056,20 @@ - - - + + + + + + + + + + + + @@ -623,8 +1078,8 @@ - - + + From 693e3bbad275472a18829159d13bb7a3667059a2 Mon Sep 17 00:00:00 2001 From: chandabindu Date: Thu, 20 May 2021 17:35:26 -0400 Subject: [PATCH 377/443] There were overlap issues with the concrete and Pbwall. Since Cip and Co. are working on the shielding design, I am commenting out the concrete shielding --- geometry/hybrid/hybridDaughter_merged.gdml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/geometry/hybrid/hybridDaughter_merged.gdml b/geometry/hybrid/hybridDaughter_merged.gdml index 37a770ce1..56a7e21e2 100644 --- a/geometry/hybrid/hybridDaughter_merged.gdml +++ b/geometry/hybrid/hybridDaughter_merged.gdml @@ -1071,10 +1071,10 @@ - + From af357701b04f412d6c10414a458d5e2d488d8643 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 21 May 2021 14:38:24 -0500 Subject: [PATCH 378/443] [runexample] /remoll/target/print is new syntax --- macros/runexample.mac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/runexample.mac b/macros/runexample.mac index 36bfe7650..87a740522 100644 --- a/macros/runexample.mac +++ b/macros/runexample.mac @@ -81,5 +81,5 @@ /remoll/filename remollout.root #/tracking/verbose 2 -/remoll/printtargetinfo +/remoll/target/print /run/beamOn 100 From 61a2a320f0792624b82b0dd4c79354135c915c5e Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 25 May 2021 12:48:20 -0500 Subject: [PATCH 379/443] [workflows] disable docker buildx cache --- .github/workflows/docker-image.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index ef896f1bf..f2a7206d5 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -26,13 +26,13 @@ jobs: uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - - name: Cache Docker layers - uses: actions/cache@v2 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- +# - name: Cache Docker layers +# uses: actions/cache@v2 +# with: +# path: /tmp/.buildx-cache +# key: ${{ runner.os }}-buildx-${{ github.sha }} +# restore-keys: | +# ${{ runner.os }}-buildx- - name: Login to DockerHub id: docker_login if: github.event_name != 'pull_request' @@ -50,7 +50,7 @@ jobs: push: ${{ steps.docker_login.outcome == 'success' && github.event_name != 'pull_request' }} tags: ${{ steps.docker_meta.outputs.tags }} labels: ${{ steps.docker_meta.outputs.labels }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache +# cache-from: type=local,src=/tmp/.buildx-cache +# cache-to: type=local,dest=/tmp/.buildx-cache - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} From 516f7bda7f0f0dd7fffa4eaa1f617d5980577ad6 Mon Sep 17 00:00:00 2001 From: Yug34 <53560276+Yug34@users.noreply.github.com> Date: Wed, 26 May 2021 00:26:20 +0530 Subject: [PATCH 380/443] Changed delete to delete[] for catpath --- src/remollTextFile.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/remollTextFile.cc b/src/remollTextFile.cc index 4aa4a9c2e..791131e6b 100644 --- a/src/remollTextFile.cc +++ b/src/remollTextFile.cc @@ -115,14 +115,14 @@ void remollTextFile::RecreateInDir(const char *adir, bool clobber ){ if( ret == -1 && errno != EEXIST ){ fprintf(stderr, "%s - %s\n", thisdir, strerror(errno) ); delete thisdir; - delete catpath; + delete[] catpath; return; } Recreate(catpath, clobber); delete thisdir; - delete catpath; + delete[] catpath; } void remollTextFile::Recreate(const char *fn, bool clobber ){ From a0c6e2a773ca8dc7e02e95ee3cad8836dda27899 Mon Sep 17 00:00:00 2001 From: hanjie1 Date: Tue, 25 May 2021 19:14:00 -0400 Subject: [PATCH 381/443] new carbon generator --- include/remollGen12CElastic.hh | 30 --- include/remollGenC12.hh | 37 ++++ src/remollGen12CElastic.cc | 367 --------------------------------- src/remollGenC12.cc | 260 +++++++++++++++++++++++ 4 files changed, 297 insertions(+), 397 deletions(-) delete mode 100644 include/remollGen12CElastic.hh create mode 100644 include/remollGenC12.hh delete mode 100644 src/remollGen12CElastic.cc create mode 100644 src/remollGenC12.cc diff --git a/include/remollGen12CElastic.hh b/include/remollGen12CElastic.hh deleted file mode 100644 index d37d94d78..000000000 --- a/include/remollGen12CElastic.hh +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __REMOLLGEN12CELASTIC_HH -#define __REMOLLGEN12CELASTIC_HH -/*! - * e12C elastic event generator - * - * Rupesh Silwal - * Aug 9, 2013 - * - * Based heavily on remollGenpElastic.hh -*/ - -#include "remollVEventGen.hh" - -class remollBeamTarget; - -class remollGen12CElastic : public remollVEventGen { - public: - remollGen12CElastic(); - ~remollGen12CElastic(); - - private: - void SamplePhysics(remollVertex *, remollEvent *); - - G4double RadProfile(G4double,G4double); - G4double EnergNumInt(G4double,G4double,G4double); - - remollBeamTarget *fBeamTarg; -}; - -#endif// __REMOLLGEN12CELASTIC_HH diff --git a/include/remollGenC12.hh b/include/remollGenC12.hh new file mode 100644 index 000000000..b721c5fa0 --- /dev/null +++ b/include/remollGenC12.hh @@ -0,0 +1,37 @@ +#ifndef __REMOLLGENC12_HH +#define __REMOLLGENC12_HH + +#include "remollVEventGen.hh" + +#include + +class remollGenC12 : public remollVEventGen { +public: + remollGenC12(G4int physicsType); + virtual ~remollGenC12(); + +private: + G4int type; + + static std::map fNamesMap; + static std::map CreateNamesMap(); + + void SamplePhysics(remollVertex *, remollEvent *); + + ///Christy Bosted fit + void GenInelastic(G4double beamE,G4double theta, + G4double &Q2,G4double &W2,G4double &effectiveXsection, + G4double &fWeight,G4double &eOut,G4double &asym); + + ///Christy Bosted fit + void GenQuasiElastic(G4double beamE,G4double theta, + G4double &Q2,G4double &W2,G4double &effectiveXsection, + G4double &fWeight,G4double &eOut,G4double &asym); + + void GenElastic(G4double beamE, G4double theta, + G4double &Q2,G4double &W2,G4double &effectiveXsection, + G4double &fWeight,G4double &eOut,G4double &asym); + +}; + +#endif//__REMOLLGENC12_HH diff --git a/src/remollGen12CElastic.cc b/src/remollGen12CElastic.cc deleted file mode 100644 index fdea03f8b..000000000 --- a/src/remollGen12CElastic.cc +++ /dev/null @@ -1,367 +0,0 @@ -#include "remollGen12CElastic.hh" - -#include "CLHEP/Random/RandFlat.h" - -#include "remollEvent.hh" -#include "remollVertex.hh" -#include "remollBeamTarget.hh" -#include "remollMultScatt.hh" - -#include "G4Material.hh" -#include "G4VPhysicalVolume.hh" -#include "G4LogicalVolume.hh" -#include "Randomize.hh" - -#include "G4SystemOfUnits.hh" -#include "G4PhysicalConstants.hh" - -#include "remolltypes.hh" - -#include - -#define Euler 0.5772157 -#define NINTERVAL 3 -//#define mAl (27*931.5*MeV) -#define C12_A 12 - -remollGen12CElastic::remollGen12CElastic() -: remollVEventGen("carbon") -{ - fTh_min = 0.1*deg; - fTh_max = 2.0*deg; - - fE_min = 80.0*MeV; // Absolute minimum of electron energy - // to generate - fApplyMultScatt = false; -} - -remollGen12CElastic::~remollGen12CElastic(){ -} - -// Generate eAl elastic event -void remollGen12CElastic::SamplePhysics(remollVertex *vert, remollEvent *evt) -{ - // Crazy weighting for brem because ep cross section blows up at low Q2 - - // Get initial beam energy instead of using other sampling - double beamE = fBeamTarg->fBeamEnergy; - // double Ekin = beamE - electron_mass_c2; - - // std::vector targVols = fBeamTarg->GetTargVols(); - - // bool bypass_target = false; - - // std::vector::iterator it = targVols.begin(); - // if( targVols.size() > 0 ){ - // while( (*it)->GetLogicalVolume()->GetMaterial()->GetName() != "C12" - // && it != targVols.end() ){ it++; } - - // if( (*it)->GetLogicalVolume()->GetMaterial()->GetName() != "C12" ){ - // G4cerr << __FILE__ << " line " << __LINE__ << ": WARNING could not find target" << G4endl; - // bypass_target = true; - // } - // } else { - // bypass_target = true; - // } - - // double bremcut = fBeamTarg->fEcut; - - // // Approximation for Q2, just needs to be order of magnitude - // double effQ2 = 2.0*beamE*beamE*(1.0-cos(0.5*deg)); - - // // About ~1.5% - // double int_bt = 0.75*(alpha/pi)*( log( effQ2/(electron_mass_c2*electron_mass_c2) ) - 1.0 ); - - // double bt; - // if( !bypass_target ){ - // bt = (4.0/3.0)*(fBeamTarg->fTravLen/(*it)->GetLogicalVolume()->GetMaterial()->GetRadlen() - // + int_bt); - // } else { - // bt = 0.0; - // } - - // double prob, prob_sample, sample, eloss, value; - // value = 1.0; - // prob = 1.- pow(bremcut/Ekin,bt) - bt/(bt+1.)*(1.- pow(bremcut/Ekin,bt+1.)) - // + 0.75*bt/(2.+bt)*(1.- pow(bremcut/Ekin,bt+2.)); - // prob = prob/(1.- bt*Euler + bt*bt/2.*(Euler*Euler+pi*pi/6.)); /* Gamma function */ - // prob_sample = G4UniformRand(); /* Random sampling */ - - // double Evlo[NINTERVAL] = { - // bremcut, - // (beamE-bremcut)*2.0*GeV/(11.0*GeV-bremcut), - // (beamE-bremcut)*9.0*GeV/(11.0*GeV-bremcut), - // }; - - // double Evhi[NINTERVAL] = { - // (beamE-bremcut)*2.0*GeV/(11.0*GeV-bremcut), - // (beamE-bremcut)*9.0*GeV/(11.0*GeV-bremcut), - // (beamE-bremcut)*(beamE-fE_min)/(11.0*GeV-bremcut), - // }; - - // double Eprob[NINTERVAL] = { 0.40, 0.20, 0.40 }; - - // double Enorm[NINTERVAL]; - // // Interval normalization - // for( int idx = 0; idx < NINTERVAL; idx++ ){ - // Enorm[idx] = ((Evhi[idx]-Evlo[idx])/(Evhi[NINTERVAL-1]-Evlo[0])) - // /Eprob[idx]; - // } - - // int Evidx; - // double evsum = 0.0; - // double vweight = 0.0; - // eloss = 0.0; - - // // Averages over the intervals - // double vavg[NINTERVAL] = { - // log(Evhi[0]/Evlo[0])/(Evhi[0]-Evlo[0]), - // log((beamE-Evlo[1])/(beamE-Evhi[1]))/(Evhi[1]-Evlo[1]), - // (1.0/(beamE-Evhi[2])-1.0/(beamE-Evlo[2]))/(Evhi[2]-Evlo[2]) - // }; - - // if (prob_sample <= prob) {//Bremsstrahlung has taken place! - // // We break this into 4 seperate energy loss intervals - // // with total integrals roughly the size of - // // what the ep product looks like with 11 GeV beam - // // cut - 2000 MeV, 1/x, 40% - // // 2000 - 9000 MeV, 1/(E-x), 20% - // // 9000 - 10990 MeV, 1/(E-x)^2, 40% - - // sample = G4UniformRand(); - - // // Identify our region - // // based on the probability distribution - // Evidx = 0; - // evsum = Eprob[Evidx]; - // while( evsum < sample ){ - // Evidx++; - // evsum += Eprob[Evidx]; - // } - - // sample = G4UniformRand(); - - // if( Evidx == 0 ){ - // eloss = Evlo[Evidx]*pow(Evhi[Evidx]/Evlo[Evidx],sample); - // vweight = eloss; - // } - - // if( Evidx == 1 ){ - // eloss = beamE - (beamE-Evhi[Evidx])* - // pow((beamE-Evlo[Evidx])/(beamE-Evhi[Evidx]),sample); - // vweight = (beamE-eloss); - // } - - // if( Evidx == 2 ){ - // eloss = beamE - pow( (1.0/(beamE-Evhi[Evidx]) - 1.0/(beamE-Evlo[Evidx]))*sample - // + 1.0/(beamE-Evlo[Evidx]), -1.0 ); - // vweight = (beamE-eloss)*(beamE-eloss); - // } - - // if( !(eloss > 0.0 ) ){ - // printf("idx = %d\n", Evidx ); - // } - - // assert( eloss > 0.0 ); - - // assert( !std::isnan(eloss) && !std::isinf(eloss) ); - - // vweight *= vavg[Evidx]; - // // mult by beamE-bremcut for proper normalization - // value = RadProfile( eloss, bt)* - // ((Evhi[NINTERVAL-1]-Evlo[0])/EnergNumInt(bt, Evlo[0], Evhi[NINTERVAL-1])) // average of RadProfile - // *vweight // sampling weighting (flat or ) / average value for normalization - // *Enorm[Evidx]; // Weight given the region - - // beamE -= eloss; - // } - - if( beamE < electron_mass_c2 ){ - evt->SetEffCrossSection(0.0); - evt->SetAsymmetry(0.0); - return; - } - - // Set event information to our new sampling - evt->fBeamE = beamE; - evt->fBeamMomentum = evt->fBeamMomentum.unit()*sqrt(beamE*beamE - electron_mass_c2*electron_mass_c2); - - //////////////////////////////////////////////////////////////////////////////////////////// - - - // sample with 1.0/(1-cos)^2 - - double cthmin = cos(fTh_min); - double cthmax = cos(fTh_max); - - double icth_b = 1.0/(1.0-cthmax); - double icth_a = 1.0/(1.0-cthmin); - - double sampv = 1.0/CLHEP::RandFlat::shoot(icth_b, icth_a); - - assert( -1.0 < sampv && sampv < 1.0 ); - - double th = acos(1.0-sampv); - - // Value to reweight cross section by to account for non-uniform - // sampling - double samp_fact = sampv*sampv*(icth_a-icth_b)/(cthmin-cthmax); - - double ph = CLHEP::RandFlat::shoot(0.0, 2.0*pi); - - double ef = C12_A*proton_mass_c2*beamE/(C12_A*proton_mass_c2 + beamE*(1.0-cos(th))); - - double q2 = 2.0*beamE*ef*(1.0-cos(th)); - // double tau = q2/(4.0*C12_A*proton_mass_c2*C12_A*proton_mass_c2); - - // double gd = pow( 1.0 + q2/(0.71*GeV*GeV), -2.0 ); - // double gep = gd; - // double gmp = 2.79*gd; - - // double gen = 1.91*gd*tau/(1.0+5.6*tau); // galster - // double gmn = -1.91*gd; - - double sigma_mott = hbarc*hbarc*pow(alpha*cos(th/2.0), 2.0)/pow(2.0*beamE*sin(th/2.0)*sin(th/2.0), 2.0); - // double ffpart1 = (gep*gep + tau*gmp*gmp)/(1.0+tau); - // double ffpart2 = 2.0*tau*gmp*gmp*tan(th/2.0)*tan(th/2.0); - - // double sigma = sigma_mott*(ef/beamE)*(ffpart1 + ffpart2); - double sigma = sigma_mott*(ef/beamE); - - double V = (fPh_max - fPh_min) * (cthmin - cthmax) * samp_fact; - - // Suppress too low angles from being generated - // If we're in the multiple-scattering regime - // the cross sections are senseless. We'll define this - // as anything less than three sigma of the characteristic - // width - - if( th < 3.0*fBeamTarg->fMS->GetPDGTh() ){ - sigma = 0.0; - } - - // Multiply by Z because we have Z protons - // value for uneven weighting - - double thisZ; - - thisZ = vert->GetMaterial()->GetZ(); - - // evt->SetEffCrossSection(sigma*V*thisZ*value); - evt->SetEffCrossSection(sigma*V*thisZ); - - if( vert->GetMaterial()->GetNumberOfElements() != 1 ){ - G4cerr << __FILE__ << " line " << __LINE__ << - ": Error! Some lazy programmer didn't account for complex materials in the moller process!" << G4endl; - exit(1); - } - - // G4double APV_base = -GF*q2/(4.0*sqrt(2.0)*pi*alpha); - - // G4double eps = pow(1.0 + 2.0*(1.0+tau)*tan(th/2.0)*tan(th/2.0), -1.0); - - // G4double apvffnum = eps*gep*gen + tau*gmp*gmn; - // G4double apvffden = eps*gep*gep + tau*gmp*gmp; - - // G4double APV = APV_base*(QWp - apvffnum/apvffden); - - // evt->SetAsymmetry(APV); - evt->SetAsymmetry(0); - - evt->SetQ2( q2 ); - evt->SetW2( C12_A*proton_mass_c2*C12_A*proton_mass_c2 ); - - // // REradiate//////////////////////////////////////////////////////////////////////////// - // // We're going to use the new kinematics for this guy - - // int_bt = (alpha/pi)*( log( q2/(electron_mass_c2*electron_mass_c2) ) - 1.0 ); - // Ekin = ef - electron_mass_c2;; - // double env, ref; - - // prob = 1.- pow(bremcut/Ekin, int_bt) - int_bt/(int_bt+1.)*(1.- pow(bremcut/Ekin,int_bt+1.)) - // + 0.75*int_bt/(2.+int_bt)*(1.- pow(bremcut/Ekin,int_bt+2.)); - // prob = prob/(1.- int_bt*Euler + int_bt*int_bt/2.*(Euler*Euler+pi*pi/6.)); /* Gamma function */ - // prob_sample = G4UniformRand(); /* Random sampling */ - - // if (prob_sample <= prob) {//Bremsstrahlung has taken place! - // do { - // sample = G4UniformRand(); - // eloss = fBeamTarg->fEcut*pow(Ekin/fBeamTarg->fEcut,sample); - // env = 1./eloss; - // value = 1./eloss*(1.-eloss/Ekin+0.75*pow(eloss/Ekin,2))*pow(eloss/Ekin,bt); - - // sample = G4UniformRand(); - // ref = value/env; - // } while (sample > ref); - - // ef = Ekin-eloss+electron_mass_c2; - // assert( ef > electron_mass_c2 ); - // } - - /////////////////////////////////////////////////////////////////////////////////////// - - evt->ProduceNewParticle( G4ThreeVector(0.0, 0.0, 0.0), - G4ThreeVector(ef*cos(ph)*sin(th), ef*sin(ph)*sin(th), ef*cos(th) ), - "e-" ); - - return; - -} - -G4double remollGen12CElastic::RadProfile(G4double eloss, G4double btt){ - double Ekin = fBeamTarg->fBeamEnergy - electron_mass_c2; - double retval = 1./eloss*(1.-eloss/Ekin+0.75*pow(eloss/Ekin,2))*pow(eloss/Ekin,btt); - - if( std::isnan(retval) || std::isinf(retval) ){ - G4cerr << __FILE__ << " line " << __LINE__ << ": ERROR" << G4endl; - G4cerr << "Ekin " << Ekin/GeV << " GeV btt = " << btt << " retval = " << retval << G4endl; - fprintf(stderr, "eloss = %e GeV\n", eloss/GeV); - } - - assert( !std::isnan(retval) && !std::isinf(retval) ); - - return retval; -} - -G4double remollGen12CElastic::EnergNumInt(G4double btt, G4double a0, G4double b0){ - const int nbin = 1000; - double sum = 0.0; - double bremcut = fBeamTarg->fEnergyCut; - - int j; - double boolc[5] = {7.0, 32.0, 12.0, 32.0, 7.0}; - - double a, b, thissum; - - for(int i =0;i +#include + +#include "remollEvent.hh" +#include "remollVertex.hh" +#include "remolltypes.hh" + +#include "G4Material.hh" +#include "G4SystemOfUnits.hh" +#include "G4PhysicalConstants.hh" + +extern G4int F1F2IN09(G4int Z, G4int IA, G4double qsq, + G4double wsq, G4double &F1, G4double &F2); + +extern G4int F1F2QE09(G4int Z, G4int IA, G4double qsq, + G4double wsq, G4double &F1, G4double &F2); + +std::map remollGenC12::fNamesMap = remollGenC12::CreateNamesMap(); + +std::map remollGenC12::CreateNamesMap() { + std::map names; + names[0] = "elasticC12"; + names[1] = "quasielasticC12"; + names[2] = "inelasticC12"; + return names; +} + +remollGenC12::remollGenC12(G4int physicsType) +: remollVEventGen(fNamesMap[physicsType]) { + type = physicsType; + + fTh_min = 0.1*deg; + fTh_max = 5.0*deg; + fApplyMultScatt = true; +} + +remollGenC12::~remollGenC12() { +} + +void remollGenC12::SamplePhysics(remollVertex *vert, remollEvent *evt) { + + G4double beamE = vert->GetBeamEnergy(); // in MeV (it can be modified by beam loss) + G4double th = acos(G4RandFlat::shoot(cos(fTh_max), cos(fTh_min))); // radians + + ///////////////////////////////////////// + // sample with 1.0/(1-cos)^2 + //////////////////////////////////////// +/* + double cthmin = cos(fTh_min); + double cthmax = cos(fTh_max); + + double icth_b = 1.0/(1.0-cthmax); + double icth_a = 1.0/(1.0-cthmin); + + double sampv = 1.0/G4RandFlat::shoot(icth_b, icth_a); + + assert( -1.0 < sampv && sampv < 1.0 ); + + double th = acos(1.0-sampv); + // Value to reweight cross section by to account for non-uniform + // sampling + double samp_fact = sampv*sampv*(icth_a-icth_b)/(cthmin-cthmax); + + G4double phaseSpaceFactor = 2.0*pi*(cos(fTh_min) - cos(fTh_max))*samp_fact; +*/ + + G4double phaseSpaceFactor = (fPh_max - fPh_min) * (cos(fTh_min) - cos(fTh_max)); + G4double ph = G4RandFlat::shoot(fPh_min, fPh_max); + G4double eOut=0; + G4double fWeight=0; + G4double Q2=0; + G4double effectiveXsection=0; + G4double W2=0; + G4double asym=0; + + switch (type) { + case 0: + GenElastic(beamE,th,Q2,W2,effectiveXsection,fWeight,eOut,asym); + break; + case 1: + GenQuasiElastic(beamE,th,Q2,W2,effectiveXsection,fWeight,eOut,asym); + phaseSpaceFactor=phaseSpaceFactor*(beamE/GeV - electron_mass_c2/GeV); + break; + case 2: + GenInelastic(beamE,th,Q2,W2,effectiveXsection,fWeight,eOut,asym); + phaseSpaceFactor=phaseSpaceFactor*(beamE/GeV - electron_mass_c2/GeV); + break; + default: + G4cerr<<"Unknown C12 event type"<GetMaterial()->GetNumberOfElements() != 1 ) { + G4cerr << __FILE__ << " line " << __LINE__ << + " : Error! Some lazy programmer didn't account for complex materials in the moller process!" << G4endl; + exit(1); + } + + evt->SetThCoM(th); + evt->SetEffCrossSection(phaseSpaceFactor*effectiveXsection*microbarn); + evt->SetQ2( Q2 ); //MeV^2 + evt->SetAsymmetry(asym); + evt->SetW2( W2 ); + evt->ProduceNewParticle( G4ThreeVector(0.0, 0.0, 0.0), + G4ThreeVector(eOut*sin(th)*cos(ph), eOut*sin(th)*sin(ph), eOut*cos(th) ), + "e-" ); + + return; +} + +void remollGenC12::GenInelastic(G4double beamE,G4double theta, + G4double &Q2,G4double &W2,G4double &effectiveXsection, + G4double &fWeight,G4double &eOut, G4double &asym) { + + G4double F1 = 0.0; + G4double F2 = 0.0; + G4double W1 = 0.0; + G4double xsect = 0.0; + + G4double CTH,STH,T2THE,Nu; + + do{ + eOut = electron_mass_c2 + G4UniformRand()*(beamE - electron_mass_c2);// Generate flat energy distribution of outgoing electron + CTH = cos(theta/2.0); + STH = sin(theta/2.0); + T2THE = STH*STH/CTH/CTH; + Nu = beamE - eOut; + Q2 = 4.0*beamE*eOut*STH*STH; + W2 = pow(proton_mass_c2,2) + 2.0*proton_mass_c2*Nu - Q2; + }while(W2/GeV/GeV<0 || W2/GeV/GeV>10 || Q2/GeV/GeV<0.0 || Q2/GeV/GeV>10); //this is because F1F2IN09 won't work for W>3 and Q2>10 + + // Mott scattering + G4double MOTT = pow((hbarc/GeV/m*fine_structure_const/(2.*beamE/GeV)*CTH/STH/STH),2)/microbarn; // units: ubarn + + G4int A=12; + G4int Z=6; + G4int bad=F1F2IN09(Z, A, Q2/GeV/GeV, W2/GeV/GeV, F1, F2); + if(bad){ + G4cerr << "ERROR: " << __FILE__ << " line " << __LINE__ << G4endl; + G4cerr << " result was (-1 = Q2,W2 out of range in resmodd | -2 = A<3 | 1 inf/nan F1/F2) : " << bad < Date: Tue, 25 May 2021 19:29:09 -0400 Subject: [PATCH 382/443] add new c12 generator to macros --- macros/runexample_Optics1.mac | 4 +++- src/remollPrimaryGeneratorAction.cc | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/macros/runexample_Optics1.mac b/macros/runexample_Optics1.mac index edb700046..e6e754255 100644 --- a/macros/runexample_Optics1.mac +++ b/macros/runexample_Optics1.mac @@ -17,7 +17,9 @@ /remoll/rasx 0 mm /remoll/rasy 0 mm -/remoll/evgen/set carbon +/remoll/evgen/set elasticC12 +#/remoll/evgen/set quasielasticC12 +#/remoll/evgen/set inelasticC12 /remoll/beamcurr 85 microampere diff --git a/src/remollPrimaryGeneratorAction.cc b/src/remollPrimaryGeneratorAction.cc index 201607f57..de2d4c591 100644 --- a/src/remollPrimaryGeneratorAction.cc +++ b/src/remollPrimaryGeneratorAction.cc @@ -27,7 +27,7 @@ #include "remollGenpInelastic.hh" #include "remollGenPion.hh" #include "remollGenBeam.hh" -#include "remollGen12CElastic.hh" +#include "remollGenC12.hh" #include "remollGenFlat.hh" #include "remollGenExternal.hh" #include "remollGenAl.hh" @@ -57,7 +57,9 @@ remollPrimaryGeneratorAction::remollPrimaryGeneratorAction() fEvGenMap["inelasticAl"] = new remollGenAl(2); fEvGenMap["external"] = new remollGenExternal(); fEvGenMap["pion_LUND"] = new remollGenLUND(); - fEvGenMap["carbon"] = new remollGen12CElastic(); + fEvGenMap["elasticC12"] = new remollGenC12(0); + fEvGenMap["quasielasticC12"] = new remollGenC12(1); + fEvGenMap["inelasticC12"] = new remollGenC12(2); fEvGenMap["hyperon"] = new remollGenHyperon(); // Populate map with all possible primary generators From 479ae6f7ac85124e4b341d2ca676a161e3ae254e Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 27 May 2021 17:34:42 -0500 Subject: [PATCH 383/443] [remoll] warn and exit if old geant4 or root version --- remoll.cc | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/remoll.cc b/remoll.cc index e28f6139b..a6fc5c22a 100644 --- a/remoll.cc +++ b/remoll.cc @@ -46,7 +46,7 @@ typedef G4RunManager RunManager; namespace { void PrintUsage() { G4cerr << "Usage: " << G4endl; - G4cerr << " remoll [-g geometry] [-m macro] [-u UIsession] [-r seed] [-o outputfile] "; + G4cerr << " remoll [-f] [-g geometry] [-m macro] [-u UIsession] [-r seed] [-o outputfile] "; #ifdef G4MULTITHREADED G4cerr << "[-t nThreads] "; #endif @@ -91,6 +91,7 @@ int main(int argc, char** argv) { G4String geometry_gdmlfile; G4String parallel_gdmlfile; G4String outputfile; + __attribute__((unused)) G4bool force = false; #ifdef G4MULTITHREADED G4int threads = 0; #endif @@ -102,6 +103,7 @@ int main(int argc, char** argv) { else if (G4String(argv[i]) == "-u") session = argv[++i]; else if (G4String(argv[i]) == "-r") seed = atol(argv[++i]); else if (G4String(argv[i]) == "-o") outputfile = argv[++i]; + else if (G4String(argv[i]) == "-f") force = true; #ifdef G4MULTITHREADED else if (G4String(argv[i]) == "-t") threads = atoi(argv[++i]); #endif @@ -112,6 +114,27 @@ int main(int argc, char** argv) { } } + //------------------------------- + // Check dependency versions + //------------------------------- + #if G4VERSION_NUMBER < 1060 + if (! force) { + G4cerr << "WARNING: You are running with an older geant4 version." << G4endl; + G4cerr << "WARNING: The encouraged version of geant4 is 10.6.2." << G4endl; + G4cerr << "WARNING: Pass the option '-f' to ignore this warning." << G4endl; + exit(-1); + } + #endif + + #if ROOT_VERSION_CODE < ROOT_VERSION(6,14,4) + if (! force) { + G4cerr << "WARNING: You are running with an older ROOT version." << G4endl; + G4cerr << "WARNING: The encouraged version of ROOT is 6.14.4." << G4endl; + G4cerr << "WARNING: Pass the option '-f' to ignore this warning." << G4endl; + exit(-1); + } + #endif + //------------------------------- // Initialization of Run manager From ddfd126b455ee4ea43fb4414136c5f96aeaab813 Mon Sep 17 00:00:00 2001 From: Yug34 Date: Sat, 29 May 2021 20:14:57 +0530 Subject: [PATCH 384/443] [searchPath] Fixed remoll not finding files --- src/remollSearchPath.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/remollSearchPath.cc b/src/remollSearchPath.cc index cf01c9aef..d86eb6902 100644 --- a/src/remollSearchPath.cc +++ b/src/remollSearchPath.cc @@ -1,5 +1,8 @@ #include "remollSearchPath.hh" +#include +#include + remollSearchPath* remollSearchPath::fInstance = nullptr; remollSearchPath::remollSearchPath() @@ -44,6 +47,9 @@ void remollSearchPath::add(const std::string& path) else if (fs::exists(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/" + path))) { fSearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/" + path)); } + else if (fs::exists(fs::path("/jlab/remoll/share/remoll/" + path))) { + fSearchPath.push_back(fs::path("/jlab/remoll/share/remoll/" + path)); + } #endif } @@ -53,6 +59,9 @@ std::string remollSearchPath::operator() (const std::string& filename) // directories inside fSearchPath, return the filename prefixed with // the directory for which the full path exists #ifndef NO_FS_SUPPORT + if(fs::exists(fs::path(std::string("/jlab/remoll/share/remoll/" + filename)))) { + return std::string("/jlab/remoll/share/remoll/" + filename); + } for (auto path: fSearchPath) { fs::path test(path.string() + "/" + filename); if(fs::exists(test)) { @@ -66,5 +75,5 @@ std::string remollSearchPath::operator() (const std::string& filename) // File not found in any of the search directories, // return the filename - return std::string(filename); /* and pray everything work */ + return std::string("/jlab/remoll/share/remoll/" + filename); /* and pray everything work */ } From 793d727198ae8835d9295c45fd219d47a91d4913 Mon Sep 17 00:00:00 2001 From: Yug34 <53560276+Yug34@users.noreply.github.com> Date: Sat, 29 May 2021 20:19:03 +0530 Subject: [PATCH 385/443] [searchPath] remollSearchPath.cc cleanup --- src/remollSearchPath.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/remollSearchPath.cc b/src/remollSearchPath.cc index d86eb6902..03a7dc799 100644 --- a/src/remollSearchPath.cc +++ b/src/remollSearchPath.cc @@ -1,8 +1,5 @@ #include "remollSearchPath.hh" -#include -#include - remollSearchPath* remollSearchPath::fInstance = nullptr; remollSearchPath::remollSearchPath() From d0156de0c8a91461059309e025eceed9efaf340f Mon Sep 17 00:00:00 2001 From: Yug34 <53560276+Yug34@users.noreply.github.com> Date: Sun, 30 May 2021 15:47:29 +0530 Subject: [PATCH 386/443] [searchPath] Removed hardcoded path, file cleanup --- src/remollSearchPath.cc | 56 ++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 32 deletions(-) diff --git a/src/remollSearchPath.cc b/src/remollSearchPath.cc index 03a7dc799..c1bf828fd 100644 --- a/src/remollSearchPath.cc +++ b/src/remollSearchPath.cc @@ -2,27 +2,26 @@ remollSearchPath* remollSearchPath::fInstance = nullptr; -remollSearchPath::remollSearchPath() -{ - // add CMAKE_INSTALL_FULL_DATADIR, CMAKE_INSTALL_PREFIX and CWD to search path - #ifndef NO_FS_SUPPORT +remollSearchPath::remollSearchPath() { + // add CMAKE_INSTALL_FULL_DATADIR, CMAKE_INSTALL_PREFIX and CWD to search path + #ifndef NO_FS_SUPPORT fSearchPath.push_back(fs::path(get_current_dir_name())); fSearchPath.push_back(fs::path(CMAKE_INSTALL_PREFIX)); fSearchPath.push_back(fs::path(CMAKE_INSTALL_FULL_DATADIR)); - #endif + fSearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/")); + #endif } remollSearchPath *remollSearchPath::getInstance() { - if (!fInstance) { - fInstance = new remollSearchPath(); - } - return fInstance; + if (!fInstance) { + fInstance = new remollSearchPath(); + } + return fInstance; } remollSearchPath::~remollSearchPath() {} -void remollSearchPath::add(const std::string& path) -{ +void remollSearchPath::add(const std::string& path) { #ifndef NO_FS_SUPPORT // Check if path is an absolute path if (fs::exists(fs::path(path))) { @@ -44,33 +43,26 @@ void remollSearchPath::add(const std::string& path) else if (fs::exists(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/" + path))) { fSearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/" + path)); } - else if (fs::exists(fs::path("/jlab/remoll/share/remoll/" + path))) { - fSearchPath.push_back(fs::path("/jlab/remoll/share/remoll/" + path)); - } #endif } -std::string remollSearchPath::operator() (const std::string& filename) -{ - // If the file you are looking for exists inside any of the - // directories inside fSearchPath, return the filename prefixed with - // the directory for which the full path exists +std::string remollSearchPath::operator() (const std::string& filename) { + // If the file you are looking for exists inside any of the + // directories inside fSearchPath, return the filename prefixed with + // the directory for which the full path exists #ifndef NO_FS_SUPPORT - if(fs::exists(fs::path(std::string("/jlab/remoll/share/remoll/" + filename)))) { - return std::string("/jlab/remoll/share/remoll/" + filename); + for (auto path: fSearchPath) { + fs::path test(path.string() + "/" + filename); + if(fs::exists(test)) { + return test.string(); } - for (auto path: fSearchPath) { - fs::path test(path.string() + "/" + filename); - if(fs::exists(test)) { - return test.string(); - } - else if(fs::exists(path / "remoll" / filename)) { - return (path / "remoll" / filename).string(); - } + else if(fs::exists(path / "remoll" / filename)) { + return (path / "remoll" / filename).string(); } + } #endif - // File not found in any of the search directories, - // return the filename - return std::string("/jlab/remoll/share/remoll/" + filename); /* and pray everything work */ + // File not found in any of the search directories, + // return the filename + return std::string(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/" + filename); /* and pray everything work */ } From f3c2f3c325ca77a212dc6e99cc7c98ec2689cc9d Mon Sep 17 00:00:00 2001 From: Yug34 Date: Wed, 2 Jun 2021 02:53:34 +0530 Subject: [PATCH 387/443] [searchPath] Reverted fallback path to relative, cleanup --- src/remollSearchPath.cc | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/src/remollSearchPath.cc b/src/remollSearchPath.cc index c1bf828fd..4bb1243bb 100644 --- a/src/remollSearchPath.cc +++ b/src/remollSearchPath.cc @@ -8,7 +8,6 @@ remollSearchPath::remollSearchPath() { fSearchPath.push_back(fs::path(get_current_dir_name())); fSearchPath.push_back(fs::path(CMAKE_INSTALL_PREFIX)); fSearchPath.push_back(fs::path(CMAKE_INSTALL_FULL_DATADIR)); - fSearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/")); #endif } @@ -27,22 +26,6 @@ void remollSearchPath::add(const std::string& path) { if (fs::exists(fs::path(path))) { fSearchPath.push_back(fs::path(path)); } - // Check if the directory to search in is inside the current working directory - else if(fs::exists(fs::path(std::string(get_current_dir_name()) + "/" + path))) { - fSearchPath.push_back(fs::path(get_current_dir_name()) / path); - } - // Check if directory to search in is inside CMAKE_INSTALL_PREFIX - else if(fs::exists(fs::path(std::string(CMAKE_INSTALL_PREFIX) + "/" + path))) { - fSearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_PREFIX) + "/" + path)); - } - // Check if directory to search in is inside CMAKE_INSTALL_FULL_DATADIR - else if(fs::exists(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/" + path))) { - fSearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/" + path)); - } - // Check if directory to search in is inside CMAKE_INSTALL_FULL_DATADIR/remoll/ - else if (fs::exists(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/" + path))) { - fSearchPath.push_back(fs::path(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/" + path)); - } #endif } @@ -64,5 +47,5 @@ std::string remollSearchPath::operator() (const std::string& filename) { // File not found in any of the search directories, // return the filename - return std::string(std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/" + filename); /* and pray everything work */ + return std::string(filename); } From 8cfc5fa932997cfc12ef9a7cb95dbf06f772fb34 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 6 Jun 2021 12:42:34 -0500 Subject: [PATCH 388/443] Replace travis badge with github badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 03cb474ef..996ead8fd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Simulations for the MOLLER Experiment at Jefferson Lab -[![Build Status](http://travis-ci.org/JeffersonLab/remoll.svg?branch=develop)](https://travis-ci.org/JeffersonLab/remoll) +[![Build Status](https://github.com/JeffersonLab/remoll/actions/workflows/docker-image.yml/badge.svg?branch=develop)](https://github.com/JeffersonLab/remoll/actions/workflows/docker-image.yml) ## Community From 904a3ef5de9085743ea4bff1f81b814a0a7586bf Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 22 Jun 2021 20:06:20 -0500 Subject: [PATCH 389/443] Delay updating info until necessary --- include/remollBeamTarget.hh | 5 +++++ src/remollBeamTarget.cc | 20 +++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/include/remollBeamTarget.hh b/include/remollBeamTarget.hh index a3addfa2f..4d3fcad47 100644 --- a/include/remollBeamTarget.hh +++ b/include/remollBeamTarget.hh @@ -46,6 +46,8 @@ class remollBeamTarget { static G4double fActiveTargetEffectiveLength; // Positions are in physical distances (i.e. in cm) static G4double fMotherTargetAbsolutePosition; + // Flag to require recomputation of effective lengths + static bool fUpdateNeeded; public: static void UpdateInfo(); @@ -55,14 +57,17 @@ class remollBeamTarget { static void ResetTargetVolumes() { fTargetVolumes.clear(); fTargetMothers.clear(); + fUpdateNeeded = true; } static void AddMotherVolume(G4VPhysicalVolume *v, const G4String& tag) { fTargetMothers.push_back(std::make_pair(v,tag)); fTargetVolumes.resize(fTargetMothers.size()); fActiveTargetMother = fTargetMothers.size() - 1; + fUpdateNeeded = true; } static void AddTargetVolume(G4VPhysicalVolume *v, const G4String& tag) { fTargetVolumes[fActiveTargetMother].push_back(std::make_pair(v,tag)); + fUpdateNeeded = true; } static std::vector> GetTargetVolumes() { return fTargetVolumes[fActiveTargetMother]; diff --git a/src/remollBeamTarget.cc b/src/remollBeamTarget.cc index 89bf3aa39..4563c7374 100644 --- a/src/remollBeamTarget.cc +++ b/src/remollBeamTarget.cc @@ -39,6 +39,7 @@ std::vector>> remollBeamTarge G4double remollBeamTarget::fActiveTargetEffectiveLength = -1e9; G4double remollBeamTarget::fMotherTargetAbsolutePosition = -1e9; G4double remollBeamTarget::fTotalTargetEffectiveLength = 0.0; +G4bool remollBeamTarget::fUpdateNeeded = true; remollBeamTarget::remollBeamTarget() : fBeamEnergy(gDefaultBeamE),fBeamCurrent(gDefaultBeamCur),fBeamPolarization(gDefaultBeamPol), @@ -78,6 +79,11 @@ remollBeamTarget::remollBeamTarget() fMessengerTarget->DeclareMethod("mother",&remollBeamTarget::SetActiveTargetMother,"Set target mother name").SetStates(G4State_Idle); fMessengerTarget->DeclareMethod("volume",&remollBeamTarget::SetActiveTargetVolume,"Set target volume name").SetStates(G4State_Idle); fMessengerTarget->DeclareMethod("print",&remollBeamTarget::PrintTargetInfo).SetStates(G4State_Idle); + + SetActiveTargetMother(fActiveTargetMotherName); + SetActiveTargetVolume(fActiveTargetVolumeName); + + fUpdateNeeded = true; } remollBeamTarget::~remollBeamTarget() @@ -97,6 +103,8 @@ G4double remollBeamTarget::GetEffLumin(SamplingType_t sampling_type) void remollBeamTarget::PrintTargetInfo() { + if (fUpdateNeeded) UpdateInfo(); + for (auto mother = fTargetMothers.begin(); mother != fTargetMothers.end(); mother++) { @@ -118,9 +126,6 @@ void remollBeamTarget::PrintTargetInfo() } } - SetActiveTargetMother(fActiveTargetMotherName); - SetActiveTargetVolume(fActiveTargetVolumeName); - G4cout << "Current active target: " << G4endl; G4cout << "Target mother = " << fActiveTargetMotherName << G4endl; G4cout << "Target volume = " << fActiveTargetVolumeName << G4endl; @@ -195,9 +200,8 @@ void remollBeamTarget::SetActiveTargetMother(G4String name) } - lock.unlock(); + fUpdateNeeded = true; - UpdateInfo(); } void remollBeamTarget::SetActiveTargetVolume(G4String name) @@ -215,9 +219,8 @@ void remollBeamTarget::SetActiveTargetVolume(G4String name) } - lock.unlock(); + fUpdateNeeded = true; - UpdateInfo(); } @@ -256,6 +259,9 @@ remollVertex remollBeamTarget::SampleVertex(SamplingType_t sampling_type) // Sample where along target weighted by density (which roughly corresponds to A // or the number of electrons, which is probably good enough for this + // Update if needed + if (fUpdateNeeded) UpdateInfo(); + // Figure out how far along the target we got G4double total_effective_length = 0; switch (sampling_type) { From 6f353fe50582390f94c8fa5b95ac920e77514107 Mon Sep 17 00:00:00 2001 From: Sakib Rahman Date: Wed, 23 Jun 2021 14:17:30 -0400 Subject: [PATCH 390/443] Flipping the sign to rotate about the proper vertical axis --- src/remollVEventGen.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/remollVEventGen.cc b/src/remollVEventGen.cc index 61f5f0ca1..a22edf7f8 100644 --- a/src/remollVEventGen.cc +++ b/src/remollVEventGen.cc @@ -125,7 +125,7 @@ void remollVEventGen::PolishEvent(remollEvent *ev) { exit(1); } - G4ThreeVector rotax = (fBeamTarg->fDir.cross(G4ThreeVector(0.0, 0.0, 1.0))).unit(); + G4ThreeVector rotax = (-1)*(fBeamTarg->fDir.cross(G4ThreeVector(0.0, 0.0, 1.0))).unit(); G4RotationMatrix msrot; msrot.rotate(fBeamTarg->fDir.theta(), rotax); From 5c5762b8062e25992925fc3a7d67dee8b0e1768a Mon Sep 17 00:00:00 2001 From: Sakib Rahman Date: Wed, 23 Jun 2021 14:18:14 -0400 Subject: [PATCH 391/443] Use the real momentum after multiple scattering and other coordinate rotations are performed instead of the true momentum --- src/remollPrimaryGeneratorAction.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/remollPrimaryGeneratorAction.cc b/src/remollPrimaryGeneratorAction.cc index de2d4c591..beaa4def7 100644 --- a/src/remollPrimaryGeneratorAction.cc +++ b/src/remollPrimaryGeneratorAction.cc @@ -172,24 +172,24 @@ void remollPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) fEvent = fEventGen->GenerateEvent(); for (unsigned int pidx = 0; pidx < fEvent->fPartType.size(); pidx++) { - double p = fEvent->fPartMom[pidx].mag(); + double p = fEvent->fPartRealMom[pidx].mag(); double m = fEvent->fPartType[pidx]->GetPDGMass(); double kinE = sqrt(p*p + m*m) - m; fParticleGun->SetParticleDefinition(fEvent->fPartType[pidx]); fParticleGun->SetParticleEnergy(kinE); fParticleGun->SetParticlePosition(fEvent->fPartPos[pidx]); - fParticleGun->SetParticleMomentumDirection(fEvent->fPartMom[pidx].unit()); + fParticleGun->SetParticleMomentumDirection(fEvent->fPartRealMom[pidx].unit()); G4ThreeVector pol(0,0,0); if (pidx == 0) { if (cross.mag() !=0) { if (cross.mag() == 1) //transverse polarization - pol = G4ThreeVector( (fEvent->fPartMom[0].unit()).cross(cross)); + pol = G4ThreeVector( (fEvent->fPartRealMom[0].unit()).cross(cross)); else if (fBeamPol.contains("+") ) //positive helicity - pol = fEvent->fPartMom[0].unit(); + pol = fEvent->fPartRealMom[0].unit(); else //negative helicity - pol = - fEvent->fPartMom[0].unit(); + pol = - fEvent->fPartRealMom[0].unit(); } } fParticleGun->SetParticlePolarization(pol); From 00688e5b6fc69c59110d945fe631bcf2a73b9525 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 9 Jul 2021 15:00:19 -0400 Subject: [PATCH 392/443] No need to use fBeamTarg in moller generator --- include/remollGenMoller.hh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/include/remollGenMoller.hh b/include/remollGenMoller.hh index 525feb06c..d7ebf90ca 100644 --- a/include/remollGenMoller.hh +++ b/include/remollGenMoller.hh @@ -11,8 +11,6 @@ #include "remollVEventGen.hh" -class remollBeamTarget; - class remollGenMoller : public remollVEventGen { public: remollGenMoller(); @@ -20,9 +18,6 @@ class remollGenMoller : public remollVEventGen { private: void SamplePhysics(remollVertex *, remollEvent *); - - remollBeamTarget *fBeamTarg; - }; #endif//__REMOLLGENMOLLER_HH From bbbb333bd7692a4275b76014baff22af19bb29cb Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 9 Jul 2021 15:01:42 -0400 Subject: [PATCH 393/443] No need for remollBeamTarget in ep elastic generator --- include/remollGenpElastic.hh | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/remollGenpElastic.hh b/include/remollGenpElastic.hh index 7e14279f4..ac6476856 100644 --- a/include/remollGenpElastic.hh +++ b/include/remollGenpElastic.hh @@ -11,8 +11,6 @@ #include "remollVEventGen.hh" -class remollBeamTarget; - class remollGenpElastic : public remollVEventGen { public: remollGenpElastic(); From b186f29514854cd89f7baa1748f49ab8af705eb1 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 9 Jul 2021 15:14:34 -0400 Subject: [PATCH 394/443] Delay update to target info until needed --- src/remollBeamTarget.cc | 56 ++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 31 deletions(-) diff --git a/src/remollBeamTarget.cc b/src/remollBeamTarget.cc index 4563c7374..03df0e226 100644 --- a/src/remollBeamTarget.cc +++ b/src/remollBeamTarget.cc @@ -79,11 +79,6 @@ remollBeamTarget::remollBeamTarget() fMessengerTarget->DeclareMethod("mother",&remollBeamTarget::SetActiveTargetMother,"Set target mother name").SetStates(G4State_Idle); fMessengerTarget->DeclareMethod("volume",&remollBeamTarget::SetActiveTargetVolume,"Set target volume name").SetStates(G4State_Idle); fMessengerTarget->DeclareMethod("print",&remollBeamTarget::PrintTargetInfo).SetStates(G4State_Idle); - - SetActiveTargetMother(fActiveTargetMotherName); - SetActiveTargetVolume(fActiveTargetVolumeName); - - fUpdateNeeded = true; } remollBeamTarget::~remollBeamTarget() @@ -148,6 +143,27 @@ void remollBeamTarget::UpdateInfo() return; } + // Find mother volume + for (auto mother = fTargetMothers.begin(); + mother != fTargetMothers.end(); + mother++) { + + if ((*mother).second == fActiveTargetMotherName) { + fActiveTargetMother = mother - fTargetMothers.begin(); + } + } + + // Find target volume + for (auto daughter = fTargetVolumes[fActiveTargetMother].begin(); + daughter != fTargetVolumes[fActiveTargetMother].end(); + daughter++) { + + if ((*daughter).second == fActiveTargetVolumeName) { + fActiveTargetVolume = daughter - fTargetVolumes[fActiveTargetMother].begin(); + } + + } + // Get absolute position fMotherTargetAbsolutePosition = fTargetMothers[fActiveTargetMother].first->GetTranslation().z() - 4500; @@ -182,45 +198,23 @@ void remollBeamTarget::UpdateInfo() fActiveTargetEffectiveLength = 2.0 * z_half_length * material->GetDensity(); } } + + fUpdateNeeded = false; } void remollBeamTarget::SetActiveTargetMother(G4String name) { G4AutoLock lock(&remollBeamTargetMutex); - - for (auto mother = fTargetMothers.begin(); - mother != fTargetMothers.end(); - mother++) { - - if ((*mother).second == name) { - fActiveTargetMotherName = name; - fActiveTargetMother = mother - fTargetMothers.begin(); - } - - } - + fActiveTargetMotherName = name; fUpdateNeeded = true; - } void remollBeamTarget::SetActiveTargetVolume(G4String name) { G4AutoLock lock(&remollBeamTargetMutex); - - for (auto daughter = fTargetVolumes[fActiveTargetMother].begin(); - daughter != fTargetVolumes[fActiveTargetMother].end(); - daughter++) { - - if ((*daughter).second == name) { - fActiveTargetVolumeName = name; - fActiveTargetVolume = daughter - fTargetVolumes[fActiveTargetMother].begin(); - } - - } - + fActiveTargetVolumeName = name; fUpdateNeeded = true; - } From 277e4446d4e589df7907771b2ddad820caf52133 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 15 Jul 2021 10:12:01 -0500 Subject: [PATCH 395/443] Define hit fBeta --- include/remollGenericDetectorHit.hh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/remollGenericDetectorHit.hh b/include/remollGenericDetectorHit.hh index 7186997f1..2b9abac0d 100644 --- a/include/remollGenericDetectorHit.hh +++ b/include/remollGenericDetectorHit.hh @@ -48,7 +48,7 @@ class remollGenericDetectorHit : public G4VHit { G4double fThRec; // Total momentum, energy, mass, kinetic energy - G4double fP, fE, fM, fK; + G4double fP, fE, fM, fK, fBeta; // Origin G4ThreeVector f3V; // Geant4 track ID, particle type, and mother ID @@ -92,6 +92,7 @@ class remollGenericDetectorHit : public G4VHit { hit.e = fE; hit.m = fM; hit.k = fK; + hit.beta = fBeta;.cc hit.edep = fEdep; return hit; }; From e8dc5cad1b1f81ea432d4a073403a00657bd7993 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 15 Jul 2021 10:12:46 -0500 Subject: [PATCH 396/443] hit.beta field in struct --- include/remolltypes.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/remolltypes.hh b/include/remolltypes.hh index ef00f838f..6dcc80505 100644 --- a/include/remolltypes.hh +++ b/include/remolltypes.hh @@ -12,7 +12,7 @@ //#include //#endif -#define __RUNSTR_LEN 255 +#define __RUNSTR_LEN 255 fBeta for hit #define __MAXFILE_LEN 1048576 // MB file size limit #include "TTimeStamp.h" @@ -77,7 +77,7 @@ struct remollGenericDetectorHit_t { double px, py, pz; double pxl, pyl, pzl; double sx, sy, sz; - double p, e, m, k; + double p, e, m, k, beta; double vx, vy, vz; double edep; }; From e5d6201954a6345db6cf760c4316c26b506c6199 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 15 Jul 2021 10:14:04 -0500 Subject: [PATCH 397/443] Set fBeta to -1.0 by default, and copy constructor --- src/remollGenericDetectorHit.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/remollGenericDetectorHit.cc b/src/remollGenericDetectorHit.cc index 6df8584d2..c7b2b5cfd 100644 --- a/src/remollGenericDetectorHit.cc +++ b/src/remollGenericDetectorHit.cc @@ -20,6 +20,7 @@ remollGenericDetectorHit::remollGenericDetectorHit(G4int det, G4int copy) fE = -1.0; fM = -1.0; fK = -1.0; + fBeta = -1.0; f3XRec = G4ThreeVector(-1e9, -1e9, -1e9); f3dPRec = G4ThreeVector(-1e9, -1e9, -1e9); @@ -56,6 +57,7 @@ remollGenericDetectorHit::remollGenericDetectorHit(const remollGenericDetectorHi fE = right.fE; fM = right.fM; fK = right.fK; + fBeta = right.fBeta; f3XRec = right.f3XRec; f3dPRec = right.f3dPRec; From c6c4d4e348b7b020a87c7331c028de85e0d05c86 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 15 Jul 2021 10:17:10 -0500 Subject: [PATCH 398/443] Set fBeta to GetVelocity / c_light --- src/remollGenericDetector.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/remollGenericDetector.cc b/src/remollGenericDetector.cc index df2ae6c66..51670d4a2 100644 --- a/src/remollGenericDetector.cc +++ b/src/remollGenericDetector.cc @@ -3,6 +3,7 @@ #include "G4OpticalPhoton.hh" #include "G4SDManager.hh" #include "G4GenericMessenger.hh" +#include "G4PhysicalConstants.hh" #include "remollGenericDetectorHit.hh" #include "remollGenericDetectorSum.hh" @@ -303,6 +304,7 @@ G4bool remollGenericDetector::ProcessHits(G4Step* step, G4TouchableHistory*) hit->fE = track->GetTotalEnergy(); hit->fM = particle->GetPDGMass(); hit->fK = track->GetKineticEnergy(); + hit->fBeta = track->GetVelocity() / c_light; hit->fTrID = track->GetTrackID(); hit->fmTrID = track->GetParentID(); From ee739e6fddf7ac430142ca13c9ca61e3b971d83e Mon Sep 17 00:00:00 2001 From: Yug34 Date: Wed, 21 Jul 2021 00:42:34 +0530 Subject: [PATCH 399/443] Added XrootD and StashCP --- Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Dockerfile b/Dockerfile index 6e3c22abd..fe948675a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,6 +20,15 @@ FROM jeffersonlab/remoll-builder:main +# XrootD +RUN yum --enablerepo=extras -y install epel-release +RUN yum -y install python3-pip \ + xrootd-client + +# Stashcp +RUN pip3 install setuptools && \ + pip3 install stashcp + # Set remoll location ENV REMOLL=/jlab/remoll From f3bd3d4a75fae9d00966e610dedc2ec9d0fe56cb Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 27 Jul 2021 13:13:05 -0500 Subject: [PATCH 400/443] Only warn once on kNoTargetVolume --- src/remollBeamTarget.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/remollBeamTarget.cc b/src/remollBeamTarget.cc index 4563c7374..cbdb39f96 100644 --- a/src/remollBeamTarget.cc +++ b/src/remollBeamTarget.cc @@ -233,10 +233,11 @@ remollVertex remollBeamTarget::SampleVertex(SamplingType_t sampling_type) remollVertex vertex; // No sampling required - if (sampling_type == kNoTargetVolume) { + static bool sampling_type_has_been_warned = false; + if (sampling_type == kNoTargetVolume && ! sampling_type_has_been_warned) { G4cerr << "ERROR: " << __PRETTY_FUNCTION__ << " line " << __LINE__ << ": " << "kNoTargetVolume!" << G4endl; - return vertex; + sampling_type_has_been_warned = true; } // Check if target mother volume exists From bbb7599eae99fa0940a9d5e2621d4ef43f873585 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 8 Sep 2021 16:32:53 -0500 Subject: [PATCH 401/443] Update load_magnetic_fieldmaps.mac --- macros/load_magnetic_fieldmaps.mac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/load_magnetic_fieldmaps.mac b/macros/load_magnetic_fieldmaps.mac index 13f00da71..73fb40fb1 100644 --- a/macros/load_magnetic_fieldmaps.mac +++ b/macros/load_magnetic_fieldmaps.mac @@ -2,7 +2,7 @@ # # Instead of including magnetic field maps directly in your macros, # consider loading this macro with -# /control/execute macros/load_magnetic_field.mac +# /control/execute macros/load_magnetic_fieldmaps.mac /remoll/addfield map_directory/V2U.1a.50cm.parallel.txt /remoll/addfield map_directory/V2DSg.9.75cm.parallel.txt From 82620b35252d82fb25a328ce2bf0fab4db10908f Mon Sep 17 00:00:00 2001 From: sudipbhattarai Date: Mon, 13 Sep 2021 12:42:56 -0600 Subject: [PATCH 402/443] Updated showermax position, gdml files and macros --- geometry/mollerParallel.gdml | 16 +- geometry/positions.xml | 7 +- geometry/showermax/showerMaxGen.gdml | 392 ++++++++++++++++-- macros/showermax/sm_close14_elastic_1001.mac | 56 +++ .../showermax/sm_close14_inelastic_1001.mac | 56 +++ macros/showermax/sm_close14_moller_1001.mac | 56 +++ macros/showermax/sm_open00_elastic_1001.mac | 56 +++ macros/showermax/sm_open00_inelastic_1001.mac | 56 +++ macros/showermax/sm_open00_moller_1001.mac | 56 +++ macros/showermax/sm_trans21_elastic_1001.mac | 56 +++ .../showermax/sm_trans21_inelastic_1001.mac | 56 +++ macros/showermax/sm_trans21_moller_1001.mac | 56 +++ 12 files changed, 887 insertions(+), 32 deletions(-) create mode 100644 macros/showermax/sm_close14_elastic_1001.mac create mode 100644 macros/showermax/sm_close14_inelastic_1001.mac create mode 100644 macros/showermax/sm_close14_moller_1001.mac create mode 100644 macros/showermax/sm_open00_elastic_1001.mac create mode 100644 macros/showermax/sm_open00_inelastic_1001.mac create mode 100644 macros/showermax/sm_open00_moller_1001.mac create mode 100644 macros/showermax/sm_trans21_elastic_1001.mac create mode 100644 macros/showermax/sm_trans21_inelastic_1001.mac create mode 100644 macros/showermax/sm_trans21_moller_1001.mac diff --git a/geometry/mollerParallel.gdml b/geometry/mollerParallel.gdml index d22fb443b..14ea053fe 100644 --- a/geometry/mollerParallel.gdml +++ b/geometry/mollerParallel.gdml @@ -46,9 +46,12 @@ startphi="0" deltaphi="360" aunit="deg" rmin="1450" rmax="1460" z="2700" lunit="mm"/> + - @@ -158,6 +161,13 @@ + + + + + + + @@ -259,6 +269,10 @@ + + + + diff --git a/geometry/positions.xml b/geometry/positions.xml index d5eabcdbd..ee4783837 100644 --- a/geometry/positions.xml +++ b/geometry/positions.xml @@ -37,8 +37,8 @@ - - + + @@ -67,5 +67,6 @@ - + + diff --git a/geometry/showermax/showerMaxGen.gdml b/geometry/showermax/showerMaxGen.gdml index ed8fece3e..98d79f944 100644 --- a/geometry/showermax/showerMaxGen.gdml +++ b/geometry/showermax/showerMaxGen.gdml @@ -108,6 +108,8 @@ + + @@ -119,6 +121,8 @@ + + @@ -129,6 +133,8 @@ + + @@ -139,6 +145,8 @@ + + @@ -149,10 +157,14 @@ + + + + @@ -258,6 +270,8 @@ + + @@ -269,6 +283,8 @@ + + @@ -279,6 +295,8 @@ + + @@ -289,6 +307,8 @@ + + @@ -299,10 +319,14 @@ + + + + @@ -408,6 +432,8 @@ + + @@ -419,6 +445,8 @@ + + @@ -429,6 +457,8 @@ + + @@ -439,6 +469,8 @@ + + @@ -449,10 +481,14 @@ + + + + @@ -558,6 +594,8 @@ + + @@ -569,6 +607,8 @@ + + @@ -579,6 +619,8 @@ + + @@ -589,6 +631,8 @@ + + @@ -599,10 +643,14 @@ + + + + @@ -708,6 +756,8 @@ + + @@ -719,6 +769,8 @@ + + @@ -729,6 +781,8 @@ + + @@ -739,6 +793,8 @@ + + @@ -749,10 +805,14 @@ + + + + @@ -858,6 +918,8 @@ + + @@ -869,6 +931,8 @@ + + @@ -879,6 +943,8 @@ + + @@ -889,6 +955,8 @@ + + @@ -899,10 +967,14 @@ + + + + @@ -1008,6 +1080,8 @@ + + @@ -1019,6 +1093,8 @@ + + @@ -1029,6 +1105,8 @@ + + @@ -1039,6 +1117,8 @@ + + @@ -1049,10 +1129,14 @@ + + + + @@ -1158,6 +1242,8 @@ + + @@ -1169,6 +1255,8 @@ + + @@ -1179,6 +1267,8 @@ + + @@ -1189,6 +1279,8 @@ + + @@ -1199,10 +1291,14 @@ + + + + @@ -1308,6 +1404,8 @@ + + @@ -1319,6 +1417,8 @@ + + @@ -1329,6 +1429,8 @@ + + @@ -1339,6 +1441,8 @@ + + @@ -1349,10 +1453,14 @@ + + + + @@ -1458,6 +1566,8 @@ + + @@ -1469,6 +1579,8 @@ + + @@ -1479,6 +1591,8 @@ + + @@ -1489,6 +1603,8 @@ + + @@ -1499,10 +1615,14 @@ + + + + @@ -1608,6 +1728,8 @@ + + @@ -1619,6 +1741,8 @@ + + @@ -1629,6 +1753,8 @@ + + @@ -1639,6 +1765,8 @@ + + @@ -1649,10 +1777,14 @@ + + + + @@ -1758,6 +1890,8 @@ + + @@ -1769,6 +1903,8 @@ + + @@ -1779,6 +1915,8 @@ + + @@ -1789,6 +1927,8 @@ + + @@ -1799,10 +1939,14 @@ + + + + @@ -1908,6 +2052,8 @@ + + @@ -1919,6 +2065,8 @@ + + @@ -1929,6 +2077,8 @@ + + @@ -1939,6 +2089,8 @@ + + @@ -1949,10 +2101,14 @@ + + + + @@ -2058,6 +2214,8 @@ + + @@ -2069,6 +2227,8 @@ + + @@ -2079,6 +2239,8 @@ + + @@ -2089,6 +2251,8 @@ + + @@ -2099,10 +2263,14 @@ + + + + @@ -2208,6 +2376,8 @@ + + @@ -2219,6 +2389,8 @@ + + @@ -2229,6 +2401,8 @@ + + @@ -2239,6 +2413,8 @@ + + @@ -2249,10 +2425,14 @@ + + + + @@ -2358,6 +2538,8 @@ + + @@ -2369,6 +2551,8 @@ + + @@ -2379,6 +2563,8 @@ + + @@ -2389,6 +2575,8 @@ + + @@ -2399,10 +2587,14 @@ + + + + @@ -2508,6 +2700,8 @@ + + @@ -2519,6 +2713,8 @@ + + @@ -2529,6 +2725,8 @@ + + @@ -2539,6 +2737,8 @@ + + @@ -2549,10 +2749,14 @@ + + + + @@ -2658,6 +2862,8 @@ + + @@ -2669,6 +2875,8 @@ + + @@ -2679,6 +2887,8 @@ + + @@ -2689,6 +2899,8 @@ + + @@ -2699,10 +2911,14 @@ + + + + @@ -2808,6 +3024,8 @@ + + @@ -2819,6 +3037,8 @@ + + @@ -2829,6 +3049,8 @@ + + @@ -2839,6 +3061,8 @@ + + @@ -2849,10 +3073,14 @@ + + + + @@ -2958,6 +3186,8 @@ + + @@ -2969,6 +3199,8 @@ + + @@ -2979,6 +3211,8 @@ + + @@ -2989,6 +3223,8 @@ + + @@ -2999,10 +3235,14 @@ + + + + @@ -3108,6 +3348,8 @@ + + @@ -3119,6 +3361,8 @@ + + @@ -3129,6 +3373,8 @@ + + @@ -3139,6 +3385,8 @@ + + @@ -3149,10 +3397,14 @@ + + + + @@ -3258,6 +3510,8 @@ + + @@ -3269,6 +3523,8 @@ + + @@ -3279,6 +3535,8 @@ + + @@ -3289,6 +3547,8 @@ + + @@ -3299,10 +3559,14 @@ + + + + @@ -3408,6 +3672,8 @@ + + @@ -3419,6 +3685,8 @@ + + @@ -3429,6 +3697,8 @@ + + @@ -3439,6 +3709,8 @@ + + @@ -3449,10 +3721,14 @@ + + + + @@ -3558,6 +3834,8 @@ + + @@ -3569,6 +3847,8 @@ + + @@ -3579,6 +3859,8 @@ + + @@ -3589,6 +3871,8 @@ + + @@ -3599,10 +3883,14 @@ + + + + @@ -3708,6 +3996,8 @@ + + @@ -3719,6 +4009,8 @@ + + @@ -3729,6 +4021,8 @@ + + @@ -3739,6 +4033,8 @@ + + @@ -3749,10 +4045,14 @@ + + + + @@ -3858,6 +4158,8 @@ + + @@ -3869,6 +4171,8 @@ + + @@ -3879,6 +4183,8 @@ + + @@ -3889,6 +4195,8 @@ + + @@ -3899,10 +4207,14 @@ + + + + @@ -4008,6 +4320,8 @@ + + @@ -4019,6 +4333,8 @@ + + @@ -4029,6 +4345,8 @@ + + @@ -4039,6 +4357,8 @@ + + @@ -4049,10 +4369,14 @@ + + + + @@ -4158,6 +4482,8 @@ + + @@ -4169,6 +4495,8 @@ + + @@ -4179,6 +4507,8 @@ + + @@ -4189,6 +4519,8 @@ + + @@ -4199,10 +4531,14 @@ + + + + @@ -4290,142 +4626,142 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/macros/showermax/sm_close14_elastic_1001.mac b/macros/showermax/sm_close14_elastic_1001.mac new file mode 100644 index 000000000..82aed48a4 --- /dev/null +++ b/macros/showermax/sm_close14_elastic_1001.mac @@ -0,0 +1,56 @@ +/remoll/setgeofile geometry/mollerMother.gdml +/remoll/physlist/register QGSP_BERT_HP +/remoll/physlist/parallel/enable +/remoll/parallel/setfile geometry/mollerParallel.gdml + +/run/initialize +/control/execute macros/load_magnetic_fieldmaps.mac + +/remoll/evgen/set elastic + +/remoll/oldras false +/remoll/beam_corrph 0.02134 +/remoll/beam_corrth 0.02134 + +/remoll/beamene 11 GeV +/remoll/beamcurr 65 microampere + +/remoll/SD/disable_all +/remoll/SD/enable 28 +/remoll/SD/detect lowenergyneutral 28 +/remoll/SD/detect secondaries 28 +/remoll/SD/detect boundaryhits 28 + +/remoll/SD/enable 70 +/remoll/SD/detect lowenergyneutral 70 +/remoll/SD/detect secondaries 70 +/remoll/SD/detect boundaryhits 70 + +/remoll/SD/enable 7141 +/remoll/SD/detect lowenergyneutral 7141 +/remoll/SD/detect secondaries 7141 +/remoll/SD/detect boundaryhits 7141 + +/remoll/SD/enable 7142 +/remoll/SD/detect lowenergyneutral 7142 +/remoll/SD/detect secondaries 7142 +/remoll/SD/detect boundaryhits 7142 + +/remoll/SD/enable 7144 +/remoll/SD/detect lowenergyneutral 7144 +/remoll/SD/detect secondaries 7144 +/remoll/SD/detect boundaryhits 7144 + +/remoll/SD/enable 7146 +/remoll/SD/detect lowenergyneutral 7146 +/remoll/SD/detect secondaries 7146 +/remoll/SD/detect boundaryhits 7146 + +/remoll/SD/enable 7148 +/remoll/SD/detect lowenergyneutral 7148 +/remoll/SD/detect secondaries 7148 +/remoll/SD/detect boundaryhits 7148 + +/remoll/filename /lustre19/expphy/volatile/halla/moller12gev/sudip/remoll_rootfiles/SM0821v3/sm_close14_SM0821v3_elastic_50k_1001.root + +/run/beamOn 50000 diff --git a/macros/showermax/sm_close14_inelastic_1001.mac b/macros/showermax/sm_close14_inelastic_1001.mac new file mode 100644 index 000000000..0497affcc --- /dev/null +++ b/macros/showermax/sm_close14_inelastic_1001.mac @@ -0,0 +1,56 @@ +/remoll/setgeofile geometry/mollerMother.gdml +/remoll/physlist/register QGSP_BERT_HP +/remoll/physlist/parallel/enable +/remoll/parallel/setfile geometry/mollerParallel.gdml + +/run/initialize +/control/execute macros/load_magnetic_fieldmaps.mac + +/remoll/evgen/set inelastic + +/remoll/oldras false +/remoll/beam_corrph 0.02134 +/remoll/beam_corrth 0.02134 + +/remoll/beamene 11 GeV +/remoll/beamcurr 65 microampere + +/remoll/SD/disable_all +/remoll/SD/enable 28 +/remoll/SD/detect lowenergyneutral 28 +/remoll/SD/detect secondaries 28 +/remoll/SD/detect boundaryhits 28 + +/remoll/SD/enable 70 +/remoll/SD/detect lowenergyneutral 70 +/remoll/SD/detect secondaries 70 +/remoll/SD/detect boundaryhits 70 + +/remoll/SD/enable 7141 +/remoll/SD/detect lowenergyneutral 7141 +/remoll/SD/detect secondaries 7141 +/remoll/SD/detect boundaryhits 7141 + +/remoll/SD/enable 7142 +/remoll/SD/detect lowenergyneutral 7142 +/remoll/SD/detect secondaries 7142 +/remoll/SD/detect boundaryhits 7142 + +/remoll/SD/enable 7144 +/remoll/SD/detect lowenergyneutral 7144 +/remoll/SD/detect secondaries 7144 +/remoll/SD/detect boundaryhits 7144 + +/remoll/SD/enable 7146 +/remoll/SD/detect lowenergyneutral 7146 +/remoll/SD/detect secondaries 7146 +/remoll/SD/detect boundaryhits 7146 + +/remoll/SD/enable 7148 +/remoll/SD/detect lowenergyneutral 7148 +/remoll/SD/detect secondaries 7148 +/remoll/SD/detect boundaryhits 7148 + +/remoll/filename /lustre19/expphy/volatile/halla/moller12gev/sudip/remoll_rootfiles/SM0821v3/sm_close14_SM0821v3_inelastic_50k_1001.root + +/run/beamOn 50000 diff --git a/macros/showermax/sm_close14_moller_1001.mac b/macros/showermax/sm_close14_moller_1001.mac new file mode 100644 index 000000000..9a83f22a4 --- /dev/null +++ b/macros/showermax/sm_close14_moller_1001.mac @@ -0,0 +1,56 @@ +/remoll/setgeofile geometry/mollerMother.gdml +/remoll/physlist/register QGSP_BERT_HP +/remoll/physlist/parallel/enable +/remoll/parallel/setfile geometry/mollerParallel.gdml + +/run/initialize +/control/execute macros/load_magnetic_fieldmaps.mac + +/remoll/evgen/set moller + +/remoll/oldras false +/remoll/beam_corrph 0.02134 +/remoll/beam_corrth 0.02134 + +/remoll/beamene 11 GeV +/remoll/beamcurr 65 microampere + +/remoll/SD/disable_all +/remoll/SD/enable 28 +/remoll/SD/detect lowenergyneutral 28 +/remoll/SD/detect secondaries 28 +/remoll/SD/detect boundaryhits 28 + +/remoll/SD/enable 70 +/remoll/SD/detect lowenergyneutral 70 +/remoll/SD/detect secondaries 70 +/remoll/SD/detect boundaryhits 70 + +/remoll/SD/enable 7141 +/remoll/SD/detect lowenergyneutral 7141 +/remoll/SD/detect secondaries 7141 +/remoll/SD/detect boundaryhits 7141 + +/remoll/SD/enable 7142 +/remoll/SD/detect lowenergyneutral 7142 +/remoll/SD/detect secondaries 7142 +/remoll/SD/detect boundaryhits 7142 + +/remoll/SD/enable 7144 +/remoll/SD/detect lowenergyneutral 7144 +/remoll/SD/detect secondaries 7144 +/remoll/SD/detect boundaryhits 7144 + +/remoll/SD/enable 7146 +/remoll/SD/detect lowenergyneutral 7146 +/remoll/SD/detect secondaries 7146 +/remoll/SD/detect boundaryhits 7146 + +/remoll/SD/enable 7148 +/remoll/SD/detect lowenergyneutral 7148 +/remoll/SD/detect secondaries 7148 +/remoll/SD/detect boundaryhits 7148 + +/remoll/filename /lustre19/expphy/volatile/halla/moller12gev/sudip/remoll_rootfiles/SM0821v3/sm_close14_SM0821v3_moller_50k_1001.root + +/run/beamOn 50000 diff --git a/macros/showermax/sm_open00_elastic_1001.mac b/macros/showermax/sm_open00_elastic_1001.mac new file mode 100644 index 000000000..15f952460 --- /dev/null +++ b/macros/showermax/sm_open00_elastic_1001.mac @@ -0,0 +1,56 @@ +/remoll/setgeofile geometry/mollerMother.gdml +/remoll/physlist/register QGSP_BERT_HP +/remoll/physlist/parallel/enable +/remoll/parallel/setfile geometry/mollerParallel.gdml + +/run/initialize +/control/execute macros/load_magnetic_fieldmaps.mac + +/remoll/evgen/set elastic + +/remoll/oldras false +/remoll/beam_corrph 0.02134 +/remoll/beam_corrth 0.02134 + +/remoll/beamene 11 GeV +/remoll/beamcurr 65 microampere + +/remoll/SD/disable_all +/remoll/SD/enable 28 +/remoll/SD/detect lowenergyneutral 28 +/remoll/SD/detect secondaries 28 +/remoll/SD/detect boundaryhits 28 + +/remoll/SD/enable 70 +/remoll/SD/detect lowenergyneutral 70 +/remoll/SD/detect secondaries 70 +/remoll/SD/detect boundaryhits 70 + +/remoll/SD/enable 7001 +/remoll/SD/detect lowenergyneutral 7001 +/remoll/SD/detect secondaries 7001 +/remoll/SD/detect boundaryhits 7001 + +/remoll/SD/enable 7002 +/remoll/SD/detect lowenergyneutral 7002 +/remoll/SD/detect secondaries 7002 +/remoll/SD/detect boundaryhits 7002 + +/remoll/SD/enable 7004 +/remoll/SD/detect lowenergyneutral 7004 +/remoll/SD/detect secondaries 7004 +/remoll/SD/detect boundaryhits 7004 + +/remoll/SD/enable 7006 +/remoll/SD/detect lowenergyneutral 7006 +/remoll/SD/detect secondaries 7006 +/remoll/SD/detect boundaryhits 7006 + +/remoll/SD/enable 7008 +/remoll/SD/detect lowenergyneutral 7008 +/remoll/SD/detect secondaries 7008 +/remoll/SD/detect boundaryhits 7008 + +/remoll/filename /lustre19/expphy/volatile/halla/moller12gev/sudip/remoll_rootfiles/SM0821v3/sm_open00_SM0821v3_elastic_50k_1001.root + +/run/beamOn 50000 diff --git a/macros/showermax/sm_open00_inelastic_1001.mac b/macros/showermax/sm_open00_inelastic_1001.mac new file mode 100644 index 000000000..e7f6c799d --- /dev/null +++ b/macros/showermax/sm_open00_inelastic_1001.mac @@ -0,0 +1,56 @@ +/remoll/setgeofile geometry/mollerMother.gdml +/remoll/physlist/register QGSP_BERT_HP +/remoll/physlist/parallel/enable +/remoll/parallel/setfile geometry/mollerParallel.gdml + +/run/initialize +/control/execute macros/load_magnetic_fieldmaps.mac + +/remoll/evgen/set inelastic + +/remoll/oldras false +/remoll/beam_corrph 0.02134 +/remoll/beam_corrth 0.02134 + +/remoll/beamene 11 GeV +/remoll/beamcurr 65 microampere + +/remoll/SD/disable_all +/remoll/SD/enable 28 +/remoll/SD/detect lowenergyneutral 28 +/remoll/SD/detect secondaries 28 +/remoll/SD/detect boundaryhits 28 + +/remoll/SD/enable 70 +/remoll/SD/detect lowenergyneutral 70 +/remoll/SD/detect secondaries 70 +/remoll/SD/detect boundaryhits 70 + +/remoll/SD/enable 7001 +/remoll/SD/detect lowenergyneutral 7001 +/remoll/SD/detect secondaries 7001 +/remoll/SD/detect boundaryhits 7001 + +/remoll/SD/enable 7002 +/remoll/SD/detect lowenergyneutral 7002 +/remoll/SD/detect secondaries 7002 +/remoll/SD/detect boundaryhits 7002 + +/remoll/SD/enable 7004 +/remoll/SD/detect lowenergyneutral 7004 +/remoll/SD/detect secondaries 7004 +/remoll/SD/detect boundaryhits 7004 + +/remoll/SD/enable 7006 +/remoll/SD/detect lowenergyneutral 7006 +/remoll/SD/detect secondaries 7006 +/remoll/SD/detect boundaryhits 7006 + +/remoll/SD/enable 7008 +/remoll/SD/detect lowenergyneutral 7008 +/remoll/SD/detect secondaries 7008 +/remoll/SD/detect boundaryhits 7008 + +/remoll/filename /lustre19/expphy/volatile/halla/moller12gev/sudip/remoll_rootfiles/SM0821v3/sm_open00_SM0821v3_inelastic_50k_1001.root + +/run/beamOn 50000 diff --git a/macros/showermax/sm_open00_moller_1001.mac b/macros/showermax/sm_open00_moller_1001.mac new file mode 100644 index 000000000..784a62943 --- /dev/null +++ b/macros/showermax/sm_open00_moller_1001.mac @@ -0,0 +1,56 @@ +/remoll/setgeofile geometry/mollerMother.gdml +/remoll/physlist/register QGSP_BERT_HP +/remoll/physlist/parallel/enable +/remoll/parallel/setfile geometry/mollerParallel.gdml + +/run/initialize +/control/execute macros/load_magnetic_fieldmaps.mac + +/remoll/evgen/set moller + +/remoll/oldras false +/remoll/beam_corrph 0.02134 +/remoll/beam_corrth 0.02134 + +/remoll/beamene 11 GeV +/remoll/beamcurr 65 microampere + +/remoll/SD/disable_all +/remoll/SD/enable 28 +/remoll/SD/detect lowenergyneutral 28 +/remoll/SD/detect secondaries 28 +/remoll/SD/detect boundaryhits 28 + +/remoll/SD/enable 70 +/remoll/SD/detect lowenergyneutral 70 +/remoll/SD/detect secondaries 70 +/remoll/SD/detect boundaryhits 70 + +/remoll/SD/enable 7001 +/remoll/SD/detect lowenergyneutral 7001 +/remoll/SD/detect secondaries 7001 +/remoll/SD/detect boundaryhits 7001 + +/remoll/SD/enable 7002 +/remoll/SD/detect lowenergyneutral 7002 +/remoll/SD/detect secondaries 7002 +/remoll/SD/detect boundaryhits 7002 + +/remoll/SD/enable 7004 +/remoll/SD/detect lowenergyneutral 7004 +/remoll/SD/detect secondaries 7004 +/remoll/SD/detect boundaryhits 7004 + +/remoll/SD/enable 7006 +/remoll/SD/detect lowenergyneutral 7006 +/remoll/SD/detect secondaries 7006 +/remoll/SD/detect boundaryhits 7006 + +/remoll/SD/enable 7008 +/remoll/SD/detect lowenergyneutral 7008 +/remoll/SD/detect secondaries 7008 +/remoll/SD/detect boundaryhits 7008 + +#/remoll/filename /lustre19/expphy/volatile/halla/moller12gev/sudip/remoll_rootfiles/SM0821v3/sm_open00_SM0821v3_moller_50k_1001.root + +/run/beamOn 10000 diff --git a/macros/showermax/sm_trans21_elastic_1001.mac b/macros/showermax/sm_trans21_elastic_1001.mac new file mode 100644 index 000000000..8dadff6e0 --- /dev/null +++ b/macros/showermax/sm_trans21_elastic_1001.mac @@ -0,0 +1,56 @@ +/remoll/setgeofile geometry/mollerMother.gdml +/remoll/physlist/register QGSP_BERT_HP +/remoll/physlist/parallel/enable +/remoll/parallel/setfile geometry/mollerParallel.gdml + +/run/initialize +/control/execute macros/load_magnetic_fieldmaps.mac + +/remoll/evgen/set elastic + +/remoll/oldras false +/remoll/beam_corrph 0.02134 +/remoll/beam_corrth 0.02134 + +/remoll/beamene 11 GeV +/remoll/beamcurr 65 microampere + +/remoll/SD/disable_all +/remoll/SD/enable 28 +/remoll/SD/detect lowenergyneutral 28 +/remoll/SD/detect secondaries 28 +/remoll/SD/detect boundaryhits 28 + +/remoll/SD/enable 70 +/remoll/SD/detect lowenergyneutral 70 +/remoll/SD/detect secondaries 70 +/remoll/SD/detect boundaryhits 70 + +/remoll/SD/enable 7211 +/remoll/SD/detect lowenergyneutral 7211 +/remoll/SD/detect secondaries 7211 +/remoll/SD/detect boundaryhits 7211 + +/remoll/SD/enable 7212 +/remoll/SD/detect lowenergyneutral 7212 +/remoll/SD/detect secondaries 7212 +/remoll/SD/detect boundaryhits 7212 + +/remoll/SD/enable 7214 +/remoll/SD/detect lowenergyneutral 7214 +/remoll/SD/detect secondaries 7214 +/remoll/SD/detect boundaryhits 7214 + +/remoll/SD/enable 7216 +/remoll/SD/detect lowenergyneutral 7216 +/remoll/SD/detect secondaries 7216 +/remoll/SD/detect boundaryhits 7216 + +/remoll/SD/enable 7218 +/remoll/SD/detect lowenergyneutral 7218 +/remoll/SD/detect secondaries 7218 +/remoll/SD/detect boundaryhits 7218 + +/remoll/filename /lustre19/expphy/volatile/halla/moller12gev/sudip/remoll_rootfiles/SM0821v3/sm_trans21_SM0821v3_elastic_50k_1001.root + +/run/beamOn 50000 diff --git a/macros/showermax/sm_trans21_inelastic_1001.mac b/macros/showermax/sm_trans21_inelastic_1001.mac new file mode 100644 index 000000000..9291702b6 --- /dev/null +++ b/macros/showermax/sm_trans21_inelastic_1001.mac @@ -0,0 +1,56 @@ +/remoll/setgeofile geometry/mollerMother.gdml +/remoll/physlist/register QGSP_BERT_HP +/remoll/physlist/parallel/enable +/remoll/parallel/setfile geometry/mollerParallel.gdml + +/run/initialize +/control/execute macros/load_magnetic_fieldmaps.mac + +/remoll/evgen/set inelastic + +/remoll/oldras false +/remoll/beam_corrph 0.02134 +/remoll/beam_corrth 0.02134 + +/remoll/beamene 11 GeV +/remoll/beamcurr 65 microampere + +/remoll/SD/disable_all +/remoll/SD/enable 28 +/remoll/SD/detect lowenergyneutral 28 +/remoll/SD/detect secondaries 28 +/remoll/SD/detect boundaryhits 28 + +/remoll/SD/enable 70 +/remoll/SD/detect lowenergyneutral 70 +/remoll/SD/detect secondaries 70 +/remoll/SD/detect boundaryhits 70 + +/remoll/SD/enable 7211 +/remoll/SD/detect lowenergyneutral 7211 +/remoll/SD/detect secondaries 7211 +/remoll/SD/detect boundaryhits 7211 + +/remoll/SD/enable 7212 +/remoll/SD/detect lowenergyneutral 7212 +/remoll/SD/detect secondaries 7212 +/remoll/SD/detect boundaryhits 7212 + +/remoll/SD/enable 7214 +/remoll/SD/detect lowenergyneutral 7214 +/remoll/SD/detect secondaries 7214 +/remoll/SD/detect boundaryhits 7214 + +/remoll/SD/enable 7216 +/remoll/SD/detect lowenergyneutral 7216 +/remoll/SD/detect secondaries 7216 +/remoll/SD/detect boundaryhits 7216 + +/remoll/SD/enable 7218 +/remoll/SD/detect lowenergyneutral 7218 +/remoll/SD/detect secondaries 7218 +/remoll/SD/detect boundaryhits 7218 + +/remoll/filename /lustre19/expphy/volatile/halla/moller12gev/sudip/remoll_rootfiles/SM0821v3/sm_trans21_SM0821v3_inelastic_50k_1001.root + +/run/beamOn 50000 diff --git a/macros/showermax/sm_trans21_moller_1001.mac b/macros/showermax/sm_trans21_moller_1001.mac new file mode 100644 index 000000000..a025e5ec9 --- /dev/null +++ b/macros/showermax/sm_trans21_moller_1001.mac @@ -0,0 +1,56 @@ +/remoll/setgeofile geometry/mollerMother.gdml +/remoll/physlist/register QGSP_BERT_HP +/remoll/physlist/parallel/enable +/remoll/parallel/setfile geometry/mollerParallel.gdml + +/run/initialize +/control/execute macros/load_magnetic_fieldmaps.mac + +/remoll/evgen/set moller + +/remoll/oldras false +/remoll/beam_corrph 0.02134 +/remoll/beam_corrth 0.02134 + +/remoll/beamene 11 GeV +/remoll/beamcurr 65 microampere + +/remoll/SD/disable_all +/remoll/SD/enable 28 +/remoll/SD/detect lowenergyneutral 28 +/remoll/SD/detect secondaries 28 +/remoll/SD/detect boundaryhits 28 + +/remoll/SD/enable 70 +/remoll/SD/detect lowenergyneutral 70 +/remoll/SD/detect secondaries 70 +/remoll/SD/detect boundaryhits 70 + +/remoll/SD/enable 7211 +/remoll/SD/detect lowenergyneutral 7211 +/remoll/SD/detect secondaries 7211 +/remoll/SD/detect boundaryhits 7211 + +/remoll/SD/enable 7212 +/remoll/SD/detect lowenergyneutral 7212 +/remoll/SD/detect secondaries 7212 +/remoll/SD/detect boundaryhits 7212 + +/remoll/SD/enable 7214 +/remoll/SD/detect lowenergyneutral 7214 +/remoll/SD/detect secondaries 7214 +/remoll/SD/detect boundaryhits 7214 + +/remoll/SD/enable 7216 +/remoll/SD/detect lowenergyneutral 7216 +/remoll/SD/detect secondaries 7216 +/remoll/SD/detect boundaryhits 7216 + +/remoll/SD/enable 7218 +/remoll/SD/detect lowenergyneutral 7218 +/remoll/SD/detect secondaries 7218 +/remoll/SD/detect boundaryhits 7218 + +/remoll/filename /lustre19/expphy/volatile/halla/moller12gev/sudip/remoll_rootfiles/SM0821v3/sm_trans21_SM0821v3_moller_50k_1001.root + +/run/beamOn 50000 From 1992e6ecf8d1c3dbddb6f4407b18f334845a7e0b Mon Sep 17 00:00:00 2001 From: sudipbhattarai Date: Mon, 13 Sep 2021 18:44:38 -0600 Subject: [PATCH 403/443] removed rootfile location dir in macros --- macros/showermax/sm_close14_elastic_1001.mac | 2 -- macros/showermax/sm_close14_inelastic_1001.mac | 2 -- macros/showermax/sm_close14_moller_1001.mac | 2 -- macros/showermax/sm_open00_elastic_1001.mac | 2 -- macros/showermax/sm_open00_inelastic_1001.mac | 2 -- macros/showermax/sm_open00_moller_1001.mac | 2 -- macros/showermax/sm_trans21_elastic_1001.mac | 2 -- macros/showermax/sm_trans21_inelastic_1001.mac | 2 -- macros/showermax/sm_trans21_moller_1001.mac | 2 -- 9 files changed, 18 deletions(-) diff --git a/macros/showermax/sm_close14_elastic_1001.mac b/macros/showermax/sm_close14_elastic_1001.mac index 82aed48a4..226c425b3 100644 --- a/macros/showermax/sm_close14_elastic_1001.mac +++ b/macros/showermax/sm_close14_elastic_1001.mac @@ -51,6 +51,4 @@ /remoll/SD/detect secondaries 7148 /remoll/SD/detect boundaryhits 7148 -/remoll/filename /lustre19/expphy/volatile/halla/moller12gev/sudip/remoll_rootfiles/SM0821v3/sm_close14_SM0821v3_elastic_50k_1001.root - /run/beamOn 50000 diff --git a/macros/showermax/sm_close14_inelastic_1001.mac b/macros/showermax/sm_close14_inelastic_1001.mac index 0497affcc..8aaffaa2c 100644 --- a/macros/showermax/sm_close14_inelastic_1001.mac +++ b/macros/showermax/sm_close14_inelastic_1001.mac @@ -51,6 +51,4 @@ /remoll/SD/detect secondaries 7148 /remoll/SD/detect boundaryhits 7148 -/remoll/filename /lustre19/expphy/volatile/halla/moller12gev/sudip/remoll_rootfiles/SM0821v3/sm_close14_SM0821v3_inelastic_50k_1001.root - /run/beamOn 50000 diff --git a/macros/showermax/sm_close14_moller_1001.mac b/macros/showermax/sm_close14_moller_1001.mac index 9a83f22a4..165deb2f7 100644 --- a/macros/showermax/sm_close14_moller_1001.mac +++ b/macros/showermax/sm_close14_moller_1001.mac @@ -51,6 +51,4 @@ /remoll/SD/detect secondaries 7148 /remoll/SD/detect boundaryhits 7148 -/remoll/filename /lustre19/expphy/volatile/halla/moller12gev/sudip/remoll_rootfiles/SM0821v3/sm_close14_SM0821v3_moller_50k_1001.root - /run/beamOn 50000 diff --git a/macros/showermax/sm_open00_elastic_1001.mac b/macros/showermax/sm_open00_elastic_1001.mac index 15f952460..1eb7560ad 100644 --- a/macros/showermax/sm_open00_elastic_1001.mac +++ b/macros/showermax/sm_open00_elastic_1001.mac @@ -51,6 +51,4 @@ /remoll/SD/detect secondaries 7008 /remoll/SD/detect boundaryhits 7008 -/remoll/filename /lustre19/expphy/volatile/halla/moller12gev/sudip/remoll_rootfiles/SM0821v3/sm_open00_SM0821v3_elastic_50k_1001.root - /run/beamOn 50000 diff --git a/macros/showermax/sm_open00_inelastic_1001.mac b/macros/showermax/sm_open00_inelastic_1001.mac index e7f6c799d..006710f29 100644 --- a/macros/showermax/sm_open00_inelastic_1001.mac +++ b/macros/showermax/sm_open00_inelastic_1001.mac @@ -51,6 +51,4 @@ /remoll/SD/detect secondaries 7008 /remoll/SD/detect boundaryhits 7008 -/remoll/filename /lustre19/expphy/volatile/halla/moller12gev/sudip/remoll_rootfiles/SM0821v3/sm_open00_SM0821v3_inelastic_50k_1001.root - /run/beamOn 50000 diff --git a/macros/showermax/sm_open00_moller_1001.mac b/macros/showermax/sm_open00_moller_1001.mac index 784a62943..e43edea0a 100644 --- a/macros/showermax/sm_open00_moller_1001.mac +++ b/macros/showermax/sm_open00_moller_1001.mac @@ -51,6 +51,4 @@ /remoll/SD/detect secondaries 7008 /remoll/SD/detect boundaryhits 7008 -#/remoll/filename /lustre19/expphy/volatile/halla/moller12gev/sudip/remoll_rootfiles/SM0821v3/sm_open00_SM0821v3_moller_50k_1001.root - /run/beamOn 10000 diff --git a/macros/showermax/sm_trans21_elastic_1001.mac b/macros/showermax/sm_trans21_elastic_1001.mac index 8dadff6e0..5b5ec9b04 100644 --- a/macros/showermax/sm_trans21_elastic_1001.mac +++ b/macros/showermax/sm_trans21_elastic_1001.mac @@ -51,6 +51,4 @@ /remoll/SD/detect secondaries 7218 /remoll/SD/detect boundaryhits 7218 -/remoll/filename /lustre19/expphy/volatile/halla/moller12gev/sudip/remoll_rootfiles/SM0821v3/sm_trans21_SM0821v3_elastic_50k_1001.root - /run/beamOn 50000 diff --git a/macros/showermax/sm_trans21_inelastic_1001.mac b/macros/showermax/sm_trans21_inelastic_1001.mac index 9291702b6..8f188e715 100644 --- a/macros/showermax/sm_trans21_inelastic_1001.mac +++ b/macros/showermax/sm_trans21_inelastic_1001.mac @@ -51,6 +51,4 @@ /remoll/SD/detect secondaries 7218 /remoll/SD/detect boundaryhits 7218 -/remoll/filename /lustre19/expphy/volatile/halla/moller12gev/sudip/remoll_rootfiles/SM0821v3/sm_trans21_SM0821v3_inelastic_50k_1001.root - /run/beamOn 50000 diff --git a/macros/showermax/sm_trans21_moller_1001.mac b/macros/showermax/sm_trans21_moller_1001.mac index a025e5ec9..677b4a21c 100644 --- a/macros/showermax/sm_trans21_moller_1001.mac +++ b/macros/showermax/sm_trans21_moller_1001.mac @@ -51,6 +51,4 @@ /remoll/SD/detect secondaries 7218 /remoll/SD/detect boundaryhits 7218 -/remoll/filename /lustre19/expphy/volatile/halla/moller12gev/sudip/remoll_rootfiles/SM0821v3/sm_trans21_SM0821v3_moller_50k_1001.root - /run/beamOn 50000 From c4364d45f3f2a30373eb909634a4f4634201a736 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 16 Sep 2021 23:17:55 -0500 Subject: [PATCH 404/443] Include "." at top of macro search path --- remoll.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/remoll.cc b/remoll.cc index a6fc5c22a..4651863fb 100644 --- a/remoll.cc +++ b/remoll.cc @@ -193,7 +193,8 @@ int main(int argc, char** argv) { // Define UI session for interactive mode - G4String searchpath = std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll"; + G4String searchpath = "."; + searchpath += ":" + std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll"; searchpath += ":" + std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/macros"; if (macro.size()) { From 58d71c9da1de5e4772d8b31df01c99c4209d63d9 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 17 Sep 2021 17:12:32 -0500 Subject: [PATCH 405/443] Workflow: build against LCG on CVMFS --- .github/workflows/build-lcg-cvmfs.yml | 58 +++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/build-lcg-cvmfs.yml diff --git a/.github/workflows/build-lcg-cvmfs.yml b/.github/workflows/build-lcg-cvmfs.yml new file mode 100644 index 000000000..1d3f0eaf1 --- /dev/null +++ b/.github/workflows/build-lcg-cvmfs.yml @@ -0,0 +1,58 @@ +name: Build LCG on CVMFS + +on: [push, pull_request] + +jobs: + linux: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + LCG: ["LCG_101/x86_64-centos7-clang12-opt", + "LCG_101/x86_64-centos7-gcc11-opt", + "LCG_101/x86_64-centos7-gcc10-opt", + "LCG_101/x86_64-centos7-gcc9-opt", + "LCG_101/x86_64-centos8-gcc11-opt", + "LCG_101/x86_64-ubuntu2004-gcc9-opt", + "LCG_100/x86_64-centos7-clang11-opt", + "LCG_100/x86_64-centos7-gcc10-opt", + "LCG_100/x86_64-centos7-gcc9-opt", + "LCG_100/x86_64-centos7-gcc8-opt", + "LCG_100/x86_64-centos8-gcc10-opt", + "LCG_100/x86_64-ubuntu2004-gcc9-opt", + "LCG_99/x86_64-centos7-clang10-opt", + "LCG_99/x86_64-centos7-gcc10-opt", + "LCG_99/x86_64-centos7-gcc8-opt", + "LCG_99/x86_64-centos8-gcc10-opt", + "LCG_99/x86_64-ubuntu2004-gcc9-opt"] + steps: + - uses: actions/checkout@v2 + - uses: cvmfs-contrib/github-action-cvmfs@v2 + with: + cvmfs_repositories: 'sft.cern.ch,geant4.cern.ch' + - uses: aidasoft/run-lcg-view@v1 + with: + release-platform: ${{ matrix.LCG }} + run: | + cmake -Bbuild -S. + cmake --build build + + macos: + runs-on: macos-latest + strategy: + matrix: + LCG: ["LCG_101/x86_64-mac11-clang120-opt", + "LCG_101/x86_64-mac1015-clang120-opt", + "LCG_100/x86_64-mac1015-clang120-opt", + "LCG_99/x86_64-mac1015-clang120-opt"] + steps: + - uses: actions/checkout@v2 + - uses: cvmfs-contrib/github-action-cvmfs@v2 + with: + cvmfs_repositories: 'sft.cern.ch,geant4.cern.ch' + - uses: aidasoft/run-lcg-view@v1 + with: + release-platform: ${{ matrix.LCG }} + run: | + cmake -Bbuild -S. + cmake --build build From 8e95217b89119890dab0f4ca4eec84b7c5544dfb Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 17 Sep 2021 17:16:46 -0500 Subject: [PATCH 406/443] remove LCG_100/x86_64-centos7-gcc8-opt --- .github/workflows/build-lcg-cvmfs.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-lcg-cvmfs.yml b/.github/workflows/build-lcg-cvmfs.yml index 1d3f0eaf1..ce74d2a0b 100644 --- a/.github/workflows/build-lcg-cvmfs.yml +++ b/.github/workflows/build-lcg-cvmfs.yml @@ -11,7 +11,6 @@ jobs: LCG: ["LCG_101/x86_64-centos7-clang12-opt", "LCG_101/x86_64-centos7-gcc11-opt", "LCG_101/x86_64-centos7-gcc10-opt", - "LCG_101/x86_64-centos7-gcc9-opt", "LCG_101/x86_64-centos8-gcc11-opt", "LCG_101/x86_64-ubuntu2004-gcc9-opt", "LCG_100/x86_64-centos7-clang11-opt", From 7a4d663b6c7be0fb6c3c12329a36931505f6a323 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 17 Sep 2021 17:29:21 -0500 Subject: [PATCH 407/443] Workflows: build against LCG and test --- .github/workflows/build-lcg-and-test.yml | 49 ++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/build-lcg-and-test.yml diff --git a/.github/workflows/build-lcg-and-test.yml b/.github/workflows/build-lcg-and-test.yml new file mode 100644 index 000000000..7b7d1fb3a --- /dev/null +++ b/.github/workflows/build-lcg-and-test.yml @@ -0,0 +1,49 @@ +name: Build and Test + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + env: + LCG: "LCG_101/x86_64-centos7-clang12-opt" + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v2 + - uses: cvmfs-contrib/github-action-cvmfs@v2 + with: + cvmfs_repositories: 'sft.cern.ch,geant4.cern.ch' + - uses: aidasoft/run-lcg-view@v1 + with: + release-platform: ${{ env.LCG }} + run: | + cmake -Bbuild -S. + cmake --build build + + test_geometries: + runs-on: ubuntu-latest + needs: build + strategy: + fail-fast: false + matrix: + suite: ["load", "validate", "overlap"] + steps: + - run: | + mkdir -p logfiles rootfiles + scripts/tests/test_geometries.sh ${{ matrix.suite }} + ls -al logfiles rootfiles + + test_macros: + runs-on: ubuntu-latest + needs: build + strategy: + fail-fast: false + matrix: + suite: ["unit", "commit", "release"] + steps: + - run: | + mkdir -p logfiles rootfiles + scripts/tests/test_macros.sh ${{ matrix.suite }} + ls -al logfiles rootfiles + From ebc8c8a5bd5a4279dc98f1cd73897d6c6ca8eccc Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 17 Sep 2021 17:36:11 -0500 Subject: [PATCH 408/443] Include unistd in remollParallelConstruction --- src/remollParallelConstruction.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/remollParallelConstruction.cc b/src/remollParallelConstruction.cc index 80efced9e..8d71ae2d1 100644 --- a/src/remollParallelConstruction.cc +++ b/src/remollParallelConstruction.cc @@ -14,6 +14,10 @@ #include "remollGenericDetector.hh" #include "remollIO.hh" +#ifdef __APPLE__ +#include +#endif + //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... remollParallelConstruction::remollParallelConstruction(const G4String& name, const G4String& gdmlfile) : G4VUserParallelWorld(name), From 75eaa50ae0f24d078652b20629a52417e9f3cafe Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 17 Sep 2021 17:36:51 -0500 Subject: [PATCH 409/443] Include unistd in remollDetectorConstruction --- src/remollDetectorConstruction.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/remollDetectorConstruction.cc b/src/remollDetectorConstruction.cc index 7210ff567..99c34163c 100644 --- a/src/remollDetectorConstruction.cc +++ b/src/remollDetectorConstruction.cc @@ -42,6 +42,10 @@ #include #include +#ifdef __APPLE__ +#include +#endif + #include "G4Threading.hh" #include "G4AutoLock.hh" namespace { G4Mutex remollDetectorConstructionMutex = G4MUTEX_INITIALIZER; } From 88ef6e1b5f95ff4a826cbfcf92245a28f3610856 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 17 Sep 2021 17:37:29 -0500 Subject: [PATCH 410/443] Include unistd in remollIO --- src/remollIO.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/remollIO.cc b/src/remollIO.cc index 4c3465d67..c956a1477 100644 --- a/src/remollIO.cc +++ b/src/remollIO.cc @@ -19,6 +19,10 @@ #include #include +#ifdef __APPLE__ +#include +#endif + #include #include #include From 70d9e115db73625eca8486f8fa8bbb8891918255 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 17 Sep 2021 18:53:36 -0500 Subject: [PATCH 411/443] Remove LCG 100 --- .github/workflows/build-lcg-cvmfs.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/build-lcg-cvmfs.yml b/.github/workflows/build-lcg-cvmfs.yml index ce74d2a0b..b0e14ee83 100644 --- a/.github/workflows/build-lcg-cvmfs.yml +++ b/.github/workflows/build-lcg-cvmfs.yml @@ -13,12 +13,6 @@ jobs: "LCG_101/x86_64-centos7-gcc10-opt", "LCG_101/x86_64-centos8-gcc11-opt", "LCG_101/x86_64-ubuntu2004-gcc9-opt", - "LCG_100/x86_64-centos7-clang11-opt", - "LCG_100/x86_64-centos7-gcc10-opt", - "LCG_100/x86_64-centos7-gcc9-opt", - "LCG_100/x86_64-centos7-gcc8-opt", - "LCG_100/x86_64-centos8-gcc10-opt", - "LCG_100/x86_64-ubuntu2004-gcc9-opt", "LCG_99/x86_64-centos7-clang10-opt", "LCG_99/x86_64-centos7-gcc10-opt", "LCG_99/x86_64-centos7-gcc8-opt", @@ -42,7 +36,6 @@ jobs: matrix: LCG: ["LCG_101/x86_64-mac11-clang120-opt", "LCG_101/x86_64-mac1015-clang120-opt", - "LCG_100/x86_64-mac1015-clang120-opt", "LCG_99/x86_64-mac1015-clang120-opt"] steps: - uses: actions/checkout@v2 From 5ca062c35f65e72fffe7a1c0b3cee26e69bff33f Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 17 Sep 2021 19:18:07 -0500 Subject: [PATCH 412/443] Enable tests again --- .github/workflows/build-lcg-and-test.yml | 54 ++++++++++++++++++++---- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-lcg-and-test.yml b/.github/workflows/build-lcg-and-test.yml index 7b7d1fb3a..28f8003b9 100644 --- a/.github/workflows/build-lcg-and-test.yml +++ b/.github/workflows/build-lcg-and-test.yml @@ -1,12 +1,13 @@ -name: Build and Test +name: Build LCG and Test on: [push, pull_request] +env: + LCG: "LCG_101/x86_64-centos7-clang12-opt" + jobs: build: runs-on: ubuntu-latest - env: - LCG: "LCG_101/x86_64-centos7-clang12-opt" strategy: fail-fast: false steps: @@ -18,9 +19,15 @@ jobs: with: release-platform: ${{ env.LCG }} run: | - cmake -Bbuild -S. - cmake --build build - + cmake -Bbuild -S. -DCMAKE_INSTALL_PREFIX=install/ + cmake --build build + cmake --build build --target install + - uses: actions/upload-artifact@v2 + with: + name: ${{ env.LCG }} + path: install/ + retention-days: 7 + test_geometries: runs-on: ubuntu-latest needs: build @@ -29,10 +36,25 @@ jobs: matrix: suite: ["load", "validate", "overlap"] steps: - - run: | + - uses: cvmfs-contrib/github-action-cvmfs@v2 + with: + cvmfs_repositories: 'sft.cern.ch,geant4.cern.ch' + - uses: actions/download-artifact@v2 + with: + name: ${{ env.LCG }} + - uses: aidasoft/run-lcg-view@v1 + with: + release-platform: ${{ env.LCG }} + run: | mkdir -p logfiles rootfiles scripts/tests/test_geometries.sh ${{ matrix.suite }} ls -al logfiles rootfiles + - uses: actions/upload-artifact@v2 + with: + name: test_geometries_${{ matrix.suite }}_logfiles + path: | + logfiles/ + retention-days: 3 test_macros: runs-on: ubuntu-latest @@ -42,8 +64,22 @@ jobs: matrix: suite: ["unit", "commit", "release"] steps: - - run: | + - uses: cvmfs-contrib/github-action-cvmfs@v2 + with: + cvmfs_repositories: 'sft.cern.ch,geant4.cern.ch' + - uses: actions/download-artifact@v2 + with: + name: ${{ env.LCG }} + - uses: aidasoft/run-lcg-view@v1 + with: + release-platform: ${{ env.LCG }} + run: | mkdir -p logfiles rootfiles scripts/tests/test_macros.sh ${{ matrix.suite }} ls -al logfiles rootfiles - + - uses: actions/upload-artifact@v2 + with: + name: test_macros_${{ matrix.suite }}_logfiles + path: | + logfiles/ + retention-days: 3 From 1a18dab9bc5b29e7554e5348f64df502352ddbba Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 17 Sep 2021 19:26:54 -0500 Subject: [PATCH 413/443] Fix for mac: include vector --- include/remollSearchPath.hh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/remollSearchPath.hh b/include/remollSearchPath.hh index 43e12d502..f28c9b88f 100644 --- a/include/remollSearchPath.hh +++ b/include/remollSearchPath.hh @@ -18,8 +18,6 @@ Usage: -------------------------------------------------------------------------------------------- */ -#include - #if defined(__cpp_lib_filesystem) #include namespace fs = std::filesystem; @@ -33,8 +31,12 @@ namespace fs = boost::filesystem; #define NO_FS_SUPPORT #endif +#include #include +#ifdef __APPLE__ +#include +#endif class remollSearchPath { From dbd55da4c54098c438e744e2adae670f8cfb88a8 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 17 Sep 2021 19:35:57 -0500 Subject: [PATCH 414/443] Artifacts without / --- .github/workflows/build-lcg-and-test.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-lcg-and-test.yml b/.github/workflows/build-lcg-and-test.yml index 28f8003b9..66c8502d6 100644 --- a/.github/workflows/build-lcg-and-test.yml +++ b/.github/workflows/build-lcg-and-test.yml @@ -3,7 +3,8 @@ name: Build LCG and Test on: [push, pull_request] env: - LCG: "LCG_101/x86_64-centos7-clang12-opt" + LCG: "LCG_101" + sys: "x86_64-centos7-clang12-opt" jobs: build: @@ -17,14 +18,14 @@ jobs: cvmfs_repositories: 'sft.cern.ch,geant4.cern.ch' - uses: aidasoft/run-lcg-view@v1 with: - release-platform: ${{ env.LCG }} + release-platform: ${{ env.LCG }}/${{ env.sys }} run: | cmake -Bbuild -S. -DCMAKE_INSTALL_PREFIX=install/ cmake --build build cmake --build build --target install - uses: actions/upload-artifact@v2 with: - name: ${{ env.LCG }} + name: ${{ env.LCG }}-${{ env.sys }} path: install/ retention-days: 7 @@ -41,10 +42,10 @@ jobs: cvmfs_repositories: 'sft.cern.ch,geant4.cern.ch' - uses: actions/download-artifact@v2 with: - name: ${{ env.LCG }} + name: ${{ env.LCG }}-${{ env.sys }} - uses: aidasoft/run-lcg-view@v1 with: - release-platform: ${{ env.LCG }} + release-platform: ${{ env.LCG }}/${{ env.sys }} run: | mkdir -p logfiles rootfiles scripts/tests/test_geometries.sh ${{ matrix.suite }} @@ -69,10 +70,10 @@ jobs: cvmfs_repositories: 'sft.cern.ch,geant4.cern.ch' - uses: actions/download-artifact@v2 with: - name: ${{ env.LCG }} + name: ${{ env.LCG }}-${{ env.sys }} - uses: aidasoft/run-lcg-view@v1 with: - release-platform: ${{ env.LCG }} + release-platform: ${{ env.LCG }}/${{ env.sys }} run: | mkdir -p logfiles rootfiles scripts/tests/test_macros.sh ${{ matrix.suite }} From bf702c906954da8be38551b25e296df0441a4563 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 17 Sep 2021 19:42:01 -0500 Subject: [PATCH 415/443] Missing semicolon --- src/remollPrimaryGeneratorAction.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/remollPrimaryGeneratorAction.cc b/src/remollPrimaryGeneratorAction.cc index de2d4c591..3850472ae 100644 --- a/src/remollPrimaryGeneratorAction.cc +++ b/src/remollPrimaryGeneratorAction.cc @@ -68,7 +68,7 @@ remollPrimaryGeneratorAction::remollPrimaryGeneratorAction() #ifdef G4LIB_USE_HEPMC fPriGenMap["hepmcAscii"] = new HepMCG4AsciiInterface(); #ifdef G4LIB_USE_PYTHIA - fPriGenMap["hepmcPythia"] = new HepMCG4PythiaInterface() + fPriGenMap["hepmcPythia"] = new HepMCG4PythiaInterface(); #endif #endif From 1a14c1b820eb7bacff63039fb0b092776c9c6903 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 17 Sep 2021 20:07:57 -0500 Subject: [PATCH 416/443] Avoid get_current_dir_name outside of GNU systems --- src/remollSearchPath.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/remollSearchPath.cc b/src/remollSearchPath.cc index 4bb1243bb..c83e35b78 100644 --- a/src/remollSearchPath.cc +++ b/src/remollSearchPath.cc @@ -1,11 +1,21 @@ #include "remollSearchPath.hh" +#include + remollSearchPath* remollSearchPath::fInstance = nullptr; remollSearchPath::remollSearchPath() { // add CMAKE_INSTALL_FULL_DATADIR, CMAKE_INSTALL_PREFIX and CWD to search path #ifndef NO_FS_SUPPORT + #ifdef _GNU_SOURCE fSearchPath.push_back(fs::path(get_current_dir_name())); + #else + char* dir = (char*) malloc(PATH_MAX * sizeof(char)); + if (getcwd(dir, PATH_MAX) != nullptr) { + fSearchPath.push_back(fs::path(dir)); + free(dir); + } + #endif fSearchPath.push_back(fs::path(CMAKE_INSTALL_PREFIX)); fSearchPath.push_back(fs::path(CMAKE_INSTALL_FULL_DATADIR)); #endif From 1a483abd2b8f55a0a6ac2d433f96738966f3d411 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 17 Sep 2021 20:11:57 -0500 Subject: [PATCH 417/443] Checkout in test jobs --- .github/workflows/build-lcg-and-test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-lcg-and-test.yml b/.github/workflows/build-lcg-and-test.yml index 66c8502d6..cf2cd0cb6 100644 --- a/.github/workflows/build-lcg-and-test.yml +++ b/.github/workflows/build-lcg-and-test.yml @@ -37,6 +37,7 @@ jobs: matrix: suite: ["load", "validate", "overlap"] steps: + - uses: actions/checkout@v2 - uses: cvmfs-contrib/github-action-cvmfs@v2 with: cvmfs_repositories: 'sft.cern.ch,geant4.cern.ch' @@ -65,6 +66,7 @@ jobs: matrix: suite: ["unit", "commit", "release"] steps: + - uses: actions/checkout@v2 - uses: cvmfs-contrib/github-action-cvmfs@v2 with: cvmfs_repositories: 'sft.cern.ch,geant4.cern.ch' From 15382258b3679e08d3f660317ead676d7cb7c91e Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 17 Sep 2021 20:36:17 -0500 Subject: [PATCH 418/443] source install/bin/remoll.sh --- .github/workflows/build-lcg-and-test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build-lcg-and-test.yml b/.github/workflows/build-lcg-and-test.yml index cf2cd0cb6..2e4783f81 100644 --- a/.github/workflows/build-lcg-and-test.yml +++ b/.github/workflows/build-lcg-and-test.yml @@ -44,11 +44,13 @@ jobs: - uses: actions/download-artifact@v2 with: name: ${{ env.LCG }}-${{ env.sys }} + path: install/ - uses: aidasoft/run-lcg-view@v1 with: release-platform: ${{ env.LCG }}/${{ env.sys }} run: | mkdir -p logfiles rootfiles + source install/bin/remoll.sh scripts/tests/test_geometries.sh ${{ matrix.suite }} ls -al logfiles rootfiles - uses: actions/upload-artifact@v2 @@ -73,11 +75,13 @@ jobs: - uses: actions/download-artifact@v2 with: name: ${{ env.LCG }}-${{ env.sys }} + path: install/ - uses: aidasoft/run-lcg-view@v1 with: release-platform: ${{ env.LCG }}/${{ env.sys }} run: | mkdir -p logfiles rootfiles + source install/bin/remoll.sh scripts/tests/test_macros.sh ${{ matrix.suite }} ls -al logfiles rootfiles - uses: actions/upload-artifact@v2 From f7a58aa9e7b933cbb6007a499eb95386cbba03f7 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 17 Sep 2021 21:03:01 -0500 Subject: [PATCH 419/443] Preserve permissions with tar workaround --- .github/workflows/build-lcg-and-test.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-lcg-and-test.yml b/.github/workflows/build-lcg-and-test.yml index 2e4783f81..5cf998084 100644 --- a/.github/workflows/build-lcg-and-test.yml +++ b/.github/workflows/build-lcg-and-test.yml @@ -23,11 +23,13 @@ jobs: cmake -Bbuild -S. -DCMAKE_INSTALL_PREFIX=install/ cmake --build build cmake --build build --target install + - run: | + tar -cvf install.tar install/ - uses: actions/upload-artifact@v2 with: name: ${{ env.LCG }}-${{ env.sys }} - path: install/ - retention-days: 7 + path: install.tar + retention-days: 1 test_geometries: runs-on: ubuntu-latest @@ -44,7 +46,9 @@ jobs: - uses: actions/download-artifact@v2 with: name: ${{ env.LCG }}-${{ env.sys }} - path: install/ + path: install.tar + - run: | + tar -xvf install.tar - uses: aidasoft/run-lcg-view@v1 with: release-platform: ${{ env.LCG }}/${{ env.sys }} @@ -75,7 +79,9 @@ jobs: - uses: actions/download-artifact@v2 with: name: ${{ env.LCG }}-${{ env.sys }} - path: install/ + path: install.tar + - run: | + tar -xvf install.tar - uses: aidasoft/run-lcg-view@v1 with: release-platform: ${{ env.LCG }}/${{ env.sys }} From a95f306aa98ad9291874e7dc3d40880847340bb0 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 17 Sep 2021 21:13:03 -0500 Subject: [PATCH 420/443] path is directory --- .github/workflows/build-lcg-and-test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build-lcg-and-test.yml b/.github/workflows/build-lcg-and-test.yml index 5cf998084..cf4a35145 100644 --- a/.github/workflows/build-lcg-and-test.yml +++ b/.github/workflows/build-lcg-and-test.yml @@ -46,7 +46,6 @@ jobs: - uses: actions/download-artifact@v2 with: name: ${{ env.LCG }}-${{ env.sys }} - path: install.tar - run: | tar -xvf install.tar - uses: aidasoft/run-lcg-view@v1 @@ -79,7 +78,6 @@ jobs: - uses: actions/download-artifact@v2 with: name: ${{ env.LCG }}-${{ env.sys }} - path: install.tar - run: | tar -xvf install.tar - uses: aidasoft/run-lcg-view@v1 From cd9647899bd01cf2e2be02312d30009098cef353 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 17 Sep 2021 21:41:09 -0500 Subject: [PATCH 421/443] Typo --- include/remollGenericDetectorHit.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/remollGenericDetectorHit.hh b/include/remollGenericDetectorHit.hh index 2b9abac0d..01c728f2f 100644 --- a/include/remollGenericDetectorHit.hh +++ b/include/remollGenericDetectorHit.hh @@ -92,7 +92,7 @@ class remollGenericDetectorHit : public G4VHit { hit.e = fE; hit.m = fM; hit.k = fK; - hit.beta = fBeta;.cc + hit.beta = fBeta; hit.edep = fEdep; return hit; }; From 56cd9946f36fb5ec1efda6e54099b75d8bf3367b Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 17 Sep 2021 22:06:08 -0500 Subject: [PATCH 422/443] Typo --- include/remolltypes.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/remolltypes.hh b/include/remolltypes.hh index 6dcc80505..f511e63b1 100644 --- a/include/remolltypes.hh +++ b/include/remolltypes.hh @@ -12,7 +12,7 @@ //#include //#endif -#define __RUNSTR_LEN 255 fBeta for hit +#define __RUNSTR_LEN 255 #define __MAXFILE_LEN 1048576 // MB file size limit #include "TTimeStamp.h" From 0a716d685fb159bb170700712989782b67ca9442 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 14 Oct 2021 13:26:37 -0500 Subject: [PATCH 423/443] return default vertex when no target volume specified --- src/remollBeamTarget.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/remollBeamTarget.cc b/src/remollBeamTarget.cc index 25ce85aac..b091a10a1 100644 --- a/src/remollBeamTarget.cc +++ b/src/remollBeamTarget.cc @@ -228,10 +228,13 @@ remollVertex remollBeamTarget::SampleVertex(SamplingType_t sampling_type) // No sampling required static bool sampling_type_has_been_warned = false; - if (sampling_type == kNoTargetVolume && ! sampling_type_has_been_warned) { - G4cerr << "ERROR: " << __PRETTY_FUNCTION__ << " line " << __LINE__ << ": " << - "kNoTargetVolume!" << G4endl; - sampling_type_has_been_warned = true; + if (sampling_type == kNoTargetVolume) { + if (! sampling_type_has_been_warned) { + G4cerr << "ERROR: " << __PRETTY_FUNCTION__ << " line " << __LINE__ << ": " << + "kNoTargetVolume!" << G4endl; + sampling_type_has_been_warned = true; + } + return vertex; } // Check if target mother volume exists From 35967457cc1ba4f245287ed146ae04dd395c56b5 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 14 Oct 2021 15:46:59 -0500 Subject: [PATCH 424/443] Load material G4_Galactic only when needed --- src/remollDetectorConstruction.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/remollDetectorConstruction.cc b/src/remollDetectorConstruction.cc index 99c34163c..d024fa0db 100644 --- a/src/remollDetectorConstruction.cc +++ b/src/remollDetectorConstruction.cc @@ -394,12 +394,12 @@ remollDetectorConstruction::~remollDetectorConstruction() void remollDetectorConstruction::AddMesh(const G4String& filename) { - G4Material* material = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic"); #ifdef __USE_CADMESH // Read mesh auto mesh = CADMesh::TessellatedMesh::FromSTL(filename); // Extract solids + G4Material* material = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic"); for (auto solid: mesh->GetSolids()) { auto lv = new G4LogicalVolume(solid, material, filename); lv->SetVisAttributes(G4Colour(0.0,1.0,0.0,1.0)); From 79127a9a013f260807a0e2f7d408117754a87e94 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 14 Oct 2021 16:11:28 -0500 Subject: [PATCH 425/443] Include fMS in remollBeamTarget as member, not pointer --- include/remollBeamTarget.hh | 8 ++++++-- include/remollMultScatt.hh | 2 +- src/remollBeamTarget.cc | 11 +++-------- src/remollGenpElastic.cc | 3 +-- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/include/remollBeamTarget.hh b/include/remollBeamTarget.hh index 4d3fcad47..cd66afe57 100644 --- a/include/remollBeamTarget.hh +++ b/include/remollBeamTarget.hh @@ -4,6 +4,7 @@ #include "remolltypes.hh" #include "remollglobs.hh" #include "remollVertex.hh" +#include "remollMultScatt.hh" #include "G4ThreeVector.hh" #include @@ -28,7 +29,6 @@ class G4GenericMessenger; class G4VPhysicalVolume; class G4Material; -class remollMultScatt; class remollBeamTarget { @@ -90,8 +90,12 @@ class remollBeamTarget { G4double fBeamCurrent; G4double fBeamPolarization; - remollMultScatt *fMS; + private: + remollMultScatt fMS; + public: + const remollMultScatt& GetMultScatt() const { return fMS; } + private: bool fAlreadyWarned; bool fAlreadyWarned_LH2; diff --git a/include/remollMultScatt.hh b/include/remollMultScatt.hh index f2af2b4aa..c242f5f14 100644 --- a/include/remollMultScatt.hh +++ b/include/remollMultScatt.hh @@ -90,7 +90,7 @@ class remollMultScatt { double GenerateMSPlane(double p, const std::tuple& m); double GenerateMSPlane(double p, const std::vector>& m); - double GetPDGTh(){ return fthpdg; } + double GetPDGTh() const { return fthpdg; } private: diff --git a/src/remollBeamTarget.cc b/src/remollBeamTarget.cc index b091a10a1..94c281838 100644 --- a/src/remollBeamTarget.cc +++ b/src/remollBeamTarget.cc @@ -20,7 +20,6 @@ #include "Randomize.hh" #include "remollBeamTarget.hh" -#include "remollMultScatt.hh" #include @@ -47,9 +46,6 @@ remollBeamTarget::remollBeamTarget() fX0(0.0),fY0(0.0),fTh0(0.0),fPh0(0.0), fdTh(0.0),fdPh(0.0),fCorrTh(0.0),fCorrPh(0.0) { - // Create new multiple scattering - fMS = new remollMultScatt(); - // Infrared energy cutoff fEnergyCut = 1e-6 * MeV; @@ -85,7 +81,6 @@ remollBeamTarget::~remollBeamTarget() { delete fMessengerTarget; delete fMessenger; - delete fMS; } G4double remollBeamTarget::GetEffLumin(SamplingType_t sampling_type) @@ -425,9 +420,9 @@ remollVertex remollBeamTarget::SampleVertex(SamplingType_t sampling_type) // Sample multiple scattering angles G4double msth = 0, msph = 0; if (ms.size() > 0) { - fMS->Init(fBeamEnergy, ms); - msth = fMS->GenerateMSPlane(); - msph = fMS->GenerateMSPlane(); + fMS.Init(fBeamEnergy, ms); + msth = fMS.GenerateMSPlane(); + msph = fMS.GenerateMSPlane(); } assert( !std::isnan(msth) && !std::isnan(msph) ); assert( !std::isinf(msth) && !std::isinf(msph) ); diff --git a/src/remollGenpElastic.cc b/src/remollGenpElastic.cc index 64fa57ad2..e713cc715 100644 --- a/src/remollGenpElastic.cc +++ b/src/remollGenpElastic.cc @@ -9,7 +9,6 @@ #include "remollEvent.hh" #include "remollVertex.hh" #include "remollBeamTarget.hh" -#include "remollMultScatt.hh" #include "remolltypes.hh" #include @@ -229,7 +228,7 @@ void remollGenpElastic::SamplePhysics(remollVertex *vert, remollEvent *evt){ // as anything less than three sigma of the characteristic // width - if( th < 3.0*fBeamTarg->fMS->GetPDGTh() ){ + if( th < 3.0*fBeamTarg->GetMultScatt().GetPDGTh() ){ sigma = 0.0; } From 1b9c102fcf2b6e12dc4db9c18b714b155d9a5cae Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 14 Oct 2021 17:10:08 -0500 Subject: [PATCH 426/443] BeamTarget as object in PrimaryGenerator, fewer pointers --- include/remollPrimaryGeneratorAction.hh | 5 +++-- src/remollPrimaryGeneratorAction.cc | 12 ++++-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/include/remollPrimaryGeneratorAction.hh b/include/remollPrimaryGeneratorAction.hh index 8b61e7224..fa36863bf 100644 --- a/include/remollPrimaryGeneratorAction.hh +++ b/include/remollPrimaryGeneratorAction.hh @@ -1,6 +1,8 @@ #ifndef remollPrimaryGeneratorAction_h #define remollPrimaryGeneratorAction_h 1 +#include "remollBeamTarget.hh" + #include "G4VUserPrimaryGeneratorAction.hh" #include "G4VPrimaryGenerator.hh" #include "G4String.hh" @@ -10,7 +12,6 @@ class G4GenericMessenger; class G4ParticleGun; class G4Event; -class remollBeamTarget; class remollVEventGen; class remollEvent; @@ -38,7 +39,7 @@ class remollPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction G4ParticleGun* fParticleGun; - remollBeamTarget *fBeamTarg; + remollBeamTarget fBeamTarg; remollEvent *fEvent; diff --git a/src/remollPrimaryGeneratorAction.cc b/src/remollPrimaryGeneratorAction.cc index 3850472ae..d36f916bf 100644 --- a/src/remollPrimaryGeneratorAction.cc +++ b/src/remollPrimaryGeneratorAction.cc @@ -35,7 +35,7 @@ #include "remollGenHyperon.hh" remollPrimaryGeneratorAction::remollPrimaryGeneratorAction() -: fEventGen(0),fPriGen(0),fParticleGun(0),fBeamTarg(0),fEvent(0),fMessenger(0),fEffCrossSection(0) +: fEventGen(0),fPriGen(0),fParticleGun(0),fEvent(0),fMessenger(0),fEffCrossSection(0) { static bool has_been_warned = false; if (! has_been_warned) { @@ -72,9 +72,6 @@ remollPrimaryGeneratorAction::remollPrimaryGeneratorAction() #endif #endif - // Create beam target - fBeamTarg = new remollBeamTarget(); - // Default generator G4String default_generator = "moller"; SetGenerator(default_generator); @@ -91,7 +88,6 @@ remollPrimaryGeneratorAction::~remollPrimaryGeneratorAction() fPriGenMap.clear(); if (fEvGenMessenger) delete fEvGenMessenger; if (fMessenger) delete fMessenger; - if (fBeamTarg) delete fBeamTarg; if (fEventGen) delete fEventGen; } @@ -131,7 +127,7 @@ void remollPrimaryGeneratorAction::SetGenerator(G4String& genname) // Set the beam target if (fEventGen) { - fEventGen->SetBeamTarget(fBeamTarg); + fEventGen->SetBeamTarget(&fBeamTarg); } } @@ -206,10 +202,10 @@ void remollPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) // Calculate rate SamplingType_t sampling_type = fEventGen->GetSamplingType(); if (fEvent->fRate == 0) { // If the rate is set to 0 then calculate it using the cross section - fEvent->fRate = fEvent->fEffXs * fBeamTarg->GetEffLumin(sampling_type) / nthrown; + fEvent->fRate = fEvent->fEffXs * fBeamTarg.GetEffLumin(sampling_type) / nthrown; } else { // For LUND - calculate rate and cross section - fEvent->fEffXs = fEvent->fRate * nthrown / fBeamTarg->GetEffLumin(sampling_type); + fEvent->fEffXs = fEvent->fRate * nthrown / fBeamTarg.GetEffLumin(sampling_type); fEvent->fRate = fEvent->fRate / nthrown; } From 25a9b681be8901bed18fa8a6c2b614c868db9195 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 14 Oct 2021 18:14:11 -0500 Subject: [PATCH 427/443] Turn most messenger pointers into objects --- include/remollBeamTarget.hh | 12 ++- include/remollDetectorConstruction.hh | 25 ++++-- include/remollGlobalField.hh | 14 +++- include/remollIO.hh | 5 +- include/remollParallelConstruction.hh | 11 ++- include/remollPhysicsList.hh | 23 ++++-- include/remollPrimaryGeneratorAction.hh | 14 ++-- include/remollRunAction.hh | 16 ++-- include/remollTrackingAction.hh | 14 ++-- include/remollVEventGen.hh | 9 ++- src/remollBeamTarget.cc | 45 +++++------ src/remollDetectorConstruction.cc | 100 +++++++++--------------- src/remollGenBeam.cc | 77 +++++++++--------- src/remollGenExternal.cc | 10 +-- src/remollGenHyperon.cc | 15 ++-- src/remollGenLUND.cc | 3 +- src/remollGenPion.cc | 5 +- src/remollGlobalField.cc | 38 ++++----- src/remollIO.cc | 7 +- src/remollParallelConstruction.cc | 36 +++------ src/remollPhysicsList.cc | 45 +++-------- src/remollPrimaryGeneratorAction.cc | 57 ++++++-------- src/remollRunAction.cc | 23 ++---- src/remollSteppingAction.cc | 1 - src/remollTrackingAction.cc | 10 +-- src/remollVEventGen.cc | 32 +++----- 26 files changed, 288 insertions(+), 359 deletions(-) diff --git a/include/remollBeamTarget.hh b/include/remollBeamTarget.hh index 4d3fcad47..051224642 100644 --- a/include/remollBeamTarget.hh +++ b/include/remollBeamTarget.hh @@ -6,6 +6,7 @@ #include "remollVertex.hh" #include "G4ThreeVector.hh" +#include "G4GenericMessenger.hh" #include /*! @@ -25,7 +26,6 @@ */ -class G4GenericMessenger; class G4VPhysicalVolume; class G4Material; class remollMultScatt; @@ -96,8 +96,14 @@ class remollBeamTarget { bool fAlreadyWarned_LH2; private: - G4GenericMessenger* fMessenger; - G4GenericMessenger* fMessengerTarget; + G4GenericMessenger fMessenger{ + this, + "/remoll/", + "Remoll properties"}; + G4GenericMessenger fTargetMessenger{ + this, + "/remoll/target/", + "Remoll target properties"}; G4Material *fDefaultMat; diff --git a/include/remollDetectorConstruction.hh b/include/remollDetectorConstruction.hh index 484cc3230..d3a040758 100644 --- a/include/remollDetectorConstruction.hh +++ b/include/remollDetectorConstruction.hh @@ -4,6 +4,7 @@ #include "G4GDMLParser.hh" #include "G4GDMLAuxStructType.hh" #include "G4VUserDetectorConstruction.hh" +#include "G4GenericMessenger.hh" #include "G4Types.hh" #include @@ -15,7 +16,6 @@ class G4Tubs; class G4LogicalVolume; class G4VPhysicalVolume; class G4VSensitiveDetector; -class G4GenericMessenger; class G4UserLimits; class remollGlobalField; @@ -50,7 +50,7 @@ class remollDetectorConstruction : public G4VUserDetectorConstruction private: - G4GDMLParser *fGDMLParser; + G4GDMLParser fGDMLParser; G4bool fGDMLValidate; G4bool fGDMLOverlapCheck; @@ -67,8 +67,14 @@ class remollDetectorConstruction : public G4VUserDetectorConstruction fGDMLFile = gdmlfile.substr(i + 1); } - G4GenericMessenger* fMessenger; - G4GenericMessenger* fGeometryMessenger; + G4GenericMessenger fMessenger{ + this, + "/remoll/", + "Remoll properties"}; + G4GenericMessenger fGeometryMessenger{ + this, + "/remoll/geometry/", + "Remoll geometry properties"}; void ReloadGeometry(const G4String gdmlfile); @@ -87,8 +93,10 @@ class remollDetectorConstruction : public G4VUserDetectorConstruction private: - G4GenericMessenger* fUserLimitsMessenger; - + G4GenericMessenger fUserLimitsMessenger{ + this, + "/remoll/geometry/userlimits/", + "Remoll geometry properties"}; public: @@ -101,7 +109,10 @@ class remollDetectorConstruction : public G4VUserDetectorConstruction private: - G4GenericMessenger* fKryptoniteMessenger; + G4GenericMessenger fKryptoniteMessenger{ + this, + "/remoll/kryptonite/", + "Remoll kryptonite properties"}; static G4UserLimits* fKryptoniteUserLimits; G4bool fKryptoniteEnable; G4int fKryptoniteVerbose; diff --git a/include/remollGlobalField.hh b/include/remollGlobalField.hh index 351640f4a..bac883e2e 100644 --- a/include/remollGlobalField.hh +++ b/include/remollGlobalField.hh @@ -7,11 +7,11 @@ */ #include "G4MagneticField.hh" +#include "G4GenericMessenger.hh" #include "G4ThreeVector.hh" #include -class G4GenericMessenger; class G4EquationOfMotion; class G4MagIntegratorStepper; class G4ChordFinder; @@ -104,8 +104,16 @@ class remollGlobalField : public G4MagneticField { remollMagneticField* GetFieldByName(const G4String& name) const; - G4GenericMessenger* fMessenger; - G4GenericMessenger* fGlobalFieldMessenger; + G4GenericMessenger fMessenger{ + this, + "/remoll/", + "Remoll properties" + }; + G4GenericMessenger fGlobalFieldMessenger{ + this, + "/remoll/field/", + "Remoll global field properties" + }; G4int fVerboseLevel; diff --git a/include/remollIO.hh b/include/remollIO.hh index 6ea8f8643..8480781be 100644 --- a/include/remollIO.hh +++ b/include/remollIO.hh @@ -12,6 +12,7 @@ #include "remollSystemOfUnits.hh" #include "G4String.hh" +#include "G4GenericMessenger.hh" #include #include @@ -20,8 +21,6 @@ class TFile; class TTree; -class G4GenericMessenger; - class remollGenericDetectorHit; class remollGenericDetectorSum; class remollEvent; @@ -116,7 +115,7 @@ class remollIO { TFile *fFile; TTree *fTree; - G4GenericMessenger* fMessenger; + G4GenericMessenger fMessenger{this,"/remoll/","Remoll properties"}; G4String fFilename; diff --git a/include/remollParallelConstruction.hh b/include/remollParallelConstruction.hh index 043c3888b..287482a8c 100644 --- a/include/remollParallelConstruction.hh +++ b/include/remollParallelConstruction.hh @@ -2,13 +2,13 @@ #define __REMOLLPARALLELCONSTRUCTION_HH 1 #include +#include +#include #include "remollSearchPath.hh" class G4LogicalVolume; class G4VPhysicalVolume; -class G4GDMLParser; -class G4GenericMessenger; // /// A parallel world construction class @@ -40,14 +40,17 @@ class remollParallelConstruction : public G4VUserParallelWorld fGDMLFile = gdmlfile.substr(i + 1); } - G4GDMLParser *fGDMLParser; + G4GDMLParser fGDMLParser; G4bool fGDMLValidate; G4bool fGDMLOverlapCheck; G4int fVerboseLevel; - G4GenericMessenger* fParallelMessenger; + G4GenericMessenger fParallelMessenger{ + this, + "/remoll/parallel/", + "Remoll parallel geometry properties"}; G4VPhysicalVolume* fWorldVolume; G4String fWorldName; diff --git a/include/remollPhysicsList.hh b/include/remollPhysicsList.hh index c39363811..8180b2aaa 100644 --- a/include/remollPhysicsList.hh +++ b/include/remollPhysicsList.hh @@ -2,8 +2,8 @@ #define remollPhysicsList_h 1 #include "G4VModularPhysicsList.hh" +#include "G4GenericMessenger.hh" -class G4GenericMessenger; class G4VPhysicsConstructor; class remollPhysicsList: public G4VModularPhysicsList @@ -55,11 +55,22 @@ class remollPhysicsList: public G4VModularPhysicsList protected: // Generic messenger as protected to be used in derived classes - G4GenericMessenger* fPhysListMessenger; - G4GenericMessenger* fOpticalMessenger; - G4GenericMessenger* fParallelMessenger; - G4GenericMessenger* fStepLimiterMessenger; - G4GenericMessenger* fBaseMessenger; + G4GenericMessenger fPhysListMessenger{ + this, + "/remoll/physlist/", + "Remoll physics list properties"}; + G4GenericMessenger fOpticalMessenger{ + this, + "/remoll/physlist/optical/", + "Remoll optical physics properties"}; + G4GenericMessenger fParallelMessenger{ + this, + "/remoll/physlist/parallel/", + "Remoll parallel physics properties"}; + G4GenericMessenger fStepLimiterMessenger{ + this, + "/remoll/physlist/steplimiter/", + "Remoll step limiter properties"}; }; #endif diff --git a/include/remollPrimaryGeneratorAction.hh b/include/remollPrimaryGeneratorAction.hh index 8b61e7224..208b60837 100644 --- a/include/remollPrimaryGeneratorAction.hh +++ b/include/remollPrimaryGeneratorAction.hh @@ -3,11 +3,12 @@ #include "G4VUserPrimaryGeneratorAction.hh" #include "G4VPrimaryGenerator.hh" +#include "G4GenericMessenger.hh" #include "G4String.hh" #include +#include -class G4GenericMessenger; class G4ParticleGun; class G4Event; class remollBeamTarget; @@ -28,12 +29,12 @@ class remollPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction void SetGenerator(G4String&); private: - std::map fEvGenMap; - remollVEventGen *fEventGen; + std::map> fEvGenMap; + std::shared_ptr fEventGen; G4String fEventGenName; - std::map fPriGenMap; - G4VPrimaryGenerator *fPriGen; + std::map> fPriGenMap; + std::shared_ptr fPriGen; G4String fPriGenName; G4ParticleGun* fParticleGun; @@ -43,8 +44,7 @@ class remollPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction remollEvent *fEvent; - G4GenericMessenger* fMessenger; - G4GenericMessenger* fEvGenMessenger; + G4GenericMessenger fEvGenMessenger{this,"/remoll/evgen/","Remoll event generator properties"}; G4double fEffCrossSection; }; diff --git a/include/remollRunAction.hh b/include/remollRunAction.hh index c1b1dd1a3..4e3b70de4 100644 --- a/include/remollRunAction.hh +++ b/include/remollRunAction.hh @@ -2,17 +2,17 @@ #define remollRunAction_h 1 #include "globals.hh" +#include "G4GenericMessenger.hh" #include "G4UserRunAction.hh" +#include "G4Timer.hh" -class G4GenericMessenger; -class G4Timer; class G4Run; class remollRunAction : public G4UserRunAction { public: remollRunAction(); - virtual ~remollRunAction(); + virtual ~remollRunAction() = default; public: G4Run* GenerateRun(); @@ -23,11 +23,15 @@ class remollRunAction : public G4UserRunAction void UpdateSeed(const G4long seed); private: - G4GenericMessenger* fMessenger; - G4Timer* fTimer; + G4GenericMessenger fMessenger{ + this, + "/remoll/", + "Remoll properties"}; + + G4Timer fTimer; private: - G4int fInterval; + G4int fInterval{10}; public: void SetUpdateInterval(G4int interval) { fInterval = interval; }; }; diff --git a/include/remollTrackingAction.hh b/include/remollTrackingAction.hh index 375d84ad4..e868cad05 100644 --- a/include/remollTrackingAction.hh +++ b/include/remollTrackingAction.hh @@ -3,23 +3,25 @@ // geant4 includes #include "G4Types.hh" +#include "G4GenericMessenger.hh" #include "G4UserTrackingAction.hh" -// forward declares -class G4GenericMessenger; - class remollTrackingAction : public G4UserTrackingAction { public: remollTrackingAction(); - virtual ~remollTrackingAction(); + virtual ~remollTrackingAction() = default; void PreUserTrackingAction(const G4Track* aTrack); void PostUserTrackingAction(const G4Track* aTrack); private: - G4GenericMessenger* fMessenger; - G4int fTrackingFlag; + G4GenericMessenger fMessenger{ + this, + "/remoll/tracking/", + "Remoll tracking properties"}; + + G4int fTrackingFlag{3}; }; #endif diff --git a/include/remollVEventGen.hh b/include/remollVEventGen.hh index e5eba3b6c..03cf1f19e 100644 --- a/include/remollVEventGen.hh +++ b/include/remollVEventGen.hh @@ -7,6 +7,7 @@ #include "G4String.hh" #include "G4ThreeVector.hh" +#include "G4GenericMessenger.hh" /*! Generic base class for event generators @@ -23,7 +24,6 @@ */ class G4ParticleGun; -class G4GenericMessenger; class remollEvent; class remollBeamTarget; @@ -97,9 +97,12 @@ public: private: // Generic messenger as protected to be used in derived classes - G4GenericMessenger* fEvGenMessenger; + G4GenericMessenger fEvGenMessenger{ + this, + "/remoll/evgen/", + "Remoll event generator properties"}; protected: - G4GenericMessenger* fThisGenMessenger; + G4GenericMessenger fThisGenMessenger; }; diff --git a/src/remollBeamTarget.cc b/src/remollBeamTarget.cc index 25ce85aac..03d0568fb 100644 --- a/src/remollBeamTarget.cc +++ b/src/remollBeamTarget.cc @@ -11,8 +11,6 @@ #include "G4RunManager.hh" #endif -#include "G4GenericMessenger.hh" - #include "G4GeometryManager.hh" #include "G4SystemOfUnits.hh" #include "G4PhysicalConstants.hh" @@ -57,34 +55,29 @@ remollBeamTarget::remollBeamTarget() fDefaultMat = new G4Material("Default_proton", 1.0, 1.0, 1e-19*g/mole); // Create generic messenger - fMessenger = new G4GenericMessenger(this,"/remoll/","Remoll properties"); - - fMessenger->DeclarePropertyWithUnit("beamcurr","microampere",fBeamCurrent,"Beam current"); - fMessenger->DeclarePropertyWithUnit("beamene","GeV",fBeamEnergy,"Beam energy"); - - fMessenger->DeclareProperty("oldras",fOldRaster,"Old (no ang corln) or new (ang corl) raster"); - fMessenger->DeclarePropertyWithUnit("rasx","cm",fRasterX,"Square raster width x (horizontal)"); - fMessenger->DeclarePropertyWithUnit("rasy","cm",fRasterY,"Square raster width y (vertical)"); - - fMessenger->DeclarePropertyWithUnit("beam_x0","cm",fX0,"beam initial position in x (horizontal)"); - fMessenger->DeclarePropertyWithUnit("beam_y0","cm",fY0,"beam initial position in y (vertical)"); - fMessenger->DeclarePropertyWithUnit("beam_ph0","deg",fPh0,"beam initial direction in x (horizontal)"); - fMessenger->DeclarePropertyWithUnit("beam_th0","deg",fTh0,"beam initial direction in y (vertical)"); - fMessenger->DeclarePropertyWithUnit("beam_corrph","deg",fCorrPh,"beam correlated angle (horizontal)"); - fMessenger->DeclarePropertyWithUnit("beam_corrth","deg",fCorrTh,"beam correlated angle (vertical)"); - fMessenger->DeclarePropertyWithUnit("beam_dph","deg",fdPh,"beam gaussian spread in x (horizontal)"); - fMessenger->DeclarePropertyWithUnit("beam_dth","deg",fdTh,"beam gaussian spread in y (vertical)"); - - fMessengerTarget = new G4GenericMessenger(this,"/remoll/target/","Remoll target properties"); - fMessengerTarget->DeclareMethod("mother",&remollBeamTarget::SetActiveTargetMother,"Set target mother name").SetStates(G4State_Idle); - fMessengerTarget->DeclareMethod("volume",&remollBeamTarget::SetActiveTargetVolume,"Set target volume name").SetStates(G4State_Idle); - fMessengerTarget->DeclareMethod("print",&remollBeamTarget::PrintTargetInfo).SetStates(G4State_Idle); + fMessenger.DeclarePropertyWithUnit("beamcurr","microampere",fBeamCurrent,"Beam current"); + fMessenger.DeclarePropertyWithUnit("beamene","GeV",fBeamEnergy,"Beam energy"); + + fMessenger.DeclareProperty("oldras",fOldRaster,"Old (no ang corln) or new (ang corl) raster"); + fMessenger.DeclarePropertyWithUnit("rasx","cm",fRasterX,"Square raster width x (horizontal)"); + fMessenger.DeclarePropertyWithUnit("rasy","cm",fRasterY,"Square raster width y (vertical)"); + + fMessenger.DeclarePropertyWithUnit("beam_x0","cm",fX0,"beam initial position in x (horizontal)"); + fMessenger.DeclarePropertyWithUnit("beam_y0","cm",fY0,"beam initial position in y (vertical)"); + fMessenger.DeclarePropertyWithUnit("beam_ph0","deg",fPh0,"beam initial direction in x (horizontal)"); + fMessenger.DeclarePropertyWithUnit("beam_th0","deg",fTh0,"beam initial direction in y (vertical)"); + fMessenger.DeclarePropertyWithUnit("beam_corrph","deg",fCorrPh,"beam correlated angle (horizontal)"); + fMessenger.DeclarePropertyWithUnit("beam_corrth","deg",fCorrTh,"beam correlated angle (vertical)"); + fMessenger.DeclarePropertyWithUnit("beam_dph","deg",fdPh,"beam gaussian spread in x (horizontal)"); + fMessenger.DeclarePropertyWithUnit("beam_dth","deg",fdTh,"beam gaussian spread in y (vertical)"); + + fTargetMessenger.DeclareMethod("mother",&remollBeamTarget::SetActiveTargetMother,"Set target mother name").SetStates(G4State_Idle); + fTargetMessenger.DeclareMethod("volume",&remollBeamTarget::SetActiveTargetVolume,"Set target volume name").SetStates(G4State_Idle); + fTargetMessenger.DeclareMethod("print",&remollBeamTarget::PrintTargetInfo).SetStates(G4State_Idle); } remollBeamTarget::~remollBeamTarget() { - delete fMessengerTarget; - delete fMessenger; delete fMS; } diff --git a/src/remollDetectorConstruction.cc b/src/remollDetectorConstruction.cc index 99c34163c..9ca88965f 100644 --- a/src/remollDetectorConstruction.cc +++ b/src/remollDetectorConstruction.cc @@ -5,7 +5,6 @@ #include "remollGlobalField.hh" #include "remollIO.hh" -#include "G4GenericMessenger.hh" #include "G4GeometryManager.hh" #include "G4GeometryTolerance.hh" #include "G4FieldManager.hh" @@ -56,15 +55,10 @@ G4UserLimits* remollDetectorConstruction::fKryptoniteUserLimits = new G4UserLimi remollDetectorConstruction::remollDetectorConstruction(const G4String& name, const G4String& gdmlfile) : fVerboseLevel(0), - fGDMLParser(0), fGDMLValidate(false), fGDMLOverlapCheck(true), fGDMLPath(""), fGDMLFile(""), - fMessenger(0), - fGeometryMessenger(0), - fUserLimitsMessenger(0), - fKryptoniteMessenger(0), fKryptoniteEnable(true), fKryptoniteVerbose(0), fWorldVolume(0), @@ -82,166 +76,153 @@ remollDetectorConstruction::remollDetectorConstruction(const G4String& name, con // New units new G4UnitDefinition("inch","in","Length",25.4*CLHEP::millimeter); - // Create GDML parser - fGDMLParser = new G4GDMLParser(); - // Create generic messenger - fMessenger = new G4GenericMessenger(this,"/remoll/","Remoll properties"); - fMessenger->DeclareMethod( + fMessenger.DeclareMethod( "setgeofile", &remollDetectorConstruction::SetGDMLFile, "Set geometry GDML file") .SetStates(G4State_PreInit); - fMessenger->DeclareMethod( + fMessenger.DeclareMethod( "printgeometry", &remollDetectorConstruction::PrintGeometry, "Print the geometry tree") .SetStates(G4State_Idle) .SetDefaultValue("false"); - fMessenger->DeclareMethod( + fMessenger.DeclareMethod( "printelements", &remollDetectorConstruction::PrintElements, "Print the elements") .SetStates(G4State_Idle); - fMessenger->DeclareMethod( + fMessenger.DeclareMethod( "printmaterials", &remollDetectorConstruction::PrintMaterials, "Print the materials") .SetStates(G4State_Idle); // Create geometry messenger - fGeometryMessenger = new G4GenericMessenger(this, - "/remoll/geometry/", - "Remoll geometry properties"); - fGeometryMessenger->DeclareMethod( + fGeometryMessenger.DeclareMethod( "setfile", &remollDetectorConstruction::SetGDMLFile, "Set geometry GDML file") .SetStates(G4State_PreInit); - fGeometryMessenger->DeclareProperty( + fGeometryMessenger.DeclareProperty( "verbose", fVerboseLevel, "Set geometry verbose level") .SetStates(G4State_PreInit,G4State_Idle); - fGeometryMessenger->DeclareProperty( + fGeometryMessenger.DeclareProperty( "validate", fGDMLValidate, "Set GMDL validate flag") .SetStates(G4State_PreInit) .SetDefaultValue("true"); - fGeometryMessenger->DeclareProperty( + fGeometryMessenger.DeclareProperty( "overlapcheck", fGDMLOverlapCheck, "Set GMDL overlap check flag") .SetStates(G4State_PreInit) .SetDefaultValue("true"); - fGeometryMessenger->DeclareMethod( + fGeometryMessenger.DeclareMethod( "load", &remollDetectorConstruction::ReloadGeometry, "Reload the geometry") .SetStates(G4State_PreInit,G4State_Idle); - fGeometryMessenger->DeclareMethod( + fGeometryMessenger.DeclareMethod( "printelements", &remollDetectorConstruction::PrintElements, "Print the elements") .SetStates(G4State_Idle); - fGeometryMessenger->DeclareMethod( + fGeometryMessenger.DeclareMethod( "printmaterials", &remollDetectorConstruction::PrintMaterials, "Print the materials") .SetStates(G4State_Idle); - fGeometryMessenger->DeclareMethod( + fGeometryMessenger.DeclareMethod( "printgeometry", &remollDetectorConstruction::PrintGeometry, "Print the geometry tree") .SetStates(G4State_Idle) .SetDefaultValue("false"); - fGeometryMessenger->DeclareMethod( + fGeometryMessenger.DeclareMethod( "printoverlaps", &remollDetectorConstruction::PrintOverlaps, "Print the geometry overlap") .SetStates(G4State_Idle); - fGeometryMessenger->DeclareMethod( + fGeometryMessenger.DeclareMethod( "absolute_position", &remollDetectorConstruction::AbsolutePosition, "Set the position of volume in parent frame [mm]") .SetStates(G4State_PreInit,G4State_Idle); - fGeometryMessenger->DeclareMethod( + fGeometryMessenger.DeclareMethod( "relative_position", &remollDetectorConstruction::RelativePosition, "Position a volume relative to current position [mm]") .SetStates(G4State_PreInit,G4State_Idle); - fGeometryMessenger->DeclareMethod( + fGeometryMessenger.DeclareMethod( "absolute_rotation", &remollDetectorConstruction::AbsoluteRotation, "Set the rotation of volume in parent frame [deg]") .SetStates(G4State_PreInit,G4State_Idle); - fGeometryMessenger->DeclareMethod( + fGeometryMessenger.DeclareMethod( "relative_rotation", &remollDetectorConstruction::RelativeRotation, "Rotate a volume relative to current orientation [deg]") .SetStates(G4State_PreInit,G4State_Idle); - fGeometryMessenger->DeclareMethod( + fGeometryMessenger.DeclareMethod( "addmesh", &remollDetectorConstruction::AddMesh, "Add mesh file (ascii stl, ascii ply, ascii obj)") .SetStates(G4State_Idle); // Create user limits messenger - fUserLimitsMessenger = new G4GenericMessenger(this, - "/remoll/geometry/userlimits/", - "Remoll geometry properties"); - fUserLimitsMessenger->DeclareMethod( + fUserLimitsMessenger.DeclareMethod( "usermaxallowedstep", &remollDetectorConstruction::SetUserMaxAllowedStep, "Set user limit MaxAllowedStep for logical volume") .SetStates(G4State_Idle); - fUserLimitsMessenger->DeclareMethod( + fUserLimitsMessenger.DeclareMethod( "usermaxtracklength", &remollDetectorConstruction::SetUserMaxTrackLength, "Set user limit MaxTrackLength for logical volume") .SetStates(G4State_Idle); - fUserLimitsMessenger->DeclareMethod( + fUserLimitsMessenger.DeclareMethod( "usermaxtime", &remollDetectorConstruction::SetUserMaxTime, "Set user limit MaxTime for logical volume") .SetStates(G4State_Idle); - fUserLimitsMessenger->DeclareMethod( + fUserLimitsMessenger.DeclareMethod( "userminekine", &remollDetectorConstruction::SetUserMinEkine, "Set user limit MinEkine for logical volume") .SetStates(G4State_Idle); - fUserLimitsMessenger->DeclareMethod( + fUserLimitsMessenger.DeclareMethod( "userminrange", &remollDetectorConstruction::SetUserMinRange, "Set user limit MinRange for logical volume") .SetStates(G4State_Idle); // Create kryptonite messenger - fKryptoniteMessenger = new G4GenericMessenger(this, - "/remoll/kryptonite/", - "Remoll kryptonite properties"); - fKryptoniteMessenger->DeclareMethod( + fKryptoniteMessenger.DeclareMethod( "verbose", &remollDetectorConstruction::SetKryptoniteVerbose, "Set verbose level"); - fKryptoniteMessenger->DeclareMethod( + fKryptoniteMessenger.DeclareMethod( "enable", &remollDetectorConstruction::EnableKryptonite, "Treat materials as kryptonite"); - fKryptoniteMessenger->DeclareMethod( + fKryptoniteMessenger.DeclareMethod( "disable", &remollDetectorConstruction::DisableKryptonite, "Treat materials as regular"); - fKryptoniteMessenger->DeclareMethod( + fKryptoniteMessenger.DeclareMethod( "add", &remollDetectorConstruction::AddKryptoniteCandidate, "Add specified material to list of kryptonite candidates"); - fKryptoniteMessenger->DeclareMethod( + fKryptoniteMessenger.DeclareMethod( "list", &remollDetectorConstruction::ListKryptoniteCandidates, "List kryptonite candidate materials"); - fKryptoniteMessenger->DeclareMethod( + fKryptoniteMessenger.DeclareMethod( "volume", &remollDetectorConstruction::EnableKryptoniteVolume, "Treat volume as kryptonite"); @@ -385,11 +366,6 @@ remollDetectorConstruction::~remollDetectorConstruction() delete lv; delete pv; } - delete fGDMLParser; - delete fMessenger; - delete fGeometryMessenger; - delete fKryptoniteMessenger; - delete fUserLimitsMessenger; } void remollDetectorConstruction::AddMesh(const G4String& filename) @@ -566,7 +542,7 @@ void remollDetectorConstruction::PrintGDMLWarning() const G4VPhysicalVolume* remollDetectorConstruction::ParseGDMLFile() { // Clear parser - fGDMLParser->Clear(); + fGDMLParser.Clear(); // Print parsing options G4cout << "Reading " << fGDMLFile << G4endl; @@ -591,14 +567,14 @@ G4VPhysicalVolume* remollDetectorConstruction::ParseGDMLFile() } // Parse GDML file - fGDMLParser->SetOverlapCheck(fGDMLOverlapCheck); + fGDMLParser.SetOverlapCheck(fGDMLOverlapCheck); // hide output if not validating or checking overlaps // https://bugzilla-geant4.kek.jp/show_bug.cgi?id=2358 if (! fGDMLOverlapCheck && ! fGDMLValidate) G4cout.setstate(std::ios_base::failbit); - fGDMLParser->Read(fGDMLFile,fGDMLValidate); + fGDMLParser.Read(fGDMLFile,fGDMLValidate); G4cout.clear(); - G4VPhysicalVolume* worldvolume = fGDMLParser->GetWorldVolume(); + G4VPhysicalVolume* worldvolume = fGDMLParser.GetWorldVolume(); // Print tolerances if (fVerboseLevel > 0) { @@ -632,7 +608,7 @@ G4VPhysicalVolume* remollDetectorConstruction::ParseGDMLFile() void remollDetectorConstruction::PrintAuxiliaryInfo() const { - const G4GDMLAuxMapType* auxmap = fGDMLParser->GetAuxMap(); + const G4GDMLAuxMapType* auxmap = fGDMLParser.GetAuxMap(); G4cout << "Found " << auxmap->size() << " volume(s) with auxiliary information." << G4endl << G4endl; @@ -650,7 +626,7 @@ void remollDetectorConstruction::ParseAuxiliaryTargetInfo() // how to improve this, you are welcome to :-) // Loop over volumes with auxiliary information - const G4GDMLAuxMapType* auxmap = fGDMLParser->GetAuxMap(); + const G4GDMLAuxMapType* auxmap = fGDMLParser.GetAuxMap(); for(G4GDMLAuxMapType::const_iterator iter = auxmap->begin(); iter != auxmap->end(); iter++) { @@ -746,7 +722,7 @@ void remollDetectorConstruction::ParseAuxiliaryTargetInfo() void remollDetectorConstruction::ParseAuxiliaryUserLimits() { - const G4GDMLAuxMapType* auxmap = fGDMLParser->GetAuxMap(); + const G4GDMLAuxMapType* auxmap = fGDMLParser.GetAuxMap(); for(G4GDMLAuxMapType::const_iterator iter = auxmap->begin(); iter != auxmap->end(); iter++) { @@ -780,7 +756,7 @@ void remollDetectorConstruction::ParseAuxiliaryUserLimits() void remollDetectorConstruction::ParseAuxiliaryVisibilityInfo() { // Loop over volumes with auxiliary information - const G4GDMLAuxMapType* auxmap = fGDMLParser->GetAuxMap(); + const G4GDMLAuxMapType* auxmap = fGDMLParser.GetAuxMap(); for(G4GDMLAuxMapType::const_iterator iter = auxmap->begin(); iter != auxmap->end(); iter++) { @@ -871,7 +847,7 @@ void remollDetectorConstruction::ParseAuxiliarySensDetInfo() std::map> detnomap; // Loop over all volumes with auxiliary tags - const G4GDMLAuxMapType* auxmap = fGDMLParser->GetAuxMap(); + const G4GDMLAuxMapType* auxmap = fGDMLParser.GetAuxMap(); for (G4GDMLAuxMapType::const_iterator iter = auxmap->begin(); iter != auxmap->end(); iter++) { G4LogicalVolume* myvol = (*iter).first; diff --git a/src/remollGenBeam.cc b/src/remollGenBeam.cc index fc6bb795e..850a69a57 100644 --- a/src/remollGenBeam.cc +++ b/src/remollGenBeam.cc @@ -8,7 +8,6 @@ #include "G4VPhysicalVolume.hh" #include "G4LogicalVolume.hh" #include "G4PhysicalConstants.hh" -#include "G4GenericMessenger.hh" #include "G4ParticleTable.hh" #include "Randomize.hh" @@ -40,44 +39,44 @@ remollGenBeam::remollGenBeam() fSamplingType = kNoTargetVolume; fApplyMultScatt = true; - fThisGenMessenger->DeclarePropertyWithUnit("rasterRefZ","mm",fRasterRefZ,"Raster Origin Z: z unit"); - fThisGenMessenger->DeclarePropertyWithUnit("origin","mm",fOriginMean,"origin position mean: x y z unit"); - fThisGenMessenger->DeclareMethodWithUnit("x","mm",&remollGenBeam::SetOriginXMean,"origin x position mean"); - fThisGenMessenger->DeclareMethodWithUnit("y","mm",&remollGenBeam::SetOriginYMean,"origin y position mean"); - fThisGenMessenger->DeclareMethodWithUnit("z","mm",&remollGenBeam::SetOriginZMean,"origin z position mean"); - - fThisGenMessenger->DeclarePropertyWithUnit("originspread","mm",fOriginSpread,"origin position spread: x y z unit"); - fThisGenMessenger->DeclareMethodWithUnit("xspread","mm",&remollGenBeam::SetOriginXSpread,"origin x position spread"); - fThisGenMessenger->DeclareMethodWithUnit("yspread","mm",&remollGenBeam::SetOriginYSpread,"origin y position spread"); - fThisGenMessenger->DeclareMethodWithUnit("zspread","mm",&remollGenBeam::SetOriginZSpread,"origin z position spread"); - fThisGenMessenger->DeclareMethod("xmodel",&remollGenBeam::SetOriginXModel,"origin x position model: flat, gauss"); - fThisGenMessenger->DeclareMethod("ymodel",&remollGenBeam::SetOriginYModel,"origin y position model: flat, gauss"); - fThisGenMessenger->DeclareMethod("zmodel",&remollGenBeam::SetOriginZModel,"origin z position model: flat, gauss"); - - fThisGenMessenger->DeclareProperty("direction",fDirection,"direction vector (will be normalized): x y z"); - fThisGenMessenger->DeclareMethod("px",&remollGenBeam::SetDirectionX,"direction x (vector will be normalized before use)"); - fThisGenMessenger->DeclareMethod("py",&remollGenBeam::SetDirectionY,"direction y (vector will be normalized before use)"); - fThisGenMessenger->DeclareMethod("pz",&remollGenBeam::SetDirectionZ,"direction z (vector will be normalized before use)"); - fThisGenMessenger->DeclareMethodWithUnit("th","deg",&remollGenBeam::SetDirectionTh,"direction vector theta angle"); - fThisGenMessenger->DeclareMethodWithUnit("ph","deg",&remollGenBeam::SetDirectionPh,"direction vector phi angle"); - fThisGenMessenger->DeclareProperty("isotropic",fIsotropic,"direction is isotropic"); - fThisGenMessenger->DeclarePropertyWithUnit("isotropic_theta_min","deg",fIsotropicThetaMin,"minimum theta in isotropic direction"); - fThisGenMessenger->DeclarePropertyWithUnit("isotropic_theta_max","deg",fIsotropicThetaMax,"maximum theta in isotropic direction"); - - fThisGenMessenger->DeclarePropertyWithUnit("originshift","mm",fOriginShift,"origin shift along direction vector: s unit"); - - fThisGenMessenger->DeclareProperty("polarization",fPolarization,"polarization vector (will be normalized): x y z"); - fThisGenMessenger->DeclareMethod("sx",&remollGenBeam::SetPolarizationX,"x component of polarization"); - fThisGenMessenger->DeclareMethod("sy",&remollGenBeam::SetPolarizationY,"y component of polarization"); - fThisGenMessenger->DeclareMethod("sz",&remollGenBeam::SetPolarizationZ,"z component of polarization"); - - fThisGenMessenger->DeclareMethodWithUnit("rasrefz","mm",&remollGenBeam::SetRasterRefZ,"reference z position where raster is defined"); - fThisGenMessenger->DeclareMethodWithUnit("rasx","mm",&remollGenBeam::SetRasterX,"raster x spread perpendicular to the beam at z = 0"); - fThisGenMessenger->DeclareMethodWithUnit("rasy","mm",&remollGenBeam::SetRasterY,"raster y spread perpendicular to the beam at z = 0"); - fThisGenMessenger->DeclareMethod("corrx",&remollGenBeam::SetCorrelationX,"sensitivity of direction to position in x (in mrad/mm)"); - fThisGenMessenger->DeclareMethod("corry",&remollGenBeam::SetCorrelationY,"sensitivity of direction to position in y (in mrad/mm)"); - - fThisGenMessenger->DeclareMethod("partName",&remollGenBeam::SetPartName,"name of particle to shoot"); + fThisGenMessenger.DeclarePropertyWithUnit("rasterRefZ","mm",fRasterRefZ,"Raster Origin Z: z unit"); + fThisGenMessenger.DeclarePropertyWithUnit("origin","mm",fOriginMean,"origin position mean: x y z unit"); + fThisGenMessenger.DeclareMethodWithUnit("x","mm",&remollGenBeam::SetOriginXMean,"origin x position mean"); + fThisGenMessenger.DeclareMethodWithUnit("y","mm",&remollGenBeam::SetOriginYMean,"origin y position mean"); + fThisGenMessenger.DeclareMethodWithUnit("z","mm",&remollGenBeam::SetOriginZMean,"origin z position mean"); + + fThisGenMessenger.DeclarePropertyWithUnit("originspread","mm",fOriginSpread,"origin position spread: x y z unit"); + fThisGenMessenger.DeclareMethodWithUnit("xspread","mm",&remollGenBeam::SetOriginXSpread,"origin x position spread"); + fThisGenMessenger.DeclareMethodWithUnit("yspread","mm",&remollGenBeam::SetOriginYSpread,"origin y position spread"); + fThisGenMessenger.DeclareMethodWithUnit("zspread","mm",&remollGenBeam::SetOriginZSpread,"origin z position spread"); + fThisGenMessenger.DeclareMethod("xmodel",&remollGenBeam::SetOriginXModel,"origin x position model: flat, gauss"); + fThisGenMessenger.DeclareMethod("ymodel",&remollGenBeam::SetOriginYModel,"origin y position model: flat, gauss"); + fThisGenMessenger.DeclareMethod("zmodel",&remollGenBeam::SetOriginZModel,"origin z position model: flat, gauss"); + + fThisGenMessenger.DeclareProperty("direction",fDirection,"direction vector (will be normalized): x y z"); + fThisGenMessenger.DeclareMethod("px",&remollGenBeam::SetDirectionX,"direction x (vector will be normalized before use)"); + fThisGenMessenger.DeclareMethod("py",&remollGenBeam::SetDirectionY,"direction y (vector will be normalized before use)"); + fThisGenMessenger.DeclareMethod("pz",&remollGenBeam::SetDirectionZ,"direction z (vector will be normalized before use)"); + fThisGenMessenger.DeclareMethodWithUnit("th","deg",&remollGenBeam::SetDirectionTh,"direction vector theta angle"); + fThisGenMessenger.DeclareMethodWithUnit("ph","deg",&remollGenBeam::SetDirectionPh,"direction vector phi angle"); + fThisGenMessenger.DeclareProperty("isotropic",fIsotropic,"direction is isotropic"); + fThisGenMessenger.DeclarePropertyWithUnit("isotropic_theta_min","deg",fIsotropicThetaMin,"minimum theta in isotropic direction"); + fThisGenMessenger.DeclarePropertyWithUnit("isotropic_theta_max","deg",fIsotropicThetaMax,"maximum theta in isotropic direction"); + + fThisGenMessenger.DeclarePropertyWithUnit("originshift","mm",fOriginShift,"origin shift along direction vector: s unit"); + + fThisGenMessenger.DeclareProperty("polarization",fPolarization,"polarization vector (will be normalized): x y z"); + fThisGenMessenger.DeclareMethod("sx",&remollGenBeam::SetPolarizationX,"x component of polarization"); + fThisGenMessenger.DeclareMethod("sy",&remollGenBeam::SetPolarizationY,"y component of polarization"); + fThisGenMessenger.DeclareMethod("sz",&remollGenBeam::SetPolarizationZ,"z component of polarization"); + + fThisGenMessenger.DeclareMethodWithUnit("rasrefz","mm",&remollGenBeam::SetRasterRefZ,"reference z position where raster is defined"); + fThisGenMessenger.DeclareMethodWithUnit("rasx","mm",&remollGenBeam::SetRasterX,"raster x spread perpendicular to the beam at z = 0"); + fThisGenMessenger.DeclareMethodWithUnit("rasy","mm",&remollGenBeam::SetRasterY,"raster y spread perpendicular to the beam at z = 0"); + fThisGenMessenger.DeclareMethod("corrx",&remollGenBeam::SetCorrelationX,"sensitivity of direction to position in x (in mrad/mm)"); + fThisGenMessenger.DeclareMethod("corry",&remollGenBeam::SetCorrelationY,"sensitivity of direction to position in y (in mrad/mm)"); + + fThisGenMessenger.DeclareMethod("partName",&remollGenBeam::SetPartName,"name of particle to shoot"); } remollGenBeam::~remollGenBeam() { } diff --git a/src/remollGenExternal.cc b/src/remollGenExternal.cc index 51bda8be4..0923036cd 100644 --- a/src/remollGenExternal.cc +++ b/src/remollGenExternal.cc @@ -6,9 +6,9 @@ */ #include "remollGenExternal.hh" + // Geant4 headers #include "G4ParticleTable.hh" -#include "G4GenericMessenger.hh" // ROOT headers #include "TFile.h" @@ -33,10 +33,10 @@ remollGenExternal::remollGenExternal() fSamplingType = kNoTargetVolume; // Add to generic messenger - fThisGenMessenger->DeclareMethod("file",&remollGenExternal::SetGenExternalFile,"External generator event filename"); - fThisGenMessenger->DeclareMethod("zOffset",&remollGenExternal::SetGenExternalZOffset,"External generator zOffset"); - fThisGenMessenger->DeclareMethod("detid",&remollGenExternal::SetGenExternalDetID,"External generator detector ID"); - fThisGenMessenger->DeclareMethod("startEvent",&remollGenExternal::SetGenExternalEntry,"External generator starting event: -1 starts random, n starts at n (default n=0)"); + fThisGenMessenger.DeclareMethod("file",&remollGenExternal::SetGenExternalFile,"External generator event filename"); + fThisGenMessenger.DeclareMethod("zOffset",&remollGenExternal::SetGenExternalZOffset,"External generator zOffset"); + fThisGenMessenger.DeclareMethod("detid",&remollGenExternal::SetGenExternalDetID,"External generator detector ID"); + fThisGenMessenger.DeclareMethod("startEvent",&remollGenExternal::SetGenExternalEntry,"External generator starting event: -1 starts random, n starts at n (default n=0)"); } remollGenExternal::~remollGenExternal() diff --git a/src/remollGenHyperon.cc b/src/remollGenHyperon.cc index 45141faf5..3b77e0c71 100644 --- a/src/remollGenHyperon.cc +++ b/src/remollGenHyperon.cc @@ -2,7 +2,6 @@ // Geant4 includes #include "G4Material.hh" -#include "G4GenericMessenger.hh" // remoll includes #include "remollBeamTarget.hh" @@ -29,13 +28,13 @@ remollGenHyperon::remollGenHyperon() fRUnit(cm),fPUnit(GeV),fWUnit(barn) { // Add to generic messenger - fThisGenMessenger->DeclareProperty("debug",fDebugLevel,"Debug level"); - fThisGenMessenger->DeclareProperty("file",fFile,"Input filename"); - fThisGenMessenger->DeclareProperty("skip",fSkip,"Number of lines to skip"); - fThisGenMessenger->DeclareProperty("particle",fParticle,"Particle name"); - fThisGenMessenger->DeclarePropertyWithUnit("runit","cm",fRUnit,"Units of position"); - fThisGenMessenger->DeclarePropertyWithUnit("punit","GeV",fPUnit,"Units of momentum"); - fThisGenMessenger->DeclarePropertyWithUnit("wunit","barn",fWUnit,"Units of weight"); + fThisGenMessenger.DeclareProperty("debug",fDebugLevel,"Debug level"); + fThisGenMessenger.DeclareProperty("file",fFile,"Input filename"); + fThisGenMessenger.DeclareProperty("skip",fSkip,"Number of lines to skip"); + fThisGenMessenger.DeclareProperty("particle",fParticle,"Particle name"); + fThisGenMessenger.DeclarePropertyWithUnit("runit","cm",fRUnit,"Units of position"); + fThisGenMessenger.DeclarePropertyWithUnit("punit","GeV",fPUnit,"Units of momentum"); + fThisGenMessenger.DeclarePropertyWithUnit("wunit","barn",fWUnit,"Units of weight"); } remollGenHyperon::~remollGenHyperon() diff --git a/src/remollGenLUND.cc b/src/remollGenLUND.cc index bc229e6e3..1e5807066 100644 --- a/src/remollGenLUND.cc +++ b/src/remollGenLUND.cc @@ -2,7 +2,6 @@ // Geant4 includes #include "G4Material.hh" -#include "G4GenericMessenger.hh" // remoll includes #include "remollBeamTarget.hh" @@ -36,7 +35,7 @@ remollGenLUND::remollGenLUND() LUNDfile_linecount = 0; // Add to generic messenger - fThisGenMessenger->DeclareMethod("LUND_filename",&remollGenLUND::SetLUNDFile,"LUND Input filename"); + fThisGenMessenger.DeclareMethod("LUND_filename",&remollGenLUND::SetLUNDFile,"LUND Input filename"); } remollGenLUND::~remollGenLUND() diff --git a/src/remollGenPion.cc b/src/remollGenPion.cc index b4f02bb0a..a78a6e921 100644 --- a/src/remollGenPion.cc +++ b/src/remollGenPion.cc @@ -1,7 +1,6 @@ #include "remollBeamTarget.hh" #include "remollGenPion.hh" -#include "G4GenericMessenger.hh" #include "G4String.hh" #include "Randomize.hh" @@ -34,8 +33,8 @@ remollGenPion::remollGenPion() fE_max = -1.0*GeV; // negative to automatically pick beam energy // Add to generic messenger - fThisGenMessenger->DeclareMethod("piontype",&remollGenPion::SetPionTypeByString_Deprecated,"Generate pion type"); - fThisGenMessenger->DeclareMethod("settype",&remollGenPion::SetPionTypeByString,"Generate pion type"); + fThisGenMessenger.DeclareMethod("piontype",&remollGenPion::SetPionTypeByString_Deprecated,"Generate pion type"); + fThisGenMessenger.DeclareMethod("settype",&remollGenPion::SetPionTypeByString,"Generate pion type"); } remollGenPion::~remollGenPion() { } diff --git a/src/remollGlobalField.cc b/src/remollGlobalField.cc index f8ae0883e..b340c3f0d 100644 --- a/src/remollGlobalField.cc +++ b/src/remollGlobalField.cc @@ -3,7 +3,6 @@ #include "G4TransportationManager.hh" #include "G4FieldManager.hh" #include "G4UImanager.hh" -#include "G4GenericMessenger.hh" #include "G4PropagatorInField.hh" @@ -65,33 +64,28 @@ remollGlobalField::remollGlobalField() fFieldManager->SetDetectorField(this); // Create generic messenger - fMessenger = new G4GenericMessenger(this,"/remoll/","Remoll properties"); - fMessenger->DeclareMethod("addfield",&remollGlobalField::AddNewField,"Add magnetic field"); + fMessenger.DeclareMethod("addfield",&remollGlobalField::AddNewField,"Add magnetic field"); // Create global field messenger - fGlobalFieldMessenger = new G4GenericMessenger(this,"/remoll/field/","Remoll global field properties"); - fGlobalFieldMessenger->DeclareMethod("equationtype",&remollGlobalField::SetEquationType,"Set equation type: \n 0: B-field, no spin (default); \n 2: B-field, with spin"); - fGlobalFieldMessenger->DeclareMethod("steppertype",&remollGlobalField::SetStepperType,"Set stepper type: \n 0: ExplicitEuler; \n 1: ImplicitEuler; \n 2: SimpleRunge; \n 3: SimpleHeum; \n 4: ClassicalRK4 (default); \n 5: CashKarpRKF45"); - fGlobalFieldMessenger->DeclareMethod("print",&remollGlobalField::PrintAccuracyParameters,"Print the accuracy parameters"); - fGlobalFieldMessenger->DeclareProperty("epsmin",fEpsMin,"Set the minimum epsilon of the field propagator"); - fGlobalFieldMessenger->DeclareProperty("epsmax",fEpsMax,"Set the maximum epsilon of the field propagator"); - fGlobalFieldMessenger->DeclareProperty("minstep",fMinStep,"Set the minimum step of the chord finder"); - fGlobalFieldMessenger->DeclareProperty("deltachord",fDeltaChord,"Set delta chord for the chord finder"); - fGlobalFieldMessenger->DeclareProperty("deltaonestep",fDeltaOneStep,"Set delta one step for the field manager"); - fGlobalFieldMessenger->DeclareProperty("deltaintersection",fMinStep,"Set delta intersection for the field manager"); - fGlobalFieldMessenger->DeclareMethod("interpolation",&remollGlobalField::SetInterpolationType,"Set magnetic field interpolation type"); - fGlobalFieldMessenger->DeclareMethod("zoffset",&remollGlobalField::SetZOffset,"Set magnetic field z offset"); - fGlobalFieldMessenger->DeclareMethod("scale",&remollGlobalField::SetFieldScale,"Scale magnetic field by factor"); - fGlobalFieldMessenger->DeclareMethod("current",&remollGlobalField::SetMagnetCurrent,"Scale magnetic field by current"); - fGlobalFieldMessenger->DeclareMethod("value",&remollGlobalField::PrintFieldValue,"Print the field value at a given point (in m)"); - fGlobalFieldMessenger->DeclareProperty("verbose",fVerboseLevel,"Set the verbose level"); + fGlobalFieldMessenger.DeclareMethod("equationtype",&remollGlobalField::SetEquationType,"Set equation type: \n 0: B-field, no spin (default); \n 2: B-field, with spin"); + fGlobalFieldMessenger.DeclareMethod("steppertype",&remollGlobalField::SetStepperType,"Set stepper type: \n 0: ExplicitEuler; \n 1: ImplicitEuler; \n 2: SimpleRunge; \n 3: SimpleHeum; \n 4: ClassicalRK4 (default); \n 5: CashKarpRKF45"); + fGlobalFieldMessenger.DeclareMethod("print",&remollGlobalField::PrintAccuracyParameters,"Print the accuracy parameters"); + fGlobalFieldMessenger.DeclareProperty("epsmin",fEpsMin,"Set the minimum epsilon of the field propagator"); + fGlobalFieldMessenger.DeclareProperty("epsmax",fEpsMax,"Set the maximum epsilon of the field propagator"); + fGlobalFieldMessenger.DeclareProperty("minstep",fMinStep,"Set the minimum step of the chord finder"); + fGlobalFieldMessenger.DeclareProperty("deltachord",fDeltaChord,"Set delta chord for the chord finder"); + fGlobalFieldMessenger.DeclareProperty("deltaonestep",fDeltaOneStep,"Set delta one step for the field manager"); + fGlobalFieldMessenger.DeclareProperty("deltaintersection",fMinStep,"Set delta intersection for the field manager"); + fGlobalFieldMessenger.DeclareMethod("interpolation",&remollGlobalField::SetInterpolationType,"Set magnetic field interpolation type"); + fGlobalFieldMessenger.DeclareMethod("zoffset",&remollGlobalField::SetZOffset,"Set magnetic field z offset"); + fGlobalFieldMessenger.DeclareMethod("scale",&remollGlobalField::SetFieldScale,"Scale magnetic field by factor"); + fGlobalFieldMessenger.DeclareMethod("current",&remollGlobalField::SetMagnetCurrent,"Scale magnetic field by current"); + fGlobalFieldMessenger.DeclareMethod("value",&remollGlobalField::PrintFieldValue,"Print the field value at a given point (in m)"); + fGlobalFieldMessenger.DeclareProperty("verbose",fVerboseLevel,"Set the verbose level"); } remollGlobalField::~remollGlobalField() { - delete fMessenger; - delete fGlobalFieldMessenger; - if (fEquation) delete fEquation; if (fStepper) delete fStepper; if (fChordFinder) delete fChordFinder; diff --git a/src/remollIO.cc b/src/remollIO.cc index c956a1477..5308cdb4a 100644 --- a/src/remollIO.cc +++ b/src/remollIO.cc @@ -5,7 +5,6 @@ #include #include "G4ParticleDefinition.hh" -#include "G4GenericMessenger.hh" #include "remollGenericDetectorHit.hh" #include "remollGenericDetectorSum.hh" @@ -45,9 +44,7 @@ remollIO* remollIO::GetInstance(const G4String& outputfile) { remollIO::remollIO(const G4String& outputfile) : fFile(0),fTree(0),fFilename(outputfile),fRate(0) { - // Create generic messenger - fMessenger = new G4GenericMessenger(this,"/remoll/","Remoll properties"); - fMessenger->DeclareProperty("filename",fFilename,"Output filename"); + fMessenger.DeclareProperty("filename",fFilename,"Output filename"); } remollIO::~remollIO() @@ -62,8 +59,6 @@ remollIO::~remollIO() delete fFile; fFile = NULL; } - - delete fMessenger; } void remollIO::InitializeTree() diff --git a/src/remollParallelConstruction.cc b/src/remollParallelConstruction.cc index 8d71ae2d1..63ce1bcb7 100644 --- a/src/remollParallelConstruction.cc +++ b/src/remollParallelConstruction.cc @@ -2,11 +2,9 @@ #include -#include #include #include #include -#include #include #include #include "G4UnitsTable.hh" @@ -22,11 +20,9 @@ remollParallelConstruction::remollParallelConstruction(const G4String& name, const G4String& gdmlfile) : G4VUserParallelWorld(name), fGDMLPath(""),fGDMLFile(""), - fGDMLParser(0), fGDMLValidate(false), fGDMLOverlapCheck(true), fVerboseLevel(0), - fParallelMessenger(0), fWorldVolume(0), fWorldName(name) { @@ -36,35 +32,29 @@ remollParallelConstruction::remollParallelConstruction(const G4String& name, con SetGDMLFile(gdmlfile); } - // Create GDML parser - fGDMLParser = new G4GDMLParser(); - // New units new G4UnitDefinition("inch","in","Length",25.4*CLHEP::millimeter); // Create parallel geometry messenger - fParallelMessenger = new G4GenericMessenger(this, - "/remoll/parallel/", - "Remoll parallel geometry properties"); - fParallelMessenger->DeclareMethod( + fParallelMessenger.DeclareMethod( "setfile", &remollParallelConstruction::SetGDMLFile, "Set parallel geometry GDML file") .SetStates(G4State_PreInit) .SetDefaultValue("") .command->GetParameter(0)->SetOmittable(true); - fParallelMessenger->DeclareProperty( + fParallelMessenger.DeclareProperty( "verbose", fVerboseLevel, "Set geometry verbose level") .SetStates(G4State_PreInit); - fParallelMessenger->DeclareProperty( + fParallelMessenger.DeclareProperty( "validate", fGDMLValidate, "Set GMDL validate flag") .SetStates(G4State_PreInit) .SetDefaultValue("true"); - fParallelMessenger->DeclareProperty( + fParallelMessenger.DeclareProperty( "overlapcheck", fGDMLOverlapCheck, "Set GMDL overlap check flag") @@ -75,8 +65,6 @@ remollParallelConstruction::remollParallelConstruction(const G4String& name, con //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... remollParallelConstruction::~remollParallelConstruction() { - delete fGDMLParser; - delete fParallelMessenger; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... @@ -131,9 +119,7 @@ void remollParallelConstruction::ConstructSD() G4VPhysicalVolume* remollParallelConstruction::ParseGDMLFile() { // Clear parser - //fGDMLParser->Clear(); // FIXME doesn't clear auxmap, instead just recreate - if (fGDMLParser) delete fGDMLParser; - fGDMLParser = new G4GDMLParser(); + //fGDMLParser.Clear(); // FIXME doesn't clear auxmap, instead just recreate // Print GDML warning PrintGDMLWarning(); @@ -155,14 +141,14 @@ G4VPhysicalVolume* remollParallelConstruction::ParseGDMLFile() } // Parse GDML file - fGDMLParser->SetOverlapCheck(fGDMLOverlapCheck); + fGDMLParser.SetOverlapCheck(fGDMLOverlapCheck); // hide output if not validating or checking overlaps // https://bugzilla-geant4.kek.jp/show_bug.cgi?id=2358 if (! fGDMLOverlapCheck && ! fGDMLValidate) G4cout.setstate(std::ios_base::failbit); - fGDMLParser->Read(fGDMLFile,fGDMLValidate); + fGDMLParser.Read(fGDMLFile,fGDMLValidate); G4cout.clear(); - G4VPhysicalVolume* parallelvolume = fGDMLParser->GetWorldVolume(); + G4VPhysicalVolume* parallelvolume = fGDMLParser.GetWorldVolume(); G4LogicalVolume* parallellogical = parallelvolume->GetLogicalVolume(); // Add GDML files to IO @@ -190,7 +176,7 @@ G4VPhysicalVolume* remollParallelConstruction::ParseGDMLFile() //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void remollParallelConstruction::PrintAuxiliaryInfo() const { - const G4GDMLAuxMapType* auxmap = fGDMLParser->GetAuxMap(); + const G4GDMLAuxMapType* auxmap = fGDMLParser.GetAuxMap(); G4cout << "Found " << auxmap->size() << " volume(s) with auxiliary information." << G4endl << G4endl; @@ -200,7 +186,7 @@ void remollParallelConstruction::PrintAuxiliaryInfo() const void remollParallelConstruction::ParseAuxiliaryVisibilityInfo() { // Loop over volumes with auxiliary information - const G4GDMLAuxMapType* auxmap = fGDMLParser->GetAuxMap(); + const G4GDMLAuxMapType* auxmap = fGDMLParser.GetAuxMap(); for(G4GDMLAuxMapType::const_iterator iter = auxmap->begin(); iter != auxmap->end(); iter++) { @@ -301,7 +287,7 @@ void remollParallelConstruction::ParseAuxiliarySensDetInfo() if (fVerboseLevel > 0) G4cout << "Beginning sensitive detector assignment" << G4endl; - const G4GDMLAuxMapType* auxmap = fGDMLParser->GetAuxMap(); + const G4GDMLAuxMapType* auxmap = fGDMLParser.GetAuxMap(); for (G4GDMLAuxMapType::const_iterator iter = auxmap->begin(); iter != auxmap->end(); iter++) { G4LogicalVolume* myvol = (*iter).first; if (fVerboseLevel > 0) diff --git a/src/remollPhysicsList.cc b/src/remollPhysicsList.cc index 58145c1e5..81a25faf3 100644 --- a/src/remollPhysicsList.cc +++ b/src/remollPhysicsList.cc @@ -3,7 +3,6 @@ #include "G4PhysListFactory.hh" #include "G4ParallelWorldPhysics.hh" #include "G4OpticalPhysics.hh" -#include "G4GenericMessenger.hh" #include "G4RunManager.hh" #include "G4NuclearLevelData.hh" #include "G4HadronicProcessStore.hh" @@ -21,11 +20,7 @@ remollPhysicsList::remollPhysicsList() fReferencePhysList(0), fParallelPhysics(0), fOpticalPhysics(0), - fStepLimiterPhysics(0), - fPhysListMessenger(0), - fOpticalMessenger(0), - fParallelMessenger(0), - fBaseMessenger(0) + fStepLimiterPhysics(0) { // Let users know to ignore the warning by Particle HP package G4cout << "remoll: Since the high precision neutron simulation in the some physics lists " << G4endl; @@ -47,63 +42,49 @@ remollPhysicsList::remollPhysicsList() G4cout << "remoll: parallel physics is " << (fParallelPhysics? "enabled":"disabled") << G4endl; G4cout << "remoll: optical physics is " << (fOpticalPhysics? "enabled":"disabled") << G4endl; - // Create physlist messenger - fPhysListMessenger = new G4GenericMessenger(this, - "/remoll/physlist/", - "Remoll physics list properties"); - fParallelMessenger = new G4GenericMessenger(this, - "/remoll/physlist/parallel/", - "Remoll parallel physics properties"); - fOpticalMessenger = new G4GenericMessenger(this, - "/remoll/physlist/optical/", - "Remoll optical physics properties"); - fStepLimiterMessenger = new G4GenericMessenger(this, - "/remoll/physlist/steplimiter/", - "Remoll step limiter properties"); - // Create commands - fPhysListMessenger->DeclareMethod( + fPhysListMessenger.DeclareMethod( "verbose", &remollPhysicsList::SetVerboseLevel, "Set physics list verbose level") .SetStates(G4State_PreInit); - fPhysListMessenger->DeclareMethod( + fPhysListMessenger.DeclareMethod( "register", &remollPhysicsList::RegisterReferencePhysList, "Register reference physics list") .SetStates(G4State_PreInit); - fPhysListMessenger->DeclareMethod( + fPhysListMessenger.DeclareMethod( "list", &remollPhysicsList::ListReferencePhysLists, "List reference physics lists"); - fParallelMessenger->DeclareMethod( + fParallelMessenger.DeclareMethod( "enable", &remollPhysicsList::EnableParallelPhysics, "Enable parallel physics") .SetStates(G4State_PreInit); - fParallelMessenger->DeclareMethod( + fParallelMessenger.DeclareMethod( "disable", &remollPhysicsList::DisableParallelPhysics, "Disable parallel physics") .SetStates(G4State_PreInit); - fOpticalMessenger->DeclareMethod( + fOpticalMessenger.DeclareMethod( "enable", &remollPhysicsList::EnableOpticalPhysics, "Enable optical physics") .SetStates(G4State_PreInit); - fOpticalMessenger->DeclareMethod( + fOpticalMessenger.DeclareMethod( "disable", &remollPhysicsList::DisableOpticalPhysics, "Disable optical physics") .SetStates(G4State_PreInit); - fStepLimiterMessenger->DeclareMethod( + fStepLimiterMessenger.DeclareMethod( "enable", &remollPhysicsList::EnableStepLimiterPhysics, "Enable step limiter"); - fStepLimiterMessenger->DeclareMethod( + fStepLimiterMessenger.DeclareMethod( "disable", &remollPhysicsList::DisableStepLimiterPhysics, "Disable step limiter"); @@ -117,12 +98,6 @@ remollPhysicsList::~remollPhysicsList() // delete fReferencePhysicsListToDelete.at(i); //} //fReferencePhysicsListToDelete.clear(); - - if (fPhysListMessenger) delete fPhysListMessenger; - if (fStepLimiterMessenger) delete fStepLimiterMessenger; - if (fParallelMessenger) delete fParallelMessenger; - if (fOpticalMessenger) delete fOpticalMessenger; - if (fBaseMessenger) delete fBaseMessenger; } void remollPhysicsList::SetVerboseLevel(G4int level) diff --git a/src/remollPrimaryGeneratorAction.cc b/src/remollPrimaryGeneratorAction.cc index 3850472ae..cd1e5e6a6 100644 --- a/src/remollPrimaryGeneratorAction.cc +++ b/src/remollPrimaryGeneratorAction.cc @@ -4,7 +4,6 @@ #include "G4ParticleGun.hh" #include "G4ParticleTable.hh" #include "G4ParticleDefinition.hh" -#include "G4GenericMessenger.hh" #include "remollHEPEvtInterface.hh" #ifdef G4LIB_USE_HEPMC @@ -34,8 +33,10 @@ #include "remollGenLUND.hh" #include "remollGenHyperon.hh" +#include + remollPrimaryGeneratorAction::remollPrimaryGeneratorAction() -: fEventGen(0),fPriGen(0),fParticleGun(0),fBeamTarg(0),fEvent(0),fMessenger(0),fEffCrossSection(0) +: fEventGen(0),fPriGen(0),fParticleGun(0),fBeamTarg(0),fEvent(0),fEffCrossSection(0) { static bool has_been_warned = false; if (! has_been_warned) { @@ -46,29 +47,29 @@ remollPrimaryGeneratorAction::remollPrimaryGeneratorAction() } // Populate map with all possible event generators - fEvGenMap["moller"] = new remollGenMoller(); - fEvGenMap["elastic"] = new remollGenpElastic(); - fEvGenMap["inelastic"] = new remollGenpInelastic(); - fEvGenMap["pion"] = new remollGenPion(); - fEvGenMap["beam"] = new remollGenBeam(); - fEvGenMap["flat"] = new remollGenFlat(); - fEvGenMap["elasticAl"] = new remollGenAl(0); - fEvGenMap["quasielasticAl"] = new remollGenAl(1); - fEvGenMap["inelasticAl"] = new remollGenAl(2); - fEvGenMap["external"] = new remollGenExternal(); - fEvGenMap["pion_LUND"] = new remollGenLUND(); - fEvGenMap["elasticC12"] = new remollGenC12(0); - fEvGenMap["quasielasticC12"] = new remollGenC12(1); - fEvGenMap["inelasticC12"] = new remollGenC12(2); - fEvGenMap["hyperon"] = new remollGenHyperon(); + fEvGenMap["moller"] = std::make_shared(); + fEvGenMap["elastic"] = std::make_shared(); + fEvGenMap["inelastic"] = std::make_shared(); + fEvGenMap["pion"] = std::make_shared(); + fEvGenMap["beam"] = std::make_shared(); + fEvGenMap["flat"] = std::make_shared(); + fEvGenMap["elasticAl"] = std::make_shared(0); + fEvGenMap["quasielasticAl"] = std::make_shared(1); + fEvGenMap["inelasticAl"] = std::make_shared(2); + fEvGenMap["external"] = std::make_shared(); + fEvGenMap["pion_LUND"] = std::make_shared(); + fEvGenMap["elasticC12"] = std::make_shared(0); + fEvGenMap["quasielasticC12"] = std::make_shared(1); + fEvGenMap["inelasticC12"] = std::make_shared(2); + fEvGenMap["hyperon"] = std::make_shared(); // Populate map with all possible primary generators - fPriGenMap["particlegun"] = new G4ParticleGun(); - fPriGenMap["HEPEvt"] = new remollHEPEvtInterface(); + fPriGenMap["particlegun"] = std::make_shared(); + fPriGenMap["HEPEvt"] = std::make_shared(); #ifdef G4LIB_USE_HEPMC - fPriGenMap["hepmcAscii"] = new HepMCG4AsciiInterface(); + fPriGenMap["hepmcAscii"] = std::make_shared(); #ifdef G4LIB_USE_PYTHIA - fPriGenMap["hepmcPythia"] = new HepMCG4PythiaInterface(); + fPriGenMap["hepmcPythia"] = std::make_shared(); #endif #endif @@ -80,19 +81,13 @@ remollPrimaryGeneratorAction::remollPrimaryGeneratorAction() SetGenerator(default_generator); // Create event generator messenger - fEvGenMessenger = new G4GenericMessenger(this,"/remoll/evgen/","Remoll event generator properties"); - fEvGenMessenger->DeclareMethod("set",&remollPrimaryGeneratorAction::SetGenerator,"Select physics generator"); - fEvGenMessenger->DeclarePropertyWithUnit("sigma","picobarn",fEffCrossSection,"Set effective cross section"); + fEvGenMessenger.DeclareMethod("set",&remollPrimaryGeneratorAction::SetGenerator,"Select physics generator"); + fEvGenMessenger.DeclarePropertyWithUnit("sigma","picobarn",fEffCrossSection,"Set effective cross section"); } remollPrimaryGeneratorAction::~remollPrimaryGeneratorAction() { - fEvGenMap.clear(); - fPriGenMap.clear(); - if (fEvGenMessenger) delete fEvGenMessenger; - if (fMessenger) delete fMessenger; if (fBeamTarg) delete fBeamTarg; - if (fEventGen) delete fEventGen; } void remollPrimaryGeneratorAction::SetGenerator(G4String& genname) @@ -102,7 +97,7 @@ void remollPrimaryGeneratorAction::SetGenerator(G4String& genname) fPriGen = 0; // Find event generator - std::map::iterator evgen = fEvGenMap.find(genname); + auto evgen = fEvGenMap.find(genname); if (evgen != fEvGenMap.end()) { G4cout << "Setting generator to " << genname << G4endl; fPriGen = 0; @@ -113,7 +108,7 @@ void remollPrimaryGeneratorAction::SetGenerator(G4String& genname) } // Find primary generator - std::map::iterator prigen = fPriGenMap.find(genname); + auto prigen = fPriGenMap.find(genname); if (prigen != fPriGenMap.end()) { G4cout << "Setting generator to " << genname << G4endl; fPriGen = prigen->second; diff --git a/src/remollRunAction.cc b/src/remollRunAction.cc index 9e064a8ad..29d22012a 100644 --- a/src/remollRunAction.cc +++ b/src/remollRunAction.cc @@ -1,6 +1,5 @@ #include "remollRunAction.hh" -#include "G4GenericMessenger.hh" #include "G4RunManager.hh" #include "G4Timer.hh" @@ -14,36 +13,24 @@ namespace { G4Mutex remollRunActionMutex = G4MUTEX_INITIALIZER; } remollRunAction::remollRunAction() -: fInterval(10) { - // Create messenger to set the seed with single long int - fMessenger = new G4GenericMessenger(this,"/remoll/","Remoll properties"); - fMessenger->DeclareMethod( + fMessenger.DeclareMethod( "seed", &remollRunAction::UpdateSeed, "Set random engine seed") .SetParameterName("seed", false) .SetStates(G4State_PreInit,G4State_Idle); - fMessenger->DeclareMethod( + fMessenger.DeclareMethod( "interval", &remollRunAction::SetUpdateInterval, "Print this many progress points (i.e. 100 -> every 1%)") .SetParameterName("interval", false) .SetStates(G4State_PreInit,G4State_Idle); - // Create timer - fTimer = new G4Timer(); - // Store random status before primary particle generation G4RunManager::GetRunManager()->StoreRandomNumberStatusToG4Event(1); } -remollRunAction::~remollRunAction() -{ - delete fMessenger; - delete fTimer; -} - void remollRunAction::UpdateSeed(const G4long seed) { G4Random::setTheSeed(seed); @@ -71,7 +58,7 @@ void remollRunAction::BeginOfRunAction(const G4Run* run) { G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl; - fTimer->Start(); + fTimer.Start(); G4AutoLock lock(&remollRunActionMutex); remollIO* io = remollIO::GetInstance(); @@ -89,10 +76,10 @@ void remollRunAction::EndOfRunAction(const G4Run* run) if (IsMaster()) { - fTimer->Stop(); + fTimer.Stop(); G4cout << "### Run " << aRun->GetRunID() << " ended " - << "(" << fTimer->GetUserElapsed() << "s)." << G4endl; + << "(" << fTimer.GetUserElapsed() << "s)." << G4endl; G4AutoLock lock(&remollRunActionMutex); remollIO* io = remollIO::GetInstance(); diff --git a/src/remollSteppingAction.cc b/src/remollSteppingAction.cc index accffe3b0..10107e5c0 100644 --- a/src/remollSteppingAction.cc +++ b/src/remollSteppingAction.cc @@ -4,7 +4,6 @@ #include "G4Track.hh" #include "G4Material.hh" #include "G4MaterialTable.hh" -#include "G4GenericMessenger.hh" remollSteppingAction::remollSteppingAction() { diff --git a/src/remollTrackingAction.cc b/src/remollTrackingAction.cc index aa2393fc8..d063c5534 100644 --- a/src/remollTrackingAction.cc +++ b/src/remollTrackingAction.cc @@ -7,13 +7,10 @@ #include "G4Version.hh" #include "G4TrackingManager.hh" #include "G4OpticalPhoton.hh" -#include "G4GenericMessenger.hh" remollTrackingAction::remollTrackingAction() -: fMessenger(0),fTrackingFlag(3) { - fMessenger = new G4GenericMessenger(this,"/remoll/tracking/","Remoll tracking properties"); - fMessenger->DeclareProperty("set",fTrackingFlag) + fMessenger.DeclareProperty("set",fTrackingFlag) .SetGuidance("Select tracking flag") .SetGuidance(" 0 : Track primary electrons only") .SetGuidance(" 1 : Track primary electrons and optical photons only") @@ -24,11 +21,6 @@ remollTrackingAction::remollTrackingAction() .SetStates(G4State_PreInit,G4State_Idle); } -remollTrackingAction::~remollTrackingAction() -{ - delete fMessenger; -} - void remollTrackingAction::PreUserTrackingAction(const G4Track* aTrack) { G4VUserTrackInformation* usertrackinfo = aTrack->GetUserInformation(); diff --git a/src/remollVEventGen.cc b/src/remollVEventGen.cc index 61f5f0ca1..ddf1bee08 100644 --- a/src/remollVEventGen.cc +++ b/src/remollVEventGen.cc @@ -4,7 +4,6 @@ #include "G4ParticleGun.hh" #include "G4RotationMatrix.hh" -#include "G4GenericMessenger.hh" #include "remollBeamTarget.hh" #include "remollVertex.hh" @@ -25,38 +24,33 @@ remollVEventGen::remollVEventGen(const G4String name) : fName(name), fBeamPol("0"), fNumberOfParticles(1),fParticleGun(0), - fBeamTarg(0) + fBeamTarg(0), + fThisGenMessenger(this,"/remoll/evgen/" + name + "/","Remoll " + name + " generator properties") { // Set initial number of particles and create particle gun SetNumberOfParticles(fNumberOfParticles); // Create event generator messenger - fEvGenMessenger = new G4GenericMessenger(this,"/remoll/evgen/","Remoll event generator properties"); - fEvGenMessenger->DeclarePropertyWithUnit("emax","GeV",fE_max,"Maximum generation energy"); - fEvGenMessenger->DeclarePropertyWithUnit("emin","GeV",fE_min,"Minimum generation energy"); - fEvGenMessenger->DeclarePropertyWithUnit("thmax","deg",fTh_max,"Maximum generation theta angle"); - fEvGenMessenger->DeclarePropertyWithUnit("thmin","deg",fTh_min,"Minimum generation theta angle"); - fEvGenMessenger->DeclarePropertyWithUnit("phmax","deg",fPh_max,"Maximum generation phi angle"); - fEvGenMessenger->DeclarePropertyWithUnit("phmin","deg",fPh_min,"Minimum generation phi angle"); - fEvGenMessenger->DeclarePropertyWithUnit("thcommax","deg",fThCoM_max,"Maximum CoM generation theta angle"); - fEvGenMessenger->DeclarePropertyWithUnit("thcommin","deg",fThCoM_min,"Minimum CoM generation theta angle"); - fEvGenMessenger->DeclareProperty("beamPolarization",fBeamPol,"Polarization direction: +L, +H, +V, -L, -H, -V, 0"); - fEvGenMessenger->DeclareMethod( + fEvGenMessenger.DeclarePropertyWithUnit("emax","GeV",fE_max,"Maximum generation energy"); + fEvGenMessenger.DeclarePropertyWithUnit("emin","GeV",fE_min,"Minimum generation energy"); + fEvGenMessenger.DeclarePropertyWithUnit("thmax","deg",fTh_max,"Maximum generation theta angle"); + fEvGenMessenger.DeclarePropertyWithUnit("thmin","deg",fTh_min,"Minimum generation theta angle"); + fEvGenMessenger.DeclarePropertyWithUnit("phmax","deg",fPh_max,"Maximum generation phi angle"); + fEvGenMessenger.DeclarePropertyWithUnit("phmin","deg",fPh_min,"Minimum generation phi angle"); + fEvGenMessenger.DeclarePropertyWithUnit("thcommax","deg",fThCoM_max,"Maximum CoM generation theta angle"); + fEvGenMessenger.DeclarePropertyWithUnit("thcommin","deg",fThCoM_min,"Minimum CoM generation theta angle"); + fEvGenMessenger.DeclareProperty("beamPolarization",fBeamPol,"Polarization direction: +L, +H, +V, -L, -H, -V, 0"); + fEvGenMessenger.DeclareMethod( "printlimits", &remollVEventGen::PrintEventGen, "Print the event generator limits"); - // Create specific event generator messenger - fThisGenMessenger = new G4GenericMessenger(this,"/remoll/evgen/" + name + "/","Remoll " + name + " generator properties"); - - fSamplingType = kActiveTargetVolume; + fSamplingType = kActiveTargetVolume; fApplyMultScatt = false; } remollVEventGen::~remollVEventGen() { - delete fThisGenMessenger; - delete fEvGenMessenger; } void remollVEventGen::PrintEventGen() From 920d1eb53f248c43145cbd3a0a450fbacab552a3 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 14 Oct 2021 19:00:41 -0500 Subject: [PATCH 428/443] Re-enabling overlap macro for workflows --- macros/tests/geometry/overlap.mac | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 macros/tests/geometry/overlap.mac diff --git a/macros/tests/geometry/overlap.mac b/macros/tests/geometry/overlap.mac new file mode 100644 index 000000000..9b38703ec --- /dev/null +++ b/macros/tests/geometry/overlap.mac @@ -0,0 +1,3 @@ +/remoll/geometry/validate false +/remoll/geometry/overlapcheck true +/run/initialize From 27447452431b5bc201308757cff7ec219b1acbee Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 14 Oct 2021 20:25:39 -0500 Subject: [PATCH 429/443] workflows: ubuntu-20.04 and macos-10.15 The `-latest` targets change without notice (if you're not paying attention). --- .github/workflows/build-lcg-cvmfs.yml | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-lcg-cvmfs.yml b/.github/workflows/build-lcg-cvmfs.yml index b0e14ee83..0679cdc8f 100644 --- a/.github/workflows/build-lcg-cvmfs.yml +++ b/.github/workflows/build-lcg-cvmfs.yml @@ -4,19 +4,11 @@ on: [push, pull_request] jobs: linux: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: - LCG: ["LCG_101/x86_64-centos7-clang12-opt", - "LCG_101/x86_64-centos7-gcc11-opt", - "LCG_101/x86_64-centos7-gcc10-opt", - "LCG_101/x86_64-centos8-gcc11-opt", - "LCG_101/x86_64-ubuntu2004-gcc9-opt", - "LCG_99/x86_64-centos7-clang10-opt", - "LCG_99/x86_64-centos7-gcc10-opt", - "LCG_99/x86_64-centos7-gcc8-opt", - "LCG_99/x86_64-centos8-gcc10-opt", + LCG: ["LCG_101/x86_64-ubuntu2004-gcc9-opt", "LCG_99/x86_64-ubuntu2004-gcc9-opt"] steps: - uses: actions/checkout@v2 @@ -31,11 +23,10 @@ jobs: cmake --build build macos: - runs-on: macos-latest + runs-on: macos-10.15 strategy: matrix: - LCG: ["LCG_101/x86_64-mac11-clang120-opt", - "LCG_101/x86_64-mac1015-clang120-opt", + LCG: ["LCG_101/x86_64-mac1015-clang120-opt", "LCG_99/x86_64-mac1015-clang120-opt"] steps: - uses: actions/checkout@v2 From 86661339a167864d375c0630bcb9a8158b8e8f25 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 14 Oct 2021 20:27:57 -0500 Subject: [PATCH 430/443] workflows: build and test on ubuntu 20.04 --- .github/workflows/build-lcg-and-test.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-lcg-and-test.yml b/.github/workflows/build-lcg-and-test.yml index cf4a35145..e3e70fef5 100644 --- a/.github/workflows/build-lcg-and-test.yml +++ b/.github/workflows/build-lcg-and-test.yml @@ -3,12 +3,13 @@ name: Build LCG and Test on: [push, pull_request] env: + os: ubuntu-20.04 LCG: "LCG_101" - sys: "x86_64-centos7-clang12-opt" + sys: "x86_64-ubuntu2004-gcc9-opt" jobs: build: - runs-on: ubuntu-latest + runs-on: ${{ env.os }} strategy: fail-fast: false steps: @@ -32,7 +33,7 @@ jobs: retention-days: 1 test_geometries: - runs-on: ubuntu-latest + runs-on: ${{ env.os }} needs: build strategy: fail-fast: false @@ -64,7 +65,7 @@ jobs: retention-days: 3 test_macros: - runs-on: ubuntu-latest + runs-on: ${{ env.os }} needs: build strategy: fail-fast: false From caae8308fcbfdad3caf9f697c97d7d31ae7e5a0a Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 14 Oct 2021 20:58:28 -0500 Subject: [PATCH 431/443] workflows: test runs-on ubuntu-20.04 --- .github/workflows/build-lcg-and-test.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-lcg-and-test.yml b/.github/workflows/build-lcg-and-test.yml index e3e70fef5..9c6755f20 100644 --- a/.github/workflows/build-lcg-and-test.yml +++ b/.github/workflows/build-lcg-and-test.yml @@ -3,13 +3,12 @@ name: Build LCG and Test on: [push, pull_request] env: - os: ubuntu-20.04 LCG: "LCG_101" sys: "x86_64-ubuntu2004-gcc9-opt" jobs: build: - runs-on: ${{ env.os }} + runs-on: ubuntu-20.04 strategy: fail-fast: false steps: @@ -33,7 +32,7 @@ jobs: retention-days: 1 test_geometries: - runs-on: ${{ env.os }} + runs-on: ubuntu-20.04 needs: build strategy: fail-fast: false @@ -65,7 +64,7 @@ jobs: retention-days: 3 test_macros: - runs-on: ${{ env.os }} + runs-on: ubuntu-20.04 needs: build strategy: fail-fast: false From dbcf1a0082cdbc5c839fff06006c711ea09c3136 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 14 Oct 2021 21:28:57 -0500 Subject: [PATCH 432/443] Bugfix: #include for std::setw --- analysis/tests/test_power.C | 1 + 1 file changed, 1 insertion(+) diff --git a/analysis/tests/test_power.C b/analysis/tests/test_power.C index 5f7650e3e..039366fcc 100644 --- a/analysis/tests/test_power.C +++ b/analysis/tests/test_power.C @@ -6,6 +6,7 @@ part of this is taken from Rakitha's code coll_scan.cc */ #include #include +#include #include "remolltypes.hh" From c6d89f6ade74b6d07d5c907719f33b6b9fb2630d Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 15 Oct 2021 00:38:54 -0500 Subject: [PATCH 433/443] clang-tidy static analysis with cmake -DENABLE_CLANG_TIDY=ON --- .clang-format | 1 + .clang-tidy | 14 ++++++++++++++ CMakeLists.txt | 17 ++++++++++++++++- 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 .clang-format create mode 100644 .clang-tidy diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..63027b878 --- /dev/null +++ b/.clang-format @@ -0,0 +1 @@ +BasedOnStyle: LLVM diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 000000000..426494769 --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,14 @@ +HeaderFilterRegex: '' +Checks: ' + bugprone-*, + concurrency-*, + cppcoreguidelines-*, + modernize-*, + portability-*, + readability-*, + -modernize-use-trailing-return-type, + -modernize-avoid-c-arrays, + -modernize-use-nodiscard, + -readability-magic-numbers +' +FormatStyle: file diff --git a/CMakeLists.txt b/CMakeLists.txt index ed8a852ab..d7b86ee75 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,24 @@ #---------------------------------------------------------------------------- # Setup the project # -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.8) project(remoll VERSION 0.1 LANGUAGES CXX C) +# Export compile commands as json for run-clang-tidy +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +# Also use clang-tidy integration in CMake +option(ENABLE_CLANG_TIDY "Enable clang-tidy integration in cmake" OFF) +if(ENABLE_CLANG_TIDY) + find_program(CLANG_TIDY_EXE NAMES "clang-tidy") + if (CLANG_TIDY_EXE) + message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}") + set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXE}" CACHE STRING "" FORCE) + else() + set(CMAKE_CXX_CLANG_TIDY "" CACHE STRING "" FORCE) + endif() +endif() + # Disallow in-source builds if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) message(FATAL_ERROR "remoll requires an out-of-source build.") From 712541825c09772bbc9511293361b0484b1da109 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 15 Oct 2021 00:40:41 -0500 Subject: [PATCH 434/443] clang-tidy readability-implicit-bool-conversion fixes --- remoll.cc | 4 ++-- src/HepMCG4AsciiInterface.cc | 2 +- src/HepMCG4Interface.cc | 8 ++++---- src/remollBeamTarget.cc | 14 ++++++------- src/remollDetectorConstruction.cc | 32 ++++++++++++++--------------- src/remollEvent.cc | 6 +++--- src/remollEventAction.cc | 2 +- src/remollGenAl.cc | 2 +- src/remollGenBeam.cc | 2 +- src/remollGenC12.cc | 2 +- src/remollGenExternal.cc | 14 ++++++------- src/remollGenHyperon.cc | 6 +++--- src/remollGenericDetector.cc | 8 ++++---- src/remollGlobalField.cc | 20 +++++++++--------- src/remollHEPEvtInterface.cc | 6 +++--- src/remollIO.cc | 24 +++++++++++----------- src/remollParallelConstruction.cc | 10 ++++----- src/remollPhysicsList.cc | 20 +++++++++--------- src/remollPrimaryGeneratorAction.cc | 2 +- src/remollRun.cc | 2 +- src/remollSearchPath.cc | 2 +- src/remollTextFile.cc | 8 ++++---- src/remollTrackReconstruct.cc | 2 +- src/remollTrackingAction.cc | 6 +++--- src/remollVEventGen.cc | 2 +- 25 files changed, 103 insertions(+), 103 deletions(-) diff --git a/remoll.cc b/remoll.cc index 4651863fb..b4def9fe3 100644 --- a/remoll.cc +++ b/remoll.cc @@ -66,7 +66,7 @@ int main(int argc, char** argv) { #endif // Warn if LIBGL_ALWAYS_INDIRECT is set - if (std::getenv("LIBGL_ALWAYS_INDIRECT")) { + if (std::getenv("LIBGL_ALWAYS_INDIRECT") != nullptr) { G4cerr << "remoll: Environment variable LIBGL_ALWAYS_INDIRECT is set." << G4endl; G4cerr << "remoll: This may interfere with visualization. Unset wih:" << G4endl; G4cerr << "remoll: tcsh> unsetenv LIBGL_ALWAYS_INDIRECT" << G4endl; @@ -196,7 +196,7 @@ int main(int argc, char** argv) { G4String searchpath = "."; searchpath += ":" + std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll"; searchpath += ":" + std::string(CMAKE_INSTALL_FULL_DATADIR) + "/remoll/macros"; - if (macro.size()) + if (macro.size() != 0u) { // Run in batch mode // Copy contents of macro into buffer to be written out into ROOT file diff --git a/src/HepMCG4AsciiInterface.cc b/src/HepMCG4AsciiInterface.cc index c918297b9..a6a5f73af 100644 --- a/src/HepMCG4AsciiInterface.cc +++ b/src/HepMCG4AsciiInterface.cc @@ -63,7 +63,7 @@ void HepMCG4AsciiInterface::Initialize() HepMC::GenEvent* HepMCG4AsciiInterface::GenerateHepMCEvent() { HepMC::GenEvent* evt= asciiInput-> read_next_event(); - if(!evt) return 0; // no more event + if(evt == nullptr) return 0; // no more event if(verbose>0) evt-> print(); diff --git a/src/HepMCG4Interface.cc b/src/HepMCG4Interface.cc index 580ca5733..b93152563 100644 --- a/src/HepMCG4Interface.cc +++ b/src/HepMCG4Interface.cc @@ -49,7 +49,7 @@ HepMCG4Interface::HepMCG4Interface() //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... HepMCG4Interface::~HepMCG4Interface() { - if (hepmcEvent) delete hepmcEvent; + if (hepmcEvent != nullptr) delete hepmcEvent; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... @@ -81,7 +81,7 @@ void HepMCG4Interface::HepMC2G4(const HepMC::GenEvent* hepmcevt, pitr = (*vitr)->particles_begin(HepMC::children); pitr != (*vitr)->particles_end(HepMC::children); ++pitr) { - if (!(*pitr)->end_vertex() && (*pitr)->status() == 1) { + if (((*pitr)->end_vertex() == nullptr) && (*pitr)->status() == 1) { qvtx = true; break; } @@ -127,11 +127,11 @@ HepMC::GenEvent* HepMCG4Interface::GenerateHepMCEvent() void HepMCG4Interface::GeneratePrimaryVertex(G4Event* anEvent) { // delete previous event object - if (hepmcEvent) delete hepmcEvent; + if (hepmcEvent != nullptr) delete hepmcEvent; // generate next event hepmcEvent = GenerateHepMCEvent(); - if (! hepmcEvent) { + if (hepmcEvent == nullptr) { G4cout << "HepMCInterface: no generated particles. run terminated..." << G4endl; G4RunManager::GetRunManager()->AbortRun(); diff --git a/src/remollBeamTarget.cc b/src/remollBeamTarget.cc index 4f6c59acd..d6a82e447 100644 --- a/src/remollBeamTarget.cc +++ b/src/remollBeamTarget.cc @@ -169,15 +169,15 @@ void remollBeamTarget::UpdateInfo() G4Box* box = dynamic_cast(solid); // Assume everything is non-nested tubes - if (!tubs && !box) { + if ((tubs == nullptr) && (box == nullptr)) { G4cerr << "ERROR: " << __PRETTY_FUNCTION__ << " line " << __LINE__ << ": Target volume " << volume->GetName() << " not made of G4Tubs or G4Box" << G4endl; exit(1); } G4double z_half_length = 0; - if (tubs) z_half_length = tubs->GetZHalfLength(); - if (box) z_half_length = box->GetZHalfLength(); + if (tubs != nullptr) z_half_length = tubs->GetZHalfLength(); + if (box != nullptr) z_half_length = box->GetZHalfLength(); fTotalTargetEffectiveLength += 2.0 * z_half_length * material->GetDensity(); @@ -296,15 +296,15 @@ remollVertex remollBeamTarget::SampleVertex(SamplingType_t sampling_type) G4Tubs* tubs = dynamic_cast(solid); G4Box* box = dynamic_cast(solid); - if (!tubs && !box) { + if ((tubs == nullptr) && (box == nullptr)) { G4cerr << "ERROR: " << __PRETTY_FUNCTION__ << " line " << __LINE__ << ": Target volume " << volume->GetName() << " not made of G4Tubs or G4Box" << G4endl; continue; // exit(1); } G4double z_half_length = 0; - if (box) z_half_length = box->GetZHalfLength(); - if (tubs) z_half_length = tubs->GetZHalfLength(); + if (box != nullptr) z_half_length = box->GetZHalfLength(); + if (tubs != nullptr) z_half_length = tubs->GetZHalfLength(); // Effective length of this target volume G4double effective_length = z_half_length*2.0 * material->GetDensity(); @@ -345,7 +345,7 @@ remollVertex remollBeamTarget::SampleVertex(SamplingType_t sampling_type) break; } - if( material->GetBaseMaterial() ){ + if( material->GetBaseMaterial() != nullptr ){ G4cerr << __FILE__ << " " << __PRETTY_FUNCTION__ << ": The material you're using isn't" << " defined in a way we can use for multiple scattering calculations" << G4endl; G4cerr << "Aborting" << G4endl; diff --git a/src/remollDetectorConstruction.cc b/src/remollDetectorConstruction.cc index 3f5279d37..e5f744044 100644 --- a/src/remollDetectorConstruction.cc +++ b/src/remollDetectorConstruction.cc @@ -255,7 +255,7 @@ void remollDetectorConstruction::EnableKryptoniteVolume(G4String name) // Find volume G4LogicalVolume* logical_volume = G4LogicalVolumeStore::GetInstance()->GetVolume(name); - if (! logical_volume) { + if (logical_volume == nullptr) { G4cerr << __FILE__ << " line " << __LINE__ << ": Warning volume " << name << " unknown" << G4endl; return; } @@ -398,7 +398,7 @@ void remollDetectorConstruction::AbsolutePosition(G4String name, G4ThreeVector p // Find volume G4VPhysicalVolume* physical_volume = G4PhysicalVolumeStore::GetInstance()->GetVolume(name); - if (! physical_volume) { + if (physical_volume == nullptr) { G4cerr << __FILE__ << " line " << __LINE__ << ": Warning volume " << name << " unknown" << G4endl; return; } @@ -424,7 +424,7 @@ void remollDetectorConstruction::RelativePosition(G4String name, G4ThreeVector p // Find volume G4VPhysicalVolume* physical_volume = G4PhysicalVolumeStore::GetInstance()->GetVolume(name); - if (! physical_volume) { + if (physical_volume == nullptr) { G4cerr << __FILE__ << " line " << __LINE__ << ": Warning volume " << name << " unknown" << G4endl; return; } @@ -450,7 +450,7 @@ void remollDetectorConstruction::AbsoluteRotation(G4String name, G4ThreeVector r // Find volume G4VPhysicalVolume* physical_volume = G4PhysicalVolumeStore::GetInstance()->GetVolume(name); - if (! physical_volume) { + if (physical_volume == nullptr) { G4cerr << __FILE__ << " line " << __LINE__ << ": Warning volume " << name << " unknown" << G4endl; return; } @@ -489,7 +489,7 @@ void remollDetectorConstruction::RelativeRotation(G4String name, G4ThreeVector r // Find volume G4VPhysicalVolume* physical_volume = G4PhysicalVolumeStore::GetInstance()->GetVolume(name); - if (! physical_volume) { + if (physical_volume == nullptr) { G4cerr << __FILE__ << " line " << __LINE__ << ": Warning volume " << name << " unknown" << G4endl; return; } @@ -557,11 +557,11 @@ G4VPhysicalVolume* remollDetectorConstruction::ParseGDMLFile() // Change directory char cwd[MAXPATHLEN]; - if (!getcwd(cwd,MAXPATHLEN)) { + if (getcwd(cwd,MAXPATHLEN) == nullptr) { G4cerr << __FILE__ << " line " << __LINE__ << ": ERROR no current working directory" << G4endl; exit(-1); } - if (chdir(fGDMLPath)) { + if (chdir(fGDMLPath) != 0) { G4cerr << __FILE__ << " line " << __LINE__ << ": ERROR cannot change directory" << G4endl; exit(-1); } @@ -597,7 +597,7 @@ G4VPhysicalVolume* remollDetectorConstruction::ParseGDMLFile() io->GrabGDMLFiles(fGDMLFile); // Change directory back - if (chdir(cwd)) { + if (chdir(cwd) != 0) { G4cerr << __FILE__ << " line " << __LINE__ << ": ERROR cannot change directory" << G4endl; exit(-1); } @@ -778,7 +778,7 @@ void remollDetectorConstruction::ParseAuxiliaryVisibilityInfo() if ((*vit).type == "Visibility") { G4Colour colour(1.0,1.0,1.0); const G4VisAttributes* visAttribute_old = ((*iter).first)->GetVisAttributes(); - if (visAttribute_old) + if (visAttribute_old != nullptr) colour = visAttribute_old->GetColour(); G4VisAttributes visAttribute_new(colour); if ((*vit).value == "true") @@ -815,7 +815,7 @@ void remollDetectorConstruction::ParseAuxiliaryVisibilityInfo() G4Colour colour(1.0,1.0,1.0); const G4VisAttributes* visAttribute_old = ((*iter).first)->GetVisAttributes(); - if (visAttribute_old) + if (visAttribute_old != nullptr) colour = visAttribute_old->GetColour(); G4Colour colour_new( @@ -926,11 +926,11 @@ void remollDetectorConstruction::ParseAuxiliarySensDetInfo() it_dettype = NextAuxWithType(++it_dettype, list.end(), "DetType")) { // Set detector type - if (remollsd) remollsd->SetDetectorType(it_dettype->value); + if (remollsd != nullptr) remollsd->SetDetectorType(it_dettype->value); // Print detector type if (fVerboseLevel > 0) - if (remollsd) remollsd->PrintDetectorType(); + if (remollsd != nullptr) remollsd->PrintDetectorType(); } @@ -964,7 +964,7 @@ G4VPhysicalVolume* remollDetectorConstruction::Construct() void remollDetectorConstruction::LoadMagneticField() { // Remove existing field and load new field - if (fGlobalField) delete fGlobalField; + if (fGlobalField != nullptr) delete fGlobalField; fGlobalField = new remollGlobalField(); } @@ -985,7 +985,7 @@ void remollDetectorConstruction::SetUserLimits( { // Find volume G4LogicalVolume* logical_volume = G4LogicalVolumeStore::GetInstance()->GetVolume(name); - if (! logical_volume) { + if (logical_volume == nullptr) { G4cerr << __FILE__ << " line " << __LINE__ << ": Warning volume " << name << " unknown" << G4endl; return; } @@ -1008,7 +1008,7 @@ void remollDetectorConstruction::SetUserLimits( { // Get user limits G4UserLimits* userlimits = logical_volume->GetUserLimits(); - if (! userlimits) { + if (userlimits == nullptr) { userlimits = new G4UserLimits(); logical_volume->SetUserLimits(userlimits); } @@ -1136,7 +1136,7 @@ void remollDetectorConstruction::PrintGeometryTree( } // Print sensitive detector G4VSensitiveDetector* sd = aVolume->GetLogicalVolume()->GetSensitiveDetector(); - if (print && sd) + if (print && (sd != nullptr)) { remollGenericDetector* remollsd = dynamic_cast(sd); G4cout << " [" << remollsd->GetDetNo() << "]"; diff --git a/src/remollEvent.cc b/src/remollEvent.cc index 1c666ab86..97c51e51f 100644 --- a/src/remollEvent.cc +++ b/src/remollEvent.cc @@ -48,7 +48,7 @@ std::vector remollEvent::GetEventParticleIO() const { std::vector parts; for (size_t idx = 0; idx < fPartType.size(); idx++) { remollEventParticle_t part; - part.pid = (fPartType[idx]? fPartType[idx]->GetPDGEncoding(): 0); + part.pid = (fPartType[idx] != nullptr? fPartType[idx]->GetPDGEncoding(): 0); part.sx = fPartSpin[idx].x(); part.sy = fPartSpin[idx].y(); part.sz = fPartSpin[idx].z(); @@ -181,7 +181,7 @@ G4bool remollEvent::EventIsSane(){ } for(unsigned int i = 0; i < fPartPos.size(); i++ ){ - if( !fPartType[i] ){ return false; } + if( fPartType[i] == nullptr ){ return false; } if( std::isnan(fPartPos[i].x()) || std::isinf(fPartPos[i].x()) ) return false; if( std::isnan(fPartPos[i].y()) || std::isinf(fPartPos[i].y()) ) return false; @@ -209,7 +209,7 @@ void remollEvent::Print(){ unsigned int i; for( i = 0; i < fPartPos.size(); i++ ){ - if( !fPartType[i] ){ + if( fPartType[i] == nullptr ){ G4cout << "\tParticle type for " << i << " not defined" << G4endl; } else { G4cout << "\t" << fPartType[i]->GetParticleName() << ":" << G4endl; diff --git a/src/remollEventAction.cc b/src/remollEventAction.cc index 4c373ec9f..56677b704 100644 --- a/src/remollEventAction.cc +++ b/src/remollEventAction.cc @@ -54,7 +54,7 @@ void remollEventAction::EndOfEventAction(const G4Event* aEvent) auto n = HCE->GetCapacity(); for (decltype(n) hcidx = 0; hcidx < n; hcidx++) { G4VHitsCollection* thiscol = HCE->GetHC(hcidx); - if (thiscol){ // This is NULL if nothing is stored + if (thiscol != nullptr){ // This is NULL if nothing is stored // Dynamic cast to test types, process however see fit and feed to IO diff --git a/src/remollGenAl.cc b/src/remollGenAl.cc index 3632c2814..7c59ff7f1 100644 --- a/src/remollGenAl.cc +++ b/src/remollGenAl.cc @@ -138,7 +138,7 @@ void remollGenAl::GenInelastic(G4double beamE,G4double theta, G4int A=27; G4int Z=13; G4int bad=F1F2IN09(Z, A, Q2/GeV/GeV, W2/GeV/GeV, F1, F2); - if(bad){ + if(bad != 0){ G4cerr << "ERROR: " << __FILE__ << " line " << __LINE__ << G4endl; G4cerr << " result was (-1 = Q2,W2 out of range in resmodd | -2 = A<3 | 1 inf/nan F1/F2) : " << bad <FindParticle(name); - if (particle) fParticleName = name; + if (particle != nullptr) fParticleName = name; else { G4cerr << "remollGenBeam: particle " << name << " not recognized." << G4endl; exit(-1); diff --git a/src/remollGenC12.cc b/src/remollGenC12.cc index 3892b432f..7fb9add47 100644 --- a/src/remollGenC12.cc +++ b/src/remollGenC12.cc @@ -139,7 +139,7 @@ void remollGenC12::GenInelastic(G4double beamE,G4double theta, G4int A=12; G4int Z=6; G4int bad=F1F2IN09(Z, A, Q2/GeV/GeV, W2/GeV/GeV, F1, F2); - if(bad){ + if(bad != 0){ G4cerr << "ERROR: " << __FILE__ << " line " << __LINE__ << G4endl; G4cerr << " result was (-1 = Q2,W2 out of range in resmodd | -2 = A<3 | 1 inf/nan F1/F2) : " << bad <Close(); fTree = 0; } @@ -56,21 +56,21 @@ void remollGenExternal::SetGenExternalFile(G4String& filename) G4cout << "Setting the external file to " << filename << " from " << fFile << G4endl; // Close previous file - if (fFile) { + if (fFile != nullptr) { fFile->Close(); fFile = 0; } // Try to open filename fFile = new TFile(filename); - if (! fFile) { + if (fFile == nullptr) { G4cerr << "Could not open external event file " << filename << G4endl; return; } // Try to find tree in file fFile->GetObject("T",fTree); - if (! fTree) { + if (fTree == nullptr) { G4cerr << "Could not find tree T in event file (SetGenExternalFile)" << filename << G4endl; return; } @@ -79,14 +79,14 @@ void remollGenExternal::SetGenExternalFile(G4String& filename) fEntries = fTree->GetEntries(); // Initialize tree - if (fTree->GetBranch("hit")) { + if (fTree->GetBranch("hit") != nullptr) { fTree->SetBranchAddress("hit", &fHit); } else { G4cerr << "Could not find branch hit in event file " << filename << G4endl; return; } - if (fTree->GetBranch("ev")) { + if (fTree->GetBranch("ev") != nullptr) { fTree->SetBranchAddress("ev", &fEvent); } else { G4cerr << "Could not find branch ev in event file " << filename << G4endl; @@ -99,7 +99,7 @@ void remollGenExternal::SamplePhysics(remollVertex* /* vert */, remollEvent* evt G4AutoLock inFileLock(&inFileMutex); // Check whether three exists - if (! fTree) { + if (fTree == nullptr) { G4cerr << "Could not find tree T in event file (SamplePhysics)" << G4endl; return; } diff --git a/src/remollGenHyperon.cc b/src/remollGenHyperon.cc index 3b77e0c71..97d82de5c 100644 --- a/src/remollGenHyperon.cc +++ b/src/remollGenHyperon.cc @@ -40,13 +40,13 @@ remollGenHyperon::remollGenHyperon() remollGenHyperon::~remollGenHyperon() { G4AutoLock lock(&remollGenHyperonMutex); - if (fFileReader) { delete fFileReader; fFileReader = 0; } + if (fFileReader != nullptr) { delete fFileReader; fFileReader = 0; } } remollFileReader* remollGenHyperon::GetFileReader() const { G4AutoLock lock(&remollGenHyperonMutex); - if (! fFileReader) { + if (fFileReader == nullptr) { fFileReader = new remollFileReader(fFile,fSkip,fDebugLevel); } return fFileReader; @@ -57,7 +57,7 @@ void remollGenHyperon::SamplePhysics(remollVertex* /*vert*/, remollEvent* evt) remollFileEvent event; // Limit scope of mutex to read from buffered file - if (GetFileReader()) { + if (GetFileReader() != nullptr) { G4AutoLock lock(&remollGenHyperonMutex); event = fFileReader->GetAnEvent(); // don't use GetFileReader, race condition } diff --git a/src/remollGenericDetector.cc b/src/remollGenericDetector.cc index 51670d4a2..0ff4060c5 100644 --- a/src/remollGenericDetector.cc +++ b/src/remollGenericDetector.cc @@ -61,7 +61,7 @@ void remollGenericDetector::BuildStaticMessenger() G4AutoLock lock(&remollGenericDetectorMutex); // If already built, just return - if (fStaticMessenger) return; + if (fStaticMessenger != nullptr) return; fStaticMessenger = new G4GenericMessenger(this,"/remoll/SD/","Remoll SD properties"); fStaticMessenger->DeclareMethod( @@ -161,7 +161,7 @@ G4bool remollGenericDetector::ProcessHits(G4Step* step, G4TouchableHistory*) G4double edep = step->GetTotalEnergyDeposit(); // Create a detector sum for this detector, if necessary - if (! fSumMap.count(copyID)) { + if (fSumMap.count(copyID) == 0u) { remollGenericDetectorSum* sum = new remollGenericDetectorSum(fDetNo, copyID); fSumMap[copyID] = sum; fSumColl->insert(sum); @@ -171,7 +171,7 @@ G4bool remollGenericDetector::ProcessHits(G4Step* step, G4TouchableHistory*) sum->AddEDep(pid, pos, edep); // Create a running sum for this detector, if necessary - if (! fRunningSumMap.count(copyID)) { + if (fRunningSumMap.count(copyID) == 0u) { remollGenericDetectorSum* sum = new remollGenericDetectorSum(fDetNo, copyID); fRunningSumMap[copyID] = sum; } @@ -223,7 +223,7 @@ G4bool remollGenericDetector::ProcessHits(G4Step* step, G4TouchableHistory*) G4VUserTrackInformation* usertrackinfo = track->GetUserInformation(); remollUserTrackInformation* remollusertrackinfo = dynamic_cast(usertrackinfo); - if (remollusertrackinfo) { + if (remollusertrackinfo != nullptr) { // if stored postpoint status is fGeomBoundary if (remollusertrackinfo->GetStepStatus() == fGeomBoundary) firststepinvolume = true; diff --git a/src/remollGlobalField.cc b/src/remollGlobalField.cc index b340c3f0d..81578e457 100644 --- a/src/remollGlobalField.cc +++ b/src/remollGlobalField.cc @@ -86,9 +86,9 @@ remollGlobalField::remollGlobalField() remollGlobalField::~remollGlobalField() { - if (fEquation) delete fEquation; - if (fStepper) delete fStepper; - if (fChordFinder) delete fChordFinder; + if (fEquation != nullptr) delete fEquation; + if (fStepper != nullptr) delete fStepper; + if (fChordFinder != nullptr) delete fChordFinder; } void remollGlobalField::SetAccuracyParameters() @@ -117,7 +117,7 @@ void remollGlobalField::PrintAccuracyParameters() void remollGlobalField::SetEquation() { - if (fEquation) delete fEquation; + if (fEquation != nullptr) delete fEquation; switch (fEquationType) { @@ -139,7 +139,7 @@ void remollGlobalField::SetEquation() void remollGlobalField::SetStepper() { - if (fStepper) delete fStepper; + if (fStepper != nullptr) delete fStepper; switch (fStepperType) { @@ -175,7 +175,7 @@ void remollGlobalField::SetStepper() void remollGlobalField::SetChordFinder() { - if (fChordFinder) delete fChordFinder; + if (fChordFinder != nullptr) delete fChordFinder; fChordFinder = new G4ChordFinder(this,fMinStep,fStepper); fChordFinder->GetIntegrationDriver()->SetVerboseLevel(0); @@ -258,7 +258,7 @@ void remollGlobalField::GetFieldValue(const G4double p[], G4double *field) const void remollGlobalField::SetZOffset(const G4String& name, G4double offset) { remollMagneticField *field = GetFieldByName(name); - if (field) { + if (field != nullptr) { G4AutoLock lock(&remollGlobalFieldMutex); field->SetZoffset(offset); } else { @@ -270,7 +270,7 @@ void remollGlobalField::SetZOffset(const G4String& name, G4double offset) void remollGlobalField::SetInterpolationType(const G4String& name, const G4String& type) { remollMagneticField *field = GetFieldByName(name); - if (field) { + if (field != nullptr) { G4AutoLock lock(&remollGlobalFieldMutex); field->SetInterpolationType(type); } else { @@ -282,7 +282,7 @@ void remollGlobalField::SetInterpolationType(const G4String& name, const G4Strin void remollGlobalField::SetFieldScale(const G4String& name, G4double scale) { remollMagneticField *field = GetFieldByName(name); - if (field) { + if (field != nullptr) { G4AutoLock lock(&remollGlobalFieldMutex); field->SetFieldScale(scale); } else { @@ -294,7 +294,7 @@ void remollGlobalField::SetFieldScale(const G4String& name, G4double scale) void remollGlobalField::SetMagnetCurrent(const G4String& name, G4double current) { remollMagneticField *field = GetFieldByName(name); - if (field) { + if (field != nullptr) { G4AutoLock lock(&remollGlobalFieldMutex); field->SetRefCurrent(current); } else { diff --git a/src/remollHEPEvtInterface.cc b/src/remollHEPEvtInterface.cc index ee273aa48..8c815d4ba 100644 --- a/src/remollHEPEvtInterface.cc +++ b/src/remollHEPEvtInterface.cc @@ -52,20 +52,20 @@ remollHEPEvtInterface::remollHEPEvtInterface() remollHEPEvtInterface::~remollHEPEvtInterface() { G4AutoLock lock(&remollHEPEvtInterfaceMutex); - if(fHEPEvtInterface) { delete fHEPEvtInterface; fHEPEvtInterface = 0; } + if(fHEPEvtInterface != nullptr) { delete fHEPEvtInterface; fHEPEvtInterface = 0; } delete fMessenger; } void remollHEPEvtInterface::Initialize() { G4AutoLock lock(&remollHEPEvtInterfaceMutex); - if (fHEPEvtInterface) { delete fHEPEvtInterface; fHEPEvtInterface = 0; } + if (fHEPEvtInterface != nullptr) { delete fHEPEvtInterface; fHEPEvtInterface = 0; } fHEPEvtInterface = new G4HEPEvtInterface(fFilename,fVerbose); } void remollHEPEvtInterface::GeneratePrimaryVertex(G4Event* anEvent) { G4AutoLock lock(&remollHEPEvtInterfaceMutex); - if (!fHEPEvtInterface) { Initialize(); } + if (fHEPEvtInterface == nullptr) { Initialize(); } fHEPEvtInterface->GeneratePrimaryVertex(anEvent); } diff --git a/src/remollIO.cc b/src/remollIO.cc index 5308cdb4a..91f0db622 100644 --- a/src/remollIO.cc +++ b/src/remollIO.cc @@ -50,12 +50,12 @@ remollIO::remollIO(const G4String& outputfile) remollIO::~remollIO() { // Delete tree - if (fTree) { + if (fTree != nullptr) { delete fTree; fTree = NULL; } // Delete file - if (fFile) { + if (fFile != nullptr) { delete fFile; fFile = NULL; } @@ -63,14 +63,14 @@ remollIO::~remollIO() void remollIO::InitializeTree() { - if (fFile) { + if (fFile != nullptr) { fFile->Close(); delete fFile; fFile = NULL; fTree = NULL; } - if (fTree) { + if (fTree != nullptr) { delete fTree; fTree = NULL; } @@ -105,7 +105,7 @@ void remollIO::InitializeTree() void remollIO::FillTree() { - if( !fTree ){ + if( fTree == nullptr ){ G4cerr << "Error " << __PRETTY_FUNCTION__ << ": " << __FILE__ << " line " << __LINE__ << " - Trying to fill non-existent tree" << G4endl; @@ -132,7 +132,7 @@ void remollIO::Flush() void remollIO::WriteTree() { - if (!fFile) + if (fFile == nullptr) return; if (!fFile->IsOpen()) { @@ -166,7 +166,7 @@ void remollIO::WriteTree() void remollIO::SetEventData(const remollEvent *ev) { - if (! ev) return; + if (ev == nullptr) return; fRate = ev->fRate*s; @@ -177,7 +177,7 @@ void remollIO::SetEventData(const remollEvent *ev) // Beam data const remollBeamTarget* bt = ev->GetBeamTarget(); - if (bt) + if (bt != nullptr) fBm = bt->GetBeamTargetIO(); } @@ -267,15 +267,15 @@ void remollIO::SearchGDMLforFiles(G4String fn) str_docURI.erase(str_docURI.find_last_of('/') + 1); // remove cwd at begin char cwd[MAXPATHLEN]; - if (getcwd(cwd,MAXPATHLEN) && str_docURI.find(cwd) == 0) { + if ((getcwd(cwd,MAXPATHLEN) != nullptr) && str_docURI.find(cwd) == 0) { str_docURI.erase(0, strlen(cwd) + 1); } // Get doctype and entities xercesc::DOMDocumentType* xmlDocType = xmlDoc->getDoctype(); - if (xmlDocType) { + if (xmlDocType != nullptr) { xercesc::DOMNamedNodeMap* xmlNamedNodeMap = xmlDocType->getEntities(); - if (xmlNamedNodeMap) { + if (xmlNamedNodeMap != nullptr) { for (XMLSize_t xx = 0; xx < xmlNamedNodeMap->getLength(); ++xx) { xercesc::DOMNode* currentNode = xmlNamedNodeMap->item(xx); if (currentNode->getNodeType() == xercesc::DOMNode::ENTITY_NODE) { // is entity @@ -309,7 +309,7 @@ void remollIO::TraverseChildren( xercesc::DOMElement *thisel ) for( XMLSize_t xx = 0; xx < nodeCount; ++xx ){ xercesc::DOMNode* currentNode = children->item(xx); - if( currentNode->getNodeType() ){ // true is not NULL + if( currentNode->getNodeType() != 0u ){ // true is not NULL if (currentNode->getNodeType() == xercesc::DOMNode::ELEMENT_NODE) { // is element xercesc::DOMElement* currentElement diff --git a/src/remollParallelConstruction.cc b/src/remollParallelConstruction.cc index 63ce1bcb7..9f38759cb 100644 --- a/src/remollParallelConstruction.cc +++ b/src/remollParallelConstruction.cc @@ -131,11 +131,11 @@ G4VPhysicalVolume* remollParallelConstruction::ParseGDMLFile() // Change directory char cwd[MAXPATHLEN]; - if (!getcwd(cwd,MAXPATHLEN)) { + if (getcwd(cwd,MAXPATHLEN) == nullptr) { G4cerr << __FILE__ << " line " << __LINE__ << ": ERROR no current working directory" << G4endl; exit(-1); } - if (chdir(fGDMLPath)) { + if (chdir(fGDMLPath) != 0) { G4cerr << __FILE__ << " line " << __LINE__ << ": ERROR cannot change directory" << G4endl; exit(-1); } @@ -156,7 +156,7 @@ G4VPhysicalVolume* remollParallelConstruction::ParseGDMLFile() io->GrabGDMLFiles(fGDMLFile); // Change directory back - if (chdir(cwd)) { + if (chdir(cwd) != 0) { G4cerr << __FILE__ << " line " << __LINE__ << ": ERROR cannot change directory" << G4endl; exit(-1); } @@ -208,7 +208,7 @@ void remollParallelConstruction::ParseAuxiliaryVisibilityInfo() if ((*vit).type == "Visibility") { G4Colour colour(1.0,1.0,1.0); const G4VisAttributes* visAttribute_old = ((*iter).first)->GetVisAttributes(); - if (visAttribute_old) + if (visAttribute_old != nullptr) colour = visAttribute_old->GetColour(); G4VisAttributes visAttribute_new(colour); if ((*vit).value == "true") @@ -245,7 +245,7 @@ void remollParallelConstruction::ParseAuxiliaryVisibilityInfo() G4Colour colour(1.0,1.0,1.0); const G4VisAttributes* visAttribute_old = ((*iter).first)->GetVisAttributes(); - if (visAttribute_old) + if (visAttribute_old != nullptr) colour = visAttribute_old->GetColour(); G4Colour colour_new( diff --git a/src/remollPhysicsList.cc b/src/remollPhysicsList.cc index 81a25faf3..bf1dedbff 100644 --- a/src/remollPhysicsList.cc +++ b/src/remollPhysicsList.cc @@ -38,9 +38,9 @@ remollPhysicsList::remollPhysicsList() EnableStepLimiterPhysics(); EnableParallelPhysics(); DisableOpticalPhysics(); - G4cout << "remoll: step limiter physics is " << (fStepLimiterPhysics? "enabled":"disabled") << G4endl; - G4cout << "remoll: parallel physics is " << (fParallelPhysics? "enabled":"disabled") << G4endl; - G4cout << "remoll: optical physics is " << (fOpticalPhysics? "enabled":"disabled") << G4endl; + G4cout << "remoll: step limiter physics is " << (fStepLimiterPhysics != nullptr? "enabled":"disabled") << G4endl; + G4cout << "remoll: parallel physics is " << (fParallelPhysics != nullptr? "enabled":"disabled") << G4endl; + G4cout << "remoll: optical physics is " << (fOpticalPhysics != nullptr? "enabled":"disabled") << G4endl; // Create commands fPhysListMessenger.DeclareMethod( @@ -126,7 +126,7 @@ void remollPhysicsList::SetParallelPhysics(G4bool flag) void remollPhysicsList::EnableParallelPhysics() { - if (fParallelPhysics) { + if (fParallelPhysics != nullptr) { G4cout << "Parallel physics already active" << G4endl; return; } @@ -145,7 +145,7 @@ void remollPhysicsList::EnableParallelPhysics() void remollPhysicsList::DisableParallelPhysics() { - if (!fParallelPhysics) { + if (fParallelPhysics == nullptr) { G4cout << "Parallel physics not active" << G4endl; return; } @@ -170,7 +170,7 @@ void remollPhysicsList::SetOpticalPhysics(G4bool flag) void remollPhysicsList::EnableOpticalPhysics() { - if (fOpticalPhysics) { + if (fOpticalPhysics != nullptr) { G4cout << "Optical physics already active" << G4endl; return; } @@ -188,7 +188,7 @@ void remollPhysicsList::EnableOpticalPhysics() void remollPhysicsList::DisableOpticalPhysics() { - if (!fOpticalPhysics) { + if (fOpticalPhysics == nullptr) { G4cout << "Optical physics not active" << G4endl; return; } @@ -213,7 +213,7 @@ void remollPhysicsList::SetStepLimiterPhysics(G4bool flag) void remollPhysicsList::EnableStepLimiterPhysics() { - if (fStepLimiterPhysics) { + if (fStepLimiterPhysics != nullptr) { G4cout << "Step limiter already active" << G4endl; return; } @@ -235,7 +235,7 @@ void remollPhysicsList::EnableStepLimiterPhysics() void remollPhysicsList::DisableStepLimiterPhysics() { - if (!fStepLimiterPhysics) { + if (fStepLimiterPhysics == nullptr) { G4cout << "Step limiter physics not active" << G4endl; return; } @@ -320,7 +320,7 @@ void remollPhysicsList::RegisterReferencePhysList(G4String name) } // Remove previous reference physics list - if (fReferencePhysList) RemoveReferencePhysList(); + if (fReferencePhysList != nullptr) RemoveReferencePhysList(); // Get reference physics list fReferencePhysList = factory.GetReferencePhysList(name); diff --git a/src/remollPrimaryGeneratorAction.cc b/src/remollPrimaryGeneratorAction.cc index c14f969a0..c850a73a7 100644 --- a/src/remollPrimaryGeneratorAction.cc +++ b/src/remollPrimaryGeneratorAction.cc @@ -134,7 +134,7 @@ void remollPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) } // Delete old primary event - if (fEvent) { + if (fEvent != nullptr) { delete fEvent; fEvent = 0; } diff --git a/src/remollRun.cc b/src/remollRun.cc index 29f52b96a..744e621e5 100644 --- a/src/remollRun.cc +++ b/src/remollRun.cc @@ -6,7 +6,7 @@ remollRunData* remollRun::fRunData = 0; remollRunData* remollRun::GetRunData() { - if (!fRunData) { + if (fRunData == nullptr) { fRunData = new remollRunData(); fRunData->Init(); } diff --git a/src/remollSearchPath.cc b/src/remollSearchPath.cc index c83e35b78..fdb6b670a 100644 --- a/src/remollSearchPath.cc +++ b/src/remollSearchPath.cc @@ -22,7 +22,7 @@ remollSearchPath::remollSearchPath() { } remollSearchPath *remollSearchPath::getInstance() { - if (!fInstance) { + if (fInstance == nullptr) { fInstance = new remollSearchPath(); } return fInstance; diff --git a/src/remollTextFile.cc b/src/remollTextFile.cc index 791131e6b..2af3bd659 100644 --- a/src/remollTextFile.cc +++ b/src/remollTextFile.cc @@ -42,12 +42,12 @@ remollTextFile::remollTextFile(const remollTextFile& r) const remollTextFile& remollTextFile::operator=(const remollTextFile& r){ TObject::operator=(r); - if (fFilename) { delete[] fFilename; } + if (fFilename != nullptr) { delete[] fFilename; } fFilenameSize = r.fFilenameSize; fFilename = new char[r.fFilenameSize]; strncpy(fFilename, r.fFilename, fFilenameSize); - if (fBuffer) { delete[] fBuffer; } + if (fBuffer != nullptr) { delete[] fBuffer; } fBufferSize = r.fBufferSize; fBuffer = new char[r.fBufferSize]; memcpy(fBuffer, r.fBuffer, fBufferSize); @@ -56,8 +56,8 @@ const remollTextFile& remollTextFile::operator=(const remollTextFile& r){ } remollTextFile::~remollTextFile(){ - if (fFilename) { delete[] fFilename; } - if (fBuffer) { delete[] fBuffer; } + if (fFilename != nullptr) { delete[] fFilename; } + if (fBuffer != nullptr) { delete[] fBuffer; } } void remollTextFile::copyFileIn(const char *fn){ diff --git a/src/remollTrackReconstruct.cc b/src/remollTrackReconstruct.cc index 9a6965802..f7c042678 100644 --- a/src/remollTrackReconstruct.cc +++ b/src/remollTrackReconstruct.cc @@ -241,7 +241,7 @@ G4ThreeVector remollTrackReconstruct::EvaluateTrack(std::vector rPosX // invert matXZ G4double detXZ = matXZ[0][0]*matXZ[1][1] - matXZ[0][1]*matXZ[1][0]; - if(!detXZ){ + if(detXZ == 0.0){ // G4cerr << "** Can't invert the matrix because determinant is ZERO **" << G4endl; return G4ThreeVector(-1000/m,-1000/m,0); // in m } diff --git a/src/remollTrackingAction.cc b/src/remollTrackingAction.cc index d063c5534..172aaf806 100644 --- a/src/remollTrackingAction.cc +++ b/src/remollTrackingAction.cc @@ -24,7 +24,7 @@ remollTrackingAction::remollTrackingAction() void remollTrackingAction::PreUserTrackingAction(const G4Track* aTrack) { G4VUserTrackInformation* usertrackinfo = aTrack->GetUserInformation(); - if (! usertrackinfo) { + if (usertrackinfo == nullptr) { #if G4VERSION_NUMBER >= 1030 aTrack->SetUserInformation(new remollUserTrackInformation()); #else @@ -69,10 +69,10 @@ void remollTrackingAction::PreUserTrackingAction(const G4Track* aTrack) void remollTrackingAction::PostUserTrackingAction(const G4Track* aTrack) { G4VUserTrackInformation* usertrackinfo = aTrack->GetUserInformation(); - if (usertrackinfo) { + if (usertrackinfo != nullptr) { remollUserTrackInformation* remollusertrackinfo = dynamic_cast(usertrackinfo); - if (remollusertrackinfo) { + if (remollusertrackinfo != nullptr) { G4StepStatus stepstatus = aTrack->GetStep()->GetPostStepPoint()->GetStepStatus(); remollusertrackinfo->SetStepStatus(stepstatus); } diff --git a/src/remollVEventGen.cc b/src/remollVEventGen.cc index 9ee47384b..91db6bcfd 100644 --- a/src/remollVEventGen.cc +++ b/src/remollVEventGen.cc @@ -68,7 +68,7 @@ void remollVEventGen::SetNumberOfParticles(G4int n) fNumberOfParticles = n; // Delete old particle gun - if (fParticleGun) { + if (fParticleGun != nullptr) { delete fParticleGun; fParticleGun = 0; } From fe20ad34b6b69b18f2102584b516a3f20bad44db Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 15 Oct 2021 00:43:32 -0500 Subject: [PATCH 435/443] clang-tidy readability-delete-null-pointer fixes --- src/HepMCG4Interface.cc | 4 ++-- src/remollDetectorConstruction.cc | 2 +- src/remollGlobalField.cc | 12 ++++++------ src/remollTextFile.cc | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/HepMCG4Interface.cc b/src/HepMCG4Interface.cc index b93152563..a3e7bb61f 100644 --- a/src/HepMCG4Interface.cc +++ b/src/HepMCG4Interface.cc @@ -49,7 +49,7 @@ HepMCG4Interface::HepMCG4Interface() //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... HepMCG4Interface::~HepMCG4Interface() { - if (hepmcEvent != nullptr) delete hepmcEvent; + delete hepmcEvent; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... @@ -127,7 +127,7 @@ HepMC::GenEvent* HepMCG4Interface::GenerateHepMCEvent() void HepMCG4Interface::GeneratePrimaryVertex(G4Event* anEvent) { // delete previous event object - if (hepmcEvent != nullptr) delete hepmcEvent; + delete hepmcEvent; // generate next event hepmcEvent = GenerateHepMCEvent(); diff --git a/src/remollDetectorConstruction.cc b/src/remollDetectorConstruction.cc index e5f744044..3c32dbdea 100644 --- a/src/remollDetectorConstruction.cc +++ b/src/remollDetectorConstruction.cc @@ -964,7 +964,7 @@ G4VPhysicalVolume* remollDetectorConstruction::Construct() void remollDetectorConstruction::LoadMagneticField() { // Remove existing field and load new field - if (fGlobalField != nullptr) delete fGlobalField; + delete fGlobalField; fGlobalField = new remollGlobalField(); } diff --git a/src/remollGlobalField.cc b/src/remollGlobalField.cc index 81578e457..f6eeda60b 100644 --- a/src/remollGlobalField.cc +++ b/src/remollGlobalField.cc @@ -86,9 +86,9 @@ remollGlobalField::remollGlobalField() remollGlobalField::~remollGlobalField() { - if (fEquation != nullptr) delete fEquation; - if (fStepper != nullptr) delete fStepper; - if (fChordFinder != nullptr) delete fChordFinder; + delete fEquation; + delete fStepper; + delete fChordFinder; } void remollGlobalField::SetAccuracyParameters() @@ -117,7 +117,7 @@ void remollGlobalField::PrintAccuracyParameters() void remollGlobalField::SetEquation() { - if (fEquation != nullptr) delete fEquation; + delete fEquation; switch (fEquationType) { @@ -139,7 +139,7 @@ void remollGlobalField::SetEquation() void remollGlobalField::SetStepper() { - if (fStepper != nullptr) delete fStepper; + delete fStepper; switch (fStepperType) { @@ -175,7 +175,7 @@ void remollGlobalField::SetStepper() void remollGlobalField::SetChordFinder() { - if (fChordFinder != nullptr) delete fChordFinder; + delete fChordFinder; fChordFinder = new G4ChordFinder(this,fMinStep,fStepper); fChordFinder->GetIntegrationDriver()->SetVerboseLevel(0); diff --git a/src/remollTextFile.cc b/src/remollTextFile.cc index 2af3bd659..61a62417d 100644 --- a/src/remollTextFile.cc +++ b/src/remollTextFile.cc @@ -42,12 +42,12 @@ remollTextFile::remollTextFile(const remollTextFile& r) const remollTextFile& remollTextFile::operator=(const remollTextFile& r){ TObject::operator=(r); - if (fFilename != nullptr) { delete[] fFilename; } + delete[] fFilename; fFilenameSize = r.fFilenameSize; fFilename = new char[r.fFilenameSize]; strncpy(fFilename, r.fFilename, fFilenameSize); - if (fBuffer != nullptr) { delete[] fBuffer; } + delete[] fBuffer; fBufferSize = r.fBufferSize; fBuffer = new char[r.fBufferSize]; memcpy(fBuffer, r.fBuffer, fBufferSize); @@ -56,8 +56,8 @@ const remollTextFile& remollTextFile::operator=(const remollTextFile& r){ } remollTextFile::~remollTextFile(){ - if (fFilename != nullptr) { delete[] fFilename; } - if (fBuffer != nullptr) { delete[] fBuffer; } + delete[] fFilename; + delete[] fBuffer; } void remollTextFile::copyFileIn(const char *fn){ From 6376ce17f93951de991dadf2f0d23b161fabb8a4 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 15 Oct 2021 01:04:06 -0500 Subject: [PATCH 436/443] clang-tidy readability-make-member-function-const fixes --- include/remollBeamTarget.hh | 2 +- src/remollBeamTarget.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/remollBeamTarget.hh b/include/remollBeamTarget.hh index 4cd841d24..fe7be08b9 100644 --- a/include/remollBeamTarget.hh +++ b/include/remollBeamTarget.hh @@ -82,7 +82,7 @@ class remollBeamTarget { remollBeamTarget(); virtual ~remollBeamTarget(); - G4double GetEffLumin(SamplingType_t); + G4double GetEffLumin(SamplingType_t) const; remollVertex SampleVertex(SamplingType_t); diff --git a/src/remollBeamTarget.cc b/src/remollBeamTarget.cc index d6a82e447..30d9d1111 100644 --- a/src/remollBeamTarget.cc +++ b/src/remollBeamTarget.cc @@ -76,7 +76,7 @@ remollBeamTarget::~remollBeamTarget() { } -G4double remollBeamTarget::GetEffLumin(SamplingType_t sampling_type) +G4double remollBeamTarget::GetEffLumin(SamplingType_t sampling_type) const { if (sampling_type == kNoTargetVolume) return fBeamCurrent / (e_SI*coulomb); // no length, just frequency From 7a6d5400335e47a08b81025989172812e741ed45 Mon Sep 17 00:00:00 2001 From: Kate Evans Date: Tue, 26 Oct 2021 02:27:34 -0400 Subject: [PATCH 437/443] This will update the sieve position in the z axis so that it is 10cm upstream of collimator 1. Previously its z location overlapped with coll1, which wouldn't work during the experiment because we want to be able to slide the sieve in and out of the beamline along the x axis. --- geometry/positions.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/geometry/positions.xml b/geometry/positions.xml index ee4783837..e67218f71 100644 --- a/geometry/positions.xml +++ b/geometry/positions.xml @@ -64,8 +64,8 @@ - - + + From e8f68fe51deef917b70ebc77837cd21e97f9d558 Mon Sep 17 00:00:00 2001 From: Kate Evans Date: Wed, 27 Oct 2021 11:41:32 -0400 Subject: [PATCH 438/443] This will add scripts that I have made for the Punch Through Studies. This includes punch through the sieve and blocker. --- .../PunchThroughStudies/BlockerPunchThru##0.C | 216 +++++++++++ .../PunchThroughStudies/PunchThru##C12ep.C | 352 ++++++++++++++++++ 2 files changed, 568 insertions(+) create mode 100644 scripts/PunchThroughStudies/BlockerPunchThru##0.C create mode 100644 scripts/PunchThroughStudies/PunchThru##C12ep.C diff --git a/scripts/PunchThroughStudies/BlockerPunchThru##0.C b/scripts/PunchThroughStudies/BlockerPunchThru##0.C new file mode 100644 index 000000000..e70e6d920 --- /dev/null +++ b/scripts/PunchThroughStudies/BlockerPunchThru##0.C @@ -0,0 +1,216 @@ +// Simple example macro for reroot analysis of remoll simulations for MOLLER +// +// Need to use reroot (CERN's root compiled with special remoll libraries, +// or root when you have linked to ibremoll.so, i.e. by a command like +// setenv LD_PRELOAD build/libremoll.so +// needs to have a subdirectory "images/Blocker" defined for the images to go to +// +// Run using (for example): +// build/reroot +// .L scripts/BlockerPunchThru##0.C +// BlockerPunchThru##0() +// +// Can put multiple root files in the script, and they will be chained together. +// +// This script will take root files of a certain Blocker thickness. It will first loop +// through the events and flag any in which a primary particle hits a Blocker hole. +// Then it will exclude these flagged events and plot electrons and positrons that hit +// upstream and downstream of the surface of the Blocker. Those particles that hit +// downstream of the surface are flagged as "punch through particles". +// Punch-through particles are plotted on the rings of the main detector. An +// xy plot and radial plot are included. Finally, all charged particles that reach the +// main detector rings are plotted (xy and r). + +#include +void BlockerPunchThru##0() +{ + //Allow Tree to use the root files that you call + TChain* T = new TChain("T"); + + //Add files from the directory "rootfilesPT/", "##0" is the Blocker thickness in mm. Replace these root files with whatever root files you would like to analyze. + T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_##0mm0.root"); + T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_##0mm1.root"); + T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_##0mm2.root"); + T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_##0mm3.root"); + T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_##0mm4.root"); + T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_##0mm5.root"); + T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_##0mm6.root"); + T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_##0mm7.root"); + T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_##0mm8.root"); + T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_##0mm9.root"); + + //Define variables that we will loop over later + Double_t rate = 0; + std::vector* parts = 0; + std::vector* hits = 0; + + //Define some branches of the Tree (which is "T") + T->SetBranchAddress("rate", &rate); + T->SetBranchAddress("hit", &hits); + T->SetBranchAddress("part", &parts); + + gROOT -> SetBatch(kTRUE); + +//---------------------------------------------------------------------------- + + //Define Histograms that we will fill later + + //---Blocker Surfaces--- + + //2D histogram for e+ and e- hitting the upstream Blocker surface + TH2F *us_Blocker_virt = new TH2F("us_Blocker_virt","Upstream Blocker (##0mm) Virtual Detector Charged Particle Hits", 100, -150, 150, 100, -150, 150); + us_Blocker_virt -> GetXaxis() -> SetTitle("x Position of Hits [mm]"); + us_Blocker_virt -> GetYaxis() -> SetTitle("y Position of Hits [mm]"); + + //2D histogram for e+ and e- hitting the downstream Blocker surface, i.e., the particles that punch through the Blocker + TH2F *ds_Blocker_virt = new TH2F("ds_Blocker_virt","Downstream Blocker (##0mm) Virtual Detector Charged Particle Hits", 100, -150, 150, 100, -150, 150); + ds_Blocker_virt -> GetXaxis() -> SetTitle("x Position of Hits [mm]"); + ds_Blocker_virt -> GetYaxis() -> SetTitle("y Position of Hits [mm]"); + + //---Main Detector PT--- + + //1D histogram for e+ and e- that punch through the Blocker and make it to the main detector on the rings + TH1F *radial_main = new TH1F("radial_main","Energies of Charged Particles that Exited the Downstream Blocker (##0mm) Surface and Hit the Main Detector", 50, 0, 1500); + radial_main -> GetXaxis() -> SetTitle("Energies of Hits [MeV]"); + + //2D histogram for particles that punch through the Blocker and make it to the main detector on the rings (xy plot) + TH2F *punch_thru_xy_main = new TH2F("punch_thru_xy_main","Charged Particles that Exited the Downstream Blocker (##0mm) Surface and Hit the Main Detector", 100, -1200, 1200, 100, -1200, 1200); + punch_thru_xy_main -> GetXaxis() -> SetTitle("x Position of Hits [mm]"); + punch_thru_xy_main -> GetYaxis() -> SetTitle("y Position of Hits [mm]"); + + //---All Charged Particles--- + + //1D histogram for e+ and e- that make it to the main detector on the rings + TH1F *radial_main_all = new TH1F("radial_main_all","Energies of All Charged Particles that Hit the Main Detector for a ##0mm Blocker", 50, 0, 1500); + radial_main_all -> GetXaxis() -> SetTitle("Energies of Hits [MeV]"); + + //2D histogram for particles that make it to the main detector on the rings (xy plot) + TH2F *xy_main_all = new TH2F("xy_main_all","All Charged Particles that Hit the Main Detector for a ##0mm Blocker", 100, -1200, 1200, 100, -1200, 1200); + xy_main_all -> GetXaxis() -> SetTitle("x Position of Hits [mm]"); + xy_main_all -> GetYaxis() -> SetTitle("y Position of Hits [mm]"); + + //---Booleans--- + + //Define logical flag for punch-through + bool punch_thru = false; + +//---------------------------------------------------------------------------- + + //Loop over all events + for (size_t iev = 0; iev < T->GetEntries(); iev++) + { + T->GetEntry(iev); + + punch_thru = false; + + //Process over hits + for (size_t ihit = 0; ihit < hits->size(); ihit++) + { + remollGenericDetectorHit_t hit = hits->at(ihit); + + if ((hit.pid==11 || hit.pid==-11)&& hit.r >=35.306 && hit.r<97.9932) + { + + if (hit.det == 1004 && hit.pz >= 0) + { + us_Blocker_virt -> Fill(hit.x, hit.y, rate); + }//end upstream if + + if (hit.det == 1005 && hit.pz >= 0) + { + ds_Blocker_virt -> Fill(hit.x, hit.y, rate); + //Flag particles as "punch through particles" + punch_thru = true; + }//end downstream if + + }//end pid and hole if + + }//end process over hits + + //process over hits again to look at the main detector + for (size_t ihit = 0; ihit < hits->size(); ihit++) + { + remollGenericDetectorHit_t hit = hits->at(ihit); + + //Only look at "punch through particles" that hit the main detector on rings 1-7 and make sure they are e- or e+ with positive z momentum. + if (punch_thru && hit.det==28 && hit.r>=650 && hit.r<=1200 && (hit.pid==11 || hit.pid==-11) && hit.pz>=0) + { + punch_thru_xy_main -> Fill(hit.x, hit.y, rate); + radial_main -> Fill(hit.e, rate); + }//end main det if + + //Only look at charged particles that hit the main detector on rings 1-7. + if (hit.det==28 && hit.r>=650 && hit.r<=1200 && hit.pz>=0 && (hit.pid==11 || hit.pid==-11)) + { + xy_main_all -> Fill(hit.x, hit.y, rate); + radial_main_all -> Fill(hit.e, rate); + }//end main det if + + }//end process over hits + }//end process over events + +//-------------------------------------------------------------------------------- +//Draw and save the histograms + + //---Blocker Surfaces--- + + //Create a canvas on which to draw the histograms + TCanvas *virt = new TCanvas("virt","Charged Particles Hitting the Virtual Detectors Upstream and Downstream of the Blocker", 1000, 1000, 1000, 1000); + + //Divide the canvas into 1 column, 2 rows + virt -> Divide(1,2); + + //Look at the first entry on the canvas and draw the upstream detector + virt -> cd(1); + us_Blocker_virt -> Draw("colz"); + + //Look at the second entry on the canvas and draw the downstream detector + virt -> cd(2); + ds_Blocker_virt -> Draw("colz"); + + //Save the canvas as an image in the director "remoll/images/Blocker/" + virt -> SaveAs("images/Blocker/Punch_Thru_US_DS_WBlocker_##0.png"); + + + //---Main Detector PT--- + + //Create a canvas on which to draw the histograms + TCanvas *main = new TCanvas("main","Electrons and Positrons Hitting the Main Detector", 1000, 1000, 1000, 1000); + + //Divide the canvas into 1 column, 2 rows + main -> Divide(1,2); + + //Look at the first entry on the canvas and draw the xy main detector + main -> cd(1); + punch_thru_xy_main -> Draw("colz"); + + //Look at the second entry on the canvas and draw the r main detector + main -> cd(2); + radial_main -> Draw("B"); + + //Save the canvas as an image in the director "remoll/images/Blocker/" + main -> SaveAs("images/Blocker/Punch_Thru_Main_WBlocker_##0.png"); + + + //---Main Detector--- + + //Create a canvas on which to draw the histograms + TCanvas *main_all_charged = new TCanvas("main_all_charged","Particles Hitting the Main Detector", 1000, 1000, 1000, 1000); + + //Divide the canvas into 1 column, 2 rows + main_all_charged -> Divide(1,2); + + //Look at the first entry on the canvas and draw the xy main detector + main_all_charged -> cd(1); + xy_main_all -> Draw("colz"); + + //Look at the second entry on the canvas and draw the r main detector + main_all_charged -> cd(2); + radial_main_all -> Draw("B"); + + //Save the canvas as an image in the director "remoll/images/Blocker/" + main_all_charged -> SaveAs("images/Blocker/Main_All_WBlocker_##0.png"); + + +}//end BlockerPunchThru() + diff --git a/scripts/PunchThroughStudies/PunchThru##C12ep.C b/scripts/PunchThroughStudies/PunchThru##C12ep.C new file mode 100644 index 000000000..dd2888068 --- /dev/null +++ b/scripts/PunchThroughStudies/PunchThru##C12ep.C @@ -0,0 +1,352 @@ +// Simple example macro for reroot analysis of remoll simulations for MOLLER +// +// Need to use reroot (CERN's root compiled with special remoll libraries, +// or root when you have linked to ibremoll.so, i.e. by a command like +// setenv LD_PRELOAD build/libremoll.so +// needs to have a subdirectory "images/NewPT" defined for the images to go to +// +// Run using (for example): +// build/reroot +// .L scripts/PunchThru##C12ep.C +// PunchThru##C12ep() +// +// Can put multiple root files in the script, and they will be chained together. You must +// specify which root files that this should run over. + +// This script was written with the intention of looking at ep scattering on the C12 +// thin target, but the script should work for any event generator and any target. +// +// This script will take root files of a certain sieve thickness, ##mm. It will first loop +// through the events and flag any in which a primary particle hits a sieve hole. +// Then it will exclude these flagged events and plot electrons and positrons that hit +// upstream and downstream of the surface of the sieve. Those particles that hit +// downstream of the surface are flagged as "punch through particles". +// Punch-through particles are plotted on the rings of the main detector. An +// xy plot and radial plot are included. Finally, all charged particles that reach the +// main detector rings are plotted (xy and r). +// +// Addition: I now also plot electrons and positrons that hit the main detector after +// passing through the sieve holes. This is so that I can look at the amount of noise our +// signal is likely to see. + +#include +void PunchThru##C12ep() +{ + //Allow Tree to use the root files that you call + TChain* T = new TChain("T"); + + //Add files from the directory "rootfilesPT/", "##" is the sieve thickness in mm. Replace these root files with whatever root files you would like to analyze. + T->Add("rootfilesPT/WSieveC12_ep_100k_80mm0.root"); + T->Add("rootfilesPT/WSieveC12_ep_100k_##mm1.root"); + T->Add("rootfilesPT/WSieveC12_ep_100k_##mm2.root"); + T->Add("rootfilesPT/WSieveC12_ep_100k_##mm3.root"); + T->Add("rootfilesPT/WSieveC12_ep_100k_##mm4.root"); + T->Add("rootfilesPT/WSieveC12_ep_100k_##mm5.root"); + T->Add("rootfilesPT/WSieveC12_ep_100k_##mm6.root"); + T->Add("rootfilesPT/WSieveC12_ep_100k_##mm7.root"); + T->Add("rootfilesPT/WSieveC12_ep_100k_##mm8.root"); + T->Add("rootfilesPT/WSieveC12_ep_100k_##mm9.root"); + + //Define variables that we will loop over later + Double_t rate = 0; + std::vector* parts = 0; + std::vector* hits = 0; + + //Define some branches of the Tree (which is "T") + T->SetBranchAddress("rate", &rate); + T->SetBranchAddress("hit", &hits); + T->SetBranchAddress("part", &parts); + + gROOT -> SetBatch(kTRUE); + +//---------------------------------------------------------------------------- + +//Define Histograms that we will fill later + + //---Sieve surface histograms--- + + //2D histogram for e+ and e- hitting the upstream sieve surface + TH2F *us_sieve_virt = new TH2F("us_sieve_virt","Upstream Sieve (##mm) Virtual Detector Charged Particle Hits for ep Scattering with Thin Carbon Target", 7000, -150, 150, 7000, -150, 150); + us_sieve_virt -> GetXaxis() -> SetTitle("x Position of Hits [mm]"); + us_sieve_virt -> GetYaxis() -> SetTitle("y Position of Hits [mm]"); + + //2D histogram for e+ and e- hitting the downstream sieve surface, i.e., the particles that punch through the sieve + TH2F *ds_sieve_virt = new TH2F("ds_sieve_virt","Downstream Sieve (##mm) Virtual Detector Charged Particle Hits for ep Scattering with Thin Carbon Target", 7000, -150, 150, 7000, -150, 150); + ds_sieve_virt -> GetXaxis() -> SetTitle("x Position of Hits [mm]"); + ds_sieve_virt -> GetYaxis() -> SetTitle("y Position of Hits [mm]"); + + //---Main detector histograms--- + + //2D histogram for e+ and e- that punch through the sieve and make it to the main detector on the rings (xy plot) + TH2F *punch_thru_main = new TH2F("punch_thru_main","Charged Particles that Exited the Downstream Sieve (##mm) Surface and Hit the Main Detector for ep Scattering with Thin Carbon Target", 1000, -1200, 1200, 1000, -1200, 1200); + punch_thru_main -> GetXaxis() -> SetTitle("x Position of Hits [mm]"); + punch_thru_main -> GetYaxis() -> SetTitle("y Position of Hits [mm]"); + + //1D histogram for e+ and e- that punch through the sieve and make it to the main detector on the rings (r plot) + TH1F *radial_main = new TH1F("radial_main","Charged Particles that Exit the Downstream Sieve (##mm) Surface and Hit the Main Detector", 1000, 650, 1200); + radial_main -> GetXaxis() -> SetTitle("r Position of Hits [mm]"); + + //2D histogram for electrons and positrons that make it to the main detector on the rings after passing through the sieve holes (xy plot) + TH2F *main_holes = new TH2F("main_holes","Charged Particles that Pass Through the Sieve Holes (##mm) and Hit the Main Detector for ep Scattering with Thin Carbon Target", 1000, -1200, 1200, 1000, -1200, 1200); + main_holes -> GetXaxis() -> SetTitle("x Position of Hits [mm]"); + main_holes -> GetYaxis() -> SetTitle("y Position of Hits [mm]"); + + //1D histogram for electrons and positrons that make it to the main detector on the rings after passing through the sieve holes (r plot) + TH1F *radial_main_holes = new TH1F("radial_main_holes","Charged Particles that Pass Through the Sieve Holes (##mm) and Hit the Main Detector", 1000, 650, 1200); + radial_main_holes -> GetXaxis() -> SetTitle("r Position of Hits [mm]"); + + //2D histogram for all electrons and positrons that make it to the main detector on the rings (xy plot) + TH2F *main_all = new TH2F("main_all","All Charged Particles that Hit the Main Detector for ep Scattering with Thin Carbon Target and a ##mm Sieve", 1000, -1200, 1200, 1000, -1200, 1200); + main_all -> GetXaxis() -> SetTitle("x Position of Hits [mm]"); + main_all -> GetYaxis() -> SetTitle("y Position of Hits [mm]"); + + //1D histogram for all electrons and positrons that make it to the main detector on the rings (r plot) + TH1F *radial_main_all = new TH1F("radial_main_all","All Charged Particles that Hit the Main Detector for ep Scattering with Thin Carbon Target and a ##mm Sieve", 1000, 650, 1200); + radial_main_all -> GetXaxis() -> SetTitle("r Position of Hits [mm]"); + +//---------------------------------------------------------------------------- + + //Define logical flag for each hole + bool no_hole_1 = false; + bool no_hole_2 = false; + bool no_hole_3 = false; + + bool hole_1 = false; + bool hole_2 = false; + bool hole_3 = false; + + //Define logical flag for punch-through. When this is true, it means that we are looking at perticles that exit the downstream surface of the sieve. + bool punch_thru = false; + +//---------------------------------------------------------------------------- + + //Loop over all events + for (size_t iev = 0; iev < T->GetEntries(); iev++) + { + T->GetEntry(iev); + + //Define initial values for booleans + no_hole_1 = true; + no_hole_2 = true; + no_hole_3 = true; + punch_thru = false; + + //Process hits, i.e., loop over all the hits in this event + for (size_t ihit = 0; ihit < hits->size(); ihit++) + { + remollGenericDetectorHit_t hit = hits->at(ihit); + + //no_hole_# is false if the primary electron goes through the hole + if (hit.det == 1001 && (hit.trid == 1)) + { + no_hole_1 = false; + } + + if (hit.det == 1002 && (hit.trid == 1)) + { + no_hole_2 = false; + } + + if (hit.det == 1003 && (hit.trid == 1)) + { + no_hole_3 = false; + } + }//end process over hits + + //Process over hits again + for (size_t ihit = 0; ihit < hits->size(); ihit++) + { + remollGenericDetectorHit_t hit = hits->at(ihit); + + //Look at only charged particles for events in which a primary electron did NOT go through a sieve hole. The radial restriction is to focus on only the sieve surface. + if ((hit.pid==11 || hit.pid==-11) && no_hole_1 && no_hole_2 && no_hole_3 && hit.r >=35.306 && hit.r<97.9932) + { + + //Look at only the virtual detector placed exactly upstream of the sieve and ensure that we are only looking at particles with positive z momentum. + if (hit.det == 1004 && hit.pz >= 0) + { + //Fill the histogram that plots only particles that hit the upstream sieve surface + us_sieve_virt -> Fill(hit.x, hit.y, rate); + }//end upstream if + + if (hit.det == 1005 && hit.pz >= 0) + { + //Fill the histogram that plots only particles that exit the downstream sieve surface + ds_sieve_virt -> Fill(hit.x, hit.y, rate); + //Flag particles as "punch through particles" + punch_thru = true; + }//end downstream if + + }//end pid and hole if + + }//end process over hits + + //process over hits again to look at the main detector + for (size_t ihit = 0; ihit < hits->size(); ihit++) + { + remollGenericDetectorHit_t hit = hits->at(ihit); + + //Only look at "punch through particles" that hit the main detector on rings 1-7 and make sure they are e- or e+ with positive z momentum. + if (punch_thru && hit.det==28 && hit.r>=650 && hit.r<=1200 && (hit.pid==11 || hit.pid==-11) && hit.pz>=0) + { + //Fill histogram for charged particles that exit the downstream surface of the sieve and reach the main detector. + punch_thru_main -> Fill(hit.x, hit.y, rate); + //This is the same plot as above but is radial instead of xy. + radial_main -> Fill(hit.r, rate); + }//end main det if + + }//end process over hits + + }//end process over events + +//---------------------------------------------------------------------------- + + //Loop over all events to flag the holes differently. + for (size_t iev = 0; iev < T->GetEntries(); iev++) + { + T->GetEntry(iev); + + hole_1 = false; + hole_2 = false; + hole_3 = false; + + //Process over hits to look at the main detector + for (size_t ihit = 0; ihit < hits->size(); ihit++) + { + remollGenericDetectorHit_t hit = hits->at(ihit); + + //Look at all charged particles that hit the main detector on rings 1-7 and make sure they are e- or e+ with positive z momentum. + if (hit.det==28 && hit.r>=650 && hit.r<=1200 && (hit.pid==11 || hit.pid==-11) && hit.pz>=0) + { + //Fill a histogram with ALL charged particles that hit the main detector. + main_all -> Fill(hit.x, hit.y, rate); + //This is the same plot as above but is radial instead of xy. + radial_main_all -> Fill(hit.r, rate); + }//end hole and radius if + + }//end process over hits + + //Process hits, i.e., loop over all the hits in this event + for (size_t ihit = 0; ihit < hits->size(); ihit++) + { + remollGenericDetectorHit_t hit = hits->at(ihit); + + //hole_# is true if the primary electron goes through the hole + if (hit.det == 1001 && (hit.trid == 1)) + { + hole_1 = true; + } + + if (hit.det == 1002 && (hit.trid == 1)) + { + hole_2 = true; + } + + if (hit.det == 1003 && (hit.trid == 1)) + { + hole_3 = true; + } + + }//end process over hits + + //process over hits to look at the main detector + for (size_t ihit = 0; ihit < hits->size(); ihit++) + { + remollGenericDetectorHit_t hit = hits->at(ihit); + + //Only look at sieve hole particles that hit the main detector on rings 1-7 and make sure they are e- or e+ with positive z momentum. + if ((hole_1 || hole_2 || hole_3) && hit.det==28 && hit.r>=650 && hit.r<=1200 && (hit.pid==11 || hit.pid==-11) && hit.pz>=0) + { + //Fill the histogram that plots the charged particles that go through the sieve holes. + main_holes -> Fill(hit.x, hit.y, rate); + //This is the same plot as above but is radial instead of xy. + radial_main_holes -> Fill(hit.r, rate); + }//end hole and radius if + + }//end process over hits + + }//end process over events + + +//-------------------------------------------------------------------------------- +//Draw and save the histograms + + //---Sieve Surfaces--- + + //Create a canvas on which to draw the histograms + TCanvas *virt = new TCanvas("virt","Charged Particles Hitting the Virtual Detectors Upstream and Downstream of the Sieve", 1000, 1000, 1000, 1000); + + //Divide the canvas into 1 column, 2 rows + virt -> Divide(1,2); + + //Look at the first entry on the canvas and draw the upstream detector + virt -> cd(1); + us_sieve_virt -> Draw(); + + //Look at the second entry on the canvas and draw the downstream detector + virt -> cd(2); + ds_sieve_virt -> Draw(); + + //Save the canvas as an image in the director "remoll/images/PT/" + virt -> SaveAs("images/NewPT/Punch_Thru_US_DS_WSieve_##.png"); + + //---Main Detector Punch Through--- + + //Create a canvas on which to draw the histograms + TCanvas *main = new TCanvas("main","Electrons and Positrons Hitting the Main Detector", 1000, 1000, 1000, 1000); + + //Divide the canvas into 1 column, 2 rows + main -> Divide(1,2); + + //Look at the first entry on the canvas and draw the xy main detector + main -> cd(1); + punch_thru_main -> Draw(); + + //Look at the second entry on the canvas and draw the r main detector + main -> cd(2); + radial_main -> Draw(); + + //Save the canvas as an image in the director "remoll/images/PT/" + main -> SaveAs("images/NewPT/Punch_Thru_Main_WSieve_##.png"); + + + //---Main Detector All--- + + //Create a canvas on which to draw the histograms + TCanvas *main_for_all = new TCanvas("main_for_all","Particles Hitting the Main Detector", 1000, 1000, 1000, 1000); + + //Divide the canvas into 1 column, 2 rows + main_for_all -> Divide(1,2); + + //Look at the first entry on the canvas and draw the xy main detector + main_for_all -> cd(1); + main_all -> Draw(); + + //Look at the second entry on the canvas and draw the r main detector + main_for_all -> cd(2); + radial_main_all -> Draw(); + + //Save the canvas as an image in the director "remoll/images/PT/" + main_for_all -> SaveAs("images/NewPT/Punch_Thru_Main_All_WSieve_##.png"); + + //---Main Detector Holes--- + + //Create a canvas on which to draw the histograms + TCanvas *main_for_holes = new TCanvas("main_for_holes","Particles Hitting the Main Detector", 1000, 1000, 1000, 1000); + + //Divide the canvas into 1 column, 2 rows + main_for_holes -> Divide(1,2); + + //Look at the first entry on the canvas and draw the xy main detector + main_for_holes -> cd(1); + main_holes -> Draw(); + + //Look at the second entry on the canvas and draw the r main detector + main_for_holes -> cd(2); + radial_main_holes -> Draw(); + + //Save the canvas as an image in the director "remoll/images/PT/" + main_for_holes -> SaveAs("images/NewPT/Punch_Thru_Main_Holes_WSieve_##.png"); + +}//end PunchThru##C12ep() + From ed481f4c8747661e54e147b8a140d8f49445a31d Mon Sep 17 00:00:00 2001 From: Kate Evans Date: Wed, 27 Oct 2021 16:37:34 -0400 Subject: [PATCH 439/443] This will add scripts for punch through studies. I've made sure that the names of the scripts do not contain special characters. --- .../{BlockerPunchThru##0.C => BlockerPunchThru.C} | 2 +- .../{PunchThru##C12ep.C => PunchThruC12ep.C} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename scripts/PunchThroughStudies/{BlockerPunchThru##0.C => BlockerPunchThru.C} (99%) rename scripts/PunchThroughStudies/{PunchThru##C12ep.C => PunchThruC12ep.C} (99%) diff --git a/scripts/PunchThroughStudies/BlockerPunchThru##0.C b/scripts/PunchThroughStudies/BlockerPunchThru.C similarity index 99% rename from scripts/PunchThroughStudies/BlockerPunchThru##0.C rename to scripts/PunchThroughStudies/BlockerPunchThru.C index e70e6d920..87b39d7b4 100644 --- a/scripts/PunchThroughStudies/BlockerPunchThru##0.C +++ b/scripts/PunchThroughStudies/BlockerPunchThru.C @@ -1,5 +1,5 @@ // Simple example macro for reroot analysis of remoll simulations for MOLLER -// +// // Need to use reroot (CERN's root compiled with special remoll libraries, // or root when you have linked to ibremoll.so, i.e. by a command like // setenv LD_PRELOAD build/libremoll.so diff --git a/scripts/PunchThroughStudies/PunchThru##C12ep.C b/scripts/PunchThroughStudies/PunchThruC12ep.C similarity index 99% rename from scripts/PunchThroughStudies/PunchThru##C12ep.C rename to scripts/PunchThroughStudies/PunchThruC12ep.C index dd2888068..b00666203 100644 --- a/scripts/PunchThroughStudies/PunchThru##C12ep.C +++ b/scripts/PunchThroughStudies/PunchThruC12ep.C @@ -1,5 +1,5 @@ // Simple example macro for reroot analysis of remoll simulations for MOLLER -// +// // Need to use reroot (CERN's root compiled with special remoll libraries, // or root when you have linked to ibremoll.so, i.e. by a command like // setenv LD_PRELOAD build/libremoll.so From e9d966986e1e6be40e2cae4c30837640d3ee8c40 Mon Sep 17 00:00:00 2001 From: Kate Evans Date: Wed, 27 Oct 2021 17:20:33 -0400 Subject: [PATCH 440/443] I removed some instances of "#" inside of the scripts. --- scripts/PunchThroughStudies/BlockerPunchThru.C | 6 +++--- scripts/PunchThroughStudies/PunchThruC12ep.C | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/PunchThroughStudies/BlockerPunchThru.C b/scripts/PunchThroughStudies/BlockerPunchThru.C index 87b39d7b4..5eaaed011 100644 --- a/scripts/PunchThroughStudies/BlockerPunchThru.C +++ b/scripts/PunchThroughStudies/BlockerPunchThru.C @@ -7,8 +7,8 @@ // // Run using (for example): // build/reroot -// .L scripts/BlockerPunchThru##0.C -// BlockerPunchThru##0() +// .L scripts/BlockerPunchThru.C +// BlockerPunchThru() // // Can put multiple root files in the script, and they will be chained together. // @@ -22,7 +22,7 @@ // main detector rings are plotted (xy and r). #include -void BlockerPunchThru##0() +void BlockerPunchThru() { //Allow Tree to use the root files that you call TChain* T = new TChain("T"); diff --git a/scripts/PunchThroughStudies/PunchThruC12ep.C b/scripts/PunchThroughStudies/PunchThruC12ep.C index b00666203..aed0c9e7b 100644 --- a/scripts/PunchThroughStudies/PunchThruC12ep.C +++ b/scripts/PunchThroughStudies/PunchThruC12ep.C @@ -7,8 +7,8 @@ // // Run using (for example): // build/reroot -// .L scripts/PunchThru##C12ep.C -// PunchThru##C12ep() +// .L scripts/PunchThruC12ep.C +// PunchThruC12ep() // // Can put multiple root files in the script, and they will be chained together. You must // specify which root files that this should run over. @@ -30,7 +30,7 @@ // signal is likely to see. #include -void PunchThru##C12ep() +void PunchThruC12ep() { //Allow Tree to use the root files that you call TChain* T = new TChain("T"); From b2918080bc12ea8e04c8def2ffed07fdbae84668 Mon Sep 17 00:00:00 2001 From: Kate Evans Date: Wed, 27 Oct 2021 17:29:02 -0400 Subject: [PATCH 441/443] I added a comment about how to change the script to track the sieve/blocker thickness. --- scripts/PunchThroughStudies/BlockerPunchThru.C | 6 ++++++ scripts/PunchThroughStudies/PunchThruC12ep.C | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/scripts/PunchThroughStudies/BlockerPunchThru.C b/scripts/PunchThroughStudies/BlockerPunchThru.C index 5eaaed011..40b52e5e9 100644 --- a/scripts/PunchThroughStudies/BlockerPunchThru.C +++ b/scripts/PunchThroughStudies/BlockerPunchThru.C @@ -10,6 +10,12 @@ // .L scripts/BlockerPunchThru.C // BlockerPunchThru() // +// +// This script is for a generic blocker thickness, ##, but to use the scripts, you should +// change this to whatever thickness you want to look at. For example, if you want +// to analyze a 100mm sieve, you should use find and replace to change all of the +// ##s to 100s. +// // Can put multiple root files in the script, and they will be chained together. // // This script will take root files of a certain Blocker thickness. It will first loop diff --git a/scripts/PunchThroughStudies/PunchThruC12ep.C b/scripts/PunchThroughStudies/PunchThruC12ep.C index aed0c9e7b..133a6cd41 100644 --- a/scripts/PunchThroughStudies/PunchThruC12ep.C +++ b/scripts/PunchThroughStudies/PunchThruC12ep.C @@ -10,6 +10,12 @@ // .L scripts/PunchThruC12ep.C // PunchThruC12ep() // +// +// This script is for a generic sieve thickness, ##, but to use the scripts, you should +// change this to whatever thickness you want to look at. For example, if you want +// to analyze a 100mm sieve, you should use find and replace to change all of the +// ##s to 100s. +// // Can put multiple root files in the script, and they will be chained together. You must // specify which root files that this should run over. From bc4b35910a86db356d150ab67a98d8498ff67617 Mon Sep 17 00:00:00 2001 From: Kate Evans Date: Fri, 29 Oct 2021 15:44:35 -0400 Subject: [PATCH 442/443] I edited the scripts so that they contain no instances of "#". Instead, they specify a 90mm sieve or blocker. --- .../PunchThroughStudies/BlockerPunchThru.C | 56 ++++++++--------- scripts/PunchThroughStudies/PunchThruC12ep.C | 62 +++++++++---------- 2 files changed, 53 insertions(+), 65 deletions(-) diff --git a/scripts/PunchThroughStudies/BlockerPunchThru.C b/scripts/PunchThroughStudies/BlockerPunchThru.C index 40b52e5e9..af3262d0b 100644 --- a/scripts/PunchThroughStudies/BlockerPunchThru.C +++ b/scripts/PunchThroughStudies/BlockerPunchThru.C @@ -1,5 +1,5 @@ // Simple example macro for reroot analysis of remoll simulations for MOLLER -// +// // Need to use reroot (CERN's root compiled with special remoll libraries, // or root when you have linked to ibremoll.so, i.e. by a command like // setenv LD_PRELOAD build/libremoll.so @@ -7,14 +7,8 @@ // // Run using (for example): // build/reroot -// .L scripts/BlockerPunchThru.C -// BlockerPunchThru() -// -// -// This script is for a generic blocker thickness, ##, but to use the scripts, you should -// change this to whatever thickness you want to look at. For example, if you want -// to analyze a 100mm sieve, you should use find and replace to change all of the -// ##s to 100s. +// .L scripts/BlockerPunchThru090.C +// BlockerPunchThru090() // // Can put multiple root files in the script, and they will be chained together. // @@ -22,7 +16,7 @@ // through the events and flag any in which a primary particle hits a Blocker hole. // Then it will exclude these flagged events and plot electrons and positrons that hit // upstream and downstream of the surface of the Blocker. Those particles that hit -// downstream of the surface are flagged as "punch through particles". +// downstream of the surface are flagged as "punch through particles". // Punch-through particles are plotted on the rings of the main detector. An // xy plot and radial plot are included. Finally, all charged particles that reach the // main detector rings are plotted (xy and r). @@ -33,17 +27,17 @@ void BlockerPunchThru() //Allow Tree to use the root files that you call TChain* T = new TChain("T"); - //Add files from the directory "rootfilesPT/", "##0" is the Blocker thickness in mm. Replace these root files with whatever root files you would like to analyze. - T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_##0mm0.root"); - T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_##0mm1.root"); - T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_##0mm2.root"); - T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_##0mm3.root"); - T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_##0mm4.root"); - T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_##0mm5.root"); - T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_##0mm6.root"); - T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_##0mm7.root"); - T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_##0mm8.root"); - T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_##0mm9.root"); + //Add files from the directory "rootfilesPT/", "090" is the Blocker thickness in mm. Replace these root files with whatever root files you would like to analyze. + T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_090mm0.root"); + T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_090mm1.root"); + T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_090mm2.root"); + T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_090mm3.root"); + T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_090mm4.root"); + T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_090mm5.root"); + T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_090mm6.root"); + T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_090mm7.root"); + T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_090mm8.root"); + T->Add("rootfilesPT/blocker/WBlockerC12_ep_100k_090mm9.root"); //Define variables that we will loop over later Double_t rate = 0; @@ -64,34 +58,34 @@ void BlockerPunchThru() //---Blocker Surfaces--- //2D histogram for e+ and e- hitting the upstream Blocker surface - TH2F *us_Blocker_virt = new TH2F("us_Blocker_virt","Upstream Blocker (##0mm) Virtual Detector Charged Particle Hits", 100, -150, 150, 100, -150, 150); + TH2F *us_Blocker_virt = new TH2F("us_Blocker_virt","Upstream Blocker (090mm) Virtual Detector Charged Particle Hits", 100, -150, 150, 100, -150, 150); us_Blocker_virt -> GetXaxis() -> SetTitle("x Position of Hits [mm]"); us_Blocker_virt -> GetYaxis() -> SetTitle("y Position of Hits [mm]"); //2D histogram for e+ and e- hitting the downstream Blocker surface, i.e., the particles that punch through the Blocker - TH2F *ds_Blocker_virt = new TH2F("ds_Blocker_virt","Downstream Blocker (##0mm) Virtual Detector Charged Particle Hits", 100, -150, 150, 100, -150, 150); + TH2F *ds_Blocker_virt = new TH2F("ds_Blocker_virt","Downstream Blocker (090mm) Virtual Detector Charged Particle Hits", 100, -150, 150, 100, -150, 150); ds_Blocker_virt -> GetXaxis() -> SetTitle("x Position of Hits [mm]"); ds_Blocker_virt -> GetYaxis() -> SetTitle("y Position of Hits [mm]"); //---Main Detector PT--- //1D histogram for e+ and e- that punch through the Blocker and make it to the main detector on the rings - TH1F *radial_main = new TH1F("radial_main","Energies of Charged Particles that Exited the Downstream Blocker (##0mm) Surface and Hit the Main Detector", 50, 0, 1500); + TH1F *radial_main = new TH1F("radial_main","Energies of Charged Particles that Exited the Downstream Blocker (090mm) Surface and Hit the Main Detector", 50, 0, 1500); radial_main -> GetXaxis() -> SetTitle("Energies of Hits [MeV]"); //2D histogram for particles that punch through the Blocker and make it to the main detector on the rings (xy plot) - TH2F *punch_thru_xy_main = new TH2F("punch_thru_xy_main","Charged Particles that Exited the Downstream Blocker (##0mm) Surface and Hit the Main Detector", 100, -1200, 1200, 100, -1200, 1200); + TH2F *punch_thru_xy_main = new TH2F("punch_thru_xy_main","Charged Particles that Exited the Downstream Blocker (090mm) Surface and Hit the Main Detector", 100, -1200, 1200, 100, -1200, 1200); punch_thru_xy_main -> GetXaxis() -> SetTitle("x Position of Hits [mm]"); punch_thru_xy_main -> GetYaxis() -> SetTitle("y Position of Hits [mm]"); //---All Charged Particles--- //1D histogram for e+ and e- that make it to the main detector on the rings - TH1F *radial_main_all = new TH1F("radial_main_all","Energies of All Charged Particles that Hit the Main Detector for a ##0mm Blocker", 50, 0, 1500); + TH1F *radial_main_all = new TH1F("radial_main_all","Energies of All Charged Particles that Hit the Main Detector for a 090mm Blocker", 50, 0, 1500); radial_main_all -> GetXaxis() -> SetTitle("Energies of Hits [MeV]"); //2D histogram for particles that make it to the main detector on the rings (xy plot) - TH2F *xy_main_all = new TH2F("xy_main_all","All Charged Particles that Hit the Main Detector for a ##0mm Blocker", 100, -1200, 1200, 100, -1200, 1200); + TH2F *xy_main_all = new TH2F("xy_main_all","All Charged Particles that Hit the Main Detector for a 090mm Blocker", 100, -1200, 1200, 100, -1200, 1200); xy_main_all -> GetXaxis() -> SetTitle("x Position of Hits [mm]"); xy_main_all -> GetYaxis() -> SetTitle("y Position of Hits [mm]"); @@ -126,7 +120,7 @@ void BlockerPunchThru() { ds_Blocker_virt -> Fill(hit.x, hit.y, rate); //Flag particles as "punch through particles" - punch_thru = true; + punch_thru = true; }//end downstream if }//end pid and hole if @@ -175,7 +169,7 @@ void BlockerPunchThru() ds_Blocker_virt -> Draw("colz"); //Save the canvas as an image in the director "remoll/images/Blocker/" - virt -> SaveAs("images/Blocker/Punch_Thru_US_DS_WBlocker_##0.png"); + virt -> SaveAs("images/Blocker/Punch_Thru_US_DS_WBlocker_090.png"); //---Main Detector PT--- @@ -195,7 +189,7 @@ void BlockerPunchThru() radial_main -> Draw("B"); //Save the canvas as an image in the director "remoll/images/Blocker/" - main -> SaveAs("images/Blocker/Punch_Thru_Main_WBlocker_##0.png"); + main -> SaveAs("images/Blocker/Punch_Thru_Main_WBlocker_090.png"); //---Main Detector--- @@ -215,7 +209,7 @@ void BlockerPunchThru() radial_main_all -> Draw("B"); //Save the canvas as an image in the director "remoll/images/Blocker/" - main_all_charged -> SaveAs("images/Blocker/Main_All_WBlocker_##0.png"); + main_all_charged -> SaveAs("images/Blocker/Main_All_WBlocker_090.png"); }//end BlockerPunchThru() diff --git a/scripts/PunchThroughStudies/PunchThruC12ep.C b/scripts/PunchThroughStudies/PunchThruC12ep.C index 133a6cd41..d26725e8e 100644 --- a/scripts/PunchThroughStudies/PunchThruC12ep.C +++ b/scripts/PunchThroughStudies/PunchThruC12ep.C @@ -1,5 +1,5 @@ // Simple example macro for reroot analysis of remoll simulations for MOLLER -// +// // Need to use reroot (CERN's root compiled with special remoll libraries, // or root when you have linked to ibremoll.so, i.e. by a command like // setenv LD_PRELOAD build/libremoll.so @@ -7,14 +7,8 @@ // // Run using (for example): // build/reroot -// .L scripts/PunchThruC12ep.C -// PunchThruC12ep() -// -// -// This script is for a generic sieve thickness, ##, but to use the scripts, you should -// change this to whatever thickness you want to look at. For example, if you want -// to analyze a 100mm sieve, you should use find and replace to change all of the -// ##s to 100s. +// .L scripts/PunchThru90C12ep.C +// PunchThru90C12ep() // // Can put multiple root files in the script, and they will be chained together. You must // specify which root files that this should run over. @@ -22,7 +16,7 @@ // This script was written with the intention of looking at ep scattering on the C12 // thin target, but the script should work for any event generator and any target. // -// This script will take root files of a certain sieve thickness, ##mm. It will first loop +// This script will take root files of a certain sieve thickness, 90mm. It will first loop // through the events and flag any in which a primary particle hits a sieve hole. // Then it will exclude these flagged events and plot electrons and positrons that hit // upstream and downstream of the surface of the sieve. Those particles that hit @@ -41,17 +35,17 @@ void PunchThruC12ep() //Allow Tree to use the root files that you call TChain* T = new TChain("T"); - //Add files from the directory "rootfilesPT/", "##" is the sieve thickness in mm. Replace these root files with whatever root files you would like to analyze. - T->Add("rootfilesPT/WSieveC12_ep_100k_80mm0.root"); - T->Add("rootfilesPT/WSieveC12_ep_100k_##mm1.root"); - T->Add("rootfilesPT/WSieveC12_ep_100k_##mm2.root"); - T->Add("rootfilesPT/WSieveC12_ep_100k_##mm3.root"); - T->Add("rootfilesPT/WSieveC12_ep_100k_##mm4.root"); - T->Add("rootfilesPT/WSieveC12_ep_100k_##mm5.root"); - T->Add("rootfilesPT/WSieveC12_ep_100k_##mm6.root"); - T->Add("rootfilesPT/WSieveC12_ep_100k_##mm7.root"); - T->Add("rootfilesPT/WSieveC12_ep_100k_##mm8.root"); - T->Add("rootfilesPT/WSieveC12_ep_100k_##mm9.root"); + //Add files from the directory "rootfilesPT/", "90" is the sieve thickness in mm. Replace these root files with whatever root files you would like to analyze. + T->Add("rootfilesPT/WSieveC12_ep_100k_90mm0.root"); + T->Add("rootfilesPT/WSieveC12_ep_100k_90mm1.root"); + T->Add("rootfilesPT/WSieveC12_ep_100k_90mm2.root"); + T->Add("rootfilesPT/WSieveC12_ep_100k_90mm3.root"); + T->Add("rootfilesPT/WSieveC12_ep_100k_90mm4.root"); + T->Add("rootfilesPT/WSieveC12_ep_100k_90mm5.root"); + T->Add("rootfilesPT/WSieveC12_ep_100k_90mm6.root"); + T->Add("rootfilesPT/WSieveC12_ep_100k_90mm7.root"); + T->Add("rootfilesPT/WSieveC12_ep_100k_90mm8.root"); + T->Add("rootfilesPT/WSieveC12_ep_100k_90mm9.root"); //Define variables that we will loop over later Double_t rate = 0; @@ -72,42 +66,42 @@ void PunchThruC12ep() //---Sieve surface histograms--- //2D histogram for e+ and e- hitting the upstream sieve surface - TH2F *us_sieve_virt = new TH2F("us_sieve_virt","Upstream Sieve (##mm) Virtual Detector Charged Particle Hits for ep Scattering with Thin Carbon Target", 7000, -150, 150, 7000, -150, 150); + TH2F *us_sieve_virt = new TH2F("us_sieve_virt","Upstream Sieve (90mm) Virtual Detector Charged Particle Hits for ep Scattering with Thin Carbon Target", 7000, -150, 150, 7000, -150, 150); us_sieve_virt -> GetXaxis() -> SetTitle("x Position of Hits [mm]"); us_sieve_virt -> GetYaxis() -> SetTitle("y Position of Hits [mm]"); //2D histogram for e+ and e- hitting the downstream sieve surface, i.e., the particles that punch through the sieve - TH2F *ds_sieve_virt = new TH2F("ds_sieve_virt","Downstream Sieve (##mm) Virtual Detector Charged Particle Hits for ep Scattering with Thin Carbon Target", 7000, -150, 150, 7000, -150, 150); + TH2F *ds_sieve_virt = new TH2F("ds_sieve_virt","Downstream Sieve (90mm) Virtual Detector Charged Particle Hits for ep Scattering with Thin Carbon Target", 7000, -150, 150, 7000, -150, 150); ds_sieve_virt -> GetXaxis() -> SetTitle("x Position of Hits [mm]"); ds_sieve_virt -> GetYaxis() -> SetTitle("y Position of Hits [mm]"); //---Main detector histograms--- //2D histogram for e+ and e- that punch through the sieve and make it to the main detector on the rings (xy plot) - TH2F *punch_thru_main = new TH2F("punch_thru_main","Charged Particles that Exited the Downstream Sieve (##mm) Surface and Hit the Main Detector for ep Scattering with Thin Carbon Target", 1000, -1200, 1200, 1000, -1200, 1200); + TH2F *punch_thru_main = new TH2F("punch_thru_main","Charged Particles that Exited the Downstream Sieve (90mm) Surface and Hit the Main Detector for ep Scattering with Thin Carbon Target", 1000, -1200, 1200, 1000, -1200, 1200); punch_thru_main -> GetXaxis() -> SetTitle("x Position of Hits [mm]"); punch_thru_main -> GetYaxis() -> SetTitle("y Position of Hits [mm]"); //1D histogram for e+ and e- that punch through the sieve and make it to the main detector on the rings (r plot) - TH1F *radial_main = new TH1F("radial_main","Charged Particles that Exit the Downstream Sieve (##mm) Surface and Hit the Main Detector", 1000, 650, 1200); + TH1F *radial_main = new TH1F("radial_main","Charged Particles that Exit the Downstream Sieve (90mm) Surface and Hit the Main Detector", 1000, 650, 1200); radial_main -> GetXaxis() -> SetTitle("r Position of Hits [mm]"); //2D histogram for electrons and positrons that make it to the main detector on the rings after passing through the sieve holes (xy plot) - TH2F *main_holes = new TH2F("main_holes","Charged Particles that Pass Through the Sieve Holes (##mm) and Hit the Main Detector for ep Scattering with Thin Carbon Target", 1000, -1200, 1200, 1000, -1200, 1200); + TH2F *main_holes = new TH2F("main_holes","Charged Particles that Pass Through the Sieve Holes (90mm) and Hit the Main Detector for ep Scattering with Thin Carbon Target", 1000, -1200, 1200, 1000, -1200, 1200); main_holes -> GetXaxis() -> SetTitle("x Position of Hits [mm]"); main_holes -> GetYaxis() -> SetTitle("y Position of Hits [mm]"); //1D histogram for electrons and positrons that make it to the main detector on the rings after passing through the sieve holes (r plot) - TH1F *radial_main_holes = new TH1F("radial_main_holes","Charged Particles that Pass Through the Sieve Holes (##mm) and Hit the Main Detector", 1000, 650, 1200); + TH1F *radial_main_holes = new TH1F("radial_main_holes","Charged Particles that Pass Through the Sieve Holes (90mm) and Hit the Main Detector", 1000, 650, 1200); radial_main_holes -> GetXaxis() -> SetTitle("r Position of Hits [mm]"); //2D histogram for all electrons and positrons that make it to the main detector on the rings (xy plot) - TH2F *main_all = new TH2F("main_all","All Charged Particles that Hit the Main Detector for ep Scattering with Thin Carbon Target and a ##mm Sieve", 1000, -1200, 1200, 1000, -1200, 1200); + TH2F *main_all = new TH2F("main_all","All Charged Particles that Hit the Main Detector for ep Scattering with Thin Carbon Target and a 90mm Sieve", 1000, -1200, 1200, 1000, -1200, 1200); main_all -> GetXaxis() -> SetTitle("x Position of Hits [mm]"); main_all -> GetYaxis() -> SetTitle("y Position of Hits [mm]"); //1D histogram for all electrons and positrons that make it to the main detector on the rings (r plot) - TH1F *radial_main_all = new TH1F("radial_main_all","All Charged Particles that Hit the Main Detector for ep Scattering with Thin Carbon Target and a ##mm Sieve", 1000, 650, 1200); + TH1F *radial_main_all = new TH1F("radial_main_all","All Charged Particles that Hit the Main Detector for ep Scattering with Thin Carbon Target and a 90mm Sieve", 1000, 650, 1200); radial_main_all -> GetXaxis() -> SetTitle("r Position of Hits [mm]"); //---------------------------------------------------------------------------- @@ -294,7 +288,7 @@ void PunchThruC12ep() ds_sieve_virt -> Draw(); //Save the canvas as an image in the director "remoll/images/PT/" - virt -> SaveAs("images/NewPT/Punch_Thru_US_DS_WSieve_##.png"); + virt -> SaveAs("images/NewPT/Punch_Thru_US_DS_WSieve_90.png"); //---Main Detector Punch Through--- @@ -313,7 +307,7 @@ void PunchThruC12ep() radial_main -> Draw(); //Save the canvas as an image in the director "remoll/images/PT/" - main -> SaveAs("images/NewPT/Punch_Thru_Main_WSieve_##.png"); + main -> SaveAs("images/NewPT/Punch_Thru_Main_WSieve_90.png"); //---Main Detector All--- @@ -333,7 +327,7 @@ void PunchThruC12ep() radial_main_all -> Draw(); //Save the canvas as an image in the director "remoll/images/PT/" - main_for_all -> SaveAs("images/NewPT/Punch_Thru_Main_All_WSieve_##.png"); + main_for_all -> SaveAs("images/NewPT/Punch_Thru_Main_All_WSieve_90.png"); //---Main Detector Holes--- @@ -352,7 +346,7 @@ void PunchThruC12ep() radial_main_holes -> Draw(); //Save the canvas as an image in the director "remoll/images/PT/" - main_for_holes -> SaveAs("images/NewPT/Punch_Thru_Main_Holes_WSieve_##.png"); + main_for_holes -> SaveAs("images/NewPT/Punch_Thru_Main_Holes_WSieve_90.png"); -}//end PunchThru##C12ep() +}//end PunchThru90C12ep() From 570bfabd52794bbf0a9903bc9c2fe32a0e0e1502 Mon Sep 17 00:00:00 2001 From: Fatemeh Gorgannejad Date: Tue, 9 Nov 2021 13:58:53 -0500 Subject: [PATCH 443/443] Rotating pion detector system to suppress background from low energy particles, extending inner radial shielding to 10 inches, and adding a 10 inches outer radial shielding --- geometry/donut/donutConcreteLead.gdml | 137 +++++++++++++----- geometry/pion/Lucite/pionDetectorLucite.gdml | 4 +- .../pion/Lucite/pionDetectorLuciteSector.gdml | 66 ++++++--- .../pion/Lucite/pionDetectorLucite_world.gdml | 4 +- geometry/pion/pionDetectorSystem.gdml | 8 +- 5 files changed, 158 insertions(+), 61 deletions(-) diff --git a/geometry/donut/donutConcreteLead.gdml b/geometry/donut/donutConcreteLead.gdml index d4689a7b5..2857a093c 100644 --- a/geometry/donut/donutConcreteLead.gdml +++ b/geometry/donut/donutConcreteLead.gdml @@ -43,7 +43,7 @@ - + @@ -52,6 +52,12 @@ + + + + + + @@ -165,18 +171,30 @@ - + + + + + + + + -
+
- + @@ -485,6 +503,26 @@ z="donutLeadEnd"/> + + + + + + + + + +
+
+ + - + - + + + + + + @@ -556,11 +599,11 @@ - + - + @@ -595,82 +638,87 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + - + @@ -680,32 +728,38 @@ - + - + - + - + + + + + + + + z="donutIBeamFramePosition"/> @@ -713,7 +767,7 @@ + z="donutIBeamFramePosition"/> @@ -721,7 +775,7 @@ + z="donutIBeamFramePosition"/> @@ -729,7 +783,7 @@ + z="donutIBeamFramePosition"/> @@ -756,6 +810,7 @@ + + + + + + + + + + + diff --git a/geometry/pion/Lucite/pionDetectorLucite.gdml b/geometry/pion/Lucite/pionDetectorLucite.gdml index 04f16ef7a..3d05fd74d 100644 --- a/geometry/pion/Lucite/pionDetectorLucite.gdml +++ b/geometry/pion/Lucite/pionDetectorLucite.gdml @@ -14,7 +14,7 @@ - + @@ -40,7 +40,7 @@ - + diff --git a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml index f3cd8722d..ff14ba86f 100644 --- a/geometry/pion/Lucite/pionDetectorLuciteSector.gdml +++ b/geometry/pion/Lucite/pionDetectorLuciteSector.gdml @@ -21,7 +21,7 @@ you modify the angle below so as to avoid overlaps between this volume and the trigger scintillator and volumes. --> - + - + - - - + - + + + + + + @@ -76,9 +81,9 @@ - + z="pionDetectorLuciteShieldDSHeight"/> --> + - + @@ -122,6 +137,14 @@ + + + + + + + + @@ -136,7 +159,7 @@ y="-(pionDetectorLuciteSectorAngleBase+pionDetectorLuciteSectorAnglePitch)"/> - + - + --> + + + + + diff --git a/geometry/pion/Lucite/pionDetectorLucite_world.gdml b/geometry/pion/Lucite/pionDetectorLucite_world.gdml index 4304933c3..afbffb2b5 100644 --- a/geometry/pion/Lucite/pionDetectorLucite_world.gdml +++ b/geometry/pion/Lucite/pionDetectorLucite_world.gdml @@ -26,11 +26,11 @@ - + diff --git a/geometry/pion/pionDetectorSystem.gdml b/geometry/pion/pionDetectorSystem.gdml index 96d12400a..c48667ec9 100644 --- a/geometry/pion/pionDetectorSystem.gdml +++ b/geometry/pion/pionDetectorSystem.gdml @@ -35,7 +35,7 @@ - + - +