Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CEPCSW_OTE_development
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
yudian2002@sjtu.edu.cn
CEPCSW_OTE_development
Commits
fe3b8e8a
Commit
fe3b8e8a
authored
3 years ago
by
lintao@ihep.ac.cn
Browse files
Options
Downloads
Patches
Plain Diff
WIP: create MC particle from the Beam Background Data.
parent
1c192e3a
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/GtBeamBackgroundTool.cpp
+40
-0
40 additions, 0 deletions
Generator/src/GtBeamBackgroundTool.cpp
Generator/src/GtBeamBackgroundTool.h
+1
-1
1 addition, 1 deletion
Generator/src/GtBeamBackgroundTool.h
with
41 additions
and
1 deletion
Generator/src/GtBeamBackgroundTool.cpp
+
40
−
0
View file @
fe3b8e8a
#include
"GtBeamBackgroundTool.h"
#include
"IBeamBackgroundFileParser.h"
#include
"BeamBackgroundFileParserV0.h"
DECLARE_COMPONENT
(
GtBeamBackgroundTool
)
StatusCode
GtBeamBackgroundTool
::
initialize
()
{
...
...
@@ -7,6 +8,17 @@ StatusCode GtBeamBackgroundTool::initialize() {
// create the instances of the background parsers
for
(
auto
&
[
label
,
inputfn
]
:
m_inputmaps
)
{
m_beaminputs
[
label
]
=
std
::
make_shared
<
BeamBackgroundFileParserV0
>
(
inputfn
,
11
,
125.
);
}
// check the size
if
(
m_beaminputs
.
empty
())
{
error
()
<<
"Empty Beam Background File Parser. "
<<
endmsg
;
return
StatusCode
::
FAILURE
;
}
return
StatusCode
::
SUCCESS
;
}
...
...
@@ -16,6 +28,34 @@ StatusCode GtBeamBackgroundTool::finalize() {
bool
GtBeamBackgroundTool
::
mutate
(
MyHepMC
::
GenEvent
&
event
)
{
if
(
m_beaminputs
.
empty
())
{
return
false
;
}
// TODO: should sample according to the rates
// dummy: get one and stop to generate
for
(
auto
&
[
label
,
parser
]
:
m_beaminputs
)
{
IBeamBackgroundFileParser
::
BeamBackgroundData
beamdata
;
auto
isok
=
parser
->
load
(
beamdata
);
if
(
not
isok
)
{
error
()
<<
"Failed to load beam background data from the parser "
<<
label
<<
endmsg
;
return
false
;
}
// fill the value
float
charge
=
beamdata
.
pdgid
==
11
?
-
1
:
1
;
// create the MC particle
edm4hep
::
MCParticle
mcp
=
event
.
m_mc_vec
.
create
();
mcp
.
setPDG
(
beamdata
.
pdgid
);
mcp
.
setGeneratorStatus
(
1
);
mcp
.
setSimulatorStatus
(
1
);
mcp
.
setCharge
(
static_cast
<
float
>
(
charge
));
mcp
.
setTime
(
beamdata
.
t
);
mcp
.
setMass
(
beamdata
.
mass
);
mcp
.
setVertex
(
edm4hep
::
Vector3d
(
beamdata
.
x
,
beamdata
.
y
,
beamdata
.
z
));
mcp
.
setMomentum
(
edm4hep
::
Vector3f
(
beamdata
.
px
,
beamdata
.
py
,
beamdata
.
pz
));
}
return
true
;
}
...
...
This diff is collapsed.
Click to expand it.
Generator/src/GtBeamBackgroundTool.h
+
1
−
1
View file @
fe3b8e8a
...
...
@@ -27,11 +27,11 @@
#include
<GaudiKernel/AlgTool.h>
#include
<Gaudi/Property.h>
#include
"IGenTool.h"
#include
"IBeamBackgroundFileParser.h"
#include
<vector>
#include
<map>
class
IBeamBackgroundFileParser
;
class
GtBeamBackgroundTool
:
public
extends
<
AlgTool
,
IGenTool
>
{
public:
...
...
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