CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/RecoJets/JetAnalyzers/src/SimpleJetDump.cc

Go to the documentation of this file.
00001 // SimpleJetDump.cc
00002 // Description:  Prints out Jets, consituent CaloTowers, constituent RecHits and associated Digis (the digis for HCAL only).
00003 //               The user can specify which level in the config file:
00004 //               DumpLevel="Jets":    Printout of jets and their kinematic quantities.
00005 //               DumpLevel="Towers":  Nested Printout of jets and their constituent CaloTowers
00006 //               DumpLevel="RecHits": Nested Printout of jets, constituent CaloTowers and constituent RecHits
00007 //               DumpLevel="Digis":   Nested Printout of jets, constituent CaloTowers, RecHits and all the HCAL digis 
00008 //                                    associated with the RecHit channel (no links exist to go back to actual digis used).
00009 //               Does simple sanity checks on energy sums at each level: jets=sum of towers, tower=sum of RecHits.
00010 //               Does quick and dirty estimate of the fC/GeV factor that was applied to make the RecHit from the Digis.
00011 //               
00012 // Author: Robert M. Harris
00013 // Date:  19 - October - 2006
00014 // 
00015 #include "RecoJets/JetAnalyzers/interface/SimpleJetDump.h"
00016 #include "RecoJets/JetAnalyzers/interface/JetPlotsExample.h"
00017 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
00018 #include "DataFormats/JetReco/interface/CaloJet.h"
00019 #include "DataFormats/JetReco/interface/GenJet.h"
00020 #include "FWCore/Framework/interface/Event.h"
00021 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00022 using namespace edm;
00023 using namespace reco;
00024 using namespace std;
00025 
00026 SimpleJetDump::SimpleJetDump( const ParameterSet & cfg ) :  
00027   CaloJetAlg( cfg.getParameter<string>( "CaloJetAlg" ) ),
00028   GenJetAlg( cfg.getParameter<string>( "GenJetAlg" ) )  
00029   {
00030 }
00031 
00032 void SimpleJetDump::beginJob( ) {
00033   evtCount = 0;
00034 }
00035 
00036 void SimpleJetDump::analyze( const Event& evt, const EventSetup& es ) {
00037 
00038   int jetInd;
00039   Handle<CaloJetCollection> caloJets;
00040   Handle<GenJetCollection> genJets;
00041    
00042   //Find the CaloTowers in leading CaloJets
00043   evt.getByLabel( CaloJetAlg, caloJets );
00044   evt.getByLabel( GenJetAlg, genJets );
00045     
00046   cout << endl << "Evt: "<<evtCount <<", Num Calo Jets=" <<caloJets->end() - caloJets->begin() << ", Num Gen Jets=" <<genJets->end() - genJets->begin() <<endl;
00047   cout <<"   *********************************************************" <<endl;
00048   jetInd = 0;
00049   for( CaloJetCollection::const_iterator jet = caloJets->begin(); jet != caloJets->end(); ++ jet ) {
00050     cout <<"Calo Jet: "<<jetInd<<", pt="<<jet->pt()<<", eta="<<jet->eta()<<", phi="<<jet->phi() <<endl;
00051     jetInd++;
00052   }
00053   cout <<"   *********************************************************" <<endl;
00054   jetInd = 0;
00055   for( GenJetCollection::const_iterator jet = genJets->begin(); jet != genJets->end(); ++ jet ) {
00056     cout <<"Gen Jet: "<<jetInd<<", pt="<<jet->pt()<<", eta="<<jet->eta()<<", phi="<<jet->phi() <<endl;
00057     jetInd++;
00058   }
00059   evtCount++;    
00060   cout <<"   *********************************************************" <<endl;
00061 
00062 }
00063 
00064 void SimpleJetDump::endJob() {
00065 
00066 
00067 }
00068 #include "FWCore/Framework/interface/MakerMacros.h"
00069 DEFINE_FWK_MODULE(SimpleJetDump);