ATLAS Offline Software
BoostedHadTopAndTopPairFilterAugmentation.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
9 
10 namespace DerivationFramework {
11 
12 
13 BoostedHadTopAndTopPairFilterAugmentation::BoostedHadTopAndTopPairFilterAugmentation(const std::string& t, const std::string& n, const IInterface* p):
14  AthAlgTool(t,n,p),
15  m_filterTool_High(""),
16  m_filterTool_Low("")
17 {
18 
19  declareInterface<DerivationFramework::IAugmentationTool>(this);
20 
21  declareProperty("EventInfoName",m_eventInfoName="EventInfo");
22  declareProperty("FilterTool_High", m_filterTool_High);
23  declareProperty("FilterTool_Low", m_filterTool_Low);
24 
25 
26 }
27 
28 
29 
31 
32 
33 
35 
36  ATH_MSG_INFO("Initialize " );
37 
38 
39  if(m_filterTool_High.retrieve().isFailure()){
40  ATH_MSG_ERROR("unable to retrieve filter tool " << m_filterTool_High);
41  return StatusCode::FAILURE;
42  }
43 
44  if(m_filterTool_Low.retrieve().isFailure()){
45  ATH_MSG_ERROR("unable to retrieve filter tool " << m_filterTool_Low);
46  return StatusCode::FAILURE;
47  }
48 
49 
50  return StatusCode::SUCCESS;
51 
52 }
53 
54 
55 
57 
58  return StatusCode::SUCCESS;
59 
60 }
61 
62 
63 
65 
66  const xAOD::EventInfo* eventInfo;
67 
68  if (evtStore()->retrieve(eventInfo,m_eventInfoName).isFailure()) {
69  ATH_MSG_ERROR("could not retrieve event info " <<m_eventInfoName);
70  return StatusCode::FAILURE;
71  }
72 
73  // call first the tool for high pT values
74  static const SG::AuxElement::Decorator<int> decorationttbarSysPt_High("TTbar350");
75  static const SG::AuxElement::Decorator<int> decorationHadTopPt_High("HadTop500");
76 
77  int filterCode_High = m_filterTool_High->filterFlag(500000.0, 350000.0);
78 
79  if (filterCode_High == 0 ){
80  decorationHadTopPt_High(*eventInfo) = 0;
81  decorationttbarSysPt_High(*eventInfo) = 0;
82  }
83  else if ( filterCode_High == 1){
84  decorationttbarSysPt_High(*eventInfo) = 1;
85  decorationHadTopPt_High(*eventInfo) = 0;
86  }
87  else if ( filterCode_High == 2){
88  decorationttbarSysPt_High(*eventInfo) = 0;
89  decorationHadTopPt_High(*eventInfo) = 1;
90 
91  }
92  else if ( filterCode_High == 3){
93  decorationttbarSysPt_High(*eventInfo) = 1;
94  decorationHadTopPt_High(*eventInfo) = 1;
95  }
96 
97 
98  // now call tool for low pT values
99  static const SG::AuxElement::Decorator<int> decorationttbarSysPt_Low("TTbar150");
100  static const SG::AuxElement::Decorator<int> decorationHadTopPt_Low("HadTop200");
101 
102  int filterCode_Low = m_filterTool_Low->filterFlag(200000.0, 150000.0);
103 
104  if (filterCode_Low == 0 ){
105  decorationHadTopPt_Low(*eventInfo) = 0;
106  decorationttbarSysPt_Low(*eventInfo) = 0;
107  }
108  else if ( filterCode_Low == 1){
109  decorationttbarSysPt_Low(*eventInfo) = 1;
110  decorationHadTopPt_Low(*eventInfo) = 0;
111  }
112  else if ( filterCode_Low == 2){
113  decorationttbarSysPt_Low(*eventInfo) = 0;
114  decorationHadTopPt_Low(*eventInfo) = 1;
115 
116  }
117  else if ( filterCode_Low == 3){
118  decorationttbarSysPt_Low(*eventInfo) = 1;
119  decorationHadTopPt_Low(*eventInfo) = 1;
120  }
121 
122 
123 
124  //ATH_MSG_INFO("filterCode "<<filterCode );
125 
126 
127  return StatusCode::SUCCESS;
128 
129 }
130 
131 
132 
133 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
DerivationFramework::BoostedHadTopAndTopPairFilterAugmentation::m_eventInfoName
std::string m_eventInfoName
Definition: BoostedHadTopAndTopPairFilterAugmentation.h:40
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
DerivationFramework::BoostedHadTopAndTopPairFilterAugmentation::~BoostedHadTopAndTopPairFilterAugmentation
~BoostedHadTopAndTopPairFilterAugmentation()
Definition: BoostedHadTopAndTopPairFilterAugmentation.cxx:30
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
DerivationFramework::BoostedHadTopAndTopPairFilterAugmentation::m_filterTool_Low
ToolHandle< DerivationFramework::BoostedHadTopAndTopPairFilterTool > m_filterTool_Low
Definition: BoostedHadTopAndTopPairFilterAugmentation.h:42
DerivationFramework::BoostedHadTopAndTopPairFilterAugmentation::finalize
StatusCode finalize()
Definition: BoostedHadTopAndTopPairFilterAugmentation.cxx:56
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
DerivationFramework::BoostedHadTopAndTopPairFilterAugmentation::m_filterTool_High
ToolHandle< DerivationFramework::BoostedHadTopAndTopPairFilterTool > m_filterTool_High
Definition: BoostedHadTopAndTopPairFilterAugmentation.h:41
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:58
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
DerivationFramework::BoostedHadTopAndTopPairFilterAugmentation::addBranches
virtual StatusCode addBranches() const
Pass the thinning service
Definition: BoostedHadTopAndTopPairFilterAugmentation.cxx:64
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
DerivationFramework::BoostedHadTopAndTopPairFilterAugmentation::initialize
StatusCode initialize()
Definition: BoostedHadTopAndTopPairFilterAugmentation.cxx:34
EventInfo.h
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
BoostedHadTopAndTopPairFilterAugmentation.h
tool to add a variable to the EventInfo corresponding to the ttbar+HF filter flag
DerivationFramework::BoostedHadTopAndTopPairFilterAugmentation::BoostedHadTopAndTopPairFilterAugmentation
BoostedHadTopAndTopPairFilterAugmentation(const std::string &t, const std::string &n, const IInterface *p)
Definition: BoostedHadTopAndTopPairFilterAugmentation.cxx:13
AthAlgTool
Definition: AthAlgTool.h:26
BoostedHadTopAndTopPairFilterTool.h