37 #include <boost/foreach.hpp>
73 produces<reco::PFJetCollection>();
74 produces<JetToPFCandidateAssociation>(
"pfCandAssocMapForIsolation");
75 produces<JetToPFCandidateAssociation>(
"pfCandAssocMapForIsoDepositVetos");
84 double chargedHadronEnergy = 0.;
85 double neutralHadronEnergy = 0.;
86 double chargedEmEnergy = 0.;
87 double neutralEmEnergy = 0.;
88 double chargedMuEnergy = 0.;
89 int chargedMultiplicity = 0;
90 int neutralMultiplicity = 0;
92 for ( reco::Jet::Constituents::const_iterator jetConstituent = jetConstituents.begin();
93 jetConstituent != jetConstituents.end(); ++jetConstituent ) {
98 chargedHadronEnergy += pfCandidate->
energy();
99 ++chargedMultiplicity;
102 chargedEmEnergy += pfCandidate->
energy();
103 ++chargedMultiplicity;
106 chargedMuEnergy += pfCandidate->
energy();
107 ++chargedMultiplicity;
112 neutralEmEnergy += pfCandidate->
energy();
113 ++neutralMultiplicity;
117 neutralHadronEnergy += pfCandidate->
energy();
118 ++neutralMultiplicity;
122 <<
"PFCandidate: Pt = " << pfCandidate->
pt() <<
", eta = " << pfCandidate->
eta() <<
", phi = " << pfCandidate->
phi()
123 <<
" has invalid particleID = " << pfCandidate->
particleId() <<
" !!" << std::endl;
128 <<
"Jet constituent: Pt = " << pfCandidate->
pt() <<
", eta = " << pfCandidate->
eta() <<
", phi = " << pfCandidate->
phi()
129 <<
" is not of type PFCandidate !!" << std::endl;
151 for ( reco::Jet::Constituents::const_iterator jetConstituent = jetConstituents.begin();
152 jetConstituent != jetConstituents.end(); ++jetConstituent ) {
155 getJetConstituents(*subjet, jet_and_subjetConstituents);
157 jet_and_subjetConstituents.push_back(*jetConstituent);
164 std::vector<reco::PFCandidateRef> pfCandidates_exclJetConstituents;
165 size_t numPFCandidates = pfCandidates->size();
166 for (
size_t pfCandidateIdx = 0; pfCandidateIdx < numPFCandidates; ++pfCandidateIdx ) {
168 bool isJetConstituent =
false;
169 for ( reco::Jet::Constituents::const_iterator jetConstituent = jetConstituents.begin();
170 jetConstituent != jetConstituents.end(); ++jetConstituent ) {
171 double dR =
deltaR(pfCandidate->
p4(), (*jetConstituent)->p4());
172 if ( dR < dRmatch ) {
173 isJetConstituent =
true;
177 if ( !(isJetConstituent^invert) ) {
178 pfCandidates_exclJetConstituents.push_back(pfCandidate);
181 return pfCandidates_exclJetConstituents;
186 std::cout <<
"#" << label <<
" = " << jetConstituents.size() <<
":" << std::endl;
188 for ( reco::Jet::Constituents::const_iterator jetConstituent = jetConstituents.begin();
189 jetConstituent != jetConstituents.end(); ++jetConstituent ) {
190 std::cout <<
" jetConstituent #" << idx <<
": Pt = " << (*jetConstituent)->pt() <<
", eta = " << (*jetConstituent)->eta() <<
", phi = " << (*jetConstituent)->phi() << std::endl;
199 std::cout <<
"<BoostedTauSeedsProducer::produce (moduleLabel = " <<
moduleLabel_ <<
")>:" << std::endl;
205 std::cout <<
"#subjets = " << subjets->size() << std::endl;
207 assert((subjets->size() % 2) == 0);
212 std::cout <<
"#pfCandidates = " << pfCandidates->size() << std::endl;
219 std::auto_ptr<JetToPFCandidateAssociation> selectedSubjetPFCandidateAssociationForIsoDepositVetos(
new JetToPFCandidateAssociation());
221 for (
size_t idx = 0; idx < (subjets->size() / 2); ++
idx ) {
222 const reco::Jet* subjet1 = &subjets->at(2*idx);
223 const reco::Jet* subjet2 = &subjets->at(2*idx + 1);
224 assert(subjet1 && subjet2);
226 std::cout <<
"processing jet #" << idx <<
":" << std::endl;
227 std::cout <<
" subjet1: Pt = " << subjet1->
pt() <<
", eta = " << subjet1->
eta() <<
", phi = " << subjet1->
phi() <<
", mass = " << subjet1->
mass()
228 <<
" (#constituents = " << subjet1->
nConstituents() <<
", area = " << subjet1->
jetArea() <<
")" << std::endl;
229 std::cout <<
" subjet2: Pt = " << subjet2->
pt() <<
", eta = " << subjet2->
eta() <<
", phi = " << subjet2->
phi() <<
", mass = " << subjet2->
mass()
230 <<
" (#constituents = " << subjet2->
nConstituents() <<
", area = " << subjet2->
jetArea() <<
")" << std::endl;
238 getJetConstituents(*subjet1, subjetConstituents1);
240 getJetConstituents(*subjet2, subjetConstituents2);
242 printJetConstituents(
"subjetConstituents1", subjetConstituents1);
243 printJetConstituents(
"subjetConstituents2", subjetConstituents2);
246 selectedSubjets->push_back(convertToPFJet(*subjet1, subjetConstituents1));
248 selectedSubjets->push_back(convertToPFJet(*subjet2, subjetConstituents2));
252 std::vector<reco::PFCandidateRef> pfCandidatesNotInSubjet1 = getPFCandidates_exclJetConstituents(pfCandidates, subjetConstituents2, 1.
e-4,
false);
253 std::vector<reco::PFCandidateRef> pfCandidatesNotInSubjet2 = getPFCandidates_exclJetConstituents(pfCandidates, subjetConstituents1, 1.
e-4,
false);
255 std::cout <<
"#pfCandidatesNotInSubjet1 = " << pfCandidatesNotInSubjet1.size() << std::endl;
256 std::cout <<
"#pfCandidatesNotInSubjet2 = " << pfCandidatesNotInSubjet2.size() << std::endl;
262 selectedSubjetPFCandidateAssociationForIsolation->insert(subjetRef1, pfCandidate);
265 selectedSubjetPFCandidateAssociationForIsolation->insert(subjetRef2, pfCandidate);
269 std::vector<reco::PFCandidateRef> pfCandidatesInSubjet1 = getPFCandidates_exclJetConstituents(pfCandidates, subjetConstituents2, 1.
e-4,
true);
270 std::vector<reco::PFCandidateRef> pfCandidatesInSubjet2 = getPFCandidates_exclJetConstituents(pfCandidates, subjetConstituents1, 1.
e-4,
true);
272 std::cout <<
"#pfCandidatesInSubjet1 = " << pfCandidatesInSubjet1.size() << std::endl;
273 std::cout <<
"#pfCandidatesInSubjet2 = " << pfCandidatesInSubjet2.size() << std::endl;
277 selectedSubjetPFCandidateAssociationForIsoDepositVetos->insert(subjetRef1, pfCandidate);
280 selectedSubjetPFCandidateAssociationForIsoDepositVetos->insert(subjetRef2, pfCandidate);
284 evt.
put(selectedSubjets);
285 evt.
put(selectedSubjetPFCandidateAssociationForIsolation,
"pfCandAssocMapForIsolation");
286 evt.
put(selectedSubjetPFCandidateAssociationForIsoDepositVetos,
"pfCandAssocMapForIsoDepositVetos");
T getParameter(std::string const &) const
virtual float pt() const
transverse momentum
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual const Point & vertex() const
vertex position (overwritten by PF...)
#define DEFINE_FWK_MODULE(type)
virtual float phi() const
momentum azimuthal angle
Base class for all types of Jets.
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::vector< Constituent > Constituents
float mNeutralHadronEnergy
virtual Constituents getJetConstituents() const
list of constituents
Jets made from PFObjects.
float mChargedHadronEnergy
BoostedTauSeedsProducer(const edm::ParameterSet &)
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
virtual double energy() const
energy
virtual void produce(edm::Event &, const edm::EventSetup &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
virtual float eta() const
momentum pseudorapidity
edm::View< reco::Jet > JetView
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidates_
RefProd< PROD > getRefBeforePut()
double deltaR(double eta1, double eta2, double phi1, double phi2)
edm::AssociationMap< edm::OneToMany< std::vector< reco::PFJet >, std::vector< reco::PFCandidate >, unsigned int > > JetToPFCandidateAssociation
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
std::vector< PFJet > PFJetCollection
collection of PFJet objects
Particle reconstructed by the particle flow algorithm.
virtual float jetArea() const
get jet area
virtual int nConstituents() const
of constituents
edm::EDGetTokenT< JetView > srcSubjets_
virtual float mass() const
mass
virtual ParticleType particleId() const
~BoostedTauSeedsProducer()
virtual const LorentzVector & p4() const
four-momentum Lorentz vector