diff --git a/DD4hepTutorials/scripts/readEdm4hep.cc b/DD4hepTutorials/scripts/readEdm4hep.cc index ade65da..a6b8ed1 100644 --- a/DD4hepTutorials/scripts/readEdm4hep.cc +++ b/DD4hepTutorials/scripts/readEdm4hep.cc @@ -17,6 +17,10 @@ * limitations under the License. */ +// This is Hands-on 6, a more complex analysis for simplecalo2 +// Follow the code and complete the six questions along the code. +// Solutions and at the end of this file. + // load required libraries for ROOT interpreter R__LOAD_LIBRARY(libDDCore.so) R__LOAD_LIBRARY(libpodio.so) diff --git a/DD4hepTutorials/sdaction/src/simplecaloSDAction.cpp b/DD4hepTutorials/sdaction/src/simplecaloSDAction.cpp index a9040d7..838e925 100644 --- a/DD4hepTutorials/sdaction/src/simplecaloSDAction.cpp +++ b/DD4hepTutorials/sdaction/src/simplecaloSDAction.cpp @@ -139,32 +139,36 @@ namespace sim { hit->position = HitCellPos; // this should be assigned only once hit->energyDeposit = aStep->GetTotalEnergyDeposit(); - // Hands-on 6: add calo hit contributions + // Add calo hit contributions // // Crete the first contribution associated to this hit - /*Geant4Calorimeter::Hit::Contribution contrib; + Geant4Calorimeter::Hit::Contribution contrib; contrib.trackID = aStep->GetTrack()->GetTrackID(); + contrib.pdgID = aStep->GetTrack()->GetParticleDefinition()->GetPDGEncoding(); 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 + contrib.x = HitCellPos.x(); + contrib.y = HitCellPos.y(); + contrib.z = HitCellPos.z(); + hit->truth.emplace_back(contrib); 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 calo hit contributions // // Add a new contribution associated to this hit - /*Geant4Calorimeter::Hit::Contribution contrib; + Geant4Calorimeter::Hit::Contribution contrib; contrib.trackID = aStep->GetTrack()->GetTrackID(); + contrib.pdgID = aStep->GetTrack()->GetParticleDefinition()->GetPDGEncoding(); 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 + contrib.x = HitCellPos.x(); + contrib.y = HitCellPos.y(); + contrib.z = HitCellPos.z(); + hit->truth.emplace_back(contrib); } return true;