From ec9acef7f3af5c85c8c9ee5d89c945dd420e6f8d Mon Sep 17 00:00:00 2001 From: Lorenzo Pezzotti Date: Thu, 2 Apr 2026 14:30:33 +0200 Subject: [PATCH 1/5] Minor changes in global README file --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a64b2cd..efab6cb 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # SoftwareTutorials -This repository hosts a variety of software tutorials related to DRDCalo (formerly DRD6) Collaboriation.activities. +This repository hosts a variety of software tutorials related to DRDCalo (formerly DRD6) Collaboriation activities. It includes the tutorials on DD4hep and Gaudi, presented in the 2nd and 4th Collaboration Meeting respectively. Ideally, this repository is expanded with relevant tutorials in the future. @@ -12,7 +12,7 @@ The tutorials can be completed by following the presentation slides linked in th ## Compilation These tutorials are made within the key4hep environment. -To compile and run them, access to an Alma9 machine with `/cvmfs/` mounted to source the key4hep stack is required. +To compile and run them, access to an Alma9 machine with `/cvmfs/` mounted (e.g. lxplus) to source the key4hep stack is required. To clone and build the repository, run the following commands: From 61f80b075cbd3d897dc0d86dc980e2b8651f2ca0 Mon Sep 17 00:00:00 2001 From: Lorenzo Pezzotti Date: Thu, 2 Apr 2026 14:31:45 +0200 Subject: [PATCH 2/5] Rm LICENSE specific for DD4hep tutorial We have now a global LICENSE for every tutorial. --- DD4hepTutorials/LICENSE | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 DD4hepTutorials/LICENSE diff --git a/DD4hepTutorials/LICENSE b/DD4hepTutorials/LICENSE deleted file mode 100644 index 016c452..0000000 --- a/DD4hepTutorials/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2025 DRD6 - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. From 632b60bfcc294337c657a2d2d3922fbd40ded6c9 Mon Sep 17 00:00:00 2001 From: Lorenzo Pezzotti Date: Thu, 2 Apr 2026 14:45:15 +0200 Subject: [PATCH 3/5] Initial comment in xml files gave error Specifically this error "FATAL +++ FATAL Error at Line 2 Column: 4 Message:'--' sequence is illegal in comment" --- .../simplecalo1/compact/elements.xml | 18 ------------------ .../simplecalo1/compact/simplecalo1.xml | 18 ------------------ .../simplecalo2/compact/elements.xml | 18 ------------------ .../simplecalo2/compact/simplecalo2.xml | 18 ------------------ 4 files changed, 72 deletions(-) diff --git a/DD4hepTutorials/simplecalo1/compact/elements.xml b/DD4hepTutorials/simplecalo1/compact/elements.xml index 7d80cee..f35eb34 100644 --- a/DD4hepTutorials/simplecalo1/compact/elements.xml +++ b/DD4hepTutorials/simplecalo1/compact/elements.xml @@ -1,21 +1,3 @@ - diff --git a/DD4hepTutorials/simplecalo1/compact/simplecalo1.xml b/DD4hepTutorials/simplecalo1/compact/simplecalo1.xml index 26ee0f2..6969c6e 100644 --- a/DD4hepTutorials/simplecalo1/compact/simplecalo1.xml +++ b/DD4hepTutorials/simplecalo1/compact/simplecalo1.xml @@ -1,21 +1,3 @@ - diff --git a/DD4hepTutorials/simplecalo2/compact/simplecalo2.xml b/DD4hepTutorials/simplecalo2/compact/simplecalo2.xml index 5b97b5a..8d8fef8 100644 --- a/DD4hepTutorials/simplecalo2/compact/simplecalo2.xml +++ b/DD4hepTutorials/simplecalo2/compact/simplecalo2.xml @@ -1,21 +1,3 @@ - -# DD4hepTutorials for DRD6 +# DD4hepTutorials for DRDCalo -Welcome to the DD4hep Tutorials for DRD6 repository! +Welcome to the DD4hep Tutorials of DRDCalo repository! This repository contains hands-on exercises to help you learn DD4hep, a powerful detector description framework. The exercises are organized into separate folders: - **simplecalo1**: Learn the fundamentals of DD4hep by building your first simplified calorimeter. - **simplecalo2**: Build on simplecalo1 and explore how to set up a custom Geant4 Sensitive Detector. -The tutorials should be run after sourcing the Key4hep environment. -To do this, you will need access to an Alma9 machine with CVMFS. - -The first step is to **build the repository**: - -```bash -# Login to an Alma9 machine with CVMFS mounted, e.g. lxplus -source /cvmfs/sw.hsf.org/key4hep/setup.sh -git clone git@github.com:DRD6/DD4hepTutorials.git -cd DD4hepTutorials -mkdir build install -cd build -cmake .. -DCMAKE_INSTALL_PREFIX=../install -Wno-dev -make install -j 8 -cd .. -# The following command configures the environment to ensure the system can locate the DD4hep detector builders: -k4_local_repo -``` - For instructions on **simplecalo1** and **simplecalo2** follow [this presentation](https://indico.ijclab.in2p3.fr/event/11400/sessions/5873/attachments/25413/37372/DRD6DD4hepTutorial_April2025.pdf). +## Previous editions of this tutorial +- April 2025, DRDCalo Collaboration Meeting [presentation](https://indico.ijclab.in2p3.fr/event/11400/sessions/5873/attachments/25413/37372/DRD6DD4hepTutorial_April2025.pdf) + Happy coding! :rocket: From 27bb7426aba1895343ed0118e3a086f624b812c6 Mon Sep 17 00:00:00 2001 From: Lorenzo Pezzotti Date: Thu, 2 Apr 2026 16:44:46 +0200 Subject: [PATCH 5/5] Add Hands-on 6 Add hands-on part on calo hit contributions. --- .../sdaction/src/simplecaloSDAction.cpp | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/DD4hepTutorials/sdaction/src/simplecaloSDAction.cpp b/DD4hepTutorials/sdaction/src/simplecaloSDAction.cpp index c8ed176..a9040d7 100644 --- a/DD4hepTutorials/sdaction/src/simplecaloSDAction.cpp +++ b/DD4hepTutorials/sdaction/src/simplecaloSDAction.cpp @@ -123,6 +123,7 @@ namespace sim { if (std::abs(localPosition.x()) > 30. || std::abs(localPosition.y()) > 30.) { return true; } + // end of Hands-on 5 */ // Create the hits and accumulate contributions from multiple steps @@ -135,11 +136,35 @@ namespace sim { hit->cellID = VolID; // this should be assigned only once // we divide the coordinated by 10 to save them as cm Position HitCellPos(CellPos.x() / 10, CellPos.y() / 10, CellPos.z() / 10); - hit->position = CellPos; // this should be assigned only once + hit->position = HitCellPos; // this should be assigned only once hit->energyDeposit = aStep->GetTotalEnergyDeposit(); + + // Hands-on 6: add calo hit contributions + // + // Crete the first contribution associated to this hit + /*Geant4Calorimeter::Hit::Contribution contrib; + contrib.trackID = aStep->GetTrack()->GetTrackID(); + contrib.deposit = aStep->GetTotalEnergyDeposit(); + contrib.time = aStep->GetPreStepPoint()->GetGlobalTime(); + contrib.x = HitCellPos.x(); contrib.y = HitCellPos.y(); contrib.z = HitCellPos.z(); + hit->truth.emplace_back(contrib);*/ + // end on Hands-on 6 + coll->add(VolID, hit); // add the hit to the hit collection } else { // if the hit exists already, increment its fields hit->energyDeposit += aStep->GetTotalEnergyDeposit(); + + // Hands-on 6: add calo hit contributions + // + // Add a new contribution associated to this hit + /*Geant4Calorimeter::Hit::Contribution contrib; + contrib.trackID = aStep->GetTrack()->GetTrackID(); + contrib.deposit = aStep->GetTotalEnergyDeposit(); + contrib.time = aStep->GetPreStepPoint()->GetGlobalTime(); + Position HitCellPos(CellPos.x() / 10, CellPos.y() / 10, CellPos.z() / 10); + contrib.x = HitCellPos.x(); contrib.y = HitCellPos.y(); contrib.z = HitCellPos.z(); + hit->truth.emplace_back(contrib);*/ + // end on Hands-on 6 } return true;