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