223 |
for (Int_t k = 0; k < 22; k++ ){ |
for (Int_t k = 0; k < 22; k++ ){ |
224 |
for (Int_t l = 0; l < 96; l++ ){ |
for (Int_t l = 0; l < 96; l++ ){ |
225 |
fread(&mip[m][k][l],sizeof(mip[m][k][l]),1,f); |
fread(&mip[m][k][l],sizeof(mip[m][k][l]),1,f); |
226 |
|
if ( debug ) printf(" %f \n",mip[m][k][l]); |
227 |
}; |
}; |
228 |
}; |
}; |
229 |
}; |
}; |
399 |
// |
// |
400 |
Int_t val = 0; |
Int_t val = 0; |
401 |
Int_t del = 1100; |
Int_t del = 1100; |
402 |
|
for (Int_t sec = 0; sec < 4; sec++){ |
403 |
|
for (Int_t dsec = 0; dsec < 7; dsec++){ |
404 |
|
val = (Int_t)de->calselftrig[sec][dsec]; |
405 |
|
del = delay(val); |
406 |
|
clevel2->selfdelay[sec][dsec] = del; |
407 |
|
}; |
408 |
|
}; |
409 |
|
val = 0; |
410 |
|
del = 1100; |
411 |
if ( clevel2->trigty != 2. ){ |
if ( clevel2->trigty != 2. ){ |
412 |
Bool_t ck = false; |
Bool_t ck = false; |
413 |
for (Int_t sec = 0; sec < 4; sec++){ |
for (Int_t sec = 0; sec < 4; sec++){ |
569 |
} else { |
} else { |
570 |
ip[i] = pre - 1; |
ip[i] = pre - 1; |
571 |
}; |
}; |
572 |
if ( (base[l][m][ip[i]] == 31000. || base[l][m][ip[i]] == 0.) ){ |
if ( (base[l][m][ip[i]] == 31000. || base[l][m][ip[i]] == 0. || !crosst ) ){ |
573 |
// |
// |
574 |
ck = 2; |
ck = 2; |
575 |
if ( sbase[l][m][pre] == 31000. || sbase[l][m][pre] == 0. ) { |
if ( sbase[l][m][pre] == 31000. || sbase[l][m][pre] == 0. ) { |
583 |
// CALIBRATION ALGORITHM |
// CALIBRATION ALGORITHM |
584 |
// |
// |
585 |
if ( !doneb ){ |
if ( !doneb ){ |
586 |
|
if ( debug ) printf(" ck is %i \n",ck); |
587 |
switch (ck) { |
switch (ck) { |
588 |
case 0: |
case 0: |
589 |
base0 = base[l][m][pre]; |
base0 = base[l][m][pre]; |
590 |
base2 = calbase[l][m][pre]; |
base2 = calbase[l][m][pre]; |
591 |
|
if ( debug ) printf(" base0 = base l m pre = %f base2 = calbase l m pre = %f \n",base[l][m][pre],calbase[l][m][pre]); |
592 |
break; |
break; |
593 |
case 1: |
case 1: |
594 |
base0 = base[l][m][ip[i]]; |
base0 = base[l][m][ip[i]]; |
595 |
base2 = calbase[l][m][ip[i]]; |
base2 = calbase[l][m][ip[i]]; |
596 |
|
if ( debug ) printf(" base0 = base l m ip(i) = %f base2 = calbase l m ip(i) = %f \n",base[l][m][ip[i]],calbase[l][m][ip[i]]); |
597 |
break; |
break; |
598 |
case 2: |
case 2: |
599 |
base0 = sbase[l][m][pre]; |
base0 = sbase[l][m][pre]; |
600 |
base2 = calbase[l][m][pre]; |
base2 = calbase[l][m][pre]; |
601 |
|
if ( debug ) printf(" base0 = sbase l m pre = %f base2 = calbase l m pre = %f \n",sbase[l][m][pre],calbase[l][m][pre]); |
602 |
break; |
break; |
603 |
case 3: |
case 3: |
604 |
base0 = calbase[l][m][pre]; |
base0 = calbase[l][m][pre]; |
605 |
base2 = calbase[l][m][pre]; |
base2 = calbase[l][m][pre]; |
606 |
|
if ( debug ) printf(" base0 = calbase l m pre = %f base2 = calbase l m pre = %f \n",calbase[l][m][pre],calbase[l][m][pre]); |
607 |
break; |
break; |
608 |
}; |
}; |
609 |
base1 = calbase[l][m][pre]; |
base1 = calbase[l][m][pre]; |
613 |
ener0 += ener; |
ener0 += ener; |
614 |
clevel1->estrip[n][m][l] = 0.; |
clevel1->estrip[n][m][l] = 0.; |
615 |
if ( base0>0 && base0 < 30000. ){ |
if ( base0>0 && base0 < 30000. ){ |
616 |
if ( !donec && (base0 - base1 + base2) != 0. ){ |
// if ( !donec && (base0 - base1 + base2) != 0. ){ |
617 |
sbase[l][m][pre] = base0 - base1 + base2; |
// sbase[l][m][pre] = base0 - base1 + base2; |
618 |
|
if ( !donec && (base0 + base1 - base2) != 0. ){ |
619 |
|
sbase[l][m][pre] = base0 + base1 - base2; |
620 |
donec = 1; |
donec = 1; |
621 |
}; |
}; |
622 |
if ( ener > 0. ){ |
if ( ener > 0. ){ |
625 |
// OK, now in estrip we have the energy deposit in MIP of all the strips for this event (at the end of loops of course) |
// OK, now in estrip we have the energy deposit in MIP of all the strips for this event (at the end of loops of course) |
626 |
// |
// |
627 |
qpre[pre] += clevel1->estrip[n][m][l]; |
qpre[pre] += clevel1->estrip[n][m][l]; |
628 |
|
// |
629 |
|
// |
630 |
}; |
}; |
631 |
}; |
}; |
632 |
}; |
}; |
795 |
memcpy(t_ca->tibar,clevel2->cibar,sizeof(clevel2->cibar)); |
memcpy(t_ca->tibar,clevel2->cibar,sizeof(clevel2->cibar)); |
796 |
memcpy(t_ca->tbar,clevel2->cbar,sizeof(clevel2->cbar)); |
memcpy(t_ca->tbar,clevel2->cbar,sizeof(clevel2->cbar)); |
797 |
memcpy(ca->planemax,clevel2->planemax,sizeof(clevel2->planemax)); |
memcpy(ca->planemax,clevel2->planemax,sizeof(clevel2->planemax)); |
798 |
|
memcpy(ca->selfdelay,clevel2->selfdelay,sizeof(clevel2->selfdelay)); |
799 |
ca->varcfit[2] = clevel2->varcfit[0]; |
ca->varcfit[2] = clevel2->varcfit[0]; |
800 |
ca->varcfit[3] = clevel2->varcfit[1]; |
ca->varcfit[3] = clevel2->varcfit[1]; |
801 |
ca->npcfit[2] = clevel2->npcfit[0]; |
ca->npcfit[2] = clevel2->npcfit[0]; |
848 |
ca->selen = clevel2->selen; |
ca->selen = clevel2->selen; |
849 |
memcpy(ca->qq,clevel2->qq,sizeof(clevel2->qq)); |
memcpy(ca->qq,clevel2->qq,sizeof(clevel2->qq)); |
850 |
memcpy(ca->planemax,clevel2->planemax,sizeof(clevel2->planemax)); |
memcpy(ca->planemax,clevel2->planemax,sizeof(clevel2->planemax)); |
851 |
|
memcpy(ca->selfdelay,clevel2->selfdelay,sizeof(clevel2->selfdelay)); |
852 |
ca->varcfit[0] = clevel2->varcfit[0]; |
ca->varcfit[0] = clevel2->varcfit[0]; |
853 |
ca->varcfit[1] = clevel2->varcfit[1]; |
ca->varcfit[1] = clevel2->varcfit[1]; |
854 |
ca->npcfit[0] = clevel2->npcfit[0]; |
ca->npcfit[0] = clevel2->npcfit[0]; |
939 |
memset(clevel2->varcfit, 0, 4*sizeof(Float_t)); |
memset(clevel2->varcfit, 0, 4*sizeof(Float_t)); |
940 |
memset(clevel2->npcfit, 0, 4*sizeof(Int_t)); |
memset(clevel2->npcfit, 0, 4*sizeof(Int_t)); |
941 |
memset(clevel2->planemax, 0, 2*sizeof(Int_t)); |
memset(clevel2->planemax, 0, 2*sizeof(Int_t)); |
942 |
|
memset(clevel2->selfdelay, 0, 4*7*sizeof(Int_t)); |
943 |
memset(clevel2->fmode, 0, 2*sizeof(Int_t)); |
memset(clevel2->fmode, 0, 2*sizeof(Int_t)); |
944 |
memset(clevel2->cibar, 0, 2*22*sizeof(Int_t)); |
memset(clevel2->cibar, 0, 2*22*sizeof(Int_t)); |
945 |
memset(clevel2->cbar, 0, 2*22*sizeof(Float_t)); |
memset(clevel2->cbar, 0, 2*22*sizeof(Float_t)); |