Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 /****************************************************************************
0002 *
0003 * This is a part of the TOTEM offline software.
0004 * Authors: 
0005 *   Jan Kašpar (jan.kaspar@gmail.com) 
0006 *
0007 ****************************************************************************/
0008 
0009 #include "CondFormats/PPSObjects/interface/TotemFramePosition.h"
0010 
0011 #include <iomanip>
0012 #include <cstdlib>
0013 
0014 using namespace std;
0015 
0016 //----------------------------------------------------------------------------------------------------
0017 
0018 std::ostream &operator<<(std::ostream &s, const TotemFramePosition &fp) {
0019   return s << fp.getFEDId() << ":" << fp.getGOHId() << ":" << fp.getIdxInFiber();
0020 }
0021 
0022 //----------------------------------------------------------------------------------------------------
0023 
0024 void TotemFramePosition::printXML() {
0025   cout << "\" FEDId=\"" << getFEDId() << "\" GOHId=\"" << getGOHId() << "\" IdxInFiber=\"" << getIdxInFiber() << "\"";
0026 }
0027 
0028 //----------------------------------------------------------------------------------------------------
0029 
0030 unsigned char TotemFramePosition::setXMLAttribute(const std::string &attribute,
0031                                                   const std::string &value,
0032                                                   unsigned char &flag) {
0033   unsigned int v = atoi(value.c_str());
0034 
0035   if (attribute == "FEDId") {
0036     setFEDId(v);
0037     flag |= 0x1C;  // SubSystem + TOTFED + OptoRx
0038     return 0;
0039   }
0040 
0041   if (attribute == "SubSystemId") {
0042     setSubSystemId(v);
0043     flag |= 0x10;
0044     return 0;
0045   }
0046 
0047   if (attribute == "TOTFEDId") {
0048     setTOTFEDId(v);
0049     flag |= 0x8;
0050     return 0;
0051   }
0052 
0053   if (attribute == "OptoRxId") {
0054     setOptoRxId(v);
0055     flag |= 0x4;
0056     return 0;
0057   }
0058 
0059   if (attribute == "GOHId") {
0060     setGOHId(v);
0061     flag |= 0x2;
0062     return 0;
0063   }
0064 
0065   if (attribute == "IdxInFiber") {
0066     setIdxInFiber(v);
0067     flag |= 0x1;
0068     return 0;
0069   }
0070 
0071   return 1;
0072 }