/[PAMELA software]/PamelaDigitizer/Digitizer.cxx
ViewVC logotype

Diff of /PamelaDigitizer/Digitizer.cxx

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

revision 1.1.1.1 by silvio, Thu Sep 13 11:00:53 2007 UTC revision 1.2 by orsi, Fri Sep 28 10:46:23 2007 UTC
# Line 1  Line 1 
1    //               ------ PAMELA Digitizer ------
2    //
3    // Date, release and how-to: see file Pamelagp2Digits.cxx
4    //
5    // NB: Check length physics packet [packet type (0x10 = physics data)]
6  //  //
7  #include <sstream>  #include <sstream>
8  #include <fstream>  #include <fstream>
9  #include <stdlib.h>  #include <stdlib.h>
10    #include <stdio.h>
11  #include <string.h>  #include <string.h>
12  #include <ctype.h>  #include <ctype.h>
13    #include <time.h>
14  #include "Riostream.h"  #include "Riostream.h"
15  #include "TFile.h"  #include "TFile.h"
16  #include "TDirectory.h"  #include "TDirectory.h"
# Line 255  void Digitizer::Loop() { Line 262  void Digitizer::Loop() {
262      DigitizeTrack();      DigitizeTrack();
263      //DigitizeS4();      //DigitizeS4();
264      DigitizeND();      DigitizeND();
265      //        //
     // Create CPU header, we need packet type (0x10 = physics data) and packet length.  
     //  
     UInt_t length = (fCALOlength + fACbuffer + fTracklength)*2;  
     DigitizePSCU(length,0x10);  
     //  
266      // Add padding to 64 bits      // Add padding to 64 bits
267      //      //
268      AddPadding();      AddPadding();
269    //
270        // Create CPU header, we need packet type (0x10 = physics data) and packet length.
271      //      //
272        //UInt_t length=2*(fCALOlength+fACbuffer+fTracklength+fNDbuffer+fS4buffer)+fPadding+fTOFbuffer+fTRIGGERbuffer;
273        UInt_t length=2*(fCALOlength+fACbuffer+fTracklength+fNDbuffer)+fPadding+fTOFbuffer+fTRIGGERbuffer;
274        DigitizePSCU(length,0x10);
275      if ( !i%100 ) std::cout << "writing event " << i << endl;      if ( !i%100 ) std::cout << "writing event " << i << endl;
276      WriteData();      WriteData();
277    };    };
# Line 1046  Int_t Digitizer::DigitizeTOF() { Line 1053  Int_t Digitizer::DigitizeTOF() {
1053    // ------ evaluate energy in each pmt: ------    // ------ evaluate energy in each pmt: ------
1054    // strip geometry (lenght/width)    // strip geometry (lenght/width)
1055    Float_t dimel[6] = {33.0, 40.8 ,18.0, 15.0, 15.0, 18.0};    Float_t dimel[6] = {33.0, 40.8 ,18.0, 15.0, 15.0, 18.0};
1056    Float_t dimes[6] = {5.1, 5.5, 7.5, 9.0, 6.0, 5.0};    //Float_t dimes[6] = {5.1, 5.5, 7.5, 9.0, 6.0, 5.0};
1057        
1058    //  S11 8 paddles  33.0 x 5.1 cm    //  S11 8 paddles  33.0 x 5.1 cm
1059    //  S12 6 paddles  40.8 x 5.5 cm    //  S12 6 paddles  40.8 x 5.5 cm
# Line 1106  Int_t Digitizer::DigitizeTOF() { Line 1113  Int_t Digitizer::DigitizeTOF() {
1113    //    fine lettura dal file */    //    fine lettura dal file */
1114    
1115    //const Int_t nmax=??; = Nthtof    //const Int_t nmax=??; = Nthtof
1116    Int_t nh, ip, ipad, ipmt;    Int_t ip, ipad;
1117      //Int_t ipmt;
1118    Int_t pmtleft=0, pmtright=0;    Int_t pmtleft=0, pmtright=0;
1119    Int_t *pl, *pr;    Int_t *pl, *pr;
1120    pl = &pmtleft;    pl = &pmtleft;
1121    pr = &pmtright;    pr = &pmtright;
1122    
1123      // TDC variables:
1124      Int_t TDClast=4095;      // no signal --> ADC ch=4095
1125      Int_t TDCint[48];
1126      Float_t  tdc[48],tdc1[48],tdcpmt[48];
1127      for(Int_t i=0; i<48; i++)
1128        tdcpmt[i] = 1000.;
1129      Float_t thresh=1.; // to be defined better... (Wolfgang)
1130    
1131        // === TDC: simulate timing for each paddle
1132        Float_t dt1 = 285.e-12 ;   // single PMT resolution
1133        Float_t tdcres[50],c1_S[50],c2_S[50],c3_S[50];
1134        for(Int_t j=0;j<48;j++)  tdcres[j] = 50.E-12;   // TDC resolution 50 picosec
1135        for(Int_t j=0;j<48;j++)  c1_S[j] = 500.;  // cable length in channels
1136        for(Int_t j=0;j<48;j++)  c2_S[j] = 0.;
1137        for(Int_t j=0;j<48;j++)  c3_S[j] = 1000.;
1138        for(Int_t j=0;j<48;j++)  c1_S[j] = c1_S[j]*tdcres[j];   // cable length in sec
1139        for(Int_t j=0;j<48;j++)  c2_S[j] = c2_S[j]*tdcres[j];
1140         // ih = 0 + i1;  // not used?? (Silvio)
1141    
1142    /* **********************************  inizio loop sugli hit */    /* **********************************  inizio loop sugli hit */
1143        
1144    for(Int_t nh=0; nh<Nthtof; nh++){    for(Int_t nh=0; nh<Nthtof; nh++){
# Line 1122  Int_t Digitizer::DigitizeTOF() { Line 1149  Int_t Digitizer::DigitizeTOF() {
1149        FGeo[j]=0.;        FGeo[j]=0.;
1150      }      }
1151    
1152        Float_t s_l_g[6] = {8.0, 8.0, 20.9, 22.0, 9.8, 8.3 };  // length of the lightguide
1153        Float_t t1,t2,veff,veff1,veff0 ;
1154        veff0 = 100.*1.0e8 ; // light velocity in the scintillator in m/sec
1155        veff1 = 100.*1.5e8; // light velocity in the lightguide in m/sec
1156        veff=veff0;         // signal velocity in the paddle
1157    
1158        t1 = Timetof[nh] ;  // Start
1159        t2 = Timetof[nh] ;
1160    
1161        // Donatella    
1162      // ridefiniz. piano e pad per i vettori in C      // ridefiniz. piano e pad per i vettori in C
1163      ip = Ipltof[nh]-1;      ip = Ipltof[nh]-1;
1164      ipad = Ipaddle[nh]-1;      ipad = Ipaddle[nh]-1;
# Line 1180  Int_t Digitizer::DigitizeTOF() { Line 1217  Int_t Digitizer::DigitizeTOF() {
1217      QevePmt_pC[pmtleft]  += QhitPmt_pC[0];      QevePmt_pC[pmtleft]  += QhitPmt_pC[0];
1218      QevePmt_pC[pmtright] += QhitPmt_pC[1];      QevePmt_pC[pmtright] += QhitPmt_pC[1];
1219            
1220    } // ****************************************       fine loop sugli hit      // TDC
1221          t2 = t2 + fabs(path[0]/veff) + s_l_g[ip]/veff1 ;  // Signal reaches PMT
1222        t1 = t1 + fabs(path[1]/veff) + s_l_g[ip]/veff1;
1223        
1224        TRandom r;
1225        t1 = r.Gaus(t1,dt1);  //apply gaussian error  dt
1226        t2 = r.Gaus(t2,dt1);  //apply gaussian error  dt
1227        
1228        t1 = t1 + c1_S[pmtleft] ;  // Signal reaches Discriminator ,TDC starts  to run
1229        t2 = t2 + c1_S[pmtright] ;
1230        
1231        // check if signal is above threshold
1232        // then check if tdcpmt is already filled by another hit...
1233        // only re-fill if time is smaller
1234        
1235        if (QhitPmt_pC[0] > thresh)
1236          if (tdcpmt[pmtleft] < 1000.) // is already filled!
1237            if (t1 <  tdcpmt[pmtleft]) {
1238              tdcpmt[pmtleft] = t1;
1239              t1 = t1 + c2_S[pmtleft] ;  // Signal reaches Coincidence
1240              tdc[pmtleft] = t1;
1241            }
1242        
1243        if (QhitPmt_pC[1] > thresh)
1244            if (tdcpmt[pmtright] < 1000.)  // is already filled!
1245              if (t2 <  tdcpmt[pmtright]) {
1246                tdcpmt[pmtright] = t2;
1247                t2 = t2 + c2_S[pmtright] ;
1248                tdc[pmtright] = t2;
1249              }      
1250        
1251      } // ****************************************       end loop over hits
1252    
1253      // ======  ADC ======
1254    for(Int_t i=0; i<48; i++){    for(Int_t i=0; i<48; i++){
1255      if(QevePmt_pC[i] != 0.){      if(QevePmt_pC[i] != 0.){
1256        ADCtof[i]= (Int_t)(ADC_pC*QevePmt_pC[i] + ADCoffset);        ADCtof[i]= (Int_t)(ADC_pC*QevePmt_pC[i] + ADCoffset);
# Line 1189  Int_t Digitizer::DigitizeTOF() { Line 1258  Int_t Digitizer::DigitizeTOF() {
1258      } else      } else
1259        ADCtof[i]= ADClast;        ADCtof[i]= ADClast;
1260    };    };
1261    
1262        
1263      // ======  build  TDC coincidence  ======
1264    
1265      Float_t t_coinc = 0;
1266      Int_t ilast = 100;
1267      for (Int_t ii=0; ii<48;ii++)
1268        if (tdc[ii] > t_coinc) {
1269          t_coinc = tdc[ii];
1270          ilast = ii;
1271        }
1272      
1273      //     cout<<ilast<<" "<<t_coinc<<endl;
1274      //     At t_coinc  trigger condition is fulfilled
1275      
1276      for (Int_t ii=0; ii<48;ii++){
1277        //      if (tdc[ii] != 0) tdc1[ii] = t_coinc - tdc[ii];   // test 1
1278        if (tdc[ii] != 0) tdc1[ii] = t_coinc - tdcpmt[ii];  // test 2
1279        tdc1[ii] = tdc1[ii]/tdcres[ii];                     // divide by TDC resolution
1280        if (tdc[ii] != 0) tdc1[ii] = tdc1[ii] + c3_S[ii];  // add cable length c3
1281    
1282      } // missing parenthesis inserted! (Silvio)
1283    
1284      for(Int_t i=0; i<48; i++){
1285        if(tdc1[i] != 0.){
1286          TDCint[i]=(Int_t)tdc1[i];
1287          //ADC[i]= ADC_pC * QevePmt_pC[i] + ADCoffset;
1288          //if(ADC[i]> ADClast) ADC[i]=ADClast;
1289        } else
1290          TDCint[i]= TDClast;
1291      }
1292    
1293    // ======  write fDataTof  =======
1294    UChar_t tofBin;    UChar_t tofBin;
   // --- write fDataTof:  
1295    for (Int_t j=0; j < 12; j++){    for (Int_t j=0; j < 12; j++){
1296      Int_t j12=j*12;      Int_t j12=j*12;
1297      fDataTof[j12+0]=0x00;   // TDC_ID      fDataTof[j12+0]=0x00;   // TDC_ID
# Line 1204  Int_t Digitizer::DigitizeTOF() { Line 1304  Int_t Digitizer::DigitizeTOF() {
1304        fDataTof[jk12+4] = Bin2GrayTof(tofBin,fDataTof[jk12+4]);        fDataTof[jk12+4] = Bin2GrayTof(tofBin,fDataTof[jk12+4]);
1305        tofBin=(UChar_t)(ADCtof[k+4*j]%256);   // ADC# (lsb)        tofBin=(UChar_t)(ADCtof[k+4*j]%256);   // ADC# (lsb)
1306        fDataTof[jk12+5] = Bin2GrayTof(tofBin,fDataTof[jk12+5]);        fDataTof[jk12+5] = Bin2GrayTof(tofBin,fDataTof[jk12+5]);
1307        fDataTof[jk12+6]=0x00;   // TDC# (msb) -- Wolfgang        tofBin=(UChar_t)(TDCint[k+4*j]/256);   // TDC# (msb)
1308        fDataTof[jk12+7]=0x00;   // TDC# (lsb) -- Wolfgang        fDataTof[jk12+6]=Bin2GrayTof(tofBin,fDataTof[jk12+6]);
1309          tofBin=(UChar_t)(TDCint[k+4*j]%256);   // TDC# (lsb)
1310          fDataTof[jk12+7]=Bin2GrayTof(tofBin,fDataTof[jk12+7]);
1311      };      };
1312      fDataTof[j12+20]=0x00;   // TEMP1      fDataTof[j12+20]=0x00;   // TEMP1
1313      fDataTof[j12+21]=0x00;   // TEMP2      fDataTof[j12+21]=0x00;   // TEMP2
# Line 1484  void Digitizer::DigitizeAC() { Line 1586  void Digitizer::DigitizeAC() {
1586  };  };
1587    
1588    
 void Digitizer::DigitizeND(){  
   // creato:  S. Borisov, INFN Roma2 e MEPHI, Sept 2007  
   // 4 bytes: 16bit header, 8bit trigPhysics, 16bit up&low background  
1589    
1590    // ND header  void Digitizer::DigitizeS4(){
1591    fDataND[0] = 0x0000;    // creato:  S. Borisov, INFN Roma2 e MEPHI, Sett 2007
1592    fDataND[1] = 0x000F;    TString ciao,modo="ns";
1593      Int_t i,j,t,NdF,pmt,NdFT,S4,S4v=0,S4p=32;
1594      Float_t E0,E1=1e-6,Ert,X,Y,Z,x,y,z,V[3],Xs[2],Ys[2],Zs[2],Yp[6],q,w,p=0.1,l,l0=500.;
1595      Xs[0]=-24.1;
1596      Xs[1]=24.1;
1597      Ys[0]=-24.1;
1598      Ys[1]=24.1;
1599      Zs[0]=-0.5;
1600      Zs[1]=0.5;
1601      Yp[0]=-20.;
1602      Yp[2]=-1.;
1603      Yp[4]=17.;
1604      for(i=0;i<3;i++)
1605        Yp[2*i+1]=Yp[2*i]+3;
1606      srand(time(NULL));
1607      // --- activate branches:
1608      fhBookTree->SetBranchStatus("Nthtof",1);
1609      fhBookTree->SetBranchStatus("Ipltof",1);
1610      fhBookTree->SetBranchStatus("Ipaddle",1);
1611        
1612      fhBookTree->SetBranchStatus("Xintof",1);
1613      fhBookTree->SetBranchStatus("Yintof",1);
1614      fhBookTree->SetBranchStatus("Xouttof",1);
1615      fhBookTree->SetBranchStatus("Youttof",1);
1616      
1617      fhBookTree->SetBranchStatus("Ereltof",1);
1618      fhBookTree->SetBranchStatus("Timetof",1);
1619      NdFT=0;
1620      Ert=0;
1621      for(i=0;i<Nthtof;i++){
1622        if(Ipltof[i]!=6) continue;
1623        Ert+=Ereltof[i];
1624          
1625        
1626        if(modo=="ns") continue;
1627        NdF=Int_t(Ereltof[i]/E1);
1628        NdFT=0;
1629        X=Xintof[i];
1630        Y=Yintof[i];
1631        Z=((Float_t)random()/(Float_t)0x7fffffff)-0.5;
1632        //cout<<"XYZ "<<X<<"  "<<Y<<"  "<<Z<<endl;
1633        for(j=0;j<NdF;j++){
1634          q=(Float_t)random()/(Float_t)0x7fffffff;
1635          w=(Float_t)random()/(Float_t)0x7fffffff;
1636          // cout<<"qw "<<q<<" "<<w<<endl;
1637          V[0]=p*cos(6.28318*q);
1638          V[1]=p*sin(6.28318*q);
1639          V[2]=p*(2.*w-1.);
1640          pmt=0;
1641          x=X;
1642          y=Y;
1643          z=Z;
1644          while(pmt==0 && (x>Xs[0] && x<Xs[1])&&(y>Ys[0] && y<Ys[1])&&(z>Zs[0] && z<Zs[1])){
1645            l=0;
1646            while(pmt==0 && (x>Xs[0] && x<Xs[1])&&(y>Ys[0] && y<Ys[1])&&(z>Zs[0] && z<Zs[1])){
1647              x+=V[0];
1648              y+=V[1];
1649              z+=V[2];
1650              l+=p;
1651              //cout<<x<<"  "<<y<<"  "<<z<<"  "<<l<<endl;
1652              //cin>>ciao;
1653            }
1654            if((x<Xs[0]+p || x>Xs[1]-p)&&(y>Ys[0]+p && y<Ys[1]-p)&&(z>Zs[0]+p && z<Zs[1]-p)){
1655              for(t=0;t<3;t++){
1656                if(y>=Yp[2*t] && y<Yp[2*t+1]){
1657                  if(pmt==0)NdFT++;
1658                  pmt=1;
1659                  //cout<<NdFT<<endl;
1660                  break;
1661                }
1662              }
1663              if(pmt==1)break;
1664              V[0]=-V[0];
1665            }
1666            q=(Float_t)random()/(Float_t)0x7fffffff;
1667            w=1-exp(-l/l0);
1668            if(q<w)break;
1669            q=(Float_t)random()/(Float_t)0x7fffffff;
1670            w=0.5;
1671            if(q<w)break;
1672            if((x>Xs[0]+p && x<Xs[1]-p)&&(y<Ys[0]+p || y>Ys[1]-p)&&(z>Zs[0]+p && z<Zs[1]-p))V[1]=-V[1];
1673            if((x>Xs[0]+p && x<Xs[1]-p)&&(y>Ys[0]+p && y<Ys[1]-p)&&(z<Zs[0]+p || z>Zs[1]-p))V[2]=-V[2];
1674            x+=V[0];
1675            y+=V[1];
1676            z+=V[2];
1677            l=0;
1678            //cout<<x<<"  "<<y<<"  "<<z<<"  "<<l<<endl;
1679                    //cin>>ciao;
1680          }
1681        }
1682      }
1683      Ert=Ert/0.002;
1684      q=(Float_t)(random())/(Float_t)(0x7fffffff);
1685      w=0.7;
1686      //E0=Float_t(4064)/7;
1687      E0=4064./7.;
1688      S4=(Int_t)(4064.*(1.-exp(-int(Ert)/E0)));
1689      //S4=Ert*7;
1690      i=S4/4;
1691      if(S4%4==0)
1692        S4v=S4+S4p;
1693      else if(S4%4==1) {
1694        if(q<w) S4v=S4-1+S4p;
1695        else S4v=S4+1+S4p;
1696      } else if(S4%4==2)
1697        S4v=S4+S4p;
1698      else if(S4%4==3){
1699        if(q<w) S4v=S4+1+S4p;
1700        else S4v=S4-1+S4p;
1701      }
1702    
1703      cout << "Ert= " <<Ert<<"; S4v= "<<S4v<<"; S4= "<<S4<<endl;
1704      fDataS4[0]=S4v;//0xf028;
1705      fDataS4[1]=0xd800;
1706      fDataS4[2]=0x0300;
1707      //  cout<<"  PMT  "<<NdFT<<"  "<<NdF<<endl;
1708      //cin>>ciao;
1709    }
1710    
1711    
1712    
1713    void Digitizer::DigitizeND(){
1714      // creato:  S. Borisov, INFN Roma2 e MEPHI, Sett 2007
1715      Int_t i=0;
1716      UShort_t NdN=0;
1717    fhBookTree->SetBranchStatus("Nthnd",1);    fhBookTree->SetBranchStatus("Nthnd",1);
1718    fhBookTree->SetBranchStatus("Itubend",1);    fhBookTree->SetBranchStatus("Itubend",1);
1719    fhBookTree->SetBranchStatus("Iparnd",1);      fhBookTree->SetBranchStatus("Iparnd",1);  
# Line 1505  void Digitizer::DigitizeND(){ Line 1727  void Digitizer::DigitizeND(){
1727    fhBookTree->SetBranchStatus("Timend",1);    fhBookTree->SetBranchStatus("Timend",1);
1728    fhBookTree->SetBranchStatus("Pathnd",1);    fhBookTree->SetBranchStatus("Pathnd",1);
1729    fhBookTree->SetBranchStatus("P0nd",1);    fhBookTree->SetBranchStatus("P0nd",1);
1730      //cout<<"n="<<Nthnd<<"  "<<NdN<<"\n";
1731    UShort_t NdN=0;    for(i=0;i<Nthnd;i++){
1732    for(Int_t i=0;i<Nthnd;i++)      if(Iparnd[i]==13){
1733      if(Iparnd[i]==13)        NdN++;
1734        NdN++;            }
1735      }
1736    NdN=10; // test!    NdN=100;
1737    fDataND[2]=0x0F00 & (NdN*256);    for(i=0;i<3;i++){
1738    //fDataND[2]=0xFFFF; //test      fDataND[2*i]=0x0000;
1739    fDataND[2]=0x0000; //background neutrons      fDataND[2*i+1]=0x010F;
1740      }
1741      fDataND[0]=0xFF00 & (256*NdN);
1742  }  }
1743    
1744    
# Line 1530  void Digitizer::DigitizeDummy() { Line 1754  void Digitizer::DigitizeDummy() {
1754      //   printf("%0x  ",fDataDummy[i]);        //   printf("%0x  ",fDataDummy[i]);  
1755      //if ((i+1)%8 ==0) cout << endl;      //if ((i+1)%8 ==0) cout << endl;
1756    }    }
     
   
   
1757  };  };
1758    
1759    
# Line 1559  void Digitizer::WriteData(){ Line 1780  void Digitizer::WriteData(){
1780    swab(fDataTrack,temp,sizeof(UShort_t)*fTracklength);  // WE MUST SWAP THE BYTES!!!    swab(fDataTrack,temp,sizeof(UShort_t)*fTracklength);  // WE MUST SWAP THE BYTES!!!
1781    fOutputfile.write(reinterpret_cast<char*>(temp),sizeof(UShort_t)*fTracklength);    fOutputfile.write(reinterpret_cast<char*>(temp),sizeof(UShort_t)*fTracklength);
1782    fTracklength=0;    fTracklength=0;
1783    // S4     // padding to 64 bytes
   // ...to be done...  
   // ND  
   memset(temp,0,sizeof(UShort_t)*1000000);  
   swab(fDataND,temp,sizeof(UShort_t)*4);  // WE MUST SWAP THE BYTES!!!  
   fOutputfile.write(reinterpret_cast<char*>(temp),sizeof(UShort_t)*4);  
   
   //  
   //  fOutputfile.write(reinterpret_cast<char*>(fDataDummy),sizeof(UShort_t)*fDummybuffer);  
   //  
   // padding to 64 bytes  
1784    //    //
1785    if ( fPadding ){    if ( fPadding ){
1786      fOutputfile.write(reinterpret_cast<char*>(fDataPadding),sizeof(UChar_t)*fPadding);      fOutputfile.write(reinterpret_cast<char*>(fDataPadding),sizeof(UChar_t)*fPadding);
1787    };    };
1788    //    // S4
1789      memset(temp,0,sizeof(UShort_t)*1000000);
1790      swab(fDataS4,temp,sizeof(UShort_t)*fS4buffer);  // WE MUST SWAP THE BYTES!!!
1791      fOutputfile.write(reinterpret_cast<char*>(temp),sizeof(UShort_t)*fS4buffer);
1792      // ND
1793      memset(temp,0,sizeof(UShort_t)*1000000);
1794      swab(fDataND,temp,sizeof(UShort_t)*fNDbuffer);  // WE MUST SWAP THE BYTES!!!
1795      fOutputfile.write(reinterpret_cast<char*>(temp),sizeof(UShort_t)*fNDbuffer);
1796  };  };
1797    
1798    
# Line 1667  Int_t Nstrip; Line 1885  Int_t Nstrip;
1885    
1886    
1887    
     
1888    Float_t ADCfull;    Float_t ADCfull;
1889      Int_t iladd=0;
1890    for (Int_t ix=0; ix<Nstrpx;ix++) {    for (Int_t ix=0; ix<Nstrpx;ix++) {
1891    Iview=Npstripx[ix]*2-1;    Iview=Npstripx[ix]*2-1;
1892    Nstrip=(Int_t)Istripx[ix]-1;    Nstrip=(Int_t)Istripx[ix]-1;
1893    ADCfull=AdcTrack[Iview][Nstrip] += Qstripx[ix]*fMipCor;    if(Nstrip<fNstrips_ladder) iladd=0;
1894      if((Nstrip>=fNstrips_ladder)&&(Nstrip<2*fNstrips_ladder)) iladd=1;
1895      if((Nstrip>=2*fNstrips_ladder)&&(Nstrip<3*fNstrips_ladder)) iladd=2;
1896      ADCfull=AdcTrack[Iview][Nstrip] += Qstripx[ix]*fMipCor[iladd][Iview];
1897    AdcTrack[Iview][Nstrip] *= SaturationTrack(ADCfull);    AdcTrack[Iview][Nstrip] *= SaturationTrack(ADCfull);
1898    
1899    };    };
# Line 1681  Int_t Nstrip; Line 1902  Int_t Nstrip;
1902    for (Int_t iy=0; iy<Nstrpy;iy++) {    for (Int_t iy=0; iy<Nstrpy;iy++) {
1903    Iview=Npstripy[iy]*2-2;    Iview=Npstripy[iy]*2-2;
1904    Nstrip=(Int_t)Istripy[iy]-1;    Nstrip=(Int_t)Istripy[iy]-1;
1905    ADCfull=AdcTrack[Iview][Nstrip] -= Qstripy[iy]*fMipCor;    if(Nstrip<fNstrips_ladder) iladd=0;
1906      if((Nstrip>=fNstrips_ladder)&&(Nstrip<2*fNstrips_ladder)) iladd=1;
1907      if((Nstrip>=2*fNstrips_ladder)&&(Nstrip<3*fNstrips_ladder)) iladd=2;
1908      ADCfull=AdcTrack[Iview][Nstrip] -= Qstripy[iy]*fMipCor[iladd][Iview];
1909    AdcTrack[Iview][Nstrip] *= SaturationTrack(ADCfull);    AdcTrack[Iview][Nstrip] *= SaturationTrack(ADCfull);
1910    
1911    };      };  
# Line 1929  std:: cout << "Entering LoadTrackCalib " Line 2153  std:: cout << "Entering LoadTrackCalib "
2153    
2154  void Digitizer::LoadMipCor() {  void Digitizer::LoadMipCor() {
2155  std:: cout << "Entering LoadMipCor" << endl;  std:: cout << "Entering LoadMipCor" << endl;
2156      Float_t xfactor=1./151.6*1.04;
2157      Float_t yfactor=1./152.1;
2158    
2159      fMipCor[0][0]=140.02*yfactor;
2160      fMipCor[0][1]=140.99*xfactor;
2161      fMipCor[0][2]=134.48*yfactor;
2162      fMipCor[0][3]=144.41*xfactor;
2163      fMipCor[0][4]=140.74*yfactor;
2164      fMipCor[0][5]=142.28*xfactor;
2165      fMipCor[0][6]=134.53*yfactor;
2166      fMipCor[0][7]=140.63*xfactor;
2167      fMipCor[0][8]=135.55*yfactor;
2168      fMipCor[0][9]=138.00*xfactor;
2169      fMipCor[0][10]=154.95*yfactor;
2170      fMipCor[0][11]=158.44*xfactor;
2171      
2172      
2173      fMipCor[1][0]=136.07*yfactor;
2174      fMipCor[1][1]=135.59*xfactor;
2175      fMipCor[1][2]=142.69*yfactor;
2176      fMipCor[1][3]=138.19*xfactor;
2177      fMipCor[1][4]=137.35*yfactor;
2178      fMipCor[1][5]=140.23*xfactor;
2179      fMipCor[1][6]=153.15*yfactor;
2180      fMipCor[1][7]=151.42*xfactor;
2181      fMipCor[1][8]=129.76*yfactor;
2182      fMipCor[1][9]=140.63*xfactor;
2183      fMipCor[1][10]=157.87*yfactor;
2184      fMipCor[1][11]=153.64*xfactor;
2185    
2186      fMipCor[2][0]=134.98*yfactor;
2187      fMipCor[2][1]=143.95*xfactor;
2188      fMipCor[2][2]=140.23*yfactor;
2189      fMipCor[2][3]=138.88*xfactor;
2190      fMipCor[2][4]=137.95*yfactor;
2191      fMipCor[2][5]=134.87*xfactor;
2192      fMipCor[2][6]=157.56*yfactor;
2193      fMipCor[2][7]=157.31*xfactor;
2194      fMipCor[2][8]=141.37*yfactor;
2195      fMipCor[2][9]=143.39*xfactor;
2196      fMipCor[2][10]=156.15*yfactor;
2197      fMipCor[2][11]=158.79*xfactor;
2198    
2199  /*  /*
2200    for (Int_t j=0; j<fNviews;j++) {    for (Int_t j=0; j<fNviews;j++) {
2201      for (Int_t i=0; i<fNstrips_view;i++) {      for (Int_t i=0; i<fNstrips_view;i++) {
# Line 2221  fTracklength=0; Line 2488  fTracklength=0;
2488    
2489  };  };
2490    
 Float_t Digitizer::SaturationTrack(Float_t ADC) {  
2491    
2492  Float_t SatFact=1.;  Float_t Digitizer::SaturationTrack(Float_t ADC) {
2493  return SatFact;    Float_t SatFact=1.;
2494      if(ADC<70.) { SatFact=80./ADC; };
2495      if(ADC>3000.) { SatFact=3000./ADC; };
2496      return SatFact;
2497  };  };
2498    
2499    

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.23