Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "CondFormats/CSCObjects/interface/CSCChannelTranslator.h"
0002 
0003 int CSCChannelTranslator::rawStripChannel(const CSCDetId& id, int igeo) const {
0004   // Translate a geometry-oriented strip channel in range 1-80, igeo,
0005   // into corresponding raw channel.
0006 
0007   int iraw = igeo;
0008 
0009   bool zplus = (id.endcap() == 1);
0010 
0011   bool me1a = (id.station() == 1) && (id.ring() == 4);
0012   bool me1b = (id.station() == 1) && (id.ring() == 1);
0013 
0014   if (me1a && zplus) {
0015     iraw = 17 - iraw;
0016   }  // 1-16 -> 16-1
0017   if (me1b && !zplus) {
0018     iraw = 65 - iraw;
0019   }  // 1-64 -> 64-1
0020   if (me1a) {
0021     iraw += 64;
0022   }  // set 1-16 to 65-80
0023 
0024   return iraw;
0025 }
0026 
0027 int CSCChannelTranslator::geomStripChannel(const CSCDetId& id, int iraw) const {
0028   // Translate a raw strip channel in range 1-80, iraw,  into
0029   // corresponding geometry-oriented channel in which increasing
0030   // channel number <-> strip number increasing with +ve local x.
0031 
0032   int igeo = iraw;
0033 
0034   bool zplus = (id.endcap() == 1);
0035   bool me11 = (id.station() == 1) && (id.ring() == 1);
0036   bool me1a = me11 && (iraw > 64);
0037   bool me1b = me11 && (iraw <= 64);
0038 
0039   if (me1a)
0040     igeo -= 64;  // 65-80 -> 1-16
0041   //if ( me1a ) igeo %= 64; // 65-80 -> 1-16
0042   if (me1a && zplus) {
0043     igeo = 17 - igeo;
0044   }  // 65-80 -> 16-1
0045   if (me1b && !zplus) {
0046     igeo = 65 - igeo;
0047   }  // 1-64 -> 64-1
0048 
0049   return igeo;
0050 }
0051 
0052 int CSCChannelTranslator::channelFromStrip(const CSCDetId& id, int strip) const {
0053   // This just returns the electronics channel label to which a given strip is connected
0054   // In all chambers but ME1A this is just a direct 1-1 correspondence.
0055   // In ME1A the 48 strips are ganged into 16 channels: 1+17+33->1, 2+18+34->2, ... 16+32+48->16.
0056   int ichan = strip;
0057   bool me1a = (id.station() == 1) && (id.ring() == 4);
0058   if (me1a && strip > 16)
0059     ichan = (strip - 1) % 16 + 1;  // gang the 48 to 16
0060   return ichan;
0061 }
0062 
0063 CSCDetId CSCChannelTranslator::rawCSCDetId(const CSCDetId& id) const {
0064   // Return the effective online CSCDetId for given offline CSCDetId
0065   // That means the same one except for ME1A, which online is part of ME11 (channels 65-80)
0066   CSCDetId idraw(id);
0067   bool me1a = (id.station() == 1) && (id.ring() == 4);
0068   if (me1a)
0069     idraw = CSCDetId(id.endcap(), id.station(), 1, id.chamber(), id.layer());
0070   return idraw;
0071 }