#include #include #include "IG4VHit.hxx" #include "ICOMETEvent.hxx" #include "IEventFolder.hxx" #include "IG4Trajectory.hxx" #include "IHandle.hxx" ClassImp(COMET::IG4VHit); ClassImp(COMET::IG4HitContainer); COMET::IG4VHit::IG4VHit() : fPrimaryId(0) {} COMET::IG4VHit::IG4VHit(const IG4VHit& rhs) : fPrimaryId(rhs.fPrimaryId) {} COMET::IG4VHit::~IG4VHit() {} void COMET::IG4VHit::ls(Option_t *opt) const { COMET::ls_header(this,opt); std::cout << "Abstract Base Class" << std::endl; } COMET::IG4HitContainer::~IG4HitContainer() { for (const_iterator v = begin(); v != end(); ++v) { delete *v; }; } void COMET::IG4HitContainer::ls(Option_t* opt) const { COMET::IDatum::ls(opt); std::string option(opt); if (option.find("dump") != std::string::npos) { TROOT::IncreaseDirLevel(); for (const_iterator v = begin(); v != end(); ++v) { (*v)->ls(opt); }; TROOT::DecreaseDirLevel(); } } const COMET::IHandle COMET::IG4VHit::GetTrajectory()const{ const COMET::ICOMETEvent* event = COMET::IEventFolder::GetCurrentEvent(); COMET::IHandle trajectories = event->Get("truth/G4Trajectories"); if(!trajectories) return COMET::IHandle(NULL); // Find the trajectory of the primary which created this hit return trajectories->GetTrajectory(fPrimaryId); } float COMET::IG4VHit::GetWeight() const { const COMET::IHandle traj = GetTrajectory(); if(not traj) return -1; return traj->GetWeight(); }