-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add track plugin to TICL candidate producer
- Loading branch information
Showing
7 changed files
with
122 additions
and
51 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#ifndef RecoHGCal_TICL_TracksterTrackPluginBase_H__ | ||
#define RecoHGCal_TICL_TracksterTrackPluginBase_H__ | ||
|
||
#include "DataFormats/Candidate/interface/Candidate.h" | ||
#include "DataFormats/VertexReco/interface/Vertex.h" | ||
#include "DataFormats/CaloRecHit/interface/CaloCluster.h" | ||
#include "DataFormats/HGCalReco/interface/Trackster.h" | ||
#include "DataFormats/HGCalReco/interface/TICLCandidate.h" | ||
#include "FWCore/Framework/interface/ConsumesCollector.h" | ||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/PluginManager/interface/PluginFactory.h" | ||
|
||
namespace ticl { | ||
class TracksterTrackPluginBase { | ||
public: | ||
TracksterTrackPluginBase(const edm::ParameterSet&, edm::ConsumesCollector&& iC) {} | ||
typedef reco::Candidate::LorentzVector LorentzVector; | ||
virtual ~TracksterTrackPluginBase() {} | ||
virtual void setTrack(const ticl::Trackster& trackster, ticl::TICLCandidate& ticl_cand) const = 0; | ||
|
||
// Allow access to event so data products can be read once at beginning of event but four-vector calculation can | ||
// be run on single tracksters | ||
edm::Event& evt() const { return *evt_; } | ||
|
||
// Needs to be called by CMSSW plugins using this plugin before being able to use other methods | ||
void beginEvent(edm::Event& evt) { | ||
evt_ = &evt; | ||
this->beginEvt(); | ||
} | ||
private: | ||
virtual void beginEvt() = 0; | ||
edm::Event* evt_; | ||
}; | ||
} // namespace | ||
|
||
typedef edmplugin::PluginFactory<ticl::TracksterTrackPluginBase*(const edm::ParameterSet&, edm::ConsumesCollector&& iC)> TracksterTrackPluginFactory; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include "DataFormats/Math/interface/LorentzVector.h" | ||
#include "FWCore/Framework/interface/ConsumesCollector.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" | ||
#include "RecoHGCal/TICL/interface/TracksterTrackPluginBase.h" | ||
|
||
namespace ticl { | ||
template<class TrackClass> | ||
class TracksterGeneralTrackPlugin final : public TracksterTrackPluginBase { | ||
public: | ||
typedef edm::Ref<std::vector<TrackClass> > TrackRef; | ||
explicit TracksterGeneralTrackPlugin<TrackClass>(const edm::ParameterSet&, edm::ConsumesCollector&& iC); | ||
void setTrack(const ticl::Trackster& trackster, ticl::TICLCandidate& ticl_cand) const override; | ||
private: | ||
void beginEvt() override; | ||
}; | ||
|
||
template<class TrackClass> | ||
TracksterGeneralTrackPlugin<TrackClass>::TracksterGeneralTrackPlugin(const edm::ParameterSet& ps, edm::ConsumesCollector&& ic) : | ||
TracksterTrackPluginBase(ps, std::move(ic)) {// , | ||
} | ||
|
||
template<class TrackClass> | ||
void TracksterGeneralTrackPlugin<TrackClass>::beginEvt() { | ||
} | ||
|
||
template<class TrackClass> | ||
void TracksterGeneralTrackPlugin<TrackClass>::setTrack(const ticl::Trackster& trackster, ticl::TICLCandidate& ticl_cand) const { | ||
if (trackster.seedIndex == 0 || !trackster.seedID.isValid()) { | ||
return; // leave default empty track ref | ||
} | ||
|
||
TrackRef ref(trackster.seedID, trackster.seedIndex, &this->evt().productGetter()); | ||
ticl_cand.set_track_ref(ref); | ||
} | ||
|
||
template class TracksterGeneralTrackPlugin<reco::Track>; | ||
typedef TracksterGeneralTrackPlugin<reco::Track> TracksterRecoTrackPlugin; | ||
|
||
} // namespace | ||
|
||
|
||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
DEFINE_EDM_PLUGIN(TracksterTrackPluginFactory, | ||
ticl::TracksterRecoTrackPlugin, | ||
"TracksterRecoTrackPlugin"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#include "RecoHGCal/TICL/interface/TracksterTrackPluginBase.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
|
||
EDM_REGISTER_PLUGINFACTORY(TracksterTrackPluginFactory, "TracksterTrackPluginFactory"); |