| 1 |
#include "TrkFunctions.cpp" |
| 2 |
#include <utils/yodaUtility.h> |
| 3 |
#include <TPaveText.h> |
| 4 |
#include <TLatex.h> |
| 5 |
#include <TCanvas.h> |
| 6 |
#include <TObjString.h> |
| 7 |
#include <TGraph.h> |
| 8 |
#include <PscuHeader.h> |
| 9 |
#include <EventHeader.h> |
| 10 |
#include <iostream> |
| 11 |
#include <fstream> |
| 12 |
#include <TStyle.h> |
| 13 |
#include <TString.h> |
| 14 |
#include <CalibTrk1Event.h> |
| 15 |
#include <CalibTrk2Event.h> |
| 16 |
|
| 17 |
/** |
| 18 |
* TrkCalibQLookExpert.cpp |
| 19 |
* |
| 20 |
* autor: D.Fedele |
| 21 |
* version 1.0 |
| 22 |
* Parameters: |
| 23 |
* base - the path to the root directory for the specific |
| 24 |
* Pamela unpack session |
| 25 |
* step - select =1 in order to analyse one event at time |
| 26 |
* fromevent - first event to analyse |
| 27 |
* toevent - last event to analyse |
| 28 |
* outdir - total path of output file |
| 29 |
* outfile - extension of output file (pdf,ps,gif,jpg) |
| 30 |
* |
| 31 |
*/ |
| 32 |
|
| 33 |
void TrkCalibQLook_EXPERT(TString file,Int_t step,Int_t fromevent, Int_t toevent,TString outdir,TString outfile) |
| 34 |
{ |
| 35 |
// |
| 36 |
// obtain information about the data file and select the output dir |
| 37 |
const string filepath=file.Data(); |
| 38 |
Int_t dwpos = filepath.find("DW_"); |
| 39 |
Int_t dwpos1 = filepath.find(".root"); |
| 40 |
TString fpath=(filepath.c_str()); |
| 41 |
TString base,ffile; |
| 42 |
stringcopy(base,fpath,0,dwpos); |
| 43 |
stringcopy(ffile,fpath,dwpos,dwpos1); |
| 44 |
|
| 45 |
TString out; |
| 46 |
if(outdir.Length()==0){ |
| 47 |
out = base; |
| 48 |
}else{ |
| 49 |
out = outdir; |
| 50 |
} |
| 51 |
|
| 52 |
// |
| 53 |
// inizialise the variables and open the file |
| 54 |
Int_t nevents=0; |
| 55 |
Int_t minevent = 0; |
| 56 |
Int_t maxevent = 0; |
| 57 |
ULong64_t FOBT[2], HOBT=0, TOBT=0; |
| 58 |
|
| 59 |
FOBT[0]=0; |
| 60 |
FOBT[1]=0; |
| 61 |
|
| 62 |
struct caltrk_def ctrk; |
| 63 |
ctrk.good0[0]=0; |
| 64 |
ctrk.good0[1]=0; |
| 65 |
for(Int_t i=0;i<12;i++){ |
| 66 |
ctrk.daqmode[i]=0; |
| 67 |
ctrk.dspnum[i]=0; |
| 68 |
ctrk.calibnum[i]=0; |
| 69 |
ctrk.ncalev[i]=0; |
| 70 |
ctrk.calfl[i]=0; |
| 71 |
ctrk.ped1[i]=0; |
| 72 |
ctrk.ped2[i]=0; |
| 73 |
ctrk.ped3[i]=0; |
| 74 |
ctrk.sig1[i]=0; |
| 75 |
ctrk.sig2[i]=0; |
| 76 |
ctrk.sig3[i]=0; |
| 77 |
ctrk.nbad1[i]=0; |
| 78 |
ctrk.nbad2[i]=0; |
| 79 |
ctrk.nbad3[i]=0; |
| 80 |
ctrk.crc_c[i][0]=0; |
| 81 |
ctrk.crc_c[i][1]=0; |
| 82 |
ctrk.crc_c[i][2]=0; |
| 83 |
ctrk.crc_hc[i]=0; |
| 84 |
for(Int_t iii=0;iii<3072;iii++){ |
| 85 |
ctrk.dspped[i][iii]=0; |
| 86 |
ctrk.dspsig[i][iii]=0; |
| 87 |
ctrk.dspbad[i][iii]=0; |
| 88 |
}; |
| 89 |
|
| 90 |
}; |
| 91 |
|
| 92 |
TFile *calibFile = new TFile(file); |
| 93 |
if ( !calibFile ){ |
| 94 |
printf("No data file, exiting...\n"); |
| 95 |
return; |
| 96 |
}; |
| 97 |
TTree *otr1,*otr2,*hotr,*totr; |
| 98 |
pamela::EventHeader *eh1=0,*eh2=0,*eh4=0,*eh3=0; |
| 99 |
pamela::PscuHeader *ph=0; |
| 100 |
pamela::CalibTrk1Event *trk1 = 0; |
| 101 |
pamela::CalibTrk2Event *trk2 = 0; |
| 102 |
|
| 103 |
hotr = (TTree*)calibFile->Get("CalibHeader"); |
| 104 |
hotr->SetBranchAddress("Header", &eh4); |
| 105 |
|
| 106 |
totr = (TTree*)calibFile->Get("CalibTrailer"); |
| 107 |
totr->SetBranchAddress("Header", &eh3); |
| 108 |
|
| 109 |
otr1 = (TTree*)calibFile->Get("CalibTrk1"); |
| 110 |
otr1->SetBranchAddress("CalibTrk1", &trk1); |
| 111 |
otr1->SetBranchAddress("Header",&eh1); |
| 112 |
otr2 = (TTree*)calibFile->Get("CalibTrk2"); |
| 113 |
otr2->SetBranchAddress("CalibTrk2", &trk2); |
| 114 |
otr2->SetBranchAddress("Header",&eh2); |
| 115 |
|
| 116 |
if(otr1->GetEntries()==otr2->GetEntries()) |
| 117 |
nevents = otr1->GetEntries(); |
| 118 |
else{ |
| 119 |
printf("WARNING: CalibTrk1 entries is different from CalibTrk2 entries"); |
| 120 |
return;} |
| 121 |
if (nevents<=0) { |
| 122 |
calibFile->Close(); |
| 123 |
printf("No calibration packets found, exiting...\n"); |
| 124 |
return; |
| 125 |
}; |
| 126 |
//printf("Number of calibration packets: %i\n",nevents); |
| 127 |
|
| 128 |
|
| 129 |
if ( fromevent > toevent && toevent ){ |
| 130 |
printf("It must be fromevent < toevent \n"); |
| 131 |
return; |
| 132 |
}; |
| 133 |
|
| 134 |
if ( fromevent > nevents || fromevent < 0 ) { |
| 135 |
printf("You can choose fromevent between 0 (all) and %i \n",nevents); |
| 136 |
return; |
| 137 |
}; |
| 138 |
|
| 139 |
if ( toevent > nevents || toevent < 0 ) { |
| 140 |
printf("You can choose toevent between 0 (all) and %i \n",nevents); |
| 141 |
return; |
| 142 |
}; |
| 143 |
if ( fromevent == 0 ) { |
| 144 |
minevent = 0; |
| 145 |
maxevent = nevents; |
| 146 |
} else { |
| 147 |
minevent = fromevent - 1; |
| 148 |
if ( toevent > 0 ){ |
| 149 |
maxevent = toevent; |
| 150 |
} else if (toevent > nevents) { |
| 151 |
maxevent = nevents; |
| 152 |
} else { |
| 153 |
maxevent = fromevent; |
| 154 |
}; |
| 155 |
}; |
| 156 |
|
| 157 |
//********************************************************************** |
| 158 |
// |
| 159 |
// LOOP OVER EVENTS |
| 160 |
// |
| 161 |
//********************************************************************** |
| 162 |
|
| 163 |
// printf("\n Scan of calibration packets from %i to %i ... \n\n",minevent+1,maxevent); |
| 164 |
for (Int_t i = minevent; i < maxevent; i++){ |
| 165 |
|
| 166 |
otr1->GetEntry(i); |
| 167 |
otr2->GetEntry(i); |
| 168 |
totr->GetEntry(i); |
| 169 |
hotr->GetEntry(i); |
| 170 |
ph = eh4->GetPscuHeader(); |
| 171 |
HOBT= ph->GetOrbitalTime(); |
| 172 |
ph = eh3->GetPscuHeader(); |
| 173 |
TOBT= ph->GetOrbitalTime(); |
| 174 |
|
| 175 |
ctrk.good0[0]=trk1->good0; |
| 176 |
ctrk.good0[1]=trk2->good0; |
| 177 |
for (Int_t m = 0; m < 6; m++){ |
| 178 |
Int_t plane=m; |
| 179 |
ph = eh1->GetPscuHeader(); |
| 180 |
FOBT[0]= ph->GetOrbitalTime(); |
| 181 |
ctrk.daqmode[trk1->DSPnumber[m]-1]=trk1->DAQmode[m]; |
| 182 |
ctrk.dspnum[trk1->DSPnumber[m]-1]=trk1->DSPnumber[m]; |
| 183 |
ctrk.calibnum[trk1->DSPnumber[m]-1]=trk1->calibnumber[m]; |
| 184 |
ctrk.ncalev[trk1->DSPnumber[m]-1]=trk1->ncalib_event[m]; |
| 185 |
ctrk.ped1[trk1->DSPnumber[m]-1]=trk1->ped_l1[m]; |
| 186 |
ctrk.ped2[trk1->DSPnumber[m]-1]=trk1->ped_l2[m]; |
| 187 |
ctrk.ped3[trk1->DSPnumber[m]-1]=trk1->ped_l3[m]; |
| 188 |
ctrk.sig1[trk1->DSPnumber[m]-1]=trk1->sig_l1[m]; |
| 189 |
ctrk.sig2[trk1->DSPnumber[m]-1]=trk1->sig_l2[m]; |
| 190 |
ctrk.sig3[trk1->DSPnumber[m]-1]=trk1->sig_l3[m]; |
| 191 |
ctrk.nbad1[trk1->DSPnumber[m]-1]=trk1->nbad_l1[m]; |
| 192 |
ctrk.nbad2[trk1->DSPnumber[m]-1]=trk1->nbad_l2[m]; |
| 193 |
ctrk.nbad3[trk1->DSPnumber[m]-1]=trk1->nbad_l3[m]; |
| 194 |
ctrk.calfl[trk1->DSPnumber[m]-1]=trk1->cal_flag[m]; |
| 195 |
ctrk.crc_c[trk1->DSPnumber[m]-1][0]=trk1->crc_cal[m][0]; |
| 196 |
ctrk.crc_c[trk1->DSPnumber[m]-1][1]=trk1->crc_cal[m][1]; |
| 197 |
ctrk.crc_c[trk1->DSPnumber[m]-1][2]=trk1->crc_cal[m][2]; |
| 198 |
ctrk.crc_hc[trk1->DSPnumber[m]-1]=trk1->crc_hcal[m]; |
| 199 |
for (Int_t j = 0; j < 3072; j++){ |
| 200 |
ctrk.dspped[trk1->DSPnumber[m]-1][j]=trk1->DSPped_par[m][j]; |
| 201 |
ctrk.dspsig[trk1->DSPnumber[m]-1][j]=trk1->DSPsig_par[m][j]; |
| 202 |
ctrk.dspbad[trk1->DSPnumber[m]-1][j]=trk1->DSPbad_par[m][j]; |
| 203 |
}; |
| 204 |
ph = eh2->GetPscuHeader(); |
| 205 |
FOBT[1]= ph->GetOrbitalTime(); |
| 206 |
ctrk.daqmode[trk2->DSPnumber[m]-1]=trk2->DAQmode[m]; |
| 207 |
ctrk.dspnum[trk2->DSPnumber[m]-1]=trk2->DSPnumber[m]; |
| 208 |
ctrk.calibnum[trk2->DSPnumber[m]-1]=trk2->calibnumber[m]; |
| 209 |
ctrk.ncalev[trk2->DSPnumber[m]-1]=trk2->ncalib_event[m]; |
| 210 |
ctrk.ped1[trk2->DSPnumber[m]-1]=trk2->ped_l1[m]; |
| 211 |
ctrk.ped2[trk2->DSPnumber[m]-1]=trk2->ped_l2[m]; |
| 212 |
ctrk.ped3[trk2->DSPnumber[m]-1]=trk2->ped_l3[m]; |
| 213 |
ctrk.sig1[trk2->DSPnumber[m]-1]=trk2->sig_l1[m]; |
| 214 |
ctrk.sig2[trk2->DSPnumber[m]-1]=trk2->sig_l2[m]; |
| 215 |
ctrk.sig3[trk2->DSPnumber[m]-1]=trk2->sig_l3[m]; |
| 216 |
ctrk.nbad1[trk2->DSPnumber[m]-1]=trk2->nbad_l1[m]; |
| 217 |
ctrk.nbad2[trk2->DSPnumber[m]-1]=trk2->nbad_l2[m]; |
| 218 |
ctrk.nbad3[trk2->DSPnumber[m]-1]=trk2->nbad_l3[m]; |
| 219 |
ctrk.calfl[trk2->DSPnumber[m]-1]=trk2->cal_flag[m]; |
| 220 |
ctrk.crc_c[trk1->DSPnumber[m]-1][0]=trk2->crc_cal[m][0]; |
| 221 |
ctrk.crc_c[trk1->DSPnumber[m]-1][1]=trk2->crc_cal[m][1]; |
| 222 |
ctrk.crc_c[trk1->DSPnumber[m]-1][2]=trk2->crc_cal[m][2]; |
| 223 |
ctrk.crc_hc[trk1->DSPnumber[m]-1]=trk2->crc_hcal[m]; |
| 224 |
for (Int_t j = 0; j < 3072; j++){ |
| 225 |
ctrk.dspped[trk2->DSPnumber[m]-1][j]=trk2->DSPped_par[m][j]; |
| 226 |
ctrk.dspsig[trk2->DSPnumber[m]-1][j]=trk2->DSPsig_par[m][j]; |
| 227 |
ctrk.dspbad[trk2->DSPnumber[m]-1][j]=trk2->DSPbad_par[m][j]; |
| 228 |
}; |
| 229 |
}; |
| 230 |
|
| 231 |
|
| 232 |
// |
| 233 |
// other variables definitions |
| 234 |
Int_t risposta=0; |
| 235 |
stringstream fromfile; |
| 236 |
|
| 237 |
fromfile<<"TrkCalibQLookExpert File: "<<ffile<<" -- CalibHeader OBT= "<<HOBT<<" -- Calib pkt OBT= "<<FOBT[0]<<" -- CalibTrailer OBT= "<<TOBT<<" --"; |
| 238 |
|
| 239 |
gStyle->SetLabelSize(0.08,"x"); |
| 240 |
gStyle->SetLabelSize(0.08,"y"); |
| 241 |
gStyle->SetTitleFillColor(10); |
| 242 |
gStyle->SetTitleFontSize(0.1); |
| 243 |
gStyle->SetTitleOffset(0.8,"y"); |
| 244 |
gStyle->SetTitleOffset(1.,"x"); |
| 245 |
gStyle->SetTitleSize(0.06,"y"); |
| 246 |
gStyle->SetTitleSize(0.06,"x"); |
| 247 |
gStyle->SetOptStat(0); |
| 248 |
|
| 249 |
// |
| 250 |
// draw display area |
| 251 |
TLatex *tzz=new TLatex(); |
| 252 |
tzz->SetTextFont(32); |
| 253 |
tzz->SetTextColor(1); |
| 254 |
tzz->SetTextAlign(12); |
| 255 |
tzz->SetTextSize(0.019); |
| 256 |
Int_t canvasx=1200; |
| 257 |
Int_t canvasy=900; |
| 258 |
TCanvas *c1 = new TCanvas("c1","TrkCalibQLook_EXPERT_ped",canvasx,canvasy); |
| 259 |
c1->SetFillColor(10); |
| 260 |
tzz->DrawLatex(.01,0.98,fromfile.str().c_str()); |
| 261 |
tzz->DrawLatex(.90,0.98,"PEDESTAL"); |
| 262 |
TCanvas *c2 = new TCanvas("c2","TrkCalibQLook_EXPERT_sig",canvasx,canvasy); |
| 263 |
c2->SetFillColor(10); |
| 264 |
tzz->DrawLatex(.01,0.98,fromfile.str().c_str()); |
| 265 |
tzz->DrawLatex(.90,0.98,"SIGMA"); |
| 266 |
|
| 267 |
// draw pads |
| 268 |
TPad *trkpad1[12],*trkpad2[12]; //pad for histos |
| 269 |
TPaveText *trkpadtext[12]; //pad for header |
| 270 |
TH1F *histosig[12]; //histos of sigma |
| 271 |
TH1F *histoped[12]; //histos of pedestals |
| 272 |
TH1F *histoasig[12]; //histos of sigma |
| 273 |
TH1F *histoaped[12]; //histos of pedestals |
| 274 |
|
| 275 |
Double_t posy = 0.95; // up y-coord - top pads |
| 276 |
Double_t hpad = 0.15; // pad height |
| 277 |
Double_t posx1=0; // left x-coord - pad column |
| 278 |
Double_t posx2=0; // right x-coord - pad olumn |
| 279 |
Double_t posx0=0; // x-coord - column division |
| 280 |
Double_t wrel = 0.6; // relative x size of first sub-column |
| 281 |
Double_t marg = 0.004; // margin among pads |
| 282 |
stringstream title; |
| 283 |
stringstream hid; |
| 284 |
|
| 285 |
for(Int_t n = 0; n<12; n++){ |
| 286 |
if ( (n+1)%2 ) { |
| 287 |
if(n>1)posy = posy-(marg*2+hpad); |
| 288 |
posx1 = marg; |
| 289 |
posx2 = 0.5 - marg; |
| 290 |
posx0 = 0.5*wrel; |
| 291 |
} else { |
| 292 |
posx1 = posx1 + 0.5; |
| 293 |
posx2 = posx2 + 0.5; |
| 294 |
posx0 = posx0 + 0.5; |
| 295 |
}; |
| 296 |
/* -----------> pad for histograms */ |
| 297 |
trkpad1[n] = new TPad("pad1"," ",posx1,posy-hpad,posx0-marg,posy,18,0,0); |
| 298 |
trkpad2[n] = new TPad("pad2"," ",posx1,posy-hpad,posx0-marg,posy,18,0,0); |
| 299 |
/* -----------> pad for header dump */ |
| 300 |
trkpadtext[n] = new TPaveText((posx0+marg),(posy-hpad),posx2,posy); |
| 301 |
/* -----------> HISTOGRAMS */ |
| 302 |
/* calibration parameters */ |
| 303 |
title<<"DSP "<<n+1; |
| 304 |
hid<<"h"<<n; |
| 305 |
histosig[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3072,0.5,3072.5); |
| 306 |
hid.str(""); |
| 307 |
hid<<"hh"<<n; |
| 308 |
histoped[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3072,0.5,3072.5); |
| 309 |
hid.str(""); |
| 310 |
hid<<"hhh"<<n; |
| 311 |
title.str(""); |
| 312 |
hid.str(""); |
| 313 |
/* AVERAGE calibration parameters */ |
| 314 |
hid<<"ah"<<n; |
| 315 |
histoasig[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3,0.5,3072.5); |
| 316 |
hid.str(""); |
| 317 |
hid<<"ahh"<<n; |
| 318 |
histoaped[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3,0.5,3072.5); |
| 319 |
hid.str(""); |
| 320 |
}; //end loop on views |
| 321 |
|
| 322 |
|
| 323 |
// = = = = = = = = = = = = = = = = = = = = = = = = = |
| 324 |
// create header dump retrieving event info |
| 325 |
// = = = = = = = = = = = = = = = = = = = = = = = = = |
| 326 |
Int_t nlines = 10; |
| 327 |
Double_t fromy = 0.9; |
| 328 |
Double_t toy = 0.1; |
| 329 |
Double_t fromx = 0.05; |
| 330 |
Double_t stepw = (toy-fromy)/(nlines-1); |
| 331 |
stringstream message; |
| 332 |
|
| 333 |
//-------------------------------- |
| 334 |
//CHECK CALIBRATION procedure |
| 335 |
//-------------------------------- |
| 336 |
Int_t nn=0; |
| 337 |
Int_t calok = 0;//BAD |
| 338 |
for(Int_t n = 0; n<12; n++){ |
| 339 |
if(ctrk.ncalev[n]==0 && ctrk.calfl[n]==0)calok = 1;//GOOD |
| 340 |
|
| 341 |
|
| 342 |
nn=ctrk.dspnum[n]-1; |
| 343 |
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
| 344 |
* |
| 345 |
* Write event LEVEL0 report |
| 346 |
* |
| 347 |
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
| 348 |
trkpadtext[nn]->SetTextFont(40); |
| 349 |
trkpadtext[nn]->SetFillColor(33); |
| 350 |
if(calok==0)trkpadtext[nn]->SetFillColor(2); |
| 351 |
trkpadtext[nn]->SetTextSize(0.013); |
| 352 |
trkpadtext[nn]->SetTextAlign(13); |
| 353 |
trkpadtext[nn]->SetTextColor(1); |
| 354 |
|
| 355 |
trkpadtext[nn]->AddText(" "); |
| 356 |
message<<"DSP num --------> "<<ctrk.dspnum[n]; |
| 357 |
trkpadtext[nn]->AddText(message.str().c_str()); |
| 358 |
message.str(""); |
| 359 |
message<<"DAQ mode -------> "<<ctrk.daqmode[n]; |
| 360 |
trkpadtext[nn]->AddText(message.str().c_str()); |
| 361 |
message.str(""); |
| 362 |
message<<"Calibnumber ----> "<<ctrk.calibnum[n]; |
| 363 |
trkpadtext[nn]->AddText(message.str().c_str()); |
| 364 |
message.str(""); |
| 365 |
message<<"ncalib_event ---> "<<ctrk.ncalev[n]; |
| 366 |
trkpadtext[nn]->AddText(message.str().c_str()); |
| 367 |
message.str(""); |
| 368 |
message<<"Cal_flag -------> "<<ctrk.calfl[n]; |
| 369 |
trkpadtext[nn]->AddText(message.str().c_str()); |
| 370 |
message.str(""); |
| 371 |
message<<"crc_hcal -------> "<<ctrk.crc_hc[n]; |
| 372 |
trkpadtext[nn]->AddText(message.str().c_str()); |
| 373 |
message.str(""); |
| 374 |
message<<"crc_cal: l1- ";message.width(5);message<< ctrk.crc_c[n][0]; |
| 375 |
message<<" l2- ";message.width(5);message<< ctrk.crc_c[n][1]; |
| 376 |
message<<" l3- ";message.width(5);message<< ctrk.crc_c[n][2]; |
| 377 |
trkpadtext[nn]->AddText(message.str().c_str()); |
| 378 |
message.str(""); |
| 379 |
message<<"<PED>: l1- "; message.width(5);message<< ctrk.ped1[n]; |
| 380 |
message<<" l2-"; message.width(5);message<< ctrk.ped2[n]; |
| 381 |
message<<" l3-"; message.width(5);message<< ctrk.ped3[n]; |
| 382 |
trkpadtext[nn]->AddText(message.str().c_str()); |
| 383 |
message.str(""); |
| 384 |
message<<"<SIG>: l1- "; message.width(5);message<< ctrk.sig1[n]; |
| 385 |
message<<" l2-"; message.width(5);message<< ctrk.sig2[n]; |
| 386 |
message<<" l3-"; message.width(5);message<< ctrk.sig3[n]; |
| 387 |
trkpadtext[nn]->AddText(message.str().c_str()); |
| 388 |
message.str(""); |
| 389 |
message<<"n.BAD: l1- "; message.width(5);message<<ctrk.nbad1[n]; |
| 390 |
message<<" l2-"; message.width(5);message<< ctrk.nbad2[n]; |
| 391 |
message<<" l3-"; message.width(5);message<< ctrk.nbad3[n]; |
| 392 |
// cout << message.str()<< endl; |
| 393 |
trkpadtext[nn]->AddText(message.str().c_str()); |
| 394 |
message.str(""); |
| 395 |
|
| 396 |
if(calok==0){ |
| 397 |
|
| 398 |
message.str("*** FAILED ***"); |
| 399 |
TText *t=trkpadtext[nn]->AddText(message.str().c_str()); |
| 400 |
t->SetTextSize(0.02); |
| 401 |
t->SetTextAlign(23); |
| 402 |
t->SetTextColor(5); |
| 403 |
}; |
| 404 |
|
| 405 |
/*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.* |
| 406 |
* |
| 407 |
* Plot histo |
| 408 |
* |
| 409 |
*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*/ |
| 410 |
|
| 411 |
|
| 412 |
/******************************************************/ |
| 413 |
/* fill histos */ |
| 414 |
for(Int_t j = 0; j < 3072; j++){ |
| 415 |
histosig[nn]->Fill((Float_t)j,ctrk.dspsig[nn][j]); |
| 416 |
histoped[nn]->Fill((Float_t)j,ctrk.dspped[nn][j]); |
| 417 |
}; |
| 418 |
histoasig[nn]->Fill(1,ctrk.sig1[nn]); |
| 419 |
histoasig[nn]->Fill(1025,ctrk.sig2[nn]); |
| 420 |
histoasig[nn]->Fill(2049,ctrk.sig3[nn]); |
| 421 |
histoaped[nn]->Fill(1,ctrk.ped1[nn]); |
| 422 |
histoaped[nn]->Fill(1025,ctrk.ped2[nn]); |
| 423 |
histoaped[nn]->Fill(2049,ctrk.ped3[nn]); |
| 424 |
/******************************************************/ |
| 425 |
|
| 426 |
TLine li; |
| 427 |
li.SetLineColor(38); |
| 428 |
li.SetLineStyle(3); |
| 429 |
li.SetLineWidth(2); |
| 430 |
|
| 431 |
|
| 432 |
/* plot PEDESTAL */ |
| 433 |
c1->cd(); |
| 434 |
trkpadtext[nn]->Draw(); |
| 435 |
trkpad1[nn]->Draw(); |
| 436 |
trkpad1[nn]->cd(); |
| 437 |
trkpad1[nn]->SetFillColor(10); |
| 438 |
trkpad1[nn]->SetFrameFillColor(10); |
| 439 |
histoped[nn]->SetLineColor(1); |
| 440 |
histoped[nn]->SetFillColor(12); |
| 441 |
histoped[nn]->SetLineWidth(1); |
| 442 |
histoped[nn]->GetYaxis()->SetTitle("PED (ADC channels)"); |
| 443 |
histoped[nn]->GetYaxis()->CenterTitle(); |
| 444 |
if((nn+1)%2==1) histoped[nn]->GetYaxis()->SetRangeUser(2500,3200); |
| 445 |
if((nn+1)%2==0) histoped[nn]->GetYaxis()->SetRangeUser(1000,1700); |
| 446 |
histoaped[nn]->SetLineColor(5); |
| 447 |
histoaped[nn]->SetLineWidth(1); |
| 448 |
if(ctrk.good0[0]==1 && ctrk.good0[1]==1) histoped[nn]->Draw("b"); |
| 449 |
else histoped[nn]->Draw("axis"); |
| 450 |
histoaped[nn]->Draw("same"); |
| 451 |
if((nn+1)%2==1) { |
| 452 |
li.DrawLine(1024.5,2500,1024.5,3200); |
| 453 |
li.DrawLine(2048.5,2500,2048.5,3200); |
| 454 |
} |
| 455 |
if((nn+1)%2==0) { |
| 456 |
li.DrawLine(1024.5,1000,1024.5,1700); |
| 457 |
li.DrawLine(2048.5,1000,2048.5,1700); |
| 458 |
} |
| 459 |
|
| 460 |
|
| 461 |
/* plot SIGMA */ |
| 462 |
Double_t max=500.; |
| 463 |
c2->cd(); |
| 464 |
trkpadtext[nn]->Draw(); |
| 465 |
trkpad2[nn]->SetLogy(); |
| 466 |
trkpad2[nn]->Draw(); |
| 467 |
trkpad2[nn]->cd(); |
| 468 |
trkpad2[nn]->SetFillColor(10); |
| 469 |
trkpad2[nn]->SetFrameFillColor(10); |
| 470 |
histosig[nn]->SetLineColor(1); |
| 471 |
histosig[nn]->SetFillColor(12); |
| 472 |
histosig[nn]->SetLineWidth(1); |
| 473 |
histosig[nn]->SetMaximum(max); |
| 474 |
histosig[nn]->SetMinimum(0.5); |
| 475 |
histosig[nn]->GetYaxis()->SetTitle("SIG (ADC channels)"); |
| 476 |
histosig[nn]->GetYaxis()->CenterTitle(); |
| 477 |
histoasig[nn]->SetLineColor(5); |
| 478 |
histoasig[nn]->SetLineWidth(1); |
| 479 |
if(ctrk.good0[0]==1 && ctrk.good0[1]==1) histosig[nn]->Draw("b"); |
| 480 |
else histosig[nn]->Draw("axis"); |
| 481 |
histoasig[nn]->Draw("same"); |
| 482 |
li.DrawLine(1024.5,0,1024.5,max); |
| 483 |
li.DrawLine(2048.5,0,2048.5,max); |
| 484 |
|
| 485 |
};//end loop on views |
| 486 |
|
| 487 |
c1->Update();//draw pads in canvas |
| 488 |
c2->Update();//draw pads in canvas |
| 489 |
|
| 490 |
stringstream nom1; |
| 491 |
stringstream nom2; |
| 492 |
|
| 493 |
if(!strcmp(outfile.Data(),"ps")||!strcmp(outfile.Data(),"pdf")){ |
| 494 |
nom1.str(""); |
| 495 |
nom2.str(""); |
| 496 |
nom1<<out<<ffile<<"_TrkCalibQLook_EXPERT-pkt"<<i+1<<".ps("; |
| 497 |
nom2<<out<<ffile<<"_TrkCalibQLook_EXPERT-pkt"<<i+1<<".ps)"; |
| 498 |
c1->Print(nom1.str().c_str(),"Landscape"); |
| 499 |
c2->Print(nom2.str().c_str(),"Landscape"); |
| 500 |
if(!strcmp(outfile.Data(),"pdf")){ |
| 501 |
stringstream com; |
| 502 |
com<<"ps2pdf13 "<<out<<ffile<<"_TrkCalibQLook_EXPERT-pkt"<<i+1<<".ps "<<out<<ffile<<"_TrkCalibQlook_EXPERT-pkt"<<i+1<<".pdf"; |
| 503 |
system(com.str().c_str()); |
| 504 |
com.str(""); |
| 505 |
com<<"rm -f "<<out<<ffile<<"_TrkCalibQLook_EXPERT-pkt"<<i+1<<".ps"; |
| 506 |
system(com.str().c_str()); |
| 507 |
com.str(""); |
| 508 |
} |
| 509 |
} |
| 510 |
else{ |
| 511 |
nom1.str(""); |
| 512 |
nom2.str(""); |
| 513 |
nom1<<out<<ffile<<"_TrkCalibQLook_EXPERT-ped-pkt"<<i+1<<"."<<outfile.Data(); |
| 514 |
nom2<<out<<ffile<<"_TrkCalibQLook_EXPERT-sig-pkt"<<i+1<<"."<<outfile.Data(); |
| 515 |
c1->Print(nom1.str().c_str()); |
| 516 |
c2->Print(nom2.str().c_str()); |
| 517 |
} |
| 518 |
|
| 519 |
delete c1; |
| 520 |
delete c2; |
| 521 |
for(Int_t j=0;j<12;j++){ |
| 522 |
delete histosig[j]; |
| 523 |
delete histoped[j]; |
| 524 |
delete histoasig[j]; |
| 525 |
delete histoaped[j]; |
| 526 |
delete trkpadtext[j]; |
| 527 |
} |
| 528 |
|
| 529 |
if(step==1 && i!=maxevent-1 ){ |
| 530 |
printf("\n Press 1<enter> to continue, 2<enter> to quit.\n"); |
| 531 |
cin>>risposta; |
| 532 |
if ( i != maxevent-1 ) { |
| 533 |
if ( risposta == 2 ) { |
| 534 |
gROOT->Reset(); |
| 535 |
// printf("Exiting...\n"); |
| 536 |
return; |
| 537 |
} |
| 538 |
} |
| 539 |
} |
| 540 |
};//end loop on events |
| 541 |
calibFile->Close(); |
| 542 |
|
| 543 |
gROOT->Reset(); |
| 544 |
// printf("... end of packets. \n"); |
| 545 |
return; |
| 546 |
} |
| 547 |
|
| 548 |
|