Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:51:03

0001 /*
0002  *  See header file for a description of this class.
0003  *
0004  *  $Date: 2010/05/06 16:23:00 $
0005  *  $Revision: 1.1 $
0006  *  \author Paolo Ronchese INFN Padova
0007  *
0008  */
0009 
0010 //----------------------
0011 // This Class' Header --
0012 //----------------------
0013 #include "CondFormats/DTObjects/interface/DTSequentialCellNumber.h"
0014 
0015 //-------------------------------
0016 // Collaborating Class Headers --
0017 //-------------------------------
0018 
0019 //---------------
0020 // C++ Headers --
0021 //---------------
0022 namespace {
0023   constexpr int cellsInTheta = 58;
0024   constexpr int cellsPerLayer[] = {0, 50, 60, 72, 96};
0025   constexpr int cellsInMB1 = (cellsPerLayer[1] * 8) + (cellsInTheta * 4);
0026   constexpr int cellsInMB2 = (cellsPerLayer[2] * 8) + (cellsInTheta * 4);
0027   constexpr int cellsInMB3 = (cellsPerLayer[3] * 8) + (cellsInTheta * 4);
0028   constexpr int cellsInMB4 = cellsPerLayer[4] * 8;
0029 
0030   constexpr int offsetChamber[] = {0, 0, cellsInMB1, cellsInMB1 + cellsInMB2, cellsInMB1 + cellsInMB2 + cellsInMB3};
0031   constexpr int cellsPerSector = cellsInMB1 + cellsInMB2 + cellsInMB3 + cellsInMB4;
0032   constexpr int cellsIn13Sectors = (cellsPerSector * 12) + cellsInMB4;
0033   constexpr int cellsPerWheel = cellsIn13Sectors + cellsInMB4;
0034 }  // namespace
0035 
0036 //--------------
0037 // Operations --
0038 //--------------
0039 int DTSequentialCellNumber::id(int wheel, int station, int sector, int superlayer, int layer, int cell) {
0040   wheel += 3;
0041   if (wheel <= 0)
0042     return -1;
0043   if (station <= 0)
0044     return -2;
0045   if (sector <= 0)
0046     return -3;
0047   if (superlayer <= 0)
0048     return -4;
0049   if (layer <= 0)
0050     return -5;
0051   if (cell <= 0)
0052     return -6;
0053 
0054   int seqWireNum = 0;
0055 
0056   if (wheel > 5)
0057     return -1;
0058   seqWireNum += (wheel - 1) * cellsPerWheel;
0059 
0060   if (sector > 14)
0061     return -2;
0062   if (sector > 12 && station < 4)
0063     return -2;
0064   if (sector > 13)
0065     seqWireNum += cellsIn13Sectors;
0066   else
0067     seqWireNum += (sector - 1) * cellsPerSector;
0068 
0069   if (station > 4)
0070     return -3;
0071   if (sector < 13)
0072     seqWireNum += offsetChamber[station];
0073 
0074   if (superlayer > 3)
0075     return -4;
0076   if (layer > 4)
0077     return -5;
0078   if (superlayer != 2) {
0079     if (cell > cellsPerLayer[station])
0080       return -6;
0081     if (superlayer == 3)
0082       layer += 4;
0083     seqWireNum += (layer - 1) * cellsPerLayer[station];
0084   } else {
0085     if (station == 4)
0086       return -4;
0087     if (cell > cellsInTheta)
0088       return -6;
0089     seqWireNum += (8 * cellsPerLayer[station]) + ((layer - 1) * cellsInTheta);
0090   }
0091 
0092   return seqWireNum + cell;
0093 }
0094 
0095 int DTSequentialCellNumber::max() { return 5 * cellsPerWheel; }