Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
Analysis Software
Deprecated List
Modules
Namespaces
Classes
Files
File List
acts
blob
sPHENIX
Alignment
CI
cmake
Core
docs
Examples
Algorithms
Detectors
Framework
Io
Csv
EDM4hep
include
src
EDM4hepMeasurementReader.cpp
EDM4hepMeasurementWriter.cpp
EDM4hepMultiTrajectoryWriter.cpp
EDM4hepParticleReader.cpp
EDM4hepParticleWriter.cpp
EDM4hepSimHitReader.cpp
EDM4hepSimHitWriter.cpp
EDM4hepTrackReader.cpp
EDM4hepTrackWriter.cpp
EDM4hepUtil.cpp
HepMC3
Json
NuclearInteractions
Obj
Performance
Root
Svg
Python
Run
Scripts
Fatras
Plugins
Tests
acts-fatras
analysis
analysis_tpc_prototype
coresoftware
Doxygen_Assist
g4exampledetector
GenFit
JETSCAPE
KFParticle
macros
online_distribution
OnlMon
prototype
pythia6
rcdaq
RDBC
tutorials
doxygen_mainpage.h
File Members
Examples
External Links
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
EDM4hepMeasurementWriter.cpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file EDM4hepMeasurementWriter.cpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2022 CERN for the benefit of the Acts project
4
//
5
// This Source Code Form is subject to the terms of the Mozilla Public
6
// License, v. 2.0. If a copy of the MPL was not distributed with this
7
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
9
#include "
ActsExamples/Io/EDM4hep/EDM4hepMeasurementWriter.hpp
"
10
11
#include "
Acts/Definitions/Units.hpp
"
12
#include "
Acts/EventData/Measurement.hpp
"
13
#include "
ActsExamples/EventData/Cluster.hpp
"
14
#include "
ActsExamples/Framework/WhiteBoard.hpp
"
15
#include "
ActsExamples/Io/EDM4hep/EDM4hepUtil.hpp
"
16
17
#include <stdexcept>
18
19
#include <podio/Frame.h>
20
21
namespace
ActsExamples {
22
23
EDM4hepMeasurementWriter::EDM4hepMeasurementWriter
(
24
const
EDM4hepMeasurementWriter::Config
&
config
,
Acts::Logging::Level
level
)
25
:
WriterT
(config.inputMeasurements,
"EDM4hepMeasurementWriter"
, level),
26
m_cfg
(config),
27
m_writer(config.outputPath) {
28
ACTS_VERBOSE
(
"Created output file "
<< config.
outputPath
);
29
30
// Input container for measurements is already checked by base constructor
31
m_inputClusters
.
maybeInitialize
(
m_cfg
.
inputClusters
);
32
}
33
34
ActsExamples::ProcessCode
EDM4hepMeasurementWriter::finalize
() {
35
m_writer
.finish();
36
37
return
ProcessCode::SUCCESS
;
38
}
39
40
ActsExamples::ProcessCode
EDM4hepMeasurementWriter::writeT
(
41
const
AlgorithmContext
& ctx,
const
MeasurementContainer
& measurements) {
42
ClusterContainer
clusters
;
43
44
podio::Frame frame;
45
46
edm4hep::TrackerHitPlaneCollection hitsPlane;
47
edm4hep::TrackerHitCollection hits;
48
49
if
(!
m_cfg
.
inputClusters
.empty()) {
50
ACTS_VERBOSE
(
"Fetch clusters for writing: "
<<
m_cfg
.
inputClusters
);
51
clusters =
m_inputClusters
(ctx);
52
}
53
54
ACTS_VERBOSE
(
"Writing "
<< measurements.size()
55
<<
" measurements in this event."
);
56
57
for
(
Index
hitIdx = 0
u
; hitIdx < measurements.size(); ++hitIdx) {
58
const
auto
& from = measurements[hitIdx];
59
const
Cluster
* fromCluster = clusters.empty() ?
nullptr
: &clusters[hitIdx];
60
61
auto
to = hitsPlane.create();
62
EDM4hepUtil::writeMeasurement
(
63
from, to, fromCluster, hits,
64
[](
Acts::GeometryIdentifier
id
) {
return
id
.value(); });
65
}
66
67
frame.put(
std::move
(hitsPlane),
"ActsTrackerHitsPlane"
);
68
frame.put(
std::move
(hits),
"ActsTrackerHitsRaw"
);
69
70
m_writer
.writeFrame(frame,
"events"
);
71
72
return
ActsExamples::ProcessCode::SUCCESS
;
73
}
74
75
}
// namespace ActsExamples
acts
blob
sPHENIX
Examples
Io
EDM4hep
src
EDM4hepMeasurementWriter.cpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:38
using
1.8.2 with
sPHENIX GitHub integration