ATLAS Offline Software
Loading...
Searching...
No Matches
TrigAnalysisTest Namespace Reference

Classes

class  BasicTriggerFired
class  ITest
class  Run1BStoxAODTrigger

Functions

int runTrigAnalysisTest (const std::string &testName)
ITestGetTrigAnalysisTest (const string &name)

Function Documentation

◆ GetTrigAnalysisTest()

ITest * TrigAnalysisTest::GetTrigAnalysisTest ( const string & name)

Definition at line 22 of file TestFactory.cxx.

22 {
23 if (name == "BasicTriggerFired") {
24 return new BasicTriggerFired();
25 } else if (name == "Run1BStoxAODTrigger") {
26 return new Run1BStoxAODTrigger();
27 } else {
28 // If we are here, then we don't know what kind of test the framework
29 // is asking for. So bomb.
30 ostringstream errtxt;
31 errtxt << "Trigger Analysis Test " << name << " is not known";
32 throw runtime_error (errtxt.str().c_str());
33 }
34 }

◆ runTrigAnalysisTest()

int TrigAnalysisTest::runTrigAnalysisTest ( const std::string & testName)

Definition at line 41 of file RootCoreTestHarness.cxx.

42 {
43 // Fetch the test to run it.
44 auto test = GetTrigAnalysisTest(testName);
45 if (test == nullptr) {
46 cout << "Unable to load test" << endl;
47 return 1;
48 }
49
50 // Initialize (as done for all xAOD standalone programs!)
51 if (!xAOD::Init(testName.c_str()).isSuccess()) {
52 return 1;
53 }
54
55 // Load up the proper file we should be checking against.
56 std::unique_ptr< TFile > file( TFile::Open( gSystem->Getenv("ROOTCORE_TEST_FILE"), "READ" ) );
57
58
59 // Init data access to the trigger
61 if (!event) {
62 cout << "cannot read from file: " << file << endl;
63 return 1;
64 }
65
66 xAODConfigTool configTool("xAODConfigTool");
67 ToolHandle<TrigConf::ITrigConfigTool> configHandle(&configTool);
68 if (!configHandle->initialize().isSuccess()) return 1;
69
70 TrigDecisionTool trigDecTool("TrigDecTool");
71 if (!trigDecTool.setProperty("ConfigTool",configHandle)) return 1;
72 if (!trigDecTool.setProperty("TrigDecisionKey","xTrigDecision")) return 1;
73 if (!trigDecTool.initialize()) return 1;
74
75 asg::SgEvent sgevent(event.get());
76 test->setEventStore( &sgevent );
77
78 // Run the files
79 size_t nEntries = event->getEntries();
80 for (size_t entry = 0; entry < nEntries; entry++) {
81 event->getEntry(entry);
82
83 test->processEvent (trigDecTool);
84 }
85
86 // Clean up
87 return test->finalize();
88 }
static std::unique_ptr< Event > createAndReadFrom(TFile &file)
static method to create an Event object and readFrom a file, given by a TFile.
Definition EventIO.cxx:43
ITest * GetTrigAnalysisTest(const string &name)
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
Definition Init.cxx:31
TFile * file