Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CEPCSW
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
maxt@ihep.ac.cn
CEPCSW
Commits
e9be2cf5
Commit
e9be2cf5
authored
5 months ago
by
lintao@ihep.ac.cn
Browse files
Options
Downloads
Patches
Plain Diff
HepMCRdr: add StartIndex.
parent
ae0e5f41
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Generator/src/HepMCRdr.cpp
+19
-4
19 additions, 4 deletions
Generator/src/HepMCRdr.cpp
Generator/src/HepMCRdr.h
+3
-0
3 additions, 0 deletions
Generator/src/HepMCRdr.h
with
22 additions
and
4 deletions
Generator/src/HepMCRdr.cpp
+
19
−
4
View file @
e9be2cf5
...
...
@@ -25,14 +25,14 @@ using namespace edm4hep;
DECLARE_COMPONENT
(
HepMCRdr
)
HepMCRdr
::~
HepMCRdr
(){
delete
ascii_in
;
delete
ascii_in
;
}
bool
HepMCRdr
::
mutate
(
MyHepMC
::
GenEvent
&
event
){
++
m_processed_event
;
HepMC
::
GenEvent
*
evt
=
ascii_in
->
read_next_event
();
if
(
!
evt
)
return
false
;
m_processed_event
++
;
int
n_mc
=
evt
->
particles_size
();
//std::cout<<"Read event :"<< m_processed_event <<", mc size :"<< n_mc <<std::endl;
std
::
map
<
int
,
int
>
pmcid_lmcid
;
...
...
@@ -93,13 +93,13 @@ bool HepMCRdr::mutate(MyHepMC::GenEvent& event){
}
bool
HepMCRdr
::
isEnd
(){
return
false
;
return
false
;
}
bool
HepMCRdr
::
configure_gentool
(){
ascii_in
=
new
HepMC
::
IO_GenEvent
(
m_filename
.
value
().
c_str
(),
std
::
ios
::
in
);
m_processed_event
=
0
;
m_processed_event
=
-
1
;
return
true
;
}
...
...
@@ -115,6 +115,17 @@ HepMCRdr::initialize() {
return
StatusCode
::
FAILURE
;
}
// skip the first n events if startIndex is not 0.
if
(
startIndex
()
>
0
)
{
for
(
int
i
=
0
;
i
<
startIndex
();
++
i
)
{
++
m_processed_event
;
HepMC
::
GenEvent
*
evt
=
ascii_in
->
read_next_event
();
if
(
!
evt
)
break
;
delete
evt
;
}
info
()
<<
"Skip the first "
<<
startIndex
()
<<
" events."
<<
endmsg
;
}
return
sc
;
}
...
...
@@ -127,3 +138,7 @@ HepMCRdr::finalize() {
}
return
sc
;
}
int
HepMCRdr
::
startIndex
(){
return
m_startIndex
.
value
();
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Generator/src/HepMCRdr.h
+
3
−
0
View file @
e9be2cf5
...
...
@@ -23,6 +23,8 @@ class HepMCRdr: public extends<AlgTool, GenReader> {
bool
mutate
(
MyHepMC
::
GenEvent
&
event
);
bool
finish
();
bool
isEnd
();
int
startIndex
()
override
;
private:
HepMC
::
IO_GenEvent
*
ascii_in
{
nullptr
};
long
m_total_event
{
-
1
};
...
...
@@ -30,6 +32,7 @@ class HepMCRdr: public extends<AlgTool, GenReader> {
// input file name
Gaudi
::
Property
<
std
::
string
>
m_filename
{
this
,
"Input"
};
Gaudi
::
Property
<
int
>
m_startIndex
{
this
,
"StartIndex"
,
0
,
"Default start index"
};
};
...
...
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