ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
TestBeam
TBTPCnv
src
TBLArDigitContainerCnv_p1.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
#include "
TBTPCnv/TBLArDigitContainerCnv_p1.h
"
6
//#include "LArRawEvent/LArDigitContainer.h"
7
#include "
TBEvent/TBLArDigitContainer.h
"
8
#include "Identifier/Identifier.h"
9
#include "
TBTPCnv/TBLArDigitContainer_p1.h
"
10
11
12
13
void
14
TBLArDigitContainerCnv_p1::persToTrans
(
const
TBLArDigitContainer_p1
* pers,
15
TBLArDigitContainer
* trans, MsgStream &log)
const
16
{
17
const
unsigned
nDigits=pers->
m_channelID
.size();
18
if
(nDigits != pers->
m_gain
.size() || nDigits != pers->
m_nSamples
.size()) {
19
log << MSG::ERROR <<
"LArDigitContainer_p1 is inconsistent! "
<< std::endl;
20
return
;
21
}
22
23
//LArDigit digit;
24
trans->
clear
();
25
trans->
reserve
(nDigits);
26
std::vector<unsigned short>::const_iterator sample_it=pers->
m_samples
.begin();
27
28
for
(
unsigned
i=0;i<nDigits;i++) {
29
std::vector<unsigned short>::const_iterator sample_it_e =
30
sample_it+pers->
m_nSamples
[i];
31
std::vector<short> samples (sample_it,sample_it_e);
32
sample_it = sample_it_e;
33
34
auto
transDig = std::make_unique<LArDigit>
35
(
HWIdentifier
(pers->
m_channelID
[i]),
36
static_cast<
CaloGain::CaloGain
>
(pers->
m_gain
[i]),
37
std::move(samples));
38
39
trans->
push_back
(std::move(transDig));
40
}
41
}
42
43
44
void
45
TBLArDigitContainerCnv_p1::transToPers
(
const
TBLArDigitContainer
* trans,
46
TBLArDigitContainer_p1
* pers, MsgStream &
/*log*/
)
const
47
{
48
49
unsigned
int
nDigits=trans->
size
();
50
pers->
m_channelID
.reserve(nDigits);
51
pers->
m_gain
.reserve(nDigits);
52
pers->
m_nSamples
.reserve(nDigits);
53
if
(nDigits)
54
pers->
m_samples
.reserve(
55
(*(trans->
begin
()))->nsamples()
56
* nDigits);
57
58
TBLArDigitContainer::const_iterator
it=trans->
begin
();
59
TBLArDigitContainer::const_iterator
it_e=trans->
end
();
60
//unsigned i=0;
61
for
(;it!=it_e;++it) {
62
const
LArDigit
* transDigit=*it;
63
pers->
m_channelID
.push_back(transDigit->
hardwareID
().
get_identifier32
().
get_compact
());
64
pers->
m_gain
.push_back((
unsigned
char
)transDigit->
gain
());
65
pers->
m_nSamples
.push_back(transDigit->
nsamples
());
66
pers->
m_samples
.insert (pers->
m_samples
.end(),
67
transDigit->
samples
().begin(),
68
transDigit->
samples
().end());
69
//std:: cout << "Working on channel "<< i++ << "(" << std::hex
70
// << transDigit->m_hardwareID.get_compact() <<std::dec << ")" <<std::endl;
71
}
72
}
TBLArDigitContainerCnv_p1.h
TBLArDigitContainer.h
TBLArDigitContainer_p1.h
DataVector< LArDigit >::const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Definition
DataVector.h:838
DataVector::reserve
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
DataVector::clear
void clear()
Erase all the elements in the collection.
HWIdentifier
Definition
HWIdentifier.h:13
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.
LArDigit
Liquid Argon digit base class.
Definition
LArDigit.h:25
LArDigit::gain
CaloGain::CaloGain gain() const
Definition
LArDigit.h:72
LArDigit::hardwareID
const HWIdentifier & hardwareID() const
Definition
LArDigit.h:66
LArDigit::nsamples
int nsamples() const
Definition
LArDigit.h:75
LArDigit::samples
const std::vector< short > & samples() const
Definition
LArDigit.h:78
TBLArDigitContainerCnv_p1::persToTrans
virtual void persToTrans(const TBLArDigitContainer_p1 *pers, TBLArDigitContainer *trans, MsgStream &log) const override
Definition
TBLArDigitContainerCnv_p1.cxx:14
TBLArDigitContainerCnv_p1::transToPers
virtual void transToPers(const TBLArDigitContainer *trans, TBLArDigitContainer_p1 *pers, MsgStream &log) const override
Definition
TBLArDigitContainerCnv_p1.cxx:45
TBLArDigitContainer_p1
Definition
TBLArDigitContainer_p1.h:17
TBLArDigitContainer_p1::m_channelID
std::vector< unsigned int > m_channelID
Definition
TBLArDigitContainer_p1.h:21
TBLArDigitContainer_p1::m_gain
std::vector< unsigned char > m_gain
Definition
TBLArDigitContainer_p1.h:22
TBLArDigitContainer_p1::m_samples
std::vector< unsigned short > m_samples
Definition
TBLArDigitContainer_p1.h:24
TBLArDigitContainer_p1::m_nSamples
std::vector< unsigned short > m_nSamples
Definition
TBLArDigitContainer_p1.h:23
TBLArDigitContainer
Gaudi Class ID.
Definition
TBLArDigitContainer.h:40
CaloGain::CaloGain
CaloGain
Definition
CaloGain.h:11
Generated on
for ATLAS Offline Software by
1.17.0