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; |
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 |
+ |
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 |
+ |
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 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 |
+ |
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 |
+ |
TrajectoryStateOnSurface state = TrackAtSurface(tsos,ev,es).atStation2(l1ObjEta); |
62 |
+ |
if (!state.isValid()) return false; |
63 |
+ |
return compare(l1ObjEta, l1ObjPhi, state.globalPosition().eta(), state.globalPosition().phi()); |
64 |
+ |
|
65 |
+ |
/* |
66 |
|
edm::ESHandle<GlobalTrackingGeometry> globalGeometry; |
67 |
|
es.get<GlobalTrackingGeometryRecord>().get(globalGeometry); |
68 |
|
edm::ESHandle<MagneticField> magField; |
71 |
|
|
72 |
|
//propagate and check matching for candidate |
73 |
|
float rpcEta = l1ObjEta; |
40 |
– |
float rpcPhi = l1ObjPhi; |
74 |
|
if (rpcEta < -1.04) rpc = ReferenceCountingPointer<Surface>(new BoundDisk( GlobalPoint(0.,0.,-790.), TkRotation<float>(), SimpleDiskBounds( 300., 710., -10., 10. ) ) ); |
75 |
|
else if (rpcEta < -0.72) rpc = ReferenceCountingPointer<Surface>(new BoundCylinder( GlobalPoint(0.,0.,0.), TkRotation<float>(), SimpleCylinderBounds( 520, 520, -700, 700 ) ) ); |
76 |
|
else if (rpcEta < 0.72) rpc = ReferenceCountingPointer<Surface>(new BoundCylinder( GlobalPoint(0.,0.,0.), TkRotation<float>(), SimpleCylinderBounds( 500, 500, -700, 700 ) ) ); |
78 |
|
else rpc = ReferenceCountingPointer<Surface>(new BoundDisk( GlobalPoint(0.,0.,790.), TkRotation<float>(), SimpleDiskBounds( 300., 710., -10., 10. ) ) ); |
79 |
|
edm::ESHandle<Propagator> propagator; |
80 |
|
es.get<TrackingComponentsRecord>().get("SteppingHelixPropagatorAlong", propagator); |
81 |
< |
TrajectoryStateOnSurface trackAtRPC = propagator->propagate(tsos, *rpc); |
82 |
< |
if (!trackAtRPC.isValid()) return false; |
83 |
< |
float phi = trackAtRPC.globalPosition().phi(); |
84 |
< |
float dphi = phi-rpcPhi; |
52 |
< |
if (dphi < -M_PI) dphi+=2*M_PI; |
53 |
< |
if (dphi > M_PI) dphi-=2*M_PI; |
54 |
< |
float eta = trackAtRPC.globalPosition().eta(); |
55 |
< |
float deta = eta-rpcEta; |
56 |
< |
|
57 |
< |
double maxDeltaEta = theConfig.getParameter<double>("maxDeltaEta"); |
58 |
< |
double maxDeltaPhi = theConfig.getParameter<double>("maxDeltaPhi"); |
59 |
< |
bool matching = ( fabs(dphi) < maxDeltaPhi && fabs(deta) < maxDeltaEta) ? true : false; |
60 |
< |
|
61 |
< |
theLastResult.isValid = true; |
62 |
< |
theLastResult.deltaEta = deta; |
63 |
< |
theLastResult.deltaPhi = dphi; |
64 |
< |
|
65 |
< |
if (matching) return true; |
66 |
< |
else return false; |
81 |
> |
TrajectoryStateOnSurface state = propagator->propagate(tsos, *rpc); |
82 |
> |
if (!state.isValid()) return false; |
83 |
> |
return compare( l1ObjEta, l1ObjPhi, state.globalPosition().eta(), state.globalPosition().phi()); |
84 |
> |
*/ |
85 |
|
} |