CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/IOMC/NtupleConverter/interface/Ntuple2HepMCFiller.h

Go to the documentation of this file.
00001 #ifndef Ntuple2HepMCFiller_H
00002 #define Ntuple2HepMCFiller_H
00003 
00011 #include <iostream>
00012 #include <iomanip>
00013 #include <vector>
00014 #include <fstream>
00015 #include <string>
00016 #include <algorithm>
00017 #include "HepMC/GenEvent.h"
00018 class NtupleROOTFile;
00019 class Ntuple2HepMCFiller {
00020         
00021         protected:
00023         Ntuple2HepMCFiller();
00024         void setInitialized(bool value);        
00025         
00026         public: 
00028         virtual ~Ntuple2HepMCFiller();          
00029         static Ntuple2HepMCFiller * instance(); 
00030         virtual void initialize(const std::string & filename, int id);  
00031         bool isInitialized();
00032         virtual bool setEvent(unsigned int event);
00033         virtual bool readCurrentEvent();
00034         virtual bool printHepMcEvent() const;   
00035         HepMC::GenEvent* fillCurrentEventData();
00036         virtual bool toGenEvent( int evtnum, HepMC::GenEvent* evt );
00037         HepMC::GenParticle* createParticle( int index );
00038         
00039         
00040         
00041         private:
00042         static Ntuple2HepMCFiller * instance_;
00043         // current  HepMC evt
00044         HepMC::GenEvent * evt;
00045         bool initialized_;
00046         NtupleROOTFile* input_;
00047 
00048         // # of particles in evt
00049         int  nParticles;
00050         //maps to convert HepMC::GenParticle to particles # and vice versa
00051         // -> needed for HepEvt like output
00052         std::vector<HepMC::GenParticle*> index_to_particle;  
00053         std::map<HepMC::GenParticle *,int> particle_to_index;   
00054         int evtid;      
00055         int ntpl_id;   
00056         
00057         // find index to HepMC::GenParticle* p in map m
00058         int find_in_map(const std::map<HepMC::GenParticle*,int>& m,
00059         HepMC::GenParticle* p) const;
00060         void buildProductionVertex( int i, 
00061         std::vector<HepMC::GenParticle*>& hepevt_particle, 
00062         HepMC::GenEvent* evt, bool printInconsistencyErrors );                 
00063         int number_children( int index ) ;
00064         int number_parents( int index );
00065 };
00066 
00067 #endif // Ntuple2HepMCFiller_H
00068