ATLAS Offline Software
PufitUtils.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3  */
4 
5 /******************************************************************************
6  * @package Trigger/TrigAlgorithms/TrigEFMissingET
7  *
8  * @brief Helper functions for pufit calculations
9  * @author Bob Kowalewski, Jon Burr
10  *****************************************************************************/
11 
12 #ifndef TRIGEFMISSINGET_PUFITUTILS_H
13 #define TRIGEFMISSINGET_PUFITUTILS_H
14 
15 #include <Eigen/Dense>
19 #include <vector>
20 
21 namespace HLT
22 {
23  namespace MET
24  {
25  namespace PufitUtils
26  {
28  struct CovarianceSum
29  {
31  CovarianceSum();
33  CovarianceSum(const Eigen::Vector2d &sum, const Eigen::Matrix2d &covariance);
39  CovarianceSum &add(const SignedKinematics &kin, double sigma);
41  Eigen::Vector2d sum;
43  Eigen::Matrix2d covariance;
44  };
45 
54  const std::vector<double> &sorted,
55  double trimFraction,
56  double &mean,
57  double &variance);
58 
67  const PufitGrid &grid,
68  double trimFraction,
69  double &mean,
70  double &variance);
71 
80  template <std::size_t N>
82  const PufitMultiGrid<N> &grid,
83  std::size_t type,
84  double trimFraction,
85  double &mean,
86  double &variance);
87 
95  const PufitGrid &grid, double &mean, double &variance);
96 
104  template <std::size_t N>
106  const PufitMultiGrid<N> &grid, int type, double &mean, double &variance);
107 
110 
112  template <typename Grid>
114  const PufitMultiGridSet<Grid> &grids,
115  std::size_t type);
116 
133  Eigen::VectorXd pufit(
134  const Eigen::Vector2d &pileupSum,
135  const Eigen::Matrix2d &pileupCovariance,
136  const Eigen::VectorXd &towerExpectations,
137  const Eigen::VectorXd &towerVariances,
138  const Eigen::VectorXd &correctionDirections,
139  double constraintImportance = 1);
140 
159  Eigen::VectorXd pufit(
160  const Eigen::Vector2d &pileupSum,
161  const Eigen::Matrix2d &pileupCovariance,
162  const Eigen::VectorXd &towerExpectations,
163  const Eigen::VectorXd &towerVariances,
164  const Eigen::Matrix<double, 2, Eigen::Dynamic> &cosSin,
165  double constraintImportance = 1);
166 
189  std::vector<SignedKinematics> pufit(
190  const Eigen::Vector2d &pileupSum,
191  const Eigen::Matrix2d &pileupCovariance,
192  const std::vector<double> &towerExpectations,
193  const std::vector<double> &towerVariances,
194  const std::vector<SignedKinematics> &toCorrect,
195  double constraintImportance = 1);
196 
208  Eigen::VectorXd pufit(
209  const Eigen::Vector2d &pileupSum,
210  const Eigen::Matrix2d &pileupCovariance,
211  double towerMean,
212  double towerVariance,
213  const Eigen::VectorXd &correctionDirections,
214  double constraintImportance = 1);
215 
230  Eigen::VectorXd pufit(
231  const Eigen::Vector2d &pileupSum,
232  const Eigen::Matrix2d &pileupCovariance,
233  double towerMean,
234  double towerVariance,
235  const Eigen::Matrix<double, 2, Eigen::Dynamic> &cosSin,
236  double constraintImportance = 1);
237 
256  std::vector<SignedKinematics> pufit(
257  const Eigen::Vector2d &pileupSum,
258  const Eigen::Matrix2d &pileupCovariance,
259  double towerMean,
260  double towerVariance,
261  const std::vector<SignedKinematics> &toCorrect,
262  double constraintImportance = 1);
263  } // namespace PufitUtils
264  } // namespace MET
265 } // namespace HLT
266 
268 
269 #endif //> !TRIGEFMISSINGET_PUFITUTILS_H
HLT::MET::PufitGrid
Bins energy deposits into a grid.
Definition: PufitGrid.h:50
HLT::MET::PufitUtils::pufit
Eigen::VectorXd pufit(const Eigen::Vector2d &pileupSum, const Eigen::Matrix2d &pileupCovariance, const Eigen::VectorXd &towerExpectations, const Eigen::VectorXd &towerVariances, const Eigen::VectorXd &correctionDirections, double constraintImportance)
Perform the pile-up fit.
Definition: PufitUtils.cxx:114
HLT::MET::PufitUtils::CovarianceSum::sum
Eigen::Vector2d sum
The sum.
Definition: PufitUtils.h:61
pdg_comparison.sigma
sigma
Definition: pdg_comparison.py:324
mean
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
Definition: dependence.cxx:254
PufitGrid.h
HLT::MET::PufitGridSet
Helper struct to contain a full set of grids.
Definition: PufitGrid.h:252
HLT::MET::PufitUtils::CovarianceSum::covariance
Eigen::Matrix2d covariance
The covariance matrix.
Definition: PufitUtils.h:63
HLT::MET::GridDisplacement
GridDisplacement
Enum to describe the positioning of the grid.
Definition: PeriodicGridBase.h:23
SignedKinematics.h
HLT
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition: HLTResultReader.h:26
HLT::MET::PufitUtils::selectGrid
GridDisplacement selectGrid(const PufitGridSet &grids)
Select the grid with the highest masked sumEt.
Definition: PufitUtils.cxx:95
DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename T::value_type > sorted(T begin, T end)
Helper function to create a sorted vector from an unsorted one.
PufitMultiGrid.h
HLT::MET::PufitUtils::trimmedMeanAndVariance
void trimmedMeanAndVariance(const std::vector< double > &sorted, double trimFraction, double &mean, double &variance)
Calculate the trimmed mean and variance for a vector of tower sumEts.
Definition: PufitUtils.cxx:35
MET
Definition: MET.py:1
HLT::MET::PufitUtils::unmaskedMeanAndVariance
void unmaskedMeanAndVariance(const PufitGrid &grid, double &mean, double &variance)
Calculate the mean and variance of unmasked towers.
Definition: PufitUtils.cxx:72
HLT::MET::PufitUtils::CovarianceSum::add
CovarianceSum & add(const SignedKinematics &kin, double sigma)
Add a new contribution to the sum.
Definition: PufitUtils.cxx:25
HLT::MET::PufitMultiGrid
Multiple grids combined into one.
Definition: PufitMultiGrid.h:63
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
HLT::MET::PufitUtils::CovarianceSum::CovarianceSum
CovarianceSum()
Default constructor - zero initialize everything.
Definition: PufitUtils.cxx:16
PufitUtils.icc
HLT::MET::PufitMultiGridSet
Helper struct to forward the SignedKinematics operators nicely.
Definition: PufitMultiGrid.h:316