ATLAS Offline Software
BadBatmanAugmentationTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // BatBatmanAugmentationTool.cxx, (c) ATLAS Detector software
8 // Author: Chris Young (christopher.young@cern.ch)
10 // This code is designed to augment EventInfo with a flag which
11 // labels events which are likely to suffer from excess noise
12 // in the EMEC-IW induced by saturation between trains. This is
13 // based on counting the number of clusters in this |eta| region
14 // of significant pT and bad LAr Quality.
17 
19 
20 namespace DerivationFramework {
21 
23  const std::string& n,
24  const IInterface* p) :
25  AthAlgTool(t,n,p)
26  {
27  declareInterface<DerivationFramework::IAugmentationTool>(this);
28  }
29 
31  {
32 
33  ATH_MSG_INFO("Init BadBatmanAugmentationTool");
34 
38 
39 
40  return StatusCode::SUCCESS;
41  }
42 
44  {
45 
46  ATH_MSG_INFO("Finalize BadBatmanAugmentationTool");
47 
48  return StatusCode::SUCCESS;
49  }
50 
52  {
53  //Running BadBatmanAugmentationTool
54 
55  //Set the name of the variable to augment
56 
58 
59  auto eventInfo = SG::makeHandle (m_eventInfo_key);
60  if (!eventInfo.isValid()){
61  ATH_MSG_WARNING("Invalid xAOD::EventInfo datahandle"
62  << m_eventInfo_key.key());
63  return StatusCode::FAILURE;
64  }
65  auto ei = eventInfo.cptr();
66 
67  auto clusterContainer = SG::makeHandle (m_clusterContainer_key);
68  if(!clusterContainer.isValid()){
69  ATH_MSG_WARNING("Invalid xAOD::CaloClusterContainer datahandle"
71  return StatusCode::FAILURE;
72  }
73  auto clusters = clusterContainer.cptr();
74 
75  //We will now loop over the cluster container counting the number of clusters which pass the criteria
76  bool isBatman=false;
77  size_t nBatman=0;
78  const static SG::AuxElement::ConstAccessor<float> acc_AVGLARQ("AVG_LAR_Q");
79  for ( auto ipart : *clusters ) {
80  if (std::fabs(ipart->rawEta())<=2.5) continue;
81  if (std::fabs(ipart->rawEta())>=3.2) continue;
82  if (ipart->rawE()/cosh(ipart->rawEta())<500.) continue;
83  if (acc_AVGLARQ(*ipart)/65535.<=0.2) continue;
84  nBatman++;
85  }
86  //If we found more than 20 clusters then mark the event as bad
87  if (nBatman>20) isBatman=true;
88  dec_isBadBatman(*ei) = isBatman;
89 
90  return StatusCode::SUCCESS;
91  }
92 }
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
DerivationFramework::BadBatmanAugmentationTool::addBranches
virtual StatusCode addBranches() const
Pass the thinning service
Definition: BadBatmanAugmentationTool.cxx:51
DerivationFramework::BadBatmanAugmentationTool::m_clusterContainer_key
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_clusterContainer_key
Definition: BadBatmanAugmentationTool.h:40
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:54
DerivationFramework::BadBatmanAugmentationTool::m_isBadBatmanKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_isBadBatmanKey
Definition: BadBatmanAugmentationTool.h:42
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
DerivationFramework::BadBatmanAugmentationTool::initialize
StatusCode initialize()
Definition: BadBatmanAugmentationTool.cxx:30
DerivationFramework::BadBatmanAugmentationTool::BadBatmanAugmentationTool
BadBatmanAugmentationTool(const std::string &t, const std::string &n, const IInterface *p)
Definition: BadBatmanAugmentationTool.cxx:22
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:99
WriteDecorHandle.h
Handle class for adding a decoration to an object.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
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
DerivationFramework::BadBatmanAugmentationTool::m_eventInfo_key
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo_key
Definition: BadBatmanAugmentationTool.h:39
SG::WriteDecorHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
RunTileMonitoring.clusters
clusters
Definition: RunTileMonitoring.py:133
AthAlgTool
Definition: AthAlgTool.h:26
BadBatmanAugmentationTool.h
DerivationFramework::BadBatmanAugmentationTool::finalize
StatusCode finalize()
Definition: BadBatmanAugmentationTool.cxx:43