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
91ccb29e
Commit
91ccb29e
authored
7 years ago
by
Jan Strube
Committed by
Andre Sailer
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Adding parameter for the MCParticle collection name
parent
3de754b6
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/LCIOFileReader.cpp
+12
-2
12 additions, 2 deletions
DDG4/lcio/LCIOFileReader.cpp
with
12 additions
and
2 deletions
DDG4/lcio/LCIOFileReader.cpp
+
12
−
2
View file @
91ccb29e
...
@@ -51,6 +51,7 @@ namespace dd4hep {
...
@@ -51,6 +51,7 @@ namespace dd4hep {
protected:
protected:
/// Reference to reader object
/// Reference to reader object
IO
::
LCReader
*
m_reader
;
IO
::
LCReader
*
m_reader
;
std
::
string
m_collectionName
;
public:
public:
/// Initializing constructor
/// Initializing constructor
LCIOFileReader
(
const
std
::
string
&
nam
);
LCIOFileReader
(
const
std
::
string
&
nam
);
...
@@ -61,6 +62,7 @@ namespace dd4hep {
...
@@ -61,6 +62,7 @@ namespace dd4hep {
virtual
EventReaderStatus
readParticleCollection
(
int
event_number
,
EVENT
::
LCCollection
**
particles
);
virtual
EventReaderStatus
readParticleCollection
(
int
event_number
,
EVENT
::
LCCollection
**
particles
);
virtual
EventReaderStatus
moveToEvent
(
int
event_number
);
virtual
EventReaderStatus
moveToEvent
(
int
event_number
);
virtual
EventReaderStatus
skipEvent
()
{
return
EVENT_READER_OK
;
}
virtual
EventReaderStatus
skipEvent
()
{
return
EVENT_READER_OK
;
}
virtual
EventReaderStatus
setParameters
(
std
::
map
<
std
::
string
,
std
::
string
>&
parameters
);
};
};
}
}
}
}
...
@@ -78,6 +80,7 @@ DECLARE_GEANT4_EVENT_READER_NS(dd4hep::sim,LCIOFileReader)
...
@@ -78,6 +80,7 @@ DECLARE_GEANT4_EVENT_READER_NS(dd4hep::sim,LCIOFileReader)
/// Initializing constructor
/// Initializing constructor
dd4hep
::
sim
::
LCIOFileReader
::
LCIOFileReader
(
const
std
::
string
&
nam
)
dd4hep
::
sim
::
LCIOFileReader
::
LCIOFileReader
(
const
std
::
string
&
nam
)
:
LCIOEventReader
(
nam
)
:
LCIOEventReader
(
nam
)
,
m_collectionName
(
LCIO
::
MCPARTICLE
)
{
{
m_reader
=
::
lcio
::
LCFactory
::
getInstance
()
->
createLCReader
(
LCReader
::
directAccess
);
m_reader
=
::
lcio
::
LCFactory
::
getInstance
()
->
createLCReader
(
LCReader
::
directAccess
);
printout
(
INFO
,
"LCIOFileReader"
,
"Created file reader. Try to open input %s"
,
nam
.
c_str
());
printout
(
INFO
,
"LCIOFileReader"
,
"Created file reader. Try to open input %s"
,
nam
.
c_str
());
...
@@ -114,13 +117,20 @@ dd4hep::sim::LCIOFileReader::readParticleCollection(int /*event_number*/, EVENT:
...
@@ -114,13 +117,20 @@ dd4hep::sim::LCIOFileReader::readParticleCollection(int /*event_number*/, EVENT:
++
m_currEvent
;
++
m_currEvent
;
if
(
evt
)
{
if
(
evt
)
{
*
particles
=
evt
->
getCollection
(
LCIO
::
MCPARTICLE
);
*
particles
=
evt
->
getCollection
(
m_collectionName
);
if
(
*
particles
)
{
if
(
*
particles
)
{
printout
(
INFO
,
"LCIOFileReader"
,
"read collection %s from event %d in run %d "
,
printout
(
INFO
,
"LCIOFileReader"
,
"read collection %s from event %d in run %d "
,
LCIO
::
MCPARTICLE
,
evt
->
getEventNumber
(),
evt
->
getRunNumber
());
m_collectionName
,
evt
->
getEventNumber
(),
evt
->
getRunNumber
());
return
EVENT_READER_OK
;
return
EVENT_READER_OK
;
}
}
}
}
return
EVENT_READER_ERROR
;
return
EVENT_READER_ERROR
;
}
}
/// Set the parameters for the class, in particular the name of the MCParticle
/// list
Geant4EventReader
::
EventReaderStatus
dd4hep
::
sim
::
LCIOFileReader
::
setParameters
(
std
::
map
<
std
::
string
,
std
::
string
>
&
parameters
)
{
_getParameterValue
(
parameters
,
"MCParticleCollectionName"
,
m_collectionName
,
LCIO
::
MCPARTICLES
);
return
EVENT_READER_OK
;
}
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