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. diff --git a/DD4hepTutorials/README.md b/DD4hepTutorials/README.md index d2aa19a..f9d145b 100644 --- a/DD4hepTutorials/README.md +++ b/DD4hepTutorials/README.md @@ -16,34 +16,18 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> -# 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: 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; 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 @@ -