CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/Alignment/TrackerAlignment/interface/TPBNameSpace.h

Go to the documentation of this file.
00001 #ifndef Alignment_TrackerAlignment_TPBNameSpace_H
00002 #define Alignment_TrackerAlignment_TPBNameSpace_H
00003 
00015 #include "CondFormats/Alignment/interface/Definitions.h"
00016 #include "DataFormats/SiPixelDetId/interface/PXBDetId.h"
00017 
00018 namespace align
00019 {
00020   namespace tpb
00021   {
00023     const unsigned int lpqc[] = {5, 8, 11};
00024 
00026     inline unsigned int moduleNumber( align::ID );
00027 
00030     inline unsigned int ladderNumber( align::ID );
00031 
00033     inline unsigned int layerNumber( align::ID );
00034 
00036     inline unsigned int halfBarrelNumber( align::ID );
00037   }
00038 }
00039 
00040 unsigned int align::tpb::moduleNumber(align::ID id)
00041 {
00042   return PXBDetId(id).module();
00043 }
00044 
00045 unsigned int align::tpb::ladderNumber(align::ID id)
00046 {
00047   PXBDetId detId(id);
00048 
00049   unsigned int l = detId.ladder(); // increases with phi
00050   unsigned int c = detId.layer() - 1;
00051 
00052 // Ladder in 1st quadrant: number = lpqc + 1 - l     (1 to lpqc)
00053 // Ladder in 2nd quadrant: number = l - lpqc         (1 to lpqc)
00054 // Ladder in 3rd quadrant: number = l - lpqc         (lpqc + 1 to 2 * lpqc)
00055 // Ladder in 4th quadrant: number = 5 * lpqc + 1 - l (lpqc + 1 to 2 * lpqc)
00056 
00057   return l > 3 * lpqc[c] ? // ladder in 4th quadrant
00058     5 * lpqc[c] + 1 - l :
00059     (l > lpqc[c] ? // ladder not in 1st quadrant
00060      l - lpqc[c] : lpqc[c] + 1 - l);
00061 }
00062 
00063 unsigned int align::tpb::layerNumber(align::ID id)
00064 {
00065   return PXBDetId(id).layer();
00066 }
00067 
00068 unsigned int align::tpb::halfBarrelNumber(align::ID id)
00069 {
00070   PXBDetId detId(id);
00071 
00072   unsigned int l = detId.ladder(); // increases with phi
00073   unsigned int c = detId.layer() - 1;
00074 
00075   return l > lpqc[c] && l <= 3 * lpqc[c] ? 1 : 2;
00076 }
00077 
00078 #endif