68int main(
int argc,
char* argv[]){
70 using namespace asg::msgUserCode;
76 std::string isData =
"";
77 std::string sample =
"";
78 std::string jetColl =
"";
79 std::string jetCalibConfig =
"";
80 std::string calibSeq =
"";
81 std::string calibArea =
"";
83 bool isCollision =
false;
88 for (
int i=1; i< argc; i++){
90 std::string opt(argv[i]); std::vector< std::string > v;
92 std::istringstream iss(opt);
97 while (std::getline(iss, item, delim)){
101 if ( opt.find(
"--help") != std::string::npos ) {
105 if ( opt.find(
"--sample=") != std::string::npos ) sample = v[1];
107 if ( opt.find(
"--jetColl=") != std::string::npos ) jetColl = v[1];
109 if ( opt.find(
"--jetCalibConfig=") != std::string::npos ) jetCalibConfig = v[1];
111 if ( opt.find(
"--calibSeq=") != std::string::npos ) calibSeq = v[1];
113 if ( opt.find(
"--calibArea=") != std::string::npos ) calibArea = v[1];
115 if ( opt.find(
"--isData=") != std::string::npos ) isData = v[1];
117 if ( opt.find(
"--devMode") != std::string::npos ) devMode =
true;
122 std::cout <<
"No input xAOD file specified, exiting" << std::endl;
126 std::cout <<
"No jet collection specified, exiting" << std::endl;
129 if(jetCalibConfig.empty()){
130 std::cout <<
"No JetCalibTools config specified, exiting" << std::endl;
133 if(calibSeq.empty()){
134 std::cout <<
"No calibration sequence specified, exiting" << std::endl;
138 std::cout <<
"isData not specified, exiting" << std::endl;
141 else if(isData==
"TRUE") isCollision =
true;
146 std::unique_ptr< TFile > ifile( TFile::Open( sample.c_str(),
"READ" ) );
149#ifdef XAOD_STANDALONE
152 ANA_CHECK( event.readFrom( ifile.get() ) );
156 std::shared_ptr<AthOnnx::IOnnxRuntimeSvc> service;
160 ANA_CHECK( event.readFrom( ifile.get() ) );
166 const std::string name_JetCalibTools =
"JetCalib_Example";
170 ANA_CHECK( jetCalibrationTool.setProperty(
"JetCollection",jetColl.c_str()) );
172 ANA_CHECK( jetCalibrationTool.setProperty(
"CalibSequence",calibSeq.c_str()) );
174 ANA_CHECK( jetCalibrationTool.setProperty(
"ConfigFile",jetCalibConfig.c_str()) );
176 ANA_CHECK( jetCalibrationTool.setProperty(
"IsData",isCollision) );
178 if(!calibArea.empty()){
179 ANA_CHECK( jetCalibrationTool.setProperty(
"CalibArea",calibArea.c_str()) );
182 ANA_CHECK( jetCalibrationTool.setProperty(
"DEVmode", devMode ) );
185 if(!(jetCalibrationTool.
initialize().isSuccess())){
186 std::cout <<
"Initialization of JetCalibTools failed, exiting" << std::endl;
194 const Long64_t nevents =
event.getEntries();
195 for(Long64_t ievent = 0; ievent < nevents; ++ievent){
198 if( event.getEntry( ievent ) < 0 ) {
199 std::cerr <<
"Failed to load entry " << ievent << std::endl;
204 if(ievent % 100==0) std::cout <<
"Event " << ievent <<
" of " << nevents << std::endl;
208 ANA_CHECK( event.retrieve( jets, jetColl +
"Jets" ) );