--- DarthVader/CalorimeterLevel2/src/CaloProcessing.cpp 2006/11/17 10:08:08 1.7 +++ DarthVader/CalorimeterLevel2/src/CaloProcessing.cpp 2007/02/13 16:55:08 1.13 @@ -67,6 +67,7 @@ calopar1 = true; calopar2 = true; calopar3 = true; + crosst = true; ftcalopar1 = 0; ttcalopar1 = 0; ftcalopar2 = 0; @@ -75,6 +76,10 @@ ttcalopar3 = 0; } +void CaloProcessing::SetCrossTalk(Bool_t ct){ + crosst = ct; +}; + /** * Initialize CaloProcessing object **/ @@ -363,14 +368,29 @@ Int_t val = 0; Int_t del = 1100; if ( clevel2->trigty != 2. ){ + Bool_t ck = false; for (Int_t sec = 0; sec < 4; sec++){ val = (Int_t)de->calselftrig[sec][6]; del = delay(val); if ( del < 1100 ){ + clevel2->wartrig = 0.; clevel2->trigty = 3.; + ck = true; break; }; }; + if ( !ck ) clevel2->wartrig = 100.; + } else { + Bool_t ck = false; + for (Int_t sec = 0; sec < 4; sec++){ + val = (Int_t)de->calselftrig[sec][6]; + del = delay(val); + if ( del < 1100 ){ + clevel2->wartrig = 0.; + ck = true; + }; + }; + if ( !ck ) clevel2->wartrig = 100.; }; // Int_t se = 5; @@ -560,26 +580,28 @@ }; }; }; - if (ck == 1){ - if (ip[i]%2 == 0) { - ipre = ip[i] + 1; - } else { - ipre = ip[i] - 1; - }; - for (Int_t j = ipre*16 ; j < (ipre+1)*16 ; j++){ - clevel1->estrip[j][m][l] += (qpre[ipre] - qpre[ip[i]]) * 0.00478; + if ( crosst ){ + if (ck == 1){ + if (ip[i]%2 == 0) { + ipre = ip[i] + 1; + } else { + ipre = ip[i] - 1; + }; + for (Int_t j = ipre*16 ; j < (ipre+1)*16 ; j++){ + clevel1->estrip[j][m][l] += (qpre[ipre] - qpre[ip[i]]) * 0.00478; + }; }; - }; - if (ck == 2){ - for (Int_t j = i*32 ; j < (i+1)*32 ; j++){ - ipre = j/16 + 1; - clevel1->estrip[j][m][l] += qpre[ipre] * 0.00478; + if (ck == 2){ + for (Int_t j = i*32 ; j < (i+1)*32 ; j++){ + ipre = j/16 + 1; + clevel1->estrip[j][m][l] += qpre[ipre] * 0.00478; + }; }; }; }; // - if ( ener0 == 0. && cbase0 == 0. && !pproblem ){ - if ( verbose ) printf(" Calorimeter power problems! event marked as bad \n"); + if ( ener0 == 0. && cbase0 == 0. && !pproblem && clevel2->perr[se] == 0){ + 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); pproblem = true; pe++; }; @@ -592,13 +614,15 @@ jjj++; j4++; if ( j < 96 ) ene[j] = clevel1->estrip[j][m][l]; - if ( jj >= 0 && jj < 96 ){ - if ( jj != 0 && jj != 32 && jj != 64 ) ene[jj-1] += -clevel1->estrip[jj][m][l] * 0.01581; - if ( jj != 31 && jj != 63 && jj != 95 ) ene[jj+1] += -clevel1->estrip[jj][m][l] * 0.01581; - }; - if ( jjj >= 0 && jjj < 96 ){ - if ( jjj != 0 && jjj != 32 && jjj != 64 ) clevel1->estrip[jjj-1][m][l] += -ene[jjj] * 0.01581; - if ( jjj != 31 && jjj != 63 && jjj != 95 ) clevel1->estrip[jjj+1][m][l] += -ene[jjj] * 0.01581; + if ( crosst ){ + if ( jj >= 0 && jj < 96 ){ + if ( jj != 0 && jj != 32 && jj != 64 ) ene[jj-1] += -clevel1->estrip[jj][m][l] * 0.01581; + if ( jj != 31 && jj != 63 && jj != 95 ) ene[jj+1] += -clevel1->estrip[jj][m][l] * 0.01581; + }; + if ( jjj >= 0 && jjj < 96 ){ + if ( jjj != 0 && jjj != 32 && jjj != 64 ) clevel1->estrip[jjj-1][m][l] += -ene[jjj] * 0.01581; + if ( jjj != 31 && jjj != 63 && jjj != 95 ) clevel1->estrip[jjj+1][m][l] += -ene[jjj] * 0.01581; + }; }; if ( j4 >= 0 && j4 < 96 ){ // @@ -615,27 +639,27 @@ tim = 100000.; plo = m; fbi = 0; - if ( clevel1->estrip[j4][m][l] > 1. ){ + if ( clevel1->estrip[j4][m][l] > 0.99995 ){ tim = 10000.; plo = m; fbi = 1; }; - if ( clevel1->estrip[j4][m][l] > 10. ){ + if ( clevel1->estrip[j4][m][l] > 9.9995 ){ tim = 1000.; plo = 22 + m; fbi = 1; }; - if ( clevel1->estrip[j4][m][l] > 100. ){ + if ( clevel1->estrip[j4][m][l] > 99.995 ){ tim = 100.; plo = 22 + m; fbi = 0; }; - if ( clevel1->estrip[j4][m][l] > 1000. ){ + if ( clevel1->estrip[j4][m][l] > 999.95 ){ tim = 10.; plo = 44 + m; fbi = 0; }; - if ( clevel1->estrip[j4][m][l] > 10000. ){ + if ( clevel1->estrip[j4][m][l] > 9999.5 ){ tim = 1.; plo = 66 + m; fbi = 0; @@ -651,9 +675,10 @@ } else { svstrip[istrip] = -(fbi*1000000000 + plo*10000000 + j4*100000 + cle); }; - // if ( ei == 770 ) printf(" j %i l %i m %i estrip %f \n",j4,l,m,clevel1->estrip[j4][m][l]); - // if ( ei == 770 ) printf(" num lim %i fbi %i tim %f plo %i cle %i \n",numeric_limits::max(),fbi,tim,plo,cle); - // if ( ei == 770 ) printf(" svstrip %i \n",svstrip[istrip]); + // + // if ( ei >= -770 ) printf(" j %i l %i m %i estrip %f \n",j4,l,m,clevel1->estrip[j4][m][l]); + // if ( ei >= -770 ) printf(" num lim %i fbi %i tim %f plo %i cle %i \n",numeric_limits::max(),fbi,tim,plo,cle); + // if ( ei >= -770 ) printf(" svstrip %i \n",svstrip[istrip]); // istrip++; }; @@ -708,23 +733,31 @@ t_ca->qlow = clevel2->qlow; t_ca->nlow = (Int_t)clevel2->nlow; // - memcpy(t_ca->tibar,clevel2->tibar,sizeof(clevel2->tibar)); - memcpy(t_ca->tbar,clevel2->tbar,sizeof(clevel2->tbar)); - // if ( trkseqno == -1 ){ - ca->impx = clevel2->impx; - ca->impy = clevel2->impy; - ca->tanx = clevel2->tanx; - ca->tany = clevel2->tany; + // ca->impx = clevel2->impx; + // ca->impy = clevel2->impy; + ca->tanx[1] = clevel2->tanx; + ca->tany[1] = clevel2->tany; ca->elen = clevel2->elen; ca->selen = clevel2->selen; - memcpy(ca->cibar,clevel2->cibar,sizeof(clevel2->cibar)); - memcpy(ca->cbar,clevel2->cbar,sizeof(clevel2->cbar)); + // memcpy(ca->cibar,clevel2->cibar,sizeof(clevel2->cibar)); + // memcpy(ca->cbar,clevel2->cbar,sizeof(clevel2->cbar)); + memcpy(t_ca->tibar,clevel2->cibar,sizeof(clevel2->cibar)); + memcpy(t_ca->tbar,clevel2->cbar,sizeof(clevel2->cbar)); memcpy(ca->planemax,clevel2->planemax,sizeof(clevel2->planemax)); - memcpy(ca->varcfit,clevel2->varcfit,sizeof(clevel2->varcfit)); - memcpy(ca->npcfit,clevel2->npcfit,sizeof(clevel2->npcfit)); + ca->varcfit[2] = clevel2->varcfit[0]; + ca->varcfit[3] = clevel2->varcfit[1]; + ca->npcfit[2] = clevel2->npcfit[0]; + ca->npcfit[3] = clevel2->npcfit[1]; + // memcpy(ca->varcfit,clevel2->varcfit,sizeof(clevel2->varcfit)); + // memcpy(ca->npcfit,clevel2->npcfit,sizeof(clevel2->npcfit)); + } else { + memcpy(t_ca->tibar,clevel2->tibar,sizeof(clevel2->tibar)); + memcpy(t_ca->tbar,clevel2->tbar,sizeof(clevel2->tbar)); }; + // // + if ( !(ca->CaloTrk) ) ca->CaloTrk = new TClonesArray("CaloTrkVar",1); //ELENA TClonesArray &t = *ca->CaloTrk; new(t[nutrk]) CaloTrkVar(*t_ca); // @@ -737,7 +770,7 @@ calol2cm(); } -void CaloProcessing::FillCommonVar(CaloLevel2 *ca){ +void CaloProcessing::FillCommonVar(CaloLevel1 *c1, CaloLevel2 *ca){ // ca->good = clevel2->good; if ( clevel2->trigty == 2. ){ @@ -745,28 +778,41 @@ } else { ca->selftrigger = 0; }; + // + ca->selftrigger += (Int_t)clevel2->wartrig; + // memcpy(ca->perr,clevel2->perr,sizeof(clevel2->perr)); memcpy(ca->swerr,clevel2->swerr,sizeof(clevel2->swerr)); memcpy(ca->crc,clevel2->crc,sizeof(clevel2->crc)); ca->nstrip = (Int_t)clevel2->nstrip; ca->qtot = clevel2->qtot; - ca->impx = clevel2->impx; - ca->impy = clevel2->impy; - ca->tanx = clevel2->tanx; - ca->tany = clevel2->tany; + // ca->impx = clevel2->impx; + // ca->impy = clevel2->impy; + ca->tanx[0] = clevel2->tanx; + ca->tany[0] = clevel2->tany; ca->nx22 = (Int_t)clevel2->nx22; ca->qx22 = clevel2->qx22; ca->qmax = clevel2->qmax; ca->elen = clevel2->elen; ca->selen = clevel2->selen; - ca->estrip = TArrayI(ca->nstrip,svstrip); memcpy(ca->qq,clevel2->qq,sizeof(clevel2->qq)); memcpy(ca->planemax,clevel2->planemax,sizeof(clevel2->planemax)); - memcpy(ca->varcfit,clevel2->varcfit,sizeof(clevel2->varcfit)); - memcpy(ca->npcfit,clevel2->npcfit,sizeof(clevel2->npcfit)); + ca->varcfit[0] = clevel2->varcfit[0]; + ca->varcfit[1] = clevel2->varcfit[1]; + ca->npcfit[0] = clevel2->npcfit[0]; + ca->npcfit[1] = clevel2->npcfit[1]; + ca->fitmode[0] = clevel2->fmode[0]; + ca->fitmode[1] = clevel2->fmode[1]; + // memcpy(ca->varcfit,clevel2->varcfit,sizeof(clevel2->varcfit)); + // memcpy(ca->npcfit,clevel2->npcfit,sizeof(clevel2->npcfit)); memcpy(ca->cibar,clevel2->cibar,sizeof(clevel2->cibar)); memcpy(ca->cbar,clevel2->cbar,sizeof(clevel2->cbar)); // + if ( c1 ){ + c1->istrip = istrip; + c1->estrip = TArrayI(istrip,svstrip); + }; + // } void CaloProcessing::ClearStructs(){ @@ -823,13 +869,14 @@ void CaloProcessing::ClearCommonVar(){ istrip = 0; clevel2->trigty = -1.; + clevel2->wartrig = 0.; clevel2->good = 0; clevel2->nstrip = 0.; clevel2->qtot = 0.; - clevel2->impx = 0.; - clevel2->impy = 0.; - clevel2->tanx = 0.; - clevel2->tany = 0.; + // clevel2->impx = 0.; + // clevel2->impy = 0.; + clevel2->tanx = 0.; // this is correct since it refers to the fortran structure + clevel2->tany = 0.; // this is correct since it refers to the fortran structure clevel2->qmax = 0.; clevel2->nx22 = 0.; clevel2->qx22 = 0.; @@ -837,9 +884,10 @@ memset(clevel2->swerr, 0, 4*sizeof(Int_t)); memset(clevel2->crc, 0, 4*sizeof(Int_t)); memset(clevel2->qq, 0, 4*sizeof(Int_t)); - memset(clevel2->varcfit, 0, 2*sizeof(Float_t)); - memset(clevel2->npcfit, 0, 2*sizeof(Int_t)); + memset(clevel2->varcfit, 0, 4*sizeof(Float_t)); + memset(clevel2->npcfit, 0, 4*sizeof(Int_t)); memset(clevel2->planemax, 0, 2*sizeof(Int_t)); + memset(clevel2->fmode, 0, 2*sizeof(Int_t)); memset(clevel2->cibar, 0, 2*22*sizeof(Int_t)); memset(clevel2->cbar, 0, 2*22*sizeof(Float_t)); }