Skip to content

Commit

Permalink
Merge header and source files
Browse files Browse the repository at this point in the history
  • Loading branch information
fwyzard committed Jul 8, 2021
1 parent 91e189f commit 714a55c
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 173 deletions.
66 changes: 41 additions & 25 deletions RecoMuon/L2MuonProducer/plugins/L2MuonCandidateProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,51 @@
* the interchangeability of the L2MuonProducer and the StandAloneMuonProducer
* This class is supposed to be removed once the
* L2/STA comparison will be done, then the RecoChargedCandidate
* production will be put into the L2MuonProducer class.
* production will be done into the L2MuonProducer class.
*
*
* \author J.Alcaraz
*/

// Framework
#include <string>

#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h"
#include "DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/TrackReco/interface/TrackFwd.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/Common/interface/Handle.h"
#include "FWCore/Framework/interface/global/EDProducer.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "RecoMuon/L2MuonProducer/src/L2MuonCandidateProducer.h"
class L2MuonCandidateProducer : public edm::global::EDProducer<> {
public:
/// constructor with config
L2MuonCandidateProducer(const edm::ParameterSet&);

// Input and output collections
#include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h"
#include "DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h"
/// destructor
~L2MuonCandidateProducer() override;

#include <string>
/// produce candidates
void produce(edm::StreamID sid, edm::Event& event, const edm::EventSetup&) const override;

using namespace edm;
using namespace std;
using namespace reco;
private:
// StandAlone Collection Label
edm::InputTag theSACollectionLabel;
edm::EDGetTokenT<reco::TrackCollection> tracksToken;
};

/// constructor with config
L2MuonCandidateProducer::L2MuonCandidateProducer(const ParameterSet& parameterSet) {
L2MuonCandidateProducer::L2MuonCandidateProducer(const edm::ParameterSet& parameterSet) {
LogTrace("Muon|RecoMuon|L2MuonCandidateProducer") << " constructor called";

// StandAlone Collection Label
theSACollectionLabel = parameterSet.getParameter<InputTag>("InputObjects");
theSACollectionLabel = parameterSet.getParameter<edm::InputTag>("InputObjects");
tracksToken = consumes<reco::TrackCollection>(theSACollectionLabel);
produces<RecoChargedCandidateCollection>();
produces<reco::RecoChargedCandidateCollection>();
}

/// destructor
Expand All @@ -50,29 +62,29 @@ L2MuonCandidateProducer::~L2MuonCandidateProducer() {
}

/// reconstruct muons
void L2MuonCandidateProducer::produce(edm::StreamID sid, Event& event, const EventSetup& eventSetup) const {
const string metname = "Muon|RecoMuon|L2MuonCandidateProducer";
void L2MuonCandidateProducer::produce(edm::StreamID sid, edm::Event& event, const edm::EventSetup& eventSetup) const {
const std::string metname = "Muon|RecoMuon|L2MuonCandidateProducer";

// Take the SA container
LogTrace(metname) << " Taking the StandAlone muons: " << theSACollectionLabel;
Handle<TrackCollection> tracks;
edm::Handle<reco::TrackCollection> tracks;
event.getByToken(tracksToken, tracks);

// Create a RecoChargedCandidate collection
LogTrace(metname) << " Creating the RecoChargedCandidate collection";
auto candidates = std::make_unique<RecoChargedCandidateCollection>();
auto candidates = std::make_unique<reco::RecoChargedCandidateCollection>();

for (unsigned int i = 0; i < tracks->size(); i++) {
TrackRef tkref(tracks, i);
Particle::Charge q = tkref->charge();
Particle::LorentzVector p4(tkref->px(), tkref->py(), tkref->pz(), tkref->p());
Particle::Point vtx(tkref->vx(), tkref->vy(), tkref->vz());
reco::TrackRef tkref(tracks, i);
reco::Particle::Charge q = tkref->charge();
reco::Particle::LorentzVector p4(tkref->px(), tkref->py(), tkref->pz(), tkref->p());
reco::Particle::Point vtx(tkref->vx(), tkref->vy(), tkref->vz());
int pid = 13;
if (abs(q) == 1)
pid = q < 0 ? 13 : -13;
else
LogWarning(metname) << "L2MuonCandidate has charge = " << q;
RecoChargedCandidate cand(q, p4, vtx, pid);
edm::LogWarning(metname) << "L2MuonCandidate has charge = " << q;
reco::RecoChargedCandidate cand(q, p4, vtx, pid);
cand.setTrack(tkref);
candidates->push_back(cand);
}
Expand All @@ -82,3 +94,7 @@ void L2MuonCandidateProducer::produce(edm::StreamID sid, Event& event, const Eve
LogTrace(metname) << " Event loaded"
<< "================================";
}

// declare as a framework plugin
#include "FWCore/Framework/interface/MakerMacros.h"
DEFINE_FWK_MODULE(L2MuonCandidateProducer);
49 changes: 0 additions & 49 deletions RecoMuon/L2MuonProducer/plugins/L2MuonCandidateProducer.h

This file was deleted.

80 changes: 53 additions & 27 deletions RecoMuon/L2MuonProducer/plugins/L2MuonProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
//
/** \class L2MuonProducer
*
* Level-2 muon reconstructor:
* L2 muon reconstructor:
* reconstructs muons using DT, CSC and RPC
* information,<BR>
* starting from Level-1 trigger seeds.
* starting from internal seeds (L2 muon track segments).
*
*
*
Expand All @@ -16,51 +16,73 @@
//
//--------------------------------------------------

#include "RecoMuon/L2MuonProducer/src/L2MuonProducer.h"
#include <memory>
#include <string>

// Framework
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/Common/interface/View.h"
#include "DataFormats/MuonSeed/interface/L2MuonTrajectorySeedCollection.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/TrackReco/interface/TrackToTrackMap.h"
#include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
#include "FWCore/Framework/interface/ConsumesCollector.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/stream/EDProducer.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

// TrackFinder and Specific STA/L2 Trajectory Builder
#include "RecoMuon/StandAloneTrackFinder/interface/StandAloneTrajectoryBuilder.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "RecoMuon/StandAloneTrackFinder/interface/ExhaustiveMuonTrajectoryBuilder.h"
#include "RecoMuon/StandAloneTrackFinder/interface/StandAloneTrajectoryBuilder.h"
#include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h"
#include "RecoMuon/TrackingTools/interface/MuonTrackFinder.h"
#include "RecoMuon/TrackingTools/interface/MuonTrackLoader.h"
#include "RecoMuon/TrackingTools/interface/MuonTrajectoryCleaner.h"
#include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h"

#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"

#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/Common/interface/View.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/TrackReco/interface/TrackToTrackMap.h"
#include "DataFormats/MuonSeed/interface/L2MuonTrajectorySeedCollection.h"
class L2MuonProducer : public edm::stream::EDProducer<> {
public:
/// constructor with config
L2MuonProducer(const edm::ParameterSet&);

#include <string>
/// destructor
~L2MuonProducer() override;

using namespace edm;
using namespace std;
/// reconstruct muons
void produce(edm::Event&, const edm::EventSetup&) override;
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

private:
// MuonSeed Collection Label
edm::InputTag theSeedCollectionLabel;

/// the track finder
std::unique_ptr<MuonTrackFinder> theTrackFinder; //It isn't the same as in ORCA

/// the event setup proxy, it takes care the services update
std::unique_ptr<MuonServiceProxy> theService;

edm::EDGetTokenT<edm::View<TrajectorySeed>> seedsToken;
};

/// constructor with config
L2MuonProducer::L2MuonProducer(const ParameterSet& parameterSet) {
L2MuonProducer::L2MuonProducer(const edm::ParameterSet& parameterSet) {
LogTrace("Muon|RecoMuon|L2MuonProducer") << "constructor called" << endl;

// Parameter set for the Builder
ParameterSet trajectoryBuilderParameters = parameterSet.getParameter<ParameterSet>("L2TrajBuilderParameters");
edm::ParameterSet trajectoryBuilderParameters =
parameterSet.getParameter<edm::ParameterSet>("L2TrajBuilderParameters");

// MuonSeed Collection Label
theSeedCollectionLabel = parameterSet.getParameter<InputTag>("InputObjects");
theSeedCollectionLabel = parameterSet.getParameter<edm::InputTag>("InputObjects");
seedsToken = consumes<edm::View<TrajectorySeed>>(theSeedCollectionLabel);
// service parameters
ParameterSet serviceParameters = parameterSet.getParameter<ParameterSet>("ServiceParameters");
edm::ParameterSet serviceParameters = parameterSet.getParameter<edm::ParameterSet>("ServiceParameters");

// TrackLoader parameters
ParameterSet trackLoaderParameters = parameterSet.getParameter<ParameterSet>("TrackLoaderParameters");
edm::ParameterSet trackLoaderParameters = parameterSet.getParameter<edm::ParameterSet>("TrackLoaderParameters");

// the services
theService = std::make_unique<MuonServiceProxy>(serviceParameters, consumesCollector());
Expand All @@ -79,7 +101,7 @@ L2MuonProducer::L2MuonProducer(const ParameterSet& parameterSet) {
trajectoryBuilder =
std::make_unique<ExhaustiveMuonTrajectoryBuilder>(trajectoryBuilderParameters, theService.get(), iC);
else {
LogWarning("Muon|RecoMuon|StandAloneMuonProducer")
edm::LogWarning("Muon|RecoMuon|StandAloneMuonProducer")
<< "No Trajectory builder associated with " << typeOfBuilder
<< ". Falling down to the default (StandAloneMuonTrajectoryBuilder)";
trajectoryBuilder =
Expand Down Expand Up @@ -109,15 +131,15 @@ L2MuonProducer::~L2MuonProducer() {
}

/// reconstruct muons
void L2MuonProducer::produce(Event& event, const EventSetup& eventSetup) {
void L2MuonProducer::produce(edm::Event& event, const edm::EventSetup& eventSetup) {
const std::string metname = "Muon|RecoMuon|L2MuonProducer";

LogTrace(metname) << endl << endl << endl;
LogTrace(metname) << "L2 Muon Reconstruction Started" << endl;

// Take the seeds container
LogTrace(metname) << "Taking the seeds: " << theSeedCollectionLabel.label() << endl;
Handle<View<TrajectorySeed>> seeds;
edm::Handle<edm::View<TrajectorySeed>> seeds;
event.getByToken(seedsToken, seeds);

// Update the services
Expand All @@ -127,7 +149,7 @@ void L2MuonProducer::produce(Event& event, const EventSetup& eventSetup) {
LogTrace(metname) << "Track Reconstruction" << endl;
theTrackFinder->reconstruct(seeds, event, eventSetup);

LogTrace(metname) << "Event loaded"
LogTrace(metname) << "edm::Event loaded"
<< "================================" << endl
<< endl;
}
Expand Down Expand Up @@ -266,3 +288,7 @@ void L2MuonProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptio
desc.add<std::string>("MuonTrajectoryBuilder", "Exhaustive");
descriptions.add("L2MuonProducer", desc);
}

// declare as a framework plugin
#include "FWCore/Framework/interface/MakerMacros.h"
DEFINE_FWK_MODULE(L2MuonProducer);
63 changes: 0 additions & 63 deletions RecoMuon/L2MuonProducer/plugins/L2MuonProducer.h

This file was deleted.

9 changes: 0 additions & 9 deletions RecoMuon/L2MuonProducer/plugins/SealModule.cc

This file was deleted.

0 comments on commit 714a55c

Please sign in to comment.