67 {
68
69 using namespace asg::msgUserCode;
71
72
73
74
75 std::string isData = "";
77 std::string jetColl = "";
78 std::string jetCalibConfig = "";
79 std::string calibSeq = "";
80 std::string calibArea = "";
81 bool devMode = false;
82 bool isCollision = false;
83
84
85
86
87 for (
int i=1;
i<
argc;
i++){
88
89 std::string
opt(argv[i]); std::vector< std::string >
v;
90
91 std::istringstream iss(opt);
92
94 char delim = '=';
95
96 while (std::getline(iss, item, delim)){
98 }
99
100 if (
opt.find(
"--help") != std::string::npos ) {
102 }
103
104 if (
opt.find(
"--sample=") != std::string::npos )
sample =
v[1];
105
106 if (
opt.find(
"--jetColl=") != std::string::npos ) jetColl =
v[1];
107
108 if (
opt.find(
"--jetCalibConfig=") != std::string::npos ) jetCalibConfig =
v[1];
109
110 if (
opt.find(
"--calibSeq=") != std::string::npos ) calibSeq =
v[1];
111
112 if (
opt.find(
"--calibArea=") != std::string::npos ) calibArea =
v[1];
113
114 if (
opt.find(
"--isData=") != std::string::npos ) isData =
v[1];
115
116 if (
opt.find(
"--devMode") != std::string::npos ) devMode =
true;
117
118 }
119
121 std::cout << "No input xAOD file specified, exiting" << std::endl;
122 return 1;
123 }
124 if(jetColl.empty()){
125 std::cout << "No jet collection specified, exiting" << std::endl;
126 return 1;
127 }
128 if(jetCalibConfig.empty()){
129 std::cout << "No JetCalibTools config specified, exiting" << std::endl;
130 return 1;
131 }
132 if(calibSeq.empty()){
133 std::cout << "No calibration sequence specified, exiting" << std::endl;
134 return 1;
135 }
136 if(isData.empty()){
137 std::cout << "isData not specified, exiting" << std::endl;
138 return 1;
139 }
140 else if(isData=="TRUE") isCollision = true;
141
142
143
144
145 std::unique_ptr< TFile >
ifile( TFile::Open(
sample.c_str(),
"READ" ) );
146
147
148#ifdef XAOD_STANDALONE
153
155 std::shared_ptr<AthOnnx::IOnnxRuntimeSvc> service;
157#else
160#endif
161
162
163
164
165 const std::string name_JetCalibTools = "JetCalib_Example";
166
167
169 ANA_CHECK( jetCalibrationTool.setProperty(
"JetCollection",jetColl.c_str()) );
170
171 ANA_CHECK( jetCalibrationTool.setProperty(
"CalibSequence",calibSeq.c_str()) );
172
173 ANA_CHECK( jetCalibrationTool.setProperty(
"ConfigFile",jetCalibConfig.c_str()) );
174
175 ANA_CHECK( jetCalibrationTool.setProperty(
"IsData",isCollision) );
176
177 if(!calibArea.empty()){
178 ANA_CHECK( jetCalibrationTool.setProperty(
"CalibArea",calibArea.c_str()) );
179 }
180
181 ANA_CHECK( jetCalibrationTool.setProperty(
"DEVmode", devMode ) );
182
183
184 if(!(jetCalibrationTool.initialize().isSuccess())){
185 std::cout << "Initialization of JetCalibTools failed, exiting" << std::endl;
186 return 0;
187 }
188
189
190
191
192
193 const Long64_t
nevents =
event.getEntries();
194 for(Long64_t ievent = 0; ievent <
nevents; ++ievent){
195
196
197 if(
event.getEntry( ievent ) < 0 ) {
198 std::cerr << "Failed to load entry " << ievent << std::endl;
199 return 1;
200 }
201
202
203 if(ievent % 100==0) std::cout <<
"Event " << ievent <<
" of " <<
nevents << std::endl;
204
205
208
209
211
212
213 ANA_CHECK( jetCalibrationTool.applyCalibration( *(jets_shallowCopy.first) ) );
214
215 delete jets_shallowCopy.first;
216 delete jets_shallowCopy.second;
217
218 }
219
221
222 return 0;
223}
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.
std::pair< std::unique_ptr< T >, std::unique_ptr< ShallowAuxContainer > > shallowCopyContainer(const T &cont, const EventContext &ctx)
Function making a shallow copy of a constant container.
JetContainer_v1 JetContainer
Definition of the current "jet container version".