Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:31:45

0001 #include "DetIdInfo.h"
0002 
0003 #include "DataFormats/MuonDetId/interface/MuonSubdetId.h"
0004 #include "DataFormats/MuonDetId/interface/DTChamberId.h"
0005 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
0006 #include "DataFormats/MuonDetId/interface/RPCDetId.h"
0007 #include "DataFormats/MuonDetId/interface/GEMDetId.h"
0008 #include "DataFormats/MuonDetId/interface/ME0DetId.h"
0009 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0010 
0011 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
0012 #include "DataFormats/EcalDetId/interface/EEDetId.h"
0013 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0014 
0015 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
0016 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
0017 
0018 #include "DataFormats/CaloTowers/interface/CaloTowerDetId.h"
0019 
0020 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
0021 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
0022 
0023 #include <sstream>
0024 
0025 std::string DetIdInfo::info(const DetId& id, const TrackerTopology* tTopo) {
0026   std::ostringstream oss;
0027 
0028   oss << "DetId: " << id.rawId() << "\n";
0029 
0030   switch (id.det()) {
0031     case DetId::Tracker:
0032       switch (id.subdetId()) {
0033         case StripSubdetector::TIB: {
0034           oss << "TIB ";
0035         } break;
0036         case StripSubdetector::TOB: {
0037           oss << "TOB ";
0038         } break;
0039         case StripSubdetector::TEC: {
0040           oss << "TEC ";
0041         } break;
0042         case StripSubdetector::TID: {
0043           oss << "TID ";
0044         } break;
0045         case (int)PixelSubdetector::PixelBarrel: {
0046           oss << "PixBarrel ";
0047         } break;
0048         case (int)PixelSubdetector::PixelEndcap: {
0049           oss << "PixEndcap ";
0050         } break;
0051       }
0052       if (tTopo != nullptr)
0053         oss << tTopo->layer(id);
0054       break;
0055 
0056     case DetId::Muon:
0057       switch (id.subdetId()) {
0058         case MuonSubdetId::DT: {
0059           DTChamberId detId(id.rawId());
0060           oss << "DT chamber (wheel, station, sector): " << detId.wheel() << ", " << detId.station() << ", "
0061               << detId.sector();
0062         } break;
0063         case MuonSubdetId::CSC: {
0064           CSCDetId detId(id.rawId());
0065           oss << "CSC chamber (endcap, station, ring, chamber, layer): " << detId.endcap() << ", " << detId.station()
0066               << ", " << detId.ring() << ", " << detId.chamber() << ", " << detId.layer();
0067         } break;
0068         case MuonSubdetId::RPC: {
0069           RPCDetId detId(id.rawId());
0070           oss << "RPC chamber ";
0071           switch (detId.region()) {
0072             case 0:
0073               oss << "/ barrel / (wheel, station, sector, layer, subsector, roll): " << detId.ring() << ", "
0074                   << detId.station() << ", " << detId.sector() << ", " << detId.layer() << ", " << detId.subsector()
0075                   << ", " << detId.roll();
0076               break;
0077             case 1:
0078               oss << "/ forward endcap / (wheel, station, sector, layer, subsector, roll): " << detId.ring() << ", "
0079                   << detId.station() << ", " << detId.sector() << ", " << detId.layer() << ", " << detId.subsector()
0080                   << ", " << detId.roll();
0081               break;
0082             case -1:
0083               oss << "/ backward endcap / (wheel, station, sector, layer, subsector, roll): " << detId.ring() << ", "
0084                   << detId.station() << ", " << detId.sector() << ", " << detId.layer() << ", " << detId.subsector()
0085                   << ", " << detId.roll();
0086               break;
0087           }
0088         } break;
0089         case MuonSubdetId::GEM: {
0090           GEMDetId detId(id.rawId());
0091           oss << "GEM chamber (endcap, station, ring, chamber, layer): " << detId.region() << ", " << detId.station()
0092               << ", " << detId.ring() << ", " << detId.chamber() << ", " << detId.layer();
0093         } break;
0094         case MuonSubdetId::ME0: {
0095           ME0DetId detId(id.rawId());
0096           oss << "ME0 chamber (endcap, station, ring, chamber, layer): " << detId.region() << ", " << detId.station()
0097               << ", " << detId.chamber() << ", " << detId.layer();
0098         } break;
0099       }
0100       break;
0101 
0102     case DetId::Calo: {
0103       CaloTowerDetId detId(id.rawId());
0104       oss << "CaloTower (ieta, iphi): " << detId.ieta() << ", " << detId.iphi();
0105     } break;
0106 
0107     case DetId::Ecal:
0108       switch (id.subdetId()) {
0109         case EcalBarrel: {
0110           EBDetId detId(id);
0111           oss << "EcalBarrel (ieta, iphi, tower_ieta, tower_iphi): " << detId.ieta() << ", " << detId.iphi() << ", "
0112               << detId.tower_ieta() << ", " << detId.tower_iphi();
0113         } break;
0114         case EcalEndcap: {
0115           EEDetId detId(id);
0116           oss << "EcalEndcap (ix, iy, SuperCrystal, crystal, quadrant): " << detId.ix() << ", " << detId.iy() << ", "
0117               << detId.isc() << ", " << detId.ic() << ", " << detId.iquadrant();
0118         } break;
0119         case EcalPreshower:
0120           oss << "EcalPreshower";
0121           break;
0122         case EcalTriggerTower:
0123           oss << "EcalTriggerTower";
0124           break;
0125         case EcalLaserPnDiode:
0126           oss << "EcalLaserPnDiode";
0127           break;
0128       }
0129       break;
0130 
0131     case DetId::Hcal: {
0132       HcalDetId detId(id);
0133       switch (detId.subdet()) {
0134         case HcalEmpty:
0135           oss << "HcalEmpty ";
0136           break;
0137         case HcalBarrel:
0138           oss << "HcalBarrel ";
0139           break;
0140         case HcalEndcap:
0141           oss << "HcalEndcap ";
0142           break;
0143         case HcalOuter:
0144           oss << "HcalOuter ";
0145           break;
0146         case HcalForward:
0147           oss << "HcalForward ";
0148           break;
0149         case HcalTriggerTower:
0150           oss << "HcalTriggerTower ";
0151           break;
0152         case HcalOther:
0153           oss << "HcalOther ";
0154           break;
0155       }
0156       oss << "(ieta, iphi, depth):" << detId.ieta() << ", " << detId.iphi() << ", " << detId.depth();
0157     } break;
0158     default:;
0159   }
0160   return oss.str();
0161 }
0162 
0163 std::string DetIdInfo::info(const std::set<DetId>& idSet, const TrackerTopology* tTopo) {
0164   std::string text;
0165   for (std::set<DetId>::const_iterator id = idSet.begin(); id != idSet.end(); id++) {
0166     text += info(*id, tTopo);
0167     text += "\n";
0168   }
0169   return text;
0170 }
0171 
0172 std::string DetIdInfo::info(const std::vector<DetId>& idSet, const TrackerTopology* tTopo) {
0173   std::string text;
0174   for (std::vector<DetId>::const_iterator id = idSet.begin(); id != idSet.end(); id++) {
0175     text += info(*id, tTopo);
0176     text += "\n";
0177   }
0178   return text;
0179 }