CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/src/RecoTauTag/TauTagTools/plugins/TauGenJetDumper.cc

Go to the documentation of this file.
00001 /*
00002  * =====================================================================================
00003  *
00004  *       Filename:  TauGenJetDumper.cc
00005  *
00006  *    Description:  Dump information about Generator taus
00007  *
00008  *         Author:  Evan K. Friis, UC Davis
00009  *
00010  *         $Id $
00011  *
00012  * =====================================================================================
00013  */
00014 #include <boost/foreach.hpp>
00015 #include <sstream>
00016 
00017 #include "FWCore/Framework/interface/EDAnalyzer.h"
00018 #include "FWCore/Framework/interface/Event.h"
00019 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00020 
00021 #include "DataFormats/JetReco/interface/GenJetCollection.h"
00022 #include "DataFormats/JetReco/interface/GenJet.h"
00023 
00024 #include "PhysicsTools/JetMCUtils/interface/JetMCTag.h"
00025 
00026 class TauGenJetDumper : public edm::EDAnalyzer {
00027   public:
00028     explicit TauGenJetDumper(const edm::ParameterSet& pset):
00029       genJetSrc_(pset.getParameter<edm::InputTag>("src")) {}
00030     virtual ~TauGenJetDumper() {}
00031     virtual void analyze(const edm::Event& evt, const edm::EventSetup& es);
00032   private:
00033     edm::InputTag genJetSrc_;
00034 };
00035 
00036 void
00037 TauGenJetDumper::analyze(const edm::Event& evt, const edm::EventSetup& es) {
00038   typedef edm::View<reco::GenJet> GenJetView;
00039   edm::Handle<GenJetView> jetView;
00040   evt.getByLabel(genJetSrc_, jetView);
00041 
00042   std::ostringstream output;
00043   output << " * * * Tau GenJet Dump " << std::endl;
00044   BOOST_FOREACH(const reco::GenJet& jet, *jetView) {
00045     output << "Decay mode: " << JetMCTagUtils::genTauDecayMode(jet) << "  "
00046       << jet.print() << std::endl;
00047   }
00048   std::cout << output.str();
00049 }
00050 
00051 #include "FWCore/Framework/interface/MakerMacros.h"
00052 DEFINE_FWK_MODULE(TauGenJetDumper);