CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
HouseholderDecomposition Class Reference

#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 &regLength=5)
 
 ~HouseholderDecomposition ()
 Destructor. More...
 

Private Member Functions

bool decompose ()
 
void makeRegions (const int &regLength)
 
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
 

Detailed Description

Implementation of the QR decomposition of a matrix using Householder transformation

13.03.2007: R.Ofierzynski

Author
Lorenzo Agostino, R.Ofierzynski, CERN

Definition at line 17 of file HouseholderDecomposition.h.

Constructor & Destructor Documentation

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.

HouseholderDecomposition::~HouseholderDecomposition ( )

Destructor.

Definition at line 28 of file HouseholderDecomposition.cc.

Member Function Documentation

bool HouseholderDecomposition::decompose ( )
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 345 of file HouseholderDecomposition.cc.

int HouseholderDecomposition::indexSqr2Reg ( const int &  sqrIndex,
const int &  maxCeta,
const int &  maxCphi 
)

Method to translate from square indices to region indices.

Definition at line 527 of file HouseholderDecomposition.cc.

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 132 of file HouseholderDecomposition.cc.

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 191 of file HouseholderDecomposition.cc.

void HouseholderDecomposition::makeRegions ( const int &  regLength)
private

Determines the regions used for splitting of the full matrix and calibrating separately used by the public runRegional method

Definition at line 577 of file HouseholderDecomposition.cc.

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 512 of file HouseholderDecomposition.cc.

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 33 of file HouseholderDecomposition.cc.

void HouseholderDecomposition::solve ( std::vector< float > &  y)
private

Apply transformations to rhs output: r = residual vector (energy vector), y = solution

Definition at line 465 of file HouseholderDecomposition.cc.

std::vector< std::vector< float > > HouseholderDecomposition::unzipMatrix ( const std::vector< std::vector< float > > &  eventMatrix,
const std::vector< int > &  VmaxCeta,
const std::vector< int > &  VmaxCphi 
)
private

Unzips the skimmed matrix into a full matrix.

Definition at line 556 of file HouseholderDecomposition.cc.

Member Data Documentation

std::vector<float> HouseholderDecomposition::alpha
private

Definition at line 75 of file HouseholderDecomposition.h.

int HouseholderDecomposition::countEvents
private

Definition at line 69 of file HouseholderDecomposition.h.

std::vector<float> HouseholderDecomposition::energyVectorProc
private

Definition at line 74 of file HouseholderDecomposition.h.

std::vector< std::vector<float> > HouseholderDecomposition::eventMatrixOrig
private

Definition at line 72 of file HouseholderDecomposition.h.

std::vector< std::vector<float> > HouseholderDecomposition::eventMatrixProc
private

Definition at line 73 of file HouseholderDecomposition.h.

int HouseholderDecomposition::maxeta
private

Definition at line 70 of file HouseholderDecomposition.h.

int HouseholderDecomposition::maxphi
private

Definition at line 70 of file HouseholderDecomposition.h.

int HouseholderDecomposition::mineta
private

Definition at line 70 of file HouseholderDecomposition.h.

int HouseholderDecomposition::minphi
private

Definition at line 70 of file HouseholderDecomposition.h.

int HouseholderDecomposition::Nchannels
private

Definition at line 71 of file HouseholderDecomposition.h.

int HouseholderDecomposition::Neta
private

Definition at line 70 of file HouseholderDecomposition.h.

int HouseholderDecomposition::Nevents
private

Definition at line 71 of file HouseholderDecomposition.h.

int HouseholderDecomposition::Nphi
private

Definition at line 70 of file HouseholderDecomposition.h.

int HouseholderDecomposition::Nxtals
private

Definition at line 71 of file HouseholderDecomposition.h.

std::vector<int> HouseholderDecomposition::pivot
private

Definition at line 76 of file HouseholderDecomposition.h.

std::vector<int> HouseholderDecomposition::regMaxEta
private

Definition at line 78 of file HouseholderDecomposition.h.

std::vector<int> HouseholderDecomposition::regMaxPhi
private

Definition at line 78 of file HouseholderDecomposition.h.

std::vector<int> HouseholderDecomposition::regMinEta
private

Definition at line 78 of file HouseholderDecomposition.h.

std::vector<int> HouseholderDecomposition::regMinPhi
private

Definition at line 78 of file HouseholderDecomposition.h.

float HouseholderDecomposition::sigmaReplacement
private

Definition at line 79 of file HouseholderDecomposition.h.

int HouseholderDecomposition::squareMode
private

Definition at line 69 of file HouseholderDecomposition.h.