28 zbeam(
const std::vector<std::pair<int,double> >& refz,
29 const std::vector<std::pair<int,double> >& testz ) {
31 if ( refz.size()!=testz.size() || refz.size()==0 )
return;
33 double _min = refz.back().first;
34 double _max = refz[0].first;
36 for (
unsigned i=refz.size() ;
i-- ; )
if ( refz[
i].
first>_max ) _max = refz[
i].first;
37 for (
unsigned i=0 ;
i<refz.size() ;
i++ )
if ( refz[
i].
first<_min ) _min = refz[
i].first;
39 double minz = refz.back().second;
42 for (
unsigned i=refz.size() ;
i-- ; ) {
43 if ( refz[
i].
second<minz ) minz = refz[
i].second;
44 if ( testz[
i].
second<minz ) minz = testz[
i].second;
45 if ( refz[
i].
second>maxz ) maxz = refz[
i].second;
46 if ( testz[
i].
second>maxz ) maxz = testz[
i].second;
49 double dz = maxz-minz;
51 gStyle->SetOptStat(0);
53 TProfile*
hr =
new TProfile(
"refz",
";lumi block;z reference [mm]", _max-_min+1, _min-0.5, _max+0.5 );
54 TProfile* ht =
new TProfile(
"testz",
";lumi block;z reference [mm]", _max-_min+1, _min-0.5, _max+0.5 );
56 TH1D*
h =
new TH1D(
"zres",
";#Delta z [mm]", 100, -10, 10 );
58 TH2D* h2 =
new TH2D(
"zcor",
";z ref [mm]; ztest [mm]", 20, minz, maxz, 20, minz, maxz );
60 for (
unsigned i=refz.size() ;
i-- ; ) {
69 hr->SetMarkerColor(kRed);
70 hr->SetLineColor(kRed);
72 hr->SetMarkerStyle(24);
73 ht->SetMarkerStyle(20);
75 hr->SetMarkerSize(0.5);
76 ht->SetMarkerSize(0.5);
78 hr->SetMaximum( maxz+dz/10 );
79 hr->SetMinimum( minz-dz/10 );
84 gPad->Print(
"zbeam.pdf");
88 gPad->Print(
"zbeam-res.pdf" );
91 h2->DrawCopy(
"colz" );
92 gPad->Print(
"zbeam-cor.pdf" );
94 TFile
f(
"zbeam.root",
"recreate" );