ATLAS Offline Software
TBTailCatcherCnv_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 // additional include needed because TBTailCatcher inherits from TBScintillator and has a TBScintillatorCont
12 
13 
14 void
16  TBTailCatcher* trans, MsgStream &/*log*/) const
17 {
18 
19  const unsigned nScints = pers->m_signal.size();
20 
21  // clear the trans contained and reserve space for the new scints
22  trans->clear();
23  trans->reserve(nScints);
24 
25  // copy all the scints from the pers to the trans
26  for (unsigned nScintNow=0; nScintNow<nScints; nScintNow++) {
27  TBScintillator * scint = new TBScintillator();
28 
29  // fill in the scint properties
30  scint -> setSignal( pers->m_signal[nScintNow] );
31  scint -> setSignalOverflow( pers->m_signal_overflow[nScintNow] );
32  scint -> setTimeSignal( pers->m_time_signal[nScintNow] );
33  scint -> setTimeOverflow( pers->m_time_overflow[nScintNow] );
34  scint -> setDetectorName( pers->m_tbDetectorName[nScintNow] );
35  scint -> setOverflow( pers->m_overflow[nScintNow] );
36 
37  // fill the container with the scint object
38  trans->addScintillator(scint);
39 
40 // log << MSG::DEBUG << "\033[34m" << "\t- pers->trans: scint->isOverflow() " << scint->isOverflow() << "\033[0m" <<endmsg;
41  }
42 
43  unsigned int nSignals=pers->m_signals.size();
44  trans->m_signals.reserve(nSignals);
45  trans->m_signals = pers->m_signals;
46 
47 }
48 
49 
50 void
52  TBTailCatcher_p1* pers, MsgStream &/*log*/) const
53 {
54 
55  const unsigned nScints = trans->size();
56 
57  pers -> m_signal.reserve(nScints);
58  pers -> m_time_signal.reserve(nScints);
59  pers -> m_signal_overflow.reserve(nScints);
60  pers -> m_time_overflow.reserve(nScints);
61  pers -> m_tbDetectorName.reserve(nScints);
62  pers -> m_overflow.reserve(nScints);
63 
64  // iterators for the container
65  TBScintillatorCont::const_iterator scintIt = trans->begin();
66  TBScintillatorCont::const_iterator scintIt_e = trans->end();
67 
68  // copy all the scints from the trans to the pers
69  for (; scintIt!=scintIt_e; ++scintIt) {
70  const TBScintillator * scint = * scintIt;
71 
72  // fill in the scint properties
73  pers -> m_signal.push_back( scint->getSignal() );
74  pers -> m_signal_overflow.push_back( scint->isSignalOverflow() );
75  pers -> m_time_signal.push_back( scint->getTimeSignal() );
76  pers -> m_time_overflow.push_back( scint->isTimeOverflow() );
77  pers -> m_tbDetectorName.push_back( scint->getDetectorName() );
78  pers -> m_overflow.push_back( scint->isOverflow() );
79  }
80 
81  pers->m_signals = trans->getSignals();
82 }
83 
DataVector::reserve
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
TBTailCatcher_p1::m_signal
std::vector< float > m_signal
Definition: TBTailCatcher_p1.h:21
TBTailCatcher_p1::m_tbDetectorName
std::vector< std::string > m_tbDetectorName
Definition: TBTailCatcher_p1.h:24
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
TBTailCatcherCnv_p1::persToTrans
virtual void persToTrans(const TBTailCatcher_p1 *pers, TBTailCatcher *trans, MsgStream &log) const override
Definition: TBTailCatcherCnv_p1.cxx:15
TBScintillatorCont.h
TBTailCatcher_p1::m_signal_overflow
std::vector< bool > m_signal_overflow
Definition: TBTailCatcher_p1.h:22
TBScintillator::isSignalOverflow
virtual bool isSignalOverflow() const
Definition: TBScintillator.h:71
TBScintillator::getSignal
virtual float getSignal() const
Definition: TBScintillator.h:67
TBTailCatcher_p1::m_time_signal
std::vector< float > m_time_signal
Definition: TBTailCatcher_p1.h:21
TBTailCatcher_p1.h
TBTailCatcherCnv_p1.h
TBScintillator::getTimeSignal
virtual float getTimeSignal() const
Definition: TBScintillator.h:77
TBTailCatcher_p1::m_overflow
std::vector< bool > m_overflow
Definition: TBTailCatcher_p1.h:25
TBScintillator::isTimeOverflow
virtual bool isTimeOverflow() const
Definition: TBScintillator.h:81
TBTailCatcher
Definition: TBTailCatcher.h:25
TBTailCatcher_p1::m_time_overflow
std::vector< bool > m_time_overflow
Definition: TBTailCatcher_p1.h:22
TBTailCatcher::m_signals
std::vector< double > m_signals
Definition: TBTailCatcher.h:70
TBTailCatcherCnv_p1::transToPers
virtual void transToPers(const TBTailCatcher *trans, TBTailCatcher_p1 *pers, MsgStream &log) const override
Definition: TBTailCatcherCnv_p1.cxx:51
TBBeamDetector::getDetectorName
const std::string & getDetectorName() const
Definition: TBBeamDetector.h:61
DataVector::clear
void clear()
Erase all the elements in the collection.
TBTailCatcher_p1::m_signals
std::vector< double > m_signals
Definition: TBTailCatcher_p1.h:19
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
TBTailCatcher::addScintillator
void addScintillator(TBScintillator *thisScint)
Definition: TBTailCatcher.cxx:39
TBTailCatcher.h
TBScintillator
Definition: TBScintillator.h:25
TBTailCatcher::getSignals
const std::vector< signal_type > & getSignals() const
Definition: TBTailCatcher.cxx:58
TBBeamDetector::isOverflow
bool isOverflow() const
Definition: TBBeamDetector.h:64
TBTailCatcher_p1
Definition: TBTailCatcher_p1.h:15
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.