ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArROD
src
ReadLArRaw.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
/*
6
7
Kin Yip : May 22, 2002
8
9
barrel_ec in software description has changed the definition.
10
11
Now, we have +-1 for Barrel
12
+-2,3 for EndCap
13
14
"pos_neg" in the ntuple is equivalent to "barrel_ec" in software description.
15
16
Hong Ma : Aug 30, 2002
17
Add testing of RoI.
18
*/
19
20
21
//#include <strstream>
22
23
#include "GaudiKernel/MsgStream.h"
24
#include "
CaloIdentifier/LArID.h
"
25
#include "
CaloIdentifier/LArID_Exception.h
"
26
#include "
LArIdentifier/LArOnlineID.h
"
27
#include "
CaloIdentifier/LArEM_ID.h
"
28
29
#include "
LArRawEvent/LArRawChannel.h
"
30
#include "
LArRawEvent/LArRawChannelContainer.h
"
31
#include "
ReadLArRaw.h
"
32
33
// access all RawChannel
34
//#include "EventContainers/SelectAllObject.h"
35
// access RawChannel in TrigTower
36
// #include "LArRawUtils/LArRawRoISelector.h"
37
//#include "LArRawUtils/LArTT_Selector.h"
38
39
#include "
CaloIdentifier/CaloCell_ID.h
"
40
41
using namespace
std
;
42
43
//const int max_chan = 2800 ;
44
46
47
ReadLArRaw::ReadLArRaw
(
const
std::string& name, ISvcLocator* pSvcLocator) :
48
AthAlgorithm
(name, pSvcLocator),
49
m_ChannelContainerName
(
"LArRawChannelContainer"
),
50
m_onlineID
(nullptr),
51
m_larem_id
(nullptr)
52
{
53
// Declare the properties
54
declareProperty
(
"LArRawChannelContainerName"
,
m_ChannelContainerName
);
55
declareProperty
(
"DumpFile"
,
m_dumpFile
=
""
);
56
}
57
58
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
59
60
StatusCode
ReadLArRaw::initialize
()
61
{
62
ATH_MSG_INFO
(
"in initialize()"
);
63
64
ATH_CHECK
(
m_cablingKey
.initialize());
65
66
ATH_CHECK
(
detStore
()->retrieve(
m_onlineID
,
"LArOnlineID"
) );
67
68
// retrieve helpers for identifier
69
const
CaloCell_ID
* idHelper =
nullptr
;
70
ATH_CHECK
(
detStore
()->retrieve (idHelper,
"CaloCell_ID"
) );
71
m_larem_id
= idHelper->
em_idHelper
();
72
73
74
75
if
(!
m_dumpFile
.empty()) {
76
m_outFile
.open(
m_dumpFile
.c_str());
77
}
78
79
// after all these ...
80
return
StatusCode::SUCCESS;
81
82
}
83
84
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
85
86
StatusCode
ReadLArRaw::execute
(
const
EventContext& ctx) {
87
88
ATH_MSG_DEBUG
(
"in execute()"
);
89
const
LArRawChannelContainer
* LArRaw ;
90
ATH_CHECK
(
evtStore
()->retrieve (LArRaw,
m_ChannelContainerName
) );
91
92
93
int
emax= 0;
94
HWIdentifier
maxId;
95
96
SG::ReadCondHandle<LArOnOffIdMapping>
cablingHdl{
m_cablingKey
, ctx};
97
const
LArOnOffIdMapping
* cabling{*cablingHdl};
98
if
(!cabling) {
99
ATH_MSG_ERROR
(
"Do not have mapping object "
<<
m_cablingKey
.key());
100
return
StatusCode::FAILURE;
101
}
102
103
LArRawChannelContainer::const_iterator it1 = LArRaw->begin();
104
LArRawChannelContainer::const_iterator it2 = LArRaw->end();
105
for
(; it1!=it2; ++it1){
106
HWIdentifier
ch_id=it1->identify();
107
if
(
m_outFile
.is_open()) {
108
if
(cabling->isOnlineConnected(ch_id))
109
m_outFile
<<
"LArRawChannelDump: 0x"
<< std::hex << ch_id.
get_compact
() << std::dec <<
" E="
<< it1->energy()
110
<<
" t="
<< it1->time() <<
" g="
<< (int)it1->gain() <<
" Q="
<< it1->quality() << std::endl;
111
}
112
113
if
(emax<it1->energy() ) {
114
emax=it1->energy() ;
115
maxId =ch_id;
116
// use LArOnlineID methods
117
ATH_MSG_VERBOSE
(
"--barrel_ec : "
<<
m_onlineID
->barrel_ec(ch_id)
118
<<
" Pos_neg : "
<<
m_onlineID
->pos_neg(ch_id)
119
<<
" FeedThrough no. : "
<<
m_onlineID
->feedthrough(ch_id)
120
<<
" slot no. : "
<<
m_onlineID
->slot(ch_id)
121
<<
" channel no. : "
<<
m_onlineID
->channel(ch_id)
122
);
123
124
ATH_MSG_DEBUG
(
"Energy = "
<< it1->energy() <<
"; Time = "
125
<< it1->time()
126
<<
"; Chi-Square = "
<< it1->quality() );
127
}
128
ATH_MSG_DEBUG
(
" Channel with max energy , maxID = "
<< emax<<
" "
<<maxId.
getString
() );
129
}
130
131
return
StatusCode::SUCCESS;
132
}
133
134
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
135
136
StatusCode
ReadLArRaw::finalize
() {
137
138
if
(
m_outFile
.is_open())
139
m_outFile
.close();
140
ATH_MSG_INFO
(
"in finalize()"
);
141
142
return
StatusCode::SUCCESS;
143
}
144
145
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CaloCell_ID.h
LArEM_ID.h
LArID.h
LArID_Exception.h
LArOnlineID.h
LArRawChannelContainer.h
LArRawChannel.h
ReadLArRaw.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonAlgorithm< Gaudi::Algorithm >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
CaloCell_ID
Helper class for offline cell identifiers.
Definition
CaloCell_ID.h:34
CaloCell_ID::em_idHelper
const LArEM_ID * em_idHelper() const
access to EM idHelper
Definition
CaloCell_ID.h:63
HWIdentifier
Definition
HWIdentifier.h:13
Identifier::getString
std::string getString() const
Provide a string form of the identifier - hexadecimal.
Definition
Identifier.cxx:37
Identifier::get_compact
value_type get_compact() const
Get the compact id.
LArOnOffIdMapping
Definition
LArOnOffIdMapping.h:20
LArRawChannelContainer
Container for LArRawChannel (IDC using LArRawChannelCollection).
Definition
LArRawChannelContainer.h:26
ReadLArRaw::execute
virtual StatusCode execute(const EventContext &ctx)
Execute method.
Definition
ReadLArRaw.cxx:86
ReadLArRaw::m_ChannelContainerName
std::string m_ChannelContainerName
Definition
ReadLArRaw.h:35
ReadLArRaw::finalize
virtual StatusCode finalize()
Definition
ReadLArRaw.cxx:136
ReadLArRaw::ReadLArRaw
ReadLArRaw(const std::string &name, ISvcLocator *pSvcLocator)
Definition
ReadLArRaw.cxx:47
ReadLArRaw::m_outFile
std::ofstream m_outFile
Definition
ReadLArRaw.h:37
ReadLArRaw::m_larem_id
const LArEM_ID * m_larem_id
Definition
ReadLArRaw.h:42
ReadLArRaw::m_dumpFile
std::string m_dumpFile
Definition
ReadLArRaw.h:36
ReadLArRaw::m_onlineID
const LArOnlineID * m_onlineID
Definition
ReadLArRaw.h:41
ReadLArRaw::initialize
virtual StatusCode initialize()
Definition
ReadLArRaw.cxx:60
ReadLArRaw::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Definition
ReadLArRaw.h:39
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
std
STL namespace.
Generated on
for ATLAS Offline Software by
1.17.0