ATLAS Offline Software
JetCalibrationTool.cxx
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // JetCalibrationTool.cxx
8 // Implementation file for class JetCalibrationTool
9 // Author: Joe Taenzer <joseph.taenzer@cern.ch>
11 
27 
30 
32  : asg::AsgMetadataTool( name )
33 {
34  declareProperty( "JetCollection", m_jetAlgo = "AntiKt4LCTopo" );
35  declareProperty( "ConfigFile", m_config = "" );
36  declareProperty( "CalibSequence", m_calibSeq = "JetArea_Offset_AbsoluteEtaJES_Insitu" );
37  declareProperty( "IsData", m_isData = true );
38  declareProperty( "ForceCampaign", m_forceCampaign = "");
39  declareProperty( "ConfigDir", m_dir = "JetCalibTools/CalibrationConfigs/" );
40  declareProperty( "EventInfoName", m_eInfoName = "EventInfo");
41  declareProperty( "DEVmode", m_devMode = false);
42  declareProperty( "OriginScale", m_originScale = "JetOriginConstitScaleMomentum");
43  declareProperty( "CalibArea", m_calibAreaTag = "00-04-82");
44  declareProperty( "GSCDepth", m_gscDepth);
45  declareProperty( "useOriginVertex", m_useOriginVertex = false);
46  // Options to force files for metadata-dependent calibration in case metadata is not available
47  declareProperty( "ForceCalibFilePtResidual", m_forceCalibFile_PtResidual = "");
48  declareProperty( "ForceCalibFileFastSim", m_forceCalibFile_FastSim = "");
49  declareProperty( "ForceCalibFileMC2MC", m_forceCalibFile_MC2MC = "");
50  // Options to use legacy calibrations for jet energy resolution in case smearing is not enabled
51  declareProperty( "CalibFileLeg", m_calibFileLeg = "JER_Nominal_Apr2019.root");
52  declareProperty( "CalibAreaLeg", m_calibAreaTagLeg = "00-04-82");
53  declareProperty( "CalibMCTypeLeg", m_calibMCTypeLeg = "MC16");
54 }
55 
57  if(m_globalConfig) delete m_globalConfig;
58  for(TEnv* config : m_globalTimeDependentConfigs) delete config;
59  for(TEnv* config : m_globalInsituCombMassConfig) delete config;
60  if (m_resData) delete m_resData;
61  if (m_resMC) delete m_resMC;
62 }
63 
64 
66 // Public methods:
68 
70  ATH_MSG_INFO ("Initializing " << name() << " to calibrate " << m_jetAlgo << " jets. ");
71 
72  TString jetAlgo = m_jetAlgo;
73  TString calibSeq = m_calibSeq;
74  std::string dir = m_dir;
75 
76  //Make sure the necessary properties were set via the constructor or python configuration
77  if ( jetAlgo.EqualTo("") || calibSeq.EqualTo("") ) {
78  ATH_MSG_FATAL("JetCalibrationTool::initialize : At least one of your constructor arguments is not set. Did you use the copy constructor?");
79  return StatusCode::FAILURE;
80  }
81 
82  if ( m_config.empty() ) { ATH_MSG_FATAL("No configuration file specified."); return StatusCode::FAILURE; }
83  // The calibration area tag is a property of the tool
84  const std::string calibPath = "CalibArea-" + m_calibAreaTag + "/";
85  if(m_devMode){
86  ATH_MSG_WARNING("Dev Mode is ON!!!");
87  ATH_MSG_WARNING("Dev Mode is NOT RECOMMENDED!!!");
88  dir = "JetCalibTools/";
89  }
90  else{dir.insert(14,calibPath);} // Obtaining the path of the configuration file
91  std::string configPath=dir+m_config; // Full path
92  TString fn = PathResolverFindCalibFile(configPath);
93  if(fn=="") {
94  ATH_MSG_FATAL( "Couldn't find ConfigFile " << configPath ); return StatusCode::FAILURE;
95  } else {
96  ATH_MSG_INFO("Reading global JES settings from: " << configPath);
97  ATH_MSG_INFO("resolved in: " << fn);
98  }
99 
100  m_globalConfig = new TEnv();
101  int status=m_globalConfig->ReadFile(fn ,EEnvLevel(0));
102  if (status!=0) { ATH_MSG_FATAL("Cannot read config file " << fn ); return StatusCode::FAILURE; }
103 
104  //Make sure that one of the standard jet collections is being used
105  if ( calibSeq.Contains("JetArea") ) {
106  if ( jetAlgo.Contains("PFlow") ) m_jetScale = PFLOW;
107  else if ( jetAlgo.Contains("EM") ) m_jetScale = EM;
108  else if ( jetAlgo.Contains("LC") ) m_jetScale = LC;
109  else { ATH_MSG_FATAL("jetAlgo " << jetAlgo << " not recognized."); return StatusCode::FAILURE; }
110  }
111 
112  // Settings for R21/2.5.X
113  m_originCorrectedClusters = m_globalConfig->GetValue("OriginCorrectedClusters",false);
114  m_doSetDetectorEta = m_globalConfig->GetValue("SetDetectorEta",true);
115 
116  // Rho key specified in the config file?
117  std::string rhoKey_config = m_globalConfig->GetValue("RhoKey", "None");
118 
119  bool requireRhoInput = false;
120 
121  //Make sure the residual correction is turned on if requested
122  if ( !calibSeq.Contains("JetArea") && !calibSeq.Contains("Residual") ) {
123  m_doJetArea = false;
124  m_doResidual = false;
125  } else if ( calibSeq.Contains("JetArea") ) {
126  if ( m_rhoKey.key().compare("auto") == 0 && rhoKey_config.compare("None") == 0) {
128  if ( m_jetScale == EM ) m_rhoKey = "Kt4EMTopoEventShape";
129  else if ( m_jetScale == LC ) m_rhoKey = "Kt4LCTopoEventShape";
130  else if ( m_jetScale == PFLOW ) m_rhoKey = "Kt4EMPFlowEventShape";
131  } else{
132  if ( m_jetScale == EM ) m_rhoKey = "Kt4EMTopoOriginEventShape";
133  else if ( m_jetScale == LC ) m_rhoKey = "Kt4LCTopoOriginEventShape";
134  else if ( m_jetScale == PFLOW ) m_rhoKey = "Kt4EMPFlowEventShape";
135  }
136  }
137  else if(rhoKey_config.compare("None") != 0 && m_rhoKey.key().compare("auto") == 0){
138  m_rhoKey = rhoKey_config;
139  }
140  requireRhoInput = true;
141  if ( !calibSeq.Contains("Residual") ) m_doResidual = false;
142  } else if ( !calibSeq.Contains("JetArea") && calibSeq.Contains("Residual") ) {
143  m_doJetArea = false;
144  ATH_MSG_INFO("ApplyOnlyResidual should be true if only Residual pile up correction wants to be applied. Need to specify pile up starting scale in the configuration file.");
145  }
146  // get nJet threshold and name
147  m_useNjetInResidual = m_globalConfig->GetValue("OffsetCorrection.UseNjet", false);
148  m_nJetThreshold = m_globalConfig->GetValue("OffsetCorrection.nJetThreshold", 20);
149  m_nJetContainerName = m_globalConfig->GetValue("OffsetCorrection.nJetContainerName",
150  "HLT_xAOD__JetContainer_a4tcemsubjesISFS");
151 
152  if ( !calibSeq.Contains("Origin") ) m_doOrigin = false;
153  if ( !calibSeq.Contains("GSC") && !calibSeq.Contains("GNNC")) m_doGSC = false;
154  if ( !calibSeq.Contains("Bcid") ) m_doBcid = false;
155  if ( calibSeq.Contains("DNN") ) m_doDNNCal = true;
156 
157  //Protect against the in-situ calibration being requested when isData is false
158  if ( calibSeq.Contains("Insitu") && !m_isData ) {
159  ATH_MSG_FATAL("JetCalibrationTool::initialize : calibSeq string contains Insitu with isData set to false. Can't apply in-situ correction to MC!!");
160  return StatusCode::FAILURE;
161  }
162 
163  // Time-Dependent Insitu Calibration
164  m_timeDependentCalib = m_globalConfig->GetValue("TimeDependentInsituCalibration",false);
165  if(m_timeDependentCalib && calibSeq.Contains("Insitu")){ // Read Insitu Configs
166  m_timeDependentInsituConfigs = JetCalibUtils::Vectorize( m_globalConfig->GetValue("InsituTimeDependentConfigs","") );
167  if(m_timeDependentInsituConfigs.empty()) ATH_MSG_ERROR("Please check there are at least two insitu configs");
168  m_runBins = JetCalibUtils::VectorizeD( m_globalConfig->GetValue("InsituRunBins","") );
169  if(m_runBins.size()!=m_timeDependentInsituConfigs.size()+1) ATH_MSG_ERROR("Please check the insitu run bins");
170  for(unsigned int i=0;i<m_timeDependentInsituConfigs.size();++i){
171 
172  std::string configPath_insitu = dir+m_timeDependentInsituConfigs.at(i).Data(); // Full path
173  TString fn_insitu = PathResolverFindCalibFile(configPath_insitu);
174 
175  ATH_MSG_INFO("Reading time-dependent insitu settings from: " << m_timeDependentInsituConfigs.at(i));
176  ATH_MSG_INFO("resolved in: " << fn_insitu);
177 
178  TEnv *globalConfig_insitu = new TEnv();
179  int status = globalConfig_insitu->ReadFile(fn_insitu ,EEnvLevel(0));
180  if (status!=0) { ATH_MSG_FATAL("Cannot read config file " << fn_insitu ); return StatusCode::FAILURE; }
181  m_globalTimeDependentConfigs.push_back(globalConfig_insitu);
182  }
183  }
184 
185  //Combined Mass Calibration:
186  m_insituCombMassCalib = m_globalConfig->GetValue("InsituCombinedMassCorrection",false);
187  if(m_insituCombMassCalib && calibSeq.Contains("InsituCombinedMass")){ // Read Combination Config
188  m_insituCombMassConfig = JetCalibUtils::Vectorize( m_globalConfig->GetValue("InsituCombinedMassCorrectionFile","") );
189  if(m_insituCombMassConfig.empty()) ATH_MSG_ERROR("Please check there is a combination config");
190  for(unsigned int i=0;i<m_insituCombMassConfig.size();++i){
191 
192  std::string configPath_comb = dir+m_insituCombMassConfig.at(i).Data(); // Full path
193  TString fn_comb = PathResolverFindCalibFile(configPath_comb);
194 
195  ATH_MSG_INFO("Reading combination settings from: " << m_insituCombMassConfig.at(i));
196  ATH_MSG_INFO("resolved in: " << fn_comb);
197 
198  TEnv *globalInsituCombMass = new TEnv();
199  int status = globalInsituCombMass->ReadFile(fn_comb ,EEnvLevel(0));
200  if (status!=0) { ATH_MSG_FATAL("Cannot read config file " << fn_comb ); return StatusCode::FAILURE; }
201  m_globalInsituCombMassConfig.push_back(globalInsituCombMass);
202  }
203  }
204 
205  //Loop over the request calib sequence
206  //Initialize derived classes for applying the requested calibrations and add them to a vector
207  std::vector<TString> vecCalibSeq = JetCalibUtils::Vectorize(calibSeq,"_");
208  for ( unsigned int i=0; i<vecCalibSeq.size(); ++i) {
209  if ( vecCalibSeq[i].EqualTo("Origin") || vecCalibSeq[i].EqualTo("DEV") ) continue;
210  if ( vecCalibSeq[i].EqualTo("Residual") && m_doJetArea ) continue;
211  ATH_CHECK( getCalibClass(vecCalibSeq[i] ));
212  }
213 
214  // Initialise ReadHandle(s)
216  ATH_CHECK( m_muKey.initialize() );
217  ATH_CHECK( m_actualMuKey.initialize() );
218  ATH_CHECK( m_rhoKey.initialize(requireRhoInput) );
219  if(m_pvKey.empty()) {
220  // No PV key: -- check if it is required
221  if(m_doResidual) {
222  // May require modification in case of residual that does not require NPV
223  ATH_MSG_ERROR("Residual calibration requested but no primary vertex container specified!");
224  return StatusCode::FAILURE;
225  }
226  else if(m_doGSC) {
227  if(m_jetAlgo.find("PFlow")!=std::string::npos) {
228  ATH_MSG_ERROR("GSC calibration for PFlow requested but no primary vertex container specified!");
229  return StatusCode::FAILURE;
230  }
231  else if((m_gscDepth!="Tile0" && m_gscDepth!="EM3")) {
232  ATH_MSG_ERROR("GSC calibration with tracks requested but no primary vertex container specified!");
233  return StatusCode::FAILURE;
234  }
235  }
236  } else {
237  // Received a PV key, declare the data dependency
238  ATH_CHECK( m_pvKey.initialize() );
239  }
240 
241  if (m_calibSeq.find("Smear") == std::string::npos) { // No smearing running, store legacy JER histograms
242  std::string pathJER_legacy = "JetCalibTools/CalibArea-" + m_calibAreaTagLeg + "/CalibrationFactors/" + m_calibFileLeg;
243  TString fn_JER = PathResolverFindCalibFile(pathJER_legacy);
244  TFile *f_LegJER = new TFile(fn_JER, "READ");
245 
246  TH2D* hist_data{};
247  TH2D* hist_MC{};
248  TString data_hist_name = "JER_Nominal_data_" +m_jetAlgo;
249  TString mc_hist_name = "JER_Nominal_" + m_calibMCTypeLeg + "_" + m_jetAlgo; // m_calibMCTypeLeg = MC16, AFII
250 
251  hist_data = (TH2D*)f_LegJER->Get(data_hist_name);
252  hist_MC = (TH2D*)f_LegJER->Get(mc_hist_name);
253  if (hist_data) {
254  m_resData = (TH2D*)hist_data->Clone();
255  m_resData->SetDirectory(nullptr); // keep it alive after closing input ROOT file
256  }
257  if (hist_MC) {
258  m_resMC = (TH2D*)hist_MC->Clone();
259  m_resMC->SetDirectory(nullptr); // keep it alive after closing input ROOT file
260  }
261 
262  f_LegJER->Close();
263  }
264 
265  return StatusCode::SUCCESS;
266 }
267 
268 //Method for initializing the requested calibration derived classes
269 StatusCode JetCalibrationTool::getCalibClass(const TString& calibration) {
270  TString jetAlgo = m_jetAlgo;
271  const TString calibPath = "CalibArea-" + m_calibAreaTag + "/";
272 
273  // Metadata needed to configure some corrections
274  TString generatorsInfo{};
275  TString simFlavour{};
276  float mcDSID{-1.0};
277  TString mcCampaign{};
278  if ( inputMetaStore()->contains<xAOD::FileMetaData>("FileMetaData") ) {
279  const xAOD::FileMetaData *fmd = nullptr;
280  ATH_CHECK(inputMetaStore()->retrieve(fmd,"FileMetaData") );
281 
282  if(m_isData){
283  UInt_t dataYear = 0;
284  fmd->value(xAOD::FileMetaData::dataYear, dataYear);
285  if (dataYear >= 2015 && dataYear <= 2018) {
286  mcCampaign = "MC20";
287  } else if (dataYear >= 2022 && dataYear <= 2024) {
288  mcCampaign = "MC23";
289  } else {
290  ATH_MSG_WARNING("Data year " << dataYear << " not recognized from file metadata. The corresponding mcCampaign will not be known.");
291  }
292 
293  } else { // is MC
294  std::string str_generatorsInfo;
295  fmd->value(xAOD::FileMetaData::generatorsInfo, str_generatorsInfo);
296  generatorsInfo = str_generatorsInfo;
297 
298  std::string str_simFlavour;
299  fmd->value(xAOD::FileMetaData::simFlavour, str_simFlavour);
300  simFlavour = str_simFlavour;
301 
302  fmd->value(xAOD::FileMetaData::mcProcID, mcDSID);
303 
304  std::string str_mcCampaign;
305  fmd->value(xAOD::FileMetaData::mcCampaign, str_mcCampaign);
306  str_mcCampaign.resize(4); //Only keep top-level of campaign (e.g. mc20 or mc23)
307  mcCampaign = str_mcCampaign;
308  mcCampaign.ToUpper();
309 
310  ATH_MSG_INFO("Have loaded metadata mcDSID:" << mcDSID << ", generatorsInfo: " << generatorsInfo << ", mcCampaign: " << mcCampaign << ", simFlavour: " << simFlavour);
311  }
312  }
313  // Force the MCCamapign (or data equivalent) for missing Metadata or tests
314  if( m_forceCampaign != "" ){
316  }
317 
318  if ( calibration.EqualTo("Bcid") ){
319  m_globalConfig->SetValue("PileupStartingScale","JetBcidScaleMomentum");
320  std::unique_ptr<JetCalibrationStep> bcidCorr = std::make_unique<BcidOffsetCorrection>(this->name()+"_Bcid", m_globalConfig, jetAlgo, calibPath, m_isData);
321  ATH_CHECK(bcidCorr->initialize());
322  m_calibSteps.push_back(std::move(bcidCorr));
323  return StatusCode::SUCCESS;
324  }
325  else if ( calibration.EqualTo("JetArea") || calibration.EqualTo("Residual") ) {
326  std::unique_ptr<JetCalibrationStep> puCorr = std::make_unique<JetPileupCorrection>(this->name()+"_Pileup", m_globalConfig, jetAlgo, calibPath,
328  puCorr->msg().setLevel( this->msg().level() );
329  ATH_CHECK(puCorr->initialize());
330  m_calibSteps.push_back(std::move(puCorr));
331  return StatusCode::SUCCESS;
332  }
333  else if ( calibration.EqualTo("EtaJES") || calibration.EqualTo("AbsoluteEtaJES") ) {
334  std::unique_ptr<JetCalibrationStep> etaJESCorr = std::make_unique<EtaJESCorrection>(this->name()+"_EtaJES", m_globalConfig, jetAlgo, calibPath, false, m_devMode);
335  etaJESCorr->msg().setLevel( this->msg().level() );
336  ATH_CHECK(etaJESCorr->initialize());
337  m_calibSteps.push_back(std::move(etaJESCorr));
338  return StatusCode::SUCCESS;
339  }
340  else if ( calibration.EqualTo("EtaMassJES") ) {
341  std::unique_ptr<JetCalibrationStep> etaJESCorr = std::make_unique<EtaJESCorrection>(this->name()+"_EtaMassJES", m_globalConfig, jetAlgo, calibPath, true, m_devMode);
342  etaJESCorr->msg().setLevel( this->msg().level() );
343  ATH_CHECK(etaJESCorr->initialize());
344  m_calibSteps.push_back(std::move(etaJESCorr));
345  return StatusCode::SUCCESS;
346  }
347  else if ( calibration.EqualTo("GSC") ) {
348  std::unique_ptr<JetCalibrationStep> gsc = std::make_unique<GlobalSequentialCorrection>(this->name()+"_GSC", m_globalConfig, jetAlgo, m_gscDepth, calibPath, m_useOriginVertex, m_devMode);
349  gsc->msg().setLevel( this->msg().level() );
350  ATH_CHECK(gsc->initialize());
351  m_calibSteps.push_back(std::move(gsc));
352 
353  // Set devMode paths for the following corrections
354  TString actualCalibPath;
355  if(m_devMode){
356  actualCalibPath = "JetCalibTools/";
357  } else {
358  actualCalibPath = "JetCalibTool/CalibArea-" + m_calibAreaTag + "/";
359  }
360  // Additional FastSim and PtResidual patches happen after GSC
361  bool do_FastSim = m_globalConfig->GetValue("JPS_FastSim.doCalibration", false) || (m_forceCalibFile_FastSim != "");
362  if(m_isData and do_FastSim){
363  ATH_MSG_WARNING("JPS_FastSim.doCalibration is set in JetCalibrationTool config but isData is set to true. Will turn off FastSim calibration.");
364  do_FastSim = false;
365  }
366  if(do_FastSim){
367  if ( (m_forceCalibFile_FastSim == "") && !inputMetaStore()->contains<xAOD::FileMetaData>("FileMetaData") ) {
368  ATH_MSG_FATAL("JPS_FastSim.doCalibration is set in JetCalibrationTool config but file has no FileMetaData. Please fix the sample or configuration.");
369  return StatusCode::FAILURE;
370  }
371  std::unique_ptr<JetCalibrationStep> JPS_FastSim = std::make_unique<Generic4VecCorrection>(this->name()+"_FastSim", m_globalConfig, jetAlgo, actualCalibPath, m_forceCalibFile_FastSim, Generic4VecCorrection::JET_CORRTYPE::FASTSIM, mcCampaign, simFlavour);
372  JPS_FastSim->msg().setLevel( this->msg().level() );
373  ATH_CHECK(JPS_FastSim->initialize());
374  m_calibSteps.push_back(std::move(JPS_FastSim));
375  }
376  bool do_PtResidual = m_globalConfig->GetValue("JPS_PtResidual.doCalibration", false) || (m_forceCalibFile_PtResidual != "");
377  if(do_PtResidual){
378  std::unique_ptr<JetCalibrationStep> JPS_PtResidual = std::make_unique<Generic4VecCorrection>(this->name()+"_PtResidual", m_globalConfig, jetAlgo, actualCalibPath, m_forceCalibFile_PtResidual, Generic4VecCorrection::JET_CORRTYPE::PTRESIDUAL, mcCampaign);
379  JPS_PtResidual->msg().setLevel( this->msg().level() );
380  ATH_CHECK(JPS_PtResidual->initialize());
381  m_calibSteps.push_back(std::move(JPS_PtResidual));
382  }
383  return StatusCode::SUCCESS;
384  }
385  else if ( calibration.EqualTo("GNNC") ) {
386  std::unique_ptr<JetCalibrationStep> gnnc = std::make_unique<GlobalNNCalibration>(this->name()+"_GNNC",m_globalConfig,jetAlgo,calibPath,m_devMode);
387  gnnc->msg().setLevel( this->msg().level() );
388  ATH_CHECK(gnnc->initialize());
389  m_calibSteps.push_back(std::move(gnnc));
390  return StatusCode::SUCCESS;
391  }
392  else if ( calibration.EqualTo("MC2MC") ) {
393  // Set devMode paths for this correction
394  TString actualCalibPath;
395  if(m_devMode){
396  actualCalibPath = "JetCalibTools/";
397  } else {
398  actualCalibPath = "JetCalibTool/CalibArea-" + m_calibAreaTag + "/";
399  }
400  if ( !inputMetaStore()->contains<xAOD::FileMetaData>("FileMetaData") && (m_forceCalibFile_MC2MC == "") ) {
401  ATH_MSG_FATAL("MC2MC step of jet calibration is requested but file has no FileMetaData. Please fix the sample or configuration.");
402  return StatusCode::FAILURE;
403  }
404  std::unique_ptr<JetCalibrationStep> JPS_MC2MC = std::make_unique<Generic4VecCorrection>(this->name()+"_MC2MC", m_globalConfig, jetAlgo, actualCalibPath, m_forceCalibFile_MC2MC, Generic4VecCorrection::JET_CORRTYPE::MC2MC, mcCampaign, simFlavour, (int) mcDSID, generatorsInfo);
405  JPS_MC2MC->msg().setLevel( this->msg().level() );
406  ATH_CHECK(JPS_MC2MC->initialize());
407  m_calibSteps.push_back(std::move(JPS_MC2MC));
408  return StatusCode::SUCCESS;
409  }
410  else if ( calibration.EqualTo("JMS") ) {
411  std::unique_ptr<JetCalibrationStep> jetMassCorr = std::make_unique<JMSCorrection>(this->name()+"_JMS", m_globalConfig, jetAlgo, calibPath, m_devMode);
412  jetMassCorr->msg().setLevel( this->msg().level() );
413  ATH_CHECK(jetMassCorr->initialize());
414  m_calibSteps.push_back(std::move(jetMassCorr));
415  return StatusCode::SUCCESS;
416  }
417  else if ( calibration.EqualTo("InsituCombinedMass") ){
418  for(unsigned int i=0;i<m_insituCombMassConfig.size();++i){
419  std::unique_ptr<JetCalibrationStep> jetMassCorr = std::make_unique<JMSCorrection>(this->name()+"_InsituCombinedMass", m_globalInsituCombMassConfig.at(i), jetAlgo, calibPath, m_devMode);
420  jetMassCorr->msg().setLevel( this->msg().level() );
421  ATH_CHECK(jetMassCorr->initialize());
422  m_calibSteps.push_back(std::move(jetMassCorr));
423  }
424  return StatusCode::SUCCESS;
425  }
426  else if ( calibration.EqualTo("Insitu") ) {
428  std::unique_ptr<JetCalibrationStep> insituDataCorr = std::make_unique<InsituDataCorrection>(this->name()+"_Insitu", m_globalConfig, jetAlgo, calibPath, m_devMode);
429  insituDataCorr->msg().setLevel( this->msg().level() );
430  ATH_CHECK(insituDataCorr->initialize());
431  m_calibSteps.push_back(std::move(insituDataCorr));
432  return StatusCode::SUCCESS;
433  }
434  else{
435  ATH_MSG_INFO("Initializing Time-Dependent Insitu Corrections");
436  for(unsigned int i=0;i<m_timeDependentInsituConfigs.size();++i){
437  // Add 0.5 before casting to avoid floating-point precision issues
438  unsigned int firstRun = static_cast<unsigned int>(m_runBins.at(i)+1.5);
439  unsigned int lastRun = static_cast<unsigned int>(m_runBins.at(i+1)+0.5);
440  std::unique_ptr<JetCalibrationStep> insituDataCorr = std::make_unique<InsituDataCorrection>(this->name()+"_Insitu_"+std::to_string(i), m_globalTimeDependentConfigs.at(i), jetAlgo,
441  calibPath, m_devMode, firstRun, lastRun);
442  insituDataCorr->msg().setLevel( this->msg().level() );
443  ATH_CHECK(insituDataCorr->initialize());
444  m_calibSteps.push_back(std::move(insituDataCorr));
445  }
446  return StatusCode::SUCCESS;
447  }
448  }
449  else if ( calibration.EqualTo("Smear") ) {
450  if(m_isData){
451  ATH_MSG_FATAL("Asked for smearing of data, which is not supported. Aborting.");
452  return StatusCode::FAILURE;
453  }
454  std::unique_ptr<JetCalibrationStep> jetSmearCorr = std::make_unique<JetSmearingCorrection>(this->name()+"_Smear", m_globalConfig,jetAlgo,calibPath,m_devMode);
455  jetSmearCorr->msg().setLevel(this->msg().level());
456  ATH_CHECK(jetSmearCorr->initialize());
457  m_calibSteps.push_back(std::move(jetSmearCorr));
458  m_smearIndex = m_calibSteps.size() - 1;
459  return StatusCode::SUCCESS;
460  }
461  else if ( calibration.EqualTo("LargeRDNN") ) {
462  std::unique_ptr<JetCalibrationStep> largeR_dnn = std::make_unique<GlobalLargeRDNNCalibration>(this->name()+"_R10DNN", m_globalConfig,calibPath,m_devMode);
463  largeR_dnn->msg().setLevel(this->msg().level());
464  ATH_CHECK(largeR_dnn->initialize());
465  m_calibSteps.push_back(std::move(largeR_dnn));
466  return StatusCode::SUCCESS;
467  }
468  ATH_MSG_FATAL("Calibration string not recognized: " << calibration << ", aborting.");
469  return StatusCode::FAILURE;
470 }
471 
473  //Grab necessary event info for pile up correction and store it in a JetEventInfo class object
474  ATH_MSG_VERBOSE("Modifying jet collection.");
475  JetEventInfo jetEventInfo;
476  ATH_CHECK( initializeEvent(jetEventInfo) );
477  for (xAOD::Jet* jet : jets) ATH_CHECK( calibrate(*jet, jetEventInfo) );
478  return StatusCode::SUCCESS;
479 }
480 
481 // Private/Protected Methods
483 
485 
486  // Check if the tool was initialized
487  if( m_calibSteps.empty() ){
488  ATH_MSG_FATAL(" JetCalibrationTool::initializeEvent : The tool was not initialized.");
489  return StatusCode::FAILURE;
490  }
491 
492  // static accessor for PV index access
493  static const SG::AuxElement::ConstAccessor<int> PVIndexAccessor("PVIndex");
494 
495  ATH_MSG_VERBOSE("Initializing event.");
496 
497  if( m_doJetArea ) {
498  //Determine the rho value to use for the jet area subtraction
499  //Should be determined using EventShape object, use hard coded values if EventShape doesn't exist
500  double rho=0;
501  const xAOD::EventShape * eventShape = nullptr;
502 
504 
505  if ( rhRhoKey.isValid() ) {
506  ATH_MSG_VERBOSE(" Found event density container " << m_rhoKey.key());
507  eventShape = rhRhoKey.cptr();
508  if ( !rhRhoKey.isValid() ) {
509  ATH_MSG_VERBOSE(" Event shape container not found.");
510  ATH_MSG_FATAL("Could not retrieve the xAOD::EventShape container " << m_rhoKey.key() << " from the input file");
511  return StatusCode::FAILURE;
512  } else if ( !eventShape->getDensity( xAOD::EventShape::Density, rho ) ) {
513  ATH_MSG_VERBOSE(" Event density not found in container.");
514  ATH_MSG_FATAL("Could not retrieve the xAOD::EventShape::Density variable from " << m_rhoKey.key());
515  return StatusCode::FAILURE;
516  } else {
517  ATH_MSG_VERBOSE(" Event density retrieved.");
518  }
519  } else if ( m_doJetArea && !rhRhoKey.isValid() ) {
520  ATH_MSG_VERBOSE(" Rho container not found: " << m_rhoKey.key());
521  ATH_MSG_FATAL("Could not retrieve xAOD::EventShape container " << m_rhoKey.key() << " from the input file");
522  return StatusCode::FAILURE;
523  }
524  jetEventInfo.setRho(rho);
525  ATH_MSG_VERBOSE(" Rho = " << 0.001*rho << " GeV");
526 
527  // Necessary retrieval and calculation for use of nJetX instead of NPV
528  if(m_useNjetInResidual) {
529  // retrieve the container
530  const xAOD::JetContainer * jets = nullptr;
531  if (evtStore()->contains<xAOD::JetContainer>(m_nJetContainerName) ) {
532  ATH_MSG_VERBOSE(" Found jet container " << m_nJetContainerName);
533  if ( evtStore()->retrieve(jets, m_nJetContainerName).isFailure() || !jets ) {
534  ATH_MSG_FATAL("Could not retrieve xAOD::JetContainer " << m_nJetContainerName << " from evtStore");
535  return StatusCode::FAILURE;
536  }
537  } else {
538  ATH_MSG_FATAL("Could not find jet container " << m_nJetContainerName << " in the evtStore");
539  return StatusCode::FAILURE;
540  }
541 
542  // count jets above threshold
543  int nJets = 0;
544  for (const auto *jet : *jets) {
545  if(jet->pt()/1000. > m_nJetThreshold)
546  nJets += 1;
547  }
548  jetEventInfo.setNjet(nJets);
549  }
550  }
551 
552  // Retrieve EventInfo object, which now has multiple uses
554  const xAOD::EventInfo * eventObj = nullptr;
555  static std::atomic<unsigned int> eventInfoWarnings = 0;
557  if ( rhEvtInfo.isValid() ) {
558  eventObj = rhEvtInfo.cptr();
559  } else {
560  ++eventInfoWarnings;
561  if ( eventInfoWarnings < 20 )
562  ATH_MSG_ERROR(" JetCalibrationTool::initializeEvent : Failed to retrieve event information.");
563  jetEventInfo.setMu(0); //Hard coded value mu = 0 in case of failure (to prevent seg faults later).
564  jetEventInfo.setPVIndex(0);
565  return StatusCode::SUCCESS; //error is recoverable, so return SUCCESS
566  }
567  jetEventInfo.setRunNumber( eventObj->runNumber() );
568 
569  // If we are applying the reisdual, then store mu
570  if (m_doResidual || m_doBcid) {
572  if(!eventInfoDecor.isPresent()) {
573  ATH_MSG_ERROR("EventInfo decoration not available!");
574  return StatusCode::FAILURE;
575  }
576  jetEventInfo.setMu( eventInfoDecor(0) );
577  }
578 
579  // If this is GSC, we need EventInfo to determine the PV to use
580  // This is support for groups where PV0 is not the vertex of interest (H->gamgam, etc)
581  if (m_doGSC)
582  {
583  // First retrieve the PVIndex if specified
584  // Default is to not specify this, so no warning if it doesn't exist
585  // However, if specified, it should be a sane value - fail if not
586  if ( m_doGSC && PVIndexAccessor.isAvailable(*eventObj) )
587  jetEventInfo.setPVIndex( PVIndexAccessor(*eventObj) );
588  else{
589  if(!m_pvKey.empty()){
590  const xAOD::VertexContainer * vertices = nullptr;
592  if (rhPV.isValid()) {
593  vertices = rhPV.cptr();
594  xAOD::VertexContainer::const_iterator vtx_itr = vertices->begin();
595  xAOD::VertexContainer::const_iterator vtx_end = vertices->end();
596  for ( ; vtx_itr != vtx_end; ++vtx_itr ){
597  if ( (*vtx_itr)->vertexType() == xAOD::VxType::PriVtx ){
598  jetEventInfo.setPVIndex((*vtx_itr)->index());
599  break;
600  }
601  }
602  }
603  else{
604  jetEventInfo.setPVIndex(0);
605  }
606  }
607  else{
608  jetEventInfo.setPVIndex(0);
609  }
610  }
611  }
612 
613  // Extract the BCID information for the BCID correction
614  if (m_doBcid)
615  {
616  static const SG::ConstAccessor<int> BCIDDistanceFromFrontAcc ("DFCommonJets_BCIDDistanceFromFront");
617  static const SG::ConstAccessor<int> BCIDGapBeforeTrainAcc ("DFCommonJets_BCIDGapBeforeTrain");
618  static const SG::ConstAccessor<int> BCIDGapBeforeTrainMinus12Acc ("DFCommonJets_BCIDGapBeforeTrainMinus12");
619 
620  jetEventInfo.setBcidDistanceFromFront( BCIDDistanceFromFrontAcc (*eventObj) );
621  jetEventInfo.setBcidGapBeforeTrain( BCIDGapBeforeTrainAcc (*eventObj) );
622  jetEventInfo.setBcidGapBeforeTrainMinus12( BCIDGapBeforeTrainMinus12Acc (*eventObj) );
623  }
624 
625  // If PV index is not zero, we need to confirm it's a reasonable value
626  // To do this, we need the primary vertices
627  // However, other users of the GSC may not have the PV collection (in particular: trigger GSC in 2016)
628  // So only retrieve vertices if needed for NPV (residual) or a non-zero PV index was specified (GSC)
629  if ((m_doResidual && !m_useNjetInResidual) || (m_doGSC && jetEventInfo.PVIndex()))
630  {
631  //Retrieve VertexContainer object, use it to obtain NPV for the residual correction or check validity of GSC non-PV0 usage
632  const xAOD::VertexContainer * vertices = nullptr;
633 
635  if (rhPV.isValid()) {
636  vertices = rhPV.cptr();
637  } else {
638  ATH_MSG_WARNING(" JetCalibrationTool::initializeEvent : Failed to retrieve primary vertices.");
639  jetEventInfo.setNPV(0); //Hard coded value NPV = 0 in case of failure (to prevent seg faults later).
640  return StatusCode::SUCCESS; //error is recoverable, so return SUCCESS
641  }
642 
643  // Calculate and set NPV if this is residual
644  if (m_doResidual)
645  {
646  int eventNPV = 0;
647  eventNPV = std::count_if(vertices->begin(), vertices->end(), [](const xAOD::Vertex* vtx){ return vtx->vertexType() == xAOD::VxType::PileUp || vtx->vertexType() == xAOD::VxType::PriVtx;});
648  jetEventInfo.setNPV(eventNPV);
649  }
650 
651  // Validate value of non-standard PV index usage
652  if (m_doGSC && jetEventInfo.PVIndex())
653  {
654  static std::atomic<unsigned int> vertexIndexWarnings = 0;
655  if (jetEventInfo.PVIndex() < 0 || static_cast<size_t>(jetEventInfo.PVIndex()) >= vertices->size())
656  {
657  ++vertexIndexWarnings;
658  if (vertexIndexWarnings < 20)
659  ATH_MSG_WARNING(" JetCalibrationTool::initializeEvent : PV index is out of bounds.");
660  jetEventInfo.setPVIndex(0); // Hard coded value PVIndex = 0 in case of failure (to prevent seg faults later).
661  return StatusCode::SUCCESS; // error is recoverable, so return SUCCESS
662  }
663  }
664  }
665  } else if (m_doDNNCal) {
666  // retrieve mu and NPV only from eventInfo
667  static std::atomic<unsigned int> eventInfoWarningsMu = 0;
669  if ( rhEvtInfo.isValid() ) {
671  jetEventInfo.setMu(eventInfoDecor(0));
672  } else {
673  ++eventInfoWarningsMu;
674  if ( eventInfoWarningsMu < 20 ) ATH_MSG_WARNING(" JetCalibrationTool::initializeEvent : Failed to retrieve event information.");
675  jetEventInfo.setMu(0); //Hard coded value mu = 0 in case of failure (to prevent seg faults later).
676  }
677 
678  static std::atomic<unsigned int> eventInfoWarningsPV = 0;
679  const xAOD::VertexContainer * vertices = nullptr;
681  if (rhPV.isValid()) {
682  vertices = rhPV.cptr();
683  int eventNPV = 0;
684  eventNPV = std::count_if(vertices->begin(), vertices->end(), [](const xAOD::Vertex* vtx){ return vtx->vertexType() == xAOD::VxType::PileUp || vtx->vertexType() == xAOD::VxType::PriVtx;});
685  jetEventInfo.setNPV(eventNPV);
686  } else {
687  ++eventInfoWarningsPV;
688  if ( eventInfoWarningsPV < 20 ) ATH_MSG_WARNING(" JetCalibrationTool::initializeEvent : Failed to retrieve primary vertices.");
689  jetEventInfo.setNPV(0); //Hard coded value NPV = 0 in case of failure (to prevent seg faults later).
690  }
691  }
692  return StatusCode::SUCCESS;
693 }
694 
696 
697  //Check for OriginCorrected and PileupCorrected attributes, assume they are false if not found
698  int tmp = 0; //temporary int for checking getAttribute
699  if ( !jet.getAttribute<int>("OriginCorrected",tmp) )
700  jet.setAttribute<int>("OriginCorrected",false);
701  if ( !jet.getAttribute<int>("PileupCorrected",tmp) )
702  jet.setAttribute<int>("PileupCorrected",false);
703 
704  ATH_MSG_VERBOSE("Calibrating jet " << jet.index());
705  if(m_doSetDetectorEta) {
706  xAOD::JetFourMom_t jetconstitP4 = jet.getAttribute<xAOD::JetFourMom_t>("JetConstitScaleMomentum");
707  jet.setAttribute<float>("DetectorEta",jetconstitP4.eta()); //saving constituent scale eta for later use
708  }
709 
710  for (unsigned int i=0; i<m_calibSteps.size(); ++i) ATH_CHECK(m_calibSteps[i]->calibrate(jet, jetEventInfo));
711 
712  return StatusCode::SUCCESS;
713 }
714 
715 
717 
718  if(m_smearIndex < 0){
719  ATH_MSG_DEBUG("Requesting nominal data resolution without smearing - currently configured to return R21 JER!");
721  } else {
722  return m_calibSteps.at(m_smearIndex)->getNominalResolutionData(jet, resolution);
723  }
724 }
725 
727 
728  if(m_smearIndex < 0){
729  ATH_MSG_DEBUG("Requesting nominal MC resolution without smearing - currently configured to return R21 JER!");
731  } else {
732  return m_calibSteps.at(m_smearIndex)->getNominalResolutionMC(jet, resolution);
733  }
734 }
735 
737 
738  // Open R21 JER and fetch the corresponding histogram
739  // Currently only supported for AntiKt4EMPFlow and AntiKt4EMTopo collections
740  if (m_jetAlgo != "AntiKt4EMTopo" and m_jetAlgo != "AntiKt4EMPFlow"){
741  ATH_MSG_ERROR("Cannot retrieve resolution without smearing step for jet collection " << m_jetAlgo);
742  return StatusCode::FAILURE;
743  }
744 
745  if(!histo) {
746  ATH_MSG_ERROR( "Missing resolution histograms!" );
747  return StatusCode::FAILURE;
748  }
749 
750  // Check dimensionality just to be safe
751  if (histo->GetDimension() != 2)
752  {
753  ATH_MSG_ERROR("Blocking reading of a " << histo->GetDimension() << "D histogram as a 2D histogram");
754  return StatusCode::FAILURE;
755  }
756 
757  // x-axis: jet pt, y-axis: abs(jet eta)
758  double x = jet.pt();
759  double y = fabs(jet.eta());
760 
761  // Ensure we are within boundaries
762  const double minX = histo->GetXaxis()->GetBinLowEdge(1);
763  const double maxX = histo->GetXaxis()->GetBinLowEdge(histo->GetNbinsX()+1);
764  if ( x >= maxX )
765  x = maxX - 1.e-6;
766  else if ( x <= minX )
767  x = minX + 1.e-6;
768  const double minY = histo->GetYaxis()->GetBinLowEdge(1);
769  const double maxY = histo->GetYaxis()->GetBinLowEdge(histo->GetNbinsY()+1);
770  if ( y >= maxY )
771  y = maxY - 1.e-6;
772  else if ( y <= minY )
773  y = minY + 1.e-6;
774 
775  // Get the result, no interpolation
776  resolution = histo->GetBinContent(histo->GetXaxis()->FindBin(x),histo->GetYaxis()->FindBin(y));
777 
778  return StatusCode::SUCCESS;
779 }
780 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::EventShape_v1::getDensity
bool getDensity(EventDensityID id, double &v) const
Get a density variable from the object.
Definition: EventShape_v1.cxx:135
Generic4VecCorrection.h
JetEventInfo::setBcidDistanceFromFront
void setBcidDistanceFromFront(Int_t BcidDistanceFromFront)
Definition: JetEventInfo.h:21
JetCalibrationTool::m_resMC
TH2D * m_resMC
Definition: JetCalibrationTool.h:125
JetCalibrationTool::m_doResidual
bool m_doResidual
Definition: JetCalibrationTool.h:110
JMSCorrection.h
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
JetCalibrationTool::m_smearIndex
int m_smearIndex
Definition: JetCalibrationTool.h:118
GlobalSequentialCorrection.h
JetCalibrationTool::m_originCorrectedClusters
bool m_originCorrectedClusters
Definition: JetCalibrationTool.h:83
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
JetEventInfo::PVIndex
int PVIndex()
Definition: JetEventInfo.h:30
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
JetCalibrationTool::m_jetAlgo
std::string m_jetAlgo
Definition: JetCalibrationTool.h:74
JetCalibrationTool::m_calibFileLeg
std::string m_calibFileLeg
Definition: JetCalibrationTool.h:98
JetCalibrationTool::LC
@ LC
Definition: JetCalibrationTool.h:45
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
JetCalibrationTool::m_timeDependentInsituConfigs
std::vector< TString > m_timeDependentInsituConfigs
Definition: JetCalibrationTool.h:89
JetCalibrationTool::m_muKey
SG::ReadDecorHandleKey< xAOD::EventInfo > m_muKey
Definition: JetCalibrationTool.h:68
JetCalibrationTool::m_isData
bool m_isData
Definition: JetCalibrationTool.h:80
GlobalNNCalibration.h
python.base_data.config
config
Definition: base_data.py:20
JetCalibrationTool::EM
@ EM
Definition: JetCalibrationTool.h:45
asg
Definition: DataHandleTestTool.h:28
SG::ReadDecorHandle::isPresent
bool isPresent() const
Is the referenced container present in SG?
defineDB.jets
jets
Definition: JetTagCalibration/share/defineDB.py:24
JetEventInfo::setRho
void setRho(double rho)
Definition: JetEventInfo.h:15
asg::AsgMetadataTool::inputMetaStore
MetaStorePtr_t inputMetaStore() const
Accessor for the input metadata store.
Definition: AsgMetadataTool.cxx:93
JetCalibrationTool::m_gscDepth
std::string m_gscDepth
Definition: JetCalibrationTool.h:115
JetCalibrationTool::initialize
StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: JetCalibrationTool.cxx:69
JetCalibrationTool::getCalibClass
StatusCode getCalibClass(const TString &calibration)
Definition: JetCalibrationTool.cxx:269
JetCalibrationTool::m_forceCampaign
std::string m_forceCampaign
Definition: JetCalibrationTool.h:81
JetCalibrationTool::m_rhoKey
SG::ReadHandleKey< xAOD::EventShape > m_rhoKey
Definition: JetCalibrationTool.h:66
JetCalibrationTool::calibrate
StatusCode calibrate(xAOD::Jet &jet, JetEventInfo &jetEventInfo) const
Definition: JetCalibrationTool.cxx:695
GlobalLargeRDNNCalibration.h
JetCalibrationTool::m_devMode
bool m_devMode
Definition: JetCalibrationTool.h:79
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
JetEventInfo::setBcidGapBeforeTrain
void setBcidGapBeforeTrain(Int_t BcidGapBeforeTrain)
Definition: JetEventInfo.h:22
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
MuonR4::to_string
std::string to_string(const SectorProjector proj)
Definition: MsTrackSeeder.cxx:66
x
#define x
Dedxcorrection::resolution
double resolution[nGasTypes][nParametersResolution]
Definition: TRT_ToT_Corrections.h:46
JetCalibrationTool::m_runBins
std::vector< double > m_runBins
Definition: JetCalibrationTool.h:90
JetCalibUtils::Vectorize
StrV Vectorize(const TString &str, const TString &sep=" ")
Definition: JetCalibUtils.cxx:14
xAOD::EventInfo_v1::runNumber
uint32_t runNumber() const
The current event's run number.
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
JetSmearingCorrection.h
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
JetCalibrationTool::m_doJetArea
bool m_doJetArea
Definition: JetCalibrationTool.h:109
JetCalibrationStep::initialize
virtual StatusCode initialize()=0
xAOD::FileMetaData_v1::value
bool value(MetaDataType type, std::string &val) const
Get a pre-defined string value out of the object.
Definition: FileMetaData_v1.cxx:195
JetCalibrationTool::m_pvKey
SG::ReadHandleKey< xAOD::VertexContainer > m_pvKey
Definition: JetCalibrationTool.h:67
xAOD::FileMetaData_v1::simFlavour
@ simFlavour
Fast or Full sim [string].
Definition: FileMetaData_v1.h:76
JetEventInfo::setBcidGapBeforeTrainMinus12
void setBcidGapBeforeTrainMinus12(Int_t BcidGapBeforeTrainMinus12)
Definition: JetEventInfo.h:23
JetCalibrationTool::initializeEvent
StatusCode initializeEvent(JetEventInfo &jetEventInfo) const
Definition: JetCalibrationTool.cxx:484
JetCalibrationTool::m_globalConfig
TEnv * m_globalConfig
Definition: JetCalibrationTool.h:102
BcidOffsetCorrection.h
JetCalibrationTool::m_insituCombMassConfig
std::vector< TString > m_insituCombMassConfig
Definition: JetCalibrationTool.h:93
xAOD::EventShape_v1::Density
@ Density
Definition: EventShape_v1.h:47
JetEventInfo::setNjet
void setNjet(double nJet)
Definition: JetEventInfo.h:18
JetEventInfo
Definition: JetEventInfo.h:8
xAOD::FileMetaData_v1::mcCampaign
@ mcCampaign
MC campaign [string].
Definition: FileMetaData_v1.h:80
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
JetCalibrationTool::m_resData
TH2D * m_resData
Definition: JetCalibrationTool.h:124
JetCalibrationTool::PFLOW
@ PFLOW
Definition: JetCalibrationTool.h:45
JetCalibrationTool::m_nJetThreshold
float m_nJetThreshold
Definition: JetCalibrationTool.h:85
JetCalibrationTool::getNominalResolutionMC
StatusCode getNominalResolutionMC(const xAOD::Jet &jet, double &resolution) const override
Definition: JetCalibrationTool.cxx:726
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
python.getCurrentFolderTag.fn
fn
Definition: getCurrentFolderTag.py:79
JetCalibrationTool.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
SG::ReadDecorHandle
Handle class for reading a decoration on an object.
Definition: StoreGate/StoreGate/ReadDecorHandle.h:94
JetCalibrationTool::m_dir
std::string m_dir
Definition: JetCalibrationTool.h:87
lumiFormat.i
int i
Definition: lumiFormat.py:85
JetCalibrationTool::m_calibAreaTag
std::string m_calibAreaTag
Definition: JetCalibrationTool.h:77
JetCalibrationTool::m_forceCalibFile_FastSim
std::string m_forceCalibFile_FastSim
Definition: JetCalibrationTool.h:95
JetCalibrationTool::m_eInfoName
std::string m_eInfoName
Definition: JetCalibrationTool.h:88
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
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition: AthCommonDataStore.h:145
TestSUSYToolsAlg.mcCampaign
mcCampaign
Definition: TestSUSYToolsAlg.py:134
JetCalibrationTool::m_nJetContainerName
std::string m_nJetContainerName
Definition: JetCalibrationTool.h:86
JetCalibrationTool::m_calibMCTypeLeg
std::string m_calibMCTypeLeg
Definition: JetCalibrationTool.h:99
xAOD::VxType::PriVtx
@ PriVtx
Primary vertex.
Definition: TrackingPrimitives.h:572
JetCalibrationTool::m_calibAreaTagLeg
std::string m_calibAreaTagLeg
Definition: JetCalibrationTool.h:97
asg::AsgMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AsgMessaging.cxx:49
JetCalibrationTool::m_evtInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_evtInfoKey
Definition: JetCalibrationTool.h:65
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
JetCalibrationTool::m_doSetDetectorEta
bool m_doSetDetectorEta
Definition: JetCalibrationTool.h:91
JetCalibrationTool::m_originScale
std::string m_originScale
Definition: JetCalibrationTool.h:78
xAOD::FileMetaData_v1::mcProcID
@ mcProcID
Same as mc_channel_number [float].
Definition: FileMetaData_v1.h:74
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
JetEventInfo::setNPV
void setNPV(double NPV)
Definition: JetEventInfo.h:17
DataVector
Derived DataVector<T>.
Definition: DataVector.h:795
JetCalibrationTool::m_forceCalibFile_MC2MC
std::string m_forceCalibFile_MC2MC
Definition: JetCalibrationTool.h:96
xAOD::FileMetaData_v1
Class holding file-level metadata about an xAOD file.
Definition: FileMetaData_v1.h:34
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
xAOD::EventShape_v1
Data class for event shapes.
Definition: EventShape_v1.h:28
beamspotman.dir
string dir
Definition: beamspotman.py:619
xAOD::JetFourMom_t
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Definition: JetTypes.h:17
JetEventInfo::setPVIndex
void setPVIndex(int PVindex)
Definition: JetEventInfo.h:19
PathResolver.h
InsituDataCorrection.h
JetCalibrationTool::m_actualMuKey
SG::ReadDecorHandleKey< xAOD::EventInfo > m_actualMuKey
Definition: JetCalibrationTool.h:70
JetCalibrationTool::m_jetScale
jetScale m_jetScale
Definition: JetCalibrationTool.h:107
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
JetCalibrationTool::JetCalibrationTool
JetCalibrationTool(const std::string &name="JetCalibrationTool")
Constructor with parameters:
Definition: JetCalibrationTool.cxx:31
JetCalibrationTool::m_config
std::string m_config
Definition: JetCalibrationTool.h:75
JetCalibrationTool::getNominalResolutionData
StatusCode getNominalResolutionData(const xAOD::Jet &jet, double &resolution) const override
Definition: JetCalibrationTool.cxx:716
JetCalibrationTool::m_globalTimeDependentConfigs
std::vector< TEnv * > m_globalTimeDependentConfigs
Definition: JetCalibrationTool.h:103
JetCalibrationTool::applyCalibration
StatusCode applyCalibration(xAOD::JetContainer &) const override
Apply calibration to a jet container.
Definition: JetCalibrationTool.cxx:472
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
PathResolverFindCalibFile
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Definition: PathResolver.cxx:321
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
y
#define y
FileMetaData.h
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
JetCalibrationTool::m_globalInsituCombMassConfig
std::vector< TEnv * > m_globalInsituCombMassConfig
Definition: JetCalibrationTool.h:104
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
EtaJESCorrection.h
JetCalibrationTool::m_doGSC
bool m_doGSC
Definition: JetCalibrationTool.h:112
xAOD::FileMetaData_v1::generatorsInfo
@ generatorsInfo
Generators information [string].
Definition: FileMetaData_v1.h:82
AsgMetadataTool.h
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
JetCalibrationTool::m_doBcid
bool m_doBcid
Definition: JetCalibrationTool.h:108
ReadDecorHandle.h
Handle class for reading a decoration on an object.
JetCalibrationTool::m_timeDependentCalib
bool m_timeDependentCalib
Definition: JetCalibrationTool.h:82
ReadBchFromCool.lastRun
lastRun
Definition: ReadBchFromCool.py:278
ResidualOffsetCorrection.h
JetCalibrationTool::getNominalResolutionHist
StatusCode getNominalResolutionHist(const xAOD::Jet &jet, double &resolution, const TH2D *histo) const
Definition: JetCalibrationTool.cxx:736
JetPileupCorrection.h
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
JetCalibrationTool::m_calibSeq
std::string m_calibSeq
Definition: JetCalibrationTool.h:76
merge.status
status
Definition: merge.py:16
JetCalibUtils::VectorizeD
VecD VectorizeD(const TString &str, const TString &sep=" ")
Definition: JetCalibUtils.cxx:25
JetEventInfo::setRunNumber
void setRunNumber(UInt_t RunNumber)
Definition: JetEventInfo.h:20
xAOD::FileMetaData_v1::dataYear
@ dataYear
Data year [uint32_t].
Definition: FileMetaData_v1.h:84
JetCalibrationTool::m_useNjetInResidual
bool m_useNjetInResidual
Definition: JetCalibrationTool.h:84
ConstAccessor.h
Helper class to provide constant type-safe access to aux data.
JetCalibrationTool::m_useOriginVertex
bool m_useOriginVertex
Definition: JetCalibrationTool.h:121
plotBeamSpotCompare.histo
histo
Definition: plotBeamSpotCompare.py:414
JetCalibrationTool::m_doDNNCal
bool m_doDNNCal
Definition: JetCalibrationTool.h:113
JetCalibrationTool::m_forceCalibFile_PtResidual
std::string m_forceCalibFile_PtResidual
Definition: JetCalibrationTool.h:94
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
JetCalibrationTool::m_doOrigin
bool m_doOrigin
Definition: JetCalibrationTool.h:111
JetEventInfo::setMu
void setMu(double mu)
Definition: JetEventInfo.h:16
JetCalibrationTool::~JetCalibrationTool
~JetCalibrationTool()
Destructor:
Definition: JetCalibrationTool.cxx:56
fitman.rho
rho
Definition: fitman.py:532
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
JetCalibrationTool::m_calibSteps
std::vector< std::unique_ptr< JetCalibrationStep > > m_calibSteps
Definition: JetCalibrationTool.h:117
JetCalibrationTool::m_insituCombMassCalib
bool m_insituCombMassCalib
Definition: JetCalibrationTool.h:92