CMS 3D CMS Logo

Public Types | Public Member Functions | Private Types | Private Attributes

RPCReadOutMapping Class Reference

#include <RPCReadOutMapping.h>

Inheritance diagram for RPCReadOutMapping:
RPCReadOutMappingWithFastSearch

List of all members.

Public Types

typedef std::pair< uint32_t, int > StripInDetUnit
 first member is DetUnit ID, second strip in DetUnit frame

Public Member Functions

void add (const DccSpec &dcc)
 attach FED to map
const DccSpecdcc (int dccId) const
 FED identified by ID.
std::vector< const DccSpec * > dccList () const
 all FEDs in map
std::pair< int, int > dccNumberRange () const
 Range of FED IDs in map (min and max id)
virtual StripInDetUnit detUnitFrame (const LinkBoardSpec &location, const LinkBoardPackedStrip &packedStrip) const
 convert strip location as in raw data (LB and LBchannel) to detUnit frame
std::vector< const
LinkBoardSpec * > 
getLBforChamber (const std::string &name) const
std::pair
< LinkBoardElectronicIndex,
int > 
getRAWSpecForCMSChamberSrip (uint32_t detId, int strip, int dccInputChannel) const
virtual const LinkBoardSpeclocation (const LinkBoardElectronicIndex &ele) const
 conversion between electronic and detector indexing
std::vector< std::pair
< LinkBoardElectronicIndex,
LinkBoardPackedStrip > > 
rawDataFrame (const StripInDetUnit &duFrame) const
 connection "paths" that lead from one digi to one strip
 RPCReadOutMapping (const std::string &version="")
const std::string & version () const
 version as string
virtual ~RPCReadOutMapping ()

Private Types

typedef std::map< int, DccSpec >
::const_iterator 
IMAP

Private Attributes

std::map< int, DccSpectheFeds
std::string theVersion

Detailed Description

Description: Class to map read-out channels to physical RPC strips

Definition at line 21 of file RPCReadOutMapping.h.


Member Typedef Documentation

typedef std::map<int, DccSpec>::const_iterator RPCReadOutMapping::IMAP [private]

Definition at line 67 of file RPCReadOutMapping.h.

typedef std::pair<uint32_t,int> RPCReadOutMapping::StripInDetUnit

first member is DetUnit ID, second strip in DetUnit frame

Definition at line 25 of file RPCReadOutMapping.h.


Constructor & Destructor Documentation

RPCReadOutMapping::RPCReadOutMapping ( const std::string &  version = "")

Definition at line 18 of file RPCReadOutMapping.cc.

virtual RPCReadOutMapping::~RPCReadOutMapping ( ) [inline, virtual]

Definition at line 28 of file RPCReadOutMapping.h.

{}

Member Function Documentation

void RPCReadOutMapping::add ( const DccSpec dcc)

attach FED to map

Definition at line 28 of file RPCReadOutMapping.cc.

References dcc(), DccSpec::id(), and theFeds.

Referenced by RPCEMap::convert().

{
  theFeds[dcc.id()] = dcc;
}
const DccSpec * RPCReadOutMapping::dcc ( int  dccId) const

FED identified by ID.

Definition at line 21 of file RPCReadOutMapping.cc.

References theFeds.

Referenced by add(), and location().

{
  IMAP im = theFeds.find(dccId);
  const DccSpec & ddc = (*im).second;
  return (im != theFeds.end()) ?  &ddc : 0;
}
std::vector< const DccSpec * > RPCReadOutMapping::dccList ( ) const

all FEDs in map

Definition at line 34 of file RPCReadOutMapping.cc.

References query::result, and theFeds.

Referenced by popcon::RPCEMapSourceHandler::Compare2EMaps(), RPCReadOutMappingWithFastSearch::init(), and RPCLinkSynchroStat::init().

{
  std::vector<const DccSpec*> result;
  result.reserve(theFeds.size());
  for (IMAP im = theFeds.begin(); im != theFeds.end(); im++) {
    result.push_back( &(im->second) );
  }
  return result;
}
std::pair< int, int > RPCReadOutMapping::dccNumberRange ( ) const

Range of FED IDs in map (min and max id)

Definition at line 44 of file RPCReadOutMapping.cc.

References first, prof2calltree::last, and theFeds.

Referenced by popcon::RPCEMapSourceHandler::Compare2EMaps().

{
  
  if (theFeds.empty()) return std::make_pair(0,-1);
  else {
    IMAP first = theFeds.begin();
    IMAP last  = theFeds.end(); last--;
    return  std::make_pair(first->first, last->first);
  }
}
RPCReadOutMapping::StripInDetUnit RPCReadOutMapping::detUnitFrame ( const LinkBoardSpec location,
const LinkBoardPackedStrip packedStrip 
) const [virtual]

convert strip location as in raw data (LB and LBchannel) to detUnit frame

Reimplemented in RPCReadOutMappingWithFastSearch.

Definition at line 132 of file RPCReadOutMapping.cc.

References ChamberStripSpec::chamberStripNumber, debug, LinkBoardSpec::feb(), LinkBoardPackedStrip::febInLB(), instance, LogDebug, LinkBoardSpec::print(), FebConnectorSpec::rawId(), FebConnectorSpec::strip(), strip(), and LinkBoardPackedStrip::stripPinInFeb().

Referenced by RPCReadOutMappingWithFastSearch::detUnitFrame(), and RPCRecordFormatter::recordUnpack().

{
  static bool debug = edm::MessageDrop::instance()->debugEnabled;
  uint32_t detUnit = 0;
  int stripInDU = 0;
  int febInLB = lbstrip.febInLB();
  int stripPinInFeb = lbstrip.stripPinInFeb();

  const FebConnectorSpec * feb = location.feb(febInLB);
  if (feb) {
    detUnit = feb->rawId();
    const ChamberStripSpec strip = feb->strip(stripPinInFeb);
    if (strip.chamberStripNumber > -1) {
      stripInDU = strip.chamberStripNumber;
    } else {
      // LogWarning("detUnitFrame")<<"problem with stip for febInLB: "<<febInLB
      //                             <<" strip pin: "<< stripPinInFeb
      //                             <<" strip pin: "<< stripPinInFeb;
      if (debug) {
        LogDebug("")<<"problem with stip for febInLB: "<<febInLB
                    <<" strip pin: "<< stripPinInFeb
                    <<" strip pin: "<< stripPinInFeb
                    <<" for linkBoard: "<<location.print(3);
      }
    }
  } else {
    // LogWarning("detUnitFrame")<<"problem with detUnit for febInLB: ";
    if (debug) {  
      LogDebug("") <<"problem with detUnit for febInLB: " <<febInLB
                   <<" for linkBoard: "<<location.print(1);
    }
  }
  return std::make_pair(detUnit,stripInDU);
}
std::vector< const LinkBoardSpec * > RPCReadOutMapping::getLBforChamber ( const std::string &  name) const

Definition at line 210 of file RPCReadOutMapping.cc.

References FebConnectorSpec::chamber(), ChamberLocationSpec::chamberLocationName(), LinkBoardElectronicIndex::dccId, LinkBoardElectronicIndex::dccInputChannelNum, LinkBoardSpec::feb(), j, gen::k, LinkBoardElectronicIndex::lbNumInLink, location(), AlCaHLTBitMon_QueryRunRegistry::string, and LinkBoardElectronicIndex::tbLinkInputNum.

                                                                                             {


 std::vector<const LinkBoardSpec*> vLBforChamber;

 LinkBoardElectronicIndex linkboard;
 linkboard.dccId = 790;
 linkboard.dccInputChannelNum = 1;
 linkboard.tbLinkInputNum = 1;
 linkboard.lbNumInLink = 0;
 const LinkBoardSpec *location = this->location(linkboard);
 
 for(int k=0;k<18;k++){
   linkboard.dccInputChannelNum = 1;
   linkboard.tbLinkInputNum = k;
   for(int j=0;j<3;j++){
     linkboard.lbNumInLink = j;
     int febInputNum=1;
     location = this->location(linkboard);
     if (location) {
       //location->print();
       for(int j=0;j<6;j++){     
         const FebConnectorSpec * feb = location->feb(febInputNum+j);
         if(feb){
           //feb->print();        
           std::string chName = feb->chamber().chamberLocationName();
           if(chName==name){
             vLBforChamber.push_back(location);
             //feb->chamber().print();
             break;
           }
         }
       }
     }
   }
 }
 return vLBforChamber;
}
std::pair< LinkBoardElectronicIndex, int > RPCReadOutMapping::getRAWSpecForCMSChamberSrip ( uint32_t  detId,
int  strip,
int  dccInputChannel 
) const

Definition at line 174 of file RPCReadOutMapping.cc.

References ChamberStripSpec::cmsStripNumber, gather_cfg::cout, LinkBoardElectronicIndex::dccId, LinkBoardElectronicIndex::dccInputChannelNum, LinkBoardSpec::feb(), i, j, gen::k, prof2calltree::l, LinkBoardElectronicIndex::lbNumInLink, location(), FebConnectorSpec::rawId(), FebConnectorSpec::strip(), and LinkBoardElectronicIndex::tbLinkInputNum.

                                                                                                   {

 LinkBoardElectronicIndex linkboard;
 linkboard.dccId = 790;
 linkboard.dccInputChannelNum = dccInputChannel;

 for(int k=0;k<18;k++){
   linkboard.tbLinkInputNum = k;
   for(int j=0;j<3;j++){
     linkboard.lbNumInLink = j;
     const LinkBoardSpec *location = this->location(linkboard);    
     if (location) {
       for(int i=1;i<7;i++){     
         const FebConnectorSpec * feb = location->feb(i);
         if(feb && feb->rawId()==detId){
           for(int l=1;l<17;l++){
             int pin = l;
             const ChamberStripSpec aStrip = feb->strip(pin);
             if(aStrip.cmsStripNumber==strip){
               int bitInLink = (i-1)*16+l-1;
               std::pair<LinkBoardElectronicIndex, int> stripInfo(linkboard,bitInLink);
               return stripInfo;
             }
           }
         }
       }
     }
   }
 }
 RPCDetId aDet(detId);
 std::cout<<"Strip: "<<strip<<" not found for detector: "<<aDet<<std::endl;
 std::pair<LinkBoardElectronicIndex, int> dummyStripInfo(linkboard,-99);
 return dummyStripInfo;
}
const LinkBoardSpec * RPCReadOutMapping::location ( const LinkBoardElectronicIndex ele) const [virtual]

conversion between electronic and detector indexing

Reimplemented in RPCReadOutMappingWithFastSearch.

Definition at line 114 of file RPCReadOutMapping.cc.

References dcc(), LinkBoardElectronicIndex::dccId, LinkBoardElectronicIndex::dccInputChannelNum, LinkBoardElectronicIndex::lbNumInLink, LinkConnSpec::linkBoard(), TriggerBoardSpec::linkConn(), LinkBoardElectronicIndex::tbLinkInputNum, and DccSpec::triggerBoard().

Referenced by getLBforChamber(), getRAWSpecForCMSChamberSrip(), and RPCRecordFormatter::recordUnpack().

{
  //FIXME after debugging change to dcc(ele.dccId)->triggerBoard(ele.dccInputChannelNum)->...
  const DccSpec *dcc = RPCReadOutMapping::dcc(ele.dccId);
  if (dcc) {
    const TriggerBoardSpec *tb = dcc->triggerBoard(ele.dccInputChannelNum);
     if (tb) {
      const LinkConnSpec *lc = tb->linkConn( ele.tbLinkInputNum);
      if (lc) {
        const LinkBoardSpec *lb = lc->linkBoard(ele.lbNumInLink);
        return lb;
      }
    }
  }
  return 0;
}
std::vector< std::pair< LinkBoardElectronicIndex, LinkBoardPackedStrip > > RPCReadOutMapping::rawDataFrame ( const StripInDetUnit duFrame) const

connection "paths" that lead from one digi to one strip

Definition at line 57 of file RPCReadOutMapping.cc.

References FebConnectorSpec::cablePinNum(), FebConnectorSpec::chamberStripNum(), LinkBoardElectronicIndex::dccId, TriggerBoardSpec::dccInputChannelNum(), LinkBoardElectronicIndex::dccInputChannelNum, TriggerBoardSpec::enabledLinkConns(), LinkBoardSpec::febs(), DccSpec::id(), LinkBoardElectronicIndex::lbNumInLink, link(), FebConnectorSpec::linkBoardInputNum(), LinkBoardSpec::linkBoardNumInLink(), LinkConnSpec::linkBoards(), splitter::LINKS, FebConnectorSpec::nstrips(), FebConnectorSpec::rawId(), query::result, LinkBoardElectronicIndex::tbLinkInputNum, theFeds, LinkConnSpec::triggerBoardInputNumber(), and DccSpec::triggerBoards().

Referenced by RPCRecordFormatter::recordPack().

{
  std::vector< std::pair< LinkBoardElectronicIndex, LinkBoardPackedStrip> > result;
  LinkBoardElectronicIndex eleIndex = { 0,0,0,0 };

  const uint32_t & rawDetId = stripInDetUnit.first;
  const int & stripInDU     = stripInDetUnit.second;

  for (IMAP im=theFeds.begin(); im != theFeds.end(); im++) {
    const DccSpec & dccSpec = (*im).second; 
    const std::vector<TriggerBoardSpec> & triggerBoards = dccSpec.triggerBoards();
    for ( std::vector<TriggerBoardSpec>::const_iterator 
        it = triggerBoards.begin(); it != triggerBoards.end(); it++) {
      const TriggerBoardSpec & triggerBoard = (*it);
      typedef std::vector<const LinkConnSpec* > LINKS;
      LINKS linkConns = triggerBoard.enabledLinkConns();
      for ( LINKS::const_iterator ic = linkConns.begin(); ic != linkConns.end(); ic++) {
              
        const LinkConnSpec & link = **ic; 
        const std::vector<LinkBoardSpec> & boards = link.linkBoards();
        for ( std::vector<LinkBoardSpec>::const_iterator
            ib = boards.begin(); ib != boards.end(); ib++) { 

          const LinkBoardSpec & board = (*ib);
          
          eleIndex.dccId = dccSpec.id();
          eleIndex.dccInputChannelNum = triggerBoard.dccInputChannelNum();
          eleIndex.tbLinkInputNum = link.triggerBoardInputNumber(); 
          eleIndex.lbNumInLink = board.linkBoardNumInLink();

          const std::vector<FebConnectorSpec> & febs = board.febs();
          int febCheck = 0;
          for ( std::vector<FebConnectorSpec>::const_iterator
              ifc = febs.begin(); ifc != febs.end(); ifc++) {
            const FebConnectorSpec & febConnector = (*ifc);
            febCheck++;
            if (febConnector.rawId() != rawDetId) continue;
            int febInLB = febConnector.linkBoardInputNum();
            /* if (febInLB != febCheck) {
              edm::LogError("rawDataFrame") << " problem with febInLB: " <<febInLB<<" "<<febCheck;
              } */
            for (int istrip=0; istrip<febConnector.nstrips(); istrip++) {
              int stripPinInFeb = febConnector.cablePinNum(istrip);
              if (febConnector.chamberStripNum(istrip) == stripInDU) {
                result.push_back(
                    std::make_pair( eleIndex, LinkBoardPackedStrip( febInLB, stripPinInFeb) ) ); 
              }
            }
          } 
        }
      }
    }
  }
  return result;
}
const std::string& RPCReadOutMapping::version ( ) const [inline]

Member Data Documentation

std::map<int, DccSpec> RPCReadOutMapping::theFeds [private]

Definition at line 68 of file RPCReadOutMapping.h.

Referenced by add(), dcc(), dccList(), dccNumberRange(), and rawDataFrame().

std::string RPCReadOutMapping::theVersion [private]

Reimplemented in RPCReadOutMappingWithFastSearch.

Definition at line 69 of file RPCReadOutMapping.h.

Referenced by version().