ATLAS Offline Software
CaloRingsCnv_p1.cxx
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // CaloRingsCnv_p1.cxx
8 // Implementation file for class CaloRingsCnv_p1
9 // Author: D.E.Ferreira de Lima<dferreir@mail.cern.ch>
11 
12 
13 // STL includes
14 
15 // egammaEvent includes
16 #include "egammaEvent/CaloRings.h"
17 
18 #include "GaudiKernel/GaudiException.h"
19 
20 // egammaEventTPCnv includes
22 
24  CaloRings* trans,
25  MsgStream& /*msg*/ )
26 {
27  if ( (!trans) || (!pers) ) {
28  throw GaudiException("CaloRingsCnv_p1::persToTrans called with NULL pers or trans!","CaloRingsCnv_p1::persToTrans", StatusCode::FAILURE);
29  return;
30  }
31 
32 
33  trans->clear();
34  unsigned int layerNumber = 0;
35  unsigned int ringNumber = 0;
36  // for each ringset
37  for (unsigned int i = 0; i < pers->m_nRings.size(); ++i) {
38  // translate layer information
39  std::vector<CaloCell_ID::CaloSample> layers;
40  for (unsigned int j = 0; j < pers->m_nLayers[i]; ++j) {
41  layers.push_back((CaloCell_ID::CaloSample) pers->m_layers[layerNumber++]);
42  }
43  // insert configuration
44  trans->addRingSet(pers->m_nRings[i], layers, pers->m_deltaEta[i], pers->m_deltaPhi[i]);
45  // copy ring values
46  for (unsigned int k = 0; k < pers->m_nRings[i]; ++k){
47  trans->at(i).at(k) = pers->m_rings[ringNumber++];
48  }
49  }
50 
51 }
52 
54  CaloRings_p1* pers,
55  MsgStream& /*msg*/ )
56 {
57  if ( (!trans) || (!pers) ) {
58  throw GaudiException("CaloRingsCnv_p1::transToPers called with NULL pers or trans!","CaloRingsCnv_p1::transToPers", StatusCode::FAILURE);
59  return;
60  }
61 
62  pers->m_nRings.clear();
63  pers->m_rings.clear();
64  pers->m_nLayers.clear();
65  pers->m_layers.clear();
66  pers->m_deltaEta.clear();
67  pers->m_deltaPhi.clear();
68 
69  for (unsigned int i = 0; i < trans->size(); ++i) {
70  pers->m_nRings.push_back(trans->at(i).m_rings.size());
71  for (unsigned int j = 0; j < trans->at(i).m_rings.size(); ++j) {
72  pers->m_rings.push_back(trans->at(i).m_rings[j]);
73  }
74  pers->m_nLayers.push_back(trans->at(i).m_layers.size());
75  for (unsigned int k = 0; k < trans->at(i).m_layers.size(); ++k) {
76  pers->m_layers.push_back((int) trans->at(i).m_layers[k]);
77  }
78  pers->m_deltaEta.push_back(trans->at(i).m_deltaEta);
79  pers->m_deltaPhi.push_back(trans->at(i).m_deltaPhi);
80  }
81 }
CaloRings::size
size_t size() const
Definition: CaloRings.cxx:139
RingSet::at
float & at(unsigned int i)
RingSet ///.
Definition: CaloRings.cxx:11
CaloRings_p1::m_nRings
std::vector< unsigned int > m_nRings
Definition: CaloRings_p1.h:53
module_driven_slicing.layers
layers
Definition: module_driven_slicing.py:114
CaloRingsCnv_p1::transToPers
virtual void transToPers(const CaloRings *transObj, CaloRings_p1 *persObj, MsgStream &msg)
Method creating the persistent representation CaloRings_p1 from its transient representation CaloRing...
Definition: CaloRingsCnv_p1.cxx:53
CaloRings
Definition: Reconstruction/egamma/egammaEvent/egammaEvent/CaloRings.h:58
CaloRings::at
RingSet & at(unsigned int i)
Definition: CaloRings.cxx:164
RingSet::m_rings
std::vector< float > m_rings
Definition: Reconstruction/egamma/egammaEvent/egammaEvent/CaloRings.h:17
CaloRings_p1::m_rings
std::vector< float > m_rings
Ring information.
Definition: CaloRings_p1.h:52
RingSet::size
size_t size() const
Definition: CaloRings.cxx:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
CaloRings_p1::m_nLayers
std::vector< unsigned int > m_nLayers
Definition: CaloRings_p1.h:56
RingSet::m_layers
std::vector< CaloCell_ID::CaloSample > m_layers
Definition: Reconstruction/egamma/egammaEvent/egammaEvent/CaloRings.h:19
CaloRingsCnv_p1::persToTrans
virtual void persToTrans(const CaloRings_p1 *persObj, CaloRings *transObj, MsgStream &msg)
Method creating the transient representation of CaloRings from its persistent representation CaloRing...
Definition: CaloRingsCnv_p1.cxx:23
CaloRings_p1::m_deltaEta
std::vector< float > m_deltaEta
Definition: CaloRings_p1.h:58
RingSet::m_deltaPhi
float m_deltaPhi
Definition: Reconstruction/egamma/egammaEvent/egammaEvent/CaloRings.h:24
CaloRingsCnv_p1.h
CaloRings::clear
void clear()
Definition: CaloRings.cxx:134
CaloRings_p1
Definition: CaloRings_p1.h:25
RingSet::m_deltaEta
float m_deltaEta
Definition: Reconstruction/egamma/egammaEvent/egammaEvent/CaloRings.h:23
CaloRings.h
CaloRings_p1::m_layers
std::vector< int > m_layers
Definition: CaloRings_p1.h:55
CaloRings::addRingSet
void addRingSet(unsigned int numberOfRings, std::vector< CaloCell_ID::CaloSample > &layers, float deltaEta, float deltaPhi)
Definition: CaloRings.cxx:118
CaloRings_p1::m_deltaPhi
std::vector< float > m_deltaPhi
Definition: CaloRings_p1.h:59
fitman.k
k
Definition: fitman.py:528