CMS 3D CMS Logo

CSCReadoutMapping Class Reference

Author:
Tim Cox Abstract class to define mapping between CSC readout hardware ids and other labels.
More...

#include <CondFormats/CSCObjects/interface/CSCReadoutMapping.h>

Inheritance diagram for CSCReadoutMapping:

CSCReadoutMappingForSliceTest CSCReadoutMappingFromFile

List of all members.

Public Member Functions

void addRecord (int endcap, int station, int ring, int chamber, int vmecrate, int dmb, int tmb, int tsector, int cscid, int ddu, int dcc)
 Add one record of info to mapping.
int chamber (int endcap, int station, int vmecrate, int dmb, int tmb) const
 Return chamber label corresponding to readout ids vme, tmb and dmb for given endcap endcap = 1 (+z), 2 (-z), station, vme crate number, dmb slot number, tmb slot number.
int crate (const CSCDetId &) const
 returns vmecrate given CSCDetId
 CSCReadoutMapping ()
 Default constructor.
int dccId (const CSCDetId &) const
 returns DCC# given CSCDetId
int dduId (const CSCDetId &) const
 returns DDU# given CSCDetId
bool debugV (void) const
 Status of debug printout flag.
CSCDetId detId (int endcap, int station, int vmecrate, int dmb, int tmb, int cfeb, int layer=0) const
 Return CSCDetId for layer corresponding to readout ids vme, tmb, and dmb for given endcap and layer no.
int dmbId (const CSCDetId &) const
 returns dmbId given CSCDetId
virtual void fill (const edm::ParameterSet &)=0
 Fill mapping store.
CSCLabel findHardwareId (const CSCDetId &) const
 returns hardware ids given chamber id
const std::string & myName (void) const
 Return class name.
void setDebugV (bool dbg)
 Set debug printout flag.
virtual ~CSCReadoutMapping ()
 Destructor.

Private Member Functions

virtual int hwId (int endcap, int station, int vme, int dmb, int tmb) const =0
 Build a unique integer out of the readout electronics labels.
int swId (int endcap, int station, int ring, int chamber) const
 Build a unique integer out of chamber labels.

Private Attributes

bool debugV_
std::map< int, inthw2sw_
std::vector< CSCLabelmapping_
std::string myName_
std::map< int, CSCLabelsw2hw_

Classes

struct  CSCLabel
 Instead of a set of vectors of int use one vector of a set of ints. More...


Detailed Description

Author:
Tim Cox Abstract class to define mapping between CSC readout hardware ids and other labels.

Defines the ids and labels in the mapping and supplies translation interface. A derived class must define how hardware labels map to a unique integer. A derived, concrete, class must define from where the mapping information comes.

Definition at line 24 of file CSCReadoutMapping.h.


Constructor & Destructor Documentation

CSCReadoutMapping::CSCReadoutMapping (  ) 

Default constructor.

Definition at line 5 of file CSCReadoutMapping.cc.

00005 : myName_("CSCReadoutMapping"), debugV_( false ) {}

CSCReadoutMapping::~CSCReadoutMapping (  )  [virtual]

Destructor.

Definition at line 7 of file CSCReadoutMapping.cc.

00007 {}


Member Function Documentation

void CSCReadoutMapping::addRecord ( int  endcap,
int  station,
int  ring,
int  chamber,
int  vmecrate,
int  dmb,
int  tmb,
int  tsector,
int  cscid,
int  ddu,
int  dcc 
)

Add one record of info to mapping.

reverse mapping for software -> hadrware labels

Definition at line 49 of file CSCReadoutMapping.cc.

References hw2sw_, hwId(), mapping_, sw2hw_, and swId().

Referenced by CSCReadoutMappingFromFile::fill().

00050                                                                                       {
00051 
00052   CSCLabel newRecord( endcap, station, ring, chamber, vmecrate, dmb, tmb, tsector, cscid, ddu, dcc );
00053   mapping_.push_back( newRecord );
00054   int hid = hwId( endcap, station, vmecrate, dmb, tmb );
00055   int sid = swId( endcap, station, ring, chamber);
00056   // LogDebug("CSC") << " map hw " << hid << " to sw " << sid;
00057   if ( hw2sw_.insert( std::make_pair(hid, sid) ).second ) {
00058     // LogDebug("CSC") << " insert pair succeeded.";
00059   }
00060   else {
00061     edm::LogError("CSC") << " already have key = " << hid;
00062   }
00064   sw2hw_.insert( std::make_pair(sid, newRecord) );
00065 
00066 } 

int CSCReadoutMapping::chamber ( int  endcap,
int  station,
int  vmecrate,
int  dmb,
int  tmb 
) const

Return chamber label corresponding to readout ids vme, tmb and dmb for given endcap endcap = 1 (+z), 2 (-z), station, vme crate number, dmb slot number, tmb slot number.

Definition at line 9 of file CSCReadoutMapping.cc.

References hw2sw_, hwId(), and it.

Referenced by detId(), and findHardwareId().

00009                                                                                          {
00010   // Build hw id from input, find sw id to match
00011   int cid = 0;
00012   int hid = hwId( endcap, station, vme, dmb, tmb );
00013   // Search for that hw id in mapping
00014   std::map<int,int>::const_iterator it = hw2sw_.find( hid );
00015   if ( it != hw2sw_.end() ) {
00016     cid = it->second;
00017     //    std::cout << "hwid = " << hid << ", swid = " << cid << std::endl;
00018     //    LogDebug("CSC") << " for requested hw id = " << hid << ", found sw id = " << cid;
00019   }
00020   else {
00021     edm::LogError("CSC") << " cannot find requested hw id = " << hid << " in mapping.";
00022   }
00023   return cid;
00024 }

int CSCReadoutMapping::crate ( const CSCDetId id  )  const

returns vmecrate given CSCDetId

Definition at line 89 of file CSCReadoutMapping.cc.

References findHardwareId(), and CSCReadoutMapping::CSCLabel::vmecrate_.

00089                                                       {
00090   CSCLabel hid = findHardwareId(id);
00091   return hid.vmecrate_;
00092 }

int CSCReadoutMapping::dccId ( const CSCDetId id  )  const

returns DCC# given CSCDetId

Definition at line 101 of file CSCReadoutMapping.cc.

References CSCReadoutMapping::CSCLabel::dcc_, and findHardwareId().

00101                                                       {
00102   CSCLabel hid = findHardwareId(id);
00103   return hid.dcc_;
00104 }

int CSCReadoutMapping::dduId ( const CSCDetId id  )  const

returns DDU# given CSCDetId

Definition at line 97 of file CSCReadoutMapping.cc.

References CSCReadoutMapping::CSCLabel::ddu_, and findHardwareId().

00097                                                       {
00098   CSCLabel hid = findHardwareId(id);
00099   return hid.ddu_;
00100 }

bool CSCReadoutMapping::debugV ( void   )  const [inline]

Status of debug printout flag.

Definition at line 104 of file CSCReadoutMapping.h.

References debugV_.

00104 { return debugV_; }

CSCDetId CSCReadoutMapping::detId ( int  endcap,
int  station,
int  vmecrate,
int  dmb,
int  tmb,
int  cfeb,
int  layer = 0 
) const

Return CSCDetId for layer corresponding to readout ids vme, tmb, and dmb for given endcap and layer no.

1-6, or for chamber if no layer no. supplied. Args: endcap = 1 (+z), 2 (-z), station, vme crate number, dmb slot number, tmb slot number, cfeb number (so we can identify ME1a/b within ME11), layer number

Definition at line 26 of file CSCReadoutMapping.cc.

References chamber(), CSCDetId::chamber(), CSCDetId::endcap(), CSCDetId::ring(), and CSCDetId::station().

00027                           {
00028 
00029   // Find CSCDetId index of chamber corresponding to the hardware readout arguments
00030   int cid = chamber( endcap, station, vme, dmb, tmb );
00031 
00032   // Decode the individual labels
00033   // ... include endcap & station for MTCC when they are unique in the mapping file
00034   // and so do not need to be specified as input arguments
00035       endcap  = CSCDetId::endcap( cid );
00036       station = CSCDetId::station( cid );
00037   int chamber = CSCDetId::chamber( cid );
00038   int ring    = CSCDetId::ring( cid );
00039 
00040   // Now sort out ME1a from ME11-combined
00041   // cfeb =0-3 for ME1b, cfeb=4 for ME1a
00042   if ( station == 1  && ring == 1 && cfeb == 4 ) {
00043       // This is ME1a region
00044       ring = 4; // reset from 1 to 4 which flags ME1a
00045   }
00046   return CSCDetId( endcap, station, ring, chamber, layer );
00047 }

int CSCReadoutMapping::dmbId ( const CSCDetId id  )  const

returns dmbId given CSCDetId

Definition at line 93 of file CSCReadoutMapping.cc.

References CSCReadoutMapping::CSCLabel::dmb_, and findHardwareId().

00093                                                       {
00094   CSCLabel hid = findHardwareId(id);
00095   return hid.dmb_;
00096 }

virtual void CSCReadoutMapping::fill ( const edm::ParameterSet  )  [pure virtual]

Fill mapping store.

Implemented in CSCReadoutMappingFromFile.

CSCReadoutMapping::CSCLabel CSCReadoutMapping::findHardwareId ( const CSCDetId id  )  const

returns hardware ids given chamber id

Search for that sw id in mapping

Definition at line 73 of file CSCReadoutMapping.cc.

References chamber(), GeomDetEnumerators::endcap, it, CSCDetId::rawIdMaker(), and sw2hw_.

Referenced by crate(), dccId(), dduId(), and dmbId().

00073                                                                                     {
00074   CSCLabel hid;
00075   int sid=CSCDetId::rawIdMaker(id.endcap(), id.station(), id.ring(), id.chamber(), 0 );  
00077   std::map<int,CSCLabel>::const_iterator it = sw2hw_.find( sid );
00078   if ( it != sw2hw_.end() ) {
00079     hid = it->second;
00080     //    std::cout << "hwid = " << hid << ", swid = " << cid << std::endl;
00081     //    LogDebug("CSC") << " for requested hw id = " << hid << ", found sw id = " << cid;
00082   }
00083   else {
00084     edm::LogError("CSC") << " cannot find requested sw id = " << id << " in mapping.";
00085   }
00086   return hid;
00087 }

virtual int CSCReadoutMapping::hwId ( int  endcap,
int  station,
int  vme,
int  dmb,
int  tmb 
) const [private, pure virtual]

Build a unique integer out of the readout electronics labels.

In general this must depend on endcap and station, as well as vme crate number and dmb slot number. And possibly tmb slot?

Implemented in CSCReadoutMappingForSliceTest.

Referenced by addRecord(), and chamber().

const std::string& CSCReadoutMapping::myName ( void   )  const [inline]

Return class name.

Definition at line 109 of file CSCReadoutMapping.h.

References myName_.

00109 { return myName_; }

void CSCReadoutMapping::setDebugV ( bool  dbg  )  [inline]

Set debug printout flag.

Definition at line 99 of file CSCReadoutMapping.h.

References debugV_.

00099 { debugV_ = dbg; }

int CSCReadoutMapping::swId ( int  endcap,
int  station,
int  ring,
int  chamber 
) const [private]

Build a unique integer out of chamber labels.

We'll probably use rawId of CSCDetId... You know it makes sense!

Definition at line 68 of file CSCReadoutMapping.cc.

References CSCDetId::rawIdMaker().

Referenced by addRecord().

00068                                                                                   {
00069   // Software id is just CSCDetId for the chamber - but no distinction within ME11
00070   return CSCDetId::rawIdMaker( endcap, station, ring, chamber, 0 ); // usual detid for chamber, i.e. layer=0
00071 }


Member Data Documentation

bool CSCReadoutMapping::debugV_ [private]

Definition at line 129 of file CSCReadoutMapping.h.

Referenced by debugV(), and setDebugV().

std::map< int, int > CSCReadoutMapping::hw2sw_ [private]

Definition at line 131 of file CSCReadoutMapping.h.

Referenced by addRecord(), and chamber().

std::vector< CSCLabel > CSCReadoutMapping::mapping_ [private]

Definition at line 130 of file CSCReadoutMapping.h.

Referenced by addRecord().

std::string CSCReadoutMapping::myName_ [private]

Definition at line 128 of file CSCReadoutMapping.h.

Referenced by myName().

std::map< int, CSCLabel > CSCReadoutMapping::sw2hw_ [private]

Definition at line 132 of file CSCReadoutMapping.h.

Referenced by addRecord(), and findHardwareId().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:17:24 2009 for CMSSW by  doxygen 1.5.4