1 #include "AliSTARTRawReader.h"
2 #include "AliSTARTRawData.h"
3 #include "AliSTARTdigit.h"
11 ClassImp(AliSTARTRawReader)
13 AliSTARTRawReader::AliSTARTRawReader (AliRawReader *rawReader, TTree* tree)
14 : TTask("STARTRawReader","read raw START data"),
19 // create an object to read STARTraw digits
24 AliSTARTRawReader::~AliSTARTRawReader ()
28 //------------------------------------------------------------------------------------------------
30 UInt_t AliSTARTRawReader::UnpackWord(UInt_t packedWord, Int_t startBit, Int_t stopBit)
32 //This method unpacks a words of StopBit-StartBit+1 bits starting from "StopBits"
36 length=stopBit-startBit+1;
37 offSet=(UInt_t)TMath::Power(2,length)-1;
39 word=packedWord&offSet;
43 //---------------------------------------------------------------------------------------
44 void AliSTARTRawReader::NextThing()
46 // read the next raw digit
47 // returns kFALSE if there is no digit left
48 UInt_t word, unpackword;
50 TArrayI *timeTDC1 = new TArrayI(24);
51 TArrayI * chargeTDC1 = new TArrayI(24);
52 TArrayI *timeTDC2 = new TArrayI(24);
53 TArrayI *chargeTDC2 = new TArrayI(24);
54 TArrayI *sumMult = new TArrayI(6);
57 fRawReader->Select(13);
59 if (!fRawReader->ReadHeader()){
60 Error("ReadSTARTRaw","Couldn't read header");
63 AliSTARTdigit *fDigits = new AliSTARTdigit();
64 fTree->Branch("START","AliSTARTdigit",&fDigits,400,1);
66 fRawReader->ReadNextInt(word);
67 for (Int_t i=0; i<24; i++)
71 fRawReader->ReadNextInt(word);
72 unpackword=UnpackWord(word,0,5);
76 fRawReader->ReadNextInt(word);
77 unpackword=UnpackWord(word,8,31);
79 timeTDC1->AddAt(time,pmt);
83 fRawReader->ReadNextInt(word);
84 unpackword=UnpackWord(word,0,5);
88 fRawReader->ReadNextInt(word);
89 unpackword=UnpackWord(word,8,31);
91 timeTDC2->AddAt(time,pmt);
96 fRawReader->ReadNextInt(word);
97 unpackword=UnpackWord(word,0,5);
101 fRawReader->ReadNextInt(word);
102 unpackword= UnpackWord(word,8,31);
103 time=unpackword; //T1
108 fRawReader->ReadNextInt(word);
109 unpackword=UnpackWord(word,0,5);
113 fRawReader->ReadNextInt(word);
114 unpackword= UnpackWord(word,8,31);
115 adc=unpackword-time; // T1+ T2 (A)
116 chargeTDC1->AddAt(adc,pmt);
121 fRawReader->ReadNextInt(word);
122 unpackword=UnpackWord(word,0,5);
126 fRawReader->ReadNextInt(word);
127 unpackword= UnpackWord(word,8,31);
128 time=unpackword; //T1
133 fRawReader->ReadNextInt(word);
134 unpackword=UnpackWord(word,0,5);
138 fRawReader->ReadNextInt(word);
139 unpackword= UnpackWord(word,8,31);
140 adc=unpackword-time; // T1+ T2 (A)
141 chargeTDC2->AddAt(adc,pmt);
145 fDigits->SetTime(*timeTDC1);
146 fDigits->SetADC(*chargeTDC1);
152 fRawReader->ReadNextInt(word);
153 unpackword=UnpackWord(word,0,5);
159 fRawReader->ReadNextInt(word);
160 unpackword=UnpackWord(word,8,31);
162 fDigits->SetMeanTime(time);
164 // Best time right &left
168 fRawReader->ReadNextInt(word);
169 unpackword=UnpackWord(word,0,5);
175 fRawReader->ReadNextInt(word);
176 unpackword=UnpackWord(word,8,31);
178 fDigits->SetTimeBestRight(time);
185 fRawReader->ReadNextInt(word);
186 unpackword=UnpackWord(word,0,5);
192 fRawReader->ReadNextInt(word);
193 unpackword=UnpackWord(word,8,31);
195 fDigits->SetTimeBestLeft(time);
198 // best time differece
202 fRawReader->ReadNextInt(word);
203 unpackword=UnpackWord(word,0,5);
209 fRawReader->ReadNextInt(word);
210 unpackword=UnpackWord(word,8,31);
212 fDigits->SetDiffTime(time);
215 for (Int_t im=0; im<6; im++)
219 fRawReader->ReadNextInt(word);
220 unpackword=UnpackWord(word,0,5);
224 fRawReader->ReadNextInt(word);
225 unpackword=UnpackWord(word,8,31);
227 sumMult->AddAt(time,im);
229 fDigits->SetSumMult(*sumMult);