2 #include "TLorentzVector.h" 20 #include "TLorentzVector.h" 26 #include "Math/GenVector/VectorUtil.h" 37 PFTaus_ = consumes<reco::PFTauCollection>(pfTau.getUntrackedParameter<
InputTag>(
"PFTauProducer"));
38 auto discs = pfTau.getUntrackedParameter<vector<InputTag>>(
"PFTauDiscriminators");
40 PFTauDis_.push_back(consumes<reco::PFTauDiscriminator>(
tag));
42 doPFTaus_ = pfTau.getUntrackedParameter<
bool>(
"doPFTaus",
false);
43 ptMinPFTau_= pfTau.getUntrackedParameter<
double>(
"ptMin",15.);
48 Electrons_ = consumes<reco::GsfElectronCollection>(
electrons.getUntrackedParameter<
InputTag>(
"ElectronCollection"));
49 doElectrons_ =
electrons.getUntrackedParameter<
bool>(
"doElectrons",
false);
50 e_doID_ =
electrons.getUntrackedParameter<
bool>(
"doID",
false);
52 e_idAssocProd_ = consumes<reco::ElectronIDAssociationCollection>(
electrons.getUntrackedParameter<
InputTag>(
"IdCollection"));
54 e_ctfTrackCollectionSrc_ =
electrons.getUntrackedParameter<
InputTag>(
"TrackCollection");
55 e_ctfTrackCollection_ = consumes<reco::TrackCollection>(e_ctfTrackCollectionSrc_);
56 ptMinElectron_=
electrons.getUntrackedParameter<
double>(
"ptMin",15.);
57 e_doTrackIso_ =
electrons.getUntrackedParameter<
bool>(
"doTrackIso",
false);
58 e_trackMinPt_=
electrons.getUntrackedParameter<
double>(
"ptMinTrack",1.5);
59 e_lipCut_=
electrons.getUntrackedParameter<
double>(
"lipMinTrack",1.5);
60 e_minIsoDR_=
electrons.getUntrackedParameter<
double>(
"InnerConeDR",0.02);
61 e_maxIsoDR_=
electrons.getUntrackedParameter<
double>(
"OuterConeDR",0.6);
62 e_isoMaxSumPt_=
electrons.getUntrackedParameter<
double>(
"MaxIsoVar",0.02);
67 Muons_ = consumes<reco::MuonCollection>(
muons.getUntrackedParameter<
InputTag>(
"MuonCollection"));
68 doMuons_ =
muons.getUntrackedParameter<
bool>(
"doMuons",
false);
69 ptMinMuon_=
muons.getUntrackedParameter<
double>(
"ptMin",15.);
74 Jets_ = consumes<reco::CaloJetCollection>(
jets.getUntrackedParameter<
InputTag>(
"JetCollection"));
75 doJets_ =
jets.getUntrackedParameter<
bool>(
"doJets");
76 ptMinJet_=
jets.getUntrackedParameter<
double>(
"etMin");
81 Towers_ = consumes<CaloTowerCollection>(towers.getUntrackedParameter<
InputTag>(
"TowerCollection"));
82 doTowers_ = towers.getUntrackedParameter<
bool>(
"doTowers");
83 ptMinTower_= towers.getUntrackedParameter<
double>(
"etMin");
84 towerIsol_= towers.getUntrackedParameter<
double>(
"towerIsolation");
89 Photons_ = consumes<reco::PhotonCollection>(
photons.getUntrackedParameter<
InputTag>(
"PhotonCollection"));
90 doPhotons_ =
photons.getUntrackedParameter<
bool>(
"doPhotons");
91 ptMinPhoton_=
photons.getUntrackedParameter<
double>(
"etMin");
92 photonEcalIso_=
photons.getUntrackedParameter<
double>(
"ECALIso");
97 MET_ = consumes<reco::CaloMETCollection>(
met.getUntrackedParameter<
InputTag>(
"METCollection"));
98 doMET_ =
met.getUntrackedParameter<
bool>(
"doMET",
false);
99 ptMinMET_=
met.getUntrackedParameter<
double>(
"ptMin",15.);
105 produces<LorentzVectorCollection>(
"PFTaus");
106 produces<LorentzVectorCollection>(
"Electrons");
107 produces<LorentzVectorCollection>(
"Muons");
108 produces<LorentzVectorCollection>(
"Jets");
109 produces<LorentzVectorCollection>(
"Photons");
110 produces<LorentzVectorCollection>(
"Towers");
111 produces<LorentzVectorCollection>(
"MET");
136 auto product_PFTaus = make_unique<LorentzVectorCollection>();
140 for (
unsigned int i=0;
i<pftaus->size(); ++
i) {
141 auto const& pftau = (*pftaus)[
i];
142 if (pftau.pt()>ptMinPFTau_&&fabs(pftau.eta())<etaMax_) {
148 if ((*pftaudis)[thePFTau] < 0.5) {
159 product_PFTaus->emplace_back(pftau.px(), pftau.py(), pftau.pz(), pftau.energy());
164 iEvent.
put(
move(product_PFTaus),
"PFTaus");
171 auto product_Electrons = make_unique<LorentzVectorCollection>();
176 if (!iEvent.
getByToken(e_idAssocProd_, pEleID)) {
177 edm::LogInfo(
"") <<
"Error! Can't get electronIDAssocProducer by label. ";
183 if (!iEvent.
getByToken(e_ctfTrackCollection_, pCtfTracks)) {
184 edm::LogInfo(
"") <<
"Error! Can't get " << e_ctfTrackCollectionSrc_.label() <<
" by label. ";
185 iEvent.
put(
move(product_Electrons),
"Electrons");
190 if (iEvent.
getByToken(Electrons_,electrons)) {
191 for (
size_t i=0 ;
i<electrons->size(); ++
i) {
196 tagIDAssocItr = pEleID->find(electronRef);
198 idDec=id_tag->cutBasedDecision();
206 double sum_of_pt_ele {};
207 for (
auto const& tr : *pCtfTracks) {
208 double const lip {
electron.gsfTrack()->dz() - tr.dz()};
209 if (tr.pt() > e_trackMinPt_ && fabs(
lip) < e_lipCut_) {
210 double dphi {fabs(tr.phi()-
electron.trackMomentumAtVtx().phi())};
211 if (dphi>acos(-1.)) {
212 dphi=2*acos(-1.)-dphi;
214 double const deta {fabs(tr.eta()-
electron.trackMomentumAtVtx().eta())};
215 double const dr_ctf_ele {
sqrt(deta*deta+dphi*dphi)};
216 if((dr_ctf_ele>e_minIsoDR_) && (dr_ctf_ele<e_maxIsoDR_)){
217 double const cft_pt_2 {tr.pt()*tr.pt()};
218 sum_of_pt_ele += cft_pt_2;
222 double const isolation_value_ele {sum_of_pt_ele/(
electron.trackMomentumAtVtx().Rho()*
electron.trackMomentumAtVtx().Rho())};
223 if (isolation_value_ele<e_isoMaxSumPt_) {
233 iEvent.
put(
move(product_Electrons),
"Electrons");
239 auto product_Muons = make_unique<LorentzVectorCollection>();
243 for (
auto const&
muon : *muons) {
244 if (
muon.pt()>ptMinMuon_ && fabs(
muon.eta())<etaMax_) {
249 iEvent.
put(
move(product_Muons),
"Muons");
256 auto product_Jets = make_unique<LorentzVectorCollection>();
260 for (
auto const&
jet : *jets) {
261 if (
jet.et()>ptMinJet_ && fabs(
jet.eta())<etaMax_) {
262 product_Jets->emplace_back(
jet.px(),
jet.py(),
jet.pz(),
jet.energy());
266 iEvent.
put(
move(product_Jets),
"Jets");
272 auto product_Towers = make_unique<LorentzVectorCollection>();
276 for (
auto const& tower1 : *towers) {
277 if (tower1.pt()>ptMinTower_ && fabs(tower1.eta())<etaMax_) {
280 for (
auto const& tower2 : *towers) {
286 if (isolET<towerIsol_) {
287 product_Towers->emplace_back(tower1.px(),tower1.py(),tower1.pz(),tower1.energy());
292 iEvent.
put(
move(product_Towers),
"Towers");
299 auto product_Gammas = make_unique<LorentzVectorCollection>();
303 for (
auto const&
photon : *photons) {
304 if (
photon.ecalRecHitSumEtConeDR04()<photonEcalIso_ &&
305 photon.et()>ptMinPhoton_ && fabs(
photon.eta())<etaMax_) {
310 iEvent.
put(
move(product_Gammas),
"Photons");
316 auto product_MET = make_unique<LorentzVectorCollection>();
319 if(iEvent.
getByToken(MET_,met) && !met->empty()){
320 auto const& metMom = met->front().p4();
321 product_MET->emplace_back(metMom.Px(), metMom.Py(), 0, metMom.Pt());
323 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
friend struct const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void doMET(edm::Event &) const
const std::string id_tag("id")
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