CMS 3D CMS Logo

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

Generated on Tue Jun 9 17:39:05 2009 for CMSSW by  doxygen 1.5.4