ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
top::TopEventMaker Class Referencefinal

TopEventMaker produce top::Event objects from xAOD::SystematicEvent objects. More...

#include <TopEventMaker.h>

Inheritance diagram for top::TopEventMaker:
Collaboration diagram for top::TopEventMaker:

Public Member Functions

 TopEventMaker (const std::string &name)
 
virtual ~TopEventMaker ()
 
StatusCode initialize ()
 Dummy implementation of the initialisation function. More...
 
 TopEventMaker (const TopEventMaker &rhs)=delete
 
 TopEventMaker (TopEventMaker &&rhs)=delete
 
TopEventMakeroperator= (const TopEventMaker &rhs)=delete
 
top::Event makeTopEvent (const xAOD::SystematicEvent *currentSystematic)
 Make a top::Event from a xAOD::SystematicEvent. More...
 
const xAOD::SystematicEventContainersystematicEvents (const std::string &sgKey) const
 As top-xaod isn't an asg::AsgTool, it doesn't have access to all the information Very annoying. 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
 

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

void decorateTopEvent (top::Event &event)
 
void decorateTopEventSoftMuons (top::Event &event)
 
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

std::shared_ptr< top::TopConfigm_config
 
std::unique_ptr< RCJetm_rc
 
std::map< std::string, std::unique_ptr< RCJet > > m_VarRC
 
std::vector< std::string > m_VarRCJetRho
 
std::vector< std::string > m_VarRCJetMassScale
 
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
 

Static Private Attributes

static bool s_hasTruthEvent = true
 

Detailed Description

TopEventMaker produce top::Event objects from xAOD::SystematicEvent objects.

Author
John Morris john..nosp@m.morr.nosp@m.is@ce.nosp@m.rn.c.nosp@m.h

Definition at line 32 of file TopEventMaker.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

◆ TopEventMaker() [1/3]

top::TopEventMaker::TopEventMaker ( const std::string &  name)
explicit

Definition at line 34 of file TopEventMaker.cxx.

34  :
36  m_config(nullptr) {
37  declareProperty("config", m_config);
38  }

◆ ~TopEventMaker()

virtual top::TopEventMaker::~TopEventMaker ( )
inlinevirtual

Definition at line 35 of file TopEventMaker.h.

35 {}

◆ TopEventMaker() [2/3]

top::TopEventMaker::TopEventMaker ( const TopEventMaker rhs)
delete

◆ TopEventMaker() [3/3]

top::TopEventMaker::TopEventMaker ( TopEventMaker &&  rhs)
delete

Member Function Documentation

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

◆ decorateTopEvent()

void top::TopEventMaker::decorateTopEvent ( top::Event event)
private

Definition at line 628 of file TopEventMaker.cxx.

629  {
630  if(m_config->useSoftMuons()) decorateTopEventSoftMuons(event);
631  }

◆ decorateTopEventSoftMuons()

void top::TopEventMaker::decorateTopEventSoftMuons ( top::Event event)
private

Definition at line 633 of file TopEventMaker.cxx.

634  {
635  if(!m_config->useJets()) return;
636 
637  //first we initialize decorations for all jets
638  for(const xAOD::Jet* jet : event.m_jets)
639  {
640  jet->auxdecor<int>("AT_SoftMuonIndex")=-1;
641  jet->auxdecor<float>("AT_SoftMuonDR")=-1;
642  }
643 
644  int imuon=0;
645  for(const xAOD::Muon* sm : event.m_softmuons)
646  {
647  //writing auxiliary info for SMT jet tagging
648  double dRmin=100.;
649  int nearestJetIndex=-1;
650  int ijet=0;
651  for(const xAOD::Jet *jet : event.m_jets)
652  {
653  double dr= xAOD::P4Helpers::deltaR(sm,jet,m_config->softmuonDRJetcutUseRapidity());
654  if(dr<dRmin && dr<m_config->softmuonDRJetcut())
655  {
656  dRmin=dr;
657  nearestJetIndex=ijet;
658  }
659  ijet++;
660  }
661  sm->auxdecor<int>("AT_SMTJetIndex")=nearestJetIndex;
662  sm->auxdecor<float>("AT_SMTJetDR")=dRmin;
663 
664  if(nearestJetIndex>=0)
665  {
666  const xAOD::Jet *jet = event.m_jets[nearestJetIndex];
667  if(jet->auxdecor<int>("AT_SoftMuonIndex")<0) //in this way we only associate a jet with the highest pt soft muon
668  {
669  jet->auxdecor<int>("AT_SoftMuonIndex")=imuon;
670  jet->auxdecor<float>("AT_SoftMuonDR")=dRmin;
671  }
672  }//end of case where we found a jet nearby
673 
674  imuon++;
675  }//end of loop on muons
676 
677  }//end of TopEventMaker::decorateTopEvent

◆ 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

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

◆ initialize()

StatusCode top::TopEventMaker::initialize ( )
virtual

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 40 of file TopEventMaker.cxx.

40  {
41  if (m_config->useRCJets() == true) {
42  m_rc = std::unique_ptr<RCJet> (new RCJet("RCJet"));
43  top::check(m_rc->setProperty("config", m_config), "Failed to set config property of RCJet");
44  top::check(m_rc->initialize(), "Failed to initialize RCJet");
45  }
46 
47  if (m_config->useVarRCJets() == true) {
48  boost::split(m_VarRCJetRho, m_config->VarRCJetRho(), boost::is_any_of(","));
49  boost::split(m_VarRCJetMassScale, m_config->VarRCJetMassScale(), boost::is_any_of(","));
50 
51  for (auto& rho : m_VarRCJetRho) {
52  for (auto& mass_scale : m_VarRCJetMassScale) {
53  std::replace(rho.begin(), rho.end(), '.', '_');
54  std::string name = rho + mass_scale;
55  m_VarRC[name] = std::unique_ptr<RCJet> (new RCJet("VarRCJet_" + name));
56  top::check(m_VarRC[name]->setProperty("config", m_config), "Failed to set config property of VarRCJet");
57  top::check(m_VarRC[name]->setProperty("VarRCjets", true), "Failed to set VarRCjets property of VarRCJet");
58  top::check(m_VarRC[name]->setProperty("VarRCjets_rho",
59  rho), "Failed to set VarRCjets rho property of VarRCJet");
60  top::check(m_VarRC[name]->setProperty("VarRCjets_mass_scale",
61  mass_scale),
62  "Failed to set VarRCjets mass scale property of VarRCJet");
63  top::check(m_VarRC[name]->initialize(), "Failed to initialize VarRCJet");
64  } // end loop over mass scale parameters (e.g., top mass, w mass, etc.)
65  } // end loop over mass scale multiplies (e.g., 1.,2.,etc.)
66  }
67 
68  return StatusCode::SUCCESS;
69  }

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

◆ makeTopEvent()

top::Event top::TopEventMaker::makeTopEvent ( const xAOD::SystematicEvent currentSystematic)

Make a top::Event from a xAOD::SystematicEvent.

A SingleSystEvent contains only access to calibrated/systematic StoreGate keys and vectors telling it which objects in a collection are good

You want to do physics on a top::Event

Parameters
systEventEssentially this make an analysis friendly version of the information in systEvent
Returns
A top::Event that you can do analysis on containing the good objects, which you can then perform selection based on event-level info with. Such as object multiplicity. Fun times are ahead.

– Need to read const collections for mini-xaod read back –///

– Shallow copy and save to TStore –///

– Pull shallow copy back out of TStore in non-const way –///

– Shallow copy and save to TStore –///

– Pull shallow copy back out of TStore in non-const way –///

– Need to read const collections for mini-xaod read back –///

– Shallow copy and save to TStore –///

– Pull shallow copy back out of TStore in non-const way –///

– Need to read const collections for mini-xaod read back –///

– Shallow copy and save to TStore –///

– Pull shallow copy back out of TStore in non-const way –///

– Need to read const collections for mini-xaod read back –///

– Shallow copy and save to TStore –///

– Pull shallow copy back out of TStore in non-const way –///

– Need to read const collections for mini-xaod read back –///

– Shallow copy and save to TStore –///

– Pull shallow copy back out of TStore in non-const way –///

– Need to read const collections for mini-xaod read back –///

– Shallow copy and save to TStore –///

– Pull shallow copy back out of TStore in non-const way –///

– Need to read const collections for mini-xaod read back –///

– Shallow copy and save to TStore –///

– Pull shallow copy back out of TStore in non-const way –///

– Need to read const collections for mini-xaod read back –///

– Shallow copy and save to TStore –///

– Pull shallow copy back out of TStore in non-const way –///

– Need to read const collections for mini-xaod read back –///

– Shallow copy and save to TStore –///

– Pull shallow copy back out of TStore in non-const way –///

Definition at line 80 of file TopEventMaker.cxx.

80  {
81  xAOD::SystematicEvent const& currentSystematic = *currentSystematicPtr;
82  //create a new event object
84 
85  // Set systematic hash value
86  std::size_t hash = currentSystematic.hashValue();
87  event.m_hashValue = hash;
88 
89  // TTree index
90  event.m_ttreeIndex = currentSystematic.ttreeIndex();
91 
92  // Is Loose event?
93  event.m_isLoose = currentSystematic.isLooseEvent();
94 
95  //event info
96  top::check(evtStore()->retrieve(event.m_info, m_config->sgKeyEventInfo()), "Failed to retrieve EventInfo");
97  event.m_systematicEvent = currentSystematicPtr;
98 
99  //Primary Vertices
100  if (evtStore()->contains<xAOD::VertexContainer>(m_config->sgKeyPrimaryVertices())) {
101  top::check(evtStore()->retrieve(event.m_primaryVertices,
102  m_config->sgKeyPrimaryVertices()), "Failed to retrieve Primary Vertices");
103  }
104 
105  //Poisson bootstrap weights
106  if (m_config->saveBootstrapWeights()) {
107  int second_seed;
108  if (m_config->isMC()) {
109  second_seed = event.m_info->mcChannelNumber();
110  } else {
111  second_seed = event.m_info->runNumber();
112  }
113  std::vector<int> weight_poisson = top::calculateBootstrapWeights(m_config->getNumberOfBootstrapReplicas(),
114  event.m_info->eventNumber(),
115  second_seed);
116  event.m_info->auxdecor< std::vector<int> >("weight_poisson") = weight_poisson;
117  }
118 
119  //electrons
120  if (m_config->useElectrons()) {
122 
123  const xAOD::ElectronContainer* calibratedElectrons(nullptr);
124  top::check(evtStore()->retrieve(calibratedElectrons, m_config->sgKeyElectrons(
125  hash)), "Failed to retrieve electrons");
126 
128  if (!evtStore()->contains<xAOD::ElectronContainer>(m_config->sgKeyElectronsTDS(hash))) {
129  std::pair< xAOD::ElectronContainer*,
130  xAOD::ShallowAuxContainer* > shallow_electrons = xAOD::shallowCopyContainer(*calibratedElectrons);
131 
132  StatusCode save = evtStore()->tds()->record(shallow_electrons.first, m_config->sgKeyElectronsTDS(hash));
133  StatusCode saveAux =
134  evtStore()->tds()->record(shallow_electrons.second, m_config->sgKeyElectronsTDSAux(hash));
135  top::check((save && saveAux), "Failed to store object in TStore");
136  }
137 
139  xAOD::ElectronContainer* calibratedElectronsTDS(nullptr);
140  top::check(evtStore()->retrieve(calibratedElectronsTDS, m_config->sgKeyElectronsTDS(
141  hash)), "Failed to retrieve electrons");
142 
143 
144  // re-write overlap information if it is decorated onto currentSystematic
145  if (currentSystematic.isAvailable< std::vector<unsigned int> >("overlapsEl")) {
146  std::vector<unsigned int> overlapsEl =
147  currentSystematic.auxdataConst< std::vector<unsigned int> >("overlapsEl");
148  if (overlapsEl.size() == calibratedElectronsTDS->size()) {
149  unsigned int counter(0);
150  for (auto x : *calibratedElectronsTDS) {
151  x->auxdecor<char>("overlaps") = overlapsEl.at(counter);
152  ++counter;
153  }
154  }
155  }
156 
157  for (auto index : currentSystematic.goodElectrons()) {
158  event.m_electrons.push_back(calibratedElectronsTDS->at(index));
159  }
160 
161  //shallow copies aren't sorted!
162  //sort only the selected electrons (faster)
163  event.m_electrons.sort(top::descendingPtSorter);
164  }
165 
166  //forward electrons
167  if (m_config->useFwdElectrons()) {
168  const xAOD::ElectronContainer* calibratedFwdElectrons(nullptr);
169  top::check(evtStore()->retrieve(calibratedFwdElectrons, m_config->sgKeyFwdElectrons(
170  hash)), "Failed to retrieve fwd electrons");
171 
173  if (!evtStore()->contains<xAOD::ElectronContainer>(m_config->sgKeyFwdElectronsTDS(hash))) {
174  std::pair< xAOD::ElectronContainer*,
175  xAOD::ShallowAuxContainer* > shallow_fwdelectrons = xAOD::shallowCopyContainer(
176  *calibratedFwdElectrons);
177 
178  StatusCode save =
179  evtStore()->tds()->record(shallow_fwdelectrons.first, m_config->sgKeyFwdElectronsTDS(hash));
180  StatusCode saveAux = evtStore()->tds()->record(shallow_fwdelectrons.second, m_config->sgKeyFwdElectronsTDSAux(
181  hash));
182  top::check((save && saveAux), "Failed to store object in TStore");
183  }
184 
186  xAOD::ElectronContainer* calibratedFwdElectronsTDS(nullptr);
187  top::check(evtStore()->retrieve(calibratedFwdElectronsTDS, m_config->sgKeyFwdElectronsTDS(
188  hash)), "Failed to retrieve fwd electrons");
189 
190  for (const auto& index : currentSystematic.goodFwdElectrons()) {
191  event.m_fwdElectrons.push_back(calibratedFwdElectronsTDS->at(index));
192  }
193 
194  //shallow copies aren't sorted!
195  //sort only the selected fwd electrons (faster)
196  event.m_fwdElectrons.sort(top::descendingPtSorter);
197  }
198 
199  //photons
200  if (m_config->usePhotons()) {
202 
203  const xAOD::PhotonContainer* calibratedPhotons(nullptr);
204  top::check(evtStore()->retrieve(calibratedPhotons, m_config->sgKeyPhotons(hash)), "Failed to retrieve photons");
205 
207  if (!evtStore()->contains<xAOD::PhotonContainer>(m_config->sgKeyPhotonsTDS(hash))) {
208  std::pair< xAOD::PhotonContainer*, xAOD::ShallowAuxContainer* > shallow_photons = xAOD::shallowCopyContainer(
209  *calibratedPhotons);
210 
211  StatusCode save = evtStore()->tds()->record(shallow_photons.first, m_config->sgKeyPhotonsTDS(hash));
212  StatusCode saveAux =
213  evtStore()->tds()->record(shallow_photons.second, m_config->sgKeyPhotonsTDSAux(hash));
214  top::check((save && saveAux), "Failed to store object in TStore");
215  }
216 
218  xAOD::PhotonContainer* calibratedPhotonsTDS(nullptr);
219  top::check(evtStore()->retrieve(calibratedPhotonsTDS, m_config->sgKeyPhotonsTDS(
220  hash)), "Failed to retrieve photons");
221 
222  for (auto index : currentSystematic.goodPhotons()) {
223  event.m_photons.push_back(calibratedPhotonsTDS->at(index));
224  }
225  //shallow copies aren't sorted!
226  //sort only the selected photons (faster)
227  event.m_photons.sort(top::descendingPtSorter);
228  }
229 
230  //muons
231  if (m_config->useMuons()) {
233  const xAOD::MuonContainer* calibratedMuons(nullptr);
234  top::check(evtStore()->retrieve(calibratedMuons, m_config->sgKeyMuons(hash)), "Failed to retrieve muons");
235 
237  if (!evtStore()->contains<xAOD::MuonContainer>(m_config->sgKeyMuonsTDS(hash))) {
238  std::pair< xAOD::MuonContainer*, xAOD::ShallowAuxContainer* > shallow_muons = xAOD::shallowCopyContainer(
239  *calibratedMuons);
240 
241  StatusCode save = evtStore()->tds()->record(shallow_muons.first, m_config->sgKeyMuonsTDS(hash));
242  StatusCode saveAux = evtStore()->tds()->record(shallow_muons.second, m_config->sgKeyMuonsTDSAux(hash));
243  top::check((save && saveAux), "Failed to store object in TStore");
244  }
245 
247  xAOD::MuonContainer* calibratedMuonsTDS(nullptr);
248  top::check(evtStore()->retrieve(calibratedMuonsTDS, m_config->sgKeyMuonsTDS(hash)), "Failed to retrieve muons");
249 
250  // re-write overlap information if it is decorated onto currentSystematic
251  if (currentSystematic.isAvailable< std::vector<unsigned int> >("overlapsMu")) {
252  std::vector<unsigned int> overlapsMu =
253  currentSystematic.auxdataConst< std::vector<unsigned int> >("overlapsMu");
254  if (overlapsMu.size() == calibratedMuonsTDS->size()) {
255  unsigned int counter(0);
256  for (auto x : *calibratedMuons) {
257  x->auxdecor<char>("overlaps") = overlapsMu.at(counter);
258  ++counter;
259  }
260  }
261  }
262 
263  for (auto index : currentSystematic.goodMuons()) {
264  event.m_muons.push_back(calibratedMuonsTDS->at(index));
265  }
266 
267  //shallow copies aren't sorted!
268  //sort only the selected muons (faster)
269  event.m_muons.sort(top::descendingPtSorter);
270  }
271 
272  //soft muons
273  if (m_config->useSoftMuons()) {
275  const xAOD::MuonContainer* calibratedSoftMuons(nullptr);
276 
277  top::check(evtStore()->retrieve(calibratedSoftMuons, m_config->sgKeySoftMuons(hash)), "Failed to retrieve muons");
278 
279 
281  if (!evtStore()->contains<xAOD::MuonContainer>(m_config->sgKeySoftMuonsTDS(hash))) {
282  std::pair< xAOD::MuonContainer*, xAOD::ShallowAuxContainer* > shallow_softmuons = xAOD::shallowCopyContainer(
283  *calibratedSoftMuons);
284 
285  StatusCode save = evtStore()->tds()->record(shallow_softmuons.first, m_config->sgKeySoftMuonsTDS(hash));
286  StatusCode saveAux =
287  evtStore()->tds()->record(shallow_softmuons.second, m_config->sgKeySoftMuonsTDSAux(hash));
288  top::check((save && saveAux), "Failed to store object in TStore");
289  }
290 
292  xAOD::MuonContainer* calibratedSoftMuonsTDS(nullptr);
293  top::check(evtStore()->retrieve(calibratedSoftMuonsTDS, m_config->sgKeySoftMuonsTDS(
294  hash)), "Failed to retrieve soft muons");
295 
296  //no overlap procedure applied to soft muons for the time being
297 
298  for (auto index : currentSystematic.goodSoftMuons()) {
299  event.m_softmuons.push_back(calibratedSoftMuonsTDS->at(index));
300  }
301 
302  //shallow copies aren't sorted!
303  //sort only the selected soft muons (faster)
304  event.m_softmuons.sort(top::descendingPtSorter);
305  }
306 
307  //taus
308  if (m_config->useTaus()) {
310  const xAOD::TauJetContainer* calibratedTaus(nullptr);
311  top::check(evtStore()->retrieve(calibratedTaus, m_config->sgKeyTaus(hash)), "Failed to retrieve taus");
312 
314  if (!evtStore()->contains<xAOD::TauJetContainer>(m_config->sgKeyTausTDS(hash))) {
315  std::pair< xAOD::TauJetContainer*, xAOD::ShallowAuxContainer* > shallow_taus = xAOD::shallowCopyContainer(
316  *calibratedTaus);
317 
318  StatusCode save = evtStore()->tds()->record(shallow_taus.first, m_config->sgKeyTausTDS(hash));
319  StatusCode saveAux = evtStore()->tds()->record(shallow_taus.second, m_config->sgKeyTausTDSAux(hash));
320  top::check((save && saveAux), "Failed to store object in TStore");
321  }
322 
324  xAOD::TauJetContainer* calibratedTausTDS(nullptr);
325  top::check(evtStore()->retrieve(calibratedTausTDS, m_config->sgKeyTausTDS(hash)), "Failed to retrieve taus");
326 
327  for (auto index : currentSystematic.goodTaus()) {
328  event.m_tauJets.push_back(calibratedTausTDS->at(index));
329  }
330 
331  //shallow copies aren't sorted!
332  //sort only the selected taus (faster)
333  event.m_tauJets.sort(top::descendingPtSorter);
334  }
335 
336  //jets
337  // We need to be careful with the boosted analysis,
338  // Do we take the jets collection that has loose or tight leptons subtracted?
339  bool looseJets(false);
340  if (m_config->applyElectronInJetSubtraction()) {
341  if (m_config->doOverlapRemovalOnLooseLeptonDef() || currentSystematic.isLooseEvent()) {
342  looseJets = true;
343  }
344  }
345 
346  if (m_config->useJets()) {
348  std::string sgKeyCalibrated(m_config->sgKeyJets(hash, looseJets));
349  std::string sgKeyTmp = "tmp_" + sgKeyCalibrated;
350  std::string sgKeyTmpAux = sgKeyTmp + "Aux.";
351 
352  const xAOD::JetContainer* calibratedJets(nullptr);
353  top::check(evtStore()->retrieve(calibratedJets, m_config->sgKeyJets(hash, looseJets)), "Failed to retrieve jets");
354 
356  if (!evtStore()->contains<xAOD::JetContainer>(m_config->sgKeyJetsTDS(hash, looseJets))) {
357  std::pair< xAOD::JetContainer*, xAOD::ShallowAuxContainer* > shallow_jets = xAOD::shallowCopyContainer(
358  *calibratedJets);
359 
360  StatusCode save = evtStore()->tds()->record(shallow_jets.first, m_config->sgKeyJetsTDS(hash, looseJets));
361  StatusCode saveAux =
362  evtStore()->tds()->record(shallow_jets.second, m_config->sgKeyJetsTDSAux(hash, looseJets));
363  top::check((save && saveAux), "Failed to store object in TStore");
364  }
365 
367  xAOD::JetContainer* calibratedJetsTDS(nullptr);
368  top::check(evtStore()->retrieve(calibratedJetsTDS, m_config->sgKeyJetsTDS(hash,
369  looseJets)), "Failed to retrieve taus");
370 
371 
372  for (auto index : currentSystematic.goodJets()) {
373  auto jet = calibratedJetsTDS->at(index);
374 
375  if (m_config->isMC()) {
376  // JVT and fJVT, make product of SF (initialised to 1 in the header)
377  top::check(jet->isAvailable<float>(
378  "JET_SF_jvt"),
379  " Can't find jet decoration \"JET_SF_jvt\" - we need it to calculate the jet scale-factors!");
380  if (jet->auxdataConst<float>("JET_SF_jvt") > 0) {
381  event.m_jvtSF *= jet->auxdataConst<float>("JET_SF_jvt");
382  }
383 
384  // fJVT scale factors not added to jets unless fJVT is requested
385  if (m_config->getfJVTWP() != "None") {
386  top::check(jet->isAvailable<float>(
387  "JET_SF_fjvt"),
388  " Can't find jet decoration \"JET_SF_fjvt\" - we need it to calculate the forward jet scale-factors!");
389  event.m_fjvtSF *= jet->auxdataConst<float>("JET_SF_fjvt");
390  }
391  if (currentSystematic.hashValue() == m_config->nominalHashValue()) {// we only need the up/down JVT SF systs
392  // for nominal
393  top::check(jet->isAvailable<float>(
394  "JET_SF_jvt_UP"),
395  " Can't find jet decoration \"JET_SF_jvt_UP\" - we need it to calculate the jet scale-factors!");
396  event.m_jvtSF_UP *= jet->auxdataConst<float>("JET_SF_jvt_UP");
397  top::check(jet->isAvailable<float>(
398  "JET_SF_jvt_DOWN"),
399  " Can't find jet decoration \"JET_SF_jvt_DOWN\" - we need it to calculate the jet scale-factors!");
400  event.m_jvtSF_DOWN *= jet->auxdataConst<float>("JET_SF_jvt_DOWN");
401 
402  // fJVT scale factors not added to jets unless fJVT is requested
403  if (m_config->getfJVTWP() != "None") {
404  top::check(jet->isAvailable<float>(
405  "JET_SF_fjvt_UP"),
406  " Can't find jet decoration \"JET_SF_fjvt_UP\" - we need it to calculate the forward jet scale-factors!");
407  event.m_fjvtSF_UP *= jet->auxdataConst<float>("JET_SF_fjvt_UP");
408  top::check(jet->isAvailable<float>(
409  "JET_SF_fjvt_DOWN"),
410  " Can't find jet decoration \"JET_SF_fjvt_DOWN\" - we need it to calculate the forward jet scale-factors!");
411  event.m_fjvtSF_DOWN *= jet->auxdataConst<float>("JET_SF_fjvt_DOWN");
412  }
413  } //isNominal
414  } //isMC
415 
416  top::check(jet->isAvailable<char>(
417  "passJVT"),
418  " Can't find jet decoration \"passJVT\" - we need it to decide if we should keep the jet in the top::Event instance or not!");
419  bool passfJVT(true);
420  if (m_config->doForwardJVTinMET() || m_config->getfJVTWP() != "None") {
421  top::check(jet->isAvailable<char>("AnalysisTop_fJVTdecision"),
422  " Can't find jet decoration \"AnalysisTop_fJVTdecision\" - we need it to decide if we should keep forward jets in the top::Event instance or not!");
423  passfJVT = jet->auxdataConst<char>("AnalysisTop_fJVTdecision");
424  if (m_config->saveFailForwardJVTJets()) {
425  if (!passfJVT) event.m_failFJvt_jets.push_back(calibratedJetsTDS->at(index));
426  }
427  //Add to failFJVT collection but don't actually cut on fJVT if fJVT is only requested in MET calculation (I'm not sure people will ever actually do this)
428  if (m_config->getfJVTWP() == "None") passfJVT = true;
429  }
430 
431  if (jet->auxdataConst<char>("passJVT") && passfJVT) event.m_jets.push_back(calibratedJetsTDS->at(index));
432  if (m_config->saveFailJVTJets()) {
433  if (!jet->auxdataConst<char>("passJVT")) event.m_failJvt_jets.push_back(calibratedJetsTDS->at(index));
434  }
435  }
436 
437  //shallow copies aren't sorted!
438  //sort only the selected taus (faster)
439  event.m_jets.sort(top::descendingPtSorter);
440  if (m_config->saveFailJVTJets()) event.m_failJvt_jets.sort(top::descendingPtSorter);
441  if ( (m_config->doForwardJVTinMET() || m_config->getfJVTWP() != "None") && m_config->saveFailForwardJVTJets()){
442  event.m_failFJvt_jets.sort(top::descendingPtSorter);
443  }
444  }
445 
446  // Reclustered jets
447  if (m_config->useRCJets()) {
448  top::check(m_rc->execute(event), "Failed to execute RCJet container");
449  std::string rcJetContainerName = m_rc->rcjetContainerName(event.m_hashValue, event.m_isLoose);
450  const xAOD::JetContainer* rc_jets(nullptr);
451  top::check(evtStore()->retrieve(rc_jets, rcJetContainerName), "Failed to retrieve RC JetContainer");
452  //Object selection
453  for (auto rcjet : *rc_jets) {
454  top::check(rcjet->isAvailable<bool>(
455  "PassedSelection"),
456  " Can't find jet decoration \"PassedSelection\" - we need it to decide if we should keep the reclustered jet in the top::Event instance or not!");
457  if (rcjet->auxdataConst<bool>("PassedSelection")) event.m_RCJets.push_back((xAOD::Jet*) rcjet);
458  }
459  }
460  // Variable-R reclustered jets
461  if (m_config->useVarRCJets()) {
462  for (auto& rho : m_VarRCJetRho) {
463  for (auto& mass_scale : m_VarRCJetMassScale) {
464  std::replace(rho.begin(), rho.end(), '.', '_');
465  std::string name = rho + mass_scale;
466  top::check(m_VarRC[name]->execute(event), "Failed to execute RCJet container");
467 
468  // Get the name of the container of re-clustered jets in TStore
469  std::string varRCJetContainerName = m_VarRC[name]->rcjetContainerName(event.m_hashValue, event.m_isLoose);
470 
471  // -- Retrieve the re-clustered jets from TStore & save good re-clustered jets -- //
472  const xAOD::JetContainer* vrc_jets(nullptr);
473  top::check(evtStore()->retrieve(vrc_jets, varRCJetContainerName), "Failed to retrieve RC JetContainer");
474 
475  event.m_VarRCJets[name] = std::make_shared<xAOD::JetContainer>(SG::VIEW_ELEMENTS);
476  for (auto vrcjet : *vrc_jets) {
477  top::check(vrcjet->isAvailable<bool>(
478  "PassedSelection"),
479  " Can't find jet decoration \"PassedSelection\" - we need it to decide if we should keep the variable-R reclustered jet in the top::Event instance or not!");
480  if (vrcjet->auxdataConst<bool>("PassedSelection")) event.m_VarRCJets[name]->push_back((xAOD::Jet*) vrcjet);
481  }
482  }
483  }
484  }
485 
486 
487  //large-R jets
488  if (m_config->useLargeRJets()) {
490  const xAOD::JetContainer* calibratedJets(nullptr);
491  top::check(evtStore()->retrieve(calibratedJets, m_config->sgKeyLargeRJets(hash)),
492  "Failed to retrieve largeR jets");
493 
495  if (!evtStore()->contains<xAOD::JetContainer>(m_config->sgKeyLargeRJetsTDS(hash))) {
496  std::pair< xAOD::JetContainer*, xAOD::ShallowAuxContainer* > shallow_jets = xAOD::shallowCopyContainer(
497  *calibratedJets);
498 
499  StatusCode save = evtStore()->tds()->record(shallow_jets.first, m_config->sgKeyLargeRJetsTDS(hash));
500  StatusCode saveAux =
501  evtStore()->tds()->record(shallow_jets.second, m_config->sgKeyLargeRJetsTDSAux(hash));
502  top::check((save && saveAux), "Failed to store object in TStore");
503  }
504 
506  xAOD::JetContainer* calibratedJetsTDS(nullptr);
507  top::check(evtStore()->retrieve(calibratedJetsTDS, m_config->sgKeyLargeRJetsTDS(
508  hash)), "Failed to retrieve largeR jets");
509 
510  for (auto index : currentSystematic.goodLargeRJets()) {
511  event.m_largeJets.push_back(calibratedJetsTDS->at(index));
512  }
513 
514  //shallow copies aren't sorted!
515  //sort only the selected jets (faster)
516  event.m_largeJets.sort(top::descendingPtSorter);
517  }
518 
519  //track jets
520  if (m_config->useTrackJets()) {
522  const xAOD::JetContainer* calibratedJets(nullptr);
523  top::check(evtStore()->retrieve(calibratedJets, m_config->sgKeyTrackJets(hash)), "Failed to retrieve track jets");
524 
526  if (!evtStore()->contains<xAOD::JetContainer>(m_config->sgKeyTrackJetsTDS(hash))) {
527  std::pair< xAOD::JetContainer*, xAOD::ShallowAuxContainer* > shallow_jets = xAOD::shallowCopyContainer(
528  *calibratedJets);
529 
530  StatusCode save = evtStore()->tds()->record(shallow_jets.first, m_config->sgKeyTrackJetsTDS(hash));
531  StatusCode saveAux =
532  evtStore()->tds()->record(shallow_jets.second, m_config->sgKeyTrackJetsTDSAux(hash));
533  top::check((save && saveAux), "Failed to store object in TStore");
534  }
535 
537  xAOD::JetContainer* calibratedJetsTDS(nullptr);
538  top::check(evtStore()->retrieve(calibratedJetsTDS, m_config->sgKeyTrackJetsTDS(
539  hash)), "Failed to retrieve track jets");
540 
541 
542  for (auto index : currentSystematic.goodTrackJets()) {
543  event.m_trackJets.push_back(calibratedJetsTDS->at(index));
544  }
545 
546  //shallow copies aren't sorted!
547  //sort only the selected jets (faster)
548  event.m_trackJets.sort(top::descendingPtSorter);
549  }
550 
551  if (m_config->useTracks()) {
552 
554  const xAOD::TrackParticleContainer* calibratedTracks(nullptr);
555  top::check(evtStore()->retrieve(calibratedTracks, m_config->sgKeyTracks(hash)), "Failed to retrieve tracks");
556 
558  if (!evtStore()->contains<xAOD::TrackParticleContainer>(m_config->sgKeyTracksTDS(hash))) {
559 
560  std::pair< xAOD::TrackParticleContainer*, xAOD::ShallowAuxContainer* > shallow_tracks = xAOD::shallowCopyContainer(*calibratedTracks);
561 
562  StatusCode save = evtStore()->tds()->record(shallow_tracks.first, m_config->sgKeyTracksTDS(hash));
563  StatusCode saveAux =
564  evtStore()->tds()->record(shallow_tracks.second, m_config->sgKeyTracksTDSAux(hash));
565  top::check((save && saveAux), "Failed to store object in TStore");
566  }
567 
569  xAOD::TrackParticleContainer* calibratedTracksTDS(nullptr);
570  top::check(evtStore()->retrieve(calibratedTracksTDS, m_config->sgKeyTracksTDS(hash)), "Failed to retrieve tracks");
571 
572  for (auto index : currentSystematic.goodTracks()) {
573  event.m_tracks.push_back(calibratedTracksTDS->at(index));
574  }
575 
576  //shallow copies aren't sorted!
577  //sort only the selected tracks (faster)
578  event.m_tracks.sort(top::descendingPtSorter);
579 
580  }
581 
582 
583  //met
584  const xAOD::MissingETContainer* mets(nullptr);
585  if (!currentSystematic.isLooseEvent()) {
586  top::check(evtStore()->retrieve(mets, m_config->sgKeyMissingEt(hash)), "Failed to retrieve MET");
587  }
588  if (currentSystematic.isLooseEvent()) {
589  top::check(evtStore()->retrieve(mets, m_config->sgKeyMissingEtLoose(hash)), "Failed to retrieve MET");
590  }
591  event.m_met = (*mets)["FinalTrk"]; // MissingETBase::Source::total()];
592 
593  //MC
594  if (m_config->isMC()) {
595  // Truth particles (these are BIG)
596  if (m_config->useTruthParticles()) {
597  top::check(evtStore()->retrieve(event.m_truth,
598  m_config->sgKeyMCParticle()), "Failed to retrieve truth particles");
599  }
600 
601  // Truth Event
603  bool hasTruthEvent = evtStore()->retrieve(event.m_truthEvent, m_config->sgKeyTruthEvent());
604  if (!hasTruthEvent) {
605  ATH_MSG_WARNING("Failed to retrieve truth Event. TopEvent::m_truthEvent will be nullptr!");
607  }
608  }
609 
610  // Parton History
611  if (m_config->doTopPartonHistory()) {
612  if (evtStore()->contains<xAOD::PartonHistoryContainer>(m_config->sgKeyTopPartonHistory())) {
613  const xAOD::PartonHistoryContainer* partonHistory(nullptr);
614  top::check(evtStore()->retrieve(partonHistory,
615  m_config->sgKeyTopPartonHistory()), "Failed to retrieve Top Parton History");
616  if (partonHistory->size() == 1) {
617  event.m_partonHistory = partonHistory->at(0);
618  }
619  }
620  } // end doTopPartonHistory
621  } // end isMC
622 
624 
625  return event;
626  }

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

◆ operator=()

TopEventMaker& top::TopEventMaker::operator= ( const TopEventMaker rhs)
delete

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

◆ systematicEvents()

const xAOD::SystematicEventContainer * top::TopEventMaker::systematicEvents ( const std::string &  sgKey) const

As top-xaod isn't an asg::AsgTool, it doesn't have access to all the information Very annoying.

As top-xaod isn't an asg::AsgTool, it doesn't have access to all the information Very annoying, as it's actually quite simple.

Definition at line 73 of file TopEventMaker.cxx.

73  {
74  const xAOD::SystematicEventContainer* systEvents(nullptr);
75 
76  top::check(evtStore()->retrieve(systEvents, sgKey), "Failed to get xAOD::SystematicEventContainer");
77  return systEvents;
78  }

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

std::shared_ptr<top::TopConfig> top::TopEventMaker::m_config
private

Definition at line 69 of file TopEventMaker.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_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_rc

std::unique_ptr<RCJet> top::TopEventMaker::m_rc
private

Definition at line 70 of file TopEventMaker.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_VarRC

std::map<std::string, std::unique_ptr<RCJet> > top::TopEventMaker::m_VarRC
private

Definition at line 71 of file TopEventMaker.h.

◆ m_VarRCJetMassScale

std::vector<std::string> top::TopEventMaker::m_VarRCJetMassScale
private

Definition at line 73 of file TopEventMaker.h.

◆ m_VarRCJetRho

std::vector<std::string> top::TopEventMaker::m_VarRCJetRho
private

Definition at line 72 of file TopEventMaker.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.

◆ s_hasTruthEvent

bool top::TopEventMaker::s_hasTruthEvent = true
staticprivate

Definition at line 75 of file TopEventMaker.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::SystematicEvent::goodTaus
const std::vector< unsigned int > & goodTaus() const
get Taus
replace
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition: hcg.cxx:307
xAOD::SystematicEvent::goodMuons
const std::vector< unsigned int > & goodMuons() const
get Muons
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
top::TopEventMaker::m_VarRC
std::map< std::string, std::unique_ptr< RCJet > > m_VarRC
Definition: TopEventMaker.h:71
xAOD::SystematicEvent::goodPhotons
const std::vector< unsigned int > & goodPhotons() const
get Photons
top::TopEventMaker::decorateTopEventSoftMuons
void decorateTopEventSoftMuons(top::Event &event)
Definition: TopEventMaker.cxx:633
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
top::TopEventMaker::s_hasTruthEvent
static bool s_hasTruthEvent
Definition: TopEventMaker.h:75
xAOD::SystematicEvent::goodJets
const std::vector< unsigned int > & goodJets() const
get Jets
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
top::TopEventMaker::m_VarRCJetRho
std::vector< std::string > m_VarRCJetRho
Definition: TopEventMaker.h:72
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition: OwnershipPolicy.h:18
index
Definition: index.py:1
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
xAOD::ShallowAuxContainer
Class creating a shallow copy of an existing auxiliary container.
Definition: ShallowAuxContainer.h:54
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
RCJet
Definition: RCJet.h:55
python.TurnDataReader.dr
dr
Definition: TurnDataReader.py:112
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
x
#define x
top::TopEventMaker::m_rc
std::unique_ptr< RCJet > m_rc
Definition: TopEventMaker.h:70
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
SG::AuxElement::auxdecor
Decorator< T, ALLOC >::reference_type auxdecor(const std::string &name) const
Fetch an aux decoration, as a non-const reference.
top::TopEventMaker::m_VarRCJetMassScale
std::vector< std::string > m_VarRCJetMassScale
Definition: TopEventMaker.h:73
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
LArG4FSStartPointFilterLegacy.execute
execute
Definition: LArG4FSStartPointFilterLegacy.py:20
SG::AuxElement::auxdataConst
Accessor< T, ALLOC >::const_reference_type auxdataConst(const std::string &name) const
Fetch an aux data variable, as a const reference.
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
checkTP.save
def save(self, fileName="./columbo.out")
Definition: checkTP.py:178
top::TopEventMaker::initialize
StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: TopEventMaker.cxx:40
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
xAOD::P4Helpers::deltaR
double deltaR(double rapidity1, double phi1, double rapidity2, double phi2)
from bare bare rapidity,phi
Definition: xAODP4Helpers.h:150
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
top::TopEventMaker::m_config
std::shared_ptr< top::TopConfig > m_config
Definition: TopEventMaker.h:69
top::TopEventMaker::decorateTopEvent
void decorateTopEvent(top::Event &event)
Definition: TopEventMaker.cxx:628
top::check
void check(bool thingToCheck, const std::string &usefulFailureMessage)
Print an error message and terminate if thingToCheck is false.
Definition: EventTools.cxx:15
python.xAODType.dummy
dummy
Definition: xAODType.py:4
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
xAOD::SystematicEvent::hashValue
std::size_t hashValue() const
get hash value
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
xAOD::SystematicEvent::isLooseEvent
char isLooseEvent() const
get isLooseEvent
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
xAOD::SystematicEvent::goodTracks
const std::vector< unsigned int > & goodTracks() const
get Tracks
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
xAOD::MissingETContainer_v1
Container for xAOD::MissingET_v1 objects.
Definition: MissingETContainer_v1.h:21
SG::AuxElement::isAvailable
bool isAvailable(const std::string &name, const std::string &clsname="") const
Check if an aux variable is available for reading.
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
xAOD::SystematicEvent::ttreeIndex
unsigned int ttreeIndex() const
get ttreeIndex
xAOD::shallowCopyContainer
std::pair< std::unique_ptr< T >, std::unique_ptr< ShallowAuxContainer > > shallowCopyContainer(const T &cont, [[maybe_unused]] const EventContext &ctx)
Function making a shallow copy of a constant container.
Definition: ShallowCopy.h:110
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
a
TList * a
Definition: liststreamerinfos.cxx:10
xAOD::SystematicEvent::goodLargeRJets
const std::vector< unsigned int > & goodLargeRJets() const
get LargeRJets
xAOD::SystematicEvent
SystematicEvent A simple xAOD class which we can persist into a mini-xAOD The xAOD EDM is way too com...
Definition: SystematicEvent.h:27
h
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
xAOD::SystematicEvent::goodFwdElectrons
const std::vector< unsigned int > & goodFwdElectrons() const
get FWD Electrons
xAOD::SystematicEvent::goodElectrons
const std::vector< unsigned int > & goodElectrons() const
get Electrons
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
xAOD::SystematicEvent::goodTrackJets
const std::vector< unsigned int > & goodTrackJets() const
get TrackJets
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
top::Event
Very simple class to hold event data after reading from a file.
Definition: Event.h:49
test_pyathena.counter
counter
Definition: test_pyathena.py:15
SG::DataProxy
Definition: DataProxy.h:44
top::descendingPtSorter
bool descendingPtSorter(const xAOD::IParticle *p1, const xAOD::IParticle *p2)
Used when sorting the e, mu, jet, tau containers after CP corrections.
Definition: EventTools.cxx:56
top::calculateBootstrapWeights
std::vector< int > calculateBootstrapWeights(int nreplicas, int eventNumber, int mcChannelNumber)
Function used to create poisson weights (mean of 1) for bootstrapping.
Definition: EventTools.cxx:60
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
Trk::split
@ split
Definition: LayerMaterialProperties.h:38
fitman.rho
rho
Definition: fitman.py:532
fitman.k
k
Definition: fitman.py:528
xAOD::SystematicEvent::goodSoftMuons
const std::vector< unsigned int > & goodSoftMuons() const
get Soft Muons