ATLAS Offline Software
Functions
test-btagging.cxx File Reference
#include "xAODRootAccess/Init.h"
#include "xAODRootAccess/tools/ReturnCheck.h"
#include "xAODRootAccess/TEvent.h"
#include "xAODJet/JetContainer.h"
#include "xAODBTagging/BTaggingContainer.h"
#include "xAODBTagging/BTaggingUtilities.h"
#include "AsgMessaging/MessageCheck.h"
#include "TFile.h"
#include "TTree.h"
#include "TError.h"

Go to the source code of this file.

Functions

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

Function Documentation

◆ ATLAS_NOT_THREAD_SAFE()

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

Definition at line 13 of file test-btagging.cxx.

13  {
14 
15  ANA_CHECK_SET_TYPE (int);
16  using namespace asg::msgUserCode;
18 
19  if (argc != 3) {
20  std::cerr << "usage: " << argv[0] << ": <DAOD> <jet collection>"
21  << std::endl;
22  return 1;
23  }
24  std::string file = argv[1];
25  std::string jets_name = argv[2];
26 
27  // The name of the application:
28  const std::string APP_NAME = "BTagTestDumper";
29 
30  // Set up the environment:
31  ANA_CHECK( xAOD::Init() );
32 
33  // Set up the event object:
35 
36  // Open the file:
37  std::unique_ptr<TFile> ifile(TFile::Open(file.c_str(), "READ"));
38  if ( ! ifile.get() || ifile->IsZombie()) {
39  std::cerr << "Couldn't open file: " << file << std::endl;
40  return 1;
41  }
42 
43  // Connect the event object to it:
44  ANA_CHECK( event.readFrom(ifile.get()) );
45 
46  unsigned long long nbad = 0;
47  unsigned long long ngood = 0;
48  unsigned long long entries = event.getEntries();
49  for (unsigned long long entry = 0; entry < entries; ++entry) {
50  // Load the event:
51  if (event.getEntry(entry) < 0) {
52  std::cerr << "Couldn't load entry " << entry << " from file"
53  << file << std::endl;
54  return 1;
55  }
56  const xAOD::JetContainer *jets = nullptr;
57  ANA_CHECK( event.retrieve(jets, jets_name) );
58  for (const xAOD::Jet *const jet : *jets) {
60  if (!btag) {
61  nbad++;
62  } else {
63  ngood++;
64  }
65  }
66  }
67  std::cout << "found " << nbad << " jets with no valid btagging link "
68  << "in " << nbad + ngood << " jets" << std::endl;
69  return nbad > 0;
70 }
TestSUSYToolsAlg.ifile
ifile
Definition: TestSUSYToolsAlg.py:92
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
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
POOL::TEvent::readFrom
StatusCode readFrom(TFile *file)
Definition: PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:132
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
POOL::TEvent::getEntry
int getEntry(long entry)
Definition: PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:184
Analysis::kError
@ kError
Definition: CalibrationDataVariables.h:60
APP_NAME
#define APP_NAME
Definition: BoostedXbbTag.cxx:23
file
TFile * file
Definition: tile_monitor.h:29
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:20
xAOD::BTagging_v1
Definition: BTagging_v1.h:39
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
gErrorIgnoreLevel
int gErrorIgnoreLevel
xAOD::BTaggingUtilities::getBTagging
const BTagging * getBTagging(const SG::AuxElement &part)
Access the default xAOD::BTagging object associated to an object.
Definition: BTaggingUtilities.cxx:37
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
ANA_CHECK_SET_TYPE
#define ANA_CHECK_SET_TYPE(TYPE)
set the type for ANA_CHECK to report failures
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:314
POOL::TEvent::retrieve
StatusCode retrieve(const T *&obj)
Definition: PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:73
entries
double entries
Definition: listroot.cxx:49
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
xAOD::TEvent
Tool for accessing xAOD files outside of Athena.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:81
xAOD::Init
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
Definition: Init.cxx:31