Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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/TotemT2FramePosition.h"
0010 
0011 #include <iomanip>
0012 #include <cstdlib>
0013 
0014 using namespace std;
0015 
0016 //----------------------------------------------------------------------------------------------------
0017 
0018 std::ostream &operator<<(std::ostream &s, const TotemT2FramePosition &fp) {
0019   return s << fp.getFEDId() << ":" << fp.getGOHId() << ":" << fp.getIdxInFiber() << ":" << fp.getPayload();
0020 }
0021 
0022 //----------------------------------------------------------------------------------------------------
0023 
0024 void TotemT2FramePosition::printXML() {
0025   cout << "\" FEDId=\"" << getFEDId() << "\" GOHId=\"" << getGOHId() << "\" IdxInFiber=\"" << getIdxInFiber()
0026        << "\" pay=\"" << getPayload() << "\"";
0027 }
0028 
0029 //----------------------------------------------------------------------------------------------------
0030 
0031 unsigned char TotemT2FramePosition::setXMLAttribute(const std::string &attribute,
0032                                                     const std::string &value,
0033                                                     unsigned char &flag) {
0034   unsigned int v = atoi(value.c_str());
0035 
0036   if (attribute == "FEDId") {
0037     setFEDId(v);
0038     flag |= 0x1C;  // SubSystem + TOTFED + OptoRx
0039     return 0;
0040   }
0041 
0042   if (attribute == "pay") {
0043     setPayload(v);
0044     flag |= 0x20;  //T2 payload
0045     return 0;
0046   }
0047 
0048   if (attribute == "GOHId") {
0049     setGOHId(v);
0050     flag |= 0x2;
0051     return 0;
0052   }
0053 
0054   if (attribute == "IdxInFiber") {
0055     setIdxInFiber(v);
0056     flag |= 0x1;
0057     return 0;
0058   }
0059 
0060   return 1;
0061 }