ATLAS Offline Software
Loading...
Searching...
No Matches
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.
15
17
18
20{
21
22 ATH_CHECK(m_eventInfo_key.initialize());
24 ATH_CHECK(m_BCIDDistanceTailKey.initialize());
27 ATH_CHECK(m_BCIDTypeKey.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
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
51 ATH_CHECK( bunchCrossingTool.isValid() );
52
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
Handle class for adding a decoration to an object.
@ BunchCrossings
Distance in units of 25 nanoseconds.
SG::WriteDecorHandleKey< xAOD::EventInfo > m_BCIDGapBeforeTrainMinus12Key
SG::WriteDecorHandleKey< xAOD::EventInfo > m_BCIDGapBeforeTrainKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_BCIDTypeMinus12Key
SG::ReadCondHandleKey< BunchCrossingCondData > m_bunchCrossingKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_BCIDGapAfterTrainMinus12Key
SG::WriteDecorHandleKey< xAOD::EventInfo > m_BCIDDistanceFrontKey
virtual StatusCode addBranches(const EventContext &ctx) const override final
SG::WriteDecorHandleKey< xAOD::EventInfo > m_BCIDDistanceTailKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_BCIDGapAfterTrainKey
Handle class for adding a decoration to an object.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())