DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Geant4HitExtractor.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 
14 // Framework include files
15 #include <DDG4/Geant4Data.h>
16 
17 using namespace dd4hep::sim;
18 
20 namespace dd4hep {
21 
23  namespace DDEve {
24 
26 
32  class SimulationHit {
33  public:
35  float deposit;
37  SimulationHit() : deposit(0.0) {}
39  SimulationHit(const Position& p, float d) : position(p), deposit(d) {}
41  SimulationHit(const SimulationHit& c) : position(c.position), deposit(c.deposit) {}
46  if ( this != &c ) {
47  position = c.position;
48  deposit = c.deposit;
49  }
50  return *this;
51  }
52  };
53  }
54 }
55 
57 static void* _convertHitCollection(const char* source) {
58  typedef dd4hep::DDEve::SimulationHit SimulationHit;
59  const std::vector<SimpleHit*>* c = (std::vector<SimpleHit*>*)source;
60  std::vector<SimulationHit>* pv = new std::vector<SimulationHit>();
61  if ( source && c->size() > 0 ) {
62  for(std::vector<SimpleHit*>::const_iterator k=c->begin(); k!=c->end(); ++k) {
63  SimpleTracker::Hit* trh = dynamic_cast<SimpleTracker::Hit*>(*k);
64  if ( trh ) {
65  pv->emplace_back(SimulationHit(trh->position, trh->energyDeposit));
66  continue;
67  }
68  SimpleCalorimeter::Hit* cah = dynamic_cast<SimpleCalorimeter::Hit*>(*k);
69  if ( cah ) {
70  pv->emplace_back(SimulationHit(cah->position, cah->energyDeposit));
71  continue;
72  }
73  }
74  }
75  return pv;
76 }
77 
78 #include <DD4hep/Factories.h>
79 using namespace dd4hep::detail;
80 DECLARE_CONSTRUCTOR(DDEve_DDG4CollectionAccess,_convertHitCollection)
dd4hep::DDEve::SimulationHit
SimulationHit definition.
Definition: Geant4HitExtractor.cpp:32
dd4hep::sim::Geant4Tracker::Hit::position
Position position
Hit position.
Definition: Geant4Data.h:268
dd4hep::DDEve::SimulationHit::position
Position position
Definition: Geant4HitExtractor.cpp:34
dd4hep::DDEve
ROOT interactive interface class for running DDEve.
Definition: Dictionary.h:54
dd4hep::DDEve::SimulationHit::~SimulationHit
~SimulationHit()
Standard Destructor.
Definition: Geant4HitExtractor.cpp:43
Geant4Data.h
Factories.h
dd4hep::DDEve::SimulationHit::deposit
float deposit
Definition: Geant4HitExtractor.cpp:35
DECLARE_CONSTRUCTOR
#define DECLARE_CONSTRUCTOR(name, func)
Definition: Factories.h:286
dd4hep::DDEve::SimulationHit::SimulationHit
SimulationHit()
Default constructor.
Definition: Geant4HitExtractor.cpp:37
dd4hep::detail
DD4hep internal namespace.
Definition: Alignments.h:32
dd4hep::sim::Geant4Tracker::Hit
DDG4 tracker hit class used by the generic DDG4 tracker sensitive detector.
Definition: Geant4Data.h:263
dd4hep::DDEve::SimulationHit::SimulationHit
SimulationHit(const SimulationHit &c)
Copy constructor.
Definition: Geant4HitExtractor.cpp:41
dd4hep::sim::Geant4Calorimeter::Hit::energyDeposit
double energyDeposit
Total energy deposit.
Definition: Geant4Data.h:332
dd4hep::sim::Geant4Calorimeter::Hit
DDG4 calorimeter hit class used by the generic DDG4 calorimeter sensitive detector.
Definition: Geant4Data.h:323
dd4hep::Position
ROOT::Math::XYZVector Position
Definition: Objects.h:81
dd4hep::sim
Namespace for the Geant4 based simulation part of the AIDA detector description toolkit.
Definition: Geant4Output2EDM4hep.cpp:49
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::DDEve::SimulationHit::SimulationHit
SimulationHit(const Position &p, float d)
Standard initializing constructor.
Definition: Geant4HitExtractor.cpp:39
dd4hep::sim::Geant4Tracker::Hit::energyDeposit
double energyDeposit
Energy deposit in the tracker hit.
Definition: Geant4Data.h:274
dd4hep::sim::Geant4Calorimeter::Hit::position
Position position
Hit position.
Definition: Geant4Data.h:328
dd4hep::DDEve::SimulationHit::operator=
SimulationHit & operator=(const SimulationHit &c)
Assignment operator.
Definition: Geant4HitExtractor.cpp:45