00001 #ifndef FastSimulation_PileUpProducer_PileUpProducer_H 00002 #define FastSimulation_PileUpProducer_PileUpProducer_H 00003 00004 #include "FWCore/Framework/interface/EDProducer.h" 00005 00006 #include <vector> 00007 #include <string> 00008 #include <fstream> 00009 00010 class ParameterSet; 00011 class Event; 00012 class EventSetup; 00013 00014 class TFile; 00015 class TTree; 00016 class TBranch; 00017 class PUEvent; 00018 00019 class PrimaryVertexGenerator; 00020 class RandomEngine; 00021 00022 class PileUpProducer : public edm::EDProducer 00023 { 00024 00025 public: 00026 00027 explicit PileUpProducer(edm::ParameterSet const & p); 00028 virtual ~PileUpProducer(); 00029 virtual void beginJob(const edm::EventSetup & c); 00030 virtual void endJob(); 00031 virtual void produce(edm::Event & e, const edm::EventSetup & c); 00032 00033 private: 00034 00036 void save(); 00037 00039 bool read(std::string inputFile); 00040 00041 private: 00042 00043 PrimaryVertexGenerator* theVertexGenerator; 00044 00045 double averageNumber_; 00046 const RandomEngine* random; 00047 std::vector<std::string> theFileNames; 00048 std::string inputFile; 00049 unsigned theNumberOfFiles; 00050 00051 std::vector<TFile*> theFiles; 00052 std::vector<TTree*> theTrees; 00053 std::vector<TBranch*> theBranches; 00054 std::vector<PUEvent*> thePUEvents; 00055 std::vector<unsigned> theCurrentEntry; 00056 std::vector<unsigned> theCurrentMinBiasEvt; 00057 std::vector<unsigned> theNumberOfEntries; 00058 std::vector<unsigned> theNumberOfMinBiasEvts; 00059 00060 std::ofstream myOutputFile; 00061 unsigned myOutputBuffer; 00062 00063 }; 00064 00065 #endif