DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Geant4XMLSetup.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 <DD4hep/Detector.h>
16 #include <DD4hep/Printout.h>
18 #include <XML/Conversions.h>
19 #include <DDG4/Geant4Config.h>
20 
22 namespace dd4hep {
23 
24  // Forward declarations
25  class ActionSequence;
26  using namespace dd4hep::sim;
27  using namespace dd4hep::sim::Setup;
28 
30  namespace sim {
31 
32  // Forward declarations
33  class XMLSetup;
34 
36  template <typename TYPE, typename PTR> TYPE* _action(PTR* in) {
37  return dynamic_cast<TYPE*>(in);
38  }
39 
41  template <typename T> static void installMessenger(const T& handle) {
42  handle->installMessengers();
43  }
44 
46  template <typename T> static void _setAttributes(const T& handle, xml_h& e) {
47  xml::Handle_t props(e);
48  // Now we set the object properties
49  std::vector<xml::Attribute> attrs = props.attributes();
50  for(std::vector<xml::Attribute>::iterator i=attrs.begin(); i!=attrs.end(); ++i) {
51  xml::Attribute a = *i;
52  handle[xml::_toString(props.attr_name(a))].str(props.attr<std::string>(a));
53  }
54  }
55 
57  template <typename T> static void _setProperties(const T& handle, xml_h& e) {
58  xml_comp_t action(e);
59  // Now we set the object properties
60  xml::Handle_t props = action.child(_Unicode(properties),false);
61  if ( props ) {
62  _setAttributes(handle, props);
63  }
64  if ( action.hasAttr(_Unicode(Control)) ) {
65  handle["Control"].str(props.attr<std::string>(_Unicode(Control)));
66  }
67  }
68 
70  static Action _convertSensitive(Detector& description, xml_h e, const std::string& detector) {
71  xml_comp_t action(e);
72  Kernel& kernel = Kernel::instance(description);
73  TypeName tn = TypeName::split(action.attr<std::string>(_U(name)));
74  // Create the object using the factory method
75  Sensitive handle(kernel,action.attr<std::string>(_U(name)),detector);
76  _setProperties(Action(handle.get()),e);
77  for(xml_coll_t f(e,_Unicode(filter)); f; ++f) {
78  std::string nam = f.attr<std::string>(_U(name));
79  Filter filter(kernel.globalFilter(nam,false));
80  handle->adopt(filter);
81  }
82  installMessenger(handle);
83  printout(INFO,"Geant4Setup","+++ Added sensitive element %s of type %s",
84  tn.second.c_str(),tn.first.c_str());
85  return Action(handle);
86  }
87 
89  static Action _convertAction(Detector& description, xml_h e) {
90  xml_comp_t action(e);
91  Kernel& kernel = Kernel::instance(description);
92  TypeName tn = TypeName::split(action.attr<std::string>(_U(name)));
93  // Create the object using the factory method
94  Action handle(kernel,action.attr<std::string>(_U(name)));
95  _setProperties(handle,e);
96  printout(INFO,"Geant4Setup","+++ Added action %s of type %s",tn.second.c_str(),tn.first.c_str());
97  installMessenger(handle);
98 
99  if ( action.hasChild(_Unicode(adopt)) ) {
100  xml_comp_t child = action.child(_Unicode(adopt));
101  Geant4Action* user = kernel.globalAction(child.nameStr());
102  Geant4ParticleHandler* ph = dynamic_cast<Geant4ParticleHandler*>(handle.get());
103  if ( ph ) {
104  ph->adopt(user);
105  }
106  }
107  return handle;
108  }
109 
110  enum { SENSITIVE, ACTION, FILTER };
112  Action _createAction(Detector& description, xml_h a, const std::string& seqType, int what) {
113  std::string nam = a.attr<std::string>(_U(name));
114  TypeName typ = TypeName::split(nam);
115  Kernel& kernel = Kernel::instance(description);
116  Action action((what==FILTER) ? (Geant4Action*)kernel.globalFilter(typ.second,false)
117  : (what==ACTION) ? kernel.globalAction(typ.second,false)
119  : 0);
120  // Create the object using the factory method
121  if ( !action ) {
122  action = (what == SENSITIVE) ? Action(_convertSensitive(description, a, seqType))
123  : (what==ACTION) ? _convertAction(description, a)
124  : (what==FILTER) ? _convertAction(description, a)
125  : Action();
126  if ( !action ) {
127  except("Geant4ActionSequence",
128  "DDG4: The action '%s' cannot be created. [Action-Missing]",nam.c_str());
129  }
130  }
131  return action;
132  }
133 }
134 
136 
145 template <> void Converter<Action>::operator()(xml_h e) const {
146  Action a = _convertAction(description, e);
147  Kernel::instance(description).registerGlobalAction(a);
148 }
149 
151 
161 template <> void Converter<Filter>::operator()(xml_h e) const {
162  Action a = _convertAction(description, e);
163  Kernel::instance(description).registerGlobalFilter(a);
164 }
165 
167 
176 template <> void Converter<Phase>::operator()(xml_h e) const {
177  xml_comp_t x_phase(e);
178  Kernel& kernel = Kernel::instance(description);
179  std::string nam = x_phase.attr<std::string>(_U(type));
180  typedef Geant4ActionPhase PH;
181  Phase p;
182 
183  if ( nam == "RunAction/begin" ) {
184  void (Geant4ActionPhase::*func)(const G4Run*) = &Geant4ActionPhase::call;
185  kernel.runAction().callAtBegin((p=kernel.addPhase<const G4Run*>(nam)).get(),func);
186  //&Geant4ActionPhase::call<const G4Run*>);
187  }
188  else if ( nam == "RunAction/end" ) {
189  void (Geant4ActionPhase::*func)(const G4Run*) = &Geant4ActionPhase::call;
190  kernel.runAction().callAtEnd((p=kernel.addPhase<const G4Run*>(nam)).get(),func);
191  //&PH::call<const G4Run*>);
192  }
193  else if ( nam == "EventAction/begin" ) {
194  void (Geant4ActionPhase::*func)(const G4Event*) = &Geant4ActionPhase::call;
195  kernel.eventAction().callAtBegin((p=kernel.addPhase<const G4Event*>(nam)).get(),func);
196  //&PH::call<const G4Event*>);
197  }
198  else if ( nam == "EventAction/end" ) {
199  void (Geant4ActionPhase::*func)(const G4Event*) = &Geant4ActionPhase::call;
200  kernel.eventAction().callAtEnd((p=kernel.addPhase<const G4Event*>(nam)).get(),func);
201  //&PH::call<const G4Event*>);
202  }
203  else if ( nam == "TrackingAction/begin" ) {
204  void (Geant4ActionPhase::*func)(const G4Track*) = &Geant4ActionPhase::call;
205  kernel.trackingAction().callAtBegin((p=kernel.addPhase<const G4Track*>(nam)).get(),func);
206  //&PH::call<const G4Track*>);
207  }
208  else if ( nam == "TrackingAction/end" ) {
209  void (Geant4ActionPhase::*func)(const G4Track*) = &Geant4ActionPhase::call;
210  kernel.trackingAction().callAtEnd((p=kernel.addPhase<const G4Track*>(nam,false)).get(),func);
211  //&PH::call<const G4Track*>);
212  }
213  else if ( nam == "StackingAction/newStage" ) {
214  kernel.stackingAction().callAtNewStage((p=kernel.addPhase<void>(nam,false)).get(),&PH::call);
215  }
216  else if ( nam == "StackingAction/prepare" ) {
217  kernel.stackingAction().callAtPrepare((p=kernel.addPhase<void>(nam,false)).get(),&PH::call);
218  }
219  else if ( nam == "SteppingAction" ) {
220  void (Geant4ActionPhase::*func)(const G4Step*,G4SteppingManager*) = &Geant4ActionPhase::call;
221  kernel.steppingAction().call((p=kernel.addPhase<const G4Step*>(nam)).get(),func);
222  //&PH::call<const G4Step*,G4SteppingManager*>);
223  }
224  else if ( nam == "GeneratorAction/primaries" ) {
225  void (Geant4ActionPhase::*func)(G4Event*) = &Geant4ActionPhase::call;
226  kernel.generatorAction().call((p=kernel.addPhase<G4Event*>(nam)).get(),func);
227  //&PH::call<G4Event*>);
228  }
229  else {
230  TypeName tn = TypeName::split(nam);
231  DetElement det = description.detector(tn.first);
232  if ( !det.isValid() ) {
233  except("Phase","DDG4: The phase '%s' of type SensitiveSeq"
234  " cannot be attached to a non-existing detector"
235  " [Detector-Missing]",nam.c_str());
236  }
237 
238  SensitiveDetector sd = description.sensitiveDetector(tn.first);
239  if ( !sd.isValid() ) {
240  except("Phase","DDG4: The phase '%s' of type SensitiveSeq"
241  " cannot be attached to a non-existing sensitive detector"
242  " [Sensitive-Missing]",nam.c_str());
243  }
244  SensitiveSeq sdSeq = SensitiveSeq(kernel,tn.first);
245  if ( tn.second == "begin" )
246  sdSeq->callAtBegin((p=kernel.addPhase<G4HCofThisEvent*>(tn.second)).get(),
247  &PH::call<G4HCofThisEvent*>);
248  else if ( tn.second == "end" )
249  sdSeq->callAtEnd((p=kernel.addPhase<G4HCofThisEvent*>(tn.second)).get(),
250  &PH::call<G4HCofThisEvent*>);
251  else if ( tn.second == "clear" )
252  sdSeq->callAtClear((p=kernel.addPhase<G4HCofThisEvent*>(tn.second)).get(),
253  &PH::call<G4HCofThisEvent*>);
254  else if ( tn.second == "process" )
255  sdSeq->callAtProcess((p=kernel.addPhase<G4Step*>(tn.second)).get(),
256  &PH::call<G4Step*,G4TouchableHistory*>);
257  else
258  except("Phase","DDG4: The phase '%s' of type SensitiveSeq"
259  " cannot be attached to the call '%s'."
260  " [Callback-Missing]",tn.first.c_str(), tn.second.c_str());
261  }
262 }
263 
265 
279 template <> void Converter<ActionSequence>::operator()(xml_h e) const {
280  xml_comp_t seq(e);
281  SensitiveSeq sdSeq;
282  std::string seqNam;
283  TypeName seqType;
284  int what = ACTION;
285  Kernel& kernel = Kernel::instance(description);
286 
287  if ( seq.hasAttr(_U(sd)) ) {
288  std::string sd_nam = seq.attr<std::string>(_U(sd));
289  SensitiveDetector sensitive = description.sensitiveDetector(sd_nam);
290  seqNam = seq.attr<std::string>(_U(type))+"/"+sd_nam;
291  if ( !sensitive.isValid() ) {
292  printout(ALWAYS,"Geant4Setup","+++ ActionSequence %s is defined, "
293  "but no sensitive detector present.",seqNam.c_str());
294  printout(ALWAYS,"Geant4Setup","+++ ---> Sequence for detector %s IGNORED on popular request!",
295  sd_nam.c_str());
296  return;
297  }
298  seqType = TypeName::split(seqNam);
299  sdSeq = SensitiveSeq(kernel,seqNam);
300  what = SENSITIVE;
301  }
302  else {
303  seqNam = seq.attr<std::string>(_U(name));
304  seqType = TypeName::split(seqNam);
305  }
306  printout(INFO,"Geant4Setup","+++ ActionSequence %s of type %s added.",
307  seqType.second.c_str(),seqType.first.c_str());
308 
309  if ( seqType.second == "PhysicsList" ) {
310  PhysicsActionSeq pl(&kernel.physicsList());
311  PropertyManager& props = kernel.physicsList().properties();
312  props.dump();
313  _setAttributes(pl,e);
314  props.dump();
315  }
316 
317  for(xml_coll_t a(seq,_Unicode(action)); a; ++a) {
318  std::string nam = a.attr<std::string>(_U(name));
319  Action action(_createAction(description,a,seqType.second,what));
320  if ( seqType.second == "RunAction" )
321  kernel.runAction().adopt(_action<Geant4RunAction>(action.get()));
322  else if ( seqType.second == "EventAction" )
323  kernel.eventAction().adopt(_action<Geant4EventAction>(action.get()));
324  else if ( seqType.second == "GeneratorAction" )
325  kernel.generatorAction().adopt(_action<Geant4GeneratorAction>(action.get()));
326  else if ( seqType.second == "TrackingAction" )
327  kernel.trackingAction().adopt(_action<Geant4TrackingAction>(action.get()));
328  else if ( seqType.second == "StackingAction" )
329  kernel.stackingAction().adopt(_action<Geant4StackingAction>(action.get()));
330  else if ( seqType.second == "SteppingAction" )
331  kernel.steppingAction().adopt(_action<Geant4SteppingAction>(action.get()));
332  else if ( seqType.second == "PhysicsList" )
333  kernel.physicsList().adopt(_action<Geant4PhysicsList>(action.get()));
334  else if ( sdSeq.get() )
335  sdSeq->adopt(_action<Geant4Sensitive>(action.get()));
336  else {
337  except("ActionSequence","DDG4: The action '%s'"
338  " cannot be attached to any sequence '%s'."
339  " [Sequence-Missing]",nam.c_str(), seqNam.c_str());
340  }
341  printout(INFO,"Geant4Setup","+++ ActionSequence %s added filter object:%s",
342  seqType.second.c_str(),action->name().c_str());
343  }
344  if ( what == SENSITIVE ) {
345  for(xml_coll_t a(seq,_Unicode(filter)); a; ++a) {
346  std::string nam = a.attr<std::string>(_U(name));
347  Action action(_createAction(description,a,"",FILTER));
348  installMessenger(action);
349  printout(INFO,"Geant4Setup","+++ ActionSequence %s added filter object:%s",
350  seqType.second.c_str(),action->name().c_str());
351  if ( sdSeq.get() )
352  sdSeq->adopt(_action<Geant4Filter>(action.get()));
353  else {
354  except("ActionSequence","DDG4: The action '%s'"
355  " cannot be attached to any sequence '%s'."
356  " [Sequence-Missing]",nam.c_str(), seqNam.c_str());
357  }
358  }
359  }
360 }
361 
363 
373 template <> void Converter<Geant4PhysicsList::ParticleProcesses>::operator()(xml_h e) const {
374  xml_comp_t part(e);
375  std::string part_name = part.nameStr();
377  _object<Geant4PhysicsList>().processes(part_name);
378  for(xml_coll_t q(part,_Unicode(process)); q; ++q) {
379  xml_comp_t proc(q);
381  p.name = proc.nameStr();
382  p.ordAtRestDoIt = proc.attr<int>(_Unicode(ordAtRestDoIt));
383  p.ordAlongSteptDoIt = proc.attr<int>(_Unicode(ordAlongSteptDoIt));
384  p.ordPostStepDoIt = proc.attr<int>(_Unicode(ordPostStepDoIt));
385  procs.emplace_back(p);
386  printout(INFO,"Geant4Setup","+++ Converter<ParticleProcesses: Particle:%s add process %s %d %d %d",
387  part_name.c_str(),p.name.c_str(),p.ordAtRestDoIt,p.ordAlongSteptDoIt,p.ordPostStepDoIt);
388  }
389 }
390 
392 
403 template <> void Converter<Geant4PhysicsList::ParticleConstructor>::operator()(xml_h e) const {
404  Geant4PhysicsList::ParticleConstructors& parts = _object<Geant4PhysicsList>().particles();
405  xml_comp_t part(e);
406  std::string n = part.nameStr();
407  parts.emplace_back(n);
408  printout(INFO,"Geant4Setup","+++ ParticleConstructor: Add Geant4 particle constructor '%s'",n.c_str());
409 }
410 
412 
420 template <> void Converter<Geant4PhysicsList::PhysicsConstructor>::operator()(xml_h e) const {
421  Geant4PhysicsList::PhysicsConstructors& parts = _object<Geant4PhysicsList>().physics();
422  xml_comp_t part(e);
423  std::string n = part.nameStr();
424  parts.emplace_back(n);
425  printout(INFO,"Geant4Setup","+++ PhysicsConstructor: Add Geant4 physics constructor '%s'",n.c_str());
426 }
427 
429 
435 struct PhysicsListExtension;
436 template <> void Converter<PhysicsListExtension>::operator()(xml_h e) const {
437  Kernel& kernel = Kernel::instance(description);
438  std::string ext = xml_comp_t(e).nameStr();
439  kernel.physicsList().properties()["extends"].str(ext);
440  printout(INFO,"Geant4Setup","+++ PhysicsListExtension: Set predefined Geant4 physics list to '%s'",ext.c_str());
441 }
442 
444 template <> void Converter<PhysicsList>::operator()(xml_h e) const {
445  std::string name = e.attr<std::string>(_U(name));
446  Kernel& kernel = Kernel::instance(description);
447  PhysicsList handle(kernel,name);
448  _setAttributes(handle,e);
449  xml_coll_t(e,_Unicode(particles)).for_each(_Unicode(construct),Converter<Geant4PhysicsList::ParticleConstructor>(description,handle.get()));
450  xml_coll_t(e,_Unicode(processes)).for_each(_Unicode(particle),Converter<Geant4PhysicsList::ParticleProcesses>(description,handle.get()));
451  xml_coll_t(e,_Unicode(physics)).for_each(_Unicode(construct),Converter<Geant4PhysicsList::PhysicsConstructor>(description,handle.get()));
452  xml_coll_t(e,_Unicode(extends)).for_each(Converter<PhysicsListExtension>(description,handle.get()));
453  kernel.physicsList().adopt(handle);
454 }
455 
457 template <> void Converter<Kernel>::operator()(xml_h e) const {
458  Kernel& kernel = Kernel::instance(description);
459  xml_comp_t k(e);
460  if ( k.hasAttr(_Unicode(NumEvents)) )
461  kernel.property("NumEvents").str(k.attr<std::string>(_Unicode(NumEvents)));
462  if ( k.hasAttr(_Unicode(UI)) )
463  kernel.property("UI").str(k.attr<std::string>(_Unicode(UI)));
464 }
465 
467 template <> void Converter<XMLSetup>::operator()(xml_h seq) const {
468  xml_elt_t compact(seq);
469  // First execute the basic setup from the plugins module
470  long result = PluginService::Create<long>("geant4_XML_reader",&description,&seq);
471  if ( 0 == result ) {
472  except("PhysicsList", "dd4hep: Failed to locate plugin to interprete files of type"
473  " \"" + seq.tag() + "\" - no factory of type geant4_XML_reader.");
474  }
475  result = *(long*) result;
476  if (result != 1) {
477  except("PhysicsList", "dd4hep: Failed to parse the XML tag %s with the plugin geant4_XML_reader", seq.tag().c_str());
478  }
479  xml_coll_t(compact,_Unicode(kernel)).for_each(Converter<Kernel>(description,param));
480  // Now deal with the new stuff.....
481  xml_coll_t(compact,_Unicode(actions) ).for_each(_Unicode(action),Converter<Action>(description,param));
482  xml_coll_t(compact,_Unicode(filters) ).for_each(_Unicode(filter),Converter<Filter>(description,param));
483  xml_coll_t(compact,_Unicode(sequences) ).for_each(_Unicode(sequence),Converter<ActionSequence>(description,param));
484  xml_coll_t(compact,_Unicode(phases) ).for_each(_Unicode(phase),Converter<Phase>(description,param));
485  xml_coll_t(compact,_Unicode(physicslist)).for_each(Converter<PhysicsList>(description,param));
486 }
487 }
488 
490 static long setup_Geant4(dd4hep::Detector& description, const xml_h& element) {
491  (dd4hep::Converter<dd4hep::sim::XMLSetup>(description))(element);
492  return 1;
493 }
494 // Factory declaration
495 DECLARE_XML_DOC_READER(geant4_setup,setup_Geant4)
dd4hep::sim::_action
TYPE * _action(PTR *in)
Action cast.
Definition: Geant4XMLSetup.cpp:36
dd4hep::sim::Setup::Action
Geant4Handle< Geant4Action > Action
Definition: Geant4Config.h:62
dd4hep::sim::Setup
Convenience namespace to ease the setupup of DDG4 applications.
Definition: Geant4Config.h:57
dd4hep::xml::Collection_t
Class to support the access to collections of XmlNodes (or XmlElements)
Definition: XMLElements.h:636
dd4hep::sim::Geant4RunActionSequence::adopt
void adopt(Geant4RunAction *action)
Add an actor responding to all callbacks. Sequence takes ownership.
Definition: Geant4RunAction.cpp:130
dd4hep::xml::Handle_t::tag
std::string tag() const
Text access to the element's tag.
Definition: XMLElements.h:414
dd4hep::sim::Geant4TrackingActionSequence::adopt
void adopt(Geant4TrackingAction *action)
Add an actor responding to all callbacks. Sequence takes ownership.
Definition: Geant4TrackingAction.cpp:70
Geant4ParticleHandler
Geant4Action to collect the MC particle information.
dd4hep::sim::Geant4PhysicsList::Process
Structure describing a G4 process.
Definition: Geant4PhysicsList.h:53
dd4hep::sim::ACTION
@ ACTION
Definition: Geant4XMLSetup.cpp:110
dd4hep::sim::Geant4ActionContainer::runAction
Geant4RunActionSequence * runAction(bool create)
Access run action sequence.
Definition: Geant4ActionContainer.cpp:92
Detector.h
dd4hep::sim::Geant4PhysicsList::Process::ordPostStepDoIt
int ordPostStepDoIt
Definition: Geant4PhysicsList.h:56
dd4hep::Property::str
std::string str() const
Conversion to string value.
Definition: ComponentProperties.cpp:48
dd4hep::xml::Attribute
const XmlAttr * Attribute
Definition: XMLElements.h:38
dd4hep::sim::Geant4Kernel::addPhase
virtual Geant4ActionPhase * addPhase(const std::string &name, const std::type_info &arg1, const std::type_info &arg2, const std::type_info &arg3, bool throw_on_exist)
Add a new phase to the phase.
Definition: Geant4Kernel.cpp:541
dd4hep::sim::Geant4Kernel::registerGlobalAction
Geant4Kernel & registerGlobalAction(Geant4Action *action)
Register action by name to be retrieved when setting up and connecting action objects.
Definition: Geant4Kernel.cpp:457
dd4hep::sim::Geant4ActionContainer::stackingAction
Geant4StackingActionSequence * stackingAction(bool create)
Access stacking action sequence.
Definition: Geant4ActionContainer.cpp:120
dd4hep::sim::Geant4Kernel::property
Property & property(const std::string &name)
Access single property.
Definition: Geant4Kernel.cpp:298
dd4hep::sim::Geant4PhysicsList::Process::ordAtRestDoIt
int ordAtRestDoIt
Definition: Geant4PhysicsList.h:56
dd4hep::sim::Geant4PhysicsListActionSequence::adopt
void adopt(Geant4PhysicsList *action)
Add an actor responding to all callbacks. Sequence takes ownership.
Definition: Geant4PhysicsList.cpp:394
dd4hep::sim::Geant4Kernel
Class, which allows all Geant4Action derivatives to access the DDG4 kernel structures.
Definition: Geant4Kernel.h:64
dd4hep::sim::Geant4ActionContainer::trackingAction
Geant4TrackingActionSequence * trackingAction(bool create)
Access tracking action sequence.
Definition: Geant4ActionContainer.cpp:113
dd4hep::sim::Geant4ActionPhase
Action phase definition. Client callback at various stage of the simulation processing.
Definition: Geant4ActionPhase.h:68
dd4hep::sim::Geant4RunActionSequence::callAtBegin
void callAtBegin(Q *p, void(T::*f)(const G4Run *))
Register begin-of-run callback. Types Q and T must be polymorph!
Definition: Geant4RunAction.h:144
dd4hep::sim::TypeName::second
std::string second
Definition: Geant4Action.h:85
dd4hep::sim::Geant4TrackingActionSequence::callAtBegin
void callAtBegin(Q *p, void(T::*f)(const G4Track *), CallbackSequence::Location where=CallbackSequence::END)
Register Pre-track action callback.
Definition: Geant4TrackingAction.h:150
dd4hep::xml::Handle_t
Class to easily access the properties of single XmlElements.
Definition: XMLElements.h:380
dd4hep::sim::Geant4PhysicsList::ParticleProcesses
std::vector< Process > ParticleProcesses
Definition: Geant4PhysicsList.h:64
dd4hep::sim::_createAction
Action _createAction(Detector &description, xml_h a, const std::string &seqType, int what)
Create/Configure Action object from XML.
Definition: Geant4XMLSetup.cpp:112
dd4hep::sim::Geant4EventActionSequence::callAtEnd
void callAtEnd(Q *p, void(T::*f)(const G4Event *))
Register end-of-event callback.
Definition: Geant4EventAction.h:157
dd4hep::sim::Geant4RunActionSequence::callAtEnd
void callAtEnd(Q *p, void(T::*f)(const G4Run *))
Register end-of-run callback. Types Q and T must be polymorph!
Definition: Geant4RunAction.h:149
xml_coll_t
dd4hep::xml::Collection_t xml_coll_t
Definition: ConditionsRepository.cpp:35
Geant4Config.h
xml_comp_t
dd4hep::xml::Component xml_comp_t
Definition: XML.h:33
_Unicode
#define _Unicode(a)
Definition: Tags.h:24
dd4hep::sim::Geant4Kernel::registerGlobalFilter
Geant4Kernel & registerGlobalFilter(Geant4Action *filter)
Register filter by name to be retrieved when setting up and connecting filter objects.
Definition: Geant4Kernel.cpp:491
dd4hep::sim::FILTER
@ FILTER
Definition: Geant4XMLSetup.cpp:110
dd4hep::sim::Geant4PhysicsList::PhysicsConstructors
std::vector< PhysicsConstructor > PhysicsConstructors
Definition: Geant4PhysicsList.h:106
dd4hep::sim::Geant4GeneratorActionSequence::call
void call(Q *p, void(T::*f)(G4Event *))
Register primary particle generation callback. Types Q and T must be polymorph!
Definition: Geant4GeneratorAction.h:137
dd4hep::sim::Geant4EventActionSequence::callAtBegin
void callAtBegin(Q *p, void(T::*f)(const G4Event *))
Register begin-of-event callback.
Definition: Geant4EventAction.h:152
Filter
dd4hep::xml::Collection_t::for_each
void for_each(T oper) const
Loop processor using function object.
Definition: XMLElements.h:667
dd4hep::sim::Geant4ActionContainer::eventAction
Geant4EventActionSequence * eventAction(bool create)
Access run action sequence.
Definition: Geant4ActionContainer.cpp:99
dd4hep::sim::Geant4PhysicsList::Process::ordAlongSteptDoIt
int ordAlongSteptDoIt
Definition: Geant4PhysicsList.h:56
dd4hep::PropertyManager::dump
void dump() const
Dump string values.
Definition: ComponentProperties.cpp:160
dd4hep::sim::Geant4ParticleHandler::adopt
bool adopt(Geant4Action *action)
Adopt the user particle handler.
_U
#define _U(a)
Definition: Tags.h:23
dd4hep::sim::TypeName::first
std::string first
Definition: Geant4Action.h:84
dd4hep::xml::_toString
std::string _toString(const Attribute attr)
Convert xml attribute to STL string.
Definition: XMLElements.cpp:234
dd4hep::sim::Geant4Action
Default base class for all Geant 4 actions and derivates thereof.
Definition: Geant4Action.h:113
dd4hep::sim::Geant4SteppingActionSequence::call
void call(Q *p, void(T::*f)(const G4Step *, G4SteppingManager *))
Register stepping action callback. Types Q and T must be polymorph!
Definition: Geant4SteppingAction.h:127
dd4hep::sim::Geant4Kernel::globalFilter
Geant4Action * globalFilter(const std::string &filter_name, bool throw_if_not_present=true)
Retrieve filter from repository.
Definition: Geant4Kernel.cpp:508
dd4hep::xml::Handle_t::child
Handle_t child(const XmlChar *tag, bool throw_exception=true) const
Access a single child by its tag name (unicode)
Definition: XMLElements.cpp:710
dd4hep::sim::TypeName::split
static TypeName split(const std::string &type_name)
Split string pair according to default delimiter ('/')
Definition: Geant4Action.cpp:40
DECLARE_XML_DOC_READER
#define DECLARE_XML_DOC_READER(name, func)
Definition: Factories.h:316
dd4hep::sim::Geant4Action::properties
PropertyManager & properties()
Access to the properties of the object.
Definition: Geant4Action.h:292
dd4hep::sim::Geant4Handle
Handle to Geant4 actions with built-in creation mechanism.
Definition: Geant4Config.h:28
dd4hep::sim::SENSITIVE
@ SENSITIVE
Definition: Geant4XMLSetup.cpp:110
dd4hep::sim::Geant4Kernel::globalAction
Geant4Action * globalAction(const std::string &action_name, bool throw_if_not_present=true)
Retrieve action from repository.
Definition: Geant4Kernel.cpp:476
dd4hep::sim::Geant4ActionPhase::call
void call()
Create action to execute phase members.
Definition: Geant4ActionPhase.cpp:103
DetFactoryHelper.h
dd4hep::sim::Geant4Kernel::instance
static Geant4Kernel & instance(Detector &description)
Instance accessor.
Definition: Geant4Kernel.cpp:163
dd4hep::sim
Namespace for the Geant4 based simulation part of the AIDA detector description toolkit.
Definition: Geant4Output2EDM4hep.cpp:49
dd4hep::sim::Geant4ActionContainer::steppingAction
Geant4SteppingActionSequence * steppingAction(bool create)
Access stepping action sequence.
Definition: Geant4ActionContainer.cpp:106
dd4hep::sim::Geant4ActionContainer::physicsList
Geant4PhysicsListActionSequence * physicsList(bool create)
Access to the physics list.
Definition: Geant4ActionContainer.cpp:150
Conversions.h
dd4hep::sim::Geant4Handle::get
TYPE * get() const
Access to the underlying object.
Definition: Geant4Handle.cpp:175
dd4hep::xml::Element
User abstraction class to manipulate XML elements within a document.
Definition: XMLElements.h:769
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
det
DetElement::Object * det
Definition: AlignmentsCalculator.cpp:66
dd4hep::sim::TypeName
Helper class to handle strings of the format "type/name".
Definition: Geant4Action.h:82
dd4hep::Detector
The main interface to the dd4hep detector description package.
Definition: Detector.h:90
dd4hep::sim::Setup::SensitiveSeq
Geant4Handle< Geant4SensDetActionSequence > SensitiveSeq
Definition: Geant4Config.h:78
dd4hep::sim::Geant4StackingActionSequence::callAtPrepare
void callAtPrepare(T *p, void(T::*f)(G4StackManager *))
Register end-of-event callback. Types Q and T must be polymorph!
Definition: Geant4StackingAction.h:155
dd4hep::sim::Geant4StackingActionSequence::adopt
void adopt(Geant4StackingAction *action)
Add an actor responding to all callbacks. Sequence takes ownership.
Definition: Geant4StackingAction.cpp:123
dd4hep::sim::Geant4SteppingActionSequence::adopt
void adopt(Geant4SteppingAction *action)
Add an actor responding to all callbacks. Sequence takes ownership.
Definition: Geant4SteppingAction.cpp:119
dd4hep::sim::Geant4PhysicsList::ParticleConstructors
std::vector< ParticleConstructor > ParticleConstructors
Definition: Geant4PhysicsList.h:84
dd4hep::xml::Handle_t::attr
T attr(const Attribute a) const
Access typed attribute value by the XmlAttr.
Definition: XMLElements.h:454
Printout.h
dd4hep::sim::Geant4PhysicsList::Process::name
std::string name
Definition: Geant4PhysicsList.h:55
dd4hep::sim::Geant4StackingActionSequence::callAtNewStage
void callAtNewStage(T *p, void(T::*f)(G4StackManager *))
Register begin-of-event callback. Types Q and T must be polymorph!
Definition: Geant4StackingAction.h:151
handle
void handle(const O *o, const C &c, F pmf)
Definition: LCDDConverter.cpp:1105
dd4hep::sim::Geant4GeneratorActionSequence::adopt
void adopt(Geant4GeneratorAction *action)
Add an actor responding to all callbacks. Sequence takes ownership.
Definition: Geant4GeneratorAction.cpp:110
dd4hep::sim::Geant4ActionContainer::generatorAction
Geant4GeneratorActionSequence * generatorAction(bool create)
Access generator action sequence.
Definition: Geant4ActionContainer.cpp:85
dd4hep::sim::Geant4EventActionSequence::adopt
void adopt(Geant4EventAction *action)
Add an actor responding to all callbacks. Sequence takes ownership.
Definition: Geant4EventAction.cpp:131
dd4hep::sim::Geant4TrackingActionSequence::callAtEnd
void callAtEnd(Q *p, void(T::*f)(const G4Track *), CallbackSequence::Location where=CallbackSequence::END)
Register Post-track action callback.
Definition: Geant4TrackingAction.h:156