ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetEventCnv
InDetEventTPCnv
src
InDetPrepRawData
PixelClusterCnv_p3.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
//-----------------------------------------------------------------------------
6
//
7
// file: PixelClusterCnv_p3.cxx
8
//
9
//-----------------------------------------------------------------------------
10
11
#include "
InDetPrepRawData/PixelCluster.h
"
12
#include "
EventPrimitives/EventPrimitives.h
"
13
14
#include "
InDetEventTPCnv/InDetPrepRawData/PixelClusterCnv_p3.h
"
15
#include "
InDetIdentifier/PixelID.h
"
16
17
#include <memory>
18
#include <algorithm>
19
20
21
22
PixelClusterCnv_p3::PixelClusterCnv_p3
(
const
PixelID
* pixid )
23
:
24
m_pixId2
(pixid)
25
{}
26
27
28
InDet::PixelCluster
29
PixelClusterCnv_p3::createPixelCluster
(
const
InDet::PixelCluster_p3
* persObj,
30
const
Identifier
& waferId,
31
const
InDetDD::SiDetectorElement
* detEl,
32
MsgStream &log)
33
{
34
// if persistent m_clusId == 0, we are reading in 64 bit ids and
35
// need to extract the cluster id from the first id in the
36
// m_rdoList
37
Identifier
clusId;
38
bool
is64BitId =
false
;
39
unsigned
int
rdoListSize = persObj->
m_rdoList
.size();
40
if
(persObj->
m_clusId
== 0) {
41
// 64-bit ids, get cluster id - wafer id has been stored in the
42
// transient object by the container cnv
43
clusId =
Identifier
(
m_pixId2
->pixel_id_offset(waferId, persObj->
m_rdoList
[0]) );
44
is64BitId =
true
;
45
rdoListSize--;
46
}
47
else
{
48
// Must also fix cluster pixel id when reading in old 32-bit ids
49
// and the code has 64-bit ids
50
clusId =
m_pixId2
->pixel_id_from_shortened(persObj->
m_clusId
);
51
}
52
53
// Local Position
54
Amg::Vector2D
localPos;
55
localPos[
Trk::locX
] = persObj->
m_localPosX
;
56
localPos[
Trk::locY
] = persObj->
m_localPosY
;
57
58
std::vector<Identifier> rdoList;
59
rdoList.resize(rdoListSize);
60
std::vector<Identifier>::iterator idit = rdoList.begin();
61
std::vector<InDet::PixelCluster_p3::rdo_diff_type>::const_iterator it = persObj->
m_rdoList
.begin();
62
if
(is64BitId) ++it;
// we have used first element of persistent rdoList for cluster id
63
for
(; it != persObj->
m_rdoList
.end(); ++it) {
64
// When reading in data written for 32-bit ids, we need to use
65
// the PixelID helper to convert it if filling a 64-bit id
66
// (i.e. using pixel_id_from_shortened). This does nothing if
67
// the identifiers are still 32-bit RDS
68
if
(is64BitId) {
69
*idit =
Identifier
(clusId.
get_compact
() + ( (
static_cast<
Identifier::value_type
>
(*it)) <<
m_pixId2
->base_bit() ) );
70
}
71
else
{
72
(*idit) =
m_pixId2
->pixel_id_from_shortened(persObj->
m_clusId
+ (*it));
73
}
74
++idit;
75
}
76
77
InDet::SiWidth
width
;
78
m_swCnv
.persToTrans(&persObj->
m_width
, &
width
, log);
79
80
// Error matrix
81
auto
cmat =
Amg::MatrixX
(2,2);
82
(cmat)(0,0) =
static_cast<
double
>
(persObj->
m_mat00
);
83
(cmat)(1,0) =
static_cast<
double
>
(persObj->
m_mat01
);
84
(cmat)(0,1) =
static_cast<
double
>
(persObj->
m_mat01
);
85
(cmat)(1,1) =
static_cast<
double
>
(persObj->
m_mat11
);
86
87
88
// Check if charge or ToT has been stored
89
int
totalToT = 0;
90
float
totalCharge = 0;
91
if
( (persObj->
m_properties
&(1<<27))!=0 )
92
totalCharge = (float)(persObj->
m_properties
& 0xFFFFFF);
93
else
94
totalToT = (persObj->
m_properties
& 0xFFFFFF);
95
96
auto
chargeList = persObj->
m_chargeList
;
97
InDet::PixelCluster
clus (clusId,
98
localPos,
99
std::move(rdoList),
100
((persObj->
m_properties
)>>28) & 0xF,
// lvl1a
101
totalToT,
102
std::move(chargeList),
103
totalCharge,
104
width
,
105
detEl,
106
std::move(cmat),
107
persObj->
m_omegax
,
108
persObj->
m_omegay
,
109
persObj->
m_splitInfo
110
);
111
112
clus.
setGangedPixel
( (persObj->
m_properties
&(1<<24))!=0 );
113
clus.
setFake
( (persObj->
m_properties
&(1<<25))!=0 );
114
clus.
setAmbiguous
( (persObj->
m_properties
&(1<<26))!=0 );
115
return
clus;
116
}
117
118
119
void
PixelClusterCnv_p3::
120
persToTrans
(
const
InDet::PixelCluster_p3
*persObj,
InDet::PixelCluster
*transObj, MsgStream &log)
121
{
122
Identifier
waferId = transObj->
identify
();
123
*transObj =
createPixelCluster
(persObj, waferId,
nullptr
, log);
124
}
//end of cnv_p3 method
125
126
127
void
PixelClusterCnv_p3::transToPers
(
const
InDet::PixelCluster
*transObj,
InDet::PixelCluster_p3
*persObj, MsgStream &log )
128
{
129
// log << MSG::VERBOSE << "In PixelCluster::transToPers" << endmsg;
130
m_swCnv
.transToPers(&transObj->
width
(), &persObj->
m_width
, log);
131
132
// base class:
133
//
134
135
// Local Position
136
persObj->
m_localPosX
= transObj->
localPosition
()[
Trk::locX
];
137
persObj->
m_localPosY
= transObj->
localPosition
()[
Trk::locY
];
138
139
// Error Matrix
140
141
persObj->
m_mat00
= (transObj->
localCovariance
())(0,0);
142
persObj->
m_mat01
= (transObj->
localCovariance
())(0,1);
143
persObj->
m_mat11
= (transObj->
localCovariance
())(1,1);
144
145
// Charge balance
146
persObj->
m_omegax
= transObj->
omegax
();
147
persObj->
m_omegay
= transObj->
omegay
();
148
149
// List of Id of the cluster
150
151
// For 64-bit ids, we set m_clusId to 0 and instead save the
152
// diff in m_rdoList as the first element
153
persObj->
m_rdoList
.resize(transObj->
rdoList
().size() + 1);
154
155
std::vector<InDet::PixelCluster_p3::rdo_diff_type>::iterator pit = persObj->
m_rdoList
.begin();
156
// Get base identifier to calculate diffs
157
Identifier
clusId = transObj->
identify
();
158
persObj->
m_clusId
= 0;
159
// Save offset to wafer id for the cluster id
160
Identifier
waferId =
m_pixId2
->wafer_id(clusId);
// remove the eta/phi of channel id
161
*pit =
static_cast<
InDet::PixelCluster_p3::rdo_diff_type
>
(
m_pixId2
->calc_offset(waferId, clusId) );
162
++pit;
163
164
for
(
const
Identifier
&
id
: transObj->
rdoList
()) {
165
*pit =
static_cast<
InDet::PixelCluster_p3::rdo_diff_type
>
(
m_pixId2
->calc_offset(clusId,
id
) );
166
++pit;
167
}
168
169
// Setting of cluster properties:
170
persObj->
m_properties
= 0;
171
if
( transObj->
gangedPixel
() ) persObj->
m_properties
|= (1<<24);
172
if
( transObj->
isFake
() ) persObj->
m_properties
|= (1<<25);
173
if
( transObj->
isAmbiguous
() ) persObj->
m_properties
|= (1<<26);
174
persObj->
m_properties
|= ((transObj->
LVL1A
() & 0xF)<<28);
175
176
if
( transObj->
totalCharge
()>0. ) {
177
persObj->
m_properties
|= (1<<27);
178
persObj->
m_properties
|= ( (int)(transObj->
totalCharge
()+0.5) & 0xFFFFFF );
179
}
else
{
180
persObj->
m_properties
|= ( transObj->
totalToT
() & 0xFFFFFF );
181
}
182
// needed for pixel cluster splitting
183
persObj->
m_splitInfo
= transObj->
splitInfoRaw
();
184
persObj->
m_chargeList
= transObj->
chargeList
();
185
}
186
187
EventPrimitives.h
PixelCluster.h
PixelClusterCnv_p3.h
PixelID.h
This is an Identifier helper class for the Pixel subdetector.
width
const double width
Definition
TTileTripReader.cxx:24
Identifier::get_compact
value_type get_compact() const
Get the compact id.
InDetDD::SiDetectorElement
Class to hold geometrical description of a silicon detector element.
Definition
SiDetectorElement.h:109
InDet::PixelCluster_p3
Definition
PixelCluster_p3.h:18
InDet::PixelCluster_p3::m_localPosY
float m_localPosY
Definition
PixelCluster_p3.h:31
InDet::PixelCluster_p3::rdo_diff_type
int rdo_diff_type
Definition
PixelCluster_p3.h:22
InDet::PixelCluster_p3::m_splitInfo
int m_splitInfo
Definition
PixelCluster_p3.h:38
InDet::PixelCluster_p3::m_mat11
float m_mat11
Definition
PixelCluster_p3.h:34
InDet::PixelCluster_p3::m_clusId
unsigned int m_clusId
Definition
PixelCluster_p3.h:28
InDet::PixelCluster_p3::m_localPosX
float m_localPosX
Definition
PixelCluster_p3.h:30
InDet::PixelCluster_p3::m_mat00
float m_mat00
Definition
PixelCluster_p3.h:32
InDet::PixelCluster_p3::m_width
InDet::SiWidth_p2 m_width
Definition
PixelCluster_p3.h:41
InDet::PixelCluster_p3::m_properties
unsigned int m_properties
Definition
PixelCluster_p3.h:37
InDet::PixelCluster_p3::m_rdoList
std::vector< rdo_diff_type > m_rdoList
Definition
PixelCluster_p3.h:29
InDet::PixelCluster_p3::m_omegay
float m_omegay
Definition
PixelCluster_p3.h:36
InDet::PixelCluster_p3::m_chargeList
std::vector< float > m_chargeList
Definition
PixelCluster_p3.h:39
InDet::PixelCluster_p3::m_omegax
float m_omegax
Definition
PixelCluster_p3.h:35
InDet::PixelCluster_p3::m_mat01
float m_mat01
Definition
PixelCluster_p3.h:33
InDet::PixelCluster
Definition
InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelCluster.h:49
InDet::PixelCluster::isAmbiguous
bool isAmbiguous() const
Definition
InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelCluster.h:237
InDet::PixelCluster::isFake
bool isFake() const
Definition
InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelCluster.h:229
InDet::PixelCluster::setAmbiguous
bool setAmbiguous(bool)
Definition
InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelCluster.h:266
InDet::PixelCluster::chargeList
const std::vector< float > & chargeList() const
Definition
InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelCluster.h:210
InDet::PixelCluster::setFake
bool setFake(bool)
Definition
InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelCluster.h:233
InDet::PixelCluster::omegax
float omegax() const
Definition
InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelCluster.h:194
InDet::PixelCluster::totalToT
int totalToT() const
Definition
InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelCluster.h:206
InDet::PixelCluster::splitInfoRaw
int splitInfoRaw() const
Definition
InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelCluster.h:261
InDet::PixelCluster::LVL1A
int LVL1A() const
Definition
InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelCluster.h:270
InDet::PixelCluster::totalCharge
float totalCharge() const
Definition
InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelCluster.h:214
InDet::PixelCluster::omegay
float omegay() const
Definition
InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelCluster.h:198
InDet::SiCluster::gangedPixel
bool gangedPixel() const
return the flag of this cluster containing a gangedPixel
InDet::SiCluster::width
const InDet::SiWidth & width() const
return width class reference
InDet::SiCluster::setGangedPixel
void setGangedPixel(bool ganged)
set the flag of this cluster containing a gangedPixel
InDet::SiWidth
Definition
SiWidth.h:25
PixelClusterCnv_p3::createPixelCluster
InDet::PixelCluster createPixelCluster(const InDet::PixelCluster_p3 *persObj, const Identifier &waferId, const InDetDD::SiDetectorElement *delEl, MsgStream &log)
Definition
PixelClusterCnv_p3.cxx:29
PixelClusterCnv_p3::m_pixId2
const PixelID * m_pixId2
Definition
PixelClusterCnv_p3.h:47
PixelClusterCnv_p3::persToTrans
void persToTrans(const InDet::PixelCluster_p3 *, InDet::PixelCluster *, MsgStream &)
Definition
PixelClusterCnv_p3.cxx:120
PixelClusterCnv_p3::PixelClusterCnv_p3
PixelClusterCnv_p3()
Definition
PixelClusterCnv_p3.h:31
PixelClusterCnv_p3::m_swCnv
InDet::SiWidthCnv_p2 m_swCnv
Definition
PixelClusterCnv_p3.h:44
PixelClusterCnv_p3::transToPers
void transToPers(const InDet::PixelCluster *, InDet::PixelCluster_p3 *, MsgStream &)
Definition
PixelClusterCnv_p3.cxx:127
PixelID
This is an Identifier helper class for the Pixel subdetector.
Definition
PixelID.h:69
Trk::PrepRawData::localPosition
const Amg::Vector2D & localPosition() const
return the local position reference
Trk::PrepRawData::identify
Identifier identify() const
return the identifier
Trk::PrepRawData::localCovariance
const Amg::MatrixX & localCovariance() const
return const ref to the error matrix
Trk::PrepRawData::rdoList
const std::vector< Identifier > & rdoList() const
return the List of rdo identifiers (pointers)
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition
EventPrimitives.h:27
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition
GeoPrimitives.h:48
Identifier
Definition
IdentifierFieldParser.cxx:14
Trk::locY
@ locY
local cartesian
Definition
ParamDefs.h:38
Trk::locX
@ locX
Definition
ParamDefs.h:37
Generated on
for ATLAS Offline Software by
1.17.0