8 TString fname_irmag(
"example/updated-magnets-2017.dat");
12 vector<string> v_filenames;
13 v_filenames.push_back(
"example/eRHIC_updated-magnets-2017_proton_275GeV_22mrad.root" );
14 v_filenames.push_back(
"example/eRHIC_updated-magnets-2017_proton_275GeV_27mrad.root" );
15 v_filenames.push_back(
"example/eRHIC_updated-magnets-2017_proton_275GeV_17mrad.root" );
17 TObjArray* graphs =
new TObjArray();
19 for (
i = 0;
i < v_filenames.size();
i++ )
22 TFile *fin =
new TFile( v_filenames.at(
i).c_str(),
"OPEN" );
25 TTree *tin = (TTree*)fin->Get(
"T");
28 tin->SetBranchAddress(
"n_G4HIT_FWDDISC",&nhits);
33 cout <<
"hits: " << nhits << endl;
35 tin->Draw(
"G4HIT_FWDDISC.x:G4HIT_FWDDISC.z",
"Entry$==0",
"");
37 TGraph* g1 =
new TGraph(nhits*2, &(tin->GetV2()[0]), &(tin->GetV1()[0]));
38 g1->SetMarkerStyle(7);
47 TH1F *
h1 =
new TH1F(
"h1",
"",10,0,15000);
48 h1->GetXaxis()->SetRangeUser(0,12000);
49 h1->GetYaxis()->SetRangeUser(-50,200);
50 h1->GetXaxis()->SetTitle(
"Z(cm)");
51 h1->GetYaxis()->SetTitle(
"X(cm)");
54 TCanvas *c1 =
new TCanvas();
58 ifstream irstream(fname_irmag);
60 if(!irstream.is_open())
62 cout <<
"ERROR: Could not open IR configuration file " << fname_irmag << endl;
66 while(!irstream.eof()){
68 getline(irstream, str);
69 if(str[0] ==
'#')
continue;
73 double center_z, center_x, center_y, aperture_radius,
length, angle, B, gradient;
75 ss >> name >> center_z >> center_x >> center_y >> aperture_radius >> length >> angle >> B >> gradient;
77 if ( name ==
"" )
continue;
83 aperture_radius *= 100;
95 angle = (angle / 1000.);
98 cout <<
"New IR component: " << name <<
" at z = " << center_z << endl;
100 string volname =
"IRMAGNET_";
101 volname.append(name);
104 TPolyLine *
b1 =
TraceBox( angle, center_z, center_x, length, aperture_radius, outer_radius );
105 TPolyLine *b2 =
TraceBox( angle, center_z, center_x, length, -1 * aperture_radius, -1 * outer_radius );
107 if(B != 0 && gradient == 0.0){
109 b1->SetFillColor(kOrange+1);
110 b2->SetFillColor(kOrange+1);
112 else if( B == 0 && gradient != 0.0){
114 b1->SetFillColor(kBlue+1);
115 b2->SetFillColor(kBlue+1);
119 b1->SetFillColor(kGray+1);
120 b2->SetFillColor(kGray+1);
127 for (
int i = 0;
i < graphs->GetEntries();
i++ )
129 graphs->At(
i)->Draw(
"LPsame");
132 c1->Print(
"multitrack_new.eps");