8 if ( g1->GetN() != g2->GetN() )
10 cerr <<
"Mismatch in number of points for graphs in calculating delta!" << endl;
14 TGraph* gdelta =
new TGraph( g1->GetN() );
16 for (
unsigned i = 0;
i < g1->GetN();
i++ )
23 g1->GetPoint(
i , x1 , y1 );
24 g2->GetPoint(
i , x2 , y2 );
27 Double_t ydelta = y1-y2;
29 gdelta->SetPoint(
i, xdelta, ydelta);
41 TFile *file_nominal =
new TFile(
"data_amatrix/G4EICIR_DSTReader_p250_vx0_vy0_theta22mrad.root",
"OPEN" );
42 TFile *file_nominal_upper =
new TFile(
"data_amatrix/G4EICIR_DSTReader_p250_vx0_vy1_theta0mrad.root",
"OPEN" );
43 TFile *file_nominal_lower =
new TFile(
"data_amatrix/G4EICIR_DSTReader_p250_vx0_vy0_theta10mrad.root",
"OPEN" );
45 TFile *file_trial =
new TFile(
"data_amatrix/G4EICIR_DSTReader_p250_vx0_vy0_theta10mrad.root",
"OPEN" );
48 TTree *tree_nominal = (TTree*)file_nominal->Get(
"T");
49 TTree *tree_nominal_upper = (TTree*)file_nominal_upper->Get(
"T");
50 TTree *tree_nominal_lower = (TTree*)file_nominal_lower->Get(
"T");
52 TTree *tree_trial = (TTree*)file_trial->Get(
"T");
56 tree_nominal->SetBranchAddress(
"n_G4HIT_FWDDISC",&nhits);
57 tree_nominal->GetEntry(0);
58 cout <<
"hits: " << nhits << endl;
61 tree_nominal->Draw(
"0.5*(G4HIT_FWDDISC.y[][0]+G4HIT_FWDDISC.y[][1]) : 0.5*(G4HIT_FWDDISC.z[][0]+G4HIT_FWDDISC.z[][1])",
"Entry$==0",
"");
62 TGraph* g_nominal =
new TGraph(nhits, &(tree_nominal->GetV2()[0]), &(tree_nominal->GetV1()[0]));
63 g_nominal->SetName(
"g_nominal");
66 TGraph* g_nominal_delta =
graph_delta(g_nominal, g_nominal);
67 if ( ! g_nominal_delta )
69 g_nominal_delta->SetName(
"g_nominal_delta");
70 g_nominal_delta->SetLineWidth(2);
73 tree_nominal_upper->Draw(
"0.5*(G4HIT_FWDDISC.y[][0]+G4HIT_FWDDISC.y[][1]) : 0.5*(G4HIT_FWDDISC.z[][0]+G4HIT_FWDDISC.z[][1])",
"Entry$==0",
"");
74 TGraph* g_nominal_upper =
new TGraph(nhits, &(tree_nominal_upper->GetV2()[0]), &(tree_nominal_upper->GetV1()[0]));
75 g_nominal_upper->SetName(
"g_nominal_upper");
78 TGraph* g_nominal_upper_delta =
graph_delta(g_nominal_upper, g_nominal);
79 if ( ! g_nominal_upper_delta )
81 g_nominal_upper_delta->SetName(
"g_nominal_upper_delta");
82 g_nominal_upper_delta->SetLineWidth(2);
83 g_nominal_upper_delta->SetLineColor(kBlue);
86 tree_nominal_lower->Draw(
"0.5*(G4HIT_FWDDISC.y[][0]+G4HIT_FWDDISC.y[][1]) : 0.5*(G4HIT_FWDDISC.z[][0]+G4HIT_FWDDISC.z[][1])",
"Entry$==0",
"");
87 TGraph* g_nominal_lower =
new TGraph(nhits, &(tree_nominal_lower->GetV2()[0]), &(tree_nominal_lower->GetV1()[0]));
88 g_nominal_lower->SetName(
"g_nominal_lower");
91 TGraph* g_nominal_lower_delta =
graph_delta(g_nominal_lower, g_nominal);
92 if ( ! g_nominal_lower_delta )
94 g_nominal_lower_delta->SetName(
"g_nominal_lower_delta");
95 g_nominal_lower_delta->SetLineWidth(2);
96 g_nominal_lower_delta->SetLineColor(kRed);
107 TH1F *
h1 =
new TH1F(
"h1",
"",10,0,15000);
108 h1->GetXaxis()->SetRangeUser(0,12000);
109 h1->GetYaxis()->SetRangeUser(-10,10);
110 h1->GetXaxis()->SetTitle(
"z (cm)");
111 h1->GetYaxis()->SetTitle(
"#Delta_{x} (mm)");
114 TCanvas *c1 =
new TCanvas();
119 g_nominal_delta->Draw(
"Lsame");
120 g_nominal_upper_delta->Draw(
"Lsame");
121 g_nominal_lower_delta->Draw(
"Lsame");
123 c1->Print(
"track_deviations_new.eps");