1 |
/** |
/** |
2 |
* FTrkCalibQLookExpert.cpp |
* FTrkCalibQLookExpert.cxx |
3 |
* |
* |
4 |
* autor: D.Fedele |
* autor: D.Fedele |
5 |
* version 2.0 |
* version v1r04 |
6 |
* Parameters: |
* Parameters: |
7 |
* file - the data file to analyze |
* file - the data file to analyze |
8 |
* step - select =1 in order to analyze one event at time |
* step - select =1 in order to analyze one event at time |
18 |
#include <TPaveText.h> |
#include <TPaveText.h> |
19 |
#include <TLatex.h> |
#include <TLatex.h> |
20 |
#include <TCanvas.h> |
#include <TCanvas.h> |
21 |
|
#include <TFile.h> |
22 |
#include <TTree.h> |
#include <TTree.h> |
23 |
#include <TGraph.h> |
#include <TGraph.h> |
24 |
#include <TStyle.h> |
#include <TStyle.h> |
30 |
#include <CalibTrk2Event.h> |
#include <CalibTrk2Event.h> |
31 |
// |
// |
32 |
|
|
33 |
|
typedef struct caltrk_def{ |
|
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); |
|
|
}; |
|
|
}; |
|
|
|
|
|
typedef struct caltrk_def{ |
|
34 |
Int_t good0[2]; |
Int_t good0[2]; |
35 |
Int_t daqmode[12]; |
Int_t daqmode[12]; |
36 |
Int_t dspnum[12]; |
Int_t dspnum[12]; |
59 |
// |
// |
60 |
// obtain information about the data file and select the output dir |
// obtain information about the data file and select the output dir |
61 |
const string filepath=file.Data(); |
const string filepath=file.Data(); |
62 |
Int_t dwpos = filepath.rfind("DW_"); |
Int_t dwpos = file.Last('/'); |
63 |
Int_t dwpos1 = filepath.find(".root"); |
Int_t dwpos1 = file.Last('.'); |
64 |
TString fpath=(filepath.c_str()); |
TString base,ffile ; |
65 |
TString base,ffile; |
ffile=file(dwpos+1,dwpos1-(dwpos+1)); |
66 |
stringcopy(base,fpath,0,dwpos); |
if(dwpos>0) base=file(0,dwpos); |
|
stringcopy(ffile,fpath,dwpos,dwpos1); |
|
67 |
|
|
68 |
TString out; |
TString out; |
69 |
if(outdir.Length()==0){ |
if(outdir.Length()==0){ |
71 |
}else{ |
}else{ |
72 |
out = outdir; |
out = outdir; |
73 |
} |
} |
74 |
|
if(out.Last('/')+1<out.Length()) out+="/"; |
75 |
|
|
76 |
// |
// |
77 |
// inizialise the variables and open the file |
// inizialise the variables and open the file |
295 |
TH1F *histoasig[12]; //histos of sigma |
TH1F *histoasig[12]; //histos of sigma |
296 |
TH1F *histoaped[12]; //histos of pedestals |
TH1F *histoaped[12]; //histos of pedestals |
297 |
|
|
298 |
Double_t posy = 0.95; // up y-coord - top pads |
Float_t posy = 0.95; // up y-coord - top pads |
299 |
Double_t hpad = 0.15; // pad height |
Float_t hpad = 0.15; // pad height |
300 |
Double_t posx1=0; // left x-coord - pad column |
Float_t posx1=0; // left x-coord - pad column |
301 |
Double_t posx2=0; // right x-coord - pad olumn |
Float_t posx2=0; // right x-coord - pad olumn |
302 |
Double_t posx0=0; // x-coord - column division |
Float_t posx0=0; // x-coord - column division |
303 |
Double_t wrel = 0.6; // relative x size of first sub-column |
Float_t wrel = 0.6; // relative x size of first sub-column |
304 |
Double_t marg = 0.004; // margin among pads |
Float_t marg = 0.004; // margin among pads |
305 |
stringstream title; |
stringstream title; |
306 |
stringstream hid; |
stringstream hid; |
307 |
|
|
324 |
/* -----------> HISTOGRAMS */ |
/* -----------> HISTOGRAMS */ |
325 |
/* calibration parameters */ |
/* calibration parameters */ |
326 |
title<<"DSP "<<n+1; |
title<<"DSP "<<n+1; |
327 |
hid<<"h"<<n; |
hid<<"h"<<n<<"i"<<i; |
328 |
histosig[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3072,0.5,3072.5); |
histosig[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3072,0.5,3072.5); |
329 |
hid.str(""); |
hid.str(""); |
330 |
hid<<"hh"<<n; |
hid<<"hh"<<n<<"i"<<i; |
331 |
histoped[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3072,0.5,3072.5); |
histoped[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3072,0.5,3072.5); |
332 |
hid.str(""); |
hid.str(""); |
333 |
hid<<"hhh"<<n; |
hid<<"hhh"<<n<<"i"<<i; |
334 |
title.str(""); |
title.str(""); |
335 |
hid.str(""); |
hid.str(""); |
336 |
/* AVERAGE calibration parameters */ |
/* AVERAGE calibration parameters */ |
337 |
hid<<"ah"<<n; |
hid<<"ah"<<n<<"i"<<i; |
338 |
histoasig[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3,0.5,3072.5); |
histoasig[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3,0.5,3072.5); |
339 |
hid.str(""); |
hid.str(""); |
340 |
hid<<"ahh"<<n; |
hid<<"ahh"<<n<<"i"<<i; |
341 |
histoaped[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3,0.5,3072.5); |
histoaped[n] = new TH1F(hid.str().c_str(),title.str().c_str(),3,0.5,3072.5); |
342 |
hid.str(""); |
hid.str(""); |
343 |
}; //end loop on views |
}; //end loop on views |
442 |
li.SetLineStyle(3); |
li.SetLineStyle(3); |
443 |
li.SetLineWidth(2); |
li.SetLineWidth(2); |
444 |
|
|
445 |
Double_t maxhist=0; |
Float_t maxhist=0; |
446 |
TBox b; |
TBox b; |
447 |
b.SetFillColor(6); |
b.SetFillColor(6); |
448 |
b.SetFillStyle(3945); |
b.SetFillStyle(3945); |
493 |
|
|
494 |
|
|
495 |
/* plot SIGMA */ |
/* plot SIGMA */ |
496 |
Double_t max=500.; |
Float_t max=500.; |
497 |
c2->cd(); |
c2->cd(); |
498 |
trkpadtext[nn]->Draw(); |
trkpadtext[nn]->Draw(); |
499 |
trkpad2[nn]->SetLogy(); |
trkpad2[nn]->SetLogy(); |