]>
Commit | Line | Data |
---|---|---|
f16935f7 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id: */ | |
17 | ||
18 | //____________________________________________________________________ | |
19 | // | |
20 | // T0 - T0. | |
21 | // | |
22 | // This class privides GIU service for reading RAW data from Laser | |
23 | // during electronics test | |
24 | // | |
fc387e80 | 25 | #include "TH1F.h" |
26 | #include "TH2F.h" | |
27 | #include "TMap.h" | |
28 | #include "TFile.h" | |
29 | #include "TTree.h" | |
30 | #include "TBranch.h" | |
31 | #include "AliT0RawReader.h" | |
32 | #include "TGLabel.h" | |
33 | #include <iostream.h> | |
34 | ||
35 | #include "AliT0CalibLaserData.h" | |
36 | ||
37 | #include "AliCDBManager.h" | |
38 | #include "AliRawReader.h" | |
39 | #include "AliRawReaderDate.h" | |
40 | #include "AliT0LookUpValue.h" | |
41 | #include "AliT0Parameters.h" | |
42 | #include "AliT0RawReader.h" | |
fc387e80 | 43 | |
44 | ClassImp(AliT0CalibLaserData) | |
45 | ||
46 | AliT0CalibLaserData::AliT0CalibLaserData() : TObject(), | |
47 | fRunNumber(905) | |
48 | { | |
49 | // | |
50 | } | |
51 | /* | |
52 | //________________________________________________________________ | |
53 | ||
54 | AliT0CalibLaserData::AliT0CalibLaserData(const AliT0CalibLaserData& calibda) : TObject(), | |
55 | fRunNumber(905) | |
56 | { | |
57 | //copy constructor | |
58 | ||
59 | } | |
60 | //________________________________________________________________ | |
61 | ||
62 | AliT0CalibLaserData &AliT0CalibLaserData::operator =(const AliT0CalibLaserData& calibda) | |
63 | { | |
64 | // assignment operator | |
65 | ||
66 | return *this; | |
67 | } | |
68 | //________________________________________________________________ | |
2d065274 | 69 | AliT0CalibLaserData::~AliT0CalibLaserData() |
70 | { | |
fc387e80 | 71 | // |
2d065274 | 72 | } |
fc387e80 | 73 | */ |
74 | //________________________________________________________________ | |
75 | ||
76 | void AliT0CalibLaserData::ReadHistSize(Int_t rNumber) | |
77 | { | |
f16935f7 | 78 | //build GUI frame for reading: |
79 | // - run number | |
80 | // - histograms rates | |
81 | ||
fc387e80 | 82 | fRunNumber = rNumber; |
83 | ||
84 | TGMainFrame* fMain = new TGMainFrame(0,1500,1500); | |
85 | fMain->SetLayoutManager( new TGMatrixLayout(fMain,7,7) ); | |
86 | ||
87 | fMain->AddFrame( new TGLabel(fMain, " Histogram") ); | |
88 | fMain->AddFrame( new TGLabel(fMain, "X min") ); | |
89 | fMain->AddFrame( new TGLabel(fMain, "X max") ); | |
90 | fMain->AddFrame( new TGLabel(fMain, "X N# channels") ); | |
91 | ||
92 | fMain->AddFrame( new TGLabel(fMain, "Y min") ); | |
93 | fMain->AddFrame( new TGLabel(fMain, "Y max") ); | |
94 | fMain->AddFrame( new TGLabel(fMain, "Y N# channels") ); | |
95 | ||
96 | fMain->AddFrame( new TGLabel(fMain, "QTC" ) ); | |
97 | fEntries[0] = new TGNumberEntry(fMain, 0); | |
98 | fMain->AddFrame(fEntries[0]); | |
99 | fEntries[1] = new TGNumberEntry(fMain, 10000); | |
100 | fMain->AddFrame(fEntries[1]); | |
101 | fEntries[2] = new TGNumberEntry(fMain, 10000); | |
102 | fMain->AddFrame(fEntries[2]); | |
103 | fMain->AddFrame( new TGLabel(fMain, " ") ); | |
104 | fMain->AddFrame( new TGLabel(fMain, " ") ); | |
105 | fMain->AddFrame( new TGLabel(fMain, " ") ); | |
106 | ||
107 | fMain->AddFrame( new TGLabel(fMain, "LED - CFD" ) ); | |
108 | fEntries[3] = new TGNumberEntry(fMain, 0); | |
109 | fMain->AddFrame(fEntries[3]); | |
110 | fEntries[4] = new TGNumberEntry(fMain, 10000); | |
111 | fMain->AddFrame(fEntries[4]); | |
112 | fEntries[5] = new TGNumberEntry(fMain, 10000); | |
113 | fMain->AddFrame(fEntries[5]); | |
114 | fMain->AddFrame( new TGLabel(fMain, " ") ); | |
115 | fMain->AddFrame( new TGLabel(fMain, " ") ); | |
116 | fMain->AddFrame( new TGLabel(fMain, " ") ); | |
117 | fMain->AddFrame( new TGLabel(fMain, "CFD vs QTC " ) ); | |
118 | // QTC axis X | |
119 | fEntries[6] = new TGNumberEntry(fMain, 1000.); | |
120 | fMain->AddFrame(fEntries[6]); | |
121 | fEntries[7] = new TGNumberEntry(fMain, 8000.5); | |
122 | fMain->AddFrame(fEntries[7]); | |
123 | fEntries[8] = new TGNumberEntry(fMain, 700); | |
124 | fMain->AddFrame(fEntries[8]); | |
125 | // CFD axis Y | |
2d065274 | 126 | fEntries[9] = new TGNumberEntry(fMain, 12000.5); |
fc387e80 | 127 | fMain->AddFrame(fEntries[9]); |
2d065274 | 128 | fEntries[10] = new TGNumberEntry(fMain, 18000.5); |
fc387e80 | 129 | fMain->AddFrame(fEntries[10]); |
2d065274 | 130 | fEntries[11] = new TGNumberEntry(fMain, 2000); |
fc387e80 | 131 | fMain->AddFrame(fEntries[11]); |
132 | // | |
133 | fMain->AddFrame( new TGLabel(fMain, "CFD vs LED-CFD " ) ); | |
134 | //LED-CFD axis X | |
135 | fEntries[12] = new TGNumberEntry(fMain, 0); | |
136 | fMain->AddFrame(fEntries[12]); | |
137 | fEntries[13] = new TGNumberEntry(fMain, 500); | |
138 | fMain->AddFrame(fEntries[13]); | |
139 | fEntries[14] = new TGNumberEntry(fMain, 500); | |
140 | fMain->AddFrame(fEntries[14]); | |
141 | // CFD axis Y | |
2d065274 | 142 | fEntries[15] = new TGNumberEntry(fMain, 14600); |
fc387e80 | 143 | fMain->AddFrame(fEntries[15]); |
2d065274 | 144 | fEntries[16] = new TGNumberEntry(fMain, 14700); |
fc387e80 | 145 | fMain->AddFrame(fEntries[16]); |
2d065274 | 146 | fEntries[17] = new TGNumberEntry(fMain, 100); |
fc387e80 | 147 | fMain->AddFrame(fEntries[17]); |
148 | ||
149 | fMain->AddFrame( new TGLabel(fMain, " Number of run") ); | |
150 | fEntries[18] = new TGNumberEntry(fMain, 905); | |
151 | fMain->AddFrame(fEntries[18]); | |
152 | ||
153 | for ( int i=0; i<19; i++ ) fEntries[i]->SetWidth(70); | |
154 | // printf( "Max Length %d\n", fEntries[0]->GetMaxWidth() ); | |
155 | ||
156 | TGTextButton *fOk = new TGTextButton(fMain, "OK"); | |
157 | fOk->Connect("Clicked()","AliT0CalibLaserData",this,"DoOk()"); | |
158 | // fOk->SetCommand(".q"); | |
159 | fMain->AddFrame(fOk); | |
160 | ||
161 | fMain->MapSubwindows(); | |
162 | fMain->Resize(); | |
163 | fMain->SetWindowName("Dialog"); | |
164 | fMain->MapWindow(); | |
165 | } | |
166 | ||
167 | void AliT0CalibLaserData::DoOk() | |
168 | { | |
f16935f7 | 169 | |
fc387e80 | 170 | // delete fMain; |
171 | fRunNumber = Int_t (fEntries[18]->GetNumber()); | |
f16935f7 | 172 | printf(" RUN NUMBER %i\n",fRunNumber); |
173 | for( int i=0; i<18; i++ ) | |
174 | fHistLimits[i] = fEntries[i]->GetNumber(); | |
175 | ||
fc387e80 | 176 | ReadData(); |
fc387e80 | 177 | } |
178 | ||
179 | void AliT0CalibLaserData::ReadData() | |
180 | { | |
f16935f7 | 181 | // reading RAW data from test LCS |
182 | // filling histograms | |
183 | // fillinf tree | |
184 | ||
fc387e80 | 185 | |
2d065274 | 186 | TH1F *hChannel[105]; TH1F *hQTC[12]; |
f16935f7 | 187 | TH2F *hCFDvsQTC[12]; TH2F *hCFDvsLED[12]; TH1F *h1CFDminLED[12]; |
2d065274 | 188 | TH1F *hmpd[12]; |
189 | Int_t allData[110][5]; | |
190 | Int_t numberOfHits[105]; | |
fc387e80 | 191 | |
2d065274 | 192 | Char_t buf1[20], buf2[20], buf3[20], buf4[20], buf7[20]; |
fc387e80 | 193 | |
2d065274 | 194 | TTree* digitsTree = new TTree("testData","Tree of test data Digits"); |
195 | TBranch *b[106]; | |
196 | ||
197 | Int_t channels[106]; | |
198 | ||
199 | TString names[106], type; | |
200 | AliT0LookUpKey* lookkey= new AliT0LookUpKey(); | |
201 | AliT0LookUpValue* lookvalue= new AliT0LookUpValue(); | |
202 | AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT"); | |
203 | AliCDBManager::Instance()->SetRun(0); | |
204 | AliT0Parameters *fParam = AliT0Parameters::Instance(); | |
205 | fParam->Init(); | |
206 | TMap *lookup = fParam->GetMapLookup(); | |
207 | TMapIter *iter = new TMapIter(lookup); | |
208 | ||
209 | for( Int_t iline=0; iline<106; iline++) | |
fc387e80 | 210 | { |
2d065274 | 211 | lookvalue = ( AliT0LookUpValue*) iter->Next(); |
212 | lookkey = (AliT0LookUpKey*) lookup->GetValue((TObject*)lookvalue); | |
213 | if(lookkey){ | |
214 | Int_t key=lookkey->GetKey(); | |
215 | names[key]=lookkey->GetChannelName(); | |
216 | // cout<<lookkey->GetKey()<<" "<<lookkey->GetChannelName()<<" trm "<<lookvalue->GetTRM()<<" tdc "<<lookvalue->GetTDC()<<" chain "<<lookvalue->GetChain()<<" channel "<<lookvalue->GetChannel()<<endl; | |
217 | hChannel[key] = new TH1F(names[key].Data(),names[key].Data(),30000,0,30000); | |
218 | // hitsname="xHits" + names[key]; | |
219 | // hNumHits[key] = new TH1F(hitsname.Data(),hitsname.Data(),50,-0.25,24.25); | |
220 | type =names[key] + "/I"; | |
221 | b[key]=digitsTree->Branch(names[key].Data(),&channels[key], type); | |
222 | } | |
223 | else | |
f16935f7 | 224 | {printf(" no such value %i \n", iline);} |
2d065274 | 225 | |
226 | } | |
227 | for(Int_t ic=0; ic<12; ic++) { | |
228 | { | |
229 | sprintf(buf1,"QTC%i",ic+1); | |
230 | sprintf(buf2,"CFDvsQTC%i",ic+1); | |
231 | sprintf(buf3,"CFDvsLED%i",ic+1); | |
f16935f7 | 232 | sprintf(buf4,"LEDminCFD%i",ic+1); |
2d065274 | 233 | sprintf(buf7,"mpd%i",ic+1); |
234 | ||
235 | hQTC[ic] = new TH1F(buf1,"QTC",(Int_t)fHistLimits[2],fHistLimits[0],fHistLimits[1]); | |
f16935f7 | 236 | h1CFDminLED[ic] = new TH1F(buf4,"LED - CFD",(Int_t)fHistLimits[5],fHistLimits[3],fHistLimits[4]); |
237 | ||
2d065274 | 238 | hmpd[ic] = new TH1F(buf7,"mpd",20000,-10000.0,10000.0); |
f16935f7 | 239 | hCFDvsQTC[ic] = new TH2F(buf2,"CFD vs QTC", |
2d065274 | 240 | (Int_t)fHistLimits[8],fHistLimits[6],fHistLimits[7], |
241 | (Int_t)fHistLimits[11],fHistLimits[9],fHistLimits[10]); | |
f16935f7 | 242 | hCFDvsLED[ic] = new TH2F(buf3,"CFD vs LED-CFD", |
2d065274 | 243 | (Int_t)fHistLimits[14],fHistLimits[12],fHistLimits[13], |
244 | (Int_t)fHistLimits[17],fHistLimits[15],fHistLimits[16]); | |
245 | ||
246 | ||
fc387e80 | 247 | } |
fc387e80 | 248 | |
2d065274 | 249 | |
250 | } | |
2d065274 | 251 | |
252 | TH1F*hEffCFD= new TH1F("hEffCFD","Effeciency",50,-0.25,24.25); | |
253 | TH1F*hEffLED= new TH1F("hEffLED","Effeciency",50,-0.25,24.25); | |
254 | TH1F*hEffQT0= new TH1F("hEffQT0","Effeciency",50,-0.25,24.25); | |
255 | TH1F*hEffQT1= new TH1F("hEffQT1","Effeciency",50,-0.25,24.25); | |
256 | ||
257 | ||
258 | Char_t filename[13]; | |
259 | sprintf(filename,"t0%i.raw",fRunNumber); | |
260 | AliRawReader *reader = new AliRawReaderDate(filename); | |
261 | // AliRawReader *reader = new AliRawReaderFile(); | |
262 | reader->LoadEquipmentIdsMap("T0map.txt"); | |
263 | // reader->RequireHeader(kFALSE); | |
264 | reader->RequireHeader(kTRUE); | |
265 | AliT0RawReader *start = new AliT0RawReader(reader); | |
266 | // start->SetNumberOfTRM(1); | |
267 | for (Int_t i0=0; i0<105; i0++) | |
268 | { | |
269 | for (Int_t j0=0; j0<5; j0++) allData[i0][j0]=0; | |
270 | numberOfHits[i0]=0; | |
271 | } | |
272 | Int_t event=0; | |
273 | ||
274 | while (reader->NextEvent()) { | |
275 | start->Next(); | |
276 | for (Int_t i=0; i<105; i++) { | |
277 | for (Int_t iHit=0; iHit<5; iHit++) | |
278 | { | |
279 | allData[i][iHit]= start->GetData(i,iHit); | |
280 | } | |
281 | } | |
282 | ||
283 | if(event%1000 == 0) printf("Event:%d\n",event); | |
284 | ||
f16935f7 | 285 | // if(event > 200000) break; |
2d065274 | 286 | |
287 | for (Int_t it = 0; it<24; it=it+2) | |
fc387e80 | 288 | { |
2d065274 | 289 | for (Int_t iHit=0; iHit<5; iHit++) |
290 | { | |
291 | if(allData[it+25][iHit] != 0 && allData[it+26][iHit] !=0) | |
fc387e80 | 292 | { |
2d065274 | 293 | Int_t cc=it/2; |
2d065274 | 294 | hQTC[cc]->Fill(allData[it+25][iHit]-allData[it+26][iHit]); |
2d065274 | 295 | hmpd[cc]->Fill(allData[it+26][iHit]-allData[it+25][iHit]); |
f16935f7 | 296 | if(allData[cc+1][iHit] != 0 ) hCFDvsQTC[cc]->Fill(allData[it+25][iHit]-allData[it+26][iHit],allData[cc+1][iHit]-allData[0][0]); |
2d065274 | 297 | if(allData[cc+1][iHit] != 0 && allData[cc+13][iHit]!=0 ) |
298 | { | |
f16935f7 | 299 | hCFDvsLED[cc]->Fill(allData[cc+13][iHit]-allData[cc+1][iHit],allData[cc+1][iHit]-allData[0][0]); |
300 | h1CFDminLED[cc]->Fill(allData[cc+13][iHit]-allData[cc+1][iHit]); | |
2d065274 | 301 | } |
fc387e80 | 302 | } |
303 | } | |
304 | } | |
2d065274 | 305 | |
306 | for (Int_t iHit=0; iHit<5; iHit++) | |
307 | { | |
308 | ||
309 | for(Int_t ik=1; ik<105; ik++) | |
310 | { | |
311 | channels[ik] = -100; | |
312 | if((allData[ik][iHit] - allData[0][0]) > 0 ) | |
313 | { | |
314 | numberOfHits[ik]++; | |
315 | hChannel[ik] -> Fill(allData[ik][iHit] - allData[0][0]); | |
316 | channels[ik] = allData[ik][iHit] - allData[0][0]; | |
317 | } | |
fc387e80 | 318 | } |
2d065274 | 319 | digitsTree->Fill(); |
fc387e80 | 320 | } |
2d065274 | 321 | |
322 | event++; | |
323 | ||
324 | } //event | |
325 | ||
326 | ||
327 | if (event>1) | |
fc387e80 | 328 | { |
f16935f7 | 329 | printf("efficiency for %i events \n",event); |
2d065274 | 330 | for (Int_t i0=1; i0<13; i0++) |
331 | { | |
f16935f7 | 332 | printf("%s %f %s %f %s %f %s %f \n", |
333 | names[i0].Data(), Float_t(numberOfHits[i0])/Float_t(event), | |
334 | names[i0+13].Data(),Float_t(numberOfHits[i0+13])/Float_t(event), | |
335 | names[i0+57].Data(),Float_t(numberOfHits[i0+57])/Float_t(event), | |
336 | names[i0+69].Data(),Float_t(numberOfHits[i0+69])/Float_t(event)); | |
2d065274 | 337 | |
338 | hEffCFD->Fill(i0,Float_t(numberOfHits[i0]) / Float_t(event)); | |
339 | hEffLED->Fill(i0,Float_t(numberOfHits[i0+13]) / Float_t(event)); | |
340 | hEffCFD->Fill(i0+12,Float_t(numberOfHits[i0+57]) /Float_t(event)); | |
341 | hEffLED->Fill(i0+12,Float_t(numberOfHits[i0+69]) /Float_t(event)); | |
342 | } | |
2d065274 | 343 | |
344 | for (Int_t i0=0; i0<24; i0=i0+2) | |
345 | { | |
346 | hEffQT1->Fill(i0, Float_t (numberOfHits[i0+25]) / Float_t(event)); | |
347 | hEffQT0->Fill(i0, Float_t (numberOfHits[i0]+26) / Float_t(event)); | |
348 | hEffQT1->Fill((i0+12), Float_t (numberOfHits[i0]+81) / Float_t(event)); | |
349 | hEffQT0->Fill((i0+12), Float_t (numberOfHits[i0]+82) / Float_t(event)); | |
2d065274 | 350 | |
f16935f7 | 351 | printf("%s %f %s %f %s %f %s %f \n", |
352 | names[i0+25].Data(), Float_t(numberOfHits[i0+25])/Float_t(event), | |
353 | names[i0+26].Data(),Float_t(numberOfHits[i0+26])/Float_t(event), | |
354 | names[i0+81].Data(),Float_t(numberOfHits[i0+81])/Float_t(event), | |
355 | names[i0+82].Data(),Float_t(numberOfHits[i0+82])/Float_t(event)); | |
2d065274 | 356 | } |
357 | } | |
358 | ||
359 | ||
360 | Char_t filehist[40]; | |
361 | sprintf(filehist,"t0tree%i.root",fRunNumber); | |
362 | // sprintf(filehist,"test.root",runNumber); | |
363 | TFile *hist = new TFile(filehist,"RECREATE"); | |
f16935f7 | 364 | hist->cd(); |
2d065274 | 365 | // digitsTree->Write("",TObject::kOverwrite); |
366 | ||
367 | hEffCFD->Write(); | |
368 | hEffLED->Write(); | |
369 | hEffQT0->Write(); | |
370 | hEffQT1->Write(); | |
371 | ||
372 | for(Int_t ik=0; ik<105; ik++) hChannel[ik] ->Write(); | |
373 | ||
374 | for (Int_t i=0; i<12; i++) | |
fc387e80 | 375 | { |
2d065274 | 376 | hQTC[i]->Write(); |
377 | hmpd[i]->Write(); | |
f16935f7 | 378 | hCFDvsQTC[i]->Write(); |
379 | hCFDvsLED[i]->Write(); | |
380 | h1CFDminLED[i]->Write(); | |
fc387e80 | 381 | } |
f16935f7 | 382 | |
fc387e80 | 383 | } |