#include <JetSmearingCorrection.h>
|
enum | SmearType { SmearType::UNKNOWN =0,
SmearType::Pt,
SmearType::Mass,
SmearType::FourVec
} |
|
enum | HistType { HistType::UNKNOWN =0,
HistType::Pt,
HistType::PtEta,
HistType::PtAbsEta
} |
|
enum | InterpType {
InterpType::UNKNOWN =0,
InterpType::Full,
InterpType::None,
InterpType::OnlyX,
InterpType::OnlyY
} |
|
|
StatusCode | getSigmaSmear (xAOD::Jet &jet, double &sigmaSmear) const |
|
StatusCode | getNominalResolution (const xAOD::Jet &jet, const TH1 *histo, const std::vector< std::unique_ptr< TH1 > > &projections, double &resolution) const |
|
StatusCode | readHisto (double &returnValue, const TH1 *histo, double x) const |
|
StatusCode | readHisto (double &returnValue, const TH1 *histo, const std::vector< std::unique_ptr< TH1 > > &projections, double x, double y) const |
|
StatusCode | cacheProjections (TH1 *fullHistogram, std::vector< std::unique_ptr< TH1 > > &cacheLocation, const std::string &type) |
|
TRandom3 * | getTLSRandomGen (unsigned long seed) const |
|
void | initMessaging () const |
| Initialize our message level and MessageSvc. More...
|
|
Definition at line 22 of file JetSmearingCorrection.h.
◆ HistType
◆ InterpType
◆ SmearType
◆ JetSmearingCorrection() [1/2]
JetSmearingCorrection::JetSmearingCorrection |
( |
| ) |
|
◆ JetSmearingCorrection() [2/2]
JetSmearingCorrection::JetSmearingCorrection |
( |
const std::string & |
name, |
|
|
TEnv * |
config, |
|
|
TString |
jetAlgo, |
|
|
TString |
calibAreaTag, |
|
|
bool |
dev |
|
) |
| |
◆ ~JetSmearingCorrection()
JetSmearingCorrection::~JetSmearingCorrection |
( |
| ) |
|
|
virtualdefault |
◆ cacheProjections()
StatusCode JetSmearingCorrection::cacheProjections |
( |
TH1 * |
fullHistogram, |
|
|
std::vector< std::unique_ptr< TH1 > > & |
cacheLocation, |
|
|
const std::string & |
type |
|
) |
| |
|
private |
Definition at line 476 of file JetSmearingCorrection.cxx.
482 return StatusCode::FAILURE;
486 if (fullHistogram->GetDimension() < 1 || fullHistogram->GetDimension() > 2)
488 ATH_MSG_FATAL(
"Unsupported histogram dimensionality for projection caching: " << fullHistogram->GetDimension());
489 return StatusCode::FAILURE;
497 if (fullHistogram->GetDimension() == 1)
498 return StatusCode::SUCCESS;
503 if (fullHistogram->GetDimension() == 1)
506 return StatusCode::FAILURE;
512 return StatusCode::FAILURE;
520 if (fullHistogram->GetDimension() == 2)
522 TH2* localHist =
dynamic_cast<TH2*
>(fullHistogram);
525 ATH_MSG_FATAL(
"Failed to convert histogram to a TH2, please check inputs: " <<
type);
526 return StatusCode::FAILURE;
530 for (Long64_t
binY = 0;
binY < localHist->GetNbinsY()+1; ++
binY)
533 cacheLocation.emplace_back(localHist->ProjectionX(Form(
"projx_%s_%lld",
type.c_str(),
binY),
binY,
binY));
538 for (Long64_t
binX = 0;
binX < localHist->GetNbinsX()+1; ++
binX)
541 cacheLocation.emplace_back(localHist->ProjectionY(Form(
"projy_%s_%lld",
type.c_str(),
binX),
binX,
binX));
547 ATH_MSG_FATAL(
"Unexpected interpolation type, somehow escaped earlier checks: " <<
type);
548 return StatusCode::FAILURE;
554 ATH_MSG_FATAL(
"Unexpected dimensionality: " << fullHistogram->GetDimension());
555 return StatusCode::FAILURE;
559 for (
auto&
hist : cacheLocation)
561 hist->SetDirectory(
nullptr);
565 return StatusCode::SUCCESS;
◆ calibrate()
Implements JetCalibrationStep.
Definition at line 424 of file JetSmearingCorrection.cxx.
429 double sigmaSmear = 0;
431 return StatusCode::FAILURE;
434 unsigned long seed =
static_cast<unsigned long>(1.e5*fabs(
jet.phi()));
436 if(seed == 0)
seed = 45583453;
442 double smearingFactor = -1;
443 while (smearingFactor < 0)
444 smearingFactor =
rng->Gaus(1.,sigmaSmear);
464 ATH_MSG_ERROR(
"Cannot smear the jet, the smearing type was not set");
465 return StatusCode::FAILURE;
470 jet.setJetP4(calibP4);
473 return StatusCode::SUCCESS;
◆ getNominalResolution()
StatusCode JetSmearingCorrection::getNominalResolution |
( |
const xAOD::Jet & |
jet, |
|
|
const TH1 * |
histo, |
|
|
const std::vector< std::unique_ptr< TH1 > > & |
projections, |
|
|
double & |
resolution |
|
) |
| const |
|
private |
Definition at line 371 of file JetSmearingCorrection.cxx.
378 return StatusCode::FAILURE;
383 return StatusCode::FAILURE;
388 return StatusCode::FAILURE;
393 ATH_MSG_ERROR(
"Cannot get the nominal resolution, the smearing histogram type was not set");
394 return StatusCode::FAILURE;
400 return StatusCode::SUCCESS;
◆ getNominalResolutionData()
StatusCode JetSmearingCorrection::getNominalResolutionData |
( |
const xAOD::Jet & |
jet, |
|
|
double & |
resolution |
|
) |
| const |
|
overridevirtual |
◆ getNominalResolutionMC()
StatusCode JetSmearingCorrection::getNominalResolutionMC |
( |
const xAOD::Jet & |
jet, |
|
|
double & |
resolution |
|
) |
| const |
|
overridevirtual |
◆ getSigmaSmear()
StatusCode JetSmearingCorrection::getSigmaSmear |
( |
xAOD::Jet & |
jet, |
|
|
double & |
sigmaSmear |
|
) |
| const |
|
private |
Definition at line 336 of file JetSmearingCorrection.cxx.
352 double resolutionMC = 0;
354 return StatusCode::FAILURE;
356 double resolutionData = 0;
358 return StatusCode::FAILURE;
363 if (resolutionMC < resolutionData)
364 sigmaSmear = sqrt(resolutionData*resolutionData - resolutionMC*resolutionMC);
368 return StatusCode::SUCCESS;
◆ getTLSRandomGen()
TRandom3 * JetSmearingCorrection::getTLSRandomGen |
( |
unsigned long |
seed | ) |
const |
|
private |
◆ initialize()
StatusCode JetSmearingCorrection::initialize |
( |
| ) |
|
|
overridevirtual |
Implements JetCalibrationStep.
Definition at line 46 of file JetSmearingCorrection.cxx.
48 ATH_MSG_INFO(
"Initializing the jet smearing correction tool");
53 return StatusCode::FAILURE;
58 return StatusCode::FAILURE;
67 TString smearType =
m_config->GetValue(
"SmearType",
"");
70 ATH_MSG_FATAL(
"No jet smearing type was specified. Aborting.");
71 return StatusCode::FAILURE;
73 else if (!smearType.CompareTo(
"pt",TString::kIgnoreCase))
75 else if (!smearType.CompareTo(
"mass",TString::kIgnoreCase))
77 else if (!smearType.CompareTo(
"FourVec",TString::kIgnoreCase))
81 ATH_MSG_FATAL(
"Unrecognized jet smearing type: " << smearType.Data());
82 return StatusCode::FAILURE;
86 TString histType =
m_config->GetValue(
"SmearingCorrectionHistType",
"");
89 ATH_MSG_FATAL(
"No jet smearing histogram parametrization was specified. Aborting.");
90 return StatusCode::FAILURE;
92 else if (!histType.CompareTo(
"pt",TString::kIgnoreCase))
94 else if (!histType.CompareTo(
"PtEta",TString::kIgnoreCase))
96 else if (!histType.CompareTo(
"PtAbsEta",TString::kIgnoreCase))
100 ATH_MSG_FATAL(
"Unrecognized jet smearing histogram parametrization: " << histType.Data());
101 return StatusCode::FAILURE;
105 TString interpType =
m_config->GetValue(
"SmearingCorrectionInterpType",
"");
106 if (interpType ==
"")
108 ATH_MSG_FATAL(
"No jet smearing histogram interpolation type was specified. Aborting.");
109 return StatusCode::FAILURE;
111 else if (!interpType.CompareTo(
"full",TString::kIgnoreCase))
113 else if (!interpType.CompareTo(
"none",TString::kIgnoreCase))
115 else if (!interpType.CompareTo(
"onlyx",TString::kIgnoreCase))
117 else if (!interpType.CompareTo(
"onlyy",TString::kIgnoreCase))
121 ATH_MSG_FATAL(
"Unrecognized jet smearing interpolation type: " << interpType.Data());
122 return StatusCode::FAILURE;
126 TString smearingFile =
m_config->GetValue(
"SmearingCorrectionFile",
"");
127 if (smearingFile ==
"")
129 ATH_MSG_FATAL(
"No jet smearing correction file specified. Aborting.");
130 return StatusCode::FAILURE;
134 TString smearingHistNameMC =
m_config->GetValue(
"SmearingHistNameResolutionMC",
"");
135 if (smearingHistNameMC ==
"")
137 ATH_MSG_FATAL(
"No MC jet smearing histogram name specified. Aborting.");
138 return StatusCode::FAILURE;
140 TString smearingHistNameData =
m_config->GetValue(
"SmearingHistNameResolutionData",
"");
141 if (smearingHistNameData ==
"")
143 ATH_MSG_FATAL(
"No data jet smearing histogram name specified. Aborting.");
144 return StatusCode::FAILURE;
150 smearingFile.Remove(0,33);
151 smearingFile.Insert(0,
"JetCalibTools/");
161 return StatusCode::FAILURE;
168 ATH_MSG_FATAL(
"Failed to get specified histogram from the file: " << smearingHistNameMC.Data());
169 return StatusCode::FAILURE;
176 ATH_MSG_FATAL(
"Failed to get specified histogram from the file: " << smearingHistNameData.Data());
177 return StatusCode::FAILURE;
192 return StatusCode::FAILURE;
197 return StatusCode::FAILURE;
206 return StatusCode::FAILURE;
211 return StatusCode::FAILURE;
216 ATH_MSG_FATAL(
"Read the histogram, but the parametrization is UNKNOWN");
217 return StatusCode::FAILURE;
224 return StatusCode::FAILURE;
226 return StatusCode::FAILURE;
229 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.
◆ 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
◆ readHisto() [1/2]
StatusCode JetSmearingCorrection::readHisto |
( |
double & |
returnValue, |
|
|
const TH1 * |
histo, |
|
|
const std::vector< std::unique_ptr< TH1 > > & |
projections, |
|
|
double |
x, |
|
|
double |
y |
|
) |
| const |
|
private |
Definition at line 276 of file JetSmearingCorrection.cxx.
282 return StatusCode::FAILURE;
286 if (
histo->GetDimension() != 2)
288 ATH_MSG_ERROR(
"Blocking reading of a " <<
histo->GetDimension() <<
"D histogram as a 2D histogram");
289 return StatusCode::FAILURE;
293 const double minX =
histo->GetXaxis()->GetBinLowEdge(1);
294 const double maxX =
histo->GetXaxis()->GetBinLowEdge(
histo->GetNbinsX()+1);
297 else if (
x <= minX )
299 const double minY =
histo->GetYaxis()->GetBinLowEdge(1);
300 const double maxY =
histo->GetYaxis()->GetBinLowEdge(
histo->GetNbinsY()+1);
303 else if (
y <= minY )
310 returnValue =
histo->Interpolate(
x,
y);
314 returnValue =
histo->GetBinContent(
histo->GetXaxis()->FindBin(
x),
histo->GetYaxis()->FindBin(
y));
319 returnValue = projections.at(
histo->GetYaxis()->FindBin(
y))->Interpolate(
x);
324 returnValue = projections.at(
histo->GetXaxis()->FindBin(
x))->Interpolate(
y);
328 ATH_MSG_ERROR(
"Unsupported interpolation type for a 2D histogram");
329 return StatusCode::FAILURE;
332 return StatusCode::SUCCESS;
◆ readHisto() [2/2]
StatusCode JetSmearingCorrection::readHisto |
( |
double & |
returnValue, |
|
|
const TH1 * |
histo, |
|
|
double |
x |
|
) |
| const |
|
private |
Definition at line 232 of file JetSmearingCorrection.cxx.
238 return StatusCode::FAILURE;
242 if (
histo->GetDimension() != 1)
244 ATH_MSG_ERROR(
"Blocking reading of a " <<
histo->GetDimension() <<
"D histogram as a 1D histogram");
245 return StatusCode::FAILURE;
249 const double minX =
histo->GetXaxis()->GetBinLowEdge(1);
250 const double maxX =
histo->GetXaxis()->GetBinLowEdge(
histo->GetNbinsX()+1);
253 else if (
x <= minX )
261 returnValue =
histo->Interpolate(
x);
265 returnValue =
histo->GetBinContent(
histo->GetXaxis()->FindBin(
x));
269 ATH_MSG_ERROR(
"Unsupported interpolation type for a 1D histogram");
270 return StatusCode::FAILURE;
273 return StatusCode::SUCCESS;
◆ 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_cachedProjResData
std::vector< std::unique_ptr<TH1> > JetSmearingCorrection::m_cachedProjResData |
|
private |
◆ m_cachedProjResMC
std::vector< std::unique_ptr<TH1> > JetSmearingCorrection::m_cachedProjResMC |
|
private |
◆ m_calibAreaTag
const TString JetSmearingCorrection::m_calibAreaTag |
|
private |
◆ m_config
TEnv* JetSmearingCorrection::m_config |
|
private |
◆ m_dev
const bool JetSmearingCorrection::m_dev |
|
private |
◆ m_GeV
double JetCalibrationStep::m_GeV |
|
protectedinherited |
◆ m_histType
HistType JetSmearingCorrection::m_histType |
|
private |
◆ m_imsg
std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr } |
|
mutableprivateinherited |
◆ m_interpType
◆ m_jetAlgo
const TString JetSmearingCorrection::m_jetAlgo |
|
private |
◆ m_jetOutScale
TString JetSmearingCorrection::m_jetOutScale |
|
private |
◆ m_jetStartScale
std::string JetCalibrationStep::m_jetStartScale |
|
protectedinherited |
◆ m_lvl
std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL } |
|
mutableprivateinherited |
◆ 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_rand_tls
boost::thread_specific_ptr<TRandom3> JetSmearingCorrection::m_rand_tls |
|
mutableprivate |
◆ m_smearResolutionData
std::unique_ptr<TH1> JetSmearingCorrection::m_smearResolutionData |
|
private |
◆ m_smearResolutionMC
std::unique_ptr<TH1> JetSmearingCorrection::m_smearResolutionMC |
|
private |
◆ m_smearType
The documentation for this class was generated from the following files: