ATLAS Offline Software
ServiceAccessor.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ServiceAccessor_H
6 #define ServiceAccessor_H
7 
8 
9 #include <iostream>
10 #include "GaudiKernel/ISvcLocator.h"
11 #include "GaudiKernel/Bootstrap.h"
12 #include "GaudiKernel/INTupleSvc.h"
13 
14 inline INTupleSvc* ntupleSvc()
15 {
16  auto findNtupleSvc = []()
17  {
18  INTupleSvc* nS = nullptr;
19  ISvcLocator* svcLocator = Gaudi::svcLocator();
20  StatusCode status = svcLocator->service("NTupleSvc",nS);
21  if (status.isFailure())
22  std::cout<<" ntupleSvc(); could not access NTupleSvc"<<std::endl;
23  return nS;
24  };
25  static INTupleSvc* const nS = findNtupleSvc();
26  return nS;
27 }
28 
29 #endif
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
merge.status
status
Definition: merge.py:17
ntupleSvc
INTupleSvc * ntupleSvc()
Definition: ServiceAccessor.h:14