ATLAS Offline Software
Loading...
Searching...
No Matches
RDataSource.h
Go to the documentation of this file.
1// Dear emacs, this is -*- c++ -*-
2//
3// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
4//
5#ifndef XAODDATASOURCE_RDATASOURCE_H
6#define XAODDATASOURCE_RDATASOURCE_H
7
8// Local include(s).
9#include "RDataSourceEvent.h"
10
11// Framework include(s).
13
14// ROOT include(s).
15#include <ROOT/RDataSource.hxx>
16#include <ROOT/RStringView.hxx>
17#include <TChain.h>
18
19// System include(s).
20#include <memory>
21#include <string>
22#include <unordered_map>
23#include <vector>
24
25namespace xAOD {
26
35 class RDataSource final : public ROOT::RDF::RDataSource {
36
37 public:
39 RDataSource( std::string_view fileNameGlob,
40 std::string_view treeName = "CollectionTree" );
42 RDataSource( const std::vector< std::string >& fileNames,
43 std::string_view treeName = "CollectionTree" );
46
48 typedef std::vector< std::pair< ULong64_t, ULong64_t > > EntryRanges_t;
49
52
54 virtual void SetNSlots( unsigned int slots ) override final;
56 virtual void Initialize() override final;
58 virtual void
59 InitSlot( unsigned int slot, ULong64_t firstEntry ) override final;
60
62 virtual void FinalizeSlot( unsigned int slot ) override final;
64 virtual void Finalize() override final;
65
67 virtual const std::vector< std::string >&
68 GetColumnNames() const override final;
70 virtual bool HasColumn( std::string_view name ) const override final;
72 virtual std::string
73 GetTypeName( std::string_view column ) const override final;
74
76 virtual EntryRanges_t GetEntryRanges() override final;
78 virtual bool
79 SetEntry( unsigned int slot, ULong64_t entry ) override final;
80
82
84 void setVerboseOutput( Bool_t value = kTRUE );
86 Bool_t isVerboseOutput() const;
87
89 void setAuxMode( TEvent::EAuxMode mode );
91 TEvent::EAuxMode auxMode() const;
92
93 private:
95 virtual Record_t
96 GetColumnReadersImpl( std::string_view column,
97 const std::type_info& typeInfo ) override final;
99 void readInputMetadata();
100
103
109 Bool_t m_verboseOutput = kFALSE;
111 TEvent::EAuxMode m_auxmode = TEvent::kClassAccess;
112
114
117
121 std::unordered_map< std::string, std::string > m_classNameMap;
122
124
127
130
132
135
142
144
145 }; // class RDataSource
146
147} // namespace xAOD
148
149#endif // XAODDATASOURCE_RDATASOURCE_H
STL class.
Extension to xAOD::TEvent, used by xAOD::RDataSource.
std::vector< std::string > m_fileNames
Files to read.
RDataSource(std::string_view fileNameGlob, std::string_view treeName="CollectionTree")
Constructor with the file name pattern.
std::vector< std::pair< ULong64_t, ULong64_t > > EntryRanges_t
Type describing the entry ranges of the input file(s)
Definition RDataSource.h:48
TEvent::EAuxMode m_auxmode
Auxiliary access mode.
~RDataSource()
Destructor.
void readInputMetadata()
Fill the metadata variables.
Bool_t m_verboseOutput
Whether verbose output should be printed or not.
virtual void InitSlot(unsigned int slot, ULong64_t firstEntry) override final
Initialize one of the slots/threads.
void setVerboseOutput(Bool_t value=kTRUE)
Set whether verbose output should be printed (for debugging)
virtual std::string GetTypeName(std::string_view column) const override final
Get the type name of a given column/object.
void setAuxMode(TEvent::EAuxMode mode)
Set the auxiliary access mode.
virtual Record_t GetColumnReadersImpl(std::string_view column, const std::type_info &typeInfo) override final
Return the type-erased vector of pointers to pointers to column values.
std::vector< std::unique_ptr< TStore > > m_stores
In-memory whiteboards used during the event loop.
virtual void FinalizeSlot(unsigned int slot) override final
Close the input file reading in one of the slots/threads.
virtual void Finalize() override final
Finalize the data source, after the event loop.
std::unordered_map< std::string, std::string > m_classNameMap
The object name -> class name map.
virtual bool SetEntry(unsigned int slot, ULong64_t entry) override final
Set which entry a give slot/thread should be processing.
virtual const std::vector< std::string > & GetColumnNames() const override final
Get the column/object names for the input file(s)
std::vector< std::unique_ptr< RDataSourceEvent > > m_events
Event objects performing the file I/O.
TEvent::EAuxMode auxMode() const
Get the auxiliary access mode.
std::vector< std::string > m_columnNames
Names of the columns/objects on the input.
virtual void SetNSlots(unsigned int slots) override final
Set the number of threads/slots that the data source should use.
EntryRanges_t m_entryRanges
Optimal entry ranges to split the processing into.
std::string m_treeName
Name of the event tree in the input files.
virtual EntryRanges_t GetEntryRanges() override final
Get the entry ranges in the input file(s)
std::vector< std::unique_ptr< TChain > > m_chains
Chains used in the file I/O.
virtual void Initialize() override final
Initialize the data source, before the start of the event loop.
virtual bool HasColumn(std::string_view name) const override final
Check if the dataset has a certain column/object.
Bool_t isVerboseOutput() const
Check whether verbose output is set up to be printed.
Tool for accessing xAOD files outside of Athena.
A relatively simple transient store for objects created in analysis.
Definition TStore.h:45
STL namespace.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
#define private