/[PAMELA software]/DarthVader/ToFLevel2/src/ToFLevel2.cpp
ViewVC logotype

Diff of /DarthVader/ToFLevel2/src/ToFLevel2.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.28 by mocchiut, Mon Dec 28 10:22:39 2009 UTC revision 1.34 by mocchiut, Wed Nov 23 21:19:38 2011 UTC
# Line 1422  ToFdEdx::ToFdEdx() Line 1422  ToFdEdx::ToFdEdx()
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  }  }
# Line 1466  void ToFdEdx::Clear(Option_t *option) Line 1467  void ToFdEdx::Clear(Option_t *option)
1467  {  {
1468    //    //
1469    // Set arrays and initialize structure    // Set arrays and initialize structure
1470    eDEDXpmt.Set(48);    eDEDXpmt.Reset(-1);   // Set array size  and reset structure    //  eDEDXpmt.Set(48);    eDEDXpmt.Reset(-1);   // Set array size  and reset structure
1471      eDEDXpmt->Set(48);    eDEDXpmt->Reset(-1);   // Set array size  and reset structure
1472    //    //
1473  };  };
1474    
# Line 1505  void ToFdEdx::Init(Int_t gg, Int_t hh, F Line 1507  void ToFdEdx::Init(Int_t gg, Int_t hh, F
1507        
1508  };  };
1509  //------------------------------------------------------------------------  //------------------------------------------------------------------------
1510  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)
1511  {  {
1512    // the parameters should be already initialised by InitPar()    // the parameters should be already initialised by InitPar()
1513      //  printf(" in process \n");
1514    Clear();    Clear();
1515    
1516   // define angle:     // define angle:  
# Line 1517  void ToFdEdx::Process(UInt_t atime, Floa Line 1520  void ToFdEdx::Process(UInt_t atime, Floa
1520    double theta=atan(dr/76.81);    double theta=atan(dr/76.81);
1521    //    //
1522    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.;
1523      for (Int_t ii=0; ii<6; ii++){
1524        if ( xtr_tof[ii] > 99. ) xtr_tof[ii] = 0.;
1525        if ( ytr_tof[ii] > 99. ) ytr_tof[ii] = 0.;
1526      };
1527    //    //
1528        
1529    
1530      //--------------------- TABLE OF PERIODS WITH HV PROBLEMS ----------------------------
1531      
1532      int Aconn=conn[0];    // PMT 0,20,22,24
1533      int Bconn=conn[1];    // PMT 6,12,26,34
1534      int Cconn=conn[2];    // PMT 4,14,28,32
1535      int Dconn=conn[3];    // PMT 2,8,10,30
1536      int Econn=conn[4];    // PMT 42,43,44,47
1537      int Fconn=conn[5];    // PMT 7,19,23,27
1538      int Gconn=conn[6];    // PMT 3,11,25,33
1539      int Hconn=conn[7];    // PMT 1,9,13,21
1540      int Iconn=conn[8];    // PMT 5,29,31,35
1541      int Lconn=conn[9];    // PMT 37,40,45,46
1542      int Mconn=conn[10];    // PMT 15,16,17,18
1543      int Nconn=conn[11];    // PMT 36,38,39,41
1544      if( false ) cout << Gconn << Iconn << Lconn <<endl; // to avoid compilation warnings
1545        
1546      //  printf(" size %i \n",eDEDXpmt.GetSize());
1547    for( int ii=0; ii<48; ii++ ) {    for( int ii=0; ii<48; ii++ ) {
1548      //      //
1549        //    eDEDXpmt.SetAt(-1.,ii);
1550      //    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]);
1551      if( adc[ii] >= PMTsat[ii]-5 )  continue;  
1552      if( adc[ii] <= 0. )            continue;      if( adc[ii] >= 4095. ){
1553          //      eDEDXpmt[ii] = 0.;
1554          eDEDXpmt->AddAt(0.,ii);
1555          continue; // EMILIANO
1556        };
1557    
1558        if( adc[ii] >= (PMTsat[ii]-5.) && adc[ii] < 4095. ){
1559          eDEDXpmt->AddAt(1000.,ii);
1560          continue; // EMILIANO
1561        };
1562    
1563        if( adc[ii] <= 0. ) {
1564          eDEDXpmt->AddAt(1500.,ii);
1565          continue;
1566        };
1567      //      //
1568      double adcpC   = f_adcPC( adc[ii] );    // - adc conversion in pC      double adcpC   = f_adcPC( adc[ii] );    // - adc conversion in pC
1569      double adccorr = adcpC*fabs(cos(theta));      if ( exitat == 0 ){
1570      //        eDEDXpmt->AddAt((Float_t)adcpC,ii);
1571      if(adccorr<=0.)           continue;        continue;
1572        }
1573      //--------------------- TABLE OF PERIODS WITH HV PROBLEMS ----------------------------      //    printf(" e qua? \n");
1574    
1575      int Aconn=conn[0];    // PMT 0,20,22,24      double adccorr = adcpC*fabs(cos(theta));    
1576      int Bconn=conn[1];    // PMT 6,12,26,34      if(adccorr<=0.)           continue;
1577      int Cconn=conn[2];    // PMT 4,14,28,32      if ( exitat == 1 ){
1578      int Dconn=conn[3];    // PMT 2,8,10,30        eDEDXpmt->AddAt((Float_t)adccorr,ii);
1579      int Econn=conn[4];    // PMT 42,43,44,47        continue;
1580      int Fconn=conn[5];    // PMT 7,19,23,27      }
1581      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  
1582    
1583      //    int standard=0;      //    int standard=0;
     if( false ) cout << Gconn << Iconn << Lconn <<endl;  
1584      int S115B_ok=0;      int S115B_ok=0;
1585      int S115B_break=0;      int S115B_break=0;
1586    
# Line 1556  void ToFdEdx::Process(UInt_t atime, Floa Line 1589  void ToFdEdx::Process(UInt_t atime, Floa
1589    
1590    
1591      //------------------------------------------------------------------------      //------------------------------------------------------------------------
1592        //    printf(" e qui? \n");
1593      //---------------------------------------------------- Z reconstruction      //---------------------------------------------------- Z reconstruction
1594    
1595      double adcHe, adcnorm, adclin, dEdx, Zeta;      double adcHe, adcnorm, adclin, dEdx, Zeta;
# Line 1566  void ToFdEdx::Process(UInt_t atime, Floa Line 1599  void ToFdEdx::Process(UInt_t atime, Floa
1599      adclin=-2;      adclin=-2;
1600      dEdx=-2;      dEdx=-2;
1601      Zeta=-2;      Zeta=-2;
1602        Double_t correction = 1.;
1603    
1604      if(Aconn==1 && (ii==0 || ii==20 || ii==22 || ii==24)){      if(Aconn==1 && (ii==0 || ii==20 || ii==22 || ii==24)){
1605        adcHe   = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.675;        correction = 1.675;
1606      }      }
1607      else if(Bconn==1 && (ii==6 || ii==12 || ii==26 || ii==34)){      else if(Bconn==1 && (ii==6 || ii==12 || ii==26 || ii==34)){
1608        adcHe   = (Get_adc_he(ii, xtr_tof, ytr_tof))/2.482;        correction = 2.482;
1609      }      }
1610      else if(Cconn==1 && (ii==4 || ii==14 || ii==28 || ii==32)){      else if(Cconn==1 && (ii==4 || ii==14 || ii==28 || ii==32)){
1611        adcHe   = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.464;        correction = 1.464;
1612      }      }
1613      else if(Dconn==1 && (ii==2 || ii==8 || ii==10 || ii==30)){      else if(Dconn==1 && (ii==2 || ii==8 || ii==10 || ii==30)){
1614        adcHe   = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.995;        correction = 1.995;
1615      }      }
1616      else if(Econn==1 && (ii==42 || ii==43 || ii==44 || ii==47)){      else if(Econn==1 && (ii==42 || ii==43 || ii==44 || ii==47)){
1617        adcHe   = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.273;        correction = 1.273;
1618      }      }
1619      else if(Fconn==1 && (ii==7 || ii==19 || ii==23 || ii==27)){      else if(Fconn==1 && (ii==7 || ii==19 || ii==23 || ii==27)){
1620        adcHe   = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.565;        correction = 1.565;
1621      }      }
1622      else if(Mconn==1 && (ii==15 || ii==16 || ii==17 || ii==18)){      else if(Mconn==1 && (ii==15 || ii==16 || ii==17 || ii==18)){
1623        adcHe   = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.565;        correction = 1.565;
1624      }      }
1625      else if(Nconn==1 && (ii==36 || ii==38 || ii==39 || ii==41)){      else if(Nconn==1 && (ii==36 || ii==38 || ii==39 || ii==41)){
1626        adcHe   = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.018;        correction = 1.018;
1627      }      }
1628      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))){
1629        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!!!  
1630      }      }
1631      else if(S115B_break==1 && ii==9 && Hconn==1){      else if(S115B_break==1 && ii==9 && Hconn==1){
1632        adcHe   = (f_att5B( ytr_tof[0] ))/1.64;        correction = 1.64;
1633      }      }
1634      else  adcHe   = Get_adc_he(ii, xtr_tof, ytr_tof);      else correction = 1.;
1635        
1636        if( ii==9 && S115B_break==1 ){
1637          adcHe   = f_att5B( ytr_tof[0] )/correction;
1638        } else {
1639          adcHe   = Get_adc_he(ii, xtr_tof, ytr_tof)/correction;
1640        };
1641      if(adcHe<=0)   continue;      if(adcHe<=0)   continue;
1642        if ( exitat == 2 ){
1643          if(ii==9 && S115B_break==1)  eDEDXpmt->AddAt(36.*(Float_t)adccorr/adcHe,ii);
1644          else  adclin  = 4.*(Float_t)adccorr/adcHe;
1645          continue;
1646        }
1647    
1648      if(ii==9 && S115B_break==1)  adcnorm = f_pos5B(adccorr);      if(ii==9 && S115B_break==1)  adcnorm = f_pos5B(adccorr);
1649      else adcnorm = f_pos( (parPos[ii]), adccorr);      else adcnorm = f_pos( (parPos[ii]), adccorr);
   
1650      if(adcnorm<=0) continue;      if(adcnorm<=0) continue;
   
1651      if(ii==9 && S115B_break==1)  adclin  = 36.*adcnorm/adcHe;      if(ii==9 && S115B_break==1)  adclin  = 36.*adcnorm/adcHe;
1652      else  adclin  = 4.*adcnorm/adcHe;      else  adclin  = 4.*adcnorm/adcHe;
   
1653      if(adclin<=0)  continue;      if(adclin<=0)  continue;
1654        if ( exitat == 3 ){
1655          if(ii==9 && S115B_break==1)  eDEDXpmt->AddAt((Float_t)adclin,ii);
1656          else  eDEDXpmt->AddAt((Float_t)adclin,ii);
1657          continue;
1658        }
1659      //      //
1660      if ( betamean > 99. ){      if ( betamean > 99. ){
1661        eDEDXpmt[ii]=(Float_t)adclin;        //      eDEDXpmt.AddAt((Float_t)adclin,ii);
1662          eDEDXpmt->AddAt((Float_t)adclin,ii);
1663          //      printf(" AAPMT IS %i dedx is %f vector is %f \n",ii,adclin,eDEDXpmt[ii]);
1664        continue;        continue;
1665      };      };
1666      //      //
# Line 1628  void ToFdEdx::Process(UInt_t atime, Floa Line 1673  void ToFdEdx::Process(UInt_t atime, Floa
1673        else                       dEdxHe = parBBpos[ii];        else                       dEdxHe = parBBpos[ii];
1674      }      }
1675            
1676      if(dEdxHe<=0)  continue;      
1677        if(dEdxHe<=0){
1678          eDEDXpmt->AddAt((Float_t)adclin,ii);
1679          continue;
1680        };
1681    
1682      if(ii==9 && S115B_break==1)  dEdx = f_desatBB5B( adclin );      if(ii==9 && S115B_break==1)  dEdx = f_desatBB5B( adclin );
1683      else  dEdx = f_desatBB((parDesatBB[ii]), adclin );      else  dEdx = f_desatBB((parDesatBB[ii]), adclin );
1684    
1685      if(dEdx<=0)    continue;      if(dEdx<=0){
1686          eDEDXpmt->AddAt((Float_t)adclin,ii);
1687          continue;
1688        };
1689    
1690      eDEDXpmt[ii]=(Float_t)dEdx;      eDEDXpmt->AddAt((Float_t)dEdx,ii);
1691        //    eDEDXpmt.AddAt((Float_t)dEdx,ii);
1692    
1693        //    printf(" PMT IS %i dedx is %f vector is %f \n",ii,dEdx,eDEDXpmt[ii]);
1694    
1695    }  //end loop on 48 PMT    }  //end loop on 48 PMT
1696    

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.34

  ViewVC Help
Powered by ViewVC 1.1.23