#include <HouseholderDecomposition.h>
Public Member Functions | |
HouseholderDecomposition (int squareMode_=5, int mineta_=1, int maxeta_=85, int minphi_=1, int maxphi_=20) | |
Default constructor. More... | |
int | indexSqr2Reg (const int &sqrIndex, const int &maxCeta, const int &maxCphi) |
Method to translate from square indices to region indices. More... | |
std::vector< float > | iterate (const std::vector< std::vector< float > > &eventMatrix, const std::vector< int > &VmaxCeta, const std::vector< int > &VmaxCphi, const std::vector< float > &energyVector, const int &nIter, const bool &normalizeFlag=false) |
std::vector< float > | iterate (const std::vector< std::vector< float > > &eventMatrix, const std::vector< int > &VmaxCeta, const std::vector< int > &VmaxCphi, const std::vector< float > &energyVectorOrig) |
Run the Householder Algorithm. Returns the vector of calibration coefficients. More... | |
std::vector< float > | recalibrateEvent (const std::vector< float > &eventSquare, const int &maxCeta, const int &maxCphi, const std::vector< float > &recalibrateVector) |
Recalibrate before next iteration: give previous solution vector as argument. More... | |
std::vector< float > | runRegional (const std::vector< std::vector< float > > &eventMatrix, const std::vector< int > &VmaxCeta, const std::vector< int > &VmaxCphi, const std::vector< float > &energyVector, const int &nIter, const int ®Length=5) |
~HouseholderDecomposition () | |
Destructor. More... | |
Private Member Functions | |
bool | decompose () |
void | makeRegions (const int ®Length) |
void | solve (std::vector< float > &y) |
std::vector< std::vector< float > > | unzipMatrix (const std::vector< std::vector< float > > &eventMatrix, const std::vector< int > &VmaxCeta, const std::vector< int > &VmaxCphi) |
Unzips the skimmed matrix into a full matrix. More... | |
Private Attributes | |
std::vector< float > | alpha |
int | countEvents |
std::vector< float > | energyVectorProc |
std::vector< std::vector< float > > | eventMatrixOrig |
std::vector< std::vector< float > > | eventMatrixProc |
int | maxeta |
int | maxphi |
int | mineta |
int | minphi |
int | Nchannels |
int | Neta |
int | Nevents |
int | Nphi |
int | Nxtals |
std::vector< int > | pivot |
std::vector< int > | regMaxEta |
std::vector< int > | regMaxPhi |
std::vector< int > | regMinEta |
std::vector< int > | regMinPhi |
float | sigmaReplacement |
int | squareMode |
Implementation of the QR decomposition of a matrix using Householder transformation
13.03.2007: R.Ofierzynski
Definition at line 17 of file HouseholderDecomposition.h.
HouseholderDecomposition::HouseholderDecomposition | ( | int | squareMode_ = 5 , |
int | mineta_ = 1 , |
||
int | maxeta_ = 85 , |
||
int | minphi_ = 1 , |
||
int | maxphi_ = 20 |
||
) |
Default constructor.
Definition at line 12 of file HouseholderDecomposition.cc.
References maxeta, maxphi, mineta, minphi, Nchannels, Neta, Nphi, Nxtals, sigmaReplacement, and squareMode.
HouseholderDecomposition::~HouseholderDecomposition | ( | ) |
|
private |
Make decomposition input: m=number of events, n=number of channels, qr=event matrix output: qr = transformed event matrix, alpha, pivot returns a boolean value, true if decomposition worked, false if it didn't
Definition at line 315 of file HouseholderDecomposition.cc.
References alpha, HLT_2022v14_cff::beta, eventMatrixProc, mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, Nchannels, Nevents, pivot, sigmaReplacement, mathSSE::sqrt(), and y.
Referenced by iterate().
int HouseholderDecomposition::indexSqr2Reg | ( | const int & | sqrIndex, |
const int & | maxCeta, | ||
const int & | maxCphi | ||
) |
Method to translate from square indices to region indices.
Definition at line 473 of file HouseholderDecomposition.cc.
References maxeta, maxphi, mineta, minphi, and squareMode.
Referenced by recalibrateEvent(), runRegional(), and unzipMatrix().
std::vector< float > HouseholderDecomposition::iterate | ( | const std::vector< std::vector< float > > & | eventMatrix, |
const std::vector< int > & | VmaxCeta, | ||
const std::vector< int > & | VmaxCphi, | ||
const std::vector< float > & | energyVector, | ||
const int & | nIter, | ||
const bool & | normalizeFlag = false |
||
) |
Run the Householder Algorithm several times (nIter). Returns the final vector of calibration coefficients. Comment from author: unless you do a new selection in between the iterations you don't need to run more than once; a second iteration on the same events does not improve the result in this case
Definition at line 123 of file HouseholderDecomposition.cc.
References mps_fire::i, dqmiolumiharvest::j, Nchannels, Nevents, Nxtals, recalibrateEvent(), and L1EGammaClusterEmuProducer_cfi::scale.
Referenced by ElectronCalibration::endJob(), ElectronCalibrationUniv::endJob(), and runRegional().
std::vector< float > HouseholderDecomposition::iterate | ( | const std::vector< std::vector< float > > & | eventMatrix, |
const std::vector< int > & | VmaxCeta, | ||
const std::vector< int > & | VmaxCphi, | ||
const std::vector< float > & | energyVectorOrig | ||
) |
Run the Householder Algorithm. Returns the vector of calibration coefficients.
Definition at line 181 of file HouseholderDecomposition.cc.
References alpha, gather_cfg::cout, decompose(), MillePedeFileConverter_cfg::e, energyVectorProc, eventMatrixOrig, eventMatrixProc, mps_fire::i, dqmiolumiharvest::j, Nchannels, Nevents, pivot, solve(), and unzipMatrix().
|
private |
Determines the regions used for splitting of the full matrix and calibrating separately used by the public runRegional method
Definition at line 529 of file HouseholderDecomposition.cc.
References funct::abs(), mps_fire::i, dqmiolumiharvest::j, mineta, minphi, Neta, Nphi, regMaxEta, regMaxPhi, regMinEta, regMinPhi, and squareMode.
Referenced by runRegional().
std::vector< float > HouseholderDecomposition::recalibrateEvent | ( | const std::vector< float > & | eventSquare, |
const int & | maxCeta, | ||
const int & | maxCphi, | ||
const std::vector< float > & | recalibrateVector | ||
) |
Recalibrate before next iteration: give previous solution vector as argument.
Definition at line 458 of file HouseholderDecomposition.cc.
References mps_fire::i, indexSqr2Reg(), and Nxtals.
Referenced by iterate(), and runRegional().
std::vector< float > HouseholderDecomposition::runRegional | ( | const std::vector< std::vector< float > > & | eventMatrix, |
const std::vector< int > & | VmaxCeta, | ||
const std::vector< int > & | VmaxCphi, | ||
const std::vector< float > & | energyVector, | ||
const int & | nIter, | ||
const int & | regLength = 5 |
||
) |
Run Regional HouseholderAlgorithm (fast version), that splits matrix into regional matrices and inverts them separately. Returns the final vector of calibration coefficients. input: eventMatrix - the skimmed event matrix, VmaxCeta, VmaxCphi - vectors containing eta and phi indices of the maximum containment crystal for each event, energyVector - the energy vector, nIter - number of iterations to be performed, regLength - default length of the region (in eta- and phi-indices), regLength=5 recommended Comment from author: if you use the same events, 2 iterations are recommended; the second iteration gives corrections of the order of 0.0001
Definition at line 30 of file HouseholderDecomposition.cc.
References mps_fire::i, testProducerWithPsetDescEmpty_cfi::i1, testProducerWithPsetDescEmpty_cfi::i2, indexSqr2Reg(), iterate(), makeRegions(), maxeta, maxphi, mineta, minphi, Nchannels, Nevents, Nphi, Nxtals, recalibrateEvent(), regMaxEta, regMaxPhi, regMinEta, regMinPhi, and squareMode.
Referenced by ElectronCalibration::endJob(), and ElectronCalibrationUniv::endJob().
|
private |
Apply transformations to rhs output: r = residual vector (energy vector), y = solution
Definition at line 420 of file HouseholderDecomposition.cc.
References alpha, energyVectorProc, eventMatrixProc, CustomPhysics_cfi::gamma, mps_fire::i, dqmiolumiharvest::j, Nchannels, Nevents, pivot, y, and z.
Referenced by iterate().
|
private |
Unzips the skimmed matrix into a full matrix.
Definition at line 508 of file HouseholderDecomposition.cc.
References mps_fire::i, indexSqr2Reg(), dqmdumpme::k, Nchannels, Nevents, and Nxtals.
Referenced by iterate().
|
private |
Definition at line 91 of file HouseholderDecomposition.h.
Referenced by decompose(), iterate(), and solve().
|
private |
Definition at line 85 of file HouseholderDecomposition.h.
|
private |
Definition at line 90 of file HouseholderDecomposition.h.
|
private |
Definition at line 88 of file HouseholderDecomposition.h.
Referenced by iterate().
|
private |
Definition at line 89 of file HouseholderDecomposition.h.
Referenced by decompose(), iterate(), and solve().
|
private |
Definition at line 86 of file HouseholderDecomposition.h.
Referenced by HouseholderDecomposition(), indexSqr2Reg(), and runRegional().
|
private |
Definition at line 86 of file HouseholderDecomposition.h.
Referenced by HouseholderDecomposition(), indexSqr2Reg(), and runRegional().
|
private |
Definition at line 86 of file HouseholderDecomposition.h.
Referenced by HouseholderDecomposition(), indexSqr2Reg(), makeRegions(), and runRegional().
|
private |
Definition at line 86 of file HouseholderDecomposition.h.
Referenced by HouseholderDecomposition(), indexSqr2Reg(), makeRegions(), and runRegional().
|
private |
Definition at line 87 of file HouseholderDecomposition.h.
Referenced by decompose(), HouseholderDecomposition(), iterate(), runRegional(), solve(), and unzipMatrix().
|
private |
Definition at line 86 of file HouseholderDecomposition.h.
Referenced by HouseholderDecomposition(), and makeRegions().
|
private |
Definition at line 87 of file HouseholderDecomposition.h.
Referenced by decompose(), iterate(), runRegional(), solve(), and unzipMatrix().
|
private |
Definition at line 86 of file HouseholderDecomposition.h.
Referenced by HouseholderDecomposition(), makeRegions(), and runRegional().
|
private |
Definition at line 87 of file HouseholderDecomposition.h.
Referenced by HouseholderDecomposition(), iterate(), recalibrateEvent(), runRegional(), and unzipMatrix().
|
private |
Definition at line 92 of file HouseholderDecomposition.h.
Referenced by decompose(), iterate(), and solve().
|
private |
Definition at line 94 of file HouseholderDecomposition.h.
Referenced by makeRegions(), and runRegional().
|
private |
Definition at line 94 of file HouseholderDecomposition.h.
Referenced by makeRegions(), and runRegional().
|
private |
Definition at line 94 of file HouseholderDecomposition.h.
Referenced by makeRegions(), and runRegional().
|
private |
Definition at line 94 of file HouseholderDecomposition.h.
Referenced by makeRegions(), and runRegional().
|
private |
Definition at line 95 of file HouseholderDecomposition.h.
Referenced by decompose(), and HouseholderDecomposition().
|
private |
Definition at line 85 of file HouseholderDecomposition.h.
Referenced by HouseholderDecomposition(), indexSqr2Reg(), makeRegions(), and runRegional().