Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "CondFormats/RPCObjects/interface/DccSpec.h"
0002 #include <sstream>
0003 #include <iostream>
0004 
0005 DccSpec::DccSpec(int id) : theId(id) {}
0006 
0007 std::string DccSpec::print(int depth) const {
0008   std::ostringstream str;
0009   str << "DccSpec:id=" << id() << std::endl;
0010   depth--;
0011   if (depth >= 0) {
0012     typedef std::vector<TriggerBoardSpec>::const_iterator ITTB;
0013     for (ITTB it = theTBs.begin(); it != theTBs.end(); it++)
0014       str << it->print(depth);
0015   }
0016   return str.str();
0017 }
0018 
0019 const TriggerBoardSpec* DccSpec::triggerBoard(int channelNumber) const {
0020   //  return (theId >=0) ? &theTBs[channelNumber-MIN_CHANNEL_NUMBER] : 0;
0021 
0022   //FIXME - temporary implementaion, to be replace by LUT (in preparation)
0023   typedef std::vector<TriggerBoardSpec>::const_iterator IT;
0024   for (IT it = theTBs.begin(); it != theTBs.end(); it++) {
0025     if (channelNumber == it->dccInputChannelNum())
0026       return &(*it);
0027   }
0028   return nullptr;
0029 }
0030 
0031 void DccSpec::add(const TriggerBoardSpec& tb) {
0032   //  if (theTBs.empty()) theTBs.resize(NUMBER_OF_CHANNELS);
0033   //  int channel = tb.dccInputChannelNum();
0034   //  if (    channel >= MIN_CHANNEL_NUMBER
0035   //       && channel <= NUMBER_OF_CHANNELS+MIN_CHANNEL_NUMBER-1) {
0036   //    theTBs[channel-MIN_CHANNEL_NUMBER] = tb;
0037   //  } else {
0038   //     edm::LogInfo(" incorrect tb, skipp adding.")<<"\t id="<<channel;
0039   //  }
0040   theTBs.push_back(tb);
0041 }