15   double TrksSim[nS]={10000, 100000, 200000, 300000, 500000, 700000, 1000000};
 
   19   TString resname= pathG+
"/ResultsTOTALSummary_";
 
   25   TString resname_pdf = resname+
".pdf";
 
   26   TString resname_pdf_o = resname_pdf+
"(";
 
   27   TString resname_pdf_c = resname_pdf+
")";
 
   32   double theta_mean_b[nS], theta_mean_a[nS], theta_mean_r[nS];
 
   33   double theta_rms_b[nS], theta_rms_a[nS], theta_rms_r[nS];
 
   36   for(
int i=0;
i<nS;
i++){
 
   39     TString path = pathG+
"/results/";
 
   48   TString nameresb0 = path + 
"/hitsRes_before_alignment_sector0.root";
 
   49   TString nameresb1 = path + 
"/hitsRes_before_alignment_sector1.root";
 
   50   TString nameresb2 = path + 
"/hitsRes_before_alignment_sector2.root";
 
   51   TString nameresb3 = path + 
"/hitsRes_before_alignment_sector3.root";
 
   52   TString nameresb4 = path + 
"/hitsRes_before_alignment_sector4.root";
 
   53   TString nameresb5 = path + 
"/hitsRes_before_alignment_sector5.root";
 
   54   TString nameresb6 = path + 
"/hitsRes_before_alignment_sector6.root";
 
   55   TString nameresb7 = path + 
"/hitsRes_before_alignment_sector7.root";
 
   56   TString nameresb8 = path + 
"/hitsRes_before_alignment_sector8.root";
 
   57   TString nameresb9 = path + 
"/hitsRes_before_alignment_sector9.root";
 
   58   TFile *fresb0 = 
new TFile(nameresb0,
"READ");
 
   59   if (fresb0->IsZombie()) {
 
   60     std::cout << 
"!!! Error opening file " <<nameresb0<< std::endl;
 
   63   TFile *fresb1 = 
new TFile(nameresb1,
"READ");
 
   64   if (fresb1->IsZombie()) {
 
   65     std::cout << 
"!!! Error opening file " <<nameresb1<< std::endl;
 
   68  TFile *fresb2 = 
new TFile(nameresb2,
"READ");
 
   69   if (fresb2->IsZombie()) {
 
   70     std::cout << 
"!!! Error opening file " <<nameresb2<< std::endl;
 
   73  TFile *fresb3 = 
new TFile(nameresb3,
"READ");
 
   74   if (fresb3->IsZombie()) {
 
   75     std::cout << 
"!!! Error opening file " <<nameresb3<< std::endl;
 
   78   TFile *fresb4 = 
new TFile(nameresb4,
"READ");
 
   79   if (fresb4->IsZombie()) {
 
   80     std::cout << 
"!!! Error opening file " <<nameresb4<< std::endl;
 
   83  TFile *fresb5 = 
new TFile(nameresb5,
"READ");
 
   84   if (fresb5->IsZombie()) {
 
   85     std::cout << 
"!!! Error opening file " <<nameresb5<< std::endl;
 
   88  TFile *fresb6 = 
new TFile(nameresb5,
"READ");
 
   89   if (fresb6->IsZombie()) {
 
   90     std::cout << 
"!!! Error opening file " <<nameresb6<< std::endl;
 
   93   TFile *fresb7 = 
new TFile(nameresb7,
"READ");
 
   94   if (fresb7->IsZombie()) {
 
   95     std::cout << 
"!!! Error opening file " <<nameresb7<< std::endl;
 
   98  TFile *fresb8 = 
new TFile(nameresb8,
"READ");
 
   99   if (fresb8->IsZombie()) {
 
  100     std::cout << 
"!!! Error opening file " <<nameresb8<< std::endl;
 
  103   TFile *fresb9 = 
new TFile(nameresb9,
"READ");
 
  104   if (fresb9->IsZombie()) {
 
  105     std::cout << 
"!!! Error opening file " <<nameresb9<< std::endl;
 
  109   TNtuple* hntuple0 = (TNtuple*)fresb0->Get(
"nhits");
 
  110    trksCur+= 0.25*(hntuple0->GetEntries());
 
  111   TNtuple* hntuple1 = (TNtuple*)fresb1->Get(
"nhits");
 
  112   trksCur+= 0.25*(hntuple1->GetEntries());
 
  113   TNtuple* hntuple2 = (TNtuple*)fresb2->Get(
"nhits");
 
  114   trksCur+= 0.25*(hntuple2->GetEntries());
 
  115   TNtuple* hntuple3 = (TNtuple*)fresb3->Get(
"nhits");
 
  116   trksCur+= 0.25*(hntuple3->GetEntries());
 
  117   TNtuple* hntuple4 = (TNtuple*)fresb4->Get(
"nhits");
 
  118   trksCur+= 0.25*(hntuple4->GetEntries());
 
  119   TNtuple* hntuple5 = (TNtuple*)fresb5->Get(
"nhits");
 
  120   trksCur+= 0.25*(hntuple5->GetEntries());
 
  121   TNtuple* hntuple6 = (TNtuple*)fresb6->Get(
"nhits");
 
  122   trksCur+= 0.25*(hntuple6->GetEntries());
 
  123   TNtuple* hntuple7 = (TNtuple*)fresb7->Get(
"nhits");
 
  124   trksCur+= 0.25*(hntuple7->GetEntries());
 
  125   TNtuple* hntuple8 = (TNtuple*)fresb8->Get(
"nhits");
 
  126   trksCur+= 0.25*(hntuple8->GetEntries());
 
  127   TNtuple* hntuple9 = (TNtuple*)fresb9->Get(
"nhits");
 
  128   trksCur+= 0.25*(hntuple9->GetEntries());
 
  129   Trks[
i] = int(trksCur*0.1);
 
  132     TString namemisc = path + 
"/KnossosResults.root";
 
  133     TFile *fmisc = 
new TFile(namemisc,
"READ");
 
  134     if (fmisc->IsZombie()) {
 
  135       std::cout << 
"!!! Error opening file " <<namemisc<< std::endl;
 
  138     TH2F *hmis_b_0 = (TH2F*)fmisc->Get(
"mis_before_0");
 
  139     mis_b[0][
i] = 1e4*(hmis_b_0->ProjectionY()->GetRMS());
 
  140     TH2F *hmis_b_1 = (TH2F*)fmisc->Get(
"mis_before_1");
 
  141     mis_b[1][
i] = 1e4*(hmis_b_1->ProjectionY()->GetRMS());
 
  142     TH2F *hmis_b_2 = (TH2F*)fmisc->Get(
"mis_before_2");
 
  143     mis_b[2][
i] = 1e4*(hmis_b_2->ProjectionY()->GetRMS());
 
  144     TH2F *hmis_b_3 = (TH2F*)fmisc->Get(
"mis_before_3");
 
  145     mis_b[3][
i] = 1e3*(hmis_b_3->ProjectionY()->GetRMS());
 
  146     TH2F *hmis_b_4 = (TH2F*)fmisc->Get(
"mis_before_4");
 
  147     mis_b[4][
i] = 1e3*(hmis_b_4->ProjectionY()->GetRMS());
 
  148     TH2F *hmis_b_5 = (TH2F*)fmisc->Get(
"mis_before_5");
 
  149     mis_b[5][
i] = 1e3*(hmis_b_5->ProjectionY()->GetRMS());
 
  151     TH2F *hmis_a_0 = (TH2F*)fmisc->Get(
"mis_diff_0");
 
  152     mis_a[0][
i] = 1e4*(hmis_a_0->ProjectionY()->GetRMS());
 
  153     TH2F *hmis_a_1 = (TH2F*)fmisc->Get(
"mis_diff_1");
 
  154     mis_a[1][
i] = 1e4*(hmis_a_1->ProjectionY()->GetRMS());
 
  155     TH2F *hmis_a_2 = (TH2F*)fmisc->Get(
"mis_diff_2");
 
  156     mis_a[2][
i] = 1e4*(hmis_a_2->ProjectionY()->GetRMS());
 
  157     TH2F *hmis_a_3 = (TH2F*)fmisc->Get(
"mis_diff_3");
 
  158     mis_a[3][
i] = 1e3*(hmis_a_3->ProjectionY()->GetRMS());
 
  159     TH2F *hmis_a_4 = (TH2F*)fmisc->Get(
"mis_diff_4");
 
  160     mis_a[4][
i] = 1e3*(hmis_a_4->ProjectionY()->GetRMS());
 
  161     TH2F *hmis_a_5 = (TH2F*)fmisc->Get(
"mis_diff_5");
 
  162     mis_a[5][
i] = 1e3*(hmis_a_5->ProjectionY()->GetRMS());
 
  167   TString name1 = path + 
"/Lumi_out_MC_and_REC_trks_matches_with_IDs0_dr_";
 
  171   name1+=
"_before.root";
 
  173   TString name2 = path + 
"/Lumi_out_MC_and_REC_trks_matches_with_IDs0_dr_";
 
  177   name2+=
"_after.root";
 
  181   name3+=
"events/Lumi_out_MC_and_REC_trks_matches_with_IDs0_dr_0_da_0_before.root";
 
  188   TFile *
f1 = 
new TFile(name1,
"READ");
 
  189   if (f1->IsZombie()) {
 
  190     std::cout << 
"!!! Error opening file " <<name1<< std::endl;
 
  194   hbefore = (TH1F*)f1->Get(
"hResTheta");
 
  195   hbefore->SetName(
"hResThetaBefore");
 
  196   hbefore->SetTitle(
"#theta resolution");
 
  198   TF1 *funrth_b = 
new TF1(
"fitrth_b",
"gaus",-0.01,0.01);
 
  199   funrth_b->SetParameters(100,0,3e-3);
 
  200   funrth_b->SetParNames(
"Constant",
"Mean",
"Sigma");
 
  201   hbefore->Fit(funrth_b);
 
  202   theta_mean_b[
i]  = 1e6*(funrth_b->GetParameter(
"Mean"));
 
  203   theta_rms_b[
i]  = 1e6*(funrth_b->GetParameter(
"Sigma"));
 
  206   TFile *
f2 = 
new TFile(name2,
"READ");
 
  207   if (f2->IsZombie()) {
 
  208     std::cout << 
"!!! Error opening file " <<name2<< std::endl;
 
  212   hafter = (TH1F*)f2->Get(
"hResTheta");
 
  213   hafter->SetName(
"hResThetaAfter");
 
  214   hafter->SetTitle(
"#theta resolution");
 
  216   TF1 *funrth_a = 
new TF1(
"fitrth_a",
"gaus",-0.01,0.01);
 
  217   funrth_a->SetParameters(100,0,3e-3);
 
  218   funrth_a->SetParNames(
"Constant",
"Mean",
"Sigma");
 
  219   hafter->Fit(funrth_a);
 
  221   theta_mean_a[
i] = 1e6*(funrth_a->GetParameter(
"Mean"));
 
  222   theta_rms_a[
i] = 1e6*(funrth_a->GetParameter(
"Sigma"));
 
  224   TFile *
f3 = 
new TFile(name3,
"READ");
 
  225   if (f3->IsZombie()) {
 
  226     std::cout << 
"!!! Error opening file " <<name2<< std::endl;
 
  230   hrefer = (TH1F*)f3->Get(
"hResTheta");
 
  231   hrefer->SetName(
"hResThetaRef");
 
  232   hrefer->SetTitle(
"#theta resolution");
 
  234   TF1 *funrth_r = 
new TF1(
"fitrth_r",
"gaus",-0.01,0.01);
 
  235   funrth_r->SetParameters(100,0,3e-3);
 
  236   funrth_r->SetParNames(
"Constant",
"Mean",
"Sigma");
 
  237   hrefer->Fit(funrth_r);
 
  238   theta_mean_r[
i] = 1e6*(funrth_r->GetParameter(
"Mean"));
 
  239   theta_rms_r[
i] = 1e6*(funrth_r->GetParameter(
"Sigma"));
 
  243   TGraph *grstat = 
new TGraph(nS,TrksSim,Trks);
 
  244   grstat->SetMarkerStyle(22);
 
  245   grstat->SetMarkerSize(2.5);
 
  248   grstat->GetXaxis()->SetTitle(
"Number of sim. trks");
 
  249   grstat->SetTitle(
"Average number of rec. trks per sector (used in Knossos)");
 
  250   c1.Print(resname_pdf_o); 
 
  255   TMultiGraph *mgr_mis[6];
 
  257   for (
int g=0;
g<6;
g++){
 
  258     gr_mis_b[
g] = 
new TGraph(nS,Trks,mis_b[
g]);
 
  259     gr_mis_b[
g]->SetMarkerStyle(20);
 
  260     gr_mis_b[
g]->SetMarkerColor(kGreen-3);
 
  261     gr_mis_b[
g]->SetMarkerSize(2.5);
 
  262     gr_mis_a[
g] = 
new TGraph(nS,Trks,mis_a[g]);
 
  263     gr_mis_a[
g]->SetMarkerStyle(29);
 
  264     gr_mis_a[
g]->SetMarkerColor(kOrange+7);
 
  265     gr_mis_a[
g]->SetMarkerSize(2.5);
 
  266     mgr_mis[
g] = 
new TMultiGraph();
 
  267     mgr_mis[
g]->Add(gr_mis_b[g]);
 
  268     mgr_mis[
g]->Add(gr_mis_a[g]);
 
  269     mgr_mis[
g]->Draw(
"AP");
 
  270     mgr_mis[
g]->GetXaxis()->SetTitle(
"Average number of rec. trks per sector");
 
  271     if(g==0) mgr_mis[
g]->GetYaxis()->SetTitle(
"#Delta_{x}, #mum");
 
  272     if(g==1) mgr_mis[
g]->GetYaxis()->SetTitle(
"#Delta_{y}, #mum");
 
  273     if(g==2) mgr_mis[
g]->GetYaxis()->SetTitle(
"#Delta_{z}, #mum");
 
  274     if(g==3) mgr_mis[
g]->GetYaxis()->SetTitle(
"#Delta_{#alpha}, mrad");
 
  275     if(g==4) mgr_mis[
g]->GetYaxis()->SetTitle(
"#Delta_{#beta}, mrad");
 
  276     if(g==5) mgr_mis[
g]->GetYaxis()->SetTitle(
"#Delta_{#gamma}, mrad");
 
  280     if(g<2 || g==5) c1.Print(resname_pdf_o); 
 
  285   TGraph *gr_theta_b = 
new TGraph(nS,Trks, theta_mean_b);
 
  286   gr_theta_b->SetMarkerStyle(20); 
 
  287   gr_theta_b->SetMarkerColor(kGreen-3); 
 
  288   gr_theta_b->SetMarkerSize(2.5); 
 
  289   TGraph *gr_theta_a = 
new TGraph(nS,Trks, theta_mean_a);
 
  290   gr_theta_a->SetMarkerStyle(29); 
 
  291   gr_theta_a->SetMarkerColor(kOrange+7); 
 
  292   gr_theta_a->SetMarkerSize(2.5); 
 
  293   TGraph *gr_theta_r = 
new TGraph(nS,Trks, theta_mean_r);
 
  294   gr_theta_r->SetMarkerStyle(21); 
 
  295   gr_theta_r->SetMarkerColor(15); 
 
  296   gr_theta_r->SetMarkerSize(2.5); 
 
  299   TMultiGraph *mgr_theta = 
new TMultiGraph();
 
  301   mgr_theta->Add(gr_theta_r);
 
  302   mgr_theta->Add(gr_theta_a);
 
  304   mgr_theta->Draw(
"AP");
 
  305   mgr_theta->GetXaxis()->SetTitle(
"Average number of rec. trks per sector");
 
  306   mgr_theta->GetYaxis()->SetTitle(
"#theta_{mean}, #murad");
 
  307  c1.Print(resname_pdf_o); 
 
  310  TGraphErrors *gr_theta_rms_b = 
new TGraphErrors(nS,Trks,theta_rms_b);
 
  311   gr_theta_rms_b->SetMarkerStyle(20); 
 
  312   gr_theta_rms_b->SetMarkerColor(kGreen-3); 
 
  313   gr_theta_rms_b->SetMarkerSize(2.5); 
 
  314   TGraphErrors *gr_theta_rms_a = 
new TGraphErrors(nS,Trks,theta_rms_a);
 
  315   gr_theta_rms_a->SetMarkerStyle(29); 
 
  316   gr_theta_rms_a->SetMarkerColor(kOrange+7); 
 
  317   gr_theta_rms_a->SetMarkerSize(2.5); 
 
  318   TGraphErrors *gr_theta_rms_r = 
new TGraphErrors(nS,Trks,theta_rms_r);
 
  319   gr_theta_rms_r->SetMarkerStyle(21); 
 
  320   gr_theta_rms_r->SetMarkerColor(15); 
 
  321   gr_theta_rms_r->SetMarkerSize(2.5); 
 
  322   TMultiGraph *mgr_theta_rms = 
new TMultiGraph();
 
  324   mgr_theta_rms->Add(gr_theta_rms_r);
 
  325   mgr_theta_rms->Add(gr_theta_rms_a);
 
  326   mgr_theta_rms->Draw(
"AP");
 
  327   mgr_theta_rms->GetXaxis()->SetTitle(
"Average number of rec. trks per sector");
 
  328   mgr_theta_rms->GetYaxis()->SetTitle(
"#theta_{#sigma}, #murad");
 
  329   c1.Print(resname_pdf_c); 
 
  332   TFile *
f = 
new TFile(out,
"RECREATE");
 
  333   for (
int g=0;
g<6;
g++){
 
  334     gr_mis_b[
g]->Write();
 
  335     gr_mis_a[
g]->Write();
 
  342   gr_theta_rms_b->Write();
 
  343   gr_theta_rms_r->Write();
 
  344   gr_theta_rms_a->Write();
 
  345   mgr_theta_rms->Write();
 
int TOTALSummaryAlign(TString pathG="/panda/pandaroot/macro/lmd/tmpOutputAlignDPM/", double tr_sc=200, double rt_sc=3)