ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
GlobalNNCalibration Class Reference

Tool to provide the global NN calibration for jets. More...

#include <GlobalNNCalibration.h>

Inheritance diagram for GlobalNNCalibration:
Collaboration diagram for GlobalNNCalibration:

Public Member Functions

 GlobalNNCalibration ()
 The constructor. More...
 
 GlobalNNCalibration (const std::string &name)
 The constructor. More...
 
 GlobalNNCalibration (const std::string &name, TEnv *config, TString jetAlgo, const TString &calibAreaTag, bool dev)
 The constructor, which is used by the JetCalibrationTool. More...
 
virtual ~GlobalNNCalibration ()=default
 The destructor. More...
 
virtual StatusCode initialize () override
 Returns the charged fraction of a jet. More...
 
virtual void setUnitsGeV (bool useGeV)
 
virtual StatusCode getNominalResolutionData (const xAOD::Jet &, double &) const
 
virtual StatusCode getNominalResolutionMC (const xAOD::Jet &, double &) const
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Protected Member Functions

virtual StatusCode calibrate (xAOD::Jet &jet, JetEventInfo &) const override
 
virtual StatusCode setStartP4 (xAOD::Jet &jet) const
 

Protected Attributes

double m_GeV
 
std::string m_jetStartScale
 
std::string m_name
 

Private Member Functions

double getJetChargedFraction (const xAOD::Jet &jet_reco) const
 Returns the charged fraction of a jet. More...
 
double getJetDetEta (const xAOD::Jet &jet_reco) const
 Returns the detector eta of the jet. More...
 
int getJetNtrk1000 (const xAOD::Jet &jet_reco) const
 Returns the number of tracks with pT > 1 GeV associated to the jet. More...
 
double getJetWtrk1000 (const xAOD::Jet &jet_reco) const
 Returns the jet width. More...
 
double getJESPt (const xAOD::Jet &jet_reco) const
 Returns the jet pT after the MCJES calibration. More...
 
std::map< std::string, double > getJetFeatures (const xAOD::Jet &jet_reco, JetEventInfo &jetEventInfo) const
 Returns a map of possible inputs to the NN, and their corresponding values for this jet. More...
 
double getSplineSlope (const int ieta, const double minPt) const
 Gets the slope of the spline histogram for a given eta bin, for extrapolation of the calibration. More...
 
void loadSplineHists (const TString &fileName, const std::string &etajes_name="etaJes")
 Reads the spline histograms from the file given in the config, and stores them in m_ptCorrFactors. More...
 
double getSplineCorr (const int etaBin, double E) const
 Returns the correction from spline histogram, which should be applied after the NN correction. More...
 
int getEtaBin (const xAOD::Jet &jet_reco, const std::vector< double > &etaBins) const
 Returns the eta bin, as determined by a list of bin edges. More...
 
void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

std::vector< std::unique_ptr< lwt::LightweightGraph > > m_lwnns
 
std::vector< std::unique_ptr< TH1 > > m_ptCorrFactors
 
std::vector< double > m_nnEtaBins
 
std::vector< double > m_closureEtaBins
 
std::vector< TString > m_NNInputs
 
TEnv * m_config {}
 
TString m_jetAlgo
 
std::string m_calibAreaTag
 
bool m_dev {}
 
bool m_doSplineCorr {true}
 
bool m_doLogPtScaling {}
 
double m_minNNCorrection {}
 
double m_maxNNCorrection {}
 
std::vector< double > m_JPtS_MinPt_Slopes
 
std::vector< double > m_JPtS_MinPt_Pt
 
std::vector< double > m_JPtS_MinPt_R
 
std::string m_nm
 Message source name. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

Detailed Description

Tool to provide the global NN calibration for jets.

Author
Jennifer Roloff
Date
August 2021

Definition at line 35 of file GlobalNNCalibration.h.

Constructor & Destructor Documentation

◆ GlobalNNCalibration() [1/3]

GlobalNNCalibration::GlobalNNCalibration ( )

The constructor.

Note that this doesn't have all the necessary information, so it will not configure things correctly.

Definition at line 30 of file GlobalNNCalibration.cxx.

31  : JetCalibrationStep::JetCalibrationStep("GlobalNNCalibration/GlobalNNCalibration"),
32 m_config(nullptr), m_jetAlgo(""), m_calibAreaTag(""), m_dev(false), m_doSplineCorr(true)
33 {
34 }

◆ GlobalNNCalibration() [2/3]

GlobalNNCalibration::GlobalNNCalibration ( const std::string &  name)

The constructor.

Note that this doesn't have all the necessary information, so it will not configure things correctly.

Parameters
nameThe name of the tool being created

Definition at line 38 of file GlobalNNCalibration.cxx.

40 m_config(nullptr), m_jetAlgo(""), m_calibAreaTag(""), m_dev(false), m_doSplineCorr(true)
41 {
42 }

◆ GlobalNNCalibration() [3/3]

GlobalNNCalibration::GlobalNNCalibration ( const std::string &  name,
TEnv *  config,
TString  jetAlgo,
const TString &  calibAreaTag,
bool  dev 
)

The constructor, which is used by the JetCalibrationTool.

Parameters
nameThe name of the tool being created
configThe name of the config file for the calibration
jetAlgoThe name of the jet collection
calibAreaTagThe tag for this calibration
devA flag for if the calibration is run in development mode

Definition at line 44 of file GlobalNNCalibration.cxx.

46  m_config(config), m_jetAlgo(std::move(jetAlgo)), m_calibAreaTag(calibAreaTag), m_dev(dev), m_doSplineCorr(true)
47 {
48 
49 }

◆ ~GlobalNNCalibration()

virtual GlobalNNCalibration::~GlobalNNCalibration ( )
virtualdefault

The destructor.

Member Function Documentation

◆ calibrate()

StatusCode GlobalNNCalibration::calibrate ( xAOD::Jet jet,
JetEventInfo jetEventInfo 
) const
overrideprotectedvirtual

Implements JetCalibrationStep.

Definition at line 126 of file GlobalNNCalibration.cxx.

126  {
127  xAOD::JetFourMom_t jetStartP4;
128  jetStartP4 = jet.jetP4();
129 
130  // The NN learns the jet response, so the original jet pT is divided
131  // by the NN output to get the calibrated pT
132  int nnEtaBin = getEtaBin(jet, m_nnEtaBins);
133  int closureEtaBin = getEtaBin(jet, m_closureEtaBins);
134  std::map<std::string,double> NN_inputValues = getJetFeatures(jet, jetEventInfo);
135  std::map<std::string,std::map<std::string,double>> inputs;
136  inputs["node_0"] = NN_inputValues;
137 
138  std::map<std::string, double> outputs = m_lwnns[nnEtaBin]->compute(inputs);
139  double nnCalibFactor = outputs["out_0"];
140  if(nnCalibFactor > m_maxNNCorrection) nnCalibFactor = m_maxNNCorrection;
141  if(nnCalibFactor < m_minNNCorrection) nnCalibFactor = m_minNNCorrection;
142 
143  double response = nnCalibFactor;
144  if(m_doSplineCorr){
145  double jetPt = getJESPt(jet);
146  response *= getSplineCorr(closureEtaBin, jetPt/nnCalibFactor);
147  if(response == 0) response = nnCalibFactor;
148  }
149 
150  xAOD::JetFourMom_t calibP4 = jetStartP4 / response;
151 
152  //Transfer calibrated jet properties to the Jet object
153  jet.setAttribute<xAOD::JetFourMom_t>("JetGNNCScaleMomentum",calibP4);
154  jet.setJetP4( calibP4 );
155 
156  return StatusCode::SUCCESS;
157 
158 }

◆ getEtaBin()

int GlobalNNCalibration::getEtaBin ( const xAOD::Jet jet_reco,
const std::vector< double > &  etaBins 
) const
private

Returns the eta bin, as determined by a list of bin edges.

Parameters
jet_recoThe jet
etaBinsA list of bin edges

Definition at line 300 of file GlobalNNCalibration.cxx.

300  {
301  double detEta = jet_reco.getAttribute<float>("DetectorEta");
302  for(unsigned int i=1; i<etaBins.size()-1; i++){
303  if(std::abs(detEta) < etaBins[i]) return i-1;
304  }
305  // This should throw an error instead probably, since this is outside of the eta range we are calibrating
306  return etaBins.size()-2;
307 }

◆ getJESPt()

double GlobalNNCalibration::getJESPt ( const xAOD::Jet jet_reco) const
private

Returns the jet pT after the MCJES calibration.

Parameters
jet_recoThe jet

Definition at line 341 of file GlobalNNCalibration.cxx.

341  {
342  return jet_reco.jetP4("JetEtaJESScaleMomentum").pt() / 1.e3;
343 }

◆ getJetChargedFraction()

double GlobalNNCalibration::getJetChargedFraction ( const xAOD::Jet jet_reco) const
private

Returns the charged fraction of a jet.

Parameters
jet_recoThe jet

Definition at line 310 of file GlobalNNCalibration.cxx.

310  {
311  static const SG::ConstAccessor<std::vector<float> > SumPtChargedPFOPt500Acc ("SumPtChargedPFOPt500");
312  if( SumPtChargedPFOPt500Acc.isAvailable(jet_reco) ) {
313  float thisChargedFraction = SumPtChargedPFOPt500Acc(jet_reco).at(0);
314  thisChargedFraction /= jet_reco.jetP4(xAOD::JetConstitScaleMomentum).Pt();
315  return double(thisChargedFraction);
316  }
317 
318  return -999.;
319 }

◆ getJetDetEta()

double GlobalNNCalibration::getJetDetEta ( const xAOD::Jet jet_reco) const
private

Returns the detector eta of the jet.

Parameters
jet_recoThe jet

Definition at line 321 of file GlobalNNCalibration.cxx.

321  {
322  static const SG::ConstAccessor<float> DetectorEtaAcc ("DetectorEta");
323  return DetectorEtaAcc.withDefault (jet_reco, -999);
324 }

◆ getJetFeatures()

std::map< std::string, double > GlobalNNCalibration::getJetFeatures ( const xAOD::Jet jet_reco,
JetEventInfo jetEventInfo 
) const
private

Returns a map of possible inputs to the NN, and their corresponding values for this jet.

Parameters
jet_recoThe jet
jetEventInfoA set of information about the event and jet

Definition at line 223 of file GlobalNNCalibration.cxx.

223  {
224  std::vector<float> samplingFrac = jet_reco.getAttribute<std::vector<float> >("EnergyPerSampling");
225  xAOD::JetFourMom_t jetconstitP4 = jet_reco.getAttribute<xAOD::JetFourMom_t>("JetConstitScaleMomentum");
226 
227  xAOD::JetFourMom_t jetStartP4;
228  jetStartP4 = jet_reco.jetP4();
229 
230  float jetE_constitscale = jetconstitP4.e();
231 
232  //EM3 and Tile0 fraction calculations
233  //EM3 = (EMB3+EME3)/energy, Tile0 = (TileBar0+TileExt0)/energy
234  //Check the map above to make sure the correct entries of samplingFrac are being used
235  float EM0 = (samplingFrac[0]+samplingFrac[4])/jetE_constitscale;
236  float EM1 = (samplingFrac[1]+samplingFrac[5])/jetE_constitscale;
237  float EM2 = (samplingFrac[2]+samplingFrac[6])/jetE_constitscale;
238  float EM3 = (samplingFrac[3]+samplingFrac[7])/jetE_constitscale;
239  float Tile0 = (samplingFrac[12]+samplingFrac[18])/jetE_constitscale;
240  float Tile1 = (samplingFrac[13]+samplingFrac[19])/jetE_constitscale;
241  float Tile2 = (samplingFrac[14]+samplingFrac[20])/jetE_constitscale;
242  float HEC0 = (samplingFrac[8])/jetE_constitscale;
243  float HEC1 = (samplingFrac[9])/jetE_constitscale;
244  float HEC2 = (samplingFrac[10])/jetE_constitscale;
245  float HEC3 = (samplingFrac[11])/jetE_constitscale;
246 
247  float FCAL0 = (samplingFrac[21])/jetE_constitscale;
248  float FCAL1 = (samplingFrac[22])/jetE_constitscale;
249  float FCAL2 = (samplingFrac[23])/jetE_constitscale;
250 
251 
252  // A map of possible NN inputs with their values for this jet.
253  // These may not all be included in the NN.
254  std::map<std::string,double> inputValues;
255 
256  // This is a list of variables that could be included in the NN.
257  // This makes it simple to change the variables in the NN without complicated changes
258  // to the code.
259  if(m_doLogPtScaling) {
260  inputValues["jet_pt"] = log10(getJESPt(jet_reco));
261  }
262  else{
263  inputValues["jet_pt"] = getJESPt(jet_reco);
264  }
265  inputValues["EM0"] = EM0;
266  inputValues["EM1"] = EM1;
267  inputValues["EM2"] = EM2;
268  inputValues["EM3"] = EM3;
269  inputValues["TILE0"] = Tile0;
270  inputValues["TILE1"] = Tile1;
271  inputValues["TILE2"] = Tile2;
272  inputValues["HEC0"] = HEC0;
273  inputValues["HEC1"] = HEC1;
274  inputValues["HEC2"] = HEC2;
275  inputValues["HEC3"] = HEC3;
276  inputValues["FCAL0"] = FCAL0;
277  inputValues["FCAL1"] = FCAL1;
278  inputValues["FCAL2"] = FCAL2;
279  inputValues["jet_Ntrk1000"] = getJetNtrk1000(jet_reco);
280  inputValues["jet_ChargedFraction"] = getJetChargedFraction(jet_reco);
281  inputValues["jet_Wtrk1000"] = getJetWtrk1000(jet_reco);
282  inputValues["jet_DetEta"] = getJetDetEta(jet_reco);
283  inputValues["jet_n90Constituents"] = jet_reco.getAttribute<float>("N90Constituents");
284  inputValues["jet_nMuSeg"] = jet_reco.getAttribute<int>("GhostMuonSegmentCount");
285  inputValues["NPV"] = jetEventInfo.NPV();
286  inputValues["averageInteractionsPerCrossing"] = jetEventInfo.mu();
287 
288  // The actual NN inputs and values
289  std::map<std::string,double> NNInputValues;
290  for(const TString& input : m_NNInputs){
291  NNInputValues[input.Data()] = inputValues[input.Data()];
292  }
293 
294  return NNInputValues;
295 }

◆ getJetNtrk1000()

int GlobalNNCalibration::getJetNtrk1000 ( const xAOD::Jet jet_reco) const
private

Returns the number of tracks with pT > 1 GeV associated to the jet.

Parameters
jet_recoThe jet

Definition at line 326 of file GlobalNNCalibration.cxx.

326  {
327  static const SG::ConstAccessor<std::vector<int> > NumTrkPt1000Acc ("NumTrkPt1000");
328  if(NumTrkPt1000Acc.isAvailable(jet_reco))
329  return NumTrkPt1000Acc(jet_reco).at(0);
330  return -999;
331 }

◆ getJetWtrk1000()

double GlobalNNCalibration::getJetWtrk1000 ( const xAOD::Jet jet_reco) const
private

Returns the jet width.

Parameters
jet_recoThe jet

Definition at line 333 of file GlobalNNCalibration.cxx.

333  {
334  static const SG::ConstAccessor<std::vector<float> > TrackWidthPt1000Acc ("TrackWidthPt1000");
335  if(TrackWidthPt1000Acc.isAvailable(jet_reco))
336  return double(TrackWidthPt1000Acc(jet_reco).at(0));
337  return -999.;
338 }

◆ getNominalResolutionData()

StatusCode JetCalibrationStep::getNominalResolutionData ( const xAOD::Jet ,
double &   
) const
virtualinherited

Reimplemented in JetSmearingCorrection.

Definition at line 33 of file JetCalibrationStep.cxx.

33  {
34  ATH_MSG_ERROR("Nominal data resolution requested from a jet calibration step that doesn't define it.");
35  return StatusCode::FAILURE;
36 }

◆ getNominalResolutionMC()

StatusCode JetCalibrationStep::getNominalResolutionMC ( const xAOD::Jet ,
double &   
) const
virtualinherited

Reimplemented in JetSmearingCorrection.

Definition at line 38 of file JetCalibrationStep.cxx.

38  {
39  ATH_MSG_ERROR("Nominal MC resolution requested from a jet calibration step that doesn't define it.");
40  return StatusCode::FAILURE;
41 }

◆ getSplineCorr()

double GlobalNNCalibration::getSplineCorr ( const int  etaBin,
double  E 
) const
private

Returns the correction from spline histogram, which should be applied after the NN correction.

Parameters
etaBin
E

Definition at line 190 of file GlobalNNCalibration.cxx.

190  {
191  if(pT >= m_ptCorrFactors[ etaBin ]->GetBinLowEdge( m_ptCorrFactors[ etaBin ]->GetNbinsX()+1)){
192  pT = m_ptCorrFactors[ etaBin ]->GetBinLowEdge( m_ptCorrFactors[ etaBin ]->GetNbinsX());
193  }
194  if(pT < m_JPtS_MinPt_Pt[etaBin]){
195  double ptCutoff = m_JPtS_MinPt_Pt[etaBin];
196  double Rcutoff = m_JPtS_MinPt_R[etaBin];
197  double slope = m_JPtS_MinPt_Slopes[etaBin];
198  double R = slope*(pT-ptCutoff)+Rcutoff;
199  return R;
200  }
201 
202 
203  double R = m_ptCorrFactors[ etaBin ]->Interpolate(pT);
204  return R;
205 }

◆ getSplineSlope()

double GlobalNNCalibration::getSplineSlope ( const int  ieta,
const double  minPt 
) const
private

Gets the slope of the spline histogram for a given eta bin, for extrapolation of the calibration.

Parameters
ietaThe eta bin for the spline histogram
minPtThe pT at which the extrapolation starts, and where the slope should be calculated

Definition at line 208 of file GlobalNNCalibration.cxx.

208  {
209  // Don't want to use interpolation here, so instead just use the values at the bin centers near the cutoff
210  int minBin = m_ptCorrFactors[ieta]->FindBin(minPt);
211 
212  double rFirst = m_ptCorrFactors[ ieta ]->GetBinContent(minBin);
213  double rSecond = m_ptCorrFactors[ ieta ]->GetBinContent(minBin+1);
214  double binWidth = m_ptCorrFactors[ ieta ]->GetBinCenter(minBin+1) - m_ptCorrFactors[ ieta ]->GetBinCenter(minBin);
215  double slope = (rSecond - rFirst) / binWidth;
216 
217  return slope;
218 }

◆ initialize()

StatusCode GlobalNNCalibration::initialize ( )
overridevirtual

Returns the charged fraction of a jet.

Parameters
nameThe name of the tool being created

Implements JetCalibrationStep.

Definition at line 52 of file GlobalNNCalibration.cxx.

52  {
53 
54  ATH_MSG_INFO("Initializing tool");
55  m_nnEtaBins = JetCalibUtils::VectorizeD( m_config->GetValue("GNNC.EtaBinsForNN","") );
56  m_closureEtaBins = JetCalibUtils::VectorizeD( m_config->GetValue("GNNC.EtaBinsForClosure","") );
57  m_NNInputs = JetCalibUtils::Vectorize( m_config->GetValue("GNNC.Inputs","") );
58  m_doSplineCorr = m_config->GetValue("GNNC.UseSplineCorr", true);
59  m_doLogPtScaling = m_config->GetValue("GNNC.UseLogPtScaling", false);
60  m_maxNNCorrection = m_config->GetValue("GNNC.MaxNNCorrection", 2.0);
61  m_minNNCorrection = m_config->GetValue("GNNC.MinNNCorrection", 0.5);
62 
63  // This code is copied from the GlobalSequentialCorrection code,
64  // so while it is hard-coded, it is consistent with how these filenames are parsed.
65  if ( m_jetAlgo.EqualTo("") ) { ATH_MSG_FATAL("No jet algorithm specified. Aborting."); return StatusCode::FAILURE; }
66 
67  //find the ROOT file containing response histograms, path comes from the config file.
68  TString MLGSCFile = m_config->GetValue("GNNC.MLFactorsFile","empty");
69  if ( MLGSCFile.EqualTo("empty") ) {
70  ATH_MSG_FATAL("NO MLFactorsFile specified. Aborting.");
71  return StatusCode::FAILURE;
72  }
73  if(m_dev){
74  MLGSCFile.Remove(0,33);
75  MLGSCFile.Insert(0,"JetCalibTools/");
76  }
77  else{MLGSCFile.Insert(14,m_calibAreaTag);}
78 
79 
80  // Get all of the different NN json files for each eta bin
81  for(unsigned int i=0; i<m_nnEtaBins.size()-1; i++){
82  TString fileName = PathResolverFindCalibFile(Form("%s_etabin_%d.json", MLGSCFile.Data(), i));
83  std::ifstream input(fileName);
84  std::unique_ptr<lwt::LightweightGraph> lwnn = std::make_unique<lwt::LightweightGraph> ( lwt::parse_json_graph(input) );
85  m_lwnns.push_back(std::move(lwnn));
86  }
87 
88 
89 
90  // An additional correction on top of the neural network to smooth out fluctuations in the pt response
91  if(m_doSplineCorr){
92  TString ptCalibHists = m_config->GetValue("GNNC.JPtS_CalibHists","");
93  if(m_dev){
94  ptCalibHists.Remove(0,33);
95  ptCalibHists.Insert(0,"JetCalibTools/");
96  }
97  else{
98  ptCalibHists.Insert(14,m_calibAreaTag);
99  }
100  TString calibHistFile = PathResolverFindCalibFile(ptCalibHists.Data());
101  loadSplineHists(calibHistFile, "etaJes");
102  m_JPtS_MinPt_Pt = JetCalibUtils::VectorizeD( m_config->GetValue("GNNC.ptCutoff","") );
103  if(m_JPtS_MinPt_Pt.size() != m_closureEtaBins.size()-1){
104  ATH_MSG_FATAL("Pt cutoff vector has wrong length. There should be one value per eta bin."); return StatusCode::FAILURE;
105  return StatusCode::FAILURE;
106  }
107 
108  for (uint ieta=0;ieta<m_closureEtaBins.size()-1;++ieta) {
109  //Calculate the slope of the response curve at the minPt for each eta bin
110  //Used in the GetLowPtJPtS method when Pt < minPt
111  const double Rcutoff = getSplineCorr(ieta, m_JPtS_MinPt_Pt[ieta]);
112  const double Slope = getSplineSlope(ieta, m_JPtS_MinPt_Pt[ieta]);
113  if(Slope > Rcutoff/m_JPtS_MinPt_Pt[ieta]) ATH_MSG_WARNING("Slope of calibration curve at minimum ET is too steep for the JPtS factors of etabin " << ieta << ", eta = " << m_closureEtaBins[ieta] );
114 
115  m_JPtS_MinPt_R.push_back(Rcutoff);
116  m_JPtS_MinPt_Slopes.push_back(Slope);
117  }
118  }
119 
120 
121  return StatusCode::SUCCESS;
122 }

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40 {
42  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ loadSplineHists()

void GlobalNNCalibration::loadSplineHists ( const TString &  fileName,
const std::string &  etajes_name = "etaJes" 
)
private

Reads the spline histograms from the file given in the config, and stores them in m_ptCorrFactors.

Loads the calib constants from histograms in TFile named fileName.

Parameters
fileName
etajes_name

Definition at line 164 of file GlobalNNCalibration.cxx.

164  {
165  std::unique_ptr<TFile> tmpF(TFile::Open( fileName ));
166  TList *ptCorr_l = dynamic_cast<TList*>( tmpF->Get(ptCorr_name.c_str()));
167  if (not ptCorr_l){
168  ATH_MSG_ERROR("TList pointer is null in GlobalNNCalibration::loadSplineHists");
169  tmpF->Close();
170  return;
171  }
172  m_ptCorrFactors.resize( ptCorr_l->GetSize() );
173  int nBinsCorr = ptCorr_l->GetSize();
174  int nEtaBins = m_closureEtaBins.size()-1;
175  if(nBinsCorr != nEtaBins){
176  ATH_MSG_WARNING("Do not have the correct number of eta bins for " << fileName << "\t" << ptCorr_name << "\t" << ptCorr_l->GetSize() );
177  }
178 
179  for(unsigned int i=0 ; i<m_closureEtaBins.size()-1; i++){
180  auto *pTH1 = dynamic_cast<TH1*>(ptCorr_l->At(i));
181  if (not pTH1) continue;
182  m_ptCorrFactors[i].reset(pTH1);
183  m_ptCorrFactors[i]->SetDirectory(nullptr);
184  }
185  tmpF->Close();
186 }

◆ msg() [1/2]

MsgStream & asg::AsgMessaging::msg ( ) const
inherited

The standard message stream.

Returns
A reference to the default message stream of this object.

Definition at line 49 of file AsgMessaging.cxx.

49  {
50 #ifndef XAOD_STANDALONE
52 #else // not XAOD_STANDALONE
53  return m_msg;
54 #endif // not XAOD_STANDALONE
55  }

◆ msg() [2/2]

MsgStream & asg::AsgMessaging::msg ( const MSG::Level  lvl) const
inherited

The standard message stream.

Parameters
lvlThe message level to set the stream to
Returns
A reference to the default message stream, set to level "lvl"

Definition at line 57 of file AsgMessaging.cxx.

57  {
58 #ifndef XAOD_STANDALONE
60 #else // not XAOD_STANDALONE
61  m_msg << lvl;
62  return m_msg;
63 #endif // not XAOD_STANDALONE
64  }

◆ msgLvl()

bool asg::AsgMessaging::msgLvl ( const MSG::Level  lvl) const
inherited

Test the output level of the object.

Parameters
lvlThe message level to test against
Returns
boolean Indicting if messages at given level will be printed
true If messages at level "lvl" will be printed

Definition at line 41 of file AsgMessaging.cxx.

41  {
42 #ifndef XAOD_STANDALONE
43  return ::AthMessaging::msgLvl( lvl );
44 #else // not XAOD_STANDALONE
45  return m_msg.msgLevel( lvl );
46 #endif // not XAOD_STANDALONE
47  }

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level  lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29 {
30  m_lvl = lvl;
31 }

◆ setStartP4()

StatusCode JetCalibrationStep::setStartP4 ( xAOD::Jet jet) const
protectedvirtualinherited

Definition at line 21 of file JetCalibrationStep.cxx.

21  {
23  if ( m_jetStartScale.compare("Default") == 0 ) {
24  return StatusCode::SUCCESS;
25  } else if ( jet.getAttribute<xAOD::JetFourMom_t>(m_jetStartScale.c_str(),tmp) ) {
26  jet.setJetP4(tmp);
27  return StatusCode::SUCCESS;
28  }
29  ATH_MSG_WARNING("Jet does not have the requested momentum state: " << m_jetStartScale);
30  return StatusCode::FAILURE;
31 }

◆ setUnitsGeV()

virtual void JetCalibrationStep::setUnitsGeV ( bool  useGeV)
inlinevirtualinherited

Definition at line 30 of file JetCalibrationStep.h.

30 { if (useGeV) m_GeV=1; else m_GeV=1000; }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_calibAreaTag

std::string GlobalNNCalibration::m_calibAreaTag
private

Definition at line 156 of file GlobalNNCalibration.h.

◆ m_closureEtaBins

std::vector<double> GlobalNNCalibration::m_closureEtaBins
private

Definition at line 150 of file GlobalNNCalibration.h.

◆ m_config

TEnv* GlobalNNCalibration::m_config {}
private

Definition at line 154 of file GlobalNNCalibration.h.

◆ m_dev

bool GlobalNNCalibration::m_dev {}
private

Definition at line 157 of file GlobalNNCalibration.h.

◆ m_doLogPtScaling

bool GlobalNNCalibration::m_doLogPtScaling {}
private

Definition at line 159 of file GlobalNNCalibration.h.

◆ m_doSplineCorr

bool GlobalNNCalibration::m_doSplineCorr {true}
private

Definition at line 158 of file GlobalNNCalibration.h.

◆ m_GeV

double JetCalibrationStep::m_GeV
protectedinherited

Definition at line 40 of file JetCalibrationStep.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_jetAlgo

TString GlobalNNCalibration::m_jetAlgo
private

Definition at line 155 of file GlobalNNCalibration.h.

◆ m_jetStartScale

std::string JetCalibrationStep::m_jetStartScale
protectedinherited

Definition at line 41 of file JetCalibrationStep.h.

◆ m_JPtS_MinPt_Pt

std::vector<double> GlobalNNCalibration::m_JPtS_MinPt_Pt
private

Definition at line 164 of file GlobalNNCalibration.h.

◆ m_JPtS_MinPt_R

std::vector<double> GlobalNNCalibration::m_JPtS_MinPt_R
private

Definition at line 165 of file GlobalNNCalibration.h.

◆ m_JPtS_MinPt_Slopes

std::vector<double> GlobalNNCalibration::m_JPtS_MinPt_Slopes
private

Definition at line 163 of file GlobalNNCalibration.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ m_lwnns

std::vector<std::unique_ptr<lwt::LightweightGraph> > GlobalNNCalibration::m_lwnns
private

Definition at line 147 of file GlobalNNCalibration.h.

◆ m_maxNNCorrection

double GlobalNNCalibration::m_maxNNCorrection {}
private

Definition at line 161 of file GlobalNNCalibration.h.

◆ m_minNNCorrection

double GlobalNNCalibration::m_minNNCorrection {}
private

Definition at line 160 of file GlobalNNCalibration.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_name

std::string JetCalibrationStep::m_name
protectedinherited

Definition at line 42 of file JetCalibrationStep.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_nnEtaBins

std::vector<double> GlobalNNCalibration::m_nnEtaBins
private

Definition at line 149 of file GlobalNNCalibration.h.

◆ m_NNInputs

std::vector<TString> GlobalNNCalibration::m_NNInputs
private

Definition at line 151 of file GlobalNNCalibration.h.

◆ m_ptCorrFactors

std::vector<std::unique_ptr<TH1> > GlobalNNCalibration::m_ptCorrFactors
private

Definition at line 148 of file GlobalNNCalibration.h.


The documentation for this class was generated from the following files:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
CalculateHighPtTerm.pT
pT
Definition: ICHEP2016/CalculateHighPtTerm.py:57
GlobalNNCalibration::getSplineSlope
double getSplineSlope(const int ieta, const double minPt) const
Gets the slope of the spline histogram for a given eta bin, for extrapolation of the calibration.
Definition: GlobalNNCalibration.cxx:208
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
GlobalNNCalibration::m_JPtS_MinPt_Slopes
std::vector< double > m_JPtS_MinPt_Slopes
Definition: GlobalNNCalibration.h:163
GlobalNNCalibration::m_NNInputs
std::vector< TString > m_NNInputs
Definition: GlobalNNCalibration.h:151
Ringer::EM3
@ EM3
Definition: CaloRingsDefs.h:49
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
TCS::KFMET::nEtaBins
constexpr unsigned nEtaBins
Definition: KalmanMETCorrectionConstants.h:18
IDTPM::R
float R(const U &p)
Definition: TrackParametersHelper.h:101
response
MDT_Response response
Definition: MDT_ResponseTest.cxx:28
GlobalNNCalibration::getEtaBin
int getEtaBin(const xAOD::Jet &jet_reco, const std::vector< double > &etaBins) const
Returns the eta bin, as determined by a list of bin edges.
Definition: GlobalNNCalibration.cxx:300
ConvertOldUJHistosToNewHistos.etaBins
list etaBins
Definition: ConvertOldUJHistosToNewHistos.py:145
Ringer::EM2
@ EM2
Definition: CaloRingsDefs.h:48
CaloCell_ID_FCS::FCAL1
@ FCAL1
Definition: FastCaloSim_CaloCell_ID.h:41
xAOD::Jet_v1::jetP4
JetFourMom_t jetP4() const
The full 4-momentum of the particle : internal jet type.
Definition: Jet_v1.cxx:76
GlobalNNCalibration::m_config
TEnv * m_config
Definition: GlobalNNCalibration.h:154
JetEventInfo::NPV
double NPV()
Definition: JetEventInfo.h:28
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:54
CaloCell_ID_FCS::HEC2
@ HEC2
Definition: FastCaloSim_CaloCell_ID.h:29
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
GlobalNNCalibration::m_JPtS_MinPt_Pt
std::vector< double > m_JPtS_MinPt_Pt
Definition: GlobalNNCalibration.h:164
xAOD::Jet_v1::getAttribute
bool getAttribute(AttributeID type, T &value) const
Retrieve attribute moment by enum.
postInclude.inputs
inputs
Definition: postInclude.SortInput.py:15
JetCalibUtils::Vectorize
StrV Vectorize(const TString &str, const TString &sep=" ")
Definition: JetCalibUtils.cxx:14
GlobalNNCalibration::getJetFeatures
std::map< std::string, double > getJetFeatures(const xAOD::Jet &jet_reco, JetEventInfo &jetEventInfo) const
Returns a map of possible inputs to the NN, and their corresponding values for this jet.
Definition: GlobalNNCalibration.cxx:223
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
binWidth
void binWidth(TH1 *h)
Definition: listroot.cxx:80
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
GlobalNNCalibration::m_calibAreaTag
std::string m_calibAreaTag
Definition: GlobalNNCalibration.h:156
xAOD::JetConstitScaleMomentum
@ JetConstitScaleMomentum
Definition: JetTypes.h:29
GlobalNNCalibration::m_doSplineCorr
bool m_doSplineCorr
Definition: GlobalNNCalibration.h:158
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
GlobalNNCalibration::m_JPtS_MinPt_R
std::vector< double > m_JPtS_MinPt_R
Definition: GlobalNNCalibration.h:165
JetCalibrationStep::JetCalibrationStep
JetCalibrationStep(const char *name="JetCalibrationStep")
Definition: JetCalibrationStep.cxx:12
xAOD::etaBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap etaBin
Definition: L2StandAloneMuon_v1.cxx:148
GlobalNNCalibration::m_ptCorrFactors
std::vector< std::unique_ptr< TH1 > > m_ptCorrFactors
Definition: GlobalNNCalibration.h:148
FortranAlgorithmOptions.fileName
fileName
Definition: FortranAlgorithmOptions.py:13
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
JetEventInfo::mu
double mu()
Definition: JetEventInfo.h:27
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
GlobalNNCalibration::m_nnEtaBins
std::vector< double > m_nnEtaBins
Definition: GlobalNNCalibration.h:149
CaloCell_ID_FCS::HEC1
@ HEC1
Definition: FastCaloSim_CaloCell_ID.h:28
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
GlobalNNCalibration::m_minNNCorrection
double m_minNNCorrection
Definition: GlobalNNCalibration.h:160
lumiFormat.i
int i
Definition: lumiFormat.py:92
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
GlobalNNCalibration::m_doLogPtScaling
bool m_doLogPtScaling
Definition: GlobalNNCalibration.h:159
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
GlobalNNCalibration::m_jetAlgo
TString m_jetAlgo
Definition: GlobalNNCalibration.h:155
GlobalNNCalibration::getSplineCorr
double getSplineCorr(const int etaBin, double E) const
Returns the correction from spline histogram, which should be applied after the NN correction.
Definition: GlobalNNCalibration.cxx:190
python.CreateTierZeroArgdict.outputs
outputs
Definition: CreateTierZeroArgdict.py:189
GlobalNNCalibration::m_maxNNCorrection
double m_maxNNCorrection
Definition: GlobalNNCalibration.h:161
xAOD::JetFourMom_t
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Definition: JetTypes.h:17
JetCalibrationStep::m_jetStartScale
std::string m_jetStartScale
Definition: JetCalibrationStep.h:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
GlobalNNCalibration::getJetDetEta
double getJetDetEta(const xAOD::Jet &jet_reco) const
Returns the detector eta of the jet.
Definition: GlobalNNCalibration.cxx:321
GlobalNNCalibration::getJetChargedFraction
double getJetChargedFraction(const xAOD::Jet &jet_reco) const
Returns the charged fraction of a jet.
Definition: GlobalNNCalibration.cxx:310
CaloCell_ID_FCS::HEC0
@ HEC0
Definition: FastCaloSim_CaloCell_ID.h:27
PathResolverFindCalibFile
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Definition: PathResolver.cxx:431
lwtDev::parse_json_graph
GraphConfig parse_json_graph(std::istream &json)
Definition: parse_json.cxx:71
GlobalNNCalibration::getJetNtrk1000
int getJetNtrk1000(const xAOD::Jet &jet_reco) const
Returns the number of tracks with pT > 1 GeV associated to the jet.
Definition: GlobalNNCalibration.cxx:326
GlobalNNCalibration::m_lwnns
std::vector< std::unique_ptr< lwt::LightweightGraph > > m_lwnns
Definition: GlobalNNCalibration.h:147
GlobalNNCalibration::loadSplineHists
void loadSplineHists(const TString &fileName, const std::string &etajes_name="etaJes")
Reads the spline histograms from the file given in the config, and stores them in m_ptCorrFactors.
Definition: GlobalNNCalibration.cxx:164
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
TH1
Definition: rootspy.cxx:268
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
GlobalNNCalibration::getJESPt
double getJESPt(const xAOD::Jet &jet_reco) const
Returns the jet pT after the MCJES calibration.
Definition: GlobalNNCalibration.cxx:341
CaloCell_ID_FCS::FCAL2
@ FCAL2
Definition: FastCaloSim_CaloCell_ID.h:42
JetCalibUtils::VectorizeD
VecD VectorizeD(const TString &str, const TString &sep=" ")
Definition: JetCalibUtils.cxx:25
GlobalNNCalibration::m_closureEtaBins
std::vector< double > m_closureEtaBins
Definition: GlobalNNCalibration.h:150
CaloCell_ID_FCS::HEC3
@ HEC3
Definition: FastCaloSim_CaloCell_ID.h:30
Ringer::EM1
@ EM1
Definition: CaloRingsDefs.h:47
GlobalNNCalibration::getJetWtrk1000
double getJetWtrk1000(const xAOD::Jet &jet_reco) const
Returns the jet width.
Definition: GlobalNNCalibration.cxx:333
CaloCell_ID_FCS::FCAL0
@ FCAL0
Definition: FastCaloSim_CaloCell_ID.h:40
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
JetCalibrationStep::m_GeV
double m_GeV
Definition: JetCalibrationStep.h:40
GlobalNNCalibration::m_dev
bool m_dev
Definition: GlobalNNCalibration.h:157