Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:59:28

0001 #ifndef MinL3Algorithm_H
0002 #define MinL3Algorithm_H
0003 
0004 /** \class MinL3Algorithm
0005  *  Implementation of the L3 Collaboration algorithm to solve a system Ax = B
0006  *  by minimization of |Ax-B| using an iterative linear approach
0007  *  This class is specific for the ECAL calibration
0008  *
0009  * 13.03.2007: R.Ofierzynski
0010  *  - implemented event weighting
0011  *
0012  * \author R.Ofierzynski, CERN
0013  */
0014 
0015 #include <vector>
0016 #include <iostream>
0017 
0018 class MinL3Algorithm {
0019 public:
0020   /// Default constructor
0021   /// kweight_ = event weight, squareMode_ = side length of the cluster square
0022   MinL3Algorithm(
0023       float kweight_ = 0., int squareMode_ = 5, int mineta_ = 1, int maxeta_ = 85, int minphi_ = 1, int maxphi_ = 20);
0024 
0025   /// Destructor
0026   ~MinL3Algorithm();
0027 
0028   /// method doing the full calibration running nIter number of times, recalibrating the event matrix after each iteration with the new solution
0029   /// returns the vector of calibration coefficients built from all iteration solutions
0030   /// >> to be used also as recipe on how to use the calibration methods one-by-one <<
0031   std::vector<float> iterate(const std::vector<std::vector<float> >& eventMatrix,
0032                              const std::vector<int>& VmaxCeta,
0033                              const std::vector<int>& VmaxCphi,
0034                              const std::vector<float>& energyVector,
0035                              const int& nIter,
0036                              const bool& normalizeFlag = false);
0037 
0038   /// add event to the calculation of the calibration vector
0039   void addEvent(const std::vector<float>& eventSquare, const int& maxCeta, const int& maxCphi, const float& energy);
0040 
0041   /// recalibrate before next iteration: give previous solution vector as argument
0042   std::vector<float> recalibrateEvent(const std::vector<float>& eventSquare,
0043                                       const int& maxCeta,
0044                                       const int& maxCphi,
0045                                       const std::vector<float>& recalibrateVector);
0046 
0047   /// get the solution at the end of the calibration
0048   std::vector<float> getSolution(bool resetsolution = true);
0049 
0050   /// reset for new iteration
0051   void resetSolution();
0052 
0053   /// method to translate from square indices to region indices
0054   int indexSqr2Reg(const int& sqrIndex, const int& maxCeta, const int& maxCphi);
0055 
0056 private:
0057   float kweight;
0058   int squareMode;
0059   int mineta, maxeta, minphi, maxphi;
0060   int countEvents;
0061   int Nchannels, Nxtals;
0062   std::vector<float> wsum;
0063   std::vector<float> Ewsum;
0064 };
0065 
0066 #endif  // MinL3Algorithm_H