CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions
PatBasicFWLiteJetAnalyzer_Selector.cc File Reference
#include "TFile.h"
#include "TH1.h"
#include "TH2.h"
#include "TCanvas.h"
#include "TLegend.h"
#include "TSystem.h"
#include "TLorentzVector.h"
#include "PhysicsTools/SelectorUtils/interface/strbitset.h"
#include "DataFormats/PatCandidates/interface/Jet.h"
#include "DataFormats/PatCandidates/interface/MET.h"
#include "DataFormats/PatCandidates/interface/Photon.h"
#include "DataFormats/PatCandidates/interface/Muon.h"
#include "DataFormats/PatCandidates/interface/Electron.h"
#include "DataFormats/PatCandidates/interface/Tau.h"
#include "PhysicsTools/SelectorUtils/interface/Selector.h"
#include "PhysicsTools/SelectorUtils/interface/JetIDSelectionFunctor.h"
#include "PhysicsTools/SelectorUtils/interface/PFJetIDSelectionFunctor.h"
#include "PhysicsTools/SelectorUtils/interface/RunLumiSelector.h"
#include "FWCore/FWLite/interface/AutoLibraryLoader.h"
#include "PhysicsTools/FWLite/interface/TFileService.h"
#include "DataFormats/FWLite/interface/ChainEvent.h"
#include "FWCore/PythonParameterSet/interface/PythonProcessDesc.h"
#include "FWCore/ParameterSet/interface/ProcessDesc.h"
#include <iostream>
#include <cmath>
#include "FWCore/Utilities/interface/InputTag.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/Common/interface/Ptr.h"
#include "PhysicsTools/SelectorUtils/interface/EventSelector.h"
#include "TROOT.h"

Go to the source code of this file.

Classes

class  JetIDStudiesSelector
 

Functions

int main (int argc, char *argv[])
 

Function Documentation

int main ( int  argc,
char *  argv[] 
)

CALO JETS


PF JETS

Definition at line 232 of file PatBasicFWLiteJetAnalyzer_Selector.cc.

References JetIDStudiesSelector::allCaloJets(), JetIDStudiesSelector::allPFJets(), pat::Jet::associatedTracks(), fwlite::ChainEvent::atEnd(), b, edm::RefVector< C, T, F >::begin(), JetIDStudiesSelector::caloDeltaPhi(), JetIDStudiesSelector::caloJet0(), JetIDStudiesSelector::caloJet1(), JetIDStudiesSelector::caloJetID(), JetIDStudiesSelector::caloKin(), pat::Jet::chargedEmEnergyFraction(), pat::Jet::chargedHadronEnergyFraction(), gather_cfg::cout, PatBasicFWLiteJetAnalyzer_Selector_cfg::doTracks, reco::GenJet::emEnergy(), pat::Jet::emEnergyFraction(), AutoLibraryLoader::enable(), edm::RefVector< C, T, F >::end(), reco::LeafCandidate::energy(), reco::LeafCandidate::eta(), event(), edm::false, reco::JetID::fHPD, pat::Jet::genJet(), edm::ParameterSet::getParameter(), reco::GenJet::hadEnergy(), SiPixelRawToDigiRegional_cfi::inputs, pat::Jet::jecFactor(), metsig::jet, pat::Jet::jetID(), TFileDirectory::make(), TFileDirectory::mkdir(), reco::JetID::n90Hits, reco::Jet::nConstituents(), pat::Jet::neutralEmEnergyFraction(), pat::Jet::neutralHadronEnergyFraction(), Parameters::parameters, JetIDStudiesSelector::pfDeltaPhi(), JetIDStudiesSelector::pfJet0(), JetIDStudiesSelector::pfJet1(), JetIDStudiesSelector::pfJetID(), reco::LeafCandidate::phi(), Pi, PythonProcessDesc::processDesc(), RecoTauCleanerPlugins::pt, reco::LeafCandidate::pt(), reco::LeafCandidate::px(), reco::LeafCandidate::py(), reco::LeafCandidate::pz(), edm::RefVector< C, T, F >::size(), AlCaHLTBitMon_QueryRunRegistry::string, pat::strbitset::test(), TrackerOfflineValidation_Standalone_cff::TFileService, fwlite::ChainEvent::toBegin(), TwoPi, and PatBasicFWLiteJetAnalyzer_Selector_cfg::useMC.

233 {
234 
235 
236  if ( argc < 2 ) {
237  std::cout << "Usage : " << argv[0] << " [parameters.py]" << std::endl;
238  return 0;
239  }
240 
241  cout << "Hello from " << argv[0] << "!" << endl;
242 
243 
244  // load framework libraries
245  gSystem->Load( "libFWCoreFWLite" );
247 
248 
249  cout << "Getting parameters" << endl;
250  // Get the python configuration
251  PythonProcessDesc builder(argv[1]);
252  boost::shared_ptr<edm::ProcessDesc> b = builder.processDesc();
253  boost::shared_ptr<edm::ParameterSet> parameters = b->getProcessPSet();
254  parameters->registerIt();
255 
256  edm::ParameterSet const& jetStudiesParams = parameters->getParameter<edm::ParameterSet>("jetStudies");
257  edm::ParameterSet const& pfJetStudiesParams = parameters->getParameter<edm::ParameterSet>("pfJetStudies");
258  edm::ParameterSet const& caloJetIDParameters = parameters->getParameter<edm::ParameterSet>("jetIDSelector");
259  edm::ParameterSet const& pfJetIDParameters = parameters->getParameter<edm::ParameterSet>("pfJetIDSelector");
260  edm::ParameterSet const& plotParameters = parameters->getParameter<edm::ParameterSet>("plotParameters");
261  edm::ParameterSet const& inputs = parameters->getParameter<edm::ParameterSet>("inputs");
262  edm::ParameterSet const& outputs = parameters->getParameter<edm::ParameterSet>("outputs");
263 
264  cout << "Making RunLumiSelector" << endl;
265  RunLumiSelector runLumiSel( inputs );
266 
267  cout << "setting up TFileService" << endl;
268  // book a set of histograms
269  fwlite::TFileService fs = fwlite::TFileService( outputs.getParameter<std::string>("outputName") );
270  TFileDirectory theDir = fs.mkdir( "histos" );
271 
272  cout << "Setting up chain event" << endl;
273  // This object 'event' is used both to get all information from the
274  // event as well as to store histograms, etc.
275  fwlite::ChainEvent ev ( inputs.getParameter<std::vector<std::string> > ("fileNames") );
276 
277 
278  cout << "Booking histograms" << endl;
279  // Book histograms
280 
281  std::map<std::string, TH1*> hists;
282 
283  hists["hist_nJet" ] = theDir.make<TH1D>( "hist_nJet" ,"Number of Calo Jets", 10, 0, 10 ) ;
284  hists["hist_nPFJet" ] = theDir.make<TH1D>( "hist_nPFJet" ,"Number of PF Jets", 10, 0, 10 ) ;
285 
286  hists["hist_jetPt" ] = theDir.make<TH1D>( "hist_jetPt" , "Jet p_{T}", 400, 0, 400 ) ;
287  hists["hist_jetEtaVsPhi" ] = theDir.make<TH2D>( "hist_jetEtaVsPhi" , "Jet #phi versus #eta;#eta;#phi", 50, -5.0, 5.0, 50, -TMath::Pi(), TMath::Pi() ) ;
288  hists["hist_jetNTracks" ] = theDir.make<TH1D>( "hist_jetNTracks" , "Jet N_{TRACKS}", 20, 0, 20 ) ;
289  hists["hist_jetNTracksVsPt" ] = theDir.make<TH2D>( "hist_jetNTracksVsPt" , "Number of Tracks versus Jet p_{T};Jet p_{T}(GeV/c) ;N_{Tracks}",20, 0, 200, 20, 0, 20 ) ;
290  hists["hist_jetEMF" ] = theDir.make<TH1D>( "hist_jetEMF" , "Jet EMF", 200, 0, 1) ;
291  hists["hist_jetPdgID" ] = theDir.make<TH1D>( "hist_jetPdgID" , "PDG Id of Jet Constituents", 10000, 0, 10000 ) ;
292  hists["hist_jetGenEmE" ] = theDir.make<TH1D>( "hist_jetGenEmE" , "Gen Jet EM Energy", 200, 0, 200 ) ;
293  hists["hist_jetGenHadE" ] = theDir.make<TH1D>( "hist_jetGenHadE" , "Gen Jet HAD Energy", 200, 0, 200 ) ;
294  hists["hist_jetGenEMF" ] = theDir.make<TH1D>( "hist_jetGenEMF" , "Gen Jet EMF", 200, 0, 1) ;
295  hists["hist_jetEoverGenE" ] = theDir.make<TH1D>( "hist_jetEoverGenE" , "Energy of reco Jet / Energy of gen Jet", 200, 0, 2.0) ;
296  hists["hist_jetCorr" ] = theDir.make<TH1D>( "hist_jetCorr" , "Jet Correction Factor", 200, 0, 1.0 ) ;
297  hists["hist_n90Hits" ] = theDir.make<TH1D>( "hist_n90Hits" , "Jet n90Hits", 20, 0, 20) ;
298  hists["hist_fHPD" ] = theDir.make<TH1D>( "hist_fHPD" , "Jet fHPD", 200, 0, 1) ;
299  hists["hist_nConstituents" ] = theDir.make<TH1D>( "hist_nConstituents" , "Jet nConstituents", 20, 0, 20 ) ;
300  hists["hist_jetCHF" ] = theDir.make<TH1D>( "hist_jetCHF" , "Jet Charged Hadron Fraction", 200, 0, 1.0) ;
301 
302  hists["hist_good_jetPt" ] = theDir.make<TH1D>( "hist_good_jetPt" , "Jet p_{T}", 400, 0, 400 ) ;
303  hists["hist_good_jetEtaVsPhi" ] = theDir.make<TH2D>( "hist_good_jetEtaVsPhi" , "Jet #phi versus #eta;#eta;#phi", 50, -5.0, 5.0, 50, -TMath::Pi(), TMath::Pi() ) ;
304  hists["hist_good_jetNTracks" ] = theDir.make<TH1D>( "hist_good_jetNTracks" , "Jet N_{TRACKS}", 20, 0, 20 ) ;
305  hists["hist_good_jetNTracksVsPt" ] = theDir.make<TH2D>( "hist_good_jetNTracksVsPt" , "Number of Tracks versus Jet p_{T};Jet p_{T}(GeV/c) ;N_{Tracks}",20, 0, 200, 20, 0, 20 ) ;
306  hists["hist_good_jetEMF" ] = theDir.make<TH1D>( "hist_good_jetEMF" , "Jet EMF", 200, 0, 1) ;
307  hists["hist_good_jetPdgID" ] = theDir.make<TH1D>( "hist_good_jetPdgID" , "PDG Id of Jet Constituents", 10000, 0, 10000 ) ;
308  hists["hist_good_jetGenEmE" ] = theDir.make<TH1D>( "hist_good_jetGenEmE" , "Gen Jet EM Energy", 200, 0, 200 ) ;
309  hists["hist_good_jetGenHadE" ] = theDir.make<TH1D>( "hist_good_jetGenHadE" , "Gen Jet HAD Energy", 200, 0, 200 ) ;
310  hists["hist_good_jetGenEMF" ] = theDir.make<TH1D>( "hist_good_jetGenEMF" , "Gen Jet EMF", 200, 0, 1) ;
311  hists["hist_good_jetEoverGenE" ] = theDir.make<TH1D>( "hist_good_jetEoverGenE" , "Energy of reco Jet / Energy of gen Jet", 200, 0, 2.0) ;
312  hists["hist_good_jetCorr" ] = theDir.make<TH1D>( "hist_good_jetCorr" , "Jet Correction Factor", 200, 0, 1.0 ) ;
313  hists["hist_good_n90Hits" ] = theDir.make<TH1D>( "hist_good_n90Hits" , "Jet n90Hits", 20, 0, 20) ;
314  hists["hist_good_fHPD" ] = theDir.make<TH1D>( "hist_good_fHPD" , "Jet fHPD", 200, 0, 1) ;
315  hists["hist_good_nConstituents" ] = theDir.make<TH1D>( "hist_good_nConstituents" , "Jet nConstituents", 20, 0, 20 ) ;
316  hists["hist_good_jetCHF" ] = theDir.make<TH1D>( "hist_good_jetCHF" , "Jet Charged Hadron Fraction", 200, 0, 1.0) ;
317 
318 
319  hists["hist_pf_jetPt" ] = theDir.make<TH1D>( "hist_pf_jetPt" , "PFJet p_{T}", 400, 0, 400 ) ;
320  hists["hist_pf_jetEtaVsPhi" ] = theDir.make<TH2D>( "hist_pf_jetEtaVsPhi" , "PFJet #phi versus #eta;#eta;#phi", 50, -5.0, 5.0, 50, -TMath::Pi(), TMath::Pi() ) ;
321  hists["hist_pf_jetNTracks" ] = theDir.make<TH1D>( "hist_pf_jetNTracks" , "PFJet N_{TRACKS}", 20, 0, 20 ) ;
322  hists["hist_pf_jetNTracksVsPt" ] = theDir.make<TH2D>( "hist_pf_jetNTracksVsPt" , "Number of Tracks versus Jet p_{T};Jet p_{T}(GeV/c) ;N_{Tracks}",20, 0, 200, 20, 0, 20 ) ;
323  hists["hist_pf_jetEMF" ] = theDir.make<TH1D>( "hist_pf_jetEMF" , "PFJet EMF", 200, 0, 1) ;
324  hists["hist_pf_jetCHF" ] = theDir.make<TH1D>( "hist_pf_jetCHF" , "PFJet CHF", 200, 0, 1) ;
325  hists["hist_pf_jetNHF" ] = theDir.make<TH1D>( "hist_pf_jetNHF" , "PFJet NHF", 200, 0, 1) ;
326  hists["hist_pf_jetCEF" ] = theDir.make<TH1D>( "hist_pf_jetCEF" , "PFJet CEF", 200, 0, 1) ;
327  hists["hist_pf_jetNEF" ] = theDir.make<TH1D>( "hist_pf_jetNEF" , "PFJet NEF", 200, 0, 1) ;
328  hists["hist_pf_jetPdgID" ] = theDir.make<TH1D>( "hist_pf_jetPdgID" , "PDG Id of Jet Constituents", 10000, 0, 10000 ) ;
329  hists["hist_pf_jetGenEmE" ] = theDir.make<TH1D>( "hist_pf_jetGenEmE" , "Gen Jet EM Energy", 200, 0, 200 ) ;
330  hists["hist_pf_jetGenHadE" ] = theDir.make<TH1D>( "hist_pf_jetGenHadE" , "Gen Jet HAD Energy", 200, 0, 200 ) ;
331  hists["hist_pf_jetGenEMF" ] = theDir.make<TH1D>( "hist_pf_jetGenEMF" , "Gen Jet EMF", 200, 0, 1) ;
332  hists["hist_pf_jetEoverGenE" ] = theDir.make<TH1D>( "hist_pf_jetEoverGenE" , "Energy of reco Jet / Energy of gen Jet", 200, 0, 2.0) ;
333  hists["hist_pf_jetCorr" ] = theDir.make<TH1D>( "hist_pf_jetCorr" , "PFJet Correction Factor", 200, 0, 1.0 ) ;
334  hists["hist_pf_nConstituents" ] = theDir.make<TH1D>( "hist_pf_nConstituents" , "PFJet nConstituents", 20, 0, 20 ) ;
335 
336  hists["hist_pf_good_jetPt" ] = theDir.make<TH1D>( "hist_pf_good_jetPt" , "PFJet p_{T}", 400, 0, 400 ) ;
337  hists["hist_pf_good_jetEtaVsPhi" ] = theDir.make<TH2D>( "hist_pf_good_jetEtaVsPhi" , "PFJet #phi versus #eta;#eta;#phi", 50, -5.0, 5.0, 50, -TMath::Pi(), TMath::Pi() ) ;
338  hists["hist_pf_good_jetNTracks" ] = theDir.make<TH1D>( "hist_pf_good_jetNTracks" , "PFJet N_{TRACKS}", 20, 0, 20 ) ;
339  hists["hist_pf_good_jetNTracksVsPt" ] = theDir.make<TH2D>( "hist_pf_good_jetNTracksVsPt", "Number of Tracks versus Jet p_{T};Jet p_{T}(GeV/c) ;N_{Tracks}",20, 0, 200, 20, 0, 20 ) ;
340  hists["hist_pf_good_jetEMF" ] = theDir.make<TH1D>( "hist_pf_good_jetEMF" , "PFJet EMF", 200, 0, 1) ;
341  hists["hist_pf_good_jetCHF" ] = theDir.make<TH1D>( "hist_pf_good_jetCHF" , "PFJet CHF", 200, 0, 1) ;
342  hists["hist_pf_good_jetNHF" ] = theDir.make<TH1D>( "hist_pf_good_jetNHF" , "PFJet NHF", 200, 0, 1) ;
343  hists["hist_pf_good_jetCEF" ] = theDir.make<TH1D>( "hist_pf_good_jetCEF" , "PFJet CEF", 200, 0, 1) ;
344  hists["hist_pf_good_jetNEF" ] = theDir.make<TH1D>( "hist_pf_good_jetNEF" , "PFJet NEF", 200, 0, 1) ;
345  hists["hist_pf_good_jetPdgID" ] = theDir.make<TH1D>( "hist_pf_good_jetPdgID" , "PDG Id of Jet Constituents", 10000, 0, 10000 ) ;
346  hists["hist_pf_good_jetGenEmE" ] = theDir.make<TH1D>( "hist_pf_good_jetGenEmE" , "Gen Jet EM Energy", 200, 0, 200 ) ;
347  hists["hist_pf_good_jetGenHadE" ] = theDir.make<TH1D>( "hist_pf_good_jetGenHadE" , "Gen Jet HAD Energy", 200, 0, 200 ) ;
348  hists["hist_pf_good_jetGenEMF" ] = theDir.make<TH1D>( "hist_pf_good_jetGenEMF" , "Gen Jet EMF", 200, 0, 1) ;
349  hists["hist_pf_good_jetEoverGenE" ] = theDir.make<TH1D>( "hist_pf_good_jetEoverGenE" , "Energy of reco Jet / Energy of gen Jet", 200, 0, 2.0) ;
350  hists["hist_pf_good_jetCorr" ] = theDir.make<TH1D>( "hist_pf_good_jetCorr" , "PFJet Correction Factor", 200, 0, 1.0 ) ;
351  hists["hist_pf_good_nConstituents" ] = theDir.make<TH1D>( "hist_pf_good_nConstituents" , "PFJet nConstituents", 20, 0, 20 ) ;
352 
353  hists["hist_mjj" ] = theDir.make<TH1D>( "hist_mjj" , "Dijet mass", 300, 0, 300 ) ;
354  hists["hist_dR_jj" ] = theDir.make<TH1D>( "hist_dR_jj" , "#Delta R_{JJ}", 200, 0, TMath::TwoPi() ) ;
355  hists["hist_imbalance_jj" ] = theDir.make<TH1D>( "hist_imbalance_jj" , "Dijet imbalance", 200, -1.0, 1.0 ) ;
356 
357  hists["hist_pf_mjj" ] = theDir.make<TH1D>( "hist_pf_mjj" , "Dijet mass", 300, 0, 300 ) ;
358  hists["hist_pf_dR_jj" ] = theDir.make<TH1D>( "hist_pf_dR_jj" , "#Delta R_{JJ}", 200, 0, TMath::TwoPi() ) ;
359  hists["hist_pf_imbalance_jj" ] = theDir.make<TH1D>( "hist_pf_imbalance_jj" , "Dijet imbalance", 200, -1.0, 1.0 ) ;
360 
361 
362 
363  cout << "Making functors" << endl;
364  JetIDStudiesSelector caloSelector( caloJetIDParameters,
365  pfJetIDParameters,
366  jetStudiesParams );
367 
368  JetIDStudiesSelector pfSelector( caloJetIDParameters,
369  pfJetIDParameters,
370  pfJetStudiesParams );
371 
372  bool doTracks = plotParameters.getParameter<bool>("doTracks");
373  bool useMC = plotParameters.getParameter<bool>("useMC");
374 
375  cout << "About to begin looping" << endl;
376 
377  int nev = 0;
378  //loop through each event
379  for (ev.toBegin(); ! ev.atEnd(); ++ev, ++nev) {
380 
381 
382  edm::EventBase const & event = ev;
383 
384  if ( runLumiSel(ev) == false ) continue;
385 
386  if ( nev % 100 == 0 ) cout << "Processing run " << event.id().run() << ", lumi " << event.id().luminosityBlock() << ", event " << event.id().event() << endl;
387 
388 
389 
390 
391  pat::strbitset retCalo = caloSelector.getBitTemplate();
392  caloSelector( event, retCalo );
393 
394 
395  pat::strbitset retPF = pfSelector.getBitTemplate();
396  pfSelector( event, retPF );
397 
401  if ( retCalo.test( caloSelector.caloKin() ) ) {
402  if ( retCalo.test( caloSelector.caloDeltaPhi() ) ) {
403  vector<pat::Jet> const & allCaloJets = caloSelector.allCaloJets();
404 
405  for ( std::vector<pat::Jet>::const_iterator jetBegin = allCaloJets.begin(),
406  jetEnd = jetBegin + 2, ijet = jetBegin;
407  ijet != jetEnd; ++ijet ) {
408 
409  const pat::Jet & jet = *ijet;
410 
411  double pt = jet.pt();
412 
413  const reco::TrackRefVector & jetTracks = jet.associatedTracks();
414 
415  hists["hist_jetPt"]->Fill( pt );
416  hists["hist_jetEtaVsPhi"]->Fill( jet.eta(), jet.phi() );
417  hists["hist_jetNTracks"]->Fill( jetTracks.size() );
418  hists["hist_jetNTracksVsPt"]->Fill( pt, jetTracks.size() );
419  hists["hist_jetEMF"]->Fill( jet.emEnergyFraction() );
420  hists["hist_jetCorr"]->Fill( jet.jecFactor("Uncorrected") );
421  hists["hist_n90Hits"]->Fill( static_cast<int>(jet.jetID().n90Hits) );
422  hists["hist_fHPD"]->Fill( jet.jetID().fHPD );
423  hists["hist_nConstituents"]->Fill( jet.nConstituents() );
424 
425  if ( useMC && jet.genJet() != 0 ) {
426  hists["hist_jetGenEmE"]->Fill( jet.genJet()->emEnergy() );
427  hists["hist_jetGenHadE"]->Fill( jet.genJet()->hadEnergy() );
428  hists["hist_jetEoverGenE"]->Fill( jet.energy() / jet.genJet()->energy() );
429  hists["hist_jetGenEMF"]->Fill( jet.genJet()->emEnergy() / jet.genJet()->energy() );
430  }
431  if ( doTracks ) {
432  TLorentzVector p4_tracks(0,0,0,0);
433  for ( reco::TrackRefVector::const_iterator itrk = jetTracks.begin(),
434  itrkEnd = jetTracks.end();
435  itrk != itrkEnd; ++itrk ) {
436  TLorentzVector p4_trk;
437  double M_PION = 0.140;
438  p4_trk.SetPtEtaPhiM( (*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), M_PION );
439  p4_tracks += p4_trk;
440  }
441  hists["hist_jetCHF"]->Fill( p4_tracks.Energy() / jet.energy() );
442  }
443 
444 
445  } // end loop over jets
446 
447 
448 
449  if ( retCalo.test( caloSelector.caloJetID() ) ) {
450  pat::Jet const & jet0 = caloSelector.caloJet0();
451  pat::Jet const & jet1 = caloSelector.caloJet1();
452 
453  TLorentzVector p4_j0( jet0.px(), jet0.py(), jet0.pz(), jet0.energy() );
454  TLorentzVector p4_j1( jet1.px(), jet1.py(), jet1.pz(), jet1.energy() );
455 
456  TLorentzVector p4_jj = p4_j0 + p4_j1;
457 
458  hists["hist_mjj"]->Fill( p4_jj.M() );
459  hists["hist_dR_jj"]->Fill( p4_j0.DeltaR( p4_j1 ) );
460  hists["hist_imbalance_jj"]->Fill( (p4_j0.Perp() - p4_j1.Perp() ) /
461  (p4_j0.Perp() + p4_j1.Perp() ) );
462 
463  hists["hist_good_jetPt"]->Fill( jet0.pt() );
464  hists["hist_good_jetEtaVsPhi"]->Fill( jet0.eta(), jet0.phi() );
465  hists["hist_good_jetNTracks"]->Fill( jet0.associatedTracks().size() );
466  hists["hist_good_jetNTracksVsPt"]->Fill( jet0.pt(), jet0.associatedTracks().size() );
467  hists["hist_good_jetEMF"]->Fill( jet0.emEnergyFraction() );
468  hists["hist_good_jetCorr"]->Fill( jet0.jecFactor("Uncorrected") );
469  hists["hist_good_n90Hits"]->Fill( static_cast<int>(jet0.jetID().n90Hits) );
470  hists["hist_good_fHPD"]->Fill( jet0.jetID().fHPD );
471  hists["hist_good_nConstituents"]->Fill( jet0.nConstituents() );
472 
473 
474  hists["hist_good_jetPt"]->Fill( jet1.pt() );
475  hists["hist_good_jetEtaVsPhi"]->Fill( jet1.eta(), jet1.phi() );
476  hists["hist_good_jetNTracks"]->Fill( jet1.associatedTracks().size() );
477  hists["hist_good_jetNTracksVsPt"]->Fill( jet1.pt(), jet1.associatedTracks().size() );
478  hists["hist_good_jetEMF"]->Fill( jet1.emEnergyFraction() );
479  hists["hist_good_jetCorr"]->Fill( jet1.jecFactor("Uncorrected") );
480  hists["hist_good_n90Hits"]->Fill( static_cast<int>(jet1.jetID().n90Hits) );
481  hists["hist_good_fHPD"]->Fill( jet1.jetID().fHPD );
482  hists["hist_good_nConstituents"]->Fill( jet1.nConstituents() );
483 
484  }// end if passed calo jet id
485  }// end if passed dphi cuts
486  }// end if passed kin cuts
487 
488 
492  if ( retPF.test( pfSelector.pfDeltaPhi() ) ) {
493 
494  vector<pat::Jet> const & allPFJets = pfSelector.allPFJets();
495 
496  for ( std::vector<pat::Jet>::const_iterator jetBegin = allPFJets.begin(),
497  jetEnd = jetBegin + 2, ijet = jetBegin;
498  ijet != jetEnd; ++ijet ) {
499 
500  const pat::Jet & jet = *ijet;
501 
502  double pt = jet.pt();
503 
504  hists["hist_pf_jetPt"]->Fill( pt );
505  hists["hist_pf_jetEtaVsPhi"]->Fill( jet.eta(), jet.phi() );
506  hists["hist_pf_nConstituents"]->Fill( jet.nConstituents() );
507  hists["hist_pf_jetCEF"]->Fill( jet.chargedEmEnergyFraction() );
508  hists["hist_pf_jetNEF"]->Fill( jet.neutralEmEnergyFraction() );
509  hists["hist_pf_jetCHF"]->Fill( jet.chargedHadronEnergyFraction() );
510  hists["hist_pf_jetNHF"]->Fill( jet.neutralHadronEnergyFraction() );
511 
512 
513  if ( useMC && jet.genJet() != 0 ) {
514  hists["hist_pf_jetGenEmE"]->Fill( jet.genJet()->emEnergy() );
515  hists["hist_pf_jetGenHadE"]->Fill( jet.genJet()->hadEnergy() );
516  hists["hist_pf_jetEoverGenE"]->Fill( jet.energy() / jet.genJet()->energy() );
517 
518  hists["hist_pf_jetGenEMF"]->Fill( jet.genJet()->emEnergy() / jet.genJet()->energy() );
519  }
520 
521  } // end loop over jets
522 
523 
524 
525  if ( retPF.test( pfSelector.pfJetID() ) ) {
526  pat::Jet const & jet0 = pfSelector.pfJet0();
527  pat::Jet const & jet1 = pfSelector.pfJet1();
528 
529  TLorentzVector p4_j0( jet0.px(), jet0.py(), jet0.pz(), jet0.energy() );
530  TLorentzVector p4_j1( jet1.px(), jet1.py(), jet1.pz(), jet1.energy() );
531 
532  TLorentzVector p4_jj = p4_j0 + p4_j1;
533 
534  hists["hist_pf_mjj"]->Fill( p4_jj.M() );
535  hists["hist_pf_dR_jj"]->Fill( p4_j0.DeltaR( p4_j1 ) );
536  hists["hist_pf_imbalance_jj"]->Fill( (p4_j0.Perp() - p4_j1.Perp() ) /
537  (p4_j0.Perp() + p4_j1.Perp() ) );
538 
539  hists["hist_pf_good_jetPt"]->Fill( jet0.pt() );
540  hists["hist_pf_good_jetEtaVsPhi"]->Fill( jet0.eta(), jet0.phi() );
541  hists["hist_pf_good_nConstituents"]->Fill( jet0.nConstituents() );
542  hists["hist_pf_good_jetCEF"]->Fill( jet0.chargedEmEnergyFraction() );
543  hists["hist_pf_good_jetNEF"]->Fill( jet0.neutralEmEnergyFraction() );
544  hists["hist_pf_good_jetCHF"]->Fill( jet0.chargedHadronEnergyFraction() );
545  hists["hist_pf_good_jetNHF"]->Fill( jet0.neutralHadronEnergyFraction() );
546 
547 
548  hists["hist_pf_good_jetPt"]->Fill( jet1.pt() );
549  hists["hist_pf_good_jetEtaVsPhi"]->Fill( jet1.eta(), jet1.phi() );
550  hists["hist_pf_good_nConstituents"]->Fill( jet1.nConstituents() );
551  hists["hist_pf_good_jetCEF"]->Fill( jet1.chargedEmEnergyFraction() );
552  hists["hist_pf_good_jetNEF"]->Fill( jet1.neutralEmEnergyFraction() );
553  hists["hist_pf_good_jetCHF"]->Fill( jet1.chargedHadronEnergyFraction() );
554  hists["hist_pf_good_jetNHF"]->Fill( jet1.neutralHadronEnergyFraction() );
555 
556  } // end if 2 good PF jets
557 
558  }// end if delta phi pf cuts
559 
560  } // end loop over events
561 
562  cout << "Calo jet selection" << endl;
563  caloSelector.print(std::cout);
564  cout << "PF jet selection" << endl;
565  pfSelector.print(std::cout);
566 
567 
568 
569 
570  return 0;
571 }
const double TwoPi
const double Pi
virtual double energy() const GCC11_FINAL
energy
T getParameter(std::string const &) const
float jecFactor(const std::string &level, const std::string &flavor="none", const std::string &set="") const
Definition: Jet.cc:236
dictionary parameters
Definition: Parameters.py:2
float neutralHadronEnergyFraction() const
neutralHadronEnergyFraction (relative to uncorrected jet energy)
Definition: Jet.h:354
float hadEnergy() const
Definition: GenJet.h:59
float emEnergy() const
Definition: GenJet.h:57
float fHPD
Definition: JetID.h:45
const reco::GenJet * genJet() const
return the matched generated jet
Definition: Jet.cc:180
float chargedHadronEnergyFraction() const
chargedHadronEnergyFraction (relative to uncorrected jet energy)
Definition: Jet.h:352
float chargedEmEnergyFraction() const
chargedEmEnergyFraction (relative to uncorrected jet energy)
Definition: Jet.h:356
const reco::TrackRefVector & associatedTracks() const
method to return a vector of refs to the tracks associated to this jet
Definition: Jet.cc:388
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:249
virtual double pz() const GCC11_FINAL
z coordinate of momentum vector
virtual double py() const GCC11_FINAL
y coordinate of momentum vector
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:244
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
virtual double px() const GCC11_FINAL
x coordinate of momentum vector
T * make(const Args &...args) const
make new ROOT object
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
float emEnergyFraction() const
returns the jet electromagnetic energy fraction
Definition: Jet.h:280
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
reco::JetID const & jetID() const
accessing Jet ID information
Definition: Jet.h:460
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
tuple argc
Definition: dir2webdir.py:38
double b
Definition: hdecay.h:120
Analysis-level calorimeter jet class.
Definition: Jet.h:73
bool test(std::string s) const
test
Definition: strbitset.h:331
virtual int nConstituents() const
of constituents
Definition: Jet.h:65
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89
static void enable()
enable automatic library loading
tuple cout
Definition: gather_cfg.py:121
float neutralEmEnergyFraction() const
neutralEmEnergyFraction (relative to uncorrected jet energy)
Definition: Jet.h:358
volatile std::atomic< bool > shutdown_flag false
virtual float pt() const GCC11_FINAL
transverse momentum
short n90Hits
Definition: JetID.h:47