Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
FPGATrackSimRawToLogicalHitsTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
16 
20 
21 
22 
23 FPGATrackSimRawToLogicalHitsTool::FPGATrackSimRawToLogicalHitsTool(const std::string& algname, const std::string &name, const IInterface *ifc) :
24  AthAlgTool(algname,name,ifc){}
25 
26 
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 
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 (auto 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  ATH_CHECK(m_FPGATrackSimMapping.retrieve());
75  pmap->doRemap(hit);
76 
77  for (unsigned int ireg = 0; ireg != m_towers.size(); ++ireg) {
78  logicEventHeader.getTower(ireg)->addHit(hit);
79  ATH_MSG_VERBOSE("Hit mapped (" << hit.isMapped() << ") to tower=" << ireg << ", nHits now=" << logicEventHeader.getTower(ireg)->nHits());
80  }
81  } // end hit loop
82 
83  if (stage == 1) {
84  FPGATrackSimOptionalEventInfo op = eventHeader.optional();
85  if (m_saveOptional == 2) {
86  logicEventHeader.setOptional(op);
87  }
88  else if (m_saveOptional == 1) {
89  // save offline tracks
92  for (FPGATrackSimOfflineTrack const & offline_t : op.getOfflineTracks()) newop.addOfflineTrack(offline_t);
93  // save truth in region
94  for (FPGATrackSimTruthTrack const & truth_t : op.getTruthTracks()) {
95  if (m_EvtSel->passMatching(truth_t)) newop.addTruthTrack(truth_t);
96  }
97  ATH_MSG_DEBUG("Selected " << newop.nTruthTracks() << " truth tracks");
98  logicEventHeader.setOptional(newop);
99  }
100  }
101 
102  return StatusCode::SUCCESS;
103 }
104 
106  return m_FPGATrackSimMapping->PlaneMap_1st(sliceNum);
107 }
108 
FPGATrackSimInputUtils.h
FPGATrackSimRawToLogicalHitsTool::convert
StatusCode convert(unsigned stage, const FPGATrackSimEventInputHeader &header, FPGATrackSimLogicalEventInputHeader &logicheader)
Definition: FPGATrackSimRawToLogicalHitsTool.cxx:50
getMenu.algname
algname
Definition: getMenu.py:54
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
FPGATrackSimEventInputHeader::hits
const std::vector< FPGATrackSimHit > & hits() const
Definition: FPGATrackSimEventInputHeader.h:37
FPGATrackSimLogicalEventInputHeader
Definition: FPGATrackSimLogicalEventInputHeader.h:21
FPGATrackSimOptionalEventInfo::getOfflineTracks
const std::vector< FPGATrackSimOfflineTrack > & getOfflineTracks() const
Definition: FPGATrackSimOptionalEventInfo.h:32
FPGATrackSimRawToLogicalHitsTool::getPlaneMap_1st
const FPGATrackSimPlaneMap * getPlaneMap_1st(int sliceNum)
Definition: FPGATrackSimRawToLogicalHitsTool.cxx:105
python.FPGATrackSimAnalysisConfig.stage
stage
Definition: FPGATrackSimAnalysisConfig.py:718
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
FPGATrackSimPlaneMap.h
Maps physical layers to logical layers.
FPGATrackSimTowerInputHeader.h
IFPGATrackSimMappingSvc.h
FPGATrackSimTruthTrack
Definition: FPGATrackSimTruthTrack.h:14
FPGATrackSimOfflineTrack.h
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
FPGATrackSimTowerInputHeader::addHit
void addHit(const FPGATrackSimHit &s)
Definition: FPGATrackSimTowerInputHeader.h:48
FPGATrackSimOptionalEventInfo::getTruthTracks
const std::vector< FPGATrackSimTruthTrack > & getTruthTracks() const
Definition: FPGATrackSimOptionalEventInfo.h:37
FPGATrackSimOptionalEventInfo::nTruthTracks
size_t nTruthTracks() const
Definition: FPGATrackSimOptionalEventInfo.h:38
FPGATrackSimEventInputHeader::nHits
int nHits() const
Definition: FPGATrackSimEventInputHeader.h:38
FPGATrackSimRegionMap.h
Maps ITK module indices to FPGATrackSim regions.
FPGATrackSimLogicalEventInputHeader::getTower
FPGATrackSimTowerInputHeader * getTower(size_t index)
Definition: FPGATrackSimLogicalEventInputHeader.h:39
FPGATrackSimEventInfo
Definition: FPGATrackSimEventInfo.h:14
FPGATrackSimTowerInputHeader::nHits
int nHits() const
Definition: FPGATrackSimTowerInputHeader.h:47
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
FPGATrackSimEventInfo.h
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
FPGATrackSimRawToLogicalHitsTool.h
FPGATrackSimRawToLogicalHitsTool::m_towers
std::vector< int > m_towers
Definition: FPGATrackSimRawToLogicalHitsTool.h:47
FPGATrackSimOfflineHit.h
FPGATrackSimOptionalEventInfo::addOfflineTrack
void addOfflineTrack(const FPGATrackSimOfflineTrack &t)
Definition: FPGATrackSimOptionalEventInfo.h:34
FPGATrackSimLogicalEventInputHeader::addTower
void addTower(const FPGATrackSimTowerInputHeader &s)
Definition: FPGATrackSimLogicalEventInputHeader.h:38
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
FPGATrackSimEventInputHeader
Definition: FPGATrackSimEventInputHeader.h:22
FPGATrackSimOptionalEventInfo
Definition: FPGATrackSimOptionalEventInfo.h:17
FPGATrackSimLogicalEventInputHeader::newEvent
void newEvent(FPGATrackSimEventInfo &event)
Definition: FPGATrackSimLogicalEventInputHeader.h:29
FPGATrackSimOfflineTrack
Definition: FPGATrackSimOfflineTrack.h:12
FPGATrackSimEventInputHeader::event
FPGATrackSimEventInfo const & event() const
Definition: FPGATrackSimEventInputHeader.h:33
FPGATrackSimOptionalEventInfo::nOfflineTracks
size_t nOfflineTracks() const
Definition: FPGATrackSimOptionalEventInfo.h:33
FPGATrackSimPlaneMap
Definition: FPGATrackSimPlaneMap.h:62
FPGATrackSimRawToLogicalHitsTool::m_FPGATrackSimMapping
ServiceHandle< IFPGATrackSimMappingSvc > m_FPGATrackSimMapping
Definition: FPGATrackSimRawToLogicalHitsTool.h:41
FPGATrackSimEventInputHeader.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
FPGATrackSimRawToLogicalHitsTool::initialize
virtual StatusCode initialize() override
Definition: FPGATrackSimRawToLogicalHitsTool.cxx:27
FPGATrackSimEventInputHeader::optional
FPGATrackSimOptionalEventInfo const & optional() const
Definition: FPGATrackSimEventInputHeader.h:34
FPGATrackSimOptionalEventInfo::addTruthTrack
void addTruthTrack(const FPGATrackSimTruthTrack &t)
Definition: FPGATrackSimOptionalEventInfo.h:39
FPGATrackSimRawToLogicalHitsTool::m_EvtSel
ServiceHandle< IFPGATrackSimEventSelectionSvc > m_EvtSel
Definition: FPGATrackSimRawToLogicalHitsTool.h:42
FPGATrackSimOptionalEventInfo::reserveOfflineTracks
void reserveOfflineTracks(size_t size)
Definition: FPGATrackSimOptionalEventInfo.h:44
FPGATrackSimLogicalEventInputHeader::reserveTowers
void reserveTowers(size_t size)
Definition: FPGATrackSimLogicalEventInputHeader.h:40
FPGATrackSimRawToLogicalHitsTool::m_towersToMap
IntegerArrayProperty m_towersToMap
Definition: FPGATrackSimRawToLogicalHitsTool.h:44
FPGATrackSimRawToLogicalHitsTool::FPGATrackSimRawToLogicalHitsTool
FPGATrackSimRawToLogicalHitsTool(const std::string &, const std::string &, const IInterface *)
Definition: FPGATrackSimRawToLogicalHitsTool.cxx:23
FPGATrackSimLogicalEventInputHeader::setOptional
void setOptional(const FPGATrackSimOptionalEventInfo &o)
Definition: FPGATrackSimLogicalEventInputHeader.h:33
AthAlgTool
Definition: AthAlgTool.h:26
FPGATrackSimTowerInputHeader
Definition: FPGATrackSimTowerInputHeader.h:18
FPGATrackSimLogicalEventInputHeader.h
FPGATrackSimTruthTrack.h
FPGATrackSimPlaneMap::doRemap
void doRemap(FPGATrackSimHit &hit) const
Definition: FPGATrackSimPlaneMap.cxx:227
FPGATrackSimRawToLogicalHitsTool::m_saveOptional
IntegerProperty m_saveOptional
Definition: FPGATrackSimRawToLogicalHitsTool.h:43
FPGATrackSimOptionalEventInfo.h