StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
SC_Reader.cxx
1 #ifndef NEW_DAQ_READER_DAQ
2 # include "StDaqLib/EVP/scReader.h"
3 #else
4 //# include "RTS/src/DAQ_READER/daqReader.h"
5 # include "RTS/src/DAQ_SC/sc.h"
6 #endif /* NEW_DAQ_READER */
7 #include "SC_Reader.hh"
8 #include "StDaqLib/GENERIC/EventReader.hh"
9 
10 #include <assert.h>
11 #include <math.h>
12 #include <ctime>
13 
14 using namespace OLDEVP;
15 
16 int SC_Reader::BBCEast() {
17  return sc.rich_scalers[0];
18 }
19 
20 int SC_Reader::BBCWest() {
21  return sc.rich_scalers[1];
22 }
23 
24 int SC_Reader::BBCX() {
25  return sc.rich_scalers[2];
26 }
27 
28 int SC_Reader::BBCBlueBkg() {
29  return sc.rich_scalers[4 - flipBBCBkg];
30 }
31 
32 int SC_Reader::BBCYellowBkg() {
33  return sc.rich_scalers[3 + flipBBCBkg];
34 }
35 
36 int SC_Reader::ZDCEast() {
37  return sc.rich_scalers[5];
38 }
39 
40 int SC_Reader::ZDCWest() {
41  return sc.rich_scalers[6];
42 }
43 
44 int SC_Reader::ZDCX() {
45  return sc.rich_scalers[7];
46 }
47 
48 int SC_Reader::ZDCEastNoKiller() {
49  return sc.rich_scalers[12];
50 }
51 
52 int SC_Reader::ZDCWestNoKiller() {
53  return sc.rich_scalers[11];
54 }
55 
56 int SC_Reader::ZDCXNoKiller() {
57  return sc.rich_scalers[14];
58 }
59 
60 int SC_Reader::EPDX() {
61  return sc.rich_scalers[13];
62 }
63 
64 int SC_Reader::PVPDEast() {
65  return sc.rich_scalers[8];
66 }
67 
68 int SC_Reader::PVPDWest() {
69  return sc.rich_scalers[9];
70 }
71 
72 int SC_Reader::CTBWest() {
73  return 0;
74 }
75 
76 int SC_Reader::CTBEast() {
77  return 0;
78 }
79 
80 int SC_Reader::TOFp() {
81  return 0;
82 }
83 
84 int SC_Reader::CTBOrTOFp() {
85  return 0;
86 }
87 
88 int SC_Reader::Mult() {
89  return sc.rich_scalers[10];
90 }
91 
92 int SC_Reader::L0() {
93  return 0;
94 }
95 
96 int SC_Reader::BBCXCTB() {
97  return 0;
98 }
99 
100 SC_Reader::SC_Reader(EventReader *er) {
101 
102  //Keep BBCBkg scalers flipped as theyStRoot/StDaqLib/SC/SC_Reader.cxx were historically before 2009
103  //Note that new DAQ reader leads to UTime = 0, or tm_year=70 (1970)
104  //but new DAQ reader only gets used for 2009+ anyhow
105  std::time_t utime = er->getEventInfo().UnixTime;
106  std::tm *time = gmtime(&utime);
107  flipBBCBkg = (time->tm_year > 95 && time->tm_year < 109 ? 1 : 0) ;
108 
109  // LDate = (((1900+time->tm_year)*100 + 1 + time->tm_mon)*100 + time->tm_mday)*100;
110  // LTime = (time->tm_hour*100 + time->tm_min)*100 + time->tm_sec;
111 #ifndef NEW_DAQ_READER
112  char *datap; // ,ew;
113  datap=er->getDATAP();
114  if (datap) OLDEVP::scReader(datap); // call the "event pool" code
115 #else
116  assert(0 && "SC_Reader is no use with the new DAQ reader");
117 // daqReader *rdr=er->getDaqReader(); assert(rdr);
118 // ::scReader((char*)rdr); // call the "event pool" code
119 #endif
120 
121 }