ATLAS Offline Software
FFJetSmearingTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /* ***********************************************************************************\
6  * *
7  * Name: FFJetSmearingTool *
8  * Purpose: Perform a jet mass smearing using Forward Folding *
9  * This tool allow the user to stimate the JMS & JMR systematics uncertainities *
10  * *
11 \*************************************************************************************/
12 
17 
18 
19 // Local includes
21 
22 // Other includes
24 
25 namespace CP {
26 
27 // Constructor
29  : asg::AsgTool(name)
30  , m_isInit(false)
31  , m_release("")
32  , m_truth_jetColl("")
33  , m_EtaRange(0)
34  , m_calibArea("CalibArea-08")
35  , m_histFileName("")
36  {
37  declareProperty( "MassDef", m_MassDef_string = "" );
38  declareProperty( "ConfigFile", m_configFile = "" );//Path to the config file. By default it points to XXX
39  declareProperty("Path",m_path);
40 }
41 
42 // Destructor
44 = default;
45 
46 
47 
48 // Initialize
50 {
51 
52  // Ensure it hasn't been initialized already
53  if (m_isInit)
54  {
55  ATH_MSG_FATAL(Form("Blocking re-initialization of tool named %s",AsgTool::name().c_str())); //AsgTool::name() calls the name
56  return StatusCode::FAILURE;
57  }
58 
59  ATH_MSG_INFO(Form("Preparing to initialize the FFJetSmearingTool named %s",AsgTool::name().c_str()));
60 
61  if (AsgTool::name().empty())
62  {
63  ATH_MSG_FATAL("No name specified. Aborting.");
64  return StatusCode::FAILURE;
65  }
66  if (m_MassDef_string.empty())
67  {
68  ATH_MSG_FATAL("No kind of jet mass specified. Aborting.");
69  return StatusCode::FAILURE;
70  }
71 
72  // Make sure we have a valid mass definition
73  ATH_CHECK(JetTools::stringToEnum(m_MassDef_string, m_MassDef)); //If it fails it means that there is No Systematic Uncertainties derived for to the given mass definition.
74  //The mass definition should be 'Calo', 'TA' or 'Comb'. Show an error and exits.
75 
76  //reading the config file as in JetUncertaintiesTool
77  TEnv settings;
78 
79  const TString configFilePath = jet::utils::findFilePath(m_configFile.c_str(),m_path.c_str(),m_calibArea.c_str());
80 
81  if (settings.ReadFile( configFilePath.Data(),kEnvGlobal))
82  {
83  ATH_MSG_ERROR("Cannot read config file: " << configFilePath.Data());
84  return StatusCode::FAILURE;
85  }
86  // We can read it - start printing
87  ATH_MSG_INFO("================================================");
88  ATH_MSG_INFO(Form(" Initializing the FFJetSmearingTool named %s",AsgTool::name().c_str()));
89  ATH_MSG_INFO(" Configuration file: " << m_configFile);
90  ATH_MSG_INFO(" Location: " << configFilePath.Data());
91 
92 
93  m_release = settings.GetValue("UncertaintyRelease","UNKNOWN");
94  ATH_MSG_INFO(" Uncertainty release: " << m_release.c_str());
95 
96  // Check the jet definition
97  m_truth_jetColl = settings.GetValue("TruthJetColl","");
98  if (m_truth_jetColl.empty())
99  {
100  ATH_MSG_ERROR("Cannot find the truth jet collection to use in config");
101  return StatusCode::FAILURE;
102  }
103  ATH_MSG_INFO(" Truth Jet Collection: " << m_truth_jetColl);
104  // Check the name of the truth label accessor for BoostjetTaggers
105  m_truthlabelaccessor = settings.GetValue("TruthLabelAccessor","");
106  if (m_truthlabelaccessor.empty())
107  {
108  ATH_MSG_ERROR("Cannot find the TruthLabelAccessor to use in config");
109  return StatusCode::FAILURE;
110  }
111  ATH_MSG_INFO(" Truth Label Accessor: " << m_truthlabelaccessor);
112  //eta range of the tool
113  m_EtaRange = settings.GetValue("EtaRange",0);
114  if (m_EtaRange == 0)
115  {
116  ATH_MSG_ERROR("Cannot find the EtaRange parameter in the config file");
117  return StatusCode::FAILURE;
118  }
119  ATH_MSG_INFO(" EtaRange : Abs(eta) < " << m_EtaRange);
120  //mass range of the tool
121  m_MaxMass = settings.GetValue("MaxMass",0);
122  if (m_MaxMass == 0)
123  {
124  ATH_MSG_ERROR("Cannot find the MaxMass parameter in the config file");
125  return StatusCode::FAILURE;
126  }
127  ATH_MSG_INFO(" MaxMass : jet_mass < " << m_MaxMass);
128  //pt range of the tool
129  m_MaxPt = settings.GetValue("MaxPt",0);
130  if (m_MaxPt == 0)
131  {
132  ATH_MSG_ERROR("Cannot find the MaxPt parameter in the config file");
133  return StatusCode::FAILURE;
134  }
135  ATH_MSG_INFO(" MaxPt : jet_pt < " << m_MaxPt);
136  // Get the file to read uncertainties in from
137  m_histFileName = settings.GetValue("UncertaintyRootFile","");
139  if (m_histFileName.empty())
140  {
141  ATH_MSG_ERROR("Cannot find uncertainty histogram file in the config file");
142  return StatusCode::FAILURE;
143  }
144  ATH_MSG_INFO(" UncertaintyFile: " << m_histFileName);
145  ATH_MSG_INFO(" Location: " << m_HistogramsFilePath);
146 
147 
148 
149  //Read all the histogram files where the jms jmr variations are saved
150  ATH_CHECK(readFFJetSmearingToolSimplifiedData(settings));//If fail, it shows an Error message and exits
151 
152  // Add the affecting systematics to the global registry
154  if(registry.registerSystematics(*this) != StatusCode::SUCCESS){
155  ATH_MSG_ERROR("Unable to register systematics!");
156  return StatusCode::FAILURE;
157  }
158 
159  m_isInit = true;
160 
161  // ANA_CHECK (applySystematicVariation (CP::SystematicSet()));
162 
163  return StatusCode::SUCCESS;
164 }
165 
166 
167 
168 //-----------------------------------------------------------------------------
169 // Declare affecting systematics
170 //-----------------------------------------------------------------------------
172 (const CP::SystematicVariation& systematic) const
173 {
174  // Using 'find' is sufficient until this tool supports continuous
175  // // variations, at which point I'll need to use the 'match' method.
177  return sys.find(systematic) != sys.end();
178 }
179 //-----------------------------------------------------------------------------
180 
182 {
184  result.insert(m_SysList);
185 
186  return result;
187 }
188 //-----------------------------------------------------------------------------
190 {
191 
192  CP::SystematicSet filteredSysts;
193  if(m_MassDef==JetTools::FFJetAllowedMassDefEnum::Calo){//take only Calo-like syst
194  for (auto ci = m_SysList.begin(); ci != m_SysList.end(); ci++) {
195  if ((*ci).basename().find("CALO_")!=std::string::npos)
196  filteredSysts.insert(*ci);
197  }
198  return filteredSysts;
199  }
200  if(m_MassDef==JetTools::FFJetAllowedMassDefEnum::TA){//take only TA-like syst
201  for (auto ci = m_SysList.begin(); ci != m_SysList.end(); ci++) {
202  if ((*ci).basename().find("TA_") !=std::string::npos)
203  filteredSysts.insert(*ci);
204  }
205  return filteredSysts;
206  }
207  if(m_MassDef==JetTools::FFJetAllowedMassDefEnum::Comb){//take only TA-like syst
208  for (auto ci = m_SysList.begin(); ci != m_SysList.end(); ci++) {
209  if ((*ci).basename().find("COMB_")!=std::string::npos){
210  filteredSysts.insert(*ci);
211  }
212  }
213  return filteredSysts;
214  }
215 
216  return m_SysList;
217 }
218 
219 //-----------------------------------------------------------------------------
220 // Apply systematic configuration
221 //-----------------------------------------------------------------------------
222 
225 {
226  // First check if we already know this systematic configuration.
227  // Look for it in our sysData map.
228  auto iter = m_sysData.find (systematics);
229 
230  // If this is a new input set, we need to filter it.
231  if(iter == m_sysData.end()){
232  // Filter the input systematics with my affecting systematics.
233  const CP::SystematicSet affectingSysts = affectingSystematics();
234  CP::SystematicSet filteredSysts;
235  if( CP::SystematicSet::
236  filterForAffectingSystematics(systematics, affectingSysts, filteredSysts) !=
237  StatusCode::SUCCESS )
238  {
239  ATH_MSG_ERROR("Received unsupported systematics: " << systematics.name());
240  return StatusCode::FAILURE;
241  }
242 
243  // At this point, we can do some additional checks for consistency
244  // with the JMS/JMR functionality. For example, if the tool can only handle
245  // one type of systematic at a time, we return an error if the filtered
246  // set has more than one item:
247  if(filteredSysts.size() > 1){
248  ATH_MSG_ERROR("No support for more than one JMS/JMR sys at a time: " <<
249  filteredSysts.name());
250  return StatusCode::FAILURE;
251  }
252 
253  // Insert the new systematic data onto our map
254  SysData myData;
255 
256  const CP::SystematicVariation& sys = *filteredSysts.begin();
257 
258  myData.SysParameter = sys.parameter(); //Up (+1) and Down (-1) systematic variation
259  myData.SysBaseName = sys.basename(); //Name of the systematic variation
260 
261  iter = m_sysData.emplace (systematics, myData).first;
262  }
263 
264  // Apply the filtered systematics
265  m_currentSysData = &iter->second;
266 
267  return StatusCode::SUCCESS;
268 }
269 
270 
271 
272 //-----------------------------------------------------------------------------
273 // Read the external file that conatins the JSS recomendations for FatJets
274 //-----------------------------------------------------------------------------
275 
277 
278  std::unique_ptr<TFile> data_file ( TFile::Open(m_HistogramsFilePath.c_str()));
279  if(!data_file || data_file->IsZombie()){
280  ATH_MSG_FATAL( "Could not open the first input file: " << m_HistogramsFilePath );
281  return StatusCode::FAILURE;
282  }
283 
284 
285 
287  TString CaloResponseMap_path = settings.GetValue("CaloResponseMap","");
288 
289  if(CaloResponseMap_path.IsNull())
290  {
291  ATH_MSG_ERROR("Cannot find the CaloResponseMap in the config file");
292  return StatusCode::FAILURE;
293  }
294 
295  m_CALO_ResponseMap = std::unique_ptr<TH2>(dynamic_cast<TH2*>(data_file->Get( CaloResponseMap_path )));
296  m_CALO_ResponseMap->SetDirectory(nullptr);
297  }
298 
300  TString TAResponseMap_path = settings.GetValue("TAResponseMap","");
301 
302  if(TAResponseMap_path.IsNull())
303  {
304  ATH_MSG_ERROR("Cannot find the TAResponseMap in the config file");
305  return StatusCode::FAILURE;
306  }
307 
308  m_TA_ResponseMap = std::unique_ptr<TH2>(dynamic_cast<TH2*>(data_file->Get( TAResponseMap_path )));
309  m_TA_ResponseMap->SetDirectory(nullptr);//To keep it open when we close the .root file
310  }
311 
312 
313 
314  //JMS systematics
315  for (size_t iComp = 0; iComp < 999; ++iComp)
316  {
317  const TString prefix = Form("JMSComponent.%zu.",iComp);
318 
319  std::string Syst_Name = settings.GetValue(prefix+"Name","");
320 
321  if( !Syst_Name.empty()){
322  m_SysList.insert( CP::SystematicVariation(Syst_Name, 1) );
323  m_SysList.insert( CP::SystematicVariation(Syst_Name, -1) );
324  m_Syst_MassDefAffected_map[Syst_Name] = settings.GetValue(prefix+"MassDef","");
325  m_Syst_TopologyAffected_map[Syst_Name] = settings.GetValue(prefix+"Topology","");
326  m_Syst_Affects_JMSorJMR[Syst_Name] = "JMS";
327  m_Syst_HistPath_map[Syst_Name] = settings.GetValue(prefix+"Hist","");
328  m_Syst_Hist_map[Syst_Name] = std::unique_ptr<TH2>(dynamic_cast<TH2*>(data_file->Get(m_Syst_HistPath_map[Syst_Name].c_str())));
329  m_Syst_Hist_map[Syst_Name]->SetDirectory(nullptr);
330  if(m_MassDef==JetTools::FFJetAllowedMassDefEnum::Comb){//for comb mass we need to read two histograms
331  m_Syst_HistTAPath_map[Syst_Name] = settings.GetValue(prefix+"HistTA","");
332  if(!m_Syst_HistTAPath_map[Syst_Name].empty()){
333  m_Syst_HistTA_map[Syst_Name] = std::unique_ptr<TH2>(dynamic_cast<TH2*>(data_file->Get(m_Syst_HistTAPath_map[Syst_Name].c_str())));
334  m_Syst_HistTA_map[Syst_Name]->SetDirectory(nullptr);
335  }
336  }
337  }
338  }
339  //JMR Systematics
340  for (size_t iComp = 0; iComp < 999; ++iComp)
341  {
342  const TString prefix = Form("JMRComponent.%zu.",iComp);
343 
344  std::string Syst_Name = settings.GetValue(prefix+"Name","");
345 
346  if( !Syst_Name.empty()){
347  m_SysList.insert( CP::SystematicVariation(Syst_Name, 1) );
348  m_SysList.insert( CP::SystematicVariation(Syst_Name, -1) );
349  m_Syst_MassDefAffected_map[Syst_Name] = settings.GetValue(prefix+"MassDef","");
350  m_Syst_TopologyAffected_map[Syst_Name] = settings.GetValue(prefix+"Topology","");
351  m_Syst_Affects_JMSorJMR[Syst_Name] = "JMR";
352  m_Syst_HistPath_map[Syst_Name] = settings.GetValue(prefix+"Hist","");
353  m_Syst_Hist_map[Syst_Name] = std::unique_ptr<TH2>(dynamic_cast<TH2*>(data_file->Get(m_Syst_HistPath_map[Syst_Name].c_str())));
354  m_Syst_Hist_map[Syst_Name]->SetDirectory(nullptr);
355  if(m_MassDef==JetTools::FFJetAllowedMassDefEnum::Comb){//for comb mass we need to read two histograms
356  m_Syst_HistTAPath_map[Syst_Name] = settings.GetValue(prefix+"HistTA","");
357  if(!m_Syst_HistTAPath_map[Syst_Name].empty()){
358  m_Syst_HistTA_map[Syst_Name] = std::unique_ptr<TH2>(dynamic_cast<TH2*>(data_file->Get(m_Syst_HistTAPath_map[Syst_Name].c_str())));
359  m_Syst_HistTA_map[Syst_Name]->SetDirectory(nullptr);
360  }
361  }
362  }
363  }
364 
365  data_file->Close();
366 
367 
368  //Read the Calo and TA mass weight histograms from the same file that JetUncertainties uses
369 
370 
371  TString Calo_TA_weight_file_name = settings.GetValue("JetUncertainties_UncertaintyRootFile","");
372  const TString Calo_TA_weight_file_path = jet::utils::findFilePath(Calo_TA_weight_file_name.Data(),m_path.c_str(),m_calibArea.c_str());
373 
374  if (Calo_TA_weight_file_path.IsNull())
375  {
376  ATH_MSG_ERROR("Cannot find the file with the Calo and TA weights");
377  return StatusCode::FAILURE;
378  }
379 
380  TString Calo_weight_hist_name = settings.GetValue("CombMassWeightCaloHist","");
381  if (Calo_weight_hist_name.IsNull())
382  {
383  ATH_MSG_ERROR("Cannot find the histogram name that contains the Calo weights in the config file");
384  return StatusCode::FAILURE;
385  }
386 
387  TString TA_weight_hist_name = settings.GetValue("CombMassWeightTAHist","");
388  if (TA_weight_hist_name.IsNull())
389  {
390  ATH_MSG_ERROR("Cannot find the histogram name that contains the TA weights in the config file");
391  return StatusCode::FAILURE;
392  }
393 
394  ATH_MSG_INFO(Form(" Calo weights hist: \"%s\"",Calo_weight_hist_name.Data()));
395  ATH_MSG_INFO(Form(" TA weights hist: \"%s\"",TA_weight_hist_name.Data()));
396  ATH_MSG_INFO(Form(" Location: %s",Calo_TA_weight_file_path.Data()));
397 
398 
399  std::unique_ptr<TFile> Calo_TA_weight_file ( TFile::Open(Calo_TA_weight_file_path));
400  if(!Calo_TA_weight_file || Calo_TA_weight_file->IsZombie()){
401  ATH_MSG_FATAL( "Could not open the first input file: " << Calo_TA_weight_file_path );
402  return StatusCode::FAILURE;
403  }
404 
405  m_caloMassWeight = std::unique_ptr<TH3F>(dynamic_cast<TH3F*>(Calo_TA_weight_file->Get(Calo_weight_hist_name)));
406  m_TAMassWeight = std::unique_ptr<TH3F>(dynamic_cast<TH3F*>(Calo_TA_weight_file->Get(TA_weight_hist_name)));
407 
408  m_caloMassWeight->SetDirectory(nullptr);
409  m_TAMassWeight->SetDirectory(nullptr);//To keep it open when we close the .root file
410 
411 
412  Calo_TA_weight_file->Close();
413 
414  return StatusCode::SUCCESS;
415 }
416 
417 
418 
419 
420 
421 //-----------------------------------------------------------------------------
422 // The function "getMatchedTruthJet" finds the truth jet that match with the given jet_reco and it save it in the given jet_truth_matched jet.
423 //-----------------------------------------------------------------------------
424 
426 {
427 
428  // Get the truth jets of the event
429  const xAOD::JetContainer* jets_truth = nullptr;
430 
431  ATH_CHECK(evtStore()->retrieve( jets_truth, m_truth_jetColl));//If fail, it means that we are "Unable to retrieve jetColl Info". It shows an Error message and exits
432 
433  double dRmax_truthJet = 0.75;// matching condition
434  double dRmin=9999; //we will take the closest jet reco-truth
435 
436  //Loop over the truth jets in the event to match
437  const xAOD::Jet* close_jet = nullptr;
438  for (const auto *const jet_truth : *jets_truth) {
439  float dR_Test = jet_reco.p4().DeltaR(jet_truth->p4());
440  if ( dR_Test < dRmax_truthJet){
441  if(dR_Test < dRmin){
442  close_jet = jet_truth;
443  dRmin = dR_Test;
444  }
445  }
446  }
447  if(dRmin > 999){ return StatusCode::FAILURE;}
448 
449  jet_truth_matched.setJetP4(close_jet->jetP4());
450  return StatusCode::SUCCESS;
451 }
452 
453 
454 //-----------------------------------------------------------------------------
455 // The function "getJetTopology" gets the topology of the given jet. "QCD" jets have a extra source of uncertainties called "MODELLINGUNCERTAINTIESQCDJETS".
456 //-----------------------------------------------------------------------------
457 
458 StatusCode FFJetSmearingTool::getJetTopology( xAOD::Jet& jet_reco, std::string& jetTopology) const
459 {
460 
462  if (!accTruthLabel.isAvailable(jet_reco) )
463  {
464  ATH_MSG_ERROR("Unable to retrieve the FatjetTruthLabel from the jet. Please call the BoostedJetTaggers decorateTruthLabel() function before calling this function.");
465  return StatusCode::FAILURE;
466  }
467 
468 
469 LargeRJetTruthLabel::TypeEnum jetTruthLabel = LargeRJetTruthLabel::intToEnum(accTruthLabel(jet_reco));
470 
471  if(jetTruthLabel == LargeRJetTruthLabel::tqqb || jetTruthLabel == LargeRJetTruthLabel::other_From_t)
472  {
473  jetTopology="Top";
474  }
475 
476  else if(jetTruthLabel == LargeRJetTruthLabel::Wqq || jetTruthLabel == LargeRJetTruthLabel::Zqq || jetTruthLabel == LargeRJetTruthLabel::Wqq_From_t || jetTruthLabel == LargeRJetTruthLabel::other_From_V)
477  {
478  jetTopology="V";
479  }
480 
481  else if(jetTruthLabel == LargeRJetTruthLabel::qcd)
482  {
483  jetTopology="QCD";
484  }
485 
486  else if(jetTruthLabel == LargeRJetTruthLabel::Hbb || jetTruthLabel == LargeRJetTruthLabel::other_From_H)
487  {
488  jetTopology="H";
489  }
490 
491  else if(jetTruthLabel == LargeRJetTruthLabel::notruth)
492  {
493  jetTopology="no_match";
494  ATH_MSG_DEBUG("No truth jet match with this reco jet. The jet will not be smeared.");
495  }
496 
497  else jetTopology="QCD"; //We should never arrive here
498 
499  ATH_MSG_VERBOSE("The topology of this jet correspond to a " << jetTopology << " large-R jet");
500 
501  return StatusCode::SUCCESS;
502 }
503 
504 
505 
506 
507 //-----------------------------------------------------------------------------
508 // The function "getJMSJMR" read the JMS and JMR uncertainties associated with the systematic
509 //-----------------------------------------------------------------------------
510 StatusCode FFJetSmearingTool::getJMSJMR( xAOD::Jet& jet_reco, double jet_mass_value, JetTools::FFJetAllowedMassDefEnum MassDef_of_syst, const std::string& jetTopology, double& JMS_err, double& JMR_err) const{
511 
512  //JMS/JMR systematic variations
513  JMS_err=0;
514  JMR_err=0;
515 
516  //Some variables to simplify the logic in the "if" structure found below
519  auto massAffectedSys = m_Syst_MassDefAffected_map.at(m_currentSysData->SysBaseName);
520 
522  ATH_MSG_VERBOSE("This uncertainty affects to the " << JetTools::enumToString(MassDef_of_syst) << " mass");
523  } //Only apply the systematic to the proper mass definition
524  else{return StatusCode::SUCCESS;}
525 
527  ATH_MSG_VERBOSE("The systematic do not affects to this jet topology");
528  return StatusCode::SUCCESS;
529  }
530 
531 
532  float jet_mass = jet_mass_value*m_MeVtoGeV;//jet_reco->m()*m_MeVtoGeV; The TA mass can not be extracted this way
533  float jet_pT = jet_reco.pt()*m_MeVtoGeV;
534 
536  JMR_err= 0;
537 
538  const TH2* hist = nullptr; //This variable will contain the pointer to the proper histogram to use in the interpolation
539 
540  if(m_Syst_MassDefAffected_map.at(m_currentSysData->SysBaseName)== JetTools::enumToString(calo) || massAffectedSys== JetTools::enumToString(ta) ){//TA and Calo mass defs take values from one hisogram only
541 
543  }
544  else if(m_Syst_MassDefAffected_map.at(m_currentSysData->SysBaseName)==JetTools::enumToString(JetTools::FFJetAllowedMassDefEnum::Comb) ){//Comb mass defs can take values from two histograms, depending ifits Calo- or TA- part is affected
545  if(MassDef_of_syst==calo)
547  else if(MassDef_of_syst==ta)
549  }
550  JMS_err = FFJetSmearingTool::Interpolate2D(hist, jet_pT, jet_mass) * m_currentSysData->SysParameter;
551  }
552 
553  else if(m_Syst_Affects_JMSorJMR.at(m_currentSysData->SysBaseName) == "JMR"){
554  JMS_err=0;
555 
556  const TH2* hist = nullptr;
557 
558  if(m_Syst_MassDefAffected_map.at(m_currentSysData->SysBaseName)== JetTools::enumToString(calo) || massAffectedSys== JetTools::enumToString(ta) ){//TA and Calo mass defs take values from one hisogram only
559 
561  }
562 
563  else if(m_Syst_MassDefAffected_map.at(m_currentSysData->SysBaseName)==JetTools::enumToString(JetTools::FFJetAllowedMassDefEnum::Comb) ){//Comb mass defs can take values from two histograms, depending ifits Calo- or TA- part is affected
564  if(MassDef_of_syst==calo)
566  else if(MassDef_of_syst==ta)
568  }
569  JMR_err = FFJetSmearingTool::Interpolate2D(hist, jet_pT, jet_mass) * m_currentSysData->SysParameter;
570  }
571 
572 
573  ATH_MSG_DEBUG("Systematic applied: " << m_currentSysData->SysBaseName);
574 
575  ATH_MSG_VERBOSE("JMS_err: " << JMS_err);
576  ATH_MSG_VERBOSE("JMR_err: " << JMR_err);
577 
578  return StatusCode::SUCCESS;
579 }
580 
581 
582 
583 //-----------------------------------------------------------------------------
584 // Once the tool is initialized. The user can call the function "SmearJetMass" to perform the jet smearing using FF (for the current systematic in his loop)
585 //-----------------------------------------------------------------------------
586 
588 
589  ATH_MSG_VERBOSE("//---------------------------------------------------------------//");
590  ATH_MSG_VERBOSE("Reco Jet to Smear: pt = " << jet_reco.pt() << ", mass = " << jet_reco.m() << ", eta = " << jet_reco.eta());
591 
592  if(std::abs(jet_reco.eta()) > m_EtaRange){//JetCalibTools do not properly for jets with |eta|>2
593  ATH_MSG_DEBUG("This jet exceeds the eta range that the tool allows (|eta|<" << m_EtaRange << ")");
595  }
596  if(jet_reco.m() > m_MaxMass){
597  ATH_MSG_DEBUG("This jet exceeds the mass range that the tool allows jet_mass <" << m_MaxMass << " MeV)");
599  }
600  if(jet_reco.pt() > m_MaxPt){
601  ATH_MSG_DEBUG("This jet exceeds the maximum pt that the tool allows jet_pt <" << m_MaxPt << " MeV)");
603  }
604 
605  //Find matched truth jet
606  xAOD::Jet jet_truth_matched;
607  jet_truth_matched.makePrivateStore();
608 
609  if(!(getMatchedTruthJet(jet_reco, jet_truth_matched).isSuccess())){
610  ATH_MSG_VERBOSE("No truth jet match with this reco jet. The jet will not be smeared.");
612  }
613 
614  ATH_MSG_VERBOSE("Matched truth Jet: pt = " << jet_truth_matched.pt() << ", mass = " << jet_truth_matched.m() << ", eta = " << jet_truth_matched.eta());
615 
616  //Get the jet topology
617  std::string jetTopology;
618 
619  if(!(getJetTopology( jet_reco, jetTopology)).isSuccess()){
620  ATH_MSG_ERROR("Imposible to obtain the jetTopology");
622  }
623  if(jetTopology == "no_match"){
625  }
626 
627 
628  //The TA mass is saved in an attribute so you can not access to it using ->m(). (if calibrated as Calo mass and not as Combined Mass), The Calo mass is not set as an attribute so you can not access it using ->getAttribute .
629 
630  double jet_mass_CALO = 0;
631  double jet_mass_TA = 0;
632  double calo_mass_weight=1; // m_comb = Weight*m_Calo + (1-Weight)*m_TA
633 
634  float JetTrackAssistedMassCalibrated_from_JetCalibTools;
635 
637 
638  xAOD::JetFourMom_t jet_reco_CALO;
639  xAOD::JetFourMom_t jet_reco_TA;
640  xAOD::JetFourMom_t jet_reco_Comb;
641 
642  jet_reco.getAttribute<xAOD::JetFourMom_t>("JetJMSScaleMomentumCalo",jet_reco_CALO);
643  jet_reco.getAttribute<xAOD::JetFourMom_t>("JetJMSScaleMomentumTA",jet_reco_TA);
644  jet_reco.getAttribute<xAOD::JetFourMom_t>("JetJMSScaleMomentumCombQCD",jet_reco_Comb);
645 
646  ATH_MSG_VERBOSE("CALO jet mass " << jet_reco_CALO.mass());
647  ATH_MSG_VERBOSE("TA jet mass " << jet_reco_TA.mass() );
648  ATH_MSG_VERBOSE("Comb jet mass " << jet_reco_Comb.mass() );
649 
650  jet_mass_CALO = jet_reco_CALO.mass();
651  jet_mass_TA = jet_reco_TA.mass();
652  jet_reco.getAttribute<float>("JetTrackAssistedMassCalibrated", JetTrackAssistedMassCalibrated_from_JetCalibTools);
653  }
655  jet_mass_CALO = jet_reco.m();
656  calo_mass_weight = 1;
657  }
659  jet_mass_TA = jet_reco.m();
660  jet_reco.getAttribute<float>("JetTrackAssistedMassCalibrated", JetTrackAssistedMassCalibrated_from_JetCalibTools);
661  calo_mass_weight = 0;
662  }
663 
664 
665 
666 
667  //Obtain the average mass response of the jet. The response will depend in the chosed topology (top,W or QCD) and also in the mass definition (CALO, TA, Combined). By default the map used correspond to QCD jets
668 
669  double avg_response_CALO=1;
670  double avg_response_TA=1;
671 
673 
674  avg_response_CALO = FFJetSmearingTool::Interpolate2D(m_CALO_ResponseMap.get(), jet_reco.pt()*m_MeVtoGeV, jet_truth_matched.m()*m_MeVtoGeV);
675  if(avg_response_CALO==0) avg_response_CALO=1;//If we look outside the Th2 histogram, we would obtain a 0 so we apply the nominal response (1)
676  }
677 
679 
680  avg_response_TA = FFJetSmearingTool::Interpolate2D(m_TA_ResponseMap.get(), jet_reco.pt()*m_MeVtoGeV, jet_truth_matched.m()*m_MeVtoGeV);
681  if(avg_response_TA==0) avg_response_TA = 1;
682  }
683 
684 
685  //Obtain the jet mass scale (JMS) and the jet mass resolution (JMR) nominal values and variation that correspond to the jet_reco
686 
687  double JMS (1), JMS_err(0), JMR(1), JMR_err(0);
688  double scale;
689  double resolution;
690 
691  double smeared_CALO_mass = jet_mass_CALO;
692  double smeared_TA_mass = jet_mass_TA;
693 
694  bool is_CALO_mass_smeared = false;
695  bool is_TA_mass_smeared = false;
696 
698 
699  if(!(getJMSJMR( jet_reco, jet_mass_CALO, JetTools::FFJetAllowedMassDefEnum::Calo,jetTopology, JMS_err, JMR_err)).isSuccess()){
700  return CP::CorrectionCode::Ok;
701  }
702 
703  scale = JMS + JMS_err;
704  resolution = JMR + JMR_err;
705 
706  if(TMath::Abs(scale-1) > 0.0001 || TMath::Abs(resolution-1) > 0.0001){
707  is_CALO_mass_smeared = true;
708 
709  ATH_MSG_VERBOSE("Forward Folding CALO procedure will use scale=" << scale << ", resolution=" << resolution << " and average respose=" << avg_response_CALO);
710 
711  //FF procedure
712  smeared_CALO_mass = jet_mass_CALO * scale + (jet_mass_CALO - avg_response_CALO*jet_truth_matched.m())*(resolution-scale);//FF formula
713  }
714 
715  }
716 
718  if(!(getJMSJMR( jet_reco, jet_mass_TA, JetTools::FFJetAllowedMassDefEnum::TA,jetTopology, JMS_err, JMR_err))){
719  return CP::CorrectionCode::Ok;
720  }
721 
722  scale = JMS + JMS_err;
723  resolution = JMR + JMR_err;
724 
725  if(TMath::Abs(scale-1) > 0.0001 || TMath::Abs(resolution-1) > 0.0001){
726 
727  is_TA_mass_smeared = true;
728 
729  ATH_MSG_VERBOSE("Forward Folding TA procedure will use scale=" << scale << ", resolution=" << resolution << " and average respose=" << avg_response_TA);
730 
731  //FF procedure
732  smeared_TA_mass = jet_mass_TA * scale + (jet_mass_TA - avg_response_TA*jet_truth_matched.m())*(resolution-scale);//FF formula
733  }
734 
735  }
736 
737  if(!is_CALO_mass_smeared && !is_TA_mass_smeared){//We only smear the jet if we have to. If not, avoid doing extra calculations
738 
739  ATH_MSG_VERBOSE("This jet is not affected by the systematic. The jet won't be modified");
740  ATH_MSG_VERBOSE("//---------------------------------------------------------------//");
741 
742  return CP::CorrectionCode::Ok;
743  }
744 
745 
746  //Recalculate the weights after the smearing
747  if(m_MassDef==JetTools::FFJetAllowedMassDefEnum::Comb && JetTrackAssistedMassCalibrated_from_JetCalibTools != 0 && jet_mass_CALO != 0){
748  //we check that JetTrackAssistedMassCalibrated_from_JetCalibTools != 0 instead of jet_mass_TA != 0 becuase
749  //there is a problem in the conversion between the mass itself and the four-vector representation (due to a
750  //limitation of floating). This makes the value of jet_mass_TA!=0 in situations where it should be 0.
751  //In order to work arround it we check JetTrackAssistedMassCalibrated_from_JetCalibTools != 0 insead.
752  double caloRes;
753  double TARes;
754 
755  xAOD::JetFourMom_t jet_reco_CALO;
756  xAOD::JetFourMom_t jet_reco_TA;
757 
758  jet_reco.getAttribute<xAOD::JetFourMom_t>("JetJMSScaleMomentumCalo",jet_reco_CALO);
759  jet_reco.getAttribute<xAOD::JetFourMom_t>("JetJMSScaleMomentumTA",jet_reco_TA);
760 
761 
762  xAOD::JetFourMom_t p4_aux;
763 
764  //The smearing do not change the pt but it changes the mass (so the energy too) so, itf we want to perform the smearing properly, we have to change
765  //the Calo and TA foru momenta before looking at the weights map
766  p4_aux = xAOD::JetFourMom_t(jet_reco_CALO.pt(),jet_reco_CALO.eta(),jet_reco_CALO.phi(),smeared_CALO_mass);//The smearing do not change the pt but it changes the Energy
767  jet_reco_CALO = p4_aux;
768 
769  p4_aux = xAOD::JetFourMom_t(jet_reco_TA.pt(),jet_reco_TA.eta(),jet_reco_TA.phi(),smeared_TA_mass);
770  jet_reco_TA = p4_aux;
771 
772  caloRes=FFJetSmearingTool::Read3DHistogram(m_caloMassWeight.get() ,jet_reco_CALO.e()*m_MeVtoGeV,TMath::Log(jet_reco_CALO.M()/jet_reco_CALO.e()),std::abs(jet_reco_CALO.eta()));
773 
774  TARes=FFJetSmearingTool::Read3DHistogram(m_TAMassWeight.get() ,jet_reco_TA.e()*m_MeVtoGeV,TMath::Log(jet_reco_TA.M()/jet_reco_TA.e()),std::abs(jet_reco_TA.eta()));
775 
776  //The histograms with the weights that we are reading were defined with the code "e_LOGmOe_eta" which means that each axis correspond to:
777  //-X: Jet Energy
778  //-Y: Log(Jet_Energy/Jet_mass)
779  //-Z:Eta
780  //Domain is [200-6000],[-6,0],[0,2] but, the ReadHistogram function put the value of the extream of the histogram to the values outside the domain.
781  //We have to use a custom "My_Interpolate" because the Z axis has just one bin (and this makes the Root Interpolate function fail)
782 
783  double caloFactor;
784  double TAFactor;
785 
786  if (caloRes == 0 ) { caloFactor = 0; TAFactor = 1;}
787  else if( TARes == 0) { caloFactor = 1; TAFactor = 0;}
788  else{
789  caloFactor = 1./(caloRes*caloRes);
790  TAFactor = 1./(TARes*TARes);
791  }
792 
793  calo_mass_weight = caloFactor /(caloFactor + TAFactor);
794 
795  ATH_MSG_VERBOSE(" Map Calo weight = " << calo_mass_weight );
796  ATH_MSG_VERBOSE(" Map TA weight = " << 1 - calo_mass_weight );
797  }
798  else if(JetTrackAssistedMassCalibrated_from_JetCalibTools == 0){calo_mass_weight = 1;}
799  else if(jet_mass_CALO == 0){calo_mass_weight = 0;}
800 
801  double smeared_mass = calo_mass_weight*smeared_CALO_mass + (1 - calo_mass_weight)*smeared_TA_mass;
802 
803  ATH_MSG_VERBOSE("Smeared CALO mass " << smeared_CALO_mass);
804  ATH_MSG_VERBOSE("Smeared TA mass " << smeared_TA_mass);
805 
806  xAOD::JetFourMom_t p4 = jet_reco.jetP4();
807 
808  p4 = xAOD::JetFourMom_t(jet_reco.pt(),jet_reco.eta(),jet_reco.phi(),smeared_mass);
809  jet_reco.setJetP4(p4);
810 
811 
812  ATH_MSG_VERBOSE("Smeared Reco Jet: pt = " << jet_reco.pt() << ", mass = " << jet_reco.m() << ", eta = " << jet_reco.eta());
813 
814  ATH_MSG_VERBOSE("//---------------------------------------------------------------//");
815 
816  return CP::CorrectionCode::Ok;
817 }
818 
819 //To apply the correction into a copied jet
821 {
822 
823  xAOD::Jet* copy = new xAOD::Jet(input);
824 
825  // Call the implemented function
827  {
828  delete copy;
830  }
831  output = copy;
832  return CP::CorrectionCode::Ok;
833 }
834 
835 //To apply the correction into all the jets inside a jet containter
837 {
839 
840  // Loop over the container
841  for (size_t iJet = 0; iJet < inputs.size(); ++iJet)
842  {
843  result = applyCorrection(*inputs.at(iJet));
845  break;
846  }
847  return result;
848 }
849 
850 
851 
852 
853 
854 //Functions from JetUncertainties. We copy them in order to read the map exactly as it is done in JetUncertainties and get EXACTLY the same result
855 
856 double FFJetSmearingTool::Read3DHistogram(const TH3* histo, double x, double y, double z) const
857 {
858 
859  double aux_x = x;
860  double aux_y = y;
861  double aux_z = z;
862 
863 
864  // Asymptotic values
865  //If the value is outside the histogram region, we take the closest value to that one
866 
867  double xMax = histo->GetXaxis()->GetBinLowEdge(histo->GetNbinsX()+1);
868  double xMin = histo->GetXaxis()->GetBinLowEdge(1);
869  double yMax = histo->GetYaxis()->GetBinLowEdge(histo->GetNbinsY()+1);
870  double yMin = histo->GetYaxis()->GetBinLowEdge(1);
871  double zMax = histo->GetZaxis()->GetBinLowEdge(histo->GetNbinsZ()+1);
872  double zMin = histo->GetZaxis()->GetBinLowEdge(1);
873 
874  if(x >= xMax) aux_x = xMax-1e-6 ; //so it fits the up-most x-bin
875  if(x <= xMin) aux_x = xMin+1e-6 ; //so it fits the low-most x-bin
876  if ( std::isnan(y)) return 0; // no weight if the input is NaN, can happen for log(X)
877  if(y >= yMax) aux_y = yMax-1e-6 ; //so it fits the up-most y-bin
878  if(y <= yMin) aux_y = yMin+1e-6 ; //so it fits the low-most y-bin
879  if(z >= zMax) aux_z = zMax-1e-6 ; //so it fits the up-most z-bin
880  if(z <= zMin) aux_z = zMin+1e-6 ; //so it fits the low-most z-bin
881 
882  //Use the interpolate function from JetHelpers.cxx
883  double weight = JetHelpers::Interpolate(histo, aux_x, aux_y, aux_z);
884 
885 
886  return weight;
887 }
888 
889 double FFJetSmearingTool::Interpolate2D(const TH2* histo, double x, double y) const //The function in JetHelpers can not be used because it needs a TH1 and we use TH2 histograms. We define our own function.
890 {
891  if (not histo){
892  ATH_MSG_ERROR("Histogram pointer is null in FFJetSmearingTool::Interpolate2D");
893  return 0.;
894  }
895  Int_t bin_x = histo->GetXaxis()->FindFixBin(x);
896  Int_t bin_y = histo->GetYaxis()->FindFixBin(y);
897  if(bin_x<1 || bin_x>histo->GetNbinsX() || bin_y<1 || bin_y>histo->GetNbinsY()) {
898  ATH_MSG_VERBOSE("The point is outside the histogram domain.");
899  return 0.;
900  }
901 
902  double interpolated_value = JetHelpers::Interpolate(histo, x, y);
903  return interpolated_value;
904 }
905 
906 
907 } // namespace CP
CP::FFJetSmearingTool::m_path
std::string m_path
Definition: FFJetSmearingTool.h:162
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
CP::FFJetSmearingTool::applyContainerCorrection
virtual CP::CorrectionCode applyContainerCorrection(xAOD::JetContainer &inputs) const override
Definition: FFJetSmearingTool.cxx:836
python.Dso.registry
registry
Definition: Control/AthenaServices/python/Dso.py:159
LargeRJetTruthLabel::TypeEnum
TypeEnum
Definition: LargeRJetLabelEnum.h:14
CP::FFJetSmearingTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: FFJetSmearingTool.cxx:49
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
JetTools::FFJetAllowedMassDefEnum
FFJetAllowedMassDefEnum
Definition: FFJetSmearingTool.h:60
CP::FFJetSmearingTool::affectingSystematics
virtual CP::SystematicSet affectingSystematics() const override
List of all systematics affecting this tool.
Definition: FFJetSmearingTool.cxx:181
CP::FFJetSmearingTool::SysData
Definition: FFJetSmearingTool.h:188
get_generator_info.result
result
Definition: get_generator_info.py:21
CP::FFJetSmearingTool::m_Syst_Hist_map
std::map< std::string, std::unique_ptr< TH2 > > m_Syst_Hist_map
Definition: FFJetSmearingTool.h:181
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CP::FFJetSmearingTool::m_SysList
CP::SystematicSet m_SysList
Definition: FFJetSmearingTool.h:175
CP::FFJetSmearingTool::SysData::SysBaseName
std::string SysBaseName
Definition: FFJetSmearingTool.h:189
CP::FFJetSmearingTool::m_Syst_HistTAPath_map
std::map< std::string, std::string > m_Syst_HistTAPath_map
Definition: FFJetSmearingTool.h:182
LargeRJetLabelEnum.h
CP::FFJetSmearingTool::m_sysData
std::unordered_map< CP::SystematicSet, SysData > m_sysData
Definition: FFJetSmearingTool.h:192
CP::SystematicSet::size
size_t size() const
returns: size of the set
Definition: SystematicSet.h:71
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
plotmaker.hist
hist
Definition: plotmaker.py:148
CP::FFJetSmearingTool::m_isInit
bool m_isInit
Definition: FFJetSmearingTool.h:150
CP::FFJetSmearingTool::m_CALO_ResponseMap
std::unique_ptr< TH2 > m_CALO_ResponseMap
Definition: FFJetSmearingTool.h:166
FFJetSmearingTool.h
asg
Definition: DataHandleTestTool.h:28
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
LargeRJetTruthLabel::other_From_t
@ other_From_t
Definition: LargeRJetLabelEnum.h:22
JetTools::enumToString
TString enumToString(const FFJetAllowedMassDefEnum type)
Definition: FFJetSmearingTool.h:81
CP::SystematicSet::name
std::string name() const
returns: the systematics joined into a single string.
Definition: SystematicSet.cxx:278
CP::FFJetSmearingTool::m_histFileName
std::string m_histFileName
Definition: FFJetSmearingTool.h:158
xAOD::Jet_v1::jetP4
JetFourMom_t jetP4() const
The full 4-momentum of the particle : internal jet type.
Definition: Jet_v1.cxx:76
xAOD::Jet_v1::phi
virtual double phi() const
The azimuthal angle ( ) of the particle.
Definition: Jet_v1.cxx:54
CP::FFJetSmearingTool::m_Syst_HistPath_map
std::map< std::string, std::string > m_Syst_HistPath_map
Definition: FFJetSmearingTool.h:180
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:587
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:54
CP::FFJetSmearingTool::m_currentSysData
SysData * m_currentSysData
Points to the current systematic configuration.
Definition: FFJetSmearingTool.h:194
LargeRJetTruthLabel::Zqq
@ Zqq
Definition: LargeRJetLabelEnum.h:20
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
CP::SystematicVariation
Definition: SystematicVariation.h:47
CP::FFJetSmearingTool::readFFJetSmearingToolSimplifiedData
StatusCode readFFJetSmearingToolSimplifiedData(TEnv &settings)
Definition: FFJetSmearingTool.cxx:276
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
LargeRJetTruthLabel::qcd
@ qcd
Definition: LargeRJetLabelEnum.h:25
x
#define x
Dedxcorrection::resolution
double resolution[nGasTypes][nParametersResolution]
Definition: TRT_ToT_Corrections.h:46
empty
bool empty(TH1 *h)
Definition: computils.cxx:294
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
LargeRJetTruthLabel::Hbb
@ Hbb
Definition: LargeRJetLabelEnum.h:26
CP::FFJetSmearingTool::m_truth_jetColl
std::string m_truth_jetColl
Definition: FFJetSmearingTool.h:152
xAOD::Jet_v1::getAttribute
bool getAttribute(AttributeID type, T &value) const
Retrieve attribute moment by enum.
postInclude.inputs
inputs
Definition: postInclude.SortInput.py:15
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
LargeRJetTruthLabel::notruth
@ notruth
Definition: LargeRJetLabelEnum.h:24
xAOD::Jet_v1::setJetP4
void setJetP4(const JetFourMom_t &p4)
Definition: Jet_v1.cxx:171
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:200
CP::FFJetSmearingTool::isAffectedBySystematic
virtual bool isAffectedBySystematic(const CP::SystematicVariation &systematic) const override
Specify whether tool is affected by provided systematic.
Definition: FFJetSmearingTool.cxx:172
JetHelpers::Interpolate
double Interpolate(const TH1 *histo, const double x)
Definition: JetHelpers.cxx:16
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
CP::CorrectionCode::OutOfValidityRange
@ OutOfValidityRange
Input object is out of validity range.
Definition: CorrectionCode.h:37
CP::CorrectionCode::Error
@ Error
Some error happened during the object correction.
Definition: CorrectionCode.h:36
CP::FFJetSmearingTool::m_MaxPt
float m_MaxPt
Definition: FFJetSmearingTool.h:156
LargeRJetTruthLabel::Wqq
@ Wqq
Definition: LargeRJetLabelEnum.h:17
CP::FFJetSmearingTool::~FFJetSmearingTool
virtual ~FFJetSmearingTool()
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CP::FFJetSmearingTool::m_Syst_MassDefAffected_map
std::map< std::string, std::string > m_Syst_MassDefAffected_map
Definition: FFJetSmearingTool.h:178
CP::FFJetSmearingTool::m_MeVtoGeV
static constexpr float m_MeVtoGeV
Definition: FFJetSmearingTool.h:196
z
#define z
CP::FFJetSmearingTool::m_MassDef_string
std::string m_MassDef_string
Definition: FFJetSmearingTool.h:159
CP::FFJetSmearingTool::m_HistogramsFilePath
std::string m_HistogramsFilePath
Definition: FFJetSmearingTool.h:163
CP::FFJetSmearingTool::getMatchedTruthJet
StatusCode getMatchedTruthJet(xAOD::Jet &jet_reco, xAOD::Jet &jet_truth_matched) const
Definition: FFJetSmearingTool.cxx:425
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
TH3
Definition: rootspy.cxx:440
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
CP::SystematicSet::end
const_iterator end() const
description: const iterator to the end of the set
Definition: SystematicSet.h:59
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CP::FFJetSmearingTool::Interpolate2D
double Interpolate2D(const TH2 *histo, double x, double y) const
Definition: FFJetSmearingTool.cxx:889
CP::FFJetSmearingTool::m_Syst_TopologyAffected_map
std::map< std::string, std::string > m_Syst_TopologyAffected_map
Definition: FFJetSmearingTool.h:179
CP::FFJetSmearingTool::correctedCopy
virtual CP::CorrectionCode correctedCopy(const xAOD::Jet &input, xAOD::Jet *&output) const override
Definition: FFJetSmearingTool.cxx:820
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
TH2
Definition: rootspy.cxx:373
CP::FFJetSmearingTool::m_EtaRange
float m_EtaRange
Definition: FFJetSmearingTool.h:154
CP::FFJetSmearingTool::m_truthlabelaccessor
std::string m_truthlabelaccessor
Definition: FFJetSmearingTool.h:153
CP::FFJetSmearingTool::m_Syst_HistTA_map
std::map< std::string, std::unique_ptr< TH2 > > m_Syst_HistTA_map
Definition: FFJetSmearingTool.h:183
xAOD::Jet_v1::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition: Jet_v1.cxx:49
JetTools::FFJetAllowedMassDefEnum::Calo
@ Calo
merge.output
output
Definition: merge.py:17
CP::FFJetSmearingTool::m_MaxMass
float m_MaxMass
Definition: FFJetSmearingTool.h:155
xAOD::JetFourMom_t
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Definition: JetTypes.h:17
LargeRJetTruthLabel::Wqq_From_t
@ Wqq_From_t
Definition: LargeRJetLabelEnum.h:21
CheckAppliedSFs.systematics
def systematics
Definition: CheckAppliedSFs.py:231
JetTools::FFJetAllowedMassDefEnum::TA
@ TA
Calorimeter.
CP::FFJetSmearingTool::getJetTopology
StatusCode getJetTopology(xAOD::Jet &jet_reco, std::string &jetTopology) const
Definition: FFJetSmearingTool.cxx:458
CP::SystematicSet::insert
void insert(const SystematicVariation &systematic)
description: insert a systematic into the set
Definition: SystematicSet.cxx:88
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
TH3F
Definition: rootspy.cxx:495
JetTools::stringToEnum
StatusCode stringToEnum(const TString &name, FFJetAllowedMassDefEnum &result)
Definition: FFJetSmearingTool.h:65
SG::AuxElement::makePrivateStore
void makePrivateStore()
Create a new (empty) private store for this object.
Definition: AuxElement.cxx:172
CP::FFJetSmearingTool::applySystematicVariation
virtual StatusCode applySystematicVariation(const CP::SystematicSet &systematics) override
Configure tool to apply systematic variation.
Definition: FFJetSmearingTool.cxx:224
CP::FFJetSmearingTool::m_release
std::string m_release
Definition: FFJetSmearingTool.h:151
CP::FFJetSmearingTool::recommendedSystematics
virtual CP::SystematicSet recommendedSystematics() const override
List of all systematics recommended for this tool.
Definition: FFJetSmearingTool.cxx:189
CP::FFJetSmearingTool::m_Syst_Affects_JMSorJMR
std::map< std::string, std::string > m_Syst_Affects_JMSorJMR
Definition: FFJetSmearingTool.h:184
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
CP::CorrectionCode::Ok
@ Ok
The correction was done successfully.
Definition: CorrectionCode.h:38
CP::FFJetSmearingTool::m_configFile
std::string m_configFile
Definition: FFJetSmearingTool.h:161
CP::FFJetSmearingTool::FFJetSmearingTool
FFJetSmearingTool(const std::string &name)
Proper constructor for Athena.
Definition: FFJetSmearingTool.cxx:28
jet::utils::findFilePath
TString findFilePath(const TString &fileName, const TString &path="", const TString &calibArea="")
Definition: Reconstruction/Jet/JetUncertainties/Root/Helpers.cxx:99
xAOD::Jet_v1::p4
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition: Jet_v1.cxx:71
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
xAOD::Jet_v1::m
virtual double m() const
The invariant mass of the particle.
Definition: Jet_v1.cxx:59
y
#define y
LargeRJetTruthLabel::other_From_V
@ other_From_V
Definition: LargeRJetLabelEnum.h:23
CP::SystematicRegistry
This module implements the central registry for handling systematic uncertainties with CP tools.
Definition: SystematicRegistry.h:25
CP::SystematicSet::begin
const_iterator begin() const
description: const iterator to the beginning of the set
Definition: SystematicSet.h:55
LargeRJetTruthLabel::intToEnum
TypeEnum intToEnum(const int type)
Definition: LargeRJetLabelEnum.h:57
CP::CorrectionCode
Return value from object correction CP tools.
Definition: CorrectionCode.h:31
LargeRJetTruthLabel::other_From_H
@ other_From_H
Definition: LargeRJetLabelEnum.h:28
CP::FFJetSmearingTool::getJMSJMR
StatusCode getJMSJMR(xAOD::Jet &jet_reco, double jet_mass, JetTools::FFJetAllowedMassDefEnum MassDef_of_syst, const std::string &jetTopology, double &JMS_err, double &JMR_err) const
Definition: FFJetSmearingTool.cxx:510
CP::FFJetSmearingTool::m_TA_ResponseMap
std::unique_ptr< TH2 > m_TA_ResponseMap
Definition: FFJetSmearingTool.h:167
CP::FFJetSmearingTool::m_caloMassWeight
std::unique_ptr< TH3F > m_caloMassWeight
Definition: FFJetSmearingTool.h:170
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
LargeRJetTruthLabel::tqqb
@ tqqb
Definition: LargeRJetLabelEnum.h:16
calibdata.copy
bool copy
Definition: calibdata.py:27
JetTools::FFJetAllowedMassDefEnum::Comb
@ Comb
Track Assisted.
CP::FFJetSmearingTool::m_calibArea
std::string m_calibArea
Definition: FFJetSmearingTool.h:157
CP::FFJetSmearingTool::SysData::SysParameter
float SysParameter
Definition: FFJetSmearingTool.h:190
plotBeamSpotCompare.histo
histo
Definition: plotBeamSpotCompare.py:415
CP::FFJetSmearingTool::Read3DHistogram
double Read3DHistogram(const TH3 *histo, double x, double y, double z) const
Definition: FFJetSmearingTool.cxx:856
xAOD::Jet_v1::pt
virtual double pt() const
The transverse momentum ( ) of the particle.
Definition: Jet_v1.cxx:44
CP::FFJetSmearingTool::m_MassDef
JetTools::FFJetAllowedMassDefEnum m_MassDef
Definition: FFJetSmearingTool.h:160
xAOD::Jet
Jet_v1 Jet
Definition of the current "jet version".
Definition: Event/xAOD/xAODJet/xAODJet/Jet.h:17
CP::FFJetSmearingTool::m_TAMassWeight
std::unique_ptr< TH3F > m_TAMassWeight
Definition: FFJetSmearingTool.h:171
CP::SystematicRegistry::getInstance
static SystematicRegistry & getInstance()
Get the singleton instance of the registry for the curren thread.
Definition: SystematicRegistry.cxx:25