ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonReconstruction
MuonRecUtils
MuonLinearSegmentMakerUtilities
src
ClusterNtuple.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
9
#include "
MuonLinearSegmentMakerUtilities/ClusterNtuple.h
"
10
#include "GaudiKernel/MsgStream.h"
11
#include "
AthenaKernel/getMessageSvc.h
"
12
#include <iostream>
13
#include <TTree.h>
14
15
namespace
ClusterSeg
{
16
17
void
ClusterNtuple::initForWrite
(TTree&
tree
){
18
init
();
19
tree
.Branch(
"nclusters"
,&
nclusters
,
"nclusters/I"
);
20
tree
.Branch(
"x"
,&
x
,
"x[nclusters]/D"
);
21
tree
.Branch(
"y"
,&
y
,
"y[nclusters]/D"
);
22
tree
.Branch(
"z"
,&
z
,
"z[nclusters]/D"
);
23
tree
.Branch(
"isPhi"
,&
isPhi
,
"isPhi[nclusters]/O"
);
24
tree
.Branch(
"techIndex"
,&
tIndex
,
"techIndex[nclusters]/I"
);
25
tree
.Branch(
"phiIndex"
,&
pIndex
,
"phiIndex[nclusters]/I"
);
26
tree
.Branch(
"isMatch"
,&
isMatch
,
"isMatch[nclusters]/O"
);
27
tree
.Branch(
"barcode"
,&
barcode
,
"barcode[nclusters]/I"
);
28
tree
.Branch(
"ntracks"
,&
ntracks
,
"ntracks/I"
);
29
tree
.Branch(
"chi2"
,&
chi2
,
"chi2[ntracks]/D"
);
30
tree
.Branch(
"ntracksT"
,&
ntracksT
,
"ntracksT/I"
);
31
tree
.Branch(
"chi2T"
,&
chi2T
,
"chi2T[ntracksT]/D"
);
32
tree
.Branch(
"nMDT"
,&
nMDT
,
"nMDT/I"
);
33
tree
.Branch(
"residual"
,&
residual
,
"residual[nMDT]/D"
);
34
tree
.Branch(
"nMDTT"
,&
nMDTT
,
"nMDTT/I"
);
35
tree
.Branch(
"residualT"
,&
residualT
,
"residualT[nMDTT]/D"
);
36
}
37
38
void
ClusterNtuple::initForRead
(TTree&
tree
) {
39
tree
.SetBranchAddress(
"nclusters"
,&
nclusters
);
40
tree
.SetBranchAddress(
"x"
,&
x
);
41
tree
.SetBranchAddress(
"y"
,&
y
);
42
tree
.SetBranchAddress(
"z"
,&
z
);
43
tree
.SetBranchAddress(
"isPhi"
,&
isPhi
);
44
tree
.SetBranchAddress(
"techIndex"
,&
tIndex
);
45
tree
.SetBranchAddress(
"phiIndex"
,&
pIndex
);
46
tree
.SetBranchAddress(
"isMatch"
,&
isMatch
);
47
tree
.SetBranchAddress(
"barcode"
,&
barcode
);
48
}
49
50
void
ClusterNtuple::fill
(
const
std::vector<Cluster*>& clusters) {
51
for
(
const
auto
& it: clusters)
fill
(*it);
52
}
53
54
void
ClusterNtuple::fill
(
const
Cluster
& cluster ){
55
if
(
nclusters
>=
CLUSTERSIZE
)
return
;
56
x
[
nclusters
] = cluster.
m_x
;
57
y
[
nclusters
] = cluster.
m_y
;
58
z
[
nclusters
] = cluster.
m_z
;
59
isPhi
[
nclusters
] = cluster.
m_isPhi
;
60
tIndex
[
nclusters
] = (int)cluster.
m_tIndex
;
61
pIndex
[
nclusters
] = (int)cluster.
m_pIndex
;
62
isMatch
[
nclusters
] = cluster.
m_isMatch
;
63
barcode
[
nclusters
] = cluster.
m_barcode
;
64
++
nclusters
;
65
}
66
67
void
ClusterNtuple::fill
(
const
double
& theVal,
FillType
theFillType) {
68
if
(theFillType ==
FillType::chi2
){
69
if
(
ntracks
>=
CLUSTERSIZE
)
return
;
70
chi2
[
ntracks
] = theVal;
71
++
ntracks
;
72
}
73
74
if
(theFillType ==
FillType::chi2T
){
75
if
(
ntracksT
>=
CLUSTERSIZE
)
return
;
76
chi2T
[
ntracksT
] = theVal;
77
++
ntracksT
;
78
}
79
80
if
(theFillType ==
FillType::residual
){
81
if
(
ntracks
>=
CLUSTERSIZE
)
return
;
82
residual
[
nMDT
] = theVal;
83
++
nMDT
;
84
}
85
86
if
(theFillType ==
FillType::residualT
){
87
if
(
ntracksT
>=
CLUSTERSIZE
)
return
;
88
residualT
[
nMDTT
] = theVal;
89
++
nMDTT
;
90
}
91
92
}
93
94
void
ClusterNtuple::reset
() {
95
nclusters
= 0;
96
ntracks
= 0;
97
ntracksT
= 0;
98
nMDT
= 0;
99
nMDTT
= 0;
100
}
101
102
bool
ClusterNtuple::read
( std::vector<Cluster*>& clusters) {
103
if
(
nclusters
== 0 ) {
104
MsgStream log(
Athena::getMessageSvc
(),
"ClusterNtuple::read"
);
105
if
(log.level()<=MSG::DEBUG) log << MSG::DEBUG <<
" ntuple not initialized for reading "
<<
endmsg
;
106
return
false
;
107
}
108
109
for
(
int
i=0;i<
nclusters
;++i){
110
Cluster
* cluster =
new
Cluster
(
x
[i],
y
[i],
z
[i],
isPhi
[i],
tIndex
[i],
pIndex
[i],
isMatch
[i],
barcode
[i]);
111
clusters.push_back(cluster);
112
}
113
114
return
true
;
115
}
116
117
void
ClusterNtuple::clean
( std::vector<Cluster*>& clusters) {
118
for
(
auto
& it: clusters)
delete
it;
119
}
120
121
void
ClusterNtuple::init
() {
122
nclusters
= 0;
123
ntracks
= 0;
124
ntracksT
= 0;
125
nMDT
= 0;
126
nMDTT
= 0;
127
}
128
129
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:61
ClusterNtuple.h
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition
getMessageSvc.cxx:20
ClusterSeg
Definition
MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLinearSegmentMakerUtilities/MuonLinearSegmentMakerUtilities/Cluster.h:12
ClusterSeg::FillType
FillType
Definition
ClusterNtuple.h:20
ClusterSeg::residual
@ residual
Definition
ClusterNtuple.h:20
ClusterSeg::chi2T
@ chi2T
Definition
ClusterNtuple.h:20
ClusterSeg::residualT
@ residualT
Definition
ClusterNtuple.h:20
ClusterSeg::chi2
@ chi2
Definition
ClusterNtuple.h:20
ClusterSeg::ClusterNtuple::nclusters
int nclusters
Definition
ClusterNtuple.h:47
ClusterSeg::ClusterNtuple::tIndex
int tIndex[CLUSTERSIZE]
Definition
ClusterNtuple.h:51
ClusterSeg::ClusterNtuple::pIndex
int pIndex[CLUSTERSIZE]
Definition
ClusterNtuple.h:52
ClusterSeg::ClusterNtuple::nMDT
int nMDT
Definition
ClusterNtuple.h:41
ClusterSeg::ClusterNtuple::clean
static void clean(std::vector< Cluster * > &clusters)
Definition
ClusterNtuple.cxx:117
ClusterSeg::ClusterNtuple::chi2
double chi2[CLUSTERSIZE]
Definition
ClusterNtuple.h:44
ClusterSeg::ClusterNtuple::init
void init()
Definition
ClusterNtuple.cxx:121
ClusterSeg::ClusterNtuple::ntracks
int ntracks
Definition
ClusterNtuple.h:46
ClusterSeg::ClusterNtuple::nMDTT
int nMDTT
Definition
ClusterNtuple.h:42
ClusterSeg::ClusterNtuple::x
double x[CLUSTERSIZE]
Definition
ClusterNtuple.h:48
ClusterSeg::ClusterNtuple::barcode
int barcode[CLUSTERSIZE]
Definition
ClusterNtuple.h:55
ClusterSeg::ClusterNtuple::chi2T
double chi2T[CLUSTERSIZE]
Definition
ClusterNtuple.h:43
ClusterSeg::ClusterNtuple::initForWrite
void initForWrite(TTree &tree)
Definition
ClusterNtuple.cxx:17
ClusterSeg::ClusterNtuple::isPhi
bool isPhi[CLUSTERSIZE]
Definition
ClusterNtuple.h:53
ClusterSeg::ClusterNtuple::residual
double residual[CLUSTERSIZE]
Definition
ClusterNtuple.h:40
ClusterSeg::ClusterNtuple::ntracksT
int ntracksT
Definition
ClusterNtuple.h:45
ClusterSeg::ClusterNtuple::fill
void fill(const double &fillVal, FillType theFillType)
Definition
ClusterNtuple.cxx:67
ClusterSeg::ClusterNtuple::initForRead
void initForRead(TTree &tree)
Definition
ClusterNtuple.cxx:38
ClusterSeg::ClusterNtuple::z
double z[CLUSTERSIZE]
Definition
ClusterNtuple.h:50
ClusterSeg::ClusterNtuple::CLUSTERSIZE
static const int CLUSTERSIZE
Definition
ClusterNtuple.h:37
ClusterSeg::ClusterNtuple::read
bool read(std::vector< Cluster * > &clusters)
Definition
ClusterNtuple.cxx:102
ClusterSeg::ClusterNtuple::residualT
double residualT[CLUSTERSIZE]
Definition
ClusterNtuple.h:39
ClusterSeg::ClusterNtuple::y
double y[CLUSTERSIZE]
Definition
ClusterNtuple.h:49
ClusterSeg::ClusterNtuple::reset
void reset()
Definition
ClusterNtuple.cxx:94
ClusterSeg::ClusterNtuple::isMatch
bool isMatch[CLUSTERSIZE]
Definition
ClusterNtuple.h:54
ClusterSeg::Cluster
Definition
MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLinearSegmentMakerUtilities/MuonLinearSegmentMakerUtilities/Cluster.h:14
ClusterSeg::Cluster::m_tIndex
Muon::MuonStationIndex::TechnologyIndex m_tIndex
Definition
MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLinearSegmentMakerUtilities/MuonLinearSegmentMakerUtilities/Cluster.h:40
ClusterSeg::Cluster::m_isPhi
bool m_isPhi
Definition
MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLinearSegmentMakerUtilities/MuonLinearSegmentMakerUtilities/Cluster.h:39
ClusterSeg::Cluster::m_z
double m_z
Definition
MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLinearSegmentMakerUtilities/MuonLinearSegmentMakerUtilities/Cluster.h:38
ClusterSeg::Cluster::m_isMatch
bool m_isMatch
Definition
MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLinearSegmentMakerUtilities/MuonLinearSegmentMakerUtilities/Cluster.h:42
ClusterSeg::Cluster::m_x
double m_x
Definition
MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLinearSegmentMakerUtilities/MuonLinearSegmentMakerUtilities/Cluster.h:36
ClusterSeg::Cluster::m_barcode
int m_barcode
Definition
MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLinearSegmentMakerUtilities/MuonLinearSegmentMakerUtilities/Cluster.h:43
ClusterSeg::Cluster::m_y
double m_y
Definition
MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLinearSegmentMakerUtilities/MuonLinearSegmentMakerUtilities/Cluster.h:37
ClusterSeg::Cluster::m_pIndex
Muon::MuonStationIndex::PhiIndex m_pIndex
Definition
MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLinearSegmentMakerUtilities/MuonLinearSegmentMakerUtilities/Cluster.h:41
tree
TChain * tree
Definition
tile_monitor.h:30
Generated on
for ATLAS Offline Software by
1.17.0