1 |
pam-fi |
1.1 |
#include <utils/yodaUtility.h> |
2 |
|
|
#include "TrkFunctions.cpp" |
3 |
|
|
#include <iostream> |
4 |
|
|
#include <fstream> |
5 |
|
|
#include <TPaveText.h> |
6 |
|
|
#include <TLatex.h> |
7 |
|
|
#include <TCanvas.h> |
8 |
|
|
#include <TGraph.h> |
9 |
|
|
#include <PscuHeader.h> |
10 |
|
|
#include <EventHeader.h> |
11 |
|
|
#include <TrkAlarmEvent.h> |
12 |
|
|
#include <TStyle.h> |
13 |
|
|
#include <TObjString.h> |
14 |
|
|
#include <physics/tracker/TrackerEvent.h> |
15 |
|
|
#include <tsbt/TsbTRecord.h> |
16 |
|
|
#include <tsbt/TsbTEvent.h> |
17 |
|
|
|
18 |
|
|
|
19 |
|
|
/** |
20 |
|
|
* TrkQLook_EXPERT |
21 |
|
|
* |
22 |
|
|
* autor: D.Fedele |
23 |
|
|
* version 1.0 |
24 |
|
|
* Parameters: |
25 |
|
|
* base - the path to the root directory for the specific |
26 |
|
|
* Pamela unpack session |
27 |
|
|
* fromevent - first event to analyse |
28 |
|
|
* toevent - last event to analyse |
29 |
|
|
* outdir - total path of output file |
30 |
|
|
* outfile - extension of output file (pdf,ps,gif,jpg) |
31 |
|
|
* |
32 |
|
|
* |
33 |
|
|
*/ |
34 |
|
|
|
35 |
|
|
void TrkQLook_EXPERT(TString file,Int_t fromevent,Int_t toevent, TString outdir, TString outfile) |
36 |
|
|
{ |
37 |
|
|
// |
38 |
|
|
// obtain information about the data file and select the output dir |
39 |
|
|
const string filepath=file.Data(); |
40 |
|
|
Int_t dwpos = filepath.find("DW_"); |
41 |
|
|
Int_t dwpos1 = filepath.find(".root"); |
42 |
|
|
TString fpath=(filepath.c_str()); |
43 |
|
|
TString base,ffile ; |
44 |
|
|
stringcopy(ffile,fpath,dwpos,dwpos1); |
45 |
|
|
stringcopy(base,fpath,0,dwpos); |
46 |
|
|
|
47 |
|
|
TString out; |
48 |
|
|
if(outdir.Length()==0){ |
49 |
|
|
out = base; |
50 |
|
|
}else{ |
51 |
|
|
out = outdir; |
52 |
|
|
} |
53 |
|
|
|
54 |
|
|
// |
55 |
|
|
// inizialise the variables and open the file |
56 |
|
|
pamela::TsbTEvent *event = 0; |
57 |
|
|
pamela::TsbTRecord *record = 0; |
58 |
|
|
pamela::tracker::TrackerEvent *te=0; |
59 |
|
|
pamela::EventHeader *eh=0,*aleh=0; |
60 |
|
|
pamela::PscuHeader *ph=0; |
61 |
|
|
pamela::TrkAlarmEvent *al=0; |
62 |
|
|
|
63 |
|
|
TFile *datafile = new TFile(file); |
64 |
|
|
|
65 |
|
|
TTree *tree = (TTree*)datafile->Get("TsbT"); |
66 |
|
|
tree->SetBranchAddress("TsbT",&event); |
67 |
|
|
|
68 |
|
|
TTree *altr = (TTree*)datafile->Get("TrkAlarm"); |
69 |
|
|
altr->SetBranchAddress("TrkAlarm",&al); |
70 |
|
|
altr->SetBranchAddress("Header",&aleh); |
71 |
|
|
|
72 |
|
|
TTree *tr = (TTree*)datafile->Get("Physics"); |
73 |
|
|
tr->SetBranchAddress("Tracker",&te); |
74 |
|
|
tr->SetBranchAddress("Header",&eh); |
75 |
|
|
|
76 |
|
|
Long64_t nevent = tr->GetEntries(); |
77 |
|
|
Long64_t tnevent = tree->GetEntries(); |
78 |
|
|
Long64_t alnevent = altr->GetEntries(); |
79 |
|
|
Int_t minevent=0; |
80 |
|
|
Int_t maxevent=0; |
81 |
|
|
|
82 |
|
|
// cout<<"Total n.events "<<nevent <<endl; |
83 |
|
|
|
84 |
|
|
if (nevent<=0){ |
85 |
|
|
datafile->Close(); |
86 |
|
|
return; |
87 |
|
|
} |
88 |
|
|
if ( fromevent > toevent && toevent>0 ){ |
89 |
|
|
printf("It must be fromevent < toevent \n"); |
90 |
|
|
return; |
91 |
|
|
} |
92 |
|
|
if ( fromevent > nevent || fromevent < 0 ) { |
93 |
pam-fi |
1.3 |
printf("You can choose fromevent between 0 (all) and %lld \n",nevent); |
94 |
pam-fi |
1.1 |
return; |
95 |
|
|
} |
96 |
|
|
if ( toevent > nevent || toevent < 0 ) { |
97 |
pam-fi |
1.3 |
printf("You can choose toevent between 0 (all) and %lld \n",nevent); |
98 |
pam-fi |
1.1 |
return; |
99 |
|
|
} |
100 |
|
|
if ( fromevent == 0 ) { |
101 |
|
|
minevent = 0; |
102 |
|
|
maxevent = nevent; |
103 |
|
|
} else { |
104 |
|
|
minevent = fromevent; |
105 |
|
|
if ( toevent > 0 ){ |
106 |
|
|
maxevent = toevent+1; |
107 |
|
|
} else if (toevent > nevent) { |
108 |
|
|
maxevent = nevent; |
109 |
|
|
} else { |
110 |
|
|
maxevent = toevent+1; |
111 |
|
|
} |
112 |
|
|
nevent=maxevent-minevent ; |
113 |
|
|
} |
114 |
|
|
|
115 |
|
|
|
116 |
|
|
//if (fromevent!=0)cout << "Scan of events from "<<minevent << " to "<< maxevent-1<< endl << endl; |
117 |
|
|
//else cout << "Scan of events from "<<minevent+1 << " to "<< maxevent<< endl << endl; |
118 |
|
|
|
119 |
|
|
// |
120 |
|
|
// other variables definitions |
121 |
|
|
stringstream oss1,oss2,oss3,oss4,fromfile,isfile,tit; |
122 |
|
|
Int_t warning_dspnumber=0; |
123 |
|
|
Int_t ALARM=0; |
124 |
|
|
Int_t WARNING[12]; |
125 |
|
|
const Int_t size=nevent; |
126 |
pam-fi |
1.3 |
Int_t dsp=0; |
127 |
pam-fi |
1.1 |
Double_t yd[size*12], yc[size*12], x[size], eventint[size]; |
128 |
pam-fi |
1.3 |
Double_t yyc[size], hi=0, land[size*12][3], illum[size*12][3] ; |
129 |
pam-fi |
1.1 |
|
130 |
|
|
TGraph *comprtime,*temp[5]; |
131 |
|
|
TGraph *eventnumb; |
132 |
|
|
TH1F *landau1[12],*landau2[12],*landau3[12],*illuminazione[12]; |
133 |
|
|
TPaveText *pt1; |
134 |
|
|
TPad *pt; |
135 |
|
|
|
136 |
|
|
// |
137 |
|
|
// information about the entries for the temperatures |
138 |
|
|
Int_t tmpSize=0,siztmp=0,maxsize=0; |
139 |
|
|
for (Int_t ev=0; ev<tnevent; ev++){ |
140 |
|
|
tree->GetEntry(ev); |
141 |
|
|
tmpSize = event->Records->GetEntries(); |
142 |
|
|
maxsize+=tmpSize; |
143 |
|
|
} |
144 |
|
|
const Int_t tsize=maxsize; |
145 |
|
|
Int_t tempt[tsize][5],xt[tsize], tempt_tmp[tsize]; |
146 |
|
|
|
147 |
|
|
|
148 |
|
|
// |
149 |
|
|
// open the output text files for the alarms |
150 |
|
|
ofstream warning(out + "warning.txt",ios::out); |
151 |
|
|
TString fname = out+ffile; |
152 |
|
|
TString fname1 = out+ffile; |
153 |
|
|
int slen=fname.Length(); |
154 |
|
|
int last=fname.Last('_'); |
155 |
|
|
if(last<(slen-1))fname.Append('_'); |
156 |
|
|
fname.Append("Trk-ALARM-report.txt"); |
157 |
|
|
ofstream alarm(fname,ios::out); |
158 |
|
|
alarm << "TRACKER ALARM REPORT - Downlink " << ffile<< endl; |
159 |
|
|
fname1.Append("_TrkAlarm-pkt-report.txt"); |
160 |
|
|
ofstream alarm1(fname1,ios::out); |
161 |
|
|
alarm1 << "TrkAlarm pkt REPORT - Downlink " << ffile<< endl; |
162 |
|
|
|
163 |
|
|
// |
164 |
|
|
// write the file for the TrkAlarm packet |
165 |
|
|
if(alnevent==0) alarm1 <<endl<< "------> NO ALARM!!! <-------"<< endl; |
166 |
|
|
else{ |
167 |
|
|
for (Int_t ev=0; ev<alnevent; ev++){ |
168 |
|
|
altr->GetEntry(ev); |
169 |
|
|
ph = aleh->GetPscuHeader(); |
170 |
|
|
|
171 |
|
|
alarm1 << "================================================="<< endl; |
172 |
|
|
alarm1 << "PSCU-Pkt N. "<< ph->GetCounter() ; |
173 |
|
|
alarm1 << " - OBT "<< ph->GetOrbitalTime() << " ms"<<endl; |
174 |
|
|
alarm1 << "(ROOT-tree entry "<<ev<<")"<<endl; |
175 |
|
|
alarm1 << "================================================="<< endl; |
176 |
|
|
|
177 |
|
|
alarm1 << " ALARM[1]= "<<(Int_t)al->ALARM[1]<<endl; |
178 |
|
|
alarm1 << " ALARM[2]= "<<(Int_t)al->ALARM[2]<<endl; |
179 |
|
|
alarm1 << " Aswr= "<<(Int_t)al->Aswr<<endl; |
180 |
|
|
alarm1 << " BID[1]= "<<(Int_t)al->BID[0]<<endl; |
181 |
|
|
alarm1 << " BID[2]= "<<(Int_t)al->BID[1]<<endl; |
182 |
|
|
alarm1 << " BID[3]= "<<(Int_t)al->BID[2]<<endl; |
183 |
|
|
alarm1 << " BID[4]= "<<(Int_t)al->BID[3]<<endl; |
184 |
|
|
alarm1 << " BID[5]= "<<(Int_t)al->BID[4]<<endl; |
185 |
|
|
alarm1 << " BID[6]= "<<(Int_t)al->BID[5]<<endl; |
186 |
|
|
alarm1 << " BID[7]= "<<(Int_t)al->BID[6]<<endl; |
187 |
|
|
alarm1 << " CmdDuringTrig= "<<(Int_t)al->CmdDuringTrig<<endl; |
188 |
|
|
alarm1 << " CmdIDMA= "<<(Int_t)al->CmdIDMA<<endl; |
189 |
|
|
alarm1 << " CmdNum= "<<(Int_t)al->CmdNum<<endl; |
190 |
|
|
alarm1 << " DSPBusy= "<<(Int_t)al->DSPBusy<<endl; |
191 |
|
|
alarm1 << " DSPMask= "<<(Int_t)al->DSPMask<<endl; |
192 |
|
|
alarm1 << " DSPSoft= "<<(Int_t)al->DSPSoft<<endl; |
193 |
|
|
alarm1 << " FinalCheck= "<<(Int_t)al->FinalCheck<<endl; |
194 |
|
|
alarm1 << " FlashData= "<<(Int_t)al->FlashData<<endl; |
195 |
|
|
alarm1 << " FlashOn= "<<(Int_t)al->FlashOn<<endl; |
196 |
|
|
alarm1 << " FlashShutdown= "<<(Int_t)al->FlashShutdown<<endl; |
197 |
|
|
alarm1 << " FlashUpset= "<<(Int_t)al->FlashUpset<<endl; |
198 |
|
|
alarm1 << " InterCheck= "<<(Int_t)al->InterCheck<<endl; |
199 |
|
|
alarm1 << " PNum= "<<(Int_t)al->PNum<<endl; |
200 |
|
|
alarm1 << " TrigIDMA= "<<(Int_t)al->TrigIDMA<<endl; |
201 |
|
|
alarm1 << " TrigMask= "<<(Int_t)al->TrigMask<<endl; |
202 |
|
|
alarm1 << " UnknownCmd= "<<(Int_t)al->UnknownCmd<<endl; |
203 |
|
|
} |
204 |
|
|
} |
205 |
|
|
|
206 |
|
|
//*************************************************************************************** |
207 |
|
|
// LOOP on each event |
208 |
|
|
//*************************************************************************************** |
209 |
|
|
|
210 |
|
|
// |
211 |
|
|
// information about the temperatures |
212 |
|
|
for (Int_t ev=0; ev<tnevent; ev++){ |
213 |
|
|
tree->GetEntry(ev); |
214 |
|
|
tmpSize = event->Records->GetEntries(); |
215 |
|
|
for (Int_t j = 0; j < tmpSize; j++){ |
216 |
|
|
record = (pamela::TsbTRecord*)event->Records->At(j); |
217 |
|
|
xt[siztmp]=record->RECORD_OBT; //0.051*record->RECORD_OBT; |
218 |
|
|
for (Int_t z = 0; z < 5; z++){ |
219 |
|
|
tempt[siztmp][z] = record->TEMPERATURES[z+1]; |
220 |
|
|
} |
221 |
|
|
siztmp++; |
222 |
|
|
} |
223 |
|
|
} |
224 |
|
|
|
225 |
|
|
// |
226 |
|
|
// information about the tracker data |
227 |
|
|
for (Int_t ev=minevent; ev<maxevent; ev++){ |
228 |
|
|
tr->GetEntry(ev); |
229 |
|
|
ph = eh->GetPscuHeader(); |
230 |
|
|
dsp=0; |
231 |
|
|
ALARM=0; |
232 |
|
|
for(Int_t i=0; i<12; i++){ |
233 |
|
|
dsp=te->DSPnumber[i]-1; |
234 |
|
|
yd[(ev-minevent)*12+dsp]= te->DATAlength[i]; |
235 |
|
|
yc[(ev-minevent)*12+dsp]= 0.051*te->compressiontime[i]; |
236 |
|
|
for(Int_t j=0;j<3;j++){ |
237 |
|
|
illum[(ev-minevent)*12+dsp][j]=te->addrcluster[i][j]; |
238 |
|
|
if(!(dsp%2)&&(te->signcluster[i][j])!=0) |
239 |
|
|
land[(ev-minevent)*12+dsp][j]=1024-(te->signcluster[i][j]); |
240 |
|
|
else land[(ev-minevent)*12+dsp][j]=te->signcluster[i][j]; |
241 |
|
|
} |
242 |
|
|
x[(ev-minevent)]= ph->GetOrbitalTime(); |
243 |
|
|
|
244 |
|
|
WARNING[i]=0; |
245 |
|
|
if(te->fc[i]!=0 || te->fl1[i]!=0 || te->fl2[i]!=0 || te->fl3[i]!=0 || te->fl4[i]!=0 || te->fl5[i]!=0 || te->fl6[i]!=0){ |
246 |
|
|
ALARM = 1; //general alarm |
247 |
|
|
WARNING[i] = 1; // DSP warning |
248 |
|
|
}; |
249 |
|
|
|
250 |
|
|
if(te->alarm[i]!=0){ // hardware alarm |
251 |
|
|
ALARM = 1; |
252 |
|
|
}; |
253 |
|
|
|
254 |
|
|
//************************************************************************************** |
255 |
|
|
// warning for internal number |
256 |
|
|
//************************************************************************************** |
257 |
|
|
if(i<=10){ |
258 |
|
|
if(te->eventn[i]!=te->eventn[i+1]){ |
259 |
|
|
warning_dspnumber++; |
260 |
|
|
warning<< "==> WARNING!! Check entry "<< ev<<" (DSP "<<dsp<<")" <<endl<< |
261 |
|
|
"eventn["<<i<<"]= "<<te->eventn[i]<<"!= eventn["<<i+1<<"]= "<< te->eventn[i+1]<<endl; |
262 |
|
|
} |
263 |
|
|
else |
264 |
|
|
eventint[(ev-minevent)]=te->eventn[0]; |
265 |
|
|
} |
266 |
|
|
} |
267 |
|
|
|
268 |
|
|
if(ev<=maxevent-1){ |
269 |
|
|
|
270 |
|
|
if((ev-minevent)>=1 && eventint[(ev-minevent)]!=eventint[(ev-minevent)-1]+1 && eventint[(ev-minevent)]!=1){ |
271 |
|
|
warning_dspnumber++; |
272 |
|
|
warning<< "==> WARNING!! Check entry "<< ev<<endl<< |
273 |
|
|
" DSP event num.= "<< eventint[(ev-minevent)]<< |
274 |
|
|
" is different from (previus+1) ="<<eventint[(ev-minevent)-1]+1 <<"\n"<<endl; |
275 |
|
|
} |
276 |
|
|
}; |
277 |
|
|
|
278 |
|
|
//******************************************************************************************** |
279 |
|
|
// file ALARM |
280 |
|
|
//******************************************************************************************** |
281 |
|
|
if(ALARM==1) { |
282 |
|
|
|
283 |
|
|
alarm << "================================================="<< endl; |
284 |
|
|
alarm << "PSCU-Pkt N. "<< ph->GetCounter() ; |
285 |
|
|
alarm << " - OBT "<< ph->GetOrbitalTime() << " ms"<<endl; |
286 |
|
|
alarm << "(ROOT-tree entry "<<ev<<")"<<endl; |
287 |
|
|
alarm << "================================================="<< endl; |
288 |
|
|
|
289 |
|
|
alarm << " DSPn"; |
290 |
|
|
alarm << " Event"; |
291 |
|
|
alarm << " Words"; |
292 |
|
|
alarm << " crc"; |
293 |
|
|
alarm << " FC"; |
294 |
|
|
alarm << " FL1"; |
295 |
|
|
alarm << " FL2"; |
296 |
|
|
alarm << " FL3"; |
297 |
|
|
alarm << " FL4"; |
298 |
|
|
alarm << " FL5"; |
299 |
|
|
alarm << " FL6" << endl; |
300 |
|
|
|
301 |
|
|
for(Int_t i=0; i<12 ; i++){ |
302 |
|
|
alarm.width(5); alarm << te->DSPnumber[i]; |
303 |
|
|
alarm.width(6); alarm << te->eventn[i]; |
304 |
|
|
alarm.width(6); alarm << te->DATAlength[i]; |
305 |
|
|
alarm.width(4); alarm << te->crc[i]; |
306 |
|
|
alarm.width(4); alarm << te->fc[i]; |
307 |
|
|
alarm.width(4); alarm << te->fl1[i]; |
308 |
|
|
alarm.width(4); alarm << te->fl2[i]; |
309 |
|
|
alarm.width(4); alarm << te->fl3[i]; |
310 |
|
|
alarm.width(4); alarm << te->fl4[i]; |
311 |
|
|
alarm.width(4); alarm << te->fl5[i]; |
312 |
|
|
alarm.width(4); alarm << te->fl6[i]; |
313 |
|
|
if(te->alarm[i]!=0)alarm<<" >> ALARM "; |
314 |
|
|
if(WARNING[i]!=0)alarm<<" (DSP warning) "; |
315 |
|
|
alarm << endl; |
316 |
|
|
} |
317 |
|
|
} |
318 |
|
|
} |
319 |
|
|
if(ALARM==0) alarm << endl<< "------> NO ALARM!!! <-------"<<endl; |
320 |
|
|
|
321 |
|
|
if(warning_dspnumber==0) warning<<"NONE"<<endl; |
322 |
|
|
|
323 |
|
|
//***************************************** |
324 |
|
|
//close all files |
325 |
|
|
//***************************************** |
326 |
|
|
warning.close(); |
327 |
|
|
alarm.close(); |
328 |
|
|
datafile->Close(); |
329 |
|
|
|
330 |
|
|
|
331 |
|
|
gStyle->SetLabelSize(0.05,"x"); |
332 |
|
|
gStyle->SetLabelSize(0.06,"y"); |
333 |
|
|
gStyle->SetStatFontSize(0.075); |
334 |
|
|
gStyle->SetOptStat(1110); |
335 |
|
|
gStyle->SetFillColor(10); |
336 |
|
|
gStyle->SetTitleFillColor(10); |
337 |
|
|
gStyle->SetTitleFontSize(0.1); |
338 |
|
|
gStyle->SetTitleOffset(0.8,"y"); |
339 |
|
|
gStyle->SetTitleOffset(0.9,"x"); |
340 |
|
|
gStyle->SetTitleSize(0.06,"y"); |
341 |
|
|
gStyle->SetTitleSize(0.055,"x"); |
342 |
|
|
|
343 |
|
|
//**************************************************************************************** |
344 |
|
|
//Output figures --- First sheet: |
345 |
|
|
//**************************************************************************************** |
346 |
|
|
|
347 |
|
|
TCanvas *CompTimeCanv=new TCanvas("Tracker_Detector_Report_4/6","",900,1200); |
348 |
|
|
CompTimeCanv->SetFillColor(10); |
349 |
|
|
CompTimeCanv->Range(0,0,100,100); |
350 |
|
|
fromfile<<"TrackerQLookExpert File: "<<ffile; |
351 |
|
|
isfile<<"COMPRESSIONTIME vs. OBT"; |
352 |
|
|
TLatex *t=new TLatex(); |
353 |
|
|
t->SetTextFont(32); |
354 |
|
|
t->SetTextColor(1); |
355 |
|
|
t->SetTextAlign(12); |
356 |
|
|
t->SetTextSize(0.02); |
357 |
|
|
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
358 |
|
|
TLatex *t1=new TLatex(); |
359 |
|
|
t1->SetTextFont(32); |
360 |
|
|
t1->SetTextColor(1); |
361 |
|
|
t1->SetTextAlign(12); |
362 |
|
|
t1->SetTextSize(0.02); |
363 |
|
|
t1->DrawLatex(64.,98.7,isfile.str().c_str()); |
364 |
|
|
isfile.str(""); |
365 |
|
|
|
366 |
|
|
//**************************************************************************************** |
367 |
|
|
//Output figures --- Second sheet: |
368 |
|
|
//**************************************************************************************** |
369 |
|
|
|
370 |
|
|
TCanvas *EventNumCanv=new TCanvas("Tracker_Detector_Report_5/6","",900,1200); |
371 |
|
|
EventNumCanv->SetFillColor(10); |
372 |
|
|
EventNumCanv->Range(0,0,100,100); |
373 |
|
|
isfile<<"WARNINGS on DSP EVENT NUMBER "; |
374 |
|
|
t->SetTextFont(32); |
375 |
|
|
t->SetTextColor(1); |
376 |
|
|
t->SetTextAlign(12); |
377 |
|
|
t->SetTextSize(0.02); |
378 |
|
|
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
379 |
|
|
t1->SetTextFont(32); |
380 |
|
|
t1->SetTextColor(1); |
381 |
|
|
t1->SetTextAlign(12); |
382 |
|
|
t1->SetTextSize(0.02); |
383 |
|
|
t1->DrawLatex(68.4,98.7,isfile.str().c_str()); |
384 |
|
|
isfile.str(""); |
385 |
|
|
|
386 |
|
|
//**************************************************************************************** |
387 |
|
|
//Output figures --- Third sheet: |
388 |
|
|
//**************************************************************************************** |
389 |
|
|
|
390 |
|
|
TCanvas *LandauCanv1=new TCanvas("Landau ladder1","",900,1200); |
391 |
|
|
LandauCanv1->SetFillColor(10); |
392 |
|
|
LandauCanv1->Range(0,0,100,100); |
393 |
|
|
isfile<<"Landau ladder1"; |
394 |
|
|
|
395 |
|
|
t->SetTextFont(32); |
396 |
|
|
t->SetTextColor(1); |
397 |
|
|
t->SetTextAlign(12); |
398 |
|
|
t->SetTextSize(0.02); |
399 |
|
|
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
400 |
|
|
t1->SetTextFont(32); |
401 |
|
|
t1->SetTextColor(1); |
402 |
|
|
t1->SetTextAlign(12); |
403 |
|
|
t1->SetTextSize(0.02); |
404 |
|
|
t1->DrawLatex(70.,98.7,isfile.str().c_str()); |
405 |
|
|
isfile.str(""); |
406 |
|
|
// //**************************************************************************************** |
407 |
|
|
// //Output figures --- Third sheet: |
408 |
|
|
// //**************************************************************************************** |
409 |
|
|
|
410 |
|
|
TCanvas *LandauCanv2=new TCanvas("Landau ladder2","",900,1200); |
411 |
|
|
LandauCanv2->SetFillColor(10); |
412 |
|
|
LandauCanv2->Range(0,0,100,100); |
413 |
|
|
isfile<<"Landau ladder2"; |
414 |
|
|
|
415 |
|
|
t->SetTextFont(32); |
416 |
|
|
t->SetTextColor(1); |
417 |
|
|
t->SetTextAlign(12); |
418 |
|
|
t->SetTextSize(0.02); |
419 |
|
|
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
420 |
|
|
t1->SetTextFont(32); |
421 |
|
|
t1->SetTextColor(1); |
422 |
|
|
t1->SetTextAlign(12); |
423 |
|
|
t1->SetTextSize(0.02); |
424 |
|
|
t1->DrawLatex(70.,98.7,isfile.str().c_str()); |
425 |
|
|
isfile.str(""); |
426 |
|
|
|
427 |
|
|
// //**************************************************************************************** |
428 |
|
|
// //Output figures --- Third sheet: |
429 |
|
|
// //**************************************************************************************** |
430 |
|
|
|
431 |
|
|
TCanvas *LandauCanv3=new TCanvas("Landau ladder3","",900,1200); |
432 |
|
|
LandauCanv3->SetFillColor(10); |
433 |
|
|
LandauCanv3->Range(0,0,100,100); |
434 |
|
|
isfile<<"Landau ladder3"; |
435 |
|
|
|
436 |
|
|
t->SetTextFont(32); |
437 |
|
|
t->SetTextColor(1); |
438 |
|
|
t->SetTextAlign(12); |
439 |
|
|
t->SetTextSize(0.02); |
440 |
|
|
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
441 |
|
|
t1->SetTextFont(32); |
442 |
|
|
t1->SetTextColor(1); |
443 |
|
|
t1->SetTextAlign(12); |
444 |
|
|
t1->SetTextSize(0.02); |
445 |
|
|
t1->DrawLatex(70.,98.7,isfile.str().c_str()); |
446 |
|
|
isfile.str(""); |
447 |
|
|
|
448 |
|
|
// //**************************************************************************************** |
449 |
|
|
// //Output figures --- Fourth sheet: |
450 |
|
|
// //**************************************************************************************** |
451 |
|
|
|
452 |
|
|
TCanvas *IlluminaCanv=new TCanvas("Illuminazione","",900,1200); |
453 |
|
|
IlluminaCanv->SetFillColor(10); |
454 |
|
|
IlluminaCanv->Range(0,0,100,100); |
455 |
pam-fi |
1.2 |
isfile<<"lighting of the views"; |
456 |
pam-fi |
1.1 |
t->SetTextFont(32); |
457 |
|
|
t->SetTextColor(1); |
458 |
|
|
t->SetTextAlign(12); |
459 |
|
|
t->SetTextSize(0.02); |
460 |
|
|
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
461 |
|
|
t1->SetTextFont(32); |
462 |
|
|
t1->SetTextColor(1); |
463 |
|
|
t1->SetTextAlign(12); |
464 |
|
|
t1->SetTextSize(0.02); |
465 |
|
|
t1->DrawLatex(70.,98.7,isfile.str().c_str()); |
466 |
|
|
isfile.str(""); |
467 |
|
|
|
468 |
|
|
//**************************************************************************************** |
469 |
|
|
//Output figures --- Fifth sheet: |
470 |
|
|
//**************************************************************************************** |
471 |
|
|
|
472 |
|
|
TCanvas *TempCanv=new TCanvas("Tracker_Detector_Temperaturt","",900,1200); |
473 |
|
|
TempCanv->SetFillColor(10); |
474 |
|
|
TempCanv->Range(0,0,100,100); |
475 |
|
|
isfile<<"Temperatures vs OBT"; |
476 |
|
|
|
477 |
|
|
t->SetTextFont(32); |
478 |
|
|
t->SetTextColor(1); |
479 |
|
|
t->SetTextAlign(12); |
480 |
|
|
t->SetTextSize(0.02); |
481 |
|
|
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
482 |
|
|
t1->SetTextFont(32); |
483 |
|
|
t1->SetTextColor(1); |
484 |
|
|
t1->SetTextAlign(12); |
485 |
|
|
t1->SetTextSize(0.02); |
486 |
|
|
t1->DrawLatex(80.,98.7,isfile.str().c_str()); |
487 |
|
|
isfile.str(""); |
488 |
|
|
|
489 |
|
|
//************************************************************************************* |
490 |
|
|
//book pads and histos |
491 |
|
|
//*************************************************************************************** |
492 |
|
|
|
493 |
|
|
TPad *pad1[12],*pad2[12],*pad3[12],*pad4[12],*pad5[12],*pad6[5]; //pad for histos |
494 |
|
|
Double_t posy = 0.95; // up y-coord - top pads |
495 |
|
|
Double_t hpad = 0; // pad height |
496 |
|
|
Double_t posx1=0; // left x-coord - pad column |
497 |
|
|
Double_t posx0=0; // x-coord - column division |
498 |
|
|
Double_t wrel = 0; // relative x size of first sub-column |
499 |
|
|
Double_t marg = 0.004; // margin among pads |
500 |
|
|
Double_t tposy = 0.95; // up y-coord - top pads |
501 |
|
|
Double_t thpad = 0; // pad height |
502 |
|
|
Double_t tposx1=0; // left x-coord - pad column |
503 |
|
|
Double_t tposx0=0; // x-coord - column division |
504 |
|
|
Double_t twrel = 0; // relative x size of first sub-column |
505 |
|
|
Double_t tmarg = 0.004; // margin among pads |
506 |
|
|
|
507 |
|
|
hpad = (posy-marg*11)/6; |
508 |
|
|
wrel = (1-marg*4)/2; |
509 |
|
|
thpad = (tposy-tmarg*5)/3; |
510 |
|
|
twrel = (1-tmarg*4)/2; |
511 |
|
|
stringstream title; |
512 |
|
|
stringstream hid; |
513 |
|
|
|
514 |
|
|
for(Int_t n = 0; n<12; n++) { |
515 |
|
|
|
516 |
|
|
if ( (n+1)%2==1 ) { |
517 |
|
|
if(n>1) posy = posy-(marg*2+hpad); |
518 |
|
|
posx1 = marg; |
519 |
|
|
posx0 = posx1 + wrel; |
520 |
|
|
} |
521 |
|
|
else { |
522 |
|
|
posx1 = posx0 + 2*marg; |
523 |
|
|
posx0 = posx1 + wrel; |
524 |
|
|
} |
525 |
|
|
|
526 |
|
|
if ( (n+1)%2==1 ) { |
527 |
|
|
if(n>1) tposy = tposy-(tmarg*2+thpad); |
528 |
|
|
tposx1 = tmarg; |
529 |
|
|
tposx0 = tposx1 + twrel; |
530 |
|
|
} |
531 |
|
|
else { |
532 |
|
|
tposx1 = tposx0 + 2*tmarg; |
533 |
|
|
tposx0 = tposx1 + twrel; |
534 |
|
|
} |
535 |
|
|
|
536 |
|
|
|
537 |
|
|
/* -----------> pad for histograms */ |
538 |
|
|
pad1[n] = new TPad("pad1"," ",posx1,posy-hpad,posx0,posy,18,0,0); |
539 |
|
|
pad2[n] = new TPad("pad2"," ",posx1,posy-hpad,posx0,posy,18,0,0); |
540 |
|
|
pad3[n] = new TPad("pad3"," ",posx1,posy-hpad,posx0,posy,18,0,0); |
541 |
|
|
pad4[n] = new TPad("pad4"," ",posx1,posy-hpad,posx0,posy,18,0,0); |
542 |
|
|
pad5[n] = new TPad("pad5"," ",posx1,posy-hpad,posx0,posy,18,0,0); |
543 |
|
|
if(n<5) pad6[n] = new TPad("pad6"," ",tposx1,tposy-thpad,tposx0,tposy,18,0,0); |
544 |
|
|
|
545 |
|
|
|
546 |
|
|
/* -----------> HISTOGRAMS */ |
547 |
|
|
|
548 |
|
|
oss1<<"DSP "<<n+1; |
549 |
|
|
oss2<<"DSPh "<<n+1; |
550 |
|
|
oss3<<"DSP h "<<n+1; |
551 |
|
|
oss4<<"DSP h"<<n+1; |
552 |
|
|
|
553 |
|
|
landau1[n]=new TH1F(oss1.str().c_str(),oss1.str().c_str(),1200,0.5,1200.5); |
554 |
|
|
landau1[n]->GetXaxis()->SetTitle("max signal"); |
555 |
|
|
landau1[n]->GetXaxis()->CenterTitle(); |
556 |
|
|
landau2[n]=new TH1F(oss2.str().c_str(),oss1.str().c_str(),1200,0.5,1200.5); |
557 |
|
|
landau2[n]->GetXaxis()->SetTitle("max signal"); |
558 |
|
|
landau2[n]->GetXaxis()->CenterTitle(); |
559 |
|
|
landau3[n]=new TH1F(oss3.str().c_str(),oss1.str().c_str(),1200,0.5,1200.5); |
560 |
|
|
landau3[n]->GetXaxis()->SetTitle("max signal"); |
561 |
|
|
landau3[n]->GetXaxis()->CenterTitle(); |
562 |
|
|
|
563 |
|
|
illuminazione[n]=new TH1F(oss4.str().c_str(),oss1.str().c_str(),3072,0.5,3072.5); |
564 |
|
|
illuminazione[n]->GetXaxis()->SetTitle("strip with max signal"); |
565 |
|
|
illuminazione[n]->GetXaxis()->CenterTitle(); |
566 |
|
|
|
567 |
|
|
oss1.str(""); |
568 |
|
|
oss2.str(""); |
569 |
|
|
oss3.str(""); |
570 |
|
|
oss4.str(""); |
571 |
|
|
}; |
572 |
|
|
|
573 |
|
|
|
574 |
|
|
//********************************************************************************** |
575 |
|
|
// Fill Graphs and Histos |
576 |
|
|
//********************************************************************************** |
577 |
|
|
|
578 |
|
|
for (Int_t i=0; i<12 ; i++){ |
579 |
|
|
|
580 |
|
|
for (Int_t ev=minevent; ev<maxevent; ev++){ |
581 |
|
|
yyc[(ev-minevent)]=yc[12*(ev-minevent)+i]; |
582 |
|
|
landau1[i]->Fill(land[12*(ev-minevent)+i][1]); |
583 |
|
|
landau2[i]->Fill(land[12*(ev-minevent)+i][2]); |
584 |
|
|
landau3[i]->Fill(land[12*(ev-minevent)+i][3]); |
585 |
|
|
for(Int_t j=0;j<3;j++){ |
586 |
|
|
hi=(j*1024)+illum[12*(ev-minevent)+i][j]; |
587 |
|
|
illuminazione[i]->Fill(hi); |
588 |
|
|
} |
589 |
|
|
} |
590 |
|
|
|
591 |
|
|
LandauCanv1->cd(); |
592 |
|
|
pad1[i]->SetFillColor(10); |
593 |
|
|
pad1[i]->SetFrameFillColor(10); |
594 |
|
|
pad1[i]->Draw(); |
595 |
|
|
pad1[i]->cd(); |
596 |
|
|
landau1[i]->Draw(""); |
597 |
|
|
LandauCanv2->cd(); |
598 |
|
|
pad4[i]->SetFillColor(10); |
599 |
|
|
pad4[i]->SetFrameFillColor(10); |
600 |
|
|
pad4[i]->Draw(); |
601 |
|
|
pad4[i]->cd(); |
602 |
|
|
landau2[i]->Draw(""); |
603 |
|
|
LandauCanv3->cd(); |
604 |
|
|
pad5[i]->SetFillColor(10); |
605 |
|
|
pad5[i]->SetFrameFillColor(10); |
606 |
|
|
pad5[i]->Draw(); |
607 |
|
|
pad5[i]->cd(); |
608 |
|
|
landau3[i]->Draw(""); |
609 |
|
|
|
610 |
|
|
IlluminaCanv->cd(); |
611 |
|
|
pad2[i]->SetFillColor(10); |
612 |
|
|
pad2[i]->SetFrameFillColor(10); |
613 |
|
|
pad2[i]->Draw(); |
614 |
|
|
pad2[i]->cd(); |
615 |
|
|
pad2[i]->SetLogy(); |
616 |
|
|
illuminazione [i]->SetStats(kFALSE); |
617 |
|
|
illuminazione[i]->Draw(""); |
618 |
|
|
|
619 |
|
|
CompTimeCanv->cd(); |
620 |
|
|
pad3[i]->SetFillColor(10); |
621 |
|
|
pad3[i]->SetFrameFillColor(10); |
622 |
|
|
pad3[i]->Draw(); |
623 |
|
|
pad3[i]->cd(); |
624 |
|
|
comprtime= new TGraph(nevent,x,yyc); |
625 |
|
|
oss1<<"DSP "<<i+1; |
626 |
|
|
comprtime->SetTitle(oss1.str().c_str()); |
627 |
|
|
comprtime->GetXaxis()->SetTitle("OBT (ms)"); |
628 |
|
|
comprtime->GetXaxis()->CenterTitle(); |
629 |
|
|
comprtime->GetYaxis()->SetTitle("compressiontime (ms)"); |
630 |
|
|
comprtime->GetYaxis()->CenterTitle(); |
631 |
|
|
comprtime->GetYaxis()->SetRangeUser(0,2); |
632 |
|
|
comprtime->Draw("ap"); |
633 |
|
|
oss1.str(""); |
634 |
|
|
}; |
635 |
|
|
|
636 |
|
|
EventNumCanv->cd(); |
637 |
|
|
TPad *pt0=new TPad("pt0"," ",0.704,0.004,0.996,0.98); |
638 |
|
|
pt1 = new TPaveText(0.004,0.004,0.986,0.996); |
639 |
|
|
pt = new TPad("pt"," ",0.004,0.004,0.7,0.98,18,0,0); |
640 |
|
|
pt1->SetFillColor(10); |
641 |
|
|
pt1->ReadFile(out + "warning.txt"); |
642 |
|
|
pt1->SetTextAlign(22); |
643 |
|
|
pt1->SetTextSize(0.035); |
644 |
|
|
pt0->SetFillColor(10); |
645 |
|
|
pt0->SetFrameFillColor(10); |
646 |
|
|
pt0->Draw(); |
647 |
|
|
pt0->cd(); |
648 |
|
|
pt1->Draw(); |
649 |
|
|
EventNumCanv->cd(); |
650 |
|
|
pt->SetFillColor(10); |
651 |
|
|
pt->SetFrameFillColor(10); |
652 |
|
|
pt->Draw(); |
653 |
|
|
pt->cd(); |
654 |
|
|
eventnumb=new TGraph(nevent,x,eventint); |
655 |
|
|
eventnumb->SetTitle(""); |
656 |
|
|
eventnumb->GetXaxis()->SetLabelSize(0.04); |
657 |
|
|
eventnumb->GetXaxis()->SetTitleSize(0.04); |
658 |
|
|
eventnumb->GetXaxis()->SetTitle("OBT (ms)"); |
659 |
|
|
eventnumb->GetXaxis()->CenterTitle(); |
660 |
|
|
eventnumb->GetXaxis()->SetTickLength(0.01); |
661 |
|
|
eventnumb->GetXaxis()->SetTitleOffset(1.2); |
662 |
|
|
eventnumb->GetYaxis()->SetLabelSize(0.04); |
663 |
|
|
eventnumb->GetYaxis()->SetTitleSize(0.04); |
664 |
|
|
eventnumb->GetYaxis()->SetTitle("DSP event-number"); |
665 |
|
|
eventnumb->GetYaxis()->CenterTitle(); |
666 |
|
|
eventnumb->GetYaxis()->SetTitleOffset(1.5); |
667 |
|
|
eventnumb->SetMarkerStyle(21); |
668 |
|
|
eventnumb->SetMarkerColor(kBlue); |
669 |
|
|
eventnumb->SetMarkerSize(0.3); |
670 |
|
|
eventnumb->Draw("ap"); |
671 |
|
|
|
672 |
|
|
for(Int_t i=0; i<5; i++){ |
673 |
|
|
for (Int_t ev=0; ev<tsize; ev++){ |
674 |
|
|
tempt_tmp[ev]=(Int_t)(((3.3*tempt[ev][i]/4096)-0.586)/0.0231); |
675 |
|
|
} |
676 |
|
|
TempCanv->cd(); |
677 |
|
|
tit<<"T"<<i+5<<" (magnetic module "<<i+1<<")"; |
678 |
|
|
pad6[i]->SetFillColor(10); |
679 |
|
|
pad6[i]->Draw(); |
680 |
|
|
pad6[i]->cd(); |
681 |
|
|
temp[i]= new TGraph(tsize,xt,tempt_tmp); |
682 |
|
|
temp[i]->SetTitle(tit.str().c_str()); |
683 |
|
|
temp[i]->GetXaxis()->SetLabelSize(0.04); |
684 |
|
|
temp[i]->GetXaxis()->SetTitleSize(0.04); |
685 |
|
|
temp[i]->GetXaxis()->SetTitle("OBT (ms)"); |
686 |
|
|
temp[i]->GetXaxis()->CenterTitle(); |
687 |
|
|
temp[i]->GetXaxis()->SetTitleOffset(0.85); |
688 |
|
|
temp[i]->GetYaxis()->SetTitleOffset(1.2); |
689 |
|
|
temp[i]->GetYaxis()->SetLabelOffset(0.001); |
690 |
|
|
temp[i]->GetYaxis()->SetLabelSize(0.04); |
691 |
|
|
temp[i]->GetYaxis()->SetTitleSize(0.04); |
692 |
|
|
temp[i]->GetYaxis()->SetTitle("Temperatures ( ^{o}C)"); |
693 |
|
|
temp[i]->GetYaxis()->CenterTitle(); |
694 |
|
|
temp[i]->SetMarkerStyle(21); |
695 |
|
|
temp[i]->SetMarkerSize(0.2); |
696 |
|
|
temp[i]->Draw("ap"); |
697 |
|
|
tit.str(""); |
698 |
|
|
} |
699 |
|
|
CompTimeCanv->Update(); |
700 |
|
|
LandauCanv1->Update(); |
701 |
|
|
LandauCanv2->Update(); |
702 |
|
|
LandauCanv3->Update(); |
703 |
|
|
IlluminaCanv->Update(); |
704 |
|
|
TempCanv->Update(); |
705 |
|
|
|
706 |
|
|
//************************************************************************* |
707 |
|
|
// Save output Files |
708 |
|
|
//************************************************************************* |
709 |
|
|
stringstream out1,out2,out3,command; |
710 |
|
|
|
711 |
|
|
if(!strcmp(outfile.Data(),"ps")||!strcmp(outfile.Data(),"pdf")){ |
712 |
|
|
out1.str(""); |
713 |
|
|
out2.str(""); |
714 |
|
|
out3.str(""); |
715 |
|
|
|
716 |
|
|
out1<<ffile<<"_TrkQLook_EXPERT.ps("; |
717 |
|
|
out2<<ffile<<"_TrkQLook_EXPERT.ps"; |
718 |
|
|
out3<<ffile<<"_TrkQLook_EXPERT.ps)"; |
719 |
|
|
|
720 |
|
|
CompTimeCanv->Print(out+out1.str().c_str(),"Portrait"); |
721 |
|
|
EventNumCanv->Print(out+out2.str().c_str(),"Portrait"); |
722 |
|
|
LandauCanv1->Print(out+out2.str().c_str(),"Portrait"); |
723 |
|
|
LandauCanv2->Print(out+out2.str().c_str(),"Portrait"); |
724 |
|
|
LandauCanv3->Print(out+out2.str().c_str(),"Portrait"); |
725 |
|
|
IlluminaCanv->Print(out+out2.str().c_str(),"Portrait"); |
726 |
|
|
TempCanv->Print(out+out3.str().c_str(),"Portrait"); |
727 |
|
|
|
728 |
|
|
if(!strcmp(outfile.Data(),"pdf")){ |
729 |
|
|
stringstream com; |
730 |
|
|
com<<"ps2pdf13 "<<out<<ffile<<"_TrkQLook_EXPERT.ps "<<out<<ffile<<"_TrkQLook_EXPERT.pdf"; |
731 |
|
|
system(com.str().c_str()); |
732 |
|
|
com.str(""); |
733 |
|
|
com<<"rm -f "<<out<<ffile<<"_TrkQLook_EXPERT.ps "; |
734 |
|
|
system(com.str().c_str()); |
735 |
|
|
com.str(""); |
736 |
|
|
} |
737 |
|
|
} |
738 |
|
|
else{ |
739 |
|
|
out1.str(""); |
740 |
|
|
out1<<ffile<<"_TrkQLook_EXPERT-CompTime."<<outfile.Data(); |
741 |
|
|
CompTimeCanv->Print(out+out1.str().c_str()); |
742 |
|
|
out1.str(""); |
743 |
|
|
out1<<ffile<<"_TrkQLook_EXPERT-Temp."<<outfile.Data(); |
744 |
|
|
TempCanv->Print(out+out1.str().c_str()); |
745 |
|
|
out1.str(""); |
746 |
|
|
out1<<ffile<<"_TrkQLook_EXPERT-EvNum."<<outfile.Data(); |
747 |
|
|
EventNumCanv->Print(out+out1.str().c_str()); |
748 |
|
|
out1.str(""); |
749 |
|
|
out1<<ffile<<"_TrkQLook_EXPERT-LandauL1."<<outfile.Data(); |
750 |
|
|
LandauCanv1->Print(out+out1.str().c_str()); |
751 |
|
|
out1.str(""); |
752 |
|
|
out1<<ffile<<"_TrkQLook_EXPERT-LandauL2."<<outfile.Data(); |
753 |
|
|
LandauCanv2->Print(out+out1.str().c_str()); |
754 |
|
|
out1.str(""); |
755 |
|
|
out1<<ffile<<"_TrkQLook_EXPERT-LandauL3."<<outfile.Data(); |
756 |
|
|
LandauCanv3->Print(out+out1.str().c_str()); |
757 |
|
|
out1.str(""); |
758 |
|
|
out1<<ffile<<"_TrkQLook_EXPERT-Illum."<<outfile.Data(); |
759 |
|
|
IlluminaCanv->Print(out+out1.str().c_str()); |
760 |
|
|
} |
761 |
|
|
|
762 |
|
|
for (Int_t i=0; i<12 ; i++){ |
763 |
|
|
delete landau1[i]; |
764 |
|
|
delete landau2[i]; |
765 |
|
|
delete landau3[i]; |
766 |
|
|
delete illuminazione[i]; |
767 |
|
|
if(i<5) temp[i]->Delete(); |
768 |
|
|
} |
769 |
|
|
eventnumb->Delete(); |
770 |
|
|
comprtime->Delete(); |
771 |
|
|
delete CompTimeCanv; |
772 |
|
|
delete EventNumCanv; |
773 |
|
|
delete LandauCanv1; |
774 |
|
|
delete LandauCanv2; |
775 |
|
|
delete LandauCanv3; |
776 |
|
|
delete IlluminaCanv; |
777 |
|
|
delete TempCanv; |
778 |
|
|
|
779 |
|
|
command.str(""); |
780 |
|
|
command<<"rm -f "<<out<<"warning.txt"; |
781 |
|
|
system(command.str().c_str()); |
782 |
|
|
|
783 |
|
|
gROOT->Reset(); |
784 |
|
|
// printf("... end of packets. \n"); |
785 |
|
|
return; |
786 |
|
|
} |