ATLAS Offline Software
Tracking
Acts
ActsGeometry
src
util
ObjExCellWriter.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// This file was largely imported from the Acts testing framework
6
7
#pragma once
8
9
#include <TTree.h>
10
#include <mutex>
11
#include "Acts/Extrapolation/ExtrapolationCell.hpp"
12
#include "Acts/Utilities/Logger.hpp"
13
14
15
23
template
<
class
T>
24
class
ObjExCellWriter
25
{
26
public
:
27
// The nested configuration struct
28
struct
Config
29
{
30
public
:
32
double
outputScalor
= 1.;
34
size_t
outputPrecision
= 4;
36
std::shared_ptr<std::ofstream>
outputStream
=
nullptr
;
37
};
38
43
ObjExCellWriter
(
const
Config
&
cfg
44
//Acts::Logging::Level lvl = Acts::Logging::INFO
45
)
46
:
m_cfg
(
cfg
),
m_vCounter
(1)
47
{
48
if
(!
m_cfg
.
outputStream
) {
49
throw
std::invalid_argument(
"Missing output stream"
);
50
}
51
}
52
55
void
56
write
(
const
std::vector<
Acts::ExtrapolationCell<T>
>& ecells) {
57
58
// loop over the cells
59
for
(
auto
& eCell : ecells) {
60
// remember the first counter
61
size_t
fCounter =
m_vCounter
;
62
63
// increase the vertex counter
64
++
m_vCounter
;
65
// the event paramters
66
auto
sPosition = eCell.startParameters->position();
67
// write the space point
68
(*(
m_cfg
.
outputStream
))
69
<<
"v "
<<
m_cfg
.
outputScalor
* sPosition.x() <<
", "
70
<<
m_cfg
.
outputScalor
* sPosition.y() <<
", "
71
<<
m_cfg
.
outputScalor
* sPosition.z() <<
'\n'
;
72
73
// loop over extrapolation steps
74
for
(
auto
& es : eCell.extrapolationSteps) {
75
if
(es.parameters) {
77
const
T
&
pars
= (*es.parameters);
78
auto
tPosition =
pars
.position();
79
// increase the counter
80
++
m_vCounter
;
81
// write the space point
82
(*(
m_cfg
.
outputStream
))
83
<<
"v "
<<
m_cfg
.
outputScalor
* tPosition.x() <<
", "
84
<<
m_cfg
.
outputScalor
* tPosition.y() <<
", "
85
<<
m_cfg
.
outputScalor
* tPosition.z() <<
'\n'
;
86
}
87
}
88
// write out the line
89
for
(
size_t
i
=fCounter+1;
i
<
m_vCounter
;
i
++) {
90
(*(
m_cfg
.
outputStream
)) <<
"l "
;
91
(*(
m_cfg
.
outputStream
)) << (
i
-1) <<
" "
<<
i
;
92
(*(
m_cfg
.
outputStream
)) <<
'\n'
;
93
}
94
//(*(m_cfg.outputStream)) << "l ";
95
//for (size_t iv = fCounter; iv < m_vCounter; ++iv)
96
//(*(m_cfg.outputStream)) << iv << " ";
97
98
//(*(m_cfg.outputStream)) << '\n';
99
// new line
100
(*(
m_cfg
.
outputStream
)) <<
'\n'
;
101
}
102
}
103
104
private
:
105
Config
m_cfg
;
106
size_t
m_vCounter
;
107
};
108
make_hlt_rep.pars
pars
Definition:
make_hlt_rep.py:90
ObjExCellWriter
Definition:
ObjExCellWriter.h:25
ObjExCellWriter::Config
Definition:
ObjExCellWriter.h:29
Acts::ExtrapolationCell
Definition:
ActsExCellWriterSvc.h:29
ObjExCellWriter::Config::outputScalor
double outputScalor
output scalor
Definition:
ObjExCellWriter.h:32
lumiFormat.i
int i
Definition:
lumiFormat.py:85
ObjExCellWriter::m_cfg
Config m_cfg
Definition:
ObjExCellWriter.h:105
ObjExCellWriter::write
void write(const std::vector< Acts::ExtrapolationCell< T >> &ecells)
The protected writeT method, called by the WriterT base.
Definition:
ObjExCellWriter.h:56
ObjExCellWriter::Config::outputPrecision
size_t outputPrecision
precision for out
Definition:
ObjExCellWriter.h:34
ObjExCellWriter::ObjExCellWriter
ObjExCellWriter(const Config &cfg)
Constructor.
Definition:
ObjExCellWriter.h:43
ObjExCellWriter::Config::outputStream
std::shared_ptr< std::ofstream > outputStream
the output stream
Definition:
ObjExCellWriter.h:36
WriteCaloSwCorrections.cfg
cfg
Definition:
WriteCaloSwCorrections.py:23
ObjExCellWriter::m_vCounter
size_t m_vCounter
Definition:
ObjExCellWriter.h:106
TSU::T
unsigned long long T
Definition:
L1TopoDataTypes.h:35
Generated on Tue Dec 24 2024 21:15:54 for ATLAS Offline Software by
1.8.18