ATLAS Offline Software
FFJetSmearingTool_MyExample.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // //
7 // Name: FFJetSmearingTool_MyExample //
8 // Purpose: example code for using the FFJetSmearingTool //
9 // ---> For more information about the tool, check TWiki: https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/FFJetSmearingTool //
10 // //
11 // * Authors: Alberto Prades and Davide Melini //
12 // * Updates: Daniel Camarero Munoz //
13 // * July 2024: Migration to R22+ for Phase-I large-R UFO pre-recommendations //
14 // * November 2024: Available in Athena by default //
15 // //
17 
18 // System
19 #include <memory>
20 #include <AsgTools/ToolHandle.h>
21 #include <AsgTools/AsgTool.h>
22 
23 // xAOD EDM classes
25 #include <xAODJet/JetContainer.h>
26 
30 #include <xAODCore/tools/IOStats.h>
32 #include <xAODCore/ShallowCopy.h>
33 
34 // Jet tools
38 
39 // ROOT
40 #include <TFile.h>
41 #include <TCanvas.h>
42 #include <TH1F.h>
43 #include <TTree.h>
44 
45 // Error checking macro
46 #define CHECK( ARG ) \
47  do { \
48  const bool result = ARG; \
49  if (!result){ \
50  std::cout << "Failed to execute: " << ARG << std::endl; \
51  return 1; \
52  } \
53  } while( false )
54 
55 // Help message if the --help option is given by the user
56 void usage(){
57  std::cout << "Running options:" << std::endl;
58  std::cout << "YOU HAVE TO ADAPT THE OPTIONS TO FFJETSMEARINGCORRECTION" << std::endl;
59  std::cout << " --help : To get the help you're reading" << std::endl;
60  std::cout << " --jetColl= : Specify the jet collection (e.g. UFO+CSSK jets)" << std::endl;
61  std::cout << " --MassDef= : Specify the kind of jet mass used (e.g. UFO)" << std::endl;
62  std::cout << " --MCType= : Specify the MC campaign (e.g. MC20, MC21, MC23, MC20AF3, MC23AF3)" << std::endl;
63  std::cout << " --sample= : Specify input xAOD" << std::endl;
64  std::cout << " Example: FFJetSmearingTool_MyExample --truth_jetColl=AntiKt10TruthSoftDropBeta100Zcut10Jets --reco_jetColl=AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets --MassDef=UFO --MCType=MC23 --eventsMax=30000 --sample=/eos/atlas/atlascerngroupdisk/perf-jets/INSITU/TestFiles/dcamarer/DAOD_PHYS_MC_Zqqjets/mc20_13TeV/DAOD_PHYS.40038344._000011.pool.root.1 --output=.root --ConfigFile=/afs/cern.ch/user/d/dcamarer/private/PostDoc/JETM/JMRcombination_PhaseILargeR/test-jetcalibtools-configs/R22/source/JetUncertainties/share/DCM_240502_new/R10_FullJMR_Phase1.config --DebugTool=false" << std::endl;
65 }
66 
68 // Main Function //
70 
71 int main(int argc, char* argv[]){
72 
74 
76  std::string sample = "";
77  std::string truth_jetColl = "";
78  std::string reco_jetColl = "";
79  std::string string_kindofmass = "";
80  std::string string_kindofmc = "";
81  std::string output = "";
82  std::string string_configfile_path = "";
83  std::string string_debugtool = "";
84  int eventsMax = 30000;
85 
87  for (int i=1; i< argc; i++){
88 
89  std::string opt(argv[i]); std::vector< std::string > v;
90  std::istringstream iss(opt);
91  std::string item;
92  char delim = '=';
93 
94  while (std::getline(iss, item, delim)){
95  v.push_back(item);
96  }
97 
98  if ( opt.find("--help") != std::string::npos ){
99  usage();
100  return 0;
101  }
102 
103  if ( opt.find("--sample=") != std::string::npos ) sample = v[1];
104  if ( opt.find("--truth_jetColl=") != std::string::npos ) truth_jetColl = v[1];
105  if ( opt.find("--reco_jetColl=") != std::string::npos ) reco_jetColl = v[1];
106  if ( opt.find("--MassDef=") != std::string::npos ) string_kindofmass = v[1];
107  if ( opt.find("--MCType=") != std::string::npos ) string_kindofmc = v[1];
108  if ( opt.find("--ConfigFile=") != std::string::npos ) string_configfile_path = v[1];
109  if ( opt.find("--DebugTool=") != std::string::npos ) string_debugtool = v[1];
110  if ( opt.find("--output=") != std::string::npos ) output = v[1];
111  if ( opt.find("--eventsMax=") != std::string::npos ) eventsMax = std::atoi(v[1].data());
112 
113  }
114 
115  if (sample==""){
116  std::cout << "No input xAOD file specified, exiting" << std::endl;
117  return 1;
118  }
119  if (truth_jetColl==""){
120  std::cout << "No truth jet collection specified, exiting" << std::endl;
121  return 1;
122  }
123  if (reco_jetColl==""){
124  std::cout << "No truth jet collection specified, exiting" << std::endl;
125  return 1;
126  }
127  if (string_kindofmass==""){
128  std::cout << "No kind of jet mass specified, exiting" << std::endl;
129  return 1;
130  }
131  if (string_kindofmc==""){
132  std::cout << "No kind of MC specified, exiting" << std::endl;
133  return 1;
134  }
135  if (string_configfile_path==""){
136  std::cout << "No ConfigFile specified, exiting" << std::endl;
137  return 1;
138  }
139  if (string_debugtool==""){
140  std::cout << "No debugtool specified, exiting" << std::endl;
141  return 1;
142  }
143  if (output==""){
144  std::cout << "Output not specified, exiting" << std::endl;
145  return 1;
146  }
147  std::cout << sample.c_str() << truth_jetColl.c_str() << reco_jetColl.c_str() << output.c_str() << string_debugtool.c_str() << std::endl;
148 
149  TString kindofmass = string_kindofmass;
150  TString kindofmc = string_kindofmc;
151 
152  bool want_to_debug = false;
153  if (string_debugtool == "true"){
154  want_to_debug = true;
155  }else if (string_debugtool == "false"){
156  want_to_debug = false;
157  }
158 
160 
161  std::unique_ptr< TFile > ifile( TFile::Open( sample.c_str(), "READ" ) );
162 
163  // Create a TEvent object
165 
166  CHECK( event.readFrom( ifile.get() ) );
167 
169 
170  const std::string name_FFJetSmearingTool = "FFJetSmearing_Example";
171  CP::FFJetSmearingTool ffjetsmearingtool(name_FFJetSmearingTool.c_str());
172  CHECK(ffjetsmearingtool.setProperty("MassDef", kindofmass));
173  CHECK(ffjetsmearingtool.setProperty("MCType", kindofmc));
174  CHECK(ffjetsmearingtool.setProperty("ConfigFile", string_configfile_path));
175  CHECK(ffjetsmearingtool.setProperty("OutputLevel", MSG::ERROR)); // Set output level threshold (1=VERBOSE, 2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL, 7=ALWAYS)
176  if (want_to_debug){
177  CHECK(ffjetsmearingtool.setProperty("OutputLevel", MSG::VERBOSE));
178  }
179  CHECK(ffjetsmearingtool.initialize());
180 
182 
183  const CP::SystematicSet& recommendedSysts = ffjetsmearingtool.recommendedSystematics();
184  std::cout << "\nRecommended systematics:\n" << std::endl;
185  for (auto sysItr = recommendedSysts.begin(); sysItr != recommendedSysts.end(); ++sysItr){
186  std::cout << sysItr->name().c_str() << std::endl;
187  }
188 
189  std::vector<CP::SystematicSet> sysList;
190 
192  // Note: in principle not needed for most of the derivaiton formats, as we save this information in DAODs
193  /*
194  JetTruthLabelingTool m_JetTruthLabelingTool("JetTruthLabelingTool");
195  CHECK(m_JetTruthLabelingTool.setProperty("TruthLabelName", "R10TruthLabel_R21Precision_2022v1"));
196  CHECK(m_JetTruthLabelingTool.setProperty("UseTRUTH3", false)); // Set this to false only if you have the FULL !TruthParticles container in your input file
197  CHECK(m_JetTruthLabelingTool.setProperty("TruthParticleContainerName", "TruthParticles")); // Set this if you have the FULL !TruthParticles container but have named it something else
198  CHECK(m_JetTruthLabelingTool.initialize());
199  */
200 
202 
203  const std::string name_JetCalibTools = "JetCalibrationTool";
204  JetCalibrationTool m_JetCalibrationTool_handle(name_JetCalibTools.c_str());
205 
206  CHECK(m_JetCalibrationTool_handle.setProperty("JetCollection", "AntiKt10UFOCSSKSoftDropBeta100Zcut10"));
207  CHECK(m_JetCalibrationTool_handle.setProperty("ConfigFile", "JES_MC20PreRecommendation_R10_UFO_CSSK_SoftDrop_JMS_R21Insitu_26Nov2024.config"));
208  //CHECK(m_JetCalibrationTool_handle.setProperty("ConfigFile", "share/JES_MC20PreRecommendation_R10_UFO_CSSK_SoftDrop_JMS_R21Insitu_02Aug2024.config")); // When using DEVmode
209  CHECK(m_JetCalibrationTool_handle.setProperty("CalibSequence", "EtaJES_JMS"));
210  CHECK(m_JetCalibrationTool_handle.setProperty("IsData", false));
211  CHECK(m_JetCalibrationTool_handle.setProperty("CalibArea", "00-04-82"));
212  CHECK(m_JetCalibrationTool_handle.setProperty("DEVmode", false));
213  //CHECK(m_JetCalibrationTool_handle.setProperty("DEVmode", true)); // When using DEVmode
214  CHECK(m_JetCalibrationTool_handle.initialize());
215 
217 
219  /*
220  sysList.insert( sysList.begin(), CP::SystematicSet() );
221  const CP::SystematicVariation nullVar = CP::SystematicVariation("Nominal");
222  sysList.back().insert(nullVar);
223  */
224 
225  for (auto sys : recommendedSysts){
226  sysList.push_back(CP::SystematicSet({sys}));
227  }
228 
229  std::cout << "\n=============SYSTEMATICS CHECK NOW" << std::endl;
230  for (auto sys : sysList){
231 
232  std::cout << "\nRunning over the systematic " << sys.name().c_str() << std::endl;
233  static constexpr float MeVtoGeV = 1.e-3;
234 
235  // Tell the calibration tool which variation to apply
236  if (ffjetsmearingtool.applySystematicVariation(sys) != StatusCode::SUCCESS){
237  std::cout << "Error, Cannot configure calibration tool for systematics" << std::endl;
238  }
239 
240  // Define histograms
241  TH1F* reco_jet_mass_hist = new TH1F("reco_jet_mass_hist","reco_jet_mass_hist", 300, 0, 600);
242  TH1F* matched_truth_jet_mass_hist = new TH1F("matched_truth_jet_mass_hist","matched_truth_jet_mass_hist", 300, 0, 600);
243  TH1F* smeared_reco_jet_mass_hist = new TH1F("smeared_reco_jet_mass_hist","smeared_reco_jet_mass_hist", 300, 0, 600);
244  //
245  TH1F* reco_jet_pt_hist = new TH1F("reco_jet_pt_hist","reco_jet_pt_hist", 800, 0, 4000);
246  TH1F* matched_truth_jet_pt_hist = new TH1F("matched_truth_jet_pt_hist","matched_truth_jet_pt_hist", 800, 0, 4000);
247  TH1F* smeared_reco_jet_pt_hist = new TH1F("smeared_reco_jet_pt_hist","smeared_reco_jet_pt_hist", 800, 0, 4000);
248  //
249  TH1F* reco_jet_rapidity_hist = new TH1F("reco_jet_rapidity_hist","reco_jet_rapidity_hist", 50, -2.5, 2.5);
250  TH1F* matched_truth_jet_rapidity_hist = new TH1F("matched_truth_jet_rapidity_hist","matched_truth_jet_rapidity_hist", 50, -2.5, 2.5);
251  TH1F* smeared_reco_jet_rapidity_hist = new TH1F("smeared_reco_jet_rapidity_hist","smeared_reco_jet_rapidity_hist", 50, -2.5, 2.5);
252 
253  reco_jet_mass_hist->Sumw2();
254  matched_truth_jet_mass_hist->Sumw2();
255  smeared_reco_jet_mass_hist->Sumw2();
256 
257  reco_jet_pt_hist->Sumw2();
258  matched_truth_jet_pt_hist->Sumw2();
259  smeared_reco_jet_pt_hist->Sumw2();
260 
261  reco_jet_rapidity_hist->Sumw2();
262  matched_truth_jet_rapidity_hist->Sumw2();
263  smeared_reco_jet_rapidity_hist->Sumw2();
264 
265  int upperlimit1 = 600;
266  int upperlimit2 = 1000;
267 
268  int numBinsMass = 120;
269  int numBinsPt = 100;
270 
271  std::unique_ptr<TH3F> hist_jet_mass_scale_change_3D;
272  hist_jet_mass_scale_change_3D = std::make_unique<TH3F>("hist_jet_mass_scale_change_3D","hist_jet_mass_scale_change_3D",numBinsPt,0,upperlimit2,numBinsMass,0,upperlimit1,numBinsMass,0,upperlimit1);
273 
274  float lowerlimit3 = -0.5;
275  float upperlimit3 = 0.5;
276  int numBinsDiff = 100;
277 
278  std::unique_ptr<TH3F> hist_jet_mass_resolution_change_3D;
279  hist_jet_mass_resolution_change_3D = std::make_unique<TH3F>("hist_jet_mass_resolution_change_3D","hist_jet_mass_resolution_change_3D",numBinsPt,0,upperlimit2,numBinsMass,0,upperlimit1,numBinsDiff,lowerlimit3,upperlimit3);
280 
282 
283  Long64_t nevents = event.getEntries();
284 
285  if (eventsMax < nevents){
286  nevents = eventsMax;
287  }
288 
289  for (Long64_t ievent = 0; ievent < nevents; ++ievent){
290 
291  // Load the event:
292  if ( event.getEntry( ievent ) < 0 ){
293  std::cout << "Failed to load entry " << ievent << std::endl;
294  return 1;
295  }
296 
297  // Show status
298  if (ievent % 1000==0){
299  std::cout << "Event " << ievent << " of " << nevents << std::endl;
300  }
301 
302  // Print some event information for fun
303  if (want_to_debug){
304  const xAOD::EventInfo* ei = nullptr;
305  CHECK( event.retrieve(ei, "EventInfo") );
306 
307  std::cout << "===>>> start processing event " << ei->eventNumber() << ", run " << ei->runNumber() << " - Events processed so far: " << ievent << std::endl;
308 
309  // Get the truth jets from the event
310  const xAOD::JetContainer* jets_truth = nullptr;
311  CHECK( event.retrieve(jets_truth, truth_jetColl) );
312  std::cout << "Number of truth jets: " << jets_truth->size() << std::endl;
313 
314  // Loop over the truth jets in the event
315  for (const xAOD::Jet* jet_truth : *jets_truth){
316  // Print basic info about this jet
317  std::cout << "Truth Jet: pt = " << jet_truth->pt()*MeVtoGeV << ", mass = " << jet_truth->m()*MeVtoGeV << ", eta = " << jet_truth->eta() << std::endl;
318  }
319 
320  // Get the reco jets from the event
321  const xAOD::JetContainer* jets_reco = nullptr;
322  CHECK( event.retrieve(jets_reco, reco_jetColl) );
323  std::cout << "Number of reco jets: " << jets_reco->size() << std::endl;
324 
325  //Loop over the reco jets in the event
326  for (const xAOD::Jet* jet_reco : *jets_reco){
327  // Print basic info about this jet
328  std::cout << "Reco Jet: pt = " << jet_reco->pt()*MeVtoGeV << ", mass = " << jet_reco->m()*MeVtoGeV << ", eta = " << jet_reco->eta() << std::endl;
329  }
330  }
331 
332  xAOD::Jet jet_truth_matched;
333  jet_truth_matched.makePrivateStore();
334 
335  // Retrieve jet container
336  const xAOD::JetContainer* jets = nullptr;
337  CHECK( event.retrieve( jets, reco_jetColl ) );
338 
339  // Shallow copy
340  auto jets_shallowCopy = xAOD::shallowCopyContainer( *jets );
341 
343  // Note: in principle not needed for most of the derivaiton formats, as we save this information in DAODs
344  //m_JetTruthLabelingTool.modify(*(jets_shallowCopy.first));
345 
346  if (want_to_debug){
347  std::cout << "Start the loop over the jets" << std::endl;
348  }
349 
350  bool lead_jet = true;
351 
352  // Apply the jet calibration
353  if ( m_JetCalibrationTool_handle.applyCalibration( *(jets_shallowCopy.first) ) != StatusCode::SUCCESS ){
354  std::cout << "JetCalibration tool reported a EL::StatusCode::FAILURE" << std::endl;
355  return 1;
356  }
357 
359 
360  for ( xAOD::Jet* jet_reco : *(jets_shallowCopy.first) ){
361 
362  double jetpt = jet_reco->pt() * MeVtoGeV;
363  double jetm = jet_reco->m() * MeVtoGeV;
364  double jetrapidity = jet_reco->rapidity();
365  // Jet pT cut
366  if (jetpt < 200 or jetpt > 3000) continue;
367  // Jet mass cut
368  if (jetm > 600) continue;
369  // Jet rapidity cut
370  if (abs(jetrapidity) > 2) continue;
371 
372  if ( ffjetsmearingtool.getMatchedTruthJet(*jet_reco, jet_truth_matched) != StatusCode::SUCCESS ){
373  continue;
374  }
375 
376  double aux_original_jet_mass = jet_reco->m() * MeVtoGeV;
377 
378  if (lead_jet == true && aux_original_jet_mass > 0){
379 
380  reco_jet_mass_hist->Fill(jet_reco->m() * MeVtoGeV);
381  reco_jet_pt_hist->Fill(jet_reco->pt() * MeVtoGeV);
382  reco_jet_rapidity_hist->Fill(jet_reco->rapidity());
383  //
384  matched_truth_jet_mass_hist->Fill(jet_truth_matched.m() * MeVtoGeV);
385  matched_truth_jet_pt_hist->Fill(jet_truth_matched.pt() * MeVtoGeV);
386  matched_truth_jet_rapidity_hist->Fill(jet_truth_matched.rapidity());
387 
388  // Smear the jets for each systematic variation
389  if ( ffjetsmearingtool.applyCorrection(*jet_reco) == CP::CorrectionCode::Error ) {
390  std::cout << "FFJetSmearingTool reported a EL::StatusCode::FAILURE" << std::endl;
391  return 1;
392  }
393 
394  smeared_reco_jet_mass_hist->Fill(jet_reco->m() * MeVtoGeV);
395  smeared_reco_jet_pt_hist->Fill(jet_reco->pt() * MeVtoGeV);
396  smeared_reco_jet_rapidity_hist->Fill(jet_reco->rapidity());
397 
398  hist_jet_mass_scale_change_3D->Fill(jet_reco->pt() * MeVtoGeV, aux_original_jet_mass, jet_reco->m() * MeVtoGeV);
399  hist_jet_mass_resolution_change_3D->Fill(jet_reco->pt() * MeVtoGeV, aux_original_jet_mass, TMath::Abs( (jet_reco->m()*MeVtoGeV) - (aux_original_jet_mass) )/aux_original_jet_mass);
400 
401  lead_jet = false;
402 
403  }
404 
405  } // Loop over reco jets
406 
407  delete jets_shallowCopy.first;
408  delete jets_shallowCopy.second;
409 
410  } // Loop over number of events
411 
412  TString output_path = "output/" + sys.name() + output ;
413  TFile *jetmass_histograms = new TFile(output_path,"recreate");
414 
415  reco_jet_mass_hist->Write();
416  matched_truth_jet_mass_hist->Write();
417  smeared_reco_jet_mass_hist->Write();
418 
419  reco_jet_pt_hist->Write();
420  matched_truth_jet_pt_hist->Write();
421  smeared_reco_jet_pt_hist->Write();
422 
423  reco_jet_rapidity_hist->Write();
424  matched_truth_jet_rapidity_hist->Write();
425  smeared_reco_jet_rapidity_hist->Write();
426 
428 
429  TH2F* hist_jet_mass_scale_change_2D = new TH2F("hist_jet_mass_scale_change_2D","hist_jet_mass_scale_change_2D",numBinsPt,0,upperlimit2,numBinsMass,0,upperlimit1);
430  for (int i=1; i<=hist_jet_mass_scale_change_3D->GetNbinsX(); i++){
431  for (int j=1; j<= hist_jet_mass_scale_change_3D->GetNbinsY(); j++){
432  TH1F* hold = new TH1F("","",numBinsMass,0,upperlimit1);
433  for (int k=1; k<= hist_jet_mass_scale_change_3D->GetNbinsZ(); k++){
434  hold->SetBinContent(k,hist_jet_mass_scale_change_3D->GetBinContent(i,j,k)); // A 2D projection of the TH3
435  }
436  hist_jet_mass_scale_change_2D->SetBinContent(i,j,hold->GetMean()/hist_jet_mass_scale_change_3D->GetYaxis()->GetBinCenter(j));
437  delete hold;
438  }
439  }
440 
441  TH2F* hist_jet_mass_resolution_change_2D = new TH2F("hist_jet_mass_resolution_change_2D","hist_jet_mass_resolution_change_2D",numBinsPt,0,upperlimit2,numBinsMass,0,upperlimit1);
442  for (int i=1; i<=hist_jet_mass_resolution_change_3D->GetNbinsX(); i++){
443  for (int j=1; j<= hist_jet_mass_resolution_change_3D->GetNbinsY(); j++){
444  TH1F* hold = new TH1F("","",numBinsDiff,lowerlimit3,upperlimit3);
445  for (int k=1; k<= hist_jet_mass_resolution_change_3D->GetNbinsZ(); k++){
446  hold->SetBinContent(k,hist_jet_mass_resolution_change_3D->GetBinContent(i,j,k)); // A 2D projection of the TH3
447  }
448  hist_jet_mass_resolution_change_2D->SetBinContent(i,j,hold->GetMean()/hist_jet_mass_resolution_change_3D->GetYaxis()->GetBinCenter(j));
449  delete hold;
450  }
451  }
452 
454 
455  double w = 650;
456  double h = 650;
457 
458  TCanvas *c1 = new TCanvas("c1","c1",w,h);
459  c1->SetWindowSize(w+(w-c1->GetWw()),h+(h-c1->GetWh()));
460  c1->cd();
461 
462  TPad *canvas_1 = new TPad("canvas_1", "canvas_1",0.0,0.0,1.0,1.0);
463  canvas_1->SetRightMargin(0.10);
464  canvas_1->SetFillStyle(4000);
465  canvas_1->Draw();
466  canvas_1->cd();
467 
468  hist_jet_mass_scale_change_2D->GetXaxis()->SetTitleOffset(1.5);
469  hist_jet_mass_scale_change_2D->GetXaxis()->SetNdivisions(5);
470  hist_jet_mass_scale_change_2D->GetYaxis()->SetTitleOffset(1.5);
471  hist_jet_mass_scale_change_2D->GetZaxis()->SetTitleOffset(1.5);
472  hist_jet_mass_scale_change_2D->GetYaxis()->SetTitle("Initial Reco Mass [GeV]");
473  hist_jet_mass_scale_change_2D->GetXaxis()->SetTitle("Reco p_{T} [GeV]");
474  hist_jet_mass_scale_change_2D->GetZaxis()->SetTitle("Average Mass smearing (Initial_reco_mass/smeared_reco_mass)");
475  hist_jet_mass_scale_change_2D->GetZaxis()->SetRangeUser(0.95,1.05);
476  hist_jet_mass_scale_change_2D->GetZaxis()->SetLabelSize(0.035);
477  hist_jet_mass_scale_change_2D->Draw("colz");
478  gPad->RedrawAxis();
479 
480  TString output_path_scale_debug = "output/debug_plots/scale_variations/" + sys.name() + "_scaleDebug.pdf" ;
481  c1->Print(output_path_scale_debug);
482 
483  delete hist_jet_mass_scale_change_2D;
484  delete c1;
485 
486  TCanvas *c2 = new TCanvas("c2","c2",w,h);
487  c2->SetWindowSize(w+(w-c2->GetWw()),h+(h-c2->GetWh()));
488  c2->cd();
489 
490  TPad *canvas_2 = new TPad("canvas_2", "canvas_2",0.0,0.0,1.0,1.0);
491  canvas_2->SetRightMargin(0.10);
492  canvas_2->SetFillStyle(4000);
493  canvas_2->Draw();
494  canvas_2->cd();
495 
496  hist_jet_mass_resolution_change_2D->GetXaxis()->SetTitleOffset(1.5);
497  hist_jet_mass_resolution_change_2D->GetXaxis()->SetNdivisions(5);
498  hist_jet_mass_resolution_change_2D->GetYaxis()->SetTitleOffset(1.5);
499  hist_jet_mass_resolution_change_2D->GetZaxis()->SetTitleOffset(1.5);
500  hist_jet_mass_resolution_change_2D->GetYaxis()->SetTitle("Initial Reco Mass [GeV]");
501  hist_jet_mass_resolution_change_2D->GetXaxis()->SetTitle("Reco p_{T} [GeV]");
502  hist_jet_mass_resolution_change_2D->GetZaxis()->SetTitle("Average Mass smearing (Initial_reco_mass/smeared_reco_mass)");
503  hist_jet_mass_resolution_change_2D->GetZaxis()->SetRangeUser(-0.1,0.1);
504  hist_jet_mass_resolution_change_2D->GetZaxis()->SetLabelSize(0.035);
505  hist_jet_mass_resolution_change_2D->Draw("colz");
506  gPad->RedrawAxis();
507 
508  TString output_path_resolution_debug = "output/debug_plots/resolution_variations/" + sys.name() + "_resolutionDebug.pdf" ;
509  c2->Print(output_path_resolution_debug);
510 
511  delete hist_jet_mass_resolution_change_2D;
512  delete c2;
513 
514  jetmass_histograms->Close();
515  delete jetmass_histograms;
516 
517  delete reco_jet_mass_hist;
518  delete matched_truth_jet_mass_hist;
519  delete smeared_reco_jet_mass_hist;
520 
521  delete reco_jet_pt_hist;
522  delete matched_truth_jet_pt_hist;
523  delete smeared_reco_jet_pt_hist;
524 
525  delete reco_jet_rapidity_hist;
526  delete matched_truth_jet_rapidity_hist;
527  delete smeared_reco_jet_rapidity_hist;
528 
529  } // Loop over systematic uncertainties
530 
531  return 0;
532 
533 }
ShallowCopy.h
CP::FFJetSmearingTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: FFJetSmearingTool.cxx:54
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
xAOD::EventInfo_v1::eventNumber
uint64_t eventNumber() const
The current event's event number.
make_coralServer_rep.opt
opt
Definition: make_coralServer_rep.py:19
EventShape.h
extractSporadic.c1
c1
Definition: extractSporadic.py:134
FFJetSmearingTool.h
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
CP::MeVtoGeV
constexpr float MeVtoGeV
Definition: IsolationCloseByCorrectionTool.cxx:33
JetCalibrationTool::initialize
StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: JetCalibrationTool.cxx:54
CP::SystematicSet::name
std::string name() const
returns: the systematics joined into a single string.
Definition: SystematicSet.cxx:278
CP::FFJetSmearingTool::applyCorrection
virtual CP::CorrectionCode applyCorrection(xAOD::Jet &jet_reco) const override
Apply a systematic variation of get a new copy.
Definition: FFJetSmearingTool.cxx:657
IOStats.h
xAOD::TEvent::kClassAccess
@ kClassAccess
Access auxiliary data using the aux containers.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:100
python.TrigEgammaMonitorHelper.TH2F
def TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:45
ReturnCheck.h
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
xAOD::EventInfo_v1::runNumber
uint32_t runNumber() const
The current event's run number.
PyPoolBrowser.item
item
Definition: PyPoolBrowser.py:129
CP::CorrectionCode::Error
@ Error
Some error happened during the object correction.
Definition: CorrectionCode.h:36
POOL::TEvent::readFrom
StatusCode readFrom(TFile *file)
Definition: PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:133
JetCalibrationTool.h
ReadStats.h
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
FullCPAlgorithmsTest_eljob.sample
sample
Definition: FullCPAlgorithmsTest_eljob.py:113
POOL::TEvent::getEntry
int getEntry(long entry)
Definition: PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:185
lumiFormat.i
int i
Definition: lumiFormat.py:85
LArCellNtuple.argv
argv
Definition: LArCellNtuple.py:152
CP::FFJetSmearingTool::getMatchedTruthJet
StatusCode getMatchedTruthJet(xAOD::Jet &jet_reco, xAOD::Jet &jet_truth_matched) const
Definition: FFJetSmearingTool.cxx:491
Message.h
JetCalibrationTool
Definition: JetCalibrationTool.h:34
JetTruthLabelingTool.h
CP::SystematicSet::end
const_iterator end() const
description: const iterator to the end of the set
Definition: SystematicSet.h:59
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:20
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
xAOD::Jet_v1::rapidity
virtual double rapidity() const
The true rapidity (y) of the particle.
Definition: Jet_v1.cxx:67
merge.output
output
Definition: merge.py:17
CHECK
#define CHECK(ARG)
Definition: FFJetSmearingTool_MyExample.cxx:46
SG::AuxElement::makePrivateStore
void makePrivateStore()
Create a new (empty) private store for this object.
Definition: AuxElement.cxx:192
item
Definition: ItemListSvc.h:43
CP::FFJetSmearingTool::applySystematicVariation
virtual StatusCode applySystematicVariation(const CP::SystematicSet &systematics) override
Configure tool to apply systematic variation.
Definition: FFJetSmearingTool.cxx:257
main
int main(int argc, char *argv[])
Definition: FFJetSmearingTool_MyExample.cxx:71
xAOD::shallowCopyContainer
std::pair< std::unique_ptr< T >, std::unique_ptr< ShallowAuxContainer > > shallowCopyContainer(const T &cont, [[maybe_unused]] const EventContext &ctx)
Function making a shallow copy of a constant container.
Definition: ShallowCopy.h:110
EventInfo.h
JetCalibrationTool::applyCalibration
StatusCode applyCalibration(xAOD::JetContainer &) const override
Apply calibration to a jet container.
Definition: JetCalibrationTool.cxx:335
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
CP::FFJetSmearingTool::recommendedSystematics
virtual CP::SystematicSet recommendedSystematics() const override
List of all systematics recommended for this tool.
Definition: FFJetSmearingTool.cxx:206
python.PyAthena.v
v
Definition: PyAthena.py:154
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
python.DataFormatRates.c2
c2
Definition: DataFormatRates.py:123
xAOD::Jet_v1::m
virtual double m() const
The invariant mass of the particle.
Definition: Jet_v1.cxx:59
h
JetContainer.h
POOL::TEvent::retrieve
StatusCode retrieve(const T *&obj)
Definition: PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:74
CP::SystematicSet::begin
const_iterator begin() const
description: const iterator to the beginning of the set
Definition: SystematicSet.h:55
CP::FFJetSmearingTool
Definition: FFJetSmearingTool.h:102
CxxUtils::atoi
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
Definition: Control/CxxUtils/Root/StringUtils.cxx:85
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
LArG4GenerateShowerLib.nevents
nevents
Definition: LArG4GenerateShowerLib.py:19
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
LArCellNtuple.ifile
string ifile
Definition: LArCellNtuple.py:133
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
ToolHandle.h
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
AsgTool.h
xAOD::Jet_v1::pt
virtual double pt() const
The transverse momentum ( ) of the particle.
Definition: Jet_v1.cxx:44
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
xAOD::TEvent
Tool for accessing xAOD files outside of Athena.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:84
fitman.k
k
Definition: fitman.py:528
usage
void usage()
Definition: FFJetSmearingTool_MyExample.cxx:56