67int main(
int argc,
char* argv[]){
69 using namespace asg::msgUserCode;
75 std::string isData =
"";
76 std::string sample =
"";
77 std::string jetColl =
"";
78 std::string jetCalibConfig =
"";
79 std::string calibSeq =
"";
80 std::string calibArea =
"";
82 bool isCollision =
false;
87 for (
int i=1; i< argc; i++){
89 std::string opt(argv[i]); std::vector< std::string > v;
91 std::istringstream iss(opt);
96 while (std::getline(iss, item, delim)){
100 if ( opt.find(
"--help") != std::string::npos ) {
104 if ( opt.find(
"--sample=") != std::string::npos ) sample = v[1];
106 if ( opt.find(
"--jetColl=") != std::string::npos ) jetColl = v[1];
108 if ( opt.find(
"--jetCalibConfig=") != std::string::npos ) jetCalibConfig = v[1];
110 if ( opt.find(
"--calibSeq=") != std::string::npos ) calibSeq = v[1];
112 if ( opt.find(
"--calibArea=") != std::string::npos ) calibArea = v[1];
114 if ( opt.find(
"--isData=") != std::string::npos ) isData = v[1];
116 if ( opt.find(
"--devMode") != std::string::npos ) devMode =
true;
121 std::cout <<
"No input xAOD file specified, exiting" << std::endl;
125 std::cout <<
"No jet collection specified, exiting" << std::endl;
128 if(jetCalibConfig.empty()){
129 std::cout <<
"No JetCalibTools config specified, exiting" << std::endl;
132 if(calibSeq.empty()){
133 std::cout <<
"No calibration sequence specified, exiting" << std::endl;
137 std::cout <<
"isData not specified, exiting" << std::endl;
140 else if(isData==
"TRUE") isCollision =
true;
145 std::unique_ptr< TFile > ifile( TFile::Open( sample.c_str(),
"READ" ) );
148#ifdef XAOD_STANDALONE
151 ANA_CHECK( event.readFrom( ifile.get() ) );
155 std::shared_ptr<AthOnnx::IOnnxRuntimeSvc> service;
159 ANA_CHECK( event.readFrom( ifile.get() ) );
165 const std::string name_JetCalibTools =
"JetCalib_Example";
169 ANA_CHECK( jetCalibrationTool.setProperty(
"JetCollection",jetColl.c_str()) );
171 ANA_CHECK( jetCalibrationTool.setProperty(
"CalibSequence",calibSeq.c_str()) );
173 ANA_CHECK( jetCalibrationTool.setProperty(
"ConfigFile",jetCalibConfig.c_str()) );
175 ANA_CHECK( jetCalibrationTool.setProperty(
"IsData",isCollision) );
177 if(!calibArea.empty()){
178 ANA_CHECK( jetCalibrationTool.setProperty(
"CalibArea",calibArea.c_str()) );
181 ANA_CHECK( jetCalibrationTool.setProperty(
"DEVmode", devMode ) );
184 if(!(jetCalibrationTool.
initialize().isSuccess())){
185 std::cout <<
"Initialization of JetCalibTools failed, exiting" << std::endl;
193 const Long64_t nevents =
event.getEntries();
194 for(Long64_t ievent = 0; ievent < nevents; ++ievent){
197 if( event.getEntry( ievent ) < 0 ) {
198 std::cerr <<
"Failed to load entry " << ievent << std::endl;
203 if(ievent % 100==0) std::cout <<
"Event " << ievent <<
" of " << nevents << std::endl;
207 ANA_CHECK( event.retrieve( jets, jetColl +
"Jets" ) );
215 delete jets_shallowCopy.first;
216 delete jets_shallowCopy.second;
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.