ATLAS Offline Software
TBBPCContCnv_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/TBBPCCont.h"
7 #include "Identifier/Identifier.h"
8 #include "TBTPCnv/TBBPCCont_p1.h"
9 
10 
11 
12 void
14  TBBPCCont* trans, MsgStream &/*log*/) const
15 {
16  const unsigned nTBBPCs = pers->m_xPos.size();
17 
18  // clear the trans contained and reserve space for the new BPCs
19  trans->clear();
20  trans->reserve(nTBBPCs);
21 
22  // copy all the BPCs from the pers to the trans
23  for (unsigned nTBBPCNow=0; nTBBPCNow<nTBBPCs; nTBBPCNow++) {
24  TBBPC * BPC = new TBBPC();
25 
26  BPC -> setXPos( pers->m_xPos[nTBBPCNow] );
27  BPC -> setYPos( pers->m_yPos[nTBBPCNow] );
28  BPC -> setXErr( pers->m_xErr[nTBBPCNow] );
29  BPC -> setYErr( pers->m_yErr[nTBBPCNow] );
30  BPC -> setXPulse( pers->m_xPulse[nTBBPCNow] );
31  BPC -> setYPulse( pers->m_yPulse[nTBBPCNow] );
32  BPC -> setHitNbr( pers->m_hitnumber[nTBBPCNow] );
33  BPC -> setXPosOverflow( pers->m_xPosOverflow[nTBBPCNow] );
34  BPC -> setYPosOverflow( pers->m_yPosOverflow[nTBBPCNow] );
35  BPC -> setXPulseOverflow( pers->m_xPulseOverflow[nTBBPCNow] );
36  BPC -> setYPulseOverflow( pers->m_yPulseOverflow[nTBBPCNow] );
37 
38  BPC -> setDetectorName( pers->m_tbDetectorName[nTBBPCNow] );
39  BPC -> setOverflow( pers->m_overflow[nTBBPCNow] );
40 
41  // fill the container with the scint object
42  trans->push_back(BPC);
43 // log << MSG::DEBUG << "\033[34m" << "\t- pers->trans: BPC->getYPulse() " << BPC->getYPulse() << "\033[0m" <<endmsg;
44  }
45 
46 }
47 
48 
49 void
51  TBBPCCont_p1* pers, MsgStream &/*log*/) const
52 {
53 
54  const unsigned nTBBPCs = trans->size();
55 
56  pers -> m_xPos.reserve(nTBBPCs);
57  pers -> m_yPos.reserve(nTBBPCs);
58  pers -> m_xErr.reserve(nTBBPCs);
59  pers -> m_yErr.reserve(nTBBPCs);
60  pers -> m_xPulse.reserve(nTBBPCs);
61  pers -> m_yPulse.reserve(nTBBPCs);
62  pers -> m_hitnumber.reserve(nTBBPCs);
63  pers -> m_xPosOverflow.reserve(nTBBPCs);
64  pers -> m_yPosOverflow.reserve(nTBBPCs);
65  pers -> m_xPulseOverflow.reserve(nTBBPCs);
66  pers -> m_yPulseOverflow.reserve(nTBBPCs);
67  pers -> m_overflowSetFlag.reserve(nTBBPCs);
68  pers -> m_tbDetectorName.reserve(nTBBPCs);
69  pers -> m_overflow.reserve(nTBBPCs);
70 
71 
72  // iterators for the container
73  TBBPCCont::const_iterator BPCIt = trans->begin();
74  TBBPCCont::const_iterator BPCIt_e = trans->end();
75 
76  // copy all the scints from the trans to the pers
77  for (; BPCIt!=BPCIt_e; ++BPCIt) {
78  const TBBPC * BPC = * BPCIt;
79 
80  // fill in the scint properties
81  pers -> m_xPos.push_back( BPC->getXPos() );
82  pers -> m_yPos.push_back( BPC->getYPos() );
83  pers -> m_xErr.push_back( BPC->getXErr() );
84  pers -> m_yErr.push_back( BPC->getYErr() );
85  pers -> m_xPulse.push_back( BPC->getXPulse() );
86  pers -> m_yPulse.push_back( BPC->getYPulse() );
87  pers -> m_hitnumber.push_back( BPC->getHitNbr() );
88  pers -> m_xPosOverflow.push_back( BPC->isXPosOverflow() );
89  pers -> m_yPosOverflow.push_back( BPC->isYPosOverflow() );
90  pers -> m_xPulseOverflow.push_back( BPC->isXPulseOverflow() );
91  pers -> m_yPulseOverflow.push_back( BPC->isYPulseOverflow() );
92 
93  pers -> m_overflowSetFlag.push_back( false );
94 
95  pers -> m_tbDetectorName.push_back( BPC->getDetectorName() );
96  pers -> m_overflow.push_back( BPC->isOverflow() );
97  }
98 
99 
100 }
101 
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
TBBPC::getXPos
signal_type getXPos() const
Definition: TBBPC.h:75
TBBPCContCnv_p1::transToPers
virtual void transToPers(const TBBPCCont *trans, TBBPCCont_p1 *pers, MsgStream &log) const override
Definition: TBBPCContCnv_p1.cxx:50
TBBPC
Definition: TBBPC.h:23
TBBPC::isYPulseOverflow
bool isYPulseOverflow() const
Definition: TBBPC.h:99
TBBPCCont_p1.h
TBBPC::isYPosOverflow
bool isYPosOverflow() const
Definition: TBBPC.h:95
TBBPCCont_p1::m_yPulseOverflow
std::vector< bool > m_yPulseOverflow
Definition: TBBPCCont_p1.h:33
TBBPCCont_p1::m_hitnumber
std::vector< short > m_hitnumber
Definition: TBBPCCont_p1.h:29
TBBPCCont_p1::m_tbDetectorName
std::vector< std::string > m_tbDetectorName
Definition: TBBPCCont_p1.h:37
TBBPC::getYPos
signal_type getYPos() const
Definition: TBBPC.h:77
TBBPC::getXPulse
signal_type getXPulse() const
Definition: TBBPC.h:85
TBBPCCont_p1::m_yPulse
std::vector< signal_type > m_yPulse
Definition: TBBPCCont_p1.h:26
TBBPCCont_p1
Definition: TBBPCCont_p1.h:15
TBBeamDetector::getDetectorName
const std::string & getDetectorName() const
Definition: TBBeamDetector.h:61
TBBPCCont_p1::m_xPos
std::vector< signal_type > m_xPos
Definition: TBBPCCont_p1.h:22
DataVector::clear
void clear()
Erase all the elements in the collection.
TBBPC::isXPulseOverflow
bool isXPulseOverflow() const
Definition: TBBPC.h:97
TBBPCCont.h
TBBPC::getXErr
signal_type getXErr() const
Definition: TBBPC.h:80
TBBPCCont_p1::m_xPulse
std::vector< signal_type > m_xPulse
Definition: TBBPCCont_p1.h:26
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
TBBPCCont_p1::m_xPulseOverflow
std::vector< bool > m_xPulseOverflow
Definition: TBBPCCont_p1.h:33
TBBPC::getYPulse
signal_type getYPulse() const
Definition: TBBPC.h:87
TBBPC::isXPosOverflow
bool isXPosOverflow() const
Definition: TBBPC.h:93
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
TBBPCCont_p1::m_yErr
std::vector< signal_type > m_yErr
Definition: TBBPCCont_p1.h:23
TBBPCCont_p1::m_overflow
std::vector< bool > m_overflow
Definition: TBBPCCont_p1.h:38
TBBPCCont_p1::m_yPosOverflow
std::vector< bool > m_yPosOverflow
Definition: TBBPCCont_p1.h:32
TBBPCContCnv_p1::persToTrans
virtual void persToTrans(const TBBPCCont_p1 *pers, TBBPCCont *trans, MsgStream &log) const override
Definition: TBBPCContCnv_p1.cxx:13
TBBPCCont_p1::m_xPosOverflow
std::vector< bool > m_xPosOverflow
Definition: TBBPCCont_p1.h:32
TBBPCCont_p1::m_yPos
std::vector< signal_type > m_yPos
Definition: TBBPCCont_p1.h:22
TBBPC::getYErr
signal_type getYErr() const
Definition: TBBPC.h:82
TBBeamDetector::isOverflow
bool isOverflow() const
Definition: TBBeamDetector.h:64
TBBPCContCnv_p1.h
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
TBBPC::getHitNbr
int getHitNbr() const
Definition: TBBPC.h:89
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
TBBPCCont
Definition: TBBPCCont.h:17
TBBPCCont_p1::m_xErr
std::vector< signal_type > m_xErr
Definition: TBBPCCont_p1.h:23