ATLAS Offline Software
Loading...
Searching...
No Matches
TBADCRawContCnv_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
7#include "Identifier/Identifier.h"
9
10
11
12void
14 TBADCRawCont* trans, MsgStream &/*log*/) const
15{
16
17 const unsigned nADCRaws = pers->m_adc.size();
18
19 // clear the trans contained and reserve space for the new scints
20 trans->clear();
21 trans->reserve(nADCRaws);
22
23 // copy all the scints from the pers to the trans
24 for (unsigned nADCRawNow=0; nADCRawNow<nADCRaws; nADCRawNow++) {
25 TBADCRaw * ADCRaw = new TBADCRaw();
26
27 // fill in the scint properties
28 ADCRaw -> setADC( pers->m_adc[nADCRawNow] );
29 ADCRaw -> setDetectorName( pers->m_tbDetectorName[nADCRawNow] );
30 ADCRaw -> setOverflow( pers->m_overflow[nADCRawNow] );
31
32 // fill the container with the scint object
33 trans->push_back(ADCRaw);
34 }
35
36}
37
38
39void
41 TBADCRawCont_p1* pers, MsgStream &/*log*/) const
42{
43
44 const unsigned nADCRaws = trans->size();
45
46 pers -> m_adc.reserve(nADCRaws);
47 pers -> m_tbDetectorName.reserve(nADCRaws);
48 pers -> m_overflow.reserve(nADCRaws);
49
50 // iterators for the container
51 TBADCRawCont::const_iterator ADCRawIt = trans->begin();
52 TBADCRawCont::const_iterator ADCRawIt_e = trans->end();
53
54 // copy all the scints from the trans to the pers
55 for (; ADCRawIt!=ADCRawIt_e; ++ADCRawIt) {
56 const TBADCRaw * ADCRaw = * ADCRawIt;
57
58 pers -> m_adc.push_back( ADCRaw->getADC() );
59 pers -> m_tbDetectorName.push_back( ADCRaw->getDetectorName() );
60 pers -> m_overflow.push_back( ADCRaw->isOverflow() );
61
62 }
63
64}
65
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
void clear()
Erase all the elements in the collection.
virtual void transToPers(const TBADCRawCont *trans, TBADCRawCont_p1 *pers, MsgStream &log) const override
virtual void persToTrans(const TBADCRawCont_p1 *pers, TBADCRawCont *trans, MsgStream &log) const override
std::vector< bool > m_overflow
std::vector< signal_type > m_adc
std::vector< std::string > m_tbDetectorName
"TBEvent/TBADCRawCont.h"
Data object holding adc measurement.
Definition TBADCRaw.h:21
signal_type getADC() const
Definition TBADCRaw.h:35
bool isOverflow() const
const std::string & getDetectorName() const