ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonTruthAlgs
src
MuonPatternCombinationDetailedTrackTruthMaker.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// Algorithm producing truth info for PrepRawData, keeping all MC particles contributed to a PRD.
6
// A. Gaponenko, 2006
7
8
#include "
MuonTruthAlgs/MuonPatternCombinationDetailedTrackTruthMaker.h
"
9
10
#include <iterator>
11
12
#include "
MuonPattern/DetailedMuonPatternTruthCollection.h
"
13
#include "
TrkTrack/TrackCollection.h
"
14
#include "
TrkTruthData/DetailedTrackTruthCollection.h
"
15
#include "
TrkTruthData/PRD_MultiTruthCollection.h
"
16
17
//================================================================
18
MuonPatternCombinationDetailedTrackTruthMaker::MuonPatternCombinationDetailedTrackTruthMaker
(
const
std::string &name,
19
ISvcLocator *pSvcLocator) :
20
AthAlgorithm
(name, pSvcLocator) {
21
if
(
m_detailedTrackTruthName
.empty())
m_detailedTrackTruthName
= (
m_trackCollectionName
+
"Truth"
);
22
}
23
24
// -----------------------------------------------------------------------------------------------------
25
StatusCode
MuonPatternCombinationDetailedTrackTruthMaker::initialize
() {
26
ATH_MSG_DEBUG
(
"MuonPatternCombinationDetailedTrackTruthMaker::initialize()"
);
27
ATH_CHECK
(
m_truthTool
.retrieve());
28
return
StatusCode::SUCCESS;
29
}
30
31
// -----------------------------------------------------------------------------------------------------
32
StatusCode
MuonPatternCombinationDetailedTrackTruthMaker::execute
(
const
EventContext&
/*ctx*/
) {
33
ATH_MSG_DEBUG
(
"MuonPatternCombinationDetailedTrackTruthMaker::execute()"
);
34
35
StatusCode
sc
;
36
37
//----------------------------------------------------------------
38
// Retrieve prep raw data truth
39
std::vector<const PRD_MultiTruthCollection *> prdCollectionVector;
40
for
(std::vector<std::string>::const_iterator ikey =
m_PRD_TruthNames
.begin(); ikey !=
m_PRD_TruthNames
.end(); ++ikey) {
41
prdCollectionVector.push_back(
nullptr
);
42
sc
=
evtStore
()->retrieve(*prdCollectionVector.rbegin(), *ikey);
43
if
(!
sc
.isSuccess()) {
44
ATH_MSG_WARNING
(
"PRD_MultiTruthCollection "
<< *ikey <<
" NOT found"
);
45
}
else
{
46
ATH_MSG_DEBUG
(
"Got PRD_MultiTruthCollection "
<< *ikey);
47
}
48
}
49
50
//----------------------------------------------------------------
51
// Retrieve track collections
52
53
const
TrackCollection
*tracks =
nullptr
;
54
if
(
evtStore
()->
contains<TrackCollection>
(
m_trackCollectionName
) &&
evtStore
()->retrieve(tracks,
m_trackCollectionName
).isSuccess()) {
55
ATH_MSG_DEBUG
(
"Got TrackCollection "
<<
m_trackCollectionName
);
56
}
else
{
57
ATH_MSG_VERBOSE
(
"TrackCollection "
<<
m_trackCollectionName
<<
" NOT found"
);
58
return
StatusCode::FAILURE;
59
}
60
61
const
MuonPatternCombinationCollection
*muPatternCombinations =
nullptr
;
62
if
(
evtStore
()->
contains<MuonPatternCombinationCollection>
(
m_collection
) &&
63
evtStore
()->retrieve(muPatternCombinations,
m_collection
).isSuccess()) {
64
ATH_MSG_DEBUG
(
"Got MuonPatternCombinationCollection "
<<
m_collection
);
65
}
else
{
66
ATH_MSG_VERBOSE
(
"MuonpatternCombinationCollection "
<<
m_collection
<<
" NOT found"
);
67
return
StatusCode::FAILURE;
68
}
69
70
//----------------------------------------------------------------
71
// Produce and store the output.
72
73
// DetailedTrackTruthCollection *dttc = new DetailedTrackTruthCollection(tracks);
74
// m_truthTool->buildDetailedTrackTruth(dttc, *tracks, prdCollectionVector);
75
76
//(DetailedMuonPatternTruthCollection *output, const MuonPatternCombinationCollection& tracks, const std::vector<const
77
// PRD_MultiTruthCollection*>& prdTruth);
78
79
DetailedMuonPatternTruthCollection
*dmptc =
new
DetailedMuonPatternTruthCollection
();
80
m_truthTool
->buildDetailedMuonPatternTruth(dmptc, *muPatternCombinations, prdCollectionVector);
81
82
sc
=
evtStore
()->record(dmptc,
m_detailedTrackTruthName
);
83
if
(
sc
.isFailure()) {
84
ATH_MSG_WARNING
(
"DetailedMuonPatternTrackTruthCollection '"
<<
m_detailedTrackTruthName
85
<<
"' could not be registered in StoreGate !"
);
86
return
StatusCode::SUCCESS;
87
}
else
{
88
ATH_MSG_DEBUG
(
"DetailedMuonPatternTrackTruthCollection '"
<<
m_detailedTrackTruthName
89
<<
"' is registered in StoreGate, size="
<< dmptc->size());
90
std::cout <<
"Debug 7.0: DetailedTrackTruthCollection is registered in storegate."
<< std::endl;
91
}
92
93
return
StatusCode::SUCCESS;
94
}
95
96
//================================================================
97
// EOF
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
DetailedMuonPatternTruthCollection.h
DetailedTrackTruthCollection.h
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
MuonPatternCombinationCollection
DataVector< Muon::MuonPatternCombination > MuonPatternCombinationCollection
This typedef represents a collection of MuonPatternCombination objects.
Definition
MuonPatternCombinationCollection.h:17
MuonPatternCombinationDetailedTrackTruthMaker.h
PRD_MultiTruthCollection.h
TrackCollection.h
TrackCollection
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
Definition
TrackCollection.h:19
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
DetailedMuonPatternTruthCollection
Definition
DetailedMuonPatternTruthCollection.h:21
MuonPatternCombinationDetailedTrackTruthMaker::execute
virtual StatusCode execute(const EventContext &ctx)
Execute method.
Definition
MuonPatternCombinationDetailedTrackTruthMaker.cxx:32
MuonPatternCombinationDetailedTrackTruthMaker::m_PRD_TruthNames
Gaudi::Property< std::vector< std::string > > m_PRD_TruthNames
Definition
MuonPatternCombinationDetailedTrackTruthMaker.h:30
MuonPatternCombinationDetailedTrackTruthMaker::m_collection
Gaudi::Property< std::string > m_collection
Definition
MuonPatternCombinationDetailedTrackTruthMaker.h:35
MuonPatternCombinationDetailedTrackTruthMaker::MuonPatternCombinationDetailedTrackTruthMaker
MuonPatternCombinationDetailedTrackTruthMaker(const std::string &name, ISvcLocator *pSvcLocator)
Definition
MuonPatternCombinationDetailedTrackTruthMaker.cxx:18
MuonPatternCombinationDetailedTrackTruthMaker::m_truthTool
ToolHandle< Trk::IDetailedMuonPatternTruthBuilder > m_truthTool
Definition
MuonPatternCombinationDetailedTrackTruthMaker.h:40
MuonPatternCombinationDetailedTrackTruthMaker::initialize
virtual StatusCode initialize()
Definition
MuonPatternCombinationDetailedTrackTruthMaker.cxx:25
MuonPatternCombinationDetailedTrackTruthMaker::m_trackCollectionName
Gaudi::Property< std::string > m_trackCollectionName
Definition
MuonPatternCombinationDetailedTrackTruthMaker.h:33
MuonPatternCombinationDetailedTrackTruthMaker::m_detailedTrackTruthName
Gaudi::Property< std::string > m_detailedTrackTruthName
Definition
MuonPatternCombinationDetailedTrackTruthMaker.h:38
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