CMS 3D CMS Logo

TrackerInteractionGeometry.cc
Go to the documentation of this file.
1 //Framework Headers
4 
5 //CMSSW Headers
11 
12 // Tracker/Tracking Headers
16 
17 //FAMOS Headers
19 
20 #include<iostream>
21 
23  const GeometricSearchTracker* theGeomSearchTracker)
24 {
25 
26  use_hardcoded = trackerMaterial.getParameter<bool >("use_hardcoded_geometry");
27 
28  if(!use_hardcoded){
29  std::vector<double> disk_thickness = trackerMaterial.getParameter<std::vector<double> >("disk_thickness");
30  std::vector<double> disk_inner_radius = trackerMaterial.getParameter<std::vector<double> >("disk_inner_radius");
31  std::vector<double> disk_outer_radius = trackerMaterial.getParameter<std::vector<double> >("disk_outer_radius");
32  std::vector<double> disk_z = trackerMaterial.getParameter<std::vector<double> >("disk_z");
33 
34  assert(disk_inner_radius.size() == disk_outer_radius.size() && disk_inner_radius.size() == disk_z.size() && disk_inner_radius.size() == disk_thickness.size());
35  std::cout << "number of disk layers = " << disk_z.size() << std::endl;
36 
37  const Surface::RotationType theRotation2(1.,0.,0.,0.,1.,0.,0.,0.,1.);
38 
39  std::vector<double> barrel_thickness = trackerMaterial.getParameter<std::vector<double> >("barrel_thickness");
40  std::vector<double> barrel_radius = trackerMaterial.getParameter<std::vector<double> >("barrel_radius");
41  std::vector<double> barrel_length = trackerMaterial.getParameter<std::vector<double> >("barrel_length");
42 
43  assert(barrel_length.size() == barrel_radius.size() && barrel_length.size() == barrel_thickness.size());
44  std::cout << "number of barrel layers = " << barrel_length.size() << std::endl;
45 
46  const Surface::PositionType thePosition(0.,0.,0.);
47  const Surface::RotationType theRotation(1.,0.,0.,0.,1.,0.,0.,0.,1.);
48 
49  for(unsigned int i = 0, j = 0; i < barrel_length.size() || j < disk_z.size(); ){
50 
51  bool add_disk = false;
52  if(i < barrel_length.size() && j < disk_z.size()){
53  if(disk_outer_radius[j] < barrel_radius[i])
54  add_disk = true;
55  else
56  add_disk = false;
57  }
58  else if (i < barrel_length.size() && !(j < disk_z.size()))
59  add_disk = false;
60  else if (!(i < barrel_length.size()) && j < disk_z.size())
61  add_disk = true;
62  else
63  assert(0);
64 
65  if(add_disk){
66  _mediumProperties.push_back(new MediumProperties(disk_thickness[j],0.0001));
67 
68  const SimpleDiskBounds diskBounds(disk_inner_radius[j],disk_outer_radius[j],-0.0150,+0.0150);
69  const Surface::PositionType positionType(0.,0.,disk_z[j]);
70 
71  unsigned layerNr = i+j;
72  BoundDisk* theDisk = new BoundDisk(positionType,theRotation2,diskBounds);
73  theDisk->setMediumProperties(*_mediumProperties[_mediumProperties.size() -1 ]);
74  if ( theDisk->mediumProperties().radLen() > 0. )
75  _theCylinders.push_back(TrackerLayer(theDisk,true,layerNr,
76  std::vector<double>(),std::vector<double>(),
77  std::vector<double>()));
78  else
79  delete theDisk;
80 
81  j++;
82 
83  }
84  else
85  {
86 
87  // Create the nest of cylinders
88 
89  const SimpleCylinderBounds cylBounds( barrel_radius[i]-0.0150, barrel_radius[i]+0.0150, -barrel_length[i]/2, +barrel_length[i]/2);
90 
91  _mediumProperties.push_back(new MediumProperties(barrel_thickness[i],0.0001));
92 
93  unsigned layerNr = i+j;
94  BoundCylinder* theCylinder = new BoundCylinder(thePosition,theRotation,cylBounds);
95  theCylinder->setMediumProperties(*_mediumProperties[_mediumProperties.size() -1 ]);
96  if ( theCylinder->mediumProperties().radLen() > 0. )
97  _theCylinders.push_back(TrackerLayer(theCylinder,false,layerNr,
98  std::vector<double>(),std::vector<double>(),
99  std::vector<double>()));
100 
101  else
102  delete theCylinder;
103 
104  i++;
105  }
106  }
107  }
108  else {
109  // Fraction of radiation length : had oc values to account
110  // for detectors, cables, support, ...
111  // Note : the second argument is not used in FAMOS
112  // Note : the first argument is tuned to reproduce the CMSIM material
113  // in terms or radiation length.
114 
115 
116  // Thickness of all layers
117  // Version of the material description
118  version = trackerMaterial.getParameter<unsigned int>("TrackerMaterialVersion");
119  // Beam Pipe
120  beamPipeThickness = trackerMaterial.getParameter<std::vector<double> >("BeamPipeThickness");
121  // Pixel Barrel Layers 1-3
122  pxbThickness = trackerMaterial.getParameter<std::vector<double> >("PXBThickness");
123  // Pixel Barrel services at the end of layers 1-3
124  pxb1CablesThickness = trackerMaterial.getParameter<std::vector<double> >("PXB1CablesThickness");
125  pxb2CablesThickness = trackerMaterial.getParameter<std::vector<double> >("PXB2CablesThickness");
126  pxb3CablesThickness = trackerMaterial.getParameter<std::vector<double> >("PXB3CablesThickness");
127  // Pixel Barrel outside cables
128  pxbOutCables1Thickness = trackerMaterial.getParameter<std::vector<double> >("PXBOutCables1Thickness");
129  pxbOutCables2Thickness = trackerMaterial.getParameter<std::vector<double> >("PXBOutCables2Thickness");
130  // Pixel Disks 1-2
131  pxdThickness = trackerMaterial.getParameter<std::vector<double> >("PXDThickness");
132  // Pixel Endcap outside cables
133  pxdOutCables1Thickness = trackerMaterial.getParameter<std::vector<double> >("PXDOutCables1Thickness");
134  pxdOutCables2Thickness = trackerMaterial.getParameter<std::vector<double> >("PXDOutCables2Thickness");
135  // Tracker Inner barrel layers 1-4
136  tibLayer1Thickness = trackerMaterial.getParameter<std::vector<double> >("TIBLayer1Thickness");
137  tibLayer2Thickness = trackerMaterial.getParameter<std::vector<double> >("TIBLayer2Thickness");
138  tibLayer3Thickness = trackerMaterial.getParameter<std::vector<double> >("TIBLayer3Thickness");
139  tibLayer4Thickness = trackerMaterial.getParameter<std::vector<double> >("TIBLayer4Thickness");
140  // TIB outside services (endcap)
141  tibOutCables1Thickness = trackerMaterial.getParameter<std::vector<double> >("TIBOutCables1Thickness");
142  tibOutCables2Thickness = trackerMaterial.getParameter<std::vector<double> >("TIBOutCables2Thickness");
143  // Tracker Inner disks layers 1-3
144  tidLayer1Thickness = trackerMaterial.getParameter<std::vector<double> >("TIDLayer1Thickness");
145  tidLayer2Thickness = trackerMaterial.getParameter<std::vector<double> >("TIDLayer2Thickness");
146  tidLayer3Thickness = trackerMaterial.getParameter<std::vector<double> >("TIDLayer3Thickness");
147  // TID outside wall (endcap)
148  tidOutsideThickness = trackerMaterial.getParameter<std::vector<double> >("TIDOutsideThickness");
149  // TOB inside wall (barrel)
150  tobInsideThickness = trackerMaterial.getParameter<std::vector<double> >("TOBInsideThickness");
151  // Tracker Outer barrel layers 1-6
152  tobLayer1Thickness = trackerMaterial.getParameter<std::vector<double> >("TOBLayer1Thickness");
153  tobLayer2Thickness = trackerMaterial.getParameter<std::vector<double> >("TOBLayer2Thickness");
154  tobLayer3Thickness = trackerMaterial.getParameter<std::vector<double> >("TOBLayer3Thickness");
155  tobLayer4Thickness = trackerMaterial.getParameter<std::vector<double> >("TOBLayer4Thickness");
156  tobLayer5Thickness = trackerMaterial.getParameter<std::vector<double> >("TOBLayer5Thickness");
157  tobLayer6Thickness = trackerMaterial.getParameter<std::vector<double> >("TOBLayer6Thickness");
158  // TOB services (endcap)
159  tobOutsideThickness = trackerMaterial.getParameter<std::vector<double> >("TOBOutsideThickness");
160  // Tracker EndCap disks layers 1-9
161  tecLayerThickness = trackerMaterial.getParameter<std::vector<double> >("TECLayerThickness");
162  // TOB outside wall (barrel)
163  barrelCablesThickness = trackerMaterial.getParameter<std::vector<double> >("BarrelCablesThickness");
164  // TEC outside wall (endcap)
165  endcapCables1Thickness = trackerMaterial.getParameter<std::vector<double> >("EndcapCables1Thickness");
166  endcapCables2Thickness = trackerMaterial.getParameter<std::vector<double> >("EndcapCables2Thickness");
167 
168  // Position of dead material layers (cables, services, etc.)
169  // Beam pipe
170  beamPipeRadius = trackerMaterial.getParameter<std::vector<double> >("BeamPipeRadius");
171  beamPipeLength = trackerMaterial.getParameter<std::vector<double> >("BeamPipeLength");
172  // Cables and Services at the end of PIXB1,2,3 ("disk")
173  pxb1CablesInnerRadius = trackerMaterial.getParameter<std::vector<double> >("PXB1CablesInnerRadius");
174  pxb2CablesInnerRadius = trackerMaterial.getParameter<std::vector<double> >("PXB2CablesInnerRadius");
175  pxb3CablesInnerRadius = trackerMaterial.getParameter<std::vector<double> >("PXB3CablesInnerRadius");
176  // Pixel Barrel Outside walls and cables
177  pxbOutCables1InnerRadius = trackerMaterial.getParameter<std::vector<double> >("PXBOutCables1InnerRadius");
178  pxbOutCables1OuterRadius = trackerMaterial.getParameter<std::vector<double> >("PXBOutCables1OuterRadius");
179  pxbOutCables1ZPosition = trackerMaterial.getParameter<std::vector<double> >("PXBOutCables1ZPosition");
180  pxbOutCables2InnerRadius = trackerMaterial.getParameter<std::vector<double> >("PXBOutCables2InnerRadius");
181  pxbOutCables2OuterRadius = trackerMaterial.getParameter<std::vector<double> >("PXBOutCables2OuterRadius");
182  pxbOutCables2ZPosition = trackerMaterial.getParameter<std::vector<double> >("PXBOutCables2ZPosition");
183  // Pixel Outside walls and cables (barrel and endcaps)
184  pixelOutCablesRadius = trackerMaterial.getParameter<std::vector<double> >("PixelOutCablesRadius");
185  pixelOutCablesLength = trackerMaterial.getParameter<std::vector<double> >("PixelOutCablesLength");
186  pixelOutCablesInnerRadius = trackerMaterial.getParameter<std::vector<double> >("PixelOutCablesInnerRadius");
187  pixelOutCablesOuterRadius = trackerMaterial.getParameter<std::vector<double> >("PixelOutCablesOuterRadius");
188  pixelOutCablesZPosition = trackerMaterial.getParameter<std::vector<double> >("PixelOutCablesZPosition");
189  // Tracker Inner Barrel Outside Cables and walls (endcap)
190  tibOutCables1InnerRadius = trackerMaterial.getParameter<std::vector<double> >("TIBOutCables1InnerRadius");
191  tibOutCables1OuterRadius = trackerMaterial.getParameter<std::vector<double> >("TIBOutCables1OuterRadius");
192  tibOutCables1ZPosition = trackerMaterial.getParameter<std::vector<double> >("TIBOutCables1ZPosition");
193  tibOutCables2InnerRadius = trackerMaterial.getParameter<std::vector<double> >("TIBOutCables2InnerRadius");
194  tibOutCables2OuterRadius = trackerMaterial.getParameter<std::vector<double> >("TIBOutCables2OuterRadius");
195  tibOutCables2ZPosition = trackerMaterial.getParameter<std::vector<double> >("TIBOutCables2ZPosition");
196  // Tracker outer barrel Inside wall (barrel)
197  tobInCablesRadius = trackerMaterial.getParameter<std::vector<double> >("TOBInCablesRadius");
198  tobInCablesLength = trackerMaterial.getParameter<std::vector<double> >("TOBInCablesLength");
199  // Tracker Inner Disks Outside Cables and walls
200  tidOutCablesInnerRadius = trackerMaterial.getParameter<std::vector<double> >("TIDOutCablesInnerRadius");
201  tidOutCablesZPosition = trackerMaterial.getParameter<std::vector<double> >("TIDOutCablesZPosition");
202  // Tracker Outer Barrel Outside Cables and walls (barrel and endcaps)
203  tobOutCablesInnerRadius = trackerMaterial.getParameter<std::vector<double> >("TOBOutCablesInnerRadius");
204  tobOutCablesOuterRadius = trackerMaterial.getParameter<std::vector<double> >("TOBOutCablesOuterRadius");
205  tobOutCablesZPosition = trackerMaterial.getParameter<std::vector<double> >("TOBOutCablesZPosition");
206  tobOutCablesRadius = trackerMaterial.getParameter<std::vector<double> >("TOBOutCablesRadius");
207  tobOutCablesLength = trackerMaterial.getParameter<std::vector<double> >("TOBOutCablesLength");
208  // Tracker Endcaps Outside Cables and walls
209  tecOutCables1InnerRadius = trackerMaterial.getParameter<std::vector<double> >("TECOutCables1InnerRadius");
210  tecOutCables1OuterRadius = trackerMaterial.getParameter<std::vector<double> >("TECOutCables1OuterRadius");
211  tecOutCables1ZPosition = trackerMaterial.getParameter<std::vector<double> >("TECOutCables1ZPosition");
212  tecOutCables2InnerRadius = trackerMaterial.getParameter<std::vector<double> >("TECOutCables2InnerRadius");
213  tecOutCables2OuterRadius = trackerMaterial.getParameter<std::vector<double> >("TECOutCables2OuterRadius");
214  tecOutCables2ZPosition = trackerMaterial.getParameter<std::vector<double> >("TECOutCables2ZPosition");
215 
216  // Fudge factors for tracker layer material inhomogeneities
217  fudgeLayer = trackerMaterial.getParameter<std::vector<unsigned int> >("FudgeLayer");
218  fudgeMin = trackerMaterial.getParameter<std::vector<double> >("FudgeMin");
219  fudgeMax = trackerMaterial.getParameter<std::vector<double> >("FudgeMax");
220  fudgeFactor = trackerMaterial.getParameter<std::vector<double> >("FudgeFactor");
221 
222  // The previous std::vector must have the same size!
223  if ( fudgeLayer.size() != fudgeMin.size() ||
224  fudgeLayer.size() != fudgeMax.size() ||
225  fudgeLayer.size() != fudgeFactor.size() ) {
226  throw cms::Exception("FastSimulation/TrackerInteractionGeometry ")
227  << " WARNING with fudge factors ! You have " << fudgeLayer.size()
228  << " layers, but "
229  << fudgeMin.size() << " min values, "
230  << fudgeMax.size() << " max values and "
231  << fudgeFactor.size() << " fudge factor values!"
232  << std::endl
233  << "Please make enter the same number of inputs "
234  << "in FastSimulation/TrackerInteractionGeometry/data/TrackerMaterial.cfi"
235  << std::endl;
236  }
237 
238  // The Beam pipe
239  _theMPBeamPipe = new MediumProperties(beamPipeThickness[version],0.0001);
240  // The pixel barrel layers
241  _theMPPixelBarrel = new MediumProperties(pxbThickness[version],0.0001);
242  // Pixel Barrel services at the end of layers 1-3
243  _theMPPixelOutside1 = new MediumProperties(pxb1CablesThickness[version],0.0001);
244  _theMPPixelOutside2 = new MediumProperties(pxb2CablesThickness[version],0.0001);
245  _theMPPixelOutside3 = new MediumProperties(pxb3CablesThickness[version],0.0001);
246  // Pixel Barrel outside cables
247  _theMPPixelOutside4 = new MediumProperties(pxbOutCables1Thickness[version],0.0001);
248  _theMPPixelOutside = new MediumProperties(pxbOutCables2Thickness[version],0.0001);
249  // The pixel endcap disks
250  _theMPPixelEndcap = new MediumProperties(pxdThickness[version],0.0001);
251  // Pixel Endcap outside cables
252  _theMPPixelOutside5 = new MediumProperties(pxdOutCables1Thickness[version],0.0001);
253  _theMPPixelOutside6 = new MediumProperties(pxdOutCables2Thickness[version],0.0001);
254  // The tracker inner barrel layers 1-4
255  _theMPTIB1 = new MediumProperties(tibLayer1Thickness[version],0.0001);
256  _theMPTIB2 = new MediumProperties(tibLayer2Thickness[version],0.0001);
257  _theMPTIB3 = new MediumProperties(tibLayer3Thickness[version],0.0001);
258  _theMPTIB4 = new MediumProperties(tibLayer4Thickness[version],0.0001);
259  // TIB outside services (endcap)
260  _theMPTIBEOutside1 = new MediumProperties(tibOutCables1Thickness[version],0.0001);
261  _theMPTIBEOutside2 = new MediumProperties(tibOutCables2Thickness[version],0.0001);
262  // The tracker inner disks 1-3
263  _theMPInner1 = new MediumProperties(tidLayer1Thickness[version],0.0001);
264  _theMPInner2 = new MediumProperties(tidLayer2Thickness[version],0.0001);
265  _theMPInner3 = new MediumProperties(tidLayer3Thickness[version],0.0001);
266  // TID outside wall (endcap)
267  _theMPTIDEOutside = new MediumProperties(tidOutsideThickness[version],0.0001);
268  // TOB inside wall (barrel)
269  _theMPTOBBInside = new MediumProperties(tobInsideThickness[version],0.0001);
270  // The tracker outer barrel layers 1-6
271  _theMPTOB1 = new MediumProperties(tobLayer1Thickness[version],0.0001);
272  _theMPTOB2 = new MediumProperties(tobLayer2Thickness[version],0.0001);
273  _theMPTOB3 = new MediumProperties(tobLayer3Thickness[version],0.0001);
274  _theMPTOB4 = new MediumProperties(tobLayer4Thickness[version],0.0001);
275  _theMPTOB5 = new MediumProperties(tobLayer5Thickness[version],0.0001);
276  _theMPTOB6 = new MediumProperties(tobLayer6Thickness[version],0.0001);
277  // TOB services (endcap)
278  _theMPTOBEOutside = new MediumProperties(tobOutsideThickness[version],0.0001);
279  // The tracker endcap disks 1-9
280  _theMPEndcap = new MediumProperties(tecLayerThickness[version],0.0001);
281  // TOB outside wall (barrel)
282  _theMPBarrelOutside = new MediumProperties(barrelCablesThickness[version],0.0001);
283  // TEC outside wall (endcap)
284  _theMPEndcapOutside = new MediumProperties(endcapCables1Thickness[version],0.0001);
285  _theMPEndcapOutside2 = new MediumProperties(endcapCables2Thickness[version],0.0001);
286 
287  // Check that the Reco Tracker Geometry has been loaded
288  if ( !theGeomSearchTracker )
289  throw cms::Exception("FastSimulation/TrackerInteractionGeometry")
290  << "The pointer to the GeometricSearchTracker was not set";
291 
292  // The vector of Barrel Tracker Layers
293  auto const& barrelLayers =
294  theGeomSearchTracker->barrelLayers();
295 
296  // The vector of Forward Tracker Layers (positive z)
297  auto const& posForwardLayers =
298  theGeomSearchTracker->posForwardLayers();
299 
300  // Local pointers
301  BoundCylinder* theCylinder;
302  BoundDisk* theDisk;
303 
304  // Create the nest of cylinders
305  const Surface::PositionType thePosition(0.,0.,0.);
306  const Surface::RotationType theRotation(1.,0.,0.,0.,1.,0.,0.,0.,1.);
307  // Beam Pipe
308  // const SimpleCylinderBounds PIPE( 0.997, 1.003, -300., 300.);
309  const SimpleCylinderBounds PIPE( beamPipeRadius[version]-0.003, beamPipeRadius[version]+0.003,
310  -beamPipeLength[version], beamPipeLength[version]);
311 
312  // Take the active layer position from the Tracker Reco Geometry
313  // Pixel barrel
314  auto bl = barrelLayers.begin();
315  double maxLength = (**bl).specificSurface().bounds().length()/2.+1.7;
316  double maxRadius = (**bl).specificSurface().radius()+0.01;
317  // First pixel barrel layer: r=4.41058, l=53.38
318  const SimpleCylinderBounds PIXB1( maxRadius-0.005, maxRadius+0.005, -maxLength, +maxLength);
319  // "Cables"
320  const SimpleDiskBounds PIXBOut1(pxb1CablesInnerRadius[version],maxRadius+0.01,-0.5,0.5);
321  const Surface::PositionType PPIXBOut1(0.0,0.0,maxLength);
322 
323  // Second pixel barrel layer: r=7.30732, l=53.38
324  ++bl;
325  maxLength = std::max( (**bl).specificSurface().bounds().length()/2.+1.7, maxLength+0.000 );
326  maxRadius = (**bl).specificSurface().radius();
327  const SimpleCylinderBounds PIXB2( maxRadius-0.005, maxRadius+0.005, -maxLength, +maxLength);
328 
329  // "Cables"
330  const SimpleDiskBounds PIXBOut2(pxb2CablesInnerRadius[version],maxRadius+0.005,-0.5,0.5);
331  const Surface::PositionType PPIXBOut2(0.0,0.0,maxLength);
332 
333  // More cables
334  ++bl;
335  maxRadius = (**bl).specificSurface().radius();
336  const SimpleDiskBounds PIXBOut3(pxb3CablesInnerRadius[version],maxRadius,-0.5,0.5);
337  const Surface::PositionType PPIXBOut3(0.0,0.0,maxLength);
338 
339  // Third pixel barrel layer: r=10.1726, l=53.38
340  maxLength = std::max( (**bl).specificSurface().bounds().length()/2.+1.7, maxLength+0.000 );
341  const SimpleCylinderBounds PIXB3( maxRadius-0.005, maxRadius+0.005, -maxLength, +maxLength);
342 
343  // Pixel Barrel Outside walls and cables
344  const SimpleDiskBounds PIXBOut4( pxbOutCables1InnerRadius[version],pxbOutCables1OuterRadius[version],-0.5,0.5);
345  const Surface::PositionType PPIXBOut4(0.0,0.0,pxbOutCables1ZPosition[version]);
346 
347  const SimpleDiskBounds PIXBOut(pxbOutCables2InnerRadius[version],pxbOutCables2OuterRadius[version],-0.5,0.5);
348  const Surface::PositionType PPIXBOut(0.0,0.0,pxbOutCables2ZPosition[version]);
349 
350  const SimpleCylinderBounds PIXBOut5( pixelOutCablesRadius[version]-0.1, pixelOutCablesRadius[version]+0.1,
351  -pixelOutCablesLength[version], pixelOutCablesLength[version]);
352 
353  const SimpleDiskBounds PIXBOut6(pixelOutCablesInnerRadius[version],pixelOutCablesOuterRadius[version],-0.5,0.5);
354  const Surface::PositionType PPIXBOut6(0.0,0.0,pixelOutCablesZPosition[version]);
355 
356 
357  // Tracker Inner Barrel : thin detectors (300 microns)
358  // First TIB layer: r=25.6786, l=130.04
359  ++bl;
360  maxRadius = (**bl).specificSurface().radius();
361  maxLength = (**bl).specificSurface().bounds().length()/2.;
362  const SimpleCylinderBounds TIB1( maxRadius-0.0150, maxRadius+0.0150, -maxLength, +maxLength);
363  // Second TIB layer: r=34.0341, l=131.999
364  ++bl;
365  maxRadius = (**bl).specificSurface().radius();
366  maxLength = std::max( (**bl).specificSurface().bounds().length()/2., maxLength+0.000 );
367  const SimpleCylinderBounds TIB2( maxRadius-0.0150, maxRadius+0.0150, -maxLength, +maxLength);
368  // Third TIB layer: r=41.9599, l=131.628 !!!! Needs to be larger than TIB2
369  ++bl;
370  maxRadius = (**bl).specificSurface().radius();
371  maxLength = std::max( (**bl).specificSurface().bounds().length()/2., maxLength+0.000 );
372  const SimpleCylinderBounds TIB3( maxRadius-0.0150, maxRadius+0.0150, -maxLength, +maxLength);
373  // Fourth TIB layer: r=49.8924, l=132.78
374  ++bl;
375  maxRadius = (**bl).specificSurface().radius();
376  maxLength = std::max( (**bl).specificSurface().bounds().length()/2., maxLength+0.000 );
377  const SimpleCylinderBounds TIB4( maxRadius-0.0150, maxRadius+0.0150, -maxLength, +maxLength);
378 
379  // Inner Barrel Cylinder & Ends : Cables and walls
380  const SimpleDiskBounds TIBEOut(tibOutCables1InnerRadius[version],tibOutCables1OuterRadius[version],-0.05,0.05);
381  const Surface::PositionType PTIBEOut(0.0,0.0,tibOutCables1ZPosition[version]);
382 
383  const SimpleDiskBounds TIBEOut2(tibOutCables2InnerRadius[version],tibOutCables2OuterRadius[version],-0.05,0.05);
384  const Surface::PositionType PTIBEOut2(0.0,0.0,tibOutCables2ZPosition[version]);
385 
386  // Inner Tracker / Outer Barrel Wall
387  const SimpleCylinderBounds TOBCIn ( tobInCablesRadius[version]-0.5, tobInCablesRadius[version]+0.5,
388  -tobInCablesLength[version], tobInCablesLength[version]);
389 
390  // First TOB layer: r=60.7671, l=216.576
391  ++bl;
392  maxRadius = (**bl).specificSurface().radius();
393  maxLength = (**bl).specificSurface().bounds().length()/2.+0.0;
394  const SimpleCylinderBounds TOB1( maxRadius-0.0150, maxRadius+0.0150, -maxLength, +maxLength);
395  // Second TOB layer: r=69.3966, l=216.576
396  ++bl;
397  maxRadius = (**bl).specificSurface().radius();
398  maxLength = std::max( (**bl).specificSurface().bounds().length()/2.+0.0, maxLength+0.000 );
399  const SimpleCylinderBounds TOB2( maxRadius-0.0150, maxRadius+0.0150, -maxLength, +maxLength);
400  // Third TOB layer: r=78.0686, l=216.576
401  ++bl;
402  maxRadius = (**bl).specificSurface().radius();
403  maxLength = std::max( (**bl).specificSurface().bounds().length()/2.+0.0, maxLength+0.000 );
404  const SimpleCylinderBounds TOB3( maxRadius-0.0150, maxRadius+0.0150, -maxLength, +maxLength);
405  // Fourth TOB layer: r=86.8618, l=216.576
406  ++bl;
407  maxRadius = (**bl).specificSurface().radius();
408  maxLength = std::max( (**bl).specificSurface().bounds().length()/2.+0.0, maxLength+0.000 );
409  const SimpleCylinderBounds TOB4( maxRadius-0.0150, maxRadius+0.0150, -maxLength, +maxLength);
410  // Fifth TOB layer: r=96.5557, l=216.576
411  ++bl;
412  maxRadius = (**bl).specificSurface().radius();
413  maxLength = std::max( (**bl).specificSurface().bounds().length()/2.+0.0, maxLength+0.000 );
414  const SimpleCylinderBounds TOB5( maxRadius-0.0150, maxRadius+0.0150, -maxLength, +maxLength);
415  // Sixth TOB layer: r=108.05, l=216.576
416  ++bl;
417  maxRadius = (**bl).specificSurface().radius();
418  maxLength = std::max( (**bl).specificSurface().bounds().length()/2.+0.0, maxLength+0.000 );
419  const SimpleCylinderBounds TOB6( maxRadius-0.0150, maxRadius+0.0150, -maxLength, +maxLength);
420 
421  const SimpleDiskBounds TOBEOut(tobOutCablesInnerRadius[version],tobOutCablesOuterRadius[version],-0.5,0.5);
422  const Surface::PositionType PTOBEOut(0.0,0.0,tobOutCablesZPosition[version]);
423 
424  const Surface::RotationType theRotation2(1.,0.,0.,0.,1.,0.,0.,0.,1.);
425 
426  // Outside : Barrel
427  const SimpleCylinderBounds TBOut ( tobOutCablesRadius[version]-0.5, tobOutCablesRadius[version]+0.5,
428  -tobOutCablesLength[version], tobOutCablesLength[version]);
429 
430  // And now the disks...
431  auto fl = posForwardLayers.begin();
432 
433  // Pixel disks
434  // First Pixel disk: Z pos 35.5 radii 5.42078, 16.0756
435  double innerRadius = (**fl).specificSurface().innerRadius()-1.0;
436  double outerRadius = (**fl).specificSurface().outerRadius()+2.0;
437  const SimpleDiskBounds PIXD1(innerRadius, outerRadius,-0.0150,+0.0150);
438  const Surface::PositionType PPIXD1(0.0,0.0,(**fl).surface().position().z());
439  // Second Pixel disk: Z pos 48.5 radii 5.42078, 16.0756
440  ++fl;
441  innerRadius = (**fl).specificSurface().innerRadius()-1.0;
442  outerRadius = std::max( (**fl).specificSurface().outerRadius()+2.0, outerRadius+0.000 );
443  const SimpleDiskBounds PIXD2(innerRadius, outerRadius,-0.0150,+0.0150);
444  const Surface::PositionType PPIXD2(0.0,0.0,(**fl).surface().position().z());
445 
446  // Tracker Inner disks (add 3 cm for the outer radius to simulate cables,
447  // and remove 1cm to inner radius to allow for some extrapolation margin)
448  // First TID : Z pos 78.445 radii 23.14, 50.4337
449  ++fl;
450  innerRadius = (**fl).specificSurface().innerRadius()-0.5;
451  outerRadius = (**fl).specificSurface().outerRadius()+3.5;
452  const SimpleDiskBounds TID1(innerRadius,outerRadius,-0.0150,+0.0150);
453  const Surface::PositionType PTID1(0.,0.,(**fl).surface().position().z());
454  // Second TID : Z pos 90.445 radii 23.14, 50.4337
455  ++fl;
456  innerRadius = (**fl).specificSurface().innerRadius()-0.5;
457  outerRadius = std::max( (**fl).specificSurface().outerRadius()+3.5, outerRadius+0.000);
458  const SimpleDiskBounds TID2(innerRadius,outerRadius,-0.0150,+0.0150);
459  const Surface::PositionType PTID2(0.,0.,(**fl).surface().position().z());
460  // Third TID : Z pos 105.445 radii 23.14, 50.4337
461  ++fl;
462  innerRadius = (**fl).specificSurface().innerRadius()-0.5;
463  outerRadius = std::max( (**fl).specificSurface().outerRadius()+3.5, outerRadius+0.000);
464  const SimpleDiskBounds TID3(innerRadius,outerRadius,-0.0150,+0.0150);
465  const Surface::PositionType PTID3(0.,0.,(**fl).surface().position().z());
466 
467  // TID Wall and cables
468  const SimpleDiskBounds TIDEOut(tidOutCablesInnerRadius[version],outerRadius+1.0,-0.5,0.5);
469  const Surface::PositionType PTIDEOut(0.0,0.0,tidOutCablesZPosition[version]);
470 
471 
472  // Tracker Endcaps : Add 11 cm to outer radius to correct for a bug, remove
473  // 5cm to the inner radius (TEC7,8,9) to correct for a simular bug, and
474  // remove other 2cm to inner radius to allow for some extrapolation margin
475  // First TEC: Z pos 131.892 radii 23.3749, 99.1967
476  ++fl;
477  innerRadius = (**fl).specificSurface().innerRadius()-1.5;
478  outerRadius = (**fl).specificSurface().outerRadius()+2.0;
479  const SimpleDiskBounds TEC1(innerRadius,outerRadius,-0.0150,+0.0150);
480  const Surface::PositionType PTEC1(0.,0,(**fl).surface().position().z());
481  // Second TEC: Z pos 145.892 radii 23.3749, 99.1967
482  ++fl;
483  innerRadius = (**fl).specificSurface().innerRadius()-1.5;
484  outerRadius = std::max( (**fl).specificSurface().outerRadius()+2.0, outerRadius+0.000 );
485  const SimpleDiskBounds TEC2(innerRadius,outerRadius,-0.0150,+0.0150);
486  const Surface::PositionType PTEC2(0.,0.,(**fl).surface().position().z());
487  // Third TEC: Z pos 159.892 radii 23.3749, 99.1967
488  ++fl;
489  innerRadius = (**fl).specificSurface().innerRadius()-1.5;
490  outerRadius = std::max( (**fl).specificSurface().outerRadius()+2.0, outerRadius+0.000 );
491  const SimpleDiskBounds TEC3(innerRadius,outerRadius,-0.0150,+0.0150);
492  const Surface::PositionType PTEC3(0.,0.,(**fl).surface().position().z());
493  // Fourth TEC: Z pos 173.892 radii 32.1263, 99.1967
494  ++fl;
495  innerRadius = (**fl).specificSurface().innerRadius()-2.5;
496  outerRadius = std::max( (**fl).specificSurface().outerRadius()+2.0, outerRadius+0.000 );
497  const SimpleDiskBounds TEC4(innerRadius,outerRadius,-0.0150,+0.0150);
498  const Surface::PositionType PTEC4(0.,0.,(**fl).surface().position().z());
499  // Fifth TEC: Z pos 187.892 radii 32.1263, 99.1967
500  ++fl;
501  innerRadius = (**fl).specificSurface().innerRadius()-2.5;
502  outerRadius = std::max( (**fl).specificSurface().outerRadius()+2.0, outerRadius+0.000 );
503  const SimpleDiskBounds TEC5(innerRadius,outerRadius,-0.0150,+0.0150);
504  const Surface::PositionType PTEC5(0.,0.,(**fl).surface().position().z());
505  // Sixth TEC: Z pos 205.392 radii 32.1263, 99.1967
506  ++fl;
507  innerRadius = (**fl).specificSurface().innerRadius()-2.5;
508  outerRadius = std::max( (**fl).specificSurface().outerRadius()+2.0, outerRadius+0.000 );
509  const SimpleDiskBounds TEC6(innerRadius,outerRadius,-0.0150,+0.0150);
510  const Surface::PositionType PTEC6(0.,0.,(**fl).surface().position().z());
511  // Seventh TEC: Z pos 224.121 radii 44.7432, 99.1967
512  ++fl;
513  innerRadius = (**fl).specificSurface().innerRadius()-9.5;
514  outerRadius = std::max( (**fl).specificSurface().outerRadius()+2.0, outerRadius+0.000 );
515  const SimpleDiskBounds TEC7(innerRadius,outerRadius,-0.0150,+0.0150);
516  const Surface::PositionType PTEC7(0.,0.,(**fl).surface().position().z());
517  // Eighth TEC: Z pos 244.621 radii 44.7432, 99.1967
518  ++fl;
519  innerRadius = (**fl).specificSurface().innerRadius()-9.5;
520  outerRadius = std::max( (**fl).specificSurface().outerRadius()+2.0, outerRadius+0.000 );
521  const SimpleDiskBounds TEC8(innerRadius,outerRadius,-0.0150,+0.0150);
522  const Surface::PositionType PTEC8(0.,0.,(**fl).surface().position().z());
523  // Nineth TEC: Z pos 266.121 radii 56.1781, 99.1967
524  ++fl;
525  innerRadius = (**fl).specificSurface().innerRadius()-20.5;
526  outerRadius = std::max( (**fl).specificSurface().outerRadius()+2.0, outerRadius+0.000 );
527  const SimpleDiskBounds TEC9(innerRadius,outerRadius,-0.0150,+0.0150);
528  const Surface::PositionType PTEC9(0.,0.,(**fl).surface().position().z());
529 
530  // Outside : Endcap
531  const SimpleDiskBounds TEOut(tecOutCables1InnerRadius[version],tecOutCables1OuterRadius[version],-0.5,0.5);
532  const Surface::PositionType PTEOut(0.0,0.0,tecOutCables1ZPosition[version]);
533 
534  const SimpleDiskBounds TEOut2(tecOutCables2InnerRadius[version],tecOutCables2OuterRadius[version],-0.5,0.5);
535  const Surface::PositionType PTEOut2(0.0,0.0,tecOutCables2ZPosition[version]);
536 
537  // The ordering of disks and cylinders is essential here
538  // (from inside to outside)
539  // Do not change it thoughtlessly.
540 
541 
542  // Beam Pipe
543 
544  unsigned layerNr = 100;
545  theCylinder = new BoundCylinder(thePosition,theRotation,PIPE);
546  theCylinder->setMediumProperties(*_theMPBeamPipe);
547  if ( theCylinder->mediumProperties().radLen() > 0. )
548  _theCylinders.push_back(TrackerLayer(theCylinder,false,layerNr,
549  minDim(layerNr),maxDim(layerNr),
550  fudgeFactors(layerNr)));
551  else
552  delete theCylinder;
553 
554  // Pixels
555 
557  theCylinder = new BoundCylinder(thePosition,theRotation,PIXB1);
558  theCylinder->setMediumProperties(*_theMPPixelBarrel);
559  if ( theCylinder->mediumProperties().radLen() > 0. )
560  _theCylinders.push_back(TrackerLayer(theCylinder,false,layerNr,
561  minDim(layerNr),maxDim(layerNr),
562  fudgeFactors(layerNr)));
563  else
564  delete theCylinder;
565 
566  layerNr = 101;
567  theDisk = new BoundDisk(PPIXBOut1,theRotation2,PIXBOut1);
568  theDisk->setMediumProperties(*_theMPPixelOutside1);
569  if ( theDisk->mediumProperties().radLen() > 0. )
570  _theCylinders.push_back(TrackerLayer(theDisk,true,layerNr,
571  minDim(layerNr),maxDim(layerNr),
572  fudgeFactors(layerNr)));
573  else
574  delete theDisk;
575 
577  theCylinder = new BoundCylinder(thePosition,theRotation,PIXB2);
578  theCylinder->setMediumProperties(*_theMPPixelBarrel);
579  if ( theCylinder->mediumProperties().radLen() > 0. )
580  _theCylinders.push_back(TrackerLayer(theCylinder,false,layerNr,
581  minDim(layerNr),maxDim(layerNr),
582  fudgeFactors(layerNr)));
583  else
584  delete theCylinder;
585 
586  layerNr = 102;
587  theDisk = new BoundDisk(PPIXBOut2,theRotation2,PIXBOut2);
588  theDisk->setMediumProperties(*_theMPPixelOutside2);
589  if ( theDisk->mediumProperties().radLen() > 0. )
590  _theCylinders.push_back(TrackerLayer(theDisk,true,layerNr,
591  minDim(layerNr),maxDim(layerNr),
592  fudgeFactors(layerNr)));
593  else
594  delete theDisk;
595 
596  layerNr = 103;
597  theDisk = new BoundDisk(PPIXBOut3,theRotation2,PIXBOut3);
598  theDisk->setMediumProperties(*_theMPPixelOutside3);
599  if ( theDisk->mediumProperties().radLen() > 0. )
600  _theCylinders.push_back(TrackerLayer(theDisk,true,layerNr,
601  minDim(layerNr),maxDim(layerNr),
602  fudgeFactors(layerNr)));
603  else
604  delete theDisk;
605 
607  theCylinder = new BoundCylinder(thePosition,theRotation,PIXB3);
608  theCylinder->setMediumProperties(*_theMPPixelBarrel);
609  if ( theCylinder->mediumProperties().radLen() > 0. )
610  _theCylinders.push_back(TrackerLayer(theCylinder,false,layerNr,
611  minDim(layerNr),maxDim(layerNr),
612  fudgeFactors(layerNr)));
613  else
614  delete theCylinder;
615 
616  layerNr = 104;
617  theDisk = new BoundDisk(PPIXBOut4,theRotation2,PIXBOut4);
618  theDisk->setMediumProperties(*_theMPPixelOutside4);
619  if ( theDisk->mediumProperties().radLen() > 0. )
620  _theCylinders.push_back(TrackerLayer(theDisk,true,layerNr,
621  minDim(layerNr),maxDim(layerNr),
622  fudgeFactors(layerNr)));
623  else
624  delete theDisk;
625 
626  layerNr = 105;
627  theDisk = new BoundDisk(PPIXBOut,theRotation2,PIXBOut);
628  theDisk->setMediumProperties(*_theMPPixelOutside);
629  if ( theDisk->mediumProperties().radLen() > 0. )
630  _theCylinders.push_back(TrackerLayer(theDisk,true,layerNr,
631  minDim(layerNr),maxDim(layerNr),
632  fudgeFactors(layerNr)));
633  else
634  delete theDisk;
635 
637  theDisk = new BoundDisk(PPIXD1,theRotation2,PIXD1);
638  theDisk->setMediumProperties(*_theMPPixelEndcap);
639  if ( theDisk->mediumProperties().radLen() > 0. )
640  _theCylinders.push_back(TrackerLayer(theDisk,true,layerNr,
641  minDim(layerNr),maxDim(layerNr),
642  fudgeFactors(layerNr)));
643  else
644  delete theDisk;
645 
647  theDisk = new BoundDisk(PPIXD2,theRotation2,PIXD2);
648  theDisk->setMediumProperties(*_theMPPixelEndcap);
649  if ( theDisk->mediumProperties().radLen() > 0. )
650  _theCylinders.push_back(TrackerLayer(theDisk,true,layerNr,
651  minDim(layerNr),maxDim(layerNr),
652  fudgeFactors(layerNr)));
653  else
654  delete theDisk;
655 
656  layerNr = 106;
657  theCylinder = new BoundCylinder(thePosition,theRotation,PIXBOut5);
658  theCylinder->setMediumProperties(*_theMPPixelOutside5);
659  if ( theCylinder->mediumProperties().radLen() > 0. )
660  _theCylinders.push_back(TrackerLayer(theCylinder,false,layerNr,
661  minDim(layerNr),maxDim(layerNr),
662  fudgeFactors(layerNr)));
663  else
664  delete theCylinder;
665 
666  layerNr = 107;
667  theDisk = new BoundDisk(PPIXBOut6,theRotation2,PIXBOut6);
668  theDisk->setMediumProperties(*_theMPPixelOutside6);
669  if ( theDisk->mediumProperties().radLen() > 0. )
670  _theCylinders.push_back(TrackerLayer(theDisk,true,layerNr,
671  minDim(layerNr),maxDim(layerNr),
672  fudgeFactors(layerNr)));
673  else
674  delete theDisk;
675 
676  // Inner Barrel
677 
679  theCylinder = new BoundCylinder(thePosition,theRotation,TIB1);
680  theCylinder->setMediumProperties(*_theMPTIB1);
681  if ( theCylinder->mediumProperties().radLen() > 0. )
682  _theCylinders.push_back(TrackerLayer(theCylinder,false,layerNr,
683  minDim(layerNr),maxDim(layerNr),
684  fudgeFactors(layerNr)));
685  else
686  delete theCylinder;
687 
689  theCylinder = new BoundCylinder(thePosition,theRotation,TIB2);
690  theCylinder->setMediumProperties(*_theMPTIB2);
691  if ( theCylinder->mediumProperties().radLen() > 0. )
692  _theCylinders.push_back(TrackerLayer(theCylinder,false,layerNr,
693  minDim(layerNr),maxDim(layerNr),
694  fudgeFactors(layerNr)));
695  else
696  delete theCylinder;
697 
699  theCylinder = new BoundCylinder(thePosition,theRotation,TIB3);
700  theCylinder->setMediumProperties(*_theMPTIB3);
701  if ( theCylinder->mediumProperties().radLen() > 0. )
702  _theCylinders.push_back(TrackerLayer(theCylinder,false,layerNr,
703  minDim(layerNr),maxDim(layerNr),
704  fudgeFactors(layerNr)));
705  else
706  delete theCylinder;
707 
709  theCylinder = new BoundCylinder(thePosition,theRotation,TIB4);
710  theCylinder->setMediumProperties(*_theMPTIB4);
711  if ( theCylinder->mediumProperties().radLen() > 0. )
712  _theCylinders.push_back(TrackerLayer(theCylinder,false,layerNr,
713  minDim(layerNr),maxDim(layerNr),
714  fudgeFactors(layerNr)));
715  else
716  delete theCylinder;
717 
718  layerNr = 108;
719  theDisk = new BoundDisk(PTIBEOut,theRotation2,TIBEOut);
720  theDisk->setMediumProperties(*_theMPTIBEOutside1);
721  if ( theDisk->mediumProperties().radLen() > 0. )
722  _theCylinders.push_back(TrackerLayer(theDisk,true,layerNr,
723  minDim(layerNr),maxDim(layerNr),
724  fudgeFactors(layerNr)));
725  else
726  delete theDisk;
727 
728  layerNr = 109;
729  theDisk = new BoundDisk(PTIBEOut2,theRotation2,TIBEOut2);
730  theDisk->setMediumProperties(*_theMPTIBEOutside2);
731  if ( theDisk->mediumProperties().radLen() > 0. )
732  _theCylinders.push_back(TrackerLayer(theDisk,true,layerNr,
733  minDim(layerNr),maxDim(layerNr),
734  fudgeFactors(layerNr)));
735  else
736  delete theDisk;
737 
738  // Inner Endcaps
739 
741  theDisk = new BoundDisk(PTID1,theRotation2,TID1);
742  theDisk->setMediumProperties(*_theMPInner1);
743  if ( theDisk->mediumProperties().radLen() > 0. )
744  _theCylinders.push_back(TrackerLayer(theDisk,layerNr,
745  minDim(layerNr),maxDim(layerNr),
746  fudgeFactors(layerNr)));
747  else
748  delete theDisk;
749 
751  theDisk = new BoundDisk(PTID2,theRotation2,TID2);
752  theDisk->setMediumProperties(*_theMPInner2);
753  if ( theDisk->mediumProperties().radLen() > 0. )
754  _theCylinders.push_back(TrackerLayer(theDisk,layerNr,
755  minDim(layerNr),maxDim(layerNr),
756  fudgeFactors(layerNr)));
757 
758  else
759  delete theDisk;
760 
762  theDisk = new BoundDisk(PTID3,theRotation2,TID3);
763  theDisk->setMediumProperties(*_theMPInner3);
764  if ( theDisk->mediumProperties().radLen() > 0. )
765  _theCylinders.push_back(TrackerLayer(theDisk,12,layerNr,
766  minDim(layerNr),maxDim(layerNr),
767  fudgeFactors(layerNr)));
768  else
769  delete theDisk;
770 
771  layerNr = 110;
772  theDisk = new BoundDisk(PTIDEOut,theRotation2,TIDEOut);
773  theDisk->setMediumProperties(*_theMPTIDEOutside);
774  if ( theDisk->mediumProperties().radLen() > 0. )
775  _theCylinders.push_back(TrackerLayer(theDisk,true,layerNr,
776  minDim(layerNr),maxDim(layerNr),
777  fudgeFactors(layerNr)));
778  else
779  delete theDisk;
780 
781 
782  // Outer Barrel
783 
784  layerNr = 111;
785  theCylinder = new BoundCylinder(thePosition,theRotation,TOBCIn);
786  theCylinder->setMediumProperties(*_theMPTOBBInside);
787  if ( theCylinder->mediumProperties().radLen() > 0. )
788  _theCylinders.push_back(TrackerLayer(theCylinder,false,layerNr,
789  minDim(layerNr),maxDim(layerNr),
790  fudgeFactors(layerNr)));
791  else
792  delete theCylinder;
793 
795  theCylinder = new BoundCylinder(thePosition,theRotation,TOB1);
796  theCylinder->setMediumProperties(*_theMPTOB1);
797  if ( theCylinder->mediumProperties().radLen() > 0. )
798  _theCylinders.push_back(TrackerLayer(theCylinder,false,layerNr,
799  minDim(layerNr),maxDim(layerNr),
800  fudgeFactors(layerNr)));
801  else
802  delete theCylinder;
803 
805  theCylinder = new BoundCylinder(thePosition,theRotation,TOB2);
806  theCylinder->setMediumProperties(*_theMPTOB2);
807  if ( theCylinder->mediumProperties().radLen() > 0. )
808  _theCylinders.push_back(TrackerLayer(theCylinder,false,layerNr,
809  minDim(layerNr),maxDim(layerNr),
810  fudgeFactors(layerNr)));
811  else
812  delete theCylinder;
813 
815  theCylinder = new BoundCylinder(thePosition,theRotation,TOB3);
816  theCylinder->setMediumProperties(*_theMPTOB3);
817  if ( theCylinder->mediumProperties().radLen() > 0. )
818  _theCylinders.push_back(TrackerLayer(theCylinder,false,layerNr,
819  minDim(layerNr),maxDim(layerNr),
820  fudgeFactors(layerNr)));
821  else
822  delete theCylinder;
823 
825  theCylinder = new BoundCylinder(thePosition,theRotation,TOB4);
826  theCylinder->setMediumProperties(*_theMPTOB4);
827  if ( theCylinder->mediumProperties().radLen() > 0. )
828  _theCylinders.push_back(TrackerLayer(theCylinder,false,layerNr,
829  minDim(layerNr),maxDim(layerNr),
830  fudgeFactors(layerNr)));
831  else
832  delete theCylinder;
833 
835  theCylinder = new BoundCylinder(thePosition,theRotation,TOB5);
836  theCylinder->setMediumProperties(*_theMPTOB5);
837  if ( theCylinder->mediumProperties().radLen() > 0. )
838  _theCylinders.push_back(TrackerLayer(theCylinder,false,layerNr,
839  minDim(layerNr),maxDim(layerNr),
840  fudgeFactors(layerNr)));
841  else
842  delete theCylinder;
843 
845  theCylinder = new BoundCylinder(thePosition,theRotation,TOB6);
846  theCylinder->setMediumProperties(*_theMPTOB6);
847  if ( theCylinder->mediumProperties().radLen() > 0. )
848  _theCylinders.push_back(TrackerLayer(theCylinder,false,layerNr,
849  minDim(layerNr),maxDim(layerNr),
850  fudgeFactors(layerNr)));
851  else
852  delete theCylinder;
853 
854  layerNr = 112;
855  theDisk = new BoundDisk(PTOBEOut,theRotation2,TOBEOut);
856  theDisk->setMediumProperties(*_theMPTOBEOutside);
857  if ( theDisk->mediumProperties().radLen() > 0. )
858  _theCylinders.push_back(TrackerLayer(theDisk,true,layerNr,
859  minDim(layerNr),maxDim(layerNr),
860  fudgeFactors(layerNr)));
861  else
862  delete theDisk;
863 
864  // Outer Endcaps
865 
867  theDisk = new BoundDisk(PTEC1,theRotation2,TEC1);
868  theDisk->setMediumProperties(*_theMPEndcap);
869  if ( theDisk->mediumProperties().radLen() > 0. )
870  _theCylinders.push_back(TrackerLayer(theDisk,layerNr,
871  minDim(layerNr),maxDim(layerNr),
872  fudgeFactors(layerNr)));
873  else
874  delete theDisk;
875 
877  theDisk = new BoundDisk(PTEC2,theRotation2,TEC2);
878  theDisk->setMediumProperties(*_theMPEndcap);
879  if ( theDisk->mediumProperties().radLen() > 0. )
880  _theCylinders.push_back(TrackerLayer(theDisk,layerNr,
881  minDim(layerNr),maxDim(layerNr),
882  fudgeFactors(layerNr)));
883  else
884  delete theDisk;
885 
887  theDisk = new BoundDisk(PTEC3,theRotation2,TEC3);
888  theDisk->setMediumProperties(*_theMPEndcap);
889  if ( theDisk->mediumProperties().radLen() > 0. )
890  _theCylinders.push_back(TrackerLayer(theDisk,layerNr,
891  minDim(layerNr),maxDim(layerNr),
892  fudgeFactors(layerNr)));
893  else
894  delete theDisk;
895 
897  theDisk = new BoundDisk(PTEC4,theRotation2,TEC4);
898  theDisk->setMediumProperties(*_theMPEndcap);
899  if ( theDisk->mediumProperties().radLen() > 0. )
900  _theCylinders.push_back(TrackerLayer(theDisk,layerNr,
901  minDim(layerNr),maxDim(layerNr),
902  fudgeFactors(layerNr)));
903  else
904  delete theDisk;
905 
907  theDisk = new BoundDisk(PTEC5,theRotation2,TEC5);
908  theDisk->setMediumProperties(*_theMPEndcap);
909  if ( theDisk->mediumProperties().radLen() > 0. )
910  _theCylinders.push_back(TrackerLayer(theDisk,layerNr,
911  minDim(layerNr),maxDim(layerNr),
912  fudgeFactors(layerNr)));
913  else
914  delete theDisk;
915 
917  theDisk = new BoundDisk(PTEC6,theRotation2,TEC6);
918  theDisk->setMediumProperties(*_theMPEndcap);
919  if ( theDisk->mediumProperties().radLen() > 0. )
920  _theCylinders.push_back(TrackerLayer(theDisk,layerNr,
921  minDim(layerNr),maxDim(layerNr),
922  fudgeFactors(layerNr)));
923  else
924  delete theDisk;
925 
927  theDisk = new BoundDisk(PTEC7,theRotation2,TEC7);
928  theDisk->setMediumProperties(*_theMPEndcap);
929  if ( theDisk->mediumProperties().radLen() > 0. )
930  _theCylinders.push_back(TrackerLayer(theDisk,layerNr,
931  minDim(layerNr),maxDim(layerNr),
932  fudgeFactors(layerNr)));
933  else
934  delete theDisk;
935 
937  theDisk = new BoundDisk(PTEC8,theRotation2,TEC8);
938  theDisk->setMediumProperties(*_theMPEndcap);
939  if ( theDisk->mediumProperties().radLen() > 0. )
940  _theCylinders.push_back(TrackerLayer(theDisk,layerNr,
941  minDim(layerNr),maxDim(layerNr),
942  fudgeFactors(layerNr)));
943  else
944  delete theDisk;
945 
947  theDisk = new BoundDisk(PTEC9,theRotation2,TEC9);
948  theDisk->setMediumProperties(*_theMPEndcap);
949  if ( theDisk->mediumProperties().radLen() > 0. )
950  _theCylinders.push_back(TrackerLayer(theDisk,layerNr,
951  minDim(layerNr),maxDim(layerNr),
952  fudgeFactors(layerNr)));
953  else
954  delete theDisk;
955 
956 
957  // Tracker Outside
958 
959  layerNr = 113;
960  theCylinder = new BoundCylinder(thePosition,theRotation,TBOut);
961  theCylinder->setMediumProperties(*_theMPBarrelOutside);
962  if ( theCylinder->mediumProperties().radLen() > 0. )
963  _theCylinders.push_back(TrackerLayer(theCylinder,false,layerNr,
964  minDim(layerNr),maxDim(layerNr),
965  fudgeFactors(layerNr)));
966  else
967  delete theCylinder;
968 
969  layerNr = 114;
970  theDisk = new BoundDisk(PTEOut,theRotation2,TEOut);
971  theDisk->setMediumProperties(*_theMPEndcapOutside);
972  if ( theDisk->mediumProperties().radLen() > 0. )
973  _theCylinders.push_back(TrackerLayer(theDisk,true,layerNr,
974  minDim(layerNr),maxDim(layerNr),
975  fudgeFactors(layerNr)));
976  else
977  delete theDisk;
978 
979  layerNr = 115;
980  theDisk = new BoundDisk(PTEOut2,theRotation2,TEOut2);
981  theDisk->setMediumProperties(*_theMPEndcapOutside2);
982  if ( theDisk->mediumProperties().radLen() > 0. )
983  _theCylinders.push_back(TrackerLayer(theDisk,true,layerNr,
984  minDim(layerNr),maxDim(layerNr),
985  fudgeFactors(layerNr)));
986  else
987  delete theDisk;
988 
989  }
990 
991 
992  // Check overall compatibility of cylinder dimensions
993  // (must be nested cylinders)
994  // Throw an exception if the test fails
995  double zin, rin;
996  double zout, rout;
997  unsigned nCyl=0;
998  std::list<TrackerLayer>::const_iterator cyliterOut=cylinderBegin();
999  // Inner cylinder dimensions
1000  if ( cyliterOut->forward() ) {
1001  zin = cyliterOut->disk()->position().z();
1002  rin = cyliterOut->disk()->outerRadius();
1003  } else {
1004  zin = cyliterOut->cylinder()->bounds().length()/2.;
1005  rin = cyliterOut->cylinder()->bounds().width()/2.;
1006  }
1007  // Go to the next cylinder
1008  ++cyliterOut;
1009 
1010 
1011  // And loop over all cylinders
1012  while ( cyliterOut != cylinderEnd() ) {
1013  // Outer cylinder dimensions
1014  if ( cyliterOut->forward() ) {
1015  zout = cyliterOut->disk()->position().z();
1016  rout = cyliterOut->disk()->outerRadius();
1017  } else {
1018  zout = cyliterOut->cylinder()->bounds().length()/2.;
1019  rout = cyliterOut->cylinder()->bounds().width()/2.;
1020  }
1021 
1022  nCyl++;
1023  if ( zout < zin || rout < rin ) {
1024  throw cms::Exception("FastSimulation/TrackerInteractionGeometry ")
1025  << " WARNING with cylinder number " << nCyl
1026  << " (Active Layer Number = " << cyliterOut->layerNumber()
1027  << " Forward ? " << cyliterOut->forward() << " ) "
1028  << " has dimensions smaller than previous cylinder : " << std::endl
1029  << " zout/zin = " << zout << " " << zin << std::endl
1030  << " rout/rin = " << rout << " " << rin << std::endl;
1031  } else {
1032  /*
1033  std::cout << " Cylinder number " << nCyl
1034  << " (Active Layer Number = " << cyliterOut->layerNumber()
1035  << " Forward ? " << cyliterOut->forward() << " ) "
1036  << " has dimensions of : "
1037  << " zout = " << zout << "; "
1038  << " rout = " << rout << std::endl;
1039  */
1040  }
1041 
1042  // Go to the next cylinder
1043  cyliterOut++;
1044  // Inner cylinder becomes outer cylinder
1045  zin = zout;
1046  rin = rout;
1047  // End test
1048  }
1049 
1050 }
1051 
1052 std::vector<double>
1054  std::vector<double> min;
1055  for ( unsigned iLayer=0; iLayer<fudgeFactor.size(); ++iLayer ) {
1056  if ( layerNr != fudgeLayer[iLayer] ) continue;
1057  min.push_back(fudgeMin[iLayer]);
1058  }
1059  return min;
1060 }
1061 
1062 std::vector<double>
1064  std::vector<double> max;
1065  for ( unsigned iLayer=0; iLayer<fudgeFactor.size(); ++iLayer ) {
1066  if ( layerNr != fudgeLayer[iLayer] ) continue;
1067  max.push_back(fudgeMax[iLayer]);
1068  }
1069  return max;
1070 }
1071 
1072 std::vector<double>
1074  std::vector<double> fudge;
1075  for ( unsigned iLayer=0; iLayer<fudgeFactor.size(); ++iLayer ) {
1076  if ( layerNr != fudgeLayer[iLayer] ) continue;
1077  fudge.push_back(fudgeFactor[iLayer]);
1078  }
1079  return fudge;
1080 }
1081 
1083 {
1084  _theCylinders.clear();
1085  // _theRings.clear();
1086 
1087  if(use_hardcoded){
1088  // The Beam pipe
1089  delete _theMPBeamPipe;
1090  // The pixel barrel layers
1091  delete _theMPPixelBarrel;
1092  // The pixel endcap disks
1093  delete _theMPPixelEndcap;
1094  // The various cables thicnesses for each layer / disks
1095  delete _theMPPixelOutside1;
1096  delete _theMPPixelOutside2;
1097  delete _theMPPixelOutside3;
1098  delete _theMPPixelOutside4;
1099  delete _theMPPixelOutside;
1100  delete _theMPPixelOutside5;
1101  delete _theMPPixelOutside6;
1102  // The tracker inner barrel layers
1103  delete _theMPTIB1;
1104  delete _theMPTIB2;
1105  delete _theMPTIB3;
1106  delete _theMPTIB4;
1107  // The tracker outer barrel layers
1108  delete _theMPTOB1;
1109  delete _theMPTOB2;
1110  delete _theMPTOB3;
1111  delete _theMPTOB4;
1112  delete _theMPTOB5;
1113  delete _theMPTOB6;
1114  // The tracker inner disks
1115  delete _theMPInner1;
1116  delete _theMPInner2;
1117  delete _theMPInner3;
1118  // The tracker endcap disks
1119  delete _theMPEndcap;
1120  // Various cable thicknesses
1121  delete _theMPTOBBInside;
1122  delete _theMPTIBEOutside1;
1123  delete _theMPTIBEOutside2;
1124  delete _theMPTIDEOutside;
1125  delete _theMPTOBEOutside;
1126  delete _theMPBarrelOutside;
1127  delete _theMPEndcapOutside;
1128  delete _theMPEndcapOutside2;
1129 
1130  }
1131  else {
1132  for(unsigned int i = 0; i < _mediumProperties.size(); i++){
1133  delete _mediumProperties[i];
1134  }
1135  }
1136 
1137 }
std::vector< double > pixelOutCablesLength
MediumProperties * _theMPEndcap
The Tracker EndCap layers.
std::vector< double > tibOutCables2OuterRadius
T getParameter(std::string const &) const
std::vector< double > pxbOutCables2OuterRadius
MediumProperties * _theMPTOB3
The tracker outer barrel layer 3.
std::vector< double > tobLayer5Thickness
std::vector< double > pxdThickness
Pixel Disks 1-2.
std::vector< double > pxbThickness
Pixel Barrel Layers 1-3.
std::vector< double > pixelOutCablesOuterRadius
std::vector< double > pxbOutCables1Thickness
Pixel Barrel outside cables.
std::vector< double > tidLayer3Thickness
std::vector< double > tibOutCables1Thickness
TIB outside services (endcap)
std::vector< ForwardDetLayer const * > const & posForwardLayers() const
MediumProperties * _theMPTOB4
The tracker outer barrel layer 4.
std::vector< double > pxb1CablesInnerRadius
Cables and Services at the end of PIXB1,2,3 ("disk")
std::vector< MediumProperties * > _mediumProperties
std::vector< double > tecOutCables2ZPosition
std::vector< double > pxbOutCables1ZPosition
std::list< TrackerLayer > _theCylinders
The list of tracker (sensistive or not) layers.
MediumProperties * _theMPPixelEndcap
The endcap pixel layers.
std::vector< double > beamPipeThickness
Beam Pipe.
std::vector< double > pxb3CablesThickness
std::vector< double > tibOutCables1OuterRadius
std::vector< double > pixelOutCablesZPosition
std::vector< double > pxbOutCables2InnerRadius
MediumProperties * _theMPTIDEOutside
Some material around the tracker inner disks (disk)
std::list< TrackerLayer >::const_iterator cylinderEnd() const
Returns the last pointer in the cylinder list.
std::vector< double > pxb1CablesThickness
Pixel Barrel services at the end of layers 1-3.
std::vector< double > pxb3CablesInnerRadius
Cylinder BoundCylinder
Definition: BoundCylinder.h:17
std::vector< double > pixelOutCablesRadius
Pixel Outside walls and cables (barrel and endcaps)
MediumProperties * _theMPTOB1
The tracker outer barrel layer 1.
std::vector< double > tobOutCablesRadius
MediumProperties * _theMPBarrelOutside
Cables around the tracker (one barrel, two disks)
std::vector< double > tobLayer3Thickness
std::vector< double > tobOutCablesInnerRadius
Tracker Outer Barrel Outside Cables and walls (barrel and endcaps)
std::vector< double > tecOutCables2OuterRadius
std::vector< double > tibOutCables2InnerRadius
std::vector< double > tobInsideThickness
TOB inside wall (barrel)
std::vector< double > tidOutCablesZPosition
std::vector< double > pxb2CablesInnerRadius
MediumProperties * _theMPTOB6
The tracker outer barrel layer 6.
std::vector< double > tobOutCablesLength
MediumProperties * _theMPTOBEOutside
Some material around the tracker outer barrel (disk)
std::vector< double > minDim(unsigned layerNr)
std::vector< double > barrelCablesThickness
std::vector< double > pixelOutCablesInnerRadius
std::vector< double > pxdOutCables1Thickness
Pixel Endcap outside cables.
std::vector< double > tobLayer6Thickness
MediumProperties * _theMPTOB2
The tracker outer barrel layer 2.
std::vector< double > endcapCables2Thickness
std::vector< double > pxbOutCables1OuterRadius
MediumProperties * _theMPTIBEOutside1
Some material around the tracker inner barrel (disk)
std::vector< double > tibLayer2Thickness
std::vector< double > fudgeFactors(unsigned layerNr)
MediumProperties * _theMPPixelOutside1
A series of cables/walls to reproduce the full sim.
MediumProperties * _theMPPixelBarrel
The barrel pixel layers.
MediumProperties * _theMPTIB2
The tracker inner barrel layer 2.
std::vector< double > tibLayer4Thickness
std::vector< double > tibOutCables1ZPosition
MediumProperties * _theMPTIB1
The tracker inner barrel layer 1.
std::vector< double > tidLayer2Thickness
std::vector< double > tibLayer1Thickness
Tracker Inner barrel layers 1-4.
std::vector< double > tecOutCables1OuterRadius
std::vector< double > tobLayer1Thickness
Tracker Outer barrel layers 1-6.
std::vector< double > tidOutsideThickness
TID outside wall (endcap)
MediumProperties * _theMPTOB5
The tracker outer barrel layer 5.
std::vector< double > tibLayer3Thickness
T min(T a, T b)
Definition: MathUtil.h:58
std::vector< double > pxbOutCables2Thickness
std::vector< double > tibOutCables2Thickness
MediumProperties * _theMPInner1
The tracker inner disks.
std::vector< double > tobLayer4Thickness
std::vector< double > tecOutCables1ZPosition
std::vector< double > endcapCables1Thickness
std::vector< double > tibOutCables1InnerRadius
Tracker Inner Barrel Outside Cables and walls (endcap)
std::vector< double > pxbOutCables1InnerRadius
Pixel Barrel Outside walls and cables.
std::vector< unsigned int > fudgeLayer
TrackerInteractionGeometry(const edm::ParameterSet &trackerMaterial, const GeometricSearchTracker *geomSearchTracker)
Constructor : get the configurable parameters.
std::vector< double > tobLayer2Thickness
std::vector< double > tobInCablesRadius
Tracker outer barrel Inside wall (barrel)
std::list< TrackerLayer >::const_iterator cylinderBegin() const
Returns the first pointer in the cylinder list.
Disk BoundDisk
Definition: BoundDisk.h:62
std::vector< double > tobOutCablesZPosition
std::vector< double > pxbOutCables2ZPosition
std::vector< double > tidOutCablesInnerRadius
Tracker Inner Disks Outside Cables and walls.
std::vector< double > maxDim(unsigned layerNr)
std::vector< double > tecOutCables1InnerRadius
Tracker Endcaps Outside Cables and walls.
std::vector< double > tibOutCables2ZPosition
std::vector< double > pxdOutCables2Thickness
MediumProperties * _theMPTOBBInside
Some material in front of the tracker outer barrel (cylinder)
std::vector< double > tobOutsideThickness
MediumProperties * _theMPTIB4
The tracker inner barrel layer 4.
std::vector< double > tidLayer1Thickness
Tracker Inner disks layers 1-3.
std::vector< double > tecOutCables2InnerRadius
std::vector< double > pxb2CablesThickness
MediumProperties * _theMPTIB3
The tracker inner barrel layer 3.
std::vector< BarrelDetLayer const * > const & barrelLayers() const
std::vector< double > tobOutCablesOuterRadius