ATLAS Offline Software
Loading...
Searching...
No Matches
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
16namespace xAOD{
17
22
25 AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( JetElement_v1 , unsigned int , key , setKey )
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
162 ( ( emEnergy() + hadEnergy() ) >= m_saturationThreshold ) ){
164 }
165 return emEnergy() + hadEnergy();
166 }
167
168 int JetElement_v1::emSliceEnergy(int slice) const
169 {
170 if( slice >= 0 && slice < (int)emEnergyVec().size() ) {
171 if( emEnergyVec()[ slice ] < m_layerSaturationThreshold ) {
172 return emEnergyVec()[ slice ];
173 }
175 }
176 return 0;
177 }
178
179 int JetElement_v1::hadSliceEnergy(int slice) const
180 {
181 if( slice >= 0 && slice < (int)hadEnergyVec().size() ) {
182 if( hadEnergyVec()[ slice ] < m_layerSaturationThreshold ) {
183 return hadEnergyVec()[ slice ];
184 }
186 }
187 return 0;
188 }
189
190 int JetElement_v1::sliceEnergy(int slice) const
191 {
192 if( ( emSliceEnergy(slice) >= m_layerSaturationThreshold ) ||
194 ( ( emSliceEnergy(slice) + hadSliceEnergy(slice) ) >= m_saturationThreshold ) ){
196 }
197 return emSliceEnergy(slice) + hadSliceEnergy(slice);
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
Scalar eta() const
pseudorapidity method
#define AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
Macro creating the accessors of primitive auxiliary properties.
#define AUXSTORE_OBJECT_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
Macro creating the accessors of complex auxiliary properties.
AuxElement()
Default constructor.
Description of JetElement_v1.
const std::vector< int > & emEnergyVec() const
get emEnergyVec - emEnergy for all time slices
void addEnergy(int emEnergy, int hadEnergy)
Add ET to triggered time slice.
const std::vector< int > & linkErrorVec() const
get linkErrorVec - linkError for all time slices
int peak() const
get peak
bool isHadSaturated() const
is Had component of JetElement saturated?
int hadSliceEnergy(int slice) const
get hadEnery for hadEnergyVec[slice] - time slice for arbitary slice
void setEmEnergyVec(const std::vector< int > &)
set emEnergyVec - emEnergy for all time slices
void setHadErrorVec(const std::vector< int > &)
set hadErrorVec - hadError for all time slices
int hadError() const
get hadError for hadErrorVec[peak] - time slice that (hopefully) contains the collision
void setLinkErrorVec(const std::vector< int > &)
set linkErrorVec - linkError for all time slices
bool isEmSaturated() const
is EM component of JetElement saturated?
const std::vector< int > & emErrorVec() const
get emErrorVec - emError for all time slices
int linkError() const
get linkError for linkErrorVec[peak] - time slice that (hopefully) contains the collision
int energy() const
get total energy. returns emEnergy() + hadEnergy()
void setEmErrorVec(const std::vector< int > &)
set emErrorVec - emError for all time slices
static const int m_saturationThreshold
int sliceEnergy(int slice) const
get total energy. returns emSliceEnergy(slice) + hadSliceEnergy(slice)
void addSlice(int slice, int emEnergy, int hadEnergy, int emError, int hadError, int linkError)
Add ET values to specified slice.
static const int m_layerSaturationThreshold
int emError() const
get emError for emErrorVec[peak] - time slice that (hopefully) contains the collision
const std::vector< int > & hadErrorVec() const
get hadErrorVec - hadError for all time slices
int emEnergy() const
get emEnery for emEnergyVec[peak] - time slice that (hopefully) contains the collision
const std::vector< int > & hadEnergyVec() const
get hadEnergyVec - hadEnergy for all time slices
int hadEnergy() const
get hadEnery for hadEnergyVec[peak] - time slice that (hopefully) contains the collision
bool isSaturated() const
is JetElement saturated?
void setHadEnergyVec(const std::vector< int > &)
set hadEnergyVec - hadEnergy for all time slices
int emSliceEnergy(int slice) const
get emEnery for emEnergyVec[slice] - time slice for arbitary slice
Forward declaration.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.