Module to analyze pat::Jets in the context of a more complex exercise. More...
Public Member Functions | |
PatJetAnalyzer (const edm::ParameterSet &cfg) | |
default contructor | |
~PatJetAnalyzer () | |
default destructor | |
Private Member Functions | |
virtual void | analyze (const edm::Event &event, const edm::EventSetup &setup) |
everything that needs to be done during the even loop | |
bool | booked (const std::string histName) const |
check if histogram was booked | |
void | fill (const std::string histName, double value) const |
fill histogram if it had been booked before | |
void | print (edm::View< pat::Jet >::const_iterator &jet, unsigned int idx) |
Private Attributes | |
std::string | corrLevel_ |
correction level for pat jet | |
std::map< std::string, TH1F * > | hists_ |
management of 1d histograms | |
edm::InputTag | jets_ |
pat jets |
Module to analyze pat::Jets in the context of a more complex exercise.
Basic quantities of jets like the transverse momentum, eta and phi as well as the invariant dijet mass are plotted. Basic histograms for a jet energy response plot as a function of the pt of the reference object are filled. As reference matched partons are chosen. Input parameters are:
Definition at line 43 of file PatJetAnalyzer.cc.
PatJetAnalyzer::PatJetAnalyzer | ( | const edm::ParameterSet & | cfg | ) | [explicit] |
default contructor
Definition at line 72 of file PatJetAnalyzer.cc.
References BINS, hists_, MAXBIN, and indexGen::title.
: corrLevel_(cfg.getParameter<std::string>("corrLevel")), jets_(cfg.getParameter<edm::InputTag>("src")) { // register TFileService edm::Service<TFileService> fs; // jet multiplicity hists_["mult" ]=fs->make<TH1F>("mult" , "N_{Jet}" , 15, 0., 15.); // jet pt (for all jets) hists_["pt" ]=fs->make<TH1F>("pt" , "p_{T}(Jet) [GeV]" , 60, 0., 300.); // jet eta (for all jets) hists_["eta" ]=fs->make<TH1F>("eta" , "#eta (Jet)" , 60, -3., 3.); // jet phi (for all jets) hists_["phi" ]=fs->make<TH1F>("phi" , "#phi (Jet)" , 60, 3.2, 3.2); // dijet mass (if available) hists_["mass" ]=fs->make<TH1F>("mass" , "M_{jj} [GeV]" , 50, 0., 500.); // basic histograms for jet energy response for(unsigned int idx=0; idx<MAXBIN; ++idx){ char buffer [10]; sprintf (buffer, "jes_%i", idx); char title [50]; sprintf (title , "p_{T}^{rec}/p_{T}^{gen} [%i GeV - %i GeV]", (int)BINS[idx], (int)BINS[idx+1]); hists_[buffer]=fs->make<TH1F>(buffer, title, 100, 0., 2.); } }
PatJetAnalyzer::~PatJetAnalyzer | ( | ) | [inline] |
void PatJetAnalyzer::analyze | ( | const edm::Event & | event, |
const edm::EventSetup & | setup | ||
) | [private, virtual] |
everything that needs to be done during the even loop
Implements edm::EDAnalyzer.
Definition at line 98 of file PatJetAnalyzer.cc.
References BINS, corrLevel_, fill(), metsig::jet, analyzePatCleaning_cfg::jets, jets_, MAXBIN, and p4.
{ // recieve jet collection label edm::Handle<edm::View<pat::Jet> > jets; event.getByLabel(jets_,jets); // loop jets for(edm::View<pat::Jet>::const_iterator jet=jets->begin(); jet!=jets->end(); ++jet){ // print jec factors // print(jet, jet-jets->begin()); // fill basic kinematics fill( "pt" , jet->correctedJet(corrLevel_).pt()); fill( "eta", jet->eta()); fill( "phi", jet->phi()); // basic plots for jet responds plot as a function of pt if( jet->genJet() ){ double resp=jet->correctedJet(corrLevel_).pt()/jet->genJet()->pt(); for(unsigned int idx=0; idx<MAXBIN; ++idx){ if(BINS[idx]<=jet->genJet()->pt() && jet->genJet()->pt()<BINS[idx+1]){ char buffer [10]; sprintf (buffer, "jes_%i", idx); fill( buffer, resp ); } } } } // jet multiplicity fill( "mult" , jets->size()); // invariant dijet mass for first two leading jets if(jets->size()>1){ fill( "mass", ((*jets)[0].p4()+(*jets)[1].p4()).mass());} }
bool PatJetAnalyzer::booked | ( | const std::string | histName | ) | const [inline, private] |
void PatJetAnalyzer::fill | ( | const std::string | histName, |
double | value | ||
) | const [inline, private] |
fill histogram if it had been booked before
Definition at line 58 of file PatJetAnalyzer.cc.
References booked(), hists_, and edm::second().
Referenced by analyze().
void PatJetAnalyzer::print | ( | edm::View< pat::Jet >::const_iterator & | jet, |
unsigned int | idx | ||
) | [private] |
Definition at line 131 of file PatJetAnalyzer.cc.
References gather_cfg::cout, pat::Jet::currentJECLevel(), pat::JetCorrFactors::NONE, reco::LeafCandidate::pt(), edm::View< T >::size(), and pat::JetCorrFactors::UDS.
{ //edm::LogInfo log("JEC"); std::cout << "[" << idx << "] :: eta=" << std::setw(10) << jet->eta() << " phi=" << std::setw(10) << jet->phi() << " size: " << jet->availableJECLevels().size() << std::endl; for(unsigned int idx=0; idx<jet->availableJECLevels().size(); ++idx){ pat::Jet correctedJet; if(jet->availableJECLevels()[idx].find("L5Flavor")!=std::string::npos|| jet->availableJECLevels()[idx].find("L7Parton")!=std::string::npos ){ correctedJet=jet->correctedJet(idx, pat::JetCorrFactors::UDS); } else{ correctedJet=jet->correctedJet(idx, pat::JetCorrFactors::NONE ); } std::cout << std::setw(10) << correctedJet.currentJECLevel() << " pt=" << std::setw(10) << correctedJet.pt() << std::endl; } }
std::string PatJetAnalyzer::corrLevel_ [private] |
correction level for pat jet
Definition at line 64 of file PatJetAnalyzer.cc.
Referenced by analyze().
std::map<std::string,TH1F*> PatJetAnalyzer::hists_ [private] |
management of 1d histograms
Definition at line 68 of file PatJetAnalyzer.cc.
Referenced by booked(), fill(), and PatJetAnalyzer().
edm::InputTag PatJetAnalyzer::jets_ [private] |