QwAnalysis
MQwV775TDC.cc
Go to the documentation of this file.
1 /**********************************************************\
2 * File: MQwV775TDC.cc *
3 * *
4 * Author: P. M. King *
5 * J. H. Lee *
6 * Time-stamp: <2010-04-12 16:11> *
7 \**********************************************************/
8 
9 #include "MQwV775TDC.h"
10 #include "QwColor.h"
11 #include "QwLog.h"
12 
13 
14 
15 
16 const UInt_t MQwV775TDC::kV775Mask_SlotNumber = 0xf8000000; // 27-31
17 const UInt_t MQwV775TDC::kV775Mask_WordType = 0x07000000; // 24-26
18 
19 const UInt_t MQwV775TDC::kV775Mask_CrateNumber = 0x00ff0000; // 16-23
20 const UInt_t MQwV775TDC::kV775Mask_HitChannels = 0x00003f00; // 8-13
21 
22 const UInt_t MQwV775TDC::kV775Mask_EventCounter = 0x00ffffff; // 0-23
23 
24 const UInt_t MQwV775TDC::kV775Mask_ChannelNumber = 0x001f0000; // 16-20
25 const UInt_t MQwV775TDC::kV775Mask_DataValidBit = 0x00004000; // 14
26 const UInt_t MQwV775TDC::kV775Mask_UnderthresholdBit = 0x00002000; // 13
27 const UInt_t MQwV775TDC::kV775Mask_OverflowBit = 0x00001000; // 12
28 const UInt_t MQwV775TDC::kV775Mask_Dataword = 0x00000fff; // 0-11
29 
30 const UInt_t MQwV775TDC::kV775WordType_NotValid = 6;
31 const UInt_t MQwV775TDC::kV775WordType_Header = 2;
32 const UInt_t MQwV775TDC::kV775WordType_Tail = 4;
33 const UInt_t MQwV775TDC::kV775WordType_Datum = 0;
34 
35 
37 {
38  fV775ValidFlag = kFALSE;
39  fV775HeaderFlag = kFALSE;
40 
41  fV775SlotNumber = 0;
43  fV775Dataword = 0;
44  fV775EventNumber = 0;
46 }
47 
49 
50 
51 // See page 43 at https://qweak.jlab.org/wiki/images/V775.pdf
52 
53 void MQwV775TDC::DecodeTDCWord(UInt_t &word, const UInt_t roc_id)
54 {
55 
56 
58  UInt_t wordtype = (word & kV775Mask_WordType)>>24;
59  if (wordtype == kV775WordType_Datum){
60  fV775ValidFlag = kTRUE;
62  /* datavalid = ((word & kV775Mask_DataValidBit)!=0); */
63  /* underthreshold = ((word & kV775Mask_UnderthresholdBit)!=0); */
64  /* overflow = ((word & kV775Mask_OverflowBit)!=0); */
66  fV775EventNumber = 0;
67  } else {
68  // For now, don't distinguish between the header, tail word,
69  // or invalid data.
70  // Treat them all as invalid data.
71  fV775ValidFlag = kFALSE;
73  fV775Dataword = 0;
74  fV775EventNumber = 0;
75  }
76 
77 
78  return;
79 }
80 
81 // UInt_t MQwV775TDC::SubtractReference(UInt_t a, UInt_t rawtime){
82 // UInt_t b=rawtime;
83 // return b;
84 // }
85 
86 Double_t MQwV775TDC::SubtractReference(Double_t rawtime, Double_t reftime)
87 {
88  Double_t real_time = rawtime - reftime;
89  return real_time;
90 }
91 
92 
93 
95 {
96  UInt_t trigger_time = 512;
97  // V775TDC has no trigger time information into its data stream.
98  // To keep the same function name between V775TDC and F1TDC,
99  // I use this function in order to return "trigger_time" as 512.
100  // The valid trigger time of F1TDC is in the range of 0 - 511,
101  // thus we can distinguish whether F1TDC or V775TDC.
102 
103  return trigger_time;
104 }
105 
106 
107 Bool_t MQwV775TDC::CheckDataIntegrity(const UInt_t roc_id, UInt_t *buffer, UInt_t num_words)
108 {
109  // will be investigated later.
110  return kFALSE;
111 }
112 
113 
114 
115 void MQwV775TDC::PrintTDCHeader(Bool_t flag)
116 {
117  return;
118 }
119 
120 
121 void MQwV775TDC::PrintTDCData(Bool_t flag)
122 {
123  if(flag)
124  {
125  std::cout << ">>>>>>>>> DATA : "
126  << "Slot " << fV775SlotNumber << " "
127  << "Ch "
128  << std::setw(2) << fV775ChannelNumber
129  << ", Raw dataword "
130  << std::setw(12) << fV775Dataword
131  << std::endl;
132  }
133  return;
134 }
UInt_t fV775EventNumber
Definition: MQwV775TDC.h:88
static const UInt_t kV775Mask_ChannelNumber
Definition: MQwV775TDC.h:70
static const UInt_t kV775Mask_EventCounter
Definition: MQwV775TDC.h:68
static const UInt_t kV775Mask_Dataword
Definition: MQwV775TDC.h:74
static const UInt_t kV775Mask_HitChannels
Definition: MQwV775TDC.h:66
static const UInt_t kV775WordType_NotValid
Definition: MQwV775TDC.h:76
void PrintTDCHeader(Bool_t flag)
Definition: MQwV775TDC.cc:115
static const UInt_t kV775Mask_WordType
Definition: MQwV775TDC.h:63
static const UInt_t kV775WordType_Header
Definition: MQwV775TDC.h:77
UInt_t fV775Dataword
Definition: MQwV775TDC.h:86
static const UInt_t kV775Mask_CrateNumber
Definition: MQwV775TDC.h:65
UInt_t GetTDCTriggerTime()
Definition: MQwV775TDC.cc:94
A logfile class, based on an identical class in the Hermes analyzer.
void DecodeTDCWord(UInt_t &word, const UInt_t roc_id=0)
Definition: MQwV775TDC.cc:53
UInt_t fV775MaxChannelsPerModule
Definition: MQwV775TDC.h:87
static const UInt_t kV775Mask_DataValidBit
Definition: MQwV775TDC.h:71
UInt_t fV775ChannelNumber
Definition: MQwV775TDC.h:85
void PrintTDCData(Bool_t flag)
Definition: MQwV775TDC.cc:121
UInt_t fV775SlotNumber
Definition: MQwV775TDC.h:84
Double_t SubtractReference(Double_t rawtime, Double_t reftime)
Definition: MQwV775TDC.cc:86
static const UInt_t kV775Mask_OverflowBit
Definition: MQwV775TDC.h:73
static const UInt_t kV775WordType_Tail
Definition: MQwV775TDC.h:78
Bool_t fV775HeaderFlag
Definition: MQwV775TDC.h:82
Bool_t CheckDataIntegrity(const UInt_t roc_id, UInt_t *buffer, UInt_t num_words)
Definition: MQwV775TDC.cc:107
Bool_t fV775ValidFlag
Definition: MQwV775TDC.h:81
static const UInt_t kV775WordType_Datum
Definition: MQwV775TDC.h:79
static const UInt_t kV775Mask_SlotNumber
Definition: MQwV775TDC.h:62
static const UInt_t kV775Mask_UnderthresholdBit
Definition: MQwV775TDC.h:72