28 #include "TLorentzVector.h" 117 produces<std::vector<reco::ME0Muon> >();
145 using namespace reco;
151 auto oc = std::make_unique<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);
203 if (!lastrecostate.
isValid())
continue;
211 getFromFTS(finalrecostate, p3FinalReco_glob, r3FinalReco_globv, chargeReco, covFinalReco);
215 int SegmentNumber = 0;
218 double ClosestDelR2 = 999.;
220 for (
auto thisSegment = OurSegments->begin(); thisSegment != OurSegments->end();
221 ++thisSegment,++SegmentNumber){
222 ME0DetId id = thisSegment->me0DetId();
226 if ( zSign *
chamber->toGlobal(thisSegment->localPosition()).
z() < 0 )
continue;
228 GlobalPoint r3FinalReco_glob(r3FinalReco_globv.
x(),r3FinalReco_globv.
y(),r3FinalReco_globv.
z());
233 LocalPoint thisPosition(thisSegment->localPosition());
234 LocalVector thisDirection(thisSegment->localDirection().x(),thisSegment->localDirection().y(),thisSegment->localDirection().z());
238 for (
int i = 1;
i <=4;
i++){
239 for (
int j = 1; j <=4; j++){
240 thisCov(
i,j) = thisSegment->parametersError()(
i,j);
251 AlgebraicMatrix55 Ctmp = (jacobGlbToLoc * covFinalReco) * ROOT::Math::Transpose(jacobGlbToLoc);
253 for(
int i=0;
i<5; ++
i) {
254 for(
int j=0; j<5; ++j) {
255 C[
i][j] = Ctmp[
i][j];
260 Double_t sigmax =
sqrt(C[3][3]+thisSegment->localPositionError().xx() );
261 Double_t sigmay =
sqrt(C[4][4]+thisSegment->localPositionError().yy() );
263 bool X_MatchFound =
false, Y_MatchFound =
false, Dir_MatchFound =
false;
278 if (X_MatchFound && Y_MatchFound && Dir_MatchFound) {
280 TrackRef thisTrackRef(generalTracks,TrackNumber);
283 GlobalPoint TkPos(r3FinalReco_globv.
x(),r3FinalReco_globv.
y(),r3FinalReco_globv.
z());
286 if (thisDelR2 < ClosestDelR2){
287 ClosestDelR2 = thisDelR2;
288 MuonCandidate =
reco::ME0Muon(thisTrackRef,(*thisSegment),SegmentNumber,chargeReco);
301 if (ClosestDelR2 < 500.) {
302 oc->push_back(MuonCandidate);
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.
#define DEFINE_FWK_MODULE(type)
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
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
edm::InputTag OurSegmentsTag
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
double deltaPhi(double phi1, double phi2)
GlobalPoint position() const
void getFromFTS(const FreeTrajectoryState &, GlobalVector &, GlobalVector &, int &, AlgebraicSymMatrix66 &)
void setGlobalTrackPosAtSurface(const GlobalPoint &globalTrackPosAtSurface)
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
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)