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::PVPDEast() {
61  return sc.rich_scalers[8];
62 }
63 
64 int SC_Reader::PVPDWest() {
65  return sc.rich_scalers[9];
66 }
67 
68 int SC_Reader::CTBWest() {
69  return 0;
70 }
71 
72 int SC_Reader::CTBEast() {
73  return 0;
74 }
75 
76 int SC_Reader::TOFp() {
77  return 0;
78 }
79 
80 int SC_Reader::CTBOrTOFp() {
81  return 0;
82 }
83 
84 int SC_Reader::Mult() {
85  return sc.rich_scalers[10];
86 }
87 
88 int SC_Reader::L0() {
89  return 0;
90 }
91 
92 int SC_Reader::BBCXCTB() {
93  return 0;
94 }
95 
96 SC_Reader::SC_Reader(EventReader *er) {
97 
98  //Keep BBCBkg scalers flipped as theyStRoot/StDaqLib/SC/SC_Reader.cxx were historically before 2009
99  //Note that new DAQ reader leads to UTime = 0, or tm_year=70 (1970)
100  //but new DAQ reader only gets used for 2009+ anyhow
101  std::time_t utime = er->getEventInfo().UnixTime;
102  std::tm *time = gmtime(&utime);
103  flipBBCBkg = (time->tm_year > 95 && time->tm_year < 109 ? 1 : 0) ;
104 
105  // LDate = (((1900+time->tm_year)*100 + 1 + time->tm_mon)*100 + time->tm_mday)*100;
106  // LTime = (time->tm_hour*100 + time->tm_min)*100 + time->tm_sec;
107 #ifndef NEW_DAQ_READER
108  char *datap; // ,ew;
109  datap=er->getDATAP();
110  if (datap) OLDEVP::scReader(datap); // call the "event pool" code
111 #else
112  assert(0 && "SC_Reader is no use with the new DAQ reader");
113 // daqReader *rdr=er->getDaqReader(); assert(rdr);
114 // ::scReader((char*)rdr); // call the "event pool" code
115 #endif
116 
117 }