--- PamelaDigitizer/DigitizeTOF.cxx 2008/12/18 17:11:47 1.4 +++ PamelaDigitizer/DigitizeTOF.cxx 2009/11/13 09:08:53 1.7 @@ -101,11 +101,12 @@ pmtleft=0; pmtright=0; // WM: S12 paddles are "reversed" (Nov'07) - if (ip==2) + if (ip==2){ if (ipad==0) ipad=1; else ipad=0; + } if ((ip>-1)&&(ip<6)) { //ToF paddles only, not S4 Paddle2Pmt(ip, ipad, &pmtleft, &pmtright); // DC: evaluates mean position and path inside the paddle @@ -188,7 +189,7 @@ } // NTHTOF < 200 // ====== ADC ====== for(Int_t i=0; i<48; i++){ - if (QevePmt_pC[i] < 800.) ADCtof[i]= (Int_t)(ADC_pC0A + ADC_pC1A*QevePmt_pC[i] + ADC_pC2A*pow(QevePmt_pC[i],2) + ADC_pC3A*pow(QevePmt_pC[i],3)); + if (QevePmt_pC[i] <= 800.) ADCtof[i]= (Int_t)(ADC_pC0A + ADC_pC1A*QevePmt_pC[i] + ADC_pC2A*pow(QevePmt_pC[i],2) + ADC_pC3A*pow(QevePmt_pC[i],3)); if (QevePmt_pC[i] > 800.) ADCtof[i]= (Int_t)(ADC_pC0B + ADC_pC1B*QevePmt_pC[i] + ADC_pC2B*pow(QevePmt_pC[i],2) + ADC_pC3B*pow(QevePmt_pC[i],3)); if (QevePmt_pC[i] > 2485.) ADCtof[i]= (Int_t)(1758. + 0.54*QevePmt_pC[i]); //assuming a fictional 0.54 ch/pC above ADCsat if (ADCtof[i]>ADCsat) ADCtof[i]=ADCsat; @@ -202,6 +203,15 @@ // ====== build TDC coincidence ====== + // + for(Int_t i=0; i<48; i++) { + if((tdcpmt[i] - c1_S[i]) > 1e-7) { + tdcpmt[i] = 0.; + tdc[i] = 0.; + } + }// cycle to introduce a window for tdc + + Float_t t_coinc = 0; Int_t ilast = 100; for (Int_t ii=0; ii<48;ii++) @@ -372,7 +382,7 @@ UChar_t crcTof=0x00; UChar_t *pc=&crcTof, *pc2; pc2=pTof; - for (Int_t jp=0; jp < 23; jp++){ + for (Int_t jp=0; jp < 22; jp++){ // cecilia: fixed 23->22 //crcTof = crc8(...) Crc8Tof(pc2++,pc); // printf("%2i --- %x\n",jp,crcTof); @@ -463,22 +473,33 @@ Int_t error = 0,temp=0; GL_PARAM *glparam = new GL_PARAM(); error = glparam->Query_GL_PARAM(3,202,fDbc); - calfile.str(""); - calfile << glparam->PATH.Data() << "/"; - calfile << glparam->NAME.Data(); - printf("\n Using TOF calibration file: \n %s\n",calfile.str().c_str()); - ifstream fileTriggerCalib; - fileTriggerCalib.open(calfile.str().c_str()); - if(!fileTriggerCalib)printf("debug: no trigger calib file!\n"); - // correct readout WM Oct '07 - for(Int_t i=0; i> temp; - fileTriggerCalib >> atte1[i]; - fileTriggerCalib >> lambda1[i]; - fileTriggerCalib >> atte2[i]; - fileTriggerCalib >> lambda2[i]; - fileTriggerCalib >> temp; + if(!error){ + calfile.str(""); + calfile << glparam->PATH.Data() << "/"; + calfile << glparam->NAME.Data(); + printf("\n Using TOF calibration file: \n %s\n",calfile.str().c_str()); + ifstream fileTriggerCalib; + fileTriggerCalib.open(calfile.str().c_str()); + for(Int_t i=0; i> temp; + fileTriggerCalib >> atte1[i]; + fileTriggerCalib >> lambda1[i]; + fileTriggerCalib >> atte2[i]; + fileTriggerCalib >> lambda2[i]; + fileTriggerCalib >> temp; + } + fileTriggerCalib.close(); + } + else{ + cout<