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

Fix PR #6576 (Me0 global reco) #6585

Merged
merged 4 commits into from
Nov 25, 2014
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DataFormats/MuonReco/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<use name="DataFormats/VertexReco"/>
<use name="rootrflx"/>
<use name="rootmath"/>
<use name="DataFormats/GEMRecHit"/>
<export>
<lib name="1"/>
</export>
28 changes: 14 additions & 14 deletions DataFormats/MuonReco/interface/ME0Muon.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,22 @@
#define MuonReco_ME0Muon_h
/** \class reco::ME0Muon ME0Muon.h DataFormats/MuonReco/interface/ME0Muon.h
*
* A lightweight reconstructed Muon to store low momentum muons without matches
* in the muon detectors. Contains:
* - reference to a silicon tracker track
* - calorimeter energy deposition
* - calo compatibility variable
* \author David Nash NEU
*
* \author Dmytro Kovalskyi, UCSB
*
* \version $Id: ME0Muon.h,v 1.4 2009/03/15 03:33:32 dmytro Exp $
*
*/
#include "DataFormats/TrackReco/interface/TrackFwd.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include <DataFormats/MuonReco/interface/EmulatedME0SegmentCollection.h>

#include <DataFormats/GEMRecHit/interface/ME0SegmentCollection.h>

namespace reco {

class ME0Muon {
public:
ME0Muon();
ME0Muon( const TrackRef & t, const EmulatedME0SegmentRef & s) { innerTrack_ = t; me0Segment_ = s;}
//ME0Muon( const TrackRef & t, const ME0Segment & s) { innerTrack_ = t; me0Segment_ = s;}
ME0Muon( const TrackRef & t, const ME0Segment & s, const int v) { innerTrack_ = t; me0Segment_ = s; me0segid_=v;}
virtual ~ME0Muon(){}

/// reference to Track reconstructed in the tracker only
Expand All @@ -31,10 +26,14 @@ namespace reco {
/// set reference to Track
virtual void setInnerTrack( const TrackRef & t ) { innerTrack_ = t; }
virtual void setTrack( const TrackRef & t ) { setInnerTrack(t); }
/// set reference to our new EmulatedME0Segment type
virtual void setEmulatedME0Segment( const EmulatedME0SegmentRef & s ) { me0Segment_ = s; }
/// set reference to our new ME0Segment type
virtual void setME0Segment( const ME0Segment & s ) { me0Segment_ = s; }

virtual EmulatedME0SegmentRef me0segment() const { return me0Segment_; }
virtual ME0Segment me0segment() const { return me0Segment_; }

//Added for testing
virtual void setme0segid( const int v){me0segid_=v;}
virtual int me0segid() const {return me0segid_;}

/// a bunch of useful accessors
int charge() const { return innerTrack_.get()->charge(); }
Expand All @@ -58,7 +57,8 @@ namespace reco {
private:
/// reference to Track reconstructed in the tracker only
TrackRef innerTrack_;
EmulatedME0SegmentRef me0Segment_;
ME0Segment me0Segment_;
int me0segid_;
};

}
Expand Down
3 changes: 2 additions & 1 deletion DataFormats/MuonReco/interface/ME0MuonCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* The collection of ME0Muon's. See \ref ME0MuonCollection.h for details.
*
* $Date: 2010/03/12 13:08:15 $
* \author Matteo Sani
* \author David Nash
*/

#include "DataFormats/MuonReco/interface/ME0Muon.h"
Expand All @@ -17,5 +17,6 @@ typedef std::vector<reco::ME0Muon> ME0MuonCollection;

/// persistent reference to a ME0Muon
typedef edm::Ref<ME0MuonCollection> ME0MuonRef;


#endif
4 changes: 2 additions & 2 deletions DataFormats/MuonReco/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@
<class name="edm::Ref<std::vector<EmulatedME0Segment>,EmulatedME0Segment,edm::refhelper::FindUsingAdvance<std::vector<EmulatedME0Segment>,EmulatedME0Segment> >"/>

<class name="std::vector<reco::ME0Muon>"/>
<class name="reco::ME0Muon" ClassVersion="14">
<version ClassVersion="14" checksum="13864262"/>
<class name="reco::ME0Muon" ClassVersion="15">
<version ClassVersion="15" checksum="3167678990"/>
</class>
<class name="edm::Wrapper<std::vector<reco::ME0Muon> >"/>

Expand Down
1 change: 1 addition & 0 deletions FastSimulation/Configuration/test/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<use name="DataFormats/GeometryVector"/>
<use name="DataFormats/GeometrySurface"/>
<use name="DataFormats/HepMCCandidate"/>
<use name="DataFormats/GEMRecHit"/>
<use name="FWCore/Framework"/>
<use name="FWCore/MessageLogger"/>
<use name="FWCore/ParameterSet"/>
Expand Down
20 changes: 10 additions & 10 deletions FastSimulation/Configuration/test/TestAnalyzer_Final.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

#include <Geometry/Records/interface/MuonGeometryRecord.h>

#include <DataFormats/MuonReco/interface/EmulatedME0Segment.h>
#include <DataFormats/MuonReco/interface/EmulatedME0SegmentCollection.h>
#include <DataFormats/GEMRecHit/interface/ME0Segment.h>
#include <DataFormats/GEMRecHit/interface/ME0SegmentCollection.h>

#include <DataFormats/MuonReco/interface/ME0Muon.h>
#include <DataFormats/MuonReco/interface/ME0MuonCollection.h>
Expand Down Expand Up @@ -135,8 +135,8 @@ TestAnalyzer_Final::analyze(const edm::Event& iEvent, const edm::EventSetup& iSe
Handle <std::vector<RecoChargedCandidate> > OurCandidates;
iEvent.getByLabel <std::vector<RecoChargedCandidate> > ("me0MuonConverter", OurCandidates);

Handle<std::vector<EmulatedME0Segment> > OurSegments;
iEvent.getByLabel<std::vector<EmulatedME0Segment> >("me0SegmentProducer", OurSegments);
Handle<std::vector<ME0Segment> > OurSegments;
iEvent.getByLabel<std::vector<ME0Segment> >("me0SegmentProducer", OurSegments);

Handle<GenParticleCollection> genParticles;
iEvent.getByLabel<GenParticleCollection>("genParticles", genParticles);
Expand Down Expand Up @@ -176,7 +176,7 @@ TestAnalyzer_Final::analyze(const edm::Event& iEvent, const edm::EventSetup& iSe
}
}
//unsigned int recosize=OurCandidates->size();
for (std::vector<EmulatedME0Segment>::const_iterator thisSegment = OurSegments->begin();
for (std::vector<ME0Segment>::const_iterator thisSegment = OurSegments->begin();
thisSegment != OurSegments->end();++thisSegment){
// double theta = atan(thisSegment->localDirection().y()/ thisSegment->localDirection().x());
// double tempeta = -log(tan (theta/2.));
Expand All @@ -196,16 +196,16 @@ TestAnalyzer_Final::analyze(const edm::Event& iEvent, const edm::EventSetup& iSe
// std::vector<int> UniqueIdList;
// std::vector<int> Ids;
std::vector<Double_t> SegmentEta;
std::vector<const EmulatedME0Segment*> Ids;
std::vector<const EmulatedME0Segment*> UniqueIdList;
std::vector<const ME0Segment*> Ids;
std::vector<const ME0Segment*> UniqueIdList;

for (std::vector<ME0Muon>::const_iterator thisMuon = OurMuons->begin();
thisMuon != OurMuons->end(); ++thisMuon){
TrackRef tkRef = thisMuon->innerTrack();
EmulatedME0SegmentRef segRef = thisMuon->me0segment();
ME0Segment segment = thisMuon->me0segment();
//int SegId = thisMuon->segRefId();
//int SegId = segRef.get();
const EmulatedME0Segment* SegId = segRef.get();
const ME0Segment* SegId = &segment;
//PointersVector.push_back(segRef.get());
bool IsNew = true;
for (unsigned int i =0; i < Ids.size(); i++){
Expand All @@ -214,7 +214,7 @@ TestAnalyzer_Final::analyze(const edm::Event& iEvent, const edm::EventSetup& iSe
if (IsNew) {
std::cout<<"Found: "<<SegId<<std::endl;
UniqueIdList.push_back(SegId);
LocalVector TempVect(segRef->localDirection().x(),segRef->localDirection().y(),segRef->localDirection().z());
LocalVector TempVect(segment.localDirection().x(),segment.localDirection().y(),segment.localDirection().z());
SegmentEta.push_back(TempVect.eta());
}
Ids.push_back(SegId);
Expand Down
5 changes: 5 additions & 0 deletions RecoMuon/MuonIdentification/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,18 @@
<use name="FWCore/ParameterSet"/>
<use name="Geometry/CommonDetUnit"/>
<use name="Geometry/CSCGeometry"/>
<use name="Geometry/GEMGeometry"/>
<use name="DataFormats/GEMRecHit"/>
<use name="Geometry/Records"/>
<use name="SimDataFormats/Track"/>
<use name="SimDataFormats/TrackingHit"/>
<use name="roothistmatrix"/>
<use name="RecoMuon/TrackingTools"/>
<use name="DataFormats/CSCRecHit"/>
<use name="RecoLocalCalo/HcalRecAlgos"/>
<use name="SimTracker/TrackAssociation"/>
<use name="SimTracker/TrackerHitAssociation"/>

<export>
<lib name="1"/>
</export>
11 changes: 5 additions & 6 deletions RecoMuon/MuonIdentification/plugins/ME0MuonConverter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@

#include <Geometry/Records/interface/MuonGeometryRecord.h>

#include <DataFormats/MuonReco/interface/EmulatedME0Segment.h>
#include <DataFormats/MuonReco/interface/EmulatedME0SegmentCollection.h>


#include <DataFormats/MuonReco/interface/ME0Muon.h>
#include <DataFormats/MuonReco/interface/ME0MuonCollection.h>


#include "DataFormats/GeometryVector/interface/GlobalVector.h"
#include "DataFormats/GeometryVector/interface/GlobalPoint.h"
#include "TrackingTools/GeomPropagators/interface/Propagator.h"
Expand All @@ -32,6 +33,7 @@

#include "TrackingTools/Records/interface/TrackingComponentsRecord.h"


#include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h"
#include "DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h"

Expand All @@ -50,13 +52,11 @@ void ME0MuonConverter::produce(edm::Event& ev, const edm::EventSetup& setup) {
using namespace reco;

Handle <std::vector<ME0Muon> > OurMuons;
ev.getByLabel <std::vector<ME0Muon> > ("me0SegmentMatcher", OurMuons);

ev.getByLabel <std::vector<ME0Muon> > ("me0SegmentMatching", OurMuons);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dnash86 Should there also be a change to the default config/customisation to match this change?
I get a failure in Reco for many workflows (e.g. 13800):

---- Begin Fatal Exception 25-Nov-2014 13:07:29 CET-----------------------
An exception of category 'ProductNotFound' occurred while
[0] Processing run: 1 lumi: 1 event: 1
[1] Running path 'reconstruction_step'
[2] Calling event method for module ME0MuonConverter/'me0MuonConverter'
Exception Message:
Principal::getByLabel: Found zero products matching all criteria
Looking for type: std::vector<reco::ME0Muon>
Looking for module label: me0SegmentMatching
Looking for productInstanceName:

As far as I can see there is no python change to switch the name of the producer. Also might be an idea to have this as a config parameter.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mark-grimes Yes, it seems I didn't add the python files I had changed in my local area to the commit, my mistake. I tested 13800 locally (as well as 13007, earlier), and it works. I've added a new commit with the 3 needed python configs, but I think they are still on PR #6576. How can I merge it with this PR?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll grab the commit and apply directly myself.

For future reference though, it's possible to put in a pull request directly on to my branch (mark-grimes:fix6576) and then the pull request gets updated. I could have done the same onto your branch and modify #6576 directly, but it requires you to accept it - in the past I've been waiting around for people to accept, so I find it easier to put in a new request myself.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. Thanks a lot for the information about future pull requests. I'll keep that in mind.

std::auto_ptr<RecoChargedCandidateCollection> oc( new RecoChargedCandidateCollection());

for (std::vector<ME0Muon>::const_iterator thisMuon = OurMuons->begin();
thisMuon != OurMuons->end(); ++thisMuon){

TrackRef tkRef = thisMuon->innerTrack();

Particle::Charge q = tkRef->charge();
Expand All @@ -67,7 +67,6 @@ void ME0MuonConverter::produce(edm::Event& ev, const edm::EventSetup& setup) {
if(abs(q)==1) pid = q < 0 ? 13 : -13;
reco::RecoChargedCandidate cand(q, p4, vtx, pid);
cand.setTrack(thisMuon->innerTrack());

oc->push_back(cand);
}

Expand Down
1 change: 1 addition & 0 deletions RecoMuon/MuonIdentification/plugins/ME0MuonConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include <DataFormats/GEMRecHit/interface/ME0SegmentCollection.h>


class ME0MuonConverter : public edm::EDProducer {
Expand Down
Loading