51 muons_(iConfig.getParameter<edm::InputTag>(
"muons")),
52 muonsCut_(iConfig.existsAs<std::
string>(
"muonsCut") ? iConfig.getParameter<std::
string>(
"muonsCut") :
""),
53 mergeCaloMuons_(iConfig.existsAs<bool>(
"mergeCaloMuons") ? iConfig.getParameter<bool>(
"mergeCaloMuons") :
true),
54 caloMuons_(iConfig.getParameter<edm::InputTag>(
"caloMuons")),
55 caloMuonsCut_(iConfig.existsAs<std::
string>(
"caloMuonsCut") ? iConfig.getParameter<std::
string>(
"caloMuonsCut") :
""),
56 minCaloCompatibility_(mergeCaloMuons_ ? iConfig.getParameter<double>(
"minCaloCompatibility") : 0),
57 mergeTracks_(iConfig.existsAs<bool>(
"mergeTracks") ? iConfig.getParameter<bool>(
"mergeTracks") :
false),
58 tracks_(mergeTracks_ ? iConfig.getParameter<edm::InputTag>(
"tracks") : edm::InputTag()),
59 tracksCut_(iConfig.existsAs<std::
string>(
"tracksCut") ? iConfig.getParameter<std::
string>(
"tracksCut") :
"")
64 produces<std::vector<reco::Muon> >();
77 std::auto_ptr<std::vector<reco::Muon> >
out(
new std::vector<reco::Muon>());
78 out->reserve(muons->size() + (
mergeTracks_?tracks->size():0));
81 for (std::vector<reco::Muon>::const_iterator it = muons->begin(), ed = muons->end(); it != ed; ++it) {
90 }
else throw cms::Exception(
"Boh") <<
"Muon with track and no CaloCompatibility; pt = " << mu.
pt() <<
", eta = " << mu.
eta() <<
", type = " << mu.
type() <<
"\n";
96 for (std::vector<reco::CaloMuon>::const_iterator it = caloMuons->begin(), ed = caloMuons->end(); it != ed; ++it) {
100 double energy =
sqrt(track->p() * track->p() + 0.011163691);
102 out->push_back(
reco::Muon(track->charge(),
p4, track->vertex()));
114 for (
size_t i = 0;
i < tracks->size();
i++) {
119 for(std::vector<reco::Muon>::const_iterator
muon = muons->begin();
muon < muons->end();
muon++){
120 if(
muon->innerTrack() == track){
127 bool isCaloMuon =
false;
128 for(std::vector<reco::CaloMuon>::const_iterator
muon = caloMuons->begin();
muon < caloMuons->end();
muon++){
129 if(
muon->innerTrack() == track){
134 if(isCaloMuon)
continue;
137 double energy =
sqrt(track->p() * track->p() + 0.011163691);
139 out->push_back(
reco::Muon(track->charge(),
p4, track->vertex()));
virtual ~CaloMuonMerger()
bool isNonnull() const
Checks for non-null.
const std::vector< reco::PFCandidatePtr > & tracks_
void setType(unsigned int type)
virtual float pt() const
transverse momentum
bool isMuon(const Candidate &part)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
bool isCaloCompatibilityValid() const
#define DEFINE_FWK_MODULE(type)
virtual TrackRef track() const
reference to a Track
void setCalEnergy(const MuonEnergy &calEnergy)
set energy deposition information
StringCutObjectSelector< reco::CaloMuon, false > caloMuonsCut_
double minCaloCompatibility_
edm::EDGetTokenT< std::vector< reco::Track > > trackToken_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
virtual void setInnerTrack(const TrackRef &t)
set reference to Track
StringCutObjectSelector< reco::TrackRef, false > tracksCut_
void setCaloCompatibility(float input)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
virtual float eta() const
momentum pseudorapidity
edm::EDGetTokenT< std::vector< reco::Muon > > muonToken_
CaloMuonMerger(const edm::ParameterSet &iConfig)
StringCutObjectSelector< reco::Muon, false > muonsCut_
edm::EDGetTokenT< std::vector< reco::CaloMuon > > caloMuonToken_
static const unsigned int CaloMuon
Merges reco::CaloMuons, reco::Muons and optionally reco::Tracks avoiding innerTrack duplications in a...
unsigned int type() const
volatile std::atomic< bool > shutdown_flag false
float caloCompatibility() const
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override