|
ATLAS Offline Software
|
Tool to provide the global NN calibration for jets.
More...
#include <GlobalNNCalibration.h>
|
double | getJetChargedFraction (const xAOD::Jet &jet_reco, int PVindex) 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, int PVindex) const |
| Returns the number of tracks with pT > 1 GeV associated to the jet. More...
|
|
double | getJetWtrk1000 (const xAOD::Jet &jet_reco, int PVindex) 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...
|
|
Tool to provide the global NN calibration for jets.
- Author
- Jennifer Roloff
- Date
- August 2021
Definition at line 35 of file GlobalNNCalibration.h.
◆ 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.
◆ 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
-
name | The name of the tool being created |
Definition at line 38 of file GlobalNNCalibration.cxx.
◆ 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
-
name | The name of the tool being created |
config | The name of the config file for the calibration |
jetAlgo | The name of the jet collection |
calibAreaTag | The tag for this calibration |
dev | A flag for if the calibration is run in development mode |
Definition at line 44 of file GlobalNNCalibration.cxx.
◆ ~GlobalNNCalibration()
virtual GlobalNNCalibration::~GlobalNNCalibration |
( |
| ) |
|
|
virtualdefault |
◆ calibrate()
◆ 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_reco | The jet |
etaBins | A list of bin edges |
Definition at line 303 of file GlobalNNCalibration.cxx.
304 double detEta = jet_reco.
getAttribute<
float>(
"DetectorEta");
305 for(
unsigned int i=1;
i<
etaBins.size()-1;
i++){
306 if(std::abs(detEta) <
etaBins[
i])
return i-1;
◆ getJESPt()
double GlobalNNCalibration::getJESPt |
( |
const xAOD::Jet & |
jet_reco | ) |
const |
|
private |
Returns the jet pT after the MCJES calibration.
- Parameters
-
Definition at line 344 of file GlobalNNCalibration.cxx.
345 return jet_reco.
jetP4(
"JetEtaJESScaleMomentum").pt() / 1.e3;
◆ getJetChargedFraction()
double GlobalNNCalibration::getJetChargedFraction |
( |
const xAOD::Jet & |
jet_reco, |
|
|
int |
PVindex |
|
) |
| const |
|
private |
Returns the charged fraction of a jet.
- Parameters
-
jet_reco | The jet |
PVindex | The index of the PV in the PrimaryVertices container |
Definition at line 313 of file GlobalNNCalibration.cxx.
315 if( SumPtChargedPFOPt500Acc.isAvailable(jet_reco) ) {
316 float thisChargedFraction = SumPtChargedPFOPt500Acc(jet_reco).at(PVindex);
318 return double(thisChargedFraction);
◆ getJetDetEta()
double GlobalNNCalibration::getJetDetEta |
( |
const xAOD::Jet & |
jet_reco | ) |
const |
|
private |
Returns the detector eta of the jet.
- Parameters
-
Definition at line 324 of file GlobalNNCalibration.cxx.
326 return DetectorEtaAcc.withDefault (jet_reco, -999);
◆ 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_reco | The jet |
jetEventInfo | A set of information about the event and jet |
Definition at line 223 of file GlobalNNCalibration.cxx.
224 std::vector<float> samplingFrac = jet_reco.
getAttribute<std::vector<float> >(
"EnergyPerSampling");
228 jetStartP4 = jet_reco.
jetP4();
230 float jetE_constitscale = jetconstitP4.e();
233 int PVindex = jetEventInfo.
PVIndex();
238 float EM0 = (samplingFrac[0]+samplingFrac[4])/jetE_constitscale;
239 float EM1 = (samplingFrac[1]+samplingFrac[5])/jetE_constitscale;
240 float EM2 = (samplingFrac[2]+samplingFrac[6])/jetE_constitscale;
241 float EM3 = (samplingFrac[3]+samplingFrac[7])/jetE_constitscale;
242 float Tile0 = (samplingFrac[12]+samplingFrac[18])/jetE_constitscale;
243 float Tile1 = (samplingFrac[13]+samplingFrac[19])/jetE_constitscale;
244 float Tile2 = (samplingFrac[14]+samplingFrac[20])/jetE_constitscale;
245 float HEC0 = (samplingFrac[8])/jetE_constitscale;
246 float HEC1 = (samplingFrac[9])/jetE_constitscale;
247 float HEC2 = (samplingFrac[10])/jetE_constitscale;
248 float HEC3 = (samplingFrac[11])/jetE_constitscale;
250 float FCAL0 = (samplingFrac[21])/jetE_constitscale;
251 float FCAL1 = (samplingFrac[22])/jetE_constitscale;
252 float FCAL2 = (samplingFrac[23])/jetE_constitscale;
257 std::map<std::string,double> inputValues;
263 inputValues[
"jet_pt"] = log10(
getJESPt(jet_reco));
266 inputValues[
"jet_pt"] =
getJESPt(jet_reco);
268 inputValues[
"EM0"] = EM0;
269 inputValues[
"EM1"] =
EM1;
270 inputValues[
"EM2"] =
EM2;
271 inputValues[
"EM3"] =
EM3;
272 inputValues[
"TILE0"] = Tile0;
273 inputValues[
"TILE1"] = Tile1;
274 inputValues[
"TILE2"] = Tile2;
275 inputValues[
"HEC0"] =
HEC0;
276 inputValues[
"HEC1"] =
HEC1;
277 inputValues[
"HEC2"] =
HEC2;
278 inputValues[
"HEC3"] =
HEC3;
279 inputValues[
"FCAL0"] =
FCAL0;
280 inputValues[
"FCAL1"] =
FCAL1;
281 inputValues[
"FCAL2"] =
FCAL2;
286 inputValues[
"jet_n90Constituents"] = jet_reco.
getAttribute<
float>(
"N90Constituents");
287 inputValues[
"jet_nMuSeg"] = jet_reco.
getAttribute<
int>(
"GhostMuonSegmentCount");
288 inputValues[
"NPV"] = jetEventInfo.
NPV();
289 inputValues[
"averageInteractionsPerCrossing"] = jetEventInfo.
mu();
292 std::map<std::string,double> NNInputValues;
294 NNInputValues[
input.Data()] = inputValues[
input.Data()];
297 return NNInputValues;
◆ getJetNtrk1000()
int GlobalNNCalibration::getJetNtrk1000 |
( |
const xAOD::Jet & |
jet_reco, |
|
|
int |
PVindex |
|
) |
| const |
|
private |
Returns the number of tracks with pT > 1 GeV associated to the jet.
- Parameters
-
jet_reco | The jet |
PVindex | The index of the PV in the PrimaryVertices container |
Definition at line 329 of file GlobalNNCalibration.cxx.
331 if(NumTrkPt1000Acc.isAvailable(jet_reco))
332 return NumTrkPt1000Acc(jet_reco).at(PVindex);
◆ getJetWtrk1000()
double GlobalNNCalibration::getJetWtrk1000 |
( |
const xAOD::Jet & |
jet_reco, |
|
|
int |
PVindex |
|
) |
| const |
|
private |
Returns the jet width.
- Parameters
-
jet_reco | The jet |
PVindex | The index of the PV in the PrimaryVertices container |
Definition at line 336 of file GlobalNNCalibration.cxx.
338 if(TrackWidthPt1000Acc.isAvailable(jet_reco))
339 return double(TrackWidthPt1000Acc(jet_reco).at(PVindex));
◆ getNominalResolutionData()
StatusCode JetCalibrationStep::getNominalResolutionData |
( |
const xAOD::Jet & |
, |
|
|
double & |
|
|
) |
| const |
|
virtualinherited |
◆ getNominalResolutionMC()
StatusCode JetCalibrationStep::getNominalResolutionMC |
( |
const xAOD::Jet & |
, |
|
|
double & |
|
|
) |
| const |
|
virtualinherited |
◆ 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
-
Definition at line 190 of file GlobalNNCalibration.cxx.
198 double R = slope*(
pT-ptCutoff)+Rcutoff;
◆ 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
-
ieta | The eta bin for the spline histogram |
minPt | The pT at which the extrapolation starts, and where the slope should be calculated |
Definition at line 208 of file GlobalNNCalibration.cxx.
215 double slope = (rSecond - rFirst) /
binWidth;
◆ initialize()
StatusCode GlobalNNCalibration::initialize |
( |
| ) |
|
|
overridevirtual |
Returns the charged fraction of a jet.
- Parameters
-
name | The name of the tool being created |
Implements JetCalibrationStep.
Definition at line 52 of file GlobalNNCalibration.cxx.
65 if (
m_jetAlgo.EqualTo(
"") ) {
ATH_MSG_FATAL(
"No jet algorithm specified. Aborting.");
return StatusCode::FAILURE; }
68 TString MLGSCFile =
m_config->GetValue(
"GNNC.MLFactorsFile",
"empty");
69 if ( MLGSCFile.EqualTo(
"empty") ) {
71 return StatusCode::FAILURE;
74 MLGSCFile.Remove(0,33);
75 MLGSCFile.Insert(0,
"JetCalibTools/");
85 m_lwnns.push_back(std::move(lwnn));
92 TString ptCalibHists =
m_config->GetValue(
"GNNC.JPtS_CalibHists",
"");
94 ptCalibHists.Remove(0,33);
95 ptCalibHists.Insert(0,
"JetCalibTools/");
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;
121 return StatusCode::SUCCESS;
◆ 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.
◆ 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
-
Definition at line 164 of file GlobalNNCalibration.cxx.
165 std::unique_ptr<TFile> tmpF(TFile::Open(
fileName ));
166 TList *ptCorr_l =
dynamic_cast<TList*
>( tmpF->Get(ptCorr_name.c_str()));
168 ATH_MSG_ERROR(
"TList pointer is null in GlobalNNCalibration::loadSplineHists");
173 int nBinsCorr = ptCorr_l->GetSize();
176 ATH_MSG_WARNING(
"Do not have the correct number of eta bins for " <<
fileName <<
"\t" << ptCorr_name <<
"\t" << ptCorr_l->GetSize() );
180 auto *pTH1 =
dynamic_cast<TH1*
>(ptCorr_l->At(
i));
181 if (not pTH1)
continue;
◆ 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.
50 #ifndef XAOD_STANDALONE
52 #else // not XAOD_STANDALONE
54 #endif // not XAOD_STANDALONE
◆ msg() [2/2]
MsgStream & asg::AsgMessaging::msg |
( |
const MSG::Level |
lvl | ) |
const |
|
inherited |
The standard message stream.
- Parameters
-
lvl | The 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.
58 #ifndef XAOD_STANDALONE
60 #else // not XAOD_STANDALONE
63 #endif // not XAOD_STANDALONE
◆ msgLvl()
bool asg::AsgMessaging::msgLvl |
( |
const MSG::Level |
lvl | ) |
const |
|
inherited |
Test the output level of the object.
- Parameters
-
lvl | The 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.
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
◆ setLevel()
void AthMessaging::setLevel |
( |
MSG::Level |
lvl | ) |
|
|
inherited |
◆ setStartP4()
StatusCode JetCalibrationStep::setStartP4 |
( |
xAOD::Jet & |
jet | ) |
const |
|
protectedvirtualinherited |
Definition at line 21 of file JetCalibrationStep.cxx.
24 return StatusCode::SUCCESS;
27 return StatusCode::SUCCESS;
30 return StatusCode::FAILURE;
◆ setUnitsGeV()
virtual void JetCalibrationStep::setUnitsGeV |
( |
bool |
useGeV | ) |
|
|
inlinevirtualinherited |
◆ ATLAS_THREAD_SAFE
std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT |
|
mutableprivateinherited |
◆ m_calibAreaTag
std::string GlobalNNCalibration::m_calibAreaTag |
|
private |
◆ m_closureEtaBins
std::vector<double> GlobalNNCalibration::m_closureEtaBins |
|
private |
◆ m_config
TEnv* GlobalNNCalibration::m_config {} |
|
private |
◆ m_dev
bool GlobalNNCalibration::m_dev {} |
|
private |
◆ m_doLogPtScaling
bool GlobalNNCalibration::m_doLogPtScaling {} |
|
private |
◆ m_doSplineCorr
bool GlobalNNCalibration::m_doSplineCorr {true} |
|
private |
◆ m_GeV
double JetCalibrationStep::m_GeV |
|
protectedinherited |
◆ m_imsg
std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr } |
|
mutableprivateinherited |
◆ m_jetAlgo
TString GlobalNNCalibration::m_jetAlgo |
|
private |
◆ m_jetStartScale
std::string JetCalibrationStep::m_jetStartScale |
|
protectedinherited |
◆ m_JPtS_MinPt_Pt
std::vector<double> GlobalNNCalibration::m_JPtS_MinPt_Pt |
|
private |
◆ m_JPtS_MinPt_R
std::vector<double> GlobalNNCalibration::m_JPtS_MinPt_R |
|
private |
◆ m_JPtS_MinPt_Slopes
std::vector<double> GlobalNNCalibration::m_JPtS_MinPt_Slopes |
|
private |
◆ m_lvl
std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL } |
|
mutableprivateinherited |
◆ m_lwnns
std::vector<std::unique_ptr<lwt::LightweightGraph> > GlobalNNCalibration::m_lwnns |
|
private |
◆ m_maxNNCorrection
double GlobalNNCalibration::m_maxNNCorrection {} |
|
private |
◆ m_minNNCorrection
double GlobalNNCalibration::m_minNNCorrection {} |
|
private |
◆ 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 |
◆ m_nm
std::string AthMessaging::m_nm |
|
privateinherited |
◆ m_nnEtaBins
std::vector<double> GlobalNNCalibration::m_nnEtaBins |
|
private |
◆ m_NNInputs
std::vector<TString> GlobalNNCalibration::m_NNInputs |
|
private |
◆ m_ptCorrFactors
std::vector<std::unique_ptr<TH1> > GlobalNNCalibration::m_ptCorrFactors |
|
private |
The documentation for this class was generated from the following files:
std::atomic< MSG::Level > m_lvl
Current logging level.
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.
std::vector< double > m_JPtS_MinPt_Slopes
std::vector< TString > m_NNInputs
constexpr unsigned nEtaBins
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.
double getJetChargedFraction(const xAOD::Jet &jet_reco, int PVindex) const
Returns the charged fraction of a jet.
JetFourMom_t jetP4() const
The full 4-momentum of the particle : internal jet type.
Helper class to provide constant type-safe access to aux data.
int getJetNtrk1000(const xAOD::Jet &jet_reco, int PVindex) const
Returns the number of tracks with pT > 1 GeV associated to the jet.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::vector< double > m_JPtS_MinPt_Pt
bool getAttribute(AttributeID type, T &value) const
Retrieve attribute moment by enum.
StrV Vectorize(const TString &str, const TString &sep=" ")
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.
IMessageSvc * getMessageSvc(bool quiet=false)
std::string m_calibAreaTag
@ JetConstitScaleMomentum
std::vector< double > m_JPtS_MinPt_R
JetCalibrationStep(const char *name="JetCalibrationStep")
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap etaBin
std::vector< std::unique_ptr< TH1 > > m_ptCorrFactors
std::vector< double > m_nnEtaBins
double getJetWtrk1000(const xAOD::Jet &jet_reco, int PVindex) const
Returns the jet width.
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)
double getSplineCorr(const int etaBin, double E) const
Returns the correction from spline histogram, which should be applied after the NN correction.
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
std::string m_jetStartScale
double getJetDetEta(const xAOD::Jet &jet_reco) const
Returns the detector eta of the jet.
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
GraphConfig parse_json_graph(std::istream &json)
std::vector< std::unique_ptr< lwt::LightweightGraph > > m_lwnns
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.
#define ATH_MSG_WARNING(x)
std::string m_nm
Message source name.
double getJESPt(const xAOD::Jet &jet_reco) const
Returns the jet pT after the MCJES calibration.
VecD VectorizeD(const TString &str, const TString &sep=" ")
std::vector< double > m_closureEtaBins