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.);
44 etaMinPFTau_= pfTau.getUntrackedParameter<
double>(
"etaMin",-2.5);
45 etaMaxPFTau_= pfTau.getUntrackedParameter<
double>(
"etaMax",2.5);
46 phiMinPFTau_= pfTau.getUntrackedParameter<
double>(
"phiMin",-3.15);
47 phiMaxPFTau_= pfTau.getUntrackedParameter<
double>(
"phiMax",3.15);
52 Electrons_ = consumes<reco::GsfElectronCollection>(
electrons.getUntrackedParameter<
InputTag>(
"ElectronCollection"));
53 doElectrons_ =
electrons.getUntrackedParameter<
bool>(
"doElectrons",
false);
54 e_doID_ =
electrons.getUntrackedParameter<
bool>(
"doID",
false);
56 e_idAssocProd_ = consumes<reco::ElectronIDAssociationCollection>(
electrons.getUntrackedParameter<
InputTag>(
"IdCollection"));
58 e_ctfTrackCollectionSrc_ =
electrons.getUntrackedParameter<
InputTag>(
"TrackCollection");
59 e_ctfTrackCollection_ = consumes<reco::TrackCollection>(e_ctfTrackCollectionSrc_);
60 ptMinElectron_=
electrons.getUntrackedParameter<
double>(
"ptMin",15.);
61 e_doTrackIso_ =
electrons.getUntrackedParameter<
bool>(
"doTrackIso",
false);
62 e_trackMinPt_=
electrons.getUntrackedParameter<
double>(
"ptMinTrack",1.5);
63 e_lipCut_=
electrons.getUntrackedParameter<
double>(
"lipMinTrack",1.5);
64 e_minIsoDR_=
electrons.getUntrackedParameter<
double>(
"InnerConeDR",0.02);
65 e_maxIsoDR_=
electrons.getUntrackedParameter<
double>(
"OuterConeDR",0.6);
66 e_isoMaxSumPt_=
electrons.getUntrackedParameter<
double>(
"MaxIsoVar",0.02);
71 Muons_ = consumes<reco::MuonCollection>(
muons.getUntrackedParameter<
InputTag>(
"MuonCollection"));
72 doMuons_ =
muons.getUntrackedParameter<
bool>(
"doMuons",
false);
73 ptMinMuon_=
muons.getUntrackedParameter<
double>(
"ptMin",15.);
78 Jets_ = consumes<reco::CaloJetCollection>(
jets.getUntrackedParameter<
InputTag>(
"JetCollection"));
79 doJets_ =
jets.getUntrackedParameter<
bool>(
"doJets");
80 ptMinJet_=
jets.getUntrackedParameter<
double>(
"etMin");
85 Towers_ = consumes<CaloTowerCollection>(towers.getUntrackedParameter<
InputTag>(
"TowerCollection"));
86 doTowers_ = towers.getUntrackedParameter<
bool>(
"doTowers");
87 ptMinTower_= towers.getUntrackedParameter<
double>(
"etMin");
88 towerIsol_= towers.getUntrackedParameter<
double>(
"towerIsolation");
93 Photons_ = consumes<reco::PhotonCollection>(
photons.getUntrackedParameter<
InputTag>(
"PhotonCollection"));
94 doPhotons_ =
photons.getUntrackedParameter<
bool>(
"doPhotons");
95 ptMinPhoton_=
photons.getUntrackedParameter<
double>(
"etMin");
96 photonEcalIso_=
photons.getUntrackedParameter<
double>(
"ECALIso");
101 MET_ = consumes<reco::CaloMETCollection>(
met.getUntrackedParameter<
InputTag>(
"METCollection"));
102 doMET_ =
met.getUntrackedParameter<
bool>(
"doMET",
false);
103 ptMinMET_=
met.getUntrackedParameter<
double>(
"ptMin",15.);
112 produces<LorentzVectorCollection>(
"PFTaus");
113 produces<LorentzVectorCollection>(
"Electrons");
114 produces<LorentzVectorCollection>(
"Muons");
115 produces<LorentzVectorCollection>(
"Jets");
116 produces<LorentzVectorCollection>(
"Photons");
117 produces<LorentzVectorCollection>(
"Towers");
118 produces<LorentzVectorCollection>(
"MET");
143 auto product_PFTaus = make_unique<LorentzVectorCollection>();
147 for (
unsigned int i=0;
i<pftaus->size(); ++
i) {
148 auto const& pftau = (*pftaus)[
i];
149 if (pftau.pt()>ptMinPFTau_&&
150 pftau.eta()>etaMinPFTau_&&pftau.eta()<etaMaxPFTau_&&
151 pftau.phi()>phiMinPFTau_&&pftau.phi()<phiMaxPFTau_) {
157 if ((*pftaudis)[thePFTau] < 0.5) {
168 product_PFTaus->emplace_back(pftau.px(), pftau.py(), pftau.pz(), pftau.energy());
173 iEvent.
put(
move(product_PFTaus),
"PFTaus");
180 auto product_Electrons = make_unique<LorentzVectorCollection>();
185 if (!iEvent.
getByToken(e_idAssocProd_, pEleID)) {
186 edm::LogInfo(
"") <<
"Error! Can't get electronIDAssocProducer by label. ";
192 if (!iEvent.
getByToken(e_ctfTrackCollection_, pCtfTracks)) {
193 edm::LogInfo(
"") <<
"Error! Can't get " << e_ctfTrackCollectionSrc_.label() <<
" by label. ";
194 iEvent.
put(
move(product_Electrons),
"Electrons");
199 if (iEvent.
getByToken(Electrons_,electrons)) {
200 for (
size_t i=0 ;
i<electrons->size(); ++
i) {
205 tagIDAssocItr = pEleID->find(electronRef);
207 idDec=id_tag->cutBasedDecision();
215 double sum_of_pt_ele {};
216 for (
auto const& tr : *pCtfTracks) {
217 double const lip {
electron.gsfTrack()->dz() - tr.dz()};
218 if (tr.pt() > e_trackMinPt_ && fabs(
lip) < e_lipCut_) {
219 double dphi {fabs(tr.phi()-
electron.trackMomentumAtVtx().phi())};
220 if (dphi>acos(-1.)) {
221 dphi=2*acos(-1.)-dphi;
223 double const deta {fabs(tr.eta()-
electron.trackMomentumAtVtx().eta())};
224 double const dr_ctf_ele {
sqrt(deta*deta+dphi*dphi)};
225 if((dr_ctf_ele>e_minIsoDR_) && (dr_ctf_ele<e_maxIsoDR_)){
226 double const cft_pt_2 {tr.pt()*tr.pt()};
227 sum_of_pt_ele += cft_pt_2;
231 double const isolation_value_ele {sum_of_pt_ele/(
electron.trackMomentumAtVtx().Rho()*
electron.trackMomentumAtVtx().Rho())};
232 if (isolation_value_ele<e_isoMaxSumPt_) {
242 iEvent.
put(
move(product_Electrons),
"Electrons");
248 auto product_Muons = make_unique<LorentzVectorCollection>();
252 for (
auto const&
muon : *muons) {
253 if (
muon.pt()>ptMinMuon_ &&
muon.eta()>etaMin_&&
muon.eta()<etaMax_&&
muon.phi()>phiMin_&&
muon.phi()<phiMax_) {
258 iEvent.
put(
move(product_Muons),
"Muons");
265 auto product_Jets = make_unique<LorentzVectorCollection>();
269 for (
auto const&
jet : *jets) {
270 if (
jet.et()>ptMinJet_ &&
jet.eta()>etaMin_&&
jet.eta()<etaMax_&&
jet.phi()>phiMin_&&
jet.phi()<phiMax_) {
271 product_Jets->emplace_back(
jet.px(),
jet.py(),
jet.pz(),
jet.energy());
275 iEvent.
put(
move(product_Jets),
"Jets");
281 auto product_Towers = make_unique<LorentzVectorCollection>();
285 for (
auto const& tower1 : *towers) {
286 if (tower1.pt()>ptMinTower_ && tower1.eta()>etaMin_&&tower1.eta()<etaMax_&&tower1.phi()>phiMin_&&tower1.phi()<phiMax_) {
289 for (
auto const& tower2 : *towers) {
295 if (isolET<towerIsol_) {
296 product_Towers->emplace_back(tower1.px(),tower1.py(),tower1.pz(),tower1.energy());
301 iEvent.
put(
move(product_Towers),
"Towers");
308 auto product_Gammas = make_unique<LorentzVectorCollection>();
312 for (
auto const&
photon : *photons) {
313 if (
photon.ecalRecHitSumEtConeDR04()<photonEcalIso_ &&
319 iEvent.
put(
move(product_Gammas),
"Photons");
325 auto product_MET = make_unique<LorentzVectorCollection>();
328 if(iEvent.
getByToken(MET_,met) && !met->empty()){
329 auto const& metMom = met->front().p4();
330 product_MET->emplace_back(metMom.Px(), metMom.Py(), 0, metMom.Pt());
332 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