Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MuonSegFit bugfix #14825

Merged
merged 3 commits into from Jun 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions RecoLocalMuon/GEMSegment/plugins/GEMSegmentAlgorithm.cc
Expand Up @@ -311,7 +311,7 @@ bool GEMSegmentAlgorithm::isGoodToMerge(const GEMEnsemble& ensemble, const Ensem
void GEMSegmentAlgorithm::buildSegments(const GEMEnsemble& ensemble, const EnsembleHitContainer& rechits, std::vector<GEMSegment>& gemsegs) {
if (rechits.size() < minHitsPerSegment) return;

MuonRecHitContainer muonRecHits;
MuonSegFit::MuonRecHitContainer muonRecHits;
proto_segment.clear();

// select hits from the ensemble and sort it
Expand All @@ -326,7 +326,8 @@ void GEMSegmentAlgorithm::buildSegments(const GEMEnsemble& ensemble, const Ensem

GEMRecHit *newRH = (*rh)->clone();
newRH->setPosition(lp);
muonRecHits.push_back(newRH);
MuonSegFit::MuonRecHitPtr trkRecHit(newRH);
muonRecHits.push_back(trkRecHit);
}

#ifdef EDM_ML_DEBUG // have lines below only compiled when in debug mode
Expand All @@ -344,7 +345,6 @@ void GEMSegmentAlgorithm::buildSegments(const GEMEnsemble& ensemble, const Ensem
bool goodfit = sfit_->fit();
edm::LogVerbatim("GEMSegmentAlgorithm") << "[GEMSegmentAlgorithm::buildSegments] GEMSegment fit done :: fit is good = "<<goodfit;

for (auto rh:muonRecHits) delete rh;
// quit function if fit was not OK
if(!goodfit) return;

Expand Down Expand Up @@ -393,6 +393,7 @@ void GEMSegmentAlgorithm::buildSegments(const GEMEnsemble& ensemble, const Ensem
edm::LogVerbatim("GEMSegmentAlgorithm") << "[GEMSegmentAlgorithm::buildSegments] GEMSegment made in "<<tmp.gemDetId();
edm::LogVerbatim("GEMSegmentAlgorithm") << "[GEMSegmentAlgorithm::buildSegments] "<<tmp;

for (auto rh:muonRecHits) rh.reset();
gemsegs.push_back(tmp);
}

Expand Down
3 changes: 1 addition & 2 deletions RecoLocalMuon/GEMSegment/plugins/GEMSegmentAlgorithm.h
Expand Up @@ -29,8 +29,7 @@ class GEMSegmentAlgorithm : public GEMSegmentAlgorithmBase {
/// Typedefs
typedef std::vector<const GEMRecHit*> EnsembleHitContainer;
typedef std::vector<EnsembleHitContainer> ProtoSegments;
typedef std::vector<const TrackingRecHit*> MuonRecHitContainer;


/// Constructor
explicit GEMSegmentAlgorithm(const edm::ParameterSet& ps);
/// Destructor
Expand Down
10 changes: 6 additions & 4 deletions RecoLocalMuon/GEMSegment/plugins/ME0SegmentAlgorithm.cc
Expand Up @@ -297,7 +297,7 @@ void ME0SegmentAlgorithm::buildSegments(const ME0Ensemble& ensemble, const Ensem
}
#endif

MuonRecHitContainer muonRecHits;
MuonSegFit::MuonRecHitContainer muonRecHits;
proto_segment.clear();

uint32_t refid = ensemble.second.begin()->first;
Expand All @@ -312,8 +312,10 @@ void ME0SegmentAlgorithm::buildSegments(const ME0Ensemble& ensemble, const Ensem
const LocalPoint lp = refPart->toLocal(gp);
ME0RecHit *newRH = (*rh)->clone();
newRH->setPosition(lp);

muonRecHits.push_back(newRH);

MuonSegFit::MuonRecHitPtr trkRecHit(newRH);
muonRecHits.push_back(trkRecHit);
//muonRecHits.push_back(newRH);
}

// The actual fit on all hits of the vector of the selected Tracking RecHits:
Expand All @@ -322,7 +324,6 @@ void ME0SegmentAlgorithm::buildSegments(const ME0Ensemble& ensemble, const Ensem
sfit_->fit();
edm::LogVerbatim("ME0SegmentAlgorithm") << "[ME0SegmentAlgorithm::buildSegments] ME0Segment fit done";

for (auto rh:muonRecHits) delete rh;
// quit function if fit was not OK
//if(!goodfit) return;

Expand Down Expand Up @@ -352,6 +353,7 @@ void ME0SegmentAlgorithm::buildSegments(const ME0Ensemble& ensemble, const Ensem
edm::LogVerbatim("ME0SegmentAlgorithm") << "[ME0SegmentAlgorithm::buildSegments] ME0Segment made";
edm::LogVerbatim("ME0SegmentAlgorithm") << "[ME0SegmentAlgorithm::buildSegments] "<<tmp;

for (auto rh:muonRecHits) rh.reset();
me0segs.push_back(tmp);
return;
}
Expand Down
1 change: 0 additions & 1 deletion RecoLocalMuon/GEMSegment/plugins/ME0SegmentAlgorithm.h
Expand Up @@ -29,7 +29,6 @@ class ME0SegmentAlgorithm : public ME0SegmentAlgorithmBase {
/// Typedefs
typedef std::vector<const ME0RecHit*> EnsembleHitContainer;
typedef std::vector<EnsembleHitContainer> ProtoSegments;
typedef std::vector<const TrackingRecHit*> MuonRecHitContainer;

/// Constructor
explicit ME0SegmentAlgorithm(const edm::ParameterSet& ps);
Expand Down
6 changes: 4 additions & 2 deletions RecoLocalMuon/GEMSegment/plugins/MuonSegFit.h
Expand Up @@ -37,8 +37,10 @@ class MuonSegFit {
public:

// TYPES
typedef std::vector<const TrackingRecHit*> MuonRecHitContainer;

//typedef std::vector<const TrackingRecHit*> MuonRecHitContainer;
typedef std::shared_ptr<TrackingRecHit> MuonRecHitPtr;
typedef std::vector<MuonRecHitPtr> MuonRecHitContainer;

// 12 x12 Symmetric
typedef ROOT::Math::SMatrix<double,12,12,ROOT::Math::MatRepSym<double,12> > SMatrixSym12;

Expand Down