2 #include "TLorentzVector.h" 18 #include "TLorentzVector.h" 24 #include "Math/GenVector/VectorUtil.h" 35 PFTaus_ = consumes<reco::PFTauCollection>(pfTau.getUntrackedParameter<
InputTag>(
"PFTauProducer"));
36 auto discs = pfTau.getUntrackedParameter<vector<InputTag>>(
"PFTauDiscriminators");
38 PFTauDis_.push_back(consumes<reco::PFTauDiscriminator>(
tag));
40 doPFTaus_ = pfTau.getUntrackedParameter<
bool>(
"doPFTaus",
false);
41 ptMinPFTau_= pfTau.getUntrackedParameter<
double>(
"ptMin",15.);
42 etaMinPFTau_= pfTau.getUntrackedParameter<
double>(
"etaMin",-2.5);
43 etaMaxPFTau_= pfTau.getUntrackedParameter<
double>(
"etaMax",2.5);
44 phiMinPFTau_= pfTau.getUntrackedParameter<
double>(
"phiMin",-3.15);
45 phiMaxPFTau_= pfTau.getUntrackedParameter<
double>(
"phiMax",3.15);
50 Electrons_ = consumes<reco::GsfElectronCollection>(
electrons.getUntrackedParameter<
InputTag>(
"ElectronCollection"));
51 doElectrons_ =
electrons.getUntrackedParameter<
bool>(
"doElectrons",
false);
52 e_ctfTrackCollectionSrc_ =
electrons.getUntrackedParameter<
InputTag>(
"TrackCollection");
53 e_ctfTrackCollection_ = consumes<reco::TrackCollection>(e_ctfTrackCollectionSrc_);
54 ptMinElectron_=
electrons.getUntrackedParameter<
double>(
"ptMin",15.);
55 e_doTrackIso_ =
electrons.getUntrackedParameter<
bool>(
"doTrackIso",
false);
56 e_trackMinPt_=
electrons.getUntrackedParameter<
double>(
"ptMinTrack",1.5);
57 e_lipCut_=
electrons.getUntrackedParameter<
double>(
"lipMinTrack",1.5);
58 e_minIsoDR_=
electrons.getUntrackedParameter<
double>(
"InnerConeDR",0.02);
59 e_maxIsoDR_=
electrons.getUntrackedParameter<
double>(
"OuterConeDR",0.6);
60 e_isoMaxSumPt_=
electrons.getUntrackedParameter<
double>(
"MaxIsoVar",0.02);
65 Muons_ = consumes<reco::MuonCollection>(
muons.getUntrackedParameter<
InputTag>(
"MuonCollection"));
66 doMuons_ =
muons.getUntrackedParameter<
bool>(
"doMuons",
false);
67 ptMinMuon_=
muons.getUntrackedParameter<
double>(
"ptMin",15.);
72 Jets_ = consumes<reco::CaloJetCollection>(
jets.getUntrackedParameter<
InputTag>(
"JetCollection"));
73 doJets_ =
jets.getUntrackedParameter<
bool>(
"doJets");
74 ptMinJet_=
jets.getUntrackedParameter<
double>(
"etMin");
79 Towers_ = consumes<CaloTowerCollection>(towers.getUntrackedParameter<
InputTag>(
"TowerCollection"));
80 doTowers_ = towers.getUntrackedParameter<
bool>(
"doTowers");
81 ptMinTower_= towers.getUntrackedParameter<
double>(
"etMin");
82 towerIsol_= towers.getUntrackedParameter<
double>(
"towerIsolation");
87 Photons_ = consumes<reco::PhotonCollection>(
photons.getUntrackedParameter<
InputTag>(
"PhotonCollection"));
88 doPhotons_ =
photons.getUntrackedParameter<
bool>(
"doPhotons");
89 ptMinPhoton_=
photons.getUntrackedParameter<
double>(
"etMin");
90 photonEcalIso_=
photons.getUntrackedParameter<
double>(
"ECALIso");
95 MET_ = consumes<reco::CaloMETCollection>(
met.getUntrackedParameter<
InputTag>(
"METCollection"));
96 doMET_ =
met.getUntrackedParameter<
bool>(
"doMET",
false);
97 ptMinMET_=
met.getUntrackedParameter<
double>(
"ptMin",15.);
106 produces<LorentzVectorCollection>(
"PFTaus");
107 produces<LorentzVectorCollection>(
"Electrons");
108 produces<LorentzVectorCollection>(
"Muons");
109 produces<LorentzVectorCollection>(
"Jets");
110 produces<LorentzVectorCollection>(
"Photons");
111 produces<LorentzVectorCollection>(
"Towers");
112 produces<LorentzVectorCollection>(
"MET");
137 auto product_PFTaus = make_unique<LorentzVectorCollection>();
141 for (
unsigned int i=0;
i<pftaus->size(); ++
i) {
142 auto const& pftau = (*pftaus)[
i];
143 if (pftau.pt()>ptMinPFTau_&&
144 pftau.eta()>etaMinPFTau_&&pftau.eta()<etaMaxPFTau_&&
145 pftau.phi()>phiMinPFTau_&&pftau.phi()<phiMaxPFTau_) {
151 if ((*pftaudis)[thePFTau] < 0.5) {
162 product_PFTaus->emplace_back(pftau.px(), pftau.py(), pftau.pz(), pftau.energy());
167 iEvent.
put(
move(product_PFTaus),
"PFTaus");
174 auto product_Electrons = make_unique<LorentzVectorCollection>();
177 if (!iEvent.
getByToken(e_ctfTrackCollection_, pCtfTracks)) {
178 edm::LogInfo(
"") <<
"Error! Can't get " << e_ctfTrackCollectionSrc_.label() <<
" by label. ";
179 iEvent.
put(
move(product_Electrons),
"Electrons");
184 if (iEvent.
getByToken(Electrons_,electrons)) {
185 for (
size_t i=0 ;
i<electrons->size(); ++
i) {
190 double sum_of_pt_ele {};
191 for (
auto const& tr : *pCtfTracks) {
192 double const lip {
electron.gsfTrack()->dz() - tr.dz()};
193 if (tr.pt() > e_trackMinPt_ && fabs(
lip) < e_lipCut_) {
194 double dphi {fabs(tr.phi()-
electron.trackMomentumAtVtx().phi())};
195 if (dphi>acos(-1.)) {
196 dphi=2*acos(-1.)-dphi;
198 double const deta {fabs(tr.eta()-
electron.trackMomentumAtVtx().eta())};
199 double const dr_ctf_ele {
sqrt(deta*deta+dphi*dphi)};
200 if((dr_ctf_ele>e_minIsoDR_) && (dr_ctf_ele<e_maxIsoDR_)){
201 double const cft_pt_2 {tr.pt()*tr.pt()};
202 sum_of_pt_ele += cft_pt_2;
206 double const isolation_value_ele {sum_of_pt_ele/(
electron.trackMomentumAtVtx().Rho()*
electron.trackMomentumAtVtx().Rho())};
207 if (isolation_value_ele<e_isoMaxSumPt_) {
217 iEvent.
put(
move(product_Electrons),
"Electrons");
223 auto product_Muons = make_unique<LorentzVectorCollection>();
227 for (
auto const&
muon : *muons) {
228 if (
muon.pt()>ptMinMuon_ &&
muon.eta()>etaMin_&&
muon.eta()<etaMax_&&
muon.phi()>phiMin_&&
muon.phi()<phiMax_) {
233 iEvent.
put(
move(product_Muons),
"Muons");
240 auto product_Jets = make_unique<LorentzVectorCollection>();
244 for (
auto const&
jet : *jets) {
245 if (
jet.et()>ptMinJet_ &&
jet.eta()>etaMin_&&
jet.eta()<etaMax_&&
jet.phi()>phiMin_&&
jet.phi()<phiMax_) {
246 product_Jets->emplace_back(
jet.px(),
jet.py(),
jet.pz(),
jet.energy());
250 iEvent.
put(
move(product_Jets),
"Jets");
256 auto product_Towers = make_unique<LorentzVectorCollection>();
260 for (
auto const& tower1 : *towers) {
261 if (tower1.pt()>ptMinTower_ && tower1.eta()>etaMin_&&tower1.eta()<etaMax_&&tower1.phi()>phiMin_&&tower1.phi()<phiMax_) {
264 for (
auto const& tower2 : *towers) {
270 if (isolET<towerIsol_) {
271 product_Towers->emplace_back(tower1.px(),tower1.py(),tower1.pz(),tower1.energy());
276 iEvent.
put(
move(product_Towers),
"Towers");
283 auto product_Gammas = make_unique<LorentzVectorCollection>();
287 for (
auto const&
photon : *photons) {
288 if (
photon.ecalRecHitSumEtConeDR04()<photonEcalIso_ &&
294 iEvent.
put(
move(product_Gammas),
"Photons");
300 auto product_MET = make_unique<LorentzVectorCollection>();
303 if(iEvent.
getByToken(MET_,met) && !met->empty()){
304 auto const& metMom = met->front().p4();
305 product_MET->emplace_back(metMom.Px(), metMom.Py(), 0, metMom.Pt());
307 iEvent.
put(
move(product_MET),
"MET");
T getUntrackedParameter(std::string const &, T const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void produce(edm::StreamID, edm::Event &, edm::EventSetup const &) const override
void doElectrons(edm::Event &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void doMET(edm::Event &) const
HLTTauRefProducer(const edm::ParameterSet &)
void doTowers(edm::Event &) const
void doPFTaus(edm::Event &) const
void doMuons(edm::Event &) const
void doJets(edm::Event &) const
void doPhotons(edm::Event &) const