CMS 3D CMS Logo

MultipleScatteringGeometry.cc
Go to the documentation of this file.
4 
12 
13 using namespace GeomDetEnumerators;
14 using namespace std;
15 
16 //------------------------------------------------------------------------------
17 const float MultipleScatteringGeometry::beamPipeR = 2.94;
19 const float MultipleScatteringGeometry::supportR = 19.;
20 
21 //------------------------------------------------------------------------------
23 {
24 
26  iSetup.get<TrackerRecoGeometryRecord>().get( track );
27 
28  vector<BarrelDetLayer const*> barrelLayers=track->barrelLayers();
29  vector<BarrelDetLayer const*>::const_iterator ib;
30  vector<ForwardDetLayer const*> forwardPosLayers=track->posForwardLayers();
31  vector<ForwardDetLayer const*> forwardNegLayers=track->negForwardLayers();
32  vector<ForwardDetLayer const*>::const_iterator ie;
33  // barrelLayers = accessor.barrelLayers();
34  for (ib = barrelLayers.begin(); ib != barrelLayers.end(); ib++)
35  theLayers.push_back(*ib);
36 
37 // forwardLayers = accessor.negativeEndcapLayers();
38  for (ie = forwardPosLayers.begin(); ie != forwardPosLayers.end(); ie++)
39  theLayers.push_back(*ie);
40  for (ie = forwardNegLayers.begin(); ie != forwardNegLayers.end(); ie++)
41  theLayers.push_back(*ie);
42 
43 }
44 
45 //------------------------------------------------------------------------------
46 vector<MSLayer> MultipleScatteringGeometry::detLayers(const edm::EventSetup &iSetup) const
47 {
48  vector<MSLayer> result;
49  vector<const DetLayer*>::const_iterator il;
50  for (il=theLayers.begin();il!=theLayers.end();il++) result.push_back(MSLayer(*il));
51  return result;
52 }
53 
54 //------------------------------------------------------------------------------
55 vector<MSLayer> MultipleScatteringGeometry::detLayers(float eta, float z,const edm::EventSetup &iSetup) const
56 {
57  vector<MSLayer> result;
58  GlobalPoint zero(0,0,z);
59  float r=1; float dirZ = r*sinh(eta);
60  GlobalVector dir(r,0.,dirZ);
62  iSetup.get<IdealMagneticFieldRecord>().get(pSetup);
63  FreeTrajectoryState fts( GlobalTrajectoryParameters(zero,dir,1,&(*pSetup)) );
65  vector<const DetLayer*>::const_iterator il;
67  for (il = theLayers.begin(); il != theLayers.end(); il++) {
68  bool contains=false;
69 // if ((*il)->subDetector() != PixelBarrel && (*il)->subDetector()!= PixelEndcap) continue;
70 
71  if ( (*il)->location() == barrel ) {
72  const BarrelDetLayer * bl = dynamic_cast<const BarrelDetLayer*>(*il);
73  if (!bl) continue;
74  tsos = propagator.propagate(fts, bl->specificSurface());
75  if (!tsos.isValid()) continue;
76  float r=bl->specificSurface().radius();
77  float dr = bl->specificSurface().bounds().thickness();
78  float z=bl->position().z();
79  float dz = bl->specificSurface().bounds().length();
80  PixelRecoRange<float> rRange(r-dr/2., r+dr/2.);
81  PixelRecoRange<float> zRange(z-dz/2., z+dz/2.);
82  contains = rRange.inside(tsos.globalPosition().perp())
83  && zRange.inside(tsos.globalPosition().z());
84  // contains = bl->contains((*il)->toLocal(tsos.globalPosition()));
85  }
86  else if ((*il)->location() == endcap) {
87  const ForwardDetLayer * fl = dynamic_cast<const ForwardDetLayer*>(*il);
88  if (!fl) continue;
89  if (fl->position().z() * eta < 0) continue;
90  const BoundDisk & disk = fl->specificSurface();
91  tsos = propagator.propagate(fts, disk);
92  if (!tsos.isValid()) continue;
93  float zMin = disk.position().z()-disk.bounds().thickness()/2;
94  float zMax = disk.position().z()+disk.bounds().thickness()/2;
95  PixelRecoRange<float> rRange(disk.innerRadius(), disk.outerRadius());
96  PixelRecoRange<float> zRange(zMin, zMax);
97  contains = rRange.inside(tsos.globalPosition().perp())
98  && zRange.inside(tsos.globalPosition().z());
99  // contains = fl->contains(fl->toLocal(tsos.globalPosition()));
100  }
101  if (contains) result.push_back(MSLayer(*il));
102  }
103  return result;
104 }
105 //------------------------------------------------------------------------------
106 vector<MSLayer> MultipleScatteringGeometry::otherLayers(float eta,const edm::EventSetup &iSetup) const
107 {
108  vector<MSLayer> result;
109  // zero
110  // MSLayer zero(barrel, 0., MSLayer::Range(-15,15));
111  // result.push_back(zero);
112 
113  // beampipe
114  MSLayer beampipe(barrel, beamPipeR, MSLayer::Range(-100,100));
115 
116  result.push_back(beampipe);
117 
118  // endflanges
119  PixelRecoPointRZ endfPoint = (eta > 0) ?
120  PixelRecoPointRZ(endflangesZ/sinh(eta), endflangesZ)
121  : PixelRecoPointRZ(-endflangesZ/sinh(eta), -endflangesZ);
122  if (0 < endfPoint.r() && endfPoint.r() < supportR) {
123  MSLayer endflanges(endcap,endfPoint.z(),MSLayer::Range(0.1,supportR-0.1));
124  result.push_back(endflanges);
125  }
126 
127  // support
128  MSLayer support( barrel,supportR, MSLayer::Range(-280,280));
129  result.push_back(support);
130 
131  return result;
132 }
133 
134 
135 
T perp() const
Definition: PV3DBase.h:72
bool contains(EventRange const &lh, EventID const &rh)
Definition: EventRange.cc:38
std::vector< ForwardDetLayer const * > const & posForwardLayers() const
std::vector< MSLayer > otherLayers(float eta, const edm::EventSetup &iSetup) const
GlobalPoint globalPosition() const
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
T z() const
Definition: PV3DBase.h:64
std::vector< ForwardDetLayer const * > const & negForwardLayers() const
std::vector< MSLayer > detLayers(float eta, float z, const edm::EventSetup &iSetup) const
virtual const BoundDisk & specificSurface() const final
float z() const
virtual const Surface::PositionType & position() const
Returns position of the surface.
const T & get() const
Definition: EventSetup.h:56
bool inside(const T &value) const
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:53
float r() const
dbl *** dir
Definition: mlp_gen.cc:35
PixelRecoRange< float > Range
Definition: MSLayer.h:16
MultipleScatteringGeometry(const edm::EventSetup &iSetup)
std::vector< BarrelDetLayer const * > const & barrelLayers() const
ib
Definition: cuy.py:660