1422 |
memset(conn,0,12*sizeof(Bool_t)); |
memset(conn,0,12*sizeof(Bool_t)); |
1423 |
memset(ts,0,12*sizeof(UInt_t)); |
memset(ts,0,12*sizeof(UInt_t)); |
1424 |
memset(te,0,12*sizeof(UInt_t)); |
memset(te,0,12*sizeof(UInt_t)); |
1425 |
|
eDEDXpmt = new TArrayF(48); |
1426 |
Define_PMTsat(); |
Define_PMTsat(); |
1427 |
Clear(); |
Clear(); |
1428 |
} |
} |
1429 |
|
|
1430 |
|
ToFdEdx::~ToFdEdx(){ |
1431 |
|
Clear(); |
1432 |
|
Delete(); |
1433 |
|
} |
1434 |
|
|
1435 |
|
void ToFdEdx::Delete(Option_t *option){ |
1436 |
|
if ( eDEDXpmt ){ |
1437 |
|
eDEDXpmt->Set(0); |
1438 |
|
if ( eDEDXpmt) delete eDEDXpmt; |
1439 |
|
} |
1440 |
|
} |
1441 |
|
|
1442 |
//------------------------------------------------------------------------ |
//------------------------------------------------------------------------ |
1443 |
void ToFdEdx::CheckConnectors(UInt_t atime, GL_PARAM *glparam, TSQLServer *dbc) |
void ToFdEdx::CheckConnectors(UInt_t atime, GL_PARAM *glparam, TSQLServer *dbc) |
1444 |
{ |
{ |
1480 |
{ |
{ |
1481 |
// |
// |
1482 |
// Set arrays and initialize structure |
// Set arrays and initialize structure |
1483 |
eDEDXpmt.Set(48); eDEDXpmt.Reset(-1); // Set array size and reset structure |
// eDEDXpmt.Set(48); eDEDXpmt.Reset(-1); // Set array size and reset structure |
1484 |
|
eDEDXpmt->Set(48); eDEDXpmt->Reset(-1); // Set array size and reset structure |
1485 |
// |
// |
1486 |
}; |
}; |
1487 |
|
|
1520 |
|
|
1521 |
}; |
}; |
1522 |
//------------------------------------------------------------------------ |
//------------------------------------------------------------------------ |
1523 |
void ToFdEdx::Process(UInt_t atime, Float_t betamean, Float_t *xtr_tof, Float_t *ytr_tof) |
void ToFdEdx::Process(UInt_t atime, Float_t betamean, Float_t *xtr_tof, Float_t *ytr_tof, Int_t exitat) |
1524 |
{ |
{ |
1525 |
// the parameters should be already initialised by InitPar() |
// the parameters should be already initialised by InitPar() |
1526 |
|
// printf(" in process \n"); |
1527 |
Clear(); |
Clear(); |
1528 |
|
|
1529 |
// define angle: |
// define angle: |
1535 |
if ( xtr_tof[1] > 99. || xtr_tof[5] > 99. || ytr_tof[0] > 99. || ytr_tof[4] > 99. ) theta = 0.; |
if ( xtr_tof[1] > 99. || xtr_tof[5] > 99. || ytr_tof[0] > 99. || ytr_tof[4] > 99. ) theta = 0.; |
1536 |
for (Int_t ii=0; ii<6; ii++){ |
for (Int_t ii=0; ii<6; ii++){ |
1537 |
if ( xtr_tof[ii] > 99. ) xtr_tof[ii] = 0.; |
if ( xtr_tof[ii] > 99. ) xtr_tof[ii] = 0.; |
1538 |
if ( ytr_tof[ii] > 99. ) xtr_tof[ii] = 0.; |
if ( ytr_tof[ii] > 99. ) ytr_tof[ii] = 0.; |
1539 |
}; |
}; |
1540 |
// |
// |
1541 |
|
|
1542 |
|
|
1543 |
|
//--------------------- TABLE OF PERIODS WITH HV PROBLEMS ---------------------------- |
1544 |
|
|
1545 |
|
int Aconn=conn[0]; // PMT 0,20,22,24 |
1546 |
|
int Bconn=conn[1]; // PMT 6,12,26,34 |
1547 |
|
int Cconn=conn[2]; // PMT 4,14,28,32 |
1548 |
|
int Dconn=conn[3]; // PMT 2,8,10,30 |
1549 |
|
int Econn=conn[4]; // PMT 42,43,44,47 |
1550 |
|
int Fconn=conn[5]; // PMT 7,19,23,27 |
1551 |
|
int Gconn=conn[6]; // PMT 3,11,25,33 |
1552 |
|
int Hconn=conn[7]; // PMT 1,9,13,21 |
1553 |
|
int Iconn=conn[8]; // PMT 5,29,31,35 |
1554 |
|
int Lconn=conn[9]; // PMT 37,40,45,46 |
1555 |
|
int Mconn=conn[10]; // PMT 15,16,17,18 |
1556 |
|
int Nconn=conn[11]; // PMT 36,38,39,41 |
1557 |
|
if( false ) cout << Gconn << Iconn << Lconn <<endl; // to avoid compilation warnings |
1558 |
|
|
1559 |
|
// printf(" size %i \n",eDEDXpmt.GetSize()); |
1560 |
for( int ii=0; ii<48; ii++ ) { |
for( int ii=0; ii<48; ii++ ) { |
1561 |
// |
// |
1562 |
|
// eDEDXpmt.SetAt(-1.,ii); |
1563 |
// printf(" ii %i beta %f atime %u xtr 1 %f ytr 1 %f adc %f \n",ii,betamean,atime,xtr_tof[0],ytr_tof[0],adc[ii]); |
// printf(" ii %i beta %f atime %u xtr 1 %f ytr 1 %f adc %f \n",ii,betamean,atime,xtr_tof[0],ytr_tof[0],adc[ii]); |
1564 |
if( adc[ii] >= PMTsat[ii]-5 ) continue; |
|
1565 |
if( adc[ii] <= 0. ) continue; |
if( adc[ii] >= 4095. ){ |
1566 |
|
// eDEDXpmt[ii] = 0.; |
1567 |
|
eDEDXpmt->AddAt(0.,ii); |
1568 |
|
continue; // EMILIANO |
1569 |
|
}; |
1570 |
|
|
1571 |
|
if( adc[ii] >= (PMTsat[ii]-5.) && adc[ii] < 4095. ){ |
1572 |
|
eDEDXpmt->AddAt(1000.,ii); |
1573 |
|
continue; // EMILIANO |
1574 |
|
}; |
1575 |
|
|
1576 |
|
if( adc[ii] <= 0. ) { |
1577 |
|
eDEDXpmt->AddAt(1500.,ii); |
1578 |
|
continue; |
1579 |
|
}; |
1580 |
// |
// |
1581 |
double adcpC = f_adcPC( adc[ii] ); // - adc conversion in pC |
double adcpC = f_adcPC( adc[ii] ); // - adc conversion in pC |
1582 |
double adccorr = adcpC*fabs(cos(theta)); |
if ( exitat == 0 ){ |
1583 |
// |
eDEDXpmt->AddAt((Float_t)adcpC,ii); |
1584 |
if(adccorr<=0.) continue; |
continue; |
1585 |
|
} |
1586 |
//--------------------- TABLE OF PERIODS WITH HV PROBLEMS ---------------------------- |
// printf(" e qua? \n"); |
1587 |
|
|
1588 |
int Aconn=conn[0]; // PMT 0,20,22,24 |
double adccorr = adcpC*fabs(cos(theta)); |
1589 |
int Bconn=conn[1]; // PMT 6,12,26,34 |
if(adccorr<=0.) continue; |
1590 |
int Cconn=conn[2]; // PMT 4,14,28,32 |
if ( exitat == 1 ){ |
1591 |
int Dconn=conn[3]; // PMT 2,8,10,30 |
eDEDXpmt->AddAt((Float_t)adccorr,ii); |
1592 |
int Econn=conn[4]; // PMT 42,43,44,47 |
continue; |
1593 |
int Fconn=conn[5]; // PMT 7,19,23,27 |
} |
1594 |
int Gconn=conn[6]; // PMT 3,11,25,33 |
// printf(" e quo? \n"); |
|
int Hconn=conn[7]; // PMT 1,9,13,21 |
|
|
int Iconn=conn[8]; // PMT 5,29,31,35 |
|
|
int Lconn=conn[9]; // PMT 37,40,45,46 |
|
|
int Mconn=conn[10]; // PMT 15,16,17,18 |
|
|
int Nconn=conn[11]; // PMT 36,38,39,41 |
|
1595 |
|
|
1596 |
// int standard=0; |
// int standard=0; |
|
if( false ) cout << Gconn << Iconn << Lconn <<endl; |
|
1597 |
int S115B_ok=0; |
int S115B_ok=0; |
1598 |
int S115B_break=0; |
int S115B_break=0; |
1599 |
|
|
1602 |
|
|
1603 |
|
|
1604 |
//------------------------------------------------------------------------ |
//------------------------------------------------------------------------ |
1605 |
|
// printf(" e qui? \n"); |
1606 |
//---------------------------------------------------- Z reconstruction |
//---------------------------------------------------- Z reconstruction |
1607 |
|
|
1608 |
double adcHe, adcnorm, adclin, dEdx, Zeta; |
double adcHe, adcnorm, adclin, dEdx, Zeta; |
1612 |
adclin=-2; |
adclin=-2; |
1613 |
dEdx=-2; |
dEdx=-2; |
1614 |
Zeta=-2; |
Zeta=-2; |
1615 |
|
Double_t correction = 1.; |
1616 |
|
|
1617 |
if(Aconn==1 && (ii==0 || ii==20 || ii==22 || ii==24)){ |
if(Aconn==1 && (ii==0 || ii==20 || ii==22 || ii==24)){ |
1618 |
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.675; |
correction = 1.675; |
1619 |
} |
} |
1620 |
else if(Bconn==1 && (ii==6 || ii==12 || ii==26 || ii==34)){ |
else if(Bconn==1 && (ii==6 || ii==12 || ii==26 || ii==34)){ |
1621 |
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/2.482; |
correction = 2.482; |
1622 |
} |
} |
1623 |
else if(Cconn==1 && (ii==4 || ii==14 || ii==28 || ii==32)){ |
else if(Cconn==1 && (ii==4 || ii==14 || ii==28 || ii==32)){ |
1624 |
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.464; |
correction = 1.464; |
1625 |
} |
} |
1626 |
else if(Dconn==1 && (ii==2 || ii==8 || ii==10 || ii==30)){ |
else if(Dconn==1 && (ii==2 || ii==8 || ii==10 || ii==30)){ |
1627 |
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.995; |
correction = 1.995; |
1628 |
} |
} |
1629 |
else if(Econn==1 && (ii==42 || ii==43 || ii==44 || ii==47)){ |
else if(Econn==1 && (ii==42 || ii==43 || ii==44 || ii==47)){ |
1630 |
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.273; |
correction = 1.273; |
1631 |
} |
} |
1632 |
else if(Fconn==1 && (ii==7 || ii==19 || ii==23 || ii==27)){ |
else if(Fconn==1 && (ii==7 || ii==19 || ii==23 || ii==27)){ |
1633 |
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.565; |
correction = 1.565; |
1634 |
} |
} |
1635 |
else if(Mconn==1 && (ii==15 || ii==16 || ii==17 || ii==18)){ |
else if(Mconn==1 && (ii==15 || ii==16 || ii==17 || ii==18)){ |
1636 |
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.565; |
correction = 1.565; |
1637 |
} |
} |
1638 |
else if(Nconn==1 && (ii==36 || ii==38 || ii==39 || ii==41)){ |
else if(Nconn==1 && (ii==36 || ii==38 || ii==39 || ii==41)){ |
1639 |
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.018; |
correction = 1.018; |
1640 |
} |
} |
1641 |
else if(Hconn==1 && (ii==1 || ii==13 || ii==21 || (ii==9&&S115B_ok==1))){ |
else if(Hconn==1 && (ii==1 || ii==13 || ii==21 || (ii==9&&S115B_ok==1))){ |
1642 |
adcHe = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.84; |
correction = 1.84; |
|
} |
|
|
else if(S115B_break==1 && ii==9 && Hconn==0){ |
|
|
adcHe = f_att5B( ytr_tof[0] ); //N.B.: this function refers to the Carbon!!! |
|
1643 |
} |
} |
1644 |
else if(S115B_break==1 && ii==9 && Hconn==1){ |
else if(S115B_break==1 && ii==9 && Hconn==1){ |
1645 |
adcHe = (f_att5B( ytr_tof[0] ))/1.64; |
correction = 1.64; |
1646 |
} |
} |
1647 |
else adcHe = Get_adc_he(ii, xtr_tof, ytr_tof); |
else correction = 1.; |
1648 |
|
|
1649 |
|
if( ii==9 && S115B_break==1 ){ |
1650 |
|
adcHe = f_att5B( ytr_tof[0] )/correction; |
1651 |
|
} else { |
1652 |
|
adcHe = Get_adc_he(ii, xtr_tof, ytr_tof)/correction; |
1653 |
|
}; |
1654 |
if(adcHe<=0) continue; |
if(adcHe<=0) continue; |
1655 |
|
if ( exitat == 2 ){ |
1656 |
|
if(ii==9 && S115B_break==1) eDEDXpmt->AddAt(36.*(Float_t)adccorr/adcHe,ii); |
1657 |
|
else adclin = 4.*(Float_t)adccorr/adcHe; |
1658 |
|
continue; |
1659 |
|
} |
1660 |
|
|
1661 |
if(ii==9 && S115B_break==1) adcnorm = f_pos5B(adccorr); |
if(ii==9 && S115B_break==1) adcnorm = f_pos5B(adccorr); |
1662 |
else adcnorm = f_pos( (parPos[ii]), adccorr); |
else adcnorm = f_pos( (parPos[ii]), adccorr); |
|
|
|
1663 |
if(adcnorm<=0) continue; |
if(adcnorm<=0) continue; |
|
|
|
1664 |
if(ii==9 && S115B_break==1) adclin = 36.*adcnorm/adcHe; |
if(ii==9 && S115B_break==1) adclin = 36.*adcnorm/adcHe; |
1665 |
else adclin = 4.*adcnorm/adcHe; |
else adclin = 4.*adcnorm/adcHe; |
|
|
|
1666 |
if(adclin<=0) continue; |
if(adclin<=0) continue; |
1667 |
|
if ( exitat == 3 ){ |
1668 |
|
if(ii==9 && S115B_break==1) eDEDXpmt->AddAt((Float_t)adclin,ii); |
1669 |
|
else eDEDXpmt->AddAt((Float_t)adclin,ii); |
1670 |
|
continue; |
1671 |
|
} |
1672 |
// |
// |
1673 |
if ( betamean > 99. ){ |
if ( betamean > 99. ){ |
1674 |
eDEDXpmt[ii]=(Float_t)adclin; |
// eDEDXpmt.AddAt((Float_t)adclin,ii); |
1675 |
|
eDEDXpmt->AddAt((Float_t)adclin,ii); |
1676 |
|
// printf(" AAPMT IS %i dedx is %f vector is %f \n",ii,adclin,eDEDXpmt[ii]); |
1677 |
continue; |
continue; |
1678 |
}; |
}; |
1679 |
// |
// |
1686 |
else dEdxHe = parBBpos[ii]; |
else dEdxHe = parBBpos[ii]; |
1687 |
} |
} |
1688 |
|
|
1689 |
if(dEdxHe<=0) continue; |
|
1690 |
|
if(dEdxHe<=0){ |
1691 |
|
eDEDXpmt->AddAt((Float_t)adclin,ii); |
1692 |
|
continue; |
1693 |
|
}; |
1694 |
|
|
1695 |
if(ii==9 && S115B_break==1) dEdx = f_desatBB5B( adclin ); |
if(ii==9 && S115B_break==1) dEdx = f_desatBB5B( adclin ); |
1696 |
else dEdx = f_desatBB((parDesatBB[ii]), adclin ); |
else dEdx = f_desatBB((parDesatBB[ii]), adclin ); |
1697 |
|
|
1698 |
if(dEdx<=0) continue; |
if(dEdx<=0){ |
1699 |
|
eDEDXpmt->AddAt((Float_t)adclin,ii); |
1700 |
|
continue; |
1701 |
|
}; |
1702 |
|
|
1703 |
eDEDXpmt[ii]=(Float_t)dEdx; |
eDEDXpmt->AddAt((Float_t)dEdx,ii); |
1704 |
|
// eDEDXpmt.AddAt((Float_t)dEdx,ii); |
1705 |
|
|
1706 |
|
// printf(" PMT IS %i dedx is %f vector is %f \n",ii,dEdx,eDEDXpmt[ii]); |
1707 |
|
|
1708 |
} //end loop on 48 PMT |
} //end loop on 48 PMT |
1709 |
|
|