ATLAS Offline Software
Classes | Functions
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
60  TEvent event(TEvent::kClassAccess);
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  }
runLayerRecalibration.chain
chain
Definition: runLayerRecalibration.py:175
TrigInDetValidation_Base.test
test
Definition: TrigInDetValidation_Base.py:147
Trig::TrigDecisionTool
Definition: TrigDecisionTool.h:65
POOL::TEvent::readFrom
StatusCode readFrom(TFile *file)
Definition: PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:133
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
asg::SgTEvent
Wrapper for TEvent to make it look like StoreGate.
Definition: SgTEvent.h:44
TrigAnalysisTest::GetTrigAnalysisTest
ITest * GetTrigAnalysisTest(const string &name)
Definition: TestFactory.cxx:22
dqBeamSpot.nEntries
int nEntries
Definition: dqBeamSpot.py:73
xAOD::TEvent
Tool for accessing xAOD files outside of Athena.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:84
xAOD::Init
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
Definition: Init.cxx:31
TrigConf::xAODConfigTool
Trigger configuration metadata tool for xAOD analysis.
Definition: xAODConfigTool.h:55