26 file[0] =
new TFile(
"rootfiles/Tracking_PFG_Run2012A_prompt_minbias_v1_190456-194076_muon_relumi_v55_fittedV0.root");
27 file[1] =
new TFile(
"rootfiles/Tracking_PFG_Run2012B_prompt_minbias_v1_190456-196531_muon_relumi_v55_fittedV0.root");
28 file[2] =
new TFile(
"rootfiles/Tracking_PFG_Run2012C_prompt_minbias_v1_190456-199011_muon_relumi_v55_fittedV0.root");
29 file[3] =
new TFile(
"rootfiles/Tracking_PFG_Run2012C_prompt_minbias_v2_190456-203002_muon_relumi_v57_fittedV0.root");
30 file[4] =
new TFile(
"rootfiles/Tracking_PFG_Run2012D_prompt_minbias_v1_190456-208686_muon_relumi_v57_fittedV0.root");
33 sprintf(modfull,
"%s%s",
module,postfix);
36 sprintf(labfull,
"%s%s",
label,postfix);
39 TH1D* deltaxsum =
new TH1D(
"deltaxsum",
"(PV-BS) Fitted X position vs run",10,0.,10.);
40 deltaxsum->SetCanExtend(TH1::kAllAxes);
41 TH1D* deltaysum =
new TH1D(
"deltaysum",
"(PV-BS) Fitted Y position vs run",10,0.,10.);
42 deltaysum->SetCanExtend(TH1::kAllAxes);
44 TH1D* deltaxmeansum =
new TH1D(
"deltaxmeansum",
"(PV-BS) Mean X position vs run",10,0.,10.);
45 deltaxmeansum->SetCanExtend(TH1::kAllAxes);
46 TH1D* deltaymeansum =
new TH1D(
"deltaymeansum",
"(PV-BS) Mean Y position vs run",10,0.,10.);
47 deltaymeansum->SetCanExtend(TH1::kAllAxes);
49 TH1D* deltazmeansum =
new TH1D(
"deltazmeansum",
"(PV-BS) Mean Z position vs run",10,0.,10.);
50 deltazmeansum->SetCanExtend(TH1::kAllAxes);
52 TF1* fdoubleg =
new TF1(
"doubleg",
"[1]*exp(-0.5*((x-[0])/[2])**2)+[3]*exp(-0.5*((x-[0])/[4])**2)+[5]*exp(sqrt((x-[0])**2)*[6])",-.2,.2);
53 fdoubleg->SetLineColor(kRed);
54 fdoubleg->SetLineWidth(1);
60 std::vector<unsigned int>
runs = castat.getRunList();
61 std::sort(runs.begin(),runs.end());
65 std::cout <<
"Found " << runs.size() <<
" runs" << std::endl;
67 for(
unsigned int i=0;
i<runs.size();++
i) {
70 sprintf(runlabel,
"%d",runs[
i]);
72 sprintf(runpath,
"run_%d",runs[
i]);
73 castat.setPath(runpath);
76 TH1F* deltax = (TH1F*)castat.getObject(
"deltaxrun");
77 if (deltax && deltax->GetEntries()>0) {
79 fdoubleg->SetParameter(0,deltax->GetMean());
80 fdoubleg->SetParameter(2,deltax->GetRMS());
81 fdoubleg->SetParameter(4,deltax->GetRMS());
82 fdoubleg->SetParameter(1,deltax->GetMaximum());
83 fdoubleg->SetParameter(3,0.1*deltax->GetMaximum());
84 fdoubleg->SetParameter(5,0.1*deltax->GetMaximum());
85 deltax->Fit(fdoubleg,
"q0b",
"",-.05,.05);
87 int bin = deltaxsum->Fill(runlabel,fdoubleg->GetParameter(0));
88 deltaxsum->SetBinError(bin,fdoubleg->GetParError(0));
90 bin = deltaxmeansum->Fill(runlabel,deltax->GetMean());
91 deltaxmeansum->SetBinError(bin,deltax->GetMeanError());
94 TH1F* deltay = (TH1F*)castat.getObject(
"deltayrun");
95 if (deltay && deltay->GetEntries()>0) {
97 fdoubleg->SetParameter(0,deltay->GetMean());
98 fdoubleg->SetParameter(2,deltay->GetRMS());
99 fdoubleg->SetParameter(4,deltay->GetRMS());
100 fdoubleg->SetParameter(1,deltay->GetMaximum());
101 fdoubleg->SetParameter(3,0.1*deltay->GetMaximum());
102 fdoubleg->SetParameter(5,0.1*deltay->GetMaximum());
103 deltay->Fit(fdoubleg,
"q0b",
"",-.05,.05);
104 int bin = deltaysum->Fill(runlabel,fdoubleg->GetParameter(0));
105 deltaysum->SetBinError(bin,fdoubleg->GetParError(0));
107 bin = deltaymeansum->Fill(runlabel,deltay->GetMean());
108 deltaymeansum->SetBinError(bin,deltay->GetMeanError());
111 TH1F* deltaz = (TH1F*)castat.getObject(
"deltazrun");
112 if (deltaz && deltaz->GetEntries()>0) {
114 int bin = deltazmeansum->Fill(runlabel,deltaz->GetMean());
115 deltazmeansum->SetBinError(bin,deltaz->GetMeanError());
128 plotfilename =
"/afs/cern.ch/cms/tracking/output/";
132 plotfilename +=
"/deltaxsum_";
133 plotfilename += labfull;
136 plotfilename +=
".gif";
138 new TCanvas(plotfilename.c_str(),plotfilename.c_str(),1500,500);
140 deltaxsum->SetLineColor(kRed); deltaxsum->SetMarkerColor(kRed);
141 deltaxsum->GetYaxis()->SetRangeUser(-.002,.002);
142 deltaxsum->GetYaxis()->SetTitle(
"#Delta x (cm)");
144 deltaxmeansum->Draw(
"esame");
145 TLegend deltaxleg(.7,.8,.85,.9,
"#Delta(x)");
146 deltaxleg.AddEntry(deltaxsum,
"fitted mean",
"l");
147 deltaxleg.AddEntry(deltaxmeansum,
"aritm. mean",
"l");
149 gPad->Print(plotfilename.c_str());
152 plotfilename =
"/afs/cern.ch/cms/tracking/output/";
156 plotfilename +=
"/deltaysum_";
157 plotfilename += labfull;
160 plotfilename +=
".gif";
162 new TCanvas(plotfilename.c_str(),plotfilename.c_str(),1500,500);
164 deltaysum->SetLineColor(kRed); deltaysum->SetMarkerColor(kRed);
165 deltaysum->GetYaxis()->SetRangeUser(-.002,.002);
166 deltaysum->GetYaxis()->SetTitle(
"#Delta y (cm)");
168 deltaymeansum->Draw(
"esame");
169 TLegend deltayleg(.7,.8,.85,.9,
"#Delta(y)");
170 deltayleg.AddEntry(deltaysum,
"fitted mean",
"l");
171 deltayleg.AddEntry(deltaymeansum,
"aritm. mean",
"l");
173 gPad->Print(plotfilename.c_str());
177 plotfilename =
"/afs/cern.ch/cms/tracking/output/";
181 plotfilename +=
"/deltazsum_";
182 plotfilename += labfull;
185 plotfilename +=
".gif";
187 new TCanvas(plotfilename.c_str(),plotfilename.c_str(),1500,500);
189 deltazmeansum->GetYaxis()->SetRangeUser(-2.,2.);
190 deltazmeansum->GetYaxis()->SetTitle(
"#Delta z (cm)");
191 deltazmeansum->Draw();
192 gPad->Print(plotfilename.c_str());