ATLAS Offline Software
PhysicsAnalysis
JetTagging
FlavourTaggingTests
util
test-jet-links.cxx
Go to the documentation of this file.
1
// Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
2
3
#include "
xAODRootAccess/Init.h
"
4
#include "
xAODRootAccess/tools/ReturnCheck.h
"
5
#include "
xAODRootAccess/TEvent.h
"
6
#include "
xAODJet/JetContainer.h
"
7
8
#include "
AsgMessaging/MessageCheck.h
"
9
10
#include "TFile.h"
11
#include "TTree.h"
12
#include "TError.h"
13
14
int
main
ATLAS_NOT_THREAD_SAFE
(
int
argc
,
char
*
argv
[]) {
15
16
ANA_CHECK_SET_TYPE
(
int
);
17
using namespace
asg::msgUserCode;
18
gErrorIgnoreLevel
=
kError
;
19
20
if
(
argc
!= 4) {
21
std::cerr <<
"usage: "
<<
argv
[0] <<
": <DAOD> <parent jet collection> <associated collection>"
22
<< std::endl;
23
return
1;
24
}
25
std::string
file
=
argv
[1];
26
std::string jets_name =
argv
[2];
27
std::string linked_jets_name =
argv
[3];
28
29
// The name of the application:
30
const
std::string
APP_NAME
=
"JetLinksTestDumper"
;
31
32
// Set up the environment:
33
ANA_CHECK
(
xAOD::Init
() );
34
35
// Set up the event object:
36
xAOD::TEvent
event
(
xAOD::TEvent::kClassAccess
);
37
38
// Open the file:
39
std::unique_ptr<TFile>
ifile
(TFile::Open(
file
.c_str(),
"READ"
));
40
if
( !
ifile
.get() ||
ifile
->IsZombie()) {
41
std::cerr <<
"Couldn't open file: "
<<
file
<< std::endl;
42
return
1;
43
}
44
45
// Connect the event object to it:
46
ANA_CHECK
(
event
.readFrom(
ifile
.get()) );
47
48
unsigned
long
long
nbad = 0;
49
unsigned
long
long
ngood = 0;
50
unsigned
long
long
entries
=
event
.getEntries();
51
for
(
unsigned
long
long
entry
= 0;
entry
<
entries
; ++
entry
) {
52
// Load the event:
53
if
(
event
.getEntry(
entry
) < 0) {
54
std::cerr <<
"Couldn't load entry "
<<
entry
<<
" from file"
55
<<
file
<< std::endl;
56
return
1;
57
}
58
const
xAOD::JetContainer
*
jets
=
nullptr
;
59
ANA_CHECK
(
event
.retrieve(
jets
, jets_name) );
60
for
(
const
xAOD::Jet
*
const
jet
: *
jets
) {
61
std::vector<const xAOD::Jet*> linked_jets;
62
if
(!
jet
->getAssociatedObjects<
xAOD::Jet
>(linked_jets_name, linked_jets)){
63
nbad++;
64
}
else
{
65
ngood++;
66
}
67
}
68
}
69
std::cout <<
"JetLinksTestDumper Summary: found "
<< nbad <<
" out of "
<< nbad + ngood <<
" large-R jets with no valid links to associated track-jets "
<< std::endl;
70
return
nbad > 0;
71
}
covarianceToolsLibrary.gErrorIgnoreLevel
gErrorIgnoreLevel
Definition:
covarianceToolsLibrary.py:21
TRT::Track::event
@ event
Definition:
InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:74
defineDB.jets
jets
Definition:
JetTagCalibration/share/defineDB.py:24
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition:
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
xAOD::TEvent::kClassAccess
@ kClassAccess
Access auxiliary data using the aux containers.
Definition:
Control/xAODRootAccess/xAODRootAccess/TEvent.h:71
ReturnCheck.h
main
int main(int, char **)
Main class for all the CppUnit test classes
Definition:
CppUnit_SGtestdriver.cxx:141
jet
Definition:
JetCalibTools_PlotJESFactors.cxx:23
LArCellNtuple.argv
argv
Definition:
LArCellNtuple.py:167
Analysis::kError
@ kError
Definition:
CalibrationDataVariables.h:60
MessageCheck.h
macros for messaging and checking status codes
APP_NAME
#define APP_NAME
Definition:
BoostedXbbTag.cxx:23
TEvent.h
file
TFile * file
Definition:
tile_monitor.h:29
Init.h
DQHistogramMergeRegExp.argc
argc
Definition:
DQHistogramMergeRegExp.py:19
DataVector
Derived DataVector<T>.
Definition:
DataVector.h:795
ATLAS_NOT_THREAD_SAFE
int main ATLAS_NOT_THREAD_SAFE(int argc, char *argv[])
Definition:
test-jet-links.cxx:14
GetAllXsec.entry
list entry
Definition:
GetAllXsec.py:132
xAOD::Jet_v1
Class describing a jet.
Definition:
Jet_v1.h:57
JetContainer.h
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
entries
double entries
Definition:
listroot.cxx:49
LArCellNtuple.ifile
string ifile
Definition:
LArCellNtuple.py:146
xAOD::TEvent
Tool for accessing xAOD files outside of Athena.
Definition:
Control/xAODRootAccess/xAODRootAccess/TEvent.h:57
xAOD::Init
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
Definition:
Init.cxx:31
Generated on Mon Nov 24 2025 21:19:40 for ATLAS Offline Software by
1.8.18