ATLAS Offline Software
Loading...
Searching...
No Matches
columnar::ColumnarPhysLiteTest Struct Reference

#include <ColumnarPhysliteTest.h>

Inheritance diagram for columnar::ColumnarPhysLiteTest:
Collaboration diagram for columnar::ColumnarPhysLiteTest:

Public Member Functions

 ColumnarPhysLiteTest ()
 ~ColumnarPhysLiteTest ()
std::string makeUniqueName ()
 make a unique tool name to be used in unit tests
void setupKnownColumns (const TestUtils::TestDefinition &testDefinition)
void setupColumns (ToolColumnVectorMap &toolWrapper)
void doCall (const TestUtils::TestDefinition &testDefinition)

Static Public Member Functions

static bool checkMode ()
 check whether we have the right mode

Public Attributes

std::unique_ptr< TFile > file
TTree * tree = nullptr
std::vector< std::shared_ptr< TestUtils::IColumnData > > knownColumns
std::vector< std::shared_ptr< TestUtils::IColumnData > > usedColumns
std::unordered_map< std::string, const std::vector< ColumnarOffsetType > * > offsetColumns

Detailed Description

Definition at line 36 of file ColumnarPhysliteTest.h.

Constructor & Destructor Documentation

◆ ColumnarPhysLiteTest()

columnar::ColumnarPhysLiteTest::ColumnarPhysLiteTest ( )

Definition at line 1752 of file ColumnarPhysliteTest.cxx.

1754 {
1755 static std::once_flag flag;
1756 std::call_once (flag, [] ()
1757 {
1758#ifdef XAOD_STANDALONE
1759 xAOD::Init().ignore();
1760#else
1761 POOL::Init();
1762#endif
1763 });
1764
1765 auto *fileName = getenv ("ASG_TEST_FILE_LITE_MC");
1766 if (fileName == nullptr)
1767 throw std::runtime_error ("missing ASG_TEST_FILE_LITE_MC");
1768 file.reset (TFile::Open (fileName, "READ"));
1769 if (!file)
1770 throw std::runtime_error ("failed to open file");
1771 tree = dynamic_cast<TTree*> (file->Get ("CollectionTree"));
1772 if (!tree)
1773 throw std::runtime_error ("failed to open tree");
1774 }
IAppMgrUI * Init(const char *options="POOLRootAccess/basic.opts")
Bootstraps (creates and configures) the Gaudi Application with the provided options file.
std::string getenv(const std::string &variableName)
get an environment variable
bool flag
Definition master.py:29
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
Definition Init.cxx:31

◆ ~ColumnarPhysLiteTest()

columnar::ColumnarPhysLiteTest::~ColumnarPhysLiteTest ( )
default

Member Function Documentation

◆ checkMode()

bool columnar::ColumnarPhysLiteTest::checkMode ( )
static

check whether we have the right mode

Definition at line 1784 of file ColumnarPhysliteTest.cxx.

1786 {
1787 return true;
1788 }

◆ doCall()

void columnar::ColumnarPhysLiteTest::doCall ( const TestUtils::TestDefinition & testDefinition)

Definition at line 2021 of file ColumnarPhysliteTest.cxx.

2022 {
2023 using namespace asg::msgUserCode;
2024 auto userConfiguration = TestUtils::UserConfiguration::fromEnvironment();
2025
2026 if (!testDefinition.sysName.empty())
2027 {
2028 auto *sysTool = dynamic_cast<CP::ISystematicsTool*>(testDefinition.tool);
2029 if (!sysTool)
2030 throw std::runtime_error ("tool does not support systematics");
2031 std::cout << "applying systematic variation: " << testDefinition.sysName << std::endl;
2032 if (sysTool->applySystematicVariation (CP::SystematicSet (testDefinition.sysName)).isFailure())
2033 throw std::runtime_error ("failed to apply systematic variation: " + testDefinition.sysName);
2034 }
2035 if constexpr (columnarAccessMode == 2)
2036 {
2037 auto *myTool = dynamic_cast<ColumnarTool<ColumnarModeArray>*>(testDefinition.tool);
2038 if (!testDefinition.containerRenames.empty())
2039 renameContainers (*myTool, testDefinition.containerRenames);
2040 ColumnVectorHeader columnHeader;
2041 ToolColumnVectorMap toolWrapper (columnHeader, *myTool);
2042
2043 setupKnownColumns (testDefinition);
2044 setupColumns (toolWrapper);
2045
2046 Benchmark benchmarkCall (testDefinition.name, userConfiguration.batchSize);
2047 Benchmark benchmarkCall2 (testDefinition.name + "(call2)", userConfiguration.batchSize);
2048 Benchmark benchmarkCheck (testDefinition.name + "(column check)", userConfiguration.batchSize);
2049 Benchmark benchmarkEmpty ("empty");
2050
2051 const auto numberOfEvents = tree->GetEntries();
2052 Long64_t entry = 0;
2053 const auto startTime = std::chrono::high_resolution_clock::now();
2054 bool endLoop = false;
2055 for (; !endLoop; ++entry)
2056 {
2057 // just sample how much overhead there is for starting and
2058 // stopping the timer
2059 benchmarkEmpty.startTimer ();
2060 benchmarkEmpty.stopTimer ();
2061
2062 ColumnVectorData columnData (&columnHeader);
2063 TestUtils::ToolWrapperData toolColumnData (&columnData, &toolWrapper);
2064 for (auto& column : usedColumns)
2065 column->getEntry (entry % numberOfEvents);
2066 if ((entry + 1) % userConfiguration.batchSize == 0)
2067 {
2068 if (entry < numberOfEvents)
2069 {
2070 for (auto& column : usedColumns)
2071 column->collectColumnData ();
2072 }
2073 for (auto& column : usedColumns)
2074 column->setData (toolColumnData);
2075 benchmarkCheck.startTimer ();
2076 columnData.checkData ();
2077 benchmarkCheck.stopTimer ();
2078 benchmarkCall.startTimer ();
2079 columnData.callNoCheck (*myTool);
2080 benchmarkCall.stopTimer ();
2081 if (userConfiguration.runToolTwice)
2082 {
2083 benchmarkCall2.startTimer ();
2084 columnData.callNoCheck (*myTool);
2085 benchmarkCall2.stopTimer ();
2086 }
2087 for (auto& column : usedColumns)
2088 column->clearColumns ();
2089 if ((std::chrono::high_resolution_clock::now() - startTime) > userConfiguration.targetTime)
2090 endLoop = true;
2091 } else if (entry + 1 == numberOfEvents)
2092 {
2093 for (auto& column : usedColumns)
2094 column->collectColumnData ();
2095 }
2096 }
2097 std::cout << "Entries in file: " << numberOfEvents << std::endl;
2098 std::cout << "Total entries read: " << entry << std::endl;
2099 const float emptyTime = benchmarkEmpty.getEntryTime(0).value();
2100 std::cout << "Empty benchmark time: " << emptyTime << "ns" << std::endl;
2101 benchmarkEmpty.setSilence();
2102 {
2103 std::vector<TestUtils::BranchPerfData> branchPerfData;
2104 TestUtils::BranchPerfData summary;
2105 summary.name = "total";
2106 summary.timeRead = 0;
2107 summary.timeUnpack = 0;
2108 summary.timeShallowCopy = 0;
2109 summary.entries = std::nullopt;
2110 summary.nullEntries = std::nullopt;
2111 for (auto& column : usedColumns)
2112 {
2113 branchPerfData.push_back (column->getPerfData (emptyTime));
2114 summary.timeRead.value() += branchPerfData.back().timeRead.value_or(0);
2115 summary.timeUnpack.value() += branchPerfData.back().timeUnpack.value_or(0);
2116 summary.timeShallowCopy.value() += branchPerfData.back().timeShallowCopy.value_or(0);
2117 }
2118 std::sort (branchPerfData.begin(), branchPerfData.end(), [] (const auto& a, const auto& b) {return a.name < b.name;});
2119 branchPerfData.insert (branchPerfData.end(), summary);
2120 const std::size_t nameWidth = std::max_element (branchPerfData.begin(), branchPerfData.end(), [] (const auto& a, const auto& b) {return a.name.size() < b.name.size();})->name.size();
2121 std::string header = std::format ("{:{}} | read(ns) | unpack(ns) | size(B) | rate(MB/s) | compression | baskets | entries | null", "branch name", nameWidth);
2122 std::cout << "\n" << header << std::endl;
2123 std::cout << std::string (header.size(), '-') << std::endl;
2124 for (auto& data : branchPerfData)
2125 {
2126 if (data.name == "total")
2127 std::cout << std::string (header.size(), '-') << std::endl;
2128 std::cout << std::format ("{:{}} |", data.name, nameWidth);
2129 if (data.timeRead)
2130 std::cout << std::format ("{:>9.0f} |", data.timeRead.value());
2131 else
2132 std::cout << " |";
2133 if (data.timeUnpack)
2134 std::cout << std::format ("{:>11.1f} |", data.timeUnpack.value());
2135 else
2136 std::cout << " |";
2137 if (data.entrySize)
2138 std::cout << std::format ("{:>8.1f} |", data.entrySize.value());
2139 else
2140 std::cout << " |";
2141 if (data.timeRead && data.entrySize)
2142 std::cout << std::format ("{:>11.1f} |", (data.entrySize.value() / (data.timeRead.value() * 1e-3 * 1.024 * 1.024)));
2143 else
2144 std::cout << " |";
2145 if (data.entrySize && data.uncompressedSize)
2146 std::cout << std::format ("{:>12.2f} |", float (data.uncompressedSize.value()) / data.entrySize.value());
2147 else
2148 std::cout << " |";
2149 if (data.numBaskets)
2150 std::cout << std::format ("{:>8} |", data.numBaskets.value());
2151 else
2152 std::cout << " |";
2153 if (data.entries)
2154 std::cout << std::format ("{:>8.2f} |", static_cast<float>(data.entries.value())/numberOfEvents);
2155 else
2156 std::cout << " |";
2157 if (data.nullEntries && data.entries)
2158 std::cout << std::format ("{:>4.0f}%", static_cast<float>(data.nullEntries.value()) / data.entries.value() * 100.0f);
2159 std::cout << std::endl;
2160 }
2161 }
2162 {
2163 std::vector<TestUtils::ToolPerfData> toolPerfData;
2164 toolPerfData.emplace_back ();
2165 toolPerfData.back().name = testDefinition.name;
2166 toolPerfData.back().timeCall = benchmarkCall.getEntryTime(emptyTime);
2167 if (userConfiguration.runToolTwice)
2168 toolPerfData.back().timeCall2 = benchmarkCall2.getEntryTime(emptyTime);
2169 toolPerfData.back().timeCheck = benchmarkCheck.getEntryTime(emptyTime);
2170 benchmarkCall.setSilence();
2171 benchmarkCall2.setSilence();
2172 benchmarkCheck.setSilence();
2173 const std::size_t nameWidth = std::max_element (toolPerfData.begin(), toolPerfData.end(), [] (const auto& a, const auto& b) {return a.name.size() < b.name.size();})->name.size();
2174 std::string header = std::format ("{:{}} | call(ns) | call2(ns) | check(ns)", "tool name", nameWidth);
2175 std::cout << "\n" << header << std::endl;
2176 std::cout << std::string (header.size(), '-') << std::endl;
2177 for (auto& data : toolPerfData)
2178 {
2179 std::cout << std::format ("{:{}} |", data.name, nameWidth);
2180 if (data.timeCall)
2181 std::cout << std::format ("{:>9.0f} |", data.timeCall.value());
2182 else
2183 std::cout << " |";
2184 if (data.timeCall2)
2185 std::cout << std::format ("{:>10.0f} |", data.timeCall2.value());
2186 else
2187 std::cout << " |";
2188 if (data.timeCheck)
2189 std::cout << std::format ("{:>10.1f}", data.timeCheck.value());
2190 std::cout << std::endl;
2191 }
2192 }
2193 } else if constexpr (columnarAccessMode == 0)
2194 {
2195 // this test simply doesn't work in Athena
2196#ifdef XAOD_STANDALONE
2197 xAOD::TEvent event;
2198 xAOD::TStore store;
2199#else
2200 POOL::TEvent event;
2201#endif
2202 ANA_CHECK_THROW (event.readFrom (file.get()));
2203
2204#ifdef XAOD_STANDALONE
2205 Benchmark benchmarkEmptyClear (testDefinition.name + " empty clear");
2206 Benchmark benchmarkCallClear (testDefinition.name + " call clear");
2207 Benchmark benchmarkPrepClear (testDefinition.name + " prep clear");
2208#endif
2209 Benchmark benchmarkRepeatCall (testDefinition.name + " repeat-call");
2210 Benchmark benchmarkCall (testDefinition.name + " call");
2211 Benchmark benchmarkCallCopyRecord (testDefinition.name + " call copy-record");
2212 Benchmark benchmarkCallRetrieve (testDefinition.name + " call retrieve");
2213 Benchmark benchmarkPrep (testDefinition.name + " prep");
2214 Benchmark benchmarkPrepCopyRecord (testDefinition.name + " prep copy-record");
2215 Benchmark benchmarkPrepRetrieve (testDefinition.name + " prep retrieve");
2216 Benchmark benchmarkGetEntry (testDefinition.name + " getEntry");
2217
2218 const auto numberOfEvents = event.getEntries();
2219#ifdef XAOD_STANDALONE
2220 std::cout << "known container keys:" << std::endl;
2221 for (auto& [container, key] : columnar::TestUtils::knownKeys)
2222 {
2223 std::cout << std::format (" {} -> 0x{:x}, 0x{:x} -> {}", container, event.getHash (container), key, event.getName (key)) << std::endl;
2224 }
2225#endif
2226 if (numberOfEvents == 0){
2227 throw std::runtime_error ("ColumnarPhysLiteTest: numberOfEvents == 0");
2228 }
2229 Long64_t entry = 0;
2230
2231 // Instead of running for a fixed number of events, we run for a
2232 // fixed amount of time. That is because individual tools can
2233 // vary wildly in how long they take to run, and we mostly want to
2234 // make sure that we ran the tool enough to get a precise
2235 // performance estimate.
2236 const auto startTime = std::chrono::high_resolution_clock::now();
2237 for (; (std::chrono::high_resolution_clock::now() - startTime) < userConfiguration.targetTime; ++entry)
2238 {
2239 benchmarkGetEntry.startTimer ();
2240 event.getEntry (entry % numberOfEvents);
2241 benchmarkGetEntry.stopTimer ();
2242 benchmarkPrepRetrieve.startTimer ();
2243 ASSERT_SUCCESS (testDefinition.xAODToolCaller->retrieve (*testDefinition.tool->evtStore()));
2244 benchmarkPrepRetrieve.stopTimer ();
2245 benchmarkPrepCopyRecord.startTimer ();
2246 static const std::string prepPostfix = "Prep";
2247 ASSERT_SUCCESS (testDefinition.xAODToolCaller->copyRecord (*testDefinition.tool->evtStore(), prepPostfix));
2248 benchmarkPrepCopyRecord.stopTimer ();
2249 benchmarkPrep.startTimer ();
2250 ASSERT_SUCCESS (testDefinition.xAODToolCaller->call ());
2251 benchmarkPrep.stopTimer ();
2252#ifdef XAOD_STANDALONE
2253 benchmarkPrepClear.startTimer ();
2254 store.clear ();
2255 benchmarkPrepClear.stopTimer ();
2256#endif
2257 benchmarkCallRetrieve.startTimer ();
2258 ASSERT_SUCCESS (testDefinition.xAODToolCaller->retrieve (*testDefinition.tool->evtStore()));
2259 benchmarkCallRetrieve.stopTimer ();
2260 benchmarkCallCopyRecord.startTimer ();
2261 static const std::string callPostfix = "Call";
2262 ASSERT_SUCCESS (testDefinition.xAODToolCaller->copyRecord (*testDefinition.tool->evtStore(), callPostfix));
2263 benchmarkCallCopyRecord.stopTimer ();
2264 benchmarkCall.startTimer ();
2265 ASSERT_SUCCESS (testDefinition.xAODToolCaller->call ());
2266 benchmarkCall.stopTimer ();
2267 if (userConfiguration.runToolTwice)
2268 {
2269 benchmarkRepeatCall.startTimer ();
2270 ASSERT_SUCCESS (testDefinition.xAODToolCaller->call ());
2271 benchmarkRepeatCall.stopTimer ();
2272 }
2273#ifdef XAOD_STANDALONE
2274 benchmarkCallClear.startTimer ();
2275 store.clear ();
2276 benchmarkCallClear.stopTimer ();
2277 benchmarkEmptyClear.startTimer ();
2278 store.clear ();
2279 benchmarkEmptyClear.stopTimer ();
2280#endif
2281 }
2282 std::cout << "Total entries read: " << entry << std::endl;
2283 } else if constexpr (columnarAccessMode == 100)
2284 {
2285 TestUtils::runXaodArrayTest (userConfiguration, testDefinition, file.get());
2286 }
2287 }
#define ANA_CHECK_THROW(EXP)
check whether the given expression was successful, throwing an exception on failure
int numberOfEvents()
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
static Double_t a
TestStore store
Definition TestStore.cxx:23
void runXaodArrayTest(const UserConfiguration &userConfiguration, const TestDefinition &testDefinition, TFile *file)
static const std::unordered_map< std::string, SG::sgkey_t > knownKeys
constexpr unsigned columnarAccessMode
Definition ColumnarDef.h:15
void renameContainers(IColumnarTool &tool, const std::vector< std::pair< std::string, std::string > > &renames)
rename containers in the columnar tool
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
std::vector< std::shared_ptr< TestUtils::IColumnData > > usedColumns
void setupColumns(ToolColumnVectorMap &toolWrapper)
void setupKnownColumns(const TestUtils::TestDefinition &testDefinition)
static UserConfiguration fromEnvironment()
create a UserConfiguration, loading from the file pointed to by the COLUMNAR_TEST_CONFIG environment ...

◆ makeUniqueName()

std::string columnar::ColumnarPhysLiteTest::makeUniqueName ( )

make a unique tool name to be used in unit tests

Definition at line 1778 of file ColumnarPhysliteTest.cxx.

1779 {
1780 static std::atomic<unsigned> index = 0;
1781 return "UniquePhysliteTestTool" + std::to_string(++index);
1782 }
str index
Definition DeMoScan.py:362

◆ setupColumns()

void columnar::ColumnarPhysLiteTest::setupColumns ( ToolColumnVectorMap & toolWrapper)

Definition at line 1948 of file ColumnarPhysliteTest.cxx.

1949 {
1950 using namespace asg::msgUserCode;
1951
1952 std::unordered_map<std::string,ColumnInfo> requestedColumns;
1953 for (auto& column : toolWrapper.getTool().getColumnInfo())
1954 requestedColumns[column.name] = std::move (column);
1955
1956 for (auto& name : toolWrapper.getColumnNames())
1957 std::cout << "requested columns: " << name << std::endl;
1958
1959 for (auto& column : knownColumns)
1960 {
1961 if (column->connect (tree, offsetColumns, requestedColumns))
1962 usedColumns.push_back (column);
1963 }
1964
1965 std::set<std::string> unclaimedColumns;
1966 for (auto& column : requestedColumns)
1967 {
1968 if (!column.second.isOptional)
1969 unclaimedColumns.insert (column.first);
1970 else
1971 std::cout << "optional column not claimed: " << column.first << std::endl;
1972 }
1973 std::erase_if (unclaimedColumns, [&] (auto& columnName)
1974 {
1975 const auto& info = requestedColumns.at (columnName);
1976 if (info.accessMode != ColumnAccessMode::output || !info.fixedDimensions.empty())
1977 return false;
1978 auto offsetIter = std::find_if (usedColumns.begin(), usedColumns.end(), [&] (const std::shared_ptr<TestUtils::IColumnData>& column)
1979 {
1980 for (auto& output : column->outputColumns)
1981 {
1982 if (output.name == info.offsetName)
1983 return true;
1984 }
1985 return false;
1986 });
1987 if (offsetIter == usedColumns.end())
1988 return false;
1989 std::shared_ptr<TestUtils::IColumnData> myColumn;
1990 if (*info.type == typeid(float))
1991 myColumn = std::make_shared<TestUtils::ColumnDataOutVector<float>> (info.name, 0);
1992 else if (*info.type == typeid(char))
1993 myColumn = std::make_shared<TestUtils::ColumnDataOutVector<char>> (info.name, 0);
1994 else if (*info.type == typeid(std::uint16_t))
1995 myColumn = std::make_shared<TestUtils::ColumnDataOutVector<std::uint16_t>> (info.name, 0);
1996 else if (*info.type == typeid(std::uint64_t))
1997 myColumn = std::make_shared<TestUtils::ColumnDataOutVector<std::uint64_t>> (info.name, 0);
1998 else
1999 {
2000 ANA_MSG_WARNING ("unhandled column type: " << info.name << " " << info.type->name());
2001 return false;
2002 }
2003 knownColumns.push_back (myColumn);
2004 if (!myColumn->connect (tree, offsetColumns, requestedColumns))
2005 {
2006 ANA_MSG_WARNING ("failed to connect dynamic output column: " << info.name);
2007 return false;
2008 }
2009 usedColumns.push_back (myColumn);
2010 return true;
2011 });
2012 if (!unclaimedColumns.empty())
2013 {
2014 std::string message = "columns not claimed:";
2015 for (auto& column : unclaimedColumns)
2016 message += " " + column;
2017 throw std::runtime_error (message);
2018 }
2019 }
#define ANA_MSG_WARNING(xmsg)
Macro printing warning messages.
@ output
an output column
Definition ColumnInfo.h:24
std::size_t erase_if(T_container &container, T_Func pred)
std::vector< std::shared_ptr< TestUtils::IColumnData > > knownColumns
std::unordered_map< std::string, const std::vector< ColumnarOffsetType > * > offsetColumns

◆ setupKnownColumns()

void columnar::ColumnarPhysLiteTest::setupKnownColumns ( const TestUtils::TestDefinition & testDefinition)

Definition at line 1790 of file ColumnarPhysliteTest.cxx.

1791 {
1792 using namespace TestUtils;
1793
1794 knownColumns.push_back (std::make_shared<ColumnDataEventCount> ());
1795
1796 tree->SetMakeClass (1);
1797 {
1798 std::unordered_map<std::string,TBranch*> branches;
1799 {
1800 TIter branchIter (tree->GetListOfBranches());
1801 TObject *obj = nullptr;
1802 while ((obj = branchIter()))
1803 {
1804 TBranch *branch = nullptr;
1805 if ((branch = dynamic_cast<TBranch*>(obj)))
1806 {
1807 branches.emplace (branch->GetName(), branch);
1808 TIter subBranchIter (branch->GetListOfBranches());
1809 while ((obj = subBranchIter()))
1810 {
1811 if (auto subBranch = dynamic_cast<TBranch*>(obj))
1812 branches.emplace (subBranch->GetName(), subBranch);
1813 }
1814 }
1815 }
1816 }
1817
1818 for (const auto& [name, branch] : branches)
1819 {
1820 if (name.find ("AuxDyn.") != std::string::npos ||
1821 name.find ("Aux.") != std::string::npos)
1822 {
1823 TClass *branchClass = nullptr;
1824 EDataType branchType {};
1825 branch->GetExpectedType (branchClass, branchType);
1826 if (branchClass == nullptr)
1827 {
1828 switch (branchType)
1829 {
1830 case kInt_t:
1831 knownColumns.push_back (std::make_shared<ColumnDataScalar<std::int32_t>> (branch->GetName()));
1832 break;
1833 case kUInt_t:
1834 knownColumns.push_back (std::make_shared<ColumnDataScalar<std::uint32_t>> (branch->GetName()));
1835 break;
1836 case kULong_t:
1837 knownColumns.push_back (std::make_shared<ColumnDataScalar<std::uint64_t>> (branch->GetName()));
1838 break;
1839 case kULong64_t:
1840 knownColumns.push_back (std::make_shared<ColumnDataScalar<std::uint64_t>> (branch->GetName()));
1841 break;
1842 case kFloat_t:
1843 knownColumns.push_back (std::make_shared<ColumnDataScalar<float>> (branch->GetName()));
1844 break;
1845 default:
1846 // no-op
1847 break;
1848 }
1849 } else
1850 {
1851 if (*branchClass->GetTypeInfo() == typeid(std::vector<float>))
1852 {
1853 knownColumns.push_back (std::make_shared<ColumnDataVector<float>> (branch->GetName()));
1854 } else if (*branchClass->GetTypeInfo() == typeid(std::vector<char>))
1855 {
1856 knownColumns.push_back (std::make_shared<ColumnDataVector<char>> (branch->GetName()));
1857 } else if (*branchClass->GetTypeInfo() == typeid(std::vector<std::int8_t>))
1858 {
1859 knownColumns.push_back (std::make_shared<ColumnDataVector<std::int8_t>> (branch->GetName()));
1860 } else if (*branchClass->GetTypeInfo() == typeid(std::vector<std::uint8_t>))
1861 {
1862 knownColumns.push_back (std::make_shared<ColumnDataVector<std::uint8_t>> (branch->GetName()));
1863 } else if (*branchClass->GetTypeInfo() == typeid(std::vector<std::int16_t>))
1864 {
1865 knownColumns.push_back (std::make_shared<ColumnDataVector<std::int16_t>> (branch->GetName()));
1866 } else if (*branchClass->GetTypeInfo() == typeid(std::vector<std::uint16_t>))
1867 {
1868 knownColumns.push_back (std::make_shared<ColumnDataVector<std::uint16_t>> (branch->GetName()));
1869 } else if (*branchClass->GetTypeInfo() == typeid(std::vector<std::int32_t>))
1870 {
1871 knownColumns.push_back (std::make_shared<ColumnDataVector<std::int32_t>> (branch->GetName()));
1872 } else if (*branchClass->GetTypeInfo() == typeid(std::vector<std::uint32_t>))
1873 {
1874 knownColumns.push_back (std::make_shared<ColumnDataVector<std::uint32_t>> (branch->GetName()));
1875 } else if (*branchClass->GetTypeInfo() == typeid(std::vector<std::int64_t>))
1876 {
1877 knownColumns.push_back (std::make_shared<ColumnDataVector<std::int64_t>> (branch->GetName()));
1878 } else if (*branchClass->GetTypeInfo() == typeid(std::vector<std::uint64_t>))
1879 {
1880 knownColumns.push_back (std::make_shared<ColumnDataVector<std::uint64_t>> (branch->GetName()));
1881 } else if (*branchClass->GetTypeInfo() == typeid(std::vector<std::vector<float>>))
1882 {
1883 knownColumns.push_back (std::make_shared<ColumnDataVectorVector<float>> (branch->GetName()));
1884 } else if (*branchClass->GetTypeInfo() == typeid(std::vector<std::vector<std::int32_t>>))
1885 {
1886 knownColumns.push_back (std::make_shared<ColumnDataVectorVector<std::int32_t>> (branch->GetName()));
1887 } else if (*branchClass->GetTypeInfo() == typeid(std::vector<std::vector<std::uint64_t>>))
1888 {
1889 knownColumns.push_back (std::make_shared<ColumnDataVectorVector<std::uint64_t>> (branch->GetName()));
1890 } else if (*branchClass->GetTypeInfo() == typeid(std::vector<std::vector<std::vector<std::size_t>>>))
1891 {
1892 knownColumns.push_back (std::make_shared<ColumnDataVectorVectorVector<std::size_t>> (branch->GetName()));
1893 } else if (*branchClass->GetTypeInfo() == typeid(std::vector<std::vector<std::vector<unsigned char>>>))
1894 {
1895 knownColumns.push_back (std::make_shared<ColumnDataVectorVectorVector<unsigned char>> (branch->GetName()));
1896 } else if (*branchClass->GetTypeInfo() == typeid(std::vector<std::string>))
1897 {
1898 knownColumns.push_back (std::make_shared<ColumnDataMetNames> (branch->GetName()));
1899 }
1900 }
1901 }
1902 }
1903 }
1904
1905 // This is a fallback for the case that we don't have an explicit
1906 // `samplingPattern` branch in our input file (i.e. an older file),
1907 // to allow us to still test tools needing it. This is likely not
1908 // something that actual users can do (they need the new files), but
1909 // for testing it seems like a reasonable workaround.
1910 knownColumns.push_back (std::make_shared<ColumnDataSamplingPattern> ("egammaClusters"));
1911
1912 // For branches that are element links they need to be explicitly
1913 // declared to have the correct xAOD type, correct split setting,
1914 // and correct linked containers.
1915 knownColumns.push_back (std::make_shared<ColumnDataVectorVectorLink<xAOD::CaloClusterContainer>> ("AnalysisElectronsAuxDyn.caloClusterLinks"));
1916 knownColumns.push_back (std::make_shared<ColumnDataVectorVectorLink<xAOD::TrackParticleContainer>> ("AnalysisElectronsAuxDyn.trackParticleLinks"));
1917 knownColumns.push_back (std::make_shared<ColumnDataVectorVectorLink<xAOD::CaloClusterContainer>> ("AnalysisPhotonsAuxDyn.caloClusterLinks"));
1918 knownColumns.push_back (std::make_shared<ColumnDataVectorVectorLink<xAOD::VertexContainer>> ("AnalysisPhotonsAuxDyn.vertexLinks"));
1919 knownColumns.push_back (std::make_shared<ColumnDataVectorSplitLink<xAOD::TrackParticleContainer>> ("AnalysisMuonsAuxDyn.inDetTrackParticleLink"));
1920 knownColumns.push_back (std::make_shared<ColumnDataVectorSplitLink<xAOD::TrackParticleContainer>> ("AnalysisMuonsAuxDyn.combinedTrackParticleLink"));
1921 knownColumns.push_back (std::make_shared<ColumnDataVectorSplitLink<xAOD::TrackParticleContainer>> ("AnalysisMuonsAuxDyn.extrapolatedMuonSpectrometerTrackParticleLink"));
1922 knownColumns.push_back (std::make_shared<ColumnDataVectorVectorLink<xAOD::TrackParticleContainer>> ("GSFConversionVerticesAuxDyn.trackParticleLinks"));
1923 knownColumns.push_back (std::make_shared<ColumnDataVectorSplitLink<xAOD::TrackParticleContainer>> ("GSFTrackParticlesAuxDyn.originalTrackParticle"));
1924 knownColumns.push_back (std::make_shared<ColumnDataVectorVectorVariantLink<xAOD::IParticleContainer>>("AnalysisJetsAuxDyn.GhostTrack"));
1925 knownColumns.push_back (std::make_shared<ColumnDataVectorLink<xAOD::JetContainer>>("METAssoc_AnalysisMETAux.jetLink"));
1926 knownColumns.push_back (std::make_shared<ColumnDataVectorVectorVariantLink<xAOD::IParticleContainer>>("METAssoc_AnalysisMETAux.objectLinks"));
1927
1928 // For METMaker we need to preplace all of the MET terms that we
1929 // expect to be used, that's what this line does.
1930 if (!testDefinition.metTermNames.empty())
1931 knownColumns.push_back (std::make_shared<ColumnDataOutputMet> ("OutputMET", testDefinition.metTermNames));
1932
1933 // For METMaker we need various extra columns to run. This may need
1934 // some work to avoid, but would likey be worth it.
1935 knownColumns.push_back (std::make_shared<ColumnDataOutVector<std::uint16_t>> ("AnalysisMuons.objectType", xAOD::Type::Muon));
1936 knownColumns.push_back (std::make_shared<ColumnDataOutVector<float>> ("AnalysisMuons.m", ParticleConstants::muonMassInMeV));
1937 knownColumns.push_back (std::make_shared<ColumnDataOutVector<std::uint16_t>> ("AnalysisJets.objectType", xAOD::Type::Jet));
1938
1939 // These are columns that represent variables that are normally held
1940 // by METAssociationHelper, or alternatively are decorated on the
1941 // MET terms (even though they are per object).
1942 knownColumns.push_back (std::make_shared<ColumnDataOutVector<float>> ("AnalysisMuons.MetObjectWeight", 0));
1943 knownColumns.push_back (std::make_shared<ColumnDataOutVector<float>> ("AnalysisJets.MetObjectWeight", 0));
1944 knownColumns.push_back (std::make_shared<ColumnDataOutVector<float>> ("AnalysisJets.MetObjectWeightSoft", 0));
1945 knownColumns.push_back (std::make_shared<ColumnDataOutVector<MissingETBase::Types::bitmask_t>> ("METAssoc_AnalysisMET.useObjectFlags", 0));
1946 }
constexpr double muonMassInMeV
the mass of the muon (in MeV)
@ Jet
The object is a jet.
Definition ObjectType.h:40
@ Muon
The object is a muon.
Definition ObjectType.h:48

Member Data Documentation

◆ file

std::unique_ptr<TFile> columnar::ColumnarPhysLiteTest::file

Definition at line 38 of file ColumnarPhysliteTest.h.

◆ knownColumns

std::vector<std::shared_ptr<TestUtils::IColumnData> > columnar::ColumnarPhysLiteTest::knownColumns

Definition at line 41 of file ColumnarPhysliteTest.h.

◆ offsetColumns

std::unordered_map<std::string,const std::vector<ColumnarOffsetType>*> columnar::ColumnarPhysLiteTest::offsetColumns

Definition at line 43 of file ColumnarPhysliteTest.h.

◆ tree

TTree* columnar::ColumnarPhysLiteTest::tree = nullptr

Definition at line 39 of file ColumnarPhysliteTest.h.

◆ usedColumns

std::vector<std::shared_ptr<TestUtils::IColumnData> > columnar::ColumnarPhysLiteTest::usedColumns

Definition at line 42 of file ColumnarPhysliteTest.h.


The documentation for this struct was generated from the following files: