68 {
69
70 using namespace asg::msgUserCode;
72
73
74
75
76 std::string isData = "";
78 std::string jetColl = "";
79 std::string jetCalibConfig = "";
80 std::string calibSeq = "";
81 std::string calibArea = "";
82 bool devMode = false;
83 bool isCollision = false;
84
85
86
87
88 for (
int i=1;
i<
argc;
i++){
89
90 std::string
opt(argv[i]); std::vector< std::string >
v;
91
92 std::istringstream iss(opt);
93
94 std::string item;
95 char delim = '=';
96
97 while (std::getline(iss, item, delim)){
99 }
100
101 if (
opt.find(
"--help") != std::string::npos ) {
103 }
104
105 if (
opt.find(
"--sample=") != std::string::npos )
sample =
v[1];
106
107 if (
opt.find(
"--jetColl=") != std::string::npos ) jetColl =
v[1];
108
109 if (
opt.find(
"--jetCalibConfig=") != std::string::npos ) jetCalibConfig =
v[1];
110
111 if (
opt.find(
"--calibSeq=") != std::string::npos ) calibSeq =
v[1];
112
113 if (
opt.find(
"--calibArea=") != std::string::npos ) calibArea =
v[1];
114
115 if (
opt.find(
"--isData=") != std::string::npos ) isData =
v[1];
116
117 if (
opt.find(
"--devMode") != std::string::npos ) devMode =
true;
118
119 }
120
122 std::cout << "No input xAOD file specified, exiting" << std::endl;
123 return 1;
124 }
125 if(jetColl.empty()){
126 std::cout << "No jet collection specified, exiting" << std::endl;
127 return 1;
128 }
129 if(jetCalibConfig.empty()){
130 std::cout << "No JetCalibTools config specified, exiting" << std::endl;
131 return 1;
132 }
133 if(calibSeq.empty()){
134 std::cout << "No calibration sequence specified, exiting" << std::endl;
135 return 1;
136 }
137 if(isData.empty()){
138 std::cout << "isData not specified, exiting" << std::endl;
139 return 1;
140 }
141 else if(isData=="TRUE") isCollision = true;
142
143
144
145
146 std::unique_ptr< TFile >
ifile( TFile::Open(
sample.c_str(),
"READ" ) );
147
148
149#ifdef XAOD_STANDALONE
154
156 std::shared_ptr<AthOnnx::IOnnxRuntimeSvc> service;
158#else
161#endif
162
163
164
165
166 const std::string name_JetCalibTools = "JetCalib_Example";
167
168
170 ANA_CHECK( jetCalibrationTool.setProperty(
"JetCollection",jetColl.c_str()) );
171
172 ANA_CHECK( jetCalibrationTool.setProperty(
"CalibSequence",calibSeq.c_str()) );
173
174 ANA_CHECK( jetCalibrationTool.setProperty(
"ConfigFile",jetCalibConfig.c_str()) );
175
176 ANA_CHECK( jetCalibrationTool.setProperty(
"IsData",isCollision) );
177
178 if(!calibArea.empty()){
179 ANA_CHECK( jetCalibrationTool.setProperty(
"CalibArea",calibArea.c_str()) );
180 }
181
182 ANA_CHECK( jetCalibrationTool.setProperty(
"DEVmode", devMode ) );
183
184
185 if(!(jetCalibrationTool.initialize().isSuccess())){
186 std::cout << "Initialization of JetCalibTools failed, exiting" << std::endl;
187 return 0;
188 }
189
190
191
192
193
194 const Long64_t
nevents =
event.getEntries();
195 for(Long64_t ievent = 0; ievent <
nevents; ++ievent){
196
197
198 if(
event.getEntry( ievent ) < 0 ) {
199 std::cerr << "Failed to load entry " << ievent << std::endl;
200 return 1;
201 }
202
203
204 if(ievent % 100==0) std::cout <<
"Event " << ievent <<
" of " <<
nevents << std::endl;
205
206
209
210
212
213
214 ANA_CHECK( jetCalibrationTool.applyCalibration( *jets_shallowCopy.first ) );
215 }
216
218
219 return 0;
220}
an object that can create a AsgService
ReadStats & stats()
Access the object belonging to the current thread.
static IOStats & instance()
Singleton object accessor.
void printSmartSlimmingBranchList(bool autoIncludeLinks=false) const
Print the accessed variables, formatted for smart slimming.
Tool for accessing xAOD files outside of Athena.
@ kClassAccess
Access auxiliary data using the aux containers.
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
ShallowCopyResult_t< T > shallowCopy(const T &cont, const EventContext &ctx)
Create a shallow copy of an existing container.
JetContainer_v1 JetContainer
Definition of the current "jet container version".