File indexing completed on 2025-01-30 09:17:26
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <DDG4/Geant4Data.h>
0016
0017 using namespace dd4hep::sim;
0018
0019
0020 namespace dd4hep {
0021
0022
0023 namespace DDEve {
0024
0025
0026
0027
0028
0029
0030
0031
0032 class SimulationHit {
0033 public:
0034 Position position;
0035 float deposit;
0036
0037 SimulationHit() : deposit(0.0) {}
0038
0039 SimulationHit(const Position& p, float d) : position(p), deposit(d) {}
0040
0041 SimulationHit(const SimulationHit& c) : position(c.position), deposit(c.deposit) {}
0042
0043 ~SimulationHit() {}
0044
0045 SimulationHit& operator=(const SimulationHit& c) {
0046 if ( this != &c ) {
0047 position = c.position;
0048 deposit = c.deposit;
0049 }
0050 return *this;
0051 }
0052 };
0053 }
0054 }
0055
0056
0057 static void* _convertHitCollection(const char* source) {
0058 typedef dd4hep::DDEve::SimulationHit SimulationHit;
0059 const std::vector<SimpleHit*>* c = (std::vector<SimpleHit*>*)source;
0060 std::vector<SimulationHit>* pv = new std::vector<SimulationHit>();
0061 if ( source && c->size() > 0 ) {
0062 for(std::vector<SimpleHit*>::const_iterator k=c->begin(); k!=c->end(); ++k) {
0063 SimpleTracker::Hit* trh = dynamic_cast<SimpleTracker::Hit*>(*k);
0064 if ( trh ) {
0065 pv->emplace_back(SimulationHit(trh->position, trh->energyDeposit));
0066 continue;
0067 }
0068 SimpleCalorimeter::Hit* cah = dynamic_cast<SimpleCalorimeter::Hit*>(*k);
0069 if ( cah ) {
0070 pv->emplace_back(SimulationHit(cah->position, cah->energyDeposit));
0071 continue;
0072 }
0073 }
0074 }
0075 return pv;
0076 }
0077
0078 #include <DD4hep/Factories.h>
0079 using namespace dd4hep::detail;
0080 DECLARE_CONSTRUCTOR(DDEve_DDG4CollectionAccess,_convertHitCollection)