CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Types

CSCTriggerNumbering Class Reference

#include <CSCTriggerNumbering.h>

List of all members.

Public Member Functions

 CSCTriggerNumbering ()
 ~CSCTriggerNumbering ()

Static Public Member Functions

static int chamberFromTriggerLabels (int TriggerSector, int TriggerSubSector, int station, int TriggerCSCID)
static int maxTriggerCscId ()
static int maxTriggerSectorId ()
static int maxTriggerSubSectorId ()
static int minTriggerCscId ()
static int minTriggerSectorId ()
static int minTriggerSubSectorId ()
static int ringFromTriggerLabels (int station, int triggerCSCID)
static int sectorFromTriggerLabels (int TriggerSector, int TriggerSubSector, int station)
static int triggerCscIdFromLabels (CSCDetId id)
static int triggerCscIdFromLabels (int station, int ring, int chamber)
static int triggerSectorFromLabels (CSCDetId id)
static int triggerSectorFromLabels (int station, int ring, int chamber)
static int triggerSubSectorFromLabels (int station, int chamber)
static int triggerSubSectorFromLabels (CSCDetId id)

Private Types

enum  eTrigMaxNum { MAX_TRIGSECTOR = 6, MAX_CSCID = 9, MAX_TRIGSUBSECTOR = 2 }
enum  eTrigMinNum { MIN_TRIGSECTOR = 1, MIN_CSCID = 1, MIN_TRIGSUBSECTOR = 0 }

Detailed Description

Converts standard trigger labels to geometry labels. "Standard" implies that the numbering is EXACTLY that of CMS NOTE: CMS IN 2000/004 v. 2.1 (Oct, 2005).

Warning:
EVERY INDEX COUNTS FROM ONE

Definition at line 15 of file CSCTriggerNumbering.h.


Member Enumeration Documentation

Enumerator:
MAX_TRIGSECTOR 
MAX_CSCID 
MAX_TRIGSUBSECTOR 

Definition at line 124 of file CSCTriggerNumbering.h.

Enumerator:
MIN_TRIGSECTOR 
MIN_CSCID 
MIN_TRIGSUBSECTOR 

Definition at line 127 of file CSCTriggerNumbering.h.


Constructor & Destructor Documentation

CSCTriggerNumbering::CSCTriggerNumbering ( )
CSCTriggerNumbering::~CSCTriggerNumbering ( )

Member Function Documentation

int CSCTriggerNumbering::chamberFromTriggerLabels ( int  TriggerSector,
int  TriggerSubSector,
int  station,
int  TriggerCSCID 
) [static]

chamberFromTriggerLabels

This function calculates the chamber number for a given set of trigger labels.

Definition at line 33 of file CSCTriggerNumbering.cc.

References Exception, MAX_CSCID, MAX_TRIGSECTOR, MAX_TRIGSUBSECTOR, CSCDetId::maxStationId(), and CSCDetId::minStationId().

Referenced by CSCTriggerPrimitivesBuilder::build(), CSCTriggerGeomManager::chamber(), CSCAnodeLCTProcessor::dumpDigis(), CSCCathodeLCTProcessor::dumpDigis(), CSCAnodeLCTProcessor::getDigis(), CSCCathodeLCTProcessor::getDigis(), CSCTriggerSimpleMapping::hwId(), csc::L1TrackId::L1TrackId(), CSCAnodeLCTProcessor::lctSearch(), CSCAnodeLCTProcessor::run(), CSCCathodeLCTProcessor::run(), CSCTriggerGeomManager::sectorOfChambersInStation(), and CSCTriggerMapping::swId().

{
  if(TriggerSector    < MIN_TRIGSECTOR           || TriggerSector    > MAX_TRIGSECTOR           ||
     TriggerSubSector < MIN_TRIGSUBSECTOR        || TriggerSubSector > MAX_TRIGSUBSECTOR        ||
     station          < CSCDetId::minStationId() || station          > CSCDetId::maxStationId() ||
     TriggerCSCID     < MIN_CSCID                || TriggerCSCID     > MAX_CSCID)
    throw cms::Exception("CSCTriggerNumbering::InvalidInput") << "CSCTriggerNumbering::chamberFromTriggerLabels():"
                                                              << " Trigger Sector: " << TriggerSector 
                                                              << " Trigger SubSector: " << TriggerSubSector
                                                              << " Station: " << station
                                                              << " TriggerCSCID: " << TriggerCSCID
                                                              << " is not a valid set of labels."
                                                              << " Cannot Convert!!";
    

  int chamber = 0;
  int realsubsector = (TriggerSubSector + 2*(TriggerSector - 1))%12 + 1; // station 1 only

  if(station != 1)
    if(TriggerCSCID <= 3)
      chamber = (TriggerCSCID + 3*(TriggerSector - 1))%18 + 1; // Derived from CMS Note: CMS IN 2000/04 ver 2.1 Oct/2005
                                                               // As far as I know this is reality.
    else
      chamber = (TriggerCSCID + 6*(TriggerSector - 1) - 2)%36 + 1;
  else
    if(TriggerCSCID <= 3)
      chamber = (TriggerCSCID + 3*(realsubsector - 1)+34)%36 + 1;
    else if(TriggerCSCID <= 6)
      chamber = (TriggerCSCID + 3*(realsubsector - 1)+31)%36 + 1;
    else
      chamber = (TriggerCSCID + 3*(realsubsector - 1)+28)%36 + 1;

  return chamber;
}
static int CSCTriggerNumbering::maxTriggerCscId ( ) [inline, static]
static int CSCTriggerNumbering::maxTriggerSectorId ( ) [inline, static]
static int CSCTriggerNumbering::maxTriggerSubSectorId ( ) [inline, static]

Definition at line 116 of file CSCTriggerNumbering.h.

References MAX_TRIGSUBSECTOR.

{ return MAX_TRIGSUBSECTOR; }
static int CSCTriggerNumbering::minTriggerCscId ( ) [inline, static]
static int CSCTriggerNumbering::minTriggerSectorId ( ) [inline, static]
static int CSCTriggerNumbering::minTriggerSubSectorId ( ) [inline, static]

Definition at line 117 of file CSCTriggerNumbering.h.

References MIN_TRIGSUBSECTOR.

{ return MIN_TRIGSUBSECTOR+1; }
int CSCTriggerNumbering::ringFromTriggerLabels ( int  station,
int  triggerCSCID 
) [static]

The following functions transform trigger labels into their corresponding standard chamber labels. ringFromTriggerLabels

This function calculates the ring at which a given chamber resides. Station 1: ring = [1,3] Station 2-4: ring = [1,2]

Definition at line 5 of file CSCTriggerNumbering.cc.

References Exception, MAX_CSCID, CSCDetId::maxStationId(), CSCDetId::minStationId(), and relativeConstraints::ring.

Referenced by CSCTriggerPrimitivesBuilder::build(), CSCSectorReceiverLUT::calcGlobalEtaME(), CSCTriggerGeomManager::chamber(), CSCAnodeLCTProcessor::dumpDigis(), CSCCathodeLCTProcessor::dumpDigis(), CSCAnodeLCTProcessor::getDigis(), CSCCathodeLCTProcessor::getDigis(), CSCSectorReceiverLUT::getGlobalEtaValue(), CSCMotherboard::getLCTs(), CSCTriggerSimpleMapping::hwId(), CSCAnodeLCTProcessor::lctSearch(), CSCAnodeLCTProcessor::run(), CSCCathodeLCTProcessor::run(), CSCTriggerGeomManager::sectorOfChambersInStation(), and CSCTriggerMapping::swId().

{
  if(station      < CSCDetId::minStationId() || station      > CSCDetId::maxStationId() ||
     triggerCSCID < MIN_CSCID                || triggerCSCID > MAX_CSCID)
    throw cms::Exception("CSCTriggerNumbering::InvalidInput") << "CSCTriggerNumbering::ringFromTriggerLabels():"
                                                              << " Station: " << station
                                                              << " TriggerCSCID: " << triggerCSCID
                                                              << " is not a valid set of labels."
                                                              << " Cannot Convert!!";

  int ring = 0;

  if(station == 1)
    if(triggerCSCID <= 3)
      ring = 1; 
    else if(triggerCSCID <= 6)
      ring = 2;
    else
      ring = 3;
  else
    if(triggerCSCID <= 3)
      ring = 1;
    else 
      ring = 2;
  
  return ring;  
}
int CSCTriggerNumbering::sectorFromTriggerLabels ( int  TriggerSector,
int  TriggerSubSector,
int  station 
) [static]

sectorFromTriggerLabels

Translates trigger sector and trigger subsector into the "real" sector number For station 1 sector = [1,12] For stations 2-4 sector = [1,6]

Definition at line 68 of file CSCTriggerNumbering.cc.

References Exception, MAX_TRIGSECTOR, MAX_TRIGSUBSECTOR, CSCDetId::maxStationId(), and CSCDetId::minStationId().

Referenced by MuonScenarioBuilder::moveCSCSectors().

{
  if(TriggerSector    < MIN_TRIGSECTOR           || TriggerSector    > MAX_TRIGSECTOR           ||
     TriggerSubSector < MIN_TRIGSUBSECTOR        || TriggerSubSector > MAX_TRIGSUBSECTOR        ||
     station          < CSCDetId::minStationId() || station          > CSCDetId::maxStationId())
    throw cms::Exception("CSCTriggerNumbering::InvalidInput") << "CSCTriggerNumbering::sectorFromTriggerLabels():"
                                                              << " Trigger Sector: " << TriggerSector 
                                                              << " Trigger SubSector: " << TriggerSubSector
                                                              << " Station: " << station
                                                              << " is not a valid set of labels."
                                                              << " Cannot Convert!!";

  return ((station == 1) ? ((TriggerSubSector + 2*(TriggerSector - 1))%12 + 1) : TriggerSector);
}
int CSCTriggerNumbering::triggerCscIdFromLabels ( CSCDetId  id) [static]

Definition at line 190 of file CSCTriggerNumbering.cc.

References relativeConstraints::ring, relativeConstraints::station, and triggerCscIdFromLabels().

{
  return triggerCscIdFromLabels(id.station(),id.ring(),id.chamber());
}
int CSCTriggerNumbering::triggerCscIdFromLabels ( int  station,
int  ring,
int  chamber 
) [static]

Return trigger-level CSC id within a sector for an Endcap Muon chamber.

This id is an index within a sector such that the 3 inner ring chambers (20 degrees each) are 1, 2, 3 (increasing counterclockwise) and the 6 outer ring chambers (10 degrees each) are 4, 5, 6, 7, 8, 9 (again increasing counter-clockwise.)

This method knows which chambers are part of which sector and returns the chamber label/index/identifier accordingly. Beware that this information is liable to change according to hardware and software changes.

Definition at line 152 of file CSCTriggerNumbering.cc.

References Exception, CSCDetId::maxChamberId(), CSCDetId::maxRingId(), CSCDetId::maxStationId(), CSCDetId::minChamberId(), CSCDetId::minRingId(), CSCDetId::minStationId(), and query::result.

Referenced by csctf::TrackStub::cscid(), csctf::TrackStub::cscidSeparateME1a(), and triggerCscIdFromLabels().

{
  if(station < CSCDetId::minStationId() || station > CSCDetId::maxStationId() ||
     ring    < CSCDetId::minRingId()    || ring    > CSCDetId::maxRingId()    ||
     chamber < CSCDetId::minChamberId() || chamber > CSCDetId::maxChamberId())
    throw cms::Exception("CSCTriggerNumbering::InvalidInput") << "CSCTriggerNumbering::triggerSectorFromLabels():"
                                                              << " Station: " << station
                                                              << " Ring: " << ring
                                                              << " Chamber: " << chamber
                                                              << " is not a valid set of labels."
                                                              << " Cannot Convert!!";

  int result;

  if( station == 1 ) {
    result = (chamber) % 3 + 1; // 1,2,3
    switch (ring) {
    case 1:
      break;
    case 2:
      result += 3; // 4,5,6
      break;
    case 3:
      result += 6; // 7,8,9
      break;
    }
  }
  else {
    if( ring == 1 ) {
      result = (chamber+1) % 3 + 1; // 1,2,3
    }
    else {
      result = (chamber+3) % 6 + 4; // 4,5,6,7,8,9
    }
  }
  return result;
}
int CSCTriggerNumbering::triggerSectorFromLabels ( CSCDetId  id) [static]
int CSCTriggerNumbering::triggerSectorFromLabels ( int  station,
int  ring,
int  chamber 
) [static]

The following functions transform standard chamber labels into their corresponding trigger labels. Return trigger-level sector id for an Endcap Muon chamber.

This method encapsulates the information about which chambers are in which sectors, and may need updating according to hardware changes, or software chamber indexing.

Station 1 has 3 rings of 10-degree chambers.
Stations 2, 3, 4 have an inner ring of 20-degree chambers and an outer ring of 10-degree chambers.

Sectors are 60 degree slices of a station, covering both rings.
For Station 1, there are subsectors of 30 degrees: 9 10-degree chambers (3 each from ME1/1, ME1/2, ME1/3.)

The first sector starts at phi = 15 degrees so it matches Barrel Muon sectors. We count from one not zero.

Definition at line 83 of file CSCTriggerNumbering.cc.

References Exception, CSCDetId::maxChamberId(), CSCDetId::maxRingId(), CSCDetId::maxStationId(), CSCDetId::minChamberId(), CSCDetId::minRingId(), CSCDetId::minStationId(), and query::result.

Referenced by MuonScenarioBuilder::moveCSCSectors(), csctf::TrackStub::sector(), csc::L1TrackId::sector(), and triggerSectorFromLabels().

{
  if(station < CSCDetId::minStationId() || station > CSCDetId::maxStationId() ||
     ring    < CSCDetId::minRingId()    || ring    > CSCDetId::maxRingId()    ||
     chamber < CSCDetId::minChamberId() || chamber > CSCDetId::maxChamberId())
    throw cms::Exception("CSCTriggerNumbering::InvalidInput") << "CSCTriggerNumbering::triggerSectorFromLabels():"
                                                              << " Station: " << station
                                                              << " Ring: " << ring
                                                              << " Chamber: " << chamber
                                                              << " is not a valid set of labels."
                                                              << " Cannot Convert!!";


  int result;
  // This version 16-Nov-99 ptc to match simplified chamber labelling for cms116
  //@@ REQUIRES UPDATE TO 2005 REALITY, ONCE I UNDERSTAND WHAT THAT IS
  // UPDATED - LGRAY Feb 2006
  
  if(station > 1 && ring > 1 ) {
    result = ((static_cast<unsigned>(chamber-3) & 0x7f) / 6) + 1; // ch 3-8->1, 9-14->2, ... 1,2 -> 6
  }
  else {
    result =  (station != 1) ? ((static_cast<unsigned>(chamber-2) & 0x1f) / 3) + 1 : // ch 2-4-> 1, 5-7->2, ...
              ((static_cast<unsigned>(chamber-3) & 0x7f) / 6) + 1;
  }

  return (result <= 6) ? result : 6; // Max sector is 6, some calculations give a value greater than six but this is expected
                                     // and delt with.
}
int CSCTriggerNumbering::triggerSubSectorFromLabels ( int  station,
int  chamber 
) [static]

Return trigger-level sub sector id within a sector in station one.

Each station one sector has two 30 degree subsectors. Again, we count from one, not zero. Zero is an allowed return value though.

A return value of zero means this station does not have subsectors.

Definition at line 118 of file CSCTriggerNumbering.cc.

References Exception, CSCDetId::maxChamberId(), CSCDetId::maxStationId(), CSCDetId::minChamberId(), and CSCDetId::minStationId().

Referenced by CSCTFAnalyzer::analyze(), L1TCSCTF::analyze(), CSCTFTrackBuilder::buildTracks(), CSCTFSPCoreLogic::loadData(), MuonScenarioBuilder::moveCSCSectors(), CSCTFPacker::produce(), CSCTFSectorProcessor::run(), csctf::TrackStub::subsector(), and triggerSubSectorFromLabels().

{
  if(station < CSCDetId::minStationId() || station > CSCDetId::maxStationId() ||
     chamber < CSCDetId::minChamberId() || chamber > CSCDetId::maxChamberId())
    throw cms::Exception("CSCTriggerNumbering::InvalidInput") << "CSCTriggerNumbering::triggerSectorFromLabels():"
                                                              << " Station: " << station
                                                              << " Chamber: " << chamber
                                                              << " is not a valid set of labels."
                                                              << " Cannot Convert!!";

  if(station != 1) return 0; // only station one has subsectors

  switch(chamber) // first make things easier to deal with
    {
    case 1:
      chamber = 36;
      break;
    case 2:
      chamber = 35;
      break;
    default:
      chamber -= 2;
    }

  chamber = ((chamber-1)%6) + 1; // renumber all chambers to 1-6

  return ((chamber-1) / 3) + 1; // [1,3] -> 1 , [4,6]->2
}
int CSCTriggerNumbering::triggerSubSectorFromLabels ( CSCDetId  id) [static]

Definition at line 147 of file CSCTriggerNumbering.cc.

References relativeConstraints::station, and triggerSubSectorFromLabels().

{
  return triggerSubSectorFromLabels(id.station(),id.chamber());
}