@@ -78,7 +78,7 @@ class PFAnalyzer : public DQMEDAnalyzer {
7878 // A map between an observable name and a function that obtains that observable from a PFCandidate.
7979 // This allows us to construct more complicated observables easily, and have it more configurable
8080 // in the config file.
81- std::map<std::string, std::function<double (const reco::PFCandidate, const pat::PackedCandidate, const reco::CandidatePtr, bool )>> m_funcMap;
81+ std::map<std::string, std::function<double (const reco::PFCandidate, const pat::PackedCandidate, const reco::CandidatePtr, int )>> m_funcMap;
8282 // std::map<std::string, std::function<double(const reco::PFCandidateCollection, reco::PFCandidate::ParticleType pfType)>>
8383 std::map<std::string, std::function<double (const std::vector<reco::PFCandidate>, reco::PFCandidate::ParticleType pfType)>>
8484 m_eventFuncMap;
@@ -120,7 +120,6 @@ class PFAnalyzer : public DQMEDAnalyzer {
120120 return pfCand.pt () / jet.pt ();
121121 }
122122
123- // static double getNPFC(const reco::PFCandidateCollection pfCands, reco::PFCandidate::ParticleType pfType) {
124123 static double getNPFC (const std::vector<reco::PFCandidate> pfCands, reco::PFCandidate::ParticleType pfType) {
125124 int nPF = 0 ;
126125 for (auto pfCand : pfCands) {
@@ -144,7 +143,6 @@ class PFAnalyzer : public DQMEDAnalyzer {
144143 return nPF;
145144 }
146145
147- // static double getMaxPt(const reco::PFCandidateCollection pfCands, reco::PFCandidate::ParticleType pfType) {
148146 static double getMaxPt (const std::vector<reco::PFCandidate> pfCands, reco::PFCandidate::ParticleType pfType) {
149147 double maxPt = 0 ;
150148 for (auto pfCand : pfCands) {
@@ -170,20 +168,36 @@ class PFAnalyzer : public DQMEDAnalyzer {
170168
171169
172170 // Various functions designed to get information from a PF canddidate
173- static double getPt (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { if (partType) {return packedPart.pt ();} return pfCand.pt (); }
174- static double getEnergy (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { if (partType) {return packedPart.energy ();} return pfCand.energy (); }
175- static double getEta (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { if (partType) {return packedPart.eta ();}return pfCand.eta (); }
176- static double getAbsEta (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { if (partType) {return std::abs (packedPart.eta ());}return std::abs (pfCand.eta ()); }
177- static double getPhi (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { if (partType) {return packedPart.phi ();}return pfCand.phi (); }
171+ static double getPt (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) {
172+ if (partType==1 ) {return packedPart.pt ();}
173+ if (partType==2 ) {return cand->pt (); }
174+ return pfCand.pt ();
175+ }
176+ static double getEnergy (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { if (partType==1 ) {return packedPart.energy ();} return pfCand.energy (); }
177+ static double getEta (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) {
178+ if (partType==1 ) { return packedPart.eta ();}
179+ if (partType==2 ) { return cand->eta (); }
180+ return pfCand.eta ();
181+ }
182+ static double getAbsEta (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) {
183+ if (partType==1 ) {return std::abs (packedPart.eta ());}
184+ if (partType==2 ) { return std::abs (cand->eta ()); }
185+ return std::abs (pfCand.eta ());
186+ }
187+ static double getPhi (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) {
188+ if (partType==1 ) {return packedPart.phi ();}
189+ if (partType==2 ) { return cand->phi (); }
190+ return pfCand.phi ();
191+ }
178192
179193 static double getHadCalibration (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) {
180194 if (pfCand.rawHcalEnergy () == 0 )
181195 return -1 ;
182196 return pfCand.hcalEnergy () / pfCand.rawHcalEnergy ();
183197 }
184- static double getPuppiWeight (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { if (partType){return packedPart.puppiWeight ();} return 1 ; }
198+ static double getPuppiWeight (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { if (partType== 1 ){return packedPart.puppiWeight ();} return 1 ; }
185199
186- static double getTime (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { if (partType){return packedPart.time ();} return pfCand.time (); }
200+ static double getTime (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { if (partType== 1 ){return packedPart.time ();} return pfCand.time (); }
187201
188202 static double getHcalEnergy_depth1 (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { return pfCand.hcalDepthEnergyFraction (1 ); }
189203 static double getHcalEnergy_depth2 (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { return pfCand.hcalDepthEnergyFraction (2 ); }
@@ -193,10 +207,10 @@ class PFAnalyzer : public DQMEDAnalyzer {
193207 static double getHcalEnergy_depth6 (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { return pfCand.hcalDepthEnergyFraction (6 ); }
194208 static double getHcalEnergy_depth7 (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { return pfCand.hcalDepthEnergyFraction (7 ); }
195209
196- static double getEcalEnergy (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { if (partType){ return (1.0 -packedPart.hcalFraction ())*packedPart.energy ();} return pfCand.ecalEnergy (); }
197- static double getRawEcalEnergy (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { if (partType){ return (1.0 -packedPart.rawHcalFraction ())*packedPart.energy ();}return pfCand.rawEcalEnergy (); }
198- static double getHcalEnergy (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { if (partType){return packedPart.hcalFraction ()*packedPart.energy ();}return pfCand.hcalEnergy (); }
199- static double getRawHcalEnergy (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { if (partType){ return packedPart.rawHcalFraction ()*packedPart.energy ();}return pfCand.rawHcalEnergy (); }
210+ static double getEcalEnergy (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { if (partType== 1 ){ return (1.0 -packedPart.hcalFraction ())*packedPart.energy ();} return pfCand.ecalEnergy (); }
211+ static double getRawEcalEnergy (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { if (partType== 1 ){ return (1.0 -packedPart.rawHcalFraction ())*packedPart.energy ();}return pfCand.rawEcalEnergy (); }
212+ static double getHcalEnergy (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { if (partType== 1 ){return packedPart.hcalFraction ()*packedPart.energy ();}return pfCand.hcalEnergy (); }
213+ static double getRawHcalEnergy (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { if (partType== 1 ){ return packedPart.rawHcalFraction ()*packedPart.energy ();}return pfCand.rawHcalEnergy (); }
200214 static double getHOEnergy (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { if (partType){return 0 ;} return pfCand.hoEnergy (); }
201215 static double getRawHOEnergy (const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { if (partType){return 0 ;} return pfCand.rawHoEnergy (); }
202216
@@ -244,8 +258,6 @@ class PFAnalyzer : public DQMEDAnalyzer {
244258 }
245259 }
246260 }
247-
248- std::cout << energy << " \t " << pfCand.pS1Energy () << std::endl;
249261 }
250262 return pfCand.pS1Energy ()+pfCand.pS2Energy ();}
251263
@@ -364,7 +376,6 @@ class PFAnalyzer : public DQMEDAnalyzer {
364376 // Get cluster and hits
365377 reco::PFClusterRef clusterref = elements[iEle].clusterRef ();
366378 reco::PFCluster cluster = *clusterref;
367- // std::vector<std::pair<DetId, float>> hitsAndFracs = cluster.hitsAndFractions();
368379 energy += cluster.energy ();
369380 }
370381 }
@@ -454,17 +465,6 @@ class PFAnalyzer : public DQMEDAnalyzer {
454465 }
455466
456467
457- static bool passesEventSelection (const std::vector<reco::Jet>& pfJets) {
458- if (pfJets.size () < 2 )
459- return false ;
460- if (pfJets[0 ].pt () < 450 )
461- return false ;
462- if (pfJets[0 ].pt () / pfJets[1 ].pt () > 2 )
463- return false ;
464-
465- return true ;
466- }
467-
468468 static bool passesNoCutSelection (const std::vector<reco::Jet>& pfJets) {
469469 return true ;
470470 }
@@ -494,7 +494,6 @@ class PFAnalyzer : public DQMEDAnalyzer {
494494 bool m_isMiniAOD;
495495
496496 edm::EDGetTokenT<reco::PFCandidateCollection> thePfCandidateCollection_;
497- // edm::EDGetTokenT<pat::PFParticleCollection> patPfCandidateCollection_;
498497 edm::EDGetTokenT<pat::PackedCandidateCollection> patPfCandidateCollection_;
499498
500499 edm::EDGetTokenT<reco::PFJetCollection> pfJetsToken_;
0 commit comments