14 #include "TProfile2D.h" 25 file[0] =
new TFile(
"rootfiles/Tracking_PFG_Run2012A_prompt_minbias_v1_190456-194076_muon_relumi_v55_fittedV0.root");
26 file[1] =
new TFile(
"rootfiles/Tracking_PFG_Run2012B_prompt_minbias_v1_190456-196531_muon_relumi_v55_fittedV0.root");
27 file[2] =
new TFile(
"rootfiles/Tracking_PFG_Run2012C_prompt_minbias_v1_190456-199011_muon_relumi_v55_fittedV0.root");
28 file[3] =
new TFile(
"rootfiles/Tracking_PFG_Run2012C_prompt_minbias_v2_190456-203002_muon_relumi_v57_fittedV0.root");
29 file[4] =
new TFile(
"rootfiles/Tracking_PFG_Run2012D_prompt_minbias_v1_190456-208686_muon_relumi_v57_fittedV0.root");
38 TH1D* deltaxsum =
new TH1D(
"deltaxsum",
"(PV-BS) Fitted X position vs run", 10, 0., 10.);
39 deltaxsum->SetCanExtend(TH1::kAllAxes);
40 TH1D* deltaysum =
new TH1D(
"deltaysum",
"(PV-BS) Fitted Y position vs run", 10, 0., 10.);
41 deltaysum->SetCanExtend(TH1::kAllAxes);
43 TH1D* deltaxmeansum =
new TH1D(
"deltaxmeansum",
"(PV-BS) Mean X position vs run", 10, 0., 10.);
44 deltaxmeansum->SetCanExtend(TH1::kAllAxes);
45 TH1D* deltaymeansum =
new TH1D(
"deltaymeansum",
"(PV-BS) Mean Y position vs run", 10, 0., 10.);
46 deltaymeansum->SetCanExtend(TH1::kAllAxes);
48 TH1D* deltazmeansum =
new TH1D(
"deltazmeansum",
"(PV-BS) Mean Z position vs run", 10, 0., 10.);
49 deltazmeansum->SetCanExtend(TH1::kAllAxes);
51 TF1* fdoubleg =
new TF1(
"doubleg",
52 "[1]*exp(-0.5*((x-[0])/[2])**2)+[3]*exp(-0.5*((x-[0])/[4])**2)+[5]*exp(sqrt((x-[0])**2)*[6])",
55 fdoubleg->SetLineColor(kRed);
56 fdoubleg->SetLineWidth(1);
67 for (
unsigned int i = 0;
i <
runs.size(); ++
i) {
69 sprintf(runlabel,
"%d",
runs[
i]);
71 sprintf(runpath,
"run_%d",
runs[
i]);
75 TH1F* deltax = (TH1F*)castat.
getObject(
"deltaxrun");
76 if (deltax && deltax->GetEntries() > 0) {
77 fdoubleg->SetParameter(0, deltax->GetMean());
78 fdoubleg->SetParameter(2, deltax->GetRMS());
79 fdoubleg->SetParameter(4, deltax->GetRMS());
80 fdoubleg->SetParameter(1, deltax->GetMaximum());
81 fdoubleg->SetParameter(3, 0.1 * deltax->GetMaximum());
82 fdoubleg->SetParameter(5, 0.1 * deltax->GetMaximum());
83 deltax->Fit(fdoubleg,
"q0b",
"", -.05, .05);
85 int bin = deltaxsum->Fill(runlabel, fdoubleg->GetParameter(0));
86 deltaxsum->SetBinError(
bin, fdoubleg->GetParError(0));
88 bin = deltaxmeansum->Fill(runlabel, deltax->GetMean());
89 deltaxmeansum->SetBinError(
bin, deltax->GetMeanError());
91 TH1F* deltay = (TH1F*)castat.
getObject(
"deltayrun");
92 if (deltay && deltay->GetEntries() > 0) {
93 fdoubleg->SetParameter(0, deltay->GetMean());
94 fdoubleg->SetParameter(2, deltay->GetRMS());
95 fdoubleg->SetParameter(4, deltay->GetRMS());
96 fdoubleg->SetParameter(1, deltay->GetMaximum());
97 fdoubleg->SetParameter(3, 0.1 * deltay->GetMaximum());
98 fdoubleg->SetParameter(5, 0.1 * deltay->GetMaximum());
99 deltay->Fit(fdoubleg,
"q0b",
"", -.05, .05);
100 int bin = deltaysum->Fill(runlabel, fdoubleg->GetParameter(0));
101 deltaysum->SetBinError(
bin, fdoubleg->GetParError(0));
103 bin = deltaymeansum->Fill(runlabel, deltay->GetMean());
104 deltaymeansum->SetBinError(
bin, deltay->GetMeanError());
106 TH1F* deltaz = (TH1F*)castat.
getObject(
"deltazrun");
107 if (deltaz && deltaz->GetEntries() > 0) {
108 int bin = deltazmeansum->Fill(runlabel, deltaz->GetMean());
109 deltazmeansum->SetBinError(
bin, deltaz->GetMeanError());
117 plotfilename =
"/afs/cern.ch/cms/tracking/output/";
121 plotfilename +=
"/deltaxsum_";
122 plotfilename += labfull;
125 plotfilename +=
".gif";
127 new TCanvas(plotfilename.c_str(), plotfilename.c_str(), 1500, 500);
129 deltaxsum->SetLineColor(kRed);
130 deltaxsum->SetMarkerColor(kRed);
131 deltaxsum->GetYaxis()->SetRangeUser(-.002, .002);
132 deltaxsum->GetYaxis()->SetTitle(
"#Delta x (cm)");
134 deltaxmeansum->Draw(
"esame");
135 TLegend deltaxleg(.7, .8, .85, .9,
"#Delta(x)");
136 deltaxleg.AddEntry(deltaxsum,
"fitted mean",
"l");
137 deltaxleg.AddEntry(deltaxmeansum,
"aritm. mean",
"l");
139 gPad->Print(plotfilename.c_str());
142 plotfilename =
"/afs/cern.ch/cms/tracking/output/";
146 plotfilename +=
"/deltaysum_";
147 plotfilename += labfull;
150 plotfilename +=
".gif";
152 new TCanvas(plotfilename.c_str(), plotfilename.c_str(), 1500, 500);
154 deltaysum->SetLineColor(kRed);
155 deltaysum->SetMarkerColor(kRed);
156 deltaysum->GetYaxis()->SetRangeUser(-.002, .002);
157 deltaysum->GetYaxis()->SetTitle(
"#Delta y (cm)");
159 deltaymeansum->Draw(
"esame");
160 TLegend deltayleg(.7, .8, .85, .9,
"#Delta(y)");
161 deltayleg.AddEntry(deltaysum,
"fitted mean",
"l");
162 deltayleg.AddEntry(deltaymeansum,
"aritm. mean",
"l");
164 gPad->Print(plotfilename.c_str());
167 plotfilename =
"/afs/cern.ch/cms/tracking/output/";
171 plotfilename +=
"/deltazsum_";
172 plotfilename += labfull;
175 plotfilename +=
".gif";
177 new TCanvas(plotfilename.c_str(), plotfilename.c_str(), 1500, 500);
179 deltazmeansum->GetYaxis()->SetRangeUser(-2., 2.);
180 deltazmeansum->GetYaxis()->SetTitle(
"#Delta z (cm)");
181 deltazmeansum->Draw();
182 gPad->Print(plotfilename.c_str());
void multibsvspvplots(const char *module, const char *label, const char *postfix, const char *)
TObject * getObject(const char *name) const
void setPath(const char *path)
const std::vector< unsigned int > getRunList() const