ATLAS Offline Software
Loading...
Searching...
No Matches
BadBatmanAugmentationTool.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 flag which
9// labels events which are likely to suffer from excess noise
10// in the EMEC-IW induced by saturation between trains. This is
11// based on counting the number of clusters in this |eta| region
12// of significant pT and bad LAr Quality.
15
17
18namespace DerivationFramework {
19
21 {
22
23 ATH_MSG_INFO("Init BadBatmanAugmentationTool");
24
25 ATH_CHECK(m_eventInfo_key.initialize());
27 ATH_CHECK(m_isBadBatmanKey.initialize());
28
29
30 return StatusCode::SUCCESS;
31 }
32
33 StatusCode BadBatmanAugmentationTool::addBranches(const EventContext& ctx) const
34 {
35 //Running BadBatmanAugmentationTool
36
37 //Set the name of the variable to augment
38
40
41 auto eventInfo = SG::makeHandle (m_eventInfo_key, ctx);
42 if (!eventInfo.isValid()){
43 ATH_MSG_WARNING("Invalid xAOD::EventInfo datahandle"
44 << m_eventInfo_key.key());
45 return StatusCode::FAILURE;
46 }
47 auto ei = eventInfo.cptr();
48
49 auto clusterContainer = SG::makeHandle (m_clusterContainer_key, ctx);
50 if(!clusterContainer.isValid()){
51 ATH_MSG_WARNING("Invalid xAOD::CaloClusterContainer datahandle"
52 << m_clusterContainer_key.key());
53 return StatusCode::FAILURE;
54 }
55 auto clusters = clusterContainer.cptr();
56
57 //We will now loop over the cluster container counting the number of clusters which pass the criteria
58 bool isBatman=false;
59 size_t nBatman=0;
60 const static SG::AuxElement::ConstAccessor<float> acc_AVGLARQ("AVG_LAR_Q");
61 for ( auto ipart : *clusters ) {
62 if (std::fabs(ipart->rawEta())<=2.5) continue;
63 if (std::fabs(ipart->rawEta())>=3.2) continue;
64 if (ipart->rawE()/cosh(ipart->rawEta())<500.) continue;
65 if (acc_AVGLARQ(*ipart)/65535.<=0.2) continue;
66 nBatman++;
67 }
68 //If we found more than 20 clusters then mark the event as bad
69 if (nBatman>20) isBatman=true;
70 dec_isBadBatman(*ei) = isBatman;
71
72 return StatusCode::SUCCESS;
73 }
74}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
Handle class for adding a decoration to an object.
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo_key
virtual StatusCode addBranches(const EventContext &ctx) const override final
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_clusterContainer_key
SG::WriteDecorHandleKey< xAOD::EventInfo > m_isBadBatmanKey
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:569
Handle class for adding a decoration to an object.
THE reconstruction tool.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())