ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
TileCalorimeter
TileSvc
TileTPCnv
src
TileRawChannelCnv_p1.cxx
Go to the documentation of this file.
1
2
3
/*
4
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
// TileRawChannelCnv_p1.cxx
8
// Implementation file for class TileRawChannelCnv_p1
9
// Author: Alexander Solodkov <Sanya.Solodkov@cern.ch>
10
// Date: June 2009
12
13
#include "
TileEvent/TileRawChannel.h
"
14
#include "
TileTPCnv/TileRawChannelCnv_p1.h
"
15
//#include "iostream"
16
17
void
18
TileRawChannelCnv_p1::persToTrans
(
const
TileRawChannel_p1
* persObj,
TileRawChannel
* transObj, MsgStream &log)
const
19
{
20
unsigned
int
length
= persObj->
m_length
;
21
unsigned
int
l1 =
length
& 0xFF;
22
unsigned
int
l2 = (
length
>> 8) & 0xFF;
23
unsigned
int
l3 = (
length
>> 16) & 0xFF;
24
unsigned
int
l4 = (
length
>> 24) & 0xFF;
25
26
std::vector<float>::const_iterator it = persObj->
m_data
.begin();
27
28
std::vector<float> amplitude;
29
if
(l1>0) {
30
amplitude.assign (it, it+l1);
31
it += l1;
32
}
else
{
33
amplitude.push_back( 0.0 );
34
}
35
36
std::vector<float> time;
37
if
(l2>0) {
38
time.assign (it, it+l2);
39
it += l2;
40
}
else
{
41
time.push_back( 0.0 );
42
}
43
44
std::vector<float> quality;
45
if
(l3>0) {
46
quality.assign (it, it+l3);
47
it += l3;
48
}
else
{
49
quality.push_back( 0.0 );
50
}
51
52
float
pedestal = 0;
53
if
(l4>0)
54
pedestal = (*it++);
55
56
if
(it != persObj->
m_data
.end()) {
57
log << MSG::ERROR <<
"TileRawChannelCnv_p1::persToTrans wrong size of data vector: "
58
<< persObj->
m_data
.size() << MSG::hex <<
"0x"
<< persObj->
m_length
<< MSG::dec <<
endmsg
;
59
}
60
61
*transObj =
TileRawChannel
(
HWIdentifier
(
Identifier32
(persObj->
m_channelID
)),
62
std::move(amplitude),
63
std::move(time),
64
std::move(quality),
65
pedestal);
66
}
67
68
69
void
70
TileRawChannelCnv_p1::transToPers
(
const
TileRawChannel
* transObj,
TileRawChannel_p1
* persObj, MsgStream &
/*log*/
)
const
71
{
72
persObj->
m_channelID
= transObj->
adc_HWID
().
get_identifier32
().
get_compact
();
73
74
unsigned
int
l1 = transObj->
size
();
if
(l1>0xFF) l1=0xFF;
75
unsigned
int
l2 = transObj->
sizeTime
();
if
(l2>0xFF) l2=0xFF;
76
unsigned
int
l3 = transObj->
sizeQuality
();
if
(l3>0xFF) l3=0xFF;
77
unsigned
int
l4 = 1;
78
79
if
(l1==1 && transObj->
amplitude
(0)==0.0) l1=0;
80
if
(l2==1 && transObj->
time
(0)==0.0) l2=0;
81
if
(l3==1 && transObj->
quality
(0)==0.0) l3=0;
82
if
( transObj->
pedestal
()==0.0) l4=0;
83
84
persObj->
m_length
= (l4<<24 | l3<<16 | l2<<8 | l1);
85
86
if
(persObj->
m_length
) {
87
88
persObj->
m_data
.reserve(l1+l2+l3+l4);
89
90
for
(
unsigned
int
i=0; i<l1; ++i) {
91
persObj->
m_data
.push_back( transObj->
amplitude
(i) );
92
}
93
94
for
(
unsigned
int
i=0; i<l2; ++i) {
95
persObj->
m_data
.push_back( transObj->
time
(i) );
96
}
97
98
for
(
unsigned
int
i=0; i<l3; ++i) {
99
persObj->
m_data
.push_back( transObj->
quality
(i) );
100
}
101
102
if
(l4>0) {
103
persObj->
m_data
.push_back( transObj->
pedestal
() );
104
}
105
106
}
else
{
107
persObj->
m_data
.clear();
108
}
109
110
// if (l1==0 || l2==0 || l3==0 || l4==0)
111
// std::cout << "id=0x" << std::hex << persObj->m_channelID
112
// << " length=0x" << persObj->m_length << std::dec
113
// << " amp=" <<transObj->m_amplitude[0]
114
// << " time="<<transObj->m_time[0]
115
// << " qual="<<transObj->m_quality[0]
116
// << " ped=" <<transObj->m_pedestal
117
// << std::endl;
118
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
length
double length(const pvec &v)
Definition
FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
TileRawChannelCnv_p1.h
TileRawChannel.h
HWIdentifier
Definition
HWIdentifier.h:13
Identifier32
Definition
Identifier32.h:28
Identifier32::get_compact
value_type get_compact() const
Get the compact id.
Definition
Identifier32.h:47
Identifier::get_identifier32
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
TileRawChannelCnv_p1::transToPers
virtual void transToPers(const TileRawChannel *transObj, TileRawChannel_p1 *persObj, MsgStream &log) const override
Method creating the persistent representation TileRawChannel_p1 from its transient representation Til...
Definition
TileRawChannelCnv_p1.cxx:70
TileRawChannelCnv_p1::persToTrans
virtual void persToTrans(const TileRawChannel_p1 *persObj, TileRawChannel *transObj, MsgStream &log) const override
Method creating the transient representation TileRawChannel from its persistent representation TileRa...
Definition
TileRawChannelCnv_p1.cxx:18
TileRawChannel_p1
Definition
TileRawChannel_p1.h:20
TileRawChannel_p1::m_channelID
unsigned int m_channelID
Definition
TileRawChannel_p1.h:33
TileRawChannel_p1::m_length
unsigned int m_length
Definition
TileRawChannel_p1.h:34
TileRawChannel_p1::m_data
std::vector< float > m_data
Definition
TileRawChannel_p1.h:35
TileRawChannel
Definition
TileRawChannel.h:35
TileRawChannel::pedestal
float pedestal(void) const
Definition
TileRawChannel.h:106
TileRawChannel::time
float time(int ind=0) const
Definition
TileRawChannel.h:103
TileRawChannel::quality
float quality(int ind=0) const
Definition
TileRawChannel.h:105
TileRawChannel::size
int size() const
Definition
TileRawChannel.h:108
TileRawChannel::sizeTime
int sizeTime() const
Definition
TileRawChannel.h:109
TileRawChannel::amplitude
float amplitude(int ind=0) const
Definition
TileRawChannel.h:101
TileRawChannel::sizeQuality
int sizeQuality() const
Definition
TileRawChannel.h:110
TileRawData::adc_HWID
HWIdentifier adc_HWID(void) const
Definition
TileRawData.h:53
Generated on
for ATLAS Offline Software by
1.17.0