StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StDAQReader.cxx
1 /***************************************************************************
2  *
3  * $Id: StDAQReader.cxx,v 1.88 2012/09/13 20:01:49 fisyak Exp $
4  *
5  * Author: Victor Perev
6  ***************************************************************************
7  *
8  * Description: Offline Wrapper for DAQ reader classes
9  *
10  ***************************************************************************
11  *
12  * $Log: StDAQReader.cxx,v $
13  * Revision 1.88 2012/09/13 20:01:49 fisyak
14  * Clean up, use Jeff's skip_then_get
15  *
16  * Revision 1.87 2010/01/25 17:17:10 fine
17  * Remove the redundant RecordSize method
18  *
19  * Revision 1.86 2010/01/15 21:26:50 fine
20  * RT #1816. Eliminate the side effect from RT 1803 fix
21  *
22  * Revision 1.85 2010/01/06 20:42:26 fine
23  * Fix type EventNumber shoould be RunNumber . Thanks Akio
24  *
25  * Revision 1.84 2010/01/06 20:09:38 fine
26  * RT #1794. Add EventNumber method to the StStreamFile interface RT # 1794
27  *
28  * Revision 1.83 2009/11/02 21:42:52 fine
29  * allow the Akio DAT file to be read in 1999-2008 format
30  *
31  * Revision 1.82 2009/10/13 19:32:44 fine
32  * Re-Activate DAQ reader
33  *
34  * Revision 1.81 2009/10/13 15:51:48 fine
35  * Activate the new DAT file format
36  *
37  * Revision 1.80 2009/10/07 23:21:56 fine
38  * Move the StRtsReaderMaker instantiation fro StDAQReader to StDAQMaker to make sure it is located just after StDAQMaker in chain
39  *
40  * Revision 1.79 2009/10/07 00:52:31 fine
41  * Move daqReader instantiation from StDAQMaker to StDAQReader to switch between input files properly
42  *
43  * Revision 1.78 2009/08/08 18:04:03 fine
44  * Add Event num / Run num to the error message
45  *
46  * Revision 1.77 2009/04/06 18:22:33 fine
47  * remove the redundant methods and fix L1/L2/L3 summary
48  *
49  * Revision 1.76 2009/03/27 23:07:33 fine
50  * Pick the SC data via the new DAQ READER
51  *
52  * Revision 1.75 2009/01/23 00:09:54 fine
53  * restore the missed EventInfo. Should fix bug 1376, 1377
54  *
55  * Revision 1.74 2009/01/14 18:20:49 fine
56  * Remove the redundant devReader type
57  *
58  * Revision 1.73 2009/01/14 17:04:05 fine
59  * Fix bug 1357
60  *
61  * Revision 1.72 2009/01/08 23:58:07 fine
62  * Pick the token info from the new reader
63  *
64  * Revision 1.71 2009/01/08 23:41:25 fine
65  * Fill the Event Header from the new daqReader if available
66  *
67  * Revision 1.70 2009/01/08 22:14:46 fine
68  * teach EventReader tp provide the new daqReader pointer
69  *
70  * Revision 1.69 2009/01/05 17:55:36 fine
71  * Fix datap issue with the newest DAQ files
72  *
73  * Revision 1.68 2008/11/26 18:01:29 fine
74  * prepare StRtsReaderMaker for DAQ_READER transition
75  *
76  * Revision 1.67 2008/11/25 21:42:53 fine
77  * preparing DAQ maker for DAQ_READER
78  *
79  * Revision 1.66 2008/10/01 18:12:19 fine
80  * Adjust the code to satisfy the new evpReader interface
81  *
82  * Revision 1.65 2008/06/09 16:11:34 fine
83  * restore the DATAP summary information if needed. Thanx Jeff
84  *
85  * Revision 1.64 2008/03/11 15:10:47 fine
86  * adjust evpReaderClass header file
87  *
88  * Revision 1.63 2008/03/06 01:32:51 fine
89  * Fix skip event problem
90  *
91  * Revision 1.62 2008/02/08 15:38:50 fine
92  * Add CPP flag to distinguish the old and new EVP_READER at the compilation time. Thankx Lidia
93  *
94  * Revision 1.61 2008/02/07 22:06:35 fine
95  * return the correct run number with the new EVP_READER. Tnx Fisyak
96  *
97  * Revision 1.60 2008/02/01 15:00:31 fine
98  * Fix the compilation problem
99  *
100  * Revision 1.59 2008/02/01 01:23:24 fine
101  * Add the message
102  *
103  * Revision 1.58 2008/02/01 01:20:57 fine
104  * :fix the buffer size for DATAP
105  *
106  * Revision 1.57 2008/01/22 21:13:01 fine
107  * move the dependency from the class desclaration to class implematation to allo for the new EVP_READER
108  *
109  * Revision 1.56 2008/01/10 01:27:56 fine
110  * set the correct buffer size
111  *
112  * Revision 1.55 2008/01/06 02:58:32 fine
113  * clean up
114  *
115  * Revision 1.54 2008/01/06 02:55:21 fine
116  * treat new DAQ EOF issue properly
117  *
118  * Revision 1.53 2008/01/06 01:48:01 fine
119  * fix missuse of the tot_bytes member use bytes instead
120  *
121  * Revision 1.52 2007/12/24 05:19:58 fine
122  * Introduce the shadow copy of the evp buffer for the new EVP_READER
123  *
124  * Revision 1.51 2007/12/23 03:04:26 fine
125  * Add the debug print puts to traceDAQ file problem
126  *
127  * Revision 1.50 2007/12/22 01:14:58 fine
128  * version compatible with new/old DAQ readers
129  *
130  * Revision 1.49 2007/08/07 19:44:10 perev
131  * Gene scalers added
132  *
133  * Revision 1.48 2007/05/29 22:12:18 fine
134  * Introduce logger-based output
135  *
136  * Revision 1.47 2007/04/24 17:10:57 akio
137  * correct byte swapping issue
138  *
139  * Revision 1.46 2004/11/11 19:58:14 jeromel
140  * Added thereIsTriggerData() check and logic for return kStErr (BT 478)
141  *
142  * Revision 1.45 2004/09/10 22:07:44 perev
143  * more defence agains corrupted DAQ data
144  *
145  * Revision 1.44 2004/08/07 02:39:00 perev
146  * Traditional Clear added
147  *
148  * Revision 1.43 2004/03/04 21:51:27 ward
149  * Replaced MERGE_SEQUENCES with a StDAQMaker chain parameter, as suggested by Landgraf and Lauret.
150  *
151  * Revision 1.42 2004/02/18 20:17:44 ward
152  * Access SSD data in makers.
153  *
154  * Revision 1.41 2004/02/04 01:39:43 jeromel
155  * Minor change (forgot a \n)
156  *
157  * Revision 1.40 2004/02/03 03:25:06 jeromel
158  * Added counter for ZeroToken events
159  *
160  * Revision 1.39 2004/02/02 20:21:42 ward
161  * Passing Token 0 events, on request of J. Lauret.
162  *
163  * Revision 1.38 2003/12/24 21:30:45 perev
164  * Cleanup of DAQ
165  *
166  * Revision 1.37 2003/09/28 01:54:58 jeromel
167  * Missing one zero
168  *
169  * Revision 1.36 2003/07/16 19:58:29 perev
170  * Cleanup of StTriggerData2003 at all
171  *
172  * Revision 1.35 2003/05/15 19:25:47 jeromel
173  * Missing Update() ??
174  *
175  * Revision 1.34 2003/05/14 18:25:08 perev
176  * Remove error for No TPC
177  *
178  * Revision 1.33 2003/04/22 20:12:42 ward
179  * So the chain can run when there is no TPC data.
180  *
181  * Revision 1.32 2003/03/24 18:12:10 ward
182  * Full support for EEMC from Herbert Ward.
183  *
184  * Revision 1.31 2003/02/16 16:02:49 perev
185  * new method added
186  *
187  * Revision 1.30 2002/12/19 22:28:19 perev
188  * PMD added
189  *
190  * Revision 1.29 2002/01/17 21:14:38 perev
191  * Akio FPD reader
192  *
193  * Revision 1.28 2001/07/16 21:38:44 perev
194  * EMC added
195  *
196  * Revision 1.27 2001/07/10 18:13:04 jeromel
197  * Changes commited for Frank Geurts (TOF) after approval from Herb Ward
198  * on Tue, 10 Jul 2001 11:19:48 and review by Victor.
199  * Changes implements TOF DAQ Reader.
200  *
201  * Revision 1.26 2001/06/19 21:10:26 jeromel
202  * Changes for FTPCReader (Janet S.)
203  *
204  * Revision 1.25 2001/03/20 01:43:14 perev
205  * first event skip fixed
206  *
207  * Revision 1.24 2001/01/03 23:08:35 perev
208  * Skip over EOF added
209  *
210  * Revision 1.23 2000/09/13 17:02:09 perev
211  * add delete of L3Reader in close
212  *
213  * Revision 1.22 2000/08/28 22:19:10 ward
214  * Skip corrupted events. StDaqLib/GENERIC/EventReader.cxx & StDAQMaker/StDAQReader.cxx.
215  *
216  * Revision 1.21 2000/07/13 22:29:52 perev
217  * Return kStErr when TPC data is not in event.
218  *
219  * Revision 1.20 2000/07/08 22:53:39 perev
220  * next offset before error return
221  *
222  * Revision 1.19 2000/07/06 20:39:28 fisyak
223  * Herb correction for Token '0' events
224  *
225  * Revision 1.18 2000/06/30 21:53:40 perev
226  * L3 stuff added
227  *
228  * Revision 1.17 2000/06/27 23:56:47 perev
229  * Helen DAQ SVT update
230  *
231  * Revision 1.16 2000/06/12 15:04:02 perev
232  * SVT + cleanup
233  *
234  * Revision 1.15 2000/05/25 20:01:58 perev
235  * EventSize added
236  *
237  * Revision 1.14 2000/04/07 15:43:18 perev
238  * SetVerbose method added
239  *
240  * Revision 1.13 2000/02/03 23:19:11 fisyak
241  * Reduce file map size
242  *
243  * Revision 1.12 2000/01/24 20:35:37 ward
244  * Access trigger data.
245  *
246  * Revision 1.11 2000/01/24 14:39:27 perev
247  * FTPC (HolmMade) is added
248  *
249  * Revision 1.10 1999/12/15 18:40:59 perev
250  * Keep undeleted all DAQ wrapper classes
251  *
252  * Revision 1.9 1999/09/24 01:22:52 fisyak
253  * Reduced Include Path
254  *
255  * Revision 1.8 1999/09/10 16:35:38 fine
256  * The oreder of deleting object has been changed to avoid crash in StDaqLib
257  *
258  * Revision 1.7 1999/08/19 22:28:40 perev
259  * fix Skip & EventNumber
260  *
261  * Revision 1.6 1999/08/10 00:28:50 fisyak
262  * Herb/Victor corrects for errors
263  *
264  * Revision 1.5 1999/08/06 16:20:58 perev
265  * RICHReader added
266  *
267  * Revision 1.4 1999/08/01 00:14:49 perev
268  * leak removed author added
269  *
270  * Revision 1.3 1999/08/01 00:09:07 perev
271  * leak removed author added
272  *
273  **************************************************************************/
274 #include "Stypes.h"
275 
276 // non standard open,close,read
277 #include <string.h>
278 #include <stdio.h>
279 #include <errno.h>
280 #include <unistd.h>
281 #include <assert.h>
282 #include <sys/types.h>
283 #include <sys/stat.h>
284 #include <fcntl.h>
285 #include "Stypes.h"
286 #include "StMessMgr.h"
287 #include "StDAQReader.h"
288 
289 #include "StDaqLib/GENERIC/EventReader.hh"
290 # include "RTS/src/DAQ_READER/daqReader.h"
291 
292 #include "StDaqLib/RICH/RICH_Reader.hh"
293 #include "StDaqLib/L3/L3_Reader.hh"
294 #include "StDaqLib/TOF/TOF_Reader.hh"
295 #include "StDaqLib/FPD/FPD_Reader.hh"
296 
297 #include "StTPCReader.h"
298 #include "StEMCReader.h"
299 #include "StSSDReader.h"
300 #include "StEEMCReader.h"
301 #include "StPMDReader.h"
302 #include "StFTPCReader.h"
303 #include "StTRGReader.h"
304 #include "StSVTReader.h"
305 #include "StMessMgr.h"
306 #include "TString.h"
307 #include "StRtsReaderMaker.h"
308 #include "StStreamFileFactory.h"
309 #include "StStreamFile.h"
310 
311 //
312 
313 
314 typedef EventInfo DAQEventInfo;
315 //_____________________________________________________________________________
316 StDAQReader::StDAQReader(const char *file, StRtsReaderMaker* rtsMaker) :
317  fRtsMaker(rtsMaker)
318  {
319  fFd = -1;
320  fVerbose = 0;
321  fEventReader = 0;
322  fTPCReader = 0;
323  fEMCReader = 0;
324  fSSDReader = 0;
325  fEEMCReader = 0;
326  fPMDReader = 0;
327  fFTPCReader = 0;
328  fRICHReader = 0;
329  fTRGReader = 0;
330  fSVTReader = 0;
331  fL3Reader = 0;
332  fTOFReader = 0;
333  fFPDReader = 0;
334  m_ZeroTokens = 0;
335  fOffset = 0;
336  fFile = 0;
337  fEventInfo = new DAQEventInfo;
338  memset(fEventInfo,0,sizeof(DAQEventInfo));
339  assert(sizeof(DAQEventInfo)==sizeof(EventInfo));
340  setTPCVersion();
341  setFTPCVersion();
342  fTrigSummary = new StTrigSummary();
343  fDaqFileReader = 0;
344  fDatFileReader = 0;
345  fDATAP = 0;
346  if(file && file[0]) open(file);
347 }
348 
349 //_____________________________________________________________________________
350 int StDAQReader::open(const char *file)
351 {
352  assert(file);
353  if (!fRtsMaker) fRtsMaker = new StRtsReaderMaker;
354  if (StStreamFileFactory::Factory()) {
355  // check the file extension.
356  const char *dat_ext= ".dat";
357  LOG_INFO << " StDAQReader::open(const char *file): " << file << " - "
358  << (const char*)&file[strlen(file)-sizeof(dat_ext)]
359  << " len=" << strlen(file)
360  << " size=" << sizeof(dat_ext)
361  << fDatFileReader << endm;
362  if (TString(dat_ext) == (const char*)&file[strlen(file)-sizeof(dat_ext)] && !fDatFileReader) {
363  fDatFileReader = StStreamFileFactory::Factory()->Create();
364  fRtsMaker->SetDatReader(fDatFileReader);
365  }
366  }
367  if (fDatFileReader) {
368  fDatFileReader->open(file);
369  } else {
370  if (fDaqFileReader) close();
371  fDaqFileReader = new daqReader((char *)file);
372  fRtsMaker->SetDaqReader(fDaqFileReader);
373  }
374  LOG_INFO << "StDAQReader::open the DAQ " << file << " via "
375  << (fDatFileReader ? "DAT reader ->" : "" ) << fDatFileReader
376  << (fDaqFileReader ? "daqReader ->" : "") << fDaqFileReader
377  << endm;
378  fOffset =0;
379  return 0;
380 }
381 //_____________________________________________________________________________
382 void StDAQReader::clear()
383 {
384  delete fEventReader; fEventReader = 0;
385 }
386 //_____________________________________________________________________________
387 int StDAQReader::close()
388 {
389  if (fDaqFileReader ) {
390  delete fDaqFileReader;
391  fDaqFileReader = 0;
392  } else if (fDatFileReader) {
393  fDatFileReader->close();
394  }
395  if (fRtsMaker) {
396  fRtsMaker->SetDaqReader(0);
397  }
398  delete fEventReader; fEventReader = 0;
399 
400  if(fTPCReader) fTPCReader ->close();
401  if(fSSDReader) fSSDReader ->close();
402  if(fEMCReader) fEMCReader ->close();
403  if(fEEMCReader) fEEMCReader->close();
404  if(fPMDReader) fPMDReader ->close();
405  if(fSVTReader) fSVTReader ->close();
406 //if (fRICHReader) fRICHReader->close();
407  if(fFTPCReader) fFTPCReader->close();
408  if(fTRGReader) fTRGReader ->close();
409  delete fL3Reader; fL3Reader = 0;
410  fOffset = -1;
411  return 0;
412 }
413 //_____________________________________________________________________________
414 StDAQReader::~StDAQReader()
415 {
416  if (m_ZeroTokens > 1){
417  LOG_WARN << m_ZeroTokens << " events with token==0" << endm;
418  }
419  free(fDATAP);
420  fDATAP = 0;
421  close();
422  delete fDatFileReader; fDatFileReader=0;
423 }
424 //_____________________________________________________________________________
427 {
428  // Create the next event from evp data
429  // qDebug() << " StEvpReader::NextEvent() - fEventType = " << fEventType;
430  char *currentData = fDaqFileReader->get(0,EVP_TYPE_ANY); // EventNumber(),fEventType);
431  LOG_DEBUG << " StEvpReader::NextEvent - data = "
432  << (void *)currentData <<" :: " << fDaqFileReader
433  << " status " << fDaqFileReader->status << " EVP_STAT_OK=" << EVP_STAT_OK
434  << " token " << fDaqFileReader->token
435  << endm
436  ;
437 
438  fOffset = -1;
439  if(currentData && (fDaqFileReader->status == EVP_STAT_OK) ) {
440  fOffset = 1;
441  } else { // event is not valid
442  /* STAT_EOR is end of run. In the case of reading from files, it means end of the file.
443  STAT_EVT is an error or corrupt event. The next event can still be read but this one is junk
444  STAT_CRIT is an error that prevents us from reading more events... */
445  switch(fDaqFileReader->status) {
446  case EVP_STAT_EOR : // EOR or EOR - might contain token 0!
447  if(fDaqFileReader->IsEvp()) { // keep going until the next run...
448  LOG_FATAL << "StEvpReader::NextEvent - waiting event" << endm;
449  nextEvent();
450  } else {
451  LOG_DEBUG << "StEvpReader::NextEvent - End Of File" << endm;
452  }
453  break;
454  case EVP_STAT_EVT :
455  LOG_ERROR << "Problem getting event - skipping" << endm;
456  nextEvent();
457  break;
458  case EVP_STAT_CRIT :
459  LOG_ERROR << "Critical error - halting..." << endm;
460  nextEvent();
461  break;
462  default:
463  LOG_FATAL << "Unknow DAQ file I/O problem " << endm;
464  };
465  }
466  fEventStatus = fDaqFileReader->status;
467  }
468 //_____________________________________________________________________________
469 int StDAQReader::Make()
470 {
471  int ret = readEvent();
472  if (fRtsMaker) fRtsMaker->Make();
473  return ret;
474 }
475 //_____________________________________________________________________________
476 int StDAQReader::readEvent()
477 {
478  int retStatus = kStOk;
479 
480  if (fDatFileReader) {
481  fDatFileReader->Read();
482  if (!fDatFileReader->good()) {
483  fOffset = -1;
484  retStatus = kStErr;
485  if (fDatFileReader->eof() ) retStatus = kStEOF;
486  }
487  } else if (fDaqFileReader) {
488  nextEvent();
489  if (fOffset == -1) retStatus = kStEOF;
490  }
491 
492  delete fEventReader; fEventReader=0;
493  delete fRICHReader; fRICHReader = 0;
494  delete fL3Reader; fL3Reader = 0;
495  delete fTOFReader; fTOFReader = 0;
496  delete fFPDReader; fFPDReader = 0;
497  if (retStatus == kStOk) {
498  fEventReader = new EventReader();
499  fEventReader->setVerbose(fVerbose);
500 
501  fEventReader->setDaqReader(fDaqFileReader);
502  if (fDaqFileReader) {
503  if (fDaqFileReader->mem) {
504  //
505  // the buffer of the new EVP_READER is mmap read-only file.
506  // This means one can not chnage the buffer the kind of thing
507  // the current STAR StDaqLib relies on.
508  // To fix the issue we have to create the memory resided copy of the buffer
509  // vf 26.12.2007
510 # if 1
511  fDATAP = (char *)realloc(fDATAP, fDaqFileReader->bytes);
512  memcpy(fDATAP,fDaqFileReader->mem, fDaqFileReader->bytes);
513  // Fix the DATAP Summary data
514  fDaqFileReader->fixDatapSummary((DATAP*)fDATAP);
515 # else
516  fDATAP = (char *)realloc(fDATAP, fDaqFileReader->bytes_mapped);
517  memcpy(fDATAP,fDaqFileReader->mem, fDaqFileReader->bytes_mapped);
518 # endif
519  fEventReader->InitEventReader(fDATAP);
520  *fEventInfo = fEventReader->getEventInfo();
521  if(fEventInfo->Token==0){
522  LOG_INFO <<
523  Form("StDAQReader::readEvent: found event with token==0") << endm;
524  m_ZeroTokens++;
525  // return kStErr; // Herb, July 5 2000
526  }
527  }
528  else if(fDaqFileReader && fDaqFileReader->token==0){
529  LOG_INFO <<
530  Form("StDAQReader::readEvent: found event with token==0") << endm;
531  m_ZeroTokens++;
532  }
533  if (fTPCReader && TPCPresent() ) fTPCReader ->Update();
534  if (fFTPCReader && FTPCPresent()) fFTPCReader->Update();
535  if (fTRGReader && TRGPresent() ) {
536  fTRGReader ->Update();
537  if ( ! fTRGReader->thereIsTriggerData() ){
538  LOG_INFO <<
539  Form("StDAQReader::readEvent: No or bad TRG data - Skipping event: ")
540  << getRunNumber() << " : " <<getEventNumber()<< endm;
541  return kStErr;
542  }
543  }
544  if (fSVTReader && SVTPresent() ) fSVTReader ->Update();
545  if (fSSDReader && SSDPresent() ) fSSDReader ->Update();
546  if (fEMCReader && EMCPresent() ) fEMCReader ->Update();
547  if (fEEMCReader && EMCPresent() ) fEEMCReader->Update();
548  if (fPMDReader && PMDPresent() ) fPMDReader ->Update();
549 
550  // Trigger Summary
551  int i;
552  for(i=0;i<2;i++) fTrigSummary->L1summary[i]=fDaqFileReader->L1summary[i];
553  for(i=0;i<2;i++) fTrigSummary->L2summary[i]=fDaqFileReader->L2summary[i];
554  for(i=0;i<4;i++) fTrigSummary->L3summary[i]=fDaqFileReader->L3summary[i];
555  } }
556  return retStatus;
557 }
558 //_____________________________________________________________________________
559 int StDAQReader::skipEvent(int nskip)
560 {
561  if (nskip == 1) {
562  nextEvent();
563  } else {
564  char *currentData = 0;
565  if (nskip == 2) currentData = fDaqFileReader->get(0,EVP_TYPE_ANY);
566  else currentData = fDaqFileReader->skip_then_get(nskip-2,0,EVP_TYPE_ANY);
567  fOffset = -1;
568  if(currentData && (fDaqFileReader->status == EVP_STAT_OK) ) {
569  fOffset = 1;
570  nextEvent();
571  }
572  }
573  Int_t ok = 0;
574  if (fOffset == -1) {
575  ok = 1;
576  LOG_WARN << Form("EOF with skipEvent(%d)",nskip)<< endm;
577  }
578  return ok;
579 }
580 
581 
582 //_____________________________________________________________________________
583 void StDAQReader::setTPCVersion(const char* vers)
584 {strcpy(fTPCVersion,vers);}
585 //_____________________________________________________________________________
586 void StDAQReader::setFTPCVersion(const char* vers)
587 {strcpy(fFTPCVersion,vers);}
588 
589 //_____________________________________________________________________________
590 int StDAQReader::getRunNumber() const
591 {
592  // return the run number from the DAQ file header
593 
594  int runNum = -1;
595  if (fDatFileReader)
596  runNum = fDatFileReader->RunNumber();
597  else if (fDaqFileReader )
598  runNum = fDaqFileReader->run;
599  else
600  runNum = fEventReader->runno();
601  return runNum;
602 }
603 //_____________________________________________________________________________
604 int StDAQReader::getEventNumber() const {
605  return fDaqFileReader ?
606  fDaqFileReader->seq
607  :
608  fEventInfo->EventSeqNo;
609 }
610 //_____________________________________________________________________________
611 unsigned int StDAQReader::getUnixTime() const
612 {
613  int unixTime = 0;
614  if (fDatFileReader)
615  unixTime = fDatFileReader->RecordUnixTime();
616  else if (fDaqFileReader )
617  unixTime = fDaqFileReader->evt_time;
618  else
619  unixTime = fEventInfo->UnixTime;
620  return unixTime;
621 }
622 
623 //_____________________________________________________________________________
624 unsigned int StDAQReader::getTrigWord() const {
625  return fDaqFileReader ?
626  fDaqFileReader->trgword
627  :
628  fEventInfo->TrigWord;
629 }
630 //_____________________________________________________________________________
631  unsigned int StDAQReader::getTrigInputWord() const {return fEventInfo->TrigInputWord;}
632 //_____________________________________________________________________________
633  int StDAQReader::TPCPresent() const {return fEventInfo->TPCPresent;}
634 //_____________________________________________________________________________
635  int StDAQReader::SVTPresent() const {return fEventInfo->SVTPresent;}
636 //_____________________________________________________________________________
637  int StDAQReader::TOFPresent() const {return fEventInfo->TOFPresent;}
638 //_____________________________________________________________________________
639  int StDAQReader::FPDPresent() const {return fEventInfo->FPDPresent;}
640 //_____________________________________________________________________________
641  int StDAQReader::SSDPresent() const {return fEventInfo->SSDPresent;}
642 //_____________________________________________________________________________
643  int StDAQReader::EMCPresent() const {return fEventInfo->EMCPresent;}
644 //_____________________________________________________________________________
645  int StDAQReader::PMDPresent() const {return fEventInfo->PMDPresent;}
646 //_____________________________________________________________________________
647  int StDAQReader::SMDPresent() const {return fEventInfo->BSMDPresent|fEventInfo->ESMDPresent;}
648 //_____________________________________________________________________________
649  int StDAQReader::FTPCPresent() const {return fEventInfo->FTPCPresent;}
650 //_____________________________________________________________________________
651  int StDAQReader::RICHPresent() const {return fEventInfo->RICHPresent;}
652 //_____________________________________________________________________________
653  int StDAQReader::TRGPresent() const {return ( fEventInfo && fEventInfo->TRGPresent) || (fDatFileReader && StTRGReader::OldFormat(fDatFileReader->Version()));}
654 //_____________________________________________________________________________
655  int StDAQReader::L3Present() const {return fEventInfo->L3Present;}
656 //_____________________________________________________________________________
657 int StDAQReader::getEventSize()const
658 {
659  int eventSize = 0;
660  if (fDatFileReader)
661  eventSize = fDatFileReader->Length();
662  else
663  eventSize = fEventInfo->EventLength;
664  return eventSize;
665  }
666 //_____________________________________________________________________________
667 StTPCReader *StDAQReader::getTPCReader(char mergeSequences)
668 {
669  int updateStatus;
670  if(!TPCPresent()) return 0;
671  if (!fTPCReader) {
672  fTPCReader = new StTPCReader(this,mergeSequences);
673  updateStatus=fTPCReader->Update();
674  if(updateStatus) { delete fTPCReader; fTPCReader=0; return 0; } // No TPC data. Herb Ward, Apr 22 2003.
675  }
676  return fTPCReader;
677 }
678 //_____________________________________________________________________________
679 StEEMCReader *StDAQReader::getEEMCReader()
680 {
681  if (!fEEMCReader) {
682  fEEMCReader = new StEEMCReader(this);
683  }
684  return fEEMCReader;
685 }
686 //_____________________________________________________________________________
687 StEMCReader *StDAQReader::getEMCReader()
688 {
689  if (!EMCPresent()) return 0;
690  if (!fEMCReader) {
691  fEMCReader = new StEMCReader(this);
692  }
693  return fEMCReader;
694 }
695 //_____________________________________________________________________________
696 StSSDReader *StDAQReader::getSSDReader()
697 {
698  if (!SSDPresent()) return 0;
699  if (!fSSDReader) {
700  fSSDReader = new StSSDReader(this);
701  }
702  return fSSDReader;
703 }
704 //_____________________________________________________________________________
705 StPMDReader *StDAQReader::getPMDReader()
706 {
707  if (!PMDPresent()) return 0;
708  if (!fPMDReader) {
709  fPMDReader = new StPMDReader(this);
710 // fPMDReader->Update();
711  }
712  return fPMDReader;
713 }
714 //_____________________________________________________________________________
715 StRICHReader *StDAQReader::getRICHReader()
716 {
717  if (!RICHPresent()) return 0;
718  if (!fRICHReader) {
719  fRICHReader = ::getRICHReader(fEventReader);
720  if (!fRICHReader) fEventInfo->RICHPresent=0;
721  }
722 
723  return fRICHReader;
724 }
725 //_____________________________________________________________________________
726 StL3Reader *StDAQReader::getL3Reader()
727 {
728  if (!L3Present()) return 0;
729  if (!fL3Reader) {
730  fL3Reader = ::getL3Reader(fEventReader);
731  if (!fL3Reader) fEventInfo->L3Present=0;
732  }
733  return fL3Reader;
734 }
735 //_____________________________________________________________________________
736 StFTPCReader *StDAQReader::getFTPCReader()
737 {
738  if (!FTPCPresent()) return 0;
739  if (!fFTPCReader) {
740  fFTPCReader = new StFTPCReader(this);
741  fFTPCReader->Update();
742  }
743  return fFTPCReader;
744 }
745 //_____________________________________________________________________________
746 StTOFReader *StDAQReader::getTOFReader()
747 {
748  if (!TOFPresent()) return 0;
749  if (!fTOFReader) {
750  fTOFReader = ::getTOFReader(fEventReader);
751  if(!fTOFReader) fEventInfo->TOFPresent=0;
752  }
753  return fTOFReader;
754 }
755 //_____________________________________________________________________________
756 StFPDReader *StDAQReader::getFPDReader()
757 {
758  if (!FPDPresent()) return 0;
759  if (!fFPDReader) {
760  fFPDReader = ::getFPDReader(fEventReader);
761  if (!fFPDReader) fEventInfo->FPDPresent=0;
762  }
763  return fFPDReader;
764 }
765 //_____________________________________________________________________________
766 StTRGReader *StDAQReader::getTRGReader()
767 {
768  if (!TRGPresent()) return 0;
769  if (!fTRGReader) {
770  fTRGReader = new StTRGReader(this);
771  //fTRGReader->Update();
772  }
773  return fTRGReader;
774 }
775 //_____________________________________________________________________________
776 StSVTReader *StDAQReader::getSVTReader()
777 {
778  if (!SVTPresent()) return 0;
779  if (!fSVTReader) {
780  fSVTReader = new StSVTReader(this);
781  fSVTReader->Update();
782  }
783  return fSVTReader;
784 }
785 
786 //_____________________________________________________________________________
787 void StDAQReader::printEventInfo()
788 {fEventReader->printEventInfo();}
virtual Int_t Make()
Definition: Stypes.h:43
void nextEvent()
NextEvent - this method is called to advance the next daq event if any.
TString fFile
Tree name.
Definition: StIOInterFace.h:32
Definition: Stypes.h:44
Definition: Stypes.h:41