Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
EIC
NPDet
Commits
538671e6
Commit
538671e6
authored
Sep 22, 2021
by
Sylvester Joosten
Browse files
Refactored output plugin and added proper MC truth info to hits
parent
9a5fce9b
Pipeline
#18973
passed with stages
in 33 seconds
Changes
3
Pipelines
2
Expand all
Hide whitespace changes
Inline
Side-by-side
src/dd4pod/dd4hep.yaml
View file @
538671e6
...
...
@@ -33,10 +33,8 @@ components:
"
dd4pod::MonteCarloContrib:
#Description
:
"
Podio
implementation
of
dd4hep's
dd4hep::sim::MonteCarloContrib
class"
#Author : "W.Armstrong"
Members
:
-
int32_t trackID // track id, -1 if none/invalid
-
int32_t trackID // track id, -1 if none/invalid
. Maps to Geant4Particle::ID.
-
int32_t pdgID // PDG Particle ID code
-
double deposit // energy deposit [GeV]
-
double time // time [ns]
...
...
@@ -61,11 +59,11 @@ components:
bool
empty()
const
{return
trackID
<
0;}
\n
"
datatypes
:
datatypes
:
dd4pod::Geant4Particle:
Description
:
"
Podio
implementation
of
dd4hep's
dd4hep::sim::Geant4Particle
class"
Author
:
"
W.Armstrong"
Author
:
"
W.
Armstrong
,
S.
Joosten
"
Members
:
-
int32_t ID // unique identifier for this particle
-
int32_t g4Parent // g4 parent particle
...
...
@@ -100,7 +98,7 @@ datatypes :
dd4pod::PhotoMultiplierHit:
Description
:
"
Podio
implementation
of
a
pmt
hit
"
Author
:
"
W.Armstrong"
Author
:
"
W.
Armstrong
,
S.
Joosten
"
Members
:
-
int64_t cellID // cellID
-
int32_t flag // User flag to classify hits
...
...
@@ -113,7 +111,7 @@ datatypes :
dd4pod::TrackerHit:
Description
:
"
Podio
implementation
of
dd4hep's
dd4hep::sim::Geant4Tracker::Hit
class"
Author
:
"
W.Armstrong"
Author
:
"
W.
Armstrong
,
S.
Joosten
"
Members
:
-
int64_t cellID // cellID
-
int32_t flag // User flag to classify hits
...
...
@@ -126,12 +124,14 @@ datatypes :
dd4pod::CalorimeterHit:
Description
:
"
Podio
implementation
of
dd4hep's
dd4hep::sim::Geant4Calorimeter::Hit
class"
Author
:
"
W.Armstrong"
Author
:
"
W.
Armstrong
,
S.
Joosten
"
Members
:
-
int64_t cellID // cellID
-
int32_t flag // User flag to classify hits
-
int32_t g4ID // Original Geant4 track identifier of the creating track (debugging)
-
dd4pod::VectorXYZ position // position [mm]
-
dd4pod::MonteCarloContrib truth // truth-info
-
dd4pod::MonteCarloContrib truth // truth-info
of one of the contributing hits
-
double energyDeposit // energy deposit [GeV]
VectorMembers
:
-
dd4pod::MonteCarloContrib contributions // All contributing hits. Not filled by default.
src/dd4pod/plugins/Geant4Output2Podio.cxx
View file @
538671e6
This diff is collapsed.
Click to expand it.
src/dd4pod/plugins/Geant4Output2Podio.h
View file @
538671e6
...
...
@@ -9,6 +9,9 @@
#include "podio/EventStore.h"
#include "podio/ROOTWriter.h"
#include <set>
#include <memory>
namespace
dd4pod
{
class
Geant4Particle
;
class
Geant4ParticleCollection
;
...
...
@@ -37,19 +40,22 @@ namespace dd4hep {
dd4hep
::
sim
::
Geant4Particle
*
part
);
/// Flag if Monte-Carlo truth should be followed and checked
bool
m_handleMCTruth
;
bool
m_handleMCTruth
=
true
;
/// Property: vector with disabled collections
std
::
vector
<
std
::
string
>
m_disabledCollections
;
//
/ Property: vector with
disable
d
c
ollections
std
::
vector
<
std
::
string
>
m_
en
able
dCollections
;
//
map collection names to a boolean for quick enable/
disable c
heck
std
::
set
<
std
::
string
>
m_
dis
able
List
;
/// Property: vector with disabled collections
bool
m_disableParticles
=
false
;
/// Store all calorimeter contributions. Will dramatically increase output data size
bool
m_storeCalorimeterContributions
=
false
;
podio
::
EventStore
store
;
podio
::
ROOTWriter
*
writer
=
nullptr
;
std
::
unique_ptr
<
podio
::
EventStore
>
m_
store
;
std
::
unique_ptr
<
podio
::
ROOTWriter
>
m_
writer
;
std
::
map
<
std
::
string
,
podio
::
CollectionBase
*>
m_col_map
;
std
::
vector
<
std
::
pair
<
std
::
string
,
podio
::
CollectionBase
*>>
m_collections
;
...
...
@@ -57,6 +63,17 @@ namespace dd4hep {
m_readCollections
;
podio
::
CollectionIDTable
*
m_collectionIDs
;
// Create a podio collection on the event store
template
<
class
CollectionType
>
void
createCollection
(
const
std
::
string
&
name
)
{
m_store
->
create
<
CollectionType
>
(
name
);
m_writer
->
registerForWrite
(
name
);
printout
(
DEBUG
,
"Geant4Output2Podio"
,
"Created collection %s"
,
name
.
c_str
());
}
void
initEventStore
(
OutputContext
<
G4Event
>&
ctxt
);
void
saveParticles
(
const
Geant4ParticleMap
*
parts
);
public:
Geant4Output2Podio
(
Geant4Context
*
context
,
const
std
::
string
&
nam
);
virtual
~
Geant4Output2Podio
();
...
...
@@ -81,6 +98,7 @@ namespace dd4hep {
/// Commit data at end of filling procedure
virtual
void
commit
(
OutputContext
<
G4Event
>&
ctxt
);
};
}
// End namespace sim
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment