ATLAS Offline Software
Macros | Functions
FFJetSmearingTool_MyExample.cxx File Reference
#include <memory>
#include "AsgTools/ToolHandle.h"
#include "AsgTools/AsgTool.h"
#include "TFile.h"
#include "TCanvas.h"
#include "xAODEventInfo/EventInfo.h"
#include "xAODJet/JetContainer.h"
#include "xAODEventShape/EventShape.h"
#include "xAODRootAccess/tools/Message.h"
#include "xAODRootAccess/tools/ReturnCheck.h"
#include "xAODCore/tools/IOStats.h"
#include "xAODCore/tools/ReadStats.h"
#include "xAODCore/ShallowCopy.h"
#include "JetCalibTools/JetCalibrationTool.h"
#include "TH1F.h"
#include "TTree.h"
#include "ParticleJetTools/JetTruthLabelingTool.h"
#include "JetUncertainties/FFJetSmearingTool.h"

Go to the source code of this file.

Macros

#define CHECK(ARG)
 

Functions

void usage ()
 
int main (int argc, char *argv[])
 

Macro Definition Documentation

◆ CHECK

#define CHECK (   ARG)
Value:
do { \
const bool result = ARG; \
if(!result) { \
printf("Failed to execute: %s \n", #ARG);\
return 1; \
} \
} while( false )

Definition at line 58 of file FFJetSmearingTool_MyExample.cxx.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 87 of file FFJetSmearingTool_MyExample.cxx.

87  {
88 
89  //Reading user instructions of the example ***********************************************************************************************
90 
91 
92  //---------------------------------------------
93  // Declaring input variables with default values
94  //---------------------------------------------
95  std::string sample = "";
96  std::string truth_jetColl = "";
97  std::string reco_jetColl = "";
98  std::string string_kindofmass = "";
99  std::string output = "";
100  std::string string_configfile_path = "";
101  std::string string_debugtool = "";
102  //---------------------------
103  // Decoding the user settings
104  //---------------------------
105 
106  for (int i=1; i< argc; i++){
107 
108  std::string opt(argv[i]); std::vector< std::string > v;
109 
110  std::istringstream iss(opt);
111 
112  std::string item;
113  char delim = '=';
114 
115  while (std::getline(iss, item, delim)){
116  v.push_back(item);
117  }
118 
119  if ( opt.find("--help") != std::string::npos ) {
120  usage(); return 0;
121  }
122 
123  if ( opt.find("--sample=") != std::string::npos ) sample = v[1];
124  if ( opt.find("--truth_jetColl=") != std::string::npos ) truth_jetColl = v[1];
125  if ( opt.find("--reco_jetColl=") != std::string::npos ) reco_jetColl = v[1];
126  if ( opt.find("--MassDef=") != std::string::npos ) string_kindofmass = v[1];
127  if ( opt.find("--ConfigFile=") != std::string::npos ) string_configfile_path = v[1];
128  if ( opt.find("--DebugTool=") != std::string::npos ) string_debugtool = v[1];
129  if ( opt.find("--output=") != std::string::npos ) output = v[1];
130  }//End: Loop over input options
131 
132 
133  if(sample==""){
134  printf("No input xAOD file specified, exiting\n");
135  return 1;
136  }
137  if(truth_jetColl==""){
138  printf("No truth jet collection specified, exiting\n");
139  return 1;
140  }
141  if(reco_jetColl==""){
142  printf("No truth jet collection specified, exiting\n");
143  return 1;
144  }
145  if(string_kindofmass==""){
146  printf("No kind of jet mass specified, exiting\n");
147  return 1;
148  }
149  if(string_configfile_path==""){
150  printf("No ConfigFile specified, exiting\n");
151  return 1;
152  }
153  if(string_debugtool==""){
154  printf("No debugtool specified, exiting\n");
155  return 1;
156  }
157  if(output==""){
158  printf("output not specified, exiting\n");
159  return 1;
160  }
161  printf("%s %s %s %s %s \n", sample.c_str(), truth_jetColl.c_str(), reco_jetColl.c_str(), output.c_str(), string_debugtool.c_str());
162 
163 
164  TString kindofmass = string_kindofmass;
165 
166  bool want_to_debug = false;
167 
168  if(string_debugtool == "true"){want_to_debug = true;}
169  if(string_debugtool == "false"){want_to_debug = false;}
170 
171 //*************************************************************************************************************************************
172 
173 
174  //--------------------
175  // Opening input file
176  //--------------------
177 
178  std::unique_ptr< TFile > ifile( TFile::Open( sample.c_str(), "READ" ) );
179 
180 
181  // Create a TEvent object
183 
184  CHECK( event.readFrom( ifile.get() ) );
185 
186 
187  //----------------------------------
188  // Initialization of FFJetSmearingTool
189  //----------------------------------
190 
191  const std::string name_FFJetSmearingTool = "FFJetSmearing_Example";
192  // Call the constructor
193 
194  CP::FFJetSmearingTool ffjetsmearingtool(name_FFJetSmearingTool.c_str());
195 
196 /*
197 asg::AsgToolConfig config (("FFJetSmearingTool/" + name_FFJetSmearingTool).c_str());
198 // configure `config` object
199 std::shared_ptr<void> cleanup;
200 ToolHandle<FFJetSmearingTool> ffjetsmearingtool;
201 
202 
203 //ASSERT_SUCCESS (config.makeTool (fjetsmearingtool, cleanup));
204 config.makeTool (ffjetsmearingtool, cleanup);
205 */
206 
207 
208 
209 
210 
211 
212  (ffjetsmearingtool.setProperty( "MassDef", kindofmass )).ignore();
213 
214  (ffjetsmearingtool.setProperty( "ConfigFile", string_configfile_path )).ignore();
215 
216  // Initialize the tool
217  if(!(ffjetsmearingtool.initialize().isSuccess())){
218  printf("Initialization of FFJetSmearingTool failed, exiting\n");
219  return 0;
220  }
221 
222 
223  //Set output level threshold (1=VERBOSE, 2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL, 7=ALWAYS)
224  ffjetsmearingtool.setProperty ("OutputLevel", MSG::ERROR);
225 
226  if(want_to_debug){
227  ffjetsmearingtool.setProperty ("OutputLevel", MSG::VERBOSE);
228  }
229 //***************************************************************** TESTINGGGG**********************
230  // Print the recommended systematics
231 
232  const CP::SystematicSet& recommendedSysts = ffjetsmearingtool.recommendedSystematics();//take the systematics of the FFJETSmearing Tool
233  printf("Recommended systematics: \n");
234  for(auto sysItr = recommendedSysts.begin();
235  sysItr != recommendedSysts.end(); ++sysItr){
236  printf("%s \n", sysItr->name().c_str());
237  }
238 
239 
240  std::vector<CP::SystematicSet> sysList;
241 
242 
243 
244  //---------------------------------------------------------
246 
247  JetTruthLabelingTool m_JetTruthLabelingTool("JetTruthLabelingTool");
248 
249  CHECK(m_JetTruthLabelingTool.setProperty("TruthLabelName", "R10TruthLabel_R21Consolidated"));
250  CHECK(m_JetTruthLabelingTool.setProperty("UseTRUTH3", false)); // Set this to false only if you have the FULL !TruthParticles container in your input file
251  CHECK(m_JetTruthLabelingTool.setProperty("TruthParticleContainerName", "TruthParticles")); // Set this if you have the FULL !TruthParticles container but have named it something else
252  CHECK(m_JetTruthLabelingTool.initialize());
253 
254 
255 
256 
257 
258  //--------------------
259  // Calibrate jets (ir is necessary to extract the Calo and TA from a Combined jet). The user have to calibrate the jets before using the SmearingTool
260  //--------------------
261  const std::string name_JetCalibTools = "JetCalibTool_LC";
262 
263  // Call the constructor
264  JetCalibrationTool jetCalibrationTool(name_JetCalibTools.c_str());
265 
266  jetCalibrationTool.setProperty("JetCollection", "AntiKt10LCTopoTrimmedPtFrac5SmallR20");
267 
268  if(kindofmass=="Comb"){ // To test like if the user has different jet mass definitions in his analysis
269  jetCalibrationTool.setProperty("ConfigFile", "JES_MC16recommendation_FatJet_Trimmed_JMS_comb_17Oct2018.config");
270  }
271  if(kindofmass=="Calo"){
272  jetCalibrationTool.setProperty("ConfigFile", "JES_MC16recommendation_FatJet_Trimmed_JMS_calo_12Oct2018.config");
273  }
274  if(kindofmass=="TA"){
275  jetCalibrationTool.setProperty("ConfigFile", "JES_MC16recommendation_FatJet_Trimmed_JMS_TA_12Oct2018.config");
276  }
277 
278 
279  jetCalibrationTool.setProperty("CalibSequence", "EtaJES_JMS");
280  jetCalibrationTool.setProperty("IsData", false);
281  jetCalibrationTool.setProperty("CalibArea", "00-04-82");
282  jetCalibrationTool.setProperty("DEVmode", false);
283 
284  if(!(jetCalibrationTool.initialize().isSuccess())){
285  printf("Initialization of JetCalibTools failed, exiting \n");
286  return 0;
287  }
288 //--------------------------------------------------------
289 
290 
291  for (auto sys : recommendedSysts) { sysList.push_back(CP::SystematicSet({sys})); }
292 
293  printf("\n=============SYSTEMATICS CHECK NOW \n");
294  for (auto sys : sysList) {
295  // Tell the calibration tool which variation to apply
296  if (ffjetsmearingtool.applySystematicVariation(sys) != StatusCode::SUCCESS) {
297  printf("Error, Cannot configure calibration tool for systematics \n");
298  }
299 
300  printf("\nWe are using the systematic %s \n", sys.name().c_str());
301 
302 
303 
304 
305 //**************************************************************************************
306 
307  static constexpr float MeVtoGeV = 1.e-3;
308 
309  //----------------------------------
310  // Define histograms
311  //----------------------------------
312 
313  TH1F* reco_jet_mass_hist=new TH1F("reco_jet_mass_hist","reco_jet_mass_hist", 100, 0, 200);
314  TH1F* matched_truth_jet_mass_hist=new TH1F("matched_truth_jet_mass_hist","matched_truth_jet_mass_hist", 100, 0, 200);
315  TH1F* smeared_reco_jet_mass_hist=new TH1F("smeared_reco_jet_mass_hist","smeared_reco_jet_mass_hist", 100, 0, 200);
316 
317  reco_jet_mass_hist->Sumw2();
318  matched_truth_jet_mass_hist->Sumw2();
319  smeared_reco_jet_mass_hist->Sumw2();
320 
321 
322 
323 
324 
325 
326  int upperlimit1 = 600;
327  int upperlimit2 = 1000;
328 
329  int numBinsMass = 120;
330  int numBinsPt = 100;
331 
332  //numBinsMass = 12;
333  //numBinsPt = 10;
334 
335 
336  std::unique_ptr<TH3F> hist_jet_mass_scale_change_3D;
337  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/*pt*/,numBinsMass,0,upperlimit1/*mass*/,numBinsMass,0,upperlimit1/*mass*/);
338 
339 
340  float lowerlimit3 = -0.5;
341  float upperlimit3 = 0.5;
342  int numBinsDiff = 100;
343 
344 
345  std::unique_ptr<TH3F> hist_jet_mass_resolution_change_3D;
346  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/*pt*/,numBinsMass,0,upperlimit1/*mass*/,numBinsDiff,lowerlimit3,upperlimit3/*mass*/);
347 
348 
349 
350  //------------------
351  // Loop over events
352  //------------------
353 
354  // Get the number of events
355  const Long64_t nevents = event.getEntries();
356 
357  // Decide how many events to run over
358  //if(nevents>10000){nevents = 10000; }
359 
360 
361 
362  for(Long64_t ievent = 0; ievent < nevents; ++ievent){
363 
364  // Load the event:
365  if( event.getEntry( ievent ) < 0 ) {
366  printf("Failed to load entry %lld \n", ievent);
367  return 1;
368  }
369 
370 
371  // Show status
372  if(ievent % 100==0) printf("Event %lld of %lld \n", ievent, nevents);
373 
374  //************************************************************//
375  // Print some event information for fun
376  if(want_to_debug){
377  const xAOD::EventInfo* ei = nullptr;
378  CHECK( event.retrieve(ei, "EventInfo") );
379 
380  printf("===>>> start processing event #%llu, run #%i, %lld events processed so far <<<=== \n", ei->eventNumber(), ei->runNumber(), ievent);
381 
382 
383  // Get the truth jets from the event
384  const xAOD::JetContainer* jets_truth = nullptr;
385  CHECK( event.retrieve(jets_truth, "AntiKt10TruthTrimmedPtFrac5SmallR20Jets") );
386 
387  printf("Number of truth jets: %lu \n", jets_truth->size());
388 
389  //Loop over the truth jets in the event
390  for(const xAOD::Jet* jet_truth : *jets_truth){
391  // Print basic info about this jet
392  printf("Truth Jet: pt = %f, mass = %f, eta = %f \n", jet_truth->pt()*MeVtoGeV, jet_truth->m()*MeVtoGeV, jet_truth->eta());
393  }
394 
395 
396 
397  // Get the reco jets from the event
398  const xAOD::JetContainer* jets_reco = nullptr;
399  CHECK( event.retrieve(jets_reco, reco_jetColl) );
400 
401  printf("Number of reco jets: %lu \n", jets_reco->size());
402 
403  //Loop over the reco jets in the event
404  for(const xAOD::Jet* jet_reco : *jets_reco){
405 
406  // Print basic info about this jet
407  printf("Reco Jet: pt = %f, mass = %f, eta = %f \n", jet_reco->pt()*MeVtoGeV, jet_reco->m()*MeVtoGeV, jet_reco->eta());
408  }
409  }
410  //************************************************************//
411 
412 
413 
414  xAOD::Jet jet_truth_matched;
415  jet_truth_matched.makePrivateStore();
416 
417  // Retrieve jet container
418  const xAOD::JetContainer* jets = nullptr;
419  CHECK( event.retrieve( jets, reco_jetColl ) );
420 
421  // Shallow copy
422  auto jets_shallowCopy = xAOD::shallowCopyContainer( *jets );
423 
424  //Give a TruthLabel to the jets. We will need it in the FFSmearingTool to apply the uncertainties of one jet topology or another
425  m_JetTruthLabelingTool.modify(*(jets_shallowCopy.first));
426 
427  if(want_to_debug) printf("Start the loop over the jets \n");
428 
429  bool lead_jet = true;//to fill the histogram
430 
431  // Iterate over the shallow copy
432  for( xAOD::Jet* jet_reco : *( jets_shallowCopy.first ) ) {
433 
434  //Calibrate the jet. This step is necessary to extract the CALO and TA mass inside the tool later (if we are talking about a combined mass jet)
435  jetCalibrationTool.applyCalibration( *jet_reco );
436 //------------------------------------------------------------------------------------------------------------------------------------------//
437 //Test how the Calo and TA mass are set in the Combined mass.
438 
439  xAOD::JetFourMom_t jet_reco_Comb_FourMom;
440  xAOD::JetFourMom_t jet_reco_CALO_FourMom;
441  xAOD::JetFourMom_t jet_reco_TA_FourMom;
442 
443  jet_reco->getAttribute<xAOD::JetFourMom_t>("JetJMSScaleMomentumCombQCD",jet_reco_Comb_FourMom);
444  jet_reco->getAttribute<xAOD::JetFourMom_t>("JetJMSScaleMomentumCalo",jet_reco_CALO_FourMom);
445  jet_reco->getAttribute<xAOD::JetFourMom_t>("JetJMSScaleMomentumTA",jet_reco_TA_FourMom);
446 
447  if(want_to_debug && kindofmass == "Comb"){
448  printf("Comb jet mass = %f \n", jet_reco_Comb_FourMom.mass());
449  printf("Calo jet mass = %f \n", jet_reco_CALO_FourMom.mass());
450  printf("TA jet mass = %f \n", jet_reco_TA_FourMom.mass());
451  }
452 
453  std::unique_ptr<xAOD::Jet> jet_reco_Comb = std::make_unique<xAOD::Jet>(); //You have to initialize the jet object this way.
454  //If not, oyu will encounter breaks when running
455  jet_reco_Comb->makePrivateStore(); //And after that we have to give it a private store to avoid a brak when using setJetP4
456  jet_reco_Comb->setJetP4(jet_reco_Comb_FourMom);
457  std::unique_ptr<xAOD::Jet> jet_reco_CALO = std::make_unique<xAOD::Jet>();
458  jet_reco_CALO->makePrivateStore();
459  jet_reco_CALO->setJetP4(jet_reco_CALO_FourMom);
460  std::unique_ptr<xAOD::Jet> jet_reco_TA = std::make_unique<xAOD::Jet>();
461  jet_reco_TA->makePrivateStore();
462  jet_reco_TA->setJetP4(jet_reco_TA_FourMom);
463 
464  if(want_to_debug && kindofmass == "Comb"){
465  printf("NEW Comb jet mass = %f \n", jet_reco_Comb->m());
466  printf("NEW CALO jet mass = %f \n", jet_reco_CALO->m());
467  printf("NEW TA jet mass = %f \n", jet_reco_TA->m());
468  }
469 
470 //------------------------------------------------------------------------------------------------------------------------------------------//
471 
472  if(want_to_debug && kindofmass=="Calo"){ printf("CALO jet mass = %f \n", jet_reco->m()); }
473  if(want_to_debug && kindofmass=="TA"){ printf("TA jet mass = %f \n", jet_reco_TA->m()); }
474 
475  if(kindofmass=="TA"){m_JetTruthLabelingTool.modifyJet(*(jet_reco_TA)); };//To tag the TA jet with the jet topology
476 
477 
478  if(!(ffjetsmearingtool.getMatchedTruthJet(*jet_reco, jet_truth_matched).isSuccess())){ continue;}
479 
480  if(lead_jet == true){reco_jet_mass_hist->Fill(jet_reco->m()*MeVtoGeV); matched_truth_jet_mass_hist->Fill(jet_truth_matched.m()*MeVtoGeV); }
481 
482  if(kindofmass=="TA"){
483 
484  Double_t aux_original_jet_mass = jet_reco->m()*MeVtoGeV;
485 
486  ffjetsmearingtool.applyCorrection(*jet_reco_TA);
487  if(lead_jet == true && aux_original_jet_mass > 0){
488  smeared_reco_jet_mass_hist->Fill(jet_reco_TA->m()*MeVtoGeV); lead_jet=false;
489 
490  hist_jet_mass_scale_change_3D->Fill(jet_reco->pt()*MeVtoGeV, aux_original_jet_mass, (jet_reco_TA->m()*MeVtoGeV)/*/(aux_original_jet_mass)*/);
491  }
492  }
493  else{
494  Double_t aux_original_jet_mass = jet_reco->m()*MeVtoGeV;
495 
496  ffjetsmearingtool.applyCorrection(*jet_reco);
497 
498  if(lead_jet == true && aux_original_jet_mass > 0){
499  smeared_reco_jet_mass_hist->Fill(jet_reco->m()*MeVtoGeV); lead_jet=false;
500 
501  hist_jet_mass_scale_change_3D->Fill(jet_reco->pt()*MeVtoGeV, aux_original_jet_mass, (jet_reco->m()*MeVtoGeV)/*/(aux_original_jet_mass)*/);
502 
503  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);
504 
505  }
506  }
507 
508  if(want_to_debug){
509  if(kindofmass=="Comb"){ printf("Comb jet mass after smearing = %f \n", jet_reco->m()); }
510  if(kindofmass=="Calo"){ printf("CALO jet mass after smearing = %f \n", jet_reco->m()); }
511  if(kindofmass=="TA"){ printf("TA jet mass after smearing = %f \n", jet_reco_TA->m()); }
512  }
513 
514  //-----------------------------------------------------//
515  //To test corrected copy function
516  xAOD::Jet* jet_reco_copy = nullptr;
517  if( ! ffjetsmearingtool.correctedCopy(*jet_reco, jet_reco_copy) ){//The copy is filled only if the jet passes the conditions to be used inside the Tool
518  if(want_to_debug){ printf("Failed to fill the corrected copy of the jet \n"); }
519  }
520  else{
521  if(want_to_debug){ printf("Corrected Copy Comb jet mass after smearing = %f \n", jet_reco_copy->m()); }
522  }
523  // Delete the corrected copy:
524  delete jet_reco_copy;
525  //-----------------------------------------------------//
526 
527 
528 
529  }
530  delete jets_shallowCopy.first;
531  delete jets_shallowCopy.second;
532 
533  }//END: Loop over events
534 
535  TString output_path = "output/" + sys.name() + "_" + output ;
536 
537  TFile *jetmass_histograms = new TFile(output_path,"recreate"/*"UPDATE"*/);
538 
539 
540  reco_jet_mass_hist->Write();
541  matched_truth_jet_mass_hist->Write();
542  smeared_reco_jet_mass_hist->Write();
543 
544 
545 
546 //------------------------------------------------------------------------------------------------------------//
547 // 3D plots for testing the JetMassScale and JetMassResolution smearing for each systematic
548 
549  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);
550 
551  for (int i=1; i<=hist_jet_mass_scale_change_3D->GetNbinsX(); i++)
552  {
553  for (int j=1; j<= hist_jet_mass_scale_change_3D->GetNbinsY(); j++)
554  {
555  TH1F* hold = new TH1F("","",numBinsMass,0,upperlimit1);
556  for (int k=1; k<= hist_jet_mass_scale_change_3D->GetNbinsZ(); k++)
557  {
558  hold->SetBinContent(k,hist_jet_mass_scale_change_3D->GetBinContent(i,j,k)); //A 2D projection of the TH3
559  }
560  hist_jet_mass_scale_change_2D->SetBinContent(i,j,hold->GetMean()/hist_jet_mass_scale_change_3D->GetYaxis()->GetBinCenter(j));
561  delete hold;
562  }
563  }
564 
565  //hist_jet_mass_scale_change_2D->Smooth(1,"");
566 
567  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);
568 
569  for (int i=1; i<=hist_jet_mass_resolution_change_3D->GetNbinsX(); i++)
570  {
571  for (int j=1; j<= hist_jet_mass_resolution_change_3D->GetNbinsY(); j++)
572  {
573  TH1F* hold = new TH1F("","",numBinsDiff,lowerlimit3,upperlimit3);
574  for (int k=1; k<= hist_jet_mass_resolution_change_3D->GetNbinsZ(); k++)
575  {
576  hold->SetBinContent(k,hist_jet_mass_resolution_change_3D->GetBinContent(i,j,k)); //A 2D projection of the TH3
577  }
578  hist_jet_mass_resolution_change_2D->SetBinContent(i,j,hold->GetMean()/hist_jet_mass_resolution_change_3D->GetYaxis()->GetBinCenter(j));
579  delete hold;
580  }
581  }
582 
583 
584 
585 
586 
587  TCanvas *c1 = new TCanvas("c1","c1",500,500);
588 
589 
590  hist_jet_mass_scale_change_2D->GetXaxis()->SetTitleOffset(1.5);
591  hist_jet_mass_scale_change_2D->GetXaxis()->SetNdivisions(5);
592  hist_jet_mass_scale_change_2D->GetYaxis()->SetTitleOffset(1.5);
593  hist_jet_mass_scale_change_2D->GetZaxis()->SetTitleOffset(1.5);
594  hist_jet_mass_scale_change_2D->GetYaxis()->SetTitle("Initial Reco Mass [GeV]");
595  hist_jet_mass_scale_change_2D->GetXaxis()->SetTitle("Reco p_{T} [GeV]");
596  hist_jet_mass_scale_change_2D->GetZaxis()->SetTitle("Average Mass smearing (Initial_reco_mass/smeared_reco_mass)");
597 
598  hist_jet_mass_scale_change_2D->GetZaxis()->SetRangeUser(0.95,1.05);
599 
600  //hist_jet_mass_scale_change_2D->GetXaxis()->SetRangeUser(pt_low_bound,pt_up_bound);
601  hist_jet_mass_scale_change_2D->Draw("colz");
602 
603  TString output_path_scale_debug = "output/debug_plots/scale_variations/" + sys.name() + "_scaleDebug.pdf" ;
604 
605  c1->Print(output_path_scale_debug);
606 
607  TCanvas *c2 = new TCanvas("c2","c2",500,500);
608 
609  hist_jet_mass_resolution_change_2D->GetXaxis()->SetTitleOffset(1.5);
610  hist_jet_mass_resolution_change_2D->GetXaxis()->SetNdivisions(5);
611  hist_jet_mass_resolution_change_2D->GetYaxis()->SetTitleOffset(1.5);
612  hist_jet_mass_resolution_change_2D->GetZaxis()->SetTitleOffset(1.5);
613  hist_jet_mass_resolution_change_2D->GetYaxis()->SetTitle("Initial Reco Mass [GeV]");
614  hist_jet_mass_resolution_change_2D->GetXaxis()->SetTitle("Reco p_{T} [GeV]");
615  hist_jet_mass_resolution_change_2D->GetZaxis()->SetTitle("Average Mass smearing (Initial_reco_mass/smeared_reco_mass)");
616 
617  hist_jet_mass_resolution_change_2D->GetZaxis()->SetRangeUser(-0.1,0.1);
618 
619  hist_jet_mass_resolution_change_2D->Draw("colz");
620 
621  TString output_path_resolution_debug = "output/debug_plots/resolution_variations/" + sys.name() + "_resolutionDebug.pdf" ;
622 
623  c2->Print(output_path_resolution_debug);
624 
625  delete hist_jet_mass_scale_change_2D;
626 
627  delete hist_jet_mass_resolution_change_2D;
628 
629  delete c1;
630  delete c2;
631 //------------------------------------------------------------------------------------------------------------//
632 
633 
634 
635 
636 
637 
638  jetmass_histograms->Close();
639 
640  delete jetmass_histograms;
641 
642 
643  delete reco_jet_mass_hist;
644  delete matched_truth_jet_mass_hist;
645  delete smeared_reco_jet_mass_hist;
646 
647 
648  }//Close the systematics loop
649 
650  return 0;
651 }

◆ usage()

void usage ( )

Definition at line 69 of file FFJetSmearingTool_MyExample.cxx.

69  {
70  printf("Running options:\n");
71  printf("YOU HAVE TO ADAPT THE OPTIONS TO FFJETSMEARINGCORRECTION\n");
72  printf(" --help : To get the help you're reading\n");
73  printf(" --jetColl= : Specify the jet collection (TrimmedLargeR)\n");
74  printf(" --MassDef= : Specify the kind of jet mass used (Calo, TA, Comb)\n");
75  printf(" --sample= : Specify input xAOD\n");
76  printf(" Example: FFJetSmearingTool_MyExample --truth_jetColl=AntiKt10TruthTrimmedPtFrac5SmallR20Jets --reco_jetColl=AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets --MassDef=Comb --sample=DAOD_JETM6.16317590._000003.pool.root.1 --output=file_name.root --ConfigFile=rel21/Spring2020/FFJetSmearingTool_TestOnly_JMR.config --DebugTool=true \n");
77 }
TestSUSYToolsAlg.ifile
ifile
Definition: TestSUSYToolsAlg.py:92
get_generator_info.result
result
Definition: get_generator_info.py:21
xAOD::EventInfo_v1::eventNumber
uint64_t eventNumber() const
The current event's event number.
TH2F
Definition: rootspy.cxx:420
extractSporadic.c1
c1
Definition: extractSporadic.py:134
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
CP::MeVtoGeV
constexpr float MeVtoGeV
Definition: IsolationCloseByCorrectionTool.cxx:33
LArCellConditions.argv
argv
Definition: LArCellConditions.py:112
xAOD::TEvent::kClassAccess
@ kClassAccess
Access auxiliary data using the aux containers.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:97
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
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
xAOD::EventInfo_v1::runNumber
uint32_t runNumber() const
The current event's run number.
xAOD::Jet_v1::setJetP4
void setJetP4(const JetFourMom_t &p4)
Definition: Jet_v1.cxx:171
PyPoolBrowser.item
item
Definition: PyPoolBrowser.py:129
DiTauMassTools::ignore
void ignore(T &&)
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:54
POOL::TEvent::readFrom
StatusCode readFrom(TFile *file)
Definition: PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:132
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
FullCPAlgorithmsTest_eljob.sample
sample
Definition: FullCPAlgorithmsTest_eljob.py:100
JetTruthLabelingTool
Definition: JetTruthLabelingTool.h:26
POOL::TEvent::getEntry
int getEntry(long entry)
Definition: PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:184
lumiFormat.i
int i
Definition: lumiFormat.py:92
JetCalibrationTool
Definition: JetCalibrationTool.h:34
CP::SystematicSet::end
const_iterator end() const
description: const iterator to the end of the set
Definition: SystematicSet.h:59
TH1F::SetBinContent
void SetBinContent(int, double)
Definition: rootspy.cxx:327
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:20
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
TH2F::SetBinContent
void SetBinContent(int, double)
Definition: rootspy.cxx:426
merge.output
output
Definition: merge.py:17
xAOD::JetFourMom_t
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Definition: JetTypes.h:17
TH3F::GetBinContent
double GetBinContent(int) const
Definition: rootspy.cxx:500
pmontree.opt
opt
Definition: pmontree.py:16
compileRPVLLRates.c2
c2
Definition: compileRPVLLRates.py:361
CHECK
#define CHECK(ARG)
Definition: FFJetSmearingTool_MyExample.cxx:57
SG::AuxElement::makePrivateStore
void makePrivateStore()
Create a new (empty) private store for this object.
Definition: AuxElement.cxx:172
item
Definition: ItemListSvc.h:43
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
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
python.PyAthena.v
v
Definition: PyAthena.py:157
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
xAOD::Jet_v1::m
virtual double m() const
The invariant mass of the particle.
Definition: Jet_v1.cxx:59
TH1F
Definition: rootspy.cxx:320
POOL::TEvent::retrieve
StatusCode retrieve(const T *&obj)
Definition: PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:73
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:96
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
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
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:81
fitman.k
k
Definition: fitman.py:528
usage
void usage()
Definition: FFJetSmearingTool_MyExample.cxx:69