StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StTPCReader.h
1 /***************************************************************************
2  *
3  * $Id: StTPCReader.h,v 1.7 2004/03/10 05:59:04 jeromel Exp $
4  *
5  * Author: Victor Perev
6  ***************************************************************************
7  *
8  * Description: Offline Wrapper for DAQ reader classes
9  *
10  ***************************************************************************
11  *
12  * $Log: StTPCReader.h,v $
13  * Revision 1.7 2004/03/10 05:59:04 jeromel
14  * Implement SetSequenceMerging(). See comment in St_tpcdaq_Maker
15  *
16  * Revision 1.6 2004/03/04 21:51:27 ward
17  * Replaced MERGE_SEQUENCES with a StDAQMaker chain parameter, as suggested by Landgraf and Lauret.
18  *
19  * Revision 1.5 2004/01/23 16:06:43 jeromel
20  * Added friend class for FCF
21  *
22  * Revision 1.4 2003/04/29 16:22:44 perev
23  * non TPCoriented cleanup
24  *
25  * Revision 1.3 2002/10/13 20:43:36 ward
26  * Support for decoding DAQ100 data and writing it into a table.
27  *
28  * Revision 1.2 2000/07/13 22:29:52 perev
29  * Return kStErr when TPC data is not in event.
30  *
31  * Revision 1.1 2000/06/12 15:12:27 perev
32  * SVT + cleanup
33  *
34  *
35  *
36  **************************************************************************/
37 #ifndef _StTPCReader_
38 #define _StTPCReader_
39 
40 #ifndef __CINT__
41 #include "StDAQReader.h"
42 
43 #endif /*__CINT__*/
44 
45 
46 // Forward declarations
47 struct EventInfo;
48 typedef EventInfo DAQEventInfo;
49 class EventReader;
50 class DetectorReader;
52 class ADCRawReader;
53 class PedestalReader;
54 class PedestalRMSReader;
55 class GainReader;
56 class CPPReader;
57 class BadChannelReader;
58 class RICH_Reader;
59 //
60 
61 
62 typedef struct TPCSequence
63 {
64  unsigned short startTimeBin;
65  unsigned short Length;
66  unsigned char *FirstAdc;
67 
69 
70 typedef struct TPCCluster
71 {
72  short start_time_bin;
73  short stop_time_bin;
74 }TPCCluster;
75 
76 
77 
78 typedef struct TPCGain
79 {
80  int t0; // t0 * 16
81  int t0_rms; // t0_rms * 16
82  int rel_gain; // rel_gain * 64
83 }TPCGain;
84 
85 class StTPCReader;
86 class StFTPCReader;
87 
88 
90 {
91  friend class St_tpcdaq_Maker; // Herb Oct 2002 for DAQ100, for access to ptrTPCP.
92  friend class StRTSClientFCFMaker; // allow RTSClient to access ptrTPCP
93  public:
94 
95  StTPCReader(StDAQReader *rd,char);
96  ~StTPCReader();
97  int close();
98  int empty();
99 
100  int getMaxPad(int PadRow) const; //Number of pads in padrow
101 
102  int getPadList(int Sector, int PadRow, unsigned char *&padList);
103  // Fills (*padList[]) with the list of pad numbers containing hits
104  // returns number of pads in (*padList)[]
105  // or negative if call fails
106 
107  int getSequences(int Sector, int PadRow, int Pad, int &nSeq,
108  TPCSequence *&SeqData);
109  // Fills (*SeqData)[] along with the ADC
110  // buffers pointed to by (*SeqData)[]
111  // Set nSeq to the # of elements in the (*SeqData)[] array
112  // returns 0 if OK.
113  // or negative if call fails
114 
115  int getRawADC(int Sector,int PadRow, int Pad, int &nArray,
116  unsigned char *&Array);
117  // Fills (*Array)[] with Raw data
118  // Fills nArray with the # of elements in (*Array)[] (512 bytes / TPC)
119  // returns 0 if OK.
120  // returns negative if call fails
121 
122 
123  int getPedestals(int Sector,int PadRow, int Pad, int &nArray,
124  unsigned char *&Array);
125 
126  // Fills (*Array)[] with Pedestal data
127  // Fills nArray with the # of elements in Array (512 bytes for TPC)
128  // returns 0 if OK.
129  // returns negative if call fails
130 
131 
132  int getRMSPedestals(int Sector,int PadRow, int Pad, int &nArray,
133  unsigned char *&Array);
134 
135  // Fills (*Array)[] with Pedestal RMS data * 16
136  // Fills nArray with the # of elements in (*Array)[] (512 bytes / TPC)
137  // returns 0 if OK.
138  // returns negative if call fails
139 
140 
141  int getGain(int Sector, int PadRow, int Pad, TPCGain *&gain);
142  // sets (*gain) to a valid gain structure pointer
143  // returns 0 if OK
144  // returns negative if call fails
145 
146 
147 // int getMeanGain();
148  // returns mean gain
149 
150 // int getGainEvents();
151  // returns the number of events the calculation is based upon
152 
153  int getClusters(int Sector, int PadRow, int Pad, int &nClusters,
154  TPCCluster *&clusters);
155  // sets (*clusters) to beginning of array of clusters
156  // sets nClusters to the length of the array
157  // returns 0 if OK
158  // returns negative if call fails
159 
160  int IsBad(int Sector, int PadRow, int Pad);
161  // returns true if the pad is bad.
162  // returns false if the pad is not bad.
163 
164  int Update();
165 
166  void SetSequenceMerging (char);
167 
168 protected:
169  int setSector(int sector);
170 
171  StDAQReader *fDAQReader;
172  DetectorReader *fTPCImpReader;
173  ZeroSuppressedReader *fZeroSuppressedReader;
174  ADCRawReader *fADCRawReader;
175  PedestalReader *fPedestalReader;
176  PedestalRMSReader *fPedestalRMSReader;
177  GainReader *fGainReader;
178  CPPReader *fCPPReader;
179  BadChannelReader *fBadChannelReader;
180 
181 private:
182  char mMergeSequences;
183  void *ptrTPCP; // Herb Oct 2002 for DAQ100.
184 
185  int fSector;
186 };
187 
188 #endif
void rd(int hits=0, bool clear=false)
This function redraws all hits and/or tracks from the current event.
Definition: Ed.C:69