00001 /* 00002 * See header file for a description of this class. 00003 * 00004 * $Date: 2010/05/06 14:41:14 $ 00005 * $Revision: 1.1 $ 00006 * \author Paolo Ronchese INFN Padova 00007 * 00008 */ 00009 00010 //---------------------- 00011 // This Class' Header -- 00012 //---------------------- 00013 #include "CondFormats/DTObjects/interface/DTSequentialCellNumber.h" 00014 00015 //------------------------------- 00016 // Collaborating Class Headers -- 00017 //------------------------------- 00018 00019 00020 //--------------- 00021 // C++ Headers -- 00022 //--------------- 00023 00024 00025 //------------------- 00026 // Initializations -- 00027 //------------------- 00028 int DTSequentialCellNumber::cellsPerWheel = 0; 00029 int DTSequentialCellNumber::cellsPerSector = 0; 00030 int DTSequentialCellNumber::cellsIn13Sectors = 0; 00031 int DTSequentialCellNumber::cellsInTheta = 58; 00032 int DTSequentialCellNumber::cellsInMB1 = 0; 00033 int DTSequentialCellNumber::cellsInMB2 = 0; 00034 int DTSequentialCellNumber::cellsInMB3 = 0; 00035 int DTSequentialCellNumber::cellsInMB4 = 0; 00036 00037 int* DTSequentialCellNumber::offsetChamber = 0; 00038 int* DTSequentialCellNumber::cellsPerLayer = 0; 00039 00040 DTSequentialCellNumber DTSequentialCell; 00041 00042 00043 //---------------- 00044 // Constructors -- 00045 //---------------- 00046 DTSequentialCellNumber::DTSequentialCellNumber() { 00047 if ( cellsPerLayer == 0 ) { 00048 cellsPerLayer = new int[5]; 00049 cellsPerLayer[1] = 50; 00050 cellsPerLayer[2] = 60; 00051 cellsPerLayer[3] = 72; 00052 cellsPerLayer[4] = 96; 00053 } 00054 if ( offsetChamber == 0 ) { 00055 offsetChamber = new int[5]; 00056 cellsInMB1 = ( cellsPerLayer[1] * 8 ) + ( cellsInTheta * 4 ); 00057 cellsInMB2 = ( cellsPerLayer[2] * 8 ) + ( cellsInTheta * 4 ); 00058 cellsInMB3 = ( cellsPerLayer[3] * 8 ) + ( cellsInTheta * 4 ); 00059 cellsInMB4 = cellsPerLayer[4] * 8; 00060 offsetChamber[1] = 0; 00061 offsetChamber[2] = cellsInMB1; 00062 offsetChamber[3] = cellsInMB1 + cellsInMB2; 00063 offsetChamber[4] = cellsInMB1 + cellsInMB2 + cellsInMB3; 00064 cellsPerSector = cellsInMB1 + cellsInMB2 + cellsInMB3 + cellsInMB4; 00065 cellsIn13Sectors = ( cellsPerSector * 12 ) + cellsInMB4; 00066 cellsPerWheel = cellsIn13Sectors + cellsInMB4; 00067 } 00068 } 00069 00070 00071 //-------------- 00072 // Destructor -- 00073 //-------------- 00074 DTSequentialCellNumber::~DTSequentialCellNumber() { 00075 } 00076 00077 00078 //-------------- 00079 // Operations -- 00080 //-------------- 00081 int DTSequentialCellNumber::id( int wheel, 00082 int station, 00083 int sector, 00084 int superlayer, 00085 int layer, 00086 int cell ) { 00087 00088 wheel += 3; 00089 if ( wheel <= 0 ) return -1; 00090 if ( station <= 0 ) return -2; 00091 if ( sector <= 0 ) return -3; 00092 if ( superlayer <= 0 ) return -4; 00093 if ( layer <= 0 ) return -5; 00094 if ( cell <= 0 ) return -6; 00095 00096 int seqWireNum = 0; 00097 00098 if ( wheel > 5 ) return -1; 00099 seqWireNum += ( wheel - 1 ) * cellsPerWheel; 00100 00101 if ( sector > 14 ) return -2; 00102 if ( sector > 12 && 00103 station < 4 ) return -2; 00104 if ( sector > 13 ) seqWireNum += cellsIn13Sectors; 00105 else 00106 seqWireNum += ( sector - 1 ) * cellsPerSector; 00107 00108 if ( station > 4 ) return -3; 00109 if ( sector < 13 ) 00110 seqWireNum += offsetChamber[station]; 00111 00112 if ( superlayer > 3 ) return -4; 00113 if ( layer > 4 ) return -5; 00114 if ( superlayer != 2 ) { 00115 if ( cell > cellsPerLayer[station] ) return -6; 00116 if ( superlayer == 3 ) layer += 4; 00117 seqWireNum += ( layer - 1 ) * cellsPerLayer[station]; 00118 } 00119 else { 00120 if ( station == 4 ) return -4; 00121 if ( cell > cellsInTheta ) return -6; 00122 seqWireNum += ( 8 * cellsPerLayer[station] ) + 00123 ( ( layer - 1 ) * cellsInTheta ); 00124 } 00125 00126 return seqWireNum + cell; 00127 00128 } 00129 00130 00131 int DTSequentialCellNumber::max() { 00132 return 5 * cellsPerWheel; 00133 } 00134 00135