![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
#include <fstream>
#include <map>
#include <memory>
#include <getopt.h>
#include <TSystem.h>
#include <TError.h>
#include <TFile.h>
#include <TH1F.h>
#include "POOLRootAccess/TEvent.h"
#include "AsgTools/AnaToolHandle.h"
#include "xAODEventInfo/EventInfo.h"
#include "xAODEventInfo/EventAuxInfo.h"
#include "xAODEgamma/Electron.h"
#include "xAODMuon/Muon.h"
#include "AthContainers/AuxElement.h"
#include "AsgMessaging/MessageCheck.h"
#include "AsgAnalysisInterfaces/IFakeBkgTool.h"
#include "AsgAnalysisInterfaces/ILinearFakeBkgTool.h"
Go to the source code of this file.
◆ FBT_CHECK
Value: while(true) { \
Error(
"fbtTestBasics",
"%s", (
"failure encounted on l." +
std::to_string(__LINE__)).c_str()); \
return false; \
}
Definition at line 40 of file fbtTestBasics.cxx.
◆ addEventWeight() [1/2]
◆ addEventWeight() [2/2]
◆ allTests()
Definition at line 110 of file fbtTestBasics.cxx.
113 Result result0, result1, result2, result3, result4, result5;
115 if(
verbose) std::cout <<
"\nWill do minimal test with CP::ApplyFakeFactor\n";
119 if(
verbose) std::cout <<
"\nWill do minimal test with CP::AsymptMatrixTool\n";
122 if(
verbose) std::cout <<
"\nWill do minimal test with CP::LhoodMM_tools\n";
125 if(
verbose) std::cout <<
"\nWill test loading efficiencies from XML\n";
131 if(
verbose) std::cout <<
"\nWill test getEventWeight()\n";
140 if(
verbose) std::cout <<
"\nWill test parallel jobs and merging\n";
149 FBT_CHECK( gSystem->Exec(
"hadd -f fbt_merged.root fbt_job*.root") == 0 );
◆ eventLoop()
template<class Interface = CP::IFakeBkgTool>
Definition at line 212 of file fbtTestBasics.cxx.
214 auto eventInfo = std::make_unique<xAOD::EventInfo>();
215 auto eventAuxInfo = std::make_unique<xAOD::EventAuxInfo>();
216 eventInfo->setStore(eventAuxInfo.get());
217 eventInfo->auxdata<
int>(
"flag") = 1;
222 auto e = std::make_unique<xAOD::Electron>();
223 e->makePrivateStore();
228 e->setP4((1 + (
i%3))*1
e4, 0., 0. ,0.511);
229 e->auxdecor<
char>(
"Tight") = (
i%4)? 0 : 1;
234 #ifdef XAOD_STANDALONE
◆ fillResult()
template<class Interface = CP::IFakeBkgTool>
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 82 of file fbtTestBasics.cxx.
86 std::string option =
argv[
i];
87 if(option==
"-v" || option==
"--verbose")
verbose =
true;
90 #ifdef XAOD_STANDALONE
93 store = std::make_unique<xAOD::TStore>();
94 StatusCode::enableFailure();
99 store =
event.evtStore().get();
104 #ifndef XAOD_STANDALONE
◆ minimalTest()
bool minimalTest |
( |
const std::string & |
type, |
|
|
Result & |
result |
|
) |
| |
◆ parallelJob()
bool parallelJob |
( |
const std::string & |
type, |
|
|
const std::string & |
saveAs |
|
) |
| |
Definition at line 171 of file fbtTestBasics.cxx.
177 std::unique_ptr<TFile>
f(TFile::Open(saveAs.c_str(),
"RECREATE"));
185 std::cout <<
"Parallel job stored intermediate yield " <<
value <<
" +" <<
up <<
" -" << down << std::endl;
◆ readFromROOT()
Definition at line 315 of file fbtTestBasics.cxx.
318 config.emplace_back(
"fbt_efficiencies.root");
319 TH1D hElFake(
"FakeEfficiency_el_pt",
"FakeEfficiency", 1, 10., 100.);
320 hElFake.SetBinContent(1, 0.05);
321 hElFake.SetBinError(1, 0.01);
322 TH1D hMuFake(
"FakeEfficiency_mu_pt",
"FakeEfficiency", 1, 10., 100.);
323 hMuFake.SetBinContent(1, 0.15);
324 hMuFake.SetBinError(1, 0.032);
325 TH1D hElReal(
"RealEfficiency_el_pt",
"RealEfficiency", 1, 10., 100.);
326 hElReal.SetBinContent(1, 0.90);
327 hElReal.SetBinError(1, 0.01);
328 TH1D hMuReal(
"RealEfficiency_mu_pt",
"RealEfficiency", 1, 10., 100.);
329 hMuReal.SetBinContent(1, 0.95);
330 hMuReal.SetBinError(1, 0.01);
331 std::unique_ptr<TFile>
f(TFile::Open(
config.back().c_str(),
"RECREATE"));
◆ readFromXML()
note: the declarations must be placed in the "good" order, otherwise the definitions of the SystematicVariations will be different than those obtained with readFromROOT()
Definition at line 342 of file fbtTestBasics.cxx.
345 config.emplace_back(
"fbt_efficiencies.xml");
350 out <<
"<efficiencies>\n";
351 out <<
"<param type=\"int\" level=\"event\"> flag </param>\n";
352 out <<
"<electron type=\"fake-efficiency\" input=\"central-value\" stat=\"per-bin\" >\n\t<bin flag=\"1\">\n 0.05 +- 0.01 (stat) </bin>\n</electron>\n";
353 out <<
"<electron type=\"real-efficiency\" input=\"central-value\" stat=\"global\" >\n\t<bin flag=\"1\">\n 0.90 +- 0.01 (stat) </bin>\n</electron>\n";
354 out <<
"<muon type=\"fake-efficiency\" input=\"central-value\" stat=\"per-bin\" >\n\t<bin flag=\"1\">\n 0.15 +- 0.032 (stat) </bin>\n</muon>\n";
355 out <<
"<muon type=\"real-efficiency\" input=\"central-value\" stat=\"global\" >\n\t<bin flag=\"1\">\n 0.95 +- 0.01 (stat) </bin>\n</muon>\n";
356 out <<
"</efficiencies>\n";
◆ setup()
template<class Interface = CP::IFakeBkgTool>
mostly useful for athena, which will otherwise re-use the previous tool
Definition at line 193 of file fbtTestBasics.cxx.
204 FBT_CHECK(
tool.setProperty(
"ProgressFileDirectory",
"fakes") );
◆ successful() [1/3]
bool successful |
( |
bool |
arg | ) |
|
◆ successful() [2/3]
bool successful |
( |
const StatusCode & |
arg | ) |
|
◆ successful() [3/3]
bool successful |
( |
int |
arg | ) |
|
◆ config
std::vector<std::string> config |
◆ eventOffset
◆ nEvents
◆ process
std::string process = ">=1F[T]" |
◆ progressFile
std::string progressFile = "" |
◆ readCPVariations
bool readCPVariations = true |
◆ selection
std::string selection = ">=1T" |
◆ store
◆ verbose
bool parallelJob(const std::string &type, const std::string &saveAs)
StatusCode record(T *p2BRegistered, const TKEY &key)
Record an object with a key.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
@ kClassAccess
Access auxiliary data using the aux containers.
Class providing the definition of the 4-vector interface.
bool successful(bool arg)
IAppMgrUI * Init(const char *options="POOLRootAccess/basic.opts")
Bootstraps (creates and configures) the Gaudi Application with the provided options file.
bool minimalTest(const std::string &type, Result &result)
POOL::TEvent event(POOL::TEvent::kClassAccess)
bool fillResult(asg::AnaToolHandle< Interface > &tool, Result &result)
virtual StatusCode clearStore(bool forceRemove=false) override final
clear DataStore contents: called by the event loop mgrs
bool eventLoop(asg::AnaToolHandle< Interface > &tool, Result &result)
std::string to_string(const DetectorType &type)
ServiceHandle< StoreGateSvc > & evtStore()
bool addEventWeight(asg::AnaToolHandle< CP::ILinearFakeBkgTool > &tool, Result &result)
bool setup(asg::AnaToolHandle< Interface > &tool, const std::string &type)
mostly useful for athena, which will otherwise re-use the previous tool
Tool for accessing xAOD files outside of Athena.
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.