From 2e136e371fcc1287f3a90c56e36fd6aba05d5edb Mon Sep 17 00:00:00 2001 From: Lorenzo Pezzotti Date: Fri, 29 Nov 2024 14:23:56 +0100 Subject: [PATCH] Add "system" id to DREndcapTubes subdetector Add "system" id to DREndcapTubes xml file and assign it to the highest volume in the geometry node. While recreating the volumeID in the DRTubesSDAction, "system" id is set as in DectDimensions_IDEA_o2_v01.xml file. In both xml files add a comment on ids to prevent unwanted modifications. --- .../compact/IDEA_o2_v01/DREndcapTubes_o1_v01.xml | 15 ++++++++++++++- .../IDEA_o2_v01/DectDimensions_IDEA_o2_v01.xml | 5 +++++ .../src/DREndcapTubes_o1_v01.cpp | 1 + plugins/DRTubesSDAction.cpp | 10 ++-------- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/FCCee/IDEA/compact/IDEA_o2_v01/DREndcapTubes_o1_v01.xml b/FCCee/IDEA/compact/IDEA_o2_v01/DREndcapTubes_o1_v01.xml index 10e4c2eba..78d485cf4 100644 --- a/FCCee/IDEA/compact/IDEA_o2_v01/DREndcapTubes_o1_v01.xml +++ b/FCCee/IDEA/compact/IDEA_o2_v01/DREndcapTubes_o1_v01.xml @@ -270,8 +270,21 @@ + + - stave:10,tower:6,air:1,col:16,row:16,clad:1,core:1,cherenkov:1 + system:5,stave:10,tower:6,air:1,col:16,row:16,clad:1,core:1,cherenkov:1 diff --git a/FCCee/IDEA/compact/IDEA_o2_v01/DectDimensions_IDEA_o2_v01.xml b/FCCee/IDEA/compact/IDEA_o2_v01/DectDimensions_IDEA_o2_v01.xml index 9895c63b1..d8e9a9470 100644 --- a/FCCee/IDEA/compact/IDEA_o2_v01/DectDimensions_IDEA_o2_v01.xml +++ b/FCCee/IDEA/compact/IDEA_o2_v01/DectDimensions_IDEA_o2_v01.xml @@ -53,6 +53,11 @@ + diff --git a/detector/calorimeter/dual-readout-tubes/src/DREndcapTubes_o1_v01.cpp b/detector/calorimeter/dual-readout-tubes/src/DREndcapTubes_o1_v01.cpp index 3f2ae408c..a9061e6fd 100644 --- a/detector/calorimeter/dual-readout-tubes/src/DREndcapTubes_o1_v01.cpp +++ b/detector/calorimeter/dual-readout-tubes/src/DREndcapTubes_o1_v01.cpp @@ -511,6 +511,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s Volume motherVolume = description.pickMotherVolume(sdet); // Place the assembly container inside the mother volume PlacedVolume AssemblyEndcapPV = motherVolume.placeVolume(AssemblyEndcap); + AssemblyEndcapPV.addPhysVolID("system",x_det.id()); sdet.setPlacement(AssemblyEndcapPV); std::cout << "--> DREndcapTubes::create_detector() end" << std::endl; diff --git a/plugins/DRTubesSDAction.cpp b/plugins/DRTubesSDAction.cpp index 6f06a3206..483846579 100644 --- a/plugins/DRTubesSDAction.cpp +++ b/plugins/DRTubesSDAction.cpp @@ -155,7 +155,8 @@ bool Geant4SensitiveAction::process(const G4Step* aStep, auto StaveID = static_cast(aStep->GetPreStepPoint()->GetTouchable()->GetCopyNumber(4)); VolumeID VolID = 0; // recreate the 64-bit VolumeID - BitFieldCoder bc("stave:10,tower:6,air:1,col:16,row:16,clad:1,core:1,cherenkov:1"); + BitFieldCoder bc("system:5,stave:10,tower:6,air:1,col:16,row:16,clad:1,core:1,cherenkov:1"); + bc.set(VolID, "system", 25); // this number is set in DectDimensions_IDEA_o2_v01.xml bc.set(VolID, "stave" , StaveID); bc.set(VolID, "tower" , TowerID); bc.set(VolID, "air", 0); @@ -178,8 +179,6 @@ bool Geant4SensitiveAction::process(const G4Step* aStep, if (IsScin) { // it is a scintillating fiber - //m_userData.fEvtAction->AddEdepScin(Edep); - if (aStep->GetTrack()->GetDefinition()->GetPDGCharge() == 0 || steplength == 0.) { return true; // not ionizing particle } @@ -188,12 +187,9 @@ bool Geant4SensitiveAction::process(const G4Step* aStep, DRTubesSglHpr::SmearSSignal(DRTubesSglHpr::ApplyBirks(Edep, steplength)); signalhit = DRTubesSglHpr::AttenuateSSignal(signalhit, distance_to_sipm); if (signalhit == 0) return true; - //m_userData.fEvtAction->AddSglScin(signalhit); } // end of scintillating fibre sigal calculation else { // it is a Cherenkov fiber - // save mc truth info in analysismanager auxiliary outputfile - //m_userData.fEvtAction->AddEdepCher(Edep); // calculate the signal in terms of Cherenkov photo-electrons if (aStep->GetTrack()->GetParticleDefinition() == G4OpticalPhoton::Definition()) { G4OpBoundaryProcessStatus theStatus = Undefined; @@ -221,8 +217,6 @@ bool Geant4SensitiveAction::process(const G4Step* aStep, G4int c_signal = DRTubesSglHpr::SmearCSignal(); signalhit = DRTubesSglHpr::AttenuateCSignal(c_signal, distance_to_sipm); if (signalhit == 0) return true; - // save mc truth info in analysismanager auxiliary outputfile - //m_userData.fEvtAction->AddSglCher(signalhit); aStep->GetTrack()->SetTrackStatus(fStopAndKill); break; }