ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
TauAnalysisTools::DiTauTruthMatchingTool Class Referenceabstract

#include <DiTauTruthMatchingTool.h>

Inheritance diagram for TauAnalysisTools::DiTauTruthMatchingTool:
Collaboration diagram for TauAnalysisTools::DiTauTruthMatchingTool:

Public Member Functions

virtual void print () const =0
 Print the state of the tool. More...
 
virtual void print () const
 Print the state of the tool. More...
 
virtual StatusCode sysInitialize ()
 Function initialising the tool in the correct way in Athena. 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 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
 

Protected Member Functions

StatusCode retrieveTruthTaus (TruthTausEvent &truthTausEvent) const
 
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...
 

Protected Attributes

TruthTausEvent m_truthTausEvent
 
bool m_bTruthTauAvailable {}
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

virtual StatusCode initialize ()
 
virtual void getTruth (const xAOD::DiTauJet &xDiTau)
 get pointer to the truth matched particle. More...
 
virtual void getTruth (const std::vector< const xAOD::DiTauJet * > &vDiTaus)
 
StatusCode findTruthTau (const xAOD::DiTauJet &xDiTau)
 
StatusCode checkTruthMatch (const xAOD::DiTauJet &xDiTau, const xAOD::TruthParticleContainer &xTauContainer) const
 
StatusCode truthMatch (const TLorentzVector &vSubjetTLV, const xAOD::TruthParticleContainer &xTruthTauContainer, const xAOD::TruthParticle *&xTruthMatch, TruthMatchedParticleType &eTruthMatchedParticleType) const
 
ElementLink< xAOD::TruthParticleContainercheckTruthLepton (const xAOD::IParticle *pLepton) const
 
virtual void setTruthMatchingMode () override
 
virtual StatusCode retrieveTruthTaus () override
 
virtual StatusCode retrieveTruthTaus (ITruthTausEvent &truthTausEvent) const override
 
StatusCode buildTruthTausFromTruthParticles (TruthTausEvent &truthTausEvent) const
 
StatusCode examineTruthTau (const xAOD::TruthParticle &xTruthParticle) const
 
StatusCode examineTruthTauDecay (const xAOD::TruthParticle &xTruthParticle, TauTruthInfo &truthInfo) const
 
void printDecay (const xAOD::TruthParticle &xTruthParticle, int depth=0) 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

double m_dMaxDeltaR
 
CxxUtils::CachedValue< bool > m_bIsTruthMatchedAvailable
 
CxxUtils::CachedValue< bool > m_bIsTruthParticleLinkAvailable
 
SG::ConstAccessor< double > m_accPtVis
 
SG::ConstAccessor< double > m_accEtaVis
 
SG::ConstAccessor< double > m_accPhiVis
 
SG::ConstAccessor< double > m_accMVis
 
SG::ReadHandleKey< xAOD::TruthParticleContainerm_truthTauInputContainer { this, "TruthTauContainerName", "TruthTaus", "Truth tau input container name (truth matching mode)" }
 
SG::ReadHandleKey< xAOD::TruthParticleContainerm_truthParticleContainer { this, "TruthParticleContainerName", "TruthParticles", "Truth particles input container name" }
 
SG::ReadHandleKey< xAOD::TruthParticleContainerm_truthElectronContainer { this, "TruthElectronContainerName", "TruthElectrons", "Truth electrons input container name" }
 
SG::ReadHandleKey< xAOD::TruthParticleContainerm_truthMuonContainer { this, "TruthMuonContainerName", "TruthMuons", "Truth muons input container name" }
 
SG::ReadHandleKey< xAOD::JetContainerm_truthJetContainer { this, "TruthJetContainerName", "AntiKt4TruthDressedWZJets", "Truth jets input container name" }
 
SG::WriteHandleKey< xAOD::TruthParticleContainerm_truthTauOutputContainer { this, "NewTruthTauContainerName", "TruthTaus", "Truth tau output container name" }
 
bool m_truthMatchingMode = false
 
bool m_bWriteInvisibleFourMomentum {}
 
bool m_bWriteVisibleChargedFourMomentum {}
 
bool m_bWriteVisibleNeutralFourMomentum {}
 
bool m_bWriteDecayModeVector {}
 
bool m_bWriteVertices {}
 
asg::AnaToolHandle< IMCTruthClassifierm_tMCTruthClassifier
 
MetaStore_t m_inputMetaStore
 Object accessing the input metadata store. More...
 
MetaStore_t m_outputMetaStore
 Object accessing the output metadata store. More...
 
bool m_beginInputFileCalled
 Flag helping to discover when the tool misses the opening of the first input file. More...
 
bool m_useIncidents
 
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
 

Callback functions helping in metadata reading/writing

void setUseIncidents (const bool flag)
 
virtual void handle (const Incident &inc)
 Function receiving incidents from IncidentSvc/TEvent. More...
 
virtual StatusCode beginInputFile ()
 Function called when a new input file is opened. More...
 
virtual StatusCode endInputFile ()
 Function called when the currently open input file got completely processed. More...
 
virtual StatusCode beginEvent ()
 Function called when a new events is loaded. More...
 
virtual StatusCode metaDataStop ()
 Function called when the tool should write out its metadata. More...
 

Detailed Description

Definition at line 27 of file DiTauTruthMatchingTool.h.

Member Typedef Documentation

◆ MetaStore_t

Type of the metadata store object in Athena.

Definition at line 66 of file AsgMetadataTool.h.

◆ MetaStorePtr_t

Type of the metadata store pointer in standalone mode.

Definition at line 68 of file AsgMetadataTool.h.

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Member Function Documentation

◆ beginEvent()

StatusCode asg::AsgMetadataTool::beginEvent ( )
protectedvirtualinherited

Function called when a new events is loaded.

Dummy implementation that can be overridden by the derived tool.

Reimplemented in AsgElectronEfficiencyCorrectionTool, TrigConf::xAODConfigTool, TauAnalysisTools::TauSelectionTool, TauAnalysisTools::DiTauSelectionTool, TauAnalysisTools::CommonSmearingTool, TauAnalysisTools::DiTauEfficiencyCorrectionsTool, Trig::TrigDecisionTool, TauAnalysisTools::TauEfficiencyCorrectionsTool, Trig::TrigConfBunchCrossingTool, xAODMaker::TriggerMenuMetaDataTool, and Trig::xAODBunchCrossingTool.

Definition at line 196 of file AsgMetadataTool.cxx.

196  {
197 
198  // Return gracefully:
199  return StatusCode::SUCCESS;
200  }

◆ beginInputFile()

StatusCode asg::AsgMetadataTool::beginInputFile ( )
protectedvirtualinherited

Function called when a new input file is opened.

Dummy implementation that can be overridden by the derived tool.

Reimplemented in AsgElectronEfficiencyCorrectionTool, TrigConf::xAODConfigTool, PMGTools::PMGTruthWeightTool, BookkeeperTool, xAODMaker::FileMetaDataTool, BookkeeperDumperTool, Trig::TrigDecisionTool, xAODMaker::TriggerMenuMetaDataTool, xAODMaker::TruthMetaDataTool, Trig::xAODBunchCrossingTool, TauAnalysisTools::TauEfficiencyCorrectionsTool, and TauAnalysisTools::TauSmearingTool.

Definition at line 180 of file AsgMetadataTool.cxx.

180  {
181 
182  // Return gracefully:
183  return StatusCode::SUCCESS;
184  }

◆ buildTruthTausFromTruthParticles()

StatusCode BuildTruthTaus::buildTruthTausFromTruthParticles ( TruthTausEvent &  truthTausEvent) const
privateinherited

Definition at line 156 of file BuildTruthTaus.cxx.

157 {
158  static const SG::Accessor<char> dressedPhotonAcc ("dressedPhoton");
159 
160  bool copyDressedPhotons = false;
161 
162  for (auto xTruthParticle : *truthTausEvent.m_xTruthParticleContainer)
163  {
164  if ( xTruthParticle->isTau() )
165  {
166  auto xTruthTau = std::make_unique<xAOD::TruthParticle>();
167  xTruthTau->makePrivateStore( *xTruthParticle );
168 
169  if ( examineTruthTau(*xTruthTau).isFailure() )
170  {
171  continue;
172  }
173 
174  // The dressedPhoton decoration will likely be unlocked and thus will
175  // not be copied by the above. Copy it explicitly in that case.
176  // See ATLASRECTS-8008.
177  // First time through the loop we check to see if the decoration
178  // needs to be copied and remember for subsequent iterations
179  // (during which the destination decoration will have already
180  // been created).
181  if (truthTausEvent.m_xTruthTauContainer->empty() &&
182  dressedPhotonAcc.isAvailable ( *xTruthParticle ) &&
183  !dressedPhotonAcc.isAvailable ( *xTruthTau ))
184  {
185  copyDressedPhotons = true;
186  }
187  if (copyDressedPhotons)
188  {
189  dressedPhotonAcc( *xTruthTau ) = dressedPhotonAcc( *xTruthParticle );
190  }
191 
192  // Run classification
193  auto pClassification = m_tMCTruthClassifier->particleTruthClassifier(xTruthTau.get());
194  static const SG::Accessor<unsigned int> decClassifierParticleType("classifierParticleType");
195  static const SG::Accessor<unsigned int> decClassifierParticleOrigin("classifierParticleOrigin");
196  decClassifierParticleType(*xTruthTau) = pClassification.first;
197  decClassifierParticleOrigin(*xTruthTau) = pClassification.second;
198 
199  // create link to the original TruthParticle
200  ElementLink < xAOD::TruthParticleContainer > lTruthParticleLink(xTruthParticle, *truthTausEvent.m_xTruthParticleContainer);
201  static const SG::Accessor<ElementLink< xAOD::TruthParticleContainer > > accOriginalTruthParticle("originalTruthParticle");
202  accOriginalTruthParticle(*xTruthTau) = lTruthParticleLink;
203 
204  truthTausEvent.m_xTruthTauContainer->push_back(std::move(xTruthTau));
205  }
206  }
207  return StatusCode::SUCCESS;
208 }

◆ checkTruthLepton()

ElementLink< xAOD::TruthParticleContainer > DiTauTruthMatchingTool::checkTruthLepton ( const xAOD::IParticle pLepton) const
private

Definition at line 316 of file DiTauTruthMatchingTool.cxx.

316  {
318  static const SG::ConstAccessor<ElementLink<xAOD::TruthParticleContainer>> accTruthParticleLink("truthParticleLink");
319  if(!accTruthParticleLink.isAvailable(*pLepton)){
320  return truthParticleLink;
321  }
322  truthParticleLink = accTruthParticleLink(*pLepton);
323  return truthParticleLink;
324 }

◆ checkTruthMatch()

StatusCode DiTauTruthMatchingTool::checkTruthMatch ( const xAOD::DiTauJet xDiTau,
const xAOD::TruthParticleContainer xTauContainer 
) const
private

Definition at line 104 of file DiTauTruthMatchingTool.cxx.

105 {
106  std::vector<const xAOD::TruthParticle*> vTruthMatch;
107  std::vector<TruthMatchedParticleType> vTruthMatchedParticleType;
108 
109  xAOD::TruthParticleContainer xRemainingTruthTaus = xTruthTauContainer;
110 
111  static const SG::Decorator<char> decIsTruthMatched("IsTruthMatched");
112  static const SG::Decorator<char> decIsTruthHadronic("IsTruthHadronic");
113  static const SG::Decorator<char> decIsTruthHadMu("IsTruthHadMu");
114  static const SG::Decorator<char> decIsTruthHadEl("IsTruthHadEl");
115  static const SG::ConstAccessor<int> accNSubjets("n_subjets");
116  static const SG::ConstAccessor<char> accIsTruthHadronic("IsTruthHadronic");
117 
118  // set default values for each subjet
119  for (int i = 0; i < accNSubjets(xDiTau); ++i)
120  {
121  const xAOD::TruthParticle* xTruthMatch = nullptr;
122  TruthMatchedParticleType eTruthMatchedParticleType = Unknown;
123 
124  vTruthMatch.push_back(xTruthMatch);
125  vTruthMatchedParticleType.push_back(eTruthMatchedParticleType);
126  }
127 
128  // truthmatching for subjets:
129  for (int i = 0; i < accNSubjets(xDiTau); ++i)
130  {
131  TLorentzVector vSubjetTLV;
132  vSubjetTLV.SetPtEtaPhiE(xDiTau.subjetPt(i),
133  xDiTau.subjetEta(i),
134  xDiTau.subjetPhi(i),
135  xDiTau.subjetE(i));
136  if ( truthMatch(vSubjetTLV,
137  xRemainingTruthTaus,
138  vTruthMatch.at(i),
139  vTruthMatchedParticleType.at(i)).isFailure() )
140  {
141  ATH_MSG_WARNING("There was a failure in matching truth taus with subjet " << i);
142  return StatusCode::FAILURE;
143  }
144  if (vTruthMatch.at(i) && vTruthMatchedParticleType.at(i) == TruthHadronicTau)
145  {
146  xRemainingTruthTaus.erase( std::find(xRemainingTruthTaus.begin(),
147  xRemainingTruthTaus.end(),
148  vTruthMatch.at(i)) );
149  }
150  }
151 
152  bool bTruthMatched = true;
153 
154  // create link to the original TruthParticle
155  std::vector< ElementLink < xAOD::TruthParticleContainer > > vTruthLinks;
156  for (int i = 0; i < accNSubjets(xDiTau); ++i)
157  {
158  const xAOD::TruthParticle* xTruthMatch = vTruthMatch.at(i);
159  TruthMatchedParticleType eTruthMatchedParticleType = vTruthMatchedParticleType.at(i);
160  if (xTruthMatch)
161  {
162  if (eTruthMatchedParticleType == TruthHadronicTau)
163  {
164  ElementLink < xAOD::TruthParticleContainer > lTruthParticleLink(xTruthMatch, xTruthTauContainer);
165  vTruthLinks.push_back(lTruthParticleLink);
166  }
167  else if (eTruthMatchedParticleType == TruthMuon)
168  {
169  ElementLink <xAOD::TruthParticleContainer> lTruthParticleLink(xTruthMatch, *m_truthTausEvent.m_xTruthMuonContainerConst);
170  vTruthLinks.push_back(lTruthParticleLink);
171  }
172  else if (eTruthMatchedParticleType == TruthElectron)
173  {
174  ElementLink <xAOD::TruthParticleContainer> lTruthParticleLink(xTruthMatch, *m_truthTausEvent.m_xTruthElectronContainerConst);
175  vTruthLinks.push_back(lTruthParticleLink);
176  }
177  }
178  else
179  {
181  vTruthLinks.push_back(lTruthParticleLink);
182 
183  // ditau is not truth matched if one of the two leading subjets is not truth matched
184  if (i == 0 || i == 1) bTruthMatched = false;
185  }
186  }
187 
189  decTruthParticleLinks ("truthParticleLinks");
190  decTruthParticleLinks(xDiTau) = vTruthLinks;
192  {
194  decTruthTaus ("TruthTaus");
195  decTruthTaus(xDiTau) = vTruthLinks;
196  }
197 
199  static const SG::Decorator<unsigned int> decClassifierParticleType("classifierParticleTypeTruthLepton");
200  static const SG::Decorator<unsigned int> decClassifierParticleOrigin("classifierParticleOriginTruthLepton");
201  static const SG::Decorator<ElementLink<xAOD::TruthParticleContainer>> decTruthLeptonLink("truthLeptonLink");
202 
205  static const SG::ConstAccessor<int> accTruthType("truthType");
206  static const SG::ConstAccessor<int> accTruthOrigin("truthOrigin");
207  static const SG::ConstAccessor<ElementLink<xAOD::ElectronContainer>> accElLink("elLink");
208  static const SG::ConstAccessor<ElementLink<xAOD::MuonContainer>> accMuLink("muonLink");
209  if(accElLink.isAvailable(xDiTau) && accMuLink.isAvailable(xDiTau))
210  ATH_MSG_ERROR("Links to reco electron and reco muon available for one ditau candidate.");
211  if(accElLink.isAvailable(xDiTau)){
212  const xAOD::Electron* pElectron = *accElLink(xDiTau);
213  if ((accTruthType.isAvailable(*pElectron) && accTruthOrigin.isAvailable(*pElectron)))
214  {
215  mcTruthType = accTruthType(*pElectron);
216  mcTruthOrigin = accTruthOrigin(*pElectron);
217  }
218  lTruthLeptonLink = checkTruthLepton(pElectron);
219  }
220  if(accMuLink.isAvailable(xDiTau)){
221  const xAOD::Muon* pMuon = *accMuLink(xDiTau);
222  if (accTruthType.isAvailable(*pMuon) && accTruthOrigin.isAvailable(*pMuon))
223  {
224  mcTruthType = accTruthType(*pMuon);
225  mcTruthOrigin = accTruthOrigin(*pMuon);
226  }
227  lTruthLeptonLink = checkTruthLepton(pMuon);
228  }
229 
230  decIsTruthHadEl(xDiTau) = (char)(mcTruthType == MCTruthPartClassifier::ParticleType::IsoElectron && accNSubjets(xDiTau) != 0 && vTruthMatchedParticleType[0] == TruthHadronicTau);
231  decIsTruthHadMu(xDiTau) = (char)(mcTruthType == MCTruthPartClassifier::ParticleType::IsoMuon && accNSubjets(xDiTau) != 0 && vTruthMatchedParticleType[0] == TruthHadronicTau);
232  decClassifierParticleType(xDiTau) = mcTruthType;
233  decClassifierParticleOrigin(xDiTau) = mcTruthOrigin;
234  decTruthLeptonLink(xDiTau) = lTruthLeptonLink;
235 
236  static const SG::Decorator<float> decTruthLeadPt("TruthVisLeadPt");
237  static const SG::Decorator<float> decTruthLeadEta("TruthVisLeadEta");
238  static const SG::Decorator<float> decTruthLeadPhi("TruthVisLeadPhi");
239  static const SG::Decorator<float> decTruthLeadM("TruthVisLeadM");
240  static const SG::Decorator<float> decTruthSubleadPt("TruthVisSubleadPt");
241  static const SG::Decorator<float> decTruthSubleadEta("TruthVisSubleadEta");
242  static const SG::Decorator<float> decTruthSubleadPhi("TruthVisSubleadPhi");
243  static const SG::Decorator<float> decTruthSubleadM("TruthVisSubleadM");
244  static const SG::Decorator<float> decTruthDeltaR("TruthVisDeltaR");
245  static const SG::Decorator<float> decTruthMass("TruthVisMass");
246 
247  // the ditau candidate should have at least 2 subjets to be truth matched
248  if ( accNSubjets(xDiTau) < 2) {
249  decIsTruthMatched(xDiTau) = (char)false;
250  decIsTruthHadronic(xDiTau) = (char)false;
251  decTruthLeadPt(xDiTau) = -1234.;
252  decTruthLeadEta(xDiTau) = -1234.;
253  decTruthLeadPhi(xDiTau) = -1234.;
254  decTruthLeadM(xDiTau) = -1234.;
255  decTruthSubleadPt(xDiTau) = -1234.;
256  decTruthSubleadEta(xDiTau) = -1234.;
257  decTruthSubleadPhi(xDiTau) = -1234.;
258  decTruthSubleadM(xDiTau) = -1234.;
259  decTruthDeltaR(xDiTau) = -1234.;
260  decTruthMass(xDiTau) = -1234.;
261  return StatusCode::SUCCESS;
262  }
263 
264  decIsTruthMatched(xDiTau) = (char)bTruthMatched;
265  if (bTruthMatched)
266  {
267  // ditau is hadronic if two leading subjets are truth matched with hadronic decay
268  decIsTruthHadronic(xDiTau) = (char)(vTruthMatchedParticleType[0]==TruthHadronicTau
269  && vTruthMatchedParticleType[1]==TruthHadronicTau );
270  }
271  else
272  decIsTruthHadronic(xDiTau) = (char)false;
273 
274  if (accIsTruthHadronic(xDiTau))
275  {
276  TLorentzVector tlvTruthTau1;
277  TLorentzVector tlvTruthTau2;
278  tlvTruthTau1.SetPtEtaPhiM(m_accPtVis(*(*vTruthLinks.at(0))),
279  m_accEtaVis(*(*vTruthLinks.at(0))),
280  m_accPhiVis(*(*vTruthLinks.at(0))),
281  m_accMVis(*(*vTruthLinks.at(0))));
282  tlvTruthTau2.SetPtEtaPhiM(m_accPtVis(*(*vTruthLinks.at(1))),
283  m_accEtaVis(*(*vTruthLinks.at(1))),
284  m_accPhiVis(*(*vTruthLinks.at(1))),
285  m_accMVis(*(*vTruthLinks.at(1))));
286 
287  decTruthLeadPt(xDiTau) = std::max(tlvTruthTau1.Pt(), tlvTruthTau2.Pt());
288  decTruthLeadEta(xDiTau) = (tlvTruthTau1.Pt() > tlvTruthTau2.Pt()) ? tlvTruthTau1.Eta() : tlvTruthTau2.Eta();
289  decTruthLeadPhi(xDiTau) = (tlvTruthTau1.Pt() > tlvTruthTau2.Pt()) ? tlvTruthTau1.Phi() : tlvTruthTau2.Phi();
290  decTruthLeadM(xDiTau) = (tlvTruthTau1.Pt() > tlvTruthTau2.Pt()) ? tlvTruthTau1.M() : tlvTruthTau2.M();
291  decTruthSubleadPt(xDiTau) = std::min(tlvTruthTau1.Pt(), tlvTruthTau2.Pt());
292  decTruthSubleadEta(xDiTau) = (tlvTruthTau1.Pt() > tlvTruthTau2.Pt()) ? tlvTruthTau2.Eta() : tlvTruthTau1.Eta();
293  decTruthSubleadPhi(xDiTau) = (tlvTruthTau1.Pt() > tlvTruthTau2.Pt()) ? tlvTruthTau2.Phi() : tlvTruthTau1.Phi();
294  decTruthSubleadM(xDiTau) = (tlvTruthTau1.Pt() > tlvTruthTau2.Pt()) ? tlvTruthTau2.M() : tlvTruthTau1.M();
295  decTruthDeltaR(xDiTau) = tlvTruthTau1.DeltaR(tlvTruthTau2);
296  decTruthMass(xDiTau) = (tlvTruthTau1 + tlvTruthTau2).M();
297  }
298  else {
299  // set to a default value
300  decTruthLeadPt(xDiTau) = -1234.;
301  decTruthLeadEta(xDiTau) = -1234.;
302  decTruthLeadPhi(xDiTau) = -1234.;
303  decTruthLeadM(xDiTau) = -1234.;
304  decTruthSubleadPt(xDiTau) = -1234.;
305  decTruthSubleadEta(xDiTau) = -1234.;
306  decTruthSubleadPhi(xDiTau) = -1234.;
307  decTruthSubleadM(xDiTau) = -1234.;
308  decTruthDeltaR(xDiTau) = -1234.;
309  decTruthMass(xDiTau) = -1234.;
310  }
311 
312  return StatusCode::SUCCESS;
313 }

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

◆ endInputFile()

StatusCode asg::AsgMetadataTool::endInputFile ( )
protectedvirtualinherited

Function called when the currently open input file got completely processed.

Dummy implementation that can be overridden by the derived tool.

Reimplemented in BookkeeperTool, xAODMaker::FileMetaDataTool, BookkeeperDumperTool, xAODMaker::TriggerMenuMetaDataTool, and xAODMaker::TruthMetaDataTool.

Definition at line 188 of file AsgMetadataTool.cxx.

188  {
189 
190  // Return gracefully:
191  return StatusCode::SUCCESS;
192  }

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

◆ examineTruthTau()

StatusCode BuildTruthTaus::examineTruthTau ( const xAOD::TruthParticle xTruthParticle) const
privateinherited

Definition at line 211 of file BuildTruthTaus.cxx.

212 {
213  // skip this tau if it has no decay vertex, should not happen
214  if ( !xTruthParticle.hasDecayVtx() )
215  return StatusCode::FAILURE;
216 
217  ATH_MSG_VERBOSE("looking for charged daughters of a truth tau");
218 
219  TauTruthInfo truthInfo;
220 
221  const xAOD::TruthVertex* xDecayVertex = xTruthParticle.decayVtx();
222  if (xDecayVertex == nullptr)
223  return StatusCode::FAILURE;
224  for ( size_t iOutgoingParticle = 0; iOutgoingParticle < xDecayVertex->nOutgoingParticles(); ++iOutgoingParticle )
225  {
226  const xAOD::TruthParticle* xTruthDaughter = xDecayVertex->outgoingParticle(iOutgoingParticle);
227  if (xTruthDaughter == nullptr)
228  {
229  ATH_MSG_ERROR("Truth daughter of tau decay was not found in "<< m_truthParticleContainer.key() <<" container. Please ensure that this container has the full tau decay information or produce the TruthTaus container in AtlasDerivation.");
230  return StatusCode::FAILURE;
231  }
232 
233  // if tau decays into tau this is not a proper tau decay
234  if ( xTruthDaughter->isTau() )
235  {
236  ATH_MSG_VERBOSE("Tau decays into a tau itself -> skip this decay");
237  return StatusCode::FAILURE;
238  }
239  }
240 
241  examineTruthTauDecay(xTruthParticle, truthInfo).ignore();
242 
243  if (truthInfo.m_bIsHadronicTau)
244  ATH_MSG_VERBOSE(truthInfo.m_iNChargedDaughters << " prong hadronic truth tau was found with uniqueID "<<HepMC::uniqueID(xTruthParticle));
245  else
246  ATH_MSG_VERBOSE(truthInfo.m_iNChargedDaughters << " prong leptonic truth tau was found with uniqueID "<<HepMC::uniqueID(xTruthParticle));
247  if ( truthInfo.m_iNChargedDaughters%2 == 0 )
248  {
249  ATH_MSG_WARNING("found tau with even multiplicity: " << truthInfo.m_iNChargedDaughters);
250  printDecay(xTruthParticle);
251  }
252 
253  static const SG::Decorator<double> decPtVis("pt_vis");
254  static const SG::Decorator<double> decEtaVis("eta_vis");
255  static const SG::Decorator<double> decPhiVis("phi_vis");
256  static const SG::Decorator<double> decMVis("m_vis");
257 
258  static const SG::Decorator<size_t> decNumCharged("numCharged");
259  static const SG::Decorator<size_t> decNumChargedPion("numChargedPion");
260  static const SG::Decorator<size_t> decNumNeutral("numNeutral");
261  static const SG::Decorator<size_t> decNumNeutralPion("numNeutralPion");
262 
263  decPtVis(xTruthParticle) = truthInfo.m_vTruthVisTLV.Pt();
264  decEtaVis(xTruthParticle) = truthInfo.m_vTruthVisTLV.Eta();
265  decPhiVis(xTruthParticle) = truthInfo.m_vTruthVisTLV.Phi();
266  decMVis(xTruthParticle) = truthInfo.m_vTruthVisTLV.M();
267 
268  decNumCharged(xTruthParticle) = truthInfo.m_iNChargedDaughters;
269  decNumChargedPion(xTruthParticle) = truthInfo.m_iNChargedPions;
270  decNumNeutral(xTruthParticle) = truthInfo.m_iNNeutralPions+truthInfo.m_iNNeutralOthers;
271  decNumNeutralPion(xTruthParticle) = truthInfo.m_iNNeutralPions;
272 
273  static const SG::Decorator<char> decIsHadronicTau("IsHadronicTau");
274  decIsHadronicTau(xTruthParticle) = (char)truthInfo.m_bIsHadronicTau;
275 
277  {
278  TLorentzVector vTruthInvisTLV = xTruthParticle.p4() - truthInfo.m_vTruthVisTLV;
279  static const SG::Decorator<double> decPtInvis("pt_invis");
280  static const SG::Decorator<double> decEtaInvis("eta_invis");
281  static const SG::Decorator<double> decPhiInvis("phi_invis");
282  static const SG::Decorator<double> decMInvis("m_invis");
283  decPtInvis(xTruthParticle) = vTruthInvisTLV.Pt();
284  decEtaInvis(xTruthParticle) = vTruthInvisTLV.Eta();
285  decPhiInvis(xTruthParticle) = vTruthInvisTLV.Phi();
286  decMInvis(xTruthParticle) = vTruthInvisTLV.M();
287  }
288 
290  {
291  static const SG::Decorator<double> decPtVisCharged("pt_vis_charged");
292  static const SG::Decorator<double> decEtaVisCharged("eta_vis_charged");
293  static const SG::Decorator<double> decPhiVisCharged("phi_vis_charged");
294  static const SG::Decorator<double> decMVisCharged("m_vis_charged");
295  decPtVisCharged(xTruthParticle) = truthInfo.m_vTruthVisTLVCharged.Pt();
296  decEtaVisCharged(xTruthParticle) = truthInfo.m_vTruthVisTLVCharged.Eta();
297  decPhiVisCharged(xTruthParticle) = truthInfo.m_vTruthVisTLVCharged.Phi();
298  decMVisCharged(xTruthParticle) = truthInfo.m_vTruthVisTLVCharged.M();
299  }
300 
302  {
303  static const SG::Decorator<double> decPtVisNeutral("pt_vis_neutral");
304  static const SG::Decorator<double> decEtaVisNeutral("eta_vis_neutral");
305  static const SG::Decorator<double> decPhiVisNeutral("phi_vis_neutral");
306  static const SG::Decorator<double> decMVisNeutral("m_vis_neutral");
307  decPtVisNeutral(xTruthParticle) = truthInfo.m_vTruthVisTLVNeutral.Pt();
308  decEtaVisNeutral(xTruthParticle) = truthInfo.m_vTruthVisTLVNeutral.Eta();
309  decPhiVisNeutral(xTruthParticle) = truthInfo.m_vTruthVisTLVNeutral.Phi();
310  decMVisNeutral(xTruthParticle) = truthInfo.m_vTruthVisTLVNeutral.M();
311  }
312 
314  {
315  static const SG::Decorator<std::vector<int> > decDecayModeVector("DecayModeVector");
316  decDecayModeVector(xTruthParticle) = truthInfo.m_vDecayMode;
317  }
318 
319  if ( m_bWriteVertices )
320  {
321  // tau decay vertex
322  static const SG::Decorator<float> decDecayVertexX("decay_vertex_x");
323  static const SG::Decorator<float> decDecayVertexY("decay_vertex_y");
324  static const SG::Decorator<float> decDecayVertexZ("decay_vertex_z");
325 
326  decDecayVertexX(xTruthParticle) = truthInfo.m_vDecayVertex.X();
327  decDecayVertexY(xTruthParticle) = truthInfo.m_vDecayVertex.Y();
328  decDecayVertexZ(xTruthParticle) = truthInfo.m_vDecayVertex.Z();
329 
330  // tau production vertex
331  static const SG::Decorator<float> decProdVertexX("prod_vertex_x");
332  static const SG::Decorator<float> decProdVertexY("prod_vertex_y");
333  static const SG::Decorator<float> decProdVertexZ("prod_vertex_z");
334 
335  decProdVertexX(xTruthParticle) = truthInfo.m_vProdVertex.X();
336  decProdVertexY(xTruthParticle) = truthInfo.m_vProdVertex.Y();
337  decProdVertexZ(xTruthParticle) = truthInfo.m_vProdVertex.Z();
338  }
339 
340  return StatusCode::SUCCESS;
341 }

◆ examineTruthTauDecay()

StatusCode BuildTruthTaus::examineTruthTauDecay ( const xAOD::TruthParticle xTruthParticle,
TauTruthInfo truthInfo 
) const
privateinherited

Definition at line 344 of file BuildTruthTaus.cxx.

346 {
347  // get vertex and check if it exists
348  const xAOD::TruthVertex* xDecayVertex = xTruthParticle.decayVtx();
349  if (!xDecayVertex)
350  return StatusCode::SUCCESS;
351 
352  truthInfo.m_vDecayVertex.SetXYZ(xDecayVertex->x(),xDecayVertex->y(),xDecayVertex->z());
353 
354  if (xTruthParticle.hasProdVtx() ) {
355  const xAOD::TruthVertex* xProdVertex = xTruthParticle.prodVtx();
356  truthInfo.m_vProdVertex.SetXYZ(xProdVertex->x(),xProdVertex->y(),xProdVertex->z());
357  } else {
358  truthInfo.m_vProdVertex.SetXYZ(-1234,-1234,-1234);
359  }
360 
361  for ( size_t iOutgoingParticle = 0; iOutgoingParticle < xDecayVertex->nOutgoingParticles(); ++iOutgoingParticle )
362  {
363  const xAOD::TruthParticle* xTruthDaughter = xDecayVertex->outgoingParticle(iOutgoingParticle);
364  if (xTruthDaughter == nullptr)
365  {
366  ATH_MSG_ERROR("Truth daughter of tau decay was not found in "<< m_truthParticleContainer.key() <<" container. Please ensure that this container has the full tau decay information or produce the TruthTaus container in AtlasDerivation.");
367  return StatusCode::FAILURE;
368  }
369 
370  int iAbsPdgId = xTruthDaughter->absPdgId();
371  int iPdgId = xTruthDaughter->pdgId();
372 
373  // look at decay of unstable particles
374  if (MC::isDecayed(xTruthDaughter) || !MC::isPhysical(xTruthDaughter))
375  {
376  if ( iAbsPdgId != 111 && iAbsPdgId != 311 && iAbsPdgId != 310 && iAbsPdgId != 130 )
377  {
378  examineTruthTauDecay(*xTruthDaughter, truthInfo).ignore();
379  continue;
380  }
381  }
382 
383  // only process stable particles
384  if (!MC::isStable(xTruthDaughter) && !MC::isDecayed(xTruthDaughter))
385  continue;
386 
387  // add pdgID to vector for decay mode classification
388  truthInfo.m_vDecayMode.push_back(iPdgId);
389 
390  // if tau decays leptonically, indicated by an electron/muon neutrino then
391  // it is not a hadronic decay
392  if ( xTruthDaughter->isHadron() )
393  truthInfo.m_bIsHadronicTau = true;
394 
395  // ignore neutrinos for further progress
396  if ( xTruthDaughter->isNeutrino() )
397  {
398  ATH_MSG_VERBOSE("found neutrino decay particle with PdgId "<<iPdgId);
399  continue;
400  }
401 
402  // add momentum of non-neutrino particle to visible momentum
403  truthInfo.m_vTruthVisTLV += xTruthDaughter->p4();
405  if ( xTruthDaughter->isCharged() )
406  truthInfo.m_vTruthVisTLVCharged += xTruthDaughter->p4();
408  if ( xTruthDaughter->isNeutral() )
409  truthInfo.m_vTruthVisTLVNeutral += xTruthDaughter->p4();
410 
411  // only count charged decay particles
412  if ( xTruthDaughter->isCharged() )
413  {
414  ATH_MSG_VERBOSE("found charged decay particle with PdgId "<<iPdgId);
415  truthInfo.m_iNChargedDaughters++;
416  // count charged pions
417  if (iAbsPdgId==211) truthInfo.m_iNChargedPions++;
418  else truthInfo.m_iNChargedOthers++;
419  }
420  else
421  {
422  ATH_MSG_VERBOSE("found neutral decay particle with PdgId "<<iPdgId);
423  // count neutral pions
424  if (iAbsPdgId==111) truthInfo.m_iNNeutralPions++;
425  else truthInfo.m_iNNeutralOthers++;
426  }
427  }
428  return StatusCode::SUCCESS;
429 }

◆ 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

◆ findTruthTau()

StatusCode DiTauTruthMatchingTool::findTruthTau ( const xAOD::DiTauJet xDiTau)
private

Definition at line 87 of file DiTauTruthMatchingTool.cxx.

88 {
89  // check if decorations were already added to the first passed tau
91  static const SG::ConstAccessor<char> accIsTruthMatched("IsTruthMatched");
92  m_bIsTruthMatchedAvailable.set (accIsTruthMatched.isAvailable(xDiTau));
93  }
95  return StatusCode::SUCCESS;
96 
98  return checkTruthMatch(xDiTau, *m_truthTausEvent.m_xTruthTauContainerConst);
99  else
100  return checkTruthMatch(xDiTau, *m_truthTausEvent.m_xTruthTauContainer);
101 }

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

◆ getProperty()

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

Get one of the tool's properties.

◆ getTruth() [1/2]

void DiTauTruthMatchingTool::getTruth ( const std::vector< const xAOD::DiTauJet * > &  vDiTaus)
privatevirtual

Implements TauAnalysisTools::IDiTauTruthMatchingTool.

Definition at line 74 of file DiTauTruthMatchingTool.cxx.

75 {
76  for (auto xDiTau : vDiTaus)
77  getTruth(*xDiTau);
78  return;
79 }

◆ getTruth() [2/2]

void DiTauTruthMatchingTool::getTruth ( const xAOD::DiTauJet xDiTau)
privatevirtual

get pointer to the truth matched particle.

if no truth particle was found a null pointer is returned

Implements TauAnalysisTools::IDiTauTruthMatchingTool.

Definition at line 62 of file DiTauTruthMatchingTool.cxx.

63 {
64  if (retrieveTruthTaus().isFailure())
65  return;
66 
67  if (findTruthTau(xDiTau).isFailure())
68  ATH_MSG_WARNING("There was a failure in finding the matched truth tau");
69 
70  return;
71 }

◆ handle()

void asg::AsgMetadataTool::handle ( const Incident &  inc)
protectedvirtualinherited

Function receiving incidents from IncidentSvc/TEvent.

Reimplemented in Trig::TrigDecisionTool.

Definition at line 130 of file AsgMetadataTool.cxx.

130  {
131 
132  // Tell the user what's happening:
133  ATH_MSG_VERBOSE( "Callback received with incident: " << inc.type() );
134 
135  // Call the appropriate member function:
136  if( inc.type() == IncidentType::BeginInputFile ) {
137  m_beginInputFileCalled = true;
138  if( beginInputFile().isFailure() ) {
139  ATH_MSG_FATAL( "Failed to call beginInputFile()" );
140  throw std::runtime_error( "Couldn't call beginInputFile()" );
141  }
142  } else if( inc.type() == IncidentType::EndInputFile ) {
143  if( endInputFile().isFailure() ) {
144  ATH_MSG_FATAL( "Failed to call endInputFile()" );
145  throw std::runtime_error( "Couldn't call endInputFile()" );
146  }
147  } else if( inc.type() == IncidentType::BeginEvent ) {
148  // If the tool didn't catch the begin input file incident for the
149  // first input file of the job, then call the appropriate function
150  // now.
151  if( ! m_beginInputFileCalled ) {
152  m_beginInputFileCalled = true;
153  if( beginInputFile().isFailure() ) {
154  ATH_MSG_FATAL( "Failed to call beginInputFile()" );
155  throw std::runtime_error( "Couldn't call beginInputFile()" );
156  }
157  }
158  if( beginEvent().isFailure() ) {
159  ATH_MSG_FATAL( "Failed to call beginEvent()" );
160  throw std::runtime_error( "Couldn't call beginEvent()" );
161  }
162 
163  #ifdef XAOD_STANDALONE
164  } else if( inc.type() == IncidentType::MetaDataStop ) {
165  if( metaDataStop().isFailure() ) {
166  ATH_MSG_FATAL( "Failed to call metaDataStop()" );
167  throw std::runtime_error( "Couldn't call metaDataStop()" );
168  }
169 
170  #endif // XAOD_STANDALONE
171  } else {
172  ATH_MSG_WARNING( "Unknown incident type received in AsgMetaDataTool: " << inc.type() );
173  }
174 
175  return;
176  }

◆ initialize()

StatusCode DiTauTruthMatchingTool::initialize ( )
privatevirtual

Reimplemented from TauAnalysisTools::BuildTruthTaus.

Definition at line 46 of file DiTauTruthMatchingTool.cxx.

47 {
48  ATH_MSG_INFO( "Initializing DiTauTruthMatchingTool" );
49 
50  // configure BuildTruthTaus in truth matching mode, not truth tau building mode
51  DiTauTruthMatchingTool::BuildTruthTaus::setTruthMatchingMode();
52 
54  {
55  ATH_MSG_FATAL("Failed initializing BuildTruthTaus");
56  return StatusCode::FAILURE;
57  }
58  return StatusCode::SUCCESS;
59 }

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

◆ inputMetaStore()

AsgMetadataTool::MetaStorePtr_t asg::AsgMetadataTool::inputMetaStore ( ) const
inherited

Accessor for the input metadata store.

Definition at line 88 of file AsgMetadataTool.cxx.

88  {
89 
90 #ifdef XAOD_STANDALONE
91  return &m_inputMetaStore;
92 #else // XAOD_STANDALONE
93  return m_inputMetaStore;
94 #endif // XAOD_STANDALONE
95  }

◆ metaDataStop()

StatusCode asg::AsgMetadataTool::metaDataStop ( )
protectedvirtualinherited

Function called when the tool should write out its metadata.

Dummy implementation that can be overridden by the derived tool.

Reimplemented in xAODMaker::FileMetaDataTool, BookkeeperTool, BookkeeperDumperTool, xAODMaker::TriggerMenuMetaDataTool, and xAODMaker::TruthMetaDataTool.

Definition at line 204 of file AsgMetadataTool.cxx.

204  {
205 
206  // Return gracefully:
207  return StatusCode::SUCCESS;
208  }

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

◆ outputMetaStore()

AsgMetadataTool::MetaStorePtr_t asg::AsgMetadataTool::outputMetaStore ( ) const
inherited

Accessor for the output metadata store.

Definition at line 97 of file AsgMetadataTool.cxx.

97  {
98 
99 #ifdef XAOD_STANDALONE
100  return &m_outputMetaStore;
101 #else // XAOD_STANDALONE
102  return m_outputMetaStore;
103 #endif // XAOD_STANDALONE
104  }

◆ print() [1/2]

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

◆ print() [2/2]

virtual void asg::IAsgTool::print ( ) const
pure virtualinherited

◆ printDecay()

void BuildTruthTaus::printDecay ( const xAOD::TruthParticle xTruthParticle,
int  depth = 0 
) const
privateinherited

Definition at line 431 of file BuildTruthTaus.cxx.

432 {
433  // loop over all decay particles, print their kinematic and other properties
434 
435  const xAOD::TruthVertex* xDecayVertex = xTruthParticle.decayVtx();
436  if (xDecayVertex == nullptr)
437  return;
438 
439  for ( size_t iOutgoingParticle = 0; iOutgoingParticle < xDecayVertex->nOutgoingParticles(); ++iOutgoingParticle )
440  {
441  const xAOD::TruthParticle* xTruthDaughter = xDecayVertex->outgoingParticle(iOutgoingParticle);
442  if (xTruthDaughter == nullptr)
443  {
444  ATH_MSG_WARNING("Truth daughter of tau decay was not found in "<< m_truthParticleContainer.key() <<" container. Please ensure that this container has the full tau decay information or produce the TruthTaus container in AtlasDerivation.");
445  return;
446  }
447  ATH_MSG_WARNING("depth "<<depth
448  <<" e "<<xTruthDaughter->e()
449  <<" eta "<<xTruthDaughter->p4().Eta()
450  <<" phi "<<xTruthDaughter->p4().Phi()
451  <<" pdgid "<<xTruthDaughter->pdgId()
452  <<" status "<<xTruthDaughter->status()
453  <<" uniqueID "<<HepMC::uniqueID(xTruthDaughter));
454  printDecay(*xTruthDaughter, depth+1);
455  }
456 }

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

◆ retrieveTruthTaus() [1/3]

StatusCode BuildTruthTaus::retrieveTruthTaus ( )
overrideprivatevirtualinherited

Implements TauAnalysisTools::IBuildTruthTaus.

Definition at line 69 of file BuildTruthTaus.cxx.

70 {
72 }

◆ retrieveTruthTaus() [2/3]

StatusCode BuildTruthTaus::retrieveTruthTaus ( ITruthTausEvent truthTausEvent) const
overrideprivatevirtualinherited

Implements TauAnalysisTools::IBuildTruthTaus.

Definition at line 75 of file BuildTruthTaus.cxx.

76 {
77  return retrieveTruthTaus (dynamic_cast<TruthTausEvent&> (truthTausEvent));
78 }

◆ retrieveTruthTaus() [3/3]

StatusCode BuildTruthTaus::retrieveTruthTaus ( TruthTausEvent &  truthTausEvent) const
protectedinherited

Definition at line 81 of file BuildTruthTaus.cxx.

82 {
83  const EventContext& ctx = Gaudi::Hive::currentContext();
84 
87  if (!truthElectronsHandle.isValid()) {
88  ATH_MSG_ERROR ("Could not retrieve " << truthElectronsHandle.key());
89  return StatusCode::FAILURE;
90  }
91  truthTausEvent.m_xTruthElectronContainerConst = truthElectronsHandle.cptr();
92  }
93  else {
94  ATH_MSG_WARNING("Truth electron container is not available, won't perform matching to truth electrons");
95  }
96 
97  if (!m_truthMuonContainer.empty()) {
99  if (!truthMuonsHandle.isValid()) {
100  ATH_MSG_ERROR ("Could not retrieve " << truthMuonsHandle.key());
101  return StatusCode::FAILURE;
102  }
103  truthTausEvent.m_xTruthMuonContainerConst = truthMuonsHandle.cptr();
104  }
105  else {
106  ATH_MSG_WARNING("Truth muon container is not available, won't perform matching to truth muons");
107  }
108 
109  if (!m_truthJetContainer.empty()) {
111  if (!truthJetsHandle.isValid()) {
112  ATH_MSG_ERROR ("Could not retrieve " << truthJetsHandle.key());
113  return StatusCode::FAILURE;
114  }
115  truthTausEvent.m_xTruthJetContainerConst = truthJetsHandle.cptr();
116  }
117  else {
118  ATH_MSG_WARNING("Truth jet container is not available, won't perform matching to truth jets");
119  }
120 
121  // if TruthTaus container exists, retrieve it, else build it from TruthParticles
122  if (m_truthMatchingMode) {
124  if (!truthTausHandle.isValid()) {
125  ATH_MSG_ERROR ("Could not retrieve " << truthTausHandle.key());
126  return StatusCode::FAILURE;
127  }
128  truthTausEvent.m_xTruthTauContainerConst = truthTausHandle.cptr();
129  }
130  else {
132  if (!truthParticlesHandle.isValid()) {
133  ATH_MSG_ERROR ("Could not retrieve " << truthParticlesHandle.key());
134  return StatusCode::FAILURE;
135  }
136  truthTausEvent.m_xTruthParticleContainer = truthParticlesHandle.cptr();
137 
138  auto truthTausOutput = std::make_unique<xAOD::TruthParticleContainer>();
139  auto truthTausOutputAux = std::make_unique<xAOD::TruthParticleAuxContainer>();
140  truthTausOutput->setStore(truthTausOutputAux.get());
141  truthTausEvent.m_xTruthTauContainer = truthTausOutput.get();
142 
143  ATH_CHECK( buildTruthTausFromTruthParticles(truthTausEvent) );
144 
145  auto writeHandle = SG::makeHandle(m_truthTauOutputContainer, ctx);
146  ATH_CHECK(writeHandle.record(std::move(truthTausOutput), std::move(truthTausOutputAux)));
147  }
148 
149  return StatusCode::SUCCESS;
150 }

◆ setTruthMatchingMode()

virtual void TauAnalysisTools::BuildTruthTaus::setTruthMatchingMode ( )
inlineoverrideprivatevirtualinherited

Implements TauAnalysisTools::IBuildTruthTaus.

Definition at line 60 of file BuildTruthTaus.h.

60  {
61  m_truthMatchingMode = true;
62  };

◆ setUseIncidents()

void asg::AsgMetadataTool::setUseIncidents ( const bool  flag)
inlineprotectedinherited

Definition at line 132 of file AsgMetadataTool.h.

133  {
135  }

◆ sysInitialize()

StatusCode asg::AsgMetadataTool::sysInitialize ( )
virtualinherited

Function initialising the tool in the correct way in Athena.

This function is used to set up the callbacks from IncidentSvc in Athena at the right time during initialisation, without the user having to do anything special in his/her code.

Reimplemented from AthCommonDataStore< AthCommonMsg< AlgTool > >.

Definition at line 110 of file AsgMetadataTool.cxx.

110  {
111 
112 #ifndef XAOD_STANDALONE
113  if (m_useIncidents) {
114  // Connect to the IncidentSvc:
115  ServiceHandle< IIncidentSvc > incSvc( "IncidentSvc", name() );
116  ATH_CHECK( incSvc.retrieve() );
117 
118  // Set up the right callbacks: don't rethrow exceptions, any failure and we should end
119  incSvc->addListener( this, IncidentType::BeginEvent, 0, false );
120  }
121  // Let the base class do its thing:
122  ATH_CHECK( AlgTool::sysInitialize() );
123 
124 #endif // not XAOD_STANDALONE
125 
126  // Return gracefully:
127  return StatusCode::SUCCESS;
128  }

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

◆ truthMatch()

StatusCode DiTauTruthMatchingTool::truthMatch ( const TLorentzVector &  vSubjetTLV,
const xAOD::TruthParticleContainer xTruthTauContainer,
const xAOD::TruthParticle *&  xTruthMatch,
TruthMatchedParticleType eTruthMatchedParticleType 
) const
private

Definition at line 327 of file DiTauTruthMatchingTool.cxx.

331 {
332  for (auto xTruthTauIt : xTruthTauContainer)
333  {
334  TLorentzVector vTruthVisTLV;
335  vTruthVisTLV.SetPtEtaPhiM(m_accPtVis(*xTruthTauIt),
336  m_accEtaVis(*xTruthTauIt),
337  m_accPhiVis(*xTruthTauIt),
338  m_accMVis(*xTruthTauIt));
339  if (vSubjetTLV.DeltaR(vTruthVisTLV) <= m_dMaxDeltaR)
340  {
341  static const SG::ConstAccessor<char> accIsHadronicTau("IsHadronicTau");
342  if ((bool)accIsHadronicTau(*xTruthTauIt))
343  eTruthMatchedParticleType = TruthHadronicTau;
344  else
345  continue; // don't let leptonic taus steal truthmatch just by chance
346 
347  xTruthMatch = xTruthTauIt;
348  break;
349  }
350  }
351 
352  if (!xTruthMatch and m_truthTausEvent.m_xTruthMuonContainerConst)
353  {
354  double dPtMax = 0.;
355  for (auto xTruthMuonIt : *m_truthTausEvent.m_xTruthMuonContainerConst)
356  {
357  if (vSubjetTLV.DeltaR(xTruthMuonIt->p4()) <= m_dMaxDeltaR)
358  {
359  if (xTruthMuonIt->pt()<dPtMax)
360  continue;
361  eTruthMatchedParticleType = TruthMuon;
362 
363  xTruthMatch = xTruthMuonIt;
364  dPtMax = xTruthMuonIt->pt();
365  }
366  }
367  }
368 
369  if (!xTruthMatch and m_truthTausEvent.m_xTruthElectronContainerConst)
370  {
371  double dPtMax = 0.;
372  for (auto xTruthElectronIt : *m_truthTausEvent.m_xTruthElectronContainerConst)
373  {
374  if (vSubjetTLV.DeltaR(xTruthElectronIt->p4()) <= m_dMaxDeltaR)
375  {
376  if (xTruthElectronIt->pt()<dPtMax)
377  continue;
378  eTruthMatchedParticleType = TruthElectron;
379  xTruthMatch = xTruthElectronIt;
380  dPtMax = xTruthElectronIt->pt();
381  }
382  }
383  }
384 
385  return StatusCode::SUCCESS;
386 }

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

SG::ConstAccessor<double> TauAnalysisTools::DiTauTruthMatchingTool::m_accEtaVis
private

Definition at line 71 of file DiTauTruthMatchingTool.h.

◆ m_accMVis

SG::ConstAccessor<double> TauAnalysisTools::DiTauTruthMatchingTool::m_accMVis
private

Definition at line 73 of file DiTauTruthMatchingTool.h.

◆ m_accPhiVis

SG::ConstAccessor<double> TauAnalysisTools::DiTauTruthMatchingTool::m_accPhiVis
private

Definition at line 72 of file DiTauTruthMatchingTool.h.

◆ m_accPtVis

SG::ConstAccessor<double> TauAnalysisTools::DiTauTruthMatchingTool::m_accPtVis
private

Definition at line 70 of file DiTauTruthMatchingTool.h.

◆ m_beginInputFileCalled

bool asg::AsgMetadataTool::m_beginInputFileCalled
privateinherited

Flag helping to discover when the tool misses the opening of the first input file.

Definition at line 126 of file AsgMetadataTool.h.

◆ m_bIsTruthMatchedAvailable

CxxUtils::CachedValue<bool> TauAnalysisTools::DiTauTruthMatchingTool::m_bIsTruthMatchedAvailable
private

Definition at line 65 of file DiTauTruthMatchingTool.h.

◆ m_bIsTruthParticleLinkAvailable

CxxUtils::CachedValue<bool> TauAnalysisTools::DiTauTruthMatchingTool::m_bIsTruthParticleLinkAvailable
private

Definition at line 66 of file DiTauTruthMatchingTool.h.

◆ m_bTruthTauAvailable

bool TauAnalysisTools::BuildTruthTaus::m_bTruthTauAvailable {}
protectedinherited

Definition at line 108 of file BuildTruthTaus.h.

◆ m_bWriteDecayModeVector

bool TauAnalysisTools::BuildTruthTaus::m_bWriteDecayModeVector {}
privateinherited

Definition at line 125 of file BuildTruthTaus.h.

◆ m_bWriteInvisibleFourMomentum

bool TauAnalysisTools::BuildTruthTaus::m_bWriteInvisibleFourMomentum {}
privateinherited

Definition at line 122 of file BuildTruthTaus.h.

◆ m_bWriteVertices

bool TauAnalysisTools::BuildTruthTaus::m_bWriteVertices {}
privateinherited

Definition at line 126 of file BuildTruthTaus.h.

◆ m_bWriteVisibleChargedFourMomentum

bool TauAnalysisTools::BuildTruthTaus::m_bWriteVisibleChargedFourMomentum {}
privateinherited

Definition at line 123 of file BuildTruthTaus.h.

◆ m_bWriteVisibleNeutralFourMomentum

bool TauAnalysisTools::BuildTruthTaus::m_bWriteVisibleNeutralFourMomentum {}
privateinherited

Definition at line 124 of file BuildTruthTaus.h.

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

double TauAnalysisTools::DiTauTruthMatchingTool::m_dMaxDeltaR
private

Definition at line 63 of file DiTauTruthMatchingTool.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_inputMetaStore

MetaStore_t asg::AsgMetadataTool::m_inputMetaStore
privateinherited

Object accessing the input metadata store.

Definition at line 119 of file AsgMetadataTool.h.

◆ m_outputMetaStore

MetaStore_t asg::AsgMetadataTool::m_outputMetaStore
privateinherited

Object accessing the output metadata store.

Definition at line 121 of file AsgMetadataTool.h.

◆ m_tMCTruthClassifier

asg::AnaToolHandle<IMCTruthClassifier> TauAnalysisTools::BuildTruthTaus::m_tMCTruthClassifier
privateinherited

Definition at line 128 of file BuildTruthTaus.h.

◆ m_truthElectronContainer

SG::ReadHandleKey<xAOD::TruthParticleContainer> TauAnalysisTools::BuildTruthTaus::m_truthElectronContainer { this, "TruthElectronContainerName", "TruthElectrons", "Truth electrons input container name" }
privateinherited

Definition at line 115 of file BuildTruthTaus.h.

◆ m_truthJetContainer

SG::ReadHandleKey<xAOD::JetContainer> TauAnalysisTools::BuildTruthTaus::m_truthJetContainer { this, "TruthJetContainerName", "AntiKt4TruthDressedWZJets", "Truth jets input container name" }
privateinherited

Definition at line 117 of file BuildTruthTaus.h.

◆ m_truthMatchingMode

bool TauAnalysisTools::BuildTruthTaus::m_truthMatchingMode = false
privateinherited

Definition at line 121 of file BuildTruthTaus.h.

◆ m_truthMuonContainer

SG::ReadHandleKey<xAOD::TruthParticleContainer> TauAnalysisTools::BuildTruthTaus::m_truthMuonContainer { this, "TruthMuonContainerName", "TruthMuons", "Truth muons input container name" }
privateinherited

Definition at line 116 of file BuildTruthTaus.h.

◆ m_truthParticleContainer

SG::ReadHandleKey<xAOD::TruthParticleContainer> TauAnalysisTools::BuildTruthTaus::m_truthParticleContainer { this, "TruthParticleContainerName", "TruthParticles", "Truth particles input container name" }
privateinherited

Definition at line 114 of file BuildTruthTaus.h.

◆ m_truthTauInputContainer

SG::ReadHandleKey<xAOD::TruthParticleContainer> TauAnalysisTools::BuildTruthTaus::m_truthTauInputContainer { this, "TruthTauContainerName", "TruthTaus", "Truth tau input container name (truth matching mode)" }
privateinherited

Definition at line 113 of file BuildTruthTaus.h.

◆ m_truthTauOutputContainer

SG::WriteHandleKey<xAOD::TruthParticleContainer> TauAnalysisTools::BuildTruthTaus::m_truthTauOutputContainer { this, "NewTruthTauContainerName", "TruthTaus", "Truth tau output container name" }
privateinherited

Definition at line 119 of file BuildTruthTaus.h.

◆ m_truthTausEvent

TruthTausEvent TauAnalysisTools::BuildTruthTaus::m_truthTausEvent
protectedinherited

Definition at line 105 of file BuildTruthTaus.h.

◆ m_useIncidents

bool asg::AsgMetadataTool::m_useIncidents
privateinherited

Definition at line 128 of file AsgMetadataTool.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.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:
TauAnalysisTools::BuildTruthTaus::examineTruthTau
StatusCode examineTruthTau(const xAOD::TruthParticle &xTruthParticle) const
Definition: BuildTruthTaus.cxx:211
xAOD::TruthVertex_v1::nOutgoingParticles
size_t nOutgoingParticles() const
Get the number of outgoing particles.
TauAnalysisTools::DiTauTruthMatchingTool::getTruth
virtual void getTruth(const xAOD::DiTauJet &xDiTau)
get pointer to the truth matched particle.
Definition: DiTauTruthMatchingTool.cxx:62
GetLCDefs::Unknown
@ Unknown
Definition: GetLCDefs.h:21
TauAnalysisTools::TruthElectron
@ TruthElectron
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:100
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
egammaParameters::depth
@ depth
pointing depth of the shower as calculated in egammaqgcld
Definition: egammaParamDefs.h:276
xAOD::TruthParticle_v1::absPdgId
int absPdgId() const
Absolute PDG ID code (often useful)
CxxUtils::CachedValue::ptr
const T * ptr() const
Return a pointer to the cached value.
asg::AsgMetadataTool::beginEvent
virtual StatusCode beginEvent()
Function called when a new events is loaded.
Definition: AsgMetadataTool.cxx:196
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
TauAnalysisTools::BuildTruthTaus::m_truthElectronContainer
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthElectronContainer
Definition: BuildTruthTaus.h:115
TauAnalysisTools::BuildTruthTaus::m_tMCTruthClassifier
asg::AnaToolHandle< IMCTruthClassifier > m_tMCTruthClassifier
Definition: BuildTruthTaus.h:128
TauAnalysisTools::DiTauTruthMatchingTool::m_accMVis
SG::ConstAccessor< double > m_accMVis
Definition: DiTauTruthMatchingTool.h:73
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
TauAnalysisTools::DiTauTruthMatchingTool::m_bIsTruthMatchedAvailable
CxxUtils::CachedValue< bool > m_bIsTruthMatchedAvailable
Definition: DiTauTruthMatchingTool.h:65
TauAnalysisTools::BuildTruthTaus::m_bWriteDecayModeVector
bool m_bWriteDecayModeVector
Definition: BuildTruthTaus.h:125
TauAnalysisTools::BuildTruthTaus::printDecay
void printDecay(const xAOD::TruthParticle &xTruthParticle, int depth=0) const
Definition: BuildTruthTaus.cxx:431
SG::Accessor< char >
TauAnalysisTools::DiTauTruthMatchingTool::m_accPtVis
SG::ConstAccessor< double > m_accPtVis
Definition: DiTauTruthMatchingTool.h:70
TauAnalysisTools::BuildTruthTaus::m_bWriteVisibleNeutralFourMomentum
bool m_bWriteVisibleNeutralFourMomentum
Definition: BuildTruthTaus.h:124
TauAnalysisTools::TruthHadronicTau
@ TruthHadronicTau
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:97
TauAnalysisTools::DiTauTruthMatchingTool::checkTruthMatch
StatusCode checkTruthMatch(const xAOD::DiTauJet &xDiTau, const xAOD::TruthParticleContainer &xTauContainer) const
Definition: DiTauTruthMatchingTool.cxx:104
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
CxxUtils::CachedValue::isValid
bool isValid() const
Test to see if the value is valid.
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
initialize
void initialize()
Definition: run_EoverP.cxx:894
TauAnalysisTools::BuildTruthTaus::retrieveTruthTaus
virtual StatusCode retrieveTruthTaus() override
Definition: BuildTruthTaus.cxx:69
xAOD::char
char
Definition: TrigDecision_v1.cxx:38
xAOD::DiTauJet_v1::subjetPhi
float subjetPhi(unsigned int numSubjet) const
Definition: DiTauJet_v1.cxx:112
TauAnalysisTools::BuildTruthTaus::m_bWriteVisibleChargedFourMomentum
bool m_bWriteVisibleChargedFourMomentum
Definition: BuildTruthTaus.h:123
TauAnalysisTools::BuildTruthTaus::m_truthTauOutputContainer
SG::WriteHandleKey< xAOD::TruthParticleContainer > m_truthTauOutputContainer
Definition: BuildTruthTaus.h:119
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
IsoElectron
@ IsoElectron
Definition: TruthClasses.h:11
TauAnalysisTools::BuildTruthTaus::m_bWriteInvisibleFourMomentum
bool m_bWriteInvisibleFourMomentum
Definition: BuildTruthTaus.h:122
TauAnalysisTools::BuildTruthTaus::m_truthMatchingMode
bool m_truthMatchingMode
Definition: BuildTruthTaus.h:121
asg::AsgMetadataTool::m_beginInputFileCalled
bool m_beginInputFileCalled
Flag helping to discover when the tool misses the opening of the first input file.
Definition: AsgMetadataTool.h:126
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
asg::AsgMetadataTool::endInputFile
virtual StatusCode endInputFile()
Function called when the currently open input file got completely processed.
Definition: AsgMetadataTool.cxx:188
asg::AsgMetadataTool::m_outputMetaStore
MetaStore_t m_outputMetaStore
Object accessing the output metadata store.
Definition: AsgMetadataTool.h:121
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
TauAnalysisTools::Unknown
@ Unknown
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:96
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
TauAnalysisTools::DiTauTruthMatchingTool::m_accEtaVis
SG::ConstAccessor< double > m_accEtaVis
Definition: DiTauTruthMatchingTool.h:71
xAOD::TruthVertex_v1::y
float y() const
Vertex y displacement.
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
xAOD::DiTauJet_v1::subjetE
float subjetE(unsigned int numSubjet) const
Definition: DiTauJet_v1.cxx:122
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
TauAnalysisTools::BuildTruthTaus::m_bWriteVertices
bool m_bWriteVertices
Definition: BuildTruthTaus.h:126
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
TauAnalysisTools::DiTauTruthMatchingTool::m_dMaxDeltaR
double m_dMaxDeltaR
Definition: DiTauTruthMatchingTool.h:63
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
NonDefined
@ NonDefined
Definition: TruthClasses.h:52
MC::isPhysical
bool isPhysical(const T &p)
Identify if the particle is physical, i.e. is stable or decayed.
Definition: HepMCHelpers.h:51
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
xAOD::TruthParticle_v1::hasDecayVtx
bool hasDecayVtx() const
Check for a decay vertex on this particle.
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
xAOD::TruthParticle_v1::e
virtual double e() const override final
The total energy of the particle.
SG::Decorator< char >
lumiFormat.i
int i
Definition: lumiFormat.py:85
TauAnalysisTools::BuildTruthTaus::m_bTruthTauAvailable
bool m_bTruthTauAvailable
Definition: BuildTruthTaus.h:108
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
asg::AsgMetadataTool::beginInputFile
virtual StatusCode beginInputFile()
Function called when a new input file is opened.
Definition: AsgMetadataTool.cxx:180
master.flag
bool flag
Definition: master.py:29
xAOD::TruthParticle_v1::hasProdVtx
bool hasProdVtx() const
Check for a production vertex on this particle.
Definition: TruthParticle_v1.cxx:74
HepMC::uniqueID
int uniqueID(const T &p)
Definition: MagicNumbers.h:116
asg::AsgMetadataTool::metaDataStop
virtual StatusCode metaDataStop()
Function called when the tool should write out its metadata.
Definition: AsgMetadataTool.cxx:204
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
xAOD::TruthParticle_v1::isTau
bool isTau() const
Whether the particle is a tau (or antitau)
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
IsoMuon
@ IsoMuon
Definition: TruthClasses.h:15
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
TauAnalysisTools::BuildTruthTaus::buildTruthTausFromTruthParticles
StatusCode buildTruthTausFromTruthParticles(TruthTausEvent &truthTausEvent) const
Definition: BuildTruthTaus.cxx:156
xAOD::TruthParticle_v1::isCharged
bool isCharged() const
Whether the particle is electrically charged.
TauAnalysisTools::TruthMuon
@ TruthMuon
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:99
xAOD::DiTauJet_v1::subjetEta
float subjetEta(unsigned int numSubjet) const
Definition: DiTauJet_v1.cxx:102
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::TruthParticle_v1::decayVtx
const TruthVertex_v1 * decayVtx() const
The decay vertex of this particle.
xAOD::TruthParticle_v1::prodVtx
const TruthVertex_v1 * prodVtx() const
The production vertex of this particle.
Definition: TruthParticle_v1.cxx:80
xAOD::TruthVertex_v1
Class describing a truth vertex in the MC record.
Definition: TruthVertex_v1.h:37
TauAnalysisTools::DiTauTruthMatchingTool::m_accPhiVis
SG::ConstAccessor< double > m_accPhiVis
Definition: DiTauTruthMatchingTool.h:72
TauAnalysisTools::BuildTruthTaus::m_truthTausEvent
TruthTausEvent m_truthTausEvent
Definition: BuildTruthTaus.h:105
TauAnalysisTools::DiTauTruthMatchingTool::truthMatch
StatusCode truthMatch(const TLorentzVector &vSubjetTLV, const xAOD::TruthParticleContainer &xTruthTauContainer, const xAOD::TruthParticle *&xTruthMatch, TruthMatchedParticleType &eTruthMatchedParticleType) const
Definition: DiTauTruthMatchingTool.cxx:327
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
asg::AsgMetadataTool::m_inputMetaStore
MetaStore_t m_inputMetaStore
Object accessing the input metadata store.
Definition: AsgMetadataTool.h:119
TauAnalysisTools::TruthMatchedParticleType
TruthMatchedParticleType
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:95
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TauAnalysisTools::BuildTruthTaus::m_truthTauInputContainer
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthTauInputContainer
Definition: BuildTruthTaus.h:113
CxxUtils::CachedValue::set
void set(const T &val) const
Set the value, assuming it is currently invalid.
xAOD::Electron_v1
Definition: Electron_v1.h:34
xAOD::TruthVertex_v1::x
float x() const
Vertex x displacement.
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
TauAnalysisTools::BuildTruthTaus::m_truthJetContainer
SG::ReadHandleKey< xAOD::JetContainer > m_truthJetContainer
Definition: BuildTruthTaus.h:117
xAOD::TruthParticle_v1::status
int status() const
Status code.
MC::isStable
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
Definition: HepMCHelpers.h:45
IMCTruthClassifier::particleTruthClassifier
virtual std::pair< MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin > particleTruthClassifier(const xAOD::TruthParticle *, MCTruthPartClassifier::Info *info=nullptr) const =0
a
TList * a
Definition: liststreamerinfos.cxx:10
h
TauAnalysisTools::BuildTruthTaus::m_truthMuonContainer
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthMuonContainer
Definition: BuildTruthTaus.h:116
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
TauAnalysisTools::DiTauTruthMatchingTool::findTruthTau
StatusCode findTruthTau(const xAOD::DiTauJet &xDiTau)
Definition: DiTauTruthMatchingTool.cxx:87
MC::isDecayed
bool isDecayed(const T &p)
Identify if the particle decayed.
Definition: HepMCHelpers.h:42
xAOD::TruthVertex_v1::z
float z() const
Vertex longitudinal distance along the beam line form the origin.
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
xAOD::TruthParticle_v1::pt
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition: TruthParticle_v1.cxx:166
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
xAOD::TruthParticle_v1::isNeutrino
bool isNeutrino() const
Whether the particle is a neutrino (or antineutrino)
TauAnalysisTools::BuildTruthTaus::m_truthParticleContainer
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleContainer
Definition: BuildTruthTaus.h:114
xAOD::DiTauJet_v1::subjetPt
float subjetPt(unsigned int numSubjet) const
Definition: DiTauJet_v1.cxx:92
xAOD::TruthParticle_v1::p4
virtual FourMom_t p4() const override final
The full 4-momentum of the particle.
Definition: TruthParticle_v1.cxx:196
DataVector::erase
iterator erase(iterator position)
Remove element at a given position.
xAOD::TruthParticle_v1::pdgId
int pdgId() const
PDG ID code.
SG::DataProxy
Definition: DataProxy.h:45
TauAnalysisTools::BuildTruthTaus::examineTruthTauDecay
StatusCode examineTruthTauDecay(const xAOD::TruthParticle &xTruthParticle, TauTruthInfo &truthInfo) const
Definition: BuildTruthTaus.cxx:344
xAOD::TruthParticle_v1::isNeutral
bool isNeutral() const
Whether the particle is electrically neutral.
TauAnalysisTools::DiTauTruthMatchingTool::checkTruthLepton
ElementLink< xAOD::TruthParticleContainer > checkTruthLepton(const xAOD::IParticle *pLepton) const
Definition: DiTauTruthMatchingTool.cxx:316
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
xAOD::TruthVertex_v1::outgoingParticle
const TruthParticle_v1 * outgoingParticle(size_t index) const
Get one of the outgoing particles.
Definition: TruthVertex_v1.cxx:119
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
fitman.k
k
Definition: fitman.py:528
xAOD::TruthParticle_v1::isHadron
bool isHadron() const
Whether the particle is a hadron.
ServiceHandle< IIncidentSvc >
asg::AsgMetadataTool::m_useIncidents
bool m_useIncidents
Definition: AsgMetadataTool.h:128