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);
83 TProfile *run1_low_down_1 = NULL;
84 TProfile *run1_low_down_2 = NULL;
85 TProfile *run1_low_down_3 = NULL;
86 TProfile *run1_low_down_4 = NULL;
88 TProfile *run2_low_down_1 = NULL;
89 TProfile *run2_low_down_2 = NULL;
90 TProfile *run2_low_down_3 = NULL;
91 TProfile *run2_low_down_4 = NULL;
93 TH1D *run1_low_down_1_hist = NULL;
94 TH1D *run1_low_down_2_hist = NULL;
95 TH1D *run1_low_down_3_hist = NULL;
96 TH1D *run1_low_down_4_hist = NULL;
98 TH1D *run2_low_down_1_hist = NULL;
99 TH1D *run2_low_down_2_hist = NULL;
100 TH1D *run2_low_down_3_hist = NULL;
101 TH1D *run2_low_down_4_hist = NULL;
106 printf (
"Histogram input filename=%s\n",infilename.c_str());
107 TFile *run1in =
new TFile(infilename.c_str(),
"read");
111 run1_low_down_1 = (TProfile*)run1in->Get(
"bcalLED/low_bias_down_sector_1_peak_vchannel");
112 run1_low_down_2 = (TProfile*)run1in->Get(
"bcalLED/low_bias_down_sector_2_peak_vchannel");
113 run1_low_down_3 = (TProfile*)run1in->Get(
"bcalLED/low_bias_down_sector_3_peak_vchannel");
114 run1_low_down_4 = (TProfile*)run1in->Get(
"bcalLED/low_bias_down_sector_4_peak_vchannel");
121 run2_low_down_1 = (TProfile*)run2in->Get(
"bcalLED/low_bias_down_sector_1_peak_vchannel");
122 run2_low_down_2 = (TProfile*)run2in->Get(
"bcalLED/low_bias_down_sector_2_peak_vchannel");
123 run2_low_down_3 = (TProfile*)run2in->Get(
"bcalLED/low_bias_down_sector_3_peak_vchannel");
124 run2_low_down_4 = (TProfile*)run2in->Get(
"bcalLED/low_bias_down_sector_4_peak_vchannel");
126 cout <<
"input profiles, projecting into histograms" <<
"\n";
128 run1_low_down_1_hist = run1_low_down_1->ProjectionX(
"run1_low_down_1_projectionx");
129 run1_low_down_2_hist = run1_low_down_2->ProjectionX(
"run1_low_down_2_projectionx");
130 run1_low_down_3_hist = run1_low_down_3->ProjectionX(
"run1_low_down_3_projectionx");
131 run1_low_down_4_hist = run1_low_down_4->ProjectionX(
"run1_low_down_4_projectionx");
133 run2_low_down_1_hist = run2_low_down_1->ProjectionX(
"run2_low_down_1_projectionx");
134 run2_low_down_2_hist = run2_low_down_2->ProjectionX(
"run2_low_down_2_projectionx");
135 run2_low_down_3_hist = run2_low_down_3->ProjectionX(
"run2_low_down_3_projectionx");
136 run2_low_down_4_hist = run2_low_down_4->ProjectionX(
"run2_low_down_4_projectionx");
139 cout <<
"profiles projected into histograms" <<
"\n";
141 run1_low_down_1_hist->SetTitle(
"6v Downstream sector 1");
142 run1_low_down_2_hist->SetTitle(
"6v Downstream sector 2");
143 run1_low_down_3_hist->SetTitle(
"6v Downstream sector 3");
144 run1_low_down_4_hist->SetTitle(
"6v Downstream sector 4");
146 cout <<
"Divideing histograms" <<
"\n";
148 run1_low_down_1_hist->Divide(run2_low_down_1_hist);
149 run1_low_down_2_hist->Divide(run2_low_down_2_hist);
150 run1_low_down_3_hist->Divide(run2_low_down_3_hist);
151 run1_low_down_4_hist->Divide(run2_low_down_4_hist);
153 cout <<
"Histograms divided" <<
"\n";
155 run1_low_down_1_hist->SetMinimum(0.8);
156 run1_low_down_1_hist->SetMaximum(1.2);
157 run1_low_down_2_hist->SetMinimum(0.8);
158 run1_low_down_2_hist->SetMaximum(1.2);
159 run1_low_down_3_hist->SetMinimum(0.8);
160 run1_low_down_3_hist->SetMaximum(1.2);
161 run1_low_down_4_hist->SetMinimum(0.8);
162 run1_low_down_4_hist->SetMaximum(1.2);
165 TCanvas *
c2 =
new TCanvas(
"c2",
"c2 pedsubpeak ",200,10,1200,1200);
168 TVirtualPad *c2_1 = c2->cd(1);
169 c2_1->SetBorderMode(0);
170 c2_1->SetFillColor(0);
174 c2_1->SetBorderMode(0);
175 c2_1->SetFillColor(0);
177 if (errorbars ==0) {run1_low_down_1_hist->Draw(
"hist p");}
178 else {run1_low_down_1_hist->Draw(
"E1 X0");}
179 run1_low_down_1_hist->SetMarkerColor(2);
180 run1_low_down_1_hist->SetMarkerStyle(2);
183 sprintf(
string,
"Run ratio to reference");
185 TLatex *
t1 =
new TLatex(0.15,0.92,
string);
187 t1->SetTextSize(0.03);
191 TVirtualPad *c2_2 = c2->cd(2);
192 c2_2->SetBorderMode(0);
193 c2_2->SetFillColor(0);
197 c2_2->SetBorderMode(0);
198 c2_2->SetFillColor(0);
200 if (errorbars ==0) {run1_low_down_2_hist->Draw(
"hist p");}
201 else {run1_low_down_2_hist->Draw(
"E1 X0");}
202 run1_low_down_2_hist->SetMarkerColor(2);
203 run1_low_down_2_hist->SetMarkerStyle(2);
206 TVirtualPad *c2_3 = c2->cd(3);
207 c2_3->SetBorderMode(0);
208 c2_3->SetFillColor(0);
213 c2_3->SetBorderMode(0);
214 c2_3->SetFillColor(0);
216 if (errorbars ==0) {run1_low_down_3_hist->Draw(
"hist p");}
217 else {run1_low_down_3_hist->Draw(
"E1 X0");}
218 run1_low_down_3_hist->SetMarkerColor(2);
219 run1_low_down_3_hist->SetMarkerStyle(2);
222 TVirtualPad *c2_4 = c2->cd(4);
223 c2_4->SetBorderMode(0);
224 c2_4->SetFillColor(0);
228 c2_4->SetBorderMode(0);
229 c2_4->SetFillColor(0);
231 if (errorbars ==0) {run1_low_down_4_hist->Draw(
"hist p");}
232 else {run1_low_down_4_hist->Draw(
"E1 X0");}
233 run1_low_down_4_hist->SetMarkerColor(2);
234 run1_low_down_4_hist->SetMarkerStyle(2);
sprintf(text,"Post KinFit Cut")
void Plot_BCAL_LED_Ratio_low_down(string infilename="hd_root.root", int run=20000)
TFile * GetReferenceFile(Int_t run, TString variation="default")
void split(const std::string &s, char delim, std::vector< std::string > &elems)
printf("string=%s", string)