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

#include <ParticleSortingTool.h>

Inheritance diagram for ParticleSortingTool:
Collaboration diagram for ParticleSortingTool:

Public Member Functions

 ParticleSortingTool (const std::string &type, const std::string &name, const IInterface *parent)
 Constructor with parameters: More...
 
virtual ~ParticleSortingTool ()
 Destructor: More...
 
virtual StatusCode initialize () override
 Athena algtool's initialize. More...
 
virtual StatusCode finalize () override
 Athena algtool's finalize. More...
 
virtual StatusCode addBranches () const final override
 Implement the method from the ISkimmingTool interface. 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
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 AlgTool interface methods. More...
 

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

StatusCode doSort (xAOD::IParticleContainer *cont) const
 Helper method that implements the call to the right sort function. More...
 
template<class CONTAINERTYPE >
StatusCode doSortConst (ConstDataVector< CONTAINERTYPE > *cont) const
 Helper method to sort a ConstDataVector. More...
 
bool comparePt (const xAOD::IParticle *partA, const xAOD::IParticle *partB) const
 The method to compare the particle's pt. More...
 
bool compareEta (const xAOD::IParticle *partA, const xAOD::IParticle *partB) const
 The method to compare the particle's eta. More...
 
bool comparePhi (const xAOD::IParticle *partA, const xAOD::IParticle *partB) const
 The method to compare the particle's phi. More...
 
bool compareMass (const xAOD::IParticle *partA, const xAOD::IParticle *partB) const
 The method to compare the particle's mass. More...
 
bool compareEnergy (const xAOD::IParticle *partA, const xAOD::IParticle *partB) const
 The method to compare the particle's energy. More...
 
bool compareRapidity (const xAOD::IParticle *partA, const xAOD::IParticle *partB) const
 The method to compare the particle's rapidity. More...
 
bool compareAuxData (const xAOD::IParticle *partA, const xAOD::IParticle *partB) const
 The method to compare an auxdata member of the particle. More...
 
bool compareDouble (double a, double b) const
 Method to compare two doubles. More...
 
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

StringProperty m_inCollKey
 Input container name. More...
 
StringProperty m_outCollKey
 The name of the output container (with SG::VIEW_ELEMENTS) with the sorted copy of input objects. More...
 
StringProperty m_sortVar
 Define by what parameter to sort (default: 'pt') More...
 
BooleanProperty m_sortDescending
 Define if the container should be sorted in a descending order (default=true) More...
 
int m_sortID
 Internal identifier for the type of sorting. More...
 
std::atomic< unsigned long > m_nEventsProcessed
 Internal event counter. More...
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Definition at line 29 of file ParticleSortingTool.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

◆ ParticleSortingTool()

ParticleSortingTool::ParticleSortingTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Constructor with parameters:

Definition at line 34 of file ParticleSortingTool.cxx.

36  :
38  m_inCollKey(""),
39  m_outCollKey(""),
40  m_sortVar("pt"),
41  m_sortDescending(true),
42  m_sortID(0),
44 {
45  declareInterface< DerivationFramework::IAugmentationTool >(this);
46 
47  declareProperty("InputContainer", m_inCollKey="", "Input container name" );
48 
49  declareProperty("OutputContainer", m_outCollKey="",
50  "The name of the output container (with SG::VIEW_ELEMENTS) with the sorted copy of input objects" );
51 
52  declareProperty("SortVariable", m_sortVar="pt",
53  "Define by what parameter to sort (default: 'pt'; allowed: 'pt', 'eta', 'phi', 'm', 'e', 'rapidity')" );
54 
55  declareProperty("SortDescending", m_sortDescending=true,
56  "Define if the container should be sorted in a descending order (default=true)" );
57 }

◆ ~ParticleSortingTool()

ParticleSortingTool::~ParticleSortingTool ( )
virtual

Destructor:

Definition at line 62 of file ParticleSortingTool.cxx.

63 {}

Member Function Documentation

◆ addBranches()

StatusCode ParticleSortingTool::addBranches ( ) const
finaloverridevirtual

Implement the method from the ISkimmingTool interface.

Implements DerivationFramework::IAugmentationTool.

Definition at line 139 of file ParticleSortingTool.cxx.

140 {
141  // Increase the event counter
143 
144  // Simple status message at the beginning of each event execute,
145  ATH_MSG_DEBUG ( "==> addBranches " << name() << " on " << m_nEventsProcessed << ". event..." );
146 
147  if ( m_outCollKey.value().empty() ) {
148  // Try to get the input container as non-const
149  ATH_MSG_DEBUG("Got an empty 'OutputCollection' property. "
150  << "Trying to retrieve a non-const version of the 'InputContainer'...");
151  xAOD::IParticleContainer* inCont = evtStore()->tryRetrieve<xAOD::IParticleContainer>( m_inCollKey.value() );
152  if (inCont){ ATH_CHECK( this->doSort(inCont) ); }
153  else {
154  ATH_MSG_DEBUG("We couldn't retrieve a non-const version of the input container... try const.");
155  const xAOD::IParticleContainer* inCont2 = nullptr;
156  ATH_CHECK( evtStore()->retrieve( inCont2, m_inCollKey.value()) );
157  // Now, do the copy and sorting and overwriting of all known container types
158  if (false) {
159  }
172  else {
173  ATH_MSG_ERROR("Couln't find the provided intput container in store gate for later overwriting");
174  return StatusCode::FAILURE;
175  }
176  }
177  }
178  else {
179  ATH_MSG_DEBUG("Got a non-empty 'OutputCollection' property. "
180  << "Trying to retrieve a const version of the 'InputContainer'...");
181 
182  // Now, do the copy and sorting of all known container types
183  if (false) {
184  }
197  else {
198  ATH_MSG_ERROR("Couln't find the provided intput container in store gate");
199  return StatusCode::FAILURE;
200  }
201 
202  }
203 
204  return StatusCode::SUCCESS;
205 }

◆ compareAuxData()

bool ParticleSortingTool::compareAuxData ( const xAOD::IParticle partA,
const xAOD::IParticle partB 
) const
private

The method to compare an auxdata member of the particle.

Definition at line 310 of file ParticleSortingTool.cxx.

312 {
313  SG::ConstAccessor<float> acc( this->m_sortVar.value() );
314  return this->compareDouble(acc(*partA),acc(*partB));
315 }

◆ compareDouble()

bool ParticleSortingTool::compareDouble ( double  a,
double  b 
) const
inlineprivate

Method to compare two doubles.

Definition at line 123 of file ParticleSortingTool.h.

124 {
125  if ( m_sortID < 0 ) { return CxxUtils::fpcompare::greater(a,b); }
126  else { return CxxUtils::fpcompare::less(a,b); }
127 }

◆ compareEnergy()

bool ParticleSortingTool::compareEnergy ( const xAOD::IParticle partA,
const xAOD::IParticle partB 
) const
private

The method to compare the particle's energy.

Definition at line 293 of file ParticleSortingTool.cxx.

295 {
296  const double a = partA->e();
297  const double b = partB->e();
298  return this->compareDouble(a,b);
299 }

◆ compareEta()

bool ParticleSortingTool::compareEta ( const xAOD::IParticle partA,
const xAOD::IParticle partB 
) const
private

The method to compare the particle's eta.

Definition at line 266 of file ParticleSortingTool.cxx.

268 {
269  const double a = partA->eta();
270  const double b = partB->eta();
271  return this->compareDouble(a,b);
272 }

◆ compareMass()

bool ParticleSortingTool::compareMass ( const xAOD::IParticle partA,
const xAOD::IParticle partB 
) const
private

The method to compare the particle's mass.

Definition at line 284 of file ParticleSortingTool.cxx.

286 {
287  const double a = partA->m();
288  const double b = partB->m();
289  return this->compareDouble(a,b);
290 }

◆ comparePhi()

bool ParticleSortingTool::comparePhi ( const xAOD::IParticle partA,
const xAOD::IParticle partB 
) const
private

The method to compare the particle's phi.

Definition at line 275 of file ParticleSortingTool.cxx.

277 {
278  const double a = partA->phi();
279  const double b = partB->phi();
280  return this->compareDouble(a,b);
281 }

◆ comparePt()

bool ParticleSortingTool::comparePt ( const xAOD::IParticle partA,
const xAOD::IParticle partB 
) const
private

The method to compare the particle's pt.

Definition at line 257 of file ParticleSortingTool.cxx.

259 {
260  const double a = partA->pt();
261  const double b = partB->pt();
262  return this->compareDouble(a,b);
263 }

◆ compareRapidity()

bool ParticleSortingTool::compareRapidity ( const xAOD::IParticle partA,
const xAOD::IParticle partB 
) const
private

The method to compare the particle's rapidity.

Definition at line 302 of file ParticleSortingTool.cxx.

304 {
305  const double a = partA->rapidity();
306  const double b = partB->rapidity();
307  return this->compareDouble(a,b);
308 }

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

◆ doSort()

StatusCode ParticleSortingTool::doSort ( xAOD::IParticleContainer cont) const
private

Helper method that implements the call to the right sort function.

Definition at line 209 of file ParticleSortingTool.cxx.

210 {
211  if ( !cont ) {
212  ATH_MSG_ERROR("No container to be sorted");
213  return StatusCode::FAILURE;
214  }
215  // Actually do the sorting, using a C++11 lambda function construct
216  // to be able to use the member function here
217  if ( std::abs(m_sortID) == 1 ) {
218  cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) {
219  return this->comparePt(a,b);
220  } );
221  }
222  else if ( std::abs(m_sortID) == 2 ) {
223  cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) {
224  return this->compareEta(a,b);
225  } );
226  }
227  else if ( std::abs(m_sortID) == 3 ) {
228  cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) {
229  return this->comparePhi(a,b);
230  } );
231  }
232  else if ( std::abs(m_sortID) == 4 ) {
233  cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) {
234  return this->compareMass(a,b);
235  } );
236  }
237  else if ( std::abs(m_sortID) == 5 ) {
238  cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) {
239  return this->compareEnergy(a,b);
240  } );
241  }
242  else if ( std::abs(m_sortID) == 6 ) {
243  cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) {
244  return this->compareRapidity(a,b);
245  } );
246  }
247  else if ( std::abs(m_sortID) == 7 ) {
248  cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) {
249  return this->compareAuxData(a,b);
250  } );
251  }
252 
253  return StatusCode::SUCCESS;
254 }

◆ doSortConst()

template<class CONTAINERTYPE >
StatusCode ParticleSortingTool::doSortConst ( ConstDataVector< CONTAINERTYPE > *  cont) const
private

Helper method to sort a ConstDataVector.

Definition at line 131 of file ParticleSortingTool.h.

132 {
133  if ( !cont ) {
134  ATH_MSG_ERROR("No ConstDataVector to be sorted");
135  return StatusCode::FAILURE;
136  }
137  // Actually do the sorting, using a C++11 lambda function construct
138  // to be able to use the member function here
139  if ( std::abs(m_sortID) == 1 ) {
140  cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) {
141  return this->comparePt(a,b);
142  } );
143  }
144  else if ( std::abs(m_sortID) == 2 ) {
145  cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) {
146  return this->compareEta(a,b);
147  } );
148  }
149  else if ( std::abs(m_sortID) == 3 ) {
150  cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) {
151  return this->comparePhi(a,b);
152  } );
153  }
154  else if ( std::abs(m_sortID) == 4 ) {
155  cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) {
156  return this->compareMass(a,b);
157  } );
158  }
159  else if ( std::abs(m_sortID) == 5 ) {
160  cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) {
161  return this->compareEnergy(a,b);
162  } );
163  }
164  else if ( std::abs(m_sortID) == 6 ) {
165  cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) {
166  return this->compareRapidity(a,b);
167  } );
168  }
169  else if ( std::abs(m_sortID) == 7 ) {
170  cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) {
171  return this->compareAuxData(a,b);
172  } );
173  }
174 
175  return StatusCode::SUCCESS;
176 }

◆ 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

◆ finalize()

StatusCode ParticleSortingTool::finalize ( )
overridevirtual

Athena algtool's finalize.

Definition at line 101 of file ParticleSortingTool.cxx.

102 {
103  ATH_MSG_DEBUG ("Finalizing " << name() << "...");
104 
105  return StatusCode::SUCCESS;
106 }

◆ initialize()

StatusCode ParticleSortingTool::initialize ( )
overridevirtual

Athena algtool's initialize.

Definition at line 69 of file ParticleSortingTool.cxx.

70 {
71  ATH_MSG_DEBUG ("Initializing " << name() << "...");
72 
73  // Print out the used configuration
74  ATH_MSG_DEBUG ( " using = " << m_inCollKey );
75  ATH_MSG_DEBUG ( " using = " << m_outCollKey );
76 
77  // initialize the counters
78  m_sortID = 0;
80 
81  // Figure out how to sort
82  if ( m_sortVar.value() == "pt" ) { m_sortID = 1; }
83  else if ( m_sortVar.value() == "eta" ) { m_sortID = 2; }
84  else if ( m_sortVar.value() == "phi" ) { m_sortID = 3; }
85  else if ( m_sortVar.value() == "m" ) { m_sortID = 4; }
86  else if ( m_sortVar.value() == "e" ) { m_sortID = 5; }
87  else if ( m_sortVar.value() == "rapidity" ) { m_sortID = 6; }
88  else {
89  ATH_MSG_INFO("Didn't find a valid value for SortVariable=" << m_sortVar.value() << "."
90  << " Assuming it's an auxdata member");
91  m_sortID = 7;
92  }
93  if ( m_sortDescending.value() ) { m_sortID *= -1; }
94 
95  return StatusCode::SUCCESS;
96 }

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

◆ interfaceID()

static const InterfaceID& DerivationFramework::IAugmentationTool::interfaceID ( )
inlinestaticinherited

AlgTool interface methods.

Definition at line 31 of file IAugmentationTool.h.

31 { return IID_IAugmentationTool; }

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

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

◆ renounce()

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

Definition at line 380 of file AthCommonDataStore.h.

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

◆ renounceArray()

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

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ sysInitialize()

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

Perform system initialization for an algorithm.

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

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

◆ sysStart()

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

Handle START transition.

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

◆ updateVHKA()

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

Definition at line 308 of file AthCommonDataStore.h.

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

Member Data Documentation

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_inCollKey

StringProperty ParticleSortingTool::m_inCollKey
private

Input container name.

Definition at line 102 of file ParticleSortingTool.h.

◆ m_nEventsProcessed

std::atomic<unsigned long> ParticleSortingTool::m_nEventsProcessed
mutableprivate

Internal event counter.

Definition at line 118 of file ParticleSortingTool.h.

◆ m_outCollKey

StringProperty ParticleSortingTool::m_outCollKey
private

The name of the output container (with SG::VIEW_ELEMENTS) with the sorted copy of input objects.

Definition at line 105 of file ParticleSortingTool.h.

◆ m_sortDescending

BooleanProperty ParticleSortingTool::m_sortDescending
private

Define if the container should be sorted in a descending order (default=true)

Definition at line 111 of file ParticleSortingTool.h.

◆ m_sortID

int ParticleSortingTool::m_sortID
private

Internal identifier for the type of sorting.

Definition at line 115 of file ParticleSortingTool.h.

◆ m_sortVar

StringProperty ParticleSortingTool::m_sortVar
private

Define by what parameter to sort (default: 'pt')

Definition at line 108 of file ParticleSortingTool.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:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
ParticleSortingTool::compareMass
bool compareMass(const xAOD::IParticle *partA, const xAOD::IParticle *partB) const
The method to compare the particle's mass.
Definition: ParticleSortingTool.cxx:284
ParticleSortingTool::compareAuxData
bool compareAuxData(const xAOD::IParticle *partA, const xAOD::IParticle *partB) const
The method to compare an auxdata member of the particle.
Definition: ParticleSortingTool.cxx:310
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
ParticleSortingTool::m_outCollKey
StringProperty m_outCollKey
The name of the output container (with SG::VIEW_ELEMENTS) with the sorted copy of input objects.
Definition: ParticleSortingTool.h:105
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
ParticleSortingTool::m_sortID
int m_sortID
Internal identifier for the type of sorting.
Definition: ParticleSortingTool.h:115
ParticleSortingTool::m_sortVar
StringProperty m_sortVar
Define by what parameter to sort (default: 'pt')
Definition: ParticleSortingTool.h:108
xAOD::IParticle::rapidity
virtual double rapidity() const =0
The true rapidity (y) of the particle.
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
COPY_AND_SORT_CONTAINER
#define COPY_AND_SORT_CONTAINER(CONTAINERTYPE)
Definition: ParticleSortingTool.cxx:111
ParticleSortingTool::comparePt
bool comparePt(const xAOD::IParticle *partA, const xAOD::IParticle *partB) const
The method to compare the particle's pt.
Definition: ParticleSortingTool.cxx:257
SG::ConstAccessor< float >
ParticleSortingTool::m_nEventsProcessed
std::atomic< unsigned long > m_nEventsProcessed
Internal event counter.
Definition: ParticleSortingTool.h:118
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
ParticleSortingTool::compareRapidity
bool compareRapidity(const xAOD::IParticle *partA, const xAOD::IParticle *partB) const
The method to compare the particle's rapidity.
Definition: ParticleSortingTool.cxx:302
CxxUtils::fpcompare::greater
bool greater(double a, double b)
Compare two FP numbers, working around x87 precision issues.
Definition: fpcompare.h:140
ParticleSortingTool::comparePhi
bool comparePhi(const xAOD::IParticle *partA, const xAOD::IParticle *partB) const
The method to compare the particle's phi.
Definition: ParticleSortingTool.cxx:275
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
ParticleSortingTool::compareEta
bool compareEta(const xAOD::IParticle *partA, const xAOD::IParticle *partB) const
The method to compare the particle's eta.
Definition: ParticleSortingTool.cxx:266
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
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ParticleSortingTool::compareEnergy
bool compareEnergy(const xAOD::IParticle *partA, const xAOD::IParticle *partB) const
The method to compare the particle's energy.
Definition: ParticleSortingTool.cxx:293
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
ParticleSortingTool::m_sortDescending
BooleanProperty m_sortDescending
Define if the container should be sorted in a descending order (default=true)
Definition: ParticleSortingTool.h:111
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
xAOD::IParticle::pt
virtual double pt() const =0
The transverse momentum ( ) of the particle.
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
ParticleSortingTool::m_inCollKey
StringProperty m_inCollKey
Input container name.
Definition: ParticleSortingTool.h:102
CxxUtils::fpcompare::less
bool less(double a, double b)
Compare two FP numbers, working around x87 precision issues.
Definition: fpcompare.h:166
ParticleSortingTool::compareDouble
bool compareDouble(double a, double b) const
Method to compare two doubles.
Definition: ParticleSortingTool.h:123
DataVector::sort
void sort()
Sort the container.
a
TList * a
Definition: liststreamerinfos.cxx:10
h
xAOD::IParticle::eta
virtual double eta() const =0
The pseudorapidity ( ) of the particle.
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
ParticleSortingTool::doSort
StatusCode doSort(xAOD::IParticleContainer *cont) const
Helper method that implements the call to the right sort function.
Definition: ParticleSortingTool.cxx:209
xAOD::IParticle::phi
virtual double phi() const =0
The azimuthal angle ( ) of the particle.
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::IParticle::e
virtual double e() const =0
The total energy of the particle.
fitman.k
k
Definition: fitman.py:528
xAOD::IParticle::m
virtual double m() const =0
The invariant mass of the particle.
OVERWRITE_AND_SORT_CONTAINER
#define OVERWRITE_AND_SORT_CONTAINER(CONTAINERTYPE)
Definition: ParticleSortingTool.cxx:124