ATLAS Offline Software
Loading...
Searching...
No Matches
TBTDCRawContCnv_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 TBTDCRawCont* trans, MsgStream &/*log*/) const
15{
16
17 const unsigned nTDCRaws = pers->m_tdc.size();
18
19 // clear the trans contained and reserve space for the new scints
20 trans->clear();
21 trans->reserve(nTDCRaws);
22
23 // copy all the scints from the pers to the trans
24 for (unsigned nTDCRawNow=0; nTDCRawNow<nTDCRaws; nTDCRawNow++) {
25 TBTDCRaw * TDCRaw = new TBTDCRaw();
26
27 // fill in the scint properties
28 TDCRaw -> setTDC( pers->m_tdc[nTDCRawNow] );
29 TDCRaw -> setUnderThreshold( pers->m_underThreshold[nTDCRawNow] );
30 TDCRaw -> setDetectorName( pers->m_tbDetectorName[nTDCRawNow] );
31 TDCRaw -> setOverflow( pers->m_overflow[nTDCRawNow] );
32
33 // fill the container with the scint object
34 trans->push_back(TDCRaw);
35 }
36}
37
38
39void
41 TBTDCRawCont_p1* pers, MsgStream &/*log*/) const
42{
43
44 const unsigned nTDCRaws = trans->size();
45
46 pers -> m_tdc.reserve(nTDCRaws);
47 pers -> m_underThreshold.reserve(nTDCRaws);
48 pers -> m_tbDetectorName.reserve(nTDCRaws);
49 pers -> m_overflow.reserve(nTDCRaws);
50
51 // iterators for the container
52 TBTDCRawCont::const_iterator TDCRawIt = trans->begin();
53 TBTDCRawCont::const_iterator TDCRawIt_e = trans->end();
54
55 // copy all the scints from the trans to the pers
56 for (; TDCRawIt!=TDCRawIt_e; ++TDCRawIt) {
57 const TBTDCRaw * TDCRaw = * TDCRawIt;
58
59 pers -> m_tdc.push_back( TDCRaw->getTDC() );
60 pers -> m_underThreshold.push_back( TDCRaw->isUnderThreshold() );
61 pers -> m_tbDetectorName.push_back( TDCRaw->getDetectorName() );
62 pers -> m_overflow.push_back( TDCRaw->isOverflow() );
63
64 }
65
66}
67
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.
bool isOverflow() const
const std::string & getDetectorName() const
virtual void transToPers(const TBTDCRawCont *trans, TBTDCRawCont_p1 *pers, MsgStream &log) const override
virtual void persToTrans(const TBTDCRawCont_p1 *pers, TBTDCRawCont *trans, MsgStream &log) const override
std::vector< bool > m_overflow
std::vector< signal_type > m_tdc
std::vector< bool > m_underThreshold
std::vector< std::string > m_tbDetectorName
"TBEvent/TBTDCRawCont.h"
Data object holding tdc measurement.
Definition TBTDCRaw.h:21
signal_type getTDC() const
Definition TBTDCRaw.h:42
signal_type isUnderThreshold() const
Definition TBTDCRaw.h:43