5 |
* WM dec 2008: Description of "GetdEdx" changed |
* WM dec 2008: Description of "GetdEdx" changed |
6 |
* WM dec 2008: "GetdEdxPaddle" modified: Now includes saturation limit |
* WM dec 2008: "GetdEdxPaddle" modified: Now includes saturation limit |
7 |
* PMTs higher than the saturation limit are not used for dEdx |
* PMTs higher than the saturation limit are not used for dEdx |
8 |
|
* WM apr 2009: bug found by Nicola in method "GetPaddlePlane" |
9 |
*/ |
*/ |
10 |
|
|
11 |
#include <ToFLevel2.h> |
#include <ToFLevel2.h> |
12 |
using namespace std; |
using namespace std; |
13 |
ClassImp(ToFPMT); |
ClassImp(ToFPMT); |
14 |
|
ClassImp(ToFdEdx); |
15 |
|
ClassImp(ToFGeom); |
16 |
ClassImp(ToFTrkVar); |
ClassImp(ToFTrkVar); |
17 |
ClassImp(ToFLevel2); |
ClassImp(ToFLevel2); |
18 |
|
|
891 |
return; |
return; |
892 |
} |
} |
893 |
|
|
894 |
if(7<pad<14){ |
if((7<pad)&&(pad<14)){ |
895 |
plane=1; |
plane=1; |
896 |
paddle=pad-pads11; |
paddle=pad-pads11; |
897 |
return; |
return; |
898 |
} |
} |
899 |
|
|
900 |
if(13<pad<16){ |
if((13<pad)&&(pad<16)){ |
901 |
plane=2; |
plane=2; |
902 |
paddle=pad-pads11-pads12; |
paddle=pad-pads11-pads12; |
903 |
return; |
return; |
904 |
} |
} |
905 |
|
|
906 |
if(15<pad<18){ |
if((15<pad)&&(pad<18)){ |
907 |
plane=3; |
plane=3; |
908 |
paddle=pad-pads11-pads12-pads21; |
paddle=pad-pads11-pads12-pads21; |
909 |
return; |
return; |
910 |
} |
} |
911 |
|
|
912 |
if(17<pad<21){ |
if((17<pad)&&(pad<21)){ |
913 |
plane=4; |
plane=4; |
914 |
paddle=pad-pads11-pads12-pads21-pads22; |
paddle=pad-pads11-pads12-pads21-pads22; |
915 |
return; |
return; |
916 |
} |
} |
917 |
|
|
918 |
if(20<pad<24){ |
if((20<pad)&&(pad<24)){ |
919 |
plane=5; |
plane=5; |
920 |
paddle=pad-pads11-pads12-pads21-pads22-pads31; |
paddle=pad-pads11-pads12-pads21-pads22-pads31; |
921 |
return; |
return; |
1420 |
|
|
1421 |
return(0); |
return(0); |
1422 |
} |
} |
1423 |
|
|
1424 |
|
|
1425 |
|
|
1426 |
|
|
1427 |
|
|
1428 |
|
|
1429 |
|
|
1430 |
|
|
1431 |
|
|
1432 |
|
|
1433 |
|
|
1434 |
|
|
1435 |
|
|
1436 |
|
|
1437 |
|
|
1438 |
|
|
1439 |
|
|
1440 |
|
|
1441 |
|
|
1442 |
|
|
1443 |
|
|
1444 |
|
|
1445 |
|
|
1446 |
|
|
1447 |
|
ToFdEdx::ToFdEdx() |
1448 |
|
{ |
1449 |
|
memset(conn,0,12*sizeof(Bool_t)); |
1450 |
|
memset(ts,0,12*sizeof(UInt_t)); |
1451 |
|
memset(te,0,12*sizeof(UInt_t)); |
1452 |
|
Define_PMTsat(); |
1453 |
|
Clear(); |
1454 |
|
} |
1455 |
|
//------------------------------------------------------------------------ |
1456 |
|
void ToFdEdx::CheckConnectors(UInt_t atime, GL_PARAM *glparam, TSQLServer *dbc) |
1457 |
|
{ |
1458 |
|
for(int i=0; i<12; i++){ |
1459 |
|
if(atime<=ts[i] || atime>te[i]){ |
1460 |
|
Int_t error=glparam->Query_GL_PARAM(atime,210+i,dbc); // parameters stored in DB in GL_PRAM table |
1461 |
|
if ( error<0 ) { |
1462 |
|
conn[i]=false; |
1463 |
|
ts[i]=0; |
1464 |
|
te[i]=numeric_limits<UInt_t>::max(); |
1465 |
|
}; |
1466 |
|
if ( !error ){ |
1467 |
|
conn[i]=true; |
1468 |
|
ts[i]=glparam->FROM_TIME; |
1469 |
|
te[i]=glparam->TO_TIME; |
1470 |
|
} |
1471 |
|
if ( error>0 ){ |
1472 |
|
conn[i]=false; |
1473 |
|
ts[i]=glparam->TO_TIME; |
1474 |
|
TSQLResult *pResult; |
1475 |
|
TSQLRow *row; |
1476 |
|
TString query= Form("SELECT FROM_TIME FROM GL_PARAM WHERE TYPE=%i AND FROM_TIME>=%i ORDER BY FROM_TIME ASC LIMIT 1;",210+i,atime); |
1477 |
|
pResult=dbc->Query(query.Data()); |
1478 |
|
if(!pResult->GetRowCount()){ |
1479 |
|
te[i]=numeric_limits<UInt_t>::max(); |
1480 |
|
}else{ |
1481 |
|
row=pResult->Next(); |
1482 |
|
te[i]=(UInt_t)atoll(row->GetField(0)); |
1483 |
|
} |
1484 |
|
} |
1485 |
|
// |
1486 |
|
|
1487 |
|
} |
1488 |
|
} |
1489 |
|
|
1490 |
|
} |
1491 |
|
//------------------------------------------------------------------------ |
1492 |
|
void ToFdEdx::Clear(Option_t *option) |
1493 |
|
{ |
1494 |
|
// |
1495 |
|
// Set arrays and initialize structure |
1496 |
|
|
1497 |
|
eDEDXpmt.Set(48); eDEDXpmt.Reset(-1); // Set array size and reset structure |
1498 |
|
eZpmt.Set(48); eZpmt.Reset(-1); |
1499 |
|
eDEDXpad.Set(24); eDEDXpad.Reset(-1); |
1500 |
|
eZpad.Set(24); eZpad.Reset(-1); |
1501 |
|
eDEDXlayer.Set(6); eDEDXlayer.Reset(-1); |
1502 |
|
eZlayer.Set(6); eZlayer.Reset(-1); |
1503 |
|
eDEDXplane.Set(3); eDEDXplane.Reset(-1); |
1504 |
|
eZplane.Set(3); eZplane.Reset(-1); |
1505 |
|
INFOpmt.Set(48); INFOpmt.Reset(0); |
1506 |
|
INFOlayer.Set(6); INFOlayer.Reset(0); |
1507 |
|
// |
1508 |
|
}; |
1509 |
|
|
1510 |
|
//------------------------------------------------------------------------ |
1511 |
|
void ToFdEdx::Print(Option_t *option) |
1512 |
|
{ |
1513 |
|
// |
1514 |
|
printf("========================================================================\n"); |
1515 |
|
|
1516 |
|
}; |
1517 |
|
|
1518 |
|
|
1519 |
|
//------------------------------------------------------------------------ |
1520 |
|
// void ToFdEdx::InitPar(TString parname, TString parfile) |
1521 |
|
// { |
1522 |
|
// // expensive function - call it once/run |
1523 |
|
|
1524 |
|
|
1525 |
|
|
1526 |
|
// ReadParAtt( Form("%s/attenuation.txt" , pardir) ); |
1527 |
|
// ReadParPos( Form("%s/desaturation_position.txt" , pardir) ); |
1528 |
|
// ReadParBBneg( Form("%s/BetheBloch.txt" , pardir) ); |
1529 |
|
// ReadParBBpos( Form("%s/BetheBloch_betagt1.txt" , pardir) ); |
1530 |
|
// ReadParDesatBB( Form("%s/desaturation_beta.txt" , pardir) ); |
1531 |
|
|
1532 |
|
// }; |
1533 |
|
|
1534 |
|
|
1535 |
|
//------------------------------------------------------------------------ |
1536 |
|
void ToFdEdx::Process(UInt_t atime, Float_t betamean, Float_t *xtr_tof, Float_t *ytr_tof, pamela::tof::TofEvent *tofl0 ) |
1537 |
|
{ |
1538 |
|
// the parameters should be already initialised by InitPar() |
1539 |
|
|
1540 |
|
|
1541 |
|
Clear(); |
1542 |
|
|
1543 |
|
|
1544 |
|
|
1545 |
|
// Float_t betamean = fabs(trackTRK->GetToFTrack()->beta[12]); |
1546 |
|
|
1547 |
|
if(betamean<0.05 || betamean>2){ |
1548 |
|
for(int i=0;i<48;i++)INFOpmt[i]=1; |
1549 |
|
} |
1550 |
|
|
1551 |
|
// define angle: |
1552 |
|
double dx = xtr_tof[1] - xtr_tof[5]; |
1553 |
|
double dy = ytr_tof[0] - ytr_tof[4]; |
1554 |
|
double dr = sqrt(dx*dx+dy*dy); |
1555 |
|
double theta=atan(dr/76.81); |
1556 |
|
|
1557 |
|
|
1558 |
|
|
1559 |
|
// TArrayF adc; |
1560 |
|
Float_t adc[48]; |
1561 |
|
|
1562 |
|
ToFLevel2 tf; |
1563 |
|
|
1564 |
|
for (Int_t gg=0; gg<4;gg++){ |
1565 |
|
for (Int_t hh=0; hh<12;hh++){ |
1566 |
|
// tofinput_.tdc[hh][gg]=tofEvent->tdc[gg][hh]; |
1567 |
|
int mm = tf.GetPMTid(gg,hh); |
1568 |
|
adc[mm]=tofl0->adc[gg][hh]; |
1569 |
|
}; |
1570 |
|
}; |
1571 |
|
|
1572 |
|
|
1573 |
|
|
1574 |
|
|
1575 |
|
for( int ii=0; ii<48; ii++ ) { |
1576 |
|
if( adc[ii] >= PMTsat[ii]-5 ) continue; |
1577 |
|
if( adc[ii] <= 0. ) continue; |
1578 |
|
|
1579 |
|
double adcpC = f_adcPC( adc[ii] ); // - adc conversion in pC |
1580 |
|
double adccorr = adcpC*fabs(cos(theta)); |
1581 |
|
|
1582 |
|
if(adccorr<=0.) continue; |
1583 |
|
|
1584 |
|
|
1585 |
|
|
1586 |
|
//--------------------- TABLE OF PERIODS WITH HV PROBLEMS ---------------------------- |
1587 |
|
|
1588 |
|
int Aconn=conn[0]; // PMT 0,20,22,24 |
1589 |
|
int Bconn=conn[1]; // PMT 6,12,26,34 |
1590 |
|
int Cconn=conn[2]; // PMT 4,14,28,32 |
1591 |
|
int Dconn=conn[3]; // PMT 2,8,10,30 |
1592 |
|
int Econn=conn[4]; // PMT 42,43,44,47 |
1593 |
|
int Fconn=conn[5]; // PMT 7,19,23,27 |
1594 |
|
int Gconn=conn[6]; // PMT 3,11,25,33 |
1595 |
|
int Hconn=conn[7]; // PMT 1,9,13,21 |
1596 |
|
int Iconn=conn[8]; // PMT 5,29,31,35 |
1597 |
|
int Lconn=conn[9]; // PMT 37,40,45,46 |
1598 |
|
int Mconn=conn[10]; // PMT 15,16,17,18 |
1599 |
|
int Nconn=conn[11]; // PMT 36,38,39,41 |
1600 |
|
|
1601 |
|
// int standard=0; |
1602 |
|
if( false ) cout << Gconn << Iconn << Lconn <<endl; |
1603 |
|
int S115B_ok=0; |
1604 |
|
int S115B_break=0; |
1605 |
|
|
1606 |
|
// if(atime>=1153660001 && atime<=1154375000)Dconn=1; |
1607 |
|
// else if(atime>=1155850001 && atime<=1156280000){ |
1608 |
|
// Hconn=1; |
1609 |
|
// Nconn=1; |
1610 |
|
// } |
1611 |
|
|
1612 |
|
// else if(atime>=1168490001 && atime<=1168940000)Dconn=1; |
1613 |
|
// else if(atime>=1168940001 && atime<=1169580000){ |
1614 |
|
// Fconn=1; |
1615 |
|
// Mconn=1; |
1616 |
|
// } |
1617 |
|
|
1618 |
|
// else if(atime>=1174665001 && atime<=1175000000)Bconn=1; |
1619 |
|
// else if(atime>=1176120001 && atime<=1176800000)Hconn=1; |
1620 |
|
// else if(atime>=1176800001 && atime<=1178330000)Econn=1; |
1621 |
|
// else if(atime>=1178330001 && atime<=1181322000)Hconn=1; |
1622 |
|
// else if(atime>=1182100001 && atime<=1183030000)Aconn=1; |
1623 |
|
// else if(atime>=1184000001 && atime<=1184570000)Hconn=1; |
1624 |
|
// else if(atime>=1185090001 && atime<=1185212000)Dconn=1; |
1625 |
|
// else if(atime>=1191100001 && atime<=1191940000)Dconn=1; |
1626 |
|
// else if(atime>=1196230001 && atime<=1196280000)Hconn=1; |
1627 |
|
// else if(atime>=1206100001 && atime<=1206375600)Cconn=1; |
1628 |
|
// else if(atime>=1217989201 && atime<=1218547800)Econn=1; |
1629 |
|
// else if(atime>=1225789201 && atime<=1226566800)Econn=1; |
1630 |
|
// else if(atime>=1229400901 && atime<=1229700000)Econn=1; |
1631 |
|
// else if(atime>=1230318001 && atime<=1230415200)Econn=1; |
1632 |
|
// else { |
1633 |
|
// standard=1; |
1634 |
|
// } |
1635 |
|
if(atime<1158720000)S115B_ok=1; |
1636 |
|
else S115B_break=1; |
1637 |
|
|
1638 |
|
|
1639 |
|
//------------------------------------------------------------------------ |
1640 |
|
|
1641 |
|
//---------------------------------------------------- Z reconstruction |
1642 |
|
|
1643 |
|
double adcHe, adcnorm, adclin, dEdx, Zeta; |
1644 |
|
|
1645 |
|
adcHe=-2; |
1646 |
|
adcnorm=-2; |
1647 |
|
adclin=-2; |
1648 |
|
dEdx=-2; |
1649 |
|
Zeta=-2; |
1650 |
|
|
1651 |
|
|
1652 |
|
// float ZetaH=-2; |
1653 |
|
// float dEdxH=-2; |
1654 |
|
|
1655 |
|
// double day = (atime-1150000000)/84600; |
1656 |
|
|
1657 |
|
if(Aconn==1 && (ii==0 || ii==20 || ii==22 || ii==24)){ |
1658 |
|
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.675; |
1659 |
|
} |
1660 |
|
else if(Bconn==1 && (ii==6 || ii==12 || ii==26 || ii==34)){ |
1661 |
|
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/2.482; |
1662 |
|
} |
1663 |
|
else if(Cconn==1 && (ii==4 || ii==14 || ii==28 || ii==32)){ |
1664 |
|
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.464; |
1665 |
|
} |
1666 |
|
else if(Dconn==1 && (ii==2 || ii==8 || ii==10 || ii==30)){ |
1667 |
|
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.995; |
1668 |
|
} |
1669 |
|
else if(Econn==1 && (ii==42 || ii==43 || ii==44 || ii==47)){ |
1670 |
|
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.273; |
1671 |
|
} |
1672 |
|
else if(Fconn==1 && (ii==7 || ii==19 || ii==23 || ii==27)){ |
1673 |
|
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.565; |
1674 |
|
} |
1675 |
|
else if(Mconn==1 && (ii==15 || ii==16 || ii==17 || ii==18)){ |
1676 |
|
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.565; |
1677 |
|
} |
1678 |
|
else if(Nconn==1 && (ii==36 || ii==38 || ii==39 || ii==41)){ |
1679 |
|
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.018; |
1680 |
|
} |
1681 |
|
else if(Hconn==1 && (ii==1 || ii==13 || ii==21 || (ii==9&&S115B_ok==1))){ |
1682 |
|
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.84; |
1683 |
|
} |
1684 |
|
else if(S115B_break==1 && ii==9 && Hconn==0){ |
1685 |
|
adcHe = f_att5B( ytr_tof[0] ); //N.B.: this function refers to the Carbon!!! |
1686 |
|
} |
1687 |
|
else if(S115B_break==1 && ii==9 && Hconn==1){ |
1688 |
|
adcHe = (f_att5B( ytr_tof[0] ))/1.64; |
1689 |
|
} |
1690 |
|
else adcHe = Get_adc_he(ii, xtr_tof, ytr_tof); |
1691 |
|
|
1692 |
|
if(adcHe<=0) continue; |
1693 |
|
|
1694 |
|
if(ii==9 && S115B_break==1) adcnorm = f_pos5B(adccorr); |
1695 |
|
else adcnorm = f_pos( (parPos[ii]), adccorr); |
1696 |
|
|
1697 |
|
if(adcnorm<=0) continue; |
1698 |
|
|
1699 |
|
if(ii==9 && S115B_break==1) adclin = 36.*adcnorm/adcHe; |
1700 |
|
else adclin = 4.*adcnorm/adcHe; |
1701 |
|
|
1702 |
|
if(adclin<=0) continue; |
1703 |
|
|
1704 |
|
double dEdxHe=-2; |
1705 |
|
if(ii==9 && S115B_break==1){ |
1706 |
|
if( betamean <1. ) dEdxHe = f_BB5B( betamean ); |
1707 |
|
else dEdxHe = 33; |
1708 |
|
} else { |
1709 |
|
if( betamean <1. ) dEdxHe = f_BB( (parBBneg[ii]), betamean ); |
1710 |
|
else dEdxHe = parBBpos[ii]; |
1711 |
|
} |
1712 |
|
|
1713 |
|
if(dEdxHe<=0) continue; |
1714 |
|
|
1715 |
|
if(ii==9 && S115B_break==1) dEdx = f_desatBB5B( adclin ); |
1716 |
|
else dEdx = f_desatBB((parDesatBB[ii]), adclin ); |
1717 |
|
|
1718 |
|
if(dEdx<=0) continue; |
1719 |
|
|
1720 |
|
if(ii==9 && S115B_break==1) Zeta = sqrt(36.*(dEdx/dEdxHe)); |
1721 |
|
else Zeta = sqrt(4.*(dEdx/dEdxHe)); |
1722 |
|
|
1723 |
|
if(Zeta<=0) continue; |
1724 |
|
|
1725 |
|
//--------------------- TIME DEPENDENCE ---------------------------------- |
1726 |
|
|
1727 |
|
|
1728 |
|
// TArrayF &binx = TDx[ii]; |
1729 |
|
// TArrayF &biny = TDy[ii]; |
1730 |
|
// for(int k=0; k<200; k++) { |
1731 |
|
// if (day > binx[k]-2.5 && day<=binx[k]+2.5 && biny[k]>0) { |
1732 |
|
// ZetaH=Zeta/biny[k]*6; |
1733 |
|
// dEdxH=dEdx/(pow(biny[k],2))*36; |
1734 |
|
// } |
1735 |
|
// } |
1736 |
|
|
1737 |
|
// if(ZetaH!=-2)eZpmt[ii]=(Float_t)ZetaH; |
1738 |
|
// else eZpmt[ii]=(Float_t)Zeta; |
1739 |
|
|
1740 |
|
// if(dEdxH!=-2)eDEDXpmt[ii]=(Float_t)dEdxH; |
1741 |
|
// else eDEDXpmt[ii]=(Float_t)dEdx; |
1742 |
|
|
1743 |
|
// printf("%5d %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %5.4f \n", ii, adcpC, adccorr, adcHe, dEdxHe, dEdx, Zeta, betamean ); |
1744 |
|
|
1745 |
|
eZpmt[ii]=(Float_t)Zeta; |
1746 |
|
eDEDXpmt[ii]=(Float_t)dEdx; |
1747 |
|
|
1748 |
|
|
1749 |
|
} //end loop on 48 PMT |
1750 |
|
|
1751 |
|
//--------------------------------------------------- paddle + layer -------------------- |
1752 |
|
|
1753 |
|
for(int j=0;j<48;j++){ |
1754 |
|
int k=100; |
1755 |
|
if(j%2==0 || j==0)k=j/2; |
1756 |
|
|
1757 |
|
double zpdl=-1; |
1758 |
|
|
1759 |
|
if((j%2==0 || j==0) && eZpmt[j]!=-1 && eZpmt[j+1]!=-1){ |
1760 |
|
zpdl=0.5*(eZpmt[j]+eZpmt[j+1]); |
1761 |
|
}else if((j%2==0 || j==0) && eZpmt[j]!=-1 && eZpmt[j+1]==-1){ |
1762 |
|
zpdl=eZpmt[j]; |
1763 |
|
}else if((j%2==0 || j==0) && eZpmt[j]==-1 && eZpmt[j+1]!=-1){ |
1764 |
|
zpdl=eZpmt[j+1]; |
1765 |
|
} |
1766 |
|
|
1767 |
|
if(j%2==0 || j==0)eZpad[k]= (Float_t)zpdl; |
1768 |
|
|
1769 |
|
if((j%2==0 || j==0)&&eZpad[k]!=-1){ |
1770 |
|
if(k>=0&&k<8)eZlayer[0]=eZpad[k]; |
1771 |
|
if(k>=8&&k<14)eZlayer[1]=eZpad[k]; |
1772 |
|
if(k>=14&&k<16)eZlayer[2]=eZpad[k]; |
1773 |
|
if(k>=16&&k<18)eZlayer[3]=eZpad[k]; |
1774 |
|
if(k>=18&&k<21)eZlayer[4]=eZpad[k]; |
1775 |
|
if(k>=21)eZlayer[5]=eZpad[k]; |
1776 |
|
} |
1777 |
|
|
1778 |
|
if(eZlayer[0]!=-1&&eZlayer[1]!=-1&&fabs(eZlayer[0]-eZlayer[1])<1.5)eZplane[0]=0.5*(eZlayer[0]+eZlayer[1]); |
1779 |
|
else if(eZlayer[0]!=-1&&eZlayer[1]==-1)eZplane[0]=eZlayer[0]; |
1780 |
|
else if(eZlayer[1]!=-1&&eZlayer[0]==-1)eZplane[0]=eZlayer[1]; |
1781 |
|
|
1782 |
|
if(eZlayer[2]!=-1&&eZlayer[3]!=-1&&fabs(eZlayer[2]-eZlayer[3])<1.5)eZplane[1]=0.5*(eZlayer[2]+eZlayer[3]); |
1783 |
|
else if(eZlayer[2]!=-1&&eZlayer[3]==-1)eZplane[1]=eZlayer[2]; |
1784 |
|
else if(eZlayer[3]!=-1&&eZlayer[2]==-1)eZplane[1]=eZlayer[3]; |
1785 |
|
|
1786 |
|
if(eZlayer[4]!=-1&&eZlayer[5]!=-1&&fabs(eZlayer[4]-eZlayer[5])<1.5)eZplane[2]=0.5*(eZlayer[4]+eZlayer[5]); |
1787 |
|
else if(eZlayer[4]!=-1&&eZlayer[5]==-1)eZplane[2]=eZlayer[4]; |
1788 |
|
else if(eZlayer[5]!=-1&&eZlayer[4]==-1)eZplane[2]=eZlayer[5]; |
1789 |
|
|
1790 |
|
} |
1791 |
|
|
1792 |
|
for(int jj=0;jj<48;jj++){ |
1793 |
|
int k=100; |
1794 |
|
if(jj%2==0 || jj==0)k=jj/2; |
1795 |
|
|
1796 |
|
double dedxpdl=-1; |
1797 |
|
|
1798 |
|
if((jj%2==0 || jj==0) && eDEDXpmt[jj]!=-1 && eDEDXpmt[jj+1]!=-1){ |
1799 |
|
dedxpdl=0.5*(eDEDXpmt[jj]+eDEDXpmt[jj+1]); |
1800 |
|
}else if((jj%2==0 || jj==0) && eDEDXpmt[jj]!=-1 && eDEDXpmt[jj+1]==-1){ |
1801 |
|
dedxpdl=eDEDXpmt[jj]; |
1802 |
|
}else if((jj%2==0 || jj==0) && eDEDXpmt[jj]==-1 && eDEDXpmt[jj+1]!=-1){ |
1803 |
|
dedxpdl=eDEDXpmt[jj+1]; |
1804 |
|
} |
1805 |
|
|
1806 |
|
if(jj%2==0 || jj==0)eDEDXpad[k]= (Float_t)dedxpdl; |
1807 |
|
|
1808 |
|
if((jj%2==0 || jj==0)&&eDEDXpad[k]!=-1){ |
1809 |
|
if(k>=0&&k<8)eDEDXlayer[0]=eDEDXpad[k]; |
1810 |
|
if(k>=8&&k<14)eDEDXlayer[1]=eDEDXpad[k]; |
1811 |
|
if(k>=14&&k<16)eDEDXlayer[2]=eDEDXpad[k]; |
1812 |
|
if(k>=16&&k<18)eDEDXlayer[3]=eDEDXpad[k]; |
1813 |
|
if(k>=18&&k<21)eDEDXlayer[4]=eDEDXpad[k]; |
1814 |
|
if(k>=21)eDEDXlayer[5]=eDEDXpad[k]; |
1815 |
|
} |
1816 |
|
|
1817 |
|
if(eDEDXlayer[0]!=-1&&eDEDXlayer[1]!=-1&&fabs(eDEDXlayer[0]-eDEDXlayer[1])<10)eDEDXplane[0]=0.5*(eDEDXlayer[0]+eDEDXlayer[1]); |
1818 |
|
else if(eDEDXlayer[0]!=-1&&eDEDXlayer[1]==-1)eDEDXplane[0]=eDEDXlayer[0]; |
1819 |
|
else if(eDEDXlayer[1]!=-1&&eDEDXlayer[0]==-1)eDEDXplane[0]=eDEDXlayer[1]; |
1820 |
|
|
1821 |
|
if(eDEDXlayer[2]!=-1&&eDEDXlayer[3]!=-1&&fabs(eDEDXlayer[2]-eDEDXlayer[3])<10)eDEDXplane[1]=0.5*(eDEDXlayer[2]+eDEDXlayer[3]); |
1822 |
|
else if(eDEDXlayer[2]!=-1&&eDEDXlayer[3]==-1)eDEDXplane[1]=eDEDXlayer[2]; |
1823 |
|
else if(eDEDXlayer[3]!=-1&&eDEDXlayer[2]==-1)eDEDXplane[1]=eDEDXlayer[3]; |
1824 |
|
|
1825 |
|
if(eDEDXlayer[4]!=-1&&eDEDXlayer[5]!=-1&&fabs(eDEDXlayer[4]-eDEDXlayer[5])<10)eDEDXplane[2]=0.5*(eDEDXlayer[4]+eDEDXlayer[5]); |
1826 |
|
else if(eDEDXlayer[4]!=-1&&eDEDXlayer[5]==-1)eDEDXplane[2]=eDEDXlayer[4]; |
1827 |
|
else if(eDEDXlayer[5]!=-1&&eDEDXlayer[4]==-1)eDEDXplane[2]=eDEDXlayer[5]; |
1828 |
|
|
1829 |
|
} |
1830 |
|
|
1831 |
|
|
1832 |
|
|
1833 |
|
}; |
1834 |
|
|
1835 |
|
|
1836 |
|
//------------------------------------------------------------------------ |
1837 |
|
void ToFdEdx::PrintTD() |
1838 |
|
{ |
1839 |
|
for(int i=0; i<48; i++) { |
1840 |
|
TArrayF &binx = TDx[i]; |
1841 |
|
TArrayF &biny = TDy[i]; |
1842 |
|
for(int k=0; k<200; k++) { // bin temporali |
1843 |
|
printf("%d %d %f %f", i,k, binx[k], biny[k]); |
1844 |
|
|
1845 |
|
} |
1846 |
|
} |
1847 |
|
} |
1848 |
|
|
1849 |
|
|
1850 |
|
//------------------------------------------------------------------------ |
1851 |
|
void ToFdEdx::Define_PMTsat() |
1852 |
|
{ |
1853 |
|
Float_t sat[48] = { |
1854 |
|
3176.35,3178.19,3167.38,3099.73,3117.00,3126.29,3111.44,3092.27, |
1855 |
|
3146.48,3094.41,3132.13,3115.37,3099.32,3110.97,3111.80,3143.14, |
1856 |
|
3106.72,3153.44,3136.00,3188.96,3104.73,3140.45,3073.18,3106.62, |
1857 |
|
3112.48,3146.92,3127.24,3136.52,3109.59,3112.89,3045.15,3147.26, |
1858 |
|
3095.92,3121.05,3083.25,3123.62,3150.92,3125.30,3067.60,3160.18, |
1859 |
|
3119.36,3108.92,3164.77,3133.64,3111.47,3131.98,3128.87,3135.56 }; |
1860 |
|
PMTsat.Set(48,sat); |
1861 |
|
} |
1862 |
|
|
1863 |
|
//------------------------------------------------------------------------ |
1864 |
|
// void ToFdEdx::ReadParTD( Int_t ipmt, const char *fname ) |
1865 |
|
// { |
1866 |
|
// printf("read %s\n",fname); |
1867 |
|
// if(ipmt<0) return; |
1868 |
|
// if(ipmt>47) return; |
1869 |
|
// FILE *fattin = fopen( fname , "r" ); |
1870 |
|
// Float_t yTD[200],xTD[200]; |
1871 |
|
// for(int j=0;j<200;j++){ |
1872 |
|
// float x,y,ym,e; |
1873 |
|
// if(fscanf(fattin,"%f %f %f %f", |
1874 |
|
// &x, &y, &ym, &e )!=4) break; |
1875 |
|
// xTD[j]=x; |
1876 |
|
// if(ym>0&&fabs(y-ym)>1) yTD[j]=ym; |
1877 |
|
// else yTD[j]=y; |
1878 |
|
// } |
1879 |
|
// TDx[ipmt].Set(200,xTD); |
1880 |
|
// TDy[ipmt].Set(200,yTD); |
1881 |
|
// fclose(fattin); |
1882 |
|
// } |
1883 |
|
|
1884 |
|
//------------------------------------------------------------------------ |
1885 |
|
void ToFdEdx::ReadParBBpos( const char *fname ) |
1886 |
|
{ |
1887 |
|
printf("read %s\n",fname); |
1888 |
|
parBBpos.Set(48); |
1889 |
|
FILE *fattin = fopen( fname , "r" ); |
1890 |
|
for (int i=0; i<48; i++) { |
1891 |
|
int tid=0; |
1892 |
|
float tp; |
1893 |
|
if(fscanf(fattin,"%d %f", |
1894 |
|
&tid, &tp )!=2) break; |
1895 |
|
parBBpos[i]=tp; |
1896 |
|
} |
1897 |
|
fclose(fattin); |
1898 |
|
} |
1899 |
|
|
1900 |
|
//------------------------------------------------------------------------ |
1901 |
|
void ToFdEdx::ReadParDesatBB( const char *fname ) |
1902 |
|
{ |
1903 |
|
printf("read %s\n",fname); |
1904 |
|
FILE *fattin = fopen( fname , "r" ); |
1905 |
|
for (int i=0; i<48; i++) { |
1906 |
|
int tid=0; |
1907 |
|
float tp[3]; |
1908 |
|
if(fscanf(fattin,"%d %f %f %f", |
1909 |
|
&tid, &tp[0], &tp[1], &tp[2] )!=4) break; |
1910 |
|
parDesatBB[i].Set(3,tp); |
1911 |
|
} |
1912 |
|
fclose(fattin); |
1913 |
|
} |
1914 |
|
|
1915 |
|
|
1916 |
|
//------------------------------------------------------------------------ |
1917 |
|
void ToFdEdx::ReadParBBneg( const char *fname ) |
1918 |
|
|
1919 |
|
{ |
1920 |
|
printf("read %s\n",fname); |
1921 |
|
FILE *fattin = fopen( fname , "r" ); |
1922 |
|
for (int i=0; i<48; i++) { |
1923 |
|
int tid=0; |
1924 |
|
float tp[3]; |
1925 |
|
if(fscanf(fattin,"%d %f %f %f", |
1926 |
|
&tid, &tp[0], &tp[1], &tp[2] )!=4) break; |
1927 |
|
parBBneg[i].Set(3,tp); |
1928 |
|
} |
1929 |
|
fclose(fattin); |
1930 |
|
} |
1931 |
|
|
1932 |
|
//------------------------------------------------------------------------ |
1933 |
|
void ToFdEdx::ReadParPos( const char *fname ) |
1934 |
|
{ |
1935 |
|
printf("read %s\n",fname); |
1936 |
|
FILE *fattin = fopen( fname , "r" ); |
1937 |
|
for (int i=0; i<48; i++) { |
1938 |
|
int tid=0; |
1939 |
|
float tp[4]; |
1940 |
|
if(fscanf(fattin,"%d %f %f %f %f", |
1941 |
|
&tid, &tp[0], &tp[1], &tp[2], &tp[3])!=5) break; |
1942 |
|
parPos[i].Set(4,tp); |
1943 |
|
} |
1944 |
|
fclose(fattin); |
1945 |
|
} |
1946 |
|
|
1947 |
|
//------------------------------------------------------------------------ |
1948 |
|
void ToFdEdx::ReadParAtt( const char *fname ) |
1949 |
|
{ |
1950 |
|
printf("read %s\n",fname); |
1951 |
|
FILE *fattin = fopen( fname , "r" ); |
1952 |
|
for (int i=0; i<48; i++) { |
1953 |
|
int tid=0; |
1954 |
|
float tp[6]; |
1955 |
|
if(fscanf(fattin,"%d %f %f %f %f %f %f", |
1956 |
|
&tid, &tp[0], &tp[1], &tp[2], &tp[3], &tp[4], &tp[5] )!=7) break; |
1957 |
|
parAtt[i].Set(6,tp); |
1958 |
|
} |
1959 |
|
fclose(fattin); |
1960 |
|
} |
1961 |
|
|
1962 |
|
|
1963 |
|
|
1964 |
|
|
1965 |
|
|
1966 |
|
|
1967 |
|
double ToFdEdx::f_att( TArrayF &p, float x ) |
1968 |
|
{ |
1969 |
|
return |
1970 |
|
p[0] + |
1971 |
|
p[1]*x + |
1972 |
|
p[2]*x*x + |
1973 |
|
p[3]*x*x*x + |
1974 |
|
p[4]*x*x*x*x + |
1975 |
|
p[5]*x*x*x*x*x; |
1976 |
|
} |
1977 |
|
//------------------------------------------------------------------------ |
1978 |
|
double ToFdEdx::f_att5B( float x ) |
1979 |
|
{ |
1980 |
|
return |
1981 |
|
101.9409 + |
1982 |
|
6.643781*x + |
1983 |
|
0.2765518*x*x + |
1984 |
|
0.004617647*x*x*x + |
1985 |
|
0.0006195132*x*x*x*x + |
1986 |
|
0.00002813734*x*x*x*x*x; |
1987 |
|
} |
1988 |
|
|
1989 |
|
|
1990 |
|
double ToFdEdx::f_pos( TArrayF &p, float x ) |
1991 |
|
{ |
1992 |
|
return |
1993 |
|
p[0] + |
1994 |
|
p[1]*x + |
1995 |
|
p[2]*x*x + |
1996 |
|
p[3]*x*x*x; |
1997 |
|
} |
1998 |
|
|
1999 |
|
double ToFdEdx::f_pos5B( float x ) |
2000 |
|
{ |
2001 |
|
return |
2002 |
|
15.45132 + |
2003 |
|
0.8369721*x + |
2004 |
|
0.0005*x*x; |
2005 |
|
} |
2006 |
|
|
2007 |
|
|
2008 |
|
|
2009 |
|
double ToFdEdx::f_adcPC( float x ) |
2010 |
|
{ |
2011 |
|
return 28.12+0.6312*x-5.647e-05*x*x+3.064e-08*x*x*x; |
2012 |
|
} |
2013 |
|
|
2014 |
|
|
2015 |
|
float ToFdEdx::Get_adc_he( int id, float pl_x[6], float pl_y[6]) |
2016 |
|
{ |
2017 |
|
|
2018 |
|
// |
2019 |
|
// input: id - pmt [0:47} |
2020 |
|
// pl_x - coord x of the tof plane |
2021 |
|
// pl_y - coord y |
2022 |
|
|
2023 |
|
adc_he = 0; |
2024 |
|
if( eGeom.GetXY(id)==1 ) adc_he = f_att( (parAtt[id]), pl_x[eGeom.GetPlane(id)] ); |
2025 |
|
if( eGeom.GetXY(id)==2 ) adc_he = f_att( (parAtt[id]), pl_y[eGeom.GetPlane(id)] ); |
2026 |
|
return adc_he; |
2027 |
|
} |
2028 |
|
|
2029 |
|
//------------------------------------------------------------------------ |
2030 |
|
double ToFdEdx::f_BB( TArrayF &p, float x ) |
2031 |
|
{ |
2032 |
|
return p[0]/(x*x)*(log(x*x/(1-x*x)) - p[1]*x*x - p[2]); |
2033 |
|
} |
2034 |
|
|
2035 |
|
//------------------------------------------------------------------------ |
2036 |
|
double ToFdEdx::f_BB5B( float x ) |
2037 |
|
{ |
2038 |
|
return 0.165797/(x*x)*(log(x*x/(1-x*x)) + 140.481*x*x + 52.9258); |
2039 |
|
} |
2040 |
|
//------------------------------------------------------------------------ |
2041 |
|
double ToFdEdx::f_desatBB( TArrayF &p, float x ) |
2042 |
|
{ |
2043 |
|
return |
2044 |
|
p[0] + |
2045 |
|
p[1]*x + |
2046 |
|
p[2]*x*x; |
2047 |
|
} |
2048 |
|
|
2049 |
|
//------------------------------------------------------------------------ |
2050 |
|
double ToFdEdx::f_desatBB5B( float x ) |
2051 |
|
{ |
2052 |
|
return |
2053 |
|
-2.4 + |
2054 |
|
0.75*x + |
2055 |
|
0.009*x*x; |
2056 |
|
} |
2057 |
|
|
2058 |
|
|
2059 |
|
|
2060 |
|
|
2061 |
|
|
2062 |
|
|
2063 |
|
|
2064 |
|
|
2065 |
|
|
2066 |
|
|
2067 |
|
|
2068 |
|
|
2069 |
|
|
2070 |
|
|
2071 |
|
|
2072 |
|
|