ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
EgammaReSamp2Fex Class Reference

Feature extraction Tool for LVL2 Calo. More...

#include <EgammaReSamp2Fex.h>

Inheritance diagram for EgammaReSamp2Fex:
Collaboration diagram for EgammaReSamp2Fex:

Public Member Functions

 EgammaReSamp2Fex (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual StatusCode execute (xAOD::TrigEMCluster &rtrigEmCluster, const IRoiDescriptor &roi, const CaloDetDescrElement *&caloDDE, const EventContext &context) const override
 execute feature extraction for the EM Calorimeter second layer More...
 
virtual StatusCode initialize () override
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Protected Attributes

const CaloIdManagerm_larMgr = nullptr
 Calorimeter Id Manager for calorimeter part determination (Barrel versus EndCap) More...
 
Gaudi::Property< bool > m_saveCells
 
Gaudi::Property< float > m_cellkeepthr
 
ToolHandle< IT2GeometryToolm_geometryTool
 
ServiceHandle< ITrigCaloDataAccessSvcm_dataSvc
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

double etaSizeLArEMSamp2 (const double eta, const int calo) const
 
double phiSizeLArEMSamp2 (const double eta, const int calo) const
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

Gaudi::Property< float > m_maxHotCellDeta {this, "MaxDetaHotCell", 1.0}
 
Gaudi::Property< float > m_maxHotCellDphi {this, "MaxDphiHotCell", 1.0}
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Feature extraction Tool for LVL2 Calo.

Second EM Calorimeter sample.

Definition at line 29 of file EgammaReSamp2Fex.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ EgammaReSamp2Fex()

EgammaReSamp2Fex::EgammaReSamp2Fex ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 22 of file EgammaReSamp2Fex.cxx.

23  :
25 {
26 }

Member Function Documentation

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ etaSizeLArEMSamp2()

double EgammaReSamp2Fex::etaSizeLArEMSamp2 ( const double  eta,
const int  calo 
) const
inlineprivate

Definition at line 51 of file EgammaReSamp2Fex.h.

51  {
52  double sizeEta;
53  if( calo == Calorimeter::EMBAR ){
54  if ( std::abs(cellEta) < 1.4 ){
55  sizeEta = 0.025;
56  }else{
57  sizeEta = 0.075;
58  }
59  } else {
60  if ( std::abs(cellEta) < 2.5 ){
61  sizeEta = 0.025;
62  } else{
63  sizeEta = 0.1;
64  }
65  }
66  return sizeEta;
67 }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ execute()

StatusCode EgammaReSamp2Fex::execute ( xAOD::TrigEMCluster rtrigEmCluster,
const IRoiDescriptor roi,
const CaloDetDescrElement *&  caloDDE,
const EventContext &  context 
) const
overridevirtual

execute feature extraction for the EM Calorimeter second layer

Parameters
[out]rtrigEmClusteris the output cluster.
[in]eta/phi-min/max= RoI definition.

Implements IReAlgToolCalo.

Definition at line 28 of file EgammaReSamp2Fex.cxx.

31 {
32  ATH_MSG_DEBUG("in execute(TrigEMCluster&)");
33 
34  // Region Selector, sampling 2
35  int sampling = 2;
36 
38  ATH_CHECK( m_dataSvc->loadCollections(context, roi, TTEM, sampling, sel) );
39 
40  double energyEta = 0.;
41  double energyPhi = 0.;
42 
43  // add these variables to take care of phi wrap-around
44  double energyNegPhi = 0.; // SRA
45  double energyNegPhiConv = 0.; // SRA
46  double energyPosPhi = 0.; // SRA
47 
48  // 1. Find seed cell (highest Et in ROI .. layer 2)
49  // 2. Find Et weighted eta, phi in 3*7 cell (layer 2) (photon + e id)
50  // 3. Find Et in cells of sizes 3*3, 3*7, 7*7 (layer 2 + strips)
51  // (3*7 for photon + e id)
52  // 4. Find cluster width in 3*5 cell, layer 2 (photon id, needs
53  // parabolic parametrisation)
54  // 5. Find strip energies and eta (2*5 window)
55  // 6. Find frac73 (photon id), (E1-E2)/(E1+E2) (e + photon id)
56 
57  double seedEnergy = 0.;
58  double seedPhi = 999.;
59  double seedEta = 999.;
60  double hotPhi = 999.;
61  double hotEta = 999.;
62  int ncells = 0;
63  // LVL1 positions
64  float etaL1 = rtrigEmCluster.eta();
65  float phiL1 = rtrigEmCluster.phi();
66 
67  const LArEM_ID* emID = m_larMgr->getEM_ID();
68  const LArCell* seedCell = nullptr;
69  const LArCell* hotCell = nullptr;
70  for (const LArCell* larcell : sel) {
71  if (larcell->energy() > seedEnergy) { // Hottest cell seach
72  float deta = std::abs(etaL1 - larcell->eta());
73  if (deta < m_maxHotCellDeta) { // Eta check is faster. Do it First
74  float dphi = std::abs(phiL1 - larcell->phi());
75  dphi = std::abs(M_PI - dphi);
76  dphi = std::abs(M_PI - dphi);
77  if (dphi < m_maxHotCellDphi) {
78  seedEnergy = larcell->energy();
79  seedCell = larcell;
80  } // End of dphi check
81  } // End of deta check
82  } // End of if energy
83  ncells++;
84  }
85  if (seedCell != nullptr) {
86  seedEta = seedCell->eta();
87  seedPhi = seedCell->phi();
88  // For the S-shape correction, we store the caloDDE of the hottest cell
89  caloDDE = (seedCell->caloDDE());
90  hotCell = seedCell;
91  hotEta = hotCell->eta();
92  hotPhi = hotCell->phi();
93  }
94  else {
95  return StatusCode::SUCCESS;
96  }
97 
98  std::map<const LArCell*, float> windows;
99  for (const LArCell* larcell : sel) {
100  float deta = std::abs(seedEta - larcell->eta());
101  if (deta < 0.025 + 0.002) { // Eta check is faster.
102  // Do it First 0.025 is cell, plus a little loose
103  float dphi = std::abs(seedPhi - larcell->phi());
104  dphi = std::abs(M_PI - dphi);
105  dphi = std::abs(M_PI - dphi);
106  if (dphi < 0.025 + 0.002) { // the same here (around 2*pi/64/4, but ok)
107  windows.emplace(larcell, 0.0);
108  } // End of dphi check
109  } // End of deta check
110  ncells++;
111  }
112 
113  for (const LArCell* larcell : sel) {
114  double etaCell = larcell->eta();
115  double phiCell = larcell->phi();
116  double energyCell = larcell->et();
117 
118  // Find position of current cell w.r.t. seed
119  float deta = std::abs(etaCell - seedEta);
120  if (deta > 0.05 + 0.002) continue; // find the energy weighted position with larger cluster
121  for (auto& [cell, energy] : windows) {
122  float deta1 = std::abs(etaCell - cell->eta());
123  float dphi = std::abs(phiCell - cell->phi());
124  if (dphi > M_PI) dphi = 2. * M_PI - dphi; // wrap (pi - 2pi)->(-pi - 0)
125 
126  // Electromagnetic measurements, done by layer
127  // layer 2: Et weighted eta, phi, summed Et in 3*7,
128  // cluster width in 3*5 cell
129  // emEnergy in 3*7 cell is also calculated, all samplings
130 
131  double cellSizeEta;
132  double cellSizePhi;
133  if (emID->is_em_barrel(larcell->ID())) {
134  cellSizeEta = etaSizeLArEMSamp2(etaCell, Calorimeter::EMBAR);
135  cellSizePhi = phiSizeLArEMSamp2(etaCell, Calorimeter::EMBAR);
136  }
137  else {
138  cellSizeEta = etaSizeLArEMSamp2(etaCell, Calorimeter::EMEND);
139  cellSizePhi = phiSizeLArEMSamp2(etaCell, Calorimeter::EMEND);
140  }
141 
142  // 3. do the 3*5 stuff
143  int nCellsEta = 3;
144  int nCellsPhi = 5;
145  if (deta1 <= 0.5 * double(nCellsEta - 1) * cellSizeEta + 0.01 &&
146  dphi <= 0.5 * double(nCellsPhi - 1) * cellSizePhi + 0.01) {
147  energy += energyCell;
148  } // End of do the 3*5 stuff
149  } // End of windows map loop
150  } // end of the loop
151 
152  float max = -999;
153  for (auto const& [cell, energy] : windows) {
154  if (energy > max) {
155  max = energy;
156  seedCell = cell;
157  }
158  }
159 
160  if (seedCell != nullptr) {
161  seedEta = seedCell->eta();
162  seedPhi = seedCell->phi();
163  // For the S-shape correction, we store the caloDDE of the hottest cell
164  caloDDE = (seedCell->caloDDE());
165  }
166  else {
167  return StatusCode::SUCCESS;
168  }
169 
170  bool cluster_in_barrel = true;
171  if (seedCell && seedCell->caloDDE()) cluster_in_barrel = seedCell->caloDDE()->is_lar_em_barrel();
172 
173  // Build desired quantities using the values previously obtained.
174 
175  double energy37Lay2 = 0.; // sum Et in 3*7 cell layer 2
176  double energy37Lay2NegPhi = 0.; // SRA for phi wrap-around
177  double energy37Lay2PosPhi = 0.; // SRA for phi wrap-around
178  double energy77Lay2 = 0.; // sum Et in 7*7 cell layer 2
179  double energy35Lay2 = 0.; // sum Et in 3*5 cell layer 2
180  double energy33Lay2 = 0.; // sum Et in 3*3 cell layer 2
181  double weightEta = 0.; // temporary variable for cluster width
182  double weightEta2 = 0.; // ditto
183  double clusterWidth35 = 0.; // cluster width in eta, 3*5 cell, layer 2
184  int nCellsEta = 0; // size of cell array in eta
185  int nCellsPhi = 0; // size of cell array in phi
186  double deta = 0.; // eta difference current cell - seed
187  double dphi = 0.; // phi difference current cell - seed
188 
189  double totalEnergy = 0;
191 
192  for (const LArCell* larcell : sel) {
193  double etaCell = larcell->eta();
194  double phiCell = larcell->phi();
195  double energyCell = larcell->energy();
196 
197  // Find position of current cell w.r.t. seed
198  deta = std::abs(etaCell - seedEta);
199  dphi = std::abs(phiCell - seedPhi);
200  if (dphi > M_PI) dphi = 2. * M_PI - dphi; // wrap (pi - 2pi)->(-pi - 0)
201 
202  double detaH = std::abs(etaCell - hotEta); // eta difference current cell - seed
203  double dphiH = std::abs(phiCell - hotPhi); // phi difference current cell - seed
204  if (dphiH > M_PI) dphiH = 2. * M_PI - dphiH; // wrap (pi - 2pi)->(-pi - 0)
205 
206  // Electromagnetic measurements, done by layer
207  // layer 2: Et weighted eta, phi, summed Et in 3*7,
208  // cluster width in 3*5 cell
209  // emEnergy in 3*7 cell is also calculated, all samplings
210 
211  double cellSizeEta;
212  double cellSizePhi;
213  if (emID->is_em_barrel(larcell->ID())) {
214  cellSizeEta = etaSizeLArEMSamp2(etaCell, Calorimeter::EMBAR);
215  cellSizePhi = phiSizeLArEMSamp2(etaCell, Calorimeter::EMBAR);
216  }
217  else {
218  cellSizeEta = etaSizeLArEMSamp2(etaCell, Calorimeter::EMEND);
219  cellSizePhi = phiSizeLArEMSamp2(etaCell, Calorimeter::EMEND);
220  }
221 
222  // hot cell stuff first
223  // 1. do the 7*7 stuff
224  nCellsEta = 7;
225  nCellsPhi = 7;
226  if (detaH <= 0.5 * double(nCellsEta - 1) * cellSizeEta + 0.01 &&
227  dphiH <= 0.5 * double(nCellsPhi - 1) * cellSizePhi + 0.01) {
228  // 2. do the 3*7 stuff
229  nCellsEta = 3;
230  nCellsPhi = 7;
231  if (detaH <= 0.5 * double(nCellsEta - 1) * cellSizeEta + 0.01 &&
232  dphiH <= 0.5 * double(nCellsPhi - 1) * cellSizePhi + 0.01) {
233  energy37Lay2 += energyCell;
234  } // End of do the 3*7 stuff
235  energy77Lay2 += energyCell;
236  } // End of do the 7*7 stuff
237 
238  // 1. do the 7*7 stuff
239  nCellsEta = 7;
240  nCellsPhi = 7;
241  if (deta <= 0.5 * double(nCellsEta - 1) * cellSizeEta + 0.005 &&
242  dphi <= 0.5 * double(nCellsPhi - 1) * cellSizePhi + 0.005) {
243  // 2. do the 3*7 stuff
244  nCellsEta = 3;
245  nCellsPhi = 7;
246  if (deta <= 0.5 * double(nCellsEta - 1) * cellSizeEta + 0.002 &&
247  dphi <= 0.5 * double(nCellsPhi - 1) * cellSizePhi + 0.002) {
248  energyEta += energyCell * etaCell;
249  // energy37Lay2 += energyCell;
250 
251  if (cluster_in_barrel) {
252  samp = larcell->caloDDE()->getSampling();
253  }
254 
255  if (phiCell > 0.) { // SRA phi wrap-around
256  energyPosPhi += double(energyCell) * phiCell;
257  energy37Lay2PosPhi += energyCell;
258  }
259  else {
260  energyNegPhi += double(energyCell) * phiCell;
261  energyNegPhiConv += double(energyCell) * (phiCell + 2.0 * M_PI);
262  energy37Lay2NegPhi += energyCell;
263  }
264  // 3. do the 3*5 stuff
265  nCellsEta = 3;
266  nCellsPhi = 5;
267  if (deta <= 0.5 * double(nCellsEta - 1) * cellSizeEta + 0.01 &&
268  dphi <= 0.5 * double(nCellsPhi - 1) * cellSizePhi + 0.01) {
269  weightEta += energyCell * etaCell;
270  weightEta2 += energyCell * etaCell * etaCell;
271  energy35Lay2 += energyCell;
272  // 3a. do the 3*3 stuff
273  // nCellsEta = 3;
274  nCellsPhi = 3;
275  if (deta <= 0.5 * double(nCellsEta - 1) * cellSizeEta + 0.01 &&
276  dphi <= 0.5 * double(nCellsPhi - 1) * cellSizePhi + 0.01) {
277  energy33Lay2 += energyCell;
278  } // End of do the 3*3 stuff
279  } // End of do the 3*5 stuff
280 
281  } // End of do the 3x7 stuff
282  // 4. do the 5*5 stuff
283  nCellsEta = 5;
284  nCellsPhi = 5;
285  if ((!cluster_in_barrel) && deta <= 0.5 * double(nCellsEta - 1) * cellSizeEta + 0.005 &&
286  dphi <= 0.5 * double(nCellsPhi - 1) * cellSizePhi + 0.005) {
287  samp = larcell->caloDDE()->getSampling();
288  } // End of do the 5*5 stuff
289  } // End of do the 7*7 stuff
290 
291  } // end of loop over sampling 2
292 
293  // Normalise energy weighted angles and calculate values
294 
295  if ((energy37Lay2PosPhi + energy37Lay2NegPhi) > 0.) { // dont divide by zero
296  // SRA phi wrap-around
297  double AvgNegPhi = 0.;
298  double AvgPosPhi = 0.;
299 
300  energyEta /= (energy37Lay2PosPhi + energy37Lay2NegPhi);
301 
302  if (energy37Lay2NegPhi > 0.) {
303  AvgNegPhi = energyNegPhi / energy37Lay2NegPhi;
304  }
305  else {
306  AvgNegPhi = -999.0;
307  }
308 
309  if (energy37Lay2PosPhi > 0.) {
310  AvgPosPhi = energyPosPhi / energy37Lay2PosPhi;
311  }
312  else {
313  AvgPosPhi = -999.0;
314  }
315 
316  if (AvgPosPhi == -999.0) {
317  if (AvgNegPhi != -999.0) {
318  energyPhi = AvgNegPhi;
319  }
320  }
321 
322  if (AvgNegPhi == -999.0) {
323  if (AvgPosPhi != -999.0) {
324  energyPhi = AvgPosPhi;
325  }
326  }
327 
328  if (AvgNegPhi != -999.0 && AvgPosPhi != -999.0) {
329  if ((AvgNegPhi > (-M_PI / 2.0)) && (AvgPosPhi < (M_PI / 2.0))) {
330  energyPhi = (energyNegPhi + energyPosPhi) / (energy37Lay2NegPhi + energy37Lay2PosPhi);
331  }
332  else {
333  if ((AvgNegPhi < (-M_PI / 2.0)) && (AvgPosPhi > (M_PI / 2.0))) {
334  energyPhi = (energyNegPhiConv + energyPosPhi) / (energy37Lay2NegPhi + energy37Lay2PosPhi);
335  if (energyPhi > M_PI) {
336  energyPhi = energyPhi - 2 * M_PI;
337  }
338  }
339  }
340  }
341  }
342  else {
343  energyEta = 99.;
344  energyPhi = 0.;
345  }
346 
347  for (const LArCell* larcell : sel) {
348  double etaCell = larcell->eta();
349  double phiCell = larcell->phi();
350  double energyCell = larcell->energy();
351 
352  // Find position of current cell w.r.t. seed
353  deta = std::abs(etaCell - energyEta);
354  dphi = std::abs(phiCell - energyPhi);
355  if (dphi > M_PI) dphi = 2. * M_PI - dphi; // wrap (pi - 2pi)->(-pi - 0)
356 
357  double cellSizeEta;
358  double cellSizePhi;
359  if (emID->is_em_barrel(larcell->ID())) {
360  cellSizeEta = etaSizeLArEMSamp2(etaCell, Calorimeter::EMBAR);
361  cellSizePhi = phiSizeLArEMSamp2(etaCell, Calorimeter::EMBAR);
362  }
363  else {
364  cellSizeEta = etaSizeLArEMSamp2(etaCell, Calorimeter::EMEND);
365  cellSizePhi = phiSizeLArEMSamp2(etaCell, Calorimeter::EMEND);
366  }
367 
368  nCellsEta = 3;
369  nCellsPhi = 7;
370  if ((deta <= 0.5 * double(nCellsEta - 1) * cellSizeEta + 0.01) &&
371  (dphi <= 0.5 * double(nCellsPhi - 1) * cellSizePhi + 0.01)) {
372 
373  if (cluster_in_barrel) {
374  totalEnergy += energyCell;
375  // samp = CaloSampling::getSampling(*larcell);
376  samp = larcell->caloDDE()->getSampling();
377  rtrigEmCluster.setEnergy(samp, rtrigEmCluster.energy(samp) + energyCell);
378  rtrigEmCluster.setRawEnergy(samp, rtrigEmCluster.rawEnergy(samp) + energyCell);
379  }
380  } // End of do the 3x7 stuff
381 
382  nCellsEta = 5;
383  nCellsPhi = 5;
384  if ((!cluster_in_barrel) && (deta <= 0.5 * double(nCellsEta - 1) * cellSizeEta + 0.01) &&
385  (dphi <= 0.5 * double(nCellsPhi - 1) * cellSizePhi + 0.01)) {
386  totalEnergy += energyCell;
387  // samp = CaloSampling::getSampling(*larcell);
388  samp = larcell->caloDDE()->getSampling();
389  rtrigEmCluster.setEnergy(samp, rtrigEmCluster.energy(samp) + energyCell);
390  rtrigEmCluster.setRawEnergy(samp, rtrigEmCluster.rawEnergy(samp) + energyCell);
391  } // End of do the 5*5 stuff
392 
393  } // end of loop over sampling 2
394 
395  // calculate cluster width
396 
397  if (energy35Lay2 > 0.) {
398  const double inv_energy35Lay2 = 1. / energy35Lay2;
399  clusterWidth35 = (weightEta2 * inv_energy35Lay2) -
400  (weightEta * inv_energy35Lay2) * (weightEta * inv_energy35Lay2);
401  clusterWidth35 > 0. ? clusterWidth35 = sqrt(clusterWidth35) : clusterWidth35 = 99.;
402  }
403  else {
404  clusterWidth35 = 99.;
405  }
406 
407  // Update cluster Variables
408 
409  // update stored variables
410  rtrigEmCluster.setE233(energy33Lay2);
411  rtrigEmCluster.setE237(energy37Lay2);
412  rtrigEmCluster.setE277(energy77Lay2);
413  rtrigEmCluster.setWeta2(clusterWidth35);
414  rtrigEmCluster.setRawEnergy(rtrigEmCluster.rawEnergy() + totalEnergy);
415  rtrigEmCluster.setEta(energyEta);
416  rtrigEmCluster.setPhi(energyPhi);
417  rtrigEmCluster.setRawEta(energyEta);
418  rtrigEmCluster.setRawPhi(energyPhi);
419  rtrigEmCluster.setNCells(ncells);
420 
421  return StatusCode::SUCCESS;
422 }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ initialize()

StatusCode IReAlgToolCalo::initialize ( )
overridevirtualinherited

Reimplemented in RingerReFex.

Definition at line 25 of file IReAlgToolCalo.cxx.

26 {
28  if (!m_dataSvc.empty()) ATH_CHECK(m_dataSvc.retrieve());
29  ATH_CHECK(m_geometryTool.retrieve());
30 
31  return StatusCode::SUCCESS;
32 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg() [1/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ phiSizeLArEMSamp2()

double EgammaReSamp2Fex::phiSizeLArEMSamp2 ( const double  eta,
const int  calo 
) const
inlineprivate

Definition at line 69 of file EgammaReSamp2Fex.h.

69  {
70  double sizePhi;
71  if( calo == Calorimeter::EMBAR ){
72  sizePhi = 0.025;
73  } else {
74  if ( std::abs(cellEta) < 2.5 ){
75  sizePhi = 0.025;
76  } else {
77  sizePhi = 0.1;
78  }
79  }
80  return sizePhi;
81 }

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_cellkeepthr

Gaudi::Property<float> IReAlgToolCalo::m_cellkeepthr
protectedinherited
Initial value:
{this, "ThresholdKeepCells", 1e5,
"Threshold to keep cells incontainer"}

Definition at line 77 of file IReAlgToolCalo.h.

◆ m_dataSvc

ServiceHandle<ITrigCaloDataAccessSvc> IReAlgToolCalo::m_dataSvc
protectedinherited
Initial value:
{this, "trigDataAccessMT",
"TrigCaloDataAccessSvc/TrigCaloDataAccessSvc",
"Data Access for LVL2 Calo Algorithms in MT"}

Definition at line 84 of file IReAlgToolCalo.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_geometryTool

ToolHandle<IT2GeometryTool> IReAlgToolCalo::m_geometryTool
protectedinherited
Initial value:
{
this, "T2GeometryTool", "T2GeometryTool/T2GeometryTool",
"Tool to check that a cells are contained in a given cluster"}

Definition at line 80 of file IReAlgToolCalo.h.

◆ m_larMgr

const CaloIdManager* IReAlgToolCalo::m_larMgr = nullptr
protectedinherited

Calorimeter Id Manager for calorimeter part determination (Barrel versus EndCap)

Definition at line 71 of file IReAlgToolCalo.h.

◆ m_maxHotCellDeta

Gaudi::Property<float> EgammaReSamp2Fex::m_maxHotCellDeta {this, "MaxDetaHotCell", 1.0}
private

Definition at line 47 of file EgammaReSamp2Fex.h.

◆ m_maxHotCellDphi

Gaudi::Property<float> EgammaReSamp2Fex::m_maxHotCellDphi {this, "MaxDphiHotCell", 1.0}
private

Definition at line 48 of file EgammaReSamp2Fex.h.

◆ m_saveCells

Gaudi::Property<bool> IReAlgToolCalo::m_saveCells
protectedinherited
Initial value:
{this, "SaveCellsInContainer", false,
"Enables saving of the RoI Calorimeter Cells in StoreGate"}

Definition at line 74 of file IReAlgToolCalo.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
xAOD::TrigCaloCluster_v1::setRawPhi
void setRawPhi(float)
set Raw Phi (no calibration)
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::TrigEMCluster_v1::setEta
void setEta(float)
set Eta (calibrated)
CaloCell::phi
virtual double phi() const override final
get phi (through CaloDetDescrElement)
Definition: CaloCell.h:359
xAOD::TrigEMCluster_v1::eta
float eta() const
get Eta (calibrated)
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
IReAlgToolCalo::m_larMgr
const CaloIdManager * m_larMgr
Calorimeter Id Manager for calorimeter part determination (Barrel versus EndCap)
Definition: IReAlgToolCalo.h:71
xAOD::TrigEMCluster_v1::setE237
void setE237(float)
set Energy in a 3x7 cluster (no calibration) around hottest cell
EgammaReSamp2Fex::phiSizeLArEMSamp2
double phiSizeLArEMSamp2(const double eta, const int calo) const
Definition: EgammaReSamp2Fex.h:69
xAOD::TrigEMCluster_v1::setEnergy
void setEnergy(float energy)
set Energy (calibrated)
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
CaloIdManager::getEM_ID
const LArEM_ID * getEM_ID(void) const
Definition: CaloIdManager.cxx:80
xAOD::TrigEMCluster_v1::setE233
void setE233(float)
set Energy in a 3x3 cluster (no calibration) around hottest cell
M_PI
#define M_PI
Definition: ActiveFraction.h:11
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
xAOD::TrigCaloCluster_v1::setRawEta
void setRawEta(float)
set Raw Eta (no calibration)
EgammaReSamp2Fex::etaSizeLArEMSamp2
double etaSizeLArEMSamp2(const double eta, const int calo) const
Definition: EgammaReSamp2Fex.h:51
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
xAOD::TrigEMCluster_v1::setE277
void setE277(float)
set Energy in a 7x7 cluster (no calibration) around hottest cell
xAOD::TrigCaloCluster_v1::rawEnergy
float rawEnergy() const
get Raw Energy (no calibration)
Calorimeter::EMBAR
@ EMBAR
Definition: Calo_Def.h:21
xAOD::TrigEMCluster_v1::setPhi
void setPhi(float)
set Phi (calibrated)
IReAlgToolCalo::m_dataSvc
ServiceHandle< ITrigCaloDataAccessSvc > m_dataSvc
Definition: IReAlgToolCalo.h:84
IReAlgToolCalo::m_geometryTool
ToolHandle< IT2GeometryTool > m_geometryTool
Definition: IReAlgToolCalo.h:80
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
IReAlgToolCalo::IReAlgToolCalo
IReAlgToolCalo(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
Definition: IReAlgToolCalo.cxx:20
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
xAOD::TrigEMCluster_v1::phi
float phi() const
get Phi (calibrated)
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
TTEM
@ TTEM
Definition: RegSelEnums.h:28
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CaloCell::caloDDE
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
Definition: CaloCell.h:305
sel
sel
Definition: SUSYToolsTester.cxx:97
EgammaReSamp2Fex::m_maxHotCellDphi
Gaudi::Property< float > m_maxHotCellDphi
Definition: EgammaReSamp2Fex.h:48
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
xAOD::TrigEMCluster_v1::setWeta2
void setWeta2(float)
set cluster width (based on a 3x5 cluster - 2nd layer)
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
EgammaReSamp2Fex::m_maxHotCellDeta
Gaudi::Property< float > m_maxHotCellDeta
Definition: EgammaReSamp2Fex.h:47
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
LArCell
Data object for LAr calorimeter readout cell.
Definition: LArCell.h:53
LArTT_Selector< LArCellCont >
xAOD::TrigCaloCluster_v1::setNCells
void setNCells(int)
set number of cells used from RoI
CaloDetDescrElement::is_lar_em_barrel
bool is_lar_em_barrel() const
cell belongs to EM barrel
Definition: CaloDetDescrElement.cxx:98
a
TList * a
Definition: liststreamerinfos.cxx:10
h
LArEM_Base_ID::is_em_barrel
bool is_em_barrel(const Identifier id) const
test if the id belongs to the EM barrel
Calorimeter::EMEND
@ EMEND
Definition: Calo_Def.h:22
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
xAOD::TrigCaloCluster_v1::setRawEnergy
void setRawEnergy(float)
set Raw Energy (no calibration)
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
LArEM_ID
Helper class for LArEM offline identifiers.
Definition: LArEM_ID.h:118
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
xAOD::TrigEMCluster_v1::energy
float energy() const
get Energy (calibrated)
CaloCell::eta
virtual double eta() const override final
get eta (through CaloDetDescrElement)
Definition: CaloCell.h:366
fitman.k
k
Definition: fitman.py:528
windows
int windows(float distance, float eta_pivot, int thr, int sector)
Definition: windows.cxx:14