9 return (cand1.delta_R(cand2) < rParam_);
16 srcVor_(iC.consumes<
edm::ValueMap<
reco::VoronoiBackground> >(iConfig.getParameter<
edm::InputTag>(
"bkg"))),
17 dropZeroTowers_(iConfig.getParameter<bool>(
"dropZeros")),
18 addNegative_(iConfig.getParameter<bool>(
"addNegative")),
19 addNegativesFromCone_(iConfig.getParameter<bool>(
"addNegativesFromCone")),
20 infinitesimalPt_(iConfig.getParameter<double>(
"infinitesimalPt")),
21 rParam_(iConfig.getParameter<double>(
"rParam"))
31 LogDebug(
"VoronoiSubtractor")<<
"The subtractor retrieving Voronoi background...\n";
44 LogDebug(
"VoronoiSubtractor")<<
"finalizing the output...\n";
48 for (
unsigned int ijet = 0;ijet <
fjJets_->size();++ijet) {
49 fastjet::PseudoJet& fjJet = (*fjJets_)[ijet];
51 LogDebug(
"VoronoiSubtractor")<<
"fjJets_ "<<ijet<<
" pt : "<<fjJet.pt()
52 <<
" --- eta : "<<fjJet.eta()<<
" --- phi : "<<fjJet.phi()<<endl;
54 fastjet::PseudoJet subtracted;
55 fastjet::PseudoJet unsubtracted;
56 fastjet::PseudoJet unsubtractedDropped;
62 std::vector<fastjet::PseudoJet> fjConstituents = fastjet::sorted_by_pt(fjJet.constituents());
63 for (
unsigned int i=0;
i<fjConstituents.size();++
i) {
64 unsigned int index = fjConstituents[
i].user_index();
69 fastjet::PseudoJet candidate(ref->px(),ref->py(),ref->pz(),ref->energy());
70 double orpt = candidate.perp();
71 unsubtracted += candidate;
74 LogDebug(
"VoronoiSubtractor")<<
"candidate "<<index
75 <<
" --- original pt : "<<orpt
76 <<
" --- voronoi pt : "<<voronoi.
pt()
77 <<
" --- ref pt : "<<ref->pt()
78 <<
" --- constituent "<<index
79 <<
" --- pt : "<<fjConstituents[
i].perp()
80 <<
" --- eta : "<<fjConstituents[
i].pseudorapidity()
81 <<
" --- phi : "<<fjConstituents[
i].phi()
82 <<
" --- mass : "<<fjConstituents[
i].m()<<endl;
83 subtracted += candidate;
92 fastjet::PseudoJet dropcand(ref->px(),ref->py(),ref->pz(),ref->energy());
94 if(
match(fjJet,dropcand)){
95 unsubtractedDropped += dropcand;
96 unsubtracted += dropcand;
101 fjJet.reset_momentum(subtracted);
103 LogDebug(
"VoronoiSubtractor")<<
"fjJets_ "<<ijet<<
" unsubtracted : "<<unsubtracted.pt()<<endl;
104 LogDebug(
"VoronoiSubtractor")<<
"fjJets_ "<<ijet<<
" subtracted : "<<subtracted.pt()<<endl;
105 LogDebug(
"VoronoiSubtractor")<<
"fjJets_ "<<ijet<<
" dropped : "<<unsubtractedDropped.pt()<<endl;
106 jetOffset_[ijet] = unsubtracted.pt() - fjJet.pt();
124 LogDebug(
"VoronoiSubtractor")<<
"The subtractor subtracting pedestals...\n";
125 vector<fastjet::PseudoJet> newcoll;
127 for (vector<fastjet::PseudoJet>::iterator input_object = coll.begin (),
128 fjInputsEnd = coll.end();
129 input_object != fjInputsEnd; ++input_object) {
134 double ptold = input_object->
pt();
135 double ptnew = voronoi.pt();
137 LogDebug(
"VoronoiSubtractor")<<
"pt old : "<<ptold<<
" ; pt new : "<<ptnew
138 <<
" E : "<<input_object->e()
139 <<
" rap : "<<input_object->rapidity()
140 <<
" phi : "<<input_object->phi()
141 <<
" MASS : "<<input_object->m()<<endl;
162 int index = input_object->user_index();
164 fastjet::PseudoJet ps(input_object->four_mom());
165 ps.reset_PtYPhiM(ptnew,input_object->rapidity(),input_object->phi(),input_object->m());
166 ps.set_user_index(index);
168 LogDebug(
"VoronoiSubtractor")<<
"New momentum : "<<ps.pt()
169 <<
" rap : "<<ps.rap()
170 <<
" phi : "<<ps.phi()
171 <<
" MASS : "<<ps.m()<<endl;
173 newcoll.push_back(ps);
180 LogDebug(
"VoronoiSubtractor")<<
"do nothing...\n";
186 LogDebug(
"VoronoiSubtractor")<<
"do nothing...\n";
std::vector< double > jetOffset_
virtual void subtractPedestal(std::vector< fastjet::PseudoJet > &coll)
virtual void offsetCorrectJets()
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< fastjet::PseudoJet > * fjJets_
bool addNegativesFromCone_
edm::EDGetTokenT< edm::ValueMap< reco::VoronoiBackground > > srcVor_
edm::Handle< reco::VoronoiMap > backgrounds_
virtual void calculateOrphanInput(std::vector< fastjet::PseudoJet > &orphanInput)
std::vector< int > droppedCandidates_
virtual void calculatePedestal(std::vector< fastjet::PseudoJet > const &coll)
bool match(fastjet::PseudoJet, fastjet::PseudoJet)
edm::EDGetTokenT< reco::CandidateView > srcCand_
virtual void setupGeometryMap(edm::Event &iEvent, const edm::EventSetup &iSetup)
double pt_subtracted() const
CaloGeometry const * geo_
edm::Handle< reco::CandidateView > candidates_
edm::View< Candidate > CandidateView
view of a collection containing candidates
VoronoiSubtractor(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)