56 |
clevel1 = &clevel1_; |
clevel1 = &clevel1_; |
57 |
clevel2 = &clevel2_; |
clevel2 = &clevel2_; |
58 |
// |
// |
59 |
|
// extern struct FlEventi eventi_; |
60 |
|
// extern struct FlGruppo gruppo_; |
61 |
|
// extern struct FlGruppo2 gruppo2_; |
62 |
|
// extern struct FlGruppo4 gruppo4_; |
63 |
|
// extern struct FlTaglioen taglioen_; |
64 |
|
// extern struct FlAngolo angolo_; |
65 |
|
// extern struct FlWhere where_; |
66 |
|
// extern struct FlGeneral general_; |
67 |
|
// extern struct FlCh ch_; |
68 |
|
// extern struct FlCalofit calofit_; |
69 |
|
// extern struct FlPawcd pawcd_; |
70 |
|
// extern struct FlQuestd questd_; |
71 |
|
// eventi = &eventi_; |
72 |
|
// gruppo = &gruppo_; |
73 |
|
// gruppo2 = &gruppo2_; |
74 |
|
// gruppo4 = &gruppo4_; |
75 |
|
// taglioen = &taglioen_; |
76 |
|
// angolo = &angolo_; |
77 |
|
// where = &where_; |
78 |
|
// general = &general_; |
79 |
|
// ch = &ch_; |
80 |
|
// calofit = &calofit_; |
81 |
|
// pawcd = &pawcd_; |
82 |
|
// questd = &questd_; |
83 |
|
// |
84 |
trkseqno = 0; |
trkseqno = 0; |
85 |
ClearStructs(); |
ClearStructs(); |
86 |
// |
// |
100 |
calopar4 = true; |
calopar4 = true; |
101 |
calopar5 = true; |
calopar5 = true; |
102 |
crosst = true; |
crosst = true; |
103 |
|
mask18 = false; |
104 |
ftcalopar1 = 0; |
ftcalopar1 = 0; |
105 |
ttcalopar1 = 0; |
ttcalopar1 = 0; |
106 |
ftcalopar2 = 0; |
ftcalopar2 = 0; |
158 |
this->InitDo(dbc,hs,sgnl,l0tree,isdeb,isverb); |
this->InitDo(dbc,hs,sgnl,l0tree,isdeb,isverb); |
159 |
dbc->Close(); |
dbc->Close(); |
160 |
delete dbc; |
delete dbc; |
161 |
|
dbc = 0; |
162 |
} |
} |
163 |
|
|
164 |
|
|
278 |
Int_t sig = this->ChkParamDo(dbc,runheader,mechal); |
Int_t sig = this->ChkParamDo(dbc,runheader,mechal); |
279 |
dbc->Close(); |
dbc->Close(); |
280 |
delete dbc; |
delete dbc; |
281 |
|
dbc = 0; |
282 |
return(sig); |
return(sig); |
283 |
} |
} |
284 |
|
|
604 |
Int_t sig = CalcCrossTalkCorrDo(dbc,runheader,usetable); |
Int_t sig = CalcCrossTalkCorrDo(dbc,runheader,usetable); |
605 |
dbc->Close(); |
dbc->Close(); |
606 |
delete dbc; |
delete dbc; |
607 |
|
dbc = 0; |
608 |
// |
// |
609 |
return(sig); |
return(sig); |
610 |
// |
// |
624 |
Int_t sig = CalcCrossTalkCorrDo(dbc,runheader,true); |
Int_t sig = CalcCrossTalkCorrDo(dbc,runheader,true); |
625 |
dbc->Close(); |
dbc->Close(); |
626 |
delete dbc; |
delete dbc; |
627 |
|
dbc = 0; |
628 |
// |
// |
629 |
return(sig); |
return(sig); |
630 |
// |
// |
745 |
// |
// |
746 |
if ( !ncalibs ) return(-110); |
if ( !ncalibs ) return(-110); |
747 |
// |
// |
748 |
calo->GetEntry(calibno); |
if ( calo->GetEntry(calibno) <= 0) throw -36; |
749 |
if ( verbose ) printf(" PULSE2 using entry %u from file %s",calibno,fcalname.Data()); |
if ( verbose ) printf(" PULSE2 using entry %u from file %s",calibno,fcalname.Data()); |
750 |
// |
// |
751 |
// retrieve calibration table |
// retrieve calibration table |
826 |
// |
// |
827 |
if ( !ncalibs ) return(-110); |
if ( !ncalibs ) return(-110); |
828 |
// |
// |
829 |
calo1->GetEntry(calibno); |
if ( calo1->GetEntry(calibno) <= 0 ) throw -36; |
830 |
if ( verbose ) printf(" PULSE1 using entry %u from file %s",calibno,fcalname.Data()); |
if ( verbose ) printf(" PULSE1 using entry %u from file %s",calibno,fcalname.Data()); |
831 |
// |
// |
832 |
// retrieve calibration table |
// retrieve calibration table |
1164 |
if ( strip6s < 4 && base[l][m][pre] > (-0.015*qp+sbase[l][m][pre]) && sbase[l][m][pre] > 0. ){ |
if ( strip6s < 4 && base[l][m][pre] > (-0.015*qp+sbase[l][m][pre]) && sbase[l][m][pre] > 0. ){ |
1165 |
if ( debug ) printf(" Suspicious calculated baseline: base %f sbase-0.02*qp %f strip6s %i \n",base[l][m][pre],(-qp*0.02+sbase[l][m][pre]),(Int_t)strip6s); |
if ( debug ) printf(" Suspicious calculated baseline: base %f sbase-0.02*qp %f strip6s %i \n",base[l][m][pre],(-qp*0.02+sbase[l][m][pre]),(Int_t)strip6s); |
1166 |
base[l][m][pre] = 31000.; |
base[l][m][pre] = 31000.; |
1167 |
|
nst = 0; // 9RED BUG |
1168 |
|
qp = 0.; // 9RED BUG |
1169 |
for (Int_t e = pre*16; e < (pre+1)*16 ; e++){ |
for (Int_t e = pre*16; e < (pre+1)*16 ; e++){ |
1170 |
dexyc[l][m][e] = dexy[l][m][e]; |
dexyc[l][m][e] = dexy[l][m][e]; |
1171 |
}; |
}; |
1172 |
}; |
}; |
1173 |
} else { |
} else { |
1174 |
|
if ( debug ) printf(" reset baseline here if ! ( (strip6s >=2 && process == 2) || (strip6s >= 9 and process > 2) ) \n"); |
1175 |
base[l][m][pre] = 31000.; |
base[l][m][pre] = 31000.; |
1176 |
|
nst = 0; // 9RED BUG |
1177 |
|
qp = 0.; // 9RED BUG |
1178 |
for (Int_t e = pre*16; e < (pre+1)*16 ; e++){ |
for (Int_t e = pre*16; e < (pre+1)*16 ; e++){ |
1179 |
dexyc[l][m][e] = dexy[l][m][e]; |
dexyc[l][m][e] = dexy[l][m][e]; |
1180 |
}; |
}; |
1181 |
}; |
}; |
1182 |
} else { |
} else { |
1183 |
|
if ( debug ) printf(" reset baseline here if no minimum find\n"); |
1184 |
|
nst = 0; // 9RED BUG |
1185 |
|
qp = 0.; // 9RED BUG |
1186 |
process += 2; |
process += 2; |
1187 |
base[l][m][pre] = 31000.; |
base[l][m][pre] = 31000.; |
1188 |
for (Int_t e = pre*16; e < (pre+1)*16 ; e++){ |
for (Int_t e = pre*16; e < (pre+1)*16 ; e++){ |
1190 |
}; |
}; |
1191 |
}; |
}; |
1192 |
}; |
}; |
1193 |
|
if ( debug ) printf(" Baseline calculation: baseline for view %i plane %i pre %i is %f nst %i qp %f \n",l,m,pre,base[l][m][pre],nst,qp); |
1194 |
} |
} |
1195 |
|
|
1196 |
Int_t CaloLevel0::Calibrate(Int_t ei){ |
Int_t CaloLevel0::Calibrate(Int_t ei){ |
1197 |
// |
// |
1198 |
// get entry ei |
// get entry ei |
1199 |
// |
// |
1200 |
l0calo->GetEntry(ei); |
if ( l0calo->GetEntry(ei) <= 0 ) throw -36; |
1201 |
// |
// |
1202 |
// if it was not a selftrigger event, could it ever been a selftrigger event? if so trigty = 3. |
// if it was not a selftrigger event, could it ever been a selftrigger event? if so trigty = 3. |
1203 |
// |
// |
1204 |
clevel2->nsatstrip = 0.; |
clevel2->nsatstrip = 0.; |
1205 |
Int_t val = 0; |
Int_t val = 0; |
1206 |
Int_t del = 1100; |
Int_t del = 1000; |
1207 |
for (Int_t sec = 0; sec < 4; sec++){ |
for (Int_t sec = 0; sec < 4; sec++){ |
1208 |
for (Int_t dsec = 0; dsec < 7; dsec++){ |
for (Int_t dsec = 0; dsec < 7; dsec++){ |
1209 |
val = (Int_t)de->calselftrig[sec][dsec]; |
val = (Int_t)de->calselftrig[sec][dsec]; |
1212 |
}; |
}; |
1213 |
}; |
}; |
1214 |
val = 0; |
val = 0; |
1215 |
del = 1100; |
del = 1000; |
1216 |
if ( clevel2->trigty != 2. ){ |
if ( clevel2->trigty < 2. ){ |
1217 |
Bool_t ck = false; |
// Bool_t ck = false; |
1218 |
for (Int_t sec = 0; sec < 4; sec++){ |
for (Int_t sec = 0; sec < 4; sec++){ |
1219 |
val = (Int_t)de->calselftrig[sec][6]; |
val = (Int_t)de->calselftrig[sec][6]; |
1220 |
del = delay(val); |
del = delay(val); |
1221 |
if ( del < 1100 ){ |
if ( del < 1000 ){ |
1222 |
clevel2->wartrig = 0.; |
clevel2->wartrig = 0.; |
1223 |
clevel2->trigty = 3.; |
clevel2->trigty = 3.; |
1224 |
ck = true; |
// ck = true; |
1225 |
break; |
break; |
1226 |
}; |
}; |
1227 |
}; |
}; |
1228 |
if ( !ck ) clevel2->wartrig = 100.; |
// if ( !ck ) clevel2->wartrig = 100.; |
1229 |
} else { |
} else { |
1230 |
Bool_t ck = false; |
Bool_t ck = false; |
1231 |
for (Int_t sec = 0; sec < 4; sec++){ |
for (Int_t sec = 0; sec < 4; sec++){ |
1232 |
val = (Int_t)de->calselftrig[sec][6]; |
val = (Int_t)de->calselftrig[sec][6]; |
1233 |
del = delay(val); |
del = delay(val); |
1234 |
if ( del < 1100 ){ |
if ( del < 1000 ){ |
1235 |
clevel2->wartrig = 0.; |
clevel2->wartrig = 0.; |
1236 |
ck = true; |
ck = true; |
1237 |
}; |
}; |
1242 |
Int_t se = 5; |
Int_t se = 5; |
1243 |
Int_t done = 0; |
Int_t done = 0; |
1244 |
Int_t pre = -1; |
Int_t pre = -1; |
1245 |
Bool_t isCOMP = false; |
// Bool_t isCOMP = false; |
1246 |
Bool_t isFULL = false; |
// Bool_t isFULL = false; |
1247 |
Bool_t isRAW = false; |
Bool_t isRAW = false; |
1248 |
Float_t ener; |
Float_t ener; |
1249 |
Int_t doneb = 0; |
Int_t doneb = 0; |
1266 |
// |
// |
1267 |
Float_t ener0 = 0.; |
Float_t ener0 = 0.; |
1268 |
Float_t cbase0 = 0.; |
Float_t cbase0 = 0.; |
1269 |
|
Float_t totbase = 0.; |
1270 |
|
Float_t totped = 0.; |
1271 |
Bool_t pproblem = false; |
Bool_t pproblem = false; |
1272 |
Bool_t negbase = false; |
Bool_t negbase = false; |
1273 |
// |
// |
1292 |
// |
// |
1293 |
// determine what kind of event we are going to analyze |
// determine what kind of event we are going to analyze |
1294 |
// |
// |
1295 |
isCOMP = false; |
// isCOMP = false; |
1296 |
isFULL = false; |
// isFULL = false; |
1297 |
isRAW = false; |
isRAW = false; |
1298 |
if ( de->stwerr[se] & (1 << 16) ) isCOMP = true; |
// if ( de->stwerr[se] & (1 << 16) ) isCOMP = true; |
1299 |
if ( de->stwerr[se] & (1 << 17) ) isFULL = true; |
// if ( de->stwerr[se] & (1 << 17) ) isFULL = true; |
1300 |
if ( de->stwerr[se] & (1 << 3) ) isRAW = true; |
if ( de->stwerr[se] & (1 << 3) ) isRAW = true; |
1301 |
if ( !chdone[se] ){ |
if ( !chdone[se] ){ |
1302 |
// |
// |
1309 |
}; |
}; |
1310 |
clevel2->perr[se] = 0; |
clevel2->perr[se] = 0; |
1311 |
if ( de->perror[se] != 0 ){ |
if ( de->perror[se] != 0 ){ |
1312 |
clevel2->perr[se] = de->perror[se]; |
clevel2->perr[se] = (Int_t)de->perror[se]; |
1313 |
pe++; |
pe++; |
1314 |
}; |
}; |
1315 |
clevel2->swerr[se] = 0; |
clevel2->swerr[se] = 0; |
1382 |
// |
// |
1383 |
pre = -1; |
pre = -1; |
1384 |
ener0 = 0.; |
ener0 = 0.; |
1385 |
|
totbase = 0.; |
1386 |
|
totped = 0.; |
1387 |
for (Int_t i = 0 ; i < 3 ; i++){ |
for (Int_t i = 0 ; i < 3 ; i++){ |
1388 |
ip[i] = 0; |
ip[i] = 0; |
1389 |
for (Int_t n = i*32 ; n < (i+1)*32 ; n++){ |
for (Int_t n = i*32 ; n < (i+1)*32 ; n++){ |
1401 |
// no suitable new baseline, use old ones! |
// no suitable new baseline, use old ones! |
1402 |
// |
// |
1403 |
if ( !done ){ |
if ( !done ){ |
1404 |
|
if ( debug ) printf(" l %i m %i pre %i ip[i] %i base %f base ip[i] %f sbase %f \n",l,m,pre,ip[i],base[l][m][pre],base[l][m][ip[i]],sbase[l][m][pre]); |
1405 |
if ( (base[l][m][pre] == 31000. || base[l][m][pre] == 0.) ){ |
if ( (base[l][m][pre] == 31000. || base[l][m][pre] == 0.) ){ |
1406 |
ck[l][m][pre] = 1; |
ck[l][m][pre] = 1; |
1407 |
if (pre%2 == 0) { |
if (pre%2 == 0) { |
1452 |
ener = dexyc[l][m][n]; |
ener = dexyc[l][m][n]; |
1453 |
ener0 += ener; |
ener0 += ener; |
1454 |
clevel1->estrip[n][m][l] = 0.; |
clevel1->estrip[n][m][l] = 0.; |
1455 |
|
totbase += de->base[l][m][pre]/96.; |
1456 |
|
totped += fabs(calped[l][m][n]); |
1457 |
if ( de->base[l][m][pre] < 0 ) negbase = true; |
if ( de->base[l][m][pre] < 0 ) negbase = true; |
1458 |
if ( base0>0 && base0 < 30000. ){ |
if ( base0>0 && base0 < 30000. ){ |
1459 |
// |
// |
1468 |
// |
// |
1469 |
// 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) |
1470 |
// |
// |
1471 |
|
if ( debug && l==0 && (m==17 || m==18) ) printf(" view %i plane %i strip %i ener %f calped %f base0 %f base1 %f base2 %f mip %f ENERGIA %f \n",l,m,n,ener,calped[l][m][n],base0,base1,base2,mip[l][m][n],clevel1->estrip[n][m][l]); |
1472 |
if ( clevel1->estrip[n][m][l] > 0. ) qpre[l][m][pre] += clevel1->estrip[n][m][l]; |
if ( clevel1->estrip[n][m][l] > 0. ) qpre[l][m][pre] += clevel1->estrip[n][m][l]; |
1473 |
// |
// |
1474 |
// |
// |
1478 |
}; |
}; |
1479 |
// |
// |
1480 |
// check if there were problems with 5.7 or glitches in the power supply |
// check if there were problems with 5.7 or glitches in the power supply |
1481 |
// |
// |
1482 |
if ( ((ener0 == 0. && cbase0 == 0.) || negbase ) && !pproblem && clevel2->perr[se] == 0){ |
// if ( ((ener0 == 0. && cbase0 == 0.) || negbase || totbase > 196600. || totped < 1. ) && !pproblem && clevel2->perr[se] == 0){ // check pedestal and baseline values for one plane, if all zeros calibration is not valid (calorimeter power problems) [8th data reduction bug, fixed on 25/11/2009 by E.M.] |
1483 |
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); |
if ( ((ener0 == 0. && cbase0 == 0.) || negbase || totbase > 32700. || totped < 1. ) && !pproblem && clevel2->perr[se] == 0){ // check pedestal and baseline values for one plane, if all zeros calibration is not valid (calorimeter power problems) [8th data reduction bug, fixed on 25/11/2009 by E.M.] |
1484 |
|
if ( verbose ) printf(" L0 entry %i : calorimeter power problems! event marked as bad perr %f swerr %X view %i plane %i negbase %i totbase %f totped %f\n",ei,de->perror[se],de->stwerr[se],l,m, negbase, totbase, totped); |
1485 |
pproblem = true; |
pproblem = true; |
1486 |
pe++; |
pe++; |
1487 |
}; |
}; |
1513 |
// |
// |
1514 |
// Cross-talk corrections |
// Cross-talk corrections |
1515 |
// |
// |
1516 |
if ( crosst ){ |
if ( crosst ){ |
1517 |
// |
// |
1518 |
// energy on silicon ladders |
// energy on silicon ladders |
1519 |
// |
// |
1530 |
if ( noselfct ){ |
if ( noselfct ){ |
1531 |
for (Int_t j = ladder*32 ; j < (ladder+1)*32 ; j++){ |
for (Int_t j = ladder*32 ; j < (ladder+1)*32 ; j++){ |
1532 |
ipre = j/16 ; |
ipre = j/16 ; |
1533 |
|
if ( debug ) printf(" CT STEP1 %i %i %i estrip %f ctprecor %f \n",j,m,l,clevel1->estrip[j][m][l],ctprecor[l][m][ipre]); |
1534 |
if ( clevel1->estrip[j][m][l] != 0. ) clevel1->estrip[j][m][l] -= clevel1->estrip[j][m][l] * ctprecor[l][m][ipre]; |
if ( clevel1->estrip[j][m][l] != 0. ) clevel1->estrip[j][m][l] -= clevel1->estrip[j][m][l] * ctprecor[l][m][ipre]; |
1535 |
|
if ( debug ) printf(" CT STEP2 %i %i %i estrip %f ctprecor %f \n",j,m,l,clevel1->estrip[j][m][l],ctprecor[l][m][ipre]); |
1536 |
}; |
}; |
1537 |
}; |
}; |
1538 |
// |
// |
1554 |
// |
// |
1555 |
if ( debug ) printf(" CK1 Limit for while: 0.07 \n"); |
if ( debug ) printf(" CK1 Limit for while: 0.07 \n"); |
1556 |
for (Int_t j = ipre*16 ; j < (ipre+1)*16 ; j++){ |
for (Int_t j = ipre*16 ; j < (ipre+1)*16 ; j++){ |
1557 |
|
if ( debug ) printf(" CT STEP3 %i %i %i estrip %f ctprecor %f \n",j,m,l,clevel1->estrip[j][m][l],ctprecor[l][m][ipp]); |
1558 |
if ( !ctground ){ |
if ( !ctground ){ |
1559 |
if ( clevel1->estrip[j][m][l] != 0. ) clevel1->estrip[j][m][l] += - qpre[l][m][ipp] * ctprecor[l][m][ipp]; |
if ( clevel1->estrip[j][m][l] != 0. ) clevel1->estrip[j][m][l] += - qpre[l][m][ipp] * ctprecor[l][m][ipp]; |
1560 |
} else { |
} else { |
1561 |
if ( clevel1->estrip[j][m][l] != 0. ) clevel1->estrip[j][m][l] += - qpre[l][m][ipp] * 0.00478; |
if ( clevel1->estrip[j][m][l] != 0. ) clevel1->estrip[j][m][l] += - qpre[l][m][ipp] * 0.00478; |
1562 |
}; |
}; |
1563 |
if ( clevel1->estrip[j][m][l] > 0. ) nqpre += clevel1->estrip[j][m][l] ; |
if ( clevel1->estrip[j][m][l] > 0. ) nqpre += clevel1->estrip[j][m][l] ; |
1564 |
|
if ( debug ) printf(" CT STEP4 %i %i %i estrip %f ctprecor %f \n",j,m,l,clevel1->estrip[j][m][l],ctprecor[l][m][ipp]); |
1565 |
}; |
}; |
1566 |
qpre[l][m][ipre] = nqpre; |
qpre[l][m][ipre] = nqpre; |
1567 |
nqpre = 0.; |
nqpre = 0.; |
1572 |
while ( it < 10 && deltaqpre > 0.07 ){ |
while ( it < 10 && deltaqpre > 0.07 ){ |
1573 |
nqpre = 0.; |
nqpre = 0.; |
1574 |
for (Int_t j = ipre*16 ; j < (ipre+1)*16 ; j++){ |
for (Int_t j = ipre*16 ; j < (ipre+1)*16 ; j++){ |
1575 |
|
if ( debug ) printf(" CT STEP5 %i %i %i estrip %f ctprecor %f \n",j,m,l,clevel1->estrip[j][m][l],ctprecor[l][m][ipre]); |
1576 |
if ( !ctground ){ |
if ( !ctground ){ |
1577 |
if ( debug ) printf(" CK1 pre correction: iteration %i deltaqpre %f ctprecor %f TOTAL CORRECTION %f \n",it,deltaqpre,ctprecor[l][m][ipre],deltaqpre * ctprecor[l][m][ipre]); |
if ( debug ) printf(" CK1 pre correction: iteration %i deltaqpre %f ctprecor %f TOTAL CORRECTION %f \n",it,deltaqpre,ctprecor[l][m][ipre],deltaqpre * ctprecor[l][m][ipre]); |
1578 |
if ( clevel1->estrip[j][m][l] != 0. ) clevel1->estrip[j][m][l] += deltaqpre * ctprecor[l][m][ipre]; |
if ( clevel1->estrip[j][m][l] != 0. ) clevel1->estrip[j][m][l] += deltaqpre * ctprecor[l][m][ipre]; |
1580 |
if ( clevel1->estrip[j][m][l] != 0. ) clevel1->estrip[j][m][l] += deltaqpre * 0.00478; |
if ( clevel1->estrip[j][m][l] != 0. ) clevel1->estrip[j][m][l] += deltaqpre * 0.00478; |
1581 |
}; |
}; |
1582 |
if ( clevel1->estrip[j][m][l] > 0. ) nqpre += clevel1->estrip[j][m][l] ; |
if ( clevel1->estrip[j][m][l] > 0. ) nqpre += clevel1->estrip[j][m][l] ; |
1583 |
|
if ( debug ) printf(" CT STEP6 %i %i %i estrip %f ctprecor %f \n",j,m,l,clevel1->estrip[j][m][l],ctprecor[l][m][ipre]); |
1584 |
}; |
}; |
1585 |
if ( ctground ) it = 100; |
if ( ctground ) it = 100; |
1586 |
it++; |
it++; |
1687 |
nqpre[0] = 0.; |
nqpre[0] = 0.; |
1688 |
nqpre[1] = 0.; |
nqpre[1] = 0.; |
1689 |
for (Int_t j = ladder*32 ; j < (ladder+1)*32 ; j++){ |
for (Int_t j = ladder*32 ; j < (ladder+1)*32 ; j++){ |
1690 |
|
if ( debug ) printf(" CT STEP6 %i %i %i estrip %f ctprecor %f \n",j,m,l,clevel1->estrip[j][m][l],ctsicor[l][m][si2]); |
1691 |
ipre = 0; |
ipre = 0; |
1692 |
if ( j > (ladder*32)+15 ) ipre = 1; |
if ( j > (ladder*32)+15 ) ipre = 1; |
1693 |
jpre = j/16 ; |
jpre = j/16 ; |
1703 |
}; |
}; |
1704 |
if ( clevel1->estrip[j][m][l] > 0. ) nqsi += clevel1->estrip[j][m][l] ; |
if ( clevel1->estrip[j][m][l] > 0. ) nqsi += clevel1->estrip[j][m][l] ; |
1705 |
if ( clevel1->estrip[j][m][l] > 0. ) nqpre[ipre] += clevel1->estrip[j][m][l] ; |
if ( clevel1->estrip[j][m][l] > 0. ) nqpre[ipre] += clevel1->estrip[j][m][l] ; |
1706 |
|
if ( debug ) printf(" CT STEP7 %i %i %i estrip %f ctprecor %f \n",j,m,l,clevel1->estrip[j][m][l],ctsicor[l][m][si2]); |
1707 |
}; |
}; |
1708 |
if ( ctground ) it = 100; |
if ( ctground ) it = 100; |
1709 |
deltaqsi = nqsi-snqsi; |
deltaqsi = nqsi-snqsi; |
|
snqsi = nqsi; |
|
|
it++; |
|
1710 |
deltaqpre[0] = nqpre[0] - qpre[l][m][pre-1]; |
deltaqpre[0] = nqpre[0] - qpre[l][m][pre-1]; |
1711 |
deltaqpre[1] = nqpre[1] - qpre[l][m][pre]; |
deltaqpre[1] = nqpre[1] - qpre[l][m][pre]; |
1712 |
|
// |
1713 |
|
// Check for divergence and stop if it happens! [9RED bug noticed with plane 18X] |
1714 |
|
// |
1715 |
|
if ( deltaqpre[0] > qpre[l][m][pre-1] || deltaqpre[1] > qpre[l][m][pre] || deltaqsi >snqsi ){ |
1716 |
|
if ( debug ) printf(" WARNING!! DIVERGING CORRECTION EXIT IMMEDIATLY FROM THE LOOP!! dqpre0 %f qpre0 %f // dqpre1 %f qpre1 %f // dqsi %f qsi %f \n",deltaqpre[0],qpre[l][m][pre-1],deltaqpre[1],qpre[l][m][pre],deltaqsi,snqsi); |
1717 |
|
it = 1000; |
1718 |
|
}; |
1719 |
|
// |
1720 |
|
snqsi = nqsi; |
1721 |
|
it++; |
1722 |
if ( debug ) printf(" BEFORE: qpre 0 %f qpre 1 %f \n",qpre[l][m][pre-1],qpre[l][m][pre]); |
if ( debug ) printf(" BEFORE: qpre 0 %f qpre 1 %f \n",qpre[l][m][pre-1],qpre[l][m][pre]); |
1723 |
qpre[l][m][pre-1] = nqpre[0]; |
qpre[l][m][pre-1] = nqpre[0]; |
1724 |
qpre[l][m][pre] = nqpre[1]; |
qpre[l][m][pre] = nqpre[1]; |
1754 |
jjj++; |
jjj++; |
1755 |
j4++; |
j4++; |
1756 |
if ( j < 96 ) ene[j] = clevel1->estrip[j][m][l]; |
if ( j < 96 ) ene[j] = clevel1->estrip[j][m][l]; |
1757 |
if ( crosst ){ |
if ( crosst ){ |
1758 |
// |
// |
1759 |
// "Real" crosstalk effect on the neighbour strips respect to the one which have seen the energy deposit |
// "Real" crosstalk effect on the neighbour strips respect to the one which have seen the energy deposit |
1760 |
// |
// |
1784 |
// CALOLEVEL1 CODING AND FILLING |
// CALOLEVEL1 CODING AND FILLING |
1785 |
// |
// |
1786 |
// |
// |
1787 |
// NOTICE: THE FOLLOWING LINE EXCLUDE ALL STRIPS FOR WHICH THE RMS*4 IS GREATER THAN 26 !!! <=============== IMPORTANT! =================> |
// NOTICE: THE FOLLOWING LINE EXCLUDE ALL STRIPS FOR WHICH THE RMS*4 IS GREATER THAN 26 !!! <=============== IMPORTANT! =================> // not true anymore, now it trust parameter files |
1788 |
// |
// |
1789 |
if ( obadmask[l][m][j4] == 1 || clevel1->estrip[j4][m][l] <= clevel1->emin || clevel1->estrip[j4][m][l] <= memin[l][m][j4] || calrms[l][m][j4] > maxrms[l][m] ){ |
if ( obadmask[l][m][j4] == 1 || clevel1->estrip[j4][m][l] <= clevel1->emin || clevel1->estrip[j4][m][l] <= memin[l][m][j4] || calrms[l][m][j4] > maxrms[l][m] || (l==0 && m == 18 && mask18 ) ){ |
1790 |
clevel1->estrip[j4][m][l] = 0.; |
clevel1->estrip[j4][m][l] = 0.; |
1791 |
}; |
}; |
1792 |
// |
// |
1793 |
|
if ( debug ) printf(" STRIP: view %i plane %i strip %i energy: %f \n",l,m,j4,clevel1->estrip[j4][m][l]); |
1794 |
|
// |
1795 |
// code and save the energy for each strip in svstrip |
// code and save the energy for each strip in svstrip |
1796 |
// |
// |
1797 |
if ( clevel1->estrip[j4][m][l] > clevel1->emin ){ |
if ( clevel1->estrip[j4][m][l] > clevel1->emin ){ |
1798 |
// |
// |
1799 |
Float_t savel1 = clevel1->estrip[j4][m][l]; |
Float_t savel1 = clevel1->estrip[j4][m][l]; |
1800 |
|
// |
1801 |
|
if ( m == 18 && l == 0 ){ |
1802 |
|
if ( debug ) printf(" Resetting plane 18X for variable calculation: view %i plane %i strip %i \n",l,m,j4); |
1803 |
|
clevel1->estrip[j4][m][l] = 0.; // SAVE STRIPS VALUE FOR PLANE 18 X but DO NOT USE IT FOR VARIABLE CALCULATION |
1804 |
|
}; |
1805 |
|
if ( debug ) printf(" HIT STRIP: view %i plane %i strip %i energy: %f \n",l,m,j4,clevel1->estrip[j4][m][l]); |
1806 |
// if ( dexyc[l][m][j4] == 32767. ){ |
// if ( dexyc[l][m][j4] == 32767. ){ |
1807 |
if ( dexyc[l][m][j4] > 32000. ){ |
if ( dexyc[l][m][j4] > 32000. || savel1 > 5000.){ // CaloLevel1 bug with plane 18X [9RED 14/04/2010] |
1808 |
savel1 += 5000.; |
if ( savel1 > 5000 ){ |
1809 |
|
if ( debug ) printf(" Absurd plane 18X energy... resetting value to 1100 MIP \n"); |
1810 |
|
savel1 = 1100.; // CaloLevel1 bug with plane 18x [9RED 14/04/2010] |
1811 |
|
}; |
1812 |
|
savel1 += 5000.; |
1813 |
clevel2->nsatstrip += 1.; |
clevel2->nsatstrip += 1.; |
1814 |
}; |
}; |
1815 |
// |
// |
1852 |
} else { |
} else { |
1853 |
svstrip[istrip] = -(fbi*1000000000 + plo*10000000 + j4*100000 + cle); |
svstrip[istrip] = -(fbi*1000000000 + plo*10000000 + j4*100000 + cle); |
1854 |
}; |
}; |
1855 |
|
if ( debug ) printf(" svstrip[%i] = %i fbi %i plo %i j4 %i cle %i \n",istrip,svstrip[istrip],fbi,plo,j4,cle); |
1856 |
// |
// |
1857 |
istrip++; |
istrip++; |
1858 |
}; |
}; |
1942 |
ClearTrkVar(); |
ClearTrkVar(); |
1943 |
} |
} |
1944 |
|
|
1945 |
|
void CaloLevel0::FillTrkVar(TClonesArray *tcl, Int_t nutrk){ |
1946 |
|
// |
1947 |
|
CaloTrkVar *t_ca = new CaloTrkVar(); |
1948 |
|
// |
1949 |
|
t_ca->trkseqno = trkseqno; |
1950 |
|
t_ca->ncore = (Int_t)clevel2->ncore; |
1951 |
|
t_ca->qcore = clevel2->qcore; |
1952 |
|
t_ca->noint = (Int_t)clevel2->noint; |
1953 |
|
t_ca->ncyl = (Int_t)clevel2->ncyl; |
1954 |
|
t_ca->qcyl = clevel2->qcyl; |
1955 |
|
t_ca->qtrack = clevel2->qtrack; |
1956 |
|
t_ca->qtrackx = clevel2->qtrackx; |
1957 |
|
t_ca->qtracky = clevel2->qtracky; |
1958 |
|
t_ca->dxtrack = clevel2->dxtrack; |
1959 |
|
t_ca->dytrack = clevel2->dytrack; |
1960 |
|
t_ca->qlast = clevel2->qlast; |
1961 |
|
t_ca->nlast = (Int_t)clevel2->nlast; |
1962 |
|
t_ca->qpre = clevel2->qpre; |
1963 |
|
t_ca->npre = (Int_t)clevel2->npre; |
1964 |
|
t_ca->qpresh = clevel2->qpresh; |
1965 |
|
t_ca->npresh = (Int_t)clevel2->npresh; |
1966 |
|
t_ca->qtr = clevel2->qtr; |
1967 |
|
t_ca->ntr = (Int_t)clevel2->ntr; |
1968 |
|
t_ca->planetot = (Int_t)clevel2->planetot; |
1969 |
|
t_ca->qmean = clevel2->qmean; |
1970 |
|
t_ca->dX0l = clevel2->dX0l; |
1971 |
|
t_ca->qlow = clevel2->qlow; |
1972 |
|
t_ca->nlow = (Int_t)clevel2->nlow; |
1973 |
|
// |
1974 |
|
memcpy(t_ca->tibar,clevel2->tibar,sizeof(clevel2->tibar)); |
1975 |
|
memcpy(t_ca->tbar,clevel2->tbar,sizeof(clevel2->tbar)); |
1976 |
|
// |
1977 |
|
// |
1978 |
|
TClonesArray &t = *tcl; |
1979 |
|
new(t[nutrk]) CaloTrkVar(*t_ca); |
1980 |
|
// |
1981 |
|
delete t_ca; |
1982 |
|
// |
1983 |
|
ClearTrkVar(); |
1984 |
|
} |
1985 |
|
|
1986 |
void CaloLevel0::GetCommonVar(){ |
void CaloLevel0::GetCommonVar(){ |
1987 |
calol2cm(); |
calol2cm(); |
1988 |
} |
} |
1990 |
void CaloLevel0::FillCommonVar(CaloLevel1 *c1, CaloLevel2 *ca){ |
void CaloLevel0::FillCommonVar(CaloLevel1 *c1, CaloLevel2 *ca){ |
1991 |
// |
// |
1992 |
ca->good = clevel2->good; |
ca->good = clevel2->good; |
1993 |
if ( clevel2->trigty == 2. ){ |
// if ( clevel2->trigty == 2. ){ |
1994 |
ca->selftrigger = 1; |
// ca->selftrigger = 1; |
1995 |
} else { |
// } else { |
1996 |
ca->selftrigger = 0; |
// ca->selftrigger = 0; |
1997 |
}; |
// }; |
1998 |
// |
// |
1999 |
ca->selftrigger += (Int_t)clevel2->wartrig; |
ca->selftrigger = (Int_t)clevel2->trigty + (Int_t)clevel2->wartrig; |
2000 |
// |
// |
2001 |
memcpy(ca->perr,clevel2->perr,sizeof(clevel2->perr)); |
memcpy(ca->perr,clevel2->perr,sizeof(clevel2->perr)); |
2002 |
memcpy(ca->swerr,clevel2->swerr,sizeof(clevel2->swerr)); |
memcpy(ca->swerr,clevel2->swerr,sizeof(clevel2->swerr)); |
2033 |
}; |
}; |
2034 |
// |
// |
2035 |
} |
} |
2036 |
|
void CaloLevel0::FillCommonVar(CaloLevel1 *c1){ |
2037 |
|
if ( c1 ){ |
2038 |
|
c1->istrip = istrip; |
2039 |
|
c1->estrip = TArrayI(istrip,svstrip); |
2040 |
|
}; |
2041 |
|
// |
2042 |
|
} |
2043 |
|
|
2044 |
void CaloLevel0::ClearStructs(){ |
void CaloLevel0::ClearStructs(){ |
2045 |
ClearTrkVar(); |
ClearTrkVar(); |
2280 |
// |
// |
2281 |
if ( !ncalibs ) return(-110); |
if ( !ncalibs ) return(-110); |
2282 |
// |
// |
2283 |
calo->GetEntry(calibno[s]); |
if ( calo->GetEntry(calibno[s]) <= 0 ) throw -36; |
2284 |
// |
// |
2285 |
if (ce->cstwerr[s] != 0 && ce->cperror[s] == 0 ) { |
if (ce->cstwerr[s] != 0 && ce->cperror[s] == 0 ) { |
2286 |
for ( Int_t d=0 ; d<11 ;d++ ){ |
for ( Int_t d=0 ; d<11 ;d++ ){ |