8 TString fname_irmag(
"example/proton-magnets-250GeV-opt2.dat");
10 TString fname_fun4all(
"example/eRHIC_proton-magnets-250GeV-opt2_250GeV_0mrad.root");
12 TString fname_eicroot(
"example/eicroot-track_proton-magnets-250GeV-opt2_250GeV_0mrad.txt");
15 TFile *fin =
new TFile(fname_fun4all);
18 TTree *tin = (TTree*)fin->Get(
"T");
21 tin->SetBranchAddress(
"n_G4HIT_FWDDISC",&nhits);
26 cout <<
"hits: " << nhits << endl;
28 tin->Draw(
"G4HIT_FWDDISC.x:G4HIT_FWDDISC.z",
"Entry$==0",
"");
30 TGraph* g1 =
new TGraph(nhits*2, &(tin->GetV2()[0]), &(tin->GetV1()[0]));
31 g1->SetMarkerStyle(7);
33 g1->SetMarkerColor(kRed);
36 TTree *tin2 =
new TTree();
37 tin2->ReadFile(fname_eicroot,
"x/F:y:z");
39 int nhits = tin2->GetEntries();
40 tin2->Draw(
"x:z",
"",
"");
42 TGraph* g2 =
new TGraph(nhits, &(tin2->GetV2()[0]), &(tin2->GetV1()[0]));
43 g2->SetMarkerStyle(7);
45 g2->SetMarkerColor(kGreen+1);
48 TH1F *
h1 =
new TH1F(
"h1",
"",10,0,15000);
49 h1->GetXaxis()->SetRangeUser(0,5000);
50 h1->GetYaxis()->SetRangeUser(-50,70);
51 h1->GetXaxis()->SetTitle(
"Z(cm)");
52 h1->GetYaxis()->SetTitle(
"X(cm)");
55 TCanvas *c1 =
new TCanvas();
59 ifstream irstream(fname_irmag);
61 if(!irstream.is_open())
63 cout <<
"ERROR: Could not open IR configuration file " << fname_irmag << endl;
67 while(!irstream.eof()){
69 getline(irstream, str);
70 if(str[0] ==
'#')
continue;
74 double center_z, center_x, center_y, aperture_radius,
length, angle, B, gradient;
76 ss >> name >> center_z >> center_x >> center_y >> aperture_radius >> length >> angle >> B >> gradient;
78 if ( name ==
"" )
continue;
84 aperture_radius *= 100;
96 angle = (angle / 1000.);
99 cout <<
"New IR component: " << name <<
" at z = " << center_z << endl;
101 string volname =
"IRMAGNET_";
102 volname.append(name);
105 TPolyLine *
b1 =
TraceBox( angle, center_z, center_x, length, aperture_radius, outer_radius );
106 TPolyLine *b2 =
TraceBox( angle, center_z, center_x, length, -1 * aperture_radius, -1 * outer_radius );
108 if(B != 0 && gradient == 0.0){
110 b1->SetFillColor(kOrange+1);
111 b2->SetFillColor(kOrange+1);
113 else if( B == 0 && gradient != 0.0){
115 b1->SetFillColor(kBlue+1);
116 b2->SetFillColor(kBlue+1);
120 b1->SetFillColor(kGray+1);
121 b2->SetFillColor(kGray+1);