ATLAS Offline Software
TrigRNNOutputContainerCnv_p1.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /**********************************************************************************
6  * @Project: Trigger
7  * @Package: TrigCaloEventTPCnv
8  * @class : TrigRNNOutputContainerCnv_p1
9  *
10  * @brief transient persistent converter for TrigRNNOutputContainer
11  *
12  * @author Danilo Enoque Ferreira de Lima <dferreir@mail.cern.ch> - UFRJ
13  *
14  * $Id$
15  **********************************************************************************/
16 #ifndef TRIGEVENTTPCNV_TRIGRNNOUTPUTCONTAINER_CNV_P1_H
17 #define TRIGEVENTTPCNV_TRIGRNNOUTPUTCONTAINER_CNV_P1_H
18 
20 
24 
25 class TrigRNNOutputContainerCnv_p1 : public T_AthenaPoolTPPtrVectorCnv<TrigRNNOutputContainer, TrigRNNOutputContainer_p1, ITPConverterFor<TrigRNNOutput> > {
26 
27  public:
28 
30 
31  // This part is implemented in T_AthenaPoolTPConverter.h.
32  // It is here temporarily to override and allow some extra debugging
33  virtual void persToTrans(const TrigRNNOutputContainer_p1 *persVect,
34  TrigRNNOutputContainer *transVect,
35  MsgStream &log) {
36  log << MSG::DEBUG << "TrigRNNOutputContainerCnv::persToTrans" << endmsg;
37  if (!persVect) {
38  log << MSG::WARNING << "TrigRNNOutputContainerCnv::persToTrans cannot convert NULL persVect" << endmsg;
39  return;
40  }
41  if (!transVect) {
42  log << MSG::WARNING << "TrigRNNOutputContainerCnv::persToTrans cannot convert to NULL transVect" << endmsg;
43  return;
44  }
45 
46  transVect->clear();
47  transVect->reserve(persVect->size());
48 
49  // convert vector entries one by one
50  for (TrigRNNOutputContainer_p1::const_iterator it = persVect->begin();
51  it != persVect->end(); ++it) {
53  transVect->push_back(p);
54  if (!p)
55  log << MSG::WARNING << "TrigRNNOutputContainerCnv::persToTrans failed for an element " << endmsg;
56  }
57  }
58 
59 
60  virtual void transToPers(const TrigRNNOutputContainer *transVect,
61  TrigRNNOutputContainer_p1 *persVect,
62  MsgStream &log) {
63  if (!persVect) {
64  log << MSG::WARNING << "TrigRNNOutputContainerCnv::transToPers cannot convert NULL persVect" << endmsg;
65  return;
66  }
67  if (!transVect) {
68  log << MSG::WARNING << "TrigRNNOutputContainerCnv::transToPers cannot convert to NULL transVect" << endmsg;
69  return;
70  }
71 
72  persVect->clear();
73  persVect->reserve(transVect->size());
74  // convert vector entries one by one
76  it != transVect->end(); ++it ) {
78  persVect->push_back(a);
79  if (a.isNull()) {
80  log << MSG::WARNING << "TrigRNNOutputContainerCnv::transToPers failed for an element " << *it << " "
81  << m_elementCnv << endmsg;
82  }
83  }
84  }
85 };
86 
87 #endif
88 
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
TrigRNNOutputContainer.h
TrigRNNOutputContainer_p1
Definition: TrigRNNOutputContainer_p1.h:23
skel.it
it
Definition: skel.GENtoEVGEN.py:396
TrigRNNOutputContainerCnv_p1::transToPers
virtual void transToPers(const TrigRNNOutputContainer *transVect, TrigRNNOutputContainer_p1 *persVect, MsgStream &log)
Definition: TrigRNNOutputContainerCnv_p1.h:70
TPObjRef
Definition: TPObjRef.h:20
TrigRNNOutputContainer_p1.h
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
TrigRNNOutputContainerCnv_p1::TrigRNNOutputContainerCnv_p1
TrigRNNOutputContainerCnv_p1()
Definition: TrigRNNOutputContainerCnv_p1.h:39
TrigRNNOutputContainer
Definition: Trigger/TrigEvent/TrigCaloEvent/TrigCaloEvent/TrigRNNOutputContainer.h:13
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
T_AthenaPoolTPConverter.h
TrigRNNOutput
This class carries the output of the Neural Network of TrigMultiVarHypo.
Definition: Trigger/TrigEvent/TrigCaloEvent/TrigCaloEvent/TrigRNNOutput.h:21
DataVector::clear
void clear()
Erase all the elements in the collection.
TrigRNNOutputContainerCnv_p1::persToTrans
virtual void persToTrans(const TrigRNNOutputContainer_p1 *persVect, TrigRNNOutputContainer *transVect, MsgStream &log)
Definition: TrigRNNOutputContainerCnv_p1.h:43
ITPConverterFor::toPersistent
TPObjRef toPersistent(CNV **cnv, const typename CNV::TransBase_t *transObj, MsgStream &log) const
Persistify an object and store the persistent represenation in the storage vector of the top-level pe...
Definition: TPConverter.h:119
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
a
TList * a
Definition: liststreamerinfos.cxx:10
TrigRNNOutputCnv_p1.h
TrigRNNOutputContainerCnv_p1
Definition: TrigRNNOutputContainerCnv_p1.h:25
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
TPPtrVectorCnv::m_elementCnv
CONV * m_elementCnv
pointer to the TP converter used for vector elements
Definition: TPConverter.h:963
TPPtrVectorCnv
Definition: TPConverter.h:919
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.
ITPConverterFor::createTransFromPStore
CNV::Trans_t * createTransFromPStore(CNV **cnv, const TPObjRef &ref, MsgStream &log) const
Create transient representation of a persistent object, stored in the the top-level persistent object...
Definition: TPConverter.h:172