ATLAS Offline Software
ViewContainerThinning.cxx
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // ViewContainerThinning.cxx
8 // Implementation file for class ViewContainerThinning
9 // Author: S.Binet<binet@cern.ch>
11 
12 // DerivationFrameworkJetEtMiss includes
13 #include "ViewContainerThinning.h"
14 
15 // STL includes
16 
17 // FrameWork includes
19 #include "StoreGate/ReadHandle.h"
20 #include "GaudiKernel/ThreadLocalContext.h"
21 
25 
26 
27 
28 namespace DerivationFramework {
29 
30  template <class T>
33  const SG::ReadHandleKey<T>& viewKey) const
34  {
35  const EventContext& ctx = Gaudi::Hive::currentContext();
36 
37  SG::ThinningHandle<T> sourceCont (key, ctx);
38  SG::ReadHandle<T> viewCont (viewKey, ctx);
39 
40  std::vector<bool> masks;
41  masks.assign( sourceCont->size(), false);
42 
43  for( const auto* part: *viewCont){
44  masks[ part->index() ] = true;
45  }
46 
47  sourceCont.keep (masks);
48  return StatusCode::SUCCESS;
49  }
50 
51 
52  // Athena algtool's Hooks
55  {
56  ATH_MSG_INFO ("Initializing " << name() << "...");
57 
59  ATH_CHECK( m_caloClusterKey.initialize (m_streamName, !m_caloClusterKey.empty()) );
61 
65 
66  return StatusCode::SUCCESS;
67  }
68 
70  {
71  return StatusCode::SUCCESS;
72  }
73 
74 
75 
77  {
78 
79  if (!m_trackParticleKey.empty()) {
81  }
82 
83  if (!m_caloClusterKey.empty()) {
85  }
86 
87  if (!m_truthParticleKey.empty()) {
89  }
90  return StatusCode::SUCCESS;
91  }
92 
93 }
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
DerivationFramework::ViewContainerThinning::m_truthParticleKey
SG::ThinningHandleKey< xAOD::TruthParticleContainer > m_truthParticleKey
Definition: ViewContainerThinning.h:62
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ThinningHandleKey
HandleKey object for adding thinning to an object.
Definition: ThinningHandleKey.h:38
ThinningHandle.h
Handle for requesting thinning for a data object.
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
TruthParticleContainer.h
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
ViewContainerThinning.h
SG::ThinningHandle
Handle for requesting thinning for a data object.
Definition: ThinningHandle.h:84
DerivationFramework::ViewContainerThinning::m_trackParticleKey
SG::ThinningHandleKey< xAOD::TrackParticleContainer > m_trackParticleKey
Definition: ViewContainerThinning.h:58
SG::ThinningHandleBase::keep
void keep(size_t ndx)
Mark that index ndx in the container should be kept (not thinned away).
Definition: ThinningHandleBase.cxx:68
DerivationFramework::ViewContainerThinning::m_truthParticleViewKey
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleViewKey
Definition: ViewContainerThinning.h:69
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
DerivationFramework::ViewContainerThinning::m_streamName
StringProperty m_streamName
Definition: ViewContainerThinning.h:55
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::ViewContainerThinning::m_caloClusterKey
SG::ThinningHandleKey< xAOD::CaloClusterContainer > m_caloClusterKey
Definition: ViewContainerThinning.h:60
DerivationFramework::ViewContainerThinning::finalize
virtual StatusCode finalize() override
Definition: ViewContainerThinning.cxx:69
DerivationFramework::ViewContainerThinning::doThinningT
StatusCode doThinningT(const SG::ThinningHandleKey< T > &key, const SG::ReadHandleKey< T > &viewKey) const
Definition: ViewContainerThinning.cxx:32
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
DerivationFramework::ViewContainerThinning::m_trackParticleViewKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trackParticleViewKey
Definition: ViewContainerThinning.h:65
DerivationFramework::ViewContainerThinning::initialize
virtual StatusCode initialize() override
Definition: ViewContainerThinning.cxx:54
DerivationFramework::ViewContainerThinning::doThinning
virtual StatusCode doThinning() const override
Definition: ViewContainerThinning.cxx:76
DerivationFramework::ViewContainerThinning::m_caloClusterViewKey
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_caloClusterViewKey
Definition: ViewContainerThinning.h:67
CaloClusterContainer.h
ReadHandle.h
Handle class for reading from StoreGate.
TrackParticleContainer.h
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37