ATLAS Offline Software
Loading...
Searching...
No Matches
TBScintillatorContCnv_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 TBScintillatorCont* trans, MsgStream &/*log*/) const
15{
16 const unsigned nScints = pers->m_signal.size();
17
18 // clear the trans contained and reserve space for the new scints
19 trans->clear();
20 trans->reserve(nScints);
21
22 // copy all the scints from the pers to the trans
23 for (unsigned nScintNow=0; nScintNow<nScints; nScintNow++) {
24 TBScintillator * scint = new TBScintillator();
25
26 // fill in the scint properties
27 scint -> setSignal( pers->m_signal[nScintNow] );
28 scint -> setSignalOverflow( pers->m_signal_overflow[nScintNow] );
29 scint -> setTimeSignal( pers->m_time_signal[nScintNow] );
30 scint -> setTimeOverflow( pers->m_time_overflow[nScintNow] );
31 scint -> setDetectorName( pers->m_tbDetectorName[nScintNow] );
32 scint -> setOverflow( pers->m_overflow[nScintNow] );
33
34 // fill the container with the scint object
35 trans->push_back(scint);
36 }
37
38}
39
40
41void
43 TBScintillatorCont_p1* pers, MsgStream &/*log*/) const
44{
45 const unsigned nScints = trans->size();
46
47 pers -> m_signal.reserve(nScints);
48 pers -> m_time_signal.reserve(nScints);
49 pers -> m_signal_overflow.reserve(nScints);
50 pers -> m_time_overflow.reserve(nScints);
51 pers -> m_tbDetectorName.reserve(nScints);
52 pers -> m_overflow.reserve(nScints);
53
54 // iterators for the container
56 TBScintillatorCont::const_iterator scintIt_e = trans->end();
57
58 // copy all the scints from the trans to the pers
59 for (; scintIt!=scintIt_e; ++scintIt) {
60 const TBScintillator * scint = * scintIt;
61
62 // fill in the scint properties
63 pers -> m_signal.push_back( scint->getSignal() );
64 pers -> m_signal_overflow.push_back( scint->isSignalOverflow() );
65 pers -> m_time_signal.push_back( scint->getTimeSignal() );
66 pers -> m_time_overflow.push_back( scint->isTimeOverflow() );
67 pers -> m_tbDetectorName.push_back( scint->getDetectorName() );
68 pers -> m_overflow.push_back( scint->isOverflow() );
69 }
70
71
72}
73
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 TBScintillatorCont *trans, TBScintillatorCont_p1 *pers, MsgStream &log) const override
virtual void persToTrans(const TBScintillatorCont_p1 *pers, TBScintillatorCont *trans, MsgStream &log) const override
std::vector< std::string > m_tbDetectorName
std::vector< float > m_time_signal
std::vector< bool > m_signal_overflow
std::vector< bool > m_overflow
std::vector< bool > m_time_overflow
std::vector< float > m_signal
"TBEvent/TBScintillatorCont.h"
virtual bool isSignalOverflow() const
virtual bool isTimeOverflow() const
virtual float getTimeSignal() const
virtual float getSignal() const