CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/Geometry/TrackerGeometryBuilder/src/trackerHierarchy.cc

Go to the documentation of this file.
00001 #include "DataFormats/SiPixelDetId/interface/PXBDetId.h"
00002 #include "DataFormats/SiPixelDetId/interface/PXFDetId.h"
00003 #include "DataFormats/SiStripDetId/interface/TIBDetId.h"
00004 #include "DataFormats/SiStripDetId/interface/TIDDetId.h"
00005 #include "DataFormats/SiStripDetId/interface/TOBDetId.h"
00006 #include "DataFormats/SiStripDetId/interface/TECDetId.h"
00007 
00008 #include<string>
00009 #include<vector>
00010 
00011 std::string trackerHierarchy(unsigned int rawid) {
00012   DetId id(rawid);
00013   int subdetid = id.subdetId();
00014   switch (subdetid) {
00015     
00016     // PXB
00017   case 1:
00018     {
00019       PXBDetId module(rawid);
00020       char theLayer  = module.layer();
00021       char theLadder = module.ladder();
00022       char theModule = module.module();
00023       char key[] = { 1, theLayer , theLadder, theModule};
00024       return std::string(key,4);
00025     }
00026     
00027     // P1XF
00028   case 2:
00029     {
00030       PXFDetId module(rawid);
00031       char thePanel  = module.panel();
00032       char theDisk   = module.disk();
00033       char theBlade  = module.blade();
00034       char theModule = module.module();
00035       char key[] = { 2,
00036                      char(module.side()),
00037                      thePanel , theDisk, 
00038                      theBlade, theModule};
00039       return std::string(key,6);
00040     }
00041   
00042   // TIB
00043   case 3:
00044     {
00045       TIBDetId module(rawid);
00046       char            theLayer  = module.layer();
00047       std::vector<unsigned int> theString = module.string();
00048       char             theModule = module.module();
00049       //side = (theString[0] == 1 ) ? "-" : "+";
00050       //part = (theString[1] == 1 ) ? "int" : "ext";
00051       char key[] = { 3, 
00052                      theLayer, 
00053                      char(theString[0]),
00054                      char(theString[1]), 
00055                      char(theString[2]), 
00056                      theModule,
00057                      char(module.glued() ? module.stereo()+1 : 0)
00058       };
00059       return std::string(key, module.glued() ? 7 : 6);
00060     }
00061     
00062     // TID
00063   case 4:
00064     {
00065       TIDDetId module(rawid);
00066       unsigned int         theDisk   = module.wheel();
00067       unsigned int         theRing   = module.ring();
00068       std::vector<unsigned int> theModule = module.module();
00069       // side = (module.side() == 1 ) ? "-" : "+";
00070       // part = (theModule[0] == 1 ) ? "back" : "front";
00071       char key[] = { 4, 
00072                      char(module.side()),
00073                      char(theDisk) , 
00074                      char(theRing),
00075                      char(theModule[0]), 
00076                      char(theModule[1]),
00077                      char(module.glued() ? module.stereo()+1 : 0)
00078       };
00079       return std::string(key,module.glued() ? 7 : 6);
00080     }
00081     
00082     // TOB
00083   case 5:
00084     {
00085       TOBDetId module(rawid);
00086       unsigned int              theLayer  = module.layer();
00087       std::vector<unsigned int> theRod    = module.rod();
00088       unsigned int              theModule = module.module();
00089       //        side = (theRod[0] == 1 ) ? "-" : "+";
00090       char key[] = { 5, char(theLayer) , 
00091                      char(theRod[0]), 
00092                      char(theRod[1]), 
00093                      char(theModule),
00094                      char(module.glued() ? module.stereo()+1 : 0)
00095       };
00096       return std::string(key, module.glued() ?  6 : 5);
00097     }
00098     
00099     // TEC
00100   case 6:
00101     {
00102       TECDetId module(rawid);
00103       unsigned int              theWheel  = module.wheel();
00104       unsigned int              theModule = module.module();
00105       std::vector<unsigned int> thePetal  = module.petal();
00106       unsigned int              theRing   = module.ring();
00107       //        side  = (module.side() == 1 ) ? "-" : "+";
00108       //        petal = (thePetal[0] == 1 ) ? "back" : "front";
00109       // int out_side  = (module.side() == 1 ) ? -1 : 1;
00110       
00111       char key[] = { 6, 
00112                      char(module.side()),
00113                      char(theWheel),
00114                      char(thePetal[0]), 
00115                      char(thePetal[1]),
00116                      char(theRing),
00117                      char(theModule),
00118                      char(module.glued() ? module.stereo()+1 : 0)
00119       };
00120       return std::string(key, module.glued() ? 8 : 7);
00121     }
00122   default:
00123     return std::string();
00124   }
00125 }