StRoot
1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
StDaqLib
RICH
RichEventReader.hh
1
/***************************************************************************
2
* $Id: RichEventReader.hh,v 1.3 2003/12/24 21:55:57 perev Exp $
3
* Author: Zhangbu Xu
4
***************************************************************************
5
* Description: definition for Rich Standalone event reader
6
*
7
*
8
* change log
9
* 06-June-99 MJL added EventInfo struct, changed method getEventInfo()
10
* 06-June-99 MJL added printEventInfo()
11
* 17-June-99 Herb Ward changed the dimension of errstr0 from 50 to 250
12
* 23-Jun-99 MJL add verbose flag and setVerbose() method
13
* 25-Jun-99 MJL added TPCV2P0_CPP_SR::getAsicParams(ASIC_params *);
14
* 09-Jul-99 MJL added EventReader::findBank()
15
* 20-Jul-99 MJL added EventReader::fprintError()
16
* 20-Jul-99 MJL add alternate getEventReader with name of logfile
17
* 20-Jul-99 MJL add overloaded printEventInfo(FILE *)
18
* 28-Dec-99 MJL add alternate InitEventReaders, mapped and unmapped
19
* 31-Jan-00 MJL change to #if !defined ST_NO_NAMESPACES
20
* 21-Apr-00 Adopted by Z. Xu to read Rich standalone events
21
*
22
***************************************************************************
23
* $Log: RichEventReader.hh,v $
24
* Revision 1.3 2003/12/24 21:55:57 perev
25
* Cleanup
26
*
27
* Revision 1.2 2003/09/02 17:55:32 perev
28
* gcc 3.2 updates + WarnOff
29
*
30
* Revision 1.1 2000/04/25 14:55:28 xzb
31
* Clean up RICH_Reader array, add RichEventReader for standalone data file
32
*
33
* Revision 1.10 2000/02/15 23:24:27 fisyak
34
* Force to compile StPadMonitorMaker
35
*
36
* Revision 1.9 2000/01/31 19:38:51 levine
37
* chamge to #if !defined ST_NO_NAMESPACES
38
*
39
* Revision 1.8 2000/01/11 22:04:40 levine
40
* EventReader.hh // change the header file to include std::string
41
* EventReader.cxx // convert string to char* via c_str() member
42
* (changes from Brian Lasiuk)
43
*
44
* Revision 1.7 2000/01/04 20:54:47 levine
45
* Implemented memory-mapped file access in EventReader.cxx. Old method
46
* (via seeks) is still possible by setting mmapp=0 in
47
*
48
* getEventReader(fd,offset,(const char *)logfile,mmapp);
49
*
50
*
51
* but memory-mapped access is much more effective.
52
*
53
* Revision 1.6 1999/07/26 17:00:03 levine
54
* changes to RICH file organization
55
*
56
* Revision 1.5 1999/07/21 21:33:08 levine
57
*
58
*
59
* changes to include error logging to file.
60
*
61
* There are now 2 constructors for EventReader:
62
*
63
* EventReader();
64
* EventReader(const char *logfilename);
65
*
66
* Constructed with no argument, there is no error logging. Supplying a file name
67
* sends all diagnostic output to the named file (N.B. opens in append mode)
68
*
69
* See example in client.cxx for constructing a log file name based on the
70
* datafile name.
71
*
72
* It is strongly advised to use the log file capability. You can grep it for
73
* instances of "ERROR:" to trap anything noteworthy (i.e., corrupted data files).
74
*
75
* Revision 1.4 1999/07/10 21:31:17 levine
76
* Detectors RICH, EMC, TRG now have their own (defined by each detector) interfaces.
77
* Existing user code will not have to change any calls to TPC-like detector
78
* readers.
79
*
80
* Revision 1.3 1999/07/02 04:37:41 levine
81
* Many changes - see change logs in individual programs
82
*
83
*
84
**************************************************************************/
85
#ifndef RICHEVENTREADER_HH
86
#define RICHEVENTREADER_HH
87
88
#include <
Stiostream.h
>
89
90
#include <sys/types.h>
91
92
#include <string>
93
#if !defined ST_NO_NAMESPACES
94
using
std::string;
95
#endif
96
97
#include "StDaqLib/GENERIC/RecHeaderFormats.hh"
98
#include "StDaqLib/GENERIC/Error.hh"
99
100
#define TRUE 1
101
#define FALSE 0
102
103
104
105
// Event Reader header files
106
// This file is included by Offline programs
107
108
class
RichEventReader
;
109
110
// Support Structures
111
112
113
// Event Reader Class
114
class
RichEventReader
115
{
116
public
:
117
RichEventReader
();
118
119
void
InitEventReader(
int
fd,
long
offset,
int
mmap);
120
// takes open file descripter-offset
121
// works on MAPPED file
122
void
InitEventReader(
int
fd,
long
offset);
123
124
long
NextEventOffset();
125
void
setVerbose(
int
);
// 0 turns off all internal printout
126
char
* findBank(
const
char
*bankid);
// navigates to pointer bnk below DATAP
127
int
verbose;
128
129
~
RichEventReader
();
130
131
char
*getDATAP() {
return
DATAP
; };
132
struct
EventInfo
getEventInfo();
133
void
printEventInfo(FILE *fd = stdout);
134
void
fprintError(
int
err,
char
*file,
int
line,
char
*userstring);
135
136
int
runno() {
return
runnum; }
137
int
errorNo() {
return
errnum; };
138
string
errstr() {
return
string(errstr0); };
139
FILE *logfd;
//file handle for log file
140
char
err_string[MX_MESSAGE][30];
141
142
int
MemUsed();
143
144
protected
:
145
char
*
DATAP
;
// Pointer to the memory mapped buffer
146
int
event_size;
147
148
private
:
149
int
fd;
// -1 if the event is in memory
150
char
*MMAPP;
// Begining of memory mapping
151
152
long
next_event_offset;
153
154
int
errnum;
155
char
errstr0[250];
156
int
runnum;
157
// later storage for detector buffers
158
};
159
160
161
// Declaration for the factories
162
RichEventReader
*getRichEventReader(
int
fd,
long
offset,
int
MMap=1);
163
164
#endif
RichEventReader
Definition:
RichEventReader.hh:114
EventInfo
Definition:
EventReader.hh:153
Stiostream.h
DATAP
Definition:
daqFormats.h:463
Generated by
1.8.5