ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
DerivationFramework
DerivationFrameworkJetEtMiss
src
DistanceInTrainAugmentationTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// Author: Chris Young (christopher.young@cern.ch)
8
// This code is designed to augment EventInfo with a variety
9
// of variables to describe where in the bunch train structure
10
// a given event lies. Care is taken to ensure that new trains
11
// are not defined at the abort gap or 4 non-colliding crossings
12
// in the 8b4e scheme.
14
#include "
DistanceInTrainAugmentationTool.h
"
15
16
#include "
StoreGate/WriteDecorHandle.h
"
17
18
19
StatusCode
DerivationFramework::DistanceInTrainAugmentationTool::initialize
()
20
{
21
22
ATH_CHECK
(
m_eventInfo_key
.initialize());
23
ATH_CHECK
(
m_BCIDDistanceFrontKey
.initialize());
24
ATH_CHECK
(
m_BCIDDistanceTailKey
.initialize());
25
ATH_CHECK
(
m_BCIDGapBeforeTrainKey
.initialize());
26
ATH_CHECK
(
m_BCIDGapAfterTrainKey
.initialize());
27
ATH_CHECK
(
m_BCIDTypeKey
.initialize());
28
ATH_CHECK
(
m_BCIDGapBeforeTrainMinus12Key
.initialize());
29
ATH_CHECK
(
m_BCIDGapAfterTrainMinus12Key
.initialize());
30
ATH_CHECK
(
m_BCIDTypeMinus12Key
.initialize());
31
32
ATH_MSG_VERBOSE
(
"initialize() .."
);
33
ATH_CHECK
(
m_bunchCrossingKey
.initialize() );
34
ATH_MSG_INFO
(
"The bunch crossing conditions key being used: "
<<
m_bunchCrossingKey
);
35
36
return
StatusCode::SUCCESS;
37
}
38
39
40
StatusCode
DerivationFramework::DistanceInTrainAugmentationTool::addBranches
(
const
EventContext& ctx)
const
{
41
42
auto
eventInfo =
SG::makeHandle
(
m_eventInfo_key
, ctx);
43
if
(!eventInfo.isValid()){
44
ATH_MSG_WARNING
(
"Invalid xAOD::EventInfo datahandle"
45
<<
m_eventInfo_key
.key());
46
return
StatusCode::FAILURE;
47
}
48
auto
ei = eventInfo.cptr();
49
50
SG::ReadCondHandle<BunchCrossingCondData>
bunchCrossingTool (
m_bunchCrossingKey
, ctx);
51
ATH_CHECK
( bunchCrossingTool.
isValid
() );
52
53
SG::WriteDecorHandle<xAOD::EventInfo,int>
dec_BCIDDistanceFront(
m_BCIDDistanceFrontKey
, ctx);
54
SG::WriteDecorHandle<xAOD::EventInfo,int>
dec_BCIDDistanceTail(
m_BCIDDistanceTailKey
, ctx);
55
SG::WriteDecorHandle<xAOD::EventInfo,int>
dec_BCIDGapBeforeTrain(
m_BCIDGapBeforeTrainKey
, ctx);
56
SG::WriteDecorHandle<xAOD::EventInfo,int>
dec_BCIDGapAfterTrain(
m_BCIDGapAfterTrainKey
, ctx);
57
SG::WriteDecorHandle<xAOD::EventInfo,int>
dec_BCIDType(
m_BCIDTypeKey
, ctx);
58
SG::WriteDecorHandle<xAOD::EventInfo,int>
dec_BCIDGapBeforeTrainMinus12(
m_BCIDGapBeforeTrainMinus12Key
, ctx);
59
SG::WriteDecorHandle<xAOD::EventInfo,int>
dec_BCIDGapAfterTrainMinus12(
m_BCIDGapAfterTrainMinus12Key
, ctx);
60
SG::WriteDecorHandle<xAOD::EventInfo,int>
dec_BCIDTypeMinus12(
m_BCIDTypeMinus12Key
, ctx);
61
62
dec_BCIDDistanceFront(*ei) = bunchCrossingTool->distanceFromFront(ei->bcid(),
BunchCrossingCondData::BunchDistanceType::BunchCrossings
);
63
dec_BCIDDistanceTail(*ei) = bunchCrossingTool->distanceFromTail(ei->bcid(),
BunchCrossingCondData::BunchDistanceType::BunchCrossings
);
64
dec_BCIDGapBeforeTrain(*ei) = bunchCrossingTool->gapBeforeTrain(ei->bcid(),
BunchCrossingCondData::BunchDistanceType::BunchCrossings
);
65
dec_BCIDGapAfterTrain(*ei) = bunchCrossingTool->gapAfterTrain(ei->bcid(),
BunchCrossingCondData::BunchDistanceType::BunchCrossings
);
66
dec_BCIDType(*ei) = bunchCrossingTool->bcType(ei->bcid());
67
if
(ei->bcid()>=12){
68
dec_BCIDTypeMinus12(*ei) = bunchCrossingTool->bcType(ei->bcid()-12);
69
dec_BCIDGapBeforeTrainMinus12(*ei) = bunchCrossingTool->gapBeforeTrain(ei->bcid()-12,
BunchCrossingCondData::BunchDistanceType::BunchCrossings
);
70
dec_BCIDGapAfterTrainMinus12(*ei) = bunchCrossingTool->gapAfterTrain(ei->bcid()-12,
BunchCrossingCondData::BunchDistanceType::BunchCrossings
);
71
}
else
{
72
dec_BCIDTypeMinus12(*ei) = -1;
73
dec_BCIDGapBeforeTrainMinus12(*ei) = 0;
74
dec_BCIDGapAfterTrainMinus12(*ei) = 0;
75
}
76
77
return
StatusCode::SUCCESS;
78
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
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_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
DistanceInTrainAugmentationTool.h
WriteDecorHandle.h
Handle class for adding a decoration to an object.
BunchCrossingCondData::BunchCrossings
@ BunchCrossings
Distance in units of 25 nanoseconds.
Definition
BunchCrossingCondData.h:132
DerivationFramework::DistanceInTrainAugmentationTool::m_BCIDGapBeforeTrainMinus12Key
SG::WriteDecorHandleKey< xAOD::EventInfo > m_BCIDGapBeforeTrainMinus12Key
Definition
DistanceInTrainAugmentationTool.h:43
DerivationFramework::DistanceInTrainAugmentationTool::m_BCIDTypeKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_BCIDTypeKey
Definition
DistanceInTrainAugmentationTool.h:42
DerivationFramework::DistanceInTrainAugmentationTool::m_BCIDGapBeforeTrainKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_BCIDGapBeforeTrainKey
Definition
DistanceInTrainAugmentationTool.h:40
DerivationFramework::DistanceInTrainAugmentationTool::m_eventInfo_key
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo_key
Definition
DistanceInTrainAugmentationTool.h:36
DerivationFramework::DistanceInTrainAugmentationTool::m_BCIDTypeMinus12Key
SG::WriteDecorHandleKey< xAOD::EventInfo > m_BCIDTypeMinus12Key
Definition
DistanceInTrainAugmentationTool.h:45
DerivationFramework::DistanceInTrainAugmentationTool::m_bunchCrossingKey
SG::ReadCondHandleKey< BunchCrossingCondData > m_bunchCrossingKey
Definition
DistanceInTrainAugmentationTool.h:34
DerivationFramework::DistanceInTrainAugmentationTool::m_BCIDGapAfterTrainMinus12Key
SG::WriteDecorHandleKey< xAOD::EventInfo > m_BCIDGapAfterTrainMinus12Key
Definition
DistanceInTrainAugmentationTool.h:44
DerivationFramework::DistanceInTrainAugmentationTool::m_BCIDDistanceFrontKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_BCIDDistanceFrontKey
Definition
DistanceInTrainAugmentationTool.h:38
DerivationFramework::DistanceInTrainAugmentationTool::addBranches
virtual StatusCode addBranches(const EventContext &ctx) const override final
Definition
DistanceInTrainAugmentationTool.cxx:40
DerivationFramework::DistanceInTrainAugmentationTool::m_BCIDDistanceTailKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_BCIDDistanceTailKey
Definition
DistanceInTrainAugmentationTool.h:39
DerivationFramework::DistanceInTrainAugmentationTool::m_BCIDGapAfterTrainKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_BCIDGapAfterTrainKey
Definition
DistanceInTrainAugmentationTool.h:41
DerivationFramework::DistanceInTrainAugmentationTool::initialize
virtual StatusCode initialize() override final
Definition
DistanceInTrainAugmentationTool.cxx:19
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadCondHandle::isValid
bool isValid()
Definition
ReadCondHandle.h:205
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition
StoreGate/StoreGate/WriteDecorHandle.h:100
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition
ReadCondHandle.h:269
Generated on
for ATLAS Offline Software by
1.17.0