ATLAS Offline Software
RIO_OnTrackCreator.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // RIO_OnTrackCreator.cxx
7 // AlgTool for adapting a RIO to a track candidate. It
8 // automatically selects the corresponding subdet correction.
10 // (c) ATLAS Detector software
12 // 2004 - now: Wolfgang Liebig <http://consult.cern.ch/xwho/people/54608>
14 
15 // --- the base class
19 // --- Gaudi stuff
20 #include "GaudiKernel/ListItem.h"
22 #include "Identifier/Identifier.h"
23 
27  const std::string& n,
28  const IInterface* p)
29  : AthAlgTool(t,n,p){}
30 
31 // destructor
33 
34 // initialise
36 {
37  if (AlgTool::initialize().isFailure()) return StatusCode::FAILURE;
38 
39  if (m_mode == "all") {
40  m_enumMode = Mode::all;
41  } else if (m_mode == "indet") {
42  m_enumMode = Mode::indet;
43  } else if (m_mode == "muon") {
44  m_enumMode = Mode::muon;
45  } else {
46  m_enumMode = Mode::invalid;
47  }
48 
49  if (m_enumMode == Mode::invalid) {
50  ATH_MSG_FATAL("Mode is set to unknown value " << m_mode);
51  return StatusCode::FAILURE;
52  }
53 
54  ATH_MSG_INFO("Mode is set to :" <<m_mode);
55 
56  // Get the correction tool to create Pixel/SCT/TRT RIO_onTrack
57  if (m_enumMode == Mode::all || m_enumMode == Mode::indet) {
58  if (!m_pixClusCor.empty()) {
59  ATH_CHECK(m_pixClusCor.retrieve());
60  } else {
61  m_doPixel = false;
62  }
63 
64  if (!m_sctClusCor.empty()) {
65  ATH_CHECK(m_sctClusCor.retrieve());
66  } else {
67  m_doSCT = false;
68  }
69 
70  if (!m_trt_Cor.empty()) {
71  ATH_CHECK(m_trt_Cor.retrieve());
72  } else {
73  m_doTRT = false;
74  }
75  } else {
76  m_trt_Cor.disable();
77  m_pixClusCor.disable();
78  m_sctClusCor.disable();
79  }
80 
81  if (m_enumMode == Mode::all || m_enumMode == Mode::muon) {
82  ATH_CHECK(m_muonDriftCircleCor.retrieve());
83  ATH_CHECK(m_muonClusterCor.retrieve());
84  } else {
85  m_muonClusterCor.disable();
86  m_muonDriftCircleCor.disable();
87  }
88 
89  // Set up ATLAS ID helper to be able to identify the RIO's det-subsystem.
90  ATH_CHECK(detStore()->retrieve(m_idHelper, "AtlasID"));
91 
92  return StatusCode::SUCCESS;
93 }
94 
95 // The sub-detector brancher algorithm
98  const TrackParameters& trk) const
99 {
100 
101  Identifier id;
102  id = rio.identify();
103 
104  // --- print RIO
105  ATH_MSG_VERBOSE ("RIO ID prints as "<<m_idHelper->print_to_string(id));
106  ATH_MSG_VERBOSE ("RIO.locP = ("<<rio.localPosition().x()<<","<<rio.localPosition().y()<<")");
107 
108  if (m_doPixel && m_idHelper->is_pixel(id)) {
109  if (m_enumMode == Mode::muon) {
111  "No tool to correct the current Pixel hit! return nullptr");
112  return nullptr;
113  }
114  return m_pixClusCor->correct(rio, trk);
115  }
116 
117  if (m_doSCT && m_idHelper->is_sct(id)) {
118  if (m_enumMode == Mode::muon) {
120  "No tool to correct the current SCT hit! - Giving back nullptr.");
121  return nullptr;
122  }
123  return m_sctClusCor->correct(rio, trk);
124  }
125 
126  if (m_doTRT && m_idHelper->is_trt(id)) {
127  if (m_enumMode == Mode::muon) {
129  "No tool to correct a TRT DriftCircle! - Giving back nullptr.");
130  return nullptr;
131  }
132  return m_trt_Cor->correct(rio, trk);
133  }
134 
135  if (m_idHelper->is_mdt(id)) {
136  if (m_enumMode == Mode::indet) {
138  "No tool to correct a MDT DriftCircle! - Giving back nullptr.");
139  return nullptr;
140  }
141  return m_muonDriftCircleCor->correct(rio, trk);
142  }
143 
144  if ((m_idHelper->is_csc(id)) || (m_idHelper->is_rpc(id)) ||
145  (m_idHelper->is_tgc(id)) || (m_idHelper->is_mm(id)) ||
146  (m_idHelper->is_stgc(id))) {
147  if (m_enumMode == Mode::indet) {
148  ATH_MSG_WARNING("No tool to correct a CSC/RPC/TGC/MM/sTGC hit! - Giving back nullptr.");
149  return nullptr;
150  }
151  return m_muonClusterCor->correct(rio, trk);
152  }
153 
154  ATH_MSG_WARNING("idHelper could not identify sub-detector for: "
155  << m_idHelper->print_to_string(id)
156  << ". Return nil RIO_OnTrack");
157  return nullptr;
158 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::muon
@ muon
Definition: TrackingPrimitives.h:195
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
initialize
void initialize()
Definition: run_EoverP.cxx:894
Trk::RIO_OnTrackCreator::RIO_OnTrackCreator
RIO_OnTrackCreator(const std::string &, const std::string &, const IInterface *)
standard AlgTool constructor
Definition: RIO_OnTrackCreator.cxx:26
RIO_OnTrackCreator.h
Trk::RIO_OnTrack
Definition: RIO_OnTrack.h:70
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
PrepRawData.h
AtlasDetectorID.h
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Trk::ParametersBase
Definition: ParametersBase.h:55
Trk::PrepRawData
Definition: PrepRawData.h:62
Trk::PrepRawData::identify
Identifier identify() const
return the identifier
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
Trk::RIO_OnTrackCreator::correct
RIO_OnTrack * correct(const PrepRawData &, const TrackParameters &) const override
the master method for going from RIO to ROT.
Definition: RIO_OnTrackCreator.cxx:97
Trk::RIO_OnTrackCreator::initialize
virtual StatusCode initialize() override
get specific ROT tools and the AtlasIdHelper
Definition: RIO_OnTrackCreator.cxx:35
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:191
RIO_OnTrack.h
Trk::RIO_OnTrackCreator::~RIO_OnTrackCreator
virtual ~RIO_OnTrackCreator()
virtual destructor
Trk::PrepRawData::localPosition
const Amg::Vector2D & localPosition() const
return the local position reference
Cut::all
@ all
Definition: SUSYToolsAlg.cxx:64
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AthAlgTool
Definition: AthAlgTool.h:26