Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-23 22:53:23

0001 #include "MultipleScatteringGeometry.h"
0002 #include "TrackingTools/DetLayers/interface/BarrelDetLayer.h"
0003 #include "TrackingTools/DetLayers/interface/ForwardDetLayer.h"
0004 
0005 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
0006 #include "TrackingTools/GeomPropagators/interface/StraightLinePropagator.h"
0007 
0008 using namespace GeomDetEnumerators;
0009 using namespace std;
0010 
0011 //------------------------------------------------------------------------------
0012 const float MultipleScatteringGeometry::beamPipeR = 2.94;
0013 const float MultipleScatteringGeometry::endflangesZ = 30;
0014 const float MultipleScatteringGeometry::supportR = 19.;
0015 
0016 //------------------------------------------------------------------------------
0017 MultipleScatteringGeometry::MultipleScatteringGeometry(const GeometricSearchTracker &tracker) {
0018   vector<BarrelDetLayer const *> barrelLayers = tracker.barrelLayers();
0019   vector<BarrelDetLayer const *>::const_iterator ib;
0020   vector<ForwardDetLayer const *> forwardPosLayers = tracker.posForwardLayers();
0021   vector<ForwardDetLayer const *> forwardNegLayers = tracker.negForwardLayers();
0022   vector<ForwardDetLayer const *>::const_iterator ie;
0023   // barrelLayers = accessor.barrelLayers();
0024   for (ib = barrelLayers.begin(); ib != barrelLayers.end(); ib++)
0025     theLayers.push_back(*ib);
0026 
0027   //   forwardLayers = accessor.negativeEndcapLayers();
0028   for (ie = forwardPosLayers.begin(); ie != forwardPosLayers.end(); ie++)
0029     theLayers.push_back(*ie);
0030   for (ie = forwardNegLayers.begin(); ie != forwardNegLayers.end(); ie++)
0031     theLayers.push_back(*ie);
0032 }
0033 
0034 //------------------------------------------------------------------------------
0035 vector<MSLayer> MultipleScatteringGeometry::detLayers() const {
0036   vector<MSLayer> result;
0037   vector<const DetLayer *>::const_iterator il;
0038   for (il = theLayers.begin(); il != theLayers.end(); il++)
0039     result.push_back(MSLayer(*il));
0040   return result;
0041 }
0042 
0043 //------------------------------------------------------------------------------
0044 vector<MSLayer> MultipleScatteringGeometry::detLayers(float eta, float z, const MagneticField &bfield) const {
0045   vector<MSLayer> result;
0046   GlobalPoint zero(0, 0, z);
0047   float r = 1;
0048   float dirZ = r * sinh(eta);
0049   GlobalVector dir(r, 0., dirZ);
0050   FreeTrajectoryState fts(GlobalTrajectoryParameters(zero, dir, 1, &bfield));
0051   StraightLinePropagator propagator(&bfield, alongMomentum);
0052   vector<const DetLayer *>::const_iterator il;
0053   TrajectoryStateOnSurface tsos;
0054   for (il = theLayers.begin(); il != theLayers.end(); il++) {
0055     bool contains = false;
0056     //  if ((*il)->subDetector() != PixelBarrel && (*il)->subDetector()!= PixelEndcap) continue;
0057 
0058     if ((*il)->location() == barrel) {
0059       const BarrelDetLayer *bl = dynamic_cast<const BarrelDetLayer *>(*il);
0060       if (!bl)
0061         continue;
0062       tsos = propagator.propagate(fts, bl->specificSurface());
0063       if (!tsos.isValid())
0064         continue;
0065       float r = bl->specificSurface().radius();
0066       float dr = bl->specificSurface().bounds().thickness();
0067       float z = bl->position().z();
0068       float dz = bl->specificSurface().bounds().length();
0069       PixelRecoRange<float> rRange(r - dr / 2., r + dr / 2.);
0070       PixelRecoRange<float> zRange(z - dz / 2., z + dz / 2.);
0071       contains = rRange.inside(tsos.globalPosition().perp()) && zRange.inside(tsos.globalPosition().z());
0072       //     contains = bl->contains((*il)->toLocal(tsos.globalPosition()));
0073     } else if ((*il)->location() == endcap) {
0074       const ForwardDetLayer *fl = dynamic_cast<const ForwardDetLayer *>(*il);
0075       if (!fl)
0076         continue;
0077       if (fl->position().z() * eta < 0)
0078         continue;
0079       const BoundDisk &disk = fl->specificSurface();
0080       tsos = propagator.propagate(fts, disk);
0081       if (!tsos.isValid())
0082         continue;
0083       float zMin = disk.position().z() - disk.bounds().thickness() / 2;
0084       float zMax = disk.position().z() + disk.bounds().thickness() / 2;
0085       PixelRecoRange<float> rRange(disk.innerRadius(), disk.outerRadius());
0086       PixelRecoRange<float> zRange(zMin, zMax);
0087       contains = rRange.inside(tsos.globalPosition().perp()) && zRange.inside(tsos.globalPosition().z());
0088       //     contains = fl->contains(fl->toLocal(tsos.globalPosition()));
0089     }
0090     if (contains)
0091       result.push_back(MSLayer(*il));
0092   }
0093   return result;
0094 }
0095 //------------------------------------------------------------------------------
0096 vector<MSLayer> MultipleScatteringGeometry::otherLayers(float eta) const {
0097   vector<MSLayer> result;
0098   // zero
0099   //  MSLayer zero(barrel, 0., MSLayer::Range(-15,15));
0100   //  result.push_back(zero);
0101 
0102   // beampipe
0103   MSLayer beampipe(barrel, beamPipeR, MSLayer::Range(-100, 100));
0104 
0105   result.push_back(beampipe);
0106 
0107   // endflanges
0108   PixelRecoPointRZ endfPoint = (eta > 0) ? PixelRecoPointRZ(endflangesZ / sinh(eta), endflangesZ)
0109                                          : PixelRecoPointRZ(-endflangesZ / sinh(eta), -endflangesZ);
0110   if (0 < endfPoint.r() && endfPoint.r() < supportR) {
0111     MSLayer endflanges(endcap, endfPoint.z(), MSLayer::Range(0.1, supportR - 0.1));
0112     result.push_back(endflanges);
0113   }
0114 
0115   // support
0116   MSLayer support(barrel, supportR, MSLayer::Range(-280, 280));
0117   result.push_back(support);
0118 
0119   return result;
0120 }