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 auto chain = new TChain("CollectionTree");
57 chain->Add(gSystem->Getenv("ROOTCORE_TEST_FILE"));
58
59 // Init data access to the trigger
61 if (!event.readFrom(chain).isSuccess()) {
62 return 1;
63 }
64
65 xAODConfigTool configTool("xAODConfigTool");
66 ToolHandle<TrigConf::ITrigConfigTool> configHandle(&configTool);
67 configHandle->initialize();
68
69 TrigDecisionTool trigDecTool("TrigDecTool");
70 trigDecTool.setProperty("ConfigTool",configHandle);
71 trigDecTool.setProperty("TrigDecisionKey","xTrigDecision");
72 trigDecTool.initialize();
73
74 asg::SgTEvent sgtevent(&event);
75 test->setEventStore( &sgtevent );
76
77 // Run the files
78 size_t nEntries = chain->GetEntries();
79 for (size_t entry = 0; entry < nEntries; entry++) {
80 event.getEntry(entry);
81
82 test->processEvent (trigDecTool);
83 }
84
85 // Clean up
86 return test->finalize();
87 }
@ kClassAccess
Access auxiliary data using the aux containers.
ITest * GetTrigAnalysisTest(const string &name)
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
Definition Init.cxx:31