ATLAS Offline Software
IsolationHelpers.h
Go to the documentation of this file.
1 // Dear emacs, this is -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 #ifndef XAODPRIMITIVES_ISOLATIONHELPERS_H
8 #define XAODPRIMITIVES_ISOLATIONHELPERS_H
9 
13 #include <cmath>
14 #include <cassert>
15 #include <iostream>
16 
17 namespace xAOD {
18 
19  namespace Iso {
20 
23  return static_cast<IsolationConeSize>(type%10);
24  }
25 
27  inline float coneSize( IsolationConeSize type ){
28  return 0.1 + (static_cast<int>(type))*0.05;
29  }
30 
32  inline IsolationConeSize coneSize( float size ){
33  int index = static_cast<int>(size*20)-2; // *20 equiv. to /0.05;
34  assert ( (index>-1) && (index < static_cast<int>(numIsolationConeSizes) ) );
36  assert ( fabs(size-coneSize(rel) )<0.0001 ); // this will fail if the input size is 0.3001...
37  return rel;
38  }
39 
41  inline float coneSize( IsolationType type ){
43  return coneSize(size);
44  }
45 
48  int subtype = type/10;
49  if( subtype >= static_cast<int>(numIsolationFlavours) ) return numIsolationFlavours;
50  return static_cast<IsolationFlavour>(subtype);
51  }
52 
53  // create a IsolationType from IsolationFlavour and IsolationConeSize
55  return static_cast<IsolationType>( 10*static_cast<int>(flavour) + static_cast<int>(coneSize) );
56  }
57 
58  template< class IsoType>
59  std::string toString( const IsoType& iso ) {
60  return toCString(iso);
61  }
62 
63 
64  } // namespace Iso
65 
66 
67 } // namespace xAOD
68 
69 #endif // XAODPRIMITIVES_ISOLATIONHELPERS_H
70 
skel.rel
rel
Announce start of JO checkingrelease nimber checking.
Definition: skel.GENtoEVGEN.py:182
xAOD::Iso::IsolationConeSize
IsolationConeSize
Enumeration for different cone sizes.
Definition: IsolationConeSize.h:17
index
Definition: index.py:1
xAOD::Iso::IsolationFlavour
IsolationFlavour
Enumeration for different ways of calculating isolation in xAOD files.
Definition: IsolationFlavour.h:17
xAOD::Iso::toString
std::string toString(const IsoType &iso)
Definition: IsolationHelpers.h:59
IsolationType.h
xAOD::Iso::enumconeSize
IsolationConeSize enumconeSize(IsolationType type)
convert Isolation Type into cone size
Definition: IsolationHelpers.h:22
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
CP::IsoType
xAOD::Iso::IsolationType IsoType
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:36
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
CP::Iso
@ Iso
Definition: MuonEfficiencyType.h:16
xAOD::Iso::IsolationType
IsolationType
Overall enumeration for isolation types in xAOD files.
Definition: IsolationType.h:26
xAOD::Iso::numIsolationConeSizes
@ numIsolationConeSizes
Definition: IsolationConeSize.h:27
IsolationConeSize.h
xAOD::Iso::isolationFlavour
IsolationFlavour isolationFlavour(IsolationType type)
convert Isolation Type into Isolation Flavour
Definition: IsolationHelpers.h:47
xAOD::Iso::numIsolationFlavours
@ numIsolationFlavours
Definition: IsolationFlavour.h:49
DeMoScan.index
string index
Definition: DeMoScan.py:364
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
IsolationFlavour.h
xAOD::Iso::coneSize
float coneSize(IsolationConeSize type)
convert Isolation Size into cone size
Definition: IsolationHelpers.h:27
subproc.subtype
string subtype
Definition: subproc.py:19
xAOD::Iso::isolationType
IsolationType isolationType(IsolationFlavour flavour, IsolationConeSize coneSize)
Definition: IsolationHelpers.h:54