Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:15:27

0001 #include "Geometry/TrackerGeometryBuilder/interface/trackerHierarchy.h"
0002 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
0003 
0004 #include <string>
0005 #include <vector>
0006 
0007 std::string trackerHierarchy(const TrackerTopology* tTopo, unsigned int rawid) {
0008   DetId id(rawid);
0009   int subdetid = id.subdetId();
0010   switch (subdetid) {
0011       // PXB
0012     case PixelSubdetector::PixelBarrel: {
0013       char theLayer = tTopo->pxbLayer(id);
0014       char theLadder = tTopo->pxbLadder(id);
0015       char theModule = tTopo->pxbModule(id);
0016       char key[] = {1, theLayer, theLadder, theModule};
0017       return std::string(key, 4);
0018     }
0019 
0020       // P1XF
0021     case PixelSubdetector::PixelEndcap: {
0022       char thePanel = tTopo->pxfPanel(id);
0023       char theDisk = tTopo->pxfDisk(id);
0024       char theBlade = tTopo->pxfBlade(id);
0025       char theModule = tTopo->pxfModule(id);
0026       char key[] = {2, char(tTopo->pxfSide(id)), thePanel, theDisk, theBlade, theModule};
0027       return std::string(key, 6);
0028     }
0029 
0030     // TIB
0031     case StripSubdetector::TIB: {
0032       char theLayer = tTopo->tibLayer(id);
0033       std::vector<unsigned int> theString = tTopo->tibStringInfo(id);
0034       char theModule = tTopo->tibModule(id);
0035       //side = (theString[0] == 1 ) ? "-" : "+";
0036       //part = (theString[1] == 1 ) ? "int" : "ext";
0037       char key[] = {3,
0038                     theLayer,
0039                     char(theString[0]),
0040                     char(theString[1]),
0041                     char(theString[2]),
0042                     theModule,
0043                     char(tTopo->tibGlued(id) ? tTopo->tibIsStereo(id) + 1 : 0)};
0044       return std::string(key, tTopo->tibGlued(id) ? 7 : 6);
0045     }
0046 
0047       // TID
0048     case StripSubdetector::TID: {
0049       unsigned int theDisk = tTopo->tidWheel(id);
0050       unsigned int theRing = tTopo->tidRing(id);
0051       // side = (tTopo->tidSide(id) == 1 ) ? "-" : "+";
0052       // part = (tTopo->tidOrder(id) == 1 ) ? "back" : "front";
0053       char key[] = {4,
0054                     char(tTopo->tidSide(id)),
0055                     char(theDisk),
0056                     char(theRing),
0057                     char(tTopo->tidOrder(id)),
0058                     char(tTopo->tidModule(id)),
0059                     char(tTopo->tidGlued(id) ? tTopo->tidIsStereo(id) + 1 : 0)};
0060       return std::string(key, tTopo->tidGlued(id) ? 7 : 6);
0061     }
0062 
0063       // TOB
0064     case StripSubdetector::TOB: {
0065       unsigned int theLayer = tTopo->tobLayer(id);
0066       unsigned int theModule = tTopo->tobModule(id);
0067       //    side = (tTopo->side(id) == 1 ) ? "-" : "+";
0068       char key[] = {5,
0069                     char(theLayer),
0070                     char(tTopo->tobSide(id)),
0071                     char(tTopo->tobRod(id)),
0072                     char(theModule),
0073                     char(tTopo->tobGlued(id) ? tTopo->tobIsStereo(id) + 1 : 0)};
0074       return std::string(key, tTopo->tobGlued(id) ? 6 : 5);
0075     }
0076 
0077       // TEC
0078     case StripSubdetector::TEC: {
0079       unsigned int theWheel = tTopo->tecWheel(id);
0080       unsigned int theModule = tTopo->tecModule(id);
0081       unsigned int theRing = tTopo->tecRing(id);
0082       //    side  = (tTopo->tecSide(id) == 1 ) ? "-" : "+";
0083       //    petal = (tTopo->tecOrder(id) == 1 ) ? "back" : "front";
0084       // int out_side  = (tTopo->tecSide(id) == 1 ) ? -1 : 1;
0085 
0086       char key[] = {6,
0087                     char(tTopo->tecSide(id)),
0088                     char(theWheel),
0089                     char(tTopo->tecOrder(id)),
0090                     char(tTopo->tecPetalNumber(id)),
0091                     char(theRing),
0092                     char(theModule),
0093                     char(tTopo->tecGlued(id) ? tTopo->tecIsStereo(id) + 1 : 0)};
0094       return std::string(key, tTopo->tecGlued(id) ? 8 : 7);
0095     }
0096     default:
0097       return std::string();
0098   }
0099 }