ATLAS Offline Software
Loading...
Searching...
No Matches
RootReaderD3PDSvc.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5
6// Gaudi/Athena include(s):
8
9// Local include(s):
10#include "RootReaderD3PDSvc.h"
11#include "RootReaderD3PD_v1.h"
12#include "RootReaderD3PD_v2.h"
13
14namespace D3PD {
15
16 RootReaderD3PDSvc::RootReaderD3PDSvc( const std::string& name, ISvcLocator* svcloc )
17 : base_class( name, svcloc ) {
18
19 declareProperty( "Version", m_version = 2,
20 "Version of the D3PDReader code to be generated" );
21 }
22
24
25 if( ( m_version < 1 ) || ( m_version > 2 ) ) {
26 REPORT_MESSAGE( MSG::ERROR ) << "D3PDReader version " << m_version
27 << " not known";
28 return StatusCode::FAILURE;
29 }
30
31 ATH_MSG_INFO( "Generating sources of version: " << m_version );
32
33 return StatusCode::SUCCESS;
34 }
35
37
38 // Delete all the D3PD objects from memory:
39 std::vector< ID3PD* >::iterator itr = m_d3pds.begin();
40 std::vector< ID3PD* >::iterator end = m_d3pds.end();
41 for( ; itr != end; ++itr ) {
42 delete ( *itr );
43 }
44 m_d3pds.clear();
45
46 return StatusCode::SUCCESS;
47 }
48
49 StatusCode RootReaderD3PDSvc::make( const std::string& name, ID3PD*& d3pd ) {
50
51 // Create a new D3PD:
52 ID3PD* d = 0;
53 switch( m_version ) {
54 case 1:
55 REPORT_MESSAGE( MSG::VERBOSE ) << "Creating RootReaderD3PD_v1 with name: "
56 << name;
57 d = new RootReaderD3PD_v1();
58 break;
59 case 2:
60 REPORT_MESSAGE( MSG::VERBOSE ) << "Creating RootReaderD3PD_v2 with name: "
61 << name;
62 d = new RootReaderD3PD_v2();
63 break;
64 default:
65 REPORT_MESSAGE( MSG::ERROR ) << "Version number not recognised!";
66 return StatusCode::FAILURE;
67 break;
68 }
69
70 m_d3pds.push_back( d );
71 d3pd = d;
72
73 // This function can actually never fail...
74 return StatusCode::SUCCESS;
75 }
76
77} // namespace D3PD
#define ATH_MSG_INFO(x)
Helpers for checking error return status codes and reporting errors.
#define REPORT_MESSAGE(LVL)
Report a message.
Define an abstract interface for building a D3PD tree.
Definition ID3PD.h:37
RootReaderD3PDSvc(const std::string &name, ISvcLocator *svcloc)
Standard Service constructor.
virtual StatusCode make(const std::string &name, ID3PD *&d3pd) override
Function implementing the ID3PDSvc interface.
std::vector< ID3PD * > m_d3pds
Internal list of all the created D3PD objects.
virtual StatusCode initialize() override
Standatd Gaudi initialization function.
int m_version
D3PDReader version to use.
virtual StatusCode finalize() override
Standard Gaudi finalization function.
D3PD class used for generating ROOT D3PDReader classes.
D3PD class used for generating ROOT D3PDReader classes.
Block filler tool for noisy FEB information.