ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Generators
GeneratorModules
src
GenBase.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
#include "
GeneratorModules/GenBase.h
"
6
#include "GaudiKernel/ISvcLocator.h"
7
#include "GaudiKernel/DataSvc.h"
8
#include <fstream>
9
10
11
GenBase::GenBase
(
const
std::string& name, ISvcLocator* pSvcLocator)
12
:
AthAlgorithm
(name, pSvcLocator)
13
{
14
}
15
16
17
StatusCode
GenBase::initialize
() {
18
ATH_CHECK
(
m_mcevents_const
.initialize() );
19
m_mcEventKey
=
m_mcevents_const
.key();
20
21
return
StatusCode::SUCCESS;
22
}
23
24
26
McEventCollection
* GenBase::events
ATLAS_NOT_CONST_THREAD_SAFE
() {
27
// Make a new MC event collection if necessary
28
McEventCollection
* mcevents =
nullptr
;
29
if
(!evtStore()->
contains<McEventCollection>
(m_mcEventKey) && m_mkMcEvent) {
30
ATH_MSG_DEBUG
(
"Creating new McEventCollection in the event store"
);
31
mcevents =
new
McEventCollection
();
32
if
(evtStore()->record(mcevents, m_mcEventKey).isFailure())
33
ATH_MSG_ERROR
(
"Failed to record a new McEventCollection"
);
34
}
35
else
{
36
const
McEventCollection
* mecc = 0;
37
38
if
(evtStore()->retrieve (mecc, m_mcEventKey).isFailure())
39
ATH_MSG_ERROR
(
"Failed to retrieve McEventCollection"
);
40
41
mcevents =
const_cast<
McEventCollection
*
>
(&(*mecc));
42
}
43
44
return
mcevents;
45
}
46
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
ATLAS_NOT_CONST_THREAD_SAFE
McEventCollection *GenBase::events ATLAS_NOT_CONST_THREAD_SAFE()
Access the current event's McEventCollection.
Definition
GenBase.cxx:26
GenBase.h
McEventCollection
McEventCollection
Definition
GeneratorObjectsTPCnv.cxx:60
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
GenBase::m_mcEventKey
std::string m_mcEventKey
StoreGate key for the MC event collection (defaults to GEN_EVENT).
Definition
GenBase.h:108
GenBase::initialize
virtual StatusCode initialize() override
Definition
GenBase.cxx:17
GenBase::GenBase
GenBase(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
GenBase.cxx:11
GenBase::m_mcevents_const
SG::ReadHandleKey< McEventCollection > m_mcevents_const
Const handle to the MC event collection.
Definition
GenBase.h:117
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
Definition
McEventCollection.h:31
contains
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
Definition
hcg.cxx:116
Generated on
for ATLAS Offline Software by
1.17.0