CMS 3D CMS Logo

ConversionSeedFinder.cc
Go to the documentation of this file.
4 // Field
5 // Geometry
7 //
10 //
11 
15 
17  : // conf_(config),
18  theUpdator_() {
20  edm::InputTag("MeasurementTrackerEvent")); //hardcoded because the original was and no time to fix (sigh)
22  edm::InputTag("offlineBeamSpot")); //hardcoded because the original was and no time to fix (sigh)
23 
24  LogDebug("ConversionSeedFinder") << " CTOR "
25  << "\n";
26 
27  theMeasurementTrackerName_ = config.getParameter<std::string>("MeasurementTrackerName");
28 }
29 
32 
33  //get the BeamSpot
34  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
35  evt.getByToken(beamSpotToken_, recoBeamSpotHandle);
36  theBeamSpot_ = *recoBeamSpotHandle;
37 
39 }
40 
44 
45  edm::ESHandle<MeasurementTracker> measurementTrackerHandle;
46  es.get<CkfComponentsRecord>().get(theMeasurementTrackerName_, measurementTrackerHandle);
47  theMeasurementTracker_ = measurementTrackerHandle.product();
48 
49  edm::ESHandle<Propagator> propagatorAlongMomHandle;
50  es.get<TrackingComponentsRecord>().get("alongMomElePropagator", propagatorAlongMomHandle);
51  thePropagatorAlongMomentum_ = &(*propagatorAlongMomHandle);
52 
53  edm::ESHandle<Propagator> propagatorOppoToMomHandle;
54  es.get<TrackingComponentsRecord>().get("oppositeToMomElePropagator", propagatorOppoToMomHandle);
55  thePropagatorOppositeToMomentum_ = &(*propagatorOppoToMomHandle);
56 }
57 
59  int charge;
60  //List the DetLayers crossed by a straight line from the centre of the
61  //detector to the supercluster position
62  // GlobalPoint vertex(0.,0.,0.);
64  charge = -1;
65  FreeTrajectoryState theStraightLineFTS = trackStateFromClusters(charge, vertex, alongMomentum, 1.);
66 
67  findLayers(theStraightLineFTS);
68 }
69 
71  const GlobalPoint& theOrigin,
73  float scaleFactor) const {
74  double caloEnergy = theSCenergy_ * scaleFactor;
75 
76  GlobalVector radiusCalo = theSCPosition_ - theOrigin;
77 
78  GlobalVector momentumWithoutCurvature = radiusCalo.unit() * caloEnergy;
79 
81  if (dir == alongMomentum) {
82  gtp = GlobalTrajectoryParameters(theOrigin, momentumWithoutCurvature, charge, &(*theMF_));
83  } else {
84  gtp = GlobalTrajectoryParameters(theSCPosition_, momentumWithoutCurvature, charge, &(*theMF_));
85  }
86 
87  // now create error matrix
88  // dpos = 4mm/sqrt(E), dtheta = move vertex by 1sigma
89  float dpos = 0.4 / sqrt(theSCenergy_);
90  dpos *= 2.;
91  float dphi = dpos / theSCPosition_.perp();
92  // float dp = 0.03 * sqrt(theCaloEnergy);
93  // float dp = theCaloEnergy / sqrt(12.); // for fun
94  float theta1 = theSCPosition_.theta();
95  float theta2 = atan2(double(theSCPosition_.perp()), theSCPosition_.z() - 5.5);
96  float dtheta = theta1 - theta2;
98  m[0][0] = 1.;
99  m[1][1] = dpos * dpos;
100  m[2][2] = dpos * dpos;
101  m[3][3] = dphi * dphi;
102  m[4][4] = dtheta * dtheta;
103 
105 
106  return fts;
107 }
108 
110  theLayerList_.clear();
111 
113 
114  StartingLayerFinder starter(&prop, this->getMeasurementTracker());
115 
116  LayerCollector collector(theNavigationSchool_, &prop, &starter, 5., 5.);
117 
118  theLayerList_ = collector.allLayers(traj);
119 
120  for (unsigned int i = 0; i < theLayerList_.size(); ++i) {
121  printLayer(i);
122  }
123 }
124 
126  const DetLayer* layer = theLayerList_[i];
127  if (layer->location() == GeomDetEnumerators::barrel) {
128  // const BarrelDetLayer * barrelLayer = dynamic_cast<const BarrelDetLayer*>(layer);
129  //float r = barrelLayer->specificSurface().radius();
130  // std::cout << " barrel layer radius " << r << " " << barrelLayer->specificSurface().bounds().length()/2. << "\n";
131 
132  } else {
133  // const ForwardDetLayer * forwardLayer = dynamic_cast<const ForwardDetLayer*>(layer);
134  // float z = fabs(forwardLayer->surface().position().z());
135  // std::cout << " forward layer position " << z << " " << forwardLayer->specificSurface().innerRadius() << " " << forwardLayer->specificSurface().outerRadius() << "\n";
136  }
137 }
#define LogDebug(id)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const Propagator * thePropagatorAlongMomentum_
T getParameter(std::string const &) const
const MeasurementTracker * getMeasurementTracker() const
const MeasurementTracker * theMeasurementTracker_
T perp() const
Definition: PV3DBase.h:69
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
virtual Location location() const =0
Which part of the detector (barrel, endcap)
const NavigationSchool * theNavigationSchool_
std::vector< const DetLayer * > theLayerList_
Definition: config.py:1
PropagationDirection
const Propagator * thePropagatorOppositeToMomentum_
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
std::string theMeasurementTrackerName_
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
void printLayer(int i) const
T sqrt(T t)
Definition: SSEVec.h:19
T z() const
Definition: PV3DBase.h:61
const TrackingGeometry * geomTracker() const
const TrackingGeometry * theTrackerGeom_
edm::ESHandle< GeometricSearchTracker > theGeomSearchTracker_
std::vector< const DetLayer * > allLayers(const FTS &aFts) const
Vector3DBase unit() const
Definition: Vector3DBase.h:54
edm::ESHandle< MagneticField > theMF_
void setEvent(const edm::Event &e)
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
FreeTrajectoryState trackStateFromClusters(int aCharge, const GlobalPoint &gpOrigine, PropagationDirection dir, float scaleFactor) const
void setEventSetup(const edm::EventSetup &es)
Initialize EventSetup objects at each event.
T get() const
Definition: EventSetup.h:73
const Point & position() const
position
Definition: BeamSpot.h:59
edm::Handle< MeasurementTrackerEvent > theTrackerData_
edm::EDGetTokenT< MeasurementTrackerEvent > measurementTrkToken_
T const * product() const
Definition: ESHandle.h:86