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_linear_fit(TString fileName =
"hd_root.root",
int runNumber = 22016, TString variation =
"default")
32 ofstream
outfile(
"c_eff_linear.out");
37 TFile *in =
new TFile::Open( fileName ,
"READ");
39 cout <<
"Unable to open file " << fileName.Data() <<
"...Exiting" << endl;
44 TH1F* h1_c_eff2 = NULL;
52 h1_c_eff2 =
new TH1F(
"h1_c_eff2",
"Effective Velocity per Channel",800,0,800);
53 h1_c_eff2->SetXTitle(
"Channel #");
54 h1_c_eff2->SetYTitle(
"Effective Velocity (cm/ns)");
55 h1_c_eff2->GetYaxis()->SetRangeUser(15,19);
56 h1_c_eff2->SetMarkerStyle(20);
57 h1_c_eff2->SetOption(
"E1");
61 vector<double> effective_velocity;
62 GetCCDBConstants(
"/BCAL/effective_velocities",runNumber, variation, effective_velocity);
66 float eff_velocities_graphs = 0;
67 float eff_velocities_graphs_errors = 0;
69 float p1_graphs_error = 0;
73 for(
int m = 0; m < channels; ++m){
75 sprintf(
string,
"bcal_point_calibs/h2_tgraph[%d]", m+1);
77 h2_tgraph = (TGraph*)in->Get(
string);
79 if(h2_tgraph->GetN() > 2){
81 h2_tgraph->Fit(
"pol1");
82 func2 = h2_tgraph->GetFunction(
"pol1");
83 p1_graphs = func2->GetParameter(1);
84 p1_graphs_error = func2->GetParError(1);
85 eff_velocities_graphs = effective_velocity[m] / (p1_graphs);
86 eff_velocities_graphs_errors = effective_velocity[m] * p1_graphs_error / ( p1_graphs * p1_graphs );
88 outfile << eff_velocities_graphs << endl;
92 h1_c_eff2->Fill(m+1,eff_velocities_graphs);
93 h1_c_eff2->SetBinError(m+2,eff_velocities_graphs_errors);
99 TCanvas *Canvas_1 =
new TCanvas(
"Canvas_1",
"Canvas_1",323,71,953,603);
100 Canvas_1->Range(-100,12.25,900,19.75);
101 Canvas_1->SetFillColor(0);
102 Canvas_1->SetBorderMode(0);
103 Canvas_1->SetBorderSize(2);
104 Canvas_1->SetFrameBorderMode(0);
105 Canvas_1->SetFrameBorderMode(0);
111 Canvas_1->SaveAs(
"h1_c_eff2.png");
112 Canvas_1->SaveAs(
"h1_c_eff2.C");
sprintf(text,"Post KinFit Cut")
void GetCCDBConstants(TString path, Int_t run, TString variation, vector< double > &container, Int_t column=1)
void c_eff_linear_fit(TString fileName="hd_root.root", int runNumber=22016, TString variation="default")
static TGraph * h2_tgraph[768]