ATLAS Offline Software
EventViewCreatorAlgorithm.h
Go to the documentation of this file.
1 /*
2  General-purpose view creation algorithm <bwynne@cern.ch>
3 
4  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 #ifndef ViewAlgs_EventViewCreatorAlgorithm_h
8 #define ViewAlgs_EventViewCreatorAlgorithm_h
9 
10 #include <vector>
11 #include <string>
12 
17 
19 
20 #include "GaudiKernel/IAlgResourcePool.h"
21 #include "GaudiKernel/IScheduler.h"
22 #include "AthViews/View.h"
23 
25 
26 // Muon specifics
27 #include "xAODMuon/MuonContainer.h"
30 
31 // Jet specifics
32 #include "xAODJet/JetContainer.h"
34 
45 {
46  public:
47  EventViewCreatorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator );
49  virtual StatusCode initialize() override;
50  virtual StatusCode execute(const EventContext&) const override;
51  virtual StatusCode finalize() override { return StatusCode::SUCCESS; }
52  protected:
53 
55 
56  SG::WriteHandleKey< ViewContainer > m_viewsKey{ this, "Views", "Unspecified",
57  "The key of views collection produced" };
58 
60  "Name of the collection which should be inserted into the just-spawned views to seed them with their ROI" };
61 
62  // needs for views
63  Gaudi::Property< std::string > m_schedulerName { this, "SchedulerName", "AvalancheSchedulerSvc", "Name of the scheduler" };
64  Gaudi::Property< std::string > m_viewNodeName{ this, "ViewNodeName", "", "Name of the ControlFlow node to attach new views to" };
65 
66  Gaudi::Property< bool > m_viewFallThrough { this, "ViewFallThrough", false,
67  "Set whether views may access StoreGate directly to retrieve data" };
68  Gaudi::Property< std::vector< std::string > > m_viewFallFilter { this, "FallThroughFilter", {},
69  "An optional list of SG keys (or parts of them) that can come from StoreGate via FallThrough" };
70 
71  Gaudi::Property< bool > m_requireParentView { this, "RequireParentView", false,
72  "For each new view, locate and link any parent views (previous step). Fail if no parent view can not be found." };
73 
74  Gaudi::Property< bool > m_reverseViews { this, "ReverseViewsDebug", false,
75  "Reverse order of views, as a debugging option" };
76 
78  "Optional ReadHandle on the output (InputMakerOutputDecisions) of an EVCA in a previous Step, whose Views can be re-used. Not currently used." };
79 
80  ToolHandle<IViewCreatorROITool> m_roiTool{this, "RoITool", "",
81  "Tool used to supply per-Decision Object the RoI on which the Decision Object's view is to be spawned"};
82 
85  Gaudi::Property< bool > m_placeMuonInView { this, "PlaceMuonInView", false,
86  "Muon slice specific option. Place Muon and MuonCandidate inside newly spawned View instance. See also InViewMuons, InViewMuonCandidates" };
87 
88  // TODO - phase this out by reading the muon from the parent View. Remove any ambiguity.
90  "Name with which the Muon should be inserted into the views"};
91 
93  "Name with which the Muon Candidate should be inserted into the views"};
94 
99  StatusCode placeMuonInView( const xAOD::Muon* theObject, SG::View* view, const EventContext& context ) const;
101 
104  Gaudi::Property< bool > m_placeJetInView { this, "PlaceJetInView", false,
105  "Jet slice specific option. Place Jet inside newly spawned View instance. See also InViewJets" };
106 
107  //switch off the use of cached EventViews
108  Gaudi::Property< bool > m_cacheDisabled { this, "CacheDisabled", false,
109  "Set whether cached EventViews are to be accessed" };
110 
111  // TODO. In the next iteration, start to use this. Remove "_PROPERTY" which is there to catch against algs with identical properties
113  "Name with which the Jet should be inserted into the views"};
114 
118  StatusCode placeJetInView( const xAOD::Jet* theObject, SG::View* view, const EventContext& context ) const;
120 
124  StatusCode linkViewToParent( const TrigCompositeUtils::Decision* outputDecision, SG::View* newView ) const;
125 
129  StatusCode placeRoIInView( const ElementLink<TrigRoiDescriptorCollection>& roi, SG::View* view, const EventContext& context ) const;
130 
134  SmartIF<IScheduler> getScheduler() const;
135 
140  bool checkCache(const TrigCompositeUtils::DecisionContainer* cachedViews,
141  const TrigCompositeUtils::Decision* outputDecision,
142  size_t& cachedIndex,
143  MatchingCache& matchingCache,
144  const EventContext& context) const;
145 
151  StatusCode populateMatchingCacheWithCachedViews(const TrigCompositeUtils::DecisionContainer* cachedViews, MatchingCache& matchingCache, const EventContext& context) const;
152 
153  private:
154 
158  std::vector<TrigCompositeUtils::LinkInfo<ViewContainer>> viewsToLink(const TrigCompositeUtils::Decision* outputDecision) const;
159 
160 };
161 
163 
164 #endif
165 
EventViewCreatorAlgorithm::m_inViewMuonCandidates
SG::WriteHandleKey< ConstDataVector< MuonCandidateCollection > > m_inViewMuonCandidates
Definition: EventViewCreatorAlgorithm.h:92
EventViewCreatorAlgorithm::m_requireParentView
Gaudi::Property< bool > m_requireParentView
Definition: EventViewCreatorAlgorithm.h:71
EventViewCreatorAlgorithm::populateMatchingCacheWithCachedViews
StatusCode populateMatchingCacheWithCachedViews(const TrigCompositeUtils::DecisionContainer *cachedViews, MatchingCache &matchingCache, const EventContext &context) const
We look for matching Decision Objects in a matchingCache.
Definition: EventViewCreatorAlgorithm.cxx:248
EventViewCreatorAlgorithm::m_viewFallFilter
Gaudi::Property< std::vector< std::string > > m_viewFallFilter
Definition: EventViewCreatorAlgorithm.h:68
EventViewCreatorAlgorithm::~EventViewCreatorAlgorithm
virtual ~EventViewCreatorAlgorithm()
Definition: EventViewCreatorAlgorithm.cxx:20
TrigCompositeUtils.h
InputMakerBase.h
EventViewCreatorAlgorithm::linkViewToParent
StatusCode linkViewToParent(const TrigCompositeUtils::Decision *outputDecision, SG::View *newView) const
Makes sure the views are linked, if configuration requireParentView is set.
Definition: EventViewCreatorAlgorithm.cxx:263
ConstDataVector.h
DataVector adapter that acts like it holds const pointers.
EventViewCreatorAlgorithm::m_cachedViewsKey
SG::ReadHandleKey< TrigCompositeUtils::DecisionContainer > m_cachedViewsKey
Definition: EventViewCreatorAlgorithm.h:77
EventViewCreatorAlgorithm::getScheduler
SmartIF< IScheduler > getScheduler() const
Obtain smart pointer to scheduler in order to schedule newly spawned views.
InputMakerBase
Input Makers are used at the start of a sequence: retrieve filtered collection via the input decision...
Definition: InputMakerBase.h:20
IViewCreatorROITool.h
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
EventViewCreatorAlgorithm::placeMuonInView
StatusCode placeMuonInView(const xAOD::Muon *theObject, SG::View *view, const EventContext &context) const
Creates a SG::VIEW_ELEMENTS collection inside a newly created View populated by the MuonCombined::Muo...
Definition: EventViewCreatorAlgorithm.cxx:310
EventViewCreatorAlgorithm::m_inViewJets
SG::WriteHandleKey< xAOD::JetContainer > m_inViewJets
Definition: EventViewCreatorAlgorithm.h:112
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
EventViewCreatorAlgorithm::m_reverseViews
Gaudi::Property< bool > m_reverseViews
Definition: EventViewCreatorAlgorithm.h:74
MuonAuxContainer.h
AthAlgorithm.h
EventViewCreatorAlgorithm::m_roiTool
ToolHandle< IViewCreatorROITool > m_roiTool
Definition: EventViewCreatorAlgorithm.h:80
EventViewCreatorAlgorithm
Used at the start of a sequence to create the EventViews: retrieves filtered collections via menu dec...
Definition: EventViewCreatorAlgorithm.h:45
EventViewCreatorAlgorithm.icc
EventViewCreatorAlgorithm::m_inViewMuons
SG::WriteHandleKey< xAOD::MuonContainer > m_inViewMuons
Definition: EventViewCreatorAlgorithm.h:89
SG::WriteHandleKey< ViewContainer >
EventViewCreatorAlgorithm::finalize
virtual StatusCode finalize() override
Definition: EventViewCreatorAlgorithm.h:51
EventViewCreatorAlgorithm::m_inViewRoIs
SG::WriteHandleKey< ConstDataVector< TrigRoiDescriptorCollection > > m_inViewRoIs
Definition: EventViewCreatorAlgorithm.h:59
EventViewCreatorAlgorithm::initialize
virtual StatusCode initialize() override
Definition: EventViewCreatorAlgorithm.cxx:22
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
EventViewCreatorAlgorithm::execute
virtual StatusCode execute(const EventContext &) const override
Definition: EventViewCreatorAlgorithm.cxx:48
EventViewCreatorAlgorithm::m_viewFallThrough
Gaudi::Property< bool > m_viewFallThrough
Definition: EventViewCreatorAlgorithm.h:66
EventViewCreatorAlgorithm::viewsToLink
std::vector< TrigCompositeUtils::LinkInfo< ViewContainer > > viewsToLink(const TrigCompositeUtils::Decision *outputDecision) const
Obtain view(s) from most recent prior step(s) which are to be wired up.
Definition: EventViewCreatorAlgorithm.cxx:183
EventViewCreatorAlgorithm::m_viewsKey
SG::WriteHandleKey< ViewContainer > m_viewsKey
Definition: EventViewCreatorAlgorithm.h:56
EventViewCreatorAlgorithm::m_viewNodeName
Gaudi::Property< std::string > m_viewNodeName
Definition: EventViewCreatorAlgorithm.h:64
EventViewCreatorAlgorithm::EventViewCreatorAlgorithm
EventViewCreatorAlgorithm()
xAOD::TrigComposite_v1
Class used to describe composite objects in the HLT.
Definition: TrigComposite_v1.h:52
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
MuonCandidateCollection.h
EventViewCreatorAlgorithm::m_cacheDisabled
Gaudi::Property< bool > m_cacheDisabled
Definition: EventViewCreatorAlgorithm.h:108
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
MuonContainer.h
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
EventViewCreatorAlgorithm::placeJetInView
StatusCode placeJetInView(const xAOD::Jet *theObject, SG::View *view, const EventContext &context) const
Creates a SG::VIEW_ELEMENTS collection inside a newly created View populated by the jet used to seed ...
Definition: EventViewCreatorAlgorithm.cxx:339
JetContainer.h
EventViewCreatorAlgorithm::m_placeMuonInView
Gaudi::Property< bool > m_placeMuonInView
Definition: EventViewCreatorAlgorithm.h:85
EventViewCreatorAlgorithm::m_schedulerName
Gaudi::Property< std::string > m_schedulerName
Definition: EventViewCreatorAlgorithm.h:63
JetAuxContainer.h
EventViewCreatorAlgorithm::m_placeJetInView
Gaudi::Property< bool > m_placeJetInView
Definition: EventViewCreatorAlgorithm.h:104
View.h
EventViewCreatorAlgorithm::placeRoIInView
StatusCode placeRoIInView(const ElementLink< TrigRoiDescriptorCollection > &roi, SG::View *view, const EventContext &context) const
Seeds a newly created view with an ROI collection containing the single seeding ROI.
Definition: EventViewCreatorAlgorithm.cxx:294
SG::View
Definition: View.h:25
EventViewCreatorAlgorithm::checkCache
bool checkCache(const TrigCompositeUtils::DecisionContainer *cachedViews, const TrigCompositeUtils::Decision *outputDecision, size_t &cachedIndex, MatchingCache &matchingCache, const EventContext &context) const
Allow for the re-use of EventViews run in a previous Step in another EVCA instance configured to spaw...
Definition: EventViewCreatorAlgorithm.cxx:187
TrigRoiDescriptorCollection.h
InputMakerBase::MatchingCache
Used to cache each incoming Decision object's ElementLink which is being used to identify the Decisio...
Definition: InputMakerBase.h:35
drawFromPickle.view
view
Definition: drawFromPickle.py:294