67 |
calopar1 = true; |
calopar1 = true; |
68 |
calopar2 = true; |
calopar2 = true; |
69 |
calopar3 = true; |
calopar3 = true; |
70 |
|
crosst = true; |
71 |
ftcalopar1 = 0; |
ftcalopar1 = 0; |
72 |
ttcalopar1 = 0; |
ttcalopar1 = 0; |
73 |
ftcalopar2 = 0; |
ftcalopar2 = 0; |
76 |
ttcalopar3 = 0; |
ttcalopar3 = 0; |
77 |
} |
} |
78 |
|
|
79 |
|
void CaloProcessing::SetCrossTalk(Bool_t ct){ |
80 |
|
crosst = ct; |
81 |
|
}; |
82 |
|
|
83 |
/** |
/** |
84 |
* Initialize CaloProcessing object |
* Initialize CaloProcessing object |
85 |
**/ |
**/ |
169 |
Int_t sgnl = 0; |
Int_t sgnl = 0; |
170 |
for ( Int_t s = 0; s < 4; s++){ |
for ( Int_t s = 0; s < 4; s++){ |
171 |
if ( atime > totime[s] ){ |
if ( atime > totime[s] ){ |
172 |
|
if ( !dbc->IsConnected() ) throw -116; |
173 |
sgnl = Update(dbc,atime,s); |
sgnl = Update(dbc,atime,s); |
174 |
if ( sgnl < 0 ) return(sgnl); |
if ( sgnl < 0 ) return(sgnl); |
175 |
}; |
}; |
368 |
Int_t val = 0; |
Int_t val = 0; |
369 |
Int_t del = 1100; |
Int_t del = 1100; |
370 |
if ( clevel2->trigty != 2. ){ |
if ( clevel2->trigty != 2. ){ |
371 |
|
Bool_t ck = false; |
372 |
for (Int_t sec = 0; sec < 4; sec++){ |
for (Int_t sec = 0; sec < 4; sec++){ |
373 |
val = (Int_t)de->calselftrig[sec][6]; |
val = (Int_t)de->calselftrig[sec][6]; |
374 |
del = delay(val); |
del = delay(val); |
375 |
if ( del < 1100 ){ |
if ( del < 1100 ){ |
376 |
|
clevel2->wartrig = 0.; |
377 |
clevel2->trigty = 3.; |
clevel2->trigty = 3.; |
378 |
|
ck = true; |
379 |
break; |
break; |
380 |
}; |
}; |
381 |
}; |
}; |
382 |
|
if ( !ck ) clevel2->wartrig = 100.; |
383 |
|
} else { |
384 |
|
Bool_t ck = false; |
385 |
|
for (Int_t sec = 0; sec < 4; sec++){ |
386 |
|
val = (Int_t)de->calselftrig[sec][6]; |
387 |
|
del = delay(val); |
388 |
|
if ( del < 1100 ){ |
389 |
|
clevel2->wartrig = 0.; |
390 |
|
ck = true; |
391 |
|
}; |
392 |
|
}; |
393 |
|
if ( !ck ) clevel2->wartrig = 100.; |
394 |
}; |
}; |
395 |
// |
// |
396 |
Int_t se = 5; |
Int_t se = 5; |
580 |
}; |
}; |
581 |
}; |
}; |
582 |
}; |
}; |
583 |
if (ck == 1){ |
if ( crosst ){ |
584 |
if (ip[i]%2 == 0) { |
if (ck == 1){ |
585 |
ipre = ip[i] + 1; |
if (ip[i]%2 == 0) { |
586 |
} else { |
ipre = ip[i] + 1; |
587 |
ipre = ip[i] - 1; |
} else { |
588 |
}; |
ipre = ip[i] - 1; |
589 |
for (Int_t j = ipre*16 ; j < (ipre+1)*16 ; j++){ |
}; |
590 |
clevel1->estrip[j][m][l] += (qpre[ipre] - qpre[ip[i]]) * 0.00478; |
for (Int_t j = ipre*16 ; j < (ipre+1)*16 ; j++){ |
591 |
|
clevel1->estrip[j][m][l] += (qpre[ipre] - qpre[ip[i]]) * 0.00478; |
592 |
|
}; |
593 |
}; |
}; |
594 |
}; |
if (ck == 2){ |
595 |
if (ck == 2){ |
for (Int_t j = i*32 ; j < (i+1)*32 ; j++){ |
596 |
for (Int_t j = i*32 ; j < (i+1)*32 ; j++){ |
ipre = j/16 + 1; |
597 |
ipre = j/16 + 1; |
clevel1->estrip[j][m][l] += qpre[ipre] * 0.00478; |
598 |
clevel1->estrip[j][m][l] += qpre[ipre] * 0.00478; |
}; |
599 |
}; |
}; |
600 |
}; |
}; |
601 |
}; |
}; |
602 |
// |
// |
603 |
if ( ener0 == 0. && cbase0 == 0. && !pproblem ){ |
if ( ener0 == 0. && cbase0 == 0. && !pproblem && clevel2->perr[se] == 0){ |
604 |
if ( verbose ) printf(" Calorimeter power problems! event marked as bad \n"); |
if ( verbose ) printf(" L0 entry %i : calorimeter power problems! event marked as bad perr %f swerr %X view %i plane %i \n",ei,de->perror[se],de->stwerr[se],l,m); |
605 |
pproblem = true; |
pproblem = true; |
606 |
pe++; |
pe++; |
607 |
}; |
}; |
614 |
jjj++; |
jjj++; |
615 |
j4++; |
j4++; |
616 |
if ( j < 96 ) ene[j] = clevel1->estrip[j][m][l]; |
if ( j < 96 ) ene[j] = clevel1->estrip[j][m][l]; |
617 |
if ( jj >= 0 && jj < 96 ){ |
if ( crosst ){ |
618 |
if ( jj != 0 && jj != 32 && jj != 64 ) ene[jj-1] += -clevel1->estrip[jj][m][l] * 0.01581; |
if ( jj >= 0 && jj < 96 ){ |
619 |
if ( jj != 31 && jj != 63 && jj != 95 ) ene[jj+1] += -clevel1->estrip[jj][m][l] * 0.01581; |
if ( jj != 0 && jj != 32 && jj != 64 ) ene[jj-1] += -clevel1->estrip[jj][m][l] * 0.01581; |
620 |
}; |
if ( jj != 31 && jj != 63 && jj != 95 ) ene[jj+1] += -clevel1->estrip[jj][m][l] * 0.01581; |
621 |
if ( jjj >= 0 && jjj < 96 ){ |
}; |
622 |
if ( jjj != 0 && jjj != 32 && jjj != 64 ) clevel1->estrip[jjj-1][m][l] += -ene[jjj] * 0.01581; |
if ( jjj >= 0 && jjj < 96 ){ |
623 |
if ( jjj != 31 && jjj != 63 && jjj != 95 ) clevel1->estrip[jjj+1][m][l] += -ene[jjj] * 0.01581; |
if ( jjj != 0 && jjj != 32 && jjj != 64 ) clevel1->estrip[jjj-1][m][l] += -ene[jjj] * 0.01581; |
624 |
|
if ( jjj != 31 && jjj != 63 && jjj != 95 ) clevel1->estrip[jjj+1][m][l] += -ene[jjj] * 0.01581; |
625 |
|
}; |
626 |
}; |
}; |
627 |
if ( j4 >= 0 && j4 < 96 ){ |
if ( j4 >= 0 && j4 < 96 ){ |
628 |
// |
// |
639 |
tim = 100000.; |
tim = 100000.; |
640 |
plo = m; |
plo = m; |
641 |
fbi = 0; |
fbi = 0; |
642 |
if ( clevel1->estrip[j4][m][l] > 1. ){ |
if ( clevel1->estrip[j4][m][l] > 0.99995 ){ |
643 |
tim = 10000.; |
tim = 10000.; |
644 |
plo = m; |
plo = m; |
645 |
fbi = 1; |
fbi = 1; |
646 |
}; |
}; |
647 |
if ( clevel1->estrip[j4][m][l] > 10. ){ |
if ( clevel1->estrip[j4][m][l] > 9.9995 ){ |
648 |
tim = 1000.; |
tim = 1000.; |
649 |
plo = 22 + m; |
plo = 22 + m; |
650 |
fbi = 1; |
fbi = 1; |
651 |
}; |
}; |
652 |
if ( clevel1->estrip[j4][m][l] > 100. ){ |
if ( clevel1->estrip[j4][m][l] > 99.995 ){ |
653 |
tim = 100.; |
tim = 100.; |
654 |
plo = 22 + m; |
plo = 22 + m; |
655 |
fbi = 0; |
fbi = 0; |
656 |
}; |
}; |
657 |
if ( clevel1->estrip[j4][m][l] > 1000. ){ |
if ( clevel1->estrip[j4][m][l] > 999.95 ){ |
658 |
tim = 10.; |
tim = 10.; |
659 |
plo = 44 + m; |
plo = 44 + m; |
660 |
fbi = 0; |
fbi = 0; |
661 |
}; |
}; |
662 |
if ( clevel1->estrip[j4][m][l] > 10000. ){ |
if ( clevel1->estrip[j4][m][l] > 9999.5 ){ |
663 |
tim = 1.; |
tim = 1.; |
664 |
plo = 66 + m; |
plo = 66 + m; |
665 |
fbi = 0; |
fbi = 0; |
675 |
} else { |
} else { |
676 |
svstrip[istrip] = -(fbi*1000000000 + plo*10000000 + j4*100000 + cle); |
svstrip[istrip] = -(fbi*1000000000 + plo*10000000 + j4*100000 + cle); |
677 |
}; |
}; |
678 |
// if ( ei == 770 ) printf(" j %i l %i m %i estrip %f \n",j4,l,m,clevel1->estrip[j4][m][l]); |
// |
679 |
// if ( ei == 770 ) printf(" num lim %i fbi %i tim %f plo %i cle %i \n",numeric_limits<Int_t>::max(),fbi,tim,plo,cle); |
// if ( ei >= -770 ) printf(" j %i l %i m %i estrip %f \n",j4,l,m,clevel1->estrip[j4][m][l]); |
680 |
// if ( ei == 770 ) printf(" svstrip %i \n",svstrip[istrip]); |
// if ( ei >= -770 ) printf(" num lim %i fbi %i tim %f plo %i cle %i \n",numeric_limits<Int_t>::max(),fbi,tim,plo,cle); |
681 |
|
// if ( ei >= -770 ) printf(" svstrip %i \n",svstrip[istrip]); |
682 |
// |
// |
683 |
istrip++; |
istrip++; |
684 |
}; |
}; |
733 |
t_ca->qlow = clevel2->qlow; |
t_ca->qlow = clevel2->qlow; |
734 |
t_ca->nlow = (Int_t)clevel2->nlow; |
t_ca->nlow = (Int_t)clevel2->nlow; |
735 |
// |
// |
|
memcpy(t_ca->tibar,clevel2->tibar,sizeof(clevel2->tibar)); |
|
|
memcpy(t_ca->tbar,clevel2->tbar,sizeof(clevel2->tbar)); |
|
|
// |
|
736 |
if ( trkseqno == -1 ){ |
if ( trkseqno == -1 ){ |
737 |
ca->impx = clevel2->impx; |
// ca->impx = clevel2->impx; |
738 |
ca->impy = clevel2->impy; |
// ca->impy = clevel2->impy; |
739 |
ca->tanx = clevel2->tanx; |
ca->tanx[1] = clevel2->tanx; |
740 |
ca->tany = clevel2->tany; |
ca->tany[1] = clevel2->tany; |
741 |
ca->elen = clevel2->elen; |
ca->elen = clevel2->elen; |
742 |
ca->selen = clevel2->selen; |
ca->selen = clevel2->selen; |
743 |
memcpy(ca->cibar,clevel2->cibar,sizeof(clevel2->cibar)); |
// memcpy(ca->cibar,clevel2->cibar,sizeof(clevel2->cibar)); |
744 |
memcpy(ca->cbar,clevel2->cbar,sizeof(clevel2->cbar)); |
// memcpy(ca->cbar,clevel2->cbar,sizeof(clevel2->cbar)); |
745 |
|
memcpy(t_ca->tibar,clevel2->cibar,sizeof(clevel2->cibar)); |
746 |
|
memcpy(t_ca->tbar,clevel2->cbar,sizeof(clevel2->cbar)); |
747 |
memcpy(ca->planemax,clevel2->planemax,sizeof(clevel2->planemax)); |
memcpy(ca->planemax,clevel2->planemax,sizeof(clevel2->planemax)); |
748 |
memcpy(ca->varcfit,clevel2->varcfit,sizeof(clevel2->varcfit)); |
ca->varcfit[2] = clevel2->varcfit[0]; |
749 |
memcpy(ca->npcfit,clevel2->npcfit,sizeof(clevel2->npcfit)); |
ca->varcfit[3] = clevel2->varcfit[1]; |
750 |
|
ca->npcfit[2] = clevel2->npcfit[0]; |
751 |
|
ca->npcfit[3] = clevel2->npcfit[1]; |
752 |
|
// memcpy(ca->varcfit,clevel2->varcfit,sizeof(clevel2->varcfit)); |
753 |
|
// memcpy(ca->npcfit,clevel2->npcfit,sizeof(clevel2->npcfit)); |
754 |
|
} else { |
755 |
|
memcpy(t_ca->tibar,clevel2->tibar,sizeof(clevel2->tibar)); |
756 |
|
memcpy(t_ca->tbar,clevel2->tbar,sizeof(clevel2->tbar)); |
757 |
}; |
}; |
758 |
|
// |
759 |
// |
// |
760 |
|
if ( !(ca->CaloTrk) ) ca->CaloTrk = new TClonesArray("CaloTrkVar",1); //ELENA |
761 |
TClonesArray &t = *ca->CaloTrk; |
TClonesArray &t = *ca->CaloTrk; |
762 |
new(t[nutrk]) CaloTrkVar(*t_ca); |
new(t[nutrk]) CaloTrkVar(*t_ca); |
763 |
// |
// |
770 |
calol2cm(); |
calol2cm(); |
771 |
} |
} |
772 |
|
|
773 |
void CaloProcessing::FillCommonVar(CaloLevel2 *ca){ |
void CaloProcessing::FillCommonVar(CaloLevel1 *c1, CaloLevel2 *ca){ |
774 |
// |
// |
775 |
ca->good = clevel2->good; |
ca->good = clevel2->good; |
776 |
if ( clevel2->trigty == 2. ){ |
if ( clevel2->trigty == 2. ){ |
778 |
} else { |
} else { |
779 |
ca->selftrigger = 0; |
ca->selftrigger = 0; |
780 |
}; |
}; |
781 |
|
// |
782 |
|
ca->selftrigger += (Int_t)clevel2->wartrig; |
783 |
|
// |
784 |
memcpy(ca->perr,clevel2->perr,sizeof(clevel2->perr)); |
memcpy(ca->perr,clevel2->perr,sizeof(clevel2->perr)); |
785 |
memcpy(ca->swerr,clevel2->swerr,sizeof(clevel2->swerr)); |
memcpy(ca->swerr,clevel2->swerr,sizeof(clevel2->swerr)); |
786 |
memcpy(ca->crc,clevel2->crc,sizeof(clevel2->crc)); |
memcpy(ca->crc,clevel2->crc,sizeof(clevel2->crc)); |
787 |
ca->nstrip = (Int_t)clevel2->nstrip; |
ca->nstrip = (Int_t)clevel2->nstrip; |
788 |
ca->qtot = clevel2->qtot; |
ca->qtot = clevel2->qtot; |
789 |
ca->impx = clevel2->impx; |
// ca->impx = clevel2->impx; |
790 |
ca->impy = clevel2->impy; |
// ca->impy = clevel2->impy; |
791 |
ca->tanx = clevel2->tanx; |
ca->tanx[0] = clevel2->tanx; |
792 |
ca->tany = clevel2->tany; |
ca->tany[0] = clevel2->tany; |
793 |
ca->nx22 = (Int_t)clevel2->nx22; |
ca->nx22 = (Int_t)clevel2->nx22; |
794 |
ca->qx22 = clevel2->qx22; |
ca->qx22 = clevel2->qx22; |
795 |
ca->qmax = clevel2->qmax; |
ca->qmax = clevel2->qmax; |
796 |
ca->elen = clevel2->elen; |
ca->elen = clevel2->elen; |
797 |
ca->selen = clevel2->selen; |
ca->selen = clevel2->selen; |
|
ca->estrip = TArrayI(ca->nstrip,svstrip); |
|
798 |
memcpy(ca->qq,clevel2->qq,sizeof(clevel2->qq)); |
memcpy(ca->qq,clevel2->qq,sizeof(clevel2->qq)); |
799 |
memcpy(ca->planemax,clevel2->planemax,sizeof(clevel2->planemax)); |
memcpy(ca->planemax,clevel2->planemax,sizeof(clevel2->planemax)); |
800 |
memcpy(ca->varcfit,clevel2->varcfit,sizeof(clevel2->varcfit)); |
ca->varcfit[0] = clevel2->varcfit[0]; |
801 |
memcpy(ca->npcfit,clevel2->npcfit,sizeof(clevel2->npcfit)); |
ca->varcfit[1] = clevel2->varcfit[1]; |
802 |
|
ca->npcfit[0] = clevel2->npcfit[0]; |
803 |
|
ca->npcfit[1] = clevel2->npcfit[1]; |
804 |
|
ca->fitmode[0] = clevel2->fmode[0]; |
805 |
|
ca->fitmode[1] = clevel2->fmode[1]; |
806 |
|
// memcpy(ca->varcfit,clevel2->varcfit,sizeof(clevel2->varcfit)); |
807 |
|
// memcpy(ca->npcfit,clevel2->npcfit,sizeof(clevel2->npcfit)); |
808 |
memcpy(ca->cibar,clevel2->cibar,sizeof(clevel2->cibar)); |
memcpy(ca->cibar,clevel2->cibar,sizeof(clevel2->cibar)); |
809 |
memcpy(ca->cbar,clevel2->cbar,sizeof(clevel2->cbar)); |
memcpy(ca->cbar,clevel2->cbar,sizeof(clevel2->cbar)); |
810 |
// |
// |
811 |
|
if ( c1 ){ |
812 |
|
c1->istrip = istrip; |
813 |
|
c1->estrip = TArrayI(istrip,svstrip); |
814 |
|
}; |
815 |
|
// |
816 |
} |
} |
817 |
|
|
818 |
void CaloProcessing::ClearStructs(){ |
void CaloProcessing::ClearStructs(){ |
869 |
void CaloProcessing::ClearCommonVar(){ |
void CaloProcessing::ClearCommonVar(){ |
870 |
istrip = 0; |
istrip = 0; |
871 |
clevel2->trigty = -1.; |
clevel2->trigty = -1.; |
872 |
|
clevel2->wartrig = 0.; |
873 |
clevel2->good = 0; |
clevel2->good = 0; |
874 |
clevel2->nstrip = 0.; |
clevel2->nstrip = 0.; |
875 |
clevel2->qtot = 0.; |
clevel2->qtot = 0.; |
876 |
clevel2->impx = 0.; |
// clevel2->impx = 0.; |
877 |
clevel2->impy = 0.; |
// clevel2->impy = 0.; |
878 |
clevel2->tanx = 0.; |
clevel2->tanx = 0.; // this is correct since it refers to the fortran structure |
879 |
clevel2->tany = 0.; |
clevel2->tany = 0.; // this is correct since it refers to the fortran structure |
880 |
clevel2->qmax = 0.; |
clevel2->qmax = 0.; |
881 |
clevel2->nx22 = 0.; |
clevel2->nx22 = 0.; |
882 |
clevel2->qx22 = 0.; |
clevel2->qx22 = 0.; |
884 |
memset(clevel2->swerr, 0, 4*sizeof(Int_t)); |
memset(clevel2->swerr, 0, 4*sizeof(Int_t)); |
885 |
memset(clevel2->crc, 0, 4*sizeof(Int_t)); |
memset(clevel2->crc, 0, 4*sizeof(Int_t)); |
886 |
memset(clevel2->qq, 0, 4*sizeof(Int_t)); |
memset(clevel2->qq, 0, 4*sizeof(Int_t)); |
887 |
memset(clevel2->varcfit, 0, 2*sizeof(Float_t)); |
memset(clevel2->varcfit, 0, 4*sizeof(Float_t)); |
888 |
memset(clevel2->npcfit, 0, 2*sizeof(Int_t)); |
memset(clevel2->npcfit, 0, 4*sizeof(Int_t)); |
889 |
memset(clevel2->planemax, 0, 2*sizeof(Int_t)); |
memset(clevel2->planemax, 0, 2*sizeof(Int_t)); |
890 |
|
memset(clevel2->fmode, 0, 2*sizeof(Int_t)); |
891 |
memset(clevel2->cibar, 0, 2*22*sizeof(Int_t)); |
memset(clevel2->cibar, 0, 2*22*sizeof(Int_t)); |
892 |
memset(clevel2->cbar, 0, 2*22*sizeof(Float_t)); |
memset(clevel2->cbar, 0, 2*22*sizeof(Float_t)); |
893 |
} |
} |