Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions DD4hepTutorials/scripts/readEdm4hep.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
24 changes: 14 additions & 10 deletions DD4hepTutorials/sdaction/src/simplecaloSDAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading