--- PamelaDigitizer/DigitizeTOF.cxx 2008/05/21 09:50:42 1.1 +++ PamelaDigitizer/DigitizeTOF.cxx 2009/08/11 14:56:30 1.6 @@ -1,32 +1,4 @@ -#include -#include -#include -#include -#include -#include -#include -#include "Riostream.h" -#include "TFile.h" -#include "TDirectory.h" -#include "TTree.h" -#include "TLeafI.h" -#include "TH1.h" -#include "TH2.h" -#include "TF1.h" -#include "TMath.h" -#include "TRandom.h" -#include "TSQLServer.h" -#include "TSystem.h" -#include "CalibTrk1Event.h" -#include "CalibTrk2Event.h" -// #include "Digitizer.h" -#include "CRC.h" -// -#include -#include -#include -#include "GLTables.h" void Digitizer::DigitizeTOF(int np,float *atte1,float *atte2,float *lambda1,float *lambda2){ //fDataTof: 12 x 23 bytes (=276 bytes) @@ -38,16 +10,16 @@ 1,1,1,1,2,2,2,3,3,3,3,4,4,4,1, //30-44 1,2,0,2,0,0,5,5,5,5,6,6,6,6,7, //45-59 3,3,4,4,5,5,6,7,8,9,10,11,12,13,14 }; //60-74 - + int Z = cdp[Ipa-1]; float time_res[8] = {425.,210.,170.,130.,120.,120.,120.,120.}; - - Float_t dt1 = 1.e-12*time_res[0]; // single PMT resolution for Z=1 (WM, Nov'07) - + for(Int_t i=0;i<8;i++)time_res[i]/=1.4;//1.17;1.5;1.3*/ + Float_t dt1 = 0.;// = 1.e-12*time_res[0]; // single PMT resolution for Z=1 (WM, Nov'07) + if ((Z > 1) && (Z < 9)) dt1=1.e-12*time_res[(Z-1)]; if (Z > 8) dt1=120.e-12; - + // ------ evaluate energy in each pmt: ------ // strip geometry (lenght/width) @@ -63,37 +35,36 @@ const Float_t echarge = 1.6e-19; // electron charge Float_t Npho=0.; Float_t QevePmt_pC[48]; - Float_t QhitPad_pC[2]={0., 0.}; - Float_t QhitPmt_pC[2]={0., 0.}; + Float_t QhitPad_pC[2]={0.,0.}; + Float_t QhitPmt_pC[2]={0.,0.}; Float_t pmGain = 3.5e6; /* PMT Gain: the same for all PMTs */ Float_t effi=0.21; /* Efficienza di fotocatodo */ // pC < 800 - Float_t ADC_pC0A = -4.437616e+01 ; - Float_t ADC_pC1A = 1.573329e+00 ; - Float_t ADC_pC2A = 2.780518e-04 ; - Float_t ADC_pC3A = -2.302160e-07 ; + Float_t ADC_pC0A =-4.437616e+01; + Float_t ADC_pC1A = 1.573329e+00; + Float_t ADC_pC2A = 2.780518e-04; + Float_t ADC_pC3A =-2.302160e-07; // pC > 800: - Float_t ADC_pC0B = -2.245756e+02 ; - Float_t ADC_pC1B = 2.184156e+00 ; - Float_t ADC_pC2B = -4.171825e-04 ; - Float_t ADC_pC3B = 3.789715e-08 ; + Float_t ADC_pC0B =-2.245756e+02; + Float_t ADC_pC1B = 2.184156e+00; + Float_t ADC_pC2B =-4.171825e-04; + Float_t ADC_pC3B = 3.789715e-08; Float_t pCthres=40.; // threshold in charge Int_t ADClast=4095; // no signal --> ADC ch=4095 Int_t ADCsat=3100; // saturation value for the ADCs Int_t ADCtof[48]; - Float_t ScaleFact[48]={0.39, 0.49, 0.38, 0.40, 0.65, 0.51, 0.43, - 0.49, 0.58, 0.38, 0.53, 0.57, 0.53, 0.45, 0.49, 0.16, - 0.15, 0.44, 0.28, 0.57, 0.26, 0.72, 0.37, 0.29, 0.30, 0.89, - 0.37, 0.08, 0.27, 0.23, 0.12, 0.22, 0.15, 0.16, 0.21, - 0.19, 0.41, 0.32, 0.39, 0.38, 0.28, 0.66, 0.28, 0.40, 0.39, 0.40, 0.37, 0.35 }; + Float_t ScaleFact[48]={0.39, 0.49, 0.38, 0.40, 0.65, 0.51, 0.43, 0.49, + 0.58, 0.38, 0.53, 0.57, 0.53, 0.45, 0.49, 0.22, + 0.21, 0.44, 0.28, 0.57, 0.26, 0.72, 0.37, 0.29, + 0.30, 0.89, 0.37, 0.12, 0.27, 0.23, 0.15, 0.22, + 0.19, 0.20, 0.21, 0.19, 0.41, 0.32, 0.39, 0.38, + 0.28, 0.66, 0.28, 0.40, 0.39, 0.40, 0.37, 0.35};//15:0.7--0.95, 16:0.9--1.25, 27:0.9--1.3, 30:0.9--1.15, 32:0.85--1.05, 33:0.85--1.05 for(Int_t i=0; i<48; i++){ QevePmt_pC[i] = 0; ADCtof[i]=0; } - Int_t ip,ipad,pmtleft=0,pmtright=0,*pl,*pr; - pl = &pmtleft; - pr = &pmtright; + Int_t ip,ipad,pmtleft=0,pmtright=0; // TDC variables: Int_t TDClast=4095,TDCint[48]; Float_t tdc[48],tdc1[48],tdcpmt[48]; @@ -114,10 +85,9 @@ c2_S[j] = c2_S[j]*tdcres[j]; } /* ********************************** start loop over hits */ - if(Nthtof>ntof)cout<<"NTHTOF > "<*ntof)cout<<"NTHTOF > "<<*ntof<<" , event rejected ! "<-1)&&(ip<6)) { //ToF paddles only, not S4 Paddle2Pmt(ip, ipad, &pmtleft, &pmtright); // DC: evaluates mean position and path inside the paddle @@ -166,10 +136,8 @@ for(Int_t j=0; j<2; j++){ QhitPad_pC[j]= Npho*FGeo[j]*effi*pmGain*echarge*1.E12*ScaleFact[pmtleft+j]; // WM - knorm[j]=atte1[pmtleft+j]*exp(lambda1[pmtleft+j]*dimel[ip]/2.*pow(-1,j+1)) + - atte2[pmtleft+j]*exp(lambda2[pmtleft+j]*dimel[ip]/2.*pow(-1,j+1)); - Atten[j]=atte1[pmtleft+j]*exp(tpos*lambda1[pmtleft+j]) + - atte2[pmtleft+j]*exp(tpos*lambda2[pmtleft+j]) ; + knorm[j]=atte1[pmtleft+j]*exp(lambda1[pmtleft+j]*dimel[ip]/2.*pow(-1,j+1)) + atte2[pmtleft+j]*exp(lambda2[pmtleft+j]*dimel[ip]/2.*pow(-1,j+1)); + Atten[j]=atte1[pmtleft+j]*exp(tpos*lambda1[pmtleft+j]) + atte2[pmtleft+j]*exp(tpos*lambda2[pmtleft+j]) ; QhitPmt_pC[j]= QhitPad_pC[j]*Atten[j]/knorm[j]; if (DEBUG) { cout<<"pmtleft "< +//TDC + // WM right and left <-> t1 = t1 + fabs(path[0]/veff) + s_l_g[ip]/veff1; t2 = t2 + fabs(path[1]/veff) + s_l_g[ip]/veff1 ; // Signal reaches PMT t1 = gRandom->Gaus(t1,dt1); //apply gaussian error dt @@ -474,7 +442,6 @@ //return r.word; }; -//void Digitizer::Paddle2Pmt(Int_t plane, Int_t paddle, Int_t* &pmtleft, Int_t* &pmtright){ void Digitizer::Paddle2Pmt(Int_t plane, Int_t paddle, Int_t *pl, Int_t *pr){ //* @param plane (0 - 5) //* @param paddle (plane=0, paddle = 0,...5) @@ -485,8 +452,7 @@ // Int_t somma=0; Int_t np=plane; - for(Int_t j=0; jQuery_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<