File indexing completed on 2025-01-18 09:14:23
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include <DDG4/DDG4Dict.h>
0021 #include <DDG4/Geant4Config.h>
0022 #include <DDG4/Geant4Primary.h>
0023 #include <DDG4/Geant4Random.h>
0024 #include <DDG4/Geant4DataDump.h>
0025 #include <DDG4/Geant4InputAction.h>
0026 #include <DDG4/Geant4GeneratorWrapper.h>
0027
0028
0029 namespace dd4hep {
0030
0031
0032 namespace sim {
0033
0034 #define ACTIONHANDLE(x) \
0035 struct x##Handle { \
0036 Geant4##x* action; \
0037 explicit x##Handle(Geant4##x* a) : action(a) { if ( action ) action->addRef();} \
0038 x##Handle(const x##Handle& h) : action(h.action) { if ( action ) action->addRef();} \
0039 ~x##Handle() { if ( action) action->release(); } \
0040 Geant4##x* release() { Geant4##x* tmp = action; action=0; return tmp; } \
0041 operator dd4hep::sim::Geant4##x* () const { return action; } \
0042 Geant4##x* operator->() const { return action; } \
0043 Geant4##x* get() const { return action; } \
0044 }
0045
0046 ACTIONHANDLE(Filter);
0047 ACTIONHANDLE(Action);
0048 ACTIONHANDLE(PhaseAction);
0049 ACTIONHANDLE(RunAction);
0050 ACTIONHANDLE(EventAction);
0051 ACTIONHANDLE(GeneratorAction);
0052 ACTIONHANDLE(PhysicsList);
0053 ACTIONHANDLE(TrackingAction);
0054 ACTIONHANDLE(SteppingAction);
0055 ACTIONHANDLE(StackingAction);
0056 ACTIONHANDLE(DetectorConstruction);
0057 ACTIONHANDLE(Sensitive);
0058 ACTIONHANDLE(ParticleHandler);
0059 ACTIONHANDLE(UserInitialization);
0060
0061 ACTIONHANDLE(GeneratorActionSequence);
0062 ACTIONHANDLE(RunActionSequence);
0063 ACTIONHANDLE(EventActionSequence);
0064 ACTIONHANDLE(TrackingActionSequence);
0065 ACTIONHANDLE(SteppingActionSequence);
0066 ACTIONHANDLE(StackingActionSequence);
0067 ACTIONHANDLE(DetectorConstructionSequence);
0068 ACTIONHANDLE(PhysicsListActionSequence);
0069 ACTIONHANDLE(SensDetActionSequence);
0070 ACTIONHANDLE(UserInitializationSequence);
0071
0072 struct PropertyResult {
0073 std::string data;
0074 int status;
0075 PropertyResult() : status(0) {}
0076 PropertyResult(const std::string& d, int s) : data(d), status(s) {}
0077 PropertyResult(const PropertyResult& c) : data(c.data), status(c.status) {}
0078 ~PropertyResult() {}
0079 };
0080
0081 struct Geant4ActionCreation {
0082 template <typename H,typename T> static H cr(KernelHandle& kernel, const std::string& name_type, bool shared) {
0083 T action(*kernel.get(),name_type,shared);
0084 H handle(action.get());
0085 return handle;
0086 }
0087 static ActionHandle createAction(KernelHandle& kernel, const std::string& name_type, bool shared)
0088 { return cr<ActionHandle,Setup::Action>(kernel,name_type,shared); }
0089 static FilterHandle createFilter(KernelHandle& kernel, const std::string& name_type, bool shared)
0090 { return cr<FilterHandle,Setup::Filter>(kernel,name_type,shared); }
0091 static PhaseActionHandle createPhaseAction(KernelHandle& kernel, const std::string& name_type, bool shared)
0092 { return cr<PhaseActionHandle,Setup::PhaseAction>(kernel,name_type,shared); }
0093 static PhysicsListHandle createPhysicsList(KernelHandle& kernel, const std::string& name_type)
0094 { return cr<PhysicsListHandle,Setup::PhysicsList>(kernel,name_type,false); }
0095 static RunActionHandle createRunAction(KernelHandle& kernel, const std::string& name_type, bool shared)
0096 { return cr<RunActionHandle,Setup::RunAction>(kernel,name_type,shared); }
0097 static EventActionHandle createEventAction(KernelHandle& kernel, const std::string& name_type, bool shared)
0098 { return cr<EventActionHandle,Setup::EventAction>(kernel,name_type,shared); }
0099 static TrackingActionHandle createTrackingAction(KernelHandle& kernel, const std::string& name_type, bool shared)
0100 { return cr<TrackingActionHandle,Setup::TrackAction>(kernel,name_type,shared); }
0101 static SteppingActionHandle createSteppingAction(KernelHandle& kernel, const std::string& name_type, bool shared)
0102 { return cr<SteppingActionHandle,Setup::StepAction>(kernel,name_type,shared); }
0103 static StackingActionHandle createStackingAction(KernelHandle& kernel, const std::string& name_type, bool shared)
0104 { return cr<StackingActionHandle,Setup::StackAction>(kernel,name_type,shared); }
0105
0106 static GeneratorActionHandle createGeneratorAction(KernelHandle& kernel, const std::string& name_type, bool shared)
0107 { return cr<GeneratorActionHandle,Setup::GenAction>(kernel,name_type,shared); }
0108
0109 static DetectorConstructionHandle createDetectorConstruction(KernelHandle& kernel, const std::string& name_type)
0110 { return cr<DetectorConstructionHandle,Setup::DetectorConstruction>(kernel,name_type,false); }
0111
0112 static UserInitializationHandle createUserInitialization(KernelHandle& kernel, const std::string& name_type)
0113 { return UserInitializationHandle(Setup::Initialization(*kernel.get(),name_type,false).get());}
0114
0115 static SensitiveHandle createSensitive(KernelHandle& kernel, const std::string& name_type, const std::string& detector, bool shared)
0116 { return SensitiveHandle(Setup::Sensitive(*kernel.get(),name_type,detector,shared).get()); }
0117
0118 static SensDetActionSequenceHandle createSensDetSequence(KernelHandle& kernel, const std::string& name_type)
0119 { return cr<SensDetActionSequenceHandle,Setup::SensitiveSeq>(kernel,name_type,false); }
0120
0121 static Geant4Action* toAction(Geant4Filter* f) { return f; }
0122 static Geant4Action* toAction(Geant4Action* f) { return f; }
0123 static Geant4Action* toAction(Geant4PhaseAction* f) { return f; }
0124 static Geant4Action* toAction(Geant4Sensitive* f) { return f; }
0125 static Geant4Action* toAction(Geant4PhysicsList* f) { return f; }
0126 static Geant4Action* toAction(Geant4RunAction* f) { return f; }
0127 static Geant4Action* toAction(Geant4EventAction* f) { return f; }
0128 static Geant4Action* toAction(Geant4TrackingAction* f) { return f; }
0129 static Geant4Action* toAction(Geant4SteppingAction* f) { return f; }
0130 static Geant4Action* toAction(Geant4StackingAction* f) { return f; }
0131 static Geant4Action* toAction(Geant4GeneratorAction* f) { return f; }
0132 static Geant4Action* toAction(Geant4GeneratorActionSequence* f) { return f; }
0133 static Geant4Action* toAction(Geant4RunActionSequence* f) { return f; }
0134 static Geant4Action* toAction(Geant4EventActionSequence* f) { return f; }
0135 static Geant4Action* toAction(Geant4TrackingActionSequence* f) { return f; }
0136 static Geant4Action* toAction(Geant4SteppingActionSequence* f) { return f; }
0137 static Geant4Action* toAction(Geant4StackingActionSequence* f) { return f; }
0138 static Geant4Action* toAction(Geant4PhysicsListActionSequence* f){ return f; }
0139 static Geant4Action* toAction(Geant4SensDetActionSequence* f) { return f; }
0140 static Geant4Action* toAction(Geant4UserInitialization* f) { return f; }
0141 static Geant4Action* toAction(Geant4UserInitializationSequence* f){ return f; }
0142 static Geant4Action* toAction(Geant4DetectorConstruction* f) { return f; }
0143 static Geant4Action* toAction(Geant4DetectorConstructionSequence* f){ return f; }
0144
0145 static Geant4Action* toAction(FilterHandle f) { return f.action; }
0146 static Geant4Action* toAction(ActionHandle f) { return f.action; }
0147 static Geant4Action* toAction(PhaseActionHandle f) { return f.action; }
0148 static Geant4Action* toAction(SensitiveHandle f) { return f.action; }
0149 static Geant4Action* toAction(PhysicsListHandle f) { return f.action; }
0150 static Geant4Action* toAction(RunActionHandle f) { return f.action; }
0151 static Geant4Action* toAction(EventActionHandle f) { return f.action; }
0152 static Geant4Action* toAction(TrackingActionHandle f) { return f.action; }
0153 static Geant4Action* toAction(SteppingActionHandle f) { return f.action; }
0154 static Geant4Action* toAction(StackingActionHandle f) { return f.action; }
0155 static Geant4Action* toAction(GeneratorActionHandle f) { return f.action; }
0156 static Geant4Action* toAction(GeneratorActionSequenceHandle f) { return f.action; }
0157 static Geant4Action* toAction(RunActionSequenceHandle f) { return f.action; }
0158 static Geant4Action* toAction(EventActionSequenceHandle f) { return f.action; }
0159 static Geant4Action* toAction(TrackingActionSequenceHandle f) { return f.action; }
0160 static Geant4Action* toAction(SteppingActionSequenceHandle f) { return f.action; }
0161 static Geant4Action* toAction(StackingActionSequenceHandle f) { return f.action; }
0162 static Geant4Action* toAction(PhysicsListActionSequenceHandle f) { return f.action; }
0163 static Geant4Action* toAction(SensDetActionSequenceHandle f) { return f.action; }
0164 static Geant4Action* toAction(UserInitializationHandle f) { return f.action; }
0165 static Geant4Action* toAction(UserInitializationSequenceHandle f){ return f.action; }
0166 static Geant4Action* toAction(DetectorConstructionHandle f) { return f.action; }
0167 static Geant4Action* toAction(DetectorConstructionSequenceHandle f){ return f.action; }
0168 static PropertyResult getProperty(Geant4Action* action, const std::string& name) {
0169 if ( action->hasProperty(name) ) {
0170 return PropertyResult(action->property(name).str(),1);
0171 }
0172 return PropertyResult("",0);
0173 }
0174 static int setProperty(Geant4Action* action, const std::string& name, const std::string& value) {
0175 if ( action->hasProperty(name) ) {
0176 action->property(name).str(value);
0177 return 1;
0178 }
0179 return 0;
0180 }
0181 static PropertyResult getPropertyKernel(Geant4Kernel* kernel, const std::string& name) {
0182 if ( kernel->hasProperty(name) ) {
0183 return PropertyResult(kernel->property(name).str(),1);
0184 }
0185 return PropertyResult("",0);
0186 }
0187 static int setPropertyKernel(Geant4Kernel* kernel, const std::string& name, const std::string& value) {
0188 if ( kernel->hasProperty(name) ) {
0189 kernel->property(name).str(value);
0190 return 1;
0191 }
0192 return 0;
0193 }
0194 };
0195
0196
0197 typedef std::vector<Geant4Vertex*> Geant4VertexVector;
0198 typedef std::map<int,Geant4Vertex*> Geant4VertexIntMap;
0199
0200
0201 typedef std::vector<Geant4Particle*> Geant4ParticleVector;
0202 typedef std::map<int,Geant4Particle*> Geant4ParticleIntMap;
0203 }
0204 }
0205
0206 typedef dd4hep::sim::Geant4ActionCreation Geant4ActionCreation;
0207
0208 #include <DD4hep/detail/DetectorInterna.h>
0209 #include <DDG4/Geant4UIManager.h>
0210
0211
0212 #if defined(__CINT__) || defined(__MAKECINT__) || defined(__CLING__) || defined(__ROOTCLING__)
0213
0214
0215
0216
0217 #pragma link C++ class dd4hep::sim::VertexExtension+;
0218 #pragma link C++ class dd4hep::sim::Geant4Vertex+;
0219 #pragma link C++ class vector<dd4hep::sim::Geant4Vertex*>+;
0220 #pragma link C++ class map<int,dd4hep::sim::Geant4Vertex*>+;
0221
0222 #pragma link C++ class dd4hep::sim::Geant4ParticleMap+;
0223 #pragma link C++ class dd4hep::sim::PrimaryExtension+;
0224 #pragma link C++ class dd4hep::sim::Geant4PrimaryInteraction+;
0225 #pragma link C++ class std::vector<dd4hep::sim::Geant4PrimaryInteraction*>+;
0226 #pragma link C++ class std::map<int,dd4hep::sim::Geant4PrimaryInteraction*>+;
0227 #pragma link C++ class dd4hep::sim::Geant4PrimaryEvent+;
0228
0229 #pragma link C++ typedef dd4hep::sim::Geant4VertexVector;
0230 #pragma link C++ typedef dd4hep::sim::Geant4VertexIntMap;
0231
0232 #pragma link C++ typedef dd4hep::sim::Geant4ParticleVector;
0233 #pragma link C++ typedef dd4hep::sim::Geant4ParticleIntMap;
0234
0235 #pragma link C++ class dd4hep::sim::PropertyResult;
0236
0237
0238 #pragma link C++ class dd4hep::sim::Geant4ParticleHandle;
0239 #pragma link C++ class dd4hep::sim::Geant4ParticleMap;
0240 #pragma link C++ class std::map<int,dd4hep::sim::Geant4Particle*>;
0241
0242 #pragma link C++ class dd4hep::dd4hep_ptr<dd4hep::sim::VertexExtension>+;
0243 #pragma link C++ class dd4hep::dd4hep_ptr<dd4hep::sim::PrimaryExtension>+;
0244 #pragma link C++ class dd4hep::dd4hep_ptr<dd4hep::sim::Geant4InputAction::Particles>;
0245
0246
0247 #pragma link C++ class dd4hep::sim::Geant4ActionCreation;
0248 #pragma link C++ class dd4hep::sim::Geant4Kernel;
0249 #pragma link C++ class dd4hep::sim::Geant4Kernel::PhaseSelector;
0250 #pragma link C++ class dd4hep::sim::Geant4Context;
0251 #pragma link C++ class dd4hep::sim::KernelHandle;
0252 #pragma link C++ class dd4hep::sim::Geant4ActionContainer;
0253
0254 #pragma link C++ class dd4hep::sim::Geant4Action;
0255 #pragma link C++ class dd4hep::sim::ActionHandle;
0256
0257 #pragma link C++ class dd4hep::sim::RunActionSequenceHandle;
0258 #pragma link C++ class dd4hep::sim::Geant4RunActionSequence;
0259 #pragma link C++ class dd4hep::sim::RunActionHandle;
0260 #pragma link C++ class dd4hep::sim::Geant4SharedRunAction;
0261 #pragma link C++ class dd4hep::sim::Geant4RunAction;
0262
0263 #pragma link C++ class dd4hep::sim::EventActionSequenceHandle;
0264 #pragma link C++ class dd4hep::sim::Geant4EventActionSequence;
0265 #pragma link C++ class dd4hep::sim::EventActionHandle;
0266 #pragma link C++ class dd4hep::sim::Geant4SharedEventAction;
0267 #pragma link C++ class dd4hep::sim::Geant4EventAction;
0268
0269 #pragma link C++ class dd4hep::sim::SteppingActionSequenceHandle;
0270 #pragma link C++ class dd4hep::sim::Geant4SteppingActionSequence;
0271 #pragma link C++ class dd4hep::sim::SteppingActionHandle;
0272 #pragma link C++ class dd4hep::sim::Geant4SharedSteppingAction;
0273 #pragma link C++ class dd4hep::sim::Geant4SteppingAction;
0274
0275 #pragma link C++ class dd4hep::sim::StackingActionHandle;
0276 #pragma link C++ class dd4hep::sim::Geant4StackingAction;
0277 #pragma link C++ class dd4hep::sim::StackingActionSequenceHandle;
0278 #pragma link C++ class dd4hep::sim::Geant4StackingActionSequence;
0279
0280 #pragma link C++ class dd4hep::sim::TrackingActionHandle;
0281 #pragma link C++ class dd4hep::sim::Geant4TrackingAction;
0282 #pragma link C++ class dd4hep::sim::TrackingActionSequenceHandle;
0283 #pragma link C++ class dd4hep::sim::Geant4TrackingActionSequence;
0284
0285 #pragma link C++ class dd4hep::sim::GeneratorActionHandle;
0286 #pragma link C++ class dd4hep::sim::GeneratorActionSequenceHandle;
0287 #pragma link C++ class dd4hep::sim::Geant4GeneratorActionSequence;
0288 #pragma link C++ class dd4hep::sim::Geant4GeneratorAction;
0289
0290 #pragma link C++ class dd4hep::sim::Geant4InputAction;
0291 #pragma link C++ class dd4hep::sim::Geant4EventReader;
0292
0293 #pragma link C++ class dd4hep::sim::PhysicsListHandle;
0294 #pragma link C++ class dd4hep::sim::Geant4PhysicsList;
0295 #pragma link C++ class dd4hep::sim::PhysicsListActionSequenceHandle;
0296 #pragma link C++ class dd4hep::sim::Geant4PhysicsListActionSequence;
0297
0298 #pragma link C++ class dd4hep::sim::UserInitializationHandle;
0299 #pragma link C++ class dd4hep::sim::UserInitializationSequenceHandle;
0300 #pragma link C++ class dd4hep::sim::Geant4UserInitializationSequence;
0301 #pragma link C++ class dd4hep::sim::Geant4UserInitialization;
0302
0303 #pragma link C++ class dd4hep::sim::DetectorConstructionHandle;
0304 #pragma link C++ class dd4hep::sim::DetectorConstructionSequenceHandle;
0305 #pragma link C++ class dd4hep::sim::Geant4DetectorConstructionSequence;
0306 #pragma link C++ class dd4hep::sim::Geant4DetectorConstruction;
0307
0308 #pragma link C++ class dd4hep::sim::SensitiveHandle;
0309 #pragma link C++ class dd4hep::sim::SensDetActionSequenceHandle;
0310 #pragma link C++ class dd4hep::sim::Geant4ActionSD;
0311 #pragma link C++ class dd4hep::sim::Geant4Sensitive;
0312 #pragma link C++ class dd4hep::sim::Geant4SensDetActionSequence;
0313
0314 #pragma link C++ class dd4hep::sim::FilterHandle;
0315 #pragma link C++ class dd4hep::sim::Geant4Filter;
0316 #pragma link C++ class dd4hep::sim::Geant4GeneratorWrapper;
0317
0318 #pragma link C++ class dd4hep::sim::PhaseActionHandle;
0319 #pragma link C++ class dd4hep::sim::Geant4ActionPhase;
0320 #pragma link C++ class dd4hep::sim::Geant4PhaseAction;
0321
0322 #pragma link C++ class dd4hep::Callback;
0323 #pragma link C++ class dd4hep::Callback::mfunc_t;
0324
0325
0326 #pragma link C++ class dd4hep::sim::Geant4DataDump;
0327 #pragma link C++ class dd4hep::sim::Geant4Random;
0328 #pragma link C++ class dd4hep::sim::Geant4ParticleHandler;
0329 #pragma link C++ class dd4hep::sim::Geant4UIManager;
0330 #pragma link C++ class dd4hep::sim::Geant4UserParticleHandler;
0331
0332
0333
0334
0335
0336
0337 #endif
0338
0339
0340 #include <CLHEP/Random/Random.h>
0341 #if defined(__CINT__) || defined(__MAKECINT__) || defined(__CLING__) || defined(__ROOTCLING__)
0342
0343 #pragma link C++ namespace CLHEP;
0344 #pragma link C++ class CLHEP::HepRandom;
0345 #pragma link C++ class CLHEP::HepRandomEngine;
0346 #endif