18 |
|
#include "DataFormats/GeometrySurface/interface/SimpleCylinderBounds.h" |
19 |
|
#include "DataFormats/GeometrySurface/interface/BoundDisk.h" |
20 |
|
#include "DataFormats/GeometrySurface/interface/SimpleDiskBounds.h" |
21 |
+ |
#include "UserCode/L1RpcTriggerAnalysis/interface/TrackAtSurface.h" |
22 |
|
|
23 |
|
using namespace edm; |
24 |
|
using namespace std; |
25 |
|
|
26 |
< |
bool TrackToL1ObjMatcher::operator()(const L1Obj& l1, const TrajectoryStateOnSurface & tsos, const edm::Event&ev, const edm::EventSetup& es) const |
26 |
> |
static const TrackToL1ObjMatcher::LastResult dummy = {false, 100., 100.}; |
27 |
> |
|
28 |
> |
TrackToL1ObjMatcher::TrackToL1ObjMatcher(const edm::ParameterSet & cfg) : theConfig(cfg), theLastResult(dummy) { } |
29 |
> |
|
30 |
> |
bool TrackToL1ObjMatcher::operator()(float l1ObjEta, float l1ObjPhi, const reco::Muon* mu, const edm::Event&ev, const edm::EventSetup& es) const |
31 |
|
{ |
32 |
< |
edm::ESHandle<GlobalTrackingGeometry> globalGeometry; |
33 |
< |
es.get<GlobalTrackingGeometryRecord>().get(globalGeometry); |
34 |
< |
edm::ESHandle<MagneticField> magField; |
35 |
< |
es.get<IdealMagneticFieldRecord>().get(magField); |
36 |
< |
ReferenceCountingPointer<Surface> rpc; |
32 |
> |
theLastResult = dummy; |
33 |
> |
TrajectoryStateOnSurface state = TrackAtSurface(mu,ev,es).atStation2(l1ObjEta); |
34 |
> |
if (!state.isValid()) return false; |
35 |
> |
return compare(l1ObjEta, l1ObjPhi, state.globalPosition().eta(), state.globalPosition().phi()); |
36 |
> |
} |
37 |
|
|
38 |
< |
//propagate and check matching for candidate |
39 |
< |
float rpcEta = l1.eta; |
40 |
< |
float rpcPhi = l1.phi; |
36 |
< |
if (rpcEta < -1.04) rpc = ReferenceCountingPointer<Surface>(new BoundDisk( GlobalPoint(0.,0.,-800.), TkRotation<float>(), SimpleDiskBounds( 300., 710., -10., 10. ) ) ); |
37 |
< |
else if (rpcEta < 1.04) rpc = ReferenceCountingPointer<Surface>(new BoundCylinder( GlobalPoint(0.,0.,0.), TkRotation<float>(), SimpleCylinderBounds( 500, 520, -700, 700 ) ) ); |
38 |
< |
else rpc = ReferenceCountingPointer<Surface>(new BoundDisk( GlobalPoint(0.,0.,800.), TkRotation<float>(), SimpleDiskBounds( 300., 710., -10., 10. ) ) ); |
39 |
< |
edm::ESHandle<Propagator> propagator; |
40 |
< |
es.get<TrackingComponentsRecord>().get("SteppingHelixPropagatorAlong", propagator); |
41 |
< |
TrajectoryStateOnSurface trackAtRPC = propagator->propagate(tsos, *rpc); |
42 |
< |
if (!trackAtRPC.isValid()) return false; |
43 |
< |
float phi = trackAtRPC.globalPosition().phi(); |
44 |
< |
float dphi = phi-rpcPhi; |
38 |
> |
bool TrackToL1ObjMatcher::compare(float l1Eta, float l1Phi, float stateEta, float statePhi) const |
39 |
> |
{ |
40 |
> |
float dphi = statePhi-l1Phi; |
41 |
|
if (dphi < -M_PI) dphi+=2*M_PI; |
42 |
|
if (dphi > M_PI) dphi-=2*M_PI; |
43 |
< |
float eta = trackAtRPC.globalPosition().eta(); |
48 |
< |
float deta = eta-rpcEta; |
43 |
> |
float deta = stateEta-l1Eta; |
44 |
|
|
45 |
|
double maxDeltaEta = theConfig.getParameter<double>("maxDeltaEta"); |
46 |
|
double maxDeltaPhi = theConfig.getParameter<double>("maxDeltaPhi"); |
47 |
|
bool matching = ( fabs(dphi) < maxDeltaPhi && fabs(deta) < maxDeltaEta) ? true : false; |
48 |
|
|
49 |
< |
if (matching) return true; |
49 |
> |
theLastResult.isValid = true; |
50 |
> |
theLastResult.deltaEta = deta; |
51 |
> |
theLastResult.deltaPhi = dphi; |
52 |
> |
|
53 |
> |
if (matching) return true; |
54 |
|
else return false; |
55 |
|
} |
56 |
+ |
|
57 |
+ |
|
58 |
+ |
bool TrackToL1ObjMatcher::operator()(float l1ObjEta, float l1ObjPhi, const TrajectoryStateOnSurface & tsos, const edm::Event&ev, const edm::EventSetup& es) const |
59 |
+ |
{ |
60 |
+ |
theLastResult = dummy; |
61 |
+ |
edm::ESHandle<GlobalTrackingGeometry> globalGeometry; |
62 |
+ |
es.get<GlobalTrackingGeometryRecord>().get(globalGeometry); |
63 |
+ |
edm::ESHandle<MagneticField> magField; |
64 |
+ |
es.get<IdealMagneticFieldRecord>().get(magField); |
65 |
+ |
ReferenceCountingPointer<Surface> rpc; |
66 |
+ |
|
67 |
+ |
//propagate and check matching for candidate |
68 |
+ |
float rpcEta = l1ObjEta; |
69 |
+ |
if (rpcEta < -1.04) rpc = ReferenceCountingPointer<Surface>(new BoundDisk( GlobalPoint(0.,0.,-790.), TkRotation<float>(), SimpleDiskBounds( 300., 710., -10., 10. ) ) ); |
70 |
+ |
else if (rpcEta < -0.72) rpc = ReferenceCountingPointer<Surface>(new BoundCylinder( GlobalPoint(0.,0.,0.), TkRotation<float>(), SimpleCylinderBounds( 520, 520, -700, 700 ) ) ); |
71 |
+ |
else if (rpcEta < 0.72) rpc = ReferenceCountingPointer<Surface>(new BoundCylinder( GlobalPoint(0.,0.,0.), TkRotation<float>(), SimpleCylinderBounds( 500, 500, -700, 700 ) ) ); |
72 |
+ |
else if (rpcEta < 1.04) rpc = ReferenceCountingPointer<Surface>(new BoundCylinder( GlobalPoint(0.,0.,0.), TkRotation<float>(), SimpleCylinderBounds( 520, 520, -700, 700 ) ) ); |
73 |
+ |
else rpc = ReferenceCountingPointer<Surface>(new BoundDisk( GlobalPoint(0.,0.,790.), TkRotation<float>(), SimpleDiskBounds( 300., 710., -10., 10. ) ) ); |
74 |
+ |
edm::ESHandle<Propagator> propagator; |
75 |
+ |
es.get<TrackingComponentsRecord>().get("SteppingHelixPropagatorAlong", propagator); |
76 |
+ |
TrajectoryStateOnSurface state = propagator->propagate(tsos, *rpc); |
77 |
+ |
if (!state.isValid()) return false; |
78 |
+ |
return compare( l1ObjEta, l1ObjPhi, state.globalPosition().eta(), state.globalPosition().phi()); |
79 |
+ |
} |