00001 00002 #include "GeneratorInterface/Pythia6Interface/interface/HepMCProductAnalyzer.h" 00003 00004 #include "SimDataFormats/HepMCProduct/interface/HepMCProduct.h" 00005 #include <iostream> 00006 00007 using namespace edm; 00008 using namespace std; 00009 00010 HepMCProductAnalyzer::HepMCProductAnalyzer(const edm::ParameterSet& iConfig) : 00011 label_(iConfig.getUntrackedParameter("moduleLabel",std::string("source"))) 00012 { 00013 //now do what ever initialization is needed 00014 00015 } 00016 00017 00018 HepMCProductAnalyzer::~HepMCProductAnalyzer() 00019 { 00020 00021 // do anything here that needs to be done at desctruction time 00022 // (e.g. close files, deallocate resources etc.) 00023 00024 } 00025 00026 00027 // 00028 // member functions 00029 // 00030 00031 // ------------ method called to produce the data ------------ 00032 void 00033 HepMCProductAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) 00034 { 00035 using namespace edm; 00036 00037 Handle<HepMCProduct> evt; 00038 // iEvent.getByLabel("PythiaSource",evt); 00039 // iEvent.getByLabel("MCFileSource",evt); 00040 00041 // if there is an ambiguity: get by label 00042 // iEvent.getByLabel(label_, evt); 00043 00044 // if no ambiguity one can do get by type 00045 iEvent.getByType(evt); 00046 00047 evt->GetEvent()->print(); 00048 00049 00050 } 00051