Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
plot_fdc_offsets.C
Go to the documentation of this file.
2  gStyle->SetOptStat(0);
3 
4  TCanvas *c1=new TCanvas("c1","Alignment results",1200,800);
5  c1->Divide(2,2);
6  gStyle->SetTitleYOffset(1.5);
7 
8  // Histograms to store offset results
9  TH1F *h1=new TH1F("h1","h1",24,0.5,24.5);
10  h1->SetMaximum(0.5);
11  h1->SetMinimum(-0.5);
12  h1->SetXTitle("Wire plane");
13  h1->SetYTitle("#Deltau [cm]");
14  h1->SetTitle("Wire plane offsets");
15  h1->SetMarkerStyle(20);
16 
17  TH1F *h1_true=new TH1F("h1_true","h1_true",24,0.5,24.5);
18  h1_true->SetMaximum(0.5);
19  h1_true->SetMinimum(-0.5);
20  h1_true->SetXTitle("Wire plane");
21  h1_true->SetYTitle("#Deltau [cm]");
22  h1_true->SetTitle("Wire plane offsets");
23  h1_true->SetMarkerStyle(20);
24 
25 
26  TH1F *h2=new TH1F("h2","h2",24,0.5,24.5);
27  h2->SetMaximum(20.0);
28  h2->SetMinimum(-20.0);
29  h2->SetXTitle("Wire plane ");
30  h2->SetYTitle("#Delta#phi [mrad]");
31  h2->SetTitle("#phi correction");
32  h2->SetMarkerStyle(20);
33 
34  TH1F *h2_true=new TH1F("h2_true","h2_true",24,0.5,24.5);
35  h2_true->SetMaximum(20.0);
36  h2_true->SetMinimum(-20.0);
37  h2_true->SetXTitle("Wire plane ");
38  h2_true->SetYTitle("#Delta#phi [mrad]");
39  h2_true->SetTitle("#phi correction");
40  h2_true->SetMarkerStyle(20);
41 
42 
43  // Histograms to store offset results
44  TH1F *h3=new TH1F("h3","h3",24,0.5,24.5);
45  h3->SetMaximum(0.5);
46  h3->SetMinimum(-0.5);
47  h3->SetXTitle("Wire plane");
48  h3->SetYTitle("#Deltau - #Deltau(true) [cm]");
49  h3->SetTitle("Wire plane offset residuals");
50  h3->SetMarkerStyle(20);
51 
52  TH1F *h4=new TH1F("h4","h4",24,0.5,24.5);
53  h4->SetMaximum(20.0);
54  h4->SetMinimum(-20.0);
55  h4->SetXTitle("Wire plane ");
56  h4->SetYTitle("#Delta#phi - #Delta#phi(true) [mrad]");
57  h4->SetTitle("#phi correction residuals");
58  h4->SetMarkerStyle(20);
59 
60  ifstream fdcfile("fdc_alignment.dat");
61  ifstream fdctrue("fdc_alignment_true.dat");
62 
63  // Skip first line, used to identify columns in file
64  char sdummy[40];
65  // fdcfile.getline(sdummy,40);
66  //fdctrue.getline(sdummy,40);
67  // loop over remaining entries
68  for (unsigned int i=0;i<24;i++){
69  unsigned int mylayer=i+1;
70  double du,dphi,dz;
71  double du_true,dphi_true,dz_true;
72 
73  fdcfile >> dphi;
74  fdcfile >> du;
75  fdcfile >> dz;
76 
77  fdctrue >> dphi_true;
78  fdctrue >> du_true;
79  fdctrue >> dz_true;
80 
81  h1->Fill(mylayer,du);
82  h1_true->Fill(mylayer,-du_true);
83  h3->Fill(mylayer,du+du_true);
84  //h1->SetBinError(mylayer,sigu);
85 
86  h2->Fill(mylayer,1000.*dphi);
87  h2_true->Fill(mylayer,1000.*dphi_true);
88  h4->Fill(mylayer,1000.*(dphi-dphi_true));
89  //h2->SetBinError(mylayer,sigphi);
90 
91  }
92  fdcfile.close();
93 
94  c1->cd(1);
95  h1->Draw("p");
96  h1_true->SetMarkerColor(2);
97  h1_true->Draw("p,same");
98 
99  c1->cd(2);
100  h2->Draw("p");
101  h2_true->SetMarkerColor(2);
102  h2_true->Draw("p,same");
103 
104  c1->cd(3);
105  h3->Draw("p");
106 
107  c1->cd(4);
108  h4->Draw("p");
109 }
Double_t c1[2][NMODULES]
Definition: tw_corr.C:68
void plot_fdc_offsets()