66 std::cout <<
"Photon channel: " << chNumber << std::endl;
70 int grsize = opDetWaveform.size();
78 double TimeVector[10000];
79 double ADCVector[10000];
92 baseline = baseline+ opDetWaveform[btime];
97 std::cout <<
"Baseline " << baseline << std::endl;
100 for (
int wtime=0; wtime< grsize; wtime++)
102 TimeVector[wtime] = wtime;
103 ADCVector[wtime] = -(opDetWaveform[wtime]-
baseline);
106 TGraph *gr =
new TGraph(grsize,TimeVector,ADCVector);
108 int n_graph = gr->GetN();
109 double *y_graph = gr->GetY();
111 int min_time = TMath::LocMax(n_graph,y_graph);
112 double min_time_to_put = TMath::LocMax(n_graph,y_graph);
113 double min = y_graph[min_time];
114 double min_to_put = min;
120 TF1 *funz=
new TF1(
"funz",
"pol1(0)", min_time-2.0, min_time);
124 double start_moment = funz->GetX(baseline, 0, min_time);
126 std::cout <<
"Start " << start_moment << std::endl;
128 TF1 *gauss_start=
new TF1(
"gauss_start",
"gaus", min_time-5.0, min_time);
129 TF1 *gauss_end =
new TF1(
"gauss_end",
"gaus", min_time, min_time+10);
131 gauss_start->SetParameter(1,min_time);
132 gauss_end->SetParameter(1,min_time);
134 gr->Fit(
"gauss_start",
"R");
136 double Constant1 = gauss_start->GetParameter(0);
138 double Sigma1 = gauss_start->GetParameter(2);
140 std::cout <<
"GaussParam 00 " << gauss_start->GetParameter(0) <<
"GaussParam 01 " << gauss_start->GetParameter(1) <<
"GaussParam 02 " << gauss_start->GetParameter(2) << std::endl;
142 gr->Fit(
"gauss_end",
"R");
144 double Constant2 = gauss_end->GetParameter(0);
146 double Sigma2 = gauss_end->GetParameter(2);
148 std::cout <<
"GaussParam 10 " << gauss_end->GetParameter(0) <<
"GaussParam 11 " << gauss_end->GetParameter(1) <<
"GaussParam 12 " << gauss_end->GetParameter(2) << std::endl;
151 Area = ((Constant1*Sigma1)/2 + (Constant2*Sigma2)/2)*sqrt(2*3.14159);
153 time_abs = sqrt(min_time_to_put);
154 FWHM = 2.35*((Sigma1+Sigma2)/2);
178 recob::OpHit opHit(chNumber, min_time_to_put, time_abs, frame, FWHM, Area, min_to_put, phelec, fasttotal);
181 opHitVec.back() = opHit;
BEGIN_PROLOG could also be cout