CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/TrackingTools/TrackAssociator/src/DetIdInfo.cc

Go to the documentation of this file.
00001 #include "DetIdInfo.h"
00002 
00003 #include "DataFormats/MuonDetId/interface/MuonSubdetId.h"
00004 #include "DataFormats/MuonDetId/interface/DTChamberId.h"
00005 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
00006 #include "DataFormats/MuonDetId/interface/RPCDetId.h"
00007   
00008 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
00009 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00010 #include "DataFormats/EcalDetId/interface/EBDetId.h"
00011 
00012 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
00013 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
00014 #include "DataFormats/SiPixelDetId/interface/PXBDetId.h"
00015 #include "DataFormats/SiPixelDetId/interface/PXFDetId.h"
00016 #include "DataFormats/SiStripDetId/interface/TIBDetId.h"
00017 #include "DataFormats/SiStripDetId/interface/TOBDetId.h"
00018 #include "DataFormats/SiStripDetId/interface/TIDDetId.h"
00019 #include "DataFormats/SiStripDetId/interface/TECDetId.h"
00020 
00021 #include "DataFormats/CaloTowers/interface/CaloTowerDetId.h"
00022 
00023 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
00024 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00025 
00026 #include <sstream>
00027 
00028 std::string DetIdInfo::info(const DetId& id) {
00029    std::ostringstream oss;
00030    
00031    oss << "DetId: " << id.rawId() << "\n";
00032    
00033    switch ( id.det() ) {
00034     
00035      case DetId::Tracker:
00036        switch ( id.subdetId() ) {
00037         case StripSubdetector::TIB:
00038              {
00039                oss <<"TIB "<<TIBDetId(id).layer();
00040              }
00041            break;
00042         case StripSubdetector::TOB:
00043              {
00044                oss <<"TOB "<<TOBDetId(id).layer();
00045              }
00046            break;
00047         case StripSubdetector::TEC:
00048              {
00049                oss <<"TEC "<<TECDetId(id).wheel();
00050              }
00051            break;
00052         case StripSubdetector::TID:
00053              {
00054                oss <<"TID "<<TIDDetId(id).wheel();
00055              }
00056            break;
00057         case (int) PixelSubdetector::PixelBarrel:
00058              {
00059                oss <<"PixBarrel "<< PXBDetId(id).layer();
00060              }
00061            break;
00062         case (int) PixelSubdetector::PixelEndcap:
00063              {
00064                oss <<"PixEndcap "<< PXBDetId(id).layer();
00065              }
00066            break;
00067          }
00068         break;
00069 
00070     case DetId::Muon:
00071       switch ( id.subdetId() ) {
00072        case MuonSubdetId::DT:
00073            { 
00074               DTChamberId detId(id.rawId());
00075               oss << "DT chamber (wheel, station, sector): "
00076                 << detId.wheel() << ", "
00077                 << detId.station() << ", "
00078                 << detId.sector();
00079            }
00080          break;
00081        case MuonSubdetId::CSC:
00082            {
00083               CSCDetId detId(id.rawId());
00084               oss << "CSC chamber (endcap, station, ring, chamber, layer): "
00085                 << detId.endcap() << ", "
00086                 << detId.station() << ", "
00087                 << detId.ring() << ", "
00088                 << detId.chamber() << ", "
00089                 << detId.layer();
00090            }
00091          break;
00092        case MuonSubdetId::RPC:
00093            { 
00094               RPCDetId detId(id.rawId());
00095               oss << "RPC chamber ";
00096               switch ( detId.region() ) {
00097                case 0:
00098                  oss << "/ barrel / (wheel, station, sector, layer, subsector, roll): "
00099                    << detId.ring() << ", "
00100                    << detId.station() << ", "
00101                    << detId.sector() << ", "
00102                    << detId.layer() << ", "
00103                    << detId.subsector() << ", "
00104                    << detId.roll();
00105                  break;
00106                case 1:
00107                  oss << "/ forward endcap / (wheel, station, sector, layer, subsector, roll): "
00108                    << detId.ring() << ", "
00109                    << detId.station() << ", "
00110                    << detId.sector() << ", "
00111                    << detId.layer() << ", "
00112                    << detId.subsector() << ", "
00113                    << detId.roll();
00114                  break;
00115                case -1:
00116                  oss << "/ backward endcap / (wheel, station, sector, layer, subsector, roll): "
00117                    << detId.ring() << ", "
00118                    << detId.station() << ", "
00119                    << detId.sector() << ", "
00120                    << detId.layer() << ", "
00121                    << detId.subsector() << ", "
00122                    << detId.roll();
00123                  break;
00124               }
00125            }
00126          break;
00127       }
00128       break;
00129     
00130     case DetId::Calo:
00131         {
00132            CaloTowerDetId detId( id.rawId() );
00133            oss << "CaloTower (ieta, iphi): "
00134              << detId.ieta() << ", "
00135              << detId.iphi();
00136         }
00137       break;
00138     
00139     case DetId::Ecal:
00140       switch ( id.subdetId() ) {
00141        case EcalBarrel:
00142            {
00143               EBDetId detId(id);
00144               oss << "EcalBarrel (ieta, iphi, tower_ieta, tower_iphi): "
00145                 << detId.ieta() << ", "
00146                 << detId.iphi() << ", "
00147                 << detId.tower_ieta() << ", "
00148                 << detId.tower_iphi();
00149            }
00150          break;
00151        case EcalEndcap:
00152            {
00153               EEDetId detId(id);
00154               oss << "EcalEndcap (ix, iy, SuperCrystal, crystal, quadrant): "
00155                 << detId.ix() << ", "
00156                 << detId.iy() << ", "
00157                 << detId.isc() << ", "
00158                 << detId.ic() << ", "
00159                 << detId.iquadrant();
00160            }
00161          break;
00162        case EcalPreshower:
00163          oss << "EcalPreshower";
00164          break;
00165        case EcalTriggerTower:
00166          oss << "EcalTriggerTower";
00167          break;
00168        case EcalLaserPnDiode:
00169          oss << "EcalLaserPnDiode";
00170          break;
00171       }
00172       break;
00173       
00174     case DetId::Hcal:
00175         {
00176            HcalDetId detId(id);
00177            switch ( detId.subdet() ) {
00178             case HcalEmpty:
00179               oss << "HcalEmpty ";
00180               break;
00181             case HcalBarrel:
00182               oss << "HcalBarrel ";
00183               break;
00184             case HcalEndcap:
00185               oss << "HcalEndcap ";
00186               break;
00187             case HcalOuter:
00188               oss << "HcalOuter ";
00189               break;
00190             case HcalForward:
00191               oss << "HcalForward ";
00192               break;
00193             case HcalTriggerTower:
00194               oss << "HcalTriggerTower ";
00195               break;
00196             case HcalOther:
00197               oss << "HcalOther ";
00198               break;
00199            }
00200            oss << "(ieta, iphi, depth):"
00201              << detId.ieta() << ", "
00202              << detId.iphi() << ", "
00203              << detId.depth();
00204         }
00205       break;
00206     default :;
00207    }
00208    return oss.str();
00209 }
00210 
00211    
00212 std::string DetIdInfo::info(const std::set<DetId>& idSet) {
00213    std::string text;
00214    for(std::set<DetId>::const_iterator id = idSet.begin(); id != idSet.end(); id++)
00215      {
00216         text += info(*id);
00217         text += "\n";
00218      }
00219    return text;
00220 }
00221 
00222 std::string DetIdInfo::info(const std::vector<DetId>& idSet) {
00223    std::string text;
00224    for(std::vector<DetId>::const_iterator id = idSet.begin(); id != idSet.end(); id++)
00225      {
00226         text += info(*id);
00227         text += "\n";
00228      }
00229    return text;
00230 }
00231 
00232