2 |
* FTrkScanQlook_EXPERT.cxx |
* FTrkScanQlook_EXPERT.cxx |
3 |
* |
* |
4 |
* autor: D.Fedele |
* autor: D.Fedele |
5 |
* version 2.0 |
* version v1r06 |
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]; |
303 |
|
|
304 |
//============================================= |
//============================================= |
305 |
// transmitted words |
// transmitted words |
306 |
Int_t word = 0; |
Int_t word = 0; |
307 |
Int_t iword = 0; |
Int_t iword = 0; |
308 |
Int_t TOTDATAlength_check = 0; |
Int_t TOTDATAlength_check = 0; |
309 |
Int_t ii=0,ifull[12],icomp[12],imax[12],nn=0; |
Int_t ii=0,ifull[12],icomp[12],imax[12],nn=0; |
310 |
trkword thisword; |
trkword thisword; |
311 |
|
|
312 |
Int_t address,ladder; |
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 |
|
|
322 |
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
323 |
* |
* |
324 |
* Write event LEVEL0 report |
* Write event LEVEL0 report |
325 |
* |
* |
326 |
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
327 |
|
|
328 |
trkpadtext[nn]->SetTextFont(40); |
trkpadtext[nn]->SetTextFont(40); |
329 |
trkpadtext[nn]->SetFillColor(33); |
trkpadtext[nn]->SetFillColor(33); |
330 |
trkpadtext[nn]->SetTextSize(0.012); |
trkpadtext[nn]->SetTextSize(0.012); |
331 |
trkpadtext[nn]->SetTextAlign(13); |
trkpadtext[nn]->SetTextAlign(13); |
332 |
|
|
333 |
trkpadtext[nn]->AddText(" "); |
trkpadtext[nn]->AddText(" "); |
334 |
message<<"DAQ mode --------> "<<trk->DAQmode[n]; |
message<<"DAQ mode --------> "<<trk->DAQmode[n]; |
335 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
336 |
message.str(""); |
message.str(""); |
337 |
message<<"Event number --------> "<<trk->eventn[n]; |
message<<"Event number --------> "<<trk->eventn[n]; |
338 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
339 |
message.str(""); |
message.str(""); |
340 |
message<<"13-bit words --------> "<<trk->DATAlength[n]; |
message<<"13-bit words --------> "<<trk->DATAlength[n]; |
341 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
342 |
message.str(""); |
message.str(""); |
343 |
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]); |
344 |
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]); |
345 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
346 |
message.str(""); |
message.str(""); |
347 |
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]); |
348 |
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]; |
349 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
350 |
message.str(""); |
message.str(""); |
351 |
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]); |
352 |
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]; |
353 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
354 |
message.str(""); |
message.str(""); |
355 |
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]; |
356 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
357 |
message.str(""); |
message.str(""); |
358 |
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"; |
359 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
360 |
message.str(""); |
message.str(""); |
361 |
trkpadtext[nn]->AddText(" "); |
trkpadtext[nn]->AddText(" "); |
362 |
message<<"CRC --> "<<trk->crc[n]; |
message<<"CRC --> "<<trk->crc[n]; |
363 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
364 |
message.str(""); |
message.str(""); |
365 |
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]; |
366 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
367 |
message.str(""); |
message.str(""); |
368 |
trkpadtext[nn]->AddText(" "); |
trkpadtext[nn]->AddText(" "); |
369 |
trkpadtext[nn]->AddLine(0,0,0,0); |
trkpadtext[nn]->AddLine(0,0,0,0); |
370 |
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]; |
371 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
372 |
message.str(""); |
message.str(""); |
373 |
message<<"Cmd "<<trk->cmdnum[n]<<" --- Answer length "<<trk->aswr[n]<<" byte"; |
message<<"Cmd "<<trk->cmdnum[n]<<" --- Answer length "<<trk->aswr[n]<<" byte"; |
374 |
trkpadtext[nn]->AddText(message.str().c_str()); |
trkpadtext[nn]->AddText(message.str().c_str()); |
375 |
message.str(""); |
message.str(""); |
376 |
trkpadtext[nn]->AddText(" "); |
trkpadtext[nn]->AddText(" "); |
377 |
|
|
378 |
TOTDATAlength_check = TOTDATAlength_check + trk->DATAlength[n]; |
TOTDATAlength_check = TOTDATAlength_check + trk->DATAlength[n]; |
|
|
|
|
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
|
|
* |
|
|
* Plot event LEVEL0 histo |
|
|
* |
|
|
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
|
379 |
|
|
380 |
//============================================= |
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
381 |
|
* |
382 |
for(Int_t i = 0; i< 3072; i++){ |
* Plot event LEVEL0 histo |
383 |
whistomax[i] = -200; |
* |
384 |
whistocomp[i] = -200; |
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
385 |
whistofull[i] = -200; |
|
386 |
whisto[i] = -200; |
//============================================= |
387 |
} |
|
388 |
|
for(Int_t i = 0; i< 3072; i++){ |
389 |
|
whistomax[i] = -200; |
390 |
|
whistocomp[i] = -200; |
391 |
|
whistofull[i] = -200; |
392 |
|
whisto[i] = -200; |
393 |
|
} |
394 |
|
|
395 |
// =============== |
// =============== |
396 |
// trasmitted data |
// trasmitted data |
397 |
// =============== |
// =============== |
398 |
|
|
399 |
address = 0; |
address = 0; |
400 |
ladder = 1; |
ladder = 1; |
401 |
for(Int_t i = 0; i < trk->DATAlength[n] ; i++){ |
for(Int_t i = 0; i < trk->DATAlength[n] ; i++){ |
402 |
word = trk->TrackerData.At(iword); |
word = trk->TrackerData.At(iword); |
403 |
thisword = datadecode(word); |
thisword = datadecode(word); |
404 |
iword++; |
iword++; |
405 |
switch (thisword.type){ |
switch (thisword.type){ |
406 |
|
|
407 |
case 0: //ADC value |
case 0: //ADC value |
408 |
whisto[address] = thisword.decode; |
whisto[address] = thisword.decode; |
409 |
address++; |
address++; |
410 |
// cout << " adr " << address << "\n"; |
// cout << " adr " << address << "\n"; |
411 |
break; |
break; |
412 |
|
|
413 |
case 1: //address |
case 1: //address |
414 |
address = 1024*(ladder-1) + thisword.decode; |
address = 1024*(ladder-1) + thisword.decode; |
415 |
// cout << " adr " << address << "\n"; |
// cout << " adr " << address << "\n"; |
416 |
break; |
break; |
417 |
|
|
418 |
case 2: //end-of-ladder |
case 2: //end-of-ladder |
419 |
ladder = thisword.decode; |
ladder = thisword.decode; |
420 |
// cout << "Ladder " << ladder << "\n"; |
// cout << "Ladder " << ladder << "\n"; |
421 |
if(ladder==3){ |
if(ladder==3){ |
422 |
// end of compressed data - FILL HISTO |
// end of compressed data - FILL HISTO |
423 |
//cout << ">>> COMPRESSED data" << "\n"; |
//cout << ">>> COMPRESSED data" << "\n"; |
424 |
for(ii = 0; ii < 3072; ii++){ |
for(ii = 0; ii < 3072; ii++){ |
425 |
whistocomp[ii]=whisto[ii]; |
whistocomp[ii]=whisto[ii]; |
426 |
whisto[ii] = -200; |
whisto[ii] = -200; |
427 |
|
} |
428 |
|
address = 0; |
429 |
|
ladder = 1; |
430 |
|
}else if(ladder==6){ |
431 |
|
// end of full data - FILL HISTO |
432 |
|
//cout << ">>> FULL data" << "\n"; |
433 |
|
for(ii = 0; ii < 3072; ii++){ |
434 |
|
whistofull[ii]=whisto[ii]; |
435 |
|
whisto[ii] = -200; |
436 |
|
} |
437 |
|
address = 0; |
438 |
|
ladder = 1; |
439 |
|
}else{ |
440 |
|
if(ladder>3) ladder=ladder-3; |
441 |
|
address= ladder*1024; |
442 |
|
ladder = ladder + 1; |
443 |
} |
} |
444 |
address = 0; |
} |
|
ladder = 1; |
|
|
}else if(ladder==6){ |
|
|
// end of full data - FILL HISTO |
|
|
//cout << ">>> FULL data" << "\n"; |
|
|
for(ii = 0; ii < 3072; ii++){ |
|
|
whistofull[ii]=whisto[ii]; |
|
|
whisto[ii] = -200; |
|
|
} |
|
|
address = 0; |
|
|
ladder = 1; |
|
|
}else{ |
|
|
if(ladder>3) ladder=ladder-3; |
|
|
address= ladder*1024; |
|
|
ladder = ladder + 1; |
|
|
} |
|
445 |
} |
} |
|
} |
|
446 |
|
|
447 |
|
|
448 |
// =============== |
// =============== |
449 |
// maximum signals |
// maximum signals |
450 |
// =============== |
// =============== |
451 |
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]]; |
452 |
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]]; |
453 |
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]]; |
454 |
|
|
455 |
for(Int_t i = 0; i < 3072; i++){ |
for(Int_t i = 0; i < 3072; i++){ |
456 |
if(whistomax[i]>-200) imax[nn]=1; |
if(whistomax[i]>-200) imax[nn]=1; |
457 |
if(whistocomp[i]>-200) icomp[nn]=1; |
if(whistocomp[i]>-200) icomp[nn]=1; |
458 |
if(whistofull[i]>-200) ifull[nn]=1; |
if(whistofull[i]>-200) ifull[nn]=1; |
459 |
histomax[nn]->Fill((Float_t)i,whistomax[i]); |
histomax[nn][e]->Fill((Float_t)i,whistomax[i]); |
460 |
histocomp[nn]->Fill((Float_t)i,whistocomp[i]); |
histocomp[nn][e]->Fill((Float_t)i,whistocomp[i]); |
461 |
histofull[nn]->Fill((Float_t)i,whistofull[i]); |
histofull[nn][e]->Fill((Float_t)i,whistofull[i]); |
462 |
} |
} |
463 |
|
|
464 |
TBox b; |
TBox b; |
465 |
b.SetFillColor(6); |
b.SetFillColor(6); |
466 |
b.SetFillStyle(3945); |
b.SetFillStyle(3945); |
467 |
|
|
468 |
c1->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]->GetYaxis()->SetRangeUser(-500,4500); |
histocomp[nn][e]->GetYaxis()->SetRangeUser(-500,4500); |
475 |
histocomp[nn]->SetLineStyle(1); |
histocomp[nn][e]->SetLineStyle(1); |
476 |
histocomp[nn]->SetLineColor(38); |
histocomp[nn][e]->SetLineColor(38); |
477 |
histocomp[nn]->SetFillColor(38); |
histocomp[nn][e]->SetFillColor(38); |
478 |
histocomp[nn]->SetLineWidth(1); |
histocomp[nn][e]->SetLineWidth(1); |
479 |
histocomp[nn]->Draw(""); |
histocomp[nn][e]->Draw(""); |
480 |
|
|
481 |
histofull[nn]->SetLineColor(40); |
histofull[nn][e]->SetLineColor(40); |
482 |
histofull[nn]->SetFillColor(40); |
histofull[nn][e]->SetFillColor(40); |
483 |
histofull[nn]->SetLineWidth(1); |
histofull[nn][e]->SetLineWidth(1); |
484 |
histofull[nn]->SetLineStyle(2); |
histofull[nn][e]->SetLineStyle(2); |
485 |
|
|
486 |
histomax[nn]->SetLineColor(2); |
histomax[nn][e]->SetLineColor(2); |
487 |
histomax[nn]->SetLineWidth(1); |
histomax[nn][e]->SetLineWidth(1); |
488 |
histomax[nn]->SetLineStyle(3); |
histomax[nn][e]->SetLineStyle(3); |
489 |
|
|
490 |
if(ifull[nn]==1) histofull[nn]->Draw("9bsame]["); |
if(ifull[nn]==1) histofull[nn][e]->Draw("9bsame]["); |
491 |
if(icomp[nn]==1) histocomp[nn]->Draw("9bsame]["); |
if(icomp[nn]==1) histocomp[nn][e]->Draw("9bsame]["); |
492 |
if(imax[nn]==1) histomax[nn]->Draw("same]["); |
if(imax[nn]==1) histomax[nn][e]->Draw("same]["); |
493 |
histocomp[nn]->Draw("axis same"); |
histocomp[nn][e]->Draw("axis same"); |
494 |
if(nn==1){ |
if(nn==1){ |
495 |
b.DrawBox(2816.,-500.,3060.,4500.); |
b.DrawBox(2816.,-500.,3060.,4500.); |
496 |
} |
} |
497 |
else if(nn==6){ |
else if(nn==6){ |
498 |
b.DrawBox(2560.,-500.,2816.,4500.); |
b.DrawBox(2560.,-500.,2816.,4500.); |
499 |
b.DrawBox(512.,-500.,768.,4500.); |
b.DrawBox(512.,-500.,768.,4500.); |
500 |
b.DrawBox(1024.,-500.,1792.,4500.); |
b.DrawBox(1024.,-500.,1792.,4500.); |
501 |
} |
} |
502 |
else if(nn==11){ |
else if(nn==11){ |
503 |
b.DrawBox(768.,-500.,1024.,4500.); |
b.DrawBox(768.,-500.,1024.,4500.); |
504 |
} |
} |
505 |
c1->Update(); |
c1[e]->Update(); |
|
|
|
|
}//end loop on views |
|
506 |
|
|
507 |
c1->Print(figsav.str().c_str()); |
}//end loop on views |
508 |
|
|
509 |
|
c1[e]->Print(figsav.str().c_str()); |
510 |
|
} |
511 |
return; |
return; |
512 |
} |
} |