From d6b5061b92c015e29633291480cafed856f7f128 Mon Sep 17 00:00:00 2001 From: Fran yuh Date: Tue, 10 Jun 2025 14:50:11 -0400 Subject: [PATCH 1/9] trying rock --- src/DetectorConstruction.cc | 99 +++++++++++++++++++++++-------------- 1 file changed, 62 insertions(+), 37 deletions(-) diff --git a/src/DetectorConstruction.cc b/src/DetectorConstruction.cc index af28ede..bb5384b 100644 --- a/src/DetectorConstruction.cc +++ b/src/DetectorConstruction.cc @@ -47,7 +47,7 @@ G4ThreadLocal BabyMINDMagneticField* DetectorConstruction::babyMINDField = 0; G4ThreadLocal G4FieldManager* DetectorConstruction::babyMINDFieldMgr = 0; DetectorConstruction::DetectorConstruction() - : G4VUserDetectorConstruction(), + : G4VUserDetectorConstruction(), m_addFLArE(true), m_addFORMOSA(true), m_addFASERnu2(true), m_addFASER2(true), m_useBabyMIND(false) { DefineMaterial(); @@ -57,7 +57,7 @@ DetectorConstruction::DetectorConstruction() fCheckOverlap = false; } -DetectorConstruction::~DetectorConstruction() +DetectorConstruction::~DetectorConstruction() { delete messenger; } @@ -66,7 +66,7 @@ void DetectorConstruction::DefineMaterial() { //----------------------------- // construction of materials //----------------------------- - + LArBoxMaterials = DetectorConstructionMaterial::GetInstance(); } @@ -79,7 +79,7 @@ G4VPhysicalVolume* DetectorConstruction::Construct() worldLV, "worldPV", nullptr, - false, + false, 0); // FPF long paper: https://dx.doi.org/10.1088/1361-6471/ac865e @@ -87,17 +87,42 @@ G4VPhysicalVolume* DetectorConstruction::Construct() G4double hallSizeX = 9.4 * m; G4double hallSizeY = 7.6 * m; G4double hallSizeZ = 64.6 * m; - - // this offset accounts for: - // - distance between the entrance wall of the hall and the first detector, so the first detector + + // this offset accounts for: + // - distance between the entrance wall of the hall and the first detector, so the first detector // starts at the center of the global coordinate // - position of the cavern center w.r.t. the line of sight, since it's not in the exact middle - G4ThreeVector hallOffset( GeometricalParameters::Get()->GetHallOffsetX(), - GeometricalParameters::Get()->GetHallOffsetY(), - hallSizeZ/2 - GeometricalParameters::Get()->GetHallHeadDistance()); - - auto hallBox = new G4Box("hallBox", hallSizeX/2, hallSizeY/2, hallSizeZ/2); - hallLV = new G4LogicalVolume(hallBox, LArBoxMaterials->Material("Air"), "hallLV"); + G4ThreeVector hallOffset( GeometricalParameters::Get()->GetHallOffsetX(), + GeometricalParameters::Get()->GetHallOffsetY(), + hallSizeZ/2 - GeometricalParameters::Get()->GetHallHeadDistance()); + + + +auto hallBox = new G4Box("hallBox", hallSizeX/2, hallSizeY/2, hallSizeZ/2); + + +G4double sideOff = 3*m; +G4double frontOff = 10*m; +G4double backOff = 3*m; + + + + +auto rockBox = new G4Box("rockBox", + (hallSizeX)/2+sideOff, + (hallSizeY)/2+sideOff, + (hallSizeZ)/2+frontOff+backOff); + +G4ThreeVector rockOffset( 0,0, 2*frontOff+backOff); + + +auto rockEnvelope = new G4SubtractionSolid("rockEnvelope", rockBox, hallBox); +auto rockDone = new G4LogicalVolume(rockEnvelope, LArBoxMaterials->Material("Rock"), "rockDone"); + + +auto modifiedWrld = new G4PVPlacement(nullptr, hallOffset, rockDone, "modifiedwrld", worldLV, false, 0, fCheckOverlap); + + hallLV = new G4LogicalVolume(hallBox, LArBoxMaterials->Material("Air"), "hallLV"); auto hallPV = new G4PVPlacement(nullptr, hallOffset, hallLV, "hallPV", worldLV, false, 0, fCheckOverlap); //----------------------------------- @@ -112,43 +137,43 @@ G4VPhysicalVolume* DetectorConstruction::Construct() TPCModuleLogical = FLArETPCAssembler->GetFLArETPCVolume(); // positioning - G4double lengthFLArE = 2*TPCInsulationThickness + lArSizeZ; + G4double lengthFLArE = 2*TPCInsulationThickness + lArSizeZ; G4ThreeVector FLArEPos = GeometricalParameters::Get()->GetFLArEPosition(); FLArEPos -= hallOffset; new G4PVPlacement(nullptr, FLArEPos, FLArETPCAssembly, "FLArETPCPhysical", hallLV, false, 0, fCheckOverlap); G4cout << "Length of FLArE : " << lengthFLArE << G4endl; G4cout << "Center of FLArE TPC : " << FLArEPos+hallOffset << G4endl; // w.r.t the global coordinate - + //----------------------------------- // FLArE HadCal/MuonCatcher or BabyMIND if( m_useBabyMIND ){ /// use BabyMIND - + BabyMINDDetectorConstruction *BabyMINDAssembler = new BabyMINDDetectorConstruction(); G4LogicalVolume *BabyMINDAssembly = BabyMINDAssembler->GetBabyMINDAssembly(); - + BabyMINDMagnetPlateLogical = BabyMINDAssembler->GetMagnetPlate(); BabyMINDVerticalBar = BabyMINDAssembler->GetVerticalBar(); BabyMINDHorizontalBar = BabyMINDAssembler->GetHorizontalBar(); - + G4double babyMINDLengthZ = GeometricalParameters::Get()->GetBabyMINDTotalSizeZ(); G4ThreeVector babyMINDPos = GeometricalParameters::Get()->GetFLArEPosition() + G4ThreeVector(0.,0.,lArSizeZ/2.+TPCInsulationThickness) + G4ThreeVector(0.,0.,babyMINDLengthZ/2.); babyMINDPos -= hallOffset; new G4PVPlacement(nullptr, babyMINDPos, BabyMINDAssembly, "BabyMINDPhysical", hallLV, false, 0, fCheckOverlap); - + G4cout << "Length of BabyMIND : " << babyMINDLengthZ << G4endl; G4cout << "Center of BabyMIND : " << babyMINDPos+hallOffset << G4endl; // w.r.t the global coordinate - + } else{ //legacy HadCal/MuonCatcher - + FLArEHadCatcherMuonFinderConstruction *HadCatMuonFindAssembler = new FLArEHadCatcherMuonFinderConstruction(); G4double HadCatcherLength = GeometricalParameters::Get()->GetHadCalLength(); G4double MuonFinderLength = GeometricalParameters::Get()->GetMuonCatcherLength(); - + G4LogicalVolume* HadCatMuonFindAssembly = HadCatMuonFindAssembler->GetHadCatcherMuonFinderAssembly(); HadCalXCellLogical = HadCatMuonFindAssembler->GetHadCalXVolume(); HadCalYCellLogical = HadCatMuonFindAssembler->GetHadCalYVolume(); @@ -156,20 +181,20 @@ G4VPhysicalVolume* DetectorConstruction::Construct() MuonFinderXCellLogical = HadCatMuonFindAssembler->GetMuonCatcherXVolume(); MuonFinderYCellLogical = HadCatMuonFindAssembler->GetMuonCatcherYVolume(); MuonFinderAbsorLayersLogical= HadCatMuonFindAssembler->GetMuonCatcherAbsorbVolume(); - + G4double HadCatMuonFindLengthZ = HadCatcherLength + MuonFinderLength; G4ThreeVector HadCatMuonFindPos = GeometricalParameters::Get()->GetFLArEPosition() + G4ThreeVector(0.,0.,lArSizeZ/2.+TPCInsulationThickness) + G4ThreeVector(0.,0.,HadCatMuonFindLengthZ/2.); - + HadCatMuonFindPos -= hallOffset; new G4PVPlacement(nullptr, HadCatMuonFindPos, HadCatMuonFindAssembly, "HadCatMuonFindPhysical", hallLV, false, 0, fCheckOverlap); - + G4cout << "Length of HadCatherMuonFinder : " << HadCatMuonFindLengthZ << G4endl; G4cout << "Center of HadCatherMuonFinder : " << HadCatMuonFindPos+hallOffset << G4endl; // w.r.t the global coordinate } } - + //----------------------------------- // FORMOSA @@ -187,7 +212,7 @@ G4VPhysicalVolume* DetectorConstruction::Construct() G4cout<<"Length of FORMOSA : "<GetEmulsionFilm(); FASERnu2VetoInterfaceLogical = FASERnu2Assembler->GetVetoInterfaceDetector(); G4LogicalVolume* FASERnu2Assembly = FASERnu2Assembler->GetFASERnu2Assembly(); - + // positioning G4double lengthFASERnu2 = GeometricalParameters::Get()->GetFASERnu2TotalSizeZ(); G4ThreeVector FASERnu2Pos = GeometricalParameters::Get()->GetFASERnu2Position(); @@ -229,7 +254,7 @@ G4VPhysicalVolume* DetectorConstruction::Construct() G4cout<<"Length of FASER2 Spectrometer : "<SetVerboseLevel(2); int SDIdx = 0; @@ -263,15 +288,15 @@ void DetectorConstruction::ConstructSDandField() { sdManager->AddNewDetector(TPCModuleSD); GeometricalParameters::Get()->AddSD2List(SDIdx, "lArBoxSD/lar_box"); SDIdx++; - + if (m_useBabyMIND) { - + LArBoxSD* BabyMINDHorBarSD = new LArBoxSD("BabyMINDHorBarSD"); BabyMINDHorizontalBar->SetSensitiveDetector(BabyMINDHorBarSD); sdManager->AddNewDetector(BabyMINDHorBarSD); GeometricalParameters::Get()->AddSD2List(SDIdx, "BabyMINDHorBarSD/lar_box"); SDIdx++; - + LArBoxSD* BabyMINDVerBarSD = new LArBoxSD("BabyMINDVerBarSD"); BabyMINDVerticalBar->SetSensitiveDetector(BabyMINDVerBarSD); sdManager->AddNewDetector(BabyMINDVerBarSD); @@ -284,9 +309,9 @@ void DetectorConstruction::ConstructSDandField() { babyMINDFieldMgr->SetDetectorField(babyMINDField); babyMINDFieldMgr->CreateChordFinder(babyMINDField); BabyMINDMagnetPlateLogical->SetFieldManager(babyMINDFieldMgr, true); - + } else { - + LArBoxSD* HadCalXSD = new LArBoxSD("HadCalXSD"); HadCalXCellLogical->SetSensitiveDetector(HadCalXSD); sdManager->AddNewDetector(HadCalXSD); @@ -322,7 +347,7 @@ void DetectorConstruction::ConstructSDandField() { sdManager->AddNewDetector(MuonFinderAbsorbSD); GeometricalParameters::Get()->AddSD2List(SDIdx, "MuonFinderAbsorbSD/lar_box"); SDIdx++; - + // magnetic field for HadCatcher + MuonFinder G4ThreeVector fieldValue = G4ThreeVector(0,fFieldValue, 0); magField = new G4UniformMagField(fieldValue); @@ -352,7 +377,7 @@ void DetectorConstruction::ConstructSDandField() { sdManager->AddNewDetector(EmulsionFilmSD); GeometricalParameters::Get()->AddSD2List(SDIdx, "FASERnu2EmulsionSD/lar_box"); SDIdx++; - + LArBoxSD* VetoInterfaceSD = new LArBoxSD("FASERnu2VetoInterfaceSD"); FASERnu2VetoInterfaceLogical->SetSensitiveDetector(VetoInterfaceSD); sdManager->AddNewDetector(VetoInterfaceSD); From b413fdfd072e26a6162358792578c7944db0a2f0 Mon Sep 17 00:00:00 2001 From: Camilla Toomey Date: Tue, 10 Jun 2025 16:26:32 -0400 Subject: [PATCH 2/9] Working version of rockbox --- src/DetectorConstruction.cc | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/src/DetectorConstruction.cc b/src/DetectorConstruction.cc index bb5384b..d551092 100644 --- a/src/DetectorConstruction.cc +++ b/src/DetectorConstruction.cc @@ -36,6 +36,7 @@ #include #include #include +#include using namespace std; @@ -98,31 +99,29 @@ G4VPhysicalVolume* DetectorConstruction::Construct() -auto hallBox = new G4Box("hallBox", hallSizeX/2, hallSizeY/2, hallSizeZ/2); + auto hallBox = new G4Box("hallBox", hallSizeX/2, hallSizeY/2, hallSizeZ/2); + G4double sideOff = 3*m; + G4double frontOff = 10*m; + G4double backOff = 3*m; -G4double sideOff = 3*m; -G4double frontOff = 10*m; -G4double backOff = 3*m; + G4double rockSizeX = hallSizeX + 2*sideOff; + G4double rockSizeY = hallSizeY + 2*sideOff; + G4double rockSizeZ = hallSizeZ + frontOff + backOff; + auto rockBox = new G4Box("rockBox", + rockSizeX/2, + rockSizeY/2, + rockSizeZ/2); + G4ThreeVector rockOffset( 0,0, (frontOff/2)-(backOff/2)); + auto rockEnvelopeSolid = new G4SubtractionSolid("rockEnvelopeSolid", rockBox, hallBox, 0, rockOffset); + auto rockEnvelope = new G4LogicalVolume(rockEnvelopeSolid, LArBoxMaterials->Material("Rock"), "rockEnvelope"); -auto rockBox = new G4Box("rockBox", - (hallSizeX)/2+sideOff, - (hallSizeY)/2+sideOff, - (hallSizeZ)/2+frontOff+backOff); + auto rockEnvelopePV = new G4PVPlacement(nullptr, hallOffset-rockOffset, rockEnvelope, "rockEnvelopePV", worldLV, false, 0, fCheckOverlap); -G4ThreeVector rockOffset( 0,0, 2*frontOff+backOff); - - -auto rockEnvelope = new G4SubtractionSolid("rockEnvelope", rockBox, hallBox); -auto rockDone = new G4LogicalVolume(rockEnvelope, LArBoxMaterials->Material("Rock"), "rockDone"); - - -auto modifiedWrld = new G4PVPlacement(nullptr, hallOffset, rockDone, "modifiedwrld", worldLV, false, 0, fCheckOverlap); - - hallLV = new G4LogicalVolume(hallBox, LArBoxMaterials->Material("Air"), "hallLV"); + hallLV = new G4LogicalVolume(hallBox, LArBoxMaterials->Material("Air"), "hallLV"); auto hallPV = new G4PVPlacement(nullptr, hallOffset, hallLV, "hallPV", worldLV, false, 0, fCheckOverlap); //----------------------------------- @@ -431,4 +430,4 @@ void DetectorConstruction::ConstructSDandField() { //// define new one //G4RunManager::GetRunManager()->DefineWorldVolume(Construct()); // G4RunManager::GetRunManager()->GeometryHasBeenModified(); -//} +//} From 80d299ffb8eb3299010c88c4d55e72819ce30ceb Mon Sep 17 00:00:00 2001 From: Matteo Vicenzi Date: Wed, 11 Jun 2025 09:20:14 -0400 Subject: [PATCH 3/9] add control flag in messenger, geometrical parameters --- CMakeLists.txt | 6 ++-- README.md | 3 +- include/DetectorConstruction.hh | 2 ++ include/DetectorConstructionMessenger.hh | 1 + include/geometry/GeometricalParameters.hh | 13 +++++++ src/DetectorConstruction.cc | 43 ++++++++++++----------- src/DetectorConstructionMessenger.cc | 11 ++++++ src/geometry/GeometricalParameters.cc | 5 +++ 8 files changed, 60 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a24091..3af08e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,14 +90,14 @@ endforeach() #---------------------------------------------------------------------------- # generate dictionaries for the custom classes in the ROOT tree -ROOT_GENERATE_DICTIONARY(DictOutput ${PROJECT_SOURCE_DIR}/include/FPFNeutrino.hh +ROOT_GENERATE_DICTIONARY(FPFClassesDict ${PROJECT_SOURCE_DIR}/include/FPFNeutrino.hh ${PROJECT_SOURCE_DIR}/include/FPFParticle.hh LINKDEF ${PROJECT_SOURCE_DIR}/include/LinkDef.h) # create a shared library that includes the dictionary add_library(FPFClasses SHARED ${PROJECT_SOURCE_DIR}/src/FPFNeutrino.cc ${PROJECT_SOURCE_DIR}/src/FPFParticle.cc - DictOutput.cxx) + FPFClassesDict.cxx) # include directories for headers target_include_directories(FPFClasses PUBLIC ${PROJECT_SOURCE_DIR}/include) @@ -121,4 +121,4 @@ target_link_libraries(FPFSim # install(TARGETS FPFSim DESTINATION ${PROJECT_SOURCE_DIR}/bin) install(TARGETS FPFClasses DESTINATION ${PROJECT_SOURCE_DIR}/lib) -install(FILES ${PROJECT_SOURCE_DIR}/build/libDictOutput_rdict.pcm DESTINATION ${PROJECT_SOURCE_DIR}/lib) +install(FILES ${PROJECT_SOURCE_DIR}/build/libFPFClassesDict_rdict.pcm DESTINATION ${PROJECT_SOURCE_DIR}/lib) diff --git a/README.md b/README.md index b4c72e6..dee7a7a 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,8 @@ Older versions of FORESEE output events in the HepMC2 format. To run over HepMC2 |/det/addFLArE | option for adding the FLArE detector, run before `/run/initialize` |`true`| |/det/addFORMOSA | option for adding the FORMOSA detector, run before `/run/initialize` |`true`| |/det/addFASERnu2 | option for adding the FASERnu2 detector, run before `/run/initialize` |`true`| -|/det/faser/addFASER2 | option for adding the FASER2 detector, run before `/run/initialize` |`true`| +|/det/addFASER2 | option for adding the FASER2 detector, run before `/run/initialize` |`true`| +|/det/enableRock | enable the rock envelope around the hall, run before `/run/initialize` |`false`| |/det/flare/addFLArEPos | position of the FLArE detector, run before `/run/initialize` |`0 0 4300 mm`| |/det/flare/material | option for detector material, choose `LAr` or `LKr`, run before `/run/initialize` |`LAr`| |/det/flare/module | option for tpc module option, choose `single` or `3x7`, run before `/run/initialize` |`single`| diff --git a/include/DetectorConstruction.hh b/include/DetectorConstruction.hh index 13812da..3a87b3b 100644 --- a/include/DetectorConstruction.hh +++ b/include/DetectorConstruction.hh @@ -36,6 +36,7 @@ class DetectorConstruction : public G4VUserDetectorConstruction { void AddFASERnu2(G4bool i) { m_addFASERnu2 = i; } void AddFASER2(G4bool i) { m_addFASER2 = i; } void UseBabyMIND(G4bool i) { m_useBabyMIND = i; } + void EnableRockEnvelope(G4bool i) { m_enableRockEnvelope = i; } void UpdateGeometry(); private: @@ -54,6 +55,7 @@ class DetectorConstruction : public G4VUserDetectorConstruction { G4bool m_addFORMOSA; G4bool m_addFASERnu2; G4bool m_addFASER2; + G4bool m_enableRockEnvelope; // FLArE G4LogicalVolume* TPCModuleLogical; diff --git a/include/DetectorConstructionMessenger.hh b/include/DetectorConstructionMessenger.hh index 0cc0930..29686ce 100644 --- a/include/DetectorConstructionMessenger.hh +++ b/include/DetectorConstructionMessenger.hh @@ -39,6 +39,7 @@ class DetectorConstructionMessenger: public G4UImessenger { G4UIcmdWithABool* detGdmlSaveCmd; G4UIcmdWithAString* detGdmlFileCmd; G4UIcmdWithABool* detCheckOverlapCmd; + G4UIcmdWithABool* detEnableRockCmd; G4UIcmdWithABool* detAddFLArECmd; G4UIcmdWithABool* detAddFORMOSACmd; G4UIcmdWithABool* detAddFASERnu2Cmd; diff --git a/include/geometry/GeometricalParameters.hh b/include/geometry/GeometricalParameters.hh index db30345..2fe0d65 100644 --- a/include/geometry/GeometricalParameters.hh +++ b/include/geometry/GeometricalParameters.hh @@ -23,6 +23,13 @@ class GeometricalParameters { G4double GetHallOffsetX() { return fHallOffsetX; } G4double GetHallOffsetY() { return fHallOffsetY; } + // rock envelope + G4bool GetEnableRockEnvelope() { return fEnableRockEnvelope; } + void SetEnableRockEnvelope(G4bool val) { fEnableRockEnvelope = val; } + G4double GetRockFrontThickness() { return fRockFrontThickness; } + G4double GetRockSideThickness() { return fRockSideThickness; } + G4double GetRockBackThickness() { return fRockBackThickness; } + // FLArE TPC volume enum tpcMaterialOption { LiquidArgon, LiquidKrypton}; tpcMaterialOption ConvertStringToTPCMaterialOption(G4String val); @@ -223,6 +230,12 @@ class GeometricalParameters { G4double fHallOffsetX; // x offset of hall center from the LOS G4double fHallOffsetY; // x offset of hall center from the LOS + // rock envelope + G4bool fEnableRockEnvelope; + G4double fRockFrontThickness; + G4double fRockSideThickness; + G4double fRockBackThickness; + // FLArE TPC volume tpcMaterialOption fFLArETPCMaterialOption; tpcConfigOption fFLArETPCConfigOption; diff --git a/src/DetectorConstruction.cc b/src/DetectorConstruction.cc index d551092..6c9648e 100644 --- a/src/DetectorConstruction.cc +++ b/src/DetectorConstruction.cc @@ -49,7 +49,8 @@ G4ThreadLocal G4FieldManager* DetectorConstruction::babyMINDFieldMgr = 0; DetectorConstruction::DetectorConstruction() : G4VUserDetectorConstruction(), - m_addFLArE(true), m_addFORMOSA(true), m_addFASERnu2(true), m_addFASER2(true), m_useBabyMIND(false) + m_addFLArE(true), m_addFORMOSA(true), m_addFASERnu2(true), m_addFASER2(true), + m_useBabyMIND(false), m_enableRockEnvelope(false) { DefineMaterial(); messenger = new DetectorConstructionMessenger(this); @@ -97,32 +98,34 @@ G4VPhysicalVolume* DetectorConstruction::Construct() GeometricalParameters::Get()->GetHallOffsetY(), hallSizeZ/2 - GeometricalParameters::Get()->GetHallHeadDistance()); - - auto hallBox = new G4Box("hallBox", hallSizeX/2, hallSizeY/2, hallSizeZ/2); + hallLV = new G4LogicalVolume(hallBox, LArBoxMaterials->Material("Air"), "hallLV"); + auto hallPV = new G4PVPlacement(nullptr, hallOffset, hallLV, "hallPV", worldLV, false, 0, fCheckOverlap); - G4double sideOff = 3*m; - G4double frontOff = 10*m; - G4double backOff = 3*m; - - G4double rockSizeX = hallSizeX + 2*sideOff; - G4double rockSizeY = hallSizeY + 2*sideOff; - G4double rockSizeZ = hallSizeZ + frontOff + backOff; + //---------------------------------- + // Rock envelope - auto rockBox = new G4Box("rockBox", - rockSizeX/2, - rockSizeY/2, - rockSizeZ/2); + if(m_enableRockEnvelope){ - G4ThreeVector rockOffset( 0,0, (frontOff/2)-(backOff/2)); + G4double rockSizeX = hallSizeX + 2*GeometricalParameters::Get()->GetRockSideThickness(); + G4double rockSizeY = hallSizeY + 2*GeometricalParameters::Get()->GetRockSideThickness(); + G4double rockSizeZ = hallSizeZ + GeometricalParameters::Get()->GetRockFrontThickness() + + GeometricalParameters::Get()->GetRockBackThickness(); + G4ThreeVector rockOffset( 0, 0, (GeometricalParameters::Get()->GetRockFrontThickness()/2)-(GeometricalParameters::Get()->GetRockBackThickness()/2)); - auto rockEnvelopeSolid = new G4SubtractionSolid("rockEnvelopeSolid", rockBox, hallBox, 0, rockOffset); - auto rockEnvelope = new G4LogicalVolume(rockEnvelopeSolid, LArBoxMaterials->Material("Rock"), "rockEnvelope"); + auto rockBox = new G4Box("rockBox",rockSizeX/2,rockSizeY/2,rockSizeZ/2); + auto rockEnvelopeSolid = new G4SubtractionSolid("rockEnvelopeSolid", rockBox, hallBox, 0, rockOffset); + auto rockEnvelope = new G4LogicalVolume(rockEnvelopeSolid, LArBoxMaterials->Material("Rock"), "rockEnvelope"); + auto rockEnvelopePV = new G4PVPlacement(nullptr, hallOffset-rockOffset, rockEnvelope, "rockEnvelopePV", worldLV, false, 0, fCheckOverlap); - auto rockEnvelopePV = new G4PVPlacement(nullptr, hallOffset-rockOffset, rockEnvelope, "rockEnvelopePV", worldLV, false, 0, fCheckOverlap); + G4cout << "Placing rock envelope: upstream " << GeometricalParameters::Get()->GetRockFrontThickness() + << " downstream " << GeometricalParameters::Get()->GetRockBackThickness() + << " side " << GeometricalParameters::Get()->GetRockSideThickness() << G4endl; - hallLV = new G4LogicalVolume(hallBox, LArBoxMaterials->Material("Air"), "hallLV"); - auto hallPV = new G4PVPlacement(nullptr, hallOffset, hallLV, "hallPV", worldLV, false, 0, fCheckOverlap); + G4VisAttributes* rockVis = new G4VisAttributes(G4Colour(167./255, 168./255, 189./255)); + rockVis->SetVisibility(true); + rockEnvelope->SetVisAttributes(rockVis); + } //----------------------------------- // FLArE TPC volume diff --git a/src/DetectorConstructionMessenger.cc b/src/DetectorConstructionMessenger.cc index b5f2c5e..f7ce3e2 100644 --- a/src/DetectorConstructionMessenger.cc +++ b/src/DetectorConstructionMessenger.cc @@ -32,6 +32,12 @@ DetectorConstructionMessenger::DetectorConstructionMessenger(DetectorConstructio detCheckOverlapCmd = new G4UIcmdWithABool("/det/checkOverlap", this); detCheckOverlapCmd->SetParameterName("checkOverlap", true); detCheckOverlapCmd->SetDefaultValue(false); + + // enable rock envelope + detEnableRockCmd = new G4UIcmdWithABool("/det/enableRock", this); + detEnableRockCmd->SetParameterName("enableRock", true); + detEnableRockCmd->SetDefaultValue(false); + // add FLARE volume detAddFLArECmd = new G4UIcmdWithABool("/det/addFLArE", this); detAddFLArECmd->SetParameterName("Add FLArE detector", true); @@ -223,6 +229,7 @@ DetectorConstructionMessenger::~DetectorConstructionMessenger() { delete detGdmlSaveCmd; delete detGdmlFileCmd; delete detCheckOverlapCmd; + delete detEnableRockCmd; delete detAddFLArECmd; delete detAddFORMOSACmd; delete detAddFASER2Cmd; @@ -295,6 +302,10 @@ void DetectorConstructionMessenger::SetNewValue(G4UIcommand* command, G4String n else if (command == detAddFORMOSACmd) det->AddFORMOSA(detAddFORMOSACmd->GetNewBoolValue(newValues)); else if (command == detAddFASERnu2Cmd) det->AddFASERnu2(detAddFASERnu2Cmd->GetNewBoolValue(newValues)); else if (command == detAddFASER2Cmd) det->AddFASER2(detAddFASER2Cmd->GetNewBoolValue(newValues)); + else if (command == detEnableRockCmd){ + det->EnableRockEnvelope(detEnableRockCmd->GetNewBoolValue(newValues)); + GeometricalParameters::Get()->SetEnableRockEnvelope(detEnableRockCmd->GetNewBoolValue(newValues)); + } // FLARE COMMANDS else if (command == flarePosCmd) diff --git a/src/geometry/GeometricalParameters.cc b/src/geometry/GeometricalParameters.cc index 61013c9..314bf23 100644 --- a/src/geometry/GeometricalParameters.cc +++ b/src/geometry/GeometricalParameters.cc @@ -12,6 +12,11 @@ GeometricalParameters::GeometricalParameters() fHallOffsetX = 1.44*m; fHallOffsetY = 2.21*m; + // rock envelope + fRockFrontThickness = 10*m; + fRockSideThickness = 3*m; + fRockBackThickness = 3*m; + // FLArE TPC volume fFLArETPCMaterialOption = tpcMaterialOption::LiquidArgon; fFLArETPCConfigOption = tpcConfigOption::ThreeBySeven; From 1b535ea8cb114b5c3fb05d5dfd8890862df5bb3c Mon Sep 17 00:00:00 2001 From: Matteo Vicenzi Date: Wed, 11 Jun 2025 09:20:53 -0400 Subject: [PATCH 4/9] pick up correct entry wall for backgrounds --- src/generators/BackgroundGenerator.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/generators/BackgroundGenerator.cc b/src/generators/BackgroundGenerator.cc index f23ff72..6bb6027 100644 --- a/src/generators/BackgroundGenerator.cc +++ b/src/generators/BackgroundGenerator.cc @@ -168,7 +168,9 @@ void BackgroundGenerator::GeneratePrimaries(G4Event* anEvent) // then extract the direction (directional cosines) from second histogram // TODO: you should actually be using a 5D histo for full correlations? - double z = -1.*GeometricalParameters::Get()->GetHallHeadDistance(); //entry wall z in mm + double z = (GeometricalParameters::Get()->GetEnableRockEnvelope()) ? + -1.*(GeometricalParameters::Get()->GetHallHeadDistance()+GeometricalParameters::Get()->GetRockFrontThickness()) + : -1.*GeometricalParameters::Get()->GetHallHeadDistance(); //entry wall z in mm double t = 0.; // TODO: imprint the bunch-crossing timing structure? double x, y, E; fhxyE->GetRandom3(x, y, E); //pos in cm, E in GeV From 269ab71f15fdf6905ccd4ec9dd1ae91db2f7f960 Mon Sep 17 00:00:00 2001 From: Matteo Vicenzi Date: Wed, 11 Jun 2025 11:04:01 -0400 Subject: [PATCH 5/9] fix root library autoloder --- CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3af08e0..9184a93 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,8 +91,9 @@ endforeach() #---------------------------------------------------------------------------- # generate dictionaries for the custom classes in the ROOT tree ROOT_GENERATE_DICTIONARY(FPFClassesDict ${PROJECT_SOURCE_DIR}/include/FPFNeutrino.hh - ${PROJECT_SOURCE_DIR}/include/FPFParticle.hh - LINKDEF ${PROJECT_SOURCE_DIR}/include/LinkDef.h) + ${PROJECT_SOURCE_DIR}/include/FPFParticle.hh + LINKDEF ${PROJECT_SOURCE_DIR}/include/LinkDef.h + MODULE FPFClasses) # create a shared library that includes the dictionary add_library(FPFClasses SHARED ${PROJECT_SOURCE_DIR}/src/FPFNeutrino.cc @@ -121,4 +122,4 @@ target_link_libraries(FPFSim # install(TARGETS FPFSim DESTINATION ${PROJECT_SOURCE_DIR}/bin) install(TARGETS FPFClasses DESTINATION ${PROJECT_SOURCE_DIR}/lib) -install(FILES ${PROJECT_SOURCE_DIR}/build/libFPFClassesDict_rdict.pcm DESTINATION ${PROJECT_SOURCE_DIR}/lib) +install(FILES ${PROJECT_SOURCE_DIR}/build/libFPFClasses_rdict.pcm DESTINATION ${PROJECT_SOURCE_DIR}/lib) From f2c020e19823bc3458b549c80fec3a1b56194afa Mon Sep 17 00:00:00 2001 From: Matteo Vicenzi Date: Wed, 11 Jun 2025 22:39:01 -0400 Subject: [PATCH 6/9] fix indentation --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9184a93..b7e5dd8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,9 +91,9 @@ endforeach() #---------------------------------------------------------------------------- # generate dictionaries for the custom classes in the ROOT tree ROOT_GENERATE_DICTIONARY(FPFClassesDict ${PROJECT_SOURCE_DIR}/include/FPFNeutrino.hh - ${PROJECT_SOURCE_DIR}/include/FPFParticle.hh - LINKDEF ${PROJECT_SOURCE_DIR}/include/LinkDef.h - MODULE FPFClasses) + ${PROJECT_SOURCE_DIR}/include/FPFParticle.hh + LINKDEF ${PROJECT_SOURCE_DIR}/include/LinkDef.h + MODULE FPFClasses) # create a shared library that includes the dictionary add_library(FPFClasses SHARED ${PROJECT_SOURCE_DIR}/src/FPFNeutrino.cc From 37d33288031feaa6ca7b9e92cacc012a9393b3b6 Mon Sep 17 00:00:00 2001 From: Matteo Vicenzi Date: Thu, 12 Jun 2025 18:06:35 -0400 Subject: [PATCH 7/9] add flag default to GeometricalParameters as well --- src/geometry/GeometricalParameters.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/geometry/GeometricalParameters.cc b/src/geometry/GeometricalParameters.cc index 314bf23..f935f09 100644 --- a/src/geometry/GeometricalParameters.cc +++ b/src/geometry/GeometricalParameters.cc @@ -13,6 +13,7 @@ GeometricalParameters::GeometricalParameters() fHallOffsetY = 2.21*m; // rock envelope + fEnableRockEnvelope = false; fRockFrontThickness = 10*m; fRockSideThickness = 3*m; fRockBackThickness = 3*m; From e9203947f313836866e5b4cb8ff8f5abafb0e3bd Mon Sep 17 00:00:00 2001 From: Matteo Vicenzi Date: Fri, 13 Jun 2025 12:54:19 -0400 Subject: [PATCH 8/9] adjust rock envelope printouts --- src/DetectorConstruction.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/DetectorConstruction.cc b/src/DetectorConstruction.cc index 6c9648e..c80de0d 100644 --- a/src/DetectorConstruction.cc +++ b/src/DetectorConstruction.cc @@ -118,14 +118,14 @@ G4VPhysicalVolume* DetectorConstruction::Construct() auto rockEnvelope = new G4LogicalVolume(rockEnvelopeSolid, LArBoxMaterials->Material("Rock"), "rockEnvelope"); auto rockEnvelopePV = new G4PVPlacement(nullptr, hallOffset-rockOffset, rockEnvelope, "rockEnvelopePV", worldLV, false, 0, fCheckOverlap); - G4cout << "Placing rock envelope: upstream " << GeometricalParameters::Get()->GetRockFrontThickness() - << " downstream " << GeometricalParameters::Get()->GetRockBackThickness() + G4cout << "Rock envelope enabled: upstream " << GeometricalParameters::Get()->GetRockFrontThickness() << "," + << " downstream " << GeometricalParameters::Get()->GetRockBackThickness() << "," << " side " << GeometricalParameters::Get()->GetRockSideThickness() << G4endl; G4VisAttributes* rockVis = new G4VisAttributes(G4Colour(167./255, 168./255, 189./255)); rockVis->SetVisibility(true); rockEnvelope->SetVisAttributes(rockVis); - } + } else G4cout << "Rock envelope disabled" << G4endl; //----------------------------------- // FLArE TPC volume From 176425dab845d5f6fd9d611ca4b6bcf29f81de3c Mon Sep 17 00:00:00 2001 From: Matteo Vicenzi Date: Fri, 13 Jun 2025 16:52:55 -0400 Subject: [PATCH 9/9] fix non-poisson background extraction --- src/generators/BackgroundGenerator.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/generators/BackgroundGenerator.cc b/src/generators/BackgroundGenerator.cc index 6bb6027..29fe4da 100644 --- a/src/generators/BackgroundGenerator.cc +++ b/src/generators/BackgroundGenerator.cc @@ -110,7 +110,7 @@ int BackgroundGenerator::ExtractBackgroundParticles() const // use it to extract a realization... int Nparticles = 0; if(lambda < 100) Nparticles = int(G4Poisson(lambda) + 0.5); - else Nparticles = int(G4RandGauss::shoot(Nparticles, TMath::Sqrt(Nparticles))+0.5); + else Nparticles = int(G4RandGauss::shoot(lambda, TMath::Sqrt(lambda)+0.5); return Nparticles; }