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
Li Zhihao
CEPCSW
Commits
51bd6c03
Commit
51bd6c03
authored
5 years ago
by
lintao@ihep.ac.cn
Browse files
Options
Downloads
Patches
Plain Diff
Accessing hit collections.
parent
a2e8ed16
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Simulation/DetSimAna/CMakeLists.txt
+3
-2
3 additions, 2 deletions
Simulation/DetSimAna/CMakeLists.txt
Simulation/DetSimAna/src/ExampleAnaElemTool.cpp
+33
-2
33 additions, 2 deletions
Simulation/DetSimAna/src/ExampleAnaElemTool.cpp
with
36 additions
and
4 deletions
Simulation/DetSimAna/CMakeLists.txt
+
3
−
2
View file @
51bd6c03
...
@@ -7,12 +7,13 @@ gaudi_depends_on_subdirs(
...
@@ -7,12 +7,13 @@ gaudi_depends_on_subdirs(
find_package
(
Geant4 REQUIRED ui_all vis_all
)
find_package
(
Geant4 REQUIRED ui_all vis_all
)
include
(
${
Geant4_USE_FILE
}
)
include
(
${
Geant4_USE_FILE
}
)
find_package
(
DD4hep COMPONENTS DDG4 REQUIRED
)
set
(
DetSimAna_srcs
set
(
DetSimAna_srcs
src/ExampleAnaElemTool.cpp
src/ExampleAnaElemTool.cpp
)
)
gaudi_add_module
(
DetSimAna
${
DetSimAna_srcs
}
gaudi_add_module
(
DetSimAna
${
DetSimAna_srcs
}
INCLUDE_DIRS DetSimInterface GaudiKernel Geant4
INCLUDE_DIRS DetSimInterface
DD4hep
GaudiKernel Geant4
LINK_LIBRARIES DetSimInterface GaudiKernel Geant4
LINK_LIBRARIES DetSimInterface
DD4hep
${
DD4hep_COMPONENT_LIBRARIES
}
GaudiKernel Geant4
)
)
This diff is collapsed.
Click to expand it.
Simulation/DetSimAna/src/ExampleAnaElemTool.cpp
+
33
−
2
View file @
51bd6c03
...
@@ -2,6 +2,12 @@
...
@@ -2,6 +2,12 @@
#include
"G4Event.hh"
#include
"G4Event.hh"
#include
"DD4hep/Detector.h"
#include
"DD4hep/Plugins.h"
#include
"DDG4/Geant4Converter.h"
#include
"DDG4/Geant4Mapping.h"
DECLARE_COMPONENT
(
ExampleAnaElemTool
)
DECLARE_COMPONENT
(
ExampleAnaElemTool
)
void
void
...
@@ -20,8 +26,33 @@ ExampleAnaElemTool::BeginOfEventAction(const G4Event* anEvent) {
...
@@ -20,8 +26,33 @@ ExampleAnaElemTool::BeginOfEventAction(const G4Event* anEvent) {
}
}
void
void
ExampleAnaElemTool
::
EndOfEventAction
(
const
G4Event
*
)
{
ExampleAnaElemTool
::
EndOfEventAction
(
const
G4Event
*
anEvent
)
{
// save all data
// readout defined in DD4hep
auto
lcdd
=
&
(
dd4hep
::
Detector
::
getInstance
());
auto
allReadouts
=
lcdd
->
readouts
();
for
(
auto
&
readout
:
allReadouts
)
{
info
()
<<
"Readout "
<<
readout
.
first
<<
endmsg
;
}
// retrieve the hit collections
G4HCofThisEvent
*
collections
=
anEvent
->
GetHCofThisEvent
();
if
(
!
collections
)
{
warning
()
<<
"No collections found. "
<<
endmsg
;
return
;
}
int
Ncol
=
collections
->
GetNumberOfCollections
();
for
(
int
icol
=
0
;
icol
<
Ncol
;
++
icol
)
{
G4VHitsCollection
*
collect
=
collections
->
GetHC
(
icol
);
if
(
!
collect
)
{
warning
()
<<
"Collection iCol "
<<
icol
<<
" is missing"
<<
endmsg
;
continue
;
}
info
()
<<
"Collection "
<<
collect
->
GetName
()
<<
endmsg
;
}
}
}
void
void
...
...
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