ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/ForwardAnalysis/Utilities/interface/HepMCFileReader.h
Revision: 1.1
Committed: Mon Jun 11 12:59:56 2012 UTC (12 years, 10 months ago) by antoniov
Content type: text/plain
Branch: MAIN
CVS Tags: V01-01-01, V01-01-00, antoniov-forwardAnalysis-09Jul2012-v1, antoniov-forwardAnalysis-29Jun2012-v1, V01-00-00, antoniov-utilities-11Jun2012-v1, HEAD
Error occurred while calculating annotation data.
Log Message:
update

File Contents

# Content
1 #ifndef Input_HepMCFileReader_h
2 #define Input_HepMCFileReader_h
3
4 // $Id: HepMCFileReader.h,v 1.1 2012/06/07 19:10:11 antoniov Exp $
5
6 /** \class HepMCFileReader
7 *
8 * This class is used by the implementation of DaqEventFactory present
9 * in this package to read in the full event raw data from a flat
10 * binary file.
11 * WARNING: If you want to use this class for other purposes you must
12 * always invoke the method initialize before starting using the interface
13 * it exposes.
14 *
15 * $Date: 2012/06/07 19:10:11 $
16 * $Revision: 1.1 $
17 * \author G. Bruno - CERN, EP Division
18 */
19
20 #include <vector>
21 #include <map>
22
23
24 namespace HepMC {
25 class IO_BaseClass;
26 class GenEvent;
27 class GenParticle;
28 }
29
30
31 class HepMCFileReader {
32
33 protected:
34 HepMCFileReader();
35
36 public:
37 virtual ~HepMCFileReader();
38 virtual void initialize(const std::string &filename);
39 inline bool isInitialized() const;
40
41 virtual bool setEvent(int event);
42 virtual bool readCurrentEvent();
43 virtual bool printHepMcEvent() const;
44 HepMC::GenEvent *fillCurrentEventData();
45 // virtual bool fillEventData(HepMC::GenEvent *event);
46 // this method prints the event information as
47 // obtained by the input file in HepEvt style
48 void printEvent() const;
49 // get all the 'integer' properties of a particle
50 // like mother, daughter, pid and status
51 // 'j' is the number of the particle in the HepMc
52 virtual void getStatsFromTuple(int &mo1, int &mo2, int &da1, int &da2,
53 int &status, int &pid, int j) const;
54 virtual void ReadStats();
55
56 static HepMCFileReader *instance();
57
58 private:
59 // current HepMC evt
60 HepMC::GenEvent *evt_;
61 HepMC::IO_BaseClass *input_;
62
63 static HepMCFileReader *instance_;
64
65 int rdstate() const;
66 //maps to convert HepMC::GenParticle to particles # and vice versa
67 // -> needed for HepEvt like output
68 std::vector<HepMC::GenParticle*> index_to_particle;
69 std::map<HepMC::GenParticle*,int> particle_to_index;
70 // find index to HepMC::GenParticle* p in map m
71 int find_in_map(const std::map<HepMC::GenParticle*,int>& m,
72 HepMC::GenParticle *p) const;
73 };
74
75
76 bool HepMCFileReader::isInitialized() const
77 {
78 return input_ != 0;
79 }
80
81 #endif