Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Qipeng Hu
athena
Commits
4dcdc61b
Commit
4dcdc61b
authored
Nov 20, 2021
by
Denis Oliveira Damazio
Committed by
Walter Lampl
Nov 20, 2021
Browse files
Implementation of the IS infrastructure for the LArNoise Burst...
parent
5ac82050
Changes
3
Hide whitespace changes
Inline
Side-by-side
Trigger/TrigHypothesis/TrigCaloHypo/CMakeLists.txt
View file @
4dcdc61b
...
...
@@ -3,12 +3,16 @@
# Declare the package name:
atlas_subdir
(
TrigCaloHypo
)
find_package
(
tdaq-common COMPONENTS hltinterface
)
# Component(s) in the package:
atlas_add_library
(
TrigCaloHypoLib
TrigCaloHypo/*.h
INTERFACE
PUBLIC_HEADERS TrigCaloHypo
LINK_LIBRARIES xAODTrigCalo CaloEvent DecisionHandlingLib GaudiKernel Identifier TrigSteeringEvent
)
INCLUDE_DIRS
${
TDAQ-COMMON_INCLUDE_DIRS
}
LINK_LIBRARIES xAODTrigCalo CaloEvent DecisionHandlingLib GaudiKernel Identifier TrigSteeringEvent
${
TDAQ-COMMON_LIBRARIES
}
)
atlas_add_component
(
TrigCaloHypo
src/*.cxx src/components/*.cxx
...
...
Trigger/TrigHypothesis/TrigCaloHypo/src/TrigLArNoiseBurstAlg.cxx
View file @
4dcdc61b
...
...
@@ -7,11 +7,16 @@
#include "TrigCompositeUtils/TrigCompositeUtils.h"
#include "TrigSteeringEvent/TrigRoiDescriptorCollection.h"
#include "hltinterface/IInfoRegister.h"
#include "hltinterface/ContainerFactory.h"
#include <boost/property_tree/ptree.hpp>
using
namespace
TrigCompositeUtils
;
TrigLArNoiseBurstAlg
::
TrigLArNoiseBurstAlg
(
const
std
::
string
&
name
,
ISvcLocator
*
pSvcLocator
)
:
::
HypoBase
(
name
,
pSvcLocator
)
{}
::
HypoBase
(
name
,
pSvcLocator
)
,
m_IsObject
(
nullptr
),
m_timeTagPosToClear
(
240
),
m_publishTime
(
180
),
m_name_of_is
(
"LArISInfo_NoiseBurstAlg"
),
m_timeTagPosRec
(
0
)
{}
StatusCode
TrigLArNoiseBurstAlg
::
initialize
()
{
...
...
@@ -20,13 +25,34 @@ StatusCode TrigLArNoiseBurstAlg::initialize() {
ATH_CHECK
(
m_knownBadFEBsVecKey
.
initialize
()
);
ATH_CHECK
(
m_knownMNBFEBsVecKey
.
initialize
()
);
ATH_CHECK
(
m_hypoTools
.
retrieve
()
);
// No TDAQ structure, no publishing anyway
try
{
auto
cfact
=
hltinterface
::
ContainerFactory
::
getInstance
();
if
(
cfact
)
{
// construct the LAr noise burst container and register it
ATH_MSG_DEBUG
(
"Got the factory for TDAQ interface, will try to register vectors"
);
m_IsObject
=
cfact
->
constructContainer
(
m_name_of_is
,
"LArNoiseBurstCandidates"
);
m_evntPos
=
cfact
->
addIntVector
(
m_IsObject
,
"Flag"
,
hltinterface
::
GenericHLTContainer
::
LASTVALUE
);
m_timeTagPos
=
cfact
->
addIntVector
(
m_IsObject
,
"TimeStamp"
,
hltinterface
::
GenericHLTContainer
::
LASTVALUE
);
m_timeTagPosns
=
cfact
->
addIntVector
(
m_IsObject
,
"TimeStamp_ns"
,
hltinterface
::
GenericHLTContainer
::
LASTVALUE
);
ATH_MSG_DEBUG
(
"Registering container in IS with name /HLTObjects/"
<<
m_name_of_is
);
hltinterface
::
IInfoRegister
::
instance
()
->
registerObject
(
"/HLTObjects/"
,
m_IsObject
);
}
// if cfact
}
catch
(
std
::
exception
&
ex
)
{
ATH_MSG_WARNING
(
"Cannot use ISInfo publication. got exception "
<<
ex
.
what
()
);
m_IsObject
=
nullptr
;
m_timeTagPosRec
=
0
;
}
// some initial value to clean up stuff
return
StatusCode
::
SUCCESS
;
}
StatusCode
TrigLArNoiseBurstAlg
::
execute
(
const
EventContext
&
context
)
const
{
ATH_MSG_DEBUG
(
"Executing "
<<
name
()
<<
"..."
);
auto
previousDecisionsHandle
=
SG
::
makeHandle
(
decisionInput
(),
context
);
ATH_CHECK
(
previousDecisionsHandle
.
isValid
()
);
ATH_MSG_DEBUG
(
"Running with "
<<
previousDecisionsHandle
->
size
()
<<
" previous decisions"
);
...
...
@@ -40,56 +66,103 @@ StatusCode TrigLArNoiseBurstAlg::execute( const EventContext& context ) const {
ATH_CHECK
(
previousDecisionsHandle
->
size
()
==
1
);
const
auto
previousDecision
=
previousDecisionsHandle
->
at
(
0
);
//get RoI
auto
roiELInfo
=
findLink
<
TrigRoiDescriptorCollection
>
(
previousDecision
,
initialRoIString
()
);
//get RoI
auto
roiELInfo
=
findLink
<
TrigRoiDescriptorCollection
>
(
previousDecision
,
initialRoIString
()
);
ATH_CHECK
(
roiELInfo
.
isValid
()
);
const
TrigRoiDescriptor
*
roi
=
*
(
roiELInfo
.
link
);
ATH_CHECK
(
roiELInfo
.
isValid
()
);
const
TrigRoiDescriptor
*
roi
=
*
(
roiELInfo
.
link
);
// get cells
SG
::
ReadHandle
<
CaloCellContainer
>
cellsHandle
(
m_cellContainerKey
,
context
);
ATH_CHECK
(
cellsHandle
.
isValid
()
);
ATH_MSG_DEBUG
(
"Cluster handle size: "
<<
cellsHandle
->
size
()
<<
"..."
);
// necessary conditions
std
::
set
<
unsigned
int
>
bf
;
std
::
vector
<
HWIdentifier
>
MNBfeb
;
SG
::
ReadCondHandle
<
LArBadFebCont
>
badHdl
(
m_knownBadFEBsVecKey
,
context
);
const
LArBadFebCont
*
badCont
=*
badHdl
;
if
(
badCont
)
{
for
(
LArBadFebCont
::
BadChanVec
::
const_iterator
i
=
badCont
->
begin
();
i
!=
badCont
->
end
();
i
++
)
{
bf
.
insert
(
i
->
first
);
}
SG
::
ReadHandle
<
CaloCellContainer
>
cellsHandle
(
m_cellContainerKey
,
context
);
ATH_CHECK
(
cellsHandle
.
isValid
()
);
ATH_MSG_DEBUG
(
"Cluster handle size: "
<<
cellsHandle
->
size
()
<<
"..."
);
// necessary conditions
std
::
set
<
unsigned
int
>
bf
;
std
::
vector
<
HWIdentifier
>
MNBfeb
;
SG
::
ReadCondHandle
<
LArBadFebCont
>
badHdl
(
m_knownBadFEBsVecKey
,
context
);
const
LArBadFebCont
*
badCont
=*
badHdl
;
if
(
badCont
)
{
for
(
LArBadFebCont
::
BadChanVec
::
const_iterator
i
=
badCont
->
begin
();
i
!=
badCont
->
end
();
i
++
)
{
bf
.
insert
(
i
->
first
);
}
}
SG
::
ReadCondHandle
<
LArBadFebCont
>
MNBHdl
(
m_knownMNBFEBsVecKey
,
context
);
const
LArBadFebCont
*
MNBCont
=*
MNBHdl
;
if
(
MNBCont
)
{
for
(
LArBadFebCont
::
BadChanVec
::
const_iterator
i
=
MNBCont
->
begin
();
i
!=
MNBCont
->
end
();
i
++
)
{
MNBfeb
.
push_back
(
HWIdentifier
(
i
->
first
));
}
}
SG
::
ReadCondHandle
<
LArBadFebCont
>
MNBHdl
(
m_knownMNBFEBsVecKey
,
context
);
const
LArBadFebCont
*
MNBCont
=*
MNBHdl
;
if
(
MNBCont
)
{
for
(
LArBadFebCont
::
BadChanVec
::
const_iterator
i
=
MNBCont
->
begin
();
i
!=
MNBCont
->
end
();
i
++
)
{
MNBfeb
.
push_back
(
HWIdentifier
(
i
->
first
));
}
}
// Get new output decision, child of previousDecision
auto
d
=
newDecisionIn
(
decisions
,
previousDecision
,
hypoAlgNodeName
(),
context
);
// Get new output decision, child of previousDecision
auto
d
=
newDecisionIn
(
decisions
,
previousDecision
,
hypoAlgNodeName
(),
context
);
// create summary struct
toolInput
.
emplace_back
(
d
,
roi
,
cellsHandle
.
cptr
(),
&
bf
,
&
MNBfeb
,
previousDecision
);
// link the cluster
{
auto
cell
=
ElementLink
<
CaloCellContainer
>
(
*
cellsHandle
,
0
);
ATH_CHECK
(
cell
.
isValid
()
);
d
->
setObjectLink
(
featureString
(),
cell
);
}
// create summary struct
toolInput
.
emplace_back
(
d
,
roi
,
cellsHandle
.
cptr
(),
&
bf
,
&
MNBfeb
,
previousDecision
);
// link the cluster
{
auto
cell
=
ElementLink
<
CaloCellContainer
>
(
*
cellsHandle
,
0
);
ATH_CHECK
(
cell
.
isValid
()
);
d
->
setObjectLink
(
featureString
(),
cell
);
}
ATH_MSG_DEBUG
(
"Found "
<<
toolInput
.
size
()
<<
" inputs to tools"
);
for
(
auto
&
tool
:
m_hypoTools
)
{
ATH_CHECK
(
tool
->
decide
(
toolInput
)
);
}
bool
any_passed
=
not
d
->
decisions
().
empty
();
// publish the found values in IS
if
(
any_passed
&&
(
m_IsObject
!=
nullptr
)
)
{
// lock the IS publishing
std
::
lock_guard
<
std
::
mutex
>
lock
(
m_pubIS_mtx
);
const
EventIDBase
&
EIHandle
=
context
.
eventID
();
long
int
thisTimeStamp
=
(
EIHandle
).
time_stamp
();
long
int
thisTimeStampns
=
(
EIHandle
).
time_stamp_ns_offset
();
uint32_t
thisLB
=
(
EIHandle
).
lumi_block
();
unsigned
long
long
thisEv
=
(
EIHandle
).
event_number
();
boost
::
property_tree
::
ptree
event_tree
;
event_tree
.
put
(
"eventNumber"
,
thisEv
);
event_tree
.
put
(
"LBNumber"
,
thisLB
);
try
{
hltinterface
::
IInfoRegister
::
instance
()
->
beginEvent
(
event_tree
);
if
(
(
thisTimeStamp
-
m_timeTagPosRec
)
>
m_timeTagPosToClear
)
{
std
::
vector
<
long
>&
ee
=
m_IsObject
->
getIntVecField
(
m_evntPos
);
std
::
vector
<
long
>&
tt
=
m_IsObject
->
getIntVecField
(
m_timeTagPos
);
std
::
vector
<
long
>&
ttn
=
m_IsObject
->
getIntVecField
(
m_timeTagPosns
);
int
toBeCleared
=
0
;
for
(
unsigned
int
dd
=
0
;
dd
<
tt
.
size
();
dd
++
){
if
(
(
thisTimeStamp
-
tt
[
dd
]
)
<
m_publishTime
)
{
toBeCleared
=
(
int
)
dd
-
1
;
break
;
}
}
if
(
toBeCleared
>
0
)
{
ee
.
erase
(
ee
.
begin
(),
ee
.
begin
()
+
(
toBeCleared
)
);
tt
.
erase
(
tt
.
begin
(),
tt
.
begin
()
+
(
toBeCleared
)
);
ttn
.
erase
(
ttn
.
begin
(),
ttn
.
begin
()
+
(
toBeCleared
)
);
}
m_timeTagPosRec
=
thisTimeStamp
;
// records to remember when things were cleared
}
// thisTimeStamp if check
m_IsObject
->
appendField
(
m_evntPos
,
std
::
vector
<
long
>
{
0
});
m_IsObject
->
appendField
(
m_timeTagPos
,
std
::
vector
<
long
>
{(
long
int
)
thisTimeStamp
});
m_IsObject
->
appendField
(
m_timeTagPosns
,
std
::
vector
<
long
>
{(
long
int
)
thisTimeStampns
});
hltinterface
::
IInfoRegister
::
instance
()
->
endEvent
(
event_tree
);
}
catch
(
const
std
::
exception
&
ex
){
ATH_MSG_INFO
(
"Caught exception while calling hltinterface::IInfoRegister::instance()->endEvent for event "
<<
thisEv
<<
" at LB "
<<
thisLB
<<
". Exception was "
<<
ex
.
what
());
}
}
// if m_IsObject
ATH_CHECK
(
hypoBaseOutputProcessing
(
outputHandle
)
);
...
...
Trigger/TrigHypothesis/TrigCaloHypo/src/TrigLArNoiseBurstAlg.h
View file @
4dcdc61b
...
...
@@ -5,15 +5,22 @@
#define TRIGCALOHYPO_TRIGLARNOISEBURSTALG
#include <string>
#include <mutex>
#include "GaudiKernel/ToolHandle.h"
#include "DecisionHandling/HypoBase.h"
#include "StoreGate/ReadHandleKey.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "AthenaKernel/SlotSpecificObj.h"
#include "TrigCaloHypo/ITrigLArNoiseBurstHypoTool.h"
#include "CaloEvent/CaloCellContainer.h"
#include "LArRecConditions/LArBadChannelCont.h"
namespace
hltinterface
{
class
GenericHLTContainer
;
}
/**
* @class TrigLArNoiseBurstAlg
* @brief Implements LArNoiseBurst detection for the new HLT framework
...
...
@@ -31,5 +38,17 @@ class TrigLArNoiseBurstAlg : public ::HypoBase {
SG
::
ReadCondHandleKey
<
LArBadFebCont
>
m_knownBadFEBsVecKey
{
this
,
"BadFEBsKey"
,
"LArKnownBadFEBs"
,
"key to read the known Bad FEBs"
};
SG
::
ReadCondHandleKey
<
LArBadFebCont
>
m_knownMNBFEBsVecKey
{
this
,
"MNBFEBsKey"
,
"LArKnownMNBFEBs"
,
"key to read the known MNB FEBs"
};
ToolHandleArray
<
ITrigLArNoiseBurstHypoTool
>
m_hypoTools
{
this
,
"HypoTools"
,
{},
"Hypo tools"
};
// lock for IS publishing
mutable
std
::
mutex
m_pubIS_mtx
;
std
::
shared_ptr
<
hltinterface
::
GenericHLTContainer
>
m_IsObject
;
long
int
m_timeTagPosToClear
;
long
int
m_publishTime
;
std
::
string
m_name_of_is
;
size_t
m_evntPos
;
size_t
m_timeTagPos
;
size_t
m_timeTagPosns
;
mutable
long
int
m_timeTagPosRec
ATLAS_THREAD_SAFE
;
};
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment