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);
56 fRawReader->Select(13);
58 if (!fRawReader->ReadHeader()){
59 Error("ReadSTARTRaw","Couldn't read header");
62 AliSTARTdigit *fDigits = new AliSTARTdigit();
63 fTree->Branch("START","AliSTARTdigit",&fDigits,400,1);
65 fRawReader->ReadNextInt(word);
66 for (Int_t i=0; i<24; i++)
70 fRawReader->ReadNextInt(word);
71 unpackword=UnpackWord(word,0,5);
75 fRawReader->ReadNextInt(word);
76 unpackword=UnpackWord(word,8,31);
78 timeTDC1->AddAt(time,pmt);
82 fRawReader->ReadNextInt(word);
83 unpackword=UnpackWord(word,0,5);
87 fRawReader->ReadNextInt(word);
88 unpackword=UnpackWord(word,8,31);
90 timeTDC2->AddAt(time,pmt);
95 fRawReader->ReadNextInt(word);
96 unpackword=UnpackWord(word,0,5);
100 fRawReader->ReadNextInt(word);
101 unpackword= UnpackWord(word,8,31);
102 time=unpackword; //T1
107 fRawReader->ReadNextInt(word);
108 unpackword=UnpackWord(word,0,5);
112 fRawReader->ReadNextInt(word);
113 unpackword= UnpackWord(word,8,31);
114 adc=unpackword-time; // T1+ T2 (A)
115 chargeTDC1->AddAt(adc,pmt);
120 fRawReader->ReadNextInt(word);
121 unpackword=UnpackWord(word,0,5);
125 fRawReader->ReadNextInt(word);
126 unpackword= UnpackWord(word,8,31);
127 time=unpackword; //T1
132 fRawReader->ReadNextInt(word);
133 unpackword=UnpackWord(word,0,5);
137 fRawReader->ReadNextInt(word);
138 unpackword= UnpackWord(word,8,31);
139 adc=unpackword-time; // T1+ T2 (A)
140 chargeTDC2->AddAt(adc,pmt);
144 fDigits->SetTime(*timeTDC1);
145 fDigits->SetADC(*chargeTDC1);
151 fRawReader->ReadNextInt(word);
152 unpackword=UnpackWord(word,0,5);
158 fRawReader->ReadNextInt(word);
159 unpackword=UnpackWord(word,8,31);
161 fDigits->SetMeanTime(time);
163 // Best time right &left
167 fRawReader->ReadNextInt(word);
168 unpackword=UnpackWord(word,0,5);
174 fRawReader->ReadNextInt(word);
175 unpackword=UnpackWord(word,8,31);
177 fDigits->SetTimeBestRight(time);
184 fRawReader->ReadNextInt(word);
185 unpackword=UnpackWord(word,0,5);
191 fRawReader->ReadNextInt(word);
192 unpackword=UnpackWord(word,8,31);
194 fDigits->SetTimeBestLeft(time);
197 // best time differece
201 fRawReader->ReadNextInt(word);
202 unpackword=UnpackWord(word,0,5);
208 fRawReader->ReadNextInt(word);
209 unpackword=UnpackWord(word,8,31);
211 fDigits->SetDiffTime(time);
214 for (Int_t im=0; im<6; im++)
218 fRawReader->ReadNextInt(word);
219 unpackword=UnpackWord(word,0,5);
223 fRawReader->ReadNextInt(word);
224 unpackword=UnpackWord(word,8,31);
226 sumMult->AddAt(time,im);
228 fDigits->SetSumMult(*sumMult);