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;
41 vector<string> tokens;
42 split(path_name,
'/', tokens);
45 ifstream
f(filename.c_str());
47 sprintf(command,
"curl -O %s", ss_url.str().c_str());
48 gSystem->Exec(command);
55 TFile *rootfile =
new TFile(filename.c_str());
64 cout <<
"Starting ploting" <<
"\n";
68 gStyle->SetPalette(1,0);
69 gStyle->SetOptStat(kFALSE);
71 gStyle->SetPadRightMargin(0.15);
72 gStyle->SetPadLeftMargin(0.15);
73 gStyle->SetPadBottomMargin(0.15);
82 TProfile *run1_low_up_1 = NULL;
83 TProfile *run1_low_up_2 = NULL;
84 TProfile *run1_low_up_3 = NULL;
85 TProfile *run1_low_up_4 = NULL;
87 TProfile *run2_low_up_1 = NULL;
88 TProfile *run2_low_up_2 = NULL;
89 TProfile *run2_low_up_3 = NULL;
90 TProfile *run2_low_up_4 = NULL;
92 TH1D *run1_high_up_1_hist=NULL;
93 TH1D *run1_high_up_2_hist=NULL;
94 TH1D *run1_high_up_3_hist=NULL;
95 TH1D *run1_high_up_4_hist=NULL;
97 TH1D *run2_high_up_1_hist=NULL;
98 TH1D *run2_high_up_2_hist=NULL;
99 TH1D *run2_high_up_3_hist=NULL;
100 TH1D *run2_high_up_4_hist=NULL;
102 TH1D *run1_low_up_1_hist = NULL;
103 TH1D *run1_low_up_2_hist = NULL;
104 TH1D *run1_low_up_3_hist = NULL;
105 TH1D *run1_low_up_4_hist = NULL;
107 TH1D *run2_low_up_1_hist = NULL;
108 TH1D *run2_low_up_2_hist = NULL;
109 TH1D *run2_low_up_3_hist = NULL;
110 TH1D *run2_low_up_4_hist = NULL;
114 printf (
"Histogram input filename=%s\n",infilename.c_str());
115 TFile *run1in =
new TFile(infilename.c_str(),
"read");
119 run1_low_up_1 = (TProfile*)run1in->Get(
"bcalLED/low_bias_up_sector_1_peak_vchannel");
120 run1_low_up_2 = (TProfile*)run1in->Get(
"bcalLED/low_bias_up_sector_2_peak_vchannel");
121 run1_low_up_3 = (TProfile*)run1in->Get(
"bcalLED/low_bias_up_sector_3_peak_vchannel");
122 run1_low_up_4 = (TProfile*)run1in->Get(
"bcalLED/low_bias_up_sector_4_peak_vchannel");
129 run2_low_up_1 = (TProfile*)run2in->Get(
"bcalLED/low_bias_up_sector_1_peak_vchannel");
130 run2_low_up_2 = (TProfile*)run2in->Get(
"bcalLED/low_bias_up_sector_2_peak_vchannel");
131 run2_low_up_3 = (TProfile*)run2in->Get(
"bcalLED/low_bias_up_sector_3_peak_vchannel");
132 run2_low_up_4 = (TProfile*)run2in->Get(
"bcalLED/low_bias_up_sector_4_peak_vchannel");
134 cout <<
"input profiles, projecting into histograms" <<
"\n";
136 run1_low_up_1_hist = run1_low_up_1->ProjectionX(
"run1_low_up_1_projectionx");
137 run1_low_up_2_hist = run1_low_up_2->ProjectionX(
"run1_low_up_2_projectionx");
138 run1_low_up_3_hist = run1_low_up_3->ProjectionX(
"run1_low_up_3_projectionx");
139 run1_low_up_4_hist = run1_low_up_4->ProjectionX(
"run1_low_up_4_projectionx");
141 run2_low_up_1_hist = run2_low_up_1->ProjectionX(
"run2_low_up_1_projectionx");
142 run2_low_up_2_hist = run2_low_up_2->ProjectionX(
"run2_low_up_2_projectionx");
143 run2_low_up_3_hist = run2_low_up_3->ProjectionX(
"run2_low_up_3_projectionx");
144 run2_low_up_4_hist = run2_low_up_4->ProjectionX(
"run2_low_up_4_projectionx");
146 cout <<
"profiles projected into histograms" <<
"\n";
148 run1_low_up_1_hist->SetTitle(
"6v Upstream sector 1");
149 run1_low_up_2_hist->SetTitle(
"6v Upstream sector 2");
150 run1_low_up_3_hist->SetTitle(
"6v Upstream sector 3");
151 run1_low_up_4_hist->SetTitle(
"6v Upstream sector 4");
153 cout <<
"Divideing histograms" <<
"\n";
155 run1_low_up_1_hist->Divide(run2_low_up_1_hist);
156 run1_low_up_2_hist->Divide(run2_low_up_2_hist);
157 run1_low_up_3_hist->Divide(run2_low_up_3_hist);
158 run1_low_up_4_hist->Divide(run2_low_up_4_hist);
160 cout <<
"Histograms divided" <<
"\n";
161 run1_low_up_1_hist->SetMinimum(0.8);
162 run1_low_up_1_hist->SetMaximum(1.2);
163 run1_low_up_2_hist->SetMinimum(0.8);
164 run1_low_up_2_hist->SetMaximum(1.2);
165 run1_low_up_3_hist->SetMinimum(0.8);
166 run1_low_up_3_hist->SetMaximum(1.2);
167 run1_low_up_4_hist->SetMinimum(0.8);
168 run1_low_up_4_hist->SetMaximum(1.2);
172 TCanvas *
c1 =
new TCanvas(
"c1",
"c1 pedsubpeak ",200,10,1200,1200);
176 TVirtualPad *c1_1 = c1->cd(1);
177 c1_1->SetBorderMode(0);
178 c1_1->SetFillColor(0);
182 c1_1->SetBorderMode(0);
183 c1_1->SetFillColor(0);
185 if (errorbars ==0) {run1_low_up_1_hist->Draw(
"hist p");}
186 else {run1_low_up_1_hist->Draw(
"E1 X0");}
187 run1_low_up_1_hist->SetMarkerColor(2);
188 run1_low_up_1_hist->SetMarkerStyle(2);
191 sprintf(
string,
"Run ratio to reference");
193 TLatex *
t1 =
new TLatex(0.15,0.92,
string);
195 t1->SetTextSize(0.03);
199 TVirtualPad *c1_2 = c1->cd(2);
200 c1_2->SetBorderMode(0);
201 c1_2->SetFillColor(0);
205 c1_2->SetBorderMode(0);
206 c1_2->SetFillColor(0);
208 if (errorbars ==0) {run1_low_up_2_hist->Draw(
"hist p");}
209 else {run1_low_up_2_hist->Draw(
"E1 X0");}
210 run1_low_up_2_hist->SetMarkerColor(2);
211 run1_low_up_2_hist->SetMarkerStyle(2);
214 TVirtualPad *c1_3 = c1->cd(3);
215 c1_3->SetBorderMode(0);
216 c1_3->SetFillColor(0);
221 c1_3->SetBorderMode(0);
222 c1_3->SetFillColor(0);
224 if (errorbars ==0) {run1_low_up_3_hist->Draw(
"hist p");}
225 else {run1_low_up_3_hist->Draw(
"E1 X0");}
226 run1_low_up_3_hist->SetMarkerColor(2);
227 run1_low_up_3_hist->SetMarkerStyle(2);
231 TVirtualPad *c1_4 = c1->cd(4);
232 c1_4->SetBorderMode(0);
233 c1_4->SetFillColor(0);
237 c1_4->SetBorderMode(0);
238 c1_4->SetFillColor(0);
240 if (errorbars ==0) {run1_low_up_4_hist->Draw(
"hist p");}
241 else {run1_low_up_4_hist->Draw(
"E1 X0");}
242 run1_low_up_4_hist->SetMarkerColor(2);
243 run1_low_up_4_hist->SetMarkerStyle(2);
sprintf(text,"Post KinFit Cut")
void Plot_BCAL_LED_Ratio_low_up(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)