File indexing completed on 2024-04-06 12:27:14
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #include "RecoMuon/Navigation/interface/MuonNavigationPrinter.h"
0022
0023 #include "TrackingTools/DetLayers/interface/BarrelDetLayer.h"
0024 #include "TrackingTools/DetLayers/interface/ForwardDetLayer.h"
0025 #include "DataFormats/GeometrySurface/interface/BoundCylinder.h"
0026 #include "DataFormats/GeometrySurface/interface/BoundDisk.h"
0027 #include "RecoMuon/DetLayers/interface/MuonDetLayerGeometry.h"
0028 #include "RecoTracker/TkDetLayers/interface/GeometricSearchTracker.h"
0029 #include "RecoMuon/Navigation/interface/MuonNavigationSchool.h"
0030 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0031
0032 #include <iostream>
0033 #include <iomanip>
0034 using namespace std;
0035
0036
0037
0038 #ifdef VI_DEBUG
0039 #define PRINT(x) std::cout << x << ' '
0040 #else
0041 #define PRINT(x) edm::LogInfo(x)
0042 #endif
0043
0044 MuonNavigationPrinter::MuonNavigationPrinter(const MuonDetLayerGeometry* muonLayout,
0045 MuonNavigationSchool const& sh,
0046 bool enableCSC,
0047 bool enableRPC,
0048 bool enableGEM,
0049 bool enableME0)
0050 : school(&sh) {
0051 PRINT("MuonNavigationPrinter") << "MuonNavigationPrinter::MuonNavigationPrinter" << std::endl;
0052 PRINT("MuonNavigationPrinter") << "================================" << std::endl;
0053 PRINT("MuonNavigationPrinter") << "BARREL:" << std::endl;
0054 vector<const DetLayer*> barrel;
0055 if (enableRPC)
0056 barrel = muonLayout->allBarrelLayers();
0057 else
0058 barrel = muonLayout->allDTLayers();
0059
0060 PRINT("MuonNavigationPrinter") << "There are " << barrel.size() << " Barrel DetLayers";
0061 for (auto i : barrel)
0062 printLayer(i);
0063 PRINT("MuonNavigationPrinter") << "================================" << std::endl;
0064 PRINT("MuonNavigationPrinter") << "BACKWARD:" << std::endl;
0065
0066 vector<const DetLayer*> backward;
0067
0068 if (enableCSC & enableGEM & enableRPC & enableME0)
0069 backward = muonLayout->allBackwardLayers();
0070 else if (enableCSC & enableGEM & !enableRPC & !enableME0)
0071 backward = muonLayout->allCscGemBackwardLayers();
0072 else if (!enableCSC & enableGEM & !enableRPC & !enableME0)
0073 backward = muonLayout->backwardGEMLayers();
0074 else if (enableCSC & !enableGEM & !enableRPC & !enableME0)
0075 backward = muonLayout->backwardCSCLayers();
0076 else if (enableCSC & !enableGEM & !enableRPC & enableME0)
0077 backward = muonLayout->allCscME0BackwardLayers();
0078 else if (!enableCSC & !enableGEM & !enableRPC & enableME0)
0079 backward = muonLayout->backwardME0Layers();
0080 else
0081 backward = muonLayout->allBackwardLayers();
0082
0083 PRINT("MuonNavigationPrinter") << "There are " << backward.size() << " Backward DetLayers";
0084 for (auto i : backward)
0085 printLayer(i);
0086 PRINT("MuonNavigationPrinter") << "==============================" << std::endl;
0087 PRINT("MuonNavigationPrinter") << "FORWARD:" << std::endl;
0088 vector<const DetLayer*> forward;
0089
0090 if (enableCSC & enableGEM & enableRPC & enableME0)
0091 forward = muonLayout->allForwardLayers();
0092 else if (enableCSC & enableGEM & !enableRPC & !enableME0)
0093 forward = muonLayout->allCscGemForwardLayers();
0094 else if (!enableCSC & enableGEM & !enableRPC & !enableME0)
0095 forward = muonLayout->forwardGEMLayers();
0096 else if (enableCSC & !enableGEM & !enableRPC & !enableME0)
0097 forward = muonLayout->forwardCSCLayers();
0098 else if (enableCSC & !enableGEM & !enableRPC & enableME0)
0099 forward = muonLayout->allCscME0ForwardLayers();
0100 else if (!enableCSC & !enableGEM & !enableRPC & enableME0)
0101 forward = muonLayout->forwardME0Layers();
0102 else
0103 forward = muonLayout->allForwardLayers();
0104
0105 PRINT("MuonNavigationPrinter") << "There are " << forward.size() << " Forward DetLayers" << std::endl;
0106 for (auto i : forward)
0107 printLayer(i);
0108 }
0109
0110 MuonNavigationPrinter::MuonNavigationPrinter(const MuonDetLayerGeometry* muonLayout,
0111 MuonNavigationSchool const& sh,
0112 const GeometricSearchTracker* tracker)
0113 : school(&sh) {
0114 PRINT("MuonNavigationPrinter") << "MuonNavigationPrinter::MuonNavigationPrinter" << std::endl;
0115
0116
0117 PRINT("MuonNavigationPrinter") << "================================" << std::endl;
0118 PRINT("MuonNavigationPrinter") << "BARREL:" << std::endl;
0119 const vector<const BarrelDetLayer*>& tkbarrel = tracker->barrelLayers();
0120 PRINT("MuonNavigationPrinter") << "There are " << tkbarrel.size() << " Tk Barrel DetLayers" << std::endl;
0121
0122 vector<const DetLayer*> barrel = muonLayout->allBarrelLayers();
0123 PRINT("MuonNavigationPrinter") << "There are " << barrel.size() << " Mu Barrel DetLayers";
0124 for (auto i : barrel)
0125 printLayer(i);
0126 PRINT("MuonNavigationPrinter") << "================================" << std::endl;
0127 PRINT("MuonNavigationPrinter") << "BACKWARD:" << std::endl;
0128 const vector<const ForwardDetLayer*>& tkbackward = tracker->negForwardLayers();
0129 PRINT("MuonNavigationPrinter") << "There are " << tkbackward.size() << " Tk Backward DetLayers" << std::endl;
0130
0131 vector<const DetLayer*> backward = muonLayout->allBackwardLayers();
0132 PRINT("MuonNavigationPrinter") << "There are " << backward.size() << " Mu Backward DetLayers << std::endl";
0133 for (auto i : backward)
0134 printLayer(i);
0135 PRINT("MuonNavigationPrinter") << "==============================" << std::endl;
0136 PRINT("MuonNavigationPrinter") << "FORWARD:" << std::endl;
0137 const vector<const ForwardDetLayer*>& tkforward = tracker->posForwardLayers();
0138 PRINT("MuonNavigationPrinter") << "There are " << tkforward.size() << " Tk Forward DetLayers" << std::endl;
0139
0140
0141 vector<const DetLayer*> forward = muonLayout->allForwardLayers();
0142 PRINT("MuonNavigationPrinter") << "There are " << forward.size() << " Mu Forward DetLayers";
0143 for (auto i : forward)
0144 printLayer(i);
0145 }
0146
0147
0148 void MuonNavigationPrinter::printLayer(const DetLayer* layer) const {
0149 vector<const DetLayer*> nextLayers = school->nextLayers(*layer, insideOut);
0150 vector<const DetLayer*> compatibleLayers = school->compatibleLayers(*layer, insideOut);
0151 if (const BarrelDetLayer* bdl = dynamic_cast<const BarrelDetLayer*>(layer)) {
0152 PRINT("MuonNavigationPrinter") << layer->location() << " " << layer->subDetector()
0153 << " layer at R: " << setiosflags(ios::showpoint | ios::fixed) << setw(8)
0154 << setprecision(2) << bdl->specificSurface().radius() << " length: " << setw(6)
0155 << setprecision(2) << layer->surface().bounds().length() << std::endl;
0156
0157 } else if (const ForwardDetLayer* fdl = dynamic_cast<const ForwardDetLayer*>(layer)) {
0158 PRINT("MuonNavigationPrinter") << endl
0159 << layer->location() << " " << layer->subDetector()
0160 << "layer at z: " << setiosflags(ios::showpoint | ios::fixed) << setw(8)
0161 << setprecision(2) << layer->surface().position().z() << " inner r: " << setw(6)
0162 << setprecision(2) << fdl->specificSurface().innerRadius()
0163 << " outer r: " << setw(6) << setprecision(2)
0164 << fdl->specificSurface().outerRadius() << std::endl;
0165 }
0166 PRINT("MuonNavigationPrinter") << " has " << nextLayers.size()
0167 << " next layers in the direction inside-out: " << std::endl;
0168 printLayers(nextLayers);
0169
0170 nextLayers.clear();
0171 nextLayers = school->nextLayers(*layer, outsideIn);
0172
0173 PRINT("MuonNavigationPrinter") << " has " << nextLayers.size()
0174 << " next layers in the direction outside-in: " << std::endl;
0175 printLayers(nextLayers);
0176
0177 PRINT("MuonNavigationPrinter") << " has " << compatibleLayers.size()
0178 << " compatible layers in the direction inside-out:: " << std::endl;
0179 printLayers(compatibleLayers);
0180 compatibleLayers.clear();
0181 compatibleLayers = school->compatibleLayers(*layer, outsideIn);
0182
0183 PRINT("MuonNavigationPrinter") << " has " << compatibleLayers.size()
0184 << " compatible layers in the direction outside-in: " << std::endl;
0185 printLayers(compatibleLayers);
0186 }
0187
0188
0189 void MuonNavigationPrinter::printLayers(const vector<const DetLayer*>& nextLayers) const {
0190 for (vector<const DetLayer*>::const_iterator inext = nextLayers.begin(); inext != nextLayers.end(); inext++) {
0191 PRINT("MuonNavigationPrinter") << " --> " << std::endl;
0192 if ((*inext)->location() == GeomDetEnumerators::barrel) {
0193 const BarrelDetLayer* l = dynamic_cast<const BarrelDetLayer*>(&(**inext));
0194 PRINT("MuonNavigationPrinter") << (*inext)->location() << " " << (*inext)->subDetector()
0195 << " layer at R: " << setiosflags(ios::showpoint | ios::fixed) << setw(8)
0196 << setprecision(2) << l->specificSurface().radius() << " " << std::endl;
0197 } else {
0198 const ForwardDetLayer* l = dynamic_cast<const ForwardDetLayer*>(&(**inext));
0199 PRINT("MuonNavigationPrinter") << (*inext)->location() << " " << (*inext)->subDetector()
0200 << " layer at z: " << setiosflags(ios::showpoint | ios::fixed) << setw(8)
0201 << setprecision(2) << l->surface().position().z() << " " << std::endl;
0202 }
0203 PRINT("MuonNavigationPrinter") << setiosflags(ios::showpoint | ios::fixed) << setprecision(1) << setw(6)
0204 << (*inext)->surface().bounds().length() << ", " << setw(6)
0205 << (*inext)->surface().bounds().width() << ", " << setw(4)
0206 << (*inext)->surface().bounds().thickness() << " : "
0207 << (*inext)->surface().position() << std::endl;
0208 }
0209 }
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246