ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArTest
LArEventTest
src
FindDuplicatedLArDigits.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
LArEventTest/FindDuplicatedLArDigits.h
"
6
#include "
CaloIdentifier/CaloGain.h
"
7
#include "
xAODEventInfo/EventInfo.h
"
8
9
#include "GaudiKernel/SmartDataPtr.h"
10
#include "
CaloIdentifier/CaloCell_ID.h
"
11
#include "
LArRawEvent/LArDigitContainer.h
"
12
#include "
LArRawEvent/LArFebHeaderContainer.h
"
13
14
#include "
LArElecCalib/ILArPedestal.h
"
15
#include <fstream>
16
17
18
19
FindDuplicatedLArDigits::FindDuplicatedLArDigits
(
const
std::string& name, ISvcLocator* pSvcLocator)
20
:
AthAlgorithm
(name, pSvcLocator),
21
m_nProblemEvent
(0),
22
m_onlineHelper
(0),
23
m_emId
(0),
24
m_hecId
(0),
25
m_fcalId
(0)
26
{
27
declareProperty
(
"ContainerKey"
,
m_contKey
);
28
m_nDigits
=-1;
29
}
30
31
FindDuplicatedLArDigits::~FindDuplicatedLArDigits
()
32
{}
33
34
StatusCode
FindDuplicatedLArDigits::initialize
()
35
{
36
const
CaloCell_ID
* idHelper =
nullptr
;
37
ATH_CHECK
(
detStore
()->retrieve (idHelper,
"CaloCell_ID"
) );
38
m_emId
=idHelper->
em_idHelper
();
39
m_fcalId
=idHelper->
fcal_idHelper
();
40
m_hecId
=idHelper->
hec_idHelper
();
41
42
if
(!
m_emId
) {
43
ATH_MSG_ERROR
(
"Could not access lar EM ID helper"
);
44
return
StatusCode::FAILURE;
45
}
46
if
(!
m_fcalId
) {
47
ATH_MSG_ERROR
(
"Could not access lar FCAL ID helper"
);
48
return
StatusCode::FAILURE;
49
}
50
if
(!
m_hecId
) {
51
ATH_MSG_ERROR
(
"Could not access lar HEC ID helper"
);
52
return
StatusCode::FAILURE;
53
}
54
55
56
ATH_CHECK
(
detStore
()->retrieve(
m_onlineHelper
,
"LArOnlineID"
) );
57
ATH_MSG_DEBUG
(
" Found the LArOnlineID helper. "
);
58
59
m_nProblemEvent
=0;
60
return
StatusCode::SUCCESS;
61
}
62
63
StatusCode
FindDuplicatedLArDigits::execute
(
const
EventContext&
/*ctx*/
)
64
{
65
// Retrieve EventInfo
66
const
xAOD::EventInfo
* thisEventInfo;
67
StatusCode
sc
=
evtStore
()->retrieve(thisEventInfo);
68
unsigned
eventnumber=0;
69
if
(
sc
!=StatusCode::SUCCESS)
70
ATH_MSG_WARNING
(
"No EventInfo object found!"
);
71
else
{
72
eventnumber=thisEventInfo->
eventNumber
();
73
}
74
75
// Retrieve LArDigitContainer
76
const
LArDigitContainer
* digit_cont;
77
if
(
m_contKey
.size())
78
ATH_CHECK
(
evtStore
()->retrieve(digit_cont,
m_contKey
) );
79
else
80
ATH_CHECK
(
evtStore
()->retrieve(digit_cont) );
81
ATH_MSG_DEBUG
(
"Retrieved LArDigitContainer from StoreGate! key="
<<
m_contKey
);
82
83
int
nDigits=digit_cont->
size
();
84
if
(
m_nDigits
==-1 ||
m_nDigits
==nDigits) {
//first event or no change
85
ATH_MSG_DEBUG
(
"Event "
<< eventnumber <<
": Found "
<< nDigits <<
" Digits in container"
);
86
}
87
else
{
88
ATH_MSG_ERROR
(
"Event "
<< eventnumber <<
": Size of digit container changed! Now: "
<< nDigits <<
" Previous Event: "
<<
m_nDigits
);
89
}
90
m_nDigits
=nDigits;
91
m_bitpattern
.reset();
92
LArDigitContainer::const_iterator
it = digit_cont->
begin
();
93
LArDigitContainer::const_iterator
it_e = digit_cont->
end
();
94
unsigned
nDoubleDigits=0;
95
for
(; it!=it_e; ++it){
96
const
HWIdentifier
hwid=(*it)->channelID();
//hardwareID();
97
const
IdentifierHash
h
=
m_onlineHelper
->channel_Hash(hwid);
98
if
(
m_bitpattern
.test(
h
)) {
99
int
barrel_ec =
m_onlineHelper
->barrel_ec(hwid);
100
std::string bc;
101
if
(barrel_ec==0)
102
bc=
"Barrel"
;
103
else
if
(barrel_ec==1)
104
bc=
"Endcap"
;
105
else
106
bc=
"unknown"
;
107
108
int
pos_neg =
m_onlineHelper
->pos_neg(hwid);
109
std::string pn;
110
if
(pos_neg==0)
111
pn=
"C-Side"
;
112
else
if
(pos_neg==1)
113
pn=
"A-Side"
;
114
else
115
pn=
"unknown"
;
116
117
int
FT =
m_onlineHelper
->feedthrough(hwid);
118
int
slot =
m_onlineHelper
->slot(hwid);
119
int
channel =
m_onlineHelper
->channel(hwid);
120
ATH_MSG_ERROR
(
"Event "
<< eventnumber <<
" Found duplicated cell! Location: ("
<< bc <<
"/"
<< pn <<
"/FT="
121
<< FT <<
"/Slot="
<< slot <<
"/Channel="
<< channel <<
")"
);
122
nDoubleDigits++;
123
}
124
m_bitpattern
.set(
h
);
125
}
126
if
(nDoubleDigits) {
127
m_nProblemEvent
++;
128
ATH_MSG_ERROR
(
"Found "
<< nDoubleDigits <<
" duplicated digits in event "
<< eventnumber );
129
//return StatusCode::RECOVERABLE;
130
}
131
return
StatusCode::SUCCESS;
132
}
// end finalize-method.
133
134
135
StatusCode
FindDuplicatedLArDigits::finalize
() {
136
if
(
m_nProblemEvent
)
137
ATH_MSG_ERROR
(
"Found "
<<
m_nProblemEvent
<<
" Events with duplicated LArDigits"
);
138
else
139
ATH_MSG_INFO
(
"No duplicated LArDigits found."
);
140
return
StatusCode::SUCCESS;
141
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x,...)
Definition
AthMsgStreamMacros.h:47
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x,...)
Definition
AthMsgStreamMacros.h:46
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
CaloCell_ID.h
CaloGain.h
FindDuplicatedLArDigits.h
ILArPedestal.h
LArDigitContainer.h
LArFebHeaderContainer.h
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
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
h
Header file for AthHistogramAlgorithm.
CaloCell_ID
Helper class for offline cell identifiers.
Definition
CaloCell_ID.h:34
CaloCell_ID::fcal_idHelper
const LArFCAL_ID * fcal_idHelper() const
access to FCAL idHelper
Definition
CaloCell_ID.h:75
CaloCell_ID::em_idHelper
const LArEM_ID * em_idHelper() const
access to EM idHelper
Definition
CaloCell_ID.h:63
CaloCell_ID::hec_idHelper
const LArHEC_ID * hec_idHelper() const
access to HEC idHelper
Definition
CaloCell_ID.h:69
DataVector< LArDigit >::const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Definition
DataVector.h:838
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
FindDuplicatedLArDigits::m_nDigits
int m_nDigits
Definition
FindDuplicatedLArDigits.h:50
FindDuplicatedLArDigits::m_emId
const LArEM_ID * m_emId
Definition
FindDuplicatedLArDigits.h:53
FindDuplicatedLArDigits::m_onlineHelper
const LArOnlineID * m_onlineHelper
Definition
FindDuplicatedLArDigits.h:51
FindDuplicatedLArDigits::FindDuplicatedLArDigits
FindDuplicatedLArDigits(const std::string &name, ISvcLocator *pSvcLocator)
Definition
FindDuplicatedLArDigits.cxx:19
FindDuplicatedLArDigits::finalize
StatusCode finalize()
Definition
FindDuplicatedLArDigits.cxx:135
FindDuplicatedLArDigits::m_fcalId
const LArFCAL_ID * m_fcalId
Definition
FindDuplicatedLArDigits.h:55
FindDuplicatedLArDigits::m_hecId
const LArHEC_ID * m_hecId
Definition
FindDuplicatedLArDigits.h:54
FindDuplicatedLArDigits::~FindDuplicatedLArDigits
~FindDuplicatedLArDigits()
Definition
FindDuplicatedLArDigits.cxx:31
FindDuplicatedLArDigits::m_nProblemEvent
unsigned m_nProblemEvent
Definition
FindDuplicatedLArDigits.h:49
FindDuplicatedLArDigits::execute
StatusCode execute(const EventContext &ctx)
Execute method.
Definition
FindDuplicatedLArDigits.cxx:63
FindDuplicatedLArDigits::initialize
StatusCode initialize()
Definition
FindDuplicatedLArDigits.cxx:34
FindDuplicatedLArDigits::m_bitpattern
std::bitset< 200000 > m_bitpattern
Definition
FindDuplicatedLArDigits.h:48
FindDuplicatedLArDigits::m_contKey
std::string m_contKey
Definition
FindDuplicatedLArDigits.h:47
HWIdentifier
Definition
HWIdentifier.h:13
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
LArDigitContainer
Container class for LArDigit.
Definition
LArDigitContainer.h:24
xAOD::EventInfo_v1::eventNumber
uint64_t eventNumber() const
The current event's event number.
xAOD::EventInfo
EventInfo_v1 EventInfo
Definition of the latest event info version.
Definition
IEventInfoCnvTool.h:16
EventInfo.h
Generated on
for ATLAS Offline Software by
1.17.0