ATLAS Offline Software
JetElement_v1.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // $Id: JetElement_v1.cxx 638578 2015-01-09 17:00:15Z morrisj $
6 
7 // System include(s):
8 #include <cmath>
9 
10 // EDM includes(s):
12 
13 // Local include(s):
15 
16 namespace xAOD{
17 
19  SG::AuxElement()
20  {
21  }
22 
25  AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( JetElement_v1 , unsigned int , key , setKey )
26  AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( JetElement_v1 , int , peak , setPeak )
27  AUXSTORE_OBJECT_SETTER_AND_GETTER( JetElement_v1 , std::vector<int> , emEnergyVec , setEmEnergyVec )
28  AUXSTORE_OBJECT_SETTER_AND_GETTER( JetElement_v1 , std::vector<int> , hadEnergyVec , setHadEnergyVec )
29  AUXSTORE_OBJECT_SETTER_AND_GETTER( JetElement_v1 , std::vector<int> , emErrorVec , setEmErrorVec )
30  AUXSTORE_OBJECT_SETTER_AND_GETTER( JetElement_v1 , std::vector<int> , hadErrorVec , setHadErrorVec )
31  AUXSTORE_OBJECT_SETTER_AND_GETTER( JetElement_v1 , std::vector<int> , linkErrorVec , setLinkErrorVec )
32 
33  void JetElement_v1::addEnergy(int emEnergyIn, int hadEnergyIn)
34  {
36 
39  int modifiedEmEnergy = emEnergy() + emEnergyIn;
40  if( modifiedEmEnergy > m_layerSaturationThreshold ){
41  modifiedEmEnergy = m_layerSaturationThreshold;
42  }
43 
44  // copy (I don't like this) the current Aux const data member vector to a non-const stack vector
45  // modify the content of the stack vector and set it as the Aux data member
46  std::vector<int> modifiedEmEnergyVec;
47  const std::vector<int> currentEmEnergyVec = emEnergyVec();
48  for(std::vector<int>::const_iterator i=currentEmEnergyVec.begin();i!=currentEmEnergyVec.end();++i){
49  modifiedEmEnergyVec.push_back( (*i) );
50  }
51  modifiedEmEnergyVec[ peak() ] = modifiedEmEnergy;
52  setEmEnergyVec( modifiedEmEnergyVec );
53 
54 
56 
59  int modifiedHadEnergy = hadEnergy() + hadEnergyIn;
60  if( modifiedHadEnergy > m_layerSaturationThreshold ){
61  modifiedEmEnergy = m_layerSaturationThreshold;
62  }
63 
64  // copy (I don't like this) the current Aux const data member vector to a non-const stack vector
65  // modify the content of the stack vector and set it as the Aux data member
66  std::vector<int> modifiedHadEnergyVec;
67  const std::vector<int> currentHadEnergyVec = hadEnergyVec();
68  for(std::vector<int>::const_iterator i=currentHadEnergyVec.begin();i!=currentHadEnergyVec.end();++i){
69  modifiedHadEnergyVec.push_back( (*i) );
70  }
71  modifiedHadEnergyVec[ peak() ] = modifiedHadEnergy;
72  setHadEnergyVec( modifiedHadEnergyVec );
73 
74 
75  }
76 
77 
78  void JetElement_v1::addSlice(int slice, int emEnergyIn, int hadEnergyIn,int emErrorIn, int hadErrorIn, int linkErrorIn)
79  {
81 
82  // EM Energy
83  int modifiedEmEnergy = emSliceEnergy( slice ) + emEnergyIn;
84  if( modifiedEmEnergy > m_layerSaturationThreshold ){
85  modifiedEmEnergy = m_layerSaturationThreshold;
86  }
87  std::vector<int> modifiedEmEnergyVec;
88  const std::vector<int> currentEmEnergyVec = emEnergyVec();
89  for(std::vector<int>::const_iterator i=currentEmEnergyVec.begin();i!=currentEmEnergyVec.end();++i){
90  modifiedEmEnergyVec.push_back( (*i) );
91  }
92  modifiedEmEnergyVec[ slice ] = modifiedEmEnergy;
93  setEmEnergyVec( modifiedEmEnergyVec );
94 
95  // Had Energy
96  int modifiedHadEnergy = hadSliceEnergy( slice ) + hadEnergyIn;
97  if( modifiedHadEnergy > m_layerSaturationThreshold ){
98  modifiedEmEnergy = m_layerSaturationThreshold;
99  }
100  std::vector<int> modifiedHadEnergyVec;
101  const std::vector<int> currentHadEnergyVec = hadEnergyVec();
102  for(std::vector<int>::const_iterator i=currentHadEnergyVec.begin();i!=currentHadEnergyVec.end();++i){
103  modifiedHadEnergyVec.push_back( (*i) );
104  }
105  modifiedHadEnergyVec[ slice ] = modifiedHadEnergy;
106  setHadEnergyVec( modifiedHadEnergyVec );
107 
108  // EM Error
109  int modifiedEmError = emErrorVec()[ slice ] + emErrorIn;
110  std::vector<int> modifiedEmErrorVec;
111  const std::vector<int> currentEmErrorVec = emErrorVec();
112  for(std::vector<int>::const_iterator i=currentEmErrorVec.begin();i!=currentEmErrorVec.end();++i){
113  modifiedEmErrorVec.push_back( (*i) );
114  }
115  modifiedEmErrorVec[ slice ] = modifiedEmError;
116  setEmErrorVec( modifiedEmErrorVec );
117 
118  // Had Error
119  int modifiedHadError = hadErrorVec()[ slice ] + hadErrorIn;
120  std::vector<int> modifiedHadErrorVec;
121  const std::vector<int> currentHadErrorVec = hadErrorVec();
122  for(std::vector<int>::const_iterator i=currentHadErrorVec.begin();i!=currentHadErrorVec.end();++i){
123  modifiedHadErrorVec.push_back( (*i) );
124  }
125  modifiedHadErrorVec[ slice ] = modifiedHadError;
126  setHadErrorVec( modifiedHadErrorVec );
127 
128  // Link Error
129  int modifiedLinkError = linkErrorVec()[ slice ] + linkErrorIn;
130  std::vector<int> modifiedLinkErrorVec;
131  const std::vector<int> currentLinkErrorVec = linkErrorVec();
132  for(std::vector<int>::const_iterator i=currentLinkErrorVec.begin();i!=currentLinkErrorVec.end();++i){
133  modifiedLinkErrorVec.push_back( (*i) );
134  }
135  modifiedLinkErrorVec[ slice ] = modifiedLinkError;
136  setLinkErrorVec( modifiedLinkErrorVec );
137 
138 
139  }
140 
142  {
144  return emEnergyVec()[ peak() ];
145  }
147  }
148 
150  {
152  return hadEnergyVec()[ peak() ];
153  }
155  }
156 
158  {
159 
160  if( ( emEnergy() >= m_layerSaturationThreshold ) ||
162  ( ( emEnergy() + hadEnergy() ) >= m_saturationThreshold ) ){
163  return m_saturationThreshold;
164  }
165  return emEnergy() + hadEnergy();
166  }
167 
169  {
170  if( slice >= 0 && slice < (int)emEnergyVec().size() ) {
172  return emEnergyVec()[ slice ];
173  }
175  }
176  return 0;
177  }
178 
180  {
181  if( slice >= 0 && slice < (int)hadEnergyVec().size() ) {
183  return hadEnergyVec()[ slice ];
184  }
186  }
187  return 0;
188  }
189 
191  {
195  return m_saturationThreshold;
196  }
198  }
199 
200 
202  {
203  return energy() == m_saturationThreshold;
204  }
205 
207  {
209  }
210 
212  {
214  }
215 
217  {
218  return emErrorVec()[ peak() ];
219  }
220 
222  {
223  return hadErrorVec()[ peak() ];
224  }
225 
227  {
228  return linkErrorVec()[ peak() ];
229  }
230 
231 } // namespace xAOD
xAOD::AUXSTORE_PRIMITIVE_SETTER_AND_GETTER
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, IP2D_pb, setIP2D_pb) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1
xAOD::JetElement_v1::peak
int peak() const
get peak
xAOD::JetElement_v1::setHadErrorVec
void setHadErrorVec(const std::vector< int > &)
set hadErrorVec - hadError for all time slices
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
xAOD::JetElement_v1::emEnergyVec
const std::vector< int > & emEnergyVec() const
get emEnergyVec - emEnergy for all time slices
AuxStoreAccessorMacros.h
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
xAOD::JetElement_v1::emSliceEnergy
int emSliceEnergy(int slice) const
get emEnery for emEnergyVec[slice] - time slice for arbitary slice
Definition: JetElement_v1.cxx:168
xAOD::JetElement_v1::isHadSaturated
bool isHadSaturated() const
is Had component of JetElement saturated?
Definition: JetElement_v1.cxx:211
xAOD::JetElement_v1::sliceEnergy
int sliceEnergy(int slice) const
get total energy. returns emSliceEnergy(slice) + hadSliceEnergy(slice)
Definition: JetElement_v1.cxx:190
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
xAOD::JetElement_v1::emErrorVec
const std::vector< int > & emErrorVec() const
get emErrorVec - emError for all time slices
xAOD::JetElement_v1::setEmErrorVec
void setEmErrorVec(const std::vector< int > &)
set emErrorVec - emError for all time slices
xAOD::JetElement_v1::JetElement_v1
JetElement_v1()
Definition: JetElement_v1.cxx:18
Amg::setPhi
Amg::RotationMatrix3D setPhi(Amg::RotationMatrix3D mat, double angle, int convention=0)
Definition: EulerAnglesHelpers.h:102
xAOD::JetElement_v1::setLinkErrorVec
void setLinkErrorVec(const std::vector< int > &)
set linkErrorVec - linkError for all time slices
xAOD::phi
setEt phi
Definition: TrigEMCluster_v1.cxx:29
xAOD::JetElement_v1::m_layerSaturationThreshold
static const int m_layerSaturationThreshold
Definition: JetElement_v1.h:108
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
xAOD::JetElement_v1
Description of JetElement_v1.
Definition: JetElement_v1.h:23
xAOD::JetElement_v1::energy
int energy() const
get total energy. returns emEnergy() + hadEnergy()
Definition: JetElement_v1.cxx:157
xAOD::JetElement_v1::isEmSaturated
bool isEmSaturated() const
is EM component of JetElement saturated?
Definition: JetElement_v1.cxx:206
xAOD::JetElement_v1::addSlice
void addSlice(int slice, int emEnergy, int hadEnergy, int emError, int hadError, int linkError)
Add ET values to specified slice.
Definition: JetElement_v1.cxx:78
xAOD::JetElement_v1::hadEnergyVec
const std::vector< int > & hadEnergyVec() const
get hadEnergyVec - hadEnergy for all time slices
perfmonmt-refit.slice
slice
Definition: perfmonmt-refit.py:52
xAOD::JetElement_v1::isSaturated
bool isSaturated() const
is JetElement saturated?
Definition: JetElement_v1.cxx:201
lumiFormat.i
int i
Definition: lumiFormat.py:92
xAOD::JetElement_v1::linkErrorVec
const std::vector< int > & linkErrorVec() const
get linkErrorVec - linkError for all time slices
xAOD::JetElement_v1::setHadEnergyVec
void setHadEnergyVec(const std::vector< int > &)
set hadEnergyVec - hadEnergy for all time slices
xAOD::JetElement_v1::hadSliceEnergy
int hadSliceEnergy(int slice) const
get hadEnery for hadEnergyVec[slice] - time slice for arbitary slice
Definition: JetElement_v1.cxx:179
xAOD::JetElement_v1::emError
int emError() const
get emError for emErrorVec[peak] - time slice that (hopefully) contains the collision
Definition: JetElement_v1.cxx:216
xAOD::JetElement_v1::linkError
int linkError() const
get linkError for linkErrorVec[peak] - time slice that (hopefully) contains the collision
Definition: JetElement_v1.cxx:226
xAOD::JetElement_v1::setEmEnergyVec
void setEmEnergyVec(const std::vector< int > &)
set emEnergyVec - emEnergy for all time slices
xAOD::JetElement_v1::emEnergy
int emEnergy() const
get emEnery for emEnergyVec[peak] - time slice that (hopefully) contains the collision
Definition: JetElement_v1.cxx:141
xAOD::JetElement_v1::hadError
int hadError() const
get hadError for hadErrorVec[peak] - time slice that (hopefully) contains the collision
Definition: JetElement_v1.cxx:221
xAOD::JetElement_v1::hadErrorVec
const std::vector< int > & hadErrorVec() const
get hadErrorVec - hadError for all time slices
JetElement_v1.h
xAOD::JetElement_v1::hadEnergy
int hadEnergy() const
get hadEnery for hadEnergyVec[peak] - time slice that (hopefully) contains the collision
Definition: JetElement_v1.cxx:149
xAOD::JetElement_v1::m_saturationThreshold
static const int m_saturationThreshold
Definition: JetElement_v1.h:107
xAOD::AUXSTORE_OBJECT_SETTER_AND_GETTER
AUXSTORE_OBJECT_SETTER_AND_GETTER(CaloRings_v1, RingSetLinks, ringSetLinks, setRingSetLinks) unsigned CaloRings_v1
Definition: CaloRings_v1.cxx:27
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37