ATLAS Offline Software
Functions
top-tool-ftag.cxx File Reference
#include <iostream>
#include "TFile.h"
#include "TTree.h"
#include "TTreeFormula.h"
#include "TSystem.h"
#include "xAODRootAccess/TEvent.h"
#include "xAODRootAccess/TStore.h"
#include "xAODRootAccess/TActiveStore.h"
#include "TopConfiguration/ConfigurationSettings.h"
#include "TopConfiguration/TopConfig.h"
#include "TopConfiguration/SelectionConfigurationData.h"
#include "TopAnalysis/Tools.h"
#include "TopCPTools/TopToolStore.h"
#include "TopAnalysis/ObjectLoaderBase.h"
#include "TopAnalysis/EventSaverBase.h"
#include "TopEvent/EventTools.h"
#include "TopEvent/TopEventMaker.h"
#include "TopEvent/SystematicEvent.h"
#include "TopObjectSelectionTools/TopObjectSelection.h"
#include "TopObjectSelectionTools/EventCleaningSelection.h"
#include "TopCorrections/BTagScaleFactorCalculator.h"
#include "xAODRootAccess/tools/TFileAccessTracer.h"
#include "TopAnalysis/MsgCategory.h"

Go to the source code of this file.

Functions

std::shared_ptr< top::TopConfigInitialiseTopSoftware (int, char **)
 
int TestFTag (const std::shared_ptr< top::TopConfig > &)
 
int main (int argc, char **argv)
 

Function Documentation

◆ InitialiseTopSoftware()

std::shared_ptr< top::TopConfig > InitialiseTopSoftware ( int  argc,
char **  argv 
)

Definition at line 53 of file top-tool-ftag.cxx.

53  {
54  if (argc != 3) {
55  ATH_MSG_INFO("Code to read an input file and return information on the"
56  << "anticipated systematics list in the b-tagging calibration"
57  << "Use like:\n"
58  << " " << argv[0] << " cuts.txt input.txt\n"
59  << " cuts.txt - file containing TopConfig\n"
60  << " input.txt - file containing list of input files\n"
61  << "\n"
62  << "For example\n"
63  << " " << argv[0] <<
64  " $ROOTCOREBIN/data/TopAnalysis/nocuts.txt $ROOTCOREBIN/data/TopAnalysis/input-13TeV-fondueworld.txt\n");
65  return 0;
66  }
67 
68  // to disable the sending of file access statistics
70 
71  //magic xAOD stuff
72  //true = fail at even the slightest xaod issue
73  top::xAODInit(true);
74  StatusCode::enableFailure();
75 
77 
78  std::string settingsFilename = std::string(argv[1]);
79  ATH_MSG_INFO("Configuration Files:\n"
80  << settingsFilename << "\n"
81  << std::string(argv[2]) << "\n");
82 
83  //load the settings from the input file
84  auto* const settings = top::ConfigurationSettings::get();
85  settings->loadFromFile(settingsFilename);
86  ATH_MSG_INFO("Configuration:\n" << *settings << "\n");
87 
88  const std::string libraryNames = settings->value("LibraryNames");
89  top::loadLibraries(libraryNames);
90 
91  //load the event selection from the input file
92  std::string cutsFilename = std::string(settingsFilename);
93 
94  //open the files (to check they exist) and count how many events we have
95  std::vector<std::string> filenames = top::fileList(std::string(argv[2]));
96 
97  // A configuration that John can easily understand
98  // This is not the same as a good configuration
99  std::shared_ptr<top::TopConfig> topConfig(new top::TopConfig());
100 
101  topConfig->setMapIndex(410501);
102  topConfig->setConfigSettings(settings);
104  // Setup all asg::AsgTools
105  top::TopToolStore topTools("top::TopToolStore");
106  top::check(topTools.setProperty("config", topConfig),
107  "Failed to setProperty of topTools");
108  top::check(topTools.initialize(), "Failed to initialize topTools");
109  topConfig->fixConfiguration();
110  ATH_MSG_INFO(*topConfig);
111 
112  return topConfig;
113 }

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 128 of file top-tool-ftag.cxx.

128  {
129  std::shared_ptr<top::TopConfig> topConfig = InitialiseTopSoftware(argc, argv);
130  TestFTag(topConfig);
131 }

◆ TestFTag()

int TestFTag ( const std::shared_ptr< top::TopConfig > &  topConfig)

Definition at line 115 of file top-tool-ftag.cxx.

115  {
116  // Here we need to access the flavour tagging CP tool
117  // and get it to tell us what systematics are available
118  // given the configuration we setup up
119 
120  // Get TopCPTool handle
121  top::BTagScaleFactorCalculator* m_btagSF = new top::BTagScaleFactorCalculator("top::BTagScaleFactorCalculator");
122  top::check(m_btagSF->setProperty("config", topConfig), "Failed to pass in the config");
123  top::check(m_btagSF->initialize(), "Failed to init");
124  top::check(m_btagSF->debug(), "Failed to debug");
125  return 0;
126 }
store
StoreGateSvc * store
Definition: fbtTestBasics.cxx:69
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
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAOD::TFileAccessTracer::enableDataSubmission
static void enableDataSubmission(::Bool_t value)
Function for turning data submission on/off.
Definition: TFileAccessTracer.cxx:281
LArCellConditions.argv
argv
Definition: LArCellConditions.py:112
xAOD::TEvent::kClassAccess
@ kClassAccess
Access auxiliary data using the aux containers.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:97
top::TopConfig
Definition: TopConfig.h:41
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
top::ConfigurationSettings::get
static ConfigurationSettings * get(bool reset=false)
Design patterns 101.
Definition: ConfigurationSettings.cxx:714
top::xAODInit
void xAODInit(bool failOnUnchecked)
A little wrapper for the xAOD tools.
Definition: Tools.cxx:46
top::check
void check(bool thingToCheck, const std::string &usefulFailureMessage)
Print an error message and terminate if thingToCheck is false.
Definition: EventTools.cxx:15
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:20
TestFTag
int TestFTag(const std::shared_ptr< top::TopConfig > &)
Definition: top-tool-ftag.cxx:115
top::TopToolStore
Definition: TopToolStore.h:49
top::BTagScaleFactorCalculator
Definition: BTagScaleFactorCalculator.h:39
top::BTagScaleFactorCalculator::debug
StatusCode debug()
Definition: BTagScaleFactorCalculator.cxx:172
top::BTagScaleFactorCalculator::initialize
StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: BTagScaleFactorCalculator.cxx:31
grepfile.filenames
list filenames
Definition: grepfile.py:34
xAOD::TStore
A relatively simple transient store for objects created in analysis.
Definition: TStore.h:44
InitialiseTopSoftware
std::shared_ptr< top::TopConfig > InitialiseTopSoftware(int, char **)
Definition: top-tool-ftag.cxx:53
xAOD::TEvent
Tool for accessing xAOD files outside of Athena.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:81