FairRoot/PandaRoot
Functions
SummaryAlign.C File Reference
#include <TFile.h>
#include <TH1.h>
#include <TH2.h>
#include <TString.h>
#include <TCanvas.h>
#include <sstream>

Go to the source code of this file.

Functions

int SummaryAlign (TString pathG="/panda/pandaroot/macro/lmd/testPixelAlignSIM_400000/mom_15/", double tr_sc=0, double rt_sc=0)
 

Function Documentation

int SummaryAlign ( TString  pathG = "/panda/pandaroot/macro/lmd/testPixelAlignSIM_400000/mom_15/",
double  tr_sc = 0,
double  rt_sc = 0 
)

Theta resolution--------------------------------------------------------------------------————

END (Theta resolution) ------------------------------------------------------———

Misalignment constants -----------------------------------------------------------——

END (Misalignment constants) --------------------------------------------------------—

Definition at line 9 of file SummaryAlign.C.

References c1, f1, f2, f3, i, name1, name2, name3, and TString.

11 {
12  const int colors[4] = {28,kAzure+2,46,8};
13  const int colors_a[4] = {kViolet-6,kOrange+7,kGreen+3,kRed+1};
14  const int ntrksSample = 1e4;
15  const double i_TrksSimi = 100./ntrksSample; //relative to simulated in %
16  // const int nParDt=8;
17  // double v_Dt[nParDt]={0,50,100,200,300,400,500,600};
18  // const int nParDa=5;
19  // double v_Da[nParDa]={0,1,3,6,9};
20  const int nParDt=10;
21  double v_Dt[nParDt]={0, 50, 100, 200, 300, 400, 500, 600, 800, 1000};
22  // const int nParDt=1;
23  // double v_Dt[nParDt]={0};
24  const int nParDa=4;
25  double v_Da[nParDa]={0,1,3,5};
26  // const int nParDa=1;
27  // double v_Da[nParDa]={0};
28  // for(int iDt=0;iDt<nParDt;iDt++){
29  // tr_sc = v_Dt[iDt];
30  // for(int iDa=0;iDa<nParDa;iDa++){
31  // rt_sc= v_Da[iDa];
32  cout<<"work with dt~"<<tr_sc<<" da~"<<rt_sc<<endl;
33  // //const int nS=10;
34  const int nS=1;
35  double TrksSim[nParDa][nParDt];
36  //double TrksSim[nS]={10000, 100000, 200000, 400000, 600000, 800000, 1000000};
37  // const int nS=3;
38  // double TrksSim[nS]={1000,5000,10000};
39 
40  // double TrksSim[nS]={10, 100, 200, 300, 400, 500, 700, 1000};
41  double TrksBef[nParDa][nParDt];
42  double TrksAft[nParDa][nParDt];
43  double TrksDiff[nParDa][nParDt];
44  double TrksKnossos[nParDa][nParDt], errTrksKnossos[nParDa][nParDt];
45  double TrksKnossos0[nParDa][nParDt], errTrksKnossos0[nParDa][nParDt];
46 
47  //How to save data
48  TString resname= pathG+"/Results1SampleSummary_BOX";
49  TString resname_pdf = resname+".pdf";
50  TString resname_pdf_o = resname_pdf+"(";
51  TString resname_pdf_c = resname_pdf+")";
52 
53  double mis_b[nParDa][6][nParDt];
54  double mis_a[nParDa][6][nParDt];
55  double mis_v_b[nParDa][6][nParDt];
56  double mis_v_a[nParDa][6][nParDt];
57 
58  double theta_mean_b[nParDa][nParDt], theta_mean_a[nParDa][nParDt], theta_mean_r[nParDa][nParDt];
59  double theta_rms_b[nParDa][nParDt], theta_rms_a[nParDa][nParDt], theta_rms_r[nParDa][nParDt];
60  // double theta_mean_b_sec[nS][10][nS], theta_mean_a_sec[nS][10][nS], theta_mean_r_sec[nS][10][nS];
61  // double theta_rms_b_sec[nS][10][nS], theta_rms_a_sec[nS][10][nS], theta_rms_r_sec[nS][10][nS];
62  TH1D *hthetabefore = new TH1D("hthetabefore","#theta_{MC}-#theta_{rec};#delta#theta,rad",1e2,-1e-3,1e-3);
63  TH1D *hthetaafter = new TH1D("hthetaafter","#theta_{MC}-#theta_{rec};#delta#theta,rad",1e2,-1e-3,1e-3);
64  TH1D *hthetaref = new TH1D("hthetaref","#theta_{MC}-#theta_{rec};#delta#theta,rad",1e2,-1e-3,1e-3);
65  for(int ipart=0;ipart<nParDa;ipart++){
66  for(int i=0;i<nParDt;i++){
67  TrksSim[ipart][i]=ntrksSample ; //ntrksSample events with 1trk/event
68  theta_mean_b[ipart][i] = 0;
69  theta_mean_a[ipart][i] = 0;
70  theta_mean_r[ipart][i] = 0;
71  theta_rms_b[ipart][i] = 0;
72  theta_rms_a[ipart][i] = 0;
73  theta_rms_r[ipart][i] = 0;
74  // for(int isector=0;isector<10;isector++){
75  // theta_mean_b_sec[ipart][isector][i] = 0;
76  // theta_mean_a_sec[ipart][isector][i] = 0;
77  // theta_mean_r_sec[ipart][isector][i] = 0;
78  // theta_rms_b_sec[ipart][isector][i] = 0;
79  // theta_rms_a_sec[ipart][isector][i] =0;
80  // theta_rms_r_sec[ipart][isector][i] = 0;
81  // }
82  }
83  }
84 
85  for(int ipart=0;ipart<nParDa;ipart++){
86  for(int i=0;i<nParDt;i++){
87  tr_sc = v_Dt[i];
88  rt_sc= v_Da[ipart];
89  int nTrks = TrksSim[ipart][i];
90  //Where search for files
91  TString path = pathG+"/";
92  path+=tr_sc;
93  path+="mkm_";
94  path+=rt_sc;
95  path+="mrad/";
96 
98  TString name1 = path + "/Lumi_QA_before.root";
99  TString name2 = path + "/Lumi_QA_after.root";
100  // TString name2 = path + "/Lumi_QA_after_";
101  // name2 +=i;
102  // name2 +="SumAlign.root";
103 
104 
105  TString name3 = pathG+"/0mkm_0mrad";
106  name3+="/Lumi_QA_after.root";
107 
108  // TH1F *hbeforetmp; TH1F *haftertmp;
109  TH1 *hbefore;
110  TH1 *hafter;
111  TH1 *hrefer;
112  // TNtuple *nsectors_b;
113  // TNtuple *nsectors_a;
114  // TNtuple *nsectors_r;
115 
116  TFile *f1 = new TFile(name1,"READ");
117  if (f1->IsZombie()) {
118  std::cout << "!!! Error opening file " <<name1<< std::endl;
119  continue;
120  // return;
121  }
122 
123 
124 
125  hbefore = (TH1*)f1->Get("NearIP/hResTheta");
126  //hbefore->Print();
127  hbefore->SetName("hResThetaBefore");
128  hbefore->SetTitle("#theta resolution");
129  // hbefore->Print();
130  TrksBef[ipart][i] = hbefore->GetEntries();
131  // TrksBef[ipart][i] *=i_TrksSimi;
132  // // if(i>0) TrksBef[ipart][i] += TrksBef[ipart][i-1];
133 
134  // // cout<<" Trks["<<ipart<<"]["<<i<<"] = "<<Trks[ipart][i]<<endl;
135  // TF1 *funrth_b = new TF1("fitrth_b","gaus",-0.01,0.01);
136  // funrth_b->SetParameters(100,0,3e-3);
137  // funrth_b->SetParNames("Constant","Mean","Sigma");
138  // hbefore->Fit(funrth_b);
139  // theta_mean_b[ipart][i] = 1e6*(funrth_b->GetParameter("Mean"));
140  // theta_rms_b[ipart][i] = 1e6*(funrth_b->GetParameter("Sigma"));
141  theta_mean_b[ipart][i] = 1e3*(hbefore->GetMean());
142  theta_rms_b[ipart][i] = 1e3*(hbefore->GetRMS());
143  // nsectors_b = (TNtuple*)f1->Get("nsectors");
144  TFile *f2 = new TFile(name2,"READ");
145  if (f2->IsZombie()) {
146  std::cout << "!!! Error opening file " <<name2<< std::endl;
147  continue;
148  // return;
149  }
150  hafter = (TH1F*)f2->Get("NearIP/hResTheta");
151  hafter->SetName("hResThetaAfter");
152  hafter->SetTitle("#theta resolution");
153  // Trks[ipart][i] = hafter->GetEntries();
154  // if(i>0) Trks[ipart][i] += Trks[ipart][i-1];
155  TrksAft[ipart][i] = hafter->GetEntries();
156  // TrksAft[ipart][i] *=i_TrksSimi;
157  // if(i>0) TrksAft[ipart][i] += TrksAft[ipart][i-1];
158 
159  TrksDiff[ipart][i] = (TrksAft[ipart][i] - TrksBef[ipart][i]);
160 
161  // TF1 *funrth_a = new TF1("fitrth_a","gaus",-0.01,0.01);
162  // funrth_a->SetParameters(100,0,3e-3);
163  // funrth_a->SetParNames("Constant","Mean","Sigma");
164  // hafter->Fit(funrth_a);
165 
166  // theta_mean_a[ipart][i] = 1e6*(funrth_a->GetParameter("Mean"));
167  // theta_rms_a[ipart][i] = 1e6*(funrth_a->GetParameter("Sigma"));
168  // // nsectors_a = (TNtuple*)f2->Get("nsectors");
169  theta_mean_a[ipart][i] = 1e3*(hafter->GetMean());
170  theta_rms_a[ipart][i] = 1e3*(hafter->GetRMS());
171  TFile *f3 = new TFile(name3,"READ");
172  if (f3->IsZombie()) {
173  std::cout << "!!! Error opening file " <<name2<< std::endl;
174  continue;
175  // return;
176  }
177  hrefer = (TH1F*)f3->Get("NearIP/hResTheta");
178  hrefer->SetName("hResThetaRef");
179  hrefer->SetTitle("#theta resolution");
180 
181  // TF1 *funrth_r = new TF1("fitrth_r","gaus",-0.01,0.01);
182  // funrth_r->SetParameters(100,0,3e-3);
183  // funrth_r->SetParNames("Constant","Mean","Sigma");
184  // hrefer->Fit(funrth_r);
185  // theta_mean_r[ipart][i] = 1e6*(funrth_r->GetParameter("Mean"));
186  // theta_rms_r[ipart][i] = 1e6*(funrth_r->GetParameter("Sigma"));
187  // nsectors_r = (TNtuple*)f3->Get("nsectors");
188  theta_mean_r[ipart][i] = 1e3*(hrefer->GetMean());
189  theta_rms_r[ipart][i] = 1e3*(hrefer->GetRMS());
190 
191  // for(int isector=0;isector<10;isector++){
192  // TString cond = "sector==";
193  // cond +=isector;
194  // nsectors_b->Project("hthetabefore","thetares",cond.Data());
195  // nsectors_a->Project("hthetaafter","thetares",cond.Data());
196  // nsectors_r->Project("hthetaref","thetares",cond.Data());
197  // hthetabefore->Fit(funrth_b);
198  // hthetaafter->Fit(funrth_a);
199  // hthetaref->Fit(funrth_r);
200  // theta_mean_b_sec[ipart][isector][i] = 1e6*(funrth_b->GetParameter("Mean"));
201  // theta_rms_b_sec[ipart][isector][i] = 1e6*(funrth_b->GetParameter("Sigma"));
202  // theta_mean_a_sec[ipart][isector][i] = 1e6*(funrth_a->GetParameter("Mean"));
203  // theta_rms_a_sec[ipart][isector][i] = 1e6*(funrth_a->GetParameter("Sigma"));
204  // theta_mean_r_sec[ipart][isector][i] = 1e6*(funrth_r->GetParameter("Mean"));
205  // theta_rms_r_sec[ipart][isector][i] = 1e6*(funrth_r->GetParameter("Sigma"));
206  // }
207 
209  f1->Close();
210  f2->Close();
211  f3->Close();
213  TString namemisc = pathG+"/";
214  namemisc+=tr_sc;
215  namemisc+="mkm_";
216  namemisc+=rt_sc;
217  namemisc+="mrad";
218  namemisc+="/KnossosResults.root";
219  TFile *fmisc = new TFile(namemisc,"READ");
220  if (fmisc->IsZombie()) {
221  std::cout << "!!! Error opening file " <<namemisc<< std::endl;
222  // return;
223  }
224  TH2F *hStatKnossos = (TH2F*)fmisc->Get("haStat_out");
225  TrksKnossos[ipart][i] = hStatKnossos->ProjectionY()->GetMean();
226  errTrksKnossos[ipart][i] = hStatKnossos->ProjectionY()->GetRMS();
227  TH2F *hStatKnossos0 = (TH2F*)fmisc->Get("haStat_in");
228  TrksKnossos0[ipart][i] = hStatKnossos0->ProjectionY()->GetMean();
229  errTrksKnossos0[ipart][i] = hStatKnossos0->ProjectionY()->GetRMS();
230  TH2F *hmis_b_0 = (TH2F*)fmisc->Get("mis_before_0");
231  mis_b[ipart][0][i] = 1e4*(hmis_b_0->ProjectionY()->GetRMS());
232  TH2F *hmis_b_1 = (TH2F*)fmisc->Get("mis_before_1");
233  mis_b[ipart][1][i] = 1e4*(hmis_b_1->ProjectionY()->GetRMS());
234  TH2F *hmis_b_2 = (TH2F*)fmisc->Get("mis_before_2");
235  mis_b[ipart][2][i] = 1e4*(hmis_b_2->ProjectionY()->GetRMS());
236  TH2F *hmis_b_3 = (TH2F*)fmisc->Get("mis_before_3");
237  mis_b[ipart][3][i] = 1e3*(hmis_b_3->ProjectionY()->GetRMS());
238  TH2F *hmis_b_4 = (TH2F*)fmisc->Get("mis_before_4");
239  mis_b[ipart][4][i] = 1e3*(hmis_b_4->ProjectionY()->GetRMS());
240  TH2F *hmis_b_5 = (TH2F*)fmisc->Get("mis_before_5");
241  mis_b[ipart][5][i] = 1e3*(hmis_b_5->ProjectionY()->GetRMS());
242 
243  TH2F *hmis_a_0 = (TH2F*)fmisc->Get("mis_diff_0");
244  mis_a[ipart][0][i] = 1e4*(hmis_a_0->ProjectionY()->GetRMS());
245  TH2F *hmis_a_1 = (TH2F*)fmisc->Get("mis_diff_1");
246  mis_a[ipart][1][i] = 1e4*(hmis_a_1->ProjectionY()->GetRMS());
247  TH2F *hmis_a_2 = (TH2F*)fmisc->Get("mis_diff_2");
248  mis_a[ipart][2][i] = 1e4*(hmis_a_2->ProjectionY()->GetRMS());
249  TH2F *hmis_a_3 = (TH2F*)fmisc->Get("mis_diff_3");
250  mis_a[ipart][3][i] = 1e3*(hmis_a_3->ProjectionY()->GetRMS());
251  TH2F *hmis_a_4 = (TH2F*)fmisc->Get("mis_diff_4");
252  mis_a[ipart][4][i] = 1e3*(hmis_a_4->ProjectionY()->GetRMS());
253  TH2F *hmis_a_5 = (TH2F*)fmisc->Get("mis_diff_5");
254  mis_a[ipart][5][i] = 1e3*(hmis_a_5->ProjectionY()->GetRMS());
255 
256 
257  mis_v_b[ipart][0][i] = 1e4*(hmis_b_0->ProjectionY()->GetMean());
258  mis_v_b[ipart][1][i] = 1e4*(hmis_b_1->ProjectionY()->GetMean());
259  mis_v_b[ipart][2][i] = 1e4*(hmis_b_2->ProjectionY()->GetMean());
260  mis_v_b[ipart][3][i] = 1e3*(hmis_b_3->ProjectionY()->GetMean());
261  mis_v_b[ipart][4][i] = 1e3*(hmis_b_4->ProjectionY()->GetMean());
262  mis_v_b[ipart][5][i] = 1e3*(hmis_b_5->ProjectionY()->GetMean());
263 
264  mis_v_a[ipart][0][i] = 1e4*(hmis_a_0->ProjectionY()->GetMean());
265  mis_v_a[ipart][1][i] = 1e4*(hmis_a_1->ProjectionY()->GetMean());
266  mis_v_a[ipart][2][i] = 1e4*(hmis_a_2->ProjectionY()->GetMean());
267  mis_v_a[ipart][3][i] = 1e3*(hmis_a_3->ProjectionY()->GetMean());
268  mis_v_a[ipart][4][i] = 1e3*(hmis_a_4->ProjectionY()->GetMean());
269  mis_v_a[ipart][5][i] = 1e3*(hmis_a_5->ProjectionY()->GetMean());
270  cout<<"mis_v_a["<<ipart<<"][5]["<<i<<"] = "<<mis_v_a[ipart][5][i]<<endl;
271  cout<<"mis_a["<<ipart<<"][5]["<<i<<"] = "<<mis_a[ipart][5][i]<<endl;
273  fmisc->Close();
274  }// trans
275  }// rotation
276 
277  // Draw results --------------------------------
278  double min_theta_mean_b = theta_mean_b[0][0], min_theta_rms_b = theta_rms_b[0][0];
279  double min_theta_mean_a = theta_mean_a[0][0], min_theta_rms_a = theta_rms_a[0][0];
280  double max_theta_mean_b = theta_mean_b[0][0], max_theta_rms_b = theta_rms_b[0][0];
281  double max_theta_mean_a = theta_mean_a[0][0], max_theta_rms_a = theta_rms_a[0][0];
282  for(int ipart=0;ipart<nParDa;ipart++){
283  for(int i=0;i<nParDt;i++){
284  if(min_theta_mean_b>theta_mean_b[ipart][i]) min_theta_mean_b = theta_mean_b[ipart][i];
285  if(max_theta_mean_b<theta_mean_b[ipart][i]) max_theta_mean_b = theta_mean_b[ipart][i];
286  if(min_theta_mean_a>theta_mean_a[ipart][i]) min_theta_mean_a = theta_mean_a[ipart][i];
287  if(max_theta_mean_a<theta_mean_a[ipart][i]) max_theta_mean_a = theta_mean_a[ipart][i];
288 
289  if(min_theta_rms_b>theta_rms_b[ipart][i]) min_theta_rms_b = theta_rms_b[ipart][i];
290  if(max_theta_rms_b<theta_rms_b[ipart][i]) max_theta_rms_b = theta_rms_b[ipart][i];
291  if(min_theta_rms_a>theta_rms_a[ipart][i]) min_theta_rms_a = theta_rms_a[ipart][i];
292  if(max_theta_rms_a<theta_rms_a[ipart][i]) max_theta_rms_a = theta_rms_a[ipart][i];
293  }
294  }
295 
296  for(int ipart=0;ipart<nParDa;ipart++){
297  for(int i=0;i<nParDt;i++){
298 
299  if(min_theta_mean_b>theta_mean_r[ipart][i]) min_theta_mean_b = theta_mean_r[ipart][i];
300  if(max_theta_mean_b<theta_mean_r[ipart][i]) max_theta_mean_b = theta_mean_r[ipart][i];
301  if(min_theta_mean_a>theta_mean_r[ipart][i]) min_theta_mean_a = theta_mean_r[ipart][i];
302  if(max_theta_mean_a<theta_mean_r[ipart][i]) max_theta_mean_a = theta_mean_r[ipart][i];
303 
304  if(min_theta_rms_b>theta_rms_r[ipart][i]) min_theta_rms_b = theta_rms_r[ipart][i];
305  if(max_theta_rms_b<theta_rms_r[ipart][i]) max_theta_rms_b = theta_rms_r[ipart][i];
306  if(min_theta_rms_a>theta_rms_r[ipart][i]) min_theta_rms_a = theta_rms_r[ipart][i];
307  if(max_theta_rms_a<theta_rms_r[ipart][i]) max_theta_rms_a = theta_rms_r[ipart][i];
308  }
309  }
310 
311  TCanvas c1;
312  TLegend *leg_b = new TLegend(0.83,0.65,0.97,0.97);
313  leg_b->SetFillColor(0);
314  TLegend *leg_a = new TLegend(0.83,0.65,0.97,0.97);
315  leg_a->SetFillColor(0);
316  // TLegend *leg_b = new TLegend(0.78,0.51,0.98,0.98);
317  // leg_b->SetFillColor(0);
318 
319  TMultiGraph *mgr_theta = new TMultiGraph();
320  TMultiGraph *mgr_theta_b = new TMultiGraph();
321  TGraphErrors *gr_theta_b[nParDa],*gr_theta_a[nParDa],*gr_theta_r[nParDa];
322  for(int ipart=0;ipart<nParDa;ipart++){// loop over rotaion scale
323  // double [nParDt], theta_mean_a[nParDa][nParDt], theta_mean_r[nParDa][nParDt];
324  // double [nParDt], theta_rms_a[nParDa][nParDt], theta_rms_r[nParDa][nParDt];
325  gr_theta_b[ipart] = new TGraphErrors(nParDt,v_Dt,theta_mean_b[ipart],0,0);
326  gr_theta_b[ipart]->SetMarkerStyle(20+ipart);
327  // gr_theta_b[ipart]->SetMarkerColor(kGreen-3);
328  // gr_theta_b[ipart]->SetMarkerColor(30*ipart+8);
329  gr_theta_b[ipart]->SetMarkerColor(colors[ipart]);
330  gr_theta_b[ipart]->SetLineColor(colors[ipart]);
331  // gr_theta_b[ipart]->SetLineColor(kGreen-3+ipart);
332  gr_theta_b[ipart]->SetMarkerSize(1.7+ipart*0.3);
333  gr_theta_a[ipart] = new TGraphErrors(nParDt,v_Dt,theta_mean_a[ipart],0,0);
334  gr_theta_a[ipart]->SetMarkerStyle(20+ipart);
335  //gr_theta_a[ipart]->SetMarkerColor(kOrange+7);
336  gr_theta_a[ipart]->SetMarkerColor(colors_a[ipart]);
337  gr_theta_a[ipart]->SetLineColor(colors_a[ipart]);
338  gr_theta_a[ipart]->SetMarkerSize(1.7+ipart*0.3);
339  mgr_theta_b->Add(gr_theta_b[ipart]);
340  mgr_theta->Add(gr_theta_a[ipart]);
341  if(ipart==0){
342  gr_theta_r[ipart] = new TGraphErrors(nParDt,v_Dt,theta_mean_r[ipart],0,0);
343  gr_theta_r[ipart]->SetMarkerStyle(20+ipart);
344  gr_theta_r[ipart]->SetMarkerColor(kGray+3);
345  gr_theta_r[ipart]->SetMarkerSize(2.7);
346  mgr_theta_b->Add(gr_theta_r[ipart]);
347  mgr_theta->Add(gr_theta_r[ipart]);
348  // leg->AddEntry(gr_theta_r[ipart],"ideal","lep");
349  leg_b->AddEntry(gr_theta_r[ipart],"ideal","lep");
350  leg_a->AddEntry(gr_theta_r[ipart],"ideal","lep");
351  }
352  TString dRName = "#Delta_{r} = ";
353  dRName +=v_Da[ipart];
354  // TString dRName_b = dRName+ " (BEFORE)";
355  // TString dRName_a = dRName+ " (AFTER)";
356  // leg->AddEntry(gr_theta_b[ipart],dRName_b,"lep");
357  // leg->AddEntry(gr_theta_a[ipart],dRName_a,"lep");
358  TString dRName_b = dRName;
359  leg_b->AddEntry(gr_theta_b[ipart],dRName_b,"lep");
360  leg_a->AddEntry(gr_theta_a[ipart],dRName_b,"lep");
361  }// END loop over rotaion scale
362 
363  mgr_theta_b->Draw("AP");
364  leg_b->Draw();
365  mgr_theta_b->SetTitle("Before");
366  mgr_theta_b->GetXaxis()->SetTitle("#Delta_{t}, #mum");
367  mgr_theta_b->GetYaxis()->SetTitle("#theta_{mean}, #murad");
368  mgr_theta_b->GetHistogram()->SetMaximum(1.15*max_theta_mean_b);
369  mgr_theta_b->GetHistogram()->SetMinimum(0.85*min_theta_mean_b);
370  c1.Print(resname_pdf_o); //write canvas and keep the ps file open
371  c1.Clear();
372 
373 
374  mgr_theta->Draw("AP");
375  leg_a->Draw();
376  mgr_theta->SetTitle("After");
377  mgr_theta->GetXaxis()->SetTitle("#Delta_{t}, #mum");
378  mgr_theta->GetYaxis()->SetTitle("#theta_{mean}, #murad");
379  mgr_theta->GetHistogram()->SetMaximum(1.15*max_theta_mean_a);
380  mgr_theta->GetHistogram()->SetMinimum(0.85*min_theta_mean_a);
381 
382  c1.Print(resname_pdf_o); //write canvas and keep the ps file open
383  c1.Clear();
385  TMultiGraph *mgr_theta_rms = new TMultiGraph();
386  TMultiGraph *mgr_theta_b_rms = new TMultiGraph();
387  for(int ipart=0;ipart<nParDa;ipart++){// loop over rotaion scale
388  gr_theta_b[ipart] = new TGraphErrors(nParDt,v_Dt,theta_rms_b[ipart],0,0);
389  gr_theta_b[ipart]->SetMarkerStyle(20+ipart);
390  // gr_theta_b[ipart]->SetMarkerColor(kGreen-3);
391  gr_theta_b[ipart]->SetMarkerColor(colors[ipart]);
392  gr_theta_b[ipart]->SetLineColor(colors[ipart]);
393  gr_theta_b[ipart]->SetMarkerSize(1.7+ipart*0.3);
394  gr_theta_a[ipart] = new TGraphErrors(nParDt,v_Dt,theta_rms_a[ipart],0,0);
395  gr_theta_a[ipart]->SetMarkerStyle(20+ipart);
396  // gr_theta_a[ipart]->SetMarkerColor(kOrange+7);
397  gr_theta_a[ipart]->SetMarkerColor(colors_a[ipart]);
398  gr_theta_a[ipart]->SetLineColor(colors_a[ipart]);
399  gr_theta_a[ipart]->SetMarkerSize(1.7+ipart*0.3);
400  mgr_theta_b_rms->Add(gr_theta_b[ipart]);
401  mgr_theta_rms->Add(gr_theta_a[ipart]);
402  if(ipart==0){
403  gr_theta_r[ipart] = new TGraphErrors(nParDt,v_Dt,theta_rms_r[ipart],0,0);
404  gr_theta_r[ipart]->SetMarkerStyle(20+ipart);
405  gr_theta_r[ipart]->SetMarkerColor(kGray+3);
406  gr_theta_r[ipart]->SetMarkerSize(2.7);
407  mgr_theta_b_rms->Add(gr_theta_r[ipart]);
408  mgr_theta_rms->Add(gr_theta_r[ipart]);
409  }
410  }// END loop over rotaion scale
411 
412  mgr_theta_b_rms->Draw("AP");
413  leg_b->Draw();
414  mgr_theta_b_rms->GetXaxis()->SetTitle("#Delta_{t}, #mum");
415  mgr_theta_b_rms->GetYaxis()->SetTitle("#theta_{rms}, #murad");
416  mgr_theta_b_rms->GetHistogram()->SetMaximum(1.15*max_theta_rms_b);
417  mgr_theta_b_rms->GetHistogram()->SetMinimum(0.85*min_theta_rms_b);
418  mgr_theta_b_rms->SetTitle("Before");
419  c1.Print(resname_pdf_o); //write canvas and keep the ps file open
420  c1.Clear();
421 
422 
423  mgr_theta_rms->Draw("AP");
424  leg_a->Draw();
425  mgr_theta_rms->GetXaxis()->SetTitle("#Delta_{t}, #mum");
426  mgr_theta_rms->GetYaxis()->SetTitle("#theta_{rms}, #murad");
427  mgr_theta_rms->GetHistogram()->SetMaximum(1.15*max_theta_rms_a);
428  mgr_theta_rms->GetHistogram()->SetMinimum(0.85*min_theta_rms_a);
429  mgr_theta_rms->SetTitle("After");
430  c1.Print(resname_pdf_o); //write canvas and keep the ps file open
431  c1.Clear();
432 
433  //put together missalignment consts results
434  TGraphErrors *gr_mis_b[6][nParDa];
435  TGraphErrors *gr_mis_a[6][nParDa];
436  TMultiGraph *mgr_mis[6];
437  TMultiGraph *mgr_mis_b[6];
438  for(int ialc=0;ialc<6;ialc++){
439  mgr_mis[ialc] = new TMultiGraph();
440  mgr_mis_b[ialc] = new TMultiGraph();
441  }
442  for(int ipart=0;ipart<nParDa;ipart++){// loop over rotaion scale
443  for(int ialc=0;ialc<6;ialc++){
444  gr_mis_b[ialc][ipart] = new TGraphErrors(nParDt,v_Dt,mis_v_b[ipart][ialc],0,mis_b[ipart][ialc]);
445  gr_mis_b[ialc][ipart]->SetMarkerStyle(20+ipart);
446  gr_mis_b[ialc][ipart]->SetMarkerColor(colors[ipart]);
447  gr_mis_b[ialc][ipart]->SetLineColor(colors[ipart]);
448  gr_mis_b[ialc][ipart]->SetMarkerSize(1.7+ipart*0.3);
449  gr_mis_a[ialc][ipart] = new TGraphErrors(nParDt,v_Dt,mis_v_a[ipart][ialc],0,mis_a[ipart][ialc]);
450  gr_mis_a[ialc][ipart]->SetMarkerStyle(20+ipart);
451  gr_mis_a[ialc][ipart]->SetMarkerColor(colors_a[ipart]);
452  gr_mis_a[ialc][ipart]->SetMarkerSize(1.7+ipart*0.3);
453  gr_mis_a[ialc][ipart]->SetLineColor(colors_a[ipart]);
454  mgr_mis_b[ialc]->Add(gr_mis_b[ialc][ipart]);
455  mgr_mis[ialc]->Add(gr_mis_a[ialc][ipart]);
456  }
457  }// END loop over rotaion scale
458  for(int ialc=0;ialc<6;ialc++){
459  if(ialc<2 || ialc==5){
460  mgr_mis_b[ialc]->Draw("AP");
461  leg_b->Draw();
462  mgr_mis_b[ialc]->GetXaxis()->SetTitle("#Delta_{t}, #mum");
463  mgr_mis_b[ialc]->GetHistogram()->SetMaximum(1200.);
464  mgr_mis_b[ialc]->GetHistogram()->SetMinimum(-1200.);
465  if(ialc==5){
466  mgr_mis_b[ialc]->GetHistogram()->SetMaximum(10.);
467  mgr_mis_b[ialc]->GetHistogram()->SetMinimum(-10.);
468  }
469  mgr_mis_b[ialc]->SetTitle("Before");
470  if(ialc==0) mgr_mis_b[ialc]->GetYaxis()->SetTitle("#Delta_{x}, #mum");
471  if(ialc==1) mgr_mis_b[ialc]->GetYaxis()->SetTitle("#Delta_{y}, #mum");
472  if(ialc==2) mgr_mis_b[ialc]->GetYaxis()->SetTitle("#Delta_{z}, #mum");
473  if(ialc==3) mgr_mis_b[ialc]->GetYaxis()->SetTitle("#Delta_{#alpha}, mrad");
474  if(ialc==4) mgr_mis_b[ialc]->GetYaxis()->SetTitle("#Delta_{#beta}, mrad");
475  if(ialc==5) mgr_mis_b[ialc]->GetYaxis()->SetTitle("#Delta_{#gamma}, mrad");
476  c1.Print(resname_pdf_o); //write canvas and keep the file open
477  c1.Clear();
478 
479  mgr_mis[ialc]->Draw("AP");
480  leg_a->Draw();
481  mgr_mis[ialc]->GetXaxis()->SetTitle("#Delta_{t}, #mum");
482  mgr_mis[ialc]->GetHistogram()->SetMaximum(10.);
483  mgr_mis[ialc]->GetHistogram()->SetMinimum(-10.);
484  if(ialc==5){
485  mgr_mis[ialc]->GetHistogram()->SetMaximum(5.);
486  mgr_mis[ialc]->GetHistogram()->SetMinimum(-5.);
487  }
488  mgr_mis[ialc]->SetTitle("After");
489  if(ialc==0) mgr_mis[ialc]->GetYaxis()->SetTitle("#Delta_{x}, #mum");
490  if(ialc==1) mgr_mis[ialc]->GetYaxis()->SetTitle("#Delta_{y}, #mum");
491  if(ialc==2) mgr_mis[ialc]->GetYaxis()->SetTitle("#Delta_{z}, #mum");
492  if(ialc==3) mgr_mis[ialc]->GetYaxis()->SetTitle("#Delta_{#alpha}, mrad");
493  if(ialc==4) mgr_mis[ialc]->GetYaxis()->SetTitle("#Delta_{#beta}, mrad");
494  if(ialc==5) mgr_mis[ialc]->GetYaxis()->SetTitle("#Delta_{#gamma}, mrad");
495  c1.Print(resname_pdf_o); //write canvas and keep the file open
496  c1.Clear();
497 
498 
499  }
500  }
501 
502  //c1.Print(resname_pdf_c); //write canvas and close the file
503 TLegend *leg2 = new TLegend(0.78,0.58,0.98,0.98);
504  leg2->SetFillColor(0);
505 
506  TMultiGraph *mgr_stat = new TMultiGraph();
507  TMultiGraph *mgr_stat_kn = new TMultiGraph();
508  TGraphErrors *grstatBef[nParDa], *grstatAft[nParDa];
509  TGraphErrors *grstatKnossos[nParDa];
510  TGraphErrors *grstatKnossos0[nParDa];
511  for(int ipart=0;ipart<nParDa;ipart++){// loop over rotaion scale
512  grstatBef[ipart] = new TGraphErrors(nParDt,v_Dt,TrksBef[ipart],0,0);
513  grstatBef[ipart]->SetMarkerStyle(20+ipart);
514  grstatBef[ipart]->SetMarkerColor(colors[ipart]);
515  grstatBef[ipart]->SetMarkerSize(1.7+ipart*0.3);
516 
517  grstatKnossos0[ipart] = new TGraphErrors(nParDt,v_Dt,TrksKnossos0[ipart],0,errTrksKnossos0[ipart]);
518  grstatKnossos0[ipart]->SetMarkerStyle(20+ipart);
519  grstatKnossos0[ipart]->SetMarkerColor(colors[ipart]);
520  grstatKnossos0[ipart]->SetLineColor(colors[ipart]);
521  grstatKnossos0[ipart]->SetMarkerSize(1.7+ipart*0.3);
522  mgr_stat_kn->Add(grstatKnossos0[ipart]);
523  grstatKnossos[ipart] = new TGraphErrors(nParDt,v_Dt,TrksKnossos[ipart],0,errTrksKnossos[ipart]);
524  grstatKnossos[ipart]->SetMarkerStyle(20+ipart);
525  grstatKnossos[ipart]->SetMarkerColor(colors_a[ipart]);
526  grstatKnossos[ipart]->SetLineColor(colors_a[ipart]);
527  grstatKnossos[ipart]->SetMarkerSize(1.7+ipart*0.3);
528  TString dRName = "#Delta_{r} = ";
529  dRName +=v_Da[ipart];
530  TString dRName_b = dRName+ " (input)";
531  TString dRName_a = dRName+ " (last iter)";
532  leg2->AddEntry(grstatKnossos0[ipart],dRName_b,"lep");
533  leg2->AddEntry(grstatKnossos[ipart],dRName_a,"lep");
534 
535  mgr_stat_kn->Add(grstatKnossos[ipart]);
536  grstatAft[ipart] = new TGraphErrors(nParDt,v_Dt,TrksAft[ipart],0,0);
537  grstatAft[ipart]->SetMarkerStyle(20+ipart);
538  grstatAft[ipart]->SetMarkerSize(1.7+ipart*0.3);
539  grstatAft[ipart]->SetMarkerColor(kOrange+7);
540  mgr_stat->Add(grstatBef[ipart]);
541  mgr_stat->Add(grstatAft[ipart]);
542  }// END loop over rotaion scale
543  // mgr_stat->Draw("AP");
544  // mgr_stat->GetXaxis()->SetTitle("#Delta_{t}, #mum");
545  // mgr_stat->GetYaxis()->SetTitle("N_{REC}");
546  // mgr_stat->GetHistogram()->SetMaximum(1e5);
547  // mgr_stat->GetHistogram()->SetMinimum(0);
548  // leg_b->Draw();
549  // c1.Print(resname_pdf_o); //write canvas and keep the file open
550  c1.Clear();
551  mgr_stat_kn->Draw("AP");
552  mgr_stat_kn->SetTitle("#trks used in Millepede (av. per sector)");
553  mgr_stat_kn->GetXaxis()->SetTitle("#Delta_{t}, #mum");
554  mgr_stat_kn->GetYaxis()->SetTitle("N_{REC}");
555  leg2->Draw();
556  c1.Print(resname_pdf_c); //write canvas and close the file
557  //
558  // mgr_stat->GetXaxis()->SetTitle("Number of sim. trks");
559  //
560  // //mgr_stat->SetTitle("Average number of rec. trks (empty = before Knossos; filled = after Knossos)");
561  // c1.Print(resname_pdf_o); //write canvas and keep the file open
562  // c1.Clear();
563  // TGraphErrors *grstatDiff = new TGraphErrors(nS,TrksSim,av_TrksDiff,0,avEr_TrksDiff);
564  // grstatDiff->SetMarkerStyle(22);
565  // grstatDiff->SetMarkerSize(2.5);
566  // grstatDiff->Draw("ALP");
567  // grstatDiff->GetXaxis()->SetTitle("Number of sim. trks");
568  // grstatDiff->GetYaxis()->SetTitle("(N^{ after}_{REC} - N^{ before}_{REC})/N_{SIM}, %");
569  // // grstatDiff->SetTitle("Diff number of rec. trks (after - before), %");
570  // c1.Print(resname_pdf_c); //write canvas and close ps file
571  // c1.Close();
572  // TString out = resname+".root";
573  // TFile *f = new TFile(out,"RECREATE");
574  // // for (int g=0;g<6;g++){
575  // // gr_mis_b[g]->Write();
576  // // gr_mis_a[g]->Write();
577  // // mgr_mis[g]->Write();
578  // // }
579  // gr_theta_b->Write();
580  // gr_theta_r->Write();
581  // gr_theta_a->Write();
582  // mgr_theta->Write();
583  // gr_theta_rms_b->Write();
584  // gr_theta_rms_r->Write();
585  // gr_theta_rms_a->Write();
586  // mgr_theta_rms->Write();
587 
588  // for(int ialc=0;ialc<6;ialc++){
589  // gr_mis_b[ialc]->Write();
590  // gr_mis_a[ialc]->Write();
591  // mgr_mis[ialc]->Write();
592  // }
593  // mgr_stat->Write();
594  // grstatDiff->Write();
595  // f->Write();
596  // f->Close();
597  // }
598  // }
599  return 0;
600 }
Int_t i
Definition: run_full.C:25
TF1 * f1
Definition: reco_analys2.C:50
TFile * f3
c1
Definition: plot_dirc.C:35
TFile * f2