Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:56:06

0001 #ifndef Alignment_CommonAlignment_Utilities_H
0002 #define Alignment_CommonAlignment_Utilities_H
0003 
0004 /** \namespace align
0005  *
0006  *  Namespace for common calculations in alignment.
0007  *
0008  *  $Date: 2007/10/08 15:22:08 $
0009  *  $Revision: 1.10 $
0010  *  \author Chung Khim Lae
0011  */
0012 
0013 #include <map>
0014 #include <memory>
0015 #include <vector>
0016 
0017 #include "CondCore/CondDB/interface/Time.h"
0018 #include "CondFormats/Alignment/interface/Definitions.h"
0019 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0020 
0021 class Alignable;
0022 class AlignmentParameters;
0023 class AlignmentLevel;
0024 
0025 namespace align {
0026   typedef std::vector<Scalar> Scalars;
0027   typedef std::vector<GlobalPoint> GlobalPoints;
0028   typedef std::vector<GlobalVector> GlobalVectors;
0029   typedef std::vector<LocalPoint> LocalPoints;
0030   typedef std::vector<LocalVector> LocalVectors;
0031   typedef std::vector<Alignable*> Alignables;
0032   typedef std::vector<AlignmentParameters*> Parameters;
0033   typedef std::vector<std::unique_ptr<AlignmentLevel> > AlignmentLevels;
0034 
0035   typedef std::map<std::pair<Alignable*, Alignable*>, AlgebraicMatrix> Correlations;
0036 
0037   using RunNumber = cond::RealTimeType<cond::runnumber>::type;
0038   using RunRange = std::pair<RunNumber, RunNumber>;
0039   using RunRanges = std::vector<RunRange>;
0040 
0041   /// Convert rotation matrix to angles about x-, y-, z-axes (frame rotation).
0042   EulerAngles toAngles(const RotationType&);
0043 
0044   /// Convert rotation angles about x-, y-, z-axes to matrix.
0045   RotationType toMatrix(const EulerAngles&);
0046 
0047   /// Find mother's position from the average of its daughters' positions.
0048   PositionType motherPosition(const std::vector<const PositionType*>& dauPos);
0049 
0050   /// Find matrix to rotate from nominal to current vectors.
0051   /// Assume both sets of vectors have the same size and order.
0052   RotationType diffRot(const GlobalVectors& current, const GlobalVectors& nominal);
0053 
0054   GlobalVector diffR(const GlobalVectors& current, const GlobalVectors& nominal);
0055 
0056   /// Find the CM of a set of points
0057   GlobalVector centerOfMass(const GlobalVectors& theVs);
0058 
0059   /// Correct a rotation matrix for rounding errors.
0060   void rectify(RotationType&);
0061 
0062   RunRanges makeNonOverlappingRunRanges(const edm::VParameterSet& runRanges, const RunNumber& defaultRun);
0063   RunRanges makeUniqueRunRanges(const edm::VParameterSet& runRanges, const RunNumber& defaultRun);
0064 }  // namespace align
0065 
0066 #endif