FairRoot/PandaRoot
PndMvdTsEvent.cxx
Go to the documentation of this file.
1 #include <stdlib.h>
2 #include "PndMvdTsEvent.h"
3 
4 #include "PndMvdSiHit.h"
5 #include "PndMvdTdcData.h"
6 #include "PndMvdQdcData.h"
7 
9 
11  fEventId(0),
12  fSiHitList(new TClonesArray("PndMvdSiHit")),
13  fTdcValues(new TClonesArray("PndMvdTdcData")),
14  fQdcValues(new TClonesArray("PndMvdQdcData")),
15  fNumScalerValues(0),
16  fScalerValues(NULL),
17  fScalerValuesAllocSize(0),
18  fExtClockCount(0),
19  fExtClockResetCount(0)
20 {
21 }
22 
24 {
25  delete fSiHitList;
26  delete fTdcValues;
27  delete fQdcValues;
28  // delete fGiTdcValues;
29  // delete fGiQdcValues;
30  if (fScalerValues)
31  {
32  free(fScalerValues);
33  }
34 }
35 
36 void PndMvdTsEvent::Clear(const Option_t*)
37 {
38  fEventId = 0;
39  fSiHitList->Clear();
40  fTdcValues->Clear();
41  fQdcValues->Clear();
42  // fGiTdcValues->Clear();
43  // fGiQdcValues->Clear();
44  fNumScalerValues = 0;
45  }
46 
48 {
49  TClonesArray& hitList = *fSiHitList;
50  for (int i=0; i<count; i++)
51  {
52  //DWORD triggerNo = (hits[i]&0x1f000000) >> 24; // bit 28 to 24 //[R.K.03/2017] FIXME unused variable
53  WORD numFrames = (hits[i]&0x00f80000) >> 19; // bit 19 to 23
54  WORD channel = (hits[i]&0x0007f000) >> 12; // bit 12 to 18
55  WORD height = (hits[i]&0x00000fff); // bit 0 to 11
56  WORD box = adcChannel/6;
57  channel += (adcChannel%6)*128;
58 
59  new(hitList[hitList.GetEntriesFast()]) PndMvdSiHit(box, channel, height, numFrames);
60  }
61 }
62 
64 {
65  TClonesArray& tdcList = *fTdcValues;
66  for (int i=0; i<count; i++)
67  {
68  if ( (tdcValues[i] & 0xf8000000) == 0)
69  {
70  int trailing = (tdcValues[i] & 0x04000000) >> 26;
71  int channel = (tdcValues[i] & 0x03E00000) >> 21;
72  int value = (tdcValues[i] & 0x001fffff);
73  new(tdcList[tdcList.GetEntriesFast()]) PndMvdTdcData(channel, value, trailing);
74  }
75  }
76 }
77 
79 {
80  TClonesArray& qdcList = *fQdcValues;
81  for (int i=0; i<count; i++)
82  {
83  int channel = (qdcValues[i] & 0xff000000) >> 24;
84  int value = (qdcValues[i] & 0x00ffffff);
85  new(qdcList[qdcList.GetEntriesFast()]) PndMvdQdcData(channel, value);
86  }
87 }
88 
90 {
91  TClonesArray& tdcList = *fTdcValues;
92  for (int i=0; i<count; i++)
93  {
94  if ( (tdcValues[i] & 0xf8000000) == 0)
95  {
96  int trailing = (tdcValues[i] & 0x04000000) >> 26;
97  int channel = (tdcValues[i] & 0x03E00000) >> 21;
98  int value = (tdcValues[i] & 0x001fffff);
99  new(tdcList[tdcList.GetEntriesFast()]) PndMvdTdcData(channel+32, value, trailing);
100  }
101  }
102 }
103 
105 {
106  TClonesArray& qdcList = *fQdcValues;
107  for (int i=0; i<count; i++)
108  {
109  int channel = (qdcValues[i] & 0x001F0000) >> 16;
110  int value = (qdcValues[i] & 0x00000fff);
111  int underflow = (qdcValues[i] & 0x00002000);
112  int overflow = (qdcValues[i] & 0x00001000);
113  if (underflow || overflow)
114  {
115  value = -1;
116  }
117  new(qdcList[qdcList.GetEntriesFast()]) PndMvdQdcData(channel+32, value);
118  }
119 }
120 
122 {
123  if (fScalerValuesAllocSize < count)
124  {
125  fScalerValues = (UInt_t*)realloc(fScalerValues, sizeof(UInt_t)*count);
127  }
129  for (int i=0; i<count; i++)
130  {
131  fScalerValues[i] = scalerValues[i];
132  }
133 }
134 
void FillGiQdcValues(DWORD *qdcValues, WORD count)
void FillTdcValues(DWORD *tdcValues, WORD count)
void FillQdcValues(DWORD *qdcValues, WORD count)
Int_t i
Definition: run_full.C:25
ClassImp(PndMvdTsEvent)
unsigned short WORD
Definition: PndMvdTsEvent.h:8
size_t fScalerValuesAllocSize
Definition: PndMvdTsEvent.h:53
Int_t fNumScalerValues
Definition: PndMvdTsEvent.h:51
TClonesArray * fQdcValues
Definition: PndMvdTsEvent.h:48
void FillSiHits(int adcChannel, DWORD *hits, WORD count)
void Clear(const Option_t *=NULL)
UInt_t * fScalerValues
Definition: PndMvdTsEvent.h:52
TClonesArray * fTdcValues
Definition: PndMvdTsEvent.h:47
unsigned int DWORD
Definition: PndMvdTsEvent.h:9
void FillScalerValues(DWORD *qdcValues, WORD count)
TClonesArray * fSiHitList
Definition: PndMvdTsEvent.h:46
int count
CbmHit * hits[nHits]
Definition: RiemannTest.C:19
virtual ~PndMvdTsEvent()
void FillGiTdcValues(DWORD *tdcValues, WORD count)