/[PAMELA software]/PamVMC/tof/src/PamVMCTofDig.cxx
ViewVC logotype

Diff of /PamVMC/tof/src/PamVMCTofDig.cxx

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

revision 1.1 by nikolas, Thu Feb 19 16:00:17 2009 UTC revision 1.5 by pam-rm2, Fri Jun 12 18:39:47 2009 UTC
# Line 27  void PamVMCTofDig::LoadCalib(){ Line 27  void PamVMCTofDig::LoadCalib(){
27    ThrowCalFileUsage("TOF",fquery.str().c_str());    ThrowCalFileUsage("TOF",fquery.str().c_str());
28        
29    fcfile.open(fquery.str().c_str());    fcfile.open(fquery.str().c_str());
   // fcfile.open("/opt/pamela-5.21/calib/tof-param/ToFCalibParam.txt");  
30    
31    if(!fcfile) ThrowCalFileWarning("TOF"); else {    if(!fcfile) ThrowCalFileWarning("TOF"); else {
32    
# Line 70  void PamVMCTofDig::DigitizeTOF(Int_t Eve Line 69  void PamVMCTofDig::DigitizeTOF(Int_t Eve
69    const Int_t ADCsat=3100;       // saturation value for the ADCs    const Int_t ADCsat=3100;       // saturation value for the ADCs
70    const Int_t TDClast=4095;    const Int_t TDClast=4095;
71    
72    
73    for(Int_t i =0; i<NP; i++){    for(Int_t i =0; i<NP; i++){
74      fQevePmt_pC[i]=ftdc[i]=ftdc1[i]=0.;      fQevePmt_pC[i]=ftdc[i]=ftdc1[i]=0.;
75      ftdcpmt[i]=1000.;      ftdcpmt[i]=1000.;
# Line 85  void PamVMCTofDig::DigitizeTOF(Int_t Eve Line 85  void PamVMCTofDig::DigitizeTOF(Int_t Eve
85      hc = 0;      hc = 0;
86    }    }
87    
88      if(fDEBUG){
89        cout<<"Summarized values for ADC in PC:"<<endl;
90        for(Int_t i=0; i<NP; i++){
91          cout<<"PMT #"<<i<<" fQevePmt_pC="<<fQevePmt_pC[i]<<endl;
92        }
93      }
94    //+++++ ADC +++++    //+++++ ADC +++++
95    
96    for(Int_t i=0; i<NP; i++){    for(Int_t i=0; i<NP; i++){
# Line 106  void PamVMCTofDig::DigitizeTOF(Int_t Eve Line 112  void PamVMCTofDig::DigitizeTOF(Int_t Eve
112    
113    // ======  TDC coincidence  ======    // ======  TDC coincidence  ======
114    
115    Float_t t_coinc = 0;  
116      for(Int_t i=0; i<NP; i++) {
117        if((ftdcpmt[i] - fc1_S[i]) > 1e-7) {
118          ftdcpmt[i] = 0.;
119          ftdc[i] = 0.;
120        }
121      }// cycle to introduce a window for tdc
122    
123      Double_t t_coinc = 0;
124    Int_t ilast = 100;    Int_t ilast = 100;
125    for (Int_t ii=0; ii<NP;ii++)    for (Int_t ii=0; ii<NP;ii++)
126      if (ftdc[ii] > t_coinc) {      if (ftdc[ii] > t_coinc) {
# Line 147  void PamVMCTofDig::DigitizeTOF(Int_t Eve Line 161  void PamVMCTofDig::DigitizeTOF(Int_t Eve
161      fTDCint[i]= TDChelp[i];      fTDCint[i]= TDChelp[i];
162    }    }
163    
164      if (fDEBUG){
165        cout<<"====== TOF coincidence after... ======"<<endl;
166        for(Int_t i=0; i<NP; i++){
167          cout<<"PMT: "<<i<<" ADC: "<<fADCtof[i]<<" TDC: "
168              <<fTDCint[i]<<endl;
169        }
170        cout<<"============================="<<endl;
171      }
172    // ======  write DataTof  =======    // ======  write DataTof  =======
173    
174    UChar_t Ctrl3bit[8]={32,0,96,64,160,128,224,192};  // DC (msb in 8 bit word )    UChar_t Ctrl3bit[8]={32,0,96,64,160,128,224,192};  // DC (msb in 8 bit word )
# Line 174  void PamVMCTofDig::DigitizeTOF(Int_t Eve Line 195  void PamVMCTofDig::DigitizeTOF(Int_t Eve
195        /* control bits inserted here, after the bin to gray conv - DC*/        /* control bits inserted here, after the bin to gray conv - DC*/
196        DataTof[jk12+6] = Ctrl3bit[2*k+1] | DataTof[jk12+6];        DataTof[jk12+6] = Ctrl3bit[2*k+1] | DataTof[jk12+6];
197        tofBin=(UChar_t)(fTDCint[k+4*j]%256);   // TDC# (lsb)        tofBin=(UChar_t)(fTDCint[k+4*j]%256);   // TDC# (lsb)
198          //if(fDEBUG) cout<<" digit TDC: "<<jk12<<" TDC:"<<(Int_t)tofBin<<endl;
199        DataTof[jk12+7]=Bin2GrayTof(tofBin,DataTof[jk12+7]);        DataTof[jk12+7]=Bin2GrayTof(tofBin,DataTof[jk12+7]);
200      }      }
201      DataTof[j12+20]=0x00;   // TEMP1      DataTof[j12+20]=0x00;   // TEMP1
# Line 300  void PamVMCTofDig::DigitizeTofPlane(Int_ Line 322  void PamVMCTofDig::DigitizeTofPlane(Int_
322      t1=t2 = hit->GetTOF();      t1=t2 = hit->GetTOF();
323      padNo = hit->GetPOS()-1;      padNo = hit->GetPOS()-1;
324      pmtleft=pmtright=0;      pmtleft=pmtright=0;
325      if(planeNo==2)      if(planeNo==2){
326        if(padNo==0)        if(padNo==0)
327          padNo=1;          padNo=1;
328        else        else
329          padNo=0;          padNo=0;
330        }
331    
332      Paddle2Pmt(planeNo,padNo, &pmtleft, &pmtright);      Paddle2Pmt(planeNo,padNo, &pmtleft, &pmtright);
333            
# Line 363  void PamVMCTofDig::DigitizeTofPlane(Int_ Line 386  void PamVMCTofDig::DigitizeTofPlane(Int_
386      // WM right and left <->          // WM right and left <->    
387      t1 += Abs(path[0]/veff0) + s_l_g[planeNo]/veff1;      t1 += Abs(path[0]/veff0) + s_l_g[planeNo]/veff1;
388      t2 += Abs(path[1]/veff0) + s_l_g[planeNo]/veff1;  // Signal reaches PMT      t2 += Abs(path[1]/veff0) + s_l_g[planeNo]/veff1;  // Signal reaches PMT
389      t1 = gRandom->Gaus(t1,TimeRes(PrimaryPDG)); //apply gaussian error  dt      t1 = frandom->Gaus(t1,TimeRes(PrimaryPDG)); //apply gaussian error  dt
390      t2 = gRandom->Gaus(t2,TimeRes(PrimaryPDG)); //apply gaussian error  dt      t2 = frandom->Gaus(t2,TimeRes(PrimaryPDG)); //apply gaussian error  dt
391      t1 += fc1_S[pmtleft] ;  // Signal reaches Discriminator ,TDC starts  to run      t1 += fc1_S[pmtleft] ;  // Signal reaches Discriminator ,TDC starts  to run
392      t2 += fc1_S[pmtright] ;      t2 += fc1_S[pmtright] ;
393    
# Line 391  void PamVMCTofDig::DigitizeTofPlane(Int_ Line 414  void PamVMCTofDig::DigitizeTofPlane(Int_
414        if (ftdcpmt[pmtright] < 1000.)  // is already filled!        if (ftdcpmt[pmtright] < 1000.)  // is already filled!
415          if (t2 <  ftdcpmt[pmtright]) {          if (t2 <  ftdcpmt[pmtright]) {
416            ftdcpmt[pmtright] = t2;            ftdcpmt[pmtright] = t2;
417            t2+= fc2_S[pmtright] ;            t2 += fc2_S[pmtright] ;
418            ftdc[pmtright] = t2;            ftdc[pmtright] = t2;
419          }          }
420      }      }
421      if(fDEBUG)cout<<"Time(s):"<<hit->GetTOF()<<" t1:"<<t1<<" t2:"<<t2<<endl      if(fDEBUG)cout<<"Time(s):"<<hit->GetTOF()<<" t1:"<<t1<<" t2:"<<t2<<endl
422                   <<"+++++  END OF TOF HIT +++++"<<endl;                   <<"+++++  END OF TOF HIT +++++"<<endl;
423          };
424    };    //END OF HIT COLLECTION LOOP
   //END OF HIT COLLECTION LOOP  
   
425  }  }
426    
427  void PamVMCTofDig::Paddle2Pmt(Int_t planeNo, Int_t padNo, Int_t *pl, Int_t *pr){  void PamVMCTofDig::Paddle2Pmt(Int_t planeNo, Int_t padNo, Int_t *pl, Int_t *pr){

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.23