ATLAS Offline Software
Classes | Macros | Functions
MuonTriggerSFRootCoreTest.cxx File Reference
#include <string>
#include <TFile.h>
#include <TError.h>
#include <TStopwatch.h>
#include <TString.h>
#include "xAODEventInfo/EventInfo.h"
#include "xAODMuon/MuonContainer.h"
#include "MuonEfficiencyCorrections/MuonTriggerScaleFactors.h"
#include "PATInterfaces/ISystematicsTool.h"
#include "PATInterfaces/SystematicsUtil.h"

Go to the source code of this file.

Classes

class  MuonTriggerSFTester
 

Macros

#define CHECK_CPSys(Arg)
 

Functions

CP::CorrectionCode getThreshold (Int_t &threshold, const std::string &trigger)
 
int main (int argc, char *argv[])
 

Macro Definition Documentation

◆ CHECK_CPSys

#define CHECK_CPSys (   Arg)
Value:
if (Arg.isFailure()){ \
Warning(#Arg,"Unsupported systematic (in line %i) ",__LINE__); \
}

Definition at line 39 of file MuonTriggerSFRootCoreTest.cxx.

Function Documentation

◆ getThreshold()

CP::CorrectionCode getThreshold ( Int_t &  threshold,
const std::string &  trigger 
)

Definition at line 48 of file MuonTriggerSFRootCoreTest.cxx.

48  {
49  std::size_t index = trigger.find("HLT_mu");
50  if (index != std::string::npos) {
51  std::string rawNumber = trigger.substr(index + 6);
52  if (!rawNumber.empty() && isdigit(rawNumber[0])) {
53  std::stringstream(rawNumber) >> threshold;
54  if (threshold < 10) threshold = 10000;
55  else threshold = (threshold + 1) * 1000;
57  }
58  }
60 }

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 317 of file MuonTriggerSFRootCoreTest.cxx.

317  {
318 
319  const char* APP_NAME = argv[0];
321  // Read the config provided by the user
322  const char* xAODFileName = "";
323  std::string customInputFolder = "";
324  std::string customFileName = "";
325  const char* nrOfEntries = "";
326  std::string trigger = "";
327  int year = -1;
328  std::string period = "";
329  for (int i = 1; i < argc - 1; i++) {
330  std::string arg = std::string(argv[i]);
331  if (arg == "-x") {
332  xAODFileName = argv[i + 1];
333  }
334  else if (arg == "-d")
335  customInputFolder = argv[i + 1];
336  else if (arg == "-f")
337  customFileName = argv[i + 1];
338  else if (arg == "-e")
339  nrOfEntries = argv[i + 1];
340  else if (arg == "-t")
341  trigger = argv[i + 1];
342  else if (arg == "-y")
343  year = atoi(argv[i + 1]);
344  else if (arg == "-p")
345  period = argv[i + 1];
346  }
347 
348  bool error = false;
349  if (xAODFileName[0] == '\0') {
350  Error(APP_NAME, "xAOD file name missing!");
351  error = true;
352  }
353  if (trigger == "") {
354  Error(APP_NAME, "trigger missing!");
355  error = true;
356  }
357  if (error) {
358  Error(APP_NAME, " Usage: %s -x [xAOD file name] -y [year] -p [period] -t [trigger] -d [custom input folder] -f [custom file name] -e [number of events to process]", APP_NAME);
359  return 1;
360  }
361 
363 
364  Info(APP_NAME, "Opening file: %s", xAODFileName);
365  std::unique_ptr<TFile> ifile(TFile::Open(xAODFileName, "READ"));
366  if (!ifile.get()) {
367  Error(APP_NAME, " Unable to load xAOD input file");
368  return 1;
369  }
370 
373  Info(APP_NAME, "Number of events in the file: %i", static_cast<int>(event.getEntries()));
374 
375  // Decide how many events to run over:
376  int nrOfEntriesToRunOver = 1000;//event.getEntries();
377  if (!std::string(nrOfEntries).empty()) {
378  int e = atoll(nrOfEntries);
379  if (e < nrOfEntriesToRunOver) {
380  nrOfEntriesToRunOver = e;
381  }
382  }
383 
384 
386  sfChecker.initialiseTools(customFileName, customInputFolder, year, period);
387  for(Long64_t entry = 0; entry < nrOfEntriesToRunOver; entry++) {
388  // Tell the object which entry to look at:
389  event.getEntry(entry);
390  sfChecker.processEvent(event, year, period);
391 
392  }
393 
394  Info(APP_NAME, "%i events successfully processed, %i warnings, %i errors detected.", nrOfEntriesToRunOver, sfChecker.m_warningsCount, sfChecker.m_errorsCount);
395  return 0;
396 }
TestSUSYToolsAlg.ifile
ifile
Definition: TestSUSYToolsAlg.py:92
MuonTriggerSFTester
Definition: MuonTriggerSFRootCoreTest.cxx:62
python.AtlRunQueryAMI.period
period
Definition: AtlRunQueryAMI.py:225
RETURN_CHECK
#define RETURN_CHECK(CONTEXT, EXP)
Helper macro for checking return codes in a compact form in the code.
Definition: ReturnCheck.h:26
index
Definition: index.py:1
CP::CorrectionCode::enableFailure
static void enableFailure() noexcept
Definition: CorrectionCode.h:64
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
python.AtlRunQueryAMI.year
year
Definition: AtlRunQueryAMI.py:226
ZDCMsg::Info
@ Info
Definition: ZDCMsg.h:20
empty
bool empty(TH1 *h)
Definition: computils.cxx:294
CP::CorrectionCode::Error
@ Error
Some error happened during the object correction.
Definition: CorrectionCode.h:36
POOL::TEvent::readFrom
StatusCode readFrom(TFile *file)
Definition: PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:132
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
lumiFormat.i
int i
Definition: lumiFormat.py:92
POOL::TEvent::getEntries
long getEntries()
Definition: PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:123
APP_NAME
#define APP_NAME
Definition: BoostedXbbTag.cxx:23
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:20
create_dcsc_inputs_sqlite.arg
list arg
Definition: create_dcsc_inputs_sqlite.py:48
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
threshold
Definition: chainparser.cxx:74
CP::CorrectionCode::Ok
@ Ok
The correction was done successfully.
Definition: CorrectionCode.h:38
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
CxxUtils::atoi
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
Definition: Control/CxxUtils/Root/StringUtils.cxx:85
L1Topo::Error
Error
The different types of error that can be flagged in the L1TopoRDO.
Definition: Error.h:16
error
Definition: IImpactPoint3dEstimator.h:70
dumpTgcDigiThreshold.threshold
list threshold
Definition: dumpTgcDigiThreshold.py:34
xAOD::TEvent
Tool for accessing xAOD files outside of Athena.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:81
PhysDESDM_Quirks.trigger
trigger
Definition: PhysDESDM_Quirks.py:27
xAOD::Init
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
Definition: Init.cxx:31