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/DTSequentialLayerNumber.h" 00014 00015 //------------------------------- 00016 // Collaborating Class Headers -- 00017 //------------------------------- 00018 00019 00020 //--------------- 00021 // C++ Headers -- 00022 //--------------- 00023 00024 00025 //------------------- 00026 // Initializations -- 00027 //------------------- 00028 int DTSequentialLayerNumber::layersPerWheel = 0; 00029 int DTSequentialLayerNumber::layersPerSector = 0; 00030 int DTSequentialLayerNumber::layersIn13Sectors = 0; 00031 00032 int* DTSequentialLayerNumber::offsetChamber = 0; 00033 00034 DTSequentialLayerNumber DTSequentialLayer; 00035 00036 00037 //---------------- 00038 // Constructors -- 00039 //---------------- 00040 DTSequentialLayerNumber::DTSequentialLayerNumber() { 00041 if ( offsetChamber == 0 ) { 00042 offsetChamber = new int[5]; 00043 offsetChamber[1] = 0; 00044 offsetChamber[2] = 12; 00045 offsetChamber[3] = 24; 00046 offsetChamber[4] = 36; 00047 layersPerSector = 44; 00048 layersIn13Sectors = ( layersPerSector * 12 ) + 8; 00049 layersPerWheel = layersIn13Sectors + 8; 00050 } 00051 } 00052 00053 00054 //-------------- 00055 // Destructor -- 00056 //-------------- 00057 DTSequentialLayerNumber::~DTSequentialLayerNumber() { 00058 } 00059 00060 00061 int DTSequentialLayerNumber::id( int wheel, 00062 int station, 00063 int sector, 00064 int superlayer, 00065 int layer ) { 00066 00067 wheel += 3; 00068 if ( wheel <= 0 ) return -1; 00069 if ( station <= 0 ) return -2; 00070 if ( sector <= 0 ) return -3; 00071 if ( superlayer <= 0 ) return -4; 00072 if ( layer <= 0 ) return -5; 00073 00074 int seqLayerNum = 0; 00075 00076 if ( wheel > 5 ) return -1; 00077 seqLayerNum += ( wheel - 1 ) * layersPerWheel; 00078 00079 if ( sector > 14 ) return -2; 00080 if ( sector > 12 && 00081 station < 4 ) return -2; 00082 if ( sector > 13 ) seqLayerNum += layersIn13Sectors; 00083 else 00084 seqLayerNum += ( sector - 1 ) * layersPerSector; 00085 00086 if ( station > 4 ) return -3; 00087 if ( sector < 13 ) 00088 seqLayerNum += offsetChamber[station]; 00089 00090 if ( superlayer > 3 ) return -4; 00091 if ( layer > 4 ) return -5; 00092 if ( superlayer != 2 ) { 00093 if ( superlayer == 3 ) layer += 4; 00094 } 00095 else { 00096 if ( station == 4 ) return -4; 00097 layer += 8; 00098 } 00099 00100 return seqLayerNum + layer; 00101 00102 } 00103 00104 00105 int DTSequentialLayerNumber::max() { 00106 return 5 * layersPerWheel; 00107 } 00108 00109