ATLAS Offline Software
InDetPhysValMonitoringUtilities.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef INDETPHYSVALMONITORINGUTILITIES
6 #define INDETPHYSVALMONITORINGUTILITIES
7 
13  #include <cmath>
14  #include <vector>
15 namespace IDPVM {
17  constexpr float
18  operator "" _GeV (long double energy) {
19  return energy * 0.001;
20  }
21 
22  constexpr float
23  operator "" _GeV (unsigned long long energy) {
24  return energy * 0.001;
25  }
26 
28  template <class T>
29  inline bool
30  inRange(const T& value, const T& minVal, const T& maxVal) {
31  return not ((value < minVal)or(value > maxVal));
32  }
33 
34  template<class T>
35  inline bool
36  inRange(const T& value, const T& absoluteMax) {
37  return not (std::abs(value) > absoluteMax);
38  }
39 
41  template <class T>
42  unsigned int
43  binIndex(const T& val, const std::vector<T>& partitions) {// signature should allow other containers
44  unsigned int i(0);
45  bool nf = true;
46 
47  while (nf and i != partitions.size()) {
48  nf = (val > partitions[i++]);
49  }
50  return nf ? i : i - 1;
51  }
52 
54  template <class T>
55  inline float
56  safelyGetEta(const T& pTrk, const float safePtThreshold = 0.1) {
57  return (pTrk.pt() > safePtThreshold) ? (pTrk.eta()) : std::nan("");
58  }
59 
60  template <class T>
61  inline float
62  safelyGetEta(const T* pTrk, const float safePtThreshold = 0.1) {
63  return (pTrk->pt() > safePtThreshold) ? (pTrk->eta()) : std::nan("");
64  }
65 }
66 
67  #endif
IDPVM
Class to retrieve associated truth from a track, implementing a cached response.
Definition: InDetPhysValMonitoringTool.h:55
athena.value
value
Definition: athena.py:124
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
lumiFormat.i
int i
Definition: lumiFormat.py:85
IDPVM::binIndex
unsigned int binIndex(const T &val, const std::vector< T > &partitions)
general utility function to return bin index given a value and the upper endpoints of each bin
Definition: InDetPhysValMonitoringUtilities.h:43
DeMoScan.partitions
dictionary partitions
Definition: DeMoScan.py:67
IDPVM::safelyGetEta
float safelyGetEta(const T &pTrk, const float safePtThreshold=0.1)
Safely get eta.
Definition: InDetPhysValMonitoringUtilities.h:56
IDPVM::inRange
bool inRange(const T &value, const T &minVal, const T &maxVal)
general utility function to check value is in range
Definition: InDetPhysValMonitoringUtilities.h:30
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14