Skip to content

Commit

Permalink
Merge pull request #14825 from jshlee/MuonSegFit-bugfix
Browse files Browse the repository at this point in the history
MuonSegFit bugfix
  • Loading branch information
cmsbuild committed Jun 10, 2016
2 parents 4882fdf + e3006ed commit a9388aa
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
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

0 comments on commit a9388aa

Please sign in to comment.