CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/Alignment/TrackerAlignment/interface/TIBNameSpace.h

Go to the documentation of this file.
00001 #ifndef Alignment_CommonAlignment_TIBNameSpace_H
00002 #define Alignment_CommonAlignment_TIBNameSpace_H
00003 
00015 #include "CondFormats/Alignment/interface/Definitions.h"
00016 #include "DataFormats/SiStripDetId/interface/TIBDetId.h"
00017 
00018 namespace align
00019 {
00020   namespace tib
00021   {
00023     const unsigned int sphs[] = {13, 15, 17, 19, 22, 23, 26, 28};
00024 
00026     inline unsigned int moduleNumber( align::ID );
00027 
00030     inline unsigned int stringNumber( align::ID );
00031 
00033     inline unsigned int surfaceNumber( align::ID );
00034 
00036     inline unsigned int halfShellNumber( align::ID );
00037 
00039     inline unsigned int layerNumber( align::ID );
00040 
00042     inline unsigned int halfBarrelNumber( align::ID );
00043   }
00044 }
00045 
00046 unsigned int align::tib::moduleNumber(align::ID id)
00047 {
00048   return TIBDetId(id).module();
00049 }
00050 
00051 unsigned int align::tib::stringNumber(align::ID id)
00052 {
00053   TIBDetId detId(id);
00054 
00055   std::vector<unsigned int> s = detId.string();
00056   // s[1]: surface lower = 1, upper = 2
00057   // s[2]: string no. increases with phi
00058 
00059   unsigned int l = 2 * (detId.layer() - 1) + s[1] - 1;
00060 
00061 // String on +y surface: number = s                (1 to sphs)
00062 // String in -y surface: number = 2 * sphs + 1 - s (1 to sphs)
00063 
00064   return s[2] > sphs[l] ? 2 * sphs[l] + 1 - s[2] : s[2];
00065 }
00066 
00067 unsigned int align::tib::surfaceNumber(align::ID id)
00068 {
00069   return TIBDetId(id).string()[1];
00070 }
00071 
00072 unsigned int align::tib::halfShellNumber(align::ID id)
00073 {
00074   TIBDetId detId(id);
00075 
00076   std::vector<unsigned int> s = detId.string();
00077   // s[1]: surface lower = 1, upper = 2
00078   // s[2]: string no. increases with phi
00079 
00080   unsigned int l = 2 * (detId.layer() - 1) + s[1] - 1;
00081 
00082   return s[2] > sphs[l] ? 1 : 2;
00083 }
00084 
00085 unsigned int align::tib::layerNumber(align::ID id)
00086 {
00087   return TIBDetId(id).layer();
00088 }
00089 
00090 unsigned int align::tib::halfBarrelNumber(align::ID id)
00091 {
00092   return TIBDetId(id).string()[0];
00093 }
00094 
00095 #endif