ATLAS Offline Software
Loading...
Searching...
No Matches
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
14void
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
50void
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
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
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.
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 bool isSignalOverflow() const
virtual bool isTimeOverflow() const
virtual float getTimeSignal() const
virtual float getSignal() const
virtual void transToPers(const TBTailCatcher *trans, TBTailCatcher_p1 *pers, MsgStream &log) const override
virtual void persToTrans(const TBTailCatcher_p1 *pers, TBTailCatcher *trans, MsgStream &log) const override
std::vector< bool > m_time_overflow
std::vector< float > m_signal
std::vector< bool > m_overflow
std::vector< double > m_signals
std::vector< std::string > m_tbDetectorName
std::vector< bool > m_signal_overflow
std::vector< float > m_time_signal
const std::vector< signal_type > & getSignals() const
std::vector< double > m_signals
void addScintillator(TBScintillator *thisScint)