69 inputTokenPFCandidatesReco_ =
72 inputTokenPFCandidatesReReco_ =
75 inputTokenPFJetsReco_ = consumes<reco::PFJetCollection>(iConfig.
getParameter<
InputTag>(
"pfJetsReco"));
77 inputTokenPFJetsReReco_ = consumes<reco::PFJetCollection>(iConfig.
getParameter<
InputTag>(
"pfJetsReReco"));
81 deltaEtaMax_ = iConfig.
getParameter<
double>(
"deltaEtaMax");
83 deltaPhiMax_ = iConfig.
getParameter<
double>(
"deltaPhiMax");
98 LogDebug(
"PFCandidateChecker") <<
"START event: " <<
iEvent.id().event() <<
" in run " <<
iEvent.id().run() << endl;
102 const auto& pfCandidatesReco =
iEvent.getHandle(inputTokenPFCandidatesReco_);
103 const auto& pfCandidatesReReco =
iEvent.getHandle(inputTokenPFCandidatesReReco_);
104 const auto& pfJetsReco =
iEvent.getHandle(inputTokenPFJetsReco_);
105 const auto& pfJetsReReco =
iEvent.getHandle(inputTokenPFJetsReReco_);
111 pfReco = *pfCandidatesReco;
112 pfReReco = *pfCandidatesReReco;
113 sort(pfReco.begin(), pfReco.end(), greaterPt);
114 sort(pfReReco.begin(), pfReReco.end(), greaterPt);
117 unsigned minSize = pfReco.size() < pfReReco.size() ? pfReco.size() : pfReReco.size();
118 bool differentCand =
false;
119 bool differentSize = pfReco.size() != pfReReco.size();
121 std::cout <<
"+++WARNING+++ PFCandidate size changed for entry " << entry_ <<
" !" << endl
122 <<
" - RECO size : " << pfReco.size() << endl
123 <<
" - Re-RECO size : " << pfReReco.size() << endl;
126 for (
unsigned i = 0;
i < minSize;
i++) {
128 const reco::PFCandidate& candReReco = (rankByPt_) ? pfReReco[
i] : (*pfCandidatesReReco)[
i];
134 differentCand =
true;
135 std::cout <<
"+++WARNING+++ PFCandidate " <<
i <<
" changed for entry " << entry_ <<
" ! " << std::endl
136 <<
" - RECO : " << candReco << std::endl
137 <<
" - Re-RECO : " << candReReco << std::endl
138 <<
" DeltaE = : " <<
deltaE << std::endl
139 <<
" DeltaEta = : " <<
deltaEta << std::endl
140 <<
" DeltaPhi = : " <<
deltaPhi << std::endl
143 std::cout <<
"Elements in Block for RECO: " << std::endl;
144 printElementsInBlocks(candReco);
145 std::cout <<
"Elements in Block for Re-RECO: " << std::endl;
146 printElementsInBlocks(candReReco);
153 if (differentSize || differentCand) {
154 printJets(*pfJetsReco, *pfJetsReReco);
155 printMet(pfReco, pfReReco);
159 LogDebug(
"PFCandidateChecker") <<
"STOP event: " <<
iEvent.id().event() <<
" in run " <<
iEvent.id().run()
166 for (
unsigned i = 0;
i < pfReco.size();
i++) {
167 metX += pfReco[
i].px();
168 metY += pfReco[
i].py();
171 std::cout <<
"MET RECO = " << metX <<
" " << metY <<
" " <<
met << std::endl;
175 for (
unsigned i = 0;
i < pfReReco.size();
i++) {
176 metX += pfReReco[
i].px();
177 metY += pfReReco[
i].py();
180 std::cout <<
"MET Re-RECO = " << metX <<
" " << metY <<
" " <<
met << std::endl;
184 bool differentSize = pfJetsReco.size() != pfJetsReReco.size();
186 std::cout <<
"+++WARNING+++ PFJet size changed for entry " << entry_ <<
" !" << endl
187 <<
" - RECO size : " << pfJetsReco.size() << endl
188 <<
" - Re-RECO size : " << pfJetsReReco.size() << endl;
189 unsigned minSize = pfJetsReco.size() < pfJetsReReco.size() ? pfJetsReco.size() : pfJetsReReco.size();
191 for (
unsigned i = 0;
i < minSize; ++
i) {
194 if (candReco.
et() < 20. && candReReco.
et() < 20.)
196 double deltaE = (candReReco.
et() - candReco.
et()) / (candReReco.
et() + candReco.
et());
200 std::cout <<
"+++WARNING+++ PFJet " <<
i <<
" changed for entry " << entry_ <<
" ! " << std::endl
201 <<
" - RECO : " << candReco.
et() <<
" " << candReco.
eta() <<
" " << candReco.
phi() << std::endl
202 <<
" - Re-RECO : " << candReReco.
et() <<
" " << candReReco.
eta() <<
" " << candReReco.
phi()
204 <<
" DeltaE = : " <<
deltaE << std::endl
205 <<
" DeltaEta = : " <<
deltaEta << std::endl
206 <<
" DeltaPhi = : " <<
deltaPhi << std::endl
211 std::cout <<
"Jet " <<
i <<
" " << candReco.
et() << std::endl;
223 for (
unsigned i = 0;
i <
cand.elementsInBlocks().size();
i++) {
227 cerr <<
"ERROR! no block ref!";
234 }
else if (blockRef != firstRef) {
235 cerr <<
"WARNING! This PFCandidate is not made from a single block" << endl;
238 out <<
"\t" <<
cand.elementsInBlocks()[
i].second << endl;
void analyze(const edm::Event &, const edm::EventSetup &) 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
edm::EDGetTokenT< reco::PFCandidateCollection > inputTokenPFCandidatesReReco_
edm::EDGetTokenT< reco::PFCandidateCollection > inputTokenPFCandidatesReco_
PFCandidates in which we'll look for pile up particles.
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.
edm::EDGetTokenT< reco::PFJetCollection > inputTokenPFJetsReco_
#define DEFINE_FWK_MODULE(type)
bool isNull() const
Checks for null.
bool rankByPt_
rank the candidates by Pt
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
bool printBlocks_
print the blocks associated to a given candidate ?
PFCandidateChecker(const edm::ParameterSet &)
double phi() const final
momentum azimuthal angle
edm::EDGetTokenT< reco::PFJetCollection > inputTokenPFJetsReReco_
double energy() const final
energy
double eta() const final
momentum pseudorapidity