ATLAS Offline Software
PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/Tools.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3  */
4 
5 #ifndef TOPTOOLS_H__
6 #define TOPTOOLS_H__
7 
8 #include <vector>
9 #include <string>
10 
11 #include "xAODRootAccess/TEvent.h"
12 
16 
18 
27 namespace top {
28  class TopObjectSelection;
29  class EventSaverBase;
30 
38  void xAODInit(bool failOnUnchecked = true);
39 
47  std::string getDerivationStream(TFile* inputFile);
48 
58  void parseCutBookkeepers(xAOD::TEvent& event, const std::size_t size,
59  std::vector<std::string> &names, std::vector<float>& sumW);
60 
68  ULong64_t getRawEventsBookkeeper(const xAOD::CutBookkeeperContainer *cutBookKeepers);
69 
76  void renameCutBookkeepers(std::vector<std::string>& bookkepeer_names,
77  const std::vector<std::string>& pmg_weight_names);
78 
88  std::vector<std::string> loadCuts(const std::string& filename);
89 
100  std::vector<std::string> fileList(const std::string& filename);
101 
113  size_t checkFiles(const std::vector<std::string>& filenames);
114 
125  void loadLibraries(const std::string& libraryNames);
126 
140  top::TopObjectSelection* loadObjectSelection(const std::shared_ptr<top::TopConfig>& config);
141 
153  top::EventSaverBase* loadEventSaver(const std::shared_ptr<top::TopConfig>& config);
154 
165  bool readMetaData(TFile* inputFile, const std::shared_ptr<top::TopConfig>& config);
166 
173  void readMetaData(const xAOD::FileMetaData* FMD, const std::shared_ptr<top::TopConfig>& config);
174 }
175 
176 #endif
CutBookkeeper.h
top::loadLibraries
void loadLibraries(const std::string &libraryNames)
So that we can load external libraries with (1) extra event selection tools in, (2) user defined obje...
Definition: Tools.cxx:275
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
top::loadCuts
std::vector< std::string > loadCuts(const std::string &filename)
Load the file and make a vector of the cuts to pass on to the selection tool.
Definition: Tools.cxx:177
top::checkFiles
size_t checkFiles(const std::vector< std::string > &filenames)
Open each file in the vector and get the number of events in it.
Definition: Tools.cxx:206
top::loadObjectSelection
top::TopObjectSelection * loadObjectSelection(const std::shared_ptr< top::TopConfig > &config)
Users may want to define (and load!) their own object selection.
Definition: Tools.cxx:291
top::readMetaData
bool readMetaData(TFile *inputFile, const std::shared_ptr< top::TopConfig > &config)
This function will be used to load the metadata object and pull information from it.
Definition: Tools.cxx:331
top::fileList
std::vector< std::string > fileList(const std::string &filename)
Given a filename for a text file, parse it and extract a list of root files.
Definition: Tools.cxx:239
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
top::getDerivationStream
std::string getDerivationStream(TFile *inputFile)
Function to determine the derivation type using string manipulation.
Definition: Tools.cxx:62
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
CaloCondBlobAlgs_fillNoiseFromASCII.inputFile
string inputFile
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:17
top::TopObjectSelection
Configure the object selection used in the analysis.
Definition: TopObjectSelection.h:66
python.subdetectors.mmg.names
names
Definition: mmg.py:8
top::xAODInit
void xAODInit(bool failOnUnchecked)
A little wrapper for the xAOD tools.
Definition: Tools.cxx:46
TEvent.h
top::EventSaverBase
A base class so users can write their own event saving stuff.
Definition: EventSaverBase.h:26
CutBookkeeperContainer.h
top::parseCutBookkeepers
void parseCutBookkeepers(xAOD::TEvent &xaodEvent, const std::size_t size, std::vector< std::string > &names, std::vector< float > &sumW)
Search bookkeepers for ones matching AllExecutedEvents, and which originate from AOD before skimming.
Definition: Tools.cxx:89
xAOD::CutBookkeeperContainer_v1
Container that holds the Container of all CutBookkeepers.
Definition: CutBookkeeperContainer_v1.h:27
xAOD::FileMetaData_v1
Class holding file-level metadata about an xAOD file.
Definition: FileMetaData_v1.h:34
top::getRawEventsBookkeeper
ULong64_t getRawEventsBookkeeper(const xAOD::CutBookkeeperContainer *cutBookKeepers)
Get raw number of events before skimming from "AllExecutedEvents" bookkeeper.
Definition: Tools.cxx:125
TopConfig.h
grepfile.filenames
list filenames
Definition: grepfile.py:34
FileMetaData.h
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
top::renameCutBookkeepers
void renameCutBookkeepers(std::vector< std::string > &bookkeeper_names, const std::vector< std::string > &pmg_weight_names)
Rename CutBookkeeper names according to MC generator weight names reported by PMGTruthWeightTool.
Definition: Tools.cxx:143
top::loadEventSaver
top::EventSaverBase * loadEventSaver(const std::shared_ptr< top::TopConfig > &config)
Users may also want to write out custom ntuples / xAODs.
Definition: Tools.cxx:314
xAOD::TEvent
Tool for accessing xAOD files outside of Athena.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:81