Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:47:49

0001 /****************************************************************************
0002 * Authors: 
0003 *  Jan Kašpar (jan.kaspar@gmail.com) 
0004 ****************************************************************************/
0005 
0006 #ifndef CalibPPS_AlignmentRelative_JanAlignmentAlgorithm_h
0007 #define CalibPPS_AlignmentRelative_JanAlignmentAlgorithm_h
0008 
0009 #include "CalibPPS/AlignmentRelative/interface/AlignmentAlgorithm.h"
0010 #include "CalibPPS/AlignmentRelative/interface/SingularMode.h"
0011 
0012 #include "TMatrixD.h"
0013 #include "TVectorD.h"
0014 #include "TH1D.h"
0015 #include "TH2D.h"
0016 #include "TGraph.h"
0017 
0018 #include <vector>
0019 #include <map>
0020 #include <string>
0021 
0022 /**
0023  *\brief Jan's alignment algorithm.
0024  **/
0025 class JanAlignmentAlgorithm : public AlignmentAlgorithm {
0026 public:
0027   /// a scatter plot, with graph and histogram representations
0028   struct ScatterPlot {
0029     TGraph *g;
0030     TH2D *h;
0031   };
0032 
0033   /// structure holding statistical information for one detector
0034   struct DetStat {
0035     TH1D *m_dist;
0036     TH1D *R_dist;
0037     std::vector<TH1D *> coefHist;
0038     std::vector<TGraph *> resVsCoef;
0039     std::map<std::set<unsigned int>, ScatterPlot> resVsCoefRot_perRPSet;
0040   };
0041 
0042 private:
0043   /// S matrix components
0044   /// indeces correspond to the qClToOpt list
0045   TMatrixD **Sc;
0046 
0047   /// M vector components
0048   /// indeces correspond to the qClToOpt list
0049   TVectorD *Mc;
0050 
0051   /// final S matrix
0052   TMatrixD S;
0053 
0054   /// final M vector
0055   TVectorD M;
0056 
0057   /// eigen values of the S matrix
0058   TVectorD S_eigVal;
0059 
0060   /// matrix of S eigenvectors
0061   TMatrixD S_eigVec;
0062 
0063   /// a list of the singular modes of the S matrix
0064   std::vector<SingularMode> singularModes;
0065 
0066   /// whether to stop when singular modes are identified
0067   bool stopOnSingularModes;
0068 
0069   /// normalized eigen value below which the (CS) eigen vectors are considered as weak
0070   double weakLimit;
0071 
0072   /// event count
0073   unsigned int events;
0074 
0075   /// statistical data collection
0076   std::map<unsigned int, DetStat> statistics;
0077 
0078   /// flag whether to build statistical plots
0079   bool buildDiagnosticPlots;
0080 
0081 public:
0082   /// dummy constructor (not to be used)
0083   JanAlignmentAlgorithm() {}
0084 
0085   /// normal constructor
0086   JanAlignmentAlgorithm(const edm::ParameterSet &ps, AlignmentTask *_t);
0087 
0088   ~JanAlignmentAlgorithm() override;
0089 
0090   std::string getName() override { return "Jan"; }
0091 
0092   bool hasErrorEstimate() override { return true; }
0093 
0094   void begin(const CTPPSGeometry *geometryReal, const CTPPSGeometry *geometryMisaligned) override;
0095 
0096   void feed(const HitCollection &, const LocalTrackFit &) override;
0097 
0098   void saveDiagnostics(TDirectory *) override;
0099 
0100   void analyze() override;
0101 
0102   unsigned int solve(const std::vector<AlignmentConstraint> &,
0103                      std::map<unsigned int, AlignmentResult> &results,
0104                      TDirectory *dir) override;
0105 
0106   void end() override;
0107 };
0108 
0109 #endif