Gaudi Framework, version v23r9
Home
Generated: Thu Jul 18 2013
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
GaudiAlg
src
lib
GaudiAlgorithm.cpp
Go to the documentation of this file.
1
// $Id: GaudiAlgorithm.cpp,v 1.12 2008/11/04 22:49:25 marcocle Exp $
2
// ============================================================================
3
#define GAUDIALG_GAUDIALGORITHM_CPP 1
4
// ============================================================================
5
// include files
6
// ============================================================================
7
// GaudiKernel
8
// ============================================================================
9
#include "
GaudiKernel/IAlgContextSvc.h
"
10
#include "
GaudiKernel/DataObject.h
"
11
// ============================================================================
12
// GaudiAlg
13
// ============================================================================
14
#include "
GaudiAlg/GaudiAlgorithm.h
"
15
// ============================================================================
27
// ============================================================================
28
// templated methods
29
// ============================================================================
30
#include "
GaudiCommon.icpp
"
31
// ============================================================================
32
template
class
GaudiCommon<Algorithm>
;
33
// ============================================================================
34
// Standard algorithm like constructor
35
// ============================================================================
36
GaudiAlgorithm::GaudiAlgorithm
(
const
std::string
& name ,
37
ISvcLocator
* pSvcLocator )
38
:
GaudiCommon
<
Algorithm
> ( name , pSvcLocator )
39
//
40
, m_evtColSvc ()
// pointer to Event Tag Collection Service
41
{
42
m_vetoObjs
.
clear
();
43
m_requireObjs
.
clear
();
44
45
setProperty
(
"RegisterForContextService"
,
true
).
ignore
() ;
46
47
declareProperty
(
"VetoObjects"
,
m_vetoObjs
,
48
"Skip execute if one or more of these TES objects exists"
);
49
declareProperty
(
"RequireObjects"
,
m_requireObjs
,
50
"Execute only if one or more of these TES objects exists"
);
51
}
52
// ============================================================================
53
// Destructor
54
// ============================================================================
55
GaudiAlgorithm::~GaudiAlgorithm
() { }
56
// ============================================================================
57
// standard initialization method
58
// ============================================================================
59
StatusCode
GaudiAlgorithm::initialize
()
60
{
61
// initialize the base class
62
const
StatusCode
sc
=
GaudiCommon<Algorithm>::initialize
() ;
63
if
( sc.
isFailure
() ) {
return
sc
; }
64
65
// Add any customisations here, that cannot go in GaudiCommon
66
67
// return
68
return
sc
;
69
}
70
// ============================================================================
71
// standard finalization method
72
// ============================================================================
73
StatusCode
GaudiAlgorithm::finalize
()
74
{
75
if
(
msgLevel
(
MSG::DEBUG
) )
76
debug
() <<
"Finalize base class GaudiAlgorithm"
<<
endmsg
;
77
78
// reset pointers
79
m_evtColSvc
.
reset
() ;
80
81
// finalize the base class and return
82
return
GaudiCommon<Algorithm>::finalize
() ;
83
}
84
// ============================================================================
85
// standard execution method
86
// ============================================================================
87
StatusCode
GaudiAlgorithm::execute
()
88
{
89
return
Error
(
"Default GaudiAlgorithm execute method called !!"
) ;
90
}
91
// ============================================================================
92
// The standard event collection service
93
// ============================================================================
94
SmartIF<INTupleSvc>
&
GaudiAlgorithm::evtColSvc
()
const
95
{
96
if
( !
m_evtColSvc
.
isValid
() )
97
{
m_evtColSvc
= svc< INTupleSvc > (
"EvtTupleSvc"
, true ) ; }
98
//
99
return
m_evtColSvc
;
100
}
101
// ============================================================================
102
/* The generic actions for the execution.
103
* @see Algorithm
104
* @see IAlgorithm
105
* @see Algorithm::sysExecute
106
* @return status code
107
*/
108
// ============================================================================
109
StatusCode
GaudiAlgorithm::sysExecute
()
110
{
111
IAlgContextSvc
* ctx = 0 ;
112
if
(
registerContext
() ) { ctx =
contextSvc
() ; }
113
// Lock the context
114
Gaudi::Utils::AlgContext cnt ( ctx ,
this
) ;
115
116
// Do not execute if one or more of the m_vetoObjs exist in TES
117
for
(
std::vector<std::string>::iterator
it =
m_vetoObjs
.
begin
();
118
it !=
m_vetoObjs
.
end
(); it++ ) {
119
if
( exist<DataObject>(*it) ) {
120
debug
() << *it <<
" found, skipping event "
<<
endmsg
;
121
return
StatusCode::SUCCESS
;
122
}
123
}
124
125
// Execute if m_requireObjs is empty
126
bool
doIt =
m_requireObjs
.
empty
() ?
true
:
false
;
127
128
// Execute also if one or more of the m_requireObjs exist in TES
129
for
(
std::vector<std::string>::iterator
it =
m_requireObjs
.
begin
();
130
it !=
m_requireObjs
.
end
(); it++ ) {
131
if
( exist<DataObject>(*it) ) {
132
doIt =
true
;
133
break
;
134
}
135
}
136
137
if
( doIt )
138
// execute the generic method:
139
return
Algorithm::sysExecute
() ;
140
else
141
return
StatusCode::SUCCESS
;
142
}
143
// ============================================================================
144
145
146
147
148
// ============================================================================
149
// The END
150
// ============================================================================
151
Generated at Thu Jul 18 2013 12:18:01 for Gaudi Framework, version v23r9 by
Doxygen
version 1.8.2 written by
Dimitri van Heesch
, © 1997-2004