ATLAS Offline Software
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 
6 #include "TBEvent/TBTDCRawCont.h"
7 #include "Identifier/Identifier.h"
9 
10 
11 
12 void
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 
39 void
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 
DataVector::reserve
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
TBTDCRaw
Definition: TBTDCRaw.h:21
TBBeamDetector::getDetectorName
std::string getDetectorName() const
Definition: TBBeamDetector.h:61
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
TBTDCRawContCnv_p1::transToPers
virtual void transToPers(const TBTDCRawCont *trans, TBTDCRawCont_p1 *pers, MsgStream &log) const override
Definition: TBTDCRawContCnv_p1.cxx:40
TBTDCRawCont_p1::m_tdc
std::vector< signal_type > m_tdc
Definition: TBTDCRawCont_p1.h:21
TBTDCRawContCnv_p1::persToTrans
virtual void persToTrans(const TBTDCRawCont_p1 *pers, TBTDCRawCont *trans, MsgStream &log) const override
Definition: TBTDCRawContCnv_p1.cxx:13
TBTDCRawCont_p1::m_underThreshold
std::vector< bool > m_underThreshold
Definition: TBTDCRawCont_p1.h:22
TBTDCRawCont_p1
Definition: TBTDCRawCont_p1.h:15
TBTDCRawContCnv_p1.h
TBTDCRawCont.h
TBTDCRawCont_p1.h
TBTDCRawCont
Definition: TBTDCRawCont.h:21
DataVector::clear
void clear()
Erase all the elements in the collection.
TBTDCRawCont_p1::m_overflow
std::vector< bool > m_overflow
Definition: TBTDCRawCont_p1.h:25
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.
TBTDCRaw::getTDC
signal_type getTDC() const
Definition: TBTDCRaw.h:42
TBBeamDetector::isOverflow
bool isOverflow() const
Definition: TBBeamDetector.h:64
TBTDCRawCont_p1::m_tbDetectorName
std::vector< std::string > m_tbDetectorName
Definition: TBTDCRawCont_p1.h:24
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
TBTDCRaw::isUnderThreshold
signal_type isUnderThreshold() const
Definition: TBTDCRaw.h:43
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.