ATLAS Offline Software
Loading...
Searching...
No Matches
LArRawChannelContainerCnv_p2.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
8
9
10// LArRawChannelContainerCnv_p2, used for T/P separation
11// author R.Seuster <seuster@cern.ch>
12
15//#include "LArTPCnv/LArRawChannelCollection_p2.h"
16//#include "DataModel/DataPool.h"
17
18void LArRawChannelContainerCnv_p2::transToPers(const LArRawChannelContainer* /*transCont*/, LArRawChannelContainer_p2* /*persCont*/, MsgStream &log) const
19{
20
21 log << MSG::ERROR << "Writing LArRawChannelContainer_p2 not supported any more. Current version is LArRawChannelContainer_p3" << endmsg;
22 return;
23}
24
25/*
26 //LArRawChannelContainer_Cnvp1_base_t::transToPers(trans,pers,log);
27
28 // The transient model has a container holding collections and the
29 // collections hold channels.
30 //
31 // The persistent model flattens this so that the persistent
32 // container has two vectors:
33 // 1) all collections, and
34 // 2) all channels
35 //
36 // The persistent collections, then only maintain indexes into the
37 // container's vector of all channels.
38 //
39 // So here we loop over all collection and add their channels
40 // to the container's vector, saving the indexes in the
41 // collection.
42
43 typedef LArRawChannelContainer TRANS;
44
45 LArRawChannelCnv_p1 chanCnv;
46 TRANS::const_iterator it_Coll = transCont->begin();
47 TRANS::const_iterator it_CollEnd = transCont->end();
48 unsigned int collIndex;
49 unsigned int chanBegin = 0;
50 unsigned int chanEnd = 0;
51 persCont->m_collections.resize(transCont->numberOfCollections());
52 for (collIndex = 0; it_Coll != it_CollEnd; ++collIndex, it_Coll++) {
53 // Add in new collection
54 const LArRawChannelCollection& collection = (**it_Coll);
55 chanBegin = chanEnd;
56 chanEnd += collection.size();
57 LArRawChannelCollection_p2& pcollection = persCont->m_collections[collIndex];
58 pcollection.m_id = collection.identify().id();
59 pcollection.m_begin = chanBegin;
60 pcollection.m_end = chanEnd;
61 // Add in channels
62 persCont->m_channels.resize(chanEnd);
63 for (unsigned int i = 0; i < collection.size(); ++i) {
64 LArRawChannel_p1* pchan = &(persCont->m_channels[i + chanBegin]);
65 const LArRawChannel* chan = collection[i];
66 chanCnv.transToPers(chan, pchan, log);
67 }
68 }
69
70
71 log << MSG::DEBUG << " *** Writing LArRawChannelContainer" << endmsg;
72}
73
74*/
75
76
78{
79 //LArRawChannelContainer_Cnvp1_base_t::persToTrans(pers,trans,log);
80
81 // The transient model has a container holding collections and the
82 // collections hold channels.
83 //
84 // The persistent model flattens this so that the persistent
85 // container has two vectors:
86 // 1) all collections, and
87 // 2) all channels
88 //
89 // The persistent collections, then only maintain indexes into the
90 // container's vector of all channels.
91 //
92 // So here we loop over all collection and extract their channels
93 // from the vector.
94
95
96
97 std::size_t nChannels=persCont->m_channels.size();
98 transCont->resize(nChannels);
99 for (std::size_t i=0;i<nChannels;++i)
100 m_larRawChannelCnv_p1.persToTrans(&(persCont->m_channels[i]),&(transCont->at(i)),log);
101
102 log << MSG::DEBUG << " *** Reading LArRawChannelContainer" << endmsg;
103}
#define endmsg
virtual void transToPers(const LArRawChannelContainer *transColl, LArRawChannelContainer_p2 *persColl, MsgStream &log) const override
virtual void persToTrans(const LArRawChannelContainer_p2 *persColl, LArRawChannelContainer *transColl, MsgStream &log) const override
Persistent LArRawChannelContainer, version p2.
std::vector< LArRawChannel_p1 > m_channels
Container for LArRawChannel (IDC using LArRawChannelCollection)