9 while (std::getline(ss, item, delim)) {
10 elems.push_back(item);
17 sprintf(command,
"ccdb dump %s:%i:%s",
"/BCAL/LED_monitoring/reference_file", run, variation.Data());
18 FILE* inputPipe = gSystem->OpenPipe(command,
"r");
23 if(fgets(buff,
sizeof(buff), inputPipe) == NULL)
26 if(fgets(buff,
sizeof(buff), inputPipe) == NULL)
30 char url_base[1024], path_name[1024];
31 ss >> url_base >> path_name;
33 gSystem->ClosePipe(inputPipe);
39 ss_url << url_base <<
"/" << path_name;
42 vector<string> tokens;
43 split(path_name,
'/', tokens);
47 ifstream
f(filename.c_str());
49 sprintf(command,
"curl -O %s", ss_url.str().c_str());
50 gSystem->Exec(command);
57 TFile *rootfile =
new TFile(filename.c_str());
69 gStyle->SetPalette(1,0);
70 gStyle->SetOptStat(kFALSE);
72 gStyle->SetPadRightMargin(0.15);
73 gStyle->SetPadLeftMargin(0.15);
74 gStyle->SetPadBottomMargin(0.15);
84 TProfile *run1_high_up_1 = NULL;
85 TProfile *run1_high_up_2 = NULL;
86 TProfile *run1_high_up_3 = NULL;
87 TProfile *run1_high_up_4 = NULL;
89 TProfile *run2_high_up_1 = NULL;
90 TProfile *run2_high_up_2 = NULL;
91 TProfile *run2_high_up_3 = NULL;
92 TProfile *run2_high_up_4 = NULL;
94 TH1D *run1_high_up_1_hist=NULL;
95 TH1D *run1_high_up_2_hist=NULL;
96 TH1D *run1_high_up_3_hist=NULL;
97 TH1D *run1_high_up_4_hist=NULL;
99 TH1D *run2_high_up_1_hist=NULL;
100 TH1D *run2_high_up_2_hist=NULL;
101 TH1D *run2_high_up_3_hist=NULL;
102 TH1D *run2_high_up_4_hist=NULL;
106 printf (
"Histogram input filename=%s\n",infilename.c_str());
107 TFile *run1in =
new TFile(infilename.c_str(),
"read");
111 run1_high_up_1 = (TProfile*)run1in->Get(
"bcalLED/high_bias_up_sector_1_peak_vchannel");
112 run1_high_up_2 = (TProfile*)run1in->Get(
"bcalLED/high_bias_up_sector_2_peak_vchannel");
113 run1_high_up_3 = (TProfile*)run1in->Get(
"bcalLED/high_bias_up_sector_3_peak_vchannel");
114 run1_high_up_4 = (TProfile*)run1in->Get(
"bcalLED/high_bias_up_sector_4_peak_vchannel");
121 run2_high_up_1 = (TProfile*)run2in->Get(
"bcalLED/high_bias_up_sector_1_peak_vchannel");
122 run2_high_up_2 = (TProfile*)run2in->Get(
"bcalLED/high_bias_up_sector_2_peak_vchannel");
123 run2_high_up_3 = (TProfile*)run2in->Get(
"bcalLED/high_bias_up_sector_3_peak_vchannel");
124 run2_high_up_4 = (TProfile*)run2in->Get(
"bcalLED/high_bias_up_sector_4_peak_vchannel");
126 cout <<
"input profiles, projecting into histograms" <<
"\n";
128 run1_high_up_1_hist = run1_high_up_1->ProjectionX(
"run1_high_up_1_projectionx");
129 run1_high_up_2_hist = run1_high_up_2->ProjectionX(
"run1_high_up_2_projectionx");
130 run1_high_up_3_hist = run1_high_up_3->ProjectionX(
"run1_high_up_3_projectionx");
131 run1_high_up_4_hist = run1_high_up_4->ProjectionX(
"run1_high_up_4_projectionx");
133 run2_high_up_1_hist = run2_high_up_1->ProjectionX(
"run2_high_up_1_projectionx");
134 run2_high_up_2_hist = run2_high_up_2->ProjectionX(
"run2_high_up_2_projectionx");
135 run2_high_up_3_hist = run2_high_up_3->ProjectionX(
"run2_high_up_3_projectionx");
136 run2_high_up_4_hist = run2_high_up_4->ProjectionX(
"run2_high_up_4_projectionx");
138 cout <<
"profiles projected into histograms" <<
"\n";
140 run1_high_up_1_hist->SetTitle(
"6.25v Upstream sector 1");
141 run1_high_up_2_hist->SetTitle(
"6.25v Upstream sector 2");
142 run1_high_up_3_hist->SetTitle(
"6.25v Upstream sector 3");
143 run1_high_up_4_hist->SetTitle(
"6.25v Upstream sector 4");
145 cout <<
"Divideing histograms" <<
"\n";
147 run1_high_up_1_hist->Divide(run2_high_up_1_hist);
148 run1_high_up_2_hist->Divide(run2_high_up_2_hist);
149 run1_high_up_3_hist->Divide(run2_high_up_3_hist);
150 run1_high_up_4_hist->Divide(run2_high_up_4_hist);
152 cout <<
"Histograms divided" <<
"\n";
154 run1_high_up_1_hist->SetMinimum(0.8);
155 run1_high_up_1_hist->SetMaximum(1.2);
156 run1_high_up_2_hist->SetMinimum(0.8);
157 run1_high_up_2_hist->SetMaximum(1.2);
158 run1_high_up_3_hist->SetMinimum(0.8);
159 run1_high_up_3_hist->SetMaximum(1.2);
160 run1_high_up_4_hist->SetMinimum(0.8);
161 run1_high_up_4_hist->SetMaximum(1.2);
166 TCanvas *
c3 =
new TCanvas(
"c3",
"c3 pedsubpeak ",200,10,1200,1200);
170 TVirtualPad *c3_1 = c3->cd(1);
171 c3_1->SetBorderMode(0);
172 c3_1->SetFillColor(0);
176 c3_1->SetBorderMode(0);
177 c3_1->SetFillColor(0);
179 if (errorbars ==0) {run1_high_up_1_hist->Draw(
"hist p");}
180 else {run1_high_up_1_hist->Draw(
"E1 X0");}
181 run1_high_up_1_hist->SetMarkerColor(2);
182 run1_high_up_1_hist->SetMarkerStyle(2);
185 sprintf(
string,
"Run ratio to reference");
187 TLatex *
t1 =
new TLatex(0.15,0.92,
string);
189 t1->SetTextSize(0.03);
194 TVirtualPad *c3_2 = c3->cd(2);
195 c3_2->SetBorderMode(0);
196 c3_2->SetFillColor(0);
201 c3_2->SetBorderMode(0);
202 c3_2->SetFillColor(0);
206 if (errorbars ==0) {run1_high_up_2_hist->Draw(
"hist p");}
207 else {run1_high_up_2_hist->Draw(
"E1 X0");}
208 run1_high_up_2_hist->SetMarkerColor(2);
209 run1_high_up_2_hist->SetMarkerStyle(2);
212 TVirtualPad *c3_3 = c3->cd(3);
213 c3_3->SetBorderMode(0);
214 c3_3->SetFillColor(0);
219 c3_3->SetBorderMode(0);
220 c3_3->SetFillColor(0);
224 if (errorbars ==0) {run1_high_up_3_hist->Draw(
"hist p");}
225 else {run1_high_up_3_hist->Draw(
"E1 X0");}
226 run1_high_up_3_hist->SetMarkerColor(2);
227 run1_high_up_3_hist->SetMarkerStyle(2);
231 TVirtualPad *c3_4 = c3->cd(4);
232 c3_4->SetBorderMode(0);
233 c3_4->SetFillColor(0);
237 c3_4->SetBorderMode(0);
238 c3_4->SetFillColor(0);
242 if (errorbars ==0) {run1_high_up_4_hist->Draw(
"hist p");}
243 else {run1_high_up_4_hist->Draw(
"E1 X0");}
244 run1_high_up_4_hist->SetMarkerColor(2);
245 run1_high_up_4_hist->SetMarkerStyle(2);
sprintf(text,"Post KinFit Cut")
TFile * GetReferenceFile(Int_t run, TString variation="default")
void split(const std::string &s, char delim, std::vector< std::string > &elems)
void Plot_BCAL_LED_Ratio_high_up(string infilename="hd_root.root", int run=20000)
printf("string=%s", string)