| 1 |
/** |
/** |
| 2 |
* FTrkQLook_BASIC.cpp |
* FTrkQLook_BASIC.cxx |
| 3 |
* |
* |
| 4 |
* autor: D.Fedele |
* autor: D.Fedele |
| 5 |
* version 2.0 |
* version v1r12 |
| 6 |
* Parameters: |
* Parameters: |
| 7 |
* file - the data file to analyze |
* file - the data file to analyze |
| 8 |
* fromevent - first event to analyze |
* fromevent - first event to analyze |
| 17 |
#include <TCanvas.h> |
#include <TCanvas.h> |
| 18 |
#include <TGraph.h> |
#include <TGraph.h> |
| 19 |
#include <TStyle.h> |
#include <TStyle.h> |
| 20 |
|
#include <TFile.h> |
| 21 |
#include <TTree.h> |
#include <TTree.h> |
| 22 |
|
#include <TArrow.h> |
| 23 |
// |
// |
| 24 |
#include <physics/tracker/TrackerEvent.h> |
#include <physics/tracker/TrackerEvent.h> |
| 25 |
#include <PscuHeader.h> |
#include <PscuHeader.h> |
| 26 |
#include <EventHeader.h> |
#include <EventHeader.h> |
| 27 |
#include <RunHeaderEvent.h> |
#include <RunHeaderEvent.h> |
| 28 |
|
#include <EventCounter.h> |
| 29 |
|
#include <PacketType.h> |
| 30 |
// |
// |
| 31 |
|
#define MAXSTORAGE 50000 |
|
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); |
|
|
}; |
|
|
}; |
|
|
|
|
| 32 |
|
|
| 33 |
void FTrkQLook_BASIC(TString file,Int_t fromevent,Int_t toevent, TString outdir,TString outfile) |
void FTrkQLook_BASIC(TString file,Int_t fromevent,Int_t toevent, TString outdir,TString outfile) |
| 34 |
{ |
{ |
| 35 |
// |
// |
| 36 |
// obtain information about the data file and select the output dir |
// obtain information about the data file and select the output dir |
| 37 |
const string filepath=file.Data(); |
Int_t dwpos = file.Last('/'); |
| 38 |
Int_t dwpos = filepath.rfind("DW_"); |
Int_t dwpos1 = file.Last('.'); |
|
Int_t dwpos1 = filepath.find(".root"); |
|
|
TString fpath=(filepath.c_str()); |
|
| 39 |
TString base,ffile ; |
TString base,ffile ; |
| 40 |
stringcopy(ffile,fpath,dwpos,dwpos1); |
ffile=file(dwpos+1,dwpos1-(dwpos+1)); |
| 41 |
stringcopy(base,fpath,0,dwpos); |
if(dwpos>0) base=file(0,dwpos); |
| 42 |
|
|
| 43 |
TString out; |
TString out; |
| 44 |
if(outdir.Length()==0){ |
if(outdir.Length()==0){ |
| 46 |
}else{ |
}else{ |
| 47 |
out = outdir; |
out = outdir; |
| 48 |
} |
} |
| 49 |
|
if(out.Last('/')+1<out.Length()) out+="/"; |
| 50 |
|
|
| 51 |
// |
// |
| 52 |
// inizialise the variables and open the file |
// inizialise the variables and open the file |
| 53 |
pamela::tracker::TrackerEvent *te=0; |
pamela::tracker::TrackerEvent *te=0; |
| 54 |
pamela::EventHeader *eh=0,*eH=0; |
pamela::EventHeader *eh=0,*eH=0,*ceh=0; |
| 55 |
pamela::RunHeaderEvent *reh=0; |
pamela::RunHeaderEvent *reh=0; |
| 56 |
pamela::PscuHeader *ph=0,*pH=0; |
pamela::PscuHeader *ph=0,*pH=0; |
| 57 |
|
pamela::EventCounter *cod=0; |
| 58 |
|
|
| 59 |
|
pamela::PacketType *pctp=0; |
| 60 |
|
|
| 61 |
TFile *datafile = new TFile(file); |
TFile *datafile = new TFile(file); |
| 62 |
TTree *otr = (TTree*)datafile->Get("RunHeader"); |
TTree *otr = (TTree*)datafile->Get("RunHeader"); |
| 65 |
TTree *tr = (TTree*)datafile->Get("Physics"); |
TTree *tr = (TTree*)datafile->Get("Physics"); |
| 66 |
tr->SetBranchAddress("Tracker",&te); |
tr->SetBranchAddress("Tracker",&te); |
| 67 |
tr->SetBranchAddress("Header",&eh); |
tr->SetBranchAddress("Header",&eh); |
| 68 |
|
TTree *ctr = (TTree*)datafile->Get("CalibTrk1"); |
| 69 |
|
ctr->SetBranchAddress("Header",&ceh); |
| 70 |
|
|
| 71 |
|
Long64_t neventC = ctr->GetEntries(); |
| 72 |
Long64_t nevent = tr->GetEntries(); |
Long64_t nevent = tr->GetEntries(); |
| 73 |
Long64_t neventH = otr->GetEntries(); |
Long64_t neventH = otr->GetEntries(); |
| 74 |
Int_t minevent=0; |
Int_t minevent=0; |
| 75 |
Int_t maxevent=0; |
Int_t maxevent=0; |
| 76 |
|
|
| 77 |
printf("Number of total events: %lld\nNumber of total header events: %lld\n",nevent,neventH); |
printf("Number of total events: %lld\nNumber of total header events: %lld\n",nevent,neventH); |
| 78 |
|
printf("Number of calibration events: %lld\n",neventC); |
| 79 |
|
|
| 80 |
if (nevent<=0){ |
if (nevent<=0){ |
| 81 |
datafile->Close(); |
datafile->Close(); |
| 103 |
} else if (toevent > nevent) { |
} else if (toevent > nevent) { |
| 104 |
maxevent = nevent; |
maxevent = nevent; |
| 105 |
} else { |
} else { |
| 106 |
maxevent = toevent+1; |
maxevent = nevent; |
| 107 |
} |
} |
| 108 |
nevent=maxevent-minevent ; |
nevent=maxevent-minevent ; |
| 109 |
} |
} |
| 111 |
// |
// |
| 112 |
// other variables definitions |
// other variables definitions |
| 113 |
stringstream oss,fromfile,isfile; |
stringstream oss,fromfile,isfile; |
| 114 |
const Int_t size=nevent; |
// |
| 115 |
Int_t dsp=0,count=0,trk_cal_us[50]; |
// information about the RunHeader |
| 116 |
Double_t perc; |
ULong_t HOBT[neventH]; |
| 117 |
Double_t yd[size*12], x[size+1]; |
Int_t trk_cal_us[neventH]; |
| 118 |
Double_t yyd[size+1],yyb[size], xb[size]; |
for (Int_t vi=0; vi<neventH;vi++){ |
| 119 |
ULong64_t HOBT[50]; |
HOBT[vi]=0; |
| 120 |
TGraph *dataletime,*dataletime1; |
trk_cal_us[vi]=0; |
|
|
|
|
for (Int_t i=0; i<50;i++){ |
|
|
HOBT[i]=0; |
|
|
trk_cal_us[i]=0; |
|
| 121 |
} |
} |
| 122 |
|
|
|
//*************************************************************************************** |
|
|
// LOOP on each event |
|
|
//*************************************************************************************** |
|
|
|
|
| 123 |
// |
// |
| 124 |
// information about trk_calib_used |
// information about RunHeader |
| 125 |
|
Int_t countnboot=1; |
| 126 |
for (Int_t ev=0; ev<neventH; ev++){ |
for (Int_t ev=0; ev<neventH; ev++){ |
| 127 |
otr->GetEntry(ev); |
otr->GetEntry(ev); |
| 128 |
pH = eH->GetPscuHeader(); |
pH = eH->GetPscuHeader(); |
| 129 |
HOBT[ev]= pH->GetOrbitalTime(); |
HOBT[ev]= pH->GetOrbitalTime(); |
| 130 |
trk_cal_us[ev]=reh->TRK_CALIB_USED; |
trk_cal_us[ev]=reh->TRK_CALIB_USED; |
| 131 |
|
if((HOBT[ev]<HOBT[ev-1]) && ev>0) |
| 132 |
|
countnboot+=1; |
| 133 |
} |
} |
| 134 |
|
countnboot+=(Int_t)(2*nevent/MAXSTORAGE); |
| 135 |
|
// printf("\ncountnboot=%d\n",countnboot); |
| 136 |
|
|
| 137 |
// |
// |
| 138 |
// information about datalength |
// information about calibration OBT |
| 139 |
x[0]=(Double_t)HOBT[0]; |
ULong_t COBT[neventC]; |
| 140 |
for (Int_t ev=minevent; ev<maxevent; ev++){ |
for (Int_t vi=0; vi<neventC;vi++){ |
| 141 |
tr->GetEntry(ev); |
COBT[vi]=0; |
| 142 |
ph = eh->GetPscuHeader(); |
} |
| 143 |
|
for (Int_t ev=0; ev<neventC; ev++){ |
| 144 |
x[(ev-minevent)+1]= ph->GetOrbitalTime(); |
ctr->GetEntry(ev); |
| 145 |
dsp=0; |
pH = ceh->GetPscuHeader(); |
| 146 |
for(Int_t i=0; i<12; i++){ |
COBT[ev]= pH->GetOrbitalTime(); |
| 147 |
dsp=te->DSPnumber[i]-1; |
} |
|
yd[(ev-minevent)*12+dsp]= te->DATAlength[i]; |
|
|
} |
|
|
}; |
|
|
datafile->Close(); |
|
|
|
|
|
|
|
|
//**************************************************************************************** |
|
|
//Output figure |
|
|
//**************************************************************************************** |
|
|
|
|
|
TCanvas *DataTimeCanv=new TCanvas("Tracker_Detector_Report_","",900,1200); |
|
|
DataTimeCanv->SetFillColor(10); |
|
|
DataTimeCanv->Range(0,0,100,100); |
|
|
fromfile<<"FTrkQLook_BASIC File: "<<ffile; |
|
|
isfile<<"DATALENGTH vs. ORBITALTIME "; |
|
|
|
|
|
TLatex *t=new TLatex(); |
|
|
t->SetTextFont(32); |
|
|
t->SetTextColor(1); |
|
|
t->SetTextAlign(12); |
|
|
t->SetTextSize(0.02); |
|
|
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
|
|
TLatex *t1=new TLatex(); |
|
|
t1->SetTextFont(32); |
|
|
t1->SetTextColor(1); |
|
|
t1->SetTextAlign(12); |
|
|
t1->SetTextSize(0.02); |
|
|
t1->DrawLatex(70.,98.7,isfile.str().c_str()); |
|
|
fromfile.str(""); |
|
|
isfile.str(""); |
|
|
|
|
| 148 |
|
|
| 149 |
//************************************************************************************* |
// |
| 150 |
//book pads and histos |
// Style options |
|
//*************************************************************************************** |
|
| 151 |
gStyle->SetLabelSize(0.06,"x"); |
gStyle->SetLabelSize(0.06,"x"); |
| 152 |
gStyle->SetLabelSize(0.06,"y"); |
gStyle->SetLabelSize(0.06,"y"); |
| 153 |
gStyle->SetStatFontSize(0.075); |
gStyle->SetStatFontSize(0.075); |
| 154 |
gStyle->SetOptStat(1110); |
gStyle->SetOptStat(10); |
| 155 |
gStyle->SetFillColor(10); |
gStyle->SetFillColor(10); |
| 156 |
gStyle->SetTitleFontSize(0.1); |
gStyle->SetTitleFontSize(0.1); |
| 157 |
|
gStyle->SetTitleFillColor(10); |
| 158 |
gStyle->SetTitleOffset(0.8,"y"); |
gStyle->SetTitleOffset(0.8,"y"); |
| 159 |
gStyle->SetTitleOffset(0.9,"x"); |
gStyle->SetTitleOffset(0.9,"x"); |
| 160 |
gStyle->SetTitleSize(0.06,"y"); |
gStyle->SetTitleSize(0.06,"y"); |
| 161 |
gStyle->SetTitleSize(0.055,"x"); |
gStyle->SetTitleSize(0.055,"x"); |
| 162 |
|
|
| 163 |
TPad *pad[12]; //pad for histos |
//*************************************************************************************** |
| 164 |
Double_t posy = 0.95; // up y-coord - top pads |
// LOOP on each event |
| 165 |
Double_t hpad = 0; // pad height |
//*************************************************************************************** |
|
Double_t posx1=0; // left x-coord - pad column |
|
|
Double_t posx0=0; // x-coord - column division |
|
|
Double_t wrel = 0; // relative x size of first sub-column |
|
|
Double_t marg = 0.004; // margin among pads |
|
|
|
|
|
hpad = (posy-marg*11)/6; |
|
|
wrel = (1-marg*4)/2; |
|
|
stringstream title; |
|
|
stringstream hid; |
|
|
|
|
|
for(Int_t n = 0; n<12; n++) { |
|
|
if ( (n+1)%2==1 ) { |
|
|
if(n>1) posy = posy-(marg*2+hpad); |
|
|
posx1 = marg; |
|
|
posx0 = posx1 + wrel; |
|
|
} |
|
|
else { |
|
|
posx1 = posx0 + 2*marg; |
|
|
posx0 = posx1 + wrel; |
|
|
} |
|
| 166 |
|
|
| 167 |
/* -----------> pad for histograms */ |
if (fromevent!=0) |
| 168 |
pad[n] = new TPad("pad"," ",posx1,posy-hpad,posx0,posy,18,0,0); |
printf("\n Scan of events from %i to %i ... \n",minevent,maxevent-1); |
| 169 |
}; |
else |
| 170 |
|
printf("\n Scan of events from %i to %i ... \n",minevent+1,maxevent); |
| 171 |
|
|
| 172 |
TLine li; |
|
| 173 |
li.SetLineColor(1); |
Int_t minev=minevent,maxev=maxevent,hin=0,hfin=0,cin=0,cfin=0; |
| 174 |
li.SetLineStyle(1); |
TPad *pad[12][countnboot]; |
| 175 |
li.SetLineWidth(1); |
TGraph *dataletime[12][countnboot],*dataletime1[12][countnboot]; |
| 176 |
//********************************************************************************** |
TCanvas *DataTimeCanv[countnboot]; |
| 177 |
// Fill Graphs and Histos |
for(Int_t ii=0; ii<countnboot;ii++){ |
| 178 |
//********************************************************************************** |
fromfile<<"FTrkQLook_BASIC File: "<<ffile; |
| 179 |
stringstream calus; |
isfile<<"DATALENGTH vs. OBT pag"<<ii+1; |
| 180 |
TLatex *t2=new TLatex(); |
DataTimeCanv[ii]=new TCanvas(isfile.str().c_str(),isfile.str().c_str(),900,1200); |
| 181 |
t2->SetTextFont(32); |
DataTimeCanv[ii]->SetFillColor(10); |
| 182 |
t2->SetTextColor(1); |
DataTimeCanv[ii]->Range(0,0,100,100); |
| 183 |
t2->SetTextAlign(13); |
|
| 184 |
t2->SetTextSize(0.08); |
TLatex *t=new TLatex(); |
| 185 |
|
t->SetTextFont(32); |
| 186 |
for (Int_t i=0; i<12 ; i++){ |
t->SetTextColor(1); |
| 187 |
perc=0; |
t->SetTextAlign(12); |
| 188 |
count=0; |
t->SetTextSize(0.02); |
| 189 |
yyd[0]=-10000.; |
t->DrawLatex(2.,98.7,fromfile.str().c_str()); |
| 190 |
for (Int_t ev=minevent; ev<maxevent; ev++){ |
TLatex *t1=new TLatex(); |
| 191 |
yyd[(ev-minevent)+1]=yd[12*(ev-minevent)+i]; |
t1->SetTextFont(32); |
| 192 |
if(i==6){ |
t1->SetTextColor(1); |
| 193 |
if(yyd[(ev-minevent)+1]>1500){ |
t1->SetTextAlign(12); |
| 194 |
if(yyd[(ev-minevent)+1]<3075){ |
t1->SetTextSize(0.02); |
| 195 |
yyb[count]= yyd[(ev-minevent)+1]; |
t1->DrawLatex(70.,98.7,isfile.str().c_str()); |
| 196 |
xb[count]= x[(ev-minevent)+1]; |
fromfile.str(""); |
| 197 |
count++; |
isfile.str(""); |
| 198 |
} |
|
| 199 |
} |
fromfile<<"D = Default Calibration"; |
| 200 |
|
isfile<<"O = OnLine Calibration"; |
| 201 |
|
t->SetTextColor(6); |
| 202 |
|
t->SetTextSize(0.018); |
| 203 |
|
t->DrawLatex(70.,97.,fromfile.str().c_str()); |
| 204 |
|
t->SetTextColor(3); |
| 205 |
|
t->DrawLatex(70.,96.,isfile.str().c_str()); |
| 206 |
|
fromfile.str(""); |
| 207 |
|
isfile.str(""); |
| 208 |
|
|
| 209 |
|
fromfile<<"The green arrow (if present) points out the time of the online calibration"; |
| 210 |
|
t->DrawLatex(7.,96.,fromfile.str().c_str()); |
| 211 |
|
fromfile.str(""); |
| 212 |
|
|
| 213 |
|
//************************************************************************************* |
| 214 |
|
//book pads and histos |
| 215 |
|
//*************************************************************************************** |
| 216 |
|
|
| 217 |
|
|
| 218 |
|
Float_t posy = 0.95; // up y-coord - top pads |
| 219 |
|
Float_t hpad = 0; // pad height |
| 220 |
|
Float_t posx1=0; // left x-coord - pad column |
| 221 |
|
Float_t posx0=0; // x-coord - column division |
| 222 |
|
Float_t wrel = 0; // relative x size of first sub-column |
| 223 |
|
Float_t marg = 0.004; // margin among pads |
| 224 |
|
|
| 225 |
|
hpad = (posy-marg*11)/6; |
| 226 |
|
wrel = (1-marg*4)/2; |
| 227 |
|
stringstream title; |
| 228 |
|
stringstream hid; |
| 229 |
|
|
| 230 |
|
for(Int_t n = 0; n<12; n++) { |
| 231 |
|
if ( (n+1)%2==1 ) { |
| 232 |
|
if(n>1) posy = posy-(marg*2+hpad); |
| 233 |
|
posx1 = marg; |
| 234 |
|
posx0 = posx1 + wrel; |
| 235 |
|
} |
| 236 |
|
else { |
| 237 |
|
posx1 = posx0 + 2*marg; |
| 238 |
|
posx0 = posx1 + wrel; |
| 239 |
|
} |
| 240 |
|
|
| 241 |
|
/* -----------> pad for histograms */ |
| 242 |
|
oss<<"pad"<<n*100+ii; |
| 243 |
|
pad[n][ii]=new TPad(oss.str().c_str()," ",posx1,posy-hpad,posx0,posy,18,0,0); |
| 244 |
|
oss.str(""); |
| 245 |
|
}; |
| 246 |
|
|
| 247 |
|
TLine li; |
| 248 |
|
li.SetLineColor(1); |
| 249 |
|
li.SetLineStyle(1); |
| 250 |
|
li.SetLineWidth(1); |
| 251 |
|
|
| 252 |
|
TArrow ar; |
| 253 |
|
ar.SetLineColor(3); |
| 254 |
|
stringstream calus; |
| 255 |
|
|
| 256 |
|
TLatex *t2=new TLatex(); |
| 257 |
|
t2->SetTextFont(32); |
| 258 |
|
t2->SetTextColor(1); |
| 259 |
|
t2->SetTextAlign(13); |
| 260 |
|
t2->SetTextSize(0.08); |
| 261 |
|
|
| 262 |
|
Int_t i=0; |
| 263 |
|
ULong_t x[MAXSTORAGE], xb[MAXSTORAGE]; |
| 264 |
|
Float_t yyd[MAXSTORAGE][12],yyb[MAXSTORAGE][12]; |
| 265 |
|
Int_t countbad[12]; |
| 266 |
|
Float_t perc=0; |
| 267 |
|
Double_t xMIN=0.,xMAX=0.; |
| 268 |
|
for (Int_t n=0; n<12 ; n++) |
| 269 |
|
countbad[n]=0; |
| 270 |
|
|
| 271 |
|
// |
| 272 |
|
// obtain values of the datalenght |
| 273 |
|
for (Int_t ev=minev; ev<maxevent; ev++){ |
| 274 |
|
tr->GetEntry(ev); |
| 275 |
|
ph = eh->GetPscuHeader(); |
| 276 |
|
cod = eh->GetCounter(); |
| 277 |
|
|
| 278 |
|
if(ev==minev){ |
| 279 |
|
if(cod->Get(pctp->CalibTrk1)>0) cin=cod->Get(pctp->CalibTrk1)-1; |
| 280 |
|
else cin=cod->Get(pctp->CalibTrk1); |
| 281 |
|
if(cin==cfin-1) cin+=1; |
| 282 |
|
|
| 283 |
|
if(cod->Get(pctp->RunHeader)>0) hin=cod->Get(pctp->RunHeader)-1; |
| 284 |
|
else hin=cod->Get(pctp->RunHeader); |
| 285 |
|
if(hin==hfin-1) hin+=1; |
| 286 |
|
} |
| 287 |
|
|
| 288 |
|
if(ev==maxevent-1) maxev=maxevent-1; |
| 289 |
|
|
| 290 |
|
if(((ULong_t)ph->GetOrbitalTime()<x[ev-minev-1] && ev-minev!=0) || ev-minev==MAXSTORAGE){ |
| 291 |
|
maxev=ev; |
| 292 |
|
break; |
| 293 |
} |
} |
| 294 |
else{ |
else{ |
| 295 |
if(yyd[(ev-minevent)+1]>750){ |
cfin=cod->Get(pctp->CalibTrk1); |
| 296 |
if(yyd[(ev-minevent)+1]<3075){ |
hfin=cod->Get(pctp->RunHeader); |
| 297 |
yyb[count]= yyd[(ev-minevent)+1]; |
x[(ev-minev)]= ph->GetOrbitalTime(); |
| 298 |
xb[count]= x[(ev-minevent)+1]; |
i=0; |
| 299 |
count++; |
|
| 300 |
|
for (Int_t n=0; n<12 ; n++){ |
| 301 |
|
i=te->DSPnumber[n]-1; |
| 302 |
|
if(i>=0){ |
| 303 |
|
if(i<12){ |
| 304 |
|
yyb[countbad[i]][i]=0; |
| 305 |
|
xb[countbad[i]]= 0; |
| 306 |
|
|
| 307 |
|
yyd[(ev-minev)][i]=te->DATAlength[n]; |
| 308 |
|
if(i==6){ |
| 309 |
|
if(yyd[(ev-minev)][i]>1500){ |
| 310 |
|
if(yyd[(ev-minev)][i]<3075){ |
| 311 |
|
yyb[countbad[i]][i]= yyd[(ev-minev)][i]; |
| 312 |
|
xb[countbad[i]]= x[(ev-minev)]; |
| 313 |
|
countbad[i]+=1; |
| 314 |
|
} |
| 315 |
|
} |
| 316 |
|
} |
| 317 |
|
else{ |
| 318 |
|
if(yyd[(ev-minev)][i]>750){ |
| 319 |
|
if(yyd[(ev-minev)][i]<3075){ |
| 320 |
|
yyb[countbad[i]][i]= yyd[(ev-minev)][i]; |
| 321 |
|
xb[countbad[i]]= x[(ev-minev)]; |
| 322 |
|
countbad[i]+=1; |
| 323 |
|
} |
| 324 |
|
} |
| 325 |
|
} |
| 326 |
|
} |
| 327 |
} |
} |
| 328 |
} |
} |
| 329 |
} |
} |
| 330 |
} |
} |
| 331 |
|
|
| 332 |
if((maxevent-minevent)>100) perc=(count*100)/(maxevent-minevent); |
// |
| 333 |
else perc=(count*10)/(maxevent-minevent); |
// define limit for the Xaxis of the graphs |
| 334 |
|
|
| 335 |
|
xMAX=x[maxev-minev-1]+(x[maxev-minev-1]-x[0])/10; |
| 336 |
|
if(xMAX>1000000) xMIN=x[0]-(x[maxev-minev-1]-x[0])/10; |
| 337 |
|
if(xMAX<1000000 || xMIN<0) xMIN=0.; |
| 338 |
|
if(xMIN==xMAX) xMIN=x[0] * x[0]/xMAX; |
| 339 |
|
|
| 340 |
|
|
| 341 |
|
// |
| 342 |
|
// Draw Histos |
| 343 |
|
for (Int_t n=0; n<12 ; n++){ |
| 344 |
|
|
| 345 |
|
Double_t yd[maxev-minev],ybd[maxev-minev]; |
| 346 |
|
Double_t xd[maxev-minev],xbd[maxev-minev]; |
| 347 |
|
|
| 348 |
|
for(Int_t v=0;v<maxev-minev;v++){ |
| 349 |
|
yd[v]=(Double_t)yyd[v][n]; |
| 350 |
|
ybd[v]=(Double_t)yyb[v][n]; |
| 351 |
|
xd[v]=(Double_t)x[v]; |
| 352 |
|
xbd[v]=(Double_t)xb[v]; |
| 353 |
|
} |
| 354 |
|
|
| 355 |
|
if(xMAX<1000000){ |
| 356 |
|
xd[maxev-minev-1]=0; |
| 357 |
|
yd[maxev-minev-1]=0.; |
| 358 |
|
} |
| 359 |
|
|
| 360 |
|
if((maxev-minev)>1000){ |
| 361 |
|
perc=(countbad[n]*100)/(maxev-minev); |
| 362 |
|
if(perc>10) pad[n][ii]->SetFillColor(2); |
| 363 |
|
else pad[n][ii]->SetFillColor(10); |
| 364 |
|
|
| 365 |
|
} |
| 366 |
|
else{ |
| 367 |
|
if(countbad[n]>=100) pad[n][ii]->SetFillColor(2); |
| 368 |
|
else pad[n][ii]->SetFillColor(10); |
| 369 |
|
} |
| 370 |
|
|
| 371 |
|
oss<<"DSP "<<n+1; |
| 372 |
|
DataTimeCanv[ii]->cd(); |
| 373 |
|
pad[n][ii]->SetFrameFillColor(10); |
| 374 |
|
pad[n][ii]->Draw(); |
| 375 |
|
pad[n][ii]->cd(); |
| 376 |
|
dataletime[n][ii]= new TGraph((maxev-minev),xd,yd); |
| 377 |
|
if(maxev-minev==1) dataletime[n][ii]->GetXaxis()->SetNdivisions(-501); |
| 378 |
|
dataletime[n][ii]->SetTitle(oss.str().c_str()); |
| 379 |
|
dataletime[n][ii]->GetXaxis()->SetTitle("OBT (ms)"); |
| 380 |
|
dataletime[n][ii]->GetXaxis()->CenterTitle(); |
| 381 |
|
dataletime[n][ii]->GetXaxis()->SetRangeUser(xMIN,xMAX); |
| 382 |
|
dataletime[n][ii]->GetYaxis()->SetTitle("datalength (Word 13 bit)"); |
| 383 |
|
dataletime[n][ii]->GetYaxis()->CenterTitle(); |
| 384 |
|
if(i==6) dataletime[n][ii]->GetYaxis()->SetRangeUser(0,4500); |
| 385 |
|
else dataletime[n][ii]->GetYaxis()->SetRangeUser(0,4000); |
| 386 |
|
dataletime[n][ii]->SetMarkerStyle(21); |
| 387 |
|
if((maxev-minev)<50) dataletime[n][ii]->SetMarkerSize(0.5); |
| 388 |
|
else dataletime[n][ii]->SetMarkerSize(0.1); |
| 389 |
|
dataletime[n][ii]->SetMarkerColor(4); |
| 390 |
|
dataletime[n][ii]->Draw("ap"); |
| 391 |
|
|
| 392 |
|
|
| 393 |
|
if((maxev-minev)>1000 && perc>10){ |
| 394 |
|
dataletime1[n][ii]= new TGraph(countbad[n],xbd,ybd); |
| 395 |
|
dataletime1[n][ii]->SetMarkerStyle(21); |
| 396 |
|
dataletime1[n][ii]->SetMarkerSize(0.1); |
| 397 |
|
dataletime1[n][ii]->SetMarkerColor(2); |
| 398 |
|
dataletime1[n][ii]->Draw("psame"); |
| 399 |
|
} |
| 400 |
|
else if((maxev-minev)<1000 && countbad[n]>=100){ |
| 401 |
|
dataletime1[n][ii]= new TGraph(countbad[n],xbd,ybd); |
| 402 |
|
dataletime1[n][ii]->SetMarkerStyle(21); |
| 403 |
|
if((maxev-minev)<50) dataletime1[n][ii]->SetMarkerSize(0.5); |
| 404 |
|
else dataletime1[n][ii]->SetMarkerSize(0.1); |
| 405 |
|
dataletime1[n][ii]->SetMarkerColor(2); |
| 406 |
|
dataletime1[n][ii]->Draw("psame"); |
| 407 |
|
} |
| 408 |
|
li.SetLineColor(1); |
| 409 |
|
li.SetLineStyle(1); |
| 410 |
|
li.SetLineWidth(1); |
| 411 |
|
if(i!=6) li.DrawLine(xMIN,750,xMAX,750); |
| 412 |
|
else li.DrawLine(xMIN,1500,xMAX,1500); |
| 413 |
|
li.DrawLine(xMIN,3075,xMAX,3075); |
| 414 |
|
|
|
Double_t min,max; |
|
|
if((maxevent-minevent)<100){ |
|
|
min=x[0]; |
|
|
max=x[size]*1.0001; |
|
|
} |
|
|
else{ |
|
|
min=x[0]; |
|
|
max=x[size-1]*1.0005; |
|
|
} |
|
|
oss<<"DSP "<<i+1; |
|
|
DataTimeCanv->cd(); |
|
|
if(perc>1) pad[i]->SetFillColor(2); |
|
|
else pad[i]->SetFillColor(10); |
|
|
pad[i]->SetFrameFillColor(10); |
|
|
pad[i]->Draw(); |
|
|
pad[i]->cd(); |
|
|
dataletime= new TGraph((maxevent-minevent)+1,x,yyd); |
|
|
dataletime->SetTitle(oss.str().c_str()); |
|
|
dataletime->GetXaxis()->SetTitle("OBT (ms)"); |
|
|
dataletime->GetXaxis()->CenterTitle(); |
|
|
dataletime->GetXaxis()->SetRangeUser(min,max); |
|
|
dataletime->GetYaxis()->SetTitle("datalength (Word 13 bit)"); |
|
|
dataletime->GetYaxis()->CenterTitle(); |
|
|
dataletime->GetYaxis()->SetRangeUser(0,3500); |
|
|
dataletime->SetMarkerStyle(21); |
|
|
if((maxevent-minevent)<50) dataletime->SetMarkerSize(0.5); |
|
|
else dataletime->SetMarkerSize(0.3); |
|
|
dataletime->SetMarkerColor(1); |
|
|
dataletime->Draw("ap"); |
|
|
if(perc>1){ |
|
|
dataletime1= new TGraph(count,xb,yyb); |
|
|
dataletime1->SetMarkerStyle(21); |
|
|
if((maxevent-minevent)<50) dataletime1->SetMarkerSize(0.5); |
|
|
else dataletime1->SetMarkerSize(0.3); |
|
|
dataletime1->SetMarkerColor(2); |
|
|
dataletime1->Draw("psame"); |
|
|
} |
|
|
li.SetLineColor(1); |
|
|
li.SetLineStyle(1); |
|
|
li.SetLineWidth(1); |
|
|
if(i!=6) li.DrawLine(min,750,max,750); |
|
|
else li.DrawLine(min,1500,max,1500); |
|
|
li.DrawLine(min,3075,max,3075); |
|
|
for(Int_t j=0;j<neventH;j++){ |
|
| 415 |
li.SetLineColor(12); |
li.SetLineColor(12); |
| 416 |
li.SetLineStyle(4); |
li.SetLineStyle(4); |
| 417 |
li.SetLineWidth(1); |
li.SetLineWidth(1); |
| 418 |
li.DrawLine(HOBT[j],0.,HOBT[j],3500.); |
for(Int_t j=hin;j<hfin;j++){ |
| 419 |
if(trk_cal_us[j]==104){ |
if(i==6) li.DrawLine(HOBT[j],0.,HOBT[j],4500.); |
| 420 |
calus<<"D"; |
else li.DrawLine(HOBT[j],0.,HOBT[j],4000.); |
| 421 |
t2->SetTextColor(6); |
if(trk_cal_us[j]==104){ |
| 422 |
t2->DrawLatex(HOBT[j],3350.,calus.str().c_str()); |
calus<<"D"; |
| 423 |
calus.str(""); |
t2->SetTextColor(6); |
| 424 |
} |
if(i==6) t2->DrawLatex(HOBT[j],4350.,calus.str().c_str()); |
| 425 |
else{ |
else t2->DrawLatex(HOBT[j],3850.,calus.str().c_str()); |
| 426 |
calus<<trk_cal_us[j]; |
calus.str(""); |
| 427 |
t2->SetTextColor(3); |
} |
| 428 |
t2->DrawLatex(HOBT[j],3350.,calus.str().c_str()); |
else{ |
| 429 |
calus.str(""); |
calus<<"O"; |
| 430 |
|
t2->SetTextColor(3); |
| 431 |
|
if(i==6) t2->DrawLatex(HOBT[j],4350.,calus.str().c_str()); |
| 432 |
|
else t2->DrawLatex(HOBT[j],3850.,calus.str().c_str()); |
| 433 |
|
calus.str(""); |
| 434 |
|
} |
| 435 |
|
} |
| 436 |
|
for(Int_t j=cin;j<cfin;j++){ |
| 437 |
|
if(i==6) ar.DrawArrow(COBT[j],1700.,COBT[j],2700.,0.01,"<"); |
| 438 |
|
else ar.DrawArrow(COBT[j],1000.,COBT[j],2000.,0.01,"<"); |
| 439 |
} |
} |
| 440 |
|
|
| 441 |
|
oss.str(""); |
| 442 |
|
DataTimeCanv[ii]->Update(); |
| 443 |
} |
} |
| 444 |
oss.str(""); |
|
| 445 |
}; |
minev=maxev; |
| 446 |
|
if(maxev==maxevent-1) { |
| 447 |
DataTimeCanv->Update(); |
countnboot=ii+1; |
| 448 |
|
break; |
| 449 |
|
} |
| 450 |
|
} |
| 451 |
printf("... end of packets. \n"); |
printf("... end of packets. \n"); |
| 452 |
|
|
| 453 |
//************************************************************************* |
//************************************************************************* |
| 454 |
// Save output Files |
// Save output Files |
| 455 |
//************************************************************************* |
//************************************************************************* |
| 456 |
stringstream out1; |
stringstream nom1,nom2,nom3; |
| 457 |
|
|
| 458 |
|
for(Int_t fl=0;fl<countnboot;fl++){ |
| 459 |
|
if(countnboot==1){ |
| 460 |
|
nom1<<ffile<<"_FTrkQLook_BASIC."<<outfile.Data(); |
| 461 |
|
DataTimeCanv[fl]->Print(out+nom1.str().c_str()); |
| 462 |
|
nom1.str(""); |
| 463 |
|
} |
| 464 |
|
|
| 465 |
|
if(countnboot>=2){ |
| 466 |
|
if(!strcmp(outfile.Data(),"ps") || !strcmp(outfile.Data(),"pdf")){ |
| 467 |
|
nom1.str(""); |
| 468 |
|
nom2.str(""); |
| 469 |
|
nom3.str(""); |
| 470 |
|
nom1<<ffile<<"_FTrkQLook_BASIC.ps("; |
| 471 |
|
nom2<<ffile<<"_FTrkQLook_BASIC.ps"; |
| 472 |
|
nom3<<ffile<<"_FTrkQLook_BASIC.ps)"; |
| 473 |
|
if(fl==0) DataTimeCanv[fl]->Print(out+nom1.str().c_str(),"portrait"); |
| 474 |
|
else if(fl==countnboot-1) DataTimeCanv[fl]->Print(out+nom3.str().c_str(),"portrait"); |
| 475 |
|
else DataTimeCanv[fl]->Print(out+nom2.str().c_str(),"portrait"); |
| 476 |
|
|
| 477 |
|
} |
| 478 |
|
else{ |
| 479 |
|
nom1.str(""); |
| 480 |
|
nom1<<ffile<<"_FTrkQLook_BASIC-pag"<<fl+1<<"."<<outfile.Data(); |
| 481 |
|
DataTimeCanv[fl]->Print(out+nom1.str().c_str()); |
| 482 |
|
} |
| 483 |
|
} |
| 484 |
|
} |
| 485 |
|
|
| 486 |
out1<<ffile<<"_FTrkQLook_BASIC."<<outfile.Data(); |
// |
| 487 |
DataTimeCanv->Print(out+out1.str().c_str()); |
// Convert ps to pdf if required |
| 488 |
out1.str(""); |
if(!strcmp(outfile.Data(),"pdf") && countnboot>=2){ |
| 489 |
|
stringstream com; |
| 490 |
|
com<<"ps2pdf13 "<<out<<ffile<<"_FTrkQLook_BASIC.ps "<<out<<ffile<<"_FTrkQLook_BASIC.pdf"; |
| 491 |
|
system(com.str().c_str()); |
| 492 |
|
printf("\n---> ps file converted in pdf format!\n"); |
| 493 |
|
com.str(""); |
| 494 |
|
com<<"rm -f "<<out<<ffile<<"_FTrkQLook_BASIC.ps"; |
| 495 |
|
system(com.str().c_str()); |
| 496 |
|
printf("---> ps file removed!\n\n"); |
| 497 |
|
com.str(""); |
| 498 |
|
} |
| 499 |
|
|
| 500 |
|
datafile->Close(); |
| 501 |
gROOT->Reset(); |
gROOT->Reset(); |
| 502 |
return; |
return; |
| 503 |
} |
} |