Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:34:57

0001 // SimpleJetDump.cc

0002 // Description:  Prints out Jets, consituent CaloTowers, constituent RecHits and associated Digis (the digis for HCAL only).

0003 //               The user can specify which level in the config file:

0004 //               DumpLevel="Jets":    Printout of jets and their kinematic quantities.

0005 //               DumpLevel="Towers":  Nested Printout of jets and their constituent CaloTowers

0006 //               DumpLevel="RecHits": Nested Printout of jets, constituent CaloTowers and constituent RecHits

0007 //               DumpLevel="Digis":   Nested Printout of jets, constituent CaloTowers, RecHits and all the HCAL digis

0008 //                                    associated with the RecHit channel (no links exist to go back to actual digis used).

0009 //               Does simple sanity checks on energy sums at each level: jets=sum of towers, tower=sum of RecHits.

0010 //               Does quick and dirty estimate of the fC/GeV factor that was applied to make the RecHit from the Digis.

0011 //

0012 // Author: Robert M. Harris

0013 // Date:  19 - October - 2006

0014 //

0015 #include "RecoJets/JetAnalyzers/interface/SimpleJetDump.h"
0016 #include "RecoJets/JetAnalyzers/interface/JetPlotsExample.h"
0017 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
0018 #include "DataFormats/JetReco/interface/CaloJet.h"
0019 #include "DataFormats/JetReco/interface/GenJet.h"
0020 #include "FWCore/Framework/interface/Event.h"
0021 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0022 using namespace edm;
0023 using namespace reco;
0024 using namespace std;
0025 
0026 SimpleJetDump::SimpleJetDump(const ParameterSet& cfg)
0027     : CaloJetAlg(cfg.getParameter<string>("CaloJetAlg")), GenJetAlg(cfg.getParameter<string>("GenJetAlg")) {}
0028 
0029 void SimpleJetDump::beginJob() { evtCount = 0; }
0030 
0031 void SimpleJetDump::analyze(const Event& evt, const EventSetup& es) {
0032   int jetInd;
0033   Handle<CaloJetCollection> caloJets;
0034   Handle<GenJetCollection> genJets;
0035 
0036   //Find the CaloTowers in leading CaloJets

0037   evt.getByLabel(CaloJetAlg, caloJets);
0038   evt.getByLabel(GenJetAlg, genJets);
0039 
0040   cout << endl
0041        << "Evt: " << evtCount << ", Num Calo Jets=" << caloJets->end() - caloJets->begin()
0042        << ", Num Gen Jets=" << genJets->end() - genJets->begin() << endl;
0043   cout << "   *********************************************************" << endl;
0044   jetInd = 0;
0045   for (CaloJetCollection::const_iterator jet = caloJets->begin(); jet != caloJets->end(); ++jet) {
0046     cout << "Calo Jet: " << jetInd << ", pt=" << jet->pt() << ", eta=" << jet->eta() << ", phi=" << jet->phi() << endl;
0047     jetInd++;
0048   }
0049   cout << "   *********************************************************" << endl;
0050   jetInd = 0;
0051   for (GenJetCollection::const_iterator jet = genJets->begin(); jet != genJets->end(); ++jet) {
0052     cout << "Gen Jet: " << jetInd << ", pt=" << jet->pt() << ", eta=" << jet->eta() << ", phi=" << jet->phi() << endl;
0053     jetInd++;
0054   }
0055   evtCount++;
0056   cout << "   *********************************************************" << endl;
0057 }
0058 
0059 void SimpleJetDump::endJob() {}
0060 #include "FWCore/Framework/interface/MakerMacros.h"
0061 DEFINE_FWK_MODULE(SimpleJetDump);