ATLAS Offline Software
Commission
CommissionRec
src
CosTriggerTimeAlg.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 "
CosTriggerTimeAlg.h
"
6
7
StatusCode
CosTriggerTimeAlg::initialize
(){
8
ATH_CHECK
(
m_larHitKeys
.initialize());
9
ATH_CHECK
(
m_timeKey
.
initialize
());
10
return
StatusCode::SUCCESS;
11
}
12
13
14
StatusCode
CosTriggerTimeAlg::execute
(
const
EventContext& ctx)
const
{
15
16
double
te = 0;
17
double
e
= 0;
18
int
n
=0;
19
20
SG::WriteHandle<CosTrigTime>
out
(
m_timeKey
,ctx);
21
22
for
(
auto
&
key
:
m_larHitKeys
) {
23
SG::ReadHandle<LArHitContainer>
hits
(
key
,ctx);
24
if
(!
hits
.isValid())
return
StatusCode::FAILURE;
25
26
for
(
const
LArHit
* hit : *
hits
) {
27
e
+= hit->energy();
28
te += hit->energy() * hit->time() ;
29
++
n
;
30
}
31
}
32
33
double
t
=0;
34
if
(
n
==0) {
35
ATH_MSG_INFO
(
"no LArHit in this event"
);
36
}
37
if
(
e
==0) {
38
ATH_MSG_INFO
(
"no LArHit energy in this event"
);
39
}
40
else
{
41
t
= te/
e
;
42
ATH_MSG_DEBUG
(
"average time from LArHit = "
<<
t
);
43
}
44
auto
cosTime=std::make_unique<CosTrigTime>(
t
);
45
ATH_CHECK
(
out
.record(std::move(cosTime)));
46
47
return
StatusCode::SUCCESS;
48
}
AllowedVariables::e
e
Definition:
AsgElectronSelectorTool.cxx:37
TRTCalib_Extractor.hits
hits
Definition:
TRTCalib_Extractor.py:35
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition:
AthMsgStreamMacros.h:31
CosTriggerTimeAlg.h
SG::ReadHandle< LArHitContainer >
python.AthDsoLogger.out
out
Definition:
AthDsoLogger.py:71
read_hist_ntuple.t
t
Definition:
read_hist_ntuple.py:5
CosTriggerTimeAlg::m_larHitKeys
SG::ReadHandleKeyArray< LArHitContainer > m_larHitKeys
Definition:
CosTriggerTimeAlg.h:26
CosTriggerTimeAlg::execute
virtual StatusCode execute(const EventContext &cxt) const
Definition:
CosTriggerTimeAlg.cxx:14
beamspotman.n
n
Definition:
beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition:
AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition:
AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition:
AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
LArHit
Class to store hit energy and time in LAr cell from G4 simulation.
Definition:
LArHit.h:25
SG::WriteHandle
Definition:
StoreGate/StoreGate/WriteHandle.h:76
CosTriggerTimeAlg::m_timeKey
SG::WriteHandleKey< CosTrigTime > m_timeKey
Definition:
CosTriggerTimeAlg.h:27
CosTriggerTimeAlg::initialize
virtual StatusCode initialize()
Definition:
CosTriggerTimeAlg.cxx:7
mapkey::key
key
Definition:
TElectronEfficiencyCorrectionTool.cxx:37
Generated on Mon Dec 23 2024 21:08:40 for ATLAS Offline Software by
1.8.18