| 2 |
* FTrkScanQlook_EXPERT.cxx |
* FTrkScanQlook_EXPERT.cxx |
| 3 |
* |
* |
| 4 |
* autor: D.Fedele |
* autor: D.Fedele |
| 5 |
* version 2.0 |
* version v2r08 |
| 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 |
| 9 |
* event - the number of the single event to analyze |
* event - the number of the single event to analyze |
| 10 |
* DSPprint - the number of a particular DSP to draw (0 don't draw) |
* va1 - the number of the single va1 to analyze (dsp*100+va1) |
| 11 |
* outfile - extension of output file (pdf,ps,gif,jpg) |
* value - the number of events to store in the .dat file with va1 values*10 + # of calibration (if #of cal = 0, select every calibration) |
| 12 |
|
* outfile - extension of output file (pdf,ps,gif,jpg) |
| 13 |
* |
* |
| 14 |
*/ |
*/ |
| 15 |
// |
// |
| 16 |
#include <iostream> |
#include <iostream> |
| 17 |
#include <sstream> |
#include <sstream> |
| 18 |
|
#include <fstream> |
| 19 |
|
#include <TAxis.h> |
| 20 |
|
#include <TH1F.h> |
| 21 |
|
#include <TROOT.h> |
| 22 |
|
#include <cstdlib> |
| 23 |
// |
// |
| 24 |
#include <TPaveText.h> |
#include <TPaveText.h> |
| 25 |
#include <TLatex.h> |
#include <TLatex.h> |
| 26 |
#include <TCanvas.h> |
#include <TCanvas.h> |
| 27 |
#include <TGraph.h> |
#include <TGraph.h> |
| 28 |
|
#include <TFile.h> |
| 29 |
#include <TTree.h> |
#include <TTree.h> |
| 30 |
#include <TStyle.h> |
#include <TStyle.h> |
| 31 |
#include <TString.h> |
#include <TString.h> |
| 32 |
// |
// |
| 33 |
#include <physics/tracker/TrackerEvent.h> |
#include <physics/tracker/TrackerEvent.h> |
| 34 |
|
#include <PscuHeader.h> |
| 35 |
|
#include <EventHeader.h> |
| 36 |
|
#include <CalibTrk1Event.h> |
| 37 |
|
#include <CalibTrk2Event.h> |
| 38 |
|
#include <RunHeaderEvent.h> |
| 39 |
// |
// |
| 40 |
|
|
| 41 |
using namespace std; |
using namespace std; |
| 42 |
|
|
| 43 |
typedef struct trkword{ |
struct trkword{ |
| 44 |
int type; |
int type; |
| 45 |
int decode; |
int decode; |
| 46 |
}; |
}; |
| 125 |
} |
} |
| 126 |
} |
} |
| 127 |
|
|
|
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); |
|
|
} |
|
|
} |
|
|
|
|
| 128 |
|
|
| 129 |
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 va1, Int_t value, TString outfile) |
| 130 |
{ |
{ |
| 131 |
|
|
| 132 |
// |
// |
| 133 |
// obtain information about the data file and select the output file |
// obtain information about the data file and select the output file |
| 134 |
const string filepath=file.Data(); |
Int_t dwpos = file.Last('/'); |
| 135 |
Int_t dwpos = filepath.rfind("/"); |
Int_t dwpos1 = file.Last('.'); |
|
Int_t dwpos1 = filepath.find(".root"); |
|
|
TString fpath=(filepath.c_str()); |
|
| 136 |
TString base,ffile ; |
TString base,ffile ; |
| 137 |
stringcopy(ffile,fpath,dwpos+1,dwpos1); |
ffile=file(dwpos+1,dwpos1-(dwpos+1)); |
| 138 |
stringcopy(base,fpath,0,dwpos); |
if(dwpos>0) base=file(0,dwpos); |
|
if(dwpos>0) base+="/"; |
|
| 139 |
|
|
| 140 |
TString out; |
TString out; |
| 141 |
if(outdir.Length()==0){ |
if(outdir.Length()==0){ |
| 143 |
}else{ |
}else{ |
| 144 |
out = outdir; |
out = outdir; |
| 145 |
} |
} |
| 146 |
|
if(out.Last('/')+1<out.Length()) out+="/"; |
| 147 |
|
|
| 148 |
pamela::tracker::TrackerEvent *trk=0; |
pamela::tracker::TrackerEvent *trk=0; |
| 149 |
|
pamela::EventHeader *eh=0,*eH=0; |
| 150 |
|
pamela::PscuHeader *ph=0,*pH=0; |
| 151 |
|
pamela::RunHeaderEvent *reh=0; |
| 152 |
|
pamela::CalibTrk1Event *trk1 = 0; |
| 153 |
|
pamela::CalibTrk2Event *trk2 = 0; |
| 154 |
|
pamela::EventCounter *cod=0; |
| 155 |
|
|
| 156 |
|
pamela::PacketType *pctp=0; |
| 157 |
// open files |
// open files |
| 158 |
TFile *trackerFile = new TFile(file); |
TFile *trackerFile = new TFile(file); |
| 159 |
if ( !trackerFile ){ |
if ( !trackerFile ){ |
| 163 |
} |
} |
| 164 |
|
|
| 165 |
//Takes the tree and branches |
//Takes the tree and branches |
| 166 |
TTree *otr; |
TTree *tr = (TTree*)trackerFile->Get("Physics"); |
| 167 |
otr = (TTree*)trackerFile->Get("Physics"); |
tr->SetBranchAddress("Tracker",&trk); |
| 168 |
|
tr->SetBranchAddress("Header",&eh); |
| 169 |
|
|
| 170 |
|
TTree *otr = (TTree*)trackerFile->Get("RunHeader"); |
| 171 |
|
otr->SetBranchAddress("Header",&eH); |
| 172 |
|
otr->SetBranchAddress("RunHeader",&reh); |
| 173 |
|
|
| 174 |
|
TTree *otr1 = (TTree*)trackerFile->Get("CalibTrk1"); |
| 175 |
|
otr1->SetBranchAddress("CalibTrk1", &trk1); |
| 176 |
|
TTree *otr2 = (TTree*)trackerFile->Get("CalibTrk2"); |
| 177 |
|
otr2->SetBranchAddress("CalibTrk2", &trk2); |
| 178 |
|
|
| 179 |
// Define variables |
// Define variables |
| 180 |
Int_t nevents = otr->GetEntries(); |
Int_t nevents = tr->GetEntries(); |
| 181 |
|
Int_t neventH = otr->GetEntries(); |
| 182 |
|
Int_t cevents=0; |
| 183 |
|
|
| 184 |
|
if(otr1->GetEntries()==otr2->GetEntries()) |
| 185 |
|
cevents = otr1->GetEntries(); |
| 186 |
|
else printf("\nWARNING: CalibTrk1 entries is different from CalibTrk2 entries\n\n"); |
| 187 |
|
|
| 188 |
|
|
| 189 |
if ( nevents <= 0 ) { |
if ( nevents <= 0 ) { |
| 190 |
trackerFile->Close(); |
trackerFile->Close(); |
| 191 |
printf("The file is empty, exiting...\n"); |
printf("The file is empty, exiting...\n"); |
| 192 |
return; |
return; |
| 193 |
} |
} |
| 194 |
|
|
| 195 |
|
// |
| 196 |
|
// open the output text files for the alarms |
| 197 |
|
TString fname = out+ffile; |
| 198 |
|
int slen=fname.Length(); |
| 199 |
|
int last=fname.Last('_'); |
| 200 |
|
if(last<(slen-1))fname.Append('_'); |
| 201 |
|
fname.Append("FTrk-DSP-values.dat"); |
| 202 |
|
ofstream values(fname,ios::out); |
| 203 |
|
|
| 204 |
|
// |
| 205 |
printf("\n Number of Entries: %d\n",nevents); |
printf("\n Number of Entries: %d\n",nevents); |
| 206 |
|
printf(" Number of Header Entries: %d\n",neventH); |
| 207 |
|
printf(" Number of Calibration: %d\n",cevents); |
| 208 |
|
|
| 209 |
printf("Scan of Entry %d\n",event-1); |
ULong_t obt=0,hobt[neventH]; |
| 210 |
|
Int_t eve,cin=0,cins=0,br=0,olrun[neventH]; |
| 211 |
otr->SetBranchAddress("Tracker", &trk); |
TString cal=""; |
| 212 |
otr->GetEntry(event-1); |
|
| 213 |
//============================================================================ |
eve=3; |
| 214 |
|
for(Int_t i=0;i<neventH;i++){ |
| 215 |
|
otr->GetEntry(i); |
| 216 |
|
pH = eH->GetPscuHeader(); |
| 217 |
|
hobt[i]= pH->GetOrbitalTime(); |
| 218 |
|
olrun[i]=reh->TRK_CALIB_USED; |
| 219 |
|
if(reh->TRK_CALIB_USED!=104 && br==0){ |
| 220 |
|
obt = pH->GetOrbitalTime(); |
| 221 |
|
cal="Event with online calibration"; |
| 222 |
|
br=1; |
| 223 |
|
} |
| 224 |
|
if(i==neventH-1 && br==0){ |
| 225 |
|
cal="***** ONLINE CALIBRATION NOT FOUND IN THIS FILE *****"; |
| 226 |
|
eve=2; |
| 227 |
|
} |
| 228 |
|
} |
| 229 |
|
|
| 230 |
gStyle->SetLabelSize(0.06,"x"); |
int tot=2,totvalues=0,TOT=0,totsum=0; |
| 231 |
gStyle->SetLabelSize(0.06,"y"); |
if(event<0) tot=abs(event); |
| 232 |
gStyle->SetTitleFontSize(0.1); |
if(value>0) totvalues=value/10; |
|
gStyle->SetFillColor(10); |
|
|
gStyle->SetTitleFillColor(10); |
|
|
gStyle->SetTitleOffset(-1,"Y"); |
|
|
gStyle->SetOptStat(0); |
|
| 233 |
|
|
| 234 |
// draw display area |
TOT= tot > totvalues ? tot : totvalues; |
| 235 |
|
if(value>0) totsum= (value/10) > 100 ? (value/10) : 100; |
| 236 |
|
else totsum=100; |
| 237 |
|
|
| 238 |
|
Int_t calev=cevents; |
| 239 |
|
|
| 240 |
|
TH1F *histomax[12][tot]; //histos of max signals |
| 241 |
|
TH1F *histocomp[12][tot]; //histos of compressed data |
| 242 |
|
TH1F *histofull[12][tot]; //histos of full data |
| 243 |
|
TCanvas *c1[tot],*csum[calev]; |
| 244 |
|
TH1F *histova[tot]; |
| 245 |
|
TGraph*sum[12][calev][totsum/2]; |
| 246 |
|
TCanvas *cva[tot]; |
| 247 |
|
|
| 248 |
|
TPad *trkpad[12]; //pad for histos |
| 249 |
|
|
| 250 |
|
stringstream fromfile,isfile,title,hid,message; |
| 251 |
|
TString figsa="",figsav="",figsava=""; |
| 252 |
Int_t canvasx=1200; |
Int_t canvasx=1200; |
| 253 |
Int_t canvasy=900; |
Int_t canvasy=900; |
| 254 |
stringstream figsav; |
|
|
figsav.str(""); |
|
|
figsav<<out<<ffile<<"_FTrkScanQLook_EXPERT_ev"<<event<<"."<<outfile.Data(); |
|
|
TCanvas *c1 = new TCanvas(figsav.str().c_str(),"FTrkQLookSCAN",canvasx,canvasy); |
|
|
c1->SetFillColor(10); |
|
|
c1->Range(0,0,1,1); |
|
|
stringstream fromfile; |
|
|
fromfile<<"FTrkScanQLook_EXPERT File: "<<ffile<<" ----> Entry "<<event-1; |
|
| 255 |
TLatex *t=new TLatex(); |
TLatex *t=new TLatex(); |
| 256 |
t->SetTextFont(32); |
t->SetTextFont(32); |
| 257 |
t->SetTextColor(1); |
t->SetTextColor(1); |
| 258 |
t->SetTextAlign(12); |
t->SetTextAlign(12); |
| 259 |
t->SetTextSize(0.02); |
t->SetTextSize(0.02); |
|
t->DrawLatex(0.02,0.98,fromfile.str().c_str()); |
|
| 260 |
|
|
| 261 |
// draw pads |
gStyle->SetLabelSize(0.06,"x"); |
| 262 |
TPad *trkpad[12]; //pad for histos |
gStyle->SetLabelSize(0.06,"y"); |
| 263 |
TPaveText *trkpadtext[12]; //pad for header |
gStyle->SetTitleFontSize(0.1); |
| 264 |
TH1F *histomax[12]; //histos of max signals |
gStyle->SetFillColor(10); |
| 265 |
TH1F *histocomp[12]; //histos of compressed data |
gStyle->SetTitleFillColor(10); |
| 266 |
TH1F *histofull[12]; //histos of full data |
gStyle->SetOptStat(0); |
| 267 |
|
|
| 268 |
Double_t posy = 0.95; // up y-coord - top pads |
Int_t p[12],psum=0; |
| 269 |
Double_t hpad = 0.15; // pad height |
Int_t whistostrip[3072]; |
| 270 |
Double_t posx1=0; // left x-coord - pad column |
for(int s=0;s<3072;s++) whistostrip[s]=s+1; |
| 271 |
Double_t posx2=0; // right x-coord - pad olumn |
|
| 272 |
Double_t posx0=0; // x-coord - column division |
if(eve==3){ |
| 273 |
Double_t wrel = 0.6; // relative x size of first sub-column |
for(Int_t i=0;i<nevents;i++){ |
| 274 |
Double_t marg = 0.004; // margin among pads |
tr->GetEntry(i); |
| 275 |
|
ph = eh->GetPscuHeader(); |
| 276 |
|
cod = eh->GetCounter(); |
| 277 |
stringstream title; |
if(olrun[cod->Get(pctp->RunHeader)-1]==104) continue; |
| 278 |
stringstream hid; |
if(value%10!=0){ |
| 279 |
for(Int_t n = 0; n<12; n++){ |
if(i==0) cin=cod->Get(pctp->CalibTrk1)+((value%10)-1); |
| 280 |
if ( (n+1)%2 ) { |
if(cod->Get(pctp->CalibTrk1)==cin+1){ |
| 281 |
if(n>1)posy = posy-(marg*2+hpad); |
eve=i+3; |
| 282 |
posx1 = marg; |
cin=100; |
| 283 |
posx2 = 0.5 - marg; |
} |
| 284 |
posx0 = 0.5*wrel; |
} |
| 285 |
} else { |
else { |
| 286 |
posx1 = posx1 + 0.5; |
if(i==0) cin=cod->Get(pctp->CalibTrk1); |
| 287 |
posx2 = posx2 + 0.5; |
if(event<0 && cod->Get(pctp->CalibTrk1)==cin+1){ |
| 288 |
posx0 = posx0 + 0.5; |
eve=i+3; |
| 289 |
}; |
cin=100; |
| 290 |
|
} |
| 291 |
/* -----------> pad for histograms */ |
else if(event>=0 && (ULong_t)ph->GetOrbitalTime()>obt && obt>0){ |
| 292 |
trkpad[n] = new TPad("pad"," ",posx1,posy-hpad,posx0-marg,posy,18,0,0); |
eve=i+3; |
| 293 |
trkpad[n]->SetFillColor(19); |
obt=0; |
| 294 |
trkpad[n]->SetFrameFillColor(10); |
} |
| 295 |
/* -----------> pad for header dump */ |
} |
| 296 |
trkpadtext[n] = new TPaveText((posx0+marg),(posy-hpad),posx2,posy); |
if(i==0) cins=cod->Get(pctp->CalibTrk1); |
| 297 |
/* -----------> HISTOGRAMS */ |
if(cod->Get(pctp->CalibTrk1)>cins){ |
| 298 |
|
psum=1; |
| 299 |
title<<"DSP "<<n+1; |
cins=cod->Get(pctp->CalibTrk1); |
| 300 |
hid<<"h"<<n; |
} |
| 301 |
histomax[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
if(psum==1){ |
| 302 |
hid<<"hh"<<n; |
figsa=out+ffile+"_FTrkScanQLook_EXPERT_sumof"; |
| 303 |
histocomp[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
figsa+=totsum; |
| 304 |
hid<<"hhh"<<n; |
figsa+="events_cal"; |
| 305 |
histofull[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
figsa+=cins; |
| 306 |
title.str(""); |
csum[cins-1] = new TCanvas(figsa.Data(),"FTrkQLookSCAN",canvasx,canvasy); |
| 307 |
hid.str(""); |
csum[cins-1]->SetFillColor(10); |
| 308 |
} //end loop on views |
csum[cins-1]->Range(0,0,1,1); |
| 309 |
|
fromfile.str(""); |
| 310 |
// = = = = = = = = = = = = = = = = = = = = = = = = = |
fromfile<<"FTrkScanQLook_EXPERT File: "<<ffile<<" ----> Sum of "<<totsum<<" events after the "<<cins<<" calibration at OBT= "<<hobt[(cod->Get(pctp->RunHeader))-1]; |
| 311 |
// create header dump retrieving event info |
t->SetTextSize(0.02); |
| 312 |
// = = = = = = = = = = = = = = = = = = = = = = = = = |
t->DrawLatex(0.02,0.98,fromfile.str().c_str()); |
| 313 |
Int_t ndsp=0; |
|
| 314 |
stringstream message; |
// draw pads |
| 315 |
|
Double_t posy = 0.95; // up y-coord - top pads |
| 316 |
Double_t whistomax[3072]; |
Double_t hpad = 0.15; // pad height |
| 317 |
Double_t whisto[3072]; |
Double_t posx1=0; // left x-coord - pad column |
| 318 |
Double_t whistocomp[3072]; |
Double_t posx0=0; // x-coord - column division |
| 319 |
Double_t whistofull[3072]; |
Double_t wrel = 0.6; // relative x size of first sub-column |
| 320 |
|
Double_t marg = 0.004; // margin among pads |
| 321 |
//============================================= |
|
| 322 |
// transmitted words |
hpad = (posy-marg*11)/6; |
| 323 |
Int_t word = 0; |
wrel = (1-marg*4)/2; |
| 324 |
Int_t iword = 0; |
for(Int_t n = 0; n<12; n++){ |
| 325 |
Int_t TOTDATAlength_check = 0; |
if ( (n+1)%2 ) { |
| 326 |
Int_t ii=0,ifull[12],icomp[12],imax[12],nn=0; |
if(n>1)posy = posy-(marg*2+hpad); |
| 327 |
trkword thisword; |
posx1 = marg; |
| 328 |
|
posx0 = posx1 + wrel; |
| 329 |
|
} else { |
| 330 |
|
posx1 = posx0 + 2*marg; |
| 331 |
|
posx0 = posx1 + wrel; |
| 332 |
|
}; |
| 333 |
|
|
| 334 |
|
/* -----------> pad for histograms */ |
| 335 |
|
trkpad[n] = new TPad("pad"," ",posx1,posy-hpad,posx0,posy,18,0,0); |
| 336 |
|
trkpad[n]->SetFillColor(19); |
| 337 |
|
trkpad[n]->SetFrameFillColor(10); |
| 338 |
|
|
| 339 |
Int_t address,ladder; |
p[n]=0; |
| 340 |
|
} |
| 341 |
|
} |
| 342 |
|
if(psum>0 && psum<=totsum){ |
| 343 |
|
// = = = = = = = = = = = = = = = = = = = = = = = = = |
| 344 |
|
// create header dump retrieving event info |
| 345 |
|
// = = = = = = = = = = = = = = = = = = = = = = = = = |
| 346 |
|
Int_t ndsp=0; |
| 347 |
|
|
| 348 |
|
// Int_t whistomax[3072]; |
| 349 |
|
Int_t whisto[3072]; |
| 350 |
|
// Int_t whistocomp[3072]; |
| 351 |
|
Int_t whistofull[3072]; |
| 352 |
|
|
| 353 |
|
// // transmitted words |
| 354 |
|
Int_t word = 0; |
| 355 |
|
Int_t iword = 0; |
| 356 |
|
// Int_t ii=0,ifull[12],icomp[12],imax[12],nn=0; |
| 357 |
|
Int_t ii=0,nn=0; |
| 358 |
|
trkword thisword; |
| 359 |
|
|
| 360 |
|
Int_t address,ladder; |
| 361 |
|
|
| 362 |
|
|
| 363 |
|
for(Int_t n = 0; n<12; n++){ |
| 364 |
|
ndsp = trk->DSPnumber[n]; |
| 365 |
|
nn = ndsp-1; |
| 366 |
|
// ifull[nn]=0; |
| 367 |
|
// icomp[nn]=0; |
| 368 |
|
// imax[nn]=0; |
| 369 |
|
|
| 370 |
|
for(Int_t vi = 0; vi< 3072; vi++){ |
| 371 |
|
// whistomax[vi] = -200; |
| 372 |
|
// whistocomp[vi] = -200; |
| 373 |
|
whistofull[vi] = -200; |
| 374 |
|
whisto[vi] = -200; |
| 375 |
|
} |
| 376 |
|
|
| 377 |
|
// // trasmitted data |
| 378 |
|
// |
| 379 |
|
address = 0; |
| 380 |
|
ladder = 1; |
| 381 |
|
for(Int_t vi = 0; vi < trk->DATAlength[n] ; vi++){ |
| 382 |
|
word = trk->TrackerData.At(iword); |
| 383 |
|
thisword = datadecode(word); |
| 384 |
|
iword++; |
| 385 |
|
switch (thisword.type){ |
| 386 |
|
|
| 387 |
|
case 0: //ADC value |
| 388 |
|
whisto[address] = thisword.decode; |
| 389 |
|
address++; |
| 390 |
|
// cout << " adr " << address << "\n"; |
| 391 |
|
break; |
| 392 |
|
|
| 393 |
|
case 1: //address |
| 394 |
|
address = 1024*(ladder-1) + thisword.decode; |
| 395 |
|
// cout << " adr " << address << "\n"; |
| 396 |
|
break; |
| 397 |
|
|
| 398 |
|
case 2: //end-of-ladder |
| 399 |
|
ladder = thisword.decode; |
| 400 |
|
// cout << "Ladder " << ladder << "\n"; |
| 401 |
|
if(ladder==3){ |
| 402 |
|
// end of compressed data - FILL HISTO |
| 403 |
|
//cout << ">>> COMPRESSED data" << "\n"; |
| 404 |
|
for(ii = 0; ii < 3072; ii++){ |
| 405 |
|
// whistocomp[ii]=whisto[ii]; |
| 406 |
|
whisto[ii] = -200; |
| 407 |
|
} |
| 408 |
|
address = 0; |
| 409 |
|
ladder = 1; |
| 410 |
|
}else if(ladder==6){ |
| 411 |
|
// end of full data - FILL HISTO |
| 412 |
|
//cout << ">>> FULL data" << "\n"; |
| 413 |
|
for(ii = 0; ii < 3072; ii++){ |
| 414 |
|
whistofull[ii]=whisto[ii]; |
| 415 |
|
whisto[ii] = -200; |
| 416 |
|
} |
| 417 |
|
address = 0; |
| 418 |
|
ladder = 1; |
| 419 |
|
}else{ |
| 420 |
|
if(ladder>3) ladder=ladder-3; |
| 421 |
|
address= ladder*1024; |
| 422 |
|
ladder = ladder + 1; |
| 423 |
|
} |
| 424 |
|
} |
| 425 |
|
} |
| 426 |
|
|
| 427 |
|
for(Int_t vi = 0; vi < 3072; vi++){ |
| 428 |
|
if(whistofull[vi]>-200){ |
| 429 |
|
if(vi==3071){ |
| 430 |
|
sum[nn][cins-1][p[nn]] = new TGraph(3072,whistostrip,whistofull); |
| 431 |
|
p[nn]++; |
| 432 |
|
} |
| 433 |
|
if(value%10==0 && value>0){ |
| 434 |
|
if(whistofull[vi]>0){ |
| 435 |
|
if(vi==0) values << (short int)ndsp << " "; |
| 436 |
|
values <<(short int) whistofull[vi] <<" "; |
| 437 |
|
if(vi==3071) values << endl; |
| 438 |
|
} |
| 439 |
|
} |
| 440 |
|
} |
| 441 |
|
} |
| 442 |
|
} |
| 443 |
|
psum++; |
| 444 |
|
if(value%10==0 && value>0) values << (short int)0 << endl << endl; |
| 445 |
|
} |
| 446 |
|
if(psum==totsum+1){ |
| 447 |
|
if(value%10==0 && value>0) values << (short int)(-cins) << endl << endl; |
| 448 |
|
psum=0; |
| 449 |
|
for(Int_t vi = 0; vi < 12; vi++){ |
| 450 |
|
if(p[vi]>0){ |
| 451 |
|
|
| 452 |
|
TLine li,liva1; |
| 453 |
|
li.SetLineColor(38); |
| 454 |
|
li.SetLineStyle(4); |
| 455 |
|
li.SetLineWidth(2); |
| 456 |
|
liva1.SetLineColor(42); |
| 457 |
|
liva1.SetLineStyle(3); |
| 458 |
|
liva1.SetLineWidth(1); |
| 459 |
|
|
| 460 |
|
Float_t va1x=0; |
| 461 |
|
csum[cins-1]->cd(); |
| 462 |
|
trkpad[vi]->Draw(); |
| 463 |
|
trkpad[vi]->cd(); |
| 464 |
|
trkpad[vi]->SetFillColor(10); |
| 465 |
|
|
| 466 |
|
stringstream tit,hid; |
| 467 |
|
tit.str(""); |
| 468 |
|
hid.str(""); |
| 469 |
|
tit<<"DSP "<<vi+1; |
| 470 |
|
sum[vi][cins-1][0]->SetTitle(tit.str().c_str()); |
| 471 |
|
sum[vi][cins-1][0]->GetXaxis()->SetTitle("channel id"); |
| 472 |
|
sum[vi][cins-1][0]->GetXaxis()->CenterTitle(); |
| 473 |
|
sum[vi][cins-1][0]->GetXaxis()->SetRangeUser(0,3073); |
| 474 |
|
sum[vi][cins-1][0]->GetXaxis()->SetTitleSize(0.06); |
| 475 |
|
sum[vi][cins-1][0]->GetXaxis()->SetTitleOffset(0.8); |
| 476 |
|
sum[vi][cins-1][0]->GetYaxis()->SetTitle("ADC value"); |
| 477 |
|
sum[vi][cins-1][0]->GetYaxis()->SetTitleSize(0.09); |
| 478 |
|
sum[vi][cins-1][0]->GetYaxis()->SetTitleOffset(0.4); |
| 479 |
|
sum[vi][cins-1][0]->GetYaxis()->CenterTitle(); |
| 480 |
|
sum[vi][cins-1][0]->GetYaxis()->SetRangeUser(0,4500); |
| 481 |
|
sum[vi][cins-1][0]->SetMarkerStyle(20); |
| 482 |
|
sum[vi][cins-1][0]->SetMarkerSize(0.1); |
| 483 |
|
sum[vi][cins-1][0]->SetMarkerColor(4); |
| 484 |
|
sum[vi][cins-1][0]->Draw("ap"); |
| 485 |
|
hid<<p[vi]<<" events"; |
| 486 |
|
t->SetTextSize(0.11); |
| 487 |
|
t->DrawLatex(2400,4250,hid.str().c_str()); |
| 488 |
|
for(int pi=1; pi<p[vi];pi++){ |
| 489 |
|
sum[vi][cins-1][pi]->SetMarkerStyle(21); |
| 490 |
|
sum[vi][cins-1][pi]->SetMarkerSize(0.1); |
| 491 |
|
sum[vi][cins-1][pi]->SetMarkerColor(4); |
| 492 |
|
sum[vi][cins-1][pi]->Draw("p"); |
| 493 |
|
} |
| 494 |
|
for(int va=1; va<24; va++){ |
| 495 |
|
va1x=128*va; |
| 496 |
|
liva1.DrawLine(va1x,0.,va1x,4500.); |
| 497 |
|
} |
| 498 |
|
li.DrawLine(1024.5,0.,1024.5,4500.); |
| 499 |
|
li.DrawLine(2048.5,0.,2048.5,4500.); |
| 500 |
|
csum[cins-1]->Update(); |
| 501 |
|
hid.str(""); |
| 502 |
|
} |
| 503 |
|
} |
| 504 |
|
if(strcmp(outfile.Data(),"ps") && strcmp(outfile.Data(),"pdf")){ |
| 505 |
|
figsa+="."+outfile; |
| 506 |
|
csum[cins-1]->Print(figsa.Data()); |
| 507 |
|
} |
| 508 |
|
if(cod->Get(pctp->CalibTrk1)==cevents) break; |
| 509 |
|
} |
| 510 |
|
} |
| 511 |
|
} |
| 512 |
|
|
| 513 |
for(Int_t n = 0; n<12; n++){ |
if(!strcmp(outfile.Data(),"ps") || !strcmp(outfile.Data(),"pdf")){ |
| 514 |
|
stringstream nom1,nom2,nom3; |
| 515 |
|
nom1<<out<<ffile<<"_FTrkScanQLook_EXPERT_sumof"<<totsum<<"event.ps("; |
| 516 |
|
nom2<<out<<ffile<<"_FTrkScanQLook_EXPERT_sumof"<<totsum<<"event.ps"; |
| 517 |
|
nom3<<out<<ffile<<"_FTrkScanQLook_EXPERT_sumof"<<totsum<<"event.ps)"; |
| 518 |
|
|
| 519 |
ndsp = trk->DSPnumber[n]; |
for(int va=0; va<cevents; va++){ |
| 520 |
nn = ndsp-1; |
if(cevents==1) csum[va]->Print(nom2.str().c_str(),"Landscape"); |
| 521 |
ifull[nn]=0; |
if(cevents>2){ |
| 522 |
icomp[nn]=0; |
if(va==0) csum[va]->Print(nom1.str().c_str(),"Landscape"); |
| 523 |
imax[nn]=0; |
if(va>0 && va<cevents-1) csum[va]->Print(nom2.str().c_str(),"Landscape"); |
| 524 |
|
if(va>0 && va==cevents-1) csum[va]->Print(nom3.str().c_str(),"Landscape"); |
| 525 |
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
} |
| 526 |
* |
} |
| 527 |
* Write event LEVEL0 report |
} |
| 528 |
* |
// |
| 529 |
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
// Convert ps to pdf if required |
| 530 |
|
if(!strcmp(outfile.Data(),"pdf")){ |
| 531 |
trkpadtext[nn]->SetTextFont(40); |
stringstream com; |
| 532 |
trkpadtext[nn]->SetFillColor(33); |
com<<"ps2pdf13 "<<out<<ffile<<"_FTrkScanQLook_EXPERT_sumof"<<totsum<<"event.ps "<<out<<ffile<<"_FTrkScanQLook_EXPERT_sumof"<<totsum<<"event.pdf"; |
| 533 |
trkpadtext[nn]->SetTextSize(0.012); |
system(com.str().c_str()); |
| 534 |
trkpadtext[nn]->SetTextAlign(13); |
printf("\n---> ps file converted in pdf format!\n"); |
| 535 |
|
com.str(""); |
| 536 |
trkpadtext[nn]->AddText(" "); |
com<<"rm -f "<<out<<ffile<<"_FTrkScanQLook_EXPERT_sumof"<<totsum<<"event.ps "; |
| 537 |
message<<"DAQ mode --------> "<<trk->DAQmode[n]; |
system(com.str().c_str()); |
| 538 |
trkpadtext[nn]->AddText(message.str().c_str()); |
printf("---> ps file removed!\n\n"); |
| 539 |
message.str(""); |
com.str(""); |
| 540 |
message<<"Event number --------> "<<trk->eventn[n]; |
} |
| 541 |
trkpadtext[nn]->AddText(message.str().c_str()); |
|
|
message.str(""); |
|
|
message<<"13-bit words --------> "<<trk->DATAlength[n]; |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
|
|
message.str(""); |
|
|
if (!(nn%2)&&trk->signcluster[n][0]!=0) message<<"L1 add: "<<trk->addrcluster[n][0]<<" - sign: "<<1024-(trk->signcluster[n][0]); |
|
|
else message<<"L1 add: "<<trk->addrcluster[n][0]<<" - sign: "<<(trk->signcluster[n][0]); |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
|
|
message.str(""); |
|
|
if (!(nn%2)&&trk->signcluster[n][1]!=0) message<<"L2 add: "<<trk->addrcluster[n][1]<<" - sign: "<<1024-(trk->signcluster[n][1]); |
|
|
else message<<"L2 add: "<<trk->addrcluster[n][1]<<" - sign: "<<trk->signcluster[n][1]; |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
|
|
message.str(""); |
|
|
if (!(nn%2)&&trk->signcluster[n][2]!=0) message<<"L3 add: "<<trk->addrcluster[n][2]<<" - sign: "<<1024-(trk->signcluster[n][2]); |
|
|
else message<<"L3 add: "<<trk->addrcluster[n][2]<<" - sign: "<<trk->signcluster[n][2]; |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
|
|
message.str(""); |
|
|
message<<"NCLUST "<<trk->nclust[n]<<" CUTC "<<trk->cutc[n]<<" CUTCL "<<trk->cutcl[n]; |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
|
|
message.str(""); |
|
|
message<<"Comp. time "<<trk->compressiontime[n]<<" x 0.051ms = "<<0.051*trk->compressiontime[n]<<" ms"; |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
|
|
message.str(""); |
|
|
trkpadtext[nn]->AddText(" "); |
|
|
message<<"CRC --> "<<trk->crc[n]; |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
|
|
message.str(""); |
|
|
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]; |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
|
|
message.str(""); |
|
|
trkpadtext[nn]->AddText(" "); |
|
|
trkpadtext[nn]->AddLine(0,0,0,0); |
|
|
message<<"PNum "<<trk->pnum[n]<<" - BId "<<trk->bid[n]<<" ALARM "<<trk->alarm[n]; |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
|
|
message.str(""); |
|
|
message<<"Cmd "<<trk->cmdnum[n]<<" --- Answer length "<<trk->aswr[n]<<" byte"; |
|
|
trkpadtext[nn]->AddText(message.str().c_str()); |
|
|
message.str(""); |
|
|
trkpadtext[nn]->AddText(" "); |
|
|
|
|
|
TOTDATAlength_check = TOTDATAlength_check + trk->DATAlength[n]; |
|
|
|
|
|
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
|
|
* |
|
|
* Plot event LEVEL0 histo |
|
|
* |
|
|
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
|
| 542 |
|
|
|
//============================================= |
|
| 543 |
|
|
| 544 |
for(Int_t i = 0; i< 3072; i++){ |
for(Int_t e=0;e<TOT;e++){ |
| 545 |
whistomax[i] = -200; |
if(event<=0 || (value%10!=0 && e==0)) |
| 546 |
whistocomp[i] = -200; |
event=eve; |
| 547 |
whistofull[i] = -200; |
else { |
| 548 |
whisto[i] = -200; |
event=event+1; |
| 549 |
|
if(event>eve-3 && eve>2) |
| 550 |
|
cal="Event with online calibration"; |
| 551 |
|
else |
| 552 |
|
cal="***** ONLINE CALIBRATION NOT FOUND IN THIS FILE *****"; |
| 553 |
} |
} |
| 554 |
|
printf("Scan of Entry %d\n",event); |
| 555 |
|
|
| 556 |
|
tr->GetEntry(event); |
| 557 |
|
//============================================================================ |
| 558 |
|
|
| 559 |
|
// draw display area |
| 560 |
|
|
| 561 |
|
TPad *trkpad[12],*pad=0; //pad for histos |
| 562 |
|
TPaveText *trkpadtext[12]; //pad for header |
| 563 |
|
Int_t ndsp=0; |
| 564 |
|
|
| 565 |
|
if((tot<TOT && e<tot) || tot==TOT){ |
| 566 |
|
figsav=out+ffile+"_FTrkScanQLook_EXPERT_ev"; |
| 567 |
|
figsav+=event+1; |
| 568 |
|
c1[e] = new TCanvas(figsav.Data(),"FTrkQLookSCAN",canvasx,canvasy); |
| 569 |
|
c1[e]->SetFillColor(10); |
| 570 |
|
c1[e]->Range(0,0,1,1); |
| 571 |
|
fromfile.str(""); |
| 572 |
|
fromfile<<"FTrkScanQLook_EXPERT File: "<<ffile<<" ----> Entry "<<event; |
| 573 |
|
t->SetTextSize(0.02); |
| 574 |
|
t->DrawLatex(0.02,0.98,fromfile.str().c_str()); |
| 575 |
|
t->DrawLatex(0.60,0.98,cal.Data()); |
| 576 |
|
|
| 577 |
|
isfile<<"Chips with white line at least once showed anomalous behaviour"; |
| 578 |
|
t->SetTextColor(17); |
| 579 |
|
t->SetTextSize(0.018); |
| 580 |
|
t->DrawLatex(.01,.96,isfile.str().c_str()); |
| 581 |
|
isfile.str(""); |
| 582 |
|
|
| 583 |
|
isfile<<"Boxes so colored point out anomalous chips (not necessarily broken)"; |
| 584 |
|
t->SetTextColor(107); |
| 585 |
|
// t->DrawLatex(.5,.96,isfile.str().c_str()); |
| 586 |
|
isfile.str(""); |
| 587 |
|
t->SetTextColor(1); |
| 588 |
|
|
| 589 |
|
if(va1!=0){ |
| 590 |
|
figsava=out+ffile+"_FTrkScanQLook_EXPERT_ev"; |
| 591 |
|
figsava+=event+1; |
| 592 |
|
figsava+="_DSP"; |
| 593 |
|
figsava+=(int)(va1/100); |
| 594 |
|
figsava+="_VA1-"; |
| 595 |
|
figsava+=va1%100; |
| 596 |
|
cva[e] = new TCanvas(figsava.Data(),"TrkQLookSCAN VA1",canvasx,canvasy); |
| 597 |
|
cva[e]->SetFillColor(10); |
| 598 |
|
cva[e]->Range(0,0,1,1); |
| 599 |
|
fromfile.str(""); |
| 600 |
|
fromfile<<"FTrkScanQLook_EXPERT File: "<<ffile<<" ----> Entry "<<event<<" --> DSP "<<(int)(va1/100)<<" --> va1 "<<va1%100; |
| 601 |
|
t->DrawLatex(0.02,0.98,fromfile.str().c_str()); |
| 602 |
|
// t->DrawLatex(0.65,0.98,cal.Data()); |
| 603 |
|
} |
| 604 |
|
|
| 605 |
// =============== |
// draw pads |
| 606 |
// trasmitted data |
Double_t posy = 0.95; // up y-coord - top pads |
| 607 |
// =============== |
Double_t hpad = 0.15; // pad height |
| 608 |
|
Double_t posx1=0; // left x-coord - pad column |
| 609 |
address = 0; |
Double_t posx2=0; // right x-coord - pad olumn |
| 610 |
ladder = 1; |
Double_t posx0=0; // x-coord - column division |
| 611 |
for(Int_t i = 0; i < trk->DATAlength[n] ; i++){ |
Double_t wrel = 0.6; // relative x size of first sub-column |
| 612 |
word = trk->TrackerData.At(iword); |
Double_t marg = 0.004; // margin among pads |
| 613 |
thisword = datadecode(word); |
|
| 614 |
iword++; |
for(Int_t n = 0; n<12; n++){ |
| 615 |
switch (thisword.type){ |
if ( (n+1)%2 ) { |
| 616 |
|
if(n>1)posy = posy-(marg*2+hpad); |
| 617 |
|
posx1 = marg; |
| 618 |
|
posx2 = 0.5 - marg; |
| 619 |
|
posx0 = 0.5*wrel; |
| 620 |
|
} else { |
| 621 |
|
posx1 = posx1 + 0.5; |
| 622 |
|
posx2 = posx2 + 0.5; |
| 623 |
|
posx0 = posx0 + 0.5; |
| 624 |
|
}; |
| 625 |
|
|
| 626 |
|
/* -----------> pad for histograms */ |
| 627 |
|
trkpad[n] = new TPad("pad"," ",posx1,posy-hpad,posx0-marg,posy,18,0,0); |
| 628 |
|
trkpad[n]->SetFillColor(19); |
| 629 |
|
trkpad[n]->SetFrameFillColor(10); |
| 630 |
|
/* -----------> pad for header dump */ |
| 631 |
|
trkpadtext[n] = new TPaveText((posx0+marg),(posy-hpad),posx2,posy); |
| 632 |
|
/* -----------> HISTOGRAMS */ |
| 633 |
|
|
| 634 |
|
title.str(""); |
| 635 |
|
title<<"DSP "<<n+1; |
| 636 |
|
hid<<"h"<<n+e*100; |
| 637 |
|
histomax[n][e] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
| 638 |
|
hid<<"hh"<<n+e*100; |
| 639 |
|
histocomp[n][e] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
| 640 |
|
hid<<"hhh"<<n+e*100; |
| 641 |
|
histofull[n][e] = new TH1F(hid.str().c_str(),title.str().c_str(),3073,-0.5,3072.5); |
| 642 |
|
title.str(""); |
| 643 |
|
hid.str(""); |
| 644 |
|
} |
| 645 |
|
if(va1!=0){ |
| 646 |
|
title.str(""); |
| 647 |
|
title<<"DSP "<<(int)(va1/100)<<" -- va1 "<<va1%100; |
| 648 |
|
hid<<"va"<<e; |
| 649 |
|
histova[e] = new TH1F(hid.str().c_str(),title.str().c_str(),130,0,129); |
| 650 |
|
} //end loop on views |
| 651 |
|
|
| 652 |
|
/* -----------> pad for histograms */ |
| 653 |
|
pad = new TPad("padva"," ",0,0,1,0.97,18,0,0); |
| 654 |
|
pad->SetFillColor(19); |
| 655 |
|
pad->SetFrameFillColor(10); |
| 656 |
|
} |
| 657 |
|
// = = = = = = = = = = = = = = = = = = = = = = = = = |
| 658 |
|
// create header dump retrieving event info |
| 659 |
|
// = = = = = = = = = = = = = = = = = = = = = = = = = |
| 660 |
|
|
| 661 |
|
|
| 662 |
|
Double_t whistomax[3072]; |
| 663 |
|
Double_t whisto[3072]; |
| 664 |
|
Double_t whistocomp[3072]; |
| 665 |
|
Double_t whistofull[3072]; |
| 666 |
|
|
| 667 |
|
//============================================= |
| 668 |
|
// transmitted words |
| 669 |
|
Int_t word = 0; |
| 670 |
|
Int_t iword = 0; |
| 671 |
|
Int_t TOTDATAlength_check = 0; |
| 672 |
|
Int_t ii=0,ifull[12],icomp[12],imax[12],nn=0; |
| 673 |
|
trkword thisword; |
| 674 |
|
|
| 675 |
|
Int_t address,ladder; |
| 676 |
|
|
| 677 |
|
|
| 678 |
|
for(Int_t n = 0; n<12; n++){ |
| 679 |
|
|
| 680 |
|
ndsp = trk->DSPnumber[n]; |
| 681 |
|
nn = ndsp-1; |
| 682 |
|
ifull[nn]=0; |
| 683 |
|
icomp[nn]=0; |
| 684 |
|
imax[nn]=0; |
| 685 |
|
if(ndsp>0){ |
| 686 |
|
if(ndsp<13){ |
| 687 |
|
if((tot<TOT && e<tot) || tot==TOT){ |
| 688 |
|
|
| 689 |
|
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
| 690 |
|
* |
| 691 |
|
* Write event LEVEL0 report |
| 692 |
|
* |
| 693 |
|
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
| 694 |
|
|
| 695 |
|
trkpadtext[nn]->SetTextFont(40); |
| 696 |
|
trkpadtext[nn]->SetFillColor(33); |
| 697 |
|
trkpadtext[nn]->SetTextSize(0.012); |
| 698 |
|
trkpadtext[nn]->SetTextAlign(13); |
| 699 |
|
|
| 700 |
|
trkpadtext[nn]->AddText(" "); |
| 701 |
|
message<<"DAQ mode --------> "<<trk->DAQmode[n]; |
| 702 |
|
trkpadtext[nn]->AddText(message.str().c_str()); |
| 703 |
|
message.str(""); |
| 704 |
|
message<<"Event number --------> "<<trk->eventn[n]; |
| 705 |
|
trkpadtext[nn]->AddText(message.str().c_str()); |
| 706 |
|
message.str(""); |
| 707 |
|
message<<"13-bit words --------> "<<trk->DATAlength[n]; |
| 708 |
|
trkpadtext[nn]->AddText(message.str().c_str()); |
| 709 |
|
message.str(""); |
| 710 |
|
if (!(nn%2)&&trk->signcluster[n][0]!=0) message<<"L1 add: "<<trk->addrcluster[n][0]<<" - sign: "<<1024-(trk->signcluster[n][0]); |
| 711 |
|
else message<<"L1 add: "<<trk->addrcluster[n][0]<<" - sign: "<<(trk->signcluster[n][0]); |
| 712 |
|
trkpadtext[nn]->AddText(message.str().c_str()); |
| 713 |
|
message.str(""); |
| 714 |
|
if (!(nn%2)&&trk->signcluster[n][1]!=0) message<<"L2 add: "<<trk->addrcluster[n][1]<<" - sign: "<<1024-(trk->signcluster[n][1]); |
| 715 |
|
else message<<"L2 add: "<<trk->addrcluster[n][1]<<" - sign: "<<trk->signcluster[n][1]; |
| 716 |
|
trkpadtext[nn]->AddText(message.str().c_str()); |
| 717 |
|
message.str(""); |
| 718 |
|
if (!(nn%2)&&trk->signcluster[n][2]!=0) message<<"L3 add: "<<trk->addrcluster[n][2]<<" - sign: "<<1024-(trk->signcluster[n][2]); |
| 719 |
|
else message<<"L3 add: "<<trk->addrcluster[n][2]<<" - sign: "<<trk->signcluster[n][2]; |
| 720 |
|
trkpadtext[nn]->AddText(message.str().c_str()); |
| 721 |
|
message.str(""); |
| 722 |
|
message<<"NCLUST "<<trk->nclust[n]<<" CUTC "<<trk->cutc[n]<<" CUTCL "<<trk->cutcl[n]; |
| 723 |
|
trkpadtext[nn]->AddText(message.str().c_str()); |
| 724 |
|
message.str(""); |
| 725 |
|
message<<"Comp. time "<<trk->compressiontime[n]<<" x 0.051ms = "<<0.051*trk->compressiontime[n]<<" ms"; |
| 726 |
|
trkpadtext[nn]->AddText(message.str().c_str()); |
| 727 |
|
message.str(""); |
| 728 |
|
trkpadtext[nn]->AddText(" "); |
| 729 |
|
message<<"CRC --> "<<trk->crc[n]; |
| 730 |
|
trkpadtext[nn]->AddText(message.str().c_str()); |
| 731 |
|
message.str(""); |
| 732 |
|
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]; |
| 733 |
|
trkpadtext[nn]->AddText(message.str().c_str()); |
| 734 |
|
message.str(""); |
| 735 |
|
trkpadtext[nn]->AddText(" "); |
| 736 |
|
trkpadtext[nn]->AddLine(0,0,0,0); |
| 737 |
|
message<<"PNum "<<trk->pnum[n]<<" - BId "<<trk->bid[n]<<" ALARM "<<trk->alarm[n]; |
| 738 |
|
trkpadtext[nn]->AddText(message.str().c_str()); |
| 739 |
|
message.str(""); |
| 740 |
|
message<<"Cmd "<<trk->cmdnum[n]<<" --- Answer length "<<trk->aswr[n]<<" byte"; |
| 741 |
|
trkpadtext[nn]->AddText(message.str().c_str()); |
| 742 |
|
message.str(""); |
| 743 |
|
trkpadtext[nn]->AddText(" "); |
| 744 |
|
|
| 745 |
|
TOTDATAlength_check = TOTDATAlength_check + trk->DATAlength[n]; |
| 746 |
|
} |
| 747 |
|
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
| 748 |
|
* |
| 749 |
|
* Plot event LEVEL0 histo |
| 750 |
|
* |
| 751 |
|
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
| 752 |
|
|
| 753 |
|
//============================================= |
| 754 |
|
} |
| 755 |
|
for(Int_t i = 0; i< 3072; i++){ |
| 756 |
|
whistomax[i] = -200; |
| 757 |
|
whistocomp[i] = -200; |
| 758 |
|
whistofull[i] = -200; |
| 759 |
|
whisto[i] = -200; |
| 760 |
|
} |
| 761 |
|
|
| 762 |
|
// =============== |
| 763 |
|
// trasmitted data |
| 764 |
|
// =============== |
| 765 |
|
|
| 766 |
|
address = 0; |
| 767 |
|
ladder = 1; |
| 768 |
|
for(Int_t i = 0; i < trk->DATAlength[n] ; i++){ |
| 769 |
|
word = trk->TrackerData.At(iword); |
| 770 |
|
thisword = datadecode(word); |
| 771 |
|
iword++; |
| 772 |
|
switch (thisword.type){ |
| 773 |
|
|
| 774 |
case 0: //ADC value |
case 0: //ADC value |
| 775 |
whisto[address] = thisword.decode; |
whisto[address] = thisword.decode; |
| 776 |
address++; |
address++; |
| 777 |
// cout << " adr " << address << "\n"; |
// cout << " adr " << address << "\n"; |
| 778 |
break; |
break; |
| 779 |
|
|
| 780 |
case 1: //address |
case 1: //address |
| 781 |
address = 1024*(ladder-1) + thisword.decode; |
address = 1024*(ladder-1) + thisword.decode; |
| 782 |
// cout << " adr " << address << "\n"; |
// cout << " adr " << address << "\n"; |
| 783 |
break; |
break; |
| 784 |
|
|
| 785 |
case 2: //end-of-ladder |
case 2: //end-of-ladder |
| 786 |
ladder = thisword.decode; |
ladder = thisword.decode; |
| 787 |
// cout << "Ladder " << ladder << "\n"; |
// cout << "Ladder " << ladder << "\n"; |
| 788 |
if(ladder==3){ |
if(ladder==3){ |
| 789 |
// end of compressed data - FILL HISTO |
// end of compressed data - FILL HISTO |
| 790 |
//cout << ">>> COMPRESSED data" << "\n"; |
//cout << ">>> COMPRESSED data" << "\n"; |
| 791 |
for(ii = 0; ii < 3072; ii++){ |
for(ii = 0; ii < 3072; ii++){ |
| 792 |
whistocomp[ii]=whisto[ii]; |
whistocomp[ii]=whisto[ii]; |
| 793 |
whisto[ii] = -200; |
whisto[ii] = -200; |
| 794 |
|
} |
| 795 |
|
address = 0; |
| 796 |
|
ladder = 1; |
| 797 |
|
}else if(ladder==6){ |
| 798 |
|
// end of full data - FILL HISTO |
| 799 |
|
//cout << ">>> FULL data" << "\n"; |
| 800 |
|
for(ii = 0; ii < 3072; ii++){ |
| 801 |
|
whistofull[ii]=whisto[ii]; |
| 802 |
|
whisto[ii] = -200; |
| 803 |
|
} |
| 804 |
|
address = 0; |
| 805 |
|
ladder = 1; |
| 806 |
|
}else{ |
| 807 |
|
if(ladder>3) ladder=ladder-3; |
| 808 |
|
address= ladder*1024; |
| 809 |
|
ladder = ladder + 1; |
| 810 |
|
} |
| 811 |
|
} |
| 812 |
|
} |
| 813 |
|
|
| 814 |
|
|
| 815 |
|
// =============== |
| 816 |
|
// maximum signals |
| 817 |
|
// =============== |
| 818 |
|
if(trk->signcluster[nn][0]!=0) whistomax[ 0+(int)trk->addrcluster[nn][0]] = whistocomp[ 0+(int)trk->addrcluster[nn][0]]; |
| 819 |
|
if(trk->signcluster[nn][1]!=0) whistomax[1024+(int)trk->addrcluster[nn][1]] = whistocomp[1024+(int)trk->addrcluster[nn][1]]; |
| 820 |
|
if(trk->signcluster[nn][2]!=0) whistomax[2048+(int)trk->addrcluster[nn][2]] = whistocomp[2048+(int)trk->addrcluster[nn][2]]; |
| 821 |
|
|
| 822 |
|
for(Int_t i = 0; i < 3072; i++){ |
| 823 |
|
if(whistomax[i]>-200) imax[nn]=1; |
| 824 |
|
if(whistocomp[i]>-200) icomp[nn]=1; |
| 825 |
|
if(whistofull[i]>-200) ifull[nn]=1; |
| 826 |
|
if(value%10!=0){ |
| 827 |
|
if((totvalues<TOT && e<totvalues) || totvalues==TOT){ |
| 828 |
|
if(whistofull[i]>0){ |
| 829 |
|
if(i==0) values << (short int)ndsp << " "; |
| 830 |
|
values <<(short int) whistofull[i] <<" "; |
| 831 |
|
if(i==3071) values << endl; |
| 832 |
|
} |
| 833 |
|
} |
| 834 |
} |
} |
| 835 |
address = 0; |
if((tot<TOT && e<tot) || tot==TOT){ |
| 836 |
ladder = 1; |
histomax[nn][e]->Fill((Float_t)i,whistomax[i]); |
| 837 |
}else if(ladder==6){ |
histocomp[nn][e]->Fill((Float_t)i,whistocomp[i]); |
| 838 |
// end of full data - FILL HISTO |
histofull[nn][e]->Fill((Float_t)i,whistofull[i]); |
| 839 |
//cout << ">>> FULL data" << "\n"; |
if(va1!=0 && ndsp==(int)(va1/100) && i>=128*((va1%100)-1)){ |
| 840 |
for(ii = 0; ii < 3072; ii++){ |
if(i<128*(va1%100)) |
| 841 |
whistofull[ii]=whisto[ii]; |
histova[e]->Fill((Float_t)(i-128*((va1%100)-1)+1),whistofull[i]); |
| 842 |
whisto[ii] = -200; |
} |
| 843 |
} |
} |
| 844 |
address = 0; |
} |
|
ladder = 1; |
|
|
}else{ |
|
|
if(ladder>3) ladder=ladder-3; |
|
|
address= ladder*1024; |
|
|
ladder = ladder + 1; |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// =============== |
|
|
// maximum signals |
|
|
// =============== |
|
|
if(trk->signcluster[nn][0]!=0) whistomax[ 0+(int)trk->addrcluster[nn][0]] = whistocomp[ 0+(int)trk->addrcluster[nn][0]]; |
|
|
if(trk->signcluster[nn][1]!=0) whistomax[1024+(int)trk->addrcluster[nn][1]] = whistocomp[1024+(int)trk->addrcluster[nn][1]]; |
|
|
if(trk->signcluster[nn][2]!=0) whistomax[2048+(int)trk->addrcluster[nn][2]] = whistocomp[2048+(int)trk->addrcluster[nn][2]]; |
|
|
|
|
|
for(Int_t i = 0; i < 3072; i++){ |
|
|
if(whistomax[i]>-200) imax[nn]=1; |
|
|
if(whistocomp[i]>-200) icomp[nn]=1; |
|
|
if(whistofull[i]>-200) ifull[nn]=1; |
|
|
histomax[nn]->Fill((Float_t)i,whistomax[i]); |
|
|
histocomp[nn]->Fill((Float_t)i,whistocomp[i]); |
|
|
histofull[nn]->Fill((Float_t)i,whistofull[i]); |
|
|
} |
|
| 845 |
|
|
| 846 |
TBox b; |
if((tot<TOT && e<tot) || tot==TOT){ |
| 847 |
b.SetFillColor(6); |
TBox b; |
| 848 |
b.SetFillStyle(3945); |
TLine li,liva1; |
| 849 |
|
li.SetLineColor(38); |
| 850 |
c1->cd(); |
li.SetLineStyle(4); |
| 851 |
trkpadtext[nn]->Draw(); |
li.SetLineWidth(2); |
| 852 |
trkpad[nn]->Draw(); |
liva1.SetLineColor(42); |
| 853 |
trkpad[nn]->cd(); |
liva1.SetLineStyle(3); |
| 854 |
trkpad[nn]->SetFillColor(10); |
liva1.SetLineWidth(1); |
| 855 |
|
|
| 856 |
histocomp[nn]->GetYaxis()->SetRangeUser(-500,4500); |
Float_t va1x=0,maxhist=4500.,minhist=-500.; |
| 857 |
histocomp[nn]->SetLineStyle(1); |
|
| 858 |
histocomp[nn]->SetLineColor(38); |
if(va1!=0){ |
| 859 |
histocomp[nn]->SetFillColor(38); |
cva[e]->cd(); |
| 860 |
histocomp[nn]->SetLineWidth(1); |
pad->Draw(); |
| 861 |
histocomp[nn]->Draw(""); |
pad->cd(); |
| 862 |
|
pad->SetFillColor(10); |
| 863 |
histofull[nn]->SetLineColor(40); |
histova[e]->SetTitleSize(0.01); |
| 864 |
histofull[nn]->SetFillColor(40); |
histova[e]->GetYaxis()->SetRangeUser(1500,4500); |
| 865 |
histofull[nn]->SetLineWidth(1); |
histova[e]->SetLineColor(40); |
| 866 |
histofull[nn]->SetLineStyle(2); |
histova[e]->SetFillColor(40); |
| 867 |
|
histova[e]->SetLineWidth(1); |
| 868 |
histomax[nn]->SetLineColor(2); |
histova[e]->SetLineStyle(2); |
| 869 |
histomax[nn]->SetLineWidth(1); |
// histova[e]->GetYaxis()->SetLabelSize(0.03); |
| 870 |
histomax[nn]->SetLineStyle(3); |
histova[e]->Draw(""); |
| 871 |
|
cva[e]->Update(); |
| 872 |
if(ifull[nn]==1) histofull[nn]->Draw("9bsame]["); |
} |
| 873 |
if(icomp[nn]==1) histocomp[nn]->Draw("9bsame]["); |
|
| 874 |
if(imax[nn]==1) histomax[nn]->Draw("same]["); |
c1[e]->cd(); |
| 875 |
histocomp[nn]->Draw("axis same"); |
trkpadtext[nn]->Draw(); |
| 876 |
if(nn==1){ |
trkpad[nn]->Draw(); |
| 877 |
b.DrawBox(2816.,-500.,3060.,4500.); |
trkpad[nn]->cd(); |
| 878 |
} |
trkpad[nn]->SetFillColor(10); |
| 879 |
else if(nn==6){ |
|
| 880 |
b.DrawBox(2560.,-500.,2816.,4500.); |
histocomp[nn][e]->SetTitleSize(0.1); |
| 881 |
b.DrawBox(512.,-500.,768.,4500.); |
histocomp[nn][e]->GetYaxis()->SetRangeUser(-500,4500); |
| 882 |
b.DrawBox(1024.,-500.,1792.,4500.); |
histocomp[nn][e]->SetLineStyle(1); |
| 883 |
|
histocomp[nn][e]->SetLineColor(38); |
| 884 |
|
histocomp[nn][e]->SetFillColor(38); |
| 885 |
|
histocomp[nn][e]->SetLineWidth(1); |
| 886 |
|
histocomp[nn][e]->Draw(""); |
| 887 |
|
|
| 888 |
|
histofull[nn][e]->SetLineColor(40); |
| 889 |
|
histofull[nn][e]->SetFillColor(40); |
| 890 |
|
histofull[nn][e]->SetLineWidth(1); |
| 891 |
|
histofull[nn][e]->SetLineStyle(2); |
| 892 |
|
|
| 893 |
|
histomax[nn][e]->SetLineColor(2); |
| 894 |
|
histomax[nn][e]->SetLineWidth(1); |
| 895 |
|
histomax[nn][e]->SetLineStyle(3); |
| 896 |
|
|
| 897 |
|
if(ifull[nn]==1) histofull[nn][e]->Draw("9bsame]["); |
| 898 |
|
if(icomp[nn]==1) histocomp[nn][e]->Draw("9bsame]["); |
| 899 |
|
if(imax[nn]==1) histomax[nn][e]->Draw("same]["); |
| 900 |
|
histocomp[nn][e]->Draw("axis same"); |
| 901 |
|
|
| 902 |
|
b.SetFillColor(19); |
| 903 |
|
b.SetFillStyle(3945); |
| 904 |
|
if(nn==0){ |
| 905 |
|
b.DrawBox(0.,minhist,2047.,maxhist); |
| 906 |
|
} |
| 907 |
|
else if(nn==1){ |
| 908 |
|
b.DrawBox(128.,minhist,256.,maxhist); |
| 909 |
|
b.DrawBox(384.,minhist,512.,maxhist); |
| 910 |
|
b.DrawBox(896.,minhist,1024.,maxhist); |
| 911 |
|
b.DrawBox(2048.,minhist,2432.,maxhist); |
| 912 |
|
b.DrawBox(2816.,minhist,2944.,maxhist); |
| 913 |
|
b.DrawBox(2944.,minhist,3070.,maxhist); |
| 914 |
|
} |
| 915 |
|
else if(nn==3){ |
| 916 |
|
b.DrawBox(0.,minhist,256.,maxhist); |
| 917 |
|
b.DrawBox(2816.,minhist,3070.,maxhist); |
| 918 |
|
} |
| 919 |
|
else if(nn==4){ |
| 920 |
|
b.DrawBox(256.,minhist,512.,maxhist); |
| 921 |
|
b.DrawBox(1792.,minhist,1920.,maxhist); |
| 922 |
|
b.DrawBox(2816.,minhist,3070.,maxhist); |
| 923 |
|
} |
| 924 |
|
else if(nn==5){ |
| 925 |
|
b.DrawBox(0.,minhist,256.,maxhist); |
| 926 |
|
b.DrawBox(896.,minhist,1024.,maxhist); |
| 927 |
|
b.DrawBox(1664.,minhist,1792.,maxhist); |
| 928 |
|
} |
| 929 |
|
else if(nn==6){ |
| 930 |
|
b.DrawBox(512.,minhist,768.,maxhist); |
| 931 |
|
b.DrawBox(1024.,minhist,1280.,maxhist); |
| 932 |
|
b.DrawBox(1280.,minhist,1792.,maxhist); |
| 933 |
|
b.DrawBox(2560.,minhist,2816.,maxhist); |
| 934 |
|
} |
| 935 |
|
else if(nn==7){ |
| 936 |
|
b.DrawBox(0.,minhist,1535.,maxhist); |
| 937 |
|
b.DrawBox(2024.,minhist,2280.,maxhist); |
| 938 |
|
} |
| 939 |
|
else if(nn==8){ |
| 940 |
|
b.DrawBox(512.,minhist,768.,maxhist); |
| 941 |
|
} |
| 942 |
|
else if(nn==9){ |
| 943 |
|
b.DrawBox(0.,minhist,128.,maxhist); |
| 944 |
|
b.DrawBox(256.,minhist,384.,maxhist); |
| 945 |
|
b.DrawBox(512.,minhist,640.,maxhist); |
| 946 |
|
b.DrawBox(896.,minhist,1152.,maxhist); |
| 947 |
|
b.DrawBox(1280.,minhist,1535.,maxhist); |
| 948 |
|
b.DrawBox(1664.,minhist,1920.,maxhist); |
| 949 |
|
b.DrawBox(2048.,minhist,2304.,maxhist); |
| 950 |
|
} |
| 951 |
|
else if(nn==10){ |
| 952 |
|
b.DrawBox(0.,minhist,512.,maxhist); |
| 953 |
|
b.DrawBox(1024.,minhist,3070.,maxhist); |
| 954 |
|
} |
| 955 |
|
else if(nn==11){ |
| 956 |
|
b.DrawBox(0.,minhist,512.,maxhist); |
| 957 |
|
b.DrawBox(768.,minhist,1024.,maxhist); |
| 958 |
|
b.DrawBox(1536.,minhist,1664.,maxhist); |
| 959 |
|
b.DrawBox(1920.,minhist,2560.,maxhist); |
| 960 |
|
b.DrawBox(2816.,minhist,3070.,maxhist); |
| 961 |
|
} |
| 962 |
|
for(int va=1; va<24; va++){ |
| 963 |
|
va1x=128*va; |
| 964 |
|
liva1.DrawLine(va1x,minhist,va1x,maxhist); |
| 965 |
|
} |
| 966 |
|
li.DrawLine(1024.5,minhist,1024.5,maxhist); |
| 967 |
|
li.DrawLine(2048.5,minhist,2048.5,maxhist); |
| 968 |
|
c1[e]->Update(); |
| 969 |
|
} |
| 970 |
|
|
| 971 |
|
} |
| 972 |
|
}//end loop on views |
| 973 |
|
|
| 974 |
|
if((tot<TOT && e<tot) || tot==TOT){ |
| 975 |
|
stringstream nom1,nom2,nom3; |
| 976 |
|
nom1<<out<<ffile<<"_FTrkScanQLook_EXPERT.ps("; |
| 977 |
|
nom2<<out<<ffile<<"_FTrkScanQLook_EXPERT.ps"; |
| 978 |
|
nom3<<out<<ffile<<"_FTrkScanQLook_EXPERT.ps)"; |
| 979 |
|
|
| 980 |
|
if(!strcmp(outfile.Data(),"ps")||!strcmp(outfile.Data(),"pdf")){ |
| 981 |
|
if(e==0){ |
| 982 |
|
c1[e]->Print(nom1.str().c_str(),"Landscape"); |
| 983 |
|
if(va1!=0) cva[e]->Print(nom2.str().c_str(),"Landscape"); |
| 984 |
|
} |
| 985 |
|
if(e>0 && tot>2){ |
| 986 |
|
c1[e]->Print(nom2.str().c_str(),"Landscape"); |
| 987 |
|
if(va1!=0) cva[e]->Print(nom2.str().c_str(),"Landscape"); |
| 988 |
|
} |
| 989 |
|
if(e==tot-1){ |
| 990 |
|
c1[e]->Print(nom2.str().c_str(),"Landscape"); |
| 991 |
|
if(va1!=0) cva[e]->Print(nom3.str().c_str(),"Landscape"); |
| 992 |
|
} |
| 993 |
|
} |
| 994 |
|
else{ |
| 995 |
|
figsav+="."+outfile; |
| 996 |
|
c1[e]->Print(figsav.Data()); |
| 997 |
|
if(va1!=0){ |
| 998 |
|
figsava+="."+outfile; |
| 999 |
|
cva[e]->Print(figsava.Data()); |
| 1000 |
|
} |
| 1001 |
|
} |
| 1002 |
} |
} |
| 1003 |
else if(nn==11){ |
if(value%10!=0){ |
| 1004 |
b.DrawBox(768.,-500.,1024.,4500.); |
if(totvalues==TOT || (totvalues<TOT && e<totvalues)) |
| 1005 |
|
values << (short int)0 << endl << endl; |
| 1006 |
} |
} |
| 1007 |
c1->Update(); |
} |
| 1008 |
|
stringstream com; |
|
}//end loop on views |
|
| 1009 |
|
|
| 1010 |
c1->Print(figsav.str().c_str()); |
values.close(); |
| 1011 |
|
if(value==0){ |
| 1012 |
|
com<<"rm -f "<<fname; |
| 1013 |
|
system(com.str().c_str()); |
| 1014 |
|
} |
| 1015 |
|
// |
| 1016 |
|
// Convert ps to pdf if required |
| 1017 |
|
if(!strcmp(outfile.Data(),"pdf")){ |
| 1018 |
|
com<<"ps2pdf13 "<<out<<ffile<<"_FTrkScanQLook_EXPERT.ps "<<out<<ffile<<"_FTrkScanQLook_EXPERT.pdf"; |
| 1019 |
|
system(com.str().c_str()); |
| 1020 |
|
printf("\n---> ps file converted in pdf format!\n"); |
| 1021 |
|
com.str(""); |
| 1022 |
|
com<<"rm -f "<<out<<ffile<<"_FTrkScanQLook_EXPERT.ps "; |
| 1023 |
|
system(com.str().c_str()); |
| 1024 |
|
printf("---> ps file removed!\n\n"); |
| 1025 |
|
com.str(""); |
| 1026 |
|
} |
| 1027 |
|
|
| 1028 |
return; |
return; |
| 1029 |
} |
} |