CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/CondFormats/CSCObjects/src/CSCChannelTranslator.cc

Go to the documentation of this file.
00001 #include "CondFormats/CSCObjects/interface/CSCChannelTranslator.h"
00002 
00003 int CSCChannelTranslator::rawStripChannel( const CSCDetId& id, int igeo ) const {
00004 
00005   // Translate a geometry-oriented strip channel in range 1-80, igeo,
00006   // into corresponding raw channel.
00007 
00008   int iraw = igeo;
00009 
00010   bool zplus = (id.endcap()==1); 
00011 
00012   bool me1a = (id.station()==1) && (id.ring()==4);
00013   bool me1b = (id.station()==1) && (id.ring()==1);
00014 
00015   if ( me1a && zplus ) { iraw = 17 - iraw; } // 1-16 -> 16-1
00016   if ( me1b && !zplus) { iraw = 65 - iraw; }  // 1-64 -> 64-1
00017   if ( me1a ) { iraw += 64 ;} // set 1-16 to 65-80 
00018 
00019   return iraw;
00020 }
00021 
00022 
00023 int CSCChannelTranslator::geomStripChannel( const CSCDetId& id, int iraw ) const {
00024   // Translate a raw strip channel in range 1-80, iraw,  into 
00025   // corresponding geometry-oriented channel in which increasing
00026   // channel number <-> strip number increasing with +ve local x.
00027 
00028   int igeo = iraw;
00029 
00030   bool zplus = (id.endcap()==1); 
00031   bool me11 = (id.station()==1) && (id.ring()==1);
00032   bool me1a = me11 && (iraw > 64);
00033   bool me1b = me11 && (iraw <= 64);
00034 
00035   if ( me1a ) igeo -= 64; // 65-80 -> 1-16
00036   //if ( me1a ) igeo %= 64; // 65-80 -> 1-16
00037   if ( me1a && zplus ) { igeo = 17 - igeo; } // 65-80 -> 16-1
00038   if ( me1b && !zplus) { igeo = 65 - igeo; }  // 1-64 -> 64-1
00039 
00040   return igeo;
00041 }
00042 
00043 int CSCChannelTranslator::channelFromStrip( const CSCDetId& id, int strip ) const {
00044   // This just returns the electronics channel label to which a given strip is connected
00045   // In all chambers but ME1A this is just a direct 1-1 correspondence.
00046   // In ME1A the 48 strips are ganged into 16 channels: 1+17+33->1, 2+18+34->2, ... 16+32+48->16.
00047   int ichan = strip;
00048   bool me1a = (id.station()==1) && (id.ring()==4);
00049   if ( me1a && strip>16 ) ichan = (strip-1)%16 + 1; // gang the 48 to 16
00050   return ichan;
00051 }
00052 
00053 CSCDetId CSCChannelTranslator::rawCSCDetId( const CSCDetId& id ) const {
00054   // Return the effective online CSCDetId for given offline CSCDetId
00055   // That means the same one except for ME1A, which online is part of ME11 (channels 65-80)
00056   CSCDetId idraw( id );
00057   bool me1a = (id.station()==1) && (id.ring()==4);
00058   if ( me1a ) idraw = CSCDetId( id.endcap(), id.station(), 1, id.chamber(), id.layer() );
00059   return idraw;   
00060 }