65 produces<std::vector<reco::ME0Muon> >();
98 auto oc = std::make_unique<std::vector<ME0Muon>>();
99 std::vector<ME0Muon> TempStore;
106 for (std::vector<Track>::const_iterator thisTrack = generalTracks->begin();
107 thisTrack != generalTracks->end(); ++thisTrack,++TrackNumber){
111 if (
std::abs(thisTrack->eta()) < 1.8)
continue;
114 float zSign = thisTrack->pz() > 0 ? 1.0f : -1.0f;
118 int chargeReco = thisTrack->charge();
121 p3reco =
GlobalVector(thisTrack->outerPx(), thisTrack->outerPy(), thisTrack->outerPz());
122 r3reco =
GlobalVector(thisTrack->outerX(), thisTrack->outerY(), thisTrack->outerZ());
128 getFromFTS(initrecostate, p3reco, r3reco, chargeReco, covReco);
132 if (!lastrecostate.
isValid())
continue;
138 getFromFTS(finalrecostate, p3FinalReco_glob, r3FinalReco_globv, chargeReco, covFinalReco);
141 int SegmentNumber = 0;
144 double ClosestDelR2 = 999.;
146 for (
auto thisSegment = OurSegments->begin(); thisSegment != OurSegments->end();
147 ++thisSegment,++SegmentNumber){
148 ME0DetId id = thisSegment->me0DetId();
152 if ( zSign *
chamber->toGlobal(thisSegment->localPosition()).
z() < 0 )
continue;
154 GlobalPoint r3FinalReco_glob(r3FinalReco_globv.
x(),r3FinalReco_globv.
y(),r3FinalReco_globv.
z());
159 LocalPoint thisPosition(thisSegment->localPosition());
160 LocalVector thisDirection(thisSegment->localDirection().x(),thisSegment->localDirection().y(),thisSegment->localDirection().z());
164 for (
int i = 1;
i <=4;
i++){
165 for (
int j = 1; j <=4; j++){
166 thisCov(
i,j) = thisSegment->parametersError()(
i,j);
174 AlgebraicMatrix55 Ctmp = (jacobGlbToLoc * covFinalReco) * ROOT::Math::Transpose(jacobGlbToLoc);
176 for(
int i=0;
i<5; ++
i) {
177 for(
int j=0; j<5; ++j) {
178 C[
i][j] = Ctmp[
i][j];
183 Double_t sigmax =
sqrt(C[3][3]+thisSegment->localPositionError().xx() );
184 Double_t sigmay =
sqrt(C[4][4]+thisSegment->localPositionError().yy() );
186 bool X_MatchFound =
false, Y_MatchFound =
false, Dir_MatchFound =
false;
194 if (X_MatchFound && Y_MatchFound && Dir_MatchFound) {
196 TrackRef thisTrackRef(generalTracks,TrackNumber);
199 GlobalPoint TkPos(r3FinalReco_globv.
x(),r3FinalReco_globv.
y(),r3FinalReco_globv.
z());
202 if (thisDelR2 < ClosestDelR2){
203 ClosestDelR2 = thisDelR2;
204 MuonCandidate =
reco::ME0Muon(thisTrackRef,(*thisSegment),SegmentNumber,chargeReco);
217 if (ClosestDelR2 < 500.) {
218 oc->push_back(MuonCandidate);
constexpr double deltaPhi(double phi1, double phi2)
const AlgebraicMatrix56 & jacobian() const
T getParameter(std::string const &) const
void setLocalTrackMomAtSurface(const LocalVector &localTrackMomAtSurface)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
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.
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
def setup(process, global_tag, zero_tesla=False)
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
edm::InputTag generalTracksTag
TrackCharge charge() const
void produce(edm::Event &, const edm::EventSetup &) override
Produce the ME0Segment collection.
void setGlobalTrackMomAtSurface(const GlobalVector &globalTrackMomAtSurface)
edm::EDGetTokenT< reco::TrackCollection > generalTracksToken_
#define DEFINE_FWK_MODULE(type)
void setLocalTrackCov(const AlgebraicSymMatrix55 &trackCov)
CLHEP::HepMatrix AlgebraicMatrix
FreeTrajectoryState const * freeTrajectoryState(bool withErrors=true) const
edm::InputTag OurSegmentsTag
static PlanePointer build(Args &&...args)
const ME0Chamber * chamber(ME0DetId id) const
Return a chamber given its id.
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< ME0SegmentCollection > OurSegmentsToken_
GlobalVector momentum() const
void setGlobalTrackCov(const AlgebraicSymMatrix66 &trackCov)
const AlgebraicSymMatrix66 & matrix() const
GlobalPoint position() const
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
~ME0SegmentMatcher() override
Destructor.
void getFromFTS(const FreeTrajectoryState &, GlobalVector &, GlobalVector &, int &, AlgebraicSymMatrix66 &)
void setGlobalTrackPosAtSurface(const GlobalPoint &globalTrackPosAtSurface)
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
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)