ATLAS Offline Software
UnassociatedHitsDecorator.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 // UnassociatedHitsDecorator.cxx, (c) ATLAS Detector software
8 // Author: Olivier Arnaez ( olivier.arnaez@cern.ch )
9 
13 
14 #include <vector>
15 #include <utility>
16 #include <string>
17 
18 namespace DerivationFramework {
19 
21  const std::string& name,
22  const IInterface* parent) :
24  {
25  declareInterface<DerivationFramework::IAugmentationTool>(this);
26  }
27 
29  {
30 
31  if (m_sgName.empty()) {
32  ATH_MSG_WARNING("No decoration prefix name provided for the output of UnassociatedHitsDecorator!");
33  }
34 
35  if (m_eventInfoKey.empty()) {
36  ATH_MSG_ERROR("No EventInfo collection provided for UnassociatedHitsDecorator!");
37  return StatusCode::FAILURE;
38  }
40  // retrieve PRD association tool
42 
43  {
44  std::vector<std::string> names;
45  names.resize(kNIntDecor);
46  names[knPixelUADecor] ="nPixelUA";
47  names[knBlayerUADecor] ="nBlayerUA";
48  names[knPixelBarrelUADecor] ="nPixelBarrelUA";
49  names[knPixelEndCapAUADecor] ="nPixelEndCapAUA";
50  names[knPixelEndCapCUADecor] ="nPixelEndCapCUA";
51  names[knSCTUADecor] ="nSCTUA";
52  names[knSCTBarrelUADecor] ="nSCTBarrelUA";
53  names[knSCTEndCapAUADecor] ="nSCTEndCapAUA";
54  names[knSCTEndCapCUADecor] ="nSCTEndCapCUA";
55  names[knTRTUADecor] ="nTRTUA";
56  names[knTRTBarrelUADecor] ="nTRTBarrelUA";
57  names[knTRTEndCapAUADecor] ="nTRTEndCapAUA";
58  names[knTRTEndCapCUADecor] ="nTRTEndCapCUA";
60  }
61  return StatusCode::SUCCESS;
62  }
63 
65  {
66  return StatusCode::SUCCESS;
67  }
68 
70  {
71  ATH_MSG_DEBUG("Adding unassociated hits info to EventInfo");
72  const EventContext& ctx = Gaudi::Hive::currentContext();
73 
75  CHECK( eventInfo.isValid() ? StatusCode::SUCCESS : StatusCode::FAILURE );
76 
77  const MinBiasPRDAssociation* prdAssoc = m_UnassociatedHitsGetterTool->get();
78  std::vector<SG::WriteDecorHandle<xAOD::EventInfo,int> >
79  intDecorators = createDecorators<xAOD::EventInfo,int>(m_intDecorKeys,ctx);
80  if (prdAssoc) {
81  intDecorators[knPixelUADecor](*eventInfo) = prdAssoc->nPixelUA;
82  intDecorators[knBlayerUADecor](*eventInfo) = prdAssoc->nBlayerUA;
83  intDecorators[knPixelBarrelUADecor](*eventInfo) = prdAssoc->nPixelBarrelUA;
84  intDecorators[knPixelEndCapAUADecor](*eventInfo) = prdAssoc->nPixelEndCapAUA;
85  intDecorators[knPixelEndCapCUADecor](*eventInfo) = prdAssoc->nPixelEndCapCUA;
86  intDecorators[knSCTUADecor](*eventInfo) = prdAssoc->nSCTUA;
87  intDecorators[knSCTBarrelUADecor](*eventInfo) = prdAssoc->nSCTBarrelUA;
88  intDecorators[knSCTEndCapAUADecor](*eventInfo) = prdAssoc->nSCTEndCapAUA;
89  intDecorators[knSCTEndCapCUADecor](*eventInfo) = prdAssoc->nSCTEndCapCUA;
90  intDecorators[knTRTUADecor](*eventInfo) = prdAssoc->nTRTUA;
91  intDecorators[knTRTBarrelUADecor](*eventInfo) = prdAssoc->nTRTBarrelUA;
92  intDecorators[knTRTEndCapAUADecor](*eventInfo) = prdAssoc->nTRTEndCapAUA;
93  intDecorators[knTRTEndCapCUADecor](*eventInfo) = prdAssoc->nTRTEndCapCUA;
94 
95  ATH_MSG_DEBUG("Decorating unassociated hits with nPixelBarrelUA = ");
96  ATH_MSG_DEBUG(prdAssoc->nPixelBarrelUA);
97 
98  m_UnassociatedHitsGetterTool->releaseObject(prdAssoc);
99  }
100  else
101  ATH_MSG_WARNING("Could not retrieve Unassociated hits information");
102 
103  return StatusCode::SUCCESS;
104  }
105 
106 }
DecoratorUtils.h
DerivationFramework::UnassociatedHitsDecorator::initialize
StatusCode initialize()
Definition: UnassociatedHitsDecorator.cxx:28
DerivationFramework::createDecoratorKeys
void createDecoratorKeys(T_Parent &parent, const SG::ReadHandleKey< T_Cont > &container_key, const std::string &prefix, const std::vector< std::string > &decor_names, std::vector< SG::WriteDecorHandleKey< T_Cont > > &decor_out)
Definition: DecoratorUtils.h:20
AthMsgStreamMacros.h
MinBiasPRDAssociation::nPixelBarrelUA
int nPixelBarrelUA
Definition: MinBiasPRDAssociation.h:20
MinBiasPRDAssociation::nPixelUA
int nPixelUA
Definition: MinBiasPRDAssociation.h:18
MinBiasPRDAssociation::nPixelEndCapAUA
int nPixelEndCapAUA
Definition: MinBiasPRDAssociation.h:21
DerivationFramework::UnassociatedHitsDecorator::m_intDecorKeys
std::vector< SG::WriteDecorHandleKey< xAOD::EventInfo > > m_intDecorKeys
Definition: UnassociatedHitsDecorator.h:65
UnassociatedHitsDecorator.h
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
DerivationFramework::UnassociatedHitsDecorator::knPixelEndCapCUADecor
@ knPixelEndCapCUADecor
Definition: UnassociatedHitsDecorator.h:55
MinBiasPRDAssociation::nSCTEndCapCUA
int nSCTEndCapCUA
Definition: MinBiasPRDAssociation.h:27
DerivationFramework::UnassociatedHitsDecorator::knSCTEndCapCUADecor
@ knSCTEndCapCUADecor
Definition: UnassociatedHitsDecorator.h:59
DerivationFramework::UnassociatedHitsDecorator::addBranches
virtual StatusCode addBranches() const
Pass the thinning service
Definition: UnassociatedHitsDecorator.cxx:69
DerivationFramework::UnassociatedHitsDecorator::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition: UnassociatedHitsDecorator.h:46
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
MinBiasPRDAssociation::nSCTUA
int nSCTUA
Definition: MinBiasPRDAssociation.h:24
DerivationFramework::UnassociatedHitsDecorator::knPixelUADecor
@ knPixelUADecor
Definition: UnassociatedHitsDecorator.h:51
DerivationFramework::UnassociatedHitsDecorator::kNIntDecor
@ kNIntDecor
Definition: UnassociatedHitsDecorator.h:64
MinBiasPRDAssociation::nTRTEndCapCUA
int nTRTEndCapCUA
Definition: MinBiasPRDAssociation.h:32
DerivationFramework::UnassociatedHitsDecorator::m_sgName
Gaudi::Property< std::string > m_sgName
Definition: UnassociatedHitsDecorator.h:43
MinBiasPRDAssociation::nTRTEndCapAUA
int nTRTEndCapAUA
Definition: MinBiasPRDAssociation.h:31
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
python.subdetectors.mmg.names
names
Definition: mmg.py:8
MinBiasPRDAssociation::nSCTBarrelUA
int nSCTBarrelUA
Definition: MinBiasPRDAssociation.h:25
test_pyathena.parent
parent
Definition: test_pyathena.py:15
DerivationFramework::UnassociatedHitsDecorator::knSCTBarrelUADecor
@ knSCTBarrelUADecor
Definition: UnassociatedHitsDecorator.h:57
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
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
MinBiasPRDAssociation::nSCTEndCapAUA
int nSCTEndCapAUA
Definition: MinBiasPRDAssociation.h:26
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
MinBiasPRDAssociation
Definition: MinBiasPRDAssociation.h:11
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
DerivationFramework::UnassociatedHitsDecorator::knBlayerUADecor
@ knBlayerUADecor
Definition: UnassociatedHitsDecorator.h:52
MinBiasPRDAssociation::nTRTBarrelUA
int nTRTBarrelUA
Definition: MinBiasPRDAssociation.h:30
DerivationFramework::UnassociatedHitsDecorator::knTRTBarrelUADecor
@ knTRTBarrelUADecor
Definition: UnassociatedHitsDecorator.h:61
DerivationFramework::UnassociatedHitsDecorator::knPixelEndCapAUADecor
@ knPixelEndCapAUADecor
Definition: UnassociatedHitsDecorator.h:54
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DerivationFramework::UnassociatedHitsDecorator::knTRTEndCapCUADecor
@ knTRTEndCapCUADecor
Definition: UnassociatedHitsDecorator.h:63
DerivationFramework::UnassociatedHitsDecorator::UnassociatedHitsDecorator
UnassociatedHitsDecorator(const std::string &type, const std::string &name, const IInterface *parent)
Definition: UnassociatedHitsDecorator.cxx:20
DerivationFramework::UnassociatedHitsDecorator::knSCTUADecor
@ knSCTUADecor
Definition: UnassociatedHitsDecorator.h:56
MinBiasPRDAssociation::nPixelEndCapCUA
int nPixelEndCapCUA
Definition: MinBiasPRDAssociation.h:22
AthAlgTool
Definition: AthAlgTool.h:26
DerivationFramework::UnassociatedHitsDecorator::knTRTUADecor
@ knTRTUADecor
Definition: UnassociatedHitsDecorator.h:60
DerivationFramework::UnassociatedHitsDecorator::m_UnassociatedHitsGetterTool
ToolHandle< IUnassociatedHitsGetterTool > m_UnassociatedHitsGetterTool
Definition: UnassociatedHitsDecorator.h:49
DerivationFramework::UnassociatedHitsDecorator::knTRTEndCapAUADecor
@ knTRTEndCapAUADecor
Definition: UnassociatedHitsDecorator.h:62
MinBiasPRDAssociation::nBlayerUA
int nBlayerUA
Definition: MinBiasPRDAssociation.h:19
MinBiasPRDAssociation::nTRTUA
int nTRTUA
Definition: MinBiasPRDAssociation.h:29
DerivationFramework::UnassociatedHitsDecorator::knPixelBarrelUADecor
@ knPixelBarrelUADecor
Definition: UnassociatedHitsDecorator.h:53
DerivationFramework::UnassociatedHitsDecorator::knSCTEndCapAUADecor
@ knSCTEndCapAUADecor
Definition: UnassociatedHitsDecorator.h:58
DerivationFramework::UnassociatedHitsDecorator::finalize
StatusCode finalize()
Definition: UnassociatedHitsDecorator.cxx:64