ATLAS Offline Software
InDetGlobalManager.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
20 //Framework
21 #include "InDetGlobalManager.h"
23 
24 #include "GaudiKernel/StatusCode.h"
25 #include "GaudiKernel/ISvcLocator.h"
26 #include "GaudiKernel/ListItem.h"
27 #include "GaudiKernel/ServiceHandle.h"
28 
30 #include "InDetIdentifier/SCT_ID.h"
31 #include "InDetIdentifier/TRT_ID.h"
32 #include "InDetIdentifier/PixelID.h"
33 
34 //Standard c++
35 #include <string>
36 #include <vector>
37 
38 //--------------------------------------------------------------------------
40  const std::string &name,
41  ISvcLocator *pSvcLocator)
42  : AthenaMonManager(name, pSvcLocator)
43 {
44 
45 }
46 
47 //--------------------------------------------------------------------------
49 {
50 
51  StatusCode sc;
52 
53  const TRT_ID *trtID = nullptr;
54  if (detStore()->retrieve(trtID, "TRT_ID").isFailure()) {
55  msg(MSG::FATAL) << "Could not get Pixel ID helper" << endmsg;
56  return StatusCode::FAILURE;
57  }
58 
59 
60  const SCT_ID *sctID = nullptr;
61  if (detStore()->retrieve(sctID, "SCT_ID").isFailure()) {
62  msg(MSG::FATAL) << "Could not get SCT ID helper" << endmsg;
63  return StatusCode::FAILURE;
64  }
65 
66 
67  const PixelID *pixelID = nullptr;
68  if (detStore()->retrieve(pixelID, "PixelID").isFailure()) {
69  msg(MSG::FATAL) << "Could not get Pixel ID helper" << endmsg;
70  return StatusCode::FAILURE;
71  }
72 
73  //--------------------------------------------------------------
74  // Loop over all MonTools Name
75  // ---> Create monitoring tool for each
76  // ---> Book histograms
77  //--------------------------------------------------------------
78 
80  if( !sc.isSuccess() ) return sc;
81 
84  i != monToolsEnd; ++i ) {
85  ToolHandle<IMonitorToolBase>& tool = *i;
86  IMonitorToolBase* mon = tool.operator->();
87  InDetGlobalMotherMonTool* managed =
88  dynamic_cast<InDetGlobalMotherMonTool*>( mon );
89  if( managed != nullptr ) {
90  managed->fillDetectorManagers(trtID, sctID, pixelID );
91  managed->retrieveTools();
92  }
93  }
94 
95  ATH_CHECK( m_CombinedTracksName.initialize() );
98  ATH_CHECK( m_PixelRDOs.initialize(m_doPixel) );
99  ATH_CHECK( m_SCT_RDOs.initialize(m_doSCT) );
107 
108  return StatusCode::SUCCESS;
109 }
110 
111 
112 //--------------------------------------------------------------------------
114 {
115  //----------------------------------------------------------------------
116  // Retrieve track collections etc needed by the different monitoring tools
117  // Avoid to retrieve several times the same object in the different
118  // monitoring tools
119  //----------------------------------------------------------------------
120 
122  if (combined_tracks.isValid()){
123  msg(MSG::DEBUG) <<"found combined tracks in StoreGate "
124  <<m_CombinedTracksName.key()<<" "<<combined_tracks->size()<<endmsg;
125  }
126  else{
127  msg(MSG::ERROR) <<"No combined tracks in StoreGate"<<endmsg;
128  return StatusCode::FAILURE;
129  }
130 
131  const BCM_RDO_Container * int_BCM_RDOs;
132 
133  if(m_doBCM){
134 
136  if (bcmRdoContainer.isValid()){
137  msg(MSG::DEBUG) <<"found BCM RDOs in StoreGate "
138  <<endmsg;
139  int_BCM_RDOs = bcmRdoContainer.cptr();
140  }
141  else{
142  msg(MSG::ERROR) <<"No BCM RDOs in StoreGate"<<endmsg;
143  return StatusCode::FAILURE;
144  }
145  }
146 
147  else{
148  int_BCM_RDOs = nullptr;
149  }
150 
151 
152  const PixelRDO_Container * int_Pixel_RDOs;
153  const InDetTimeCollection * int_Pixel_LVL1ID;
154  const InDetTimeCollection * int_Pixel_BCID;
155 
156  if(m_doPixel){
158  if (pixRdoContainer.isValid()){
159  msg(MSG::DEBUG) <<"found Pixel RDOs in StoreGate "
160  <<endmsg;
161  int_Pixel_RDOs = pixRdoContainer.cptr();
162  }
163  else{
164  msg(MSG::ERROR) <<"No Pixel RDOs in StoreGate"<<endmsg;
165  return StatusCode::FAILURE;
166  }
167  if(m_doTiming){
169  if (pixel_LVL1IDColl.isValid()){
170  msg(MSG::DEBUG) <<"found Pixel LVL1ID information in StoreGate "
171  <<endmsg;
172  int_Pixel_LVL1ID = pixel_LVL1IDColl.cptr();
173  }
174  else{
175  msg(MSG::ERROR) <<"No Pixel LVL1ID information in StoreGate"<<endmsg;
176  return StatusCode::FAILURE;
177  }
178 
180  if (pixel_BCIDColl.isValid()){
181  msg(MSG::DEBUG) <<"found Pixel BCID information in StoreGate "
182  <<endmsg;
183  int_Pixel_BCID = pixel_BCIDColl.cptr();
184  }
185  else{
186  msg(MSG::ERROR) <<"No Pixel BCID information in StoreGate"<<endmsg;
187  return StatusCode::FAILURE;
188  }
189  }
190  else{
191  int_Pixel_LVL1ID = nullptr;
192  int_Pixel_BCID = nullptr;
193  }
194  }
195 
196  else{
197  int_Pixel_RDOs = nullptr;
198  int_Pixel_LVL1ID = nullptr;
199  int_Pixel_BCID = nullptr;
200  }
201 
202 
203  const SCT_RDO_Container * int_SCT_RDOs;
204  const InDetTimeCollection * int_SCT_LVL1ID;
205  const InDetTimeCollection * int_SCT_BCID;
206 
207  if(m_doSCT){
209  if (sctRdoContainer.isValid()){
210  msg(MSG::DEBUG) <<"found SCT RDOs in StoreGate "
211  <<endmsg;
212  int_SCT_RDOs = sctRdoContainer.cptr();
213  }
214  else{
215  msg(MSG::ERROR) <<"No SCT RDOs in StoreGate"<<endmsg;
216  return StatusCode::FAILURE;
217  }
218 
219  if(m_doTiming){
221  if (sct_LVL1IDColl.isValid()){
222  msg(MSG::DEBUG) <<"found SCT LVL1ID information in StoreGate "
223  <<endmsg;
224  int_SCT_LVL1ID = sct_LVL1IDColl.cptr();
225  }
226  else{
227  msg(MSG::ERROR) <<"No SCT LVL1ID information in StoreGate"<<endmsg;
228  return StatusCode::FAILURE;
229  }
230 
232  if (sct_BCIDColl.isValid()){
233  msg(MSG::DEBUG) <<"found SCT BCID information in StoreGate "
234  <<endmsg;
235  int_SCT_BCID = sct_BCIDColl.cptr();
236  }
237  else{
238  msg(MSG::ERROR) <<"No SCT BCID information in StoreGate"<<endmsg;
239  return StatusCode::FAILURE;
240  }
241  }
242  else{
243  int_SCT_LVL1ID= nullptr;
244  int_SCT_BCID = nullptr;
245  }
246  }
247 
248  else{
249  int_SCT_RDOs = nullptr;
250  int_SCT_LVL1ID= nullptr;
251  int_SCT_BCID = nullptr;
252  }
253 
254 
255  const InDet::TRT_DriftCircleContainer * int_DriftCircles;
256  const InDetTimeCollection * int_TRT_LVL1ID;
257  const InDetTimeCollection * int_TRT_BCID;
258  const ComTime * int_TRT_Phase;
259 
260  if(m_doTRT){
261 
263  if (driftCircleContainer.isValid()){
264  msg(MSG::DEBUG) <<"found TRT driftcircles in StoreGate "
265  <<endmsg;
266  int_DriftCircles = driftCircleContainer.cptr();
267  }
268  else{
269  msg(MSG::ERROR) <<"No TRT driftcircles in StoreGate"<<endmsg;
270  return StatusCode::FAILURE;
271  }
272 
273  if(m_doTiming){
275  if (trt_LVL1IDColl.isValid()){
276  msg(MSG::DEBUG) <<"found TRT LVL1ID information in StoreGate "
277  <<endmsg;
278  int_TRT_LVL1ID = trt_LVL1IDColl.cptr();
279  }
280  else{
281  msg(MSG::ERROR) <<"No TRT LVL1ID information in StoreGate"<<endmsg;
282  return StatusCode::FAILURE;
283  }
284 
286  if (trt_BCIDColl.isValid()){
287  msg(MSG::DEBUG) <<"found TRT BCID information in StoreGate "
288  <<endmsg;
289  int_TRT_BCID = trt_BCIDColl.cptr();
290  }
291  else{
292  msg(MSG::ERROR) <<"No TRT BCID information in StoreGate"<<endmsg;
293  return StatusCode::FAILURE;
294  }
295  }
296  else{
297  int_TRT_LVL1ID = nullptr;
298  int_TRT_BCID = nullptr;
299  }
300 
301  if(m_doTRTPhase){
303  if (trtPhase.isValid()){
304  msg(MSG::DEBUG) <<"found TRT event phase information in StoreGate "
305  <<endmsg;
306  int_TRT_Phase = trtPhase.cptr();
307  }
308 
309  else{
310  msg(MSG::ERROR) <<"No TRT event phase information in StoreGate"<<endmsg;
311  return StatusCode::FAILURE;
312  }
313  }
314  else int_TRT_Phase = nullptr;
315 }
316 
317  else{
318  int_DriftCircles = nullptr;
319  int_TRT_LVL1ID = nullptr;
320  int_TRT_BCID = nullptr;
321  int_TRT_Phase = nullptr;
322  }
323 
324  //------------------------------------------------------------------
325 
326 
329  i != monToolsEnd; ++i ) {
330  ToolHandle<IMonitorToolBase>& tool = *i;
331  IMonitorToolBase* mon = tool.operator->();
332  InDetGlobalMotherMonTool* managed =
333  dynamic_cast<InDetGlobalMotherMonTool*>( mon );
334 
335  if( managed != nullptr ) {
336  if ( msgLvl(MSG::DEBUG) ) msg(MSG::DEBUG)
337  <<"Loop over InDetGlobalMonTool " <<managed << endmsg;
338  managed->fillTracks(combined_tracks.cptr());
339  managed->fillRDOContainers(int_BCM_RDOs, int_Pixel_RDOs, int_SCT_RDOs, int_DriftCircles);
340  managed->fillTimeContainers( int_Pixel_LVL1ID,int_SCT_LVL1ID,int_TRT_LVL1ID, int_Pixel_BCID, int_SCT_BCID, int_TRT_BCID, int_TRT_Phase );
341  }
342  }
343  return AthenaMonManager::execute();
344 }
345 
346 //------------------------------------------------------------------------
348 {
349  return AthenaMonManager::finalize();
350 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
InDetGlobalMotherMonTool::fillTracks
virtual void fillTracks(const TrackCollection *sct_tracks, const TrackCollection *trt_tracks, const TrackCollection *combined_tracks, const TrackCollection *pix_tracks)
Set the adresses of track collections to those initialized by InDetGlobalManager in all sub-tools.
Definition: InDetGlobalMotherMonTool.h:439
PixelID.h
This is an Identifier helper class for the Pixel subdetector. This class is a factory for creating co...
InDetGlobalManager::m_SCT_LVL1ID
SG::ReadHandleKey< InDetTimeCollection > m_SCT_LVL1ID
Definition: InDetGlobalManager.h:67
SCT_ID.h
This is an Identifier helper class for the SCT subdetector. This class is a factory for creating comp...
InDetGlobalManager::m_SCT_RDOs
SG::ReadHandleKey< SCT_RDO_Container > m_SCT_RDOs
Definition: InDetGlobalManager.h:65
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
InDetGlobalManager::m_doTRT
Gaudi::Property< bool > m_doTRT
Definition: InDetGlobalManager.h:81
InDetGlobalManager::m_BCM_RDOs
SG::ReadHandleKey< BCM_RDO_Container > m_BCM_RDOs
Definition: InDetGlobalManager.h:63
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthenaMonManager::finalize
virtual StatusCode finalize()
Definition: AthenaMonManager.cxx:600
TRT_ID.h
This is an Identifier helper class for the TRT subdetector. This class is a factory for creating comp...
InDetGlobalManager::m_PixelRDOs
SG::ReadHandleKey< PixelRDO_Container > m_PixelRDOs
Definition: InDetGlobalManager.h:64
AthCommonMsg< Algorithm >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
InDetGlobalManager::m_doSCT
Gaudi::Property< bool > m_doSCT
Definition: InDetGlobalManager.h:80
InDetGlobalManager::m_TRT_BCID
SG::ReadHandleKey< InDetTimeCollection > m_TRT_BCID
Definition: InDetGlobalManager.h:71
InDetGlobalManager::m_doPixel
Gaudi::Property< bool > m_doPixel
Definition: InDetGlobalManager.h:79
InDetGlobalManager::m_PixelBCID
SG::ReadHandleKey< InDetTimeCollection > m_PixelBCID
Definition: InDetGlobalManager.h:69
InDetRawDataContainer
Definition: InDetRawDataContainer.h:27
InDetGlobalManager::m_doTRTPhase
Gaudi::Property< bool > m_doTRTPhase
Definition: InDetGlobalManager.h:84
ComTime
Definition: ComTime.h:17
InDetGlobalManager::m_doTiming
Gaudi::Property< bool > m_doTiming
Definition: InDetGlobalManager.h:83
InDetGlobalManager::m_SCT_BCID
SG::ReadHandleKey< InDetTimeCollection > m_SCT_BCID
Definition: InDetGlobalManager.h:70
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
InDetGlobalMotherMonTool::fillDetectorManagers
virtual void fillDetectorManagers(const TRT_ID *trtID, const SCT_ID *sctID, const PixelID *pixelID)
Filling the detector managers.
Definition: InDetGlobalMotherMonTool.h:459
AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
InDetGlobalManager.h
InDetGlobalMotherMonTool
This tool derives from InDetGlobalMonitorToolBase The Mother tool interfaces to all subtools.
Definition: InDetGlobalMotherMonTool.h:75
AthenaMonManager
An Algorithm that manages a set of modules, each inheriting from ManagedMonitorToolBase,...
Definition: AthenaMonManager.h:34
InDetGlobalMotherMonTool::retrieveTools
virtual void retrieveTools()
Definition: InDetGlobalMotherMonTool.h:498
lumiFormat.i
int i
Definition: lumiFormat.py:92
BCM_RDO_Container
Definition: BCM_RDO_Container.h:27
InDetGlobalManager::InDetGlobalManager
InDetGlobalManager(const std::string &name, ISvcLocator *pSvcLocator)
Definition: InDetGlobalManager.cxx:39
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
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
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
AthenaMonManager::m_monTools
ToolHandleArray< IMonitorToolBase > m_monTools
Definition: AthenaMonManager.h:123
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
InDetGlobalManager::m_TRT_DriftCircleName
SG::ReadHandleKey< InDet::TRT_DriftCircleContainer > m_TRT_DriftCircleName
Name of trt drift circle container.
Definition: InDetGlobalManager.h:61
InDetGlobalManager::m_TRT_Phase
SG::ReadHandleKey< ComTime > m_TRT_Phase
Definition: InDetGlobalManager.h:72
InDet::TRT_DriftCircleContainer
Trk::PrepRawDataContainer< TRT_DriftCircleCollection > TRT_DriftCircleContainer
Definition: TRT_DriftCircleContainer.h:27
InDetTimeCollection
std::vector< std::pair< uint32_t, unsigned int > > InDetTimeCollection
Definition: InDetTimeCollection.h:12
InDetGlobalManager::m_doBCM
Gaudi::Property< bool > m_doBCM
Definition: InDetGlobalManager.h:82
IMonitorToolBase
Definition: IMonitorToolBase.h:25
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
AthenaMonManager::execute
virtual StatusCode execute()
Definition: AthenaMonManager.cxx:512
InDetGlobalManager::execute
virtual StatusCode execute()
Definition: InDetGlobalManager.cxx:113
InDetGlobalManager::m_PixelLVL1ID
SG::ReadHandleKey< InDetTimeCollection > m_PixelLVL1ID
Definition: InDetGlobalManager.h:66
InDetGlobalManager::finalize
virtual StatusCode finalize()
Definition: InDetGlobalManager.cxx:347
TRT_ID
Definition: TRT_ID.h:84
SCT_ID
Definition: SCT_ID.h:68
DEBUG
#define DEBUG
Definition: page_access.h:11
plotBeamSpotMon.mon
mon
Definition: plotBeamSpotMon.py:67
AthCommonMsg< Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
InDetGlobalManager::m_TRT_LVL1ID
SG::ReadHandleKey< InDetTimeCollection > m_TRT_LVL1ID
Definition: InDetGlobalManager.h:68
InDetGlobalMotherMonTool::fillRDOContainers
virtual void fillRDOContainers(const BCM_RDO_Container *bcmRdoContainer, const PixelRDO_Container *pixRdoContainer, const SCT_RDO_Container *sctRdoContainer, const InDet::TRT_DriftCircleContainer *driftCircleContainer)
RDO containers.
Definition: InDetGlobalMotherMonTool.h:469
InDetGlobalMotherMonTool::fillTimeContainers
virtual void fillTimeContainers(const InDetTimeCollection *pixLVL1IDContainer, const InDetTimeCollection *sctLVL1IDContainer, const InDetTimeCollection *trtLVL1IDContainer, const InDetTimeCollection *pixel_BCIDColl, const InDetTimeCollection *sct_BCIDColl, const InDetTimeCollection *trt_BCIDColl, const ComTime *trtPhase)
Timing collections (BCID, LVL1ID, TRT event phase)
Definition: InDetGlobalMotherMonTool.h:481
InDetGlobalMotherMonTool.h
InDetTimeCollection.h
InDetGlobalManager::m_CombinedTracksName
SG::ReadHandleKey< TrackCollection > m_CombinedTracksName
Definition: InDetGlobalManager.h:58
PixelID
Definition: PixelID.h:67
InDetGlobalManager::initialize
virtual StatusCode initialize()
Definition: InDetGlobalManager.cxx:48
AthenaMonManager::initialize
virtual StatusCode initialize()
Definition: AthenaMonManager.cxx:384