Fork me on GitHub

source: svn/trunk/external/ProMC/ProMCBook.h@ 1173

Last change on this file since 1173 was 1173, checked in by Pavel Demin, 11 years ago

add external/ProMC

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision Date
File size: 2.3 KB
Line 
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). chekanov@anl.gov
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
34using namespace promc;
35using namespace std;
36using namespace zipios ;
37
38
39
40using std::cerr ;
41using std::cout ;
42using std::endl ;
43using std::ios ;
44using std::string ;
45using std::exception ;
46using std::istream;
47using std::ofstream;
48using std::ifstream;
49using std::setw;
50
51
52class ProMCBook{
53public:
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 void setHeader(ProMCHeader h);
70 void setStatistics(ProMCStat h);
71 void close();
72 void write(ProMCEvent e ); // write histogram if any
73 void clear();
74 unsigned int size(); // all size
75 static const int current_version=2;
76
77
78private:
79
80 int timestamp;
81 int version;
82 string description;
83 ProMCStat hStat;
84 unsigned long nev;
85 unsigned long requested_nev;
86 ZipOutputStream *outzip;
87 ZipInputStream *inpzip;
88 bool isToWrite;
89 ZipFile *zfile;
90
91};
92
93#endif
Note: See TracBrowser for help on using the repository browser.