26 init(alpha0, beta0, width0, chi20);
30 init(tAB, alpha0, beta0, width0, chi20);
39 for (
int cris = 0; cris <
fNchsel; cris++) {
44 alpha_val[cris] = alpha0;
45 beta_val[cris] = beta0;
46 width_val[cris] = width0;
47 chi2_val[cris] = chi20;
50 alpha_init[cris] = alpha0;
51 beta_init[cris] = beta0;
52 width_init[cris] = width0;
53 chi2_init[cris] = chi20;
62 assignChannel(cris, cris);
67 init(alpha0, beta0, width0, chi20);
69 tABinit = tAB->CloneTree();
98 tABinit->SetBranchAddress(
"iphi", &iphii, &b_iphi);
99 tABinit->SetBranchAddress(
"ieta", &ietai, &b_ieta);
100 tABinit->SetBranchAddress(
"side", &sidei, &b_side);
101 tABinit->SetBranchAddress(
"dccID", &dccIDi, &b_dccID);
102 tABinit->SetBranchAddress(
"towerID", &towerIDi, &b_towerID);
103 tABinit->SetBranchAddress(
"channelID", &channelIDi, &b_channelID);
104 tABinit->SetBranchAddress(
"alpha", &alphai, &b_alpha);
105 tABinit->SetBranchAddress(
"beta", &betai, &b_beta);
106 tABinit->SetBranchAddress(
"width", &widthi, &b_width);
107 tABinit->SetBranchAddress(
"chi2", &chi2i, &b_chi2);
108 tABinit->SetBranchAddress(
"flag", &flagi, &b_flag);
110 nchsel = tABinit->GetEntries();
113 for (
int cris = 0; cris < nchsel; cris++) {
114 tABinit->GetEntry(cris);
118 putalphaVal(cris, alphai);
119 putchi2Val(cris, chi2i);
120 putbetaVal(cris, betai);
121 putwidthVal(cris, widthi);
122 putflagVal(cris, flagi);
124 putalphaInit(cris, alphai);
125 putchi2Init(cris, chi2i);
126 putbetaInit(cris, betai);
127 putwidthInit(cris, widthi);
128 putflagInit(cris, flagi);
129 putetaInit(cris, ietai);
130 putphiInit(cris, iphii);
154 printf(
" number of channels exceed maximum allowed\n");
166 timestart = ((
long int)timecur);
172 timestop = ((
long int)timecur);
177 tower_init[ch] = side;
179 side_init[ch] = side;
188 for (
i = 0;
i < nchsel;
i++)
193 if (npass[
n] <
nevt) {
194 for (
k = 0;
k < nsamplecristal;
k++) {
195 rawsglu[
n][npass[
n]][
k] = sampl[
k];
201 printf(
"no index found for ch=%d\n", ch);
206 double tm_atmax[200];
209 double chi2_all = 0.;
212 dbi =
new double *[200];
213 for (
int k = 0;
k < 200;
k++)
214 dbi[
k] =
new double[2];
217 signalu =
new double *[200];
218 for (
int k = 0;
k < 200;
k++)
219 signalu[
k] =
new double[10];
223 for (
int i = 0;
i < nchsel;
i++) {
225 if (npass[
i] <= 10) {
226 putalphaVal(
i, alpha_init[
i]);
227 putbetaVal(
i, beta_init[
i]);
228 putwidthVal(
i, width_init[
i]);
229 putchi2Val(
i, chi2_init[
i]);
233 pjf->
set_const(nsamplecristal, sampbmax, sampamax, alpha_init[
i], beta_init[
i], npass[
i]);
235 for (
int pass = 0; pass < npass[
i]; pass++) {
237 for (
int k = 0;
k < presample;
k++) {
238 ped += rawsglu[
i][pass][
k];
240 ped /= double(presample);
242 for (
int k = 0;
k < nsamplecristal;
k++) {
243 signalu[pass][
k] = rawsglu[
i][pass][
k] - ped;
250 if (parout[0] >= 0.0 && parout[1] >= 0.0 && chi2_all <= chi2cut && chi2_all > 0.0) {
251 putalphaVal(
i, parout[0]);
252 putbetaVal(
i, parout[1]);
253 putchi2Val(
i, chi2_all);
257 putalphaVal(
i, alpha_init[
i]);
258 putbetaVal(
i, beta_init[
i]);
259 putwidthVal(
i, width_init[
i]);
260 putchi2Val(
i, chi2_init[
i]);
264 for (
int kj = 0; kj < npass[
i]; kj++) {
265 tm_atmax[kj] = dbi[kj][1];
267 computetmaxVal(
i, &tm_atmax[0]);
273 tABinit = tAB->CloneTree();
294 TBranch *b_channelID;
302 tABinit->SetBranchAddress(
"iphi", &iphii, &b_iphi);
303 tABinit->SetBranchAddress(
"ieta", &ietai, &b_ieta);
304 tABinit->SetBranchAddress(
"side", &sidei, &b_side);
305 tABinit->SetBranchAddress(
"dccID", &dccIDi, &b_dccID);
306 tABinit->SetBranchAddress(
"towerID", &towerIDi, &b_towerID);
307 tABinit->SetBranchAddress(
"channelID", &channelIDi, &b_channelID);
308 tABinit->SetBranchAddress(
"alpha", &alphai, &b_alpha);
309 tABinit->SetBranchAddress(
"beta", &betai, &b_beta);
310 tABinit->SetBranchAddress(
"width", &widthi, &b_width);
311 tABinit->SetBranchAddress(
"chi2", &chi2i, &b_chi2);
312 tABinit->SetBranchAddress(
"flag", &flagi, &b_flag);
315 TFile *fABout =
new TFile(namefile.c_str(),
"RECREATE");
316 tABout =
new TTree(
"ABCol0",
"ABCol0");
331 tABout->Branch(
"iphi", &
iphi,
"iphi/I");
332 tABout->Branch(
"ieta", &
ieta,
"ieta/I");
333 tABout->Branch(
"side", &side,
"side/I");
334 tABout->Branch(
"dccID", &dccID,
"dccID/I");
335 tABout->Branch(
"towerID", &
towerID,
"towerID/I");
336 tABout->Branch(
"channelID", &channelID,
"channelID/I");
337 tABout->Branch(
"alpha", &
alpha,
"alpha/D");
338 tABout->Branch(
"beta", &
beta,
"beta/D");
339 tABout->Branch(
"width", &
width,
"width/D");
340 tABout->Branch(
"chi2", &
chi2,
"chi2/D");
341 tABout->Branch(
"flag", &
flag,
"flag/I");
343 tABout->SetBranchAddress(
"ieta", &
ieta);
344 tABout->SetBranchAddress(
"iphi", &
iphi);
345 tABout->SetBranchAddress(
"side", &side);
346 tABout->SetBranchAddress(
"dccID", &dccID);
347 tABout->SetBranchAddress(
"towerID", &
towerID);
348 tABout->SetBranchAddress(
"channelID", &channelID);
349 tABout->SetBranchAddress(
"alpha", &
alpha);
350 tABout->SetBranchAddress(
"beta", &
beta);
351 tABout->SetBranchAddress(
"width", &
width);
352 tABout->SetBranchAddress(
"chi2", &
chi2);
353 tABout->SetBranchAddress(
"flag", &
flag);
355 for (
int i = 0;
i < nchsel;
i++) {
357 tABinit->GetEntry(
i);
363 channelID = channelIDi;
371 channelID = ch_init[
i];
394 for (
int k = 0;
k < npass[
i] - 1;
k++) {
395 if (1. < tm_val[
k] && tm_val[
k] < 10.) {
398 sigtm += tm_val[
k] * tm_val[
k];
401 if (npassok[
i] <= 0) {
404 for (
int k = 0;
k < npass[
i] - 1;
k++) {
405 if (1. < tm_val[
k] && tm_val[
k] < 10.) {
406 double ss = (sigtm / npassok[
i] - tm / npassok[
i] * tm / npassok[
i]);
410 tm_mean = tm / npassok[
i];
415 putwidthVal(
i, tm_mean);
440 std::vector<double>
v;
442 v.push_back(alpha_val[
n]);
443 v.push_back(beta_val[
n]);
444 v.push_back(width_val[
n]);
445 v.push_back(chi2_val[
n]);
446 v.push_back(flag_val[
n]);
451 std::vector<double>
v;
453 v.push_back(alpha_init[
n]);
454 v.push_back(beta_init[
n]);
455 v.push_back(width_init[
n]);
456 v.push_back(chi2_init[
n]);
457 v.push_back(flag_init[
n]);
465 sprintf(
filename,
"runABW%d.pedestal", gRunNumber);
468 printf(
"Error while opening file : %s\n",
filename);
470 for (
int i = 0;
i < nchsel;
i++) {
472 nev = (
int)npassok[
i];
473 double trise = alpha_val[
i] * beta_val[
i];
475 "%d %d 1 %ld %ld %f %f %f %f\n",
486 int iret = fclose(
fd);
487 printf(
" Closing file : %d\n", iret);