ATLAS Offline Software
Event/xAOD/xAODInDetMeasurement/Root/Utilities.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
8 
9  float computeTotalCharge( const SG::AuxElement& cluster) {
10  static const SG::AuxElement::Accessor<std::vector<float> > chargesAcc("chargeList");
11  assert( chargesAcc.isAvailable( cluster ) );
13  }
14 
15  float computeTotalCharge( const std::vector<float>& charges) {
16  float totalCharge = 0.f;
17  for (auto& charge : charges)
18  totalCharge += charge;
19  return totalCharge;
20  }
21 
22  int computeTotalToT( const SG::AuxElement& cluster) {
23  static const SG::AuxElement::Accessor< std::vector<int> > totsAcc("totList");
24  assert( totsAcc.isAvailable( cluster ) );
26  }
27 
28  int computeTotalToT( const std::vector<int>& tots) {
29  int totalToT = 0;
30  for (auto& tot : tots)
31  totalToT += tot;
32  return totalToT;
33  }
34 
35 }
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:66
SG::AuxElement
Base class for elements of a container that can have aux data.
Definition: AuxElement.h:446
xAOD::xAODInDetMeasurement::Utilities::computeTotalToT
int computeTotalToT(const SG::AuxElement &cluster)
Definition: Event/xAOD/xAODInDetMeasurement/Root/Utilities.cxx:22
xAOD::xAODInDetMeasurement::Utilities
Definition: Event/xAOD/xAODInDetMeasurement/Root/Utilities.cxx:7
xAOD::charge
charge
Definition: TrigElectron_v1.cxx:85
LB_AnalMapSplitter.tot
tot
Definition: LB_AnalMapSplitter.py:46
xAOD::xAODInDetMeasurement::Utilities::computeTotalCharge
float computeTotalCharge(const SG::AuxElement &cluster)
Definition: Event/xAOD/xAODInDetMeasurement/Root/Utilities.cxx:9
Utilities.h
SG::ConstAccessor< T, AuxAllocator_t< T > >::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.