DD4hep
1.30.0
Detector Description Toolkit for High Energy Physics
DDG4
src
Geant4InteractionMerger.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/Printout.h
>
16
#include <
DD4hep/InstanceCount.h
>
17
#include <
DDG4/Geant4InputHandling.h
>
18
#include <
DDG4/Geant4InteractionMerger.h
>
19
20
using namespace
dd4hep::sim
;
21
23
Geant4InteractionMerger::Geant4InteractionMerger
(
Geant4Context
* ctxt,
const
std::string& nam)
24
:
Geant4GeneratorAction
(ctxt,nam)
25
{
26
InstanceCount::increment
(
this
);
27
}
28
30
Geant4InteractionMerger::~Geant4InteractionMerger
() {
31
InstanceCount::decrement
(
this
);
32
}
33
35
void
Geant4InteractionMerger::operator()
(G4Event*
/* event */
) {
36
Geant4PrimaryEvent
* evt =
context
()->
event
().
extension
<
Geant4PrimaryEvent
>();
37
const
std::vector<Geant4PrimaryEvent::Interaction*>& inter = evt->
interactions
();
38
debug
(
"+++ Merging MC input record from %d interactions:"
,(
int
)inter.size());
39
mergeInteractions
(
this
,
context
());
40
}
dd4hep::sim::Geant4PrimaryEvent
Class modelling a complete primary event with multiple interactions.
Definition:
Geant4Primary.h:143
dd4hep::sim::Geant4InteractionMerger::~Geant4InteractionMerger
virtual ~Geant4InteractionMerger()
Default destructor.
dd4hep::sim::Geant4PrimaryEvent::interactions
std::vector< Geant4PrimaryInteraction * > interactions() const
Retrieve all interactions.
Definition:
Geant4Primary.cpp:113
dd4hep::sim::mergeInteractions
int mergeInteractions(const Geant4Action *caller, const Geant4Context *context)
Merge all interactions present in the context.
Definition:
Geant4InputHandling.cpp:226
dd4hep::InstanceCount::increment
static void increment(T *)
Increment count according to type information.
Definition:
InstanceCount.h:98
dd4hep::sim::Geant4Context::event
Geant4Event & event() const
Access the geant4 event – valid only between BeginEvent() and EndEvent()!
Definition:
Geant4Context.cpp:84
Geant4InputHandling.h
dd4hep::sim::Geant4Event::extension
T * extension(bool alert=true)
Access to type safe extension object. Exception is thrown if the object is invalid.
Definition:
Geant4Context.h:151
dd4hep::sim::Geant4InteractionMerger::Geant4InteractionMerger
Geant4InteractionMerger(Geant4Context *context, const std::string &nam)
Standard constructor.
dd4hep::InstanceCount::decrement
static void decrement(T *)
Decrement count according to type information.
Definition:
InstanceCount.h:102
dd4hep::sim::Geant4GeneratorAction
Concrete implementation of the Geant4 generator action base class.
Definition:
Geant4GeneratorAction.h:47
dd4hep::sim::Geant4InteractionMerger::operator()
virtual void operator()(G4Event *event) override
Event generation action callback.
dd4hep::sim
Namespace for the Geant4 based simulation part of the AIDA detector description toolkit.
Definition:
Geant4Output2EDM4hep.cpp:49
Geant4InteractionMerger.h
dd4hep::sim::Geant4Action::debug
void debug(const char *fmt,...) const
Support of debug messages.
Definition:
Geant4Action.cpp:207
InstanceCount.h
Printout.h
dd4hep::sim::Geant4Context
Generic context to extend user, run and event information.
Definition:
Geant4Context.h:201
dd4hep::sim::Geant4Action::context
Geant4Context * context() const
Access the context.
Definition:
Geant4Action.h:270
Generated on Thu Jan 9 2025 17:18:09 for DD4hep by
1.8.18