CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuonNavigationPrinter.cc
Go to the documentation of this file.
1 
19 
26 
28 
29 #include <iostream>
30 #include <iomanip>
31 using namespace std;
32 
34 
35  edm::LogInfo ("MuonNavigationPrinter")<< "MuonNavigationPrinter::MuonNavigationPrinter" ;
36  vector<DetLayer*>::const_iterator iter;
37  edm::LogInfo ("MuonNavigationPrinter")<<"================================";
38  edm::LogInfo ("MuonNavigationPrinter")<< "BARREL:";
39  vector<DetLayer*> barrel;
40  if ( enableRPC ) barrel = muonLayout->allBarrelLayers();
41  else barrel = muonLayout->allDTLayers();
42 
43  edm::LogInfo ("MuonNavigationPrinter")<<"There are "<<barrel.size()<<" Barrel DetLayers";
44  for ( iter = barrel.begin(); iter != barrel.end(); iter++ ) printLayer(*iter);
45  edm::LogInfo ("MuonNavigationPrinter")<<"================================";
46  edm::LogInfo ("MuonNavigationPrinter") << "BACKWARD:";
47 
48  vector<DetLayer*> backward;
49  if ( enableRPC ) backward = muonLayout->allBackwardLayers();
50  else backward = muonLayout->backwardCSCLayers();
51 
52  edm::LogInfo ("MuonNavigationPrinter")<<"There are "<<backward.size()<<" Backward DetLayers";
53  for ( iter = backward.begin(); iter != backward.end(); iter++ ) printLayer(*iter);
54  edm::LogInfo ("MuonNavigationPrinter") << "==============================";
55  edm::LogInfo ("MuonNavigationPrinter") << "FORWARD:";
56  vector<DetLayer*> forward;
57  if ( enableRPC ) forward = muonLayout->allForwardLayers();
58  else forward = muonLayout->forwardCSCLayers();
59 
60  edm::LogInfo ("MuonNavigationPrinter")<<"There are "<<forward.size()<<" Forward DetLayers";
61  for ( iter = forward.begin(); iter != forward.end(); iter++ ) printLayer(*iter);
62 
63 }
64 
66 
67  edm::LogInfo ("MuonNavigationPrinter")<< "MuonNavigationPrinter::MuonNavigationPrinter" ;
68  vector<DetLayer*>::const_iterator iter;
69 // vector<BarrelDetLayer*>::const_iterator tkiter;
70 // vector<ForwardDetLayer*>::const_iterator tkfiter;
71  edm::LogInfo ("MuonNavigationPrinter")<<"================================";
72  edm::LogInfo ("MuonNavigationPrinter")<< "BARREL:";
73  vector<BarrelDetLayer*> tkbarrel = tracker->barrelLayers();
74  edm::LogInfo ("MuonNavigationPrinter")<<"There are "<<tkbarrel.size()<<" Tk Barrel DetLayers";
75 // for ( tkiter = tkbarrel.begin(); tkiter != tkbarrel.end(); tkiter++ ) printLayer(*tkiter);
76  vector<DetLayer*> barrel = muonLayout->allBarrelLayers();
77  edm::LogInfo ("MuonNavigationPrinter")<<"There are "<<barrel.size()<<" Mu Barrel DetLayers";
78  for ( iter = barrel.begin(); iter != barrel.end(); iter++ ) printLayer(*iter);
79  edm::LogInfo ("MuonNavigationPrinter")<<"================================";
80  edm::LogInfo ("MuonNavigationPrinter") << "BACKWARD:";
81  vector<ForwardDetLayer*> tkbackward = tracker->negForwardLayers();
82  edm::LogInfo ("MuonNavigationPrinter")<<"There are "<<tkbackward.size()<<" Tk Backward DetLayers";
84  vector<DetLayer*> backward = muonLayout->allBackwardLayers();
85  edm::LogInfo ("MuonNavigationPrinter")<<"There are "<<backward.size()<<" Mu Backward DetLayers";
86  for ( iter = backward.begin(); iter != backward.end(); iter++ ) printLayer(*iter);
87  edm::LogInfo ("MuonNavigationPrinter") << "==============================";
88  edm::LogInfo ("MuonNavigationPrinter") << "FORWARD:";
89  vector<ForwardDetLayer*> tkforward = tracker->posForwardLayers();
90  edm::LogInfo ("MuonNavigationPrinter")<<"There are "<<tkforward.size()<<" Tk Forward DetLayers";
91 // for ( tkfiter = tkforward.begin(); tkfiter != tkforward.end(); tkfiter++ ) printLayer(*tkfiter);
92 
93  vector<DetLayer*> forward = muonLayout->allForwardLayers();
94  edm::LogInfo ("MuonNavigationPrinter")<<"There are "<<forward.size()<<" Mu Forward DetLayers";
95  for ( iter = forward.begin(); iter != forward.end(); iter++ ) printLayer(*iter);
96 
97 }
98 
101  vector<const DetLayer*> nextLayers = layer->nextLayers(insideOut);
102  vector<const DetLayer*> compatibleLayers = layer->compatibleLayers(insideOut);
103  if (BarrelDetLayer* bdl = dynamic_cast<BarrelDetLayer*>(layer)) {
104  edm::LogInfo ("MuonNavigationPrinter")
105  << layer->location() << " " << layer->subDetector() << " layer at R: "
106  << setiosflags(ios::showpoint | ios::fixed)
107  << setw(8) << setprecision(2)
108  << bdl->specificSurface().radius() << " length: "
109  << setw(6) << setprecision(2)
110  << layer->surface().bounds().length();
111 
112  }
113  else if (ForwardDetLayer* fdl = dynamic_cast<ForwardDetLayer*>(layer)) {
114  edm::LogInfo ("MuonNavigationPrinter") << endl
115  << layer->location() << " " << layer->subDetector() << "layer at z: "
116  << setiosflags(ios::showpoint | ios::fixed)
117  << setw(8) << setprecision(2)
118  << layer->surface().position().z() << " inner r: "
119  << setw(6) << setprecision(2)
120  << fdl->specificSurface().innerRadius() << " outer r: "
121  << setw(6) << setprecision(2)
122  << fdl->specificSurface().outerRadius();
123  }
124  edm::LogInfo ("MuonNavigationPrinter") << " has " << nextLayers.size() << " next layers in the direction inside-out: ";
125  printLayers(nextLayers);
126 
127  nextLayers.clear();
128  nextLayers = layer->nextLayers(outsideIn);
129 
130  edm::LogInfo ("MuonNavigationPrinter") << " has " << nextLayers.size() << " next layers in the direction outside-in: ";
131  printLayers(nextLayers);
132 
133  edm::LogInfo ("MuonNavigationPrinter") << " has " << compatibleLayers.size() << " compatible layers in the direction inside-out:: ";
134  printLayers(compatibleLayers);
135  compatibleLayers.clear();
136  compatibleLayers = layer->compatibleLayers(outsideIn);
137 
138  edm::LogInfo ("MuonNavigationPrinter") << " has " << compatibleLayers.size() << " compatible layers in the direction outside-in: ";
139  printLayers(compatibleLayers);
140 
141 }
142 
144 void MuonNavigationPrinter::printLayers(vector<const DetLayer*> nextLayers) const {
145 
146  for ( vector<const DetLayer*>::const_iterator inext = nextLayers.begin();
147  inext != nextLayers.end(); inext++ ) {
148 
149  edm::LogInfo ("MuonNavigationPrinter") << " --> ";
150  if ( (*inext)->location() == GeomDetEnumerators::barrel ) {
151  const BarrelDetLayer* l = dynamic_cast<const BarrelDetLayer*>(&(**inext));
152  edm::LogInfo ("MuonNavigationPrinter") << (*inext)->location() << " "
153  << (*inext)->subDetector()
154  << " layer at R: "
155  << setiosflags(ios::showpoint | ios::fixed)
156  << setw(8) << setprecision(2)
157  << l->specificSurface().radius() << " ";
158  }
159  else {
160  const ForwardDetLayer* l = dynamic_cast<const ForwardDetLayer*>(&(**inext));
161  edm::LogInfo ("MuonNavigationPrinter") << (*inext)->location() << " "
162  << (*inext)->subDetector()
163  << " layer at z: "
164  << setiosflags(ios::showpoint | ios::fixed)
165  << setw(8) << setprecision(2)
166  << l->surface().position().z() << " ";
167  }
168  edm::LogInfo ("MuonNavigationPrinter") << setiosflags(ios::showpoint | ios::fixed)
169  << setprecision(1)
170  << setw(6) << (*inext)->surface().bounds().length() << ", "
171  << setw(6) << (*inext)->surface().bounds().width() << ", "
172  << setw(4) <<(*inext)->surface().bounds().thickness() << " : "
173  << (*inext)->surface().position();
174  }
175 
176 }
177 
178 
180 
181 // /// determine whether the layer is forward or backward
182 // string MuonNavigationPrinter::layerPart(const DetLayer* layer) const {
183 
184 // string result = "unknown";
185 
186 // if ( layer->part() == barrel ) return "barrel";
187 // if ( layer->part() == forward && layer->surface().position().z() < 0 ) {
188 // result = "backward";
189 // }
190 // if ( layer->part() == forward && layer->surface().position().z() >= 0 ) {
191 // result = "forward";
192 // }
193 
194 // return result;
195 
196 // }
197 
198 // /// determine the module (pixel, sililcon, msgc, dt, csc, rpc)
199 // string MuonNavigationPrinter::layerModule(const DetLayer* layer) const {
200 
201 // string result = "unknown";
202 
203 // GeomDetEnumerators::SubDetector det = layer->subDetector();
204 
205 // if ( det == Pixel ) return "Pixel";
206 // if ( det == TIB || det == TOB
207 // || det == TID || det == TEC ) return "silicon";
208 // if ( det == DT ) return "DT";
209 // if ( det == CSC ) return "CSC";
210 // if ( det == RPC ) return "RPC";
211 
212 // return result;
213 
214 // }
215 
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
virtual float length() const =0
virtual Location location() const =0
Which part of the detector (barrel, endcap)
virtual const BoundSurface & surface() const
The surface of the GeometricSearchDet.
virtual std::vector< const DetLayer * > nextLayers(NavigationDirection direction) const
Definition: DetLayer.cc:35
virtual SubDetector subDetector() const =0
The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
const std::vector< DetLayer * > & allForwardLayers() const
return all forward (+Z) layers (CSC+RPC), inside-out
const std::vector< DetLayer * > & allDTLayers() const
return the DT DetLayers (barrel), inside-out
void printLayer(DetLayer *) const
print layer
std::vector< BarrelDetLayer * > const & barrelLayers() const
MuonNavigationPrinter(const MuonDetLayerGeometry *, bool enableRPC=true)
Scalar radius() const
Radius of the cylinder.
Definition: Cylinder.h:55
T z() const
Definition: PV3DBase.h:63
std::vector< ForwardDetLayer * > const & negForwardLayers() const
const std::vector< DetLayer * > & allBackwardLayers() const
return all backward (-Z) layers (CSC+RPC), inside-out
const Bounds & bounds() const
Definition: BoundSurface.h:89
std::vector< ForwardDetLayer * > const & posForwardLayers() const
const std::vector< DetLayer * > & backwardCSCLayers() const
return the backward (-Z) CSC DetLayers, inside-out
virtual const BoundCylinder & specificSurface() const
Extension of the interface.
const std::vector< DetLayer * > & forwardCSCLayers() const
return the forward (+Z) CSC DetLayers, inside-out
void printLayers(std::vector< const DetLayer * >) const
print next layers
std::vector< const DetLayer * > compatibleLayers(NavigationDirection direction) const
Definition: DetLayer.cc:60
const PositionType & position() const
const std::vector< DetLayer * > & allBarrelLayers() const
return all barrel DetLayers (DT+RPC), inside-out