2 |
* FTrkScanQlook_EXPERT.cxx |
* FTrkScanQlook_EXPERT.cxx |
3 |
* |
* |
4 |
* autor: D.Fedele |
* autor: D.Fedele |
5 |
* version 2.0 |
* version v1r12 |
6 |
* Parameters: |
* Parameters: |
7 |
* file - the path to the root file to analyze |
* file - the path to the root file to analyze |
8 |
* outdir - total path of output file |
* outdir - total path of output file |
19 |
#include <TLatex.h> |
#include <TLatex.h> |
20 |
#include <TCanvas.h> |
#include <TCanvas.h> |
21 |
#include <TGraph.h> |
#include <TGraph.h> |
22 |
|
#include <TFile.h> |
23 |
#include <TTree.h> |
#include <TTree.h> |
24 |
#include <TStyle.h> |
#include <TStyle.h> |
25 |
#include <TString.h> |
#include <TString.h> |
26 |
// |
// |
27 |
#include <physics/tracker/TrackerEvent.h> |
#include <physics/tracker/TrackerEvent.h> |
28 |
|
#include <PscuHeader.h> |
29 |
|
#include <EventHeader.h> |
30 |
|
#include <RunHeaderEvent.h> |
31 |
// |
// |
32 |
|
|
33 |
using namespace std; |
using namespace std; |
117 |
} |
} |
118 |
} |
} |
119 |
|
|
|
void stringcopy(TString& s1, const TString& s2, Int_t from=0, Int_t to=0){ |
|
|
if ( to == 0 ){ |
|
|
Int_t t2length = s2.Length(); |
|
|
s1 = ""; |
|
|
to = t2length; |
|
|
} |
|
|
for (Int_t i = from; i<to; i++){ |
|
|
s1.Append(s2[i],1); |
|
|
} |
|
|
} |
|
|
|
|
120 |
|
|
121 |
void FTrkScanQLook_EXPERT(TString file, TString outdir,Int_t event, Int_t DSPprint, TString outfile) |
void FTrkScanQLook_EXPERT(TString file, TString outdir,Int_t event, Int_t DSPprint, TString outfile) |
122 |
{ |
{ |
123 |
|
|
124 |
// |
// |
125 |
// obtain information about the data file and select the output file |
// obtain information about the data file and select the output file |
126 |
const string filepath=file.Data(); |
Int_t dwpos = file.Last('/'); |
127 |
Int_t dwpos = filepath.rfind("/"); |
Int_t dwpos1 = file.Last('.'); |
|
Int_t dwpos1 = filepath.find(".root"); |
|
|
TString fpath=(filepath.c_str()); |
|
128 |
TString base,ffile ; |
TString base,ffile ; |
129 |
stringcopy(ffile,fpath,dwpos+1,dwpos1); |
ffile=file(dwpos+1,dwpos1-(dwpos+1)); |
130 |
stringcopy(base,fpath,0,dwpos); |
if(dwpos>0) base=file(0,dwpos); |
|
if(dwpos>0) base+="/"; |
|
131 |
|
|
132 |
TString out; |
TString out; |
133 |
if(outdir.Length()==0){ |
if(outdir.Length()==0){ |
135 |
}else{ |
}else{ |
136 |
out = outdir; |
out = outdir; |
137 |
} |
} |
138 |
|
if(out.Last('/')+1<out.Length()) out+="/"; |
139 |
|
|
140 |
pamela::tracker::TrackerEvent *trk=0; |
pamela::tracker::TrackerEvent *trk=0; |
141 |
|
pamela::EventHeader *eh=0,*eH=0; |
142 |
|
pamela::PscuHeader *ph=0,*pH=0; |
143 |
|
pamela::RunHeaderEvent *reh=0; |
144 |
|
|
145 |
// open files |
// open files |
146 |
TFile *trackerFile = new TFile(file); |
TFile *trackerFile = new TFile(file); |
151 |
} |
} |
152 |
|
|
153 |
//Takes the tree and branches |
//Takes the tree and branches |
154 |
TTree *otr; |
TTree *tr = (TTree*)trackerFile->Get("Physics"); |
155 |
otr = (TTree*)trackerFile->Get("Physics"); |
tr->SetBranchAddress("Tracker",&trk); |
156 |
|
tr->SetBranchAddress("Header",&eh); |
157 |
|
|
158 |
|
TTree *otr = (TTree*)trackerFile->Get("RunHeader"); |
159 |
|
otr->SetBranchAddress("Header",&eH); |
160 |
|
otr->SetBranchAddress("RunHeader",&reh); |
161 |
|
|
162 |
// Define variables |
// Define variables |
163 |
Int_t nevents = otr->GetEntries(); |
Int_t nevents = tr->GetEntries(); |
164 |
|
Int_t neventH = otr->GetEntries(); |
165 |
if ( nevents <= 0 ) { |
if ( nevents <= 0 ) { |
166 |
trackerFile->Close(); |
trackerFile->Close(); |
167 |
printf("The file is empty, exiting...\n"); |
printf("The file is empty, exiting...\n"); |
170 |
|
|
171 |
|
|
172 |
printf("\n Number of Entries: %d\n",nevents); |
printf("\n Number of Entries: %d\n",nevents); |
173 |
|
printf(" Number of Header Entries: %d\n",neventH); |
174 |
|
|
175 |
printf("Scan of Entry %d\n",event-1); |
Long64_t obt=0; |
176 |
|
Int_t ev[2]; |
177 |
|
TString cal=""; |
178 |
|
|
179 |
|
ev[0]=0; |
180 |
|
ev[1]=0; |
181 |
|
for(Int_t i=0;i<neventH;i++){ |
182 |
|
otr->GetEntry(i); |
183 |
|
pH = eH->GetPscuHeader(); |
184 |
|
if(reh->TRK_CALIB_USED!=104){ |
185 |
|
obt = pH->GetOrbitalTime(); |
186 |
|
cal="Event with online calibration"; |
187 |
|
break; |
188 |
|
} |
189 |
|
if(i==neventH-1){ |
190 |
|
cal="***** ONLINE CALIBRATION NOT FOUND IN THIS FILE *****"; |
191 |
|
ev[0]=2; |
192 |
|
ev[1]=3; |
193 |
|
} |
194 |
|
} |
195 |
|
if(ev[0]==0){ |
196 |
|
for(Int_t i=0;i<nevents;i++){ |
197 |
|
tr->GetEntry(i); |
198 |
|
ph = eh->GetPscuHeader(); |
199 |
|
if(ph->GetOrbitalTime()>obt){ |
200 |
|
ev[0]=i+2; |
201 |
|
ev[1]=i+3; |
202 |
|
break; |
203 |
|
} |
204 |
|
} |
205 |
|
} |
206 |
|
|
207 |
|
|
208 |
|
TH1F *histomax[12][2]; //histos of max signals |
209 |
|
TH1F *histocomp[12][2]; //histos of compressed data |
210 |
|
TH1F *histofull[12][2]; //histos of full data |
211 |
|
TCanvas *c1[2]; |
212 |
|
|
213 |
|
for(Int_t e=0;e<2;e++){ |
214 |
|
event=ev[e]; |
215 |
|
printf("Scan of Entry %d\n",event); |
216 |
|
|
217 |
otr->SetBranchAddress("Tracker", &trk); |
tr->GetEntry(event); |
218 |
otr->GetEntry(event-1); |
//============================================================================ |
|
//============================================================================ |
|
|
|
|
|
gStyle->SetLabelSize(0.06,"x"); |
|
|
gStyle->SetLabelSize(0.06,"y"); |
|
|
gStyle->SetTitleFontSize(0.1); |
|
|
gStyle->SetFillColor(10); |
|
|
gStyle->SetTitleFillColor(10); |
|
|
gStyle->SetTitleOffset(-1,"Y"); |
|
|
gStyle->SetOptStat(0); |
|
|
|
|
|
// draw display area |
|
219 |
|
|
220 |
Int_t canvasx=1200; |
gStyle->SetLabelSize(0.06,"x"); |
221 |
Int_t canvasy=900; |
gStyle->SetLabelSize(0.06,"y"); |
222 |
stringstream figsav; |
gStyle->SetTitleFontSize(0.1); |
223 |
figsav.str(""); |
gStyle->SetFillColor(10); |
224 |
figsav<<out<<ffile<<"_FTrkScanQLook_EXPERT_ev"<<event<<"."<<outfile.Data(); |
gStyle->SetTitleFillColor(10); |
225 |
TCanvas *c1 = new TCanvas(figsav.str().c_str(),"FTrkQLookSCAN",canvasx,canvasy); |
gStyle->SetTitleOffset(-1,"Y"); |
226 |
c1->SetFillColor(10); |
gStyle->SetOptStat(0); |
|
c1->Range(0,0,1,1); |
|
|
stringstream fromfile; |
|
|
fromfile<<"FTrkScanQLook_EXPERT File: "<<ffile<<" ----> Entry "<<event-1; |
|
|
TLatex *t=new TLatex(); |
|
|
t->SetTextFont(32); |
|
|
t->SetTextColor(1); |
|
|
t->SetTextAlign(12); |
|
|
t->SetTextSize(0.02); |
|
|
t->DrawLatex(0.02,0.98,fromfile.str().c_str()); |
|
|
|
|
|
// draw pads |
|
|
TPad *trkpad[12]; //pad for histos |
|
|
TPaveText *trkpadtext[12]; //pad for header |
|
|
TH1F *histomax[12]; //histos of max signals |
|
|
TH1F *histocomp[12]; //histos of compressed data |
|
|
TH1F *histofull[12]; //histos of full data |
|
227 |
|
|
228 |
Double_t posy = 0.95; // up y-coord - top pads |
// draw display area |
229 |
Double_t hpad = 0.15; // pad height |
|
230 |
Double_t posx1=0; // left x-coord - pad column |
Int_t canvasx=1200; |
231 |
Double_t posx2=0; // right x-coord - pad olumn |
Int_t canvasy=900; |
232 |
Double_t posx0=0; // x-coord - column division |
stringstream figsav; |
233 |
Double_t wrel = 0.6; // relative x size of first sub-column |
figsav.str(""); |
234 |
Double_t marg = 0.004; // margin among pads |
figsav<<out<<ffile<<"_FTrkScanQLook_EXPERT_ev"<<event+1<<"."<<outfile.Data(); |
235 |
|
c1[e] = new TCanvas(figsav.str().c_str(),"FTrkQLookSCAN",canvasx,canvasy); |
236 |
|
c1[e]->SetFillColor(10); |
237 |
stringstream title; |
c1[e]->Range(0,0,1,1); |
238 |
stringstream hid; |
stringstream fromfile; |
239 |
for(Int_t n = 0; n<12; n++){ |
fromfile<<"FTrkScanQLook_EXPERT File: "<<ffile<<" ----> Entry "<<event; |
240 |
if ( (n+1)%2 ) { |
TLatex *t=new TLatex(); |
241 |
if(n>1)posy = posy-(marg*2+hpad); |
t->SetTextFont(32); |
242 |
posx1 = marg; |
t->SetTextColor(1); |
243 |
posx2 = 0.5 - marg; |
t->SetTextAlign(12); |
244 |
posx0 = 0.5*wrel; |
t->SetTextSize(0.02); |
245 |
} else { |
t->DrawLatex(0.02,0.98,fromfile.str().c_str()); |
246 |
posx1 = posx1 + 0.5; |
t->DrawLatex(0.60,0.98,cal.Data()); |
247 |
posx2 = posx2 + 0.5; |
|
248 |
posx0 = posx0 + 0.5; |
// draw pads |
249 |
}; |
TPad *trkpad[12]; //pad for histos |
250 |
|
TPaveText *trkpadtext[12]; //pad for header |
251 |
|
Double_t posy = 0.95; // up y-coord - top pads |
252 |
|
Double_t hpad = 0.15; // pad height |
253 |
|
Double_t posx1=0; // left x-coord - pad column |
254 |
|
Double_t posx2=0; // right x-coord - pad olumn |
255 |
|
Double_t posx0=0; // x-coord - column division |
256 |
|
Double_t wrel = 0.6; // relative x size of first sub-column |
257 |
|
Double_t marg = 0.004; // margin among pads |
258 |
|
|
259 |
|
|
260 |
|
stringstream title; |
261 |
|
stringstream hid; |
262 |
|
for(Int_t n = 0; n<12; n++){ |
263 |
|
if ( (n+1)%2 ) { |
264 |
|
if(n>1)posy = posy-(marg*2+hpad); |
265 |
|
posx1 = marg; |
266 |
|
posx2 = 0.5 - marg; |
267 |
|
posx0 = 0.5*wrel; |
268 |
|
} else { |
269 |
|
posx1 = posx1 + 0.5; |
270 |
|
posx2 = posx2 + 0.5; |
271 |
|
posx0 = posx0 + 0.5; |
272 |
|
}; |
273 |
|
|
274 |
/* -----------> pad for histograms */ |
/* -----------> pad for histograms */ |
275 |
trkpad[n] = new TPad("pad"," ",posx1,posy-hpad,posx0-marg,posy,18,0,0); |
trkpad[n] = new TPad("pad"," ",posx1,posy-hpad,posx0-marg,posy,18,0,0); |
276 |
trkpad[n]->SetFillColor(19); |
trkpad[n]->SetFillColor(19); |
277 |
trkpad[n]->SetFrameFillColor(10); |
trkpad[n]->SetFrameFillColor(10); |
278 |
/* -----------> pad for header dump */ |
/* -----------> pad for header dump */ |
279 |
trkpadtext[n] = new TPaveText((posx0+marg),(posy-hpad),posx2,posy); |
trkpadtext[n] = new TPaveText((posx0+marg),(posy-hpad),posx2,posy); |
280 |
/* -----------> HISTOGRAMS */ |
/* -----------> HISTOGRAMS */ |
281 |
|
|
282 |
title<<"DSP "<<n+1; |
title<<"DSP "<<n+1; |
283 |
hid<<"h"<<n; |
hid<<"h"<<n+e*100; |
284 |
histomax[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
histomax[n][e] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
285 |
hid<<"hh"<<n; |
hid<<"hh"<<n+e*100; |
286 |
histocomp[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
histocomp[n][e] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
287 |
hid<<"hhh"<<n; |
hid<<"hhh"<<n+e*100; |
288 |
histofull[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
histofull[n][e] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
289 |
title.str(""); |
title.str(""); |
290 |
hid.str(""); |
hid.str(""); |
291 |
} //end loop on views |
} //end loop on views |
292 |
|
|
293 |
// = = = = = = = = = = = = = = = = = = = = = = = = = |
// = = = = = = = = = = = = = = = = = = = = = = = = = |
294 |
// create header dump retrieving event info |
// create header dump retrieving event info |
295 |
// = = = = = = = = = = = = = = = = = = = = = = = = = |
// = = = = = = = = = = = = = = = = = = = = = = = = = |
296 |
Int_t ndsp=0; |
Int_t ndsp=0; |
297 |
stringstream message; |
stringstream message; |
298 |
|
|
299 |
Double_t whistomax[3072]; |
Double_t whistomax[3072]; |
300 |
Double_t whisto[3072]; |
Double_t whisto[3072]; |
301 |
Double_t whistocomp[3072]; |
Double_t whistocomp[3072]; |
302 |
Double_t whistofull[3072]; |
Double_t whistofull[3072]; |
|
|
|
|
//============================================= |
|
|
// transmitted words |
|
|
Int_t word = 0; |
|
|
Int_t iword = 0; |
|
|
Int_t TOTDATAlength_check = 0; |
|
|
Int_t ii=0,ifull[12],icomp[12],imax[12],nn=0; |
|
|
trkword thisword; |
|
303 |
|
|
304 |
Int_t address,ladder; |
//============================================= |
305 |
|
// transmitted words |
306 |
|
Int_t word = 0; |
307 |
|
Int_t iword = 0; |
308 |
|
Int_t TOTDATAlength_check = 0; |
309 |
|
Int_t ii=0,ifull[12],icomp[12],imax[12],nn=0; |
310 |
|
trkword thisword; |
311 |
|
|
312 |
|
Int_t address,ladder; |
313 |
|
|
314 |
for(Int_t n = 0; n<12; n++){ |
for(Int_t n = 0; n<12; n++){ |
315 |
|
|
316 |
ndsp = trk->DSPnumber[n]; |
ndsp = trk->DSPnumber[n]; |
317 |
nn = ndsp-1; |
nn = ndsp-1; |
318 |
ifull[nn]=0; |
ifull[nn]=0; |
319 |
icomp[nn]=0; |
icomp[nn]=0; |
320 |
imax[nn]=0; |
imax[nn]=0; |
321 |
|
if(ndsp>0){ |
322 |
|
if(ndsp<13){ |
323 |
|
|
324 |
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
325 |
* |
* |
326 |
* Write event LEVEL0 report |
* Write event LEVEL0 report |
327 |
* |
* |
328 |
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
329 |
|
|
330 |
trkpadtext[nn]->SetTextFont(40); |
trkpadtext[nn]->SetTextFont(40); |
331 |
trkpadtext[nn]->SetFillColor(33); |
trkpadtext[nn]->SetFillColor(33); |
332 |
trkpadtext[nn]->SetTextSize(0.012); |
trkpadtext[nn]->SetTextSize(0.012); |
333 |
trkpadtext[nn]->SetTextAlign(13); |
trkpadtext[nn]->SetTextAlign(13); |
334 |
|
|
335 |
trkpadtext[nn]->AddText(" "); |
trkpadtext[nn]->AddText(" "); |
336 |
message<<"DAQ mode --------> "<<trk->DAQmode[n]; |
message<<"DAQ mode --------> "<<trk->DAQmode[n]; |
337 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
338 |
message.str(""); |
message.str(""); |
339 |
message<<"Event number --------> "<<trk->eventn[n]; |
message<<"Event number --------> "<<trk->eventn[n]; |
340 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
341 |
message.str(""); |
message.str(""); |
342 |
message<<"13-bit words --------> "<<trk->DATAlength[n]; |
message<<"13-bit words --------> "<<trk->DATAlength[n]; |
343 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
344 |
message.str(""); |
message.str(""); |
345 |
if (!(nn%2)&&trk->signcluster[n][0]!=0) message<<"L1 add: "<<trk->addrcluster[n][0]<<" - sign: "<<1024-(trk->signcluster[n][0]); |
if (!(nn%2)&&trk->signcluster[n][0]!=0) message<<"L1 add: "<<trk->addrcluster[n][0]<<" - sign: "<<1024-(trk->signcluster[n][0]); |
346 |
else message<<"L1 add: "<<trk->addrcluster[n][0]<<" - sign: "<<(trk->signcluster[n][0]); |
else message<<"L1 add: "<<trk->addrcluster[n][0]<<" - sign: "<<(trk->signcluster[n][0]); |
347 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
348 |
message.str(""); |
message.str(""); |
349 |
if (!(nn%2)&&trk->signcluster[n][1]!=0) message<<"L2 add: "<<trk->addrcluster[n][1]<<" - sign: "<<1024-(trk->signcluster[n][1]); |
if (!(nn%2)&&trk->signcluster[n][1]!=0) message<<"L2 add: "<<trk->addrcluster[n][1]<<" - sign: "<<1024-(trk->signcluster[n][1]); |
350 |
else message<<"L2 add: "<<trk->addrcluster[n][1]<<" - sign: "<<trk->signcluster[n][1]; |
else message<<"L2 add: "<<trk->addrcluster[n][1]<<" - sign: "<<trk->signcluster[n][1]; |
351 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
352 |
message.str(""); |
message.str(""); |
353 |
if (!(nn%2)&&trk->signcluster[n][2]!=0) message<<"L3 add: "<<trk->addrcluster[n][2]<<" - sign: "<<1024-(trk->signcluster[n][2]); |
if (!(nn%2)&&trk->signcluster[n][2]!=0) message<<"L3 add: "<<trk->addrcluster[n][2]<<" - sign: "<<1024-(trk->signcluster[n][2]); |
354 |
else message<<"L3 add: "<<trk->addrcluster[n][2]<<" - sign: "<<trk->signcluster[n][2]; |
else message<<"L3 add: "<<trk->addrcluster[n][2]<<" - sign: "<<trk->signcluster[n][2]; |
355 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
356 |
message.str(""); |
message.str(""); |
357 |
message<<"NCLUST "<<trk->nclust[n]<<" CUTC "<<trk->cutc[n]<<" CUTCL "<<trk->cutcl[n]; |
message<<"NCLUST "<<trk->nclust[n]<<" CUTC "<<trk->cutc[n]<<" CUTCL "<<trk->cutcl[n]; |
358 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
359 |
message.str(""); |
message.str(""); |
360 |
message<<"Comp. time "<<trk->compressiontime[n]<<" x 0.051ms = "<<0.051*trk->compressiontime[n]<<" ms"; |
message<<"Comp. time "<<trk->compressiontime[n]<<" x 0.051ms = "<<0.051*trk->compressiontime[n]<<" ms"; |
361 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
362 |
message.str(""); |
message.str(""); |
363 |
trkpadtext[nn]->AddText(" "); |
trkpadtext[nn]->AddText(" "); |
364 |
message<<"CRC --> "<<trk->crc[n]; |
message<<"CRC --> "<<trk->crc[n]; |
365 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
366 |
message.str(""); |
message.str(""); |
367 |
message<<"FL1-6 --> "<<trk->fl1[n]<<" "<<trk->fl2[n]<<" "<<trk->fl3[n]<<" "<<trk->fl4[n]<<" "<<trk->fl5[n]<<" "<<trk->fl6[n]<<" FC "<<trk->fc[n]; |
message<<"FL1-6 --> "<<trk->fl1[n]<<" "<<trk->fl2[n]<<" "<<trk->fl3[n]<<" "<<trk->fl4[n]<<" "<<trk->fl5[n]<<" "<<trk->fl6[n]<<" FC "<<trk->fc[n]; |
368 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
369 |
message.str(""); |
message.str(""); |
370 |
trkpadtext[nn]->AddText(" "); |
trkpadtext[nn]->AddText(" "); |
371 |
trkpadtext[nn]->AddLine(0,0,0,0); |
trkpadtext[nn]->AddLine(0,0,0,0); |
372 |
message<<"PNum "<<trk->pnum[n]<<" - BId "<<trk->bid[n]<<" ALARM "<<trk->alarm[n]; |
message<<"PNum "<<trk->pnum[n]<<" - BId "<<trk->bid[n]<<" ALARM "<<trk->alarm[n]; |
373 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
374 |
message.str(""); |
message.str(""); |
375 |
message<<"Cmd "<<trk->cmdnum[n]<<" --- Answer length "<<trk->aswr[n]<<" byte"; |
message<<"Cmd "<<trk->cmdnum[n]<<" --- Answer length "<<trk->aswr[n]<<" byte"; |
376 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
377 |
message.str(""); |
message.str(""); |
378 |
trkpadtext[nn]->AddText(" "); |
trkpadtext[nn]->AddText(" "); |
379 |
|
|
380 |
TOTDATAlength_check = TOTDATAlength_check + trk->DATAlength[n]; |
TOTDATAlength_check = TOTDATAlength_check + trk->DATAlength[n]; |
|
|
|
|
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
|
|
* |
|
|
* Plot event LEVEL0 histo |
|
|
* |
|
|
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
|
381 |
|
|
382 |
//============================================= |
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
383 |
|
* |
384 |
|
* Plot event LEVEL0 histo |
385 |
|
* |
386 |
|
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
387 |
|
|
388 |
|
//============================================= |
389 |
|
|
390 |
|
for(Int_t i = 0; i< 3072; i++){ |
391 |
|
whistomax[i] = -200; |
392 |
|
whistocomp[i] = -200; |
393 |
|
whistofull[i] = -200; |
394 |
|
whisto[i] = -200; |
395 |
|
} |
396 |
|
|
397 |
for(Int_t i = 0; i< 3072; i++){ |
// =============== |
398 |
whistomax[i] = -200; |
// trasmitted data |
399 |
whistocomp[i] = -200; |
// =============== |
|
whistofull[i] = -200; |
|
|
whisto[i] = -200; |
|
|
} |
|
400 |
|
|
401 |
// =============== |
address = 0; |
402 |
// trasmitted data |
ladder = 1; |
403 |
// =============== |
for(Int_t i = 0; i < trk->DATAlength[n] ; i++){ |
404 |
|
word = trk->TrackerData.At(iword); |
405 |
address = 0; |
thisword = datadecode(word); |
406 |
ladder = 1; |
iword++; |
407 |
for(Int_t i = 0; i < trk->DATAlength[n] ; i++){ |
switch (thisword.type){ |
|
word = trk->TrackerData.At(iword); |
|
|
thisword = datadecode(word); |
|
|
iword++; |
|
|
switch (thisword.type){ |
|
408 |
|
|
409 |
case 0: //ADC value |
case 0: //ADC value |
410 |
whisto[address] = thisword.decode; |
whisto[address] = thisword.decode; |
411 |
address++; |
address++; |
412 |
// cout << " adr " << address << "\n"; |
// cout << " adr " << address << "\n"; |
413 |
break; |
break; |
414 |
|
|
415 |
|
case 1: //address |
416 |
|
address = 1024*(ladder-1) + thisword.decode; |
417 |
|
// cout << " adr " << address << "\n"; |
418 |
|
break; |
419 |
|
|
420 |
|
case 2: //end-of-ladder |
421 |
|
ladder = thisword.decode; |
422 |
|
// cout << "Ladder " << ladder << "\n"; |
423 |
|
if(ladder==3){ |
424 |
|
// end of compressed data - FILL HISTO |
425 |
|
//cout << ">>> COMPRESSED data" << "\n"; |
426 |
|
for(ii = 0; ii < 3072; ii++){ |
427 |
|
whistocomp[ii]=whisto[ii]; |
428 |
|
whisto[ii] = -200; |
429 |
|
} |
430 |
|
address = 0; |
431 |
|
ladder = 1; |
432 |
|
}else if(ladder==6){ |
433 |
|
// end of full data - FILL HISTO |
434 |
|
//cout << ">>> FULL data" << "\n"; |
435 |
|
for(ii = 0; ii < 3072; ii++){ |
436 |
|
whistofull[ii]=whisto[ii]; |
437 |
|
whisto[ii] = -200; |
438 |
|
} |
439 |
|
address = 0; |
440 |
|
ladder = 1; |
441 |
|
}else{ |
442 |
|
if(ladder>3) ladder=ladder-3; |
443 |
|
address= ladder*1024; |
444 |
|
ladder = ladder + 1; |
445 |
|
} |
446 |
|
} |
447 |
|
} |
448 |
|
|
449 |
|
|
450 |
case 1: //address |
// =============== |
451 |
address = 1024*(ladder-1) + thisword.decode; |
// maximum signals |
452 |
// cout << " adr " << address << "\n"; |
// =============== |
453 |
break; |
if(trk->signcluster[nn][0]!=0) whistomax[ 0+(int)trk->addrcluster[nn][0]] = whistocomp[ 0+(int)trk->addrcluster[nn][0]]; |
454 |
|
if(trk->signcluster[nn][1]!=0) whistomax[1024+(int)trk->addrcluster[nn][1]] = whistocomp[1024+(int)trk->addrcluster[nn][1]]; |
455 |
|
if(trk->signcluster[nn][2]!=0) whistomax[2048+(int)trk->addrcluster[nn][2]] = whistocomp[2048+(int)trk->addrcluster[nn][2]]; |
456 |
|
|
457 |
|
for(Int_t i = 0; i < 3072; i++){ |
458 |
|
if(whistomax[i]>-200) imax[nn]=1; |
459 |
|
if(whistocomp[i]>-200) icomp[nn]=1; |
460 |
|
if(whistofull[i]>-200) ifull[nn]=1; |
461 |
|
histomax[nn][e]->Fill((Float_t)i,whistomax[i]); |
462 |
|
histocomp[nn][e]->Fill((Float_t)i,whistocomp[i]); |
463 |
|
histofull[nn][e]->Fill((Float_t)i,whistofull[i]); |
464 |
|
} |
465 |
|
|
466 |
|
TBox b; |
467 |
|
|
468 |
case 2: //end-of-ladder |
c1[e]->cd(); |
469 |
ladder = thisword.decode; |
trkpadtext[nn]->Draw(); |
470 |
// cout << "Ladder " << ladder << "\n"; |
trkpad[nn]->Draw(); |
471 |
if(ladder==3){ |
trkpad[nn]->cd(); |
472 |
// end of compressed data - FILL HISTO |
trkpad[nn]->SetFillColor(10); |
473 |
//cout << ">>> COMPRESSED data" << "\n"; |
|
474 |
for(ii = 0; ii < 3072; ii++){ |
histocomp[nn][e]->GetYaxis()->SetRangeUser(-500,4500); |
475 |
whistocomp[ii]=whisto[ii]; |
histocomp[nn][e]->SetLineStyle(1); |
476 |
whisto[ii] = -200; |
histocomp[nn][e]->SetLineColor(38); |
477 |
|
histocomp[nn][e]->SetFillColor(38); |
478 |
|
histocomp[nn][e]->SetLineWidth(1); |
479 |
|
histocomp[nn][e]->Draw(""); |
480 |
|
|
481 |
|
histofull[nn][e]->SetLineColor(40); |
482 |
|
histofull[nn][e]->SetFillColor(40); |
483 |
|
histofull[nn][e]->SetLineWidth(1); |
484 |
|
histofull[nn][e]->SetLineStyle(2); |
485 |
|
|
486 |
|
histomax[nn][e]->SetLineColor(2); |
487 |
|
histomax[nn][e]->SetLineWidth(1); |
488 |
|
histomax[nn][e]->SetLineStyle(3); |
489 |
|
|
490 |
|
if(ifull[nn]==1) histofull[nn][e]->Draw("9bsame]["); |
491 |
|
if(icomp[nn]==1) histocomp[nn][e]->Draw("9bsame]["); |
492 |
|
if(imax[nn]==1) histomax[nn][e]->Draw("same]["); |
493 |
|
histocomp[nn][e]->Draw("axis same"); |
494 |
|
if(nn==1){ |
495 |
|
b.SetFillColor(6); |
496 |
|
b.SetFillStyle(3945); |
497 |
|
b.DrawBox(2944.,-500.,3060.,4500.); |
498 |
|
|
499 |
|
b.SetFillColor(107); |
500 |
|
b.SetFillStyle(3954); |
501 |
|
b.DrawBox(2816.,-500.,2944.,4500.); |
502 |
|
b.DrawBox(2048.,-500.,2176.,4500.); |
503 |
} |
} |
504 |
address = 0; |
else if(nn==4){ |
505 |
ladder = 1; |
b.SetFillColor(107); |
506 |
}else if(ladder==6){ |
b.SetFillStyle(3954); |
507 |
// end of full data - FILL HISTO |
b.DrawBox(384.,-500.,512.,4500.); |
|
//cout << ">>> FULL data" << "\n"; |
|
|
for(ii = 0; ii < 3072; ii++){ |
|
|
whistofull[ii]=whisto[ii]; |
|
|
whisto[ii] = -200; |
|
508 |
} |
} |
509 |
address = 0; |
else if(nn==6){ |
510 |
ladder = 1; |
b.SetFillColor(6); |
511 |
}else{ |
b.SetFillStyle(3945); |
512 |
if(ladder>3) ladder=ladder-3; |
b.DrawBox(2560.,-500.,2816.,4500.); |
513 |
address= ladder*1024; |
b.DrawBox(1024.,-500.,1535.,4500.); |
|
ladder = ladder + 1; |
|
|
} |
|
|
} |
|
|
} |
|
514 |
|
|
515 |
|
b.SetFillColor(107); |
516 |
// =============== |
b.SetFillStyle(3954); |
517 |
// maximum signals |
b.DrawBox(512.,-500.,768.,4500.); |
518 |
// =============== |
b.DrawBox(1536.,-500.,1792.,4500.); |
519 |
if(trk->signcluster[nn][0]!=0) whistomax[ 0+(int)trk->addrcluster[nn][0]] = whistocomp[ 0+(int)trk->addrcluster[nn][0]]; |
} |
520 |
if(trk->signcluster[nn][1]!=0) whistomax[1024+(int)trk->addrcluster[nn][1]] = whistocomp[1024+(int)trk->addrcluster[nn][1]]; |
else if(nn==7){ |
521 |
if(trk->signcluster[nn][2]!=0) whistomax[2048+(int)trk->addrcluster[nn][2]] = whistocomp[2048+(int)trk->addrcluster[nn][2]]; |
b.SetFillColor(107); |
522 |
|
b.SetFillStyle(3954); |
523 |
for(Int_t i = 0; i < 3072; i++){ |
b.DrawBox(512.,-500.,768.,4500.); |
524 |
if(whistomax[i]>-200) imax[nn]=1; |
} |
525 |
if(whistocomp[i]>-200) icomp[nn]=1; |
else if(nn==9){ |
526 |
if(whistofull[i]>-200) ifull[nn]=1; |
b.SetFillColor(107); |
527 |
histomax[nn]->Fill((Float_t)i,whistomax[i]); |
b.SetFillStyle(3954); |
528 |
histocomp[nn]->Fill((Float_t)i,whistocomp[i]); |
b.DrawBox(256.,-500.,384.,4500); |
529 |
histofull[nn]->Fill((Float_t)i,whistofull[i]); |
} |
530 |
} |
else if(nn==11){ |
531 |
|
b.SetFillColor(6); |
532 |
TBox b; |
b.SetFillStyle(3945); |
533 |
b.SetFillColor(6); |
b.DrawBox(768.,-500.,1024.,4500.); |
534 |
b.SetFillStyle(3945); |
|
535 |
|
b.SetFillColor(107); |
536 |
c1->cd(); |
b.SetFillStyle(3954); |
537 |
trkpadtext[nn]->Draw(); |
b.DrawBox(0.,-500.,512.,4500); |
538 |
trkpad[nn]->Draw(); |
b.DrawBox(1920.,-500.,2048.,4500); |
539 |
trkpad[nn]->cd(); |
b.DrawBox(2176.,-500.,2304.,4500); |
540 |
trkpad[nn]->SetFillColor(10); |
} |
541 |
|
c1[e]->Update(); |
542 |
histocomp[nn]->GetYaxis()->SetRangeUser(-500,4500); |
} |
543 |
histocomp[nn]->SetLineStyle(1); |
} |
|
histocomp[nn]->SetLineColor(38); |
|
|
histocomp[nn]->SetFillColor(38); |
|
|
histocomp[nn]->SetLineWidth(1); |
|
|
histocomp[nn]->Draw(""); |
|
|
|
|
|
histofull[nn]->SetLineColor(40); |
|
|
histofull[nn]->SetFillColor(40); |
|
|
histofull[nn]->SetLineWidth(1); |
|
|
histofull[nn]->SetLineStyle(2); |
|
|
|
|
|
histomax[nn]->SetLineColor(2); |
|
|
histomax[nn]->SetLineWidth(1); |
|
|
histomax[nn]->SetLineStyle(3); |
|
|
|
|
|
if(ifull[nn]==1) histofull[nn]->Draw("9bsame]["); |
|
|
if(icomp[nn]==1) histocomp[nn]->Draw("9bsame]["); |
|
|
if(imax[nn]==1) histomax[nn]->Draw("same]["); |
|
|
histocomp[nn]->Draw("axis same"); |
|
|
if(nn==1){ |
|
|
b.DrawBox(2816.,-500.,3060.,4500.); |
|
|
} |
|
|
else if(nn==6){ |
|
|
b.DrawBox(2560.,-500.,2816.,4500.); |
|
|
b.DrawBox(512.,-500.,768.,4500.); |
|
|
b.DrawBox(1024.,-500.,1792.,4500.); |
|
|
} |
|
|
else if(nn==11){ |
|
|
b.DrawBox(768.,-500.,1024.,4500.); |
|
|
} |
|
|
c1->Update(); |
|
|
|
|
|
}//end loop on views |
|
544 |
|
|
545 |
c1->Print(figsav.str().c_str()); |
}//end loop on views |
546 |
|
|
547 |
|
c1[e]->Print(figsav.str().c_str()); |
548 |
|
} |
549 |
return; |
return; |
550 |
} |
} |