Newer
Older
#include "DDG4/Geant4Data.h"
using namespace DD4hep;
using namespace DD4hep::Simulation;
/// Namespace for the AIDA detector description toolkit
/// Namespace for the DD4hep event display specializations
/// SimulationHit definition
/**
* \author M.Frank
* \version 1.0
* \ingroup DD4HEP_SIMULATION
* \ingroup DD4HEP_EVE
*/
class SimulationHit {
public:
Position position;
float deposit;
SimulationHit(const Position& p, float d) : position(p), deposit(d) {}
SimulationHit(const SimulationHit& c) : position(c.position), deposit(c.deposit) {}
SimulationHit& operator=(const SimulationHit& c) {
Markus Frank
committed
if ( this != &c ) {
position = c.position;
deposit = c.deposit;
}
return *this;
/// Hit conversion function \ingroup DD4HEP_EVE
static void* _convertHitCollection(const char* source) {
typedef DD4hep::DDEve::SimulationHit SimulationHit;
const std::vector<SimpleHit*>* c = (std::vector<SimpleHit*>*)source;
std::vector<SimulationHit>* pv = new std::vector<SimulationHit>();
if ( source && c->size() > 0 ) {
for(std::vector<SimpleHit*>::const_iterator k=c->begin(); k!=c->end(); ++k) {
SimpleTracker::Hit* trh = dynamic_cast<SimpleTracker::Hit*>(*k);
if ( trh ) {
Markus Frank
committed
pv->push_back(SimulationHit(trh->position, trh->energyDeposit));
continue;
}
SimpleCalorimeter::Hit* cah = dynamic_cast<SimpleCalorimeter::Hit*>(*k);
if ( cah ) {
Markus Frank
committed
pv->push_back(SimulationHit(cah->position, cah->energyDeposit));
continue;