ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
EFTracking
FPGATrackSim
FPGATrackSimInput
src
FPGATrackSimRawToLogicalHitsTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
FPGATrackSimInput/FPGATrackSimRawToLogicalHitsTool.h
"
6
#include "
FPGATrackSimSGInput/FPGATrackSimInputUtils.h
"
7
8
#include "
FPGATrackSimObjects/FPGATrackSimEventInputHeader.h
"
9
#include "
FPGATrackSimObjects/FPGATrackSimLogicalEventInputHeader.h
"
10
#include "
FPGATrackSimObjects/FPGATrackSimTowerInputHeader.h
"
11
#include "
FPGATrackSimObjects/FPGATrackSimEventInfo.h
"
12
#include "
FPGATrackSimObjects/FPGATrackSimOptionalEventInfo.h
"
13
#include "
FPGATrackSimObjects/FPGATrackSimOfflineTrack.h
"
14
#include "
FPGATrackSimObjects/FPGATrackSimOfflineHit.h
"
15
#include "
FPGATrackSimObjects/FPGATrackSimTruthTrack.h
"
16
17
#include "
FPGATrackSimMaps/FPGATrackSimRegionMap.h
"
18
#include "
FPGATrackSimMaps/FPGATrackSimPlaneMap.h
"
19
#include "
FPGATrackSimMaps/IFPGATrackSimMappingSvc.h
"
20
21
22
23
FPGATrackSimRawToLogicalHitsTool::FPGATrackSimRawToLogicalHitsTool
(
const
std::string& algname,
const
std::string &name,
const
IInterface *ifc) :
24
AthAlgTool
(algname,name,ifc){}
25
26
27
StatusCode
FPGATrackSimRawToLogicalHitsTool::initialize
(){
28
ATH_CHECK
(
m_FPGATrackSimMapping
.retrieve());
29
ATH_CHECK
(
m_EvtSel
.retrieve());
30
31
ATH_MSG_INFO
(
"SaveOptional="
<<
m_saveOptional
);
32
// remove deferensed m_towersToMap.value() in newer releases!
33
if
(
m_towersToMap
.value().empty() ){
34
int
maxNtowers =
m_FPGATrackSimMapping
->RegionMap_2nd()->getNRegions();
35
for
(
int
ireg=0;ireg!=maxNtowers;++ireg)
m_towers
.push_back(ireg);
36
}
else
{
37
m_towers
=
m_towersToMap
.value();
38
}
39
40
ATH_MSG_DEBUG
(
"Configured to process "
<<
m_towers
.size() <<
" towers"
);
41
std::stringstream listOfTowers;
42
for
(
int
ireg:
m_towers
){
43
listOfTowers<<
", "
<<ireg;
44
}
45
ATH_MSG_DEBUG
(
"List of Towers: "
<<listOfTowers.str());
46
return
StatusCode::SUCCESS;
47
}
48
49
50
StatusCode
FPGATrackSimRawToLogicalHitsTool::convert
(
unsigned
stage,
const
FPGATrackSimEventInputHeader
& eventHeader,
FPGATrackSimLogicalEventInputHeader
& logicEventHeader){
51
52
ATH_MSG_DEBUG
(
"Mapping "
<< eventHeader.
nHits
() <<
" hits using stage "
<< stage);
53
FPGATrackSimEventInfo
eventinfo = eventHeader.
event
();
54
ATH_MSG_DEBUG
(
"Getting Event "
<< eventinfo);
55
logicEventHeader.
newEvent
(eventinfo);
//this also reset all varaibles
56
57
if
(stage!=1 && stage!=2)
58
{
59
ATH_MSG_FATAL
(
"convert() must have stage == 1 or 2"
);
60
}
61
62
const
FPGATrackSimPlaneMap
* pmap =
m_FPGATrackSimMapping
->PlaneMap_2nd(0);
63
64
logicEventHeader.
reserveTowers
(
m_towers
.size());
65
for
(
int
ireg:
m_towers
){
66
FPGATrackSimTowerInputHeader
tower =
FPGATrackSimTowerInputHeader
(ireg);
//default header, can eventually set eta/phi/deta/dphi
67
logicEventHeader.
addTower
( tower);
68
}
69
for
(
FPGATrackSimHit
hit
: eventHeader.
hits
()) {
// hit loop
70
// In the ITk geometry, some of the plane IDs are -1 if the layers are not yet being used.
71
// This causes the code in this hit loop to crash. As a workaround for the moment, we currently
72
// skip over hits in layers that are not included in the FPGATrackSim geometry, with plane = -1
73
74
pmap->
doRemap
(
hit
);
75
76
for
(
unsigned
int
ireg = 0; ireg !=
m_towers
.size(); ++ireg) {
77
logicEventHeader.
getTower
(ireg)->
addHit
(
hit
);
78
ATH_MSG_VERBOSE
(
"Hit mapped ("
<<
hit
.isMapped() <<
") to tower="
<< ireg <<
", nHits now="
<< logicEventHeader.
getTower
(ireg)->
nHits
());
79
}
80
}
// end hit loop
81
82
if
(stage == 1) {
83
FPGATrackSimOptionalEventInfo
op = eventHeader.
optional
();
84
if
(
m_saveOptional
== 2) {
85
logicEventHeader.
setOptional
(op);
86
}
87
else
if
(
m_saveOptional
== 1) {
88
// save offline tracks
89
FPGATrackSimOptionalEventInfo
newop;
90
newop.
reserveOfflineTracks
(op.
nOfflineTracks
());
91
for
(
FPGATrackSimOfflineTrack
const
& offline_t : op.
getOfflineTracks
()) newop.
addOfflineTrack
(offline_t);
92
// save truth in region
93
for
(
FPGATrackSimTruthTrack
const
& truth_t : op.
getTruthTracks
()) {
94
if
(
m_EvtSel
->passMatching(truth_t)) newop.
addTruthTrack
(truth_t);
95
}
96
ATH_MSG_DEBUG
(
"Selected "
<< newop.
nTruthTracks
() <<
" truth tracks"
);
97
logicEventHeader.
setOptional
(newop);
98
}
99
}
100
101
return
StatusCode::SUCCESS;
102
}
103
104
const
FPGATrackSimPlaneMap
*
FPGATrackSimRawToLogicalHitsTool::getPlaneMap_1st
(
int
sliceNum) {
105
return
m_FPGATrackSimMapping
->PlaneMap_1st(sliceNum);
106
}
107
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
FPGATrackSimEventInfo.h
FPGATrackSimEventInputHeader.h
FPGATrackSimInputUtils.h
FPGATrackSimLogicalEventInputHeader.h
FPGATrackSimOfflineHit.h
FPGATrackSimOfflineTrack.h
FPGATrackSimOptionalEventInfo.h
FPGATrackSimPlaneMap.h
Maps physical layers to logical layers.
FPGATrackSimRawToLogicalHitsTool.h
FPGATrackSimRegionMap.h
Maps ITK module indices to FPGATrackSim regions.
FPGATrackSimTowerInputHeader.h
FPGATrackSimTruthTrack.h
IFPGATrackSimMappingSvc.h
hit
bool hit(const Container &ids, int pdgId)
Definition
JetIRCSafeLabelTool.cxx:64
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
FPGATrackSimEventInfo
Definition
FPGATrackSimEventInfo.h:14
FPGATrackSimEventInputHeader
Definition
FPGATrackSimEventInputHeader.h:22
FPGATrackSimEventInputHeader::nHits
int nHits() const
Definition
FPGATrackSimEventInputHeader.h:38
FPGATrackSimEventInputHeader::event
FPGATrackSimEventInfo const & event() const
Definition
FPGATrackSimEventInputHeader.h:33
FPGATrackSimEventInputHeader::optional
FPGATrackSimOptionalEventInfo const & optional() const
Definition
FPGATrackSimEventInputHeader.h:34
FPGATrackSimEventInputHeader::hits
const std::vector< FPGATrackSimHit > & hits() const
Definition
FPGATrackSimEventInputHeader.h:37
FPGATrackSimHit
Definition
FPGATrackSimHit.h:42
FPGATrackSimLogicalEventInputHeader
Definition
FPGATrackSimLogicalEventInputHeader.h:21
FPGATrackSimLogicalEventInputHeader::addTower
void addTower(const FPGATrackSimTowerInputHeader &s)
Definition
FPGATrackSimLogicalEventInputHeader.h:38
FPGATrackSimLogicalEventInputHeader::setOptional
void setOptional(const FPGATrackSimOptionalEventInfo &o)
Definition
FPGATrackSimLogicalEventInputHeader.h:33
FPGATrackSimLogicalEventInputHeader::getTower
FPGATrackSimTowerInputHeader * getTower(size_t index)
Definition
FPGATrackSimLogicalEventInputHeader.h:39
FPGATrackSimLogicalEventInputHeader::newEvent
void newEvent(FPGATrackSimEventInfo &event)
Definition
FPGATrackSimLogicalEventInputHeader.h:29
FPGATrackSimLogicalEventInputHeader::reserveTowers
void reserveTowers(size_t size)
Definition
FPGATrackSimLogicalEventInputHeader.h:40
FPGATrackSimOfflineTrack
Definition
FPGATrackSimOfflineTrack.h:12
FPGATrackSimOptionalEventInfo
Definition
FPGATrackSimOptionalEventInfo.h:17
FPGATrackSimOptionalEventInfo::nTruthTracks
size_t nTruthTracks() const
Definition
FPGATrackSimOptionalEventInfo.h:38
FPGATrackSimOptionalEventInfo::getTruthTracks
const std::vector< FPGATrackSimTruthTrack > & getTruthTracks() const
Definition
FPGATrackSimOptionalEventInfo.h:37
FPGATrackSimOptionalEventInfo::addOfflineTrack
void addOfflineTrack(const FPGATrackSimOfflineTrack &t) const
Definition
FPGATrackSimOptionalEventInfo.h:34
FPGATrackSimOptionalEventInfo::addTruthTrack
void addTruthTrack(const FPGATrackSimTruthTrack &t) const
Definition
FPGATrackSimOptionalEventInfo.h:39
FPGATrackSimOptionalEventInfo::nOfflineTracks
size_t nOfflineTracks() const
Definition
FPGATrackSimOptionalEventInfo.h:33
FPGATrackSimOptionalEventInfo::reserveOfflineTracks
void reserveOfflineTracks(size_t size) const
Definition
FPGATrackSimOptionalEventInfo.h:44
FPGATrackSimOptionalEventInfo::getOfflineTracks
const std::vector< FPGATrackSimOfflineTrack > & getOfflineTracks() const
Definition
FPGATrackSimOptionalEventInfo.h:32
FPGATrackSimPlaneMap
Definition
FPGATrackSimPlaneMap.h:62
FPGATrackSimPlaneMap::doRemap
void doRemap(FPGATrackSimHit &hit) const
Definition
FPGATrackSimPlaneMap.cxx:227
FPGATrackSimRawToLogicalHitsTool::initialize
virtual StatusCode initialize() override
Definition
FPGATrackSimRawToLogicalHitsTool.cxx:27
FPGATrackSimRawToLogicalHitsTool::m_EvtSel
ServiceHandle< IFPGATrackSimEventSelectionSvc > m_EvtSel
Definition
FPGATrackSimRawToLogicalHitsTool.h:41
FPGATrackSimRawToLogicalHitsTool::convert
StatusCode convert(unsigned stage, const FPGATrackSimEventInputHeader &header, FPGATrackSimLogicalEventInputHeader &logicheader)
Definition
FPGATrackSimRawToLogicalHitsTool.cxx:50
FPGATrackSimRawToLogicalHitsTool::m_towers
std::vector< int > m_towers
Definition
FPGATrackSimRawToLogicalHitsTool.h:46
FPGATrackSimRawToLogicalHitsTool::getPlaneMap_1st
const FPGATrackSimPlaneMap * getPlaneMap_1st(int sliceNum)
Definition
FPGATrackSimRawToLogicalHitsTool.cxx:104
FPGATrackSimRawToLogicalHitsTool::m_FPGATrackSimMapping
ServiceHandle< IFPGATrackSimMappingSvc > m_FPGATrackSimMapping
Definition
FPGATrackSimRawToLogicalHitsTool.h:40
FPGATrackSimRawToLogicalHitsTool::m_towersToMap
IntegerArrayProperty m_towersToMap
Definition
FPGATrackSimRawToLogicalHitsTool.h:43
FPGATrackSimRawToLogicalHitsTool::FPGATrackSimRawToLogicalHitsTool
FPGATrackSimRawToLogicalHitsTool(const std::string &, const std::string &, const IInterface *)
Definition
FPGATrackSimRawToLogicalHitsTool.cxx:23
FPGATrackSimRawToLogicalHitsTool::m_saveOptional
IntegerProperty m_saveOptional
Definition
FPGATrackSimRawToLogicalHitsTool.h:42
FPGATrackSimTowerInputHeader
Definition
FPGATrackSimTowerInputHeader.h:18
FPGATrackSimTowerInputHeader::nHits
int nHits() const
Definition
FPGATrackSimTowerInputHeader.h:47
FPGATrackSimTowerInputHeader::addHit
void addHit(const FPGATrackSimHit &s)
Definition
FPGATrackSimTowerInputHeader.h:48
FPGATrackSimTruthTrack
Definition
FPGATrackSimTruthTrack.h:14
Generated on
for ATLAS Offline Software by
1.17.0