ProMC  1.3
 All Classes Functions
ProMCBook.h
1 /* ---------------------------------------------------------------------------
2 ** This software is in the public domain, furnished "as is", without technical
3 ** support, and with no warranty, express or implied, as to its usefulness for
4 ** any purpose.
5 **
6 ** A library for HEP events storage and processing based on Google's ProtocolBuffers
7 **
8 ** Author: S.Chekanov (ANL). [email protected]
9 ** Copyright 2012
10 ** -------------------------------------------------------------------------*/
11 
12 
13 #ifndef ProMCBook_H
14 #define ProMCBook_H
15 
16 #include <string>
17 #include <iostream>
18 #include <fstream>
19 #include <iomanip>
20 #include "zipios++/zipios-config.h"
21 #include "zipios++/meta-iostreams.h"
22 #include "zipios++/zipoutputstream.h"
23 #include "zipios++/zipfile.h"
24 #include "zipios++/zipinputstream.h"
25 #include <ctime>
26 #include <iostream>
27 #include <fstream>
28 #include <exception>
29 #include "ProMC.pb.h"
30 #include "ProMCHeader.pb.h"
31 #include "ProMCStat.pb.h"
32 #include "ProMCDescription.pb.h"
33 
34 using namespace promc;
35 using namespace std;
36 using namespace zipios ;
37 
38 
39 
40 using std::cerr ;
41 using std::cout ;
42 using std::endl ;
43 using std::ios ;
44 using std::string ;
45 using std::exception ;
46 using std::istream;
47 using std::ofstream;
48 using std::ifstream;
49 using std::setw;
50 
51 
52 class ProMCBook{
53 public:
54 
55  ProMCBook();
56  ~ProMCBook();
57  ProMCBook(const char* filename, const char * option);
58  void open(const char* filename, const char * option);
59  ProMCEvent get();
60  ProMCEvent event(long idx);
61  int next();
62  int getTimestamp() { return timestamp; };
63  int getVersion() { return version; };
64  string getDescription() { return description; };
65  void setDescription(int events, string s);
66  int getEvents() { return nev; };
67  int getEventsRequested() { return requested_nev; };
68  ProMCHeader getHeader();
69  ProMCStat getStatistics();
70  void setHeader(ProMCHeader h);
71  void setStatistics(ProMCStat h);
72  void close();
73  void write(ProMCEvent e ); // write histogram if any
74  void clear();
75  unsigned int size(); // all size
76  static const int current_version=2;
77 
78 
79 private:
80 
81  int timestamp;
82  int version;
83  string description;
84  ProMCStat hStat;
85  unsigned long nev;
86  unsigned long requested_nev;
87  ZipOutputStream *outzip;
88  ZipInputStream *inpzip;
89  bool isToWrite;
90  ZipFile *zfile;
91 
92 };
93 
94 #endif
Definition: ProMCStat.pb.h:158
Definition: ProMCHeader.pb.h:374
Definition: ProMCBook.h:52
Definition: ProMC.pb.h:316