-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Format for clustering CSC rechits with jet algorithms #35543
Changes from all commits
99ccc39
80bda88
3cb2a02
bf8a9f8
99c7b87
130b698
5c04e0b
d4d1286
f5f3b03
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
<use name="DataFormats/Common"/> | ||
<use name="DataFormats/MuonDetId"/> | ||
<use name="DataFormats/TrackingRecHit"/> | ||
<use name="DataFormats/Common"/> | ||
<use name="DataFormats/MuonDetId"/> | ||
<use name="DataFormats/Candidate"/> | ||
<use name="DataFormats/TrackingRecHit"/> | ||
<export> | ||
<lib name="1"/> | ||
</export> |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,79 @@ | ||||
#ifndef DataFormats_CSCJetCandidate_h | ||||
#define DataFormats_CSCJetCandidate_h | ||||
|
||||
#include <vector> | ||||
#include <memory> | ||||
#include "DataFormats/Math/interface/Point3D.h" | ||||
#include "DataFormats/Common/interface/SortedCollection.h" | ||||
|
||||
#include <DataFormats/CSCRecHit/interface/CSCRecHit2D.h> | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not used.
Suggested change
|
||||
#include "DataFormats/Candidate/interface/LeafCandidate.h" | ||||
|
||||
namespace reco { | ||||
|
||||
class CSCJetCandidate : public LeafCandidate { | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have (so far just minor) preference for such class to be in DataFormats/MuonReco. |
||||
public: | ||||
//default constructor | ||||
CSCJetCandidate() | ||||
: x_(0.), | ||||
y_(0.), | ||||
z_(0.), | ||||
tPeak_(-999.), | ||||
tWire_(-999.), | ||||
quality_(0), | ||||
chamber_(0), | ||||
station_(0), | ||||
nStrips_(0), | ||||
hitWire_(0), | ||||
wgroupsBX_(0), | ||||
nWireGroups_(0) {} | ||||
|
||||
CSCJetCandidate(const double phi, | ||||
const double eta, | ||||
const float x, | ||||
const float y, | ||||
const float z, | ||||
const float tPeak, | ||||
const float tWire, | ||||
const int quality, | ||||
const int chamber, | ||||
const int station, | ||||
const int nStrips, | ||||
const int hitWire, | ||||
const int wgroupsBX, | ||||
const int nWireGroups); | ||||
|
||||
//destructor | ||||
~CSCJetCandidate() override; | ||||
|
||||
float xPos() const { return x_; } | ||||
float yPos() const { return y_; } | ||||
float zPos() const { return z_; } | ||||
float tPeak() const { return tPeak_; } | ||||
float tWire() const { return tWire_; } | ||||
int quality() const { return quality_; } | ||||
int chamber() const { return chamber_; } | ||||
int station() const { return station_; } | ||||
int nStrips() const { return nStrips_; } | ||||
int hitWire() const { return hitWire_; } | ||||
int wgroupsBX() const { return wgroupsBX_; } | ||||
int nWireGroups() const { return nWireGroups_; } | ||||
|
||||
private: | ||||
float x_; | ||||
float y_; | ||||
float z_; | ||||
float tPeak_; | ||||
float tWire_; | ||||
int quality_; | ||||
int chamber_; | ||||
int station_; | ||||
int nStrips_; | ||||
int hitWire_; | ||||
int wgroupsBX_; | ||||
int nWireGroups_; | ||||
}; | ||||
|
||||
typedef std::vector<CSCJetCandidate> CSCJetCandidateCollection; | ||||
} // namespace reco | ||||
#endif |
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,38 @@ | ||||||||
#include "DataFormats/CSCRecHit/interface/CSCJetCandidate.h" | ||||||||
|
||||||||
/* | ||||||||
* Create LeafCandidate with (eta,phi) only as CSC rechits has no energy/momentum measurement | ||||||||
* Pt is set to 1.0 as a place holder, mass is set at 0. | ||||||||
* Vertex associated with the CSC rechit is set to the origin. | ||||||||
* | ||||||||
*/ | ||||||||
reco::CSCJetCandidate::CSCJetCandidate(double phi, | ||||||||
double eta, | ||||||||
float x, | ||||||||
float y, | ||||||||
float z, | ||||||||
float tPeak, | ||||||||
float tWire, | ||||||||
int quality, | ||||||||
int chamber, | ||||||||
int station, | ||||||||
int nStrips, | ||||||||
int hitWire, | ||||||||
int wgroupsBX, | ||||||||
int nWireGroups) | ||||||||
: LeafCandidate(0, LorentzVector(math::PtEtaPhiMLorentzVector(1.0, eta, phi, 0)), Point(0, 0, 0)) { | ||||||||
x_ = x; | ||||||||
Comment on lines
+23
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
initializer list (before [the comment applies to the rest of the members] |
||||||||
y_ = y; | ||||||||
z_ = z; | ||||||||
tPeak_ = tPeak; | ||||||||
tWire_ = tWire; | ||||||||
quality_ = quality; | ||||||||
chamber_ = chamber; | ||||||||
station_ = station; | ||||||||
nStrips_ = nStrips; | ||||||||
hitWire_ = hitWire; | ||||||||
wgroupsBX_ = wgroupsBX; | ||||||||
nWireGroups_ = nWireGroups; | ||||||||
} | ||||||||
|
||||||||
reco::CSCJetCandidate::~CSCJetCandidate() {} |
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -17,8 +17,12 @@ | |||||||||||
<class name="edm::ClonePolicy<CSCRecHit2D>"/> <!-- Root6 --> | ||||||||||||
<class name="edm::RangeMap<CSCDetId,edm::OwnVector<CSCRecHit2D,edm::ClonePolicy<CSCRecHit2D> >,edm::ClonePolicy<CSCRecHit2D> >"/> | ||||||||||||
<class name="edm::Wrapper<edm::RangeMap<CSCDetId,edm::OwnVector<CSCRecHit2D,edm::ClonePolicy<CSCRecHit2D> >,edm::ClonePolicy<CSCRecHit2D> > >"/> | ||||||||||||
|
||||||||||||
<class name="std::vector<CSCSegment>"/> | ||||||||||||
<class name="reco::CSCJetCandidate" ClassVersion="4"> | ||||||||||||
<version ClassVersion="3" checksum="1185432696"/> | ||||||||||||
<version ClassVersion="4" checksum="882507185"/> | ||||||||||||
Comment on lines
+20
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
remove intermediate/unused class versions |
||||||||||||
</class> | ||||||||||||
<class name="std::vector<reco::CSCJetCandidate>"/> | ||||||||||||
<class name="edm::Wrapper<std::vector<reco::CSCJetCandidate>>"/> | ||||||||||||
<class name="std::vector<CSCSegment*>"/> | ||||||||||||
<class name="CSCSegment" ClassVersion="11"> | ||||||||||||
<version ClassVersion="11" checksum="160361831"/> | ||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#include <RecoLocalMuon/CSCRecHitD/src/CSCJetCandidateProducer.h> | ||
|
||
#include <FWCore/Framework/interface/Frameworkfwd.h> | ||
#include <FWCore/Framework/interface/EDProducer.h> | ||
#include <FWCore/Framework/interface/Event.h> | ||
#include <FWCore/Framework/interface/MakerMacros.h> | ||
#include <DataFormats/Common/interface/Handle.h> | ||
#include <FWCore/Framework/interface/ESHandle.h> | ||
#include <FWCore/ParameterSet/interface/ParameterSet.h> | ||
#include <FWCore/Utilities/interface/Exception.h> | ||
#include <FWCore/MessageLogger/interface/MessageLogger.h> | ||
|
||
#include <DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h> | ||
#include "Geometry/Records/interface/MuonGeometryRecord.h" | ||
|
||
CSCJetCandidateProducer::CSCJetCandidateProducer(const edm::ParameterSet& ps) { | ||
cscRechitInputToken_ = consumes<CSCRecHit2DCollection>(edm::InputTag("csc2DRecHits")), | ||
|
||
// register what this produces | ||
produces<CSCJetCandidateCollection>(); | ||
} | ||
|
||
CSCJetCandidateProducer::~CSCJetCandidateProducer() {} | ||
|
||
void CSCJetCandidateProducer::produce(edm::Event& ev, const edm::EventSetup& setup) { | ||
LogTrace("CSCRecHit") << "[CSCJetCandidateProducer] starting event "; | ||
|
||
edm::ESHandle<CSCGeometry> cscG; | ||
edm::Handle<CSCRecHit2DCollection> cscRechits; | ||
|
||
setup.get<MuonGeometryRecord>().get(cscG); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. esConsumes should be used |
||
ev.getByToken(cscRechitInputToken_, cscRechits); | ||
|
||
// Create empty collection of rechits | ||
auto oc = std::make_unique<CSCJetCandidateCollection>(); | ||
|
||
// Put collection in event | ||
LogTrace("CSCRecHit") << "[CSCJetCandidateProducer] putting collection of " << oc->size() << " rechits into event."; | ||
|
||
for (const CSCRecHit2D& cscRechit : *cscRechits) { | ||
LocalPoint cscRecHitLocalPosition = cscRechit.localPosition(); | ||
CSCDetId cscdetid = cscRechit.cscDetId(); | ||
int endcap = CSCDetId::endcap(cscdetid) == 1 ? 1 : -1; | ||
const CSCChamber* cscchamber = cscG->chamber(cscdetid); | ||
if (cscchamber) { | ||
GlobalPoint globalPosition = cscchamber->toGlobal(cscRecHitLocalPosition); | ||
|
||
float x = globalPosition.x(); | ||
float y = globalPosition.y(); | ||
float z = globalPosition.z(); | ||
double phi = globalPosition.phi(); | ||
double eta = globalPosition.eta(); | ||
float tpeak = cscRechit.tpeak(); | ||
float wireTime = cscRechit.wireTime(); | ||
int quality = cscRechit.quality(); | ||
int chamber = endcap * (CSCDetId::station(cscdetid) * 10 + CSCDetId::ring(cscdetid)); | ||
int station = endcap * CSCDetId::station(cscdetid); | ||
int nStrips = cscRechit.nStrips(); | ||
int hitWire = cscRechit.hitWire(); | ||
int wgroupsBX = cscRechit.wgroupsBX(); | ||
int nWireGroups = cscRechit.nWireGroups(); | ||
|
||
reco::CSCJetCandidate rh( | ||
phi, eta, x, y, z, tpeak, wireTime, quality, chamber, station, nStrips, hitWire, wgroupsBX, nWireGroups); | ||
oc->push_back(rh); | ||
} | ||
} | ||
ev.put(std::move(oc)); | ||
} | ||
|
||
//define this as a plug-in | ||
DEFINE_FWK_MODULE(CSCJetCandidateProducer); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#ifndef CSCRecHitD_CSCJetCandidateProducer_h | ||
#define CSCRecHitD_CSCJetCandidateProducer_h | ||
|
||
/** \class CSCJetCandidateProducer | ||
* | ||
* Produces a collection of CSCJetCandidate's (2D CSC RecHits as JetCandidates) | ||
* \author Martin Kwok | ||
* | ||
*/ | ||
|
||
#include <FWCore/Framework/interface/ConsumesCollector.h> | ||
#include <FWCore/Framework/interface/Frameworkfwd.h> | ||
#include "FWCore/Framework/interface/stream/EDProducer.h" | ||
#include <FWCore/Framework/interface/Event.h> | ||
#include <FWCore/ParameterSet/interface/ParameterSet.h> | ||
#include <FWCore/Utilities/interface/InputTag.h> | ||
#include <FWCore/Utilities/interface/ESGetToken.h> | ||
|
||
#include "DataFormats/CSCRecHit/interface/CSCSegmentCollection.h" | ||
#include "DataFormats/CSCRecHit/interface/CSCJetCandidate.h" | ||
#include "Geometry/CSCGeometry/interface/CSCGeometry.h" | ||
#include "DataFormats/MuonDetId/interface/CSCDetId.h" | ||
|
||
class CSCJetCandidateProducer : public edm::stream::EDProducer<> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. header files are not needed for plugins; please merge this .h file contents into the CSCJetCandidateProducer.cc all new modules should have a |
||
public: | ||
explicit CSCJetCandidateProducer(const edm::ParameterSet& ps); | ||
~CSCJetCandidateProducer() override; | ||
|
||
void produce(edm::Event&, const edm::EventSetup&) override; | ||
|
||
private: | ||
edm::EDGetTokenT<CSCRecHit2DCollection> cscRechitInputToken_; | ||
typedef std::vector<reco::CSCJetCandidate> CSCJetCandidateCollection; | ||
}; | ||
|
||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please revert to the old indentation