ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
jet::PileupUncertaintyComponent Class Reference

#include <PileupUncertaintyComponent.h>

Inheritance diagram for jet::PileupUncertaintyComponent:
Collaboration diagram for jet::PileupUncertaintyComponent:

Public Member Functions

 PileupUncertaintyComponent (const ComponentHelper &component, const float refNPV, const float refMu)
 
 PileupUncertaintyComponent (const ComponentHelper &component, const UncertaintyHistogram *refNPV, const UncertaintyHistogram *refMu)
 
 PileupUncertaintyComponent (const ComponentHelper &component, const UncertaintyHistogram *refNPV, const float refMu)
 
 PileupUncertaintyComponent (const ComponentHelper &component, const float refNPV, const UncertaintyHistogram *refMu)
 
 PileupUncertaintyComponent (const PileupUncertaintyComponent &toCopy)
 
virtual PileupUncertaintyComponentclone () const
 
virtual ~PileupUncertaintyComponent ()
 
virtual StatusCode initialize (TFile *histFile)
 
virtual PileupComp::TypeEnum getPileupType () const
 
virtual float getNPVRef () const
 
virtual float getMuRef () const
 
virtual TString getName () const
 
virtual TString getValidName () const
 
virtual CompScaleVar::TypeEnum getScaleVar () const
 
virtual JetTopology::TypeEnum getTopology () const
 
virtual bool isAlwaysZero () const
 
virtual bool getValidity (const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
 
virtual double getUncertainty (const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
 
virtual bool getValidUncertainty (double &unc, const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Protected Member Functions

virtual bool getValidityImpl (const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
 
virtual double getUncertaintyImpl (const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
 
virtual bool getValidBool (const double validity) const
 
virtual double getSplitFactor (const xAOD::Jet &jet) const
 
virtual double getAbsMass (const xAOD::Jet &jet, const CompMassDef::TypeEnum massDef) const
 
virtual double getMassOverPt (const xAOD::Jet &jet, const CompMassDef::TypeEnum massDef) const
 
virtual double getMassOverE (const xAOD::Jet &jet, const CompMassDef::TypeEnum massDef) const
 

Protected Attributes

bool m_isInit
 
const TString m_uncHistName
 
const TString m_validHistName
 
const CompScaleVar::TypeEnum m_scaleVar
 
const JetTopology::TypeEnum m_topology
 
const float m_energyScale
 
const Interpolate::TypeEnum m_interpolate
 
const int m_splitNumber
 
int m_numExpectedHist
 
UncertaintyHistogramm_uncHist
 
UncertaintyHistogramm_validHist
 

Private Types

enum  PileupRefType { PileupRef_UNKNOWN, PileupRef_NONE, PileupRef_NPV, PileupRef_MU }
 

Private Member Functions

 PileupUncertaintyComponent (const std::string &name="")
 
double getPileupWeight (const xAOD::Jet &jet, const xAOD::EventInfo &eInfo, const PileupRefType refType) const
 
void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

const PileupComp::TypeEnum m_pileupType
 
const float m_refNPV
 
const float m_refMu
 
const UncertaintyHistogramm_refNPVHist
 
const UncertaintyHistogramm_refMuHist
 
const bool m_absEta
 
const TString m_secondUncName
 
UncertaintyHistogramm_secondUncHist
 
PileupRefType m_refType
 
PileupRefType m_secondRefType
 
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

Definition at line 13 of file PileupUncertaintyComponent.h.

Member Enumeration Documentation

◆ PileupRefType

Enumerator
PileupRef_UNKNOWN 
PileupRef_NONE 
PileupRef_NPV 
PileupRef_MU 

Definition at line 53 of file PileupUncertaintyComponent.h.

Constructor & Destructor Documentation

◆ PileupUncertaintyComponent() [1/6]

jet::PileupUncertaintyComponent::PileupUncertaintyComponent ( const ComponentHelper component,
const float  refNPV,
const float  refMu 
)

Definition at line 35 of file PileupUncertaintyComponent.cxx.

39  : UncertaintyComponent(component,component.pileupType == PileupComp::PtTerm ? 2 : 1)
40  , m_pileupType(component.pileupType)
41  , m_refNPV(refNPV)
42  , m_refMu(refMu)
43  , m_refNPVHist(nullptr)
44  , m_refMuHist(nullptr)
45  , m_absEta(CompParametrization::isAbsEta(component.parametrization))
46  , m_secondUncName(component.uncNames.size()>1?component.uncNames.at(1):"")
47  , m_secondUncHist(nullptr)
50 {
51  ATH_MSG_DEBUG("Created PileupUncertaintyComponent named" << m_uncHistName.Data());
52 
53  // Ensure that the pileup type and ref values are sensible
55  ATH_MSG_FATAL("Pileup type is UNKNOWN: " << m_uncHistName.Data());
56  if (m_refNPV <= 0 || m_refMu <= 0)
57  ATH_MSG_FATAL(Form("Unexpected pileup reference values. (NPV,mu)=(%.1f,%.1f) for %s",m_refNPV,m_refMu,m_uncHistName.Data()));
58 }

◆ PileupUncertaintyComponent() [2/6]

jet::PileupUncertaintyComponent::PileupUncertaintyComponent ( const ComponentHelper component,
const UncertaintyHistogram refNPV,
const UncertaintyHistogram refMu 
)

Definition at line 60 of file PileupUncertaintyComponent.cxx.

64  : UncertaintyComponent(component,component.pileupType == PileupComp::PtTerm ? 2 : 1)
65  , m_pileupType(component.pileupType)
66  , m_refNPV(-1)
67  , m_refMu(-1)
68  , m_refNPVHist(refNPV)
69  , m_refMuHist(refMu)
70  , m_absEta(CompParametrization::isAbsEta(component.parametrization))
71  , m_secondUncName(component.uncNames.size()>1?component.uncNames.at(1):"")
72  , m_secondUncHist(nullptr)
75 {
76  ATH_MSG_DEBUG("Created PileupUncertaintyComponent named" << m_uncHistName.Data());
77 
78  // Ensure that the pileup type and ref values are sensible
80  ATH_MSG_FATAL("Pileup type is UNKNOWN: " << m_uncHistName.Data());
81  if (!m_refNPV || !m_refMu)
82  ATH_MSG_FATAL(Form("Unexpected pileup reference values. (NPV,mu)=(%s,%s) for %s",m_refNPVHist?"OK":"NULL",m_refMuHist?"OK":"NULL",m_uncHistName.Data()));
83 }

◆ PileupUncertaintyComponent() [3/6]

jet::PileupUncertaintyComponent::PileupUncertaintyComponent ( const ComponentHelper component,
const UncertaintyHistogram refNPV,
const float  refMu 
)

Definition at line 85 of file PileupUncertaintyComponent.cxx.

89  : UncertaintyComponent(component,component.pileupType == PileupComp::PtTerm ? 2 : 1)
90  , m_pileupType(component.pileupType)
91  , m_refNPV(-1)
92  , m_refMu(refMu)
93  , m_refNPVHist(refNPV)
94  , m_refMuHist(nullptr)
95  , m_absEta(CompParametrization::isAbsEta(component.parametrization))
96  , m_secondUncName(component.uncNames.size()>1?component.uncNames.at(1):"")
97  , m_secondUncHist(nullptr)
100 {
101  ATH_MSG_DEBUG("Created PileupUncertaintyComponent named" << m_uncHistName.Data());
102 
103  // Ensure that the pileup type and ref values are sensible
105  ATH_MSG_FATAL("Pileup type is UNKNOWN: " << m_uncHistName.Data());
106  if (!m_refNPV || m_refMu <= 0)
107  ATH_MSG_FATAL(Form("Unexpected pileup reference values. (NPV,mu)=(%s,%.1f) for %s",m_refNPVHist?"OK":"NULL",m_refMu,m_uncHistName.Data()));
108 }

◆ PileupUncertaintyComponent() [4/6]

jet::PileupUncertaintyComponent::PileupUncertaintyComponent ( const ComponentHelper component,
const float  refNPV,
const UncertaintyHistogram refMu 
)

Definition at line 110 of file PileupUncertaintyComponent.cxx.

114  : UncertaintyComponent(component,component.pileupType == PileupComp::PtTerm ? 2 : 1)
115  , m_pileupType(component.pileupType)
116  , m_refNPV(refNPV)
117  , m_refMu(-1)
118  , m_refNPVHist(nullptr)
119  , m_refMuHist(refMu)
120  , m_absEta(CompParametrization::isAbsEta(component.parametrization))
121  , m_secondUncName(component.uncNames.size()>1?component.uncNames.at(1):"")
122  , m_secondUncHist(nullptr)
125 {
126  ATH_MSG_DEBUG("Created PileupUncertaintyComponent named" << m_uncHistName.Data());
127 
128  // Ensure that the pileup type and ref values are sensible
130  ATH_MSG_FATAL("Pileup type is UNKNOWN: " << m_uncHistName.Data());
131  if (m_refNPV <= 0 || !m_refMu)
132  ATH_MSG_FATAL(Form("Unusual pileup reference values. (NPV,mu)=(%.1f,%s) for %s",m_refNPV,m_refMuHist?"OK":"NULL",m_uncHistName.Data()));
133 }

◆ PileupUncertaintyComponent() [5/6]

jet::PileupUncertaintyComponent::PileupUncertaintyComponent ( const PileupUncertaintyComponent toCopy)

Definition at line 135 of file PileupUncertaintyComponent.cxx.

136  : UncertaintyComponent(toCopy)
137  , m_pileupType(toCopy.m_pileupType)
138  , m_refNPV(toCopy.m_refNPV)
139  , m_refMu(toCopy.m_refMu)
140  , m_refNPVHist(toCopy.m_refNPVHist)
141  , m_refMuHist(toCopy.m_refMuHist)
142  , m_absEta(toCopy.m_absEta)
143  , m_secondUncName(toCopy.m_secondUncName)
144  , m_secondUncHist(nullptr)
145  , m_refType(toCopy.m_refType)
146  , m_secondRefType(toCopy.m_secondRefType)
147 {
148  ATH_MSG_DEBUG(Form("Creating copy of PileupUncertaintyComponent named %s",m_uncHistName.Data()));
149  if (toCopy.m_secondUncHist)
150  m_secondUncHist = new UncertaintyHistogram(*toCopy.m_secondUncHist);
151 }

◆ ~PileupUncertaintyComponent()

jet::PileupUncertaintyComponent::~PileupUncertaintyComponent ( )
virtual

Definition at line 158 of file PileupUncertaintyComponent.cxx.

159 {
161 }

◆ PileupUncertaintyComponent() [6/6]

jet::PileupUncertaintyComponent::PileupUncertaintyComponent ( const std::string &  name = "")
private

Definition at line 19 of file PileupUncertaintyComponent.cxx.

20  : UncertaintyComponent(ComponentHelper(name),0)
22  , m_refNPV(-1)
23  , m_refMu(-1)
24  , m_refNPVHist(nullptr)
25  , m_refMuHist(nullptr)
26  , m_absEta(false)
27  , m_secondUncName("")
28  , m_secondUncHist(nullptr)
31 {
33 }

Member Function Documentation

◆ clone()

PileupUncertaintyComponent * jet::PileupUncertaintyComponent::clone ( ) const
virtual

Implements jet::UncertaintyComponent.

Definition at line 153 of file PileupUncertaintyComponent.cxx.

154 {
155  return new PileupUncertaintyComponent(*this);
156 }

◆ getAbsMass()

double jet::UncertaintyComponent::getAbsMass ( const xAOD::Jet jet,
const CompMassDef::TypeEnum  massDef 
) const
protectedvirtualinherited

Definition at line 309 of file UncertaintyComponent.cxx.

310 {
311  // Check for the simple case (where we want the default four-vector itself)
312  if (massDef == CompMassDef::UNKNOWN || massDef == CompMassDef::FourVecMass)
313  return jet.m();
314 
315  // Not the simple case, check for the specified four-vector instead and return it if it is available
316  JetFourMomAccessor scale(CompMassDef::getJetScaleString(massDef).Data());
317  if (scale.isAvailable(jet))
318  return scale(jet).M();
319 
320  // Fall-back on the TA moment as a float if applicable (legacy support)
321  SG::AuxElement::ConstAccessor<float> scaleTAMoment("JetTrackAssistedMassCalibrated");
322  if (massDef == CompMassDef::TAMass && scaleTAMoment.isAvailable(jet))
323  return scaleTAMoment(jet);
324 
325  // Fall-back on the calo mass as the 4-vec if applicable (legacy support)
326  if (massDef == CompMassDef::CaloMass)
327  return jet.m();
328 
329  // Specified scale is not available, error
330  ATH_MSG_ERROR("Failed to retrieve the " << CompMassDef::enumToString(massDef).Data() << " mass from the jet");
331  return JESUNC_ERROR_CODE;
332 }

◆ getMassOverE()

double jet::UncertaintyComponent::getMassOverE ( const xAOD::Jet jet,
const CompMassDef::TypeEnum  massDef 
) const
protectedvirtualinherited

Definition at line 360 of file UncertaintyComponent.cxx.

361 {
362  // Check for the simple case (where we want the default four-vector itself)
363  if (massDef == CompMassDef::UNKNOWN || massDef == CompMassDef::FourVecMass)
364  return jet.m()/jet.e();
365 
366  // Not the simple case, check for the specified four-vector instead and return it if it is available
367  JetFourMomAccessor scale(CompMassDef::getJetScaleString(massDef).Data());
368  if (scale.isAvailable(jet))
369  return scale(jet).M()/scale(jet).E();
370 
371  // Fall-back on the TA moment as a float if applicable (legacy support)
372  SG::AuxElement::ConstAccessor<float> scaleTAMoment("JetTrackAssistedMassCalibrated");
373  if (massDef == CompMassDef::TAMass && scaleTAMoment.isAvailable(jet))
374  return scaleTAMoment(jet)/jet.e();
375 
376  // Fall-back on the calo mass as the 4-vec if applicable (legacy support)
377  if (massDef == CompMassDef::CaloMass)
378  return jet.m()/jet.e();
379 
380  // Specified scale is not available, error
381  ATH_MSG_ERROR("Failed to retrieve the " << CompMassDef::enumToString(massDef).Data() << " mass from the jet");
382  return JESUNC_ERROR_CODE;
383 
384 }

◆ getMassOverPt()

double jet::UncertaintyComponent::getMassOverPt ( const xAOD::Jet jet,
const CompMassDef::TypeEnum  massDef 
) const
protectedvirtualinherited

Definition at line 334 of file UncertaintyComponent.cxx.

335 {
336  // Check for the simple case (where we want the default four-vector itself)
337  if (massDef == CompMassDef::UNKNOWN || massDef == CompMassDef::FourVecMass)
338  return jet.m()/jet.pt();
339 
340  // Not the simple case, check for the specified four-vector instead and return it if it is available
341  JetFourMomAccessor scale(CompMassDef::getJetScaleString(massDef).Data());
342  if (scale.isAvailable(jet))
343  return scale(jet).M()/scale(jet).Pt();
344 
345  // Fall-back on the TA moment as a float if applicable (legacy support)
346  SG::AuxElement::ConstAccessor<float> scaleTAMoment("JetTrackAssistedMassCalibrated");
347  if (massDef == CompMassDef::TAMass && scaleTAMoment.isAvailable(jet))
348  return scaleTAMoment(jet)/jet.pt();
349 
350  // Fall-back on the calo mass as the 4-vec if applicable (legacy support)
351  if (massDef == CompMassDef::CaloMass)
352  return jet.m()/jet.pt();
353 
354  // Specified scale is not available, error
355  ATH_MSG_ERROR("Failed to retrieve the " << CompMassDef::enumToString(massDef).Data() << " mass from the jet");
356  return JESUNC_ERROR_CODE;
357 
358 }

◆ getMuRef()

virtual float jet::PileupUncertaintyComponent::getMuRef ( ) const
inlinevirtual

Definition at line 41 of file PileupUncertaintyComponent.h.

41 { return m_refMu; }

◆ getName()

virtual TString jet::UncertaintyComponent::getName ( ) const
inlinevirtualinherited

Definition at line 35 of file UncertaintyComponent.h.

35 { return m_uncHistName; }

◆ getNPVRef()

virtual float jet::PileupUncertaintyComponent::getNPVRef ( ) const
inlinevirtual

Definition at line 40 of file PileupUncertaintyComponent.h.

40 { return m_refNPV; }

◆ getPileupType()

virtual PileupComp::TypeEnum jet::PileupUncertaintyComponent::getPileupType ( ) const
inlinevirtual

Definition at line 39 of file PileupUncertaintyComponent.h.

39 { return m_pileupType; }

◆ getPileupWeight()

double jet::PileupUncertaintyComponent::getPileupWeight ( const xAOD::Jet jet,
const xAOD::EventInfo eInfo,
const PileupRefType  refType 
) const
private

Definition at line 247 of file PileupUncertaintyComponent.cxx.

248 {
249  static const SG::AuxElement::Accessor<float> accNPV("NPV");
250 
251  double weight;
252  const float mu = eInfo.averageInteractionsPerCrossing();
253  const float NPV = accNPV.isAvailable(eInfo) ? accNPV(eInfo) : -1;
254 
255  if (NPV <= 0)
256  {
257  ATH_MSG_ERROR("Unexpected number of primary vertices, does EventInfo contain NPV? (NPV="<<NPV<<")");
258  return JESUNC_ERROR_CODE;
259  }
260 
261  if (refType == PileupRef_NPV)
262  weight = NPV - (m_refNPVHist?m_refNPVHist->getValue(fabs(jet.eta())):m_refNPV);
263  else if (refType == PileupRef_MU)
264  weight = mu - (m_refMuHist?m_refMuHist->getValue(fabs(jet.eta())):m_refMu);
265  else if (refType == PileupRef_NONE)
266  weight = 1;
267  else
268  {
269  ATH_MSG_ERROR(Form("Unknown pileup referencetype for component %s",getName().Data()));
270  return JESUNC_ERROR_CODE;
271  }
272 
273  return weight;
274 }

◆ getScaleVar()

virtual CompScaleVar::TypeEnum jet::UncertaintyComponent::getScaleVar ( ) const
inlinevirtualinherited

Definition at line 37 of file UncertaintyComponent.h.

37 { return m_scaleVar; }

◆ getSplitFactor()

double jet::UncertaintyComponent::getSplitFactor ( const xAOD::Jet jet) const
protectedvirtualinherited

Definition at line 196 of file UncertaintyComponent.cxx.

197 {
198  // Immediate return for the most common case
199  if (!m_splitNumber)
200  return 1;
201 
202  // SplitNumber was specified, we have to calculate the factor
203  double splitFactor = 1;
204  const TH1* histo = m_uncHist->getHisto();
205 
206  if (m_splitNumber == 1 || m_splitNumber == -1)
207  {
208  // Straight line in log(pT) from 0 to 1
209  // y = mx+b
210  // m = 1/[log(max)-log(min)]
211  // x = log(min) --> b = -m*log(min)
212 
213  const double minPt = histo->GetXaxis()->GetBinLowEdge(1);
214  const double maxPt = histo->GetXaxis()->GetBinLowEdge(histo->GetNbinsX()+1);
215  const double valPt = jet.pt()*m_energyScale;
216 
217  const double slope = 1./(log(maxPt)-log(minPt));
218  const double intercept = -slope*log(minPt);
219 
220  splitFactor = slope*log(valPt <= minPt ? minPt+1.e-3 : valPt >= maxPt ? maxPt-1.e-3 : valPt)+intercept;
221  }
222  else if (m_splitNumber == 2 || m_splitNumber == -2)
223  {
224  // Straight line in |eta| from 0 to 1
225  // y = mx + b
226  // m = 1/(max - min)
227  // x = min --> b = -m*min
228  const double minEta = 0;
229  const double maxEta = 4.5;
230  const double absEta = fabs(jet.eta());
231 
232  const double slope = 1./(maxEta - minEta);
233  const double intercept = -slope*minEta;
234 
235  splitFactor = slope*(absEta <= minEta ? minEta+1.e-3 : absEta >= maxEta ? maxEta-1.e-3 : absEta)+intercept;
236  }
237  else if (m_splitNumber == 3 || m_splitNumber == -3)
238  {
239  // Increasing with log(pT) and increasing with |eta|
240  // z = mx + ny + c
241  // z(min,min) = 0
242  // z(max,max) = 1
243  // Linear in both dimensions means need factor of 1/2 in a single dimension
244  // m = 0.5/[log(maxPt)-log(minPt)]
245  // n = 0.5/(maxEta - minEta)
246  // c = -minPt*m - minEta*n
247  // 2*z = (logx-logxmin)/(logxmax-logxmin) + (y-ymin)/(ymax-ymin)
248  const double minPt = histo->GetXaxis()->GetBinLowEdge(1);
249  const double maxPt = histo->GetXaxis()->GetBinLowEdge(histo->GetNbinsX()+1);
250  const double valPt = jet.pt()*m_energyScale;
251 
252  const double minEta = 0;
253  const double maxEta = 4.5;
254  const double absEta = fabs(jet.eta());
255 
256  const double slopePt = 1./(log(maxPt)-log(minPt));
257  const double slopeEta = 1./(maxEta-minEta);
258 
259  const double fixedPt = valPt <= minPt ? minPt+1.e-3 : valPt >= maxPt ? maxPt - 1.e-3 : valPt;
260  const double fixedEta = absEta <= minEta ? minEta+1.e-3 : absEta >= maxEta ? maxEta-1.e-3 : absEta;
261 
262  splitFactor = (slopePt*(log(fixedPt)-log(minPt)) + slopeEta*(fixedEta-minEta))/2.;
263  }
264  else if (m_splitNumber == 4 || m_splitNumber == -4)
265  {
266  // Increasing with log(pT) and decreasing with |eta|
267  // See description above, follows similarly
268  // 2*z = (logx-logxmin)/(logxmax-logxmin) + (ymax-y)/(ymax-ymin)
269  const double minPt = histo->GetXaxis()->GetBinLowEdge(1);
270  const double maxPt = histo->GetXaxis()->GetBinLowEdge(histo->GetNbinsX()+1);
271  const double valPt = jet.pt()*m_energyScale;
272 
273  const double minEta = 0;
274  const double maxEta = 4.5;
275  const double absEta = fabs(jet.eta());
276 
277  const double slopePt = 1./(log(maxPt)-log(minPt));
278  const double slopeEta = 1./(maxEta-minEta);
279 
280  const double fixedPt = valPt <= minPt ? minPt+1.e-3 : valPt >= maxPt ? maxPt - 1.e-3 : valPt;
281  const double fixedEta = absEta <= minEta ? minEta+1.e-3 : absEta >= maxEta ? maxEta-1.e-3 : absEta;
282 
283  splitFactor = (slopePt*(log(fixedPt)-log(minPt)) + slopeEta*(maxEta-fixedEta))/2.;
284  }
285 
286 
287  // Now check if this is the functional part or the complementary part
288  if (m_splitNumber < 0)
289  splitFactor = sqrt(1-splitFactor*splitFactor);
290 
291  return splitFactor;
292 }

◆ getTopology()

virtual JetTopology::TypeEnum jet::UncertaintyComponent::getTopology ( ) const
inlinevirtualinherited

Definition at line 38 of file UncertaintyComponent.h.

38 { return m_topology; }

◆ getUncertainty()

double jet::UncertaintyComponent::getUncertainty ( const xAOD::Jet jet,
const xAOD::EventInfo eInfo 
) const
virtualinherited

Definition at line 169 of file UncertaintyComponent.cxx.

170 {
171  if (!m_isInit)
172  {
173  ATH_MSG_ERROR("Component hasn't been initialized: " << getName().Data());
174  return JESUNC_ERROR_CODE;
175  }
176  return getUncertaintyImpl(jet,eInfo)*getSplitFactor(jet);
177 }

◆ getUncertaintyImpl()

double jet::PileupUncertaintyComponent::getUncertaintyImpl ( const xAOD::Jet jet,
const xAOD::EventInfo eInfo 
) const
protectedvirtual

Implements jet::UncertaintyComponent.

Definition at line 239 of file PileupUncertaintyComponent.cxx.

240 {
241  double unc = getPileupWeight(jet,eInfo,m_refType)*m_uncHist->getValue(jet.pt()*m_energyScale,m_absEta ? fabs(jet.eta()) : jet.eta());
243 
244  return unc;
245 }

◆ getValidBool()

bool jet::UncertaintyComponent::getValidBool ( const double  validity) const
protectedvirtualinherited

Definition at line 301 of file UncertaintyComponent.cxx.

302 {
303  if (validity < 1.e-5 && validity > -1.e-5) return false;
304  if (validity < 1+1.e-5 && validity > 1-1.e-5) return true;
305  ATH_MSG_ERROR(Form("Validity value not in expected range: %lf for histogram %s",validity,getValidName().Data()));
306  return false;
307 }

◆ getValidity()

bool jet::UncertaintyComponent::getValidity ( const xAOD::Jet jet,
const xAOD::EventInfo eInfo 
) const
virtualinherited

Definition at line 159 of file UncertaintyComponent.cxx.

160 {
161  if (!m_isInit)
162  {
163  ATH_MSG_ERROR("Component hasn't been initialized: " << getName().Data());
164  return false;
165  }
166  return getValidityImpl(jet,eInfo);
167 }

◆ getValidityImpl()

bool jet::PileupUncertaintyComponent::getValidityImpl ( const xAOD::Jet jet,
const xAOD::EventInfo eInfo 
) const
protectedvirtual

Implements jet::UncertaintyComponent.

Definition at line 234 of file PileupUncertaintyComponent.cxx.

235 {
236  return !m_validHist ? true : getValidBool(m_validHist->getValue(jet.pt()*m_energyScale,m_absEta ? fabs(jet.eta()) : jet.eta()));
237 }

◆ getValidName()

virtual TString jet::UncertaintyComponent::getValidName ( ) const
inlinevirtualinherited

Definition at line 36 of file UncertaintyComponent.h.

36 { return m_validHistName; }

◆ getValidUncertainty()

bool jet::UncertaintyComponent::getValidUncertainty ( double &  unc,
const xAOD::Jet jet,
const xAOD::EventInfo eInfo 
) const
virtualinherited

Definition at line 179 of file UncertaintyComponent.cxx.

180 {
181  if (getValidity(jet,eInfo))
182  {
183  unc = getUncertainty(jet,eInfo);
184  return true;
185  }
186  return false;
187 }

◆ initialize()

StatusCode jet::PileupUncertaintyComponent::initialize ( TFile *  histFile)
virtual

Reimplemented from jet::UncertaintyComponent.

Definition at line 163 of file PileupUncertaintyComponent.cxx.

164 {
165  // Call the base class first
166  if (UncertaintyComponent::initialize(histFile).isFailure())
167  return StatusCode::FAILURE;
168 
169 
170  // Then ensure that the number of histograms matches what is expected for Pileup components
172  {
173  ATH_MSG_ERROR("Expected a single histogram for OffsetNPV: " << getName().Data());
174  return StatusCode::FAILURE;
175  }
177  {
178  ATH_MSG_ERROR("Expected a single histogram for OffsetMu: " << getName().Data());
179  return StatusCode::FAILURE;
180  }
181  else if (m_pileupType == PileupComp::PtTerm && m_secondUncName == "")
182  {
183  ATH_MSG_ERROR("Expected two histograms for PtTerm: " << getName().Data());
184  return StatusCode::FAILURE;
185  }
186 
187  // Get the reference types
194  else if (m_pileupType == PileupComp::PtTerm)
195  {
196  if (m_uncHistName.Contains("NPV",TString::kIgnoreCase) && m_secondUncName.Contains("Mu",TString::kIgnoreCase))
197  {
200  }
201  else if (m_uncHistName.Contains("Mu",TString::kIgnoreCase) && m_secondUncName.Contains("NPV",TString::kIgnoreCase))
202  {
205  }
206  else
207  {
208  ATH_MSG_ERROR("Unexpected histogram naming scheme for PtTerm");
209  return StatusCode::FAILURE;
210  }
211  }
212 
213  // Create the second histogram if applicable
215  {
216  m_secondUncHist = new UncertaintyHistogram(m_secondUncName,m_interpolate);
217  if (!m_secondUncHist)
218  {
219  ATH_MSG_ERROR("Failed to create second uncertainty histogram for component: " << getName().Data());
220  return StatusCode::FAILURE;
221  }
222  if (m_secondUncHist->initialize(histFile).isFailure()) return StatusCode::FAILURE;
223  }
224 
225  return StatusCode::SUCCESS;
226 }

◆ 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 }

◆ isAlwaysZero()

bool jet::UncertaintyComponent::isAlwaysZero ( ) const
virtualinherited

Reimplemented in jet::CombinedMassUncertaintyComponent.

Definition at line 140 of file UncertaintyComponent.cxx.

141 {
142  if (!m_isInit)
143  {
144  ATH_MSG_ERROR("Cannot call method before initialization, component: " << getName().Data());
145  return false;
146  }
147 
148  const TH1* histo = m_uncHist->getHisto();
149  return !(fabs(histo->GetMinimum()) > 1.e-8 || fabs(histo->GetMaximum()) > 1.e-8);
150 }

◆ 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 }

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_absEta

const bool jet::PileupUncertaintyComponent::m_absEta
private

Definition at line 61 of file PileupUncertaintyComponent.h.

◆ m_energyScale

const float jet::UncertaintyComponent::m_energyScale
protectedinherited

Definition at line 55 of file UncertaintyComponent.h.

◆ m_imsg

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

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_interpolate

const Interpolate::TypeEnum jet::UncertaintyComponent::m_interpolate
protectedinherited

Definition at line 56 of file UncertaintyComponent.h.

◆ m_isInit

bool jet::UncertaintyComponent::m_isInit
protectedinherited

Definition at line 50 of file UncertaintyComponent.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_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_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_numExpectedHist

int jet::UncertaintyComponent::m_numExpectedHist
protectedinherited

Definition at line 59 of file UncertaintyComponent.h.

◆ m_pileupType

const PileupComp::TypeEnum jet::PileupUncertaintyComponent::m_pileupType
private

Definition at line 56 of file PileupUncertaintyComponent.h.

◆ m_refMu

const float jet::PileupUncertaintyComponent::m_refMu
private

Definition at line 58 of file PileupUncertaintyComponent.h.

◆ m_refMuHist

const UncertaintyHistogram* jet::PileupUncertaintyComponent::m_refMuHist
private

Definition at line 60 of file PileupUncertaintyComponent.h.

◆ m_refNPV

const float jet::PileupUncertaintyComponent::m_refNPV
private

Definition at line 57 of file PileupUncertaintyComponent.h.

◆ m_refNPVHist

const UncertaintyHistogram* jet::PileupUncertaintyComponent::m_refNPVHist
private

Definition at line 59 of file PileupUncertaintyComponent.h.

◆ m_refType

PileupRefType jet::PileupUncertaintyComponent::m_refType
private

Definition at line 65 of file PileupUncertaintyComponent.h.

◆ m_scaleVar

const CompScaleVar::TypeEnum jet::UncertaintyComponent::m_scaleVar
protectedinherited

Definition at line 53 of file UncertaintyComponent.h.

◆ m_secondRefType

PileupRefType jet::PileupUncertaintyComponent::m_secondRefType
private

Definition at line 66 of file PileupUncertaintyComponent.h.

◆ m_secondUncHist

UncertaintyHistogram* jet::PileupUncertaintyComponent::m_secondUncHist
private

Definition at line 64 of file PileupUncertaintyComponent.h.

◆ m_secondUncName

const TString jet::PileupUncertaintyComponent::m_secondUncName
private

Definition at line 62 of file PileupUncertaintyComponent.h.

◆ m_splitNumber

const int jet::UncertaintyComponent::m_splitNumber
protectedinherited

Definition at line 57 of file UncertaintyComponent.h.

◆ m_topology

const JetTopology::TypeEnum jet::UncertaintyComponent::m_topology
protectedinherited

Definition at line 54 of file UncertaintyComponent.h.

◆ m_uncHist

UncertaintyHistogram* jet::UncertaintyComponent::m_uncHist
protectedinherited

Definition at line 60 of file UncertaintyComponent.h.

◆ m_uncHistName

const TString jet::UncertaintyComponent::m_uncHistName
protectedinherited

Definition at line 51 of file UncertaintyComponent.h.

◆ m_validHist

UncertaintyHistogram* jet::UncertaintyComponent::m_validHist
protectedinherited

Definition at line 61 of file UncertaintyComponent.h.

◆ m_validHistName

const TString jet::UncertaintyComponent::m_validHistName
protectedinherited

Definition at line 52 of file UncertaintyComponent.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
jet::UncertaintyComponent::getValidityImpl
virtual bool getValidityImpl(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const =0
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
jet::CompMassDef::FourVecMass
@ FourVecMass
Definition: UncertaintyEnum.h:73
jet::PileupComp::RhoTopology
@ RhoTopology
Definition: UncertaintyEnum.h:168
jet::PileupComp::UNKNOWN
@ UNKNOWN
Definition: UncertaintyEnum.h:164
jet::PileupUncertaintyComponent::PileupRef_NONE
@ PileupRef_NONE
Definition: PileupUncertaintyComponent.h:53
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
jet::UncertaintyComponent::m_energyScale
const float m_energyScale
Definition: UncertaintyComponent.h:55
jet::UncertaintyComponent::getSplitFactor
virtual double getSplitFactor(const xAOD::Jet &jet) const
Definition: UncertaintyComponent.cxx:196
jet::UncertaintyComponent::m_interpolate
const Interpolate::TypeEnum m_interpolate
Definition: UncertaintyComponent.h:56
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
jet::PileupComp::PtTerm
@ PtTerm
Definition: UncertaintyEnum.h:167
jet::PileupUncertaintyComponent::PileupRef_MU
@ PileupRef_MU
Definition: PileupUncertaintyComponent.h:53
Data
@ Data
Definition: BaseObject.h:11
jet::PileupUncertaintyComponent::m_secondRefType
PileupRefType m_secondRefType
Definition: PileupUncertaintyComponent.h:66
jet::CompMassDef::CaloMass
@ CaloMass
Definition: UncertaintyEnum.h:74
jet::UncertaintyHistogram::getHisto
const TH1 * getHisto() const
Definition: UncertaintyHistogram.h:37
jet::UncertaintyComponent::m_uncHistName
const TString m_uncHistName
Definition: UncertaintyComponent.h:51
jet::CompParametrization::isAbsEta
bool isAbsEta(const TypeEnum type)
Definition: UncertaintyEnum.cxx:143
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
jet::UncertaintyComponent::initialize
virtual StatusCode initialize(TFile *histFile)
Definition: UncertaintyComponent.cxx:96
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
jet::UncertaintyComponent::m_isInit
bool m_isInit
Definition: UncertaintyComponent.h:50
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
jet::UncertaintyComponent::getValidBool
virtual bool getValidBool(const double validity) const
Definition: UncertaintyComponent.cxx:301
jet::UncertaintyHistogram::getValue
double getValue(const double var1) const
Definition: UncertaintyHistogram.cxx:141
PUfitVar::maxEta
constexpr float maxEta
Definition: GepMETPufitAlg.cxx:13
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
jet::UncertaintyHistogram::initialize
virtual StatusCode initialize(TFile *histFile)
Definition: UncertaintyHistogram.cxx:85
JESUNC_ERROR_CODE
#define JESUNC_ERROR_CODE
Definition: Reconstruction/Jet/JetUncertainties/JetUncertainties/Helpers.h:23
jet::UncertaintyComponent::m_validHistName
const TString m_validHistName
Definition: UncertaintyComponent.h:52
jet::PileupUncertaintyComponent::m_absEta
const bool m_absEta
Definition: PileupUncertaintyComponent.h:61
jet::PileupUncertaintyComponent::m_refType
PileupRefType m_refType
Definition: PileupUncertaintyComponent.h:65
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
jet::PileupUncertaintyComponent::m_refNPVHist
const UncertaintyHistogram * m_refNPVHist
Definition: PileupUncertaintyComponent.h:59
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
JESUNC_SAFE_DELETE
#define JESUNC_SAFE_DELETE(T)
Definition: Reconstruction/Jet/JetUncertainties/JetUncertainties/Helpers.h:25
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
jet::CompMassDef::getJetScaleString
TString getJetScaleString(const TypeEnum type)
Definition: UncertaintyEnum.cxx:225
jet::CompMassDef::TAMass
@ TAMass
Definition: UncertaintyEnum.h:75
jet::UncertaintyComponent::m_validHist
UncertaintyHistogram * m_validHist
Definition: UncertaintyComponent.h:61
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
jet::UncertaintyComponent::getName
virtual TString getName() const
Definition: UncertaintyComponent.h:35
jet::PileupUncertaintyComponent::m_refNPV
const float m_refNPV
Definition: PileupUncertaintyComponent.h:57
jet::PileupComp::OffsetNPV
@ OffsetNPV
Definition: UncertaintyEnum.h:165
xAOD::EventInfo_v1::averageInteractionsPerCrossing
float averageInteractionsPerCrossing() const
Average interactions per crossing for all BCIDs - for out-of-time pile-up.
Definition: EventInfo_v1.cxx:397
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
jet::UncertaintyComponent::m_splitNumber
const int m_splitNumber
Definition: UncertaintyComponent.h:57
jet::UncertaintyComponent::getUncertaintyImpl
virtual double getUncertaintyImpl(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const =0
jet::PileupUncertaintyComponent::m_refMu
const float m_refMu
Definition: PileupUncertaintyComponent.h:58
JESUNC_NO_DEFAULT_CONSTRUCTOR
#define JESUNC_NO_DEFAULT_CONSTRUCTOR
Definition: Reconstruction/Jet/JetUncertainties/JetUncertainties/Helpers.h:24
jet::UncertaintyComponent::getValidName
virtual TString getValidName() const
Definition: UncertaintyComponent.h:36
jet::PileupComp::OffsetMu
@ OffsetMu
Definition: UncertaintyEnum.h:166
jet::PileupUncertaintyComponent::m_secondUncName
const TString m_secondUncName
Definition: PileupUncertaintyComponent.h:62
jet::CompMassDef::UNKNOWN
@ UNKNOWN
Definition: UncertaintyEnum.h:72
jet::PileupUncertaintyComponent::m_pileupType
const PileupComp::TypeEnum m_pileupType
Definition: PileupUncertaintyComponent.h:56
jet::UncertaintyComponent::m_scaleVar
const CompScaleVar::TypeEnum m_scaleVar
Definition: UncertaintyComponent.h:53
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
jet::PileupUncertaintyComponent::PileupRef_UNKNOWN
@ PileupRef_UNKNOWN
Definition: PileupUncertaintyComponent.h:53
jet::PileupUncertaintyComponent::getPileupWeight
double getPileupWeight(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo, const PileupRefType refType) const
Definition: PileupUncertaintyComponent.cxx:247
jet::UncertaintyComponent::getUncertainty
virtual double getUncertainty(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
Definition: UncertaintyComponent.cxx:169
jet::PileupUncertaintyComponent::m_refMuHist
const UncertaintyHistogram * m_refMuHist
Definition: PileupUncertaintyComponent.h:60
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
TauGNNUtils::Variables::absEta
bool absEta(const xAOD::TauJet &tau, double &out)
Definition: TauGNNUtils.cxx:234
jet::UncertaintyComponent::UncertaintyComponent
UncertaintyComponent(const ComponentHelper &component, const size_t numHist=1)
Definition: UncertaintyComponent.cxx:47
jet::PileupUncertaintyComponent::PileupUncertaintyComponent
PileupUncertaintyComponent(const ComponentHelper &component, const float refNPV, const float refMu)
Definition: PileupUncertaintyComponent.cxx:35
jet::UncertaintyComponent::m_uncHist
UncertaintyHistogram * m_uncHist
Definition: UncertaintyComponent.h:60
jet::PileupUncertaintyComponent::m_secondUncHist
UncertaintyHistogram * m_secondUncHist
Definition: PileupUncertaintyComponent.h:64
jet::CompMassDef::enumToString
TString enumToString(const TypeEnum type)
Definition: UncertaintyEnum.cxx:188
plotBeamSpotCompare.histo
histo
Definition: plotBeamSpotCompare.py:415
CaloNoise_fillDB.mu
mu
Definition: CaloNoise_fillDB.py:53
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
jet::UncertaintyComponent::getValidity
virtual bool getValidity(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
Definition: UncertaintyComponent.cxx:159
jet::PileupUncertaintyComponent::PileupRef_NPV
@ PileupRef_NPV
Definition: PileupUncertaintyComponent.h:53
jet::UncertaintyComponent::m_topology
const JetTopology::TypeEnum m_topology
Definition: UncertaintyComponent.h:54