2 |
* FTrkScanQlook_EXPERT.cxx |
* FTrkScanQlook_EXPERT.cxx |
3 |
* |
* |
4 |
* autor: D.Fedele |
* autor: D.Fedele |
5 |
* version v1r08 |
* 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 |
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]; |
381 |
|
|
382 |
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
383 |
* |
* |
384 |
* Plot event LEVEL0 histo |
* Plot event LEVEL0 histo |
385 |
* |
* |
386 |
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
387 |
|
|
388 |
//============================================= |
//============================================= |
389 |
|
|
390 |
for(Int_t i = 0; i< 3072; i++){ |
for(Int_t i = 0; i< 3072; i++){ |
391 |
whistomax[i] = -200; |
whistomax[i] = -200; |
392 |
whistocomp[i] = -200; |
whistocomp[i] = -200; |
393 |
whistofull[i] = -200; |
whistofull[i] = -200; |
394 |
whisto[i] = -200; |
whisto[i] = -200; |
395 |
} |
} |
396 |
|
|
397 |
// =============== |
// =============== |
398 |
// trasmitted data |
// trasmitted data |
399 |
// =============== |
// =============== |
400 |
|
|
401 |
address = 0; |
address = 0; |
402 |
ladder = 1; |
ladder = 1; |
403 |
for(Int_t i = 0; i < trk->DATAlength[n] ; i++){ |
for(Int_t i = 0; i < trk->DATAlength[n] ; i++){ |
404 |
word = trk->TrackerData.At(iword); |
word = trk->TrackerData.At(iword); |
405 |
thisword = datadecode(word); |
thisword = datadecode(word); |
406 |
iword++; |
iword++; |
407 |
switch (thisword.type){ |
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 |
case 1: //address |
416 |
address = 1024*(ladder-1) + thisword.decode; |
address = 1024*(ladder-1) + thisword.decode; |
417 |
// cout << " adr " << address << "\n"; |
// cout << " adr " << address << "\n"; |
418 |
break; |
break; |
419 |
|
|
420 |
case 2: //end-of-ladder |
case 2: //end-of-ladder |
421 |
ladder = thisword.decode; |
ladder = thisword.decode; |
422 |
// cout << "Ladder " << ladder << "\n"; |
// cout << "Ladder " << ladder << "\n"; |
423 |
if(ladder==3){ |
if(ladder==3){ |
424 |
// end of compressed data - FILL HISTO |
// end of compressed data - FILL HISTO |
425 |
//cout << ">>> COMPRESSED data" << "\n"; |
//cout << ">>> COMPRESSED data" << "\n"; |
426 |
for(ii = 0; ii < 3072; ii++){ |
for(ii = 0; ii < 3072; ii++){ |
427 |
whistocomp[ii]=whisto[ii]; |
whistocomp[ii]=whisto[ii]; |
428 |
whisto[ii] = -200; |
whisto[ii] = -200; |
429 |
} |
} |
430 |
address = 0; |
address = 0; |
431 |
ladder = 1; |
ladder = 1; |
432 |
}else if(ladder==6){ |
}else if(ladder==6){ |
433 |
// end of full data - FILL HISTO |
// end of full data - FILL HISTO |
434 |
//cout << ">>> FULL data" << "\n"; |
//cout << ">>> FULL data" << "\n"; |
435 |
for(ii = 0; ii < 3072; ii++){ |
for(ii = 0; ii < 3072; ii++){ |
436 |
whistofull[ii]=whisto[ii]; |
whistofull[ii]=whisto[ii]; |
437 |
whisto[ii] = -200; |
whisto[ii] = -200; |
438 |
} |
} |
439 |
address = 0; |
address = 0; |
440 |
ladder = 1; |
ladder = 1; |
441 |
}else{ |
}else{ |
442 |
if(ladder>3) ladder=ladder-3; |
if(ladder>3) ladder=ladder-3; |
443 |
address= ladder*1024; |
address= ladder*1024; |
444 |
ladder = ladder + 1; |
ladder = ladder + 1; |
445 |
} |
} |
446 |
} |
} |
447 |
} |
} |
448 |
|
|
449 |
|
|
450 |
// =============== |
// =============== |
451 |
// maximum signals |
// maximum signals |
452 |
// =============== |
// =============== |
453 |
if(trk->signcluster[nn][0]!=0) whistomax[ 0+(int)trk->addrcluster[nn][0]] = whistocomp[ 0+(int)trk->addrcluster[nn][0]]; |
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]]; |
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]]; |
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++){ |
for(Int_t i = 0; i < 3072; i++){ |
458 |
if(whistomax[i]>-200) imax[nn]=1; |
if(whistomax[i]>-200) imax[nn]=1; |
459 |
if(whistocomp[i]>-200) icomp[nn]=1; |
if(whistocomp[i]>-200) icomp[nn]=1; |
460 |
if(whistofull[i]>-200) ifull[nn]=1; |
if(whistofull[i]>-200) ifull[nn]=1; |
461 |
histomax[nn][e]->Fill((Float_t)i,whistomax[i]); |
histomax[nn][e]->Fill((Float_t)i,whistomax[i]); |
462 |
histocomp[nn][e]->Fill((Float_t)i,whistocomp[i]); |
histocomp[nn][e]->Fill((Float_t)i,whistocomp[i]); |
463 |
histofull[nn][e]->Fill((Float_t)i,whistofull[i]); |
histofull[nn][e]->Fill((Float_t)i,whistofull[i]); |
464 |
} |
} |
465 |
|
|
466 |
TBox b; |
TBox b; |
467 |
|
|
468 |
c1[e]->cd(); |
c1[e]->cd(); |
469 |
trkpadtext[nn]->Draw(); |
trkpadtext[nn]->Draw(); |
470 |
trkpad[nn]->Draw(); |
trkpad[nn]->Draw(); |
471 |
trkpad[nn]->cd(); |
trkpad[nn]->cd(); |
472 |
trkpad[nn]->SetFillColor(10); |
trkpad[nn]->SetFillColor(10); |
473 |
|
|
474 |
histocomp[nn][e]->GetYaxis()->SetRangeUser(-500,4500); |
histocomp[nn][e]->GetYaxis()->SetRangeUser(-500,4500); |
475 |
histocomp[nn][e]->SetLineStyle(1); |
histocomp[nn][e]->SetLineStyle(1); |
476 |
histocomp[nn][e]->SetLineColor(38); |
histocomp[nn][e]->SetLineColor(38); |
477 |
histocomp[nn][e]->SetFillColor(38); |
histocomp[nn][e]->SetFillColor(38); |
478 |
histocomp[nn][e]->SetLineWidth(1); |
histocomp[nn][e]->SetLineWidth(1); |
479 |
histocomp[nn][e]->Draw(""); |
histocomp[nn][e]->Draw(""); |
480 |
|
|
481 |
histofull[nn][e]->SetLineColor(40); |
histofull[nn][e]->SetLineColor(40); |
482 |
histofull[nn][e]->SetFillColor(40); |
histofull[nn][e]->SetFillColor(40); |
483 |
histofull[nn][e]->SetLineWidth(1); |
histofull[nn][e]->SetLineWidth(1); |
484 |
histofull[nn][e]->SetLineStyle(2); |
histofull[nn][e]->SetLineStyle(2); |
485 |
|
|
486 |
histomax[nn][e]->SetLineColor(2); |
histomax[nn][e]->SetLineColor(2); |
487 |
histomax[nn][e]->SetLineWidth(1); |
histomax[nn][e]->SetLineWidth(1); |
488 |
histomax[nn][e]->SetLineStyle(3); |
histomax[nn][e]->SetLineStyle(3); |
489 |
|
|
490 |
if(ifull[nn]==1) histofull[nn][e]->Draw("9bsame]["); |
if(ifull[nn]==1) histofull[nn][e]->Draw("9bsame]["); |
491 |
if(icomp[nn]==1) histocomp[nn][e]->Draw("9bsame]["); |
if(icomp[nn]==1) histocomp[nn][e]->Draw("9bsame]["); |
492 |
if(imax[nn]==1) histomax[nn][e]->Draw("same]["); |
if(imax[nn]==1) histomax[nn][e]->Draw("same]["); |
493 |
histocomp[nn][e]->Draw("axis same"); |
histocomp[nn][e]->Draw("axis same"); |
494 |
if(nn==1){ |
if(nn==1){ |
495 |
b.SetFillColor(6); |
b.SetFillColor(6); |
496 |
b.SetFillStyle(3945); |
b.SetFillStyle(3945); |
497 |
b.DrawBox(2944.,-500.,3060.,4500.); |
b.DrawBox(2944.,-500.,3060.,4500.); |
498 |
|
|
499 |
b.SetFillColor(107); |
b.SetFillColor(107); |
500 |
b.SetFillStyle(3954); |
b.SetFillStyle(3954); |
501 |
b.DrawBox(2816.,-500.,2944.,4500.); |
b.DrawBox(2816.,-500.,2944.,4500.); |
502 |
b.DrawBox(2048.,-500.,2176.,4500.); |
b.DrawBox(2048.,-500.,2176.,4500.); |
503 |
} |
} |
504 |
else if(nn==6){ |
else if(nn==4){ |
505 |
b.SetFillColor(6); |
b.SetFillColor(107); |
506 |
b.SetFillStyle(3945); |
b.SetFillStyle(3954); |
507 |
b.DrawBox(2560.,-500.,2816.,4500.); |
b.DrawBox(384.,-500.,512.,4500.); |
508 |
b.DrawBox(1024.,-500.,1792.,4500.); |
} |
509 |
|
else if(nn==6){ |
510 |
|
b.SetFillColor(6); |
511 |
|
b.SetFillStyle(3945); |
512 |
|
b.DrawBox(2560.,-500.,2816.,4500.); |
513 |
|
b.DrawBox(1024.,-500.,1535.,4500.); |
514 |
|
|
515 |
b.SetFillColor(107); |
b.SetFillColor(107); |
516 |
b.SetFillStyle(3954); |
b.SetFillStyle(3954); |
517 |
b.DrawBox(512.,-500.,768.,4500.); |
b.DrawBox(512.,-500.,768.,4500.); |
518 |
} |
b.DrawBox(1536.,-500.,1792.,4500.); |
519 |
else if(nn==7){ |
} |
520 |
b.SetFillColor(107); |
else if(nn==7){ |
521 |
b.SetFillStyle(3954); |
b.SetFillColor(107); |
522 |
b.DrawBox(512.,-500.,768.,4500.); |
b.SetFillStyle(3954); |
523 |
} |
b.DrawBox(512.,-500.,768.,4500.); |
524 |
else if(nn==11){ |
} |
525 |
b.SetFillColor(6); |
else if(nn==9){ |
526 |
b.SetFillStyle(3945); |
b.SetFillColor(107); |
527 |
b.DrawBox(768.,-500.,1024.,4500.); |
b.SetFillStyle(3954); |
528 |
|
b.DrawBox(256.,-500.,384.,4500); |
529 |
|
} |
530 |
|
else if(nn==11){ |
531 |
|
b.SetFillColor(6); |
532 |
|
b.SetFillStyle(3945); |
533 |
|
b.DrawBox(768.,-500.,1024.,4500.); |
534 |
|
|
535 |
b.SetFillColor(107); |
b.SetFillColor(107); |
536 |
b.SetFillStyle(3954); |
b.SetFillStyle(3954); |
537 |
b.DrawBox(0.,-500.,512.,4500); |
b.DrawBox(0.,-500.,512.,4500); |
538 |
b.DrawBox(1920.,-500.,2048.,4500); |
b.DrawBox(1920.,-500.,2048.,4500); |
539 |
|
b.DrawBox(2176.,-500.,2304.,4500); |
540 |
|
} |
541 |
|
c1[e]->Update(); |
542 |
|
} |
543 |
} |
} |
|
c1[e]->Update(); |
|
544 |
|
|
545 |
}//end loop on views |
}//end loop on views |
546 |
|
|