add DCS to Preprocessor LASER
[u/mrichter/AliRoot.git] / T0 / readRawDDLT0.C
1 void readRawDDLT0()
2 {
3
4   TH1F * hCFD[8]; TH1F *hLED[8]; TH1F*hQT01[4];TH1F*hQT02[4];
5   TH1F*hQTD[4]; TH1F*hADC[8]; TH2*hQTCFD[4];
6   Char_t buf1[10], buf2[10], buf3[10], buf4[10], buf5[10], buf6[10],buf7[10];
7   for (Int_t ic=0; ic<8; ic++)
8     {
9       sprintf(buf1,"CFD%i",ic+1);
10       hCFD[ic]= new TH1F(buf1,"CFD",500,0.5,6000.5);
11       sprintf(buf2,"LED%i",ic+1);
12       hLED[ic]= new TH1F(buf2,"LED",500,-0.5,2000.5);
13       //LED-CFD
14       sprintf(buf6,"ADC_%i",ic+1);
15       hADC[ic]= new TH1F(buf6,"QT1",500,0,6000);
16     }
17   
18   for (Int_t iq=0; iq<4; iq++)
19     {
20       //QT01 - QT04
21       sprintf(buf3,"QT0%i",iq+1);
22       hQT01[iq]= new TH1F(buf3,"QT01",500,0,6000);
23       sprintf(buf4,"QT1_%i",iq+1);
24       //QT11 - QT14 
25       hQT02[iq]= new TH1F(buf4,"QT02",500,0,6000);
26       sprintf(buf5,"QTD_%i",iq+1);
27       //QT11-QT01 ....
28       hQTD[iq]= new TH1F(buf5,"QTdiff",5000,1500,6000);
29
30       sprintf(buf7,"QTCFD_%i",iq+1);
31       hQTCFD[iq]= new TH2F(buf7,"QT vs CFD",500,0,6000,500,0,5000);
32   }
33
34   TH1F *hORA= new TH1F("hORA"," T0 A ",500, 1000,2000);
35   TH1F *hORC= new TH1F("hORC"," T0 C ",500, 1000,2000);
36   TH1F*hEffCFD= new TH1F("hEffCFD","Effeciency",8,0.25,4.25);
37
38   //  TH2F*hQTCFD= new TH2F("hQTCFD","QT vs CFD",500,0.5,6000.5,500,0.5,5000.5);
39   TH2F*hQTLED= new TH2F("hQTLED","QT vs LED",500,0.5,6000.5,500,0.5,5000.5);
40   TH2F*hLEDCFD= new TH2F("hLEDCFD","LEd vs CFD",500,-0.5,10000.5,500,-0.5,10000.5);
41
42   AliCDBManager* cdb      = AliCDBManager::Instance();
43   AliCDBStorage *stor = cdb->GetStorage("local://$ALICE_ROOT");
44
45   // AliRawReader *reader = new AliRawReaderDate("raw0/T0_3328.ddl");
46    AliRawReader *reader = new AliRawReaderFile();
47    //  reader->LoadEquipmentIdsMap("T0map.txt");
48    // reader->RequireHeader(kFALSE);
49   AliT0RawReader *start = new AliT0RawReader(reader);
50    Int_t allData[110][5];
51
52    while (reader->NextEvent()) {
53      start->Next();
54      for (Int_t i=0; i<110; i++) {
55        allData[i][0]= start->GetData(i,0);
56        cout<<" i "<< i<<" "<<allData[i][0] <<endl;
57      }
58    }
59    
60    /*
61   Char_t filedata[20];
62
63   sprintf(filedata,"START%i.root",runNumber);
64   TFile *f1 = new TFile(filedata);
65   //  f1->ls();
66   TTree *tree = (TTree *)f1->Get("raw");
67   //  t->Dump();
68   AliSTARTdigit *digit = 0;
69   tree->SetBranchAddress("START",&digit);
70   Int_t nevent=tree->GetEntries();
71   for(Int_t i=0; i<nevent; i++)
72     {
73       tree->GetEntry(i);
74       Int_t time = digit->CFD01();
75       hCFD[0]->Fill(time);
76       time = digit->CFD02();
77       hCFD[1]->Fill(time);
78       time = digit->CFD03();
79       hCFD[2]->Fill(time);
80       time = digit->CFD04();
81       hCFD[3]->Fill(time);
82       time = digit->CFD11();
83       hCFD[4]->Fill(time);
84       time = digit->CFD12();
85       hCFD[5]->Fill(time);
86       time = digit->CFD13();
87       hCFD[6]->Fill(time);
88       time = digit->CFD14();
89       hCFD[7]->Fill(time);
90       time = digit->LED01();
91       hLED[0]->Fill(time);
92       time = digit->LED02();
93       hLED[1]->Fill(time);
94       time = digit->LED03();
95       hLED[2]->Fill(time);
96       time = digit->LED04();
97       hLED[3]->Fill(time);
98       time = digit->LED05();
99       hLED[4]->Fill(time);
100       time = digit->LED06();
101       hLED[5]->Fill(time);
102       time = digit->LED07();
103       hLED[6]->Fill(time);
104       time = digit->LED08();
105       hLED[7]->Fill(time);
106
107       Int_t led=(digit->LED01()-digit->CFD01());
108       hLEDCFD->Fill(time,digit->CFD01());
109       
110       time = digit->QT01();
111       hQT01[0]->Fill(time);
112       time = digit->QT02();
113       hQT01[1]->Fill(time);
114       time = digit->QT03();
115       hQT01[2]->Fill(time);
116       time = digit->QT04();
117       hQT01[3]->Fill(time);
118
119       time = digit->QT11();
120       hQT02[0]->Fill(time);
121       time = digit->QT12();
122       hQT02[1]->Fill(time);
123       time = digit->QT13();
124       hQT02[2]->Fill(time);
125       time = digit->QT04();
126       hQT02[3]->Fill(time);
127       
128       
129       time = (digit->QT11() - digit->QT01());
130       hQTD[0]->Fill(time);
131       hQTLED->Fill(led,time);
132       hQTCFD[0]->Fill(time,digit->CFD01());
133
134       time = (digit->QT12() - digit->QT02());
135       hQTD[1]->Fill(time);
136       hQTCFD[1]->Fill(time,digit->CFD02());
137
138       time = (digit->QT13() - digit->QT03());
139       hQTD[2]->Fill(time);
140       hQTCFD[2]->Fill(time,digit->CFD03());
141       
142       time = (digit->QT14() - digit->QT04());
143       hQTD[3]->Fill(time);
144       hQTCFD[3]->Fill(time,digit->CFD04());
145       
146       time = (digit->LED01() - digit->CFD01());
147       hADC[0]->Fill(time);
148       time = (digit->LED02() - digit->CFD02());
149       hADC[1]->Fill(time);
150       time = (digit->QT03() - digit->CFD03());
151       hADC[2]->Fill(time);
152       time = (digit->QT04() - digit->CFD04());
153       hADC[3]->Fill(time);
154       time = (digit->LED05() - digit->CFD11());
155       hADC[4]->Fill(time);
156       time = (digit->LED06() - digit->CFD12());
157       hADC[5]->Fill(time);
158       time = (digit->LED07() - digit->CFD13());
159       hADC[6]->Fill(time);
160       time = (digit->LED08() - digit->CFD14());
161       hADC[7]->Fill(time);
162      
163       time = digit->ORA();
164       hORA->Fill(time);
165       time = digit->ORC();
166       hORC->Fill(time);
167       
168     }
169   cout<<nevent<<endl;
170   for (Int_t iq=0; iq<4; iq++)
171     {  
172       Float_t NCFD = 0; 
173       
174       Float_t NCFD =  hCFD[iq]->Integral(hCFD[iq]->GetXaxis()->FindBin(200.5),
175                                          hCFD[iq]->GetXaxis()->FindBin(600.5));
176       cout<<NCFD<<endl;
177       
178       hEffCFD->Fill(iq+1,NCFD/nevent);
179       
180     }
181
182   Char_t filehist[20]; 
183   sprintf(filehist,"hist%i.root",runNumber);
184   TFile *hist = new TFile(filehist,"RECREATE");
185
186   hLEDCFD->Write();
187   for (i=0; i<8; i++)
188     {
189       hCFD[i]->Write();
190       hLED[i]->Write();
191       hADC[i]->Write();
192     }
193   for (i=0; i<4; i++)
194     {
195       hQT01[i]->Write();
196       hQT02[i]->Write();
197       hQTD[i]->Write();
198       hQTCFD[i]->Write();
199     }
200   hEffCFD->Write();
201   hORA->Write();
202   hORC->Write();
203   hQTLED->Write();
204    */
205
206 }
207
208