CMS 3D CMS Logo

MTDNavigationPrinter.cc
Go to the documentation of this file.
1 
12 
21 
22 #include <iostream>
23 #include <iomanip>
24 using namespace std;
25 
26 // #define VI_DEBUG
27 
28 #ifdef VI_DEBUG
29 #define PRINT(x) std::cout << x << ' '
30 #else
31 #define PRINT(x) edm::LogInfo(x)
32 #endif
33 
35  MTDNavigationSchool const& sh,
36  bool enableBTL,
37  bool enableETL)
38  : school(&sh) {
39  PRINT("MTDNavigationPrinter") << "MTDNavigationPrinter::MTDNavigationPrinter" << std::endl;
40  PRINT("MTDNavigationPrinter") << "================================" << std::endl;
41  PRINT("MTDNavigationPrinter") << "BARREL:" << std::endl;
42  vector<const DetLayer*> barrel;
43  if (enableBTL)
44  barrel = mtdLayout->allBarrelLayers();
45  else
46  barrel = mtdLayout->allBarrelLayers();
47 
48  PRINT("MTDNavigationPrinter") << "There are " << barrel.size() << " Barrel DetLayers";
49  for (auto i : barrel)
50  printLayer(i);
51  PRINT("MTDNavigationPrinter") << "================================" << std::endl;
52  PRINT("MTDNavigationPrinter") << "BACKWARD:" << std::endl;
53 
54  vector<const DetLayer*> backward;
55 
56  if (enableETL)
57  backward = mtdLayout->allBackwardLayers();
58  else
59  backward = mtdLayout->allBackwardLayers();
60 
61  PRINT("MTDNavigationPrinter") << "There are " << backward.size() << " Backward DetLayers";
62  for (auto i : backward)
63  printLayer(i);
64  PRINT("MTDNavigationPrinter") << "==============================" << std::endl;
65  PRINT("MTDNavigationPrinter") << "FORWARD:" << std::endl;
66  vector<const DetLayer*> forward;
67 
68  if (enableETL)
69  forward = mtdLayout->allForwardLayers();
70  else
71  forward = mtdLayout->allForwardLayers();
72 
73  PRINT("MTDNavigationPrinter") << "There are " << forward.size() << " Forward DetLayers" << std::endl;
74  for (auto i : forward)
75  printLayer(i);
76 }
77 
79  MTDNavigationSchool const& sh,
81  : school(&sh) {
82  PRINT("MTDNavigationPrinter") << "MTDNavigationPrinter::MTDNavigationPrinter" << std::endl;
83  // vector<BarrelDetLayer*>::const_iterator tkiter;
84  // vector<ForwardDetLayer*>::const_iterator tkfiter;
85  PRINT("MTDNavigationPrinter") << "================================" << std::endl;
86  PRINT("MTDNavigationPrinter") << "BARREL:" << std::endl;
87  const vector<const BarrelDetLayer*>& tkbarrel = tracker->barrelLayers();
88  PRINT("MTDNavigationPrinter") << "There are " << tkbarrel.size() << " Tk Barrel DetLayers" << std::endl;
89  // for ( tkiter = tkbarrel.begin(); tkiter != tkbarrel.end(); tkiter++ ) printLayer(*tkiter);
90  vector<const DetLayer*> barrel = mtdLayout->allBarrelLayers();
91  PRINT("MTDNavigationPrinter") << "There are " << barrel.size() << " Mu Barrel DetLayers";
92  for (auto i : barrel)
93  printLayer(i);
94  PRINT("MTDNavigationPrinter") << "================================" << std::endl;
95  PRINT("MTDNavigationPrinter") << "BACKWARD:" << std::endl;
96  const vector<const ForwardDetLayer*>& tkbackward = tracker->negForwardLayers();
97  PRINT("MTDNavigationPrinter") << "There are " << tkbackward.size() << " Tk Backward DetLayers" << std::endl;
99  vector<const DetLayer*> backward = mtdLayout->allBackwardLayers();
100  PRINT("MTDNavigationPrinter") << "There are " << backward.size() << " Mu Backward DetLayers << std::endl";
101  for (auto i : backward)
102  printLayer(i);
103  PRINT("MTDNavigationPrinter") << "==============================" << std::endl;
104  PRINT("MTDNavigationPrinter") << "FORWARD:" << std::endl;
105  const vector<const ForwardDetLayer*>& tkforward = tracker->posForwardLayers();
106  PRINT("MTDNavigationPrinter") << "There are " << tkforward.size() << " Tk Forward DetLayers" << std::endl;
107  // for ( tkfiter = tkforward.begin(); tkfiter != tkforward.end(); tkfiter++ ) printLayer(*tkfiter);
108 
109  vector<const DetLayer*> forward = mtdLayout->allForwardLayers();
110  PRINT("MTDNavigationPrinter") << "There are " << forward.size() << " Mu Forward DetLayers";
111  for (auto i : forward)
112  printLayer(i);
113 }
114 
116 void MTDNavigationPrinter::printLayer(const DetLayer* layer) const {
117  vector<const DetLayer*> nextLayers = school->nextLayers(*layer, insideOut);
118  vector<const DetLayer*> compatibleLayers = school->compatibleLayers(*layer, insideOut);
119  if (const BarrelDetLayer* bdl = dynamic_cast<const BarrelDetLayer*>(layer)) {
120  PRINT("MTDNavigationPrinter") << layer->location() << " " << layer->subDetector()
121  << " layer at R: " << setiosflags(ios::showpoint | ios::fixed) << setw(8)
122  << setprecision(2) << bdl->specificSurface().radius() << " length: " << setw(6)
123  << setprecision(2) << layer->surface().bounds().length() << std::endl;
124 
125  } else if (const ForwardDetLayer* fdl = dynamic_cast<const ForwardDetLayer*>(layer)) {
126  PRINT("MTDNavigationPrinter") << endl
127  << layer->location() << " " << layer->subDetector()
128  << "layer at z: " << setiosflags(ios::showpoint | ios::fixed) << setw(8)
129  << setprecision(2) << layer->surface().position().z() << " inner r: " << setw(6)
130  << setprecision(2) << fdl->specificSurface().innerRadius() << " outer r: " << setw(6)
131  << setprecision(2) << fdl->specificSurface().outerRadius() << std::endl;
132  }
133  PRINT("MTDNavigationPrinter") << " has " << nextLayers.size()
134  << " next layers in the direction inside-out: " << std::endl;
135  printLayers(nextLayers);
136 
137  nextLayers.clear();
138  nextLayers = school->nextLayers(*layer, outsideIn);
139 
140  PRINT("MTDNavigationPrinter") << " has " << nextLayers.size()
141  << " next layers in the direction outside-in: " << std::endl;
142  printLayers(nextLayers);
143 
144  PRINT("MTDNavigationPrinter") << " has " << compatibleLayers.size()
145  << " compatible layers in the direction inside-out:: " << std::endl;
146  printLayers(compatibleLayers);
147  compatibleLayers.clear();
148  compatibleLayers = school->compatibleLayers(*layer, outsideIn);
149 
150  PRINT("MTDNavigationPrinter") << " has " << compatibleLayers.size()
151  << " compatible layers in the direction outside-in: " << std::endl;
152  printLayers(compatibleLayers);
153 }
154 
156 void MTDNavigationPrinter::printLayers(const vector<const DetLayer*>& nextLayers) const {
157  for (vector<const DetLayer*>::const_iterator inext = nextLayers.begin(); inext != nextLayers.end(); inext++) {
158  PRINT("MTDNavigationPrinter") << " --> " << std::endl;
159  if ((*inext)->location() == GeomDetEnumerators::barrel) {
160  const BarrelDetLayer* l = dynamic_cast<const BarrelDetLayer*>(&(**inext));
161  PRINT("MTDNavigationPrinter") << (*inext)->location() << " " << (*inext)->subDetector()
162  << " layer at R: " << setiosflags(ios::showpoint | ios::fixed) << setw(8)
163  << setprecision(2) << l->specificSurface().radius() << " " << std::endl;
164  } else {
165  const ForwardDetLayer* l = dynamic_cast<const ForwardDetLayer*>(&(**inext));
166  PRINT("MTDNavigationPrinter") << (*inext)->location() << " " << (*inext)->subDetector()
167  << " layer at z: " << setiosflags(ios::showpoint | ios::fixed) << setw(8)
168  << setprecision(2) << l->surface().position().z() << " " << std::endl;
169  }
170  PRINT("MTDNavigationPrinter") << setiosflags(ios::showpoint | ios::fixed) << setprecision(1) << setw(6)
171  << (*inext)->surface().bounds().length() << ", " << setw(6)
172  << (*inext)->surface().bounds().width() << ", " << setw(4)
173  << (*inext)->surface().bounds().thickness() << " : " << (*inext)->surface().position()
174  << std::endl;
175  }
176 }
alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
mps_fire.i
i
Definition: mps_fire.py:428
Reference_intrackfit_cff.barrel
list barrel
Definition: Reference_intrackfit_cff.py:37
MessageLogger.h
DetLayer::subDetector
virtual SubDetector subDetector() const =0
The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel,...
DetLayer
Definition: DetLayer.h:21
BoundDisk.h
MTDNavigationSchool.h
MTDNavigationPrinter::printLayer
void printLayer(const DetLayer *) const
print layer
Definition: MTDNavigationPrinter.cc:116
BoundCylinder.h
MTDNavigationPrinter::school
const MTDNavigationSchool * school
return detector part (barrel, forward, backward)
Definition: MTDNavigationPrinter.h:38
Bounds::length
virtual float length() const =0
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
GeomDetEnumerators::barrel
Definition: GeomDetEnumerators.h:9
GeometricSearchTracker.h
DetLayer::location
virtual Location location() const =0
Which part of the detector (barrel, endcap)
MTDDetLayerGeometry::allBarrelLayers
const std::vector< const DetLayer * > & allBarrelLayers() const
return all barrel layers
Definition: MTDDetLayerGeometry.cc:62
MTDNavigationSchool
Definition: MTDNavigationSchool.h:31
NavigationSchool::nextLayers
std::vector< const DetLayer * > nextLayers(const DetLayer &detLayer, Args &&... args) const
Definition: NavigationSchool.h:33
MTDNavigationPrinter::printLayers
void printLayers(const std::vector< const DetLayer * > &) const
print next layers
Definition: MTDNavigationPrinter.cc:156
Surface::bounds
const Bounds & bounds() const
Definition: Surface.h:87
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
MTDNavigationPrinter::MTDNavigationPrinter
MTDNavigationPrinter(const MTDDetLayerGeometry *, MTDNavigationSchool const &, bool enableBTL=true, bool enableETL=true)
Definition: MTDNavigationPrinter.cc:34
BarrelDetLayer.h
PRINT
#define PRINT(x)
Definition: MTDNavigationPrinter.cc:31
MTDDetLayerGeometry
Definition: MTDDetLayerGeometry.h:19
NavigationSchool::compatibleLayers
std::vector< const DetLayer * > compatibleLayers(const DetLayer &detLayer, Args &&... args) const
Returns all layers compatible.
Definition: NavigationSchool.h:41
BarrelDetLayer
Definition: BarrelDetLayer.h:22
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
MTDDetLayerGeometry::allBackwardLayers
const std::vector< const DetLayer * > & allBackwardLayers() const
return all endcap layers
Definition: MTDDetLayerGeometry.cc:68
GloballyPositioned::position
const PositionType & position() const
Definition: GloballyPositioned.h:36
std
Definition: JetResolutionObject.h:76
MTDDetLayerGeometry.h
outsideIn
Definition: NavigationDirection.h:4
ForwardDetLayer
Definition: ForwardDetLayer.h:22
ForwardDetLayer.h
GeometricSearchTracker
Definition: GeometricSearchTracker.h:14
MTDDetLayerGeometry::allForwardLayers
const std::vector< const DetLayer * > & allForwardLayers() const
return all endcap layers
Definition: MTDDetLayerGeometry.cc:66
GeometricSearchDet::surface
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
insideOut
Definition: NavigationDirection.h:4
MTDNavigationPrinter.h