ATLAS Offline Software
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 
12 void
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 
41 void
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
55  TBScintillatorCont::const_iterator scintIt = trans->begin();
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 
DataVector::reserve
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
TBScintillatorCont_p1::m_time_overflow
std::vector< bool > m_time_overflow
Definition: TBScintillatorCont_p1.h:20
TBScintillatorCont.h
TBScintillator::isSignalOverflow
virtual bool isSignalOverflow() const
Definition: TBScintillator.h:71
TBScintillator::getSignal
virtual float getSignal() const
Definition: TBScintillator.h:67
TBScintillatorCont
Definition: TBScintillatorCont.h:19
TBScintillatorCont_p1::m_tbDetectorName
std::vector< std::string > m_tbDetectorName
Definition: TBScintillatorCont_p1.h:22
TBScintillator::getTimeSignal
virtual float getTimeSignal() const
Definition: TBScintillator.h:77
TBScintillatorCont_p1::m_overflow
std::vector< bool > m_overflow
Definition: TBScintillatorCont_p1.h:23
TBScintillator::isTimeOverflow
virtual bool isTimeOverflow() const
Definition: TBScintillator.h:81
TBScintillatorCont_p1.h
TBScintillatorCont_p1
Definition: TBScintillatorCont_p1.h:15
TBScintillatorCont_p1::m_time_signal
std::vector< float > m_time_signal
Definition: TBScintillatorCont_p1.h:19
TBScintillatorContCnv_p1::persToTrans
virtual void persToTrans(const TBScintillatorCont_p1 *pers, TBScintillatorCont *trans, MsgStream &log) const override
Definition: TBScintillatorContCnv_p1.cxx:13
TBBeamDetector::getDetectorName
const std::string & getDetectorName() const
Definition: TBBeamDetector.h:61
DataVector::clear
void clear()
Erase all the elements in the collection.
TBScintillatorContCnv_p1.h
TBScintillatorCont_p1::m_signal
std::vector< float > m_signal
Definition: TBScintillatorCont_p1.h:19
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.
TBScintillatorCont_p1::m_signal_overflow
std::vector< bool > m_signal_overflow
Definition: TBScintillatorCont_p1.h:20
TBScintillator
Definition: TBScintillator.h:25
TBScintillatorContCnv_p1::transToPers
virtual void transToPers(const TBScintillatorCont *trans, TBScintillatorCont_p1 *pers, MsgStream &log) const override
Definition: TBScintillatorContCnv_p1.cxx:42
TBBeamDetector::isOverflow
bool isOverflow() const
Definition: TBBeamDetector.h:64
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.