ATLAS Offline Software
Loading...
Searching...
No Matches
CaloTopoTowerContainerCnv.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7// LArDetDescr includes
9
10// Gaudi
11#include "GaudiKernel/MsgStream.h"
12#include "GaudiKernel/IToolSvc.h"
13#include "GaudiKernel/ThreadLocalContext.h"
14
15// Athena
17
18
20 :
21 // Base class constructor
23{}
24
26 MsgStream log(msgSvc(), "CaloTopoTowerContainerCnv::createTransient" );
27 CaloTopoTowerContainer* Cont = 0;
28 if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << "Starting CaloTopoTowerContainerCnv::PoolToDataObject" << endmsg;
30 if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << "Read version p0 of CaloTopoTowerContainer. GUID="
31 << m_classID.toString() << endmsg;
33 }
34 else if(compareClassGuid(p1_guid)) {
35 if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << "Read version p1 of CaloTopoTowerContainer. GUID="
36 << m_classID.toString() << endmsg;
38 Cont=new CaloTopoTowerContainer();
39 m_converter.persToTrans(pers,Cont,log);
40 delete pers;
41 }
42 if (!Cont) {
43 log << MSG::FATAL << "Unable to get object from pool" << endmsg;
44 return Cont;
45 }
46
47 Cont->init();
48
49 // rebuild the CaloTopoTowers in the container.
50 const EventContext& ctx = Gaudi::Hive::currentContext();
51
52 m_TopoTowerBldr= getTool("CaloTopoTowerBuilderTool","TopoTowerTwrBldr");
53 if(!m_TopoTowerBldr){
54 log<<MSG::ERROR<< " Failed to create CaloTopoTowerContainer " <<endmsg;
55 return 0;
56 }
57 if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << "creating CaloTopoTowerContainerCnv::PoolToDataObject" << endmsg;
58 StatusCode scfcal = m_TopoTowerBldr->execute(ctx, Cont);
59 if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<" TopoTowers rebuild m_TopoTowerBldr->execute(Cont); Successful "<<endmsg;
60 if (scfcal.isFailure()) {
61 log<<MSG::ERROR<<" TopoTowers rebuild failed "<<endmsg;
62 }
63 if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<" TopoTowers rebuild worked "<<endmsg;
64
65 return Cont;
66}
67
69 MsgStream log(msgSvc(), "CaloTopoTowerContainerCnv::createPersistent");
70 if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << "Writing CaloTopoTowerContainer_p1" << endmsg;
72 m_converter.transToPers(trans,pers,log);
73 return pers;
74}
75
76
78const std::string& type, const std::string& nm)
79{
80 SmartIF<IToolSvc> myToolSvc{Gaudi::svcLocator()->service("ToolSvc")};
81 if(!myToolSvc.isValid()) {
82 ATH_MSG_ERROR("Cannot locate ToolSvc");
83 return 0;
84 }
85
87 // Allocate Tools //
89
90 IAlgTool* algToolPtr;
91 StatusCode sc = myToolSvc->retrieveTool(type,nm,algToolPtr);
92 // tool not found
93 if ( sc.isFailure() )
94 {
95 ATH_MSG_INFO("Cannot find tool named <"
96 << type << "/" << nm
97 << ">");
98 return 0;
99 }
100 return dynamic_cast<CaloTopoTowerBuilderToolBase*>(algToolPtr);
101
102}
#define endmsg
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
Definition of CaloDetDescrManager.
T_AthenaPoolCustomCnv< CaloTopoTowerContainer, CaloTopoTowerContainerPERS > CaloTopoTowerContainerCnvBase
CaloTopoTowerContainer_p1 CaloTopoTowerContainerPERS
static Double_t sc
CaloTopoTowerBuilderToolBase is abstract base class for tower builders.
virtual CaloTopoTowerContainerPERS * createPersistent(CaloTopoTowerContainer *) override
virtual CaloTopoTowerContainer * createTransient() override
CaloTopoTowerBuilderToolBase * m_TopoTowerBldr
CaloTopoTowerBuilderToolBase * getTool(const std::string &type, const std::string &nm)
CaloTopoTowerContainerCnv(ISvcLocator *svcloc)
CaloTopoTowerContainerCnv_p1 m_converter
Storable container class for CaloTower.
void init()
Initializes the CaloTowerContainer.