Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DD4hep
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cepc
externals
mirroring
DD4hep
Commits
6d6ead26
Commit
6d6ead26
authored
11 years ago
by
Frank Gaede
Browse files
Options
Downloads
Patches
Plain Diff
- some code cleanup
parent
aa0e04af
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
DDG4/lcio/Geant4Output2LCIO.cpp
+20
-8
20 additions, 8 deletions
DDG4/lcio/Geant4Output2LCIO.cpp
with
20 additions
and
8 deletions
DDG4/lcio/Geant4Output2LCIO.cpp
+
20
−
8
View file @
6d6ead26
...
...
@@ -93,13 +93,16 @@ namespace DD4hep {
#include
"IMPL/LCRunHeaderImpl.h"
#include
"IMPL/LCCollectionVec.h"
using
namespace
DD4hep
::
Simulation
;
using
namespace
DD4hep
;
using
namespace
std
;
#include
"DDG4/Factories.h"
DECLARE_GEANT4ACTION
(
Geant4Output2LCIO
)
/// Standard constructor
Geant4Output2LCIO
::
Geant4Output2LCIO
(
Geant4Context
*
ctxt
,
const
string
&
nam
)
:
Geant4OutputAction
(
ctxt
,
nam
),
m_volMgr
(),
m_file
(
0
),
m_runNo
(
0
)
...
...
@@ -116,7 +119,7 @@ Geant4Output2LCIO::~Geant4Output2LCIO() {
InstanceCount
::
decrement
(
this
);
}
//
/
Callback to store the Geant4 run information
// Callback to store the Geant4 run information
void
Geant4Output2LCIO
::
beginRun
(
const
G4Run
*
)
{
if
(
0
==
m_file
&&
!
m_output
.
empty
()
)
{
m_file
=
lcio
::
LCFactory
::
getInstance
()
->
createLCWriter
();
...
...
@@ -133,10 +136,9 @@ void Geant4Output2LCIO::endRun(const G4Run* ) {
/// Commit data at end of filling procedure
void
Geant4Output2LCIO
::
commit
(
OutputContext
<
G4Event
>&
ctxt
)
{
//lcio::LCEventImpl* e = ctxt.data<lcio::LCEventImpl>();
lcio
::
LCEventImpl
*
e
=
context
()
->
event
().
extension
<
lcio
::
LCEventImpl
>
();
m_file
->
writeEvent
(
e
);
std
::
cout
<<
" ########### Geant4Output2LCIO::commit() : writing LCIO event to file .... "
<<
std
::
endl
;
//
std::cout << " ########### Geant4Output2LCIO::commit() : writing LCIO event to file .... " << std::endl ;
}
/// Callback to store the Geant4 run information
...
...
@@ -150,14 +152,19 @@ void Geant4Output2LCIO::saveRun(const G4Run* run) {
void
Geant4Output2LCIO
::
begin
(
const
G4Event
*
event
){
lcio
::
LCEventImpl
*
e
=
new
lcio
::
LCEventImpl
;
//fg: fixme: should be this call (deleting the pointer in the end) but that does not compile ...
context
()
->
event
().
addExtension
<
lcio
::
LCEventImpl
>
(
e
);
//context()->event().addExtension(e);
//context()->event().addExtension( e , typeid( lcio::LCEventImpl ), 0);
// std::cout << " ########### Geant4Output2LCIO::begin add new LCIO event event context " << std::endl ;
//fg: fixme: should be this call taking ownership of the LCEvent
// deleting it at the end - however does not seem to work
// see fixme in Geant4Output2LCIO::saveCollection() below
//context()->event().addExtension<lcio::LCEventImpl>( e , 1 );
context
()
->
event
().
addExtension
<
lcio
::
LCEventImpl
>
(
e
,
0
);
}
/// Callback to store the Geant4 event
void
Geant4Output2LCIO
::
saveEvent
(
OutputContext
<
G4Event
>&
ctxt
)
{
lcio
::
LCEventImpl
*
e
=
context
()
->
event
().
extension
<
lcio
::
LCEventImpl
>
();
...
...
@@ -180,4 +187,9 @@ void Geant4Output2LCIO::saveCollection(OutputContext<G4Event>& ctxt, G4VHitsColl
lcio
::
LCCollectionVec
*
col
=
cnv
(
_A
(
m_volMgr
,
collection
));
evt
->
addCollection
(
col
,
hc_nam
);
}
//fg: fixme: for the memory handling with LCIO we need to take away the ownership from
// the Geant4HitCollection - however this creates a seg fault at the end of event...
// Geant4HitCollection* g4hcol = (Geant4HitCollection* ) collection ;
// std::vector<void*> v ;
// g4hcol->releaseHitsUnchecked(v) ;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment