CMS 3D CMS Logo

Functions
ResolutionPlots.cc File Reference
#include <TH2F.h>

Go to the source code of this file.

Functions

void ResolutionPlots ()
 
void ResolutionPlots_HistoMaker (const std::string &unit)
 

Function Documentation

◆ ResolutionPlots()

void ResolutionPlots ( )

Definition at line 121 of file ResolutionPlots.cc.

References ResolutionPlots_HistoMaker().

121  {
122  ResolutionPlots_HistoMaker("centimetres");
123  ResolutionPlots_HistoMaker("pitch units");
124 }
void ResolutionPlots_HistoMaker(const std::string &unit)

◆ ResolutionPlots_HistoMaker()

void ResolutionPlots_HistoMaker ( const std::string &  unit)

Definition at line 3 of file ResolutionPlots.cc.

References alignmentValidation::c1, gather_cfg::cout, mps_fire::i, dqmiodumpmetadata::n, ESFEDIntegrityTask_cfi::OutputFile, AlCaHLTBitMon_QueryRunRegistry::string, and unit().

Referenced by ResolutionPlots().

3  {
4  int n = 20;
5 
6  float numbers[] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0,
7  11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0};
8 
9  std::string YAxisTitle;
10  std::string HistoTitle;
12  std::string RootFile;
13 
14  float UL[20] = {0};
15  float NonUL[20] = {0};
16 
17  if (unit == "centimetres") {
18  float UL_Array[] = {0.00137706, 0.00142804, 0.00223064, 0.00313546, 0.00528442, 0.00328381, 0.00365521,
19  0.00362465, 0.00404834, 0.00304523, 0.00154502, 0.00103244, 0.0108947, 0,
20  0.0030021, 0.00229157, 0.00244635, 0.00576464, 0.00461518, 0.00464276};
21 
22  float NonUL_Array[] = {0.00211815, 0.00243601, 0.002224, 0.00223777, 0.00284721, 0.00306343, 0.00310523,
23  0.00334504, 0.00333095, 0.00326225, 0.00331065, 0.00237821, 0.00233033, 0,
24  0.00285122, 0.00287095, 0.00226949, 0.0030951, 0.00284769, 0.00285031};
25 
26  for (int i = 0; i < 20; i++) {
27  UL[i] = UL_Array[i];
28  NonUL[i] = NonUL_Array[i];
29  }
30 
31  YAxisTitle = "Resolution [cm]";
32  HistoTitle = "Resolution values for UL and non-UL samples, in centimetres";
33  OutputFile = "ResolutionComparison_ULAndNonUL_Centimetres.pdf";
34  RootFile = "ResolutionComparison_ULAndNonUL_Centimetres.root";
35 
36  } else if (unit == "pitch units") {
37  float UL_Array[] = {0.172131, 0.143091, 0.161787, 0.126722, 0.17909, 0.197285, 0.180396,
38  0.170818, 0.182258, 0.166405, 0.0844271, 0.0846207, 0.0400775, 0,
39  0.120119, 0.171899, 0.160656, 0.18299, 0.177929, 0.178037};
40 
41  float NonUL_Array[] = {0.153758, 0.151801, 0.14859, 0.148245, 0.147986, 0.146962, 0.147919,
42  0.147431, 0.146219, 0.145619, 0.14549, 0.147042, 0.147267, 0,
43  0.146873, 0.153169, 0.151639, 0.146694, 0.148681, 0.148683};
44 
45  for (int i = 0; i < 20; i++) {
46  UL[i] = UL_Array[i];
47  NonUL[i] = NonUL_Array[i];
48  }
49 
50  YAxisTitle = "Resolution [pitch units]";
51  HistoTitle = "Resolution values for the UL and non-UL samples in pitch units";
52  OutputFile = "ResolutionComparison_ULAndNonUL_PitchUnits.pdf";
53  RootFile = "ResolutionComparison_ULAndNonUL_PitchUnits.root";
54 
55  } else {
56  std::cout << "ERROR: Unit must be centimetres or pitch units" << std::endl;
57  }
58 
59  auto c1 = new TCanvas("c1", "c1", 800, 600);
60 
61  TGraph* gr1 = new TGraph(n, numbers, UL);
62  gr1->SetName("UL samples");
63  gr1->SetTitle("UL samples");
64  gr1->SetMarkerStyle(21);
65  gr1->SetDrawOption("AP");
66  gr1->SetLineColor(0);
67  gr1->SetLineWidth(4);
68  gr1->SetFillStyle(0);
69 
70  TGraph* gr2 = new TGraph(n, numbers, NonUL);
71  gr2->SetName("Non-UL samples");
72  gr2->SetTitle("Non-UL samples");
73  gr2->SetMarkerStyle(22);
74  gr2->SetMarkerColor(2);
75  gr2->SetDrawOption("P");
76  gr2->SetLineColor(0);
77  gr2->SetLineWidth(0);
78  gr2->SetFillStyle(0);
79 
80  TMultiGraph* mg = new TMultiGraph();
81  mg->Add(gr1);
82  mg->Add(gr2);
83  mg->GetHistogram()->SetTitle(HistoTitle.c_str());
84  mg->GetHistogram()->SetTitleOffset(0.05);
85  mg->GetHistogram()->GetXaxis()->SetTitle("Region");
86  mg->GetHistogram()->GetXaxis()->SetTitleOffset(2.5);
87  c1->SetBottomMargin(0.2);
88 
89  mg->GetHistogram()->GetXaxis()->SetBinLabel(1.0, "TIB L1");
90  mg->GetHistogram()->GetXaxis()->SetBinLabel(mg->GetHistogram()->GetXaxis()->FindBin(2.0), "TIB L2");
91  mg->GetHistogram()->GetXaxis()->SetBinLabel(mg->GetHistogram()->GetXaxis()->FindBin(3.0), "TIB L3");
92  mg->GetHistogram()->GetXaxis()->SetBinLabel(mg->GetHistogram()->GetXaxis()->FindBin(4.0), "TIB L4");
93  mg->GetHistogram()->GetXaxis()->SetBinLabel(mg->GetHistogram()->GetXaxis()->FindBin(5.0), "Side TID");
94  mg->GetHistogram()->GetXaxis()->SetBinLabel(mg->GetHistogram()->GetXaxis()->FindBin(6.0), "Wheel TID");
95  mg->GetHistogram()->GetXaxis()->SetBinLabel(mg->GetHistogram()->GetXaxis()->FindBin(7.0), "Ring TID");
96  mg->GetHistogram()->GetXaxis()->SetBinLabel(mg->GetHistogram()->GetXaxis()->FindBin(8.0), "TOB L1");
97  mg->GetHistogram()->GetXaxis()->SetBinLabel(mg->GetHistogram()->GetXaxis()->FindBin(9.0), "TOB L2");
98  mg->GetHistogram()->GetXaxis()->SetBinLabel(mg->GetHistogram()->GetXaxis()->FindBin(10.0), "TOB L3");
99  mg->GetHistogram()->GetXaxis()->SetBinLabel(mg->GetHistogram()->GetXaxis()->FindBin(11.0), "TOB L4");
100  mg->GetHistogram()->GetXaxis()->SetBinLabel(mg->GetHistogram()->GetXaxis()->FindBin(12.0), "TOB L5");
101  mg->GetHistogram()->GetXaxis()->SetBinLabel(mg->GetHistogram()->GetXaxis()->FindBin(13.0), "TOB L6");
102  mg->GetHistogram()->GetXaxis()->SetBinLabel(mg->GetHistogram()->GetXaxis()->FindBin(14.0), "Side TEC");
103  mg->GetHistogram()->GetXaxis()->SetBinLabel(mg->GetHistogram()->GetXaxis()->FindBin(15.0), "Wheel TEC");
104  mg->GetHistogram()->GetXaxis()->SetBinLabel(mg->GetHistogram()->GetXaxis()->FindBin(16.0), "Ring TEC");
105  mg->GetHistogram()->GetXaxis()->SetBinLabel(mg->GetHistogram()->GetXaxis()->FindBin(17.0), "TIB (All)");
106  mg->GetHistogram()->GetXaxis()->SetBinLabel(mg->GetHistogram()->GetXaxis()->FindBin(18.0), "TOB (All)");
107  mg->GetHistogram()->GetXaxis()->SetBinLabel(mg->GetHistogram()->GetXaxis()->FindBin(19.0), "TID (All)");
108  mg->GetHistogram()->GetXaxis()->SetBinLabel(100, "TEC (All)");
109 
110  mg->GetHistogram()->GetYaxis()->SetTitle(YAxisTitle.c_str());
111  mg->Draw("ALP");
112  c1->BuildLegend();
113  mg->SaveAs(OutputFile.c_str());
114 
115  TFile* output = new TFile(RootFile.c_str(), "RECREATE");
116  output->cd();
117  mg->Write();
118  output->Close();
119 }
Basic3DVector unit() const
Definition: output.py:1