ATLAS Offline Software
Loading...
Searching...
No Matches
CaloLayerCalculator.h
Go to the documentation of this file.
1// This file's extension implies that it's C, but it's really -*- C++ -*-.
2
3/*
4 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
5*/
6
7// $Id: CaloLayerCalculator.h,v 1.1 2006-03-20 17:42:26 ssnyder Exp $
62
63#ifndef CALOUTILS_CALOLAYERCALCULATOR_H
64#define CALOUTILS_CALOLAYERCALCULATOR_H
65
67#include "CaloGeoHelpers/CaloSampling.h"
71
72#include "GaudiKernel/StatusCode.h"
73#include <string>
74
77
79class CaloCell;
80
82{
83public:
86
93
94
115 template <typename Iterator>
116 void fill (Iterator beg,
117 Iterator end,
118 double eta,
119 double phi,
120 double deta,
121 double dphi,
123 xAOD::CaloCluster* tofill = 0);
124
125
144 StatusCode fill (const CaloDetDescrManager& mgr,
145 const CaloCellContainer* cell_container,
146 double eta,
147 double phi,
148 double deta,
149 double dphi,
151 xAOD::CaloCluster* tofill = 0);
152
153
155
157
162 double etam() const;
163
164
169 double phim() const;
170
171
176 double etas() const;
177
178
183 double phis() const;
184
185
190 double em() const;
191
192
198 double etamax() const;
199
200
206 double phimax() const;
207
208
213 double emax() const;
214
218 double phimr() const { return m_phimr; }
219 double etamr() const { return m_etamr; }
220 double phirmax() const { return m_phirmax; }
221 double etarmax() const { return m_etarmax; }
222
224private:
227
229 void reset();
230
233
235 void resetOnNegativeEnergy(double eta, double phi);
236
237
240 template <typename Iterator>
241 static double get_weight (Iterator it);
242
246
250
253 template <typename CONT, typename RPAR, typename COLL>
255
256
258 double m_etam = 0.0; // Mean @f$\eta@f$.
259 double m_phim = 0.0; // Mean @f$\phi@f$.
260 double m_etas = 0.0; // RMS @f$\eta@f$.
261 double m_phis = 0.0; // RMS @f$\phi@f$.
262 double m_em = 0.0; // Total energy.
263 double m_etamax = 0.0; // @f$\eta@f$ center of maximum-energy cell.
264 double m_phimax = 0.0; // @f$\phi@f$ center of maximum-energy cell.
265 double m_emax = 0.0; // Energy of maximum-energy cell.
266
267 // Added to cluster in the calorimeter frame
268 double m_etamr = 0.0; // Mean @f$\eta@f$ with raw quantity
269 double m_phimr = 0.0; // Mean @f$\phi@f$ with raw quantity
270 double m_etarmax = 0.0; // @f$\eta_raw@f$ center of maximum-energy cell.
271 double m_phirmax = 0.0; // @f$\phi_raw@f$ center of maximum-energy cell.
272
273
285 struct Helper
286 {
301 double eta,
302 double phi,
303 double deta,
304 double dphi,
306 xAOD::CaloCluster* tofill,
307 const CaloCellContainer* cell_container);
308
309
315 void cell (const CaloCell* cell, double weight);
316
317
323 ~Helper();
324
325
328 double m_eta;
329 double m_phi;
330 double m_deta;
331 double m_dphi;
335
337 double m_s00; // energy sum.
338 double m_s10; // eta-weighted energy sum.
339 double m_s20; // eta^2-weighted energy sum.
340 double m_s01; // phi-weighted energy sum.
341 double m_s02; // phi^2-weighted energy sum.
342
343 // Added to cluster in the calorimeter frame
344 double m_s10r; // eta_raw-weighted energy sum.
345 double m_s01r; // phi_raw-weighted energy sum.
346 };
347 friend struct Helper;
349};
350
351
375template <typename Iterator>
377 Iterator end,
378 double eta,
379 double phi,
380 double deta,
381 double dphi,
383 xAOD::CaloCluster* tofill /*= 0*/)
384{
385 reset();
386 const CaloCellContainer* cell_container=0;
387 if (tofill) cell_container=tofill->getCellLinks()->getCellContainer();
388 if (beg != end) {
389 Helper h (*this, eta, phi, deta, dphi, sampling, tofill, cell_container);
390 for (; beg != end; ++beg)
391 h.cell (*beg, get_weight (beg));
392 }
393}
394
395
400inline
402{
403 return m_etam;
404}
405
406
411inline
413{
414 return m_phim;
415}
416
417
422inline
424{
425 return m_etas;
426}
427
428
433inline
435{
436 return m_phis;
437}
438
439
444inline
446{
447 return m_em;
448}
449
450
456inline
458{
459 return m_etamax;
460}
461
462
468inline
470{
471 return m_phimax;
472}
473
474
479inline
481{
482 return m_emax;
483}
484
485
488template <typename Iterator>
489inline
491{
492 return 1;
493}
494
495
498template <typename CONT, typename RPAR, typename COLL>
499inline
501{
502 return it.getParameter();
503}
504
505inline
507{
508 return it.weight();
509}
510
511
512inline
514{
515 return it.weight();
516}
517
518
519#endif // not CALOUTILS_CALOLAYERCALCULATOR_H
520
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
Definition of CaloDetDescrManager.
CaloPhiRange class declaration.
Header file for AthHistogramAlgorithm.
Container class for CaloCell.
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
This class provides the client interface for accessing the detector description information common to...
double etam() const
Data access.
double etamax() const
Get maximum value.
static double get_weight(Iterator it)
Get the weight from a cell iterator.
void fill(Iterator beg, Iterator end, double eta, double phi, double deta, double dphi, CaloSampling::CaloSample sampling, xAOD::CaloCluster *tofill=0)
Calculate layer variables from cells in a list.
double phis() const
Get the RMS size.
double etas() const
Get the RMS size.
CaloLayerCalculator()
Initialization.
double phimax() const
Get maximum value.
double m_etam
Layer variables.
double emax() const
Get the maximum energy.
void resetOnNegativeEnergy()
Reset output variables, but not m_em, allowing samplings to be negative.
double em() const
Get the total energy.
double phimr() const
Similar as phim, etam, phimax, etamax, but with raw quantities.
double phim() const
Get the mean layer value.
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version)
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Helper class for layer variable calculation.
const CaloCellContainer * m_cell_container
CaloSampling::CaloSample m_sampling
void cell(const CaloCell *cell, double weight)
Accumulate results for another cell.
Helper(CaloLayerCalculator &calc, double eta, double phi, double deta, double dphi, CaloSampling::CaloSample sampling, xAOD::CaloCluster *tofill, const CaloCellContainer *cell_container)
Initialize for doing layer variable calculation.
double m_s00
Temporary variables used to accumulate the results.
~Helper()
Calculate the layer variables from the accumulated cells The variables in the parent CaloLayerCalcula...
CaloLayerCalculator & m_calc
These members hold the values passed to the constructor.