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