Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:28

0001 /****************************************************************************
0002  *
0003  * This is a part of CMS-TOTEM PPS offline software.
0004  * Authors:
0005  *  Jan Kašpar (jan.kaspar@gmail.com)
0006  *  Helena Malbouisson
0007  *  Clemencia Mora Herrera
0008  *
0009  ****************************************************************************/
0010 
0011 #ifndef CondFormats_PPSObjects_CTPPSRPAlignmentCorrectionsData
0012 #define CondFormats_PPSObjects_CTPPSRPAlignmentCorrectionsData
0013 
0014 #include "CondFormats/PPSObjects/interface/CTPPSRPAlignmentCorrectionData.h"
0015 
0016 #include <map>
0017 
0018 /**
0019  *\brief Container for CTPPS RP alignment corrections.
0020  * The corrections are stored on two levels - RP and sensor. For every level,
0021  * there is a map: ID --> alignment correction. Sensors inherit the
0022  * alignment corrections from the corresponding RP, see getFullSensorCorrection
0023  * method.
0024  **/
0025 class CTPPSRPAlignmentCorrectionsData {
0026 public:
0027   /// map: element id -> its alignment correction
0028   typedef std::map<unsigned int, CTPPSRPAlignmentCorrectionData> mapType;
0029 
0030 private:
0031   /// alignment correction maps
0032   mapType rps_, sensors_;
0033 
0034   friend class StraightTrackAlignment;
0035 
0036 public:
0037   CTPPSRPAlignmentCorrectionsData() {}
0038 
0039   /// returns the map of RP alignment corrections
0040   const mapType& getRPMap() const { return rps_; }
0041 
0042   /// returns the map of sensor alignment corrections
0043   const mapType& getSensorMap() const { return sensors_; }
0044 
0045   /// returns the correction value from the RP map
0046   CTPPSRPAlignmentCorrectionData& getRPCorrection(unsigned int id);
0047   CTPPSRPAlignmentCorrectionData getRPCorrection(unsigned int id) const;
0048 
0049   /// returns the correction value from the sensor map
0050   CTPPSRPAlignmentCorrectionData& getSensorCorrection(unsigned int id);
0051   CTPPSRPAlignmentCorrectionData getSensorCorrection(unsigned int id) const;
0052 
0053   /// returns the correction for the given sensor, combining the data from RP and sensor map
0054   /// regarding transverse shifts, uses the x and y representation, sh_r will not be corrected!
0055   /// by default, RP errors shall not be summed up (strong correlation).
0056   CTPPSRPAlignmentCorrectionData getFullSensorCorrection(unsigned int id, bool useRPErrors = false) const;
0057 
0058   /// sets the alignment correction for the given RP
0059   void setRPCorrection(unsigned int id, const CTPPSRPAlignmentCorrectionData& ac);
0060 
0061   /// sets the alignment correction for the given sensor
0062   void setSensorCorrection(unsigned int id, const CTPPSRPAlignmentCorrectionData& ac);
0063 
0064   /// adds (merges) a RP correction on top of the current value
0065   /// \param sumErrors if it is true, old and new alignment uncertainties are summed (in quadrature)
0066   /// if it is false, the uncertainties of the parameter (i.e. not the object) will be used
0067   /// With the add... switches one can control which corrections are added.
0068   void addRPCorrection(unsigned int,
0069                        const CTPPSRPAlignmentCorrectionData&,
0070                        bool sumErrors = true,
0071                        bool addSh = true,
0072                        bool addRot = true);
0073 
0074   /// adds (merges) a RP correction on top of the current value
0075   void addSensorCorrection(unsigned int,
0076                            const CTPPSRPAlignmentCorrectionData&,
0077                            bool sumErrors = true,
0078                            bool addSh = true,
0079                            bool addRot = true);
0080 
0081   /// adds (merges) corrections on top of the current values
0082   void addCorrections(const CTPPSRPAlignmentCorrectionsData&,
0083                       bool sumErrors = true,
0084                       bool addSh = true,
0085                       bool addRot = true);
0086 
0087   /// clears all alignments
0088   void clear();
0089 
0090   COND_SERIALIZABLE;
0091 };
0092 
0093 std::ostream& operator<<(std::ostream& s, const CTPPSRPAlignmentCorrectionsData& corr);
0094 
0095 #endif