28 #include "TLorentzVector.h"
117 produces<std::vector<reco::ME0Muon> >();
145 using namespace reco;
151 std::auto_ptr<std::vector<ME0Muon> > oc(
new std::vector<ME0Muon> );
152 std::vector<ME0Muon> TempStore;
161 for (std::vector<Track>::const_iterator thisTrack =
generalTracks->begin();
162 thisTrack !=
generalTracks->end(); ++thisTrack,++TrackNumber){
166 if (
std::abs(thisTrack->eta()) < 1.8)
continue;
168 float zSign = thisTrack->pz() > 0 ? 1.0f : -1.0f;
170 const float zValue = 526.75 * zSign;
176 int chargeReco = thisTrack->charge();
179 p3reco =
GlobalVector(thisTrack->outerPx(), thisTrack->outerPy(), thisTrack->outerPz());
180 r3reco =
GlobalVector(thisTrack->outerX(), thisTrack->outerY(), thisTrack->outerZ());
185 covReco_curv = thisTrack->outerStateCovariance();
187 getFromFTS(initrecostate, p3reco, r3reco, chargeReco, covReco);
202 lastrecostate = ThisshProp->propagate(initrecostate,*plane);
210 getFromFTS(finalrecostate, p3FinalReco_glob, r3FinalReco_globv, chargeReco, covFinalReco);
214 int SegmentNumber = 0;
217 double ClosestDelR2 = 999.;
219 for (
auto thisSegment = OurSegments->begin(); thisSegment != OurSegments->end();
220 ++thisSegment,++SegmentNumber){
221 ME0DetId id = thisSegment->me0DetId();
223 auto roll = me0Geom->etaPartition(
id);
225 if ( zSign * roll->toGlobal(thisSegment->localPosition()).
z() < 0 )
continue;
227 GlobalPoint r3FinalReco_glob(r3FinalReco_globv.
x(),r3FinalReco_globv.
y(),r3FinalReco_globv.
z());
229 LocalPoint r3FinalReco = roll->toLocal(r3FinalReco_glob);
230 LocalVector p3FinalReco=roll->toLocal(p3FinalReco_glob);
232 LocalPoint thisPosition(thisSegment->localPosition());
233 LocalVector thisDirection(thisSegment->localDirection().x(),thisSegment->localDirection().y(),thisSegment->localDirection().z());
237 for (
int i = 1;
i <=4;
i++){
238 for (
int j = 1;
j <=4;
j++){
239 thisCov(
i,
j) = thisSegment->parametersError()(
i,
j);
250 AlgebraicMatrix55 Ctmp = (jacobGlbToLoc * covFinalReco) * ROOT::Math::Transpose(jacobGlbToLoc);
252 for(
int i=0;
i<5; ++
i) {
253 for(
int j=0;
j<5; ++
j) {
254 C[
i][
j] = Ctmp[
i][
j];
259 Double_t sigmax =
sqrt(C[3][3]+thisSegment->localPositionError().xx() );
260 Double_t sigmay =
sqrt(C[4][4]+thisSegment->localPositionError().yy() );
262 bool X_MatchFound =
false, Y_MatchFound =
false, Dir_MatchFound =
false;
277 if (X_MatchFound && Y_MatchFound && Dir_MatchFound) {
281 GlobalPoint SegPos(roll->toGlobal(thisSegment->localPosition()));
282 GlobalPoint TkPos(r3FinalReco_globv.
x(),r3FinalReco_globv.
y(),r3FinalReco_globv.
z());
285 if (thisDelR2 < ClosestDelR2){
286 ClosestDelR2 = thisDelR2;
287 MuonCandidate =
reco::ME0Muon(thisTrackRef,(*thisSegment),SegmentNumber,chargeReco);
300 if (ClosestDelR2 < 500.) {
301 oc->push_back(MuonCandidate);
const AlgebraicMatrix56 & jacobian() const
T getParameter(std::string const &) const
void setLocalTrackMomAtSurface(const LocalVector &localTrackMomAtSurface)
CartesianTrajectoryError cartesianError() const
double thePHIDIR_RESIDUAL_CUT
ROOT::Math::SMatrix< double, 5, 6, ROOT::Math::MatRepStd< double, 5, 6 > > AlgebraicMatrix56
bool getByToken(EDGetToken token, Handle< PROD > &result) const
FreeTrajectoryState getFTS(const GlobalVector &, const GlobalVector &, int, const AlgebraicSymMatrix66 &, const MagneticField *)
ME0SegmentMatcher(const edm::ParameterSet &)
Constructor.
#define DEFINE_FWK_MODULE(type)
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
edm::InputTag generalTracksTag
TrackCharge charge() const
virtual void produce(edm::Event &, const edm::EventSetup &) override
Produce the ME0Segment collection.
void setGlobalTrackMomAtSurface(const GlobalVector &globalTrackMomAtSurface)
edm::EDGetTokenT< reco::TrackCollection > generalTracksToken_
~ME0SegmentMatcher()
Destructor.
void setLocalTrackCov(const AlgebraicSymMatrix55 &trackCov)
CLHEP::HepMatrix AlgebraicMatrix
FreeTrajectoryState const * freeTrajectoryState(bool withErrors=true) const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
edm::InputTag OurSegmentsTag
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< ME0SegmentCollection > OurSegmentsToken_
GlobalVector momentum() const
void setGlobalTrackCov(const AlgebraicSymMatrix66 &trackCov)
const AlgebraicSymMatrix66 & matrix() const
double deltaPhi(double phi1, double phi2)
GlobalPoint position() const
void getFromFTS(const FreeTrajectoryState &, GlobalVector &, GlobalVector &, int &, AlgebraicSymMatrix66 &)
void setGlobalTrackPosAtSurface(const GlobalPoint &globalTrackPosAtSurface)
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
virtual void beginRun(edm::Run const &, edm::EventSetup const &) override
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepStd< double, 5, 5 > > AlgebraicMatrix55
Global3DVector GlobalVector
void setLocalTrackPosAtSurface(const LocalPoint &localTrackPosAtSurface)