6 sprintf(command,
"ccdb dump %s:%i:%s", path.Data(),
run, variation.Data());
7 FILE* inputPipe = gSystem->OpenPipe(command,
"r");
12 if(fgets(buff,
sizeof(buff), inputPipe) == NULL)
17 while(fgets(buff,
sizeof(buff), inputPipe) != NULL){
18 istringstream locConstantsStream(buff);
19 while (locConstantsStream >> entry){
21 if (counter %
column == 0) container.push_back(entry);
25 gSystem->ClosePipe(inputPipe);
30 void c_eff_pol2(TString fileName =
"hd_root.root",
int runNumber = 22016, TString variation =
"default")
32 ofstream
outfile(
"c_eff_pol2.out");
37 TFile *in = TFile::Open( fileName ,
"READ");
39 cout <<
"Unable to open file " << fileName.Data() <<
"...Exiting" << endl;
44 TH1D* h1_c_eff2 = NULL;
47 TH1D* h1_p2_fit_parameter = NULL;
55 h1_c_eff2 =
new TH1D(
"h1_c_eff2",
"Effective Velocity per Channel",800,0,800);
56 h1_c_eff2->SetXTitle(
"Channel #");
57 h1_c_eff2->SetYTitle(
"Effective Velocity (cm/ns)");
58 h1_c_eff2->GetYaxis()->SetRangeUser(15,19);
59 h1_c_eff2->SetMarkerStyle(20);
60 h1_c_eff2->SetOption(
"E1");
63 h1_p2_fit_parameter =
new TH1D(
"h1_p2_fit_parameter",
"p2 fit parameter", 800, 0, 800);
64 h1_p2_fit_parameter->SetXTitle(
"Channel #");
65 h1_p2_fit_parameter->SetYTitle(
"p2 fit parameter (cm^{-1)");
66 h1_p2_fit_parameter->SetMarkerStyle(20);
67 h1_p2_fit_parameter->SetOption(
"E1");
71 vector<double> effective_velocity;
72 GetCCDBConstants(
"/BCAL/effective_velocities",runNumber, variation, effective_velocity);
74 outfile.open(prefix +
"effective_velocities.txt");
77 float eff_velocities_graphs = 0;
78 float eff_velocities_graphs_errors = 0;
81 float p2_graphs_error = 0;
82 float p1_graphs_error = 0;
86 for(
int m = 0; m < channels; ++m){
88 sprintf(
string,
"bcal_point_calibs/h2_tgraph[%d]", m+1);
90 h2_tgraph = (TGraph*)in->Get(
string);
92 if(h2_tgraph->GetN() > 2){
94 h2_tgraph->Fit(
"pol2");
95 func2 = h2_tgraph->GetFunction(
"pol2");
96 p2_graphs = func2->GetParameter(2);
97 p2_graphs_error = func2->GetParError(2);
98 p1_graphs = func2->GetParameter(1);
99 p1_graphs_error = func2->GetParError(1);
100 eff_velocities_graphs = effective_velocity[m] / (p1_graphs);
101 eff_velocities_graphs_errors = effective_velocity[m] * p1_graphs_error / ( p1_graphs * p1_graphs );
103 outfile << eff_velocities_graphs << endl;
107 h1_c_eff2->Fill(m+1,eff_velocities_graphs);
108 h1_c_eff2->SetBinError(m+2,eff_velocities_graphs_errors);
109 h1_p2_fit_parameter->Fill(m+1, p2_graphs);
110 h1_p2_fit_parameter->SetBinError(m+2, p2_graphs_error);
117 TCanvas *Canvas_1 =
new TCanvas(
"Canvas_1",
"Canvas_1",323,71,953,603);
118 Canvas_1->Range(-100,12.25,900,19.75);
119 Canvas_1->SetFillColor(0);
120 Canvas_1->SetBorderMode(0);
121 Canvas_1->SetBorderSize(2);
122 Canvas_1->SetFrameBorderMode(0);
123 Canvas_1->SetFrameBorderMode(0);
129 Canvas_1->SaveAs(
"h1_c_eff2.png");
130 Canvas_1->SaveAs(
"h1_c_eff2.C");
132 TCanvas *Canvas_4 =
new TCanvas(
"Canvas_4",
"Canvas_4",323,71,953,603);
133 Canvas_4->Range(-100,12.25,900,19.75);
134 Canvas_4->SetFillColor(0);
135 Canvas_4->SetBorderMode(0);
136 Canvas_4->SetBorderSize(2);
137 Canvas_4->SetFrameBorderMode(0);
138 Canvas_4->SetFrameBorderMode(0);
140 h1_p2_fit_parameter->Draw(
"");
143 Canvas_4->SaveAs(
"h1_p2_fit_parameter.png");
144 Canvas_4->SaveAs(
"h1_p2_fit_parameter.C");
sprintf(text,"Post KinFit Cut")
void GetCCDBConstants(TString path, Int_t run, TString variation, vector< double > &container, Int_t column=1)
static TGraph * h2_tgraph[768]
void c_eff_pol2(TString fileName="hd_root.root", int runNumber=22016, TString variation="default")