83 deltaEtaMax_ = iConfig.
getParameter<
double>(
"deltaEtaMax");
85 deltaPhiMax_ = iConfig.
getParameter<
double>(
"deltaPhiMax");
95 LogDebug(
"PFCandidateChecker") <<
" input collections : " << inputTagPFCandidatesReco_ <<
" " 96 << inputTagPFCandidatesReReco_;
104 LogDebug(
"PFCandidateChecker") <<
"START event: " <<
iEvent.id().event() <<
" in run " <<
iEvent.id().run() << endl;
109 iEvent.getByLabel(inputTagPFCandidatesReco_, pfCandidatesReco);
112 iEvent.getByLabel(inputTagPFCandidatesReReco_, pfCandidatesReReco);
115 iEvent.getByLabel(inputTagPFJetsReco_, pfJetsReco);
118 iEvent.getByLabel(inputTagPFJetsReReco_, pfJetsReReco);
124 pfReco = *pfCandidatesReco;
125 pfReReco = *pfCandidatesReReco;
126 sort(pfReco.begin(), pfReco.end(), greaterPt);
127 sort(pfReReco.begin(), pfReReco.end(), greaterPt);
130 unsigned minSize = pfReco.size() < pfReReco.size() ? pfReco.size() : pfReReco.size();
131 bool differentCand =
false;
132 bool differentSize = pfReco.size() != pfReReco.size();
134 std::cout <<
"+++WARNING+++ PFCandidate size changed for entry " << entry_ <<
" !" << endl
135 <<
" - RECO size : " << pfReco.size() << endl
136 <<
" - Re-RECO size : " << pfReReco.size() << endl;
139 for (
unsigned i = 0;
i < minSize;
i++) {
141 const reco::PFCandidate& candReReco = (rankByPt_) ? pfReReco[
i] : (*pfCandidatesReReco)[
i];
147 differentCand =
true;
148 std::cout <<
"+++WARNING+++ PFCandidate " <<
i <<
" changed for entry " << entry_ <<
" ! " << std::endl
149 <<
" - RECO : " << candReco << std::endl
150 <<
" - Re-RECO : " << candReReco << std::endl
151 <<
" DeltaE = : " <<
deltaE << std::endl
152 <<
" DeltaEta = : " <<
deltaEta << std::endl
153 <<
" DeltaPhi = : " <<
deltaPhi << std::endl
156 std::cout <<
"Elements in Block for RECO: " << std::endl;
157 printElementsInBlocks(candReco);
158 std::cout <<
"Elements in Block for Re-RECO: " << std::endl;
159 printElementsInBlocks(candReReco);
166 if (differentSize || differentCand) {
167 printJets(*pfJetsReco, *pfJetsReReco);
168 printMet(pfReco, pfReReco);
172 LogDebug(
"PFCandidateChecker") <<
"STOP event: " <<
iEvent.id().event() <<
" in run " <<
iEvent.id().run()
179 for (
unsigned i = 0;
i < pfReco.size();
i++) {
180 metX += pfReco[
i].px();
181 metY += pfReco[
i].py();
184 std::cout <<
"MET RECO = " << metX <<
" " << metY <<
" " <<
met << std::endl;
188 for (
unsigned i = 0;
i < pfReReco.size();
i++) {
189 metX += pfReReco[
i].px();
190 metY += pfReReco[
i].py();
193 std::cout <<
"MET Re-RECO = " << metX <<
" " << metY <<
" " <<
met << std::endl;
197 bool differentSize = pfJetsReco.size() != pfJetsReReco.size();
199 std::cout <<
"+++WARNING+++ PFJet size changed for entry " << entry_ <<
" !" << endl
200 <<
" - RECO size : " << pfJetsReco.size() << endl
201 <<
" - Re-RECO size : " << pfJetsReReco.size() << endl;
202 unsigned minSize = pfJetsReco.size() < pfJetsReReco.size() ? pfJetsReco.size() : pfJetsReReco.size();
204 for (
unsigned i = 0;
i < minSize; ++
i) {
207 if (candReco.
et() < 20. && candReReco.
et() < 20.)
209 double deltaE = (candReReco.
et() - candReco.
et()) / (candReReco.
et() + candReco.
et());
213 std::cout <<
"+++WARNING+++ PFJet " <<
i <<
" changed for entry " << entry_ <<
" ! " << std::endl
214 <<
" - RECO : " << candReco.
et() <<
" " << candReco.
eta() <<
" " << candReco.
phi() << std::endl
215 <<
" - Re-RECO : " << candReReco.
et() <<
" " << candReReco.
eta() <<
" " << candReReco.
phi()
217 <<
" DeltaE = : " <<
deltaE << std::endl
218 <<
" DeltaEta = : " <<
deltaEta << std::endl
219 <<
" DeltaPhi = : " <<
deltaPhi << std::endl
224 std::cout <<
"Jet " <<
i <<
" " << candReco.
et() << std::endl;
236 for (
unsigned i = 0;
i <
cand.elementsInBlocks().size();
i++) {
240 cerr <<
"ERROR! no block ref!";
247 }
else if (blockRef != firstRef) {
248 cerr <<
"WARNING! This PFCandidate is not made from a single block" << endl;
251 out <<
"\t" <<
cand.elementsInBlocks()[
i].second << endl;
void analyze(const edm::Event &, const edm::EventSetup &) override
void beginRun(const edm::Run &r, const edm::EventSetup &c) override
static bool greaterPt(const reco::PFCandidate &a, const reco::PFCandidate &b)
T getParameter(std::string const &) const
void printMet(const reco::PFCandidateCollection &pfReco, const reco::PFCandidateCollection &pfReReco) const
void printJets(const reco::PFJetCollection &pfJetsReco, const reco::PFJetCollection &pfJetsReReco) const
~PFCandidateChecker() override
void printElementsInBlocks(const reco::PFCandidate &cand, std::ostream &out=std::cout) const
double deltaEMax_
Cuts for comparison.
Jets made from PFObjects.
static const double deltaEta
T getUntrackedParameter(std::string const &, T const &) const
Checks what a re-reco changes in PFCandidates.
#define DEFINE_FWK_MODULE(type)
bool isNull() const
Checks for null.
edm::InputTag inputTagPFJetsReReco_
bool rankByPt_
rank the candidates by Pt
edm::InputTag inputTagPFJetsReco_
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
std::vector< PFJet > PFJetCollection
collection of PFJet objects
Particle reconstructed by the particle flow algorithm.
double et() const final
transverse energy
edm::InputTag inputTagPFCandidatesReco_
PFCandidates in which we'll look for pile up particles.
bool printBlocks_
print the blocks associated to a given candidate ?
PFCandidateChecker(const edm::ParameterSet &)
double phi() const final
momentum azimuthal angle
edm::InputTag inputTagPFCandidatesReReco_
double energy() const final
energy
double eta() const final
momentum pseudorapidity