ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
JetMissingEtID
JetSelectorTools
util
TestJetCleaningTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
6
#ifdef ROOTCORE
7
# include "
xAODRootAccess/TEvent.h
"
8
# include "
xAODRootAccess/TStore.h
"
9
#endif
// ROOTCORE
10
11
#include "
JetSelectorTools/JetCleaningTool.h
"
12
#include "
JetSelectorTools/Helpers.h
"
13
14
#include "
xAODJet/Jet.h
"
15
#include "
xAODJet/JetContainer.h
"
16
#include "
xAODJet/JetAuxContainer.h
"
17
18
#include "TString.h"
19
#include "TSystem.h"
20
21
const
char
*
parseResult
(
const
asg::AcceptData
& result,
const
char
*
selection
=
"Cleaning"
)
22
{
23
return
result.getCutResult(
selection
)==
true
?
"true"
:
"false"
;
24
}
25
26
void
setJetToDefault
(
xAOD::Jet
&
jet
)
27
{
28
jet
.setJetP4(
xAOD::JetFourMom_t
(100.e3,0.,0.,0.));
29
30
jet
.setAttribute<
float
>(
xAOD::JetAttribute::EMFrac
,0.1);
31
jet
.setAttribute<
float
>(
xAOD::JetAttribute::HECFrac
,0.1);
32
jet
.setAttribute<
float
>(
xAOD::JetAttribute::LArQuality
,0.1);
33
jet
.setAttribute<
float
>(
xAOD::JetAttribute::HECQuality
,0.1);
34
jet
.setAttribute<
float
>(
xAOD::JetAttribute::FracSamplingMax
,0.7);
35
jet
.setAttribute<
float
>(
xAOD::JetAttribute::NegativeE
,0);
36
jet
.setAttribute<
float
>(
xAOD::JetAttribute::AverageLArQF
,0);
37
jet
.setAttribute<
int
>(
xAOD::JetAttribute::FracSamplingMaxIndex
,12);
38
39
// for sumPtTrk
40
std::vector<float> sumPtTrkvec;
41
sumPtTrkvec.push_back(50.e3);
42
jet
.setAttribute(
xAOD::JetAttribute::SumPtTrkPt500
,sumPtTrkvec);
43
44
45
// for EnergyPerSampling
46
const
float
jetE =
jet
.e();
47
std::vector<float> ePerS;
48
ePerS.push_back( 0 * jetE );
// 0 : PreSamplerB
49
ePerS.push_back( 0.1 * jetE );
// 1 : EMB1
50
ePerS.push_back( 0.1 * jetE );
// 2 : EMB2
51
ePerS.push_back( 0.1 * jetE );
// 3 : EMB3
52
ePerS.push_back( 0 * jetE );
// 4 : PreSamplerE
53
ePerS.push_back( 0 * jetE );
// 5 : EME1
54
ePerS.push_back( 0 * jetE );
// 6 : EME2
55
ePerS.push_back( 0 * jetE );
// 7 : EME3
56
ePerS.push_back( 0 * jetE );
// 8 : HEC0
57
ePerS.push_back( 0 * jetE );
// 9 : HEC1
58
ePerS.push_back( 0 * jetE );
// 10 : HEC2
59
ePerS.push_back( 0 * jetE );
// 11 : HEC3
60
ePerS.push_back( 0.7 * jetE );
// 12 : TileBar0
61
ePerS.push_back( 0 * jetE );
// 13 : TileBar1
62
ePerS.push_back( 0 * jetE );
// 14 : TileBar2
63
ePerS.push_back( 0 * jetE );
// 15 : TileGap1
64
ePerS.push_back( 0 * jetE );
// 16 : TileGap2
65
ePerS.push_back( 0 * jetE );
// 17 : TileGap3
66
ePerS.push_back( 0 * jetE );
// 18 : TileExt0
67
ePerS.push_back( 0 * jetE );
// 19 : TileExt1
68
ePerS.push_back( 0 * jetE );
// 20 : TileExt2
69
ePerS.push_back( 0 * jetE );
// 21 : FCAL0
70
ePerS.push_back( 0 * jetE );
// 22 : FCAL1
71
ePerS.push_back( 0 * jetE );
// 23 : FCAL2
72
jet
.setAttribute(
"EnergyPerSampling"
,ePerS);
73
}
74
75
76
int
main
(
int
argc,
char
* argv[])
77
{
78
// Arguments and default values
79
TString cutLevel =
"LooseBad"
;
80
TString doUgly =
"true"
;
81
TString hotCells = Form(
"%s/data/JetSelectorTools/HotCells2012.config"
,gSystem->Getenv(
"ROOTCOREBIN"
));
82
if
(argc > 1)
83
cutLevel = argv[1];
84
if
(argc > 2)
85
doUgly = argv[2];
86
if
(argc > 3)
87
hotCells = argv[3];
88
89
// Create and set the cleaning tool
90
JetCleaningTool
* tool =
new
JetCleaningTool
(
"MyCleaningTool"
);
91
if
(tool->setProperty(
"CutLevel"
,cutLevel.Data()).isFailure())
92
{
93
printf(
"Failed to set CutLevel\n"
);
94
exit(1);
95
}
96
if
(tool->setProperty(
"DoUgly"
,doUgly.EqualTo(
"true"
,TString::kIgnoreCase)?
true
:
false
).isFailure())
97
{
98
printf(
"Failed to set DoUgly\n"
);
99
exit(2);
100
}
101
if
(tool->setProperty(
"HotCellsFile"
,hotCells.Data()).isFailure())
102
{
103
printf(
"Failed to set HotCellsFile\n"
);
104
exit(3);
105
}
106
if
(tool->initialize().isFailure())
107
{
108
printf(
"Failed to initialize the tool\n"
);
109
exit(4);
110
}
111
112
// Prepare to build some jets to test the tool
113
xAOD::TEvent
event;
114
xAOD::TStore
store;
115
xAOD::JetContainer
* jets =
new
xAOD::JetContainer
();
116
jets->setStore(
new
xAOD::JetAuxContainer
());
117
jets->push_back(
new
xAOD::Jet
());
118
jets->push_back(
new
xAOD::Jet
());
119
xAOD::Jet
*
jet
= jets->at(0);
120
121
// Confirm that the default jet passes
122
setJetToDefault
(*
jet
);
123
printf(
"Test jet <default pass> : %s\n"
,
parseResult
(tool->accept(*
jet
)));
124
125
126
// Test the isUgly criterion
127
jet
->setAttribute<
int
>(
xAOD::JetAttribute::FracSamplingMaxIndex
,17);
128
printf(
"Test jet <isUgly fail> : %s\n"
,
parseResult
(tool->accept(*
jet
)));
129
130
// Test hot cells criterion
131
jet
->setAttribute<
int
>(
xAOD::JetAttribute::FracSamplingMaxIndex
,13);
132
jet
->setJetP4(
xAOD::JetFourMom_t
(100.,-0.15,2.7,0));
133
printf(
"Test jet <hot cell fail> : %s\n"
,tool->containsHotCells(*
jet
,202660)==
true
?
"false"
:
"true"
);
134
135
136
137
138
139
return
0;
140
}
141
TEvent.h
Jet.h
JetAuxContainer.h
JetCleaningTool.h
JetContainer.h
Helpers.h
TStore.h
setJetToDefault
void setJetToDefault(xAOD::Jet &jet)
Definition
TestJetCleaningTool.cxx:26
parseResult
const char * parseResult(const asg::AcceptData &result, const char *selection="Cleaning")
Definition
TestJetCleaningTool.cxx:21
JetCleaningTool
Class for selecting jets that pass cleaning cuts.
Definition
JetCleaningTool.h:40
asg::AcceptData
Definition
AcceptData.h:31
xAOD::TEvent
Tool for accessing xAOD files outside of Athena.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:59
xAOD::TStore
A relatively simple transient store for objects created in analysis.
Definition
TStore.h:45
selection
const std::string selection
Definition
fbtTestBasics.cxx:75
main
int main()
Definition
hello.cxx:18
jet
Definition
JetCalibTools_PlotJESFactors.cxx:23
xAOD::Jet
Jet_v1 Jet
Definition of the current "jet version".
Definition
Event/xAOD/xAODJet/xAODJet/Jet.h:17
xAOD::JetAuxContainer
JetAuxContainer_v1 JetAuxContainer
Definition of the current jet auxiliary container.
Definition
JetAuxContainer.h:22
xAOD::JetContainer
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Definition
JetContainer.h:17
xAOD::JetFourMom_t
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Definition
JetTypes.h:17
xAOD::JetAttribute::EMFrac
@ EMFrac
Definition
JetAttributes.h:112
xAOD::JetAttribute::LArQuality
@ LArQuality
Definition
JetAttributes.h:83
xAOD::JetAttribute::HECQuality
@ HECQuality
Definition
JetAttributes.h:80
xAOD::JetAttribute::NegativeE
@ NegativeE
Definition
JetAttributes.h:84
xAOD::JetAttribute::FracSamplingMax
@ FracSamplingMax
Definition
JetAttributes.h:116
xAOD::JetAttribute::SumPtTrkPt500
@ SumPtTrkPt500
Definition
JetAttributes.h:108
xAOD::JetAttribute::AverageLArQF
@ AverageLArQF
Definition
JetAttributes.h:85
xAOD::JetAttribute::FracSamplingMaxIndex
@ FracSamplingMaxIndex
Definition
JetAttributes.h:117
xAOD::JetAttribute::HECFrac
@ HECFrac
Definition
JetAttributes.h:113
Generated on
for ATLAS Offline Software by
1.17.0