Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:51:25

0001 /****************************************************************************
0002  *
0003  * This is a part of TOTEM offline software.
0004  * Authors:
0005  * Jan Kaspar
0006  * Helena Malbouisson
0007  * Clemencia Mora Herrera
0008  *
0009  ****************************************************************************/
0010 
0011 #ifndef CondFormats_PPSObjects_CTPPSRPAlignmentCorrectionsMethods
0012 #define CondFormats_PPSObjects_CTPPSRPAlignmentCorrectionsMethods
0013 
0014 #include "CondFormats/PPSObjects/interface/CTPPSRPAlignmentCorrectionData.h"
0015 #include "CondFormats/PPSObjects/interface/CTPPSRPAlignmentCorrectionsData.h"
0016 #include "CondFormats/PPSObjects/interface/CTPPSRPAlignmentCorrectionsDataSequence.h"
0017 
0018 #include <xercesc/dom/DOM.hpp>
0019 
0020 //----------------------------------------------------------------------------------------------------
0021 
0022 class CTPPSRPAlignmentCorrectionsMethods {
0023 public:
0024   CTPPSRPAlignmentCorrectionsMethods() {}
0025 
0026   /// loads sequence of alignment corrections from XML file
0027   static CTPPSRPAlignmentCorrectionsDataSequence loadFromXML(const std::string& fileName);
0028 
0029   /// writes sequence of alignment corrections into a single XML file
0030   static void writeToXML(const CTPPSRPAlignmentCorrectionsDataSequence& seq,
0031                          const std::string& fileName,
0032                          bool precise = false,
0033                          bool wrErrors = true,
0034                          bool wrSh_xy = true,
0035                          bool wrSh_z = false,
0036                          bool wrRot_xy = false,
0037                          bool wrRot_z = true);
0038 
0039   /// writes alignment corrections into a single XML file, assigning infinite interval of validity
0040   static void writeToXML(const CTPPSRPAlignmentCorrectionsData& ad,
0041                          const std::string& fileName,
0042                          bool precise = false,
0043                          bool wrErrors = true,
0044                          bool wrSh_xy = true,
0045                          bool wrSh_z = false,
0046                          bool wrRot_xy = false,
0047                          bool wrRot_z = true) {
0048     const edm::ValidityInterval iov(edm::IOVSyncValue::beginOfTime(), edm::IOVSyncValue::endOfTime());
0049     CTPPSRPAlignmentCorrectionsDataSequence s;
0050     s.insert(iov, ad);
0051     writeToXML(s, fileName, precise, wrErrors, wrSh_xy, wrSh_z, wrRot_xy, wrRot_z);
0052   }
0053 
0054   static edm::IOVSyncValue stringToIOVValue(const std::string&);
0055 
0056   static std::string iovValueToString(const edm::IOVSyncValue&);
0057 
0058 protected:
0059   /// load corrections data corresponding to one IOV
0060   static CTPPSRPAlignmentCorrectionsData getCorrectionsData(xercesc::DOMNode*);
0061 
0062   /// writes data of a correction in XML format
0063   static void writeXML(const CTPPSRPAlignmentCorrectionData& data,
0064                        FILE* f,
0065                        bool precise,
0066                        bool wrErrors,
0067                        bool wrSh_xy,
0068                        bool wrSh_z,
0069                        bool wrRot_xy,
0070                        bool wrRot_z);
0071 
0072   /// writes a block of corrections into a file
0073   static void writeXMLBlock(const CTPPSRPAlignmentCorrectionsData&,
0074                             FILE*,
0075                             bool precise = false,
0076                             bool wrErrors = true,
0077                             bool wrSh_xy = true,
0078                             bool wrSh_z = false,
0079                             bool wrRot_xy = false,
0080                             bool wrRot_z = true);
0081 };
0082 
0083 #endif