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

#include <GSCCalibStep.h>

Inheritance diagram for GSCCalibStep:
Collaboration diagram for GSCCalibStep:

Public Member Functions

 GSCCalibStep (const std::string &name="GSCCalibStep")
 Constructor with parameters: More...
 
virtual StatusCode initialize () override
 Dummy implementation of the initialisation function. More...
 
virtual StatusCode calibrate (xAOD::JetContainer &) const override
 Apply calibration to a jet container. More...
 
virtual void print () const
 Print the state of the tool. More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 
virtual StatusCode getNominalResolutionData (const xAOD::Jet &, const JetHelper::JetContext &, double &) const
 
virtual StatusCode getNominalResolutionMC (const xAOD::Jet &, const JetHelper::JetContext &, double &) const
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

float getChargedFractionResponse (const xAOD::Jet &jet, const JetHelper::JetContext &jc, uint etabin) const
 
float getTile0Response (const xAOD::Jet &jet, const JetHelper::JetContext &jc, uint etabin) const
 
float getEM3Response (const xAOD::Jet &jet, const JetHelper::JetContext &jc, uint etabin) const
 
float getPunchThroughResponse (const xAOD::Jet &jet, const JetHelper::JetContext &jc, double eta_det) const
 
float getNTrkResponse (const xAOD::Jet &jet, const JetHelper::JetContext &jc, uint etabin) const
 
float getTrackWIDTHResponse (const xAOD::Jet &jet, const JetHelper::JetContext &jc, uint etabin) const
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

ToolHandle< JetHelper::IVarToolm_vartool1 {this, "vartool1", "VarTool", "InputVariable instance" }
 
ToolHandle< JetHelper::IVarToolm_vartool2 {this, "vartool2", "VarTool", "InputVariable instance" }
 
ToolHandle< JetHelper::IVarToolm_histTool2D {this, "histTool", "HistoInput2D", "HistoInput2D instance" }
 
ToolHandleArray< JetHelper::IVarToolm_histTool_EM3 = {this , "histTool_EM3", {}, "EM3 histo reader" }
 
ToolHandleArray< JetHelper::IVarToolm_histTool_ChargedFraction = {this , "histTool_CharFrac", {}, "ChargedFraction histo reader" }
 
ToolHandleArray< JetHelper::IVarToolm_histTool_Tile0 = {this , "histTool_Tile0", {}, "Tile0 histo reader" }
 
ToolHandleArray< JetHelper::IVarToolm_histTool_PunchThrough = {this , "histTool_PunchThrough", {}, "PunchThrough histo reader" }
 
ToolHandleArray< JetHelper::IVarToolm_histTool_nTrk = {this , "histTool_nTrk", {}, "nTrk histo reader" }
 
ToolHandleArray< JetHelper::IVarToolm_histTool_trackWIDTH = {this , "histTool_trackWIDTH", {}, "trackWIDTH histo reader" }
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Definition at line 29 of file GSCCalibStep.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ GSCCalibStep()

GSCCalibStep::GSCCalibStep ( const std::string &  name = "GSCCalibStep")

Constructor with parameters:

Definition at line 15 of file GSCCalibStep.cxx.

16  : asg::AsgTool( name ){ }

Member Function Documentation

◆ calibrate()

StatusCode GSCCalibStep::calibrate ( xAOD::JetContainer jets) const
overridevirtual

Apply calibration to a jet container.

Implements IJetCalibStep.

Definition at line 42 of file GSCCalibStep.cxx.

42  {
43 
44  ATH_MSG_DEBUG("calibrating jet collection.");
45 
46  for (xAOD::Jet* jet : jets){
47 
49 
50  xAOD::JetFourMom_t jetconstitP4 = jet->getAttribute<xAOD::JetFourMom_t>("JetConstitScaleMomentum");
51  std::vector<float> samplingFrac = jet->getAttribute<std::vector<float> >("EnergyPerSampling");
52  // get Primary Vertex index
53  int PVindex = 0;
54  ATH_MSG_DEBUG("PV index:" << PVindex);
55  // get detector Eta
56  float detectorEta = jet->getAttribute<float>("DetectorEta");
57  // get trackWIDTHPVX
58  float trackWIDTHPVX = 0;
59  static const SG::ConstAccessor<std::vector<float> > TrackWidthPt1000Acc ("TrackWidthPt1000");
60  if(TrackWidthPt1000Acc.isAvailable(*jet))
61  {
62  trackWIDTHPVX = TrackWidthPt1000Acc(*jet).at(PVindex);
63  ATH_MSG_DEBUG("trackWIDTHPVX found set to: " << trackWIDTHPVX);
64  }
65  jc.setValue("trackWIDTH", trackWIDTHPVX);
66  // get nTrkPVX
67  int nTrkPVX = 0;
68  static const SG::ConstAccessor<std::vector<int>> NumTrkPt1000Acc ("NumTrkPt1000");
69  if(NumTrkPt1000Acc.isAvailable(*jet))
70  {
71  nTrkPVX = NumTrkPt1000Acc(*jet).at(PVindex);
72  ATH_MSG_DEBUG("nTrkPVX found set to: " << nTrkPVX);
73  }
74  jc.setValue("nTrk", nTrkPVX);
75  // get Charged Fraction
76  float ChargedFraction = 0;
77  static const SG::ConstAccessor<std::vector<float>> SumPtChargedPFOPt500Acc ("SumPtChargedPFOPt500");
78  if(SumPtChargedPFOPt500Acc.isAvailable(*jet))
79  {
80  ChargedFraction = SumPtChargedPFOPt500Acc(*jet).at(PVindex)/jetconstitP4.Pt();
81  ATH_MSG_DEBUG("ChargedFraction found set to: " << ChargedFraction);
82  }
83  jc.setValue("ChargedFraction", ChargedFraction);
84  // get EM3
85  float EM3 = (samplingFrac[3]+samplingFrac[7])/jetconstitP4.e();
86  ATH_MSG_DEBUG("EM3 found set to: " << EM3);
87  jc.setValue("EM3", EM3);
88  // get Tile0
89  float Tile0 = (samplingFrac[12]+samplingFrac[18])/jetconstitP4.e();
90  ATH_MSG_DEBUG("Tile0 found set to: " << Tile0);
91  jc.setValue("Tile0", Tile0);
92  // get N90Constituents
93  double N90Constituents = 0;
94  static const SG::ConstAccessor<float> N90ConstituentsAcc ("N90Constituents");
95  if(N90ConstituentsAcc.isAvailable(*jet))
96  {
97  N90Constituents = N90ConstituentsAcc(*jet);
98  ATH_MSG_DEBUG("N90Constituents found set to: " << N90Constituents);
99  }
100  jc.setValue("N90Constituents", N90Constituents);
101  // get caloWIDTH
102  double caloWIDTH = 0;
103  static const SG::ConstAccessor<float> WidthAcc ("Width");
104  if(WidthAcc.isAvailable(*jet))
105  {
106  caloWIDTH = WidthAcc(*jet);
107  ATH_MSG_DEBUG("caloWIDTH found set to: " << caloWIDTH);
108  }
109  jc.setValue("caloWIDTH", caloWIDTH);
110  // get TG3
111  float TG3 = (samplingFrac[17])/jetconstitP4.e();
112  ATH_MSG_DEBUG("TG3 found set to: " << TG3);
113  jc.setValue("TG3", TG3);
114  // get Muon segments
115  int Nsegments = 0;
116  static const SG::ConstAccessor<int> GhostMuonSegmentCountAcc ("GhostMuonSegmentCount");
117  if(GhostMuonSegmentCountAcc.isAvailable(*jet))
118  {
119  Nsegments = GhostMuonSegmentCountAcc(*jet);
120  ATH_MSG_DEBUG("Nsegments found set to: " << Nsegments);
121  }
122  jc.setValue("Nsegments", Nsegments);
123 
124  ATH_MSG_DEBUG("Jet pt original:" << jet->pt()*1e-3);
125 
126  float getGSCCorrection = 1.0;
127  int etabin = fabs(detectorEta)/0.1;// m_binSize in old version
128  xAOD::JetFourMom_t startingP4 = jet->jetP4();
129 
130  ATH_MSG_DEBUG("ChargedFraction Response: " << getChargedFractionResponse(*jet, jc, etabin));
131  ATH_MSG_DEBUG("Tile0 Response: " <<getTile0Response(*jet, jc, etabin));
132  ATH_MSG_DEBUG("EM3 Response: " << getEM3Response(*jet, jc, etabin));
133  ATH_MSG_DEBUG("NTrk Response: " <<getNTrkResponse(*jet, jc, etabin));
134  ATH_MSG_DEBUG("TrkWidth Response: " <<getTrackWIDTHResponse(*jet, jc, etabin));
135 
136  getGSCCorrection*=1./getChargedFractionResponse(*jet, jc, etabin);
137  jet->setJetP4( startingP4*getGSCCorrection );
138  getGSCCorrection*=1./getTile0Response(*jet, jc, etabin);
139  jet->setJetP4( startingP4*getGSCCorrection );
140  getGSCCorrection*=1./getEM3Response(*jet, jc, etabin);
141  jet->setJetP4( startingP4*getGSCCorrection );
142  getGSCCorrection*=1./getNTrkResponse(*jet, jc, etabin);
143  jet->setJetP4( startingP4*getGSCCorrection );
144  getGSCCorrection*=1./getTrackWIDTHResponse(*jet, jc, etabin);
145 
146  ATH_MSG_DEBUG("GSC full correction: " << getGSCCorrection);
147 
148  jet->setAttribute<xAOD::JetFourMom_t>("JetGSCScaleMomentum",startingP4*getGSCCorrection);
149  jet->setJetP4( startingP4*getGSCCorrection );
150 
151  ATH_MSG_DEBUG("Jet pt calibrated:" << jet->pt()*1e-3);
152 
153 
154  }// loop jets
155 
156  return StatusCode::SUCCESS;
157 }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ getChargedFractionResponse()

float GSCCalibStep::getChargedFractionResponse ( const xAOD::Jet jet,
const JetHelper::JetContext jc,
uint  etabin 
) const
private

Definition at line 159 of file GSCCalibStep.cxx.

159  {
160  if (jc.getValue<float>("ChargedFraction")<=0) return 1; //ChargedFraction < 0 is unphysical, ChargedFraction = 0 is a special case, so we return 1 for ChargedFraction <= 0
161  if ( etabin >= m_histTool_ChargedFraction.size() ) return 1.;
162  double ChargedFractionResponse = m_histTool_ChargedFraction[etabin]->getValue(jet, jc);
163  return ChargedFractionResponse;
164 }

◆ getEM3Response()

float GSCCalibStep::getEM3Response ( const xAOD::Jet jet,
const JetHelper::JetContext jc,
uint  etabin 
) const
private

Definition at line 173 of file GSCCalibStep.cxx.

173  {
174  if (jc.getValue<float>("EM3")<=0) return 1; //EM3 < 0 is unphysical, EM3 = 0 is a special case, so we return 1 for EM3 <= 0
175  if ( etabin >= m_histTool_EM3.size() ) return 1.;
176  float EM3Response = m_histTool_EM3[etabin]->getValue(jet, jc);
177  return EM3Response;
178 }

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void *  ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119  {
120 
121 #ifdef XAOD_STANDALONE
122  // In case we use @c xAOD::TEvent, we have a direct function call
123  // for this.
124  return evtStore()->event()->getKey( ptr );
125 #else
126  const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127  return ( proxy == nullptr ? 0 : proxy->sgkey() );
128 #endif // XAOD_STANDALONE
129  }

◆ getName()

const std::string & asg::AsgTool::getName ( const void *  ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106  {
107 
108 #ifdef XAOD_STANDALONE
109  // In case we use @c xAOD::TEvent, we have a direct function call
110  // for this.
111  return evtStore()->event()->getName( ptr );
112 #else
113  const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114  static const std::string dummy = "";
115  return ( proxy == nullptr ? dummy : proxy->name() );
116 #endif // XAOD_STANDALONE
117  }

◆ getNominalResolutionData()

virtual StatusCode IJetCalibStep::getNominalResolutionData ( const xAOD::Jet ,
const JetHelper::JetContext ,
double &   
) const
inlinevirtualinherited

Reimplemented in SmearingCalibStep.

Definition at line 38 of file IJetCalibStep.h.

38 { return StatusCode::FAILURE; }

◆ getNominalResolutionMC()

virtual StatusCode IJetCalibStep::getNominalResolutionMC ( const xAOD::Jet ,
const JetHelper::JetContext ,
double &   
) const
inlinevirtualinherited

Reimplemented in SmearingCalibStep.

Definition at line 39 of file IJetCalibStep.h.

39 { return StatusCode::FAILURE; }

◆ getNTrkResponse()

float GSCCalibStep::getNTrkResponse ( const xAOD::Jet jet,
const JetHelper::JetContext jc,
uint  etabin 
) const
private

Definition at line 200 of file GSCCalibStep.cxx.

200  {
201  if (jc.getValue<int>("nTrk")<=0) return 1; //nTrk < 0 is unphysical, nTrk = 0 is a special case, so return 1 for nTrk <= 0
202  if ( etabin >= m_histTool_nTrk.size() ) return 1.;
203  double nTrkResponse;
204  /*if(m_turnOffTrackCorrections){
205  if(pT>=m_turnOffStartingpT && pT<=m_turnOffEndpT){
206  double responseatStartingpT = m_histTool_nTrk[etabin]->getValue(jet, jc);
207  nTrkResponse = (1-responseatStartingpT)/(m_turnOffEndpT-m_turnOffStartingpT);
208  nTrkResponse *= pT;
209  nTrkResponse += 1 - (m_turnOffEndpT*(1-responseatStartingpT)/(m_turnOffEndpT-m_turnOffStartingpT));
210  return nTrkResponse;
211  }
212  else if(pT>m_turnOffEndpT) return 1;
213  } TODO */
214  nTrkResponse = m_histTool_nTrk[etabin]->getValue(jet, jc);
215  return nTrkResponse;
216 }

◆ getProperty()

template<class T >
const T* asg::AsgTool::getProperty ( const std::string &  name) const
inherited

Get one of the tool's properties.

◆ getPunchThroughResponse()

float GSCCalibStep::getPunchThroughResponse ( const xAOD::Jet jet,
const JetHelper::JetContext jc,
double  eta_det 
) const
private

Definition at line 180 of file GSCCalibStep.cxx.

180  {
181  int etabin=-99;
182  std::vector<float> punchThroughEtaBins = {0.0, 1.3, 1.9};//variable in old version
183 
184  if (punchThroughEtaBins.empty() || m_histTool_PunchThrough.size() != punchThroughEtaBins.size()-1)
185  ATH_MSG_WARNING("Please check that the punch through eta binning is properly set in your config file");
186  if ( eta_det >= punchThroughEtaBins.back() || jc.getValue<float>("Nsegments") < 20 ) return 1;
187  for (uint i=0; i<punchThroughEtaBins.size()-1; ++i) {
188  if(eta_det >= punchThroughEtaBins[i] && eta_det < punchThroughEtaBins[i+1]) etabin = i;
189  }
190  if(etabin<0) {
191  ATH_MSG_WARNING("There was a problem determining the eta bin to use for the punch through correction.");
192  //this could probably be improved, but to avoid a seg fault...
193  return 1;
194  }
195  double PunchThroughResponse = m_histTool_PunchThrough[etabin]->getValue(jet, jc);
196  if(PunchThroughResponse>1) return 1;
197  return PunchThroughResponse;
198 }

◆ getTile0Response()

float GSCCalibStep::getTile0Response ( const xAOD::Jet jet,
const JetHelper::JetContext jc,
uint  etabin 
) const
private

Definition at line 166 of file GSCCalibStep.cxx.

166  {
167  if (jc.getValue<float>("Tile0")<0) return 1; //Tile0 < 0 is unphysical, so we return 1
168  if ( etabin >= m_histTool_Tile0.size() ) return 1.;
169  double Tile0Response = m_histTool_Tile0[etabin]->getValue(jet, jc);
170  return Tile0Response;
171 }

◆ getTrackWIDTHResponse()

float GSCCalibStep::getTrackWIDTHResponse ( const xAOD::Jet jet,
const JetHelper::JetContext jc,
uint  etabin 
) const
private

Definition at line 218 of file GSCCalibStep.cxx.

218  {
219  if (jc.getValue<float>("trackWIDTH")<=0) return 1;
220  if ( etabin >= m_histTool_trackWIDTH.size() ) return 1.;
221  //jets with no tracks are assigned a trackWIDTH of -1, we use the trackWIDTH=0 correction in those cases
222  double trackWIDTHResponse;
223  /*if(m_turnOffTrackCorrections){
224  if(pT>=m_turnOffStartingpT && pT<=m_turnOffEndpT){
225  double responseatStartingpT = readPtJetPropertyHisto(m_turnOffStartingpT, trackWIDTH, *m_respFactorstrackWIDTH[etabin]);
226  trackWIDTHResponse = (1-responseatStartingpT)/(m_turnOffEndpT-m_turnOffStartingpT);
227  trackWIDTHResponse *= pT;
228  trackWIDTHResponse += 1 - (m_turnOffEndpT*(1-responseatStartingpT)/(m_turnOffEndpT-m_turnOffStartingpT));
229  return trackWIDTHResponse;
230  }
231  else if(pT>m_turnOffEndpT) return 1;
232  } TODO */
233  trackWIDTHResponse = m_histTool_trackWIDTH[etabin]->getValue(jet, jc);
234  return trackWIDTHResponse;
235 }

◆ initialize()

StatusCode GSCCalibStep::initialize ( )
overridevirtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Reimplemented from asg::AsgTool.

Definition at line 24 of file GSCCalibStep.cxx.

24  {
25  ATH_MSG_DEBUG ("Initializing " << name() );
26 
27  ATH_CHECK( m_vartool1.retrieve() );
28  ATH_CHECK( m_vartool2.retrieve() );
29 
30  ATH_CHECK( m_histTool2D.retrieve() );
31  ATH_CHECK( m_histTool_EM3.retrieve());
33  ATH_CHECK( m_histTool_Tile0.retrieve());
35  ATH_CHECK( m_histTool_nTrk.retrieve());
36  ATH_CHECK( m_histTool_trackWIDTH.retrieve());
37 
38  return StatusCode::SUCCESS;
39 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg() [1/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101  {
102 
103  return MSG::name( msg().level() );
104  }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ print()

void asg::AsgTool::print ( ) const
virtualinherited

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_histTool2D

ToolHandle<JetHelper::IVarTool> GSCCalibStep::m_histTool2D {this, "histTool", "HistoInput2D", "HistoInput2D instance" }
private

Definition at line 45 of file GSCCalibStep.h.

◆ m_histTool_ChargedFraction

ToolHandleArray<JetHelper::IVarTool> GSCCalibStep::m_histTool_ChargedFraction = {this , "histTool_CharFrac", {}, "ChargedFraction histo reader" }
private

Definition at line 47 of file GSCCalibStep.h.

◆ m_histTool_EM3

ToolHandleArray<JetHelper::IVarTool> GSCCalibStep::m_histTool_EM3 = {this , "histTool_EM3", {}, "EM3 histo reader" }
private

Definition at line 46 of file GSCCalibStep.h.

◆ m_histTool_nTrk

ToolHandleArray<JetHelper::IVarTool> GSCCalibStep::m_histTool_nTrk = {this , "histTool_nTrk", {}, "nTrk histo reader" }
private

Definition at line 50 of file GSCCalibStep.h.

◆ m_histTool_PunchThrough

ToolHandleArray<JetHelper::IVarTool> GSCCalibStep::m_histTool_PunchThrough = {this , "histTool_PunchThrough", {}, "PunchThrough histo reader" }
private

Definition at line 49 of file GSCCalibStep.h.

◆ m_histTool_Tile0

ToolHandleArray<JetHelper::IVarTool> GSCCalibStep::m_histTool_Tile0 = {this , "histTool_Tile0", {}, "Tile0 histo reader" }
private

Definition at line 48 of file GSCCalibStep.h.

◆ m_histTool_trackWIDTH

ToolHandleArray<JetHelper::IVarTool> GSCCalibStep::m_histTool_trackWIDTH = {this , "histTool_trackWIDTH", {}, "trackWIDTH histo reader" }
private

Definition at line 51 of file GSCCalibStep.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vartool1

ToolHandle<JetHelper::IVarTool> GSCCalibStep::m_vartool1 {this, "vartool1", "VarTool", "InputVariable instance" }
private

Definition at line 43 of file GSCCalibStep.h.

◆ m_vartool2

ToolHandle<JetHelper::IVarTool> GSCCalibStep::m_vartool2 {this, "vartool2", "VarTool", "InputVariable instance" }
private

Definition at line 44 of file GSCCalibStep.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
GSCCalibStep::m_vartool1
ToolHandle< JetHelper::IVarTool > m_vartool1
Definition: GSCCalibStep.h:43
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
Ringer::EM3
@ EM3
Definition: CaloRingsDefs.h:49
GSCCalibStep::getEM3Response
float getEM3Response(const xAOD::Jet &jet, const JetHelper::JetContext &jc, uint etabin) const
Definition: GSCCalibStep.cxx:173
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
JetHelper::JetContext
Class JetContext Designed to read AOD information related to the event, N vertices,...
Definition: JetContext.h:24
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
GSCCalibStep::m_histTool_ChargedFraction
ToolHandleArray< JetHelper::IVarTool > m_histTool_ChargedFraction
Definition: GSCCalibStep.h:47
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
GSCCalibStep::m_histTool2D
ToolHandle< JetHelper::IVarTool > m_histTool2D
Definition: GSCCalibStep.h:45
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
GSCCalibStep::m_vartool2
ToolHandle< JetHelper::IVarTool > m_vartool2
Definition: GSCCalibStep.h:44
GSCCalibStep::getNTrkResponse
float getNTrkResponse(const xAOD::Jet &jet, const JetHelper::JetContext &jc, uint etabin) const
Definition: GSCCalibStep.cxx:200
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
GSCCalibStep::getTile0Response
float getTile0Response(const xAOD::Jet &jet, const JetHelper::JetContext &jc, uint etabin) const
Definition: GSCCalibStep.cxx:166
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
GSCCalibStep::m_histTool_nTrk
ToolHandleArray< JetHelper::IVarTool > m_histTool_nTrk
Definition: GSCCalibStep.h:50
python.xAODType.dummy
dummy
Definition: xAODType.py:4
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MSG::name
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition: MsgLevel.cxx:19
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
GSCCalibStep::getTrackWIDTHResponse
float getTrackWIDTHResponse(const xAOD::Jet &jet, const JetHelper::JetContext &jc, uint etabin) const
Definition: GSCCalibStep.cxx:218
GSCCalibStep::getChargedFractionResponse
float getChargedFractionResponse(const xAOD::Jet &jet, const JetHelper::JetContext &jc, uint etabin) const
Definition: GSCCalibStep.cxx:159
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
xAOD::JetFourMom_t
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Definition: JetTypes.h:17
GSCCalibStep::m_histTool_trackWIDTH
ToolHandleArray< JetHelper::IVarTool > m_histTool_trackWIDTH
Definition: GSCCalibStep.h:51
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
GSCCalibStep::m_histTool_PunchThrough
ToolHandleArray< JetHelper::IVarTool > m_histTool_PunchThrough
Definition: GSCCalibStep.h:49
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
JetHelper::JetContext::setValue
bool setValue(const std::string &name, const T value, bool allowOverwrite=false)
Definition: JetContext.h:52
GSCCalibStep::m_histTool_EM3
ToolHandleArray< JetHelper::IVarTool > m_histTool_EM3
Definition: GSCCalibStep.h:46
SG::DataProxy
Definition: DataProxy.h:45
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
GSCCalibStep::m_histTool_Tile0
ToolHandleArray< JetHelper::IVarTool > m_histTool_Tile0
Definition: GSCCalibStep.h:48
fitman.k
k
Definition: fitman.py:528
JetHelper::JetContext::getValue
void getValue(const std::string &name, T &value) const
Definition: JetContext.h:39