ATLAS Offline Software
Loading...
Searching...
No Matches
TBCaloCoolPosTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "TBCaloCoolPosTool.h"
6
7
8// Gaudi includes
9#include "GaudiKernel/MsgStream.h"
10#include "GaudiKernel/IIncidentSvc.h"
11#include "GaudiKernel/ServiceHandle.h"
12
13
15 const std::string& name,
16 const IInterface* parent)
17 :
18 base_class(type, name, parent),m_init(0)
19{
20}
21
22//--------------------------------------------------------------------------
25
26//--------------------------------------------------------------------------
28{
29 return StatusCode::SUCCESS ;
30}
31
32//--------------------------------------------------------------------------
34{
35 ATH_MSG_DEBUG ("in initialize()" );
36
37 if( initHandles() ) {
38 m_init = true;
39 } else
40 { // wait for the begin run
41 // start listening to "BeginRun"
42 ServiceHandle<IIncidentSvc> incSvc("IncidentSvc", name());
43 ATH_CHECK( incSvc.retrieve() );
44 const int PRIORITY = 100;
45 incSvc->addListener(this, "BeginRun", PRIORITY);
46 }
47
48 return StatusCode::SUCCESS;
49}
50
51
52void TBCaloCoolPosTool::handle(const Incident&)
53{
54 // This should be the beginning of Run.
55
56 ATH_MSG_DEBUG ("in handle()" );
57 if(! m_init) {
58 // not yet initialized.
59 if( initHandles() ) {
60 m_init = true;
61 } else
62 {
63 ATH_MSG_ERROR ( " unable initialize DataHandle in BeginRun Incident " );
64 }
65 }
66
67 return;
68}
69
70bool TBCaloCoolPosTool::initHandles ATLAS_NOT_THREAD_SAFE ()
71{
72 ATH_MSG_DEBUG ("in initHandles()" );
73
74 const EventContext& ctx = Gaudi::Hive::currentContext();
75 int run = ctx.eventID().run_number();
76
77 std::string etaKey,thetaKey,zKey,deltaKey;
78
79 if(run<1000454){
80 // this is the period before July 12, folder name is under Tile
81 thetaKey = "/TILE/DCS/SYSTEM1/TABLE/THETA" ;
82 etaKey = "/TILE/DCS/SYSTEM1/TABLE/ETA" ;
83 zKey = "/TILE/DCS/SYSTEM1/TABLE/Z" ;
84 deltaKey = "/TILE/DCS/SYSTEM1/TABLE/DELTA" ;
85 ATH_MSG_DEBUG ( " runs before 1000454, using Folders with SYSTEM1..." );
86
87 } else
88 { // Folder moved under System:
89 thetaKey = "/TILE/DCS/TILE_LV_62/TABLE/THETA" ;
90 etaKey = "/TILE/DCS/TILE_LV_62/TABLE/ETA" ;
91 zKey = "/TILE/DCS/TILE_LV_62/TABLE/Z" ;
92 deltaKey = "/TILE/DCS/TILE_LV_62/TABLE/DELTA" ;
93 ATH_MSG_DEBUG ( " runs after 1000454, using Folders with TILE_LV_62..." );
94 }
95
96 ATH_CHECK(detStore()->regHandle(m_deltaTable,deltaKey),false);
97 ATH_CHECK(detStore()->regHandle(m_thetaTable,thetaKey),false);
98 ATH_CHECK(detStore()->regHandle(m_zTable,zKey),false);
99 ATH_CHECK(detStore()->regHandle(m_etaTable,etaKey),false);
100
101 ATH_MSG_DEBUG ( " eta = " << eta() );
102 ATH_MSG_DEBUG ( " theta = " << theta() );
103 ATH_MSG_DEBUG ( " z = " << z() );
104 ATH_MSG_DEBUG ( " delta = " << delta() );
105
106 return true;
107}
108
109//--------------------------------------------------------------------------
111{
112 float e=0;
113 try {
114 e=(* m_etaTable)["eta"].data<float>();
115 }
116 catch (const std::exception& ex) {
117 ATH_MSG_ERROR("eta AttributeList access failed");
118 return 0 ;
119 }
120 return e;
121}
122
124{
125 float t=0;
126 try {
127 t=(* m_thetaTable)["theta"].data<float>();
128 }
129 catch (const std::exception& ex) {
130 ATH_MSG_ERROR("theta AttributeList access failed");
131 return 0 ;
132 }
133 return t;
134}
135
137{
138 float z=0;
139 try {
140 z=(* m_zTable)["z"].data<float>();
141 }
142 catch (const std::exception& ex) {
143 ATH_MSG_ERROR("z AttributeList access failed");
144 return 0 ;
145 }
146 return z;
147}
148
150{
151 float d=0;
152 try {
153 d=(* m_deltaTable)["delta"].data<float>();
154 }
155 catch (const std::exception& ex) {
156 ATH_MSG_ERROR("delta AttributeList access failed");
157 return 0 ;
158 }
159 return d;
160}
161
Scalar eta() const
pseudorapidity method
Scalar theta() const
theta method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
bool TBCaloCoolPosTool::initHandles ATLAS_NOT_THREAD_SAFE()
Install fatal handler with default options.
#define z
virtual double theta()
access eta value
virtual double delta()
access eta value
virtual StatusCode finalize()
virtual double z()
access eta value
virtual void handle(const Incident &)
virtual double eta()
access eta value
TBCaloCoolPosTool(const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode initialize()
Definition run.py:1