ATLAS Offline Software
Loading...
Searching...
No Matches
AthTileTripReader.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5/*
6 * File: AthTileTripReader.cxx
7 * Author: Stephen Cole <stephen.cole@cern.ch>
8 *
9 * Created on August 21, 2012, 11:32 AM
10 */
11
17#include "GaudiKernel/MsgStream.h"
18
19#include "TSystem.h"
20
22
23using namespace std;
24using namespace Root;
25using xAOD::EventInfo;
26
28 const std::string& name,
29 const IInterface* parent): AthAlgTool(type,name,parent) {
30
32 declareInterface<AthTileTripReader>(this);
33
34 declareProperty("TileTripFile",
35 m_tripFile="/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/TileTripReader/CompleteTripList_2015-2018.root",
36 "Path to the trip list file");
37
38 declareProperty("dR",m_dR=0.4);
39
40}
41
42
46
47
49 MsgStream mslog( msgSvc(), name() );
50 const char* fname;
51 if(m_tripFile[0] == '/' || m_tripFile[0] == '$' ||
52 m_tripFile[0] == '.' || m_tripFile.find(":")!=string::npos){
53 fname = gSystem->ExpandPathName( m_tripFile.c_str() );
54 }
55 else{
57 if ( m_tripFile.empty() )
58 ATH_MSG_WARNING("Could NOT resolve file name "<<m_tripFile);
59 fname=m_tripFile.data();
60 }
61
62 if(!m_tripReader->setTripFile(fname)){
63 ATH_MSG_ERROR("ERROR! No trip file loaded!");
64 return StatusCode::FAILURE;
65 }
66 MSG::Level cLevel=mslog.currentLevel();
67 if(cLevel<=MSG::DEBUG)
68 m_tripReader->setVerbosity(1);
69 else m_tripReader->setVerbosity(0);
70 m_tripReader->initialize();
71 return StatusCode::SUCCESS;
72}
73
75 if(!m_tripReader->finalize()){
76 ATH_MSG_ERROR ( "ERROR! Something went wrong at finalize!" );
77 return StatusCode::FAILURE;
78 }
79 return StatusCode::SUCCESS;
80}
81
83 const EventInfo* evt=0;
84 StatusCode sc=evtStore()->retrieve(evt,"ByteStreamEventInfo");
85 if(sc.isFailure()){
86 ATH_MSG_ERROR ( "ERROR! Could not retrieve event info from store gate!");
87 return asg::AcceptData(&m_tripReader->getAcceptInfo());
88 }
89 if(!part) return m_tripReader->accept(evt->runNumber(),
90 evt->lumiBlock(),
91 evt->eventNumber());
92
93 int tileFlags=evt->eventFlags(EventInfo::Tile);
94 int tileError=evt->errorState(EventInfo::Tile);
95 return m_tripReader->accept(evt->runNumber(),
96 evt->lumiBlock(),
97 evt->eventNumber(),
98 part->eta(),
99 part->phi(),
100 tileError,
101 tileFlags);
102}
103
105 const EventInfo* evt=0;
106 StatusCode sc=evtStore()->retrieve(evt,"ByteStreamEventInfo");
107 if(sc.isFailure()){
108 ATH_MSG_ERROR ( "ERROR! Could not retrieve event info from store gate!");
109 return 0;
110 }
111
112 int tileFlags=evt->eventFlags(EventInfo::Tile);
113 int tileError=evt->errorState(EventInfo::Tile);
114 return m_tripReader->calculate(evt->runNumber(),
115 evt->lumiBlock(),
116 part->eta(),
117 part->phi(),
118 m_dR,
119 tileError,
120 tileFlags);
121}
122
124 const EventInfo* evt=0;
125 StatusCode sc=evtStore()->retrieve(evt,"ByteStreamEventInfo");
126 if(sc.isFailure()){
127 ATH_MSG_ERROR ( "ERROR! Could not retrieve event info from store gate!");
128 return false;
129 }
130
131 return m_tripReader->checkEvent(evt->runNumber(),
132 evt->lumiBlock(),
133 evt->eventNumber());
134
135}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
Helpers for checking error return status codes and reporting errors.
static Double_t sc
std::string PathResolverFindXMLFile(const std::string &logical_file_name)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
float calculate(const INavigable4Momentum *part)
AthTileTripReader(const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode finalize() override
virtual StatusCode initialize() override
Root::TTileTripReader * m_tripReader
asg::AcceptData accept(const INavigable4Momentum *part=0)
@ Tile
The Tile calorimeter.
STL namespace.
EventInfo_v1 EventInfo
Definition of the latest event info version.