00001 // ---------------------------------------------------------------------- 00002 // FlatEGunASCIIWriter.h 00003 // Author: Julia Yarba 00004 // 00005 // This code has been molded after examples in HepMC and HepPDT, and 00006 // after single particle gun example (private contacts with Lynn Garren) 00007 // 00008 // Plus, it uses the ParameterSet funtionalities for "user interface" 00009 // 00010 // ---------------------------------------------------------------------- 00011 00012 #ifndef FlatEGunASCIIWriter_h 00013 #define FlatEGunASCIIWriter_h 00014 00015 // base class 00016 #include "FWCore/Framework/interface/EDAnalyzer.h" 00017 00018 // for local things (data members) 00019 #include <string> 00020 00021 #include "HepPDT/defs.h" 00022 #include "HepPDT/TableBuilder.hh" 00023 #include "HepPDT/ParticleDataTable.hh" 00024 00025 #include "HepMC/GenEvent.h" 00026 #include "HepMC/IO_GenEvent.h" 00027 00028 #include "FWCore/Framework/interface/GeneratedInputSource.h" 00029 #include "FWCore/Framework/interface/ESHandle.h" 00030 #include "FWCore/Framework/interface/EventSetup.h" 00031 00032 namespace edm 00033 { 00034 00035 class FlatEGunASCIIWriter : public edm::EDAnalyzer 00036 { 00037 00038 public: 00039 00040 // The following is not yet used, but will be the primary 00041 // constructor when the parameter set system is available. 00042 // 00043 explicit FlatEGunASCIIWriter( const edm::ParameterSet& ) ; 00044 00045 virtual ~FlatEGunASCIIWriter() ; 00046 00047 virtual void analyze( const edm::Event&, const edm::EventSetup& ); 00048 virtual void beginJob() ; 00049 virtual void beginRun( edm::Run&, const EventSetup& ) ; 00050 00051 private: 00052 00053 00054 // gun particle(s) characteristics 00055 std::vector<int> fPartIDs ; 00056 double fMinEta ; 00057 double fMaxEta ; 00058 double fMinPhi ; 00059 double fMaxPhi ; 00060 double fMinE ; 00061 double fMaxE ; 00062 00063 // the event format itself 00064 HepMC::GenEvent* fEvt; 00065 00066 00067 // HepMC/HepPDT related things 00068 ESHandle<HepPDT::ParticleDataTable> fPDGTable ; 00069 00070 std::string fOutFileName; 00071 HepMC::IO_GenEvent * fOutStream ; 00072 00073 int fCurrentEvent ; // event counter - untill I learn how to get it 00074 // from edm::Event ) EventID ??? or what ?) 00075 00076 }; 00077 00078 } 00079 00080 #endif