StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
L3_Reader.hh
1 /***************************************************************************
2  *
3  * $Id: L3_Reader.hh,v 1.10 2015/07/29 01:34:57 smirnovd Exp $
4  *
5  * Author: Christof Struck, struck@star.physics.yale.edu
6  ***************************************************************************
7  *
8  * Description: L3_Reader provides interface to access L3 raw data
9  * in a similar way to the other detector readers
10  *
11  *
12  * change log:
13  * 06 Jun 00 CS initial version
14  * 25 Jul 00 CS added i960 cluster reader
15  * 11 Sep 00 CS removed memory leak in L3_Reader
16  *
17  ***************************************************************************
18  *
19  * $Log: L3_Reader.hh,v $
20  * Revision 1.10 2015/07/29 01:34:57 smirnovd
21  * C++11 requires a space between literal and identifier
22  *
23  * Revision 1.9 2001/09/24 21:42:56 struck
24  * cs: changed vertex info to float (unit [cm]) in Bank_L3_GTD
25  *
26  * Revision 1.8 2001/08/20 05:37:45 struck
27  * removed naming conflicts with 'Stl3Utils/foreign/L3Formats.h'
28  *
29  * Revision 1.7 2001/07/17 19:16:11 struck
30  * update to 2001 data format (backwards compatible)Z
31  *
32  * Revision 1.6 2001/06/21 19:24:50 struck
33  * corrected typo in filenames
34  *
35  * Revision 1.5 2000/09/11 16:31:39 struck
36  * removed memory leak in L3_Reader
37  *
38  * Revision 1.4 2000/07/26 02:12:28 struck
39  * added i960 cluster reader
40  *
41  * Revision 1.3 2000/07/06 18:16:01 ward
42  * Install L3 code from Christof Struck.
43  *
44  *
45  **************************************************************************/
46 #ifndef L3_READER_HH
47 #define L3_READER_HH
48 
49 
51 #include <string>
52 #if !defined ST_NO_NAMESPACES
53 using std::string;
54 #endif
55 
56 #include <stdio.h>
57 #include "StDaqLib/GENERIC/EventReader.hh"
58 #include "StDaqLib/GENERIC/RecHeaderFormats.hh"
59 #include "StDaqLib/GENERIC/swaps.hh"
60 #include "StDaqLib/GENERIC/Error.hh"
61 #include "L3_Banks.hh"
62 
64 
65 class Bank_L3_P;
66 class Bank_L3_SUMD;
67 class Bank_L3_GTD;
68 class Bank_L3_SECP;
69 class Bank_L3_SECTP;
70 class Bank_L3_SECCD;
71 class Bank_TPCSECLP;
72 class Bank_TPCRBCLP;
73 class Bank_TPCMZCLD;
74 class Gl3AlgorithmReader;
75 class GlobalTrackReader;
76 class Sl3ClusterReader;
77 class Sl3TrackReader;
78 class L3_Reader;
79 
80 #define L3ERROR(x, text) {errnum = x; sprintf(errstr0,"ERROR: " text " %s::%d",__FILE__,__LINE__); }
81 #define L3secERROR(x, text, s) {errnum = x; sprintf(errstr0,"ERROR: " text " in sector %d, %s::%d",s,__FILE__,__LINE__); }
82 #define pL3secERROR(x, text, s) {mL3->errnum = x; sprintf(mL3->errstr0,"ERROR: " text " in sector %d, %s::%d",s,__FILE__,__LINE__); }
83 
84 #define maxClusterPerSector 100000
85 
86 
87 
88 //##########################################################
89 // -------------- Gl3AlgorithmReader -----------------------
90 //##########################################################
91 
93 
94 public:
96  ~Gl3AlgorithmReader() {};
97 
98  int getNumberofAlgorithms() { return mNAlg; }
99  unsigned int getNumberOfProcessedEvents() { return mNProcessed; }
100  unsigned int getNumberOfReconstructedEvents() { return mNReconstructed; }
101  Algorithm_Data *getAlgorithmData() { return mAlgData; }
102  int initialize();
103 
104 private:
105  Bank_L3_SUMD *mL3SUMD;
106  unsigned int mNProcessed;
107  unsigned int mNReconstructed;
108  int mNAlg;
109  Algorithm_Data *mAlgData;
110 
111  L3_Reader *mL3r;
112 };
113 
114 
115 
116 //##########################################################
117 // -------------- GlobalTrackReader ------------------------
118 //##########################################################
119 
121 
122 public:
123  globalTrack *getTrackList() { return mTracks; }
124  int getNumberOfTracks() { return mNTracks; }
125  int getNumberOfHits() { return mNHits; }
126  vertex getVertex() { return mGlobalVertex; }
127 
128  int initialize();
129 
131  ~GlobalTrackReader() {};
132 
133 private:
134  Bank_L3_GTD *mL3GTD;
135  globalTrack *mTracks;
136  int mNTracks;
137  int mNHits;
138  vertex mGlobalVertex;
139 
140  L3_Reader *mL3;
141 };
142 
143 
144 
145 //##########################################################
146 // ------------- Sl3ClusterReader -------------------------
147 //##########################################################
148 
150 
151 public:
152  L3_Cluster *getClusterList() { return mCluster; }
153  int getNumberOfClusters() { return mNCluster; }
154 
155  int initialize(int sector);
156 
158  ~Sl3ClusterReader() {};
159 
160 private:
161  Bank_L3_SECCD *mL3SECCD;
162  L3_Cluster *mCluster;
163  int mNCluster;
164  int mSector;
165  L3_Reader *mL3;
166 };
167 
168 
169 
170 //##########################################################
171 // ------------- Sl3TrackReader ---------------------------
172 //##########################################################
173 
175 
176 public:
177  localTrack *getLocalTrackList() { return mTracks; }
178  int getNumberOfTracks() { return mNTracks; }
179  int getNumberOfHits() { return mNHits; }
180  int getCpuTime() { return mCpuTime; }
181  int getRealTime() { return mRealTime; }
182  int getParameterSetId() {return mParaSet; }
183  vertex getVertex() { return mSectorVertex; }
184 
185  int initialize(int sector);
186 
188  ~Sl3TrackReader() {};
189 
190 private:
191  Bank_L3_SECTP *mL3SECTP;
192  Bank_L3_LTD *mL3LTD;
193  localTrack *mTracks;
194  int mNTracks;
195  int mNHits;
196  int mCpuTime;
197  int mRealTime;
198  int mParaSet;
199  vertex mSectorVertex;
200  int mSector;
201  L3_Reader *mL3;
202 
203 };
204 
205 
206 
207 //##########################################################
208 //-------------- I960ClusterReader ------------------------
209 //##########################################################
210 
212 
213 public:
214  L3_Cluster *getClusterList() { return mCluster; }
215  int getNumberOfClusters() { return mNCluster; }
216 
217  int initialize(int sector);
218 
221 
222 private:
223  Bank_TPCMZCLD *mBankTPCMZCLD[12][3]; // pointers to banks of one sector
224  L3_Cluster *mCluster;
225  int mNCluster;
226  int mSector;
227  L3_Reader *mL3;
228 
229 };
230 
231 
232 
233 //##########################################################
234 //-------------- L3_Reader --------------------------------
235 //##########################################################
236 
237 class L3_Reader {
238  friend class EventReader;
239 
240 public:
241  L3_Reader(EventReader *er, Bank_L3_P *pL3P);
242  ~L3_Reader();
243 
244  Bank_L3_P *getL3_P() { return mBankL3P; }
245  Bank_L3_SUMD *getL3_SUMD();
246  Bank_L3_GTD *getL3_GTD();
247  Bank_L3_SECP *getL3_SECP(int sector); // numbering conv. sector = 1...24
248  Bank_L3_SECTP *getL3_SECTP(int sector);
249  Bank_L3_SECCD *getL3_SECCD(int sector);
250  Bank_TPCSECLP *getTPCSECLP(int sector);
251  Bank_TPCRBCLP *getTPCRBCLP(int sector, int rb);
252  Bank_TPCMZCLD *getTPCMZCLD(int sector, int rb, int mz);
253  int *getSVT_Bank(int sector); // 1...5 = 4 svt 'sectors' + 1 ssd
254  int *getFTPC_Bank(int sector); // 1...2 = east/west (or west/east??)
255  int *getEMC_Bank();
256 
257  GlobalTrackReader *getGlobalTrackReader();
258  Gl3AlgorithmReader *getGl3AlgorithmReader();
259  Sl3ClusterReader *getSl3ClusterReader(int sector);
260  Sl3TrackReader *getSl3TrackReader(int sector);
261  I960ClusterReader *getI960ClusterReader(int sector);
262 
263  unsigned char getL3PFormatNumber() { return mBankL3P->header.FormatNumber; }
264  unsigned int getTime() { return mTime; }
265  unsigned int getGl3Id() { return mGl3Id; }
266  L3_Summary *getL3_Summary() { return mL3sum; }
267 
268  int errorNo() { return errnum; };
269  string errstr() { return string(errstr0); };
270 
271  int errnum;
272  char errstr0[250];
273 
274 protected:
275  // bank pointer, only pBankL3P is set by the constructor
276  // the sector banks point to the last sector which was asked for
277  Bank_L3_P *mBankL3P;
278  Bank_L3_SUMD *mBankL3SUMD;
279  Bank_L3_GTD *mBankL3GTD;
280  Bank_L3_SECP *mBankL3SECP;
281  Bank_L3_SECCD *mBankL3SECCD;
282  Bank_L3_SECTP *mBankL3SECTP;
283  Bank_TPCSECLP *mBankTPCSECLP;
284  Bank_TPCRBCLP *mBankTPCRBCLP;
285  Bank_TPCMZCLD *mBankTPCMZCLD;
286  // provide pointer to SVT/SSD, FTPC and EMC, nothing else
287  int *mSVT;
288  int *mFTPC;
289  int *mEMC;
290 
291 private:
292  Gl3AlgorithmReader *mAlr;
293  GlobalTrackReader *mGtr;
294  Sl3ClusterReader *mScr;
295  Sl3TrackReader *mStr;
296  I960ClusterReader *mIcr;
297 
298  L3_Summary *mL3sum;
299  unsigned int mGl3Id;
300  unsigned int mTime;
301 
302 
303 };
304 
305 
306 L3_Reader *getL3Reader(EventReader *er);
307 
308 
309 #endif
Definition: rb.hh:21