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