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