#include <DedxCorrecSvc.h>
Inheritance diagram for DedxCorrecSvc:
Public Member Functions | |
DedxCorrecSvc (const std::string &name, ISvcLocator *svcloc) | |
~DedxCorrecSvc () | |
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvUnknown) |
virtual StatusCode | initialize () |
virtual StatusCode | finalize () |
void | handle (const Incident &) |
double | RungCorrec (int runNO, double ex) const |
double | WireGainCorrec (int wireid, double ex) const |
double | DriftDistCorrec (int layid, double ddrift, double ex) const |
double | SaturCorrec (int layid, double costheta, double ex) const |
double | CosthetaCorrec (double costheta, double ex) const |
double | T0Correc (double t0, double ex) const |
double | HadronCorrec (double costheta, double dedx) const |
double | ZdepCorrec (int layid, double zhit, double ex) const |
double | EntaCorrec (int layid, double enta, double ex) const |
double | LayerGainCorrec (int layid, double ex) const |
double | DocaSinCorrec (int layid, double doca, double enta, double ex) const |
double | DipAngCorrec (int layid, double costheta, double ex) const |
double | GlobalCorrec (double dedx) const |
double | CellCorrec (int ser, double adc, double dd, double enta, double z, double costheta) const |
double | LayerCorrec (int layer, double z, double costheta, double ex) const |
double | TrkCorrec (double costheta, double dedx) const |
double | StandardCorrec (int runFlag, int ntpFlag, int runNO, double pathl, int wid, int layid, double adc, double dd, double eangle, double z, double costheta) const |
double | StandardHitCorrec (int calib_rec_Flag, int runFlag, int ntpFlag, int runNO, double pathl, int wid, int layid, double adc, double dd, double eangle, double costheta) const |
double | StandardTrackCorrec (int calib_rec_Flag, int typFlag, int ntpFlag, int runNO, double ex, double costheta, double t0) const |
double | PathL (int ntpFlag, const Dedx_Helix &hel, int layer, int cellid, double z) const |
double | D2I (const double &cosTheta, const double &D) const |
double | I2D (const double &cosTheta, const double &I) const |
void | set_flag (int calib_F) |
double | f_larcos (double x, int nbin) |
Static Public Member Functions | |
static const InterfaceID & | interfaceID () |
Private Member Functions | |
void | init_param () |
void | init_param_svc () |
double | sq (double &x) const |
double | cub (double &x) const |
double | sq4 (double &x) const |
double | sq5 (double &x) const |
double | sq6 (double &x) const |
double | sq7 (double &x) const |
double | sq8 (double &x) const |
double | sq9 (double &x) const |
double | sq10 (double &x) const |
double | sq11 (double &x) const |
double | T0 () |
double | T1 (double &x) const |
double | T2 (double &x) const |
double | T3 (double &x) const |
double | T4 (double &x) const |
double | T5 (double &x) const |
double | T6 (double &x) const |
double | T7 (double &x) const |
double | T8 (double &x) const |
double | T9 (double &x) const |
double | T10 (double &x) const |
double | T11 (double &x) const |
double | T12 (double &x) const |
double | T13 (double &x) const |
double | T14 (double &x) const |
double | T15 (double &x) const |
double | T16 (double &x) const |
double | T17 (double &x) const |
double | T18 (double &x) const |
double | T19 (double &x) const |
double | T20 (double &x) const |
Private Attributes | |
bool | m_initConstFlg |
IntegerProperty | m_run |
double | m_valid [6796] |
double | m_wire_g [6796] |
double | m_rung [4][10000] |
double | m_ddg [4][43] |
double | m_docaeangle [40][40] |
vector< double > | m_venangle |
double | m_ggs [4][43] |
double | m_enta [4][43] |
double | m_zdep [4][43] |
double | m_layer_g [43] |
double | m_dedx_gain |
double | m_dedx_resol |
int | N_run |
double | curve_par [5] |
double | sigma_par [6] |
vector< double > | cos_k |
vector< double > | cos_b |
vector< double > | t0_k |
vector< double > | t0_b |
double | Iner_Stepdoca |
double | Out_Stepdoca |
double | m_alpha |
double | m_gamma |
double | m_delta |
double | m_power |
double | m_ratio |
int | m_rung_flag |
calibration flag : run by run correction ( calib_F & 1 )? ON : OFF | |
int | m_wireg_flag |
calibration flag : wire by wire correction ( calib_F & 2 )? ON : OFF | |
int | m_ggs_flag |
calibration flag : electron dip angle correction ( calib_F & 4 )? ON : OFF | |
int | m_ddg_flag |
calibration flag : drift distance ( calib_F & 8 ) ? ON : OFF | |
int | m_t0_flag |
calibration flag : t0 correction ( calib_F & 16 ) ? ON : OFF | |
int | m_sat_flag |
calibration flag : hadron saturation correction ( calib_F & 32 ) ? ON : OFF | |
int | m_enta_flag |
calibration flag : entrance angle depsndence ( calib_F & 16 )? ON : OFF | |
int | m_zdep_flag |
calibration flag : z depsndence ( calib_F & 32 )? ON : OFF | |
int | m_layerg_flag |
correction : mdc layer gain ( calib_F & 64 )? ON:OFF | |
int | m_dcasin_flag |
correction : doca and sinenta correction ( calib_F & 128 )? ON:OFF | |
int | m_dip_flag |
correction : Qsaturation correction ( calib_F & 256 )? ON:OFF | |
int | m_mdcg_flag |
correction : mdc gain (run by run) ( calib_F & 512 )? ON:OFF | |
int | m_init |
control flags | |
int | m_par_flag |
IMdcGeomSvc * | geosvc |
mdc geometry | |
IMagneticFieldSvc * | m_pIMF |
bool | m_debug |
int | m_debug_i |
int | m_debug_j |
Definition at line 19 of file DedxCorrecSvc.h.
DedxCorrecSvc::DedxCorrecSvc | ( | const std::string & | name, | |
ISvcLocator * | svcloc | |||
) |
DedxCorrecSvc::~DedxCorrecSvc | ( | ) |
double DedxCorrecSvc::CellCorrec | ( | int | ser, | |
double | adc, | |||
double | dd, | |||
double | enta, | |||
double | z, | |||
double | costheta | |||
) | const [virtual] |
Implements IDedxCorrecSvc.
Definition at line 842 of file DedxCorrecSvc.cxx.
References DriftDistCorrec(), LayerGainCorrec(), m_ddg_flag, m_enta_flag, m_ggs_flag, m_layerg_flag, m_rung_flag, m_valid, m_wire_g, m_wireg_flag, m_zdep_flag, SaturCorrec(), and ZdepCorrec().
00843 { 00844 00845 if( m_rung_flag == 0 && m_wireg_flag == 0 && m_ddg_flag == 0 00846 && m_layerg_flag == 0 && m_zdep_flag == 0 && 00847 m_ggs_flag == 0) return adc; 00848 adc = m_valid[ser]*m_wire_g[ser]*adc; 00849 // int lyr = Wire2Lyr(ser); 00850 int lyr = ser; 00851 double ex = adc; 00852 double correct1_ex , correct2_ex, correct3_ex, correct4_ex, correct5_ex; 00853 00854 if( m_ggs_flag) { 00855 correct1_ex = SaturCorrec( lyr, costheta, adc ); 00856 ex = correct1_ex; 00857 } else { 00858 correct1_ex = adc; 00859 } 00860 00861 if( m_ddg_flag) { 00862 correct2_ex = DriftDistCorrec( lyr, dd, correct1_ex ); 00863 ex = correct2_ex; 00864 } else { 00865 correct2_ex =correct1_ex; 00866 } 00867 if( m_enta_flag) { 00868 correct3_ex = DriftDistCorrec( lyr, sinenta, correct2_ex ); 00869 ex = correct3_ex; 00870 } else { 00871 correct3_ex =correct2_ex; 00872 } 00873 00874 if( m_zdep_flag) { 00875 correct4_ex = ZdepCorrec( lyr, z, correct3_ex ); 00876 ex = correct4_ex; 00877 } else { 00878 correct4_ex = correct3_ex; 00879 } 00880 00881 if( m_layerg_flag) { 00882 correct5_ex = LayerGainCorrec( lyr, correct4_ex ); 00883 ex = correct5_ex; 00884 } else { 00885 correct5_ex = correct4_ex; 00886 } 00887 return ex; 00888 00889 }
double DedxCorrecSvc::CosthetaCorrec | ( | double | costheta, | |
double | ex | |||
) | const |
Definition at line 565 of file DedxCorrecSvc.cxx.
Referenced by StandardCorrec(), and StandardTrackCorrec().
00565 { 00566 //cout<<"DedxCorrecSvc::CosthetaCorrec"<<endl; 00567 double dedx_cos; 00568 //cout<<"costheta vaule is = "<<costheta<< " dedx = " << dedx << endl; 00569 if(fabs(costheta)>1.0) return dedx; 00570 00571 const int nbin=cos_k.size()+1; 00572 const double step=2.00/nbin; 00573 int n= (int)((costheta+1.00-0.5*step)/step); 00574 if(costheta>(1.00-0.5*step)) 00575 n=nbin-2; 00576 00577 if(costheta>-0.5*step && costheta<=0) 00578 dedx_cos=cos_k[n-1]*costheta+cos_b[n-1]; 00579 else if(costheta>0 && costheta<0.5*step) 00580 dedx_cos=cos_k[n+1]*costheta+cos_b[n+1]; 00581 else 00582 dedx_cos=cos_k[n]*costheta+cos_b[n]; 00583 00584 //cout << "cos_k[n]="<<cos_k[n] << " cos_b[n]=" << cos_b[n] << 00585 // " dedx_cos=" << dedx_cos << " final dedx=" << dedx/dedx_cos << endl; 00586 00587 //conside physical edge around 0.93 00588 if(nbin==80){ // temporally for only nbin = 80 00589 if(costheta>0.80 && costheta<0.95){ 00590 n = 77; 00591 if(costheta<0.9282) n--; 00592 if(costheta<0.9115) n--; 00593 if(costheta<0.8877) n--; 00594 if(costheta<0.8634) n--; 00595 if(costheta<0.8460) n--; 00596 if(costheta<0.8089) n--; 00597 dedx_cos=cos_k[n]*costheta+cos_b[n]; 00598 } 00599 else if(costheta<-0.80 && costheta>-0.95){ 00600 n = 2; 00601 if(costheta>-0.9115) n++; 00602 if(costheta>-0.8877) n++; 00603 if(costheta>-0.8634) n++; 00604 if(costheta>-0.8460) n++; 00605 if(costheta>-0.8089) n++; 00606 dedx_cos=cos_k[n]*costheta+cos_b[n]; 00607 } 00608 } 00609 00610 if(dedx_cos>0){ 00611 dedx_cos = dedx/dedx_cos; 00612 return dedx_cos; 00613 } 00614 else return dedx; 00615 }
double DedxCorrecSvc::cub | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::D2I | ( | const double & | cosTheta, | |
const double & | D | |||
) | const |
Definition at line 2153 of file DedxCorrecSvc.cxx.
References I, m_alpha, m_delta, m_gamma, m_power, and m_ratio.
Referenced by HadronCorrec().
02154 { 02155 //cout<<"DedxCorrecSvc::D2I"<<endl; 02156 double absCosTheta = fabs(cosTheta); 02157 double projection = pow(absCosTheta,m_power) + m_delta; // Projected length on wire 02158 double chargeDensity = D/projection; 02159 double numerator = 1 + m_alpha*chargeDensity; 02160 double denominator = 1 + m_gamma*chargeDensity; 02161 double I = D; 02162 02163 //if(denominator > 0.1) 02164 02165 I = D * m_ratio* numerator/denominator; 02166 // cout << "m_alpha " << m_alpha << endl; 02167 // cout << "m_gamma " << m_gamma << endl; 02168 // cout << "m_delta " << m_delta << endl; 02169 // cout << "m_power " << m_power << endl; 02170 // cout << "m_ratio " << m_ratio << endl; 02171 return I; 02172 }
double DedxCorrecSvc::DipAngCorrec | ( | int | layid, | |
double | costheta, | |||
double | ex | |||
) | const |
double DedxCorrecSvc::DocaSinCorrec | ( | int | layid, | |
double | doca, | |||
double | enta, | |||
double | ex | |||
) | const |
Definition at line 785 of file DedxCorrecSvc.cxx.
References doca_norm, Eangle_cut_bin, Eangle_value_cut, genRecEmupikp::i, m_debug, m_debug_i, m_debug_j, m_docaeangle, NumSlicesDoca, Out_DocaMax, Out_DocaMin, and Out_Stepdoca.
Referenced by StandardCorrec(), and StandardHitCorrec().
00785 { 00786 if(m_debug) cout<<"DedxCorrecSvc::DocaSinCorrec"<<endl; 00787 // cout<<"doca = "<<doca<<" eangle = "<<eangle<<endl; 00788 00789 if(eangle>0.25) eangle = eangle -0.5; 00790 else if(eangle < -0.25) eangle = eangle +0.5; 00791 int iDoca; 00792 int iEAng = 0; 00793 doca = doca/doca_norm[layer]; 00794 iDoca =(Int_t)floor((doca-Out_DocaMin)/Out_Stepdoca); 00795 if(doca<Out_DocaMin) iDoca=0; 00796 if(doca>Out_DocaMax) iDoca=NumSlicesDoca-1; 00797 if(iDoca >=(Int_t)floor((Out_DocaMax-Out_DocaMin)/Out_Stepdoca) ) 00798 iDoca = (Int_t)floor((Out_DocaMax-Out_DocaMin)/Out_Stepdoca)-1; 00799 if(iDoca<0) iDoca = 0; 00800 if(m_debug) cout<<"iDoca : "<<iDoca<<" doca : "<<doca<<" Out_DocaMin : "<<Out_DocaMin<<" Out_Stepdoca : "<<Out_Stepdoca<<endl; 00801 00802 //iEAng = (Int_t)floor((eangle-Phi_Min)/IEangle_step); 00803 for(int i =0; i<14; i++){ 00804 //iEAng =0; 00805 if(eangle <Eangle_value_cut[i] || eangle > Eangle_value_cut[i+1]) continue; 00806 else if(eangle>= Eangle_value_cut[i] && eangle < Eangle_value_cut[i+1]) { 00807 for(int k =0; k<i; k++){ 00808 iEAng+= Eangle_cut_bin[k]; 00809 } 00810 double eangle_bin_cut_step = (Eangle_value_cut[i+1] - Eangle_value_cut[i])/Eangle_cut_bin[i]; 00811 int temp_bin = int((eangle-Eangle_value_cut[i])/eangle_bin_cut_step); 00812 iEAng+= temp_bin; 00813 } 00814 } 00815 //cout<<iDoca <<" "<<iEAng<<endl; 00816 if(m_docaeangle[iDoca][iEAng]>0) { 00817 if(m_debug && (iDoca==m_debug_i) && (iEAng==m_debug_j)) 00818 cout << "doca: " << doca << " eang" << eangle << " dedx before: " << dedx << endl; 00819 dedx = dedx/m_docaeangle[iDoca][iEAng]; 00820 if(m_debug && (iDoca==m_debug_i) && (iEAng==m_debug_j)) 00821 cout << "gain: " << m_docaeangle[iDoca][iEAng] << " dedx after: " << dedx << endl; 00822 } 00823 return dedx; 00824 }
double DedxCorrecSvc::DriftDistCorrec | ( | int | layid, | |
double | ddrift, | |||
double | ex | |||
) | const [virtual] |
Implements IDedxCorrecSvc.
Definition at line 694 of file DedxCorrecSvc.cxx.
References m_ddg, m_par_flag, T1(), T2(), and T3().
Referenced by CellCorrec(), StandardCorrec(), and StandardHitCorrec().
00694 { 00695 // cout<<"DedxCorrecSvc::DriftDistCorrec"<<endl; 00696 double dedx_ddg; 00697 //cout<<"m_par_flag = "<<m_par_flag<<endl; 00698 //cout<<"dd vaule is = "<<dd<<endl; 00699 dd = fabs(dd); 00700 if(m_par_flag == 1) { 00701 dedx_ddg = m_ddg[0][layer] + m_ddg[1][layer]*dd + 00702 m_ddg[2][layer]*dd*dd + m_ddg[3][layer]*pow(dd,3); 00703 } else if(m_par_flag == 0) { 00704 dedx_ddg = m_ddg[0][layer] + m_ddg[1][layer]*T1(dd) + 00705 m_ddg[2][layer]*T2(dd) + m_ddg[3][layer]*T3(dd); 00706 } 00707 //cout<<"dedx_ddg is = "<<dedx_ddg<<endl; 00708 dedx_ddg = dedx/dedx_ddg; 00709 if (dedx_ddg>0.0) return dedx_ddg; 00710 else return dedx; 00711 }
double DedxCorrecSvc::EntaCorrec | ( | int | layid, | |
double | enta, | |||
double | ex | |||
) | const [virtual] |
Implements IDedxCorrecSvc.
Definition at line 715 of file DedxCorrecSvc.cxx.
References bin, and m_venangle.
Referenced by StandardCorrec(), and StandardHitCorrec().
00715 { 00716 // cout<<"DedxCorrecSvc::EntaCorrec"<<endl; 00717 // double dedx_enta; 00718 // if(m_par_flag == 1) { 00719 // dedx_enta = m_enta[0][layer] + m_enta[1][layer]*sinenta + 00720 // m_enta[2][layer]*sinenta*sinenta + m_enta[3][layer]*pow(sinenta,3); 00721 // } else if(m_par_flag == 0) { 00722 // dedx_enta = m_enta[0][layer] + m_enta[1][layer]*T1(sinenta) + 00723 // m_enta[2][layer]*T2(sinenta) + m_enta[3][layer]*T3(sinenta); 00724 // } 00725 // dedx_enta = dedx/dedx_enta; 00726 // if (dedx_enta>0.0) return dedx_enta; 00727 // else return dedx; 00728 00729 if(eangle>-0.25 && eangle<0.25){ 00730 double stepsize= 0.5/m_venangle.size(); 00731 int nsize= m_venangle.size(); 00732 double slope=0; 00733 double offset=1; 00734 double y1=0,y2=0,x1=0,x2=0; 00735 00736 if(eangle>=-0.25+0.5*stepsize && eangle<=0.25-0.5*stepsize){ 00737 int bin = (int)( (eangle-(-0.25+0.5*stepsize))/stepsize); 00738 y1=m_venangle[bin]; 00739 x1=-0.25+0.5*stepsize+bin*stepsize; 00740 y2=m_venangle[bin+1]; 00741 x2=-0.25+1.5*stepsize+bin*stepsize; 00742 } 00743 else if(eangle<=-0.25+0.5*stepsize){ 00744 y1=m_venangle[0]; 00745 x1=-0.25+0.5*stepsize; 00746 y2=m_venangle[1]; 00747 x2=-0.25+1.5*stepsize; 00748 } 00749 else if( eangle>=0.25-0.5*stepsize){ 00750 y1=m_venangle[nsize-2]; 00751 x1=0.25-1.5*stepsize; 00752 y2=m_venangle[nsize-1]; 00753 x2=0.25-0.5*stepsize; 00754 } 00755 double kcof= (y2-y1)/(x2-x1); 00756 double bcof= y1-kcof*x1; 00757 double ratio = kcof*eangle+bcof; 00758 dedx=dedx/ratio; 00759 } 00760 00761 return dedx; 00762 }
double DedxCorrecSvc::f_larcos | ( | double | x, | |
int | nbin | |||
) |
Definition at line 121 of file DedxCorrecSvc.cxx.
Referenced by init_param_svc().
00121 { 00122 if(nbin!=80) return x; // temporally for only nbin = 80 00123 double m_absx(fabs(x)); 00124 double m_charge(x/m_absx); 00125 if(m_absx>0.925 && m_absx<=0.950) return 0.9283*m_charge; // these numbers are from the mean values 00126 if(m_absx>0.900 && m_absx<=0.925) return 0.9115*m_charge; // of each bin in cos(theta) distribution 00127 if(m_absx>0.875 && m_absx<=0.900) return 0.8877*m_charge; 00128 if(m_absx>0.850 && m_absx<=0.875) return 0.8634*m_charge; 00129 if(m_absx>0.825 && m_absx<=0.850) return 0.8460*m_charge; 00130 if(m_absx>0.800 && m_absx<=0.825) return 0.8089*m_charge; 00131 }
StatusCode DedxCorrecSvc::finalize | ( | ) | [virtual] |
Definition at line 94 of file DedxCorrecSvc.cxx.
References Bes_Common::INFO.
Referenced by main().
00094 { 00095 // cout<<"DedxCorrecSvc::finalize()"<<endl; 00096 MsgStream log(messageService(), name()); 00097 log << MSG::INFO << name() << "DedxCorrecSvc::finalize()" << endreq; 00098 return StatusCode::SUCCESS; 00099 }
double DedxCorrecSvc::GlobalCorrec | ( | double | dedx | ) | const [virtual] |
Implements IDedxCorrecSvc.
Definition at line 832 of file DedxCorrecSvc.cxx.
References m_dedx_gain, and m_mdcg_flag.
Referenced by StandardCorrec().
00832 { 00833 if( m_mdcg_flag == 0 ) return dedx; 00834 double calib_ex = dedx; 00835 if( m_dedx_gain > 0 ) calib_ex /= m_dedx_gain; 00836 return calib_ex; 00837 }
double DedxCorrecSvc::HadronCorrec | ( | double | costheta, | |
double | dedx | |||
) | const |
Definition at line 651 of file DedxCorrecSvc.cxx.
Referenced by StandardCorrec(), and StandardTrackCorrec().
00651 { 00652 // cout<<"DedxCorrecSvc::HadronCorrec"<<endl; 00653 //constant 1.00 in the following function is the mean dedx of normalized electrons. 00654 dedx=dedx/550.00; 00655 return D2I(costheta, I2D(costheta,1.00)/1.00*dedx)*550; 00656 }
void DedxCorrecSvc::handle | ( | const Incident & | ) |
Definition at line 101 of file DedxCorrecSvc.cxx.
References Bes_Common::DEBUG, init_param(), init_param_svc(), m_init, and m_initConstFlg.
00101 { 00102 // cout<<"DedxCorrecSvc::handle"<<endl; 00103 MsgStream log( messageService(), name() ); 00104 log << MSG::DEBUG << "handle: " << inc.type() << endreq; 00105 00106 if ( inc.type() == "NewRun" ){ 00107 log << MSG::DEBUG << "New Run" << endreq; 00108 00109 if( ! m_initConstFlg ) 00110 { 00111 if( m_init == 0 ) { init_param(); } 00112 else if( m_init ==1 ) { init_param_svc(); } 00113 /* if( ! init_param() ){ 00114 log << MSG::ERROR 00115 << "can not initilize Mdc Calib Constants" << endreq; 00116 }*/ 00117 } 00118 } 00119 }
double DedxCorrecSvc::I2D | ( | const double & | cosTheta, | |
const double & | I | |||
) | const |
Definition at line 2175 of file DedxCorrecSvc.cxx.
References m_alpha, m_delta, m_gamma, m_power, and m_ratio.
Referenced by HadronCorrec().
02176 { 02177 // cout<<" DedxCorrecSvc::I2D"<<endl; 02178 double absCosTheta = fabs(cosTheta); 02179 double projection = pow(absCosTheta,m_power) + m_delta; // Projected length on wire 02180 02181 // Do the quadratic to compute d of the electron 02182 double a = m_alpha / projection; 02183 double b = 1 - m_gamma / projection*(I/m_ratio); 02184 double c = -I/m_ratio; 02185 02186 if(b==0 && a==0){ 02187 cout<<"both a and b coefficiants for hadron correction are 0"<<endl; 02188 return I; 02189 } 02190 02191 double D = a != 0? (-b + sqrt(b*b - 4.0*a*c))/(2.0*a) : -c/b; 02192 if(D<0){ 02193 cout<<"D is less 0! will try another solution"<<endl; 02194 D=a != 0? (-b - sqrt(b*b + 4.0*a*c))/(2.0*a) : -c/b; 02195 if(D<0){ 02196 cout<<"D is still less 0! just return uncorrectecd value"<<endl; 02197 return I; 02198 } 02199 } 02200 02201 return D; 02202 }
void DedxCorrecSvc::init_param | ( | ) | [private] |
Definition at line 1096 of file DedxCorrecSvc.cxx.
References genRecEmupikp::i, ganga-rec::j, m_ddg, m_dedx_gain, m_dedx_resol, m_enta, m_ggs, m_initConstFlg, m_layer_g, m_rung, m_valid, m_wire_g, and m_zdep.
Referenced by handle().
01096 { 01097 01098 //cout<<"DedxCorrecSvc::init_param()"<<endl; 01099 01100 for( int i = 0; i<6796 ; i++) { 01101 m_valid[i] = 1.0; 01102 m_wire_g[i] = 1.0; 01103 } 01104 m_dedx_gain = 1.0; 01105 m_dedx_resol = 1.0; 01106 for(int j = 0; j<100; j++){ 01107 m_rung[0][j] =1; 01108 } 01109 for(int j = 0; j<43; j++) { 01110 m_layer_g[j] = 1.0; 01111 m_ggs[0][j] = 1.0; 01112 m_ddg[0][j] = 1.0; 01113 m_enta[0][j] = 1.0; 01114 m_zdep[0][j] = 1.0; 01115 for(int k = 1; k<4; k++ ) { 01116 m_ggs[k][j] = 0.0; 01117 m_ddg[k][j] = 0.0; 01118 m_enta[k][j] = 0.0; 01119 m_zdep[k][j] = 0.0; 01120 } 01121 } 01122 01123 std::cout<<"DedxCorrecSvc::init_param()!!!"<<std::endl; 01124 std::cout<<"hello,init_param"<<endl; 01125 m_initConstFlg =true; 01126 01127 }
void DedxCorrecSvc::init_param_svc | ( | ) | [private] |
Definition at line 134 of file DedxCorrecSvc.cxx.
References cos(), cos_b, cos_k, dead_wire, Bes_Common::DEBUG, calibUtil::ERROR, f_larcos(), genRecEmupikp::i, Iner_DocaMax, Iner_DocaMin, Iner_Stepdoca, ganga-rec::j, m_alpha, m_ddg, m_debug, m_debug_i, m_debug_j, m_dedx_gain, m_dedx_resol, m_delta, m_docaeangle, m_gamma, m_ggs, m_layer_g, m_power, m_ratio, m_rung, m_valid, m_venangle, m_wire_g, m_zdep, N_run, NumSlicesDoca, Out_DocaMax, Out_DocaMin, Out_Stepdoca, deljobs::string, t0_b, t0_k, and test.
Referenced by handle().
00134 { 00135 // cout<<"DedxCorrecSvc::init_param_svc()"<<endl; 00136 MsgStream log(messageService(), name()); 00137 IDataProviderSvc* pCalibDataSvc; 00138 StatusCode sc = service("CalibDataSvc", pCalibDataSvc, true); 00139 if ( !sc.isSuccess() ) { 00140 log << MSG::ERROR 00141 << "Could not get IDataProviderSvc interface of CalibXmlCnvSvc" 00142 << endreq; 00143 return ; 00144 } else { 00145 log << MSG::DEBUG 00146 << "Retrieved IDataProviderSvc interface of CalibXmlCnvSvc" 00147 << endreq; 00148 } 00149 00150 Iner_Stepdoca = (Iner_DocaMax-Iner_DocaMin)/NumSlicesDoca; 00151 Out_Stepdoca = (Out_DocaMax-Out_DocaMin)/NumSlicesDoca; 00152 //cout<<"Out_DocaMax: "<<Out_DocaMax<<" Out_DocaMin: "<<Out_DocaMin<<" Out_Stepdoca : "<<Out_Stepdoca<<" NumSlicesDoca : "<<NumSlicesDoca<<endl; 00153 std::string fullPath = "/Calib/DedxCal"; 00154 00155 SmartDataPtr<CalibData::DedxCalibData> test(pCalibDataSvc, fullPath); 00156 00157 //rung par---------------------------------------------------------- 00158 N_run = test->getrunNO(); 00159 int run_temp = 0; 00160 cout<<"N_run = "<<N_run<<endl; 00161 for(int j=0;j<10000;j++) 00162 { 00163 if(j<N_run) 00164 { 00165 for(int i=0;i<4;i++) 00166 { 00167 m_rung[i][j] = test->getrung(i,j); 00168 if(i==2 && m_rung[2][j]>run_temp) run_temp = m_rung[2][j]; 00169 } 00170 } 00171 else 00172 { 00173 run_temp++; 00174 m_rung[0][j] = 1; 00175 m_rung[1][j] = 550; 00176 m_rung[2][j] = run_temp; 00177 m_rung[3][j] = 26.8; 00178 } 00179 } 00180 00181 //for(int i=0;i<4;i++) 00182 //{ 00183 // for(int j=0;j<10000;j++) 00184 // { 00185 // std::cout<<"rung["<<i<<"]["<<j<<"]= "<<m_rung[i][j]<<std::endl; 00186 // } 00187 //} 00188 00189 //TFile* fruncalib=new TFile("/home/bes/xcao/besd26/Calib/651_Calib/Psai_cal/rung_calib/first_calib/DedxConst.root"); 00190 /*TFile* fruncalib=new TFile("/home/bes/xcao/besd26/Calib/651_Calib/Psai_cal/rung_calib/fourth_calib/temp/DedxConst.root"); 00191 00192 double rungain, runmean, runresol; 00193 int runno; 00194 TTree *rungtree= (TTree*) fruncalib-> Get("runcalib"); 00195 rungtree -> SetBranchAddress("rungain", &rungain); 00196 rungtree -> SetBranchAddress("runmean", &runmean); 00197 rungtree -> SetBranchAddress("runno", &runno); 00198 rungtree -> SetBranchAddress("runresol", &runresol); 00199 rungtree -> GetEntry(0); 00200 int NRUN = rungtree -> GetEntries(); 00201 N_run = rungtree -> GetEntries(); 00202 //cout<<"N_run = "<<N_run<<endl; 00203 //cout<<"NRUN = "<<NRUN<<endl; 00204 for(int runid =0; runid<NRUN; runid++) { 00205 rungtree->GetEntry(runid); 00206 m_rung[0][runid] = rungain; 00207 m_rung[1][runid] = runmean; 00208 m_rung[2][runid] = runno; 00209 m_rung[3][runid] = runresol; 00210 //cout<<"runid :"<<runid<<" run_no = "<<m_rung[2][runid]<<" run_mean = "<<m_rung[1][runid]<<" run_gain = "<<m_rung[0][runid]<<" runresol = "<<m_rung[3][runid]<<endl; 00211 } 00212 00213 //cout<<"run by run const ------------------------------------------------- "<<endl; 00214 for(int i=0;i<4;i++) { 00215 for(int j=0;j<NRUN;j++) { 00216 //std::cout<<"rung["<<i<<"]["<<j<<"]="<<m_rung[i][j]<<endl; 00217 //std::cout<<"\n"; 00218 } 00219 }*/ 00220 00221 for(int i=0;i<4;i++) { 00222 for(int j=0;j<43;j++) { 00223 m_ddg[i][j] = test->getddg(i,j); 00224 m_ggs[i][j] = test->getggs(i,j); 00225 m_zdep[i][j] = test->getzdep(i,j); 00226 // m_enta[i][j] = test->getenta(i,j); 00227 //std::cout<<"ddg["<<i<<"]["<<j<<"]="<<m_ddg[i][j]; 00228 //std::cout<<" ggs["<<i<<"]["<<j<<"]="<<m_ggs[i][j]; 00229 //std::cout<<" zdep["<<i<<"]["<<j<<"]="<<m_zdep[i][j]; 00230 //std::cout<<"\n"; 00231 } 00232 } 00233 00234 m_dedx_gain = test->getgain(); 00235 std::cout<<"gain="<<m_dedx_gain<<"\n"; 00236 00237 m_dedx_resol = test->getresol(); 00238 std::cout<<"resol="<<m_dedx_resol<<"\n"; 00239 00240 for(int i=0;i<43;i++) { 00241 m_layer_g[i] = test -> getlayerg(i); 00242 if(m_layer_g[i]>2.0 || m_layer_g[i]<0.5) m_layer_g[i] =1; 00243 //std::cout<<"layerg["<<i<<"]="<<m_layer_g[i]<<endl; 00244 } 00245 00246 /*const int n = 6796; 00247 double wireg[n]; 00248 TFile* fwiregcalib=new TFile("/home/bes/xcao/besd26/Calib/651_Calib/Psai_cal/wireg_calib/wiregcalib.root"); 00249 TTree *wiregtree= (TTree*)fwiregcalib -> Get("wiregcalib"); 00250 wiregtree -> SetBranchAddress("wireg", &wireg); 00251 wiregtree -> GetEntry(0); 00252 //cout<<"wire gain ------------------------------------------------- "<<endl; 00253 for(int i=0; i<n; i++){ 00254 m_wire_g[i] = wireg[i]; 00255 //std::cout<<"wireg["<<i<<"] = "<<m_wire_g[i]<<"\n"; 00256 }*/ 00257 00258 for(int i=0;i<6796;i++) { 00259 m_wire_g[i] = test -> getwireg(i); 00260 //std::cout<<"wireg["<<i<<"] = "<<m_wire_g[i]<<"\n"; 00261 } 00262 00263 //int kk=0; 00264 //if(N_run<11397) kk=0; 00265 //else if(N_run<12739) kk=1; 00266 //else if(N_run<14395) kk=2; 00267 //else kk=3; 00268 int kk=3; 00269 for(int i=0;i<6796;i++) { 00270 m_valid[i] = 1; 00271 /*if(i<=483) {m_valid[i] =0;}*/ 00272 for(int j=0; j<25; j++){ 00273 if( i == dead_wire[kk][j] ) 00274 {m_valid[i] = 0; 00275 //cout<<"N_run: "<<N_run<<" kk: "<<kk<<endl; 00276 //cout<<"m_valid["<<i<<"]: "<<m_valid[i]<<endl; 00277 } 00278 } 00279 //std::cout<<"valid["<<i<<"]="<<m_valid[i]<<"\n"; 00280 } 00281 00282 //tempoary way to get costheta constants 00283 cos_k.clear(); 00284 cos_b.clear(); 00285 //double cos1[80]; 00286 if(true){ 00287 const int nbin=80; 00288 vector<double> cos; 00289 /*TFile* fcosthecalib=new TFile("/home/bes/xcao/besd26/Calib/651_Calib/Psai_cal/costhe_calib/costhetacalib2.root"); 00290 TTree *costhetree= (TTree*)fcosthecalib -> Get("costhetacalib"); 00291 TBranch* b_costheta; 00292 double costheta; 00293 costhetree->SetBranchAddress("costheta",&costheta,&b_costheta); 00294 //const int nbin=tc->GetEntries(); 00295 //cout<<"costheta gain ------------------------------------------------- "<<endl; 00296 for(int i=0; i<nbin; i++){ 00297 costhetree->GetEntry(i); 00298 cos.push_back(costheta); 00299 //cout<<"i : "<<i<<" costheta gain : "<<costheta<<endl; 00300 }*/ 00301 00302 for(int i=0; i<nbin; i++){ 00303 cos.push_back(test -> get_costheta(i)); 00304 } 00305 for(int i=0;i<nbin-1;i++){ 00306 double k=0; 00307 double b=0; 00308 if(cos[i]>0.0001){ // not empty bin corresponding to large angle 00309 if(cos[i+1]>0.0001){ 00310 double x1=-1.00+(0.5+i)*(2.00/nbin); 00311 double y1=cos[i]; 00312 double x2=-1.00+(0.5+i+1)*(2.00/nbin); 00313 double y2=cos[i+1]; 00314 // correct around absolute large cos(theta) angle 00315 if(fabs(x1)>0.8) x1 = f_larcos(x1, nbin); 00316 if(fabs(x2)>0.8) x2 = f_larcos(x2, nbin); 00317 k=(y2-y1)/(x2-x1); // k is the slope 00318 b=y1-k*x1; 00319 //cout << "x1 " << x1 << " x2 " << x2 << " y1 " << y1 << " y2 " << y2 << endl; 00320 } 00321 else if(i>0){ 00322 if(cos[i-1]>0.0001){ 00323 double x1=-1.00+(0.5+i-1)*(2.00/nbin); 00324 double y1=cos[i-1]; 00325 double x2=-1.00+(0.5+i)*(2.00/nbin); 00326 double y2=cos[i]; 00327 // correct around absolute large cos(theta) angle 00328 if(fabs(x1)>0.8) x1 = f_larcos(x1, nbin); 00329 if(fabs(x2)>0.8) x2 = f_larcos(x2, nbin); 00330 k=(y2-y1)/(x2-x1); 00331 b=y1-k*x1; 00332 //cout << "x1 " << x1 << " x2 " << x2 << " y1 " << y1 << " y2 " << y2 << endl; 00333 } 00334 } 00335 } 00336 else { 00337 if(i>0){ 00338 if(cos[i-1]>0.0001 && cos[i+1]>0.0001){ 00339 double x1=-1.00+(0.5+i-1)*(2.00/nbin); 00340 double y1=cos[i-1]; 00341 double x2=-1.00+(0.5+i+1)*(2.00/nbin); 00342 double y2=cos[i+1]; 00343 // correct around absolute large cos(theta) angle 00344 if(fabs(x1)>0.8) x1 = f_larcos(x1, nbin); 00345 if(fabs(x2)>0.8) x2 = f_larcos(x2, nbin); 00346 k=(y2-y1)/(x2-x1); 00347 b=y1-k*x1; 00348 //cout << "x1 " << x1 << " x2 " << x2 << " y1 " << y1 << " y2 " << y2 << endl; 00349 } 00350 } 00351 } 00352 //cout<<"i : "<<i<<" costheta gain : "<<cos[i] << " k=" << k << " b=" << b <<endl; 00353 cos_k.push_back(k); 00354 cos_b.push_back(b); 00355 } 00356 } 00357 00358 t0_k.clear(); 00359 t0_b.clear(); 00360 if(true){ 00361 //const int nbin=35; 00362 /*vector<double> xbin; 00363 vector<double> ybin; 00364 TFile* ft0calib=new TFile("/ihepbatch/besd13/chunlei/calib/t0calib.root"); 00365 TTree *tree_t0=(TTree*)ft0calib->Get("t0calib"); 00366 TBranch* b_t0; 00367 TBranch* b_dedx; 00368 double t0, dedx; 00369 tree_t0->SetBranchAddress("t0",&t0,&b_t0); 00370 tree_t0->SetBranchAddress("dedx",&dedx,&b_dedx); 00371 const int nbin=tree_t0->GetEntries(); 00372 //cout<<"costheta t0 ------------------------------------------------- "<<endl; 00373 for(int i=0; i<tree_t0->GetEntries(); i++){ 00374 tree_t0->GetEntry(i); 00375 xbin.push_back(t0); 00376 ybin.push_back(dedx); 00377 //cout<<"xbin = "<<t0<<" ybin = "<<dedx<<endl; 00378 }*/ 00379 00380 const int nbin=35; 00381 vector<double> xbin; 00382 vector<double> ybin; 00383 for(int i=0; i<35; i++){ 00384 xbin.push_back(test ->get_t0(i)); 00385 ybin.push_back(test ->get_dedx(i)); 00386 //cout<<"xbin = "<<test ->get_t0(i)<<" ybin = "<<test ->get_dedx(i)<<endl; 00387 } 00388 for(int i=0;i<nbin-1;i++){ 00389 double k=0; 00390 double b=0; 00391 if(ybin[i]>0){ 00392 if(ybin[i+1]>0){ 00393 double x1=xbin[i]; 00394 double y1=ybin[i]; 00395 double x2=xbin[i+1]; 00396 double y2=ybin[i+1]; 00397 k=(y2-y1)/(x2-x1); 00398 b=(y1*x2-y2*x1)/(x2-x1); 00399 } 00400 else if(i>0){ 00401 if(ybin[i-1]>0){ 00402 double x1=xbin[i-1]; 00403 double y1=ybin[i-1]; 00404 double x2=xbin[i]; 00405 double y2=ybin[i]; 00406 k=(y2-y1)/(x2-x1); 00407 b=(y1*x2-y2*x1)/(x2-x1); 00408 } 00409 } 00410 } 00411 else { 00412 if(i>0){ 00413 if(ybin[i-1]>0 && ybin[i+1]>0){ 00414 double x1=xbin[i-1]; 00415 double y1=ybin[i-1]; 00416 double x2=xbin[i+1]; 00417 double y2=ybin[i+1]; 00418 k=(y2-y1)/(x2-x1); 00419 b=(y1*x2-y2*x1)/(x2-x1); 00420 } 00421 } 00422 } 00423 t0_k.push_back(k); 00424 t0_b.push_back(b); 00425 } 00426 } 00427 00428 if(true){ 00429 /*TFile fconst9("/home/bes/xcao/besd26/Calib/651_Calib/Psai_cal/doca_eangle_calib/check/doca_eangle_kal_doca110.root"); 00430 const int n = 1600; 00431 double Iner_gain[n], Iner_chi[n], Iner_hits[n]; 00432 double Out_gain[n], Out_chi[n], Out_hits[n]; 00433 double Id_doca[n], Ip_eangle[n]; 00434 00435 TTree *tree_docasin= (TTree*)fconst9.Get("docasincalib"); 00436 tree_docasin -> SetBranchAddress("Iner_gain", &Iner_gain); 00437 tree_docasin -> SetBranchAddress("Iner_chi", &Iner_chi); 00438 tree_docasin -> SetBranchAddress("Iner_hits", &Iner_hits); 00439 tree_docasin -> SetBranchAddress("Out_gain", &Out_gain); 00440 tree_docasin -> SetBranchAddress("Out_chi", &Out_chi); 00441 tree_docasin -> SetBranchAddress("Out_hits", &Out_hits); 00442 tree_docasin -> SetBranchAddress("Id_doca", &Id_doca); 00443 tree_docasin -> SetBranchAddress("Ip_eangle", &Ip_eangle); 00444 tree_docasin -> GetEntry(0); 00445 double docaeangle_gain[n]; 00446 double docaeangle_chisq[n]; 00447 double docaeangle_entries[n]; 00448 double cell[n]; 00449 //cout<<"doca eangle gain ------------------------------------------------- "<<endl; 00450 for(int i=0; i<n; i++){ 00451 tree_docasin->GetEntry(i); 00452 cell[i] = i; 00453 docaeangle_gain[i] = Out_gain[i]; 00454 docaeangle_chisq[i] = Out_chi[i]; 00455 docaeangle_entries[i] = Out_hits[i]; 00456 int Id_Doca_temp = Id_doca[i]; 00457 int Ip_Eangle_temp = Ip_eangle[i]; 00458 m_docaeangle[Id_Doca_temp][Ip_Eangle_temp] = Out_gain[i]; 00459 //cout<<i<<" "<<Id_Doca_temp<<" "<<Ip_Eangle_temp<<" "<<docaeangle_gain[i]<<endl; 00460 //m_docaeangle[Id_Doca_temp][Ip_Eangle_temp] = docaeangle_gain[i]; 00461 //cout<<i<<" "<<Id_doca[i]<<" "<<Ip_eangle[i]<<" Entries : "<<docaeangle_entries[i]<<" Gain value : "<<docaeangle_gain[i]<<" chisq : "<<docaeangle_chisq[i] <<endl; 00462 00463 } 00464 m_docaeangle[38][28]=0.72805;*/ 00465 00466 const int n = 1600; 00467 double docaeangle_gain[n]; 00468 double docaeangle_chisq[n]; 00469 double docaeangle_entries[n]; 00470 double cell[n]; 00471 for(int i=0; i<n; i++){ 00472 cell[i] = i; 00473 docaeangle_gain[i] = test -> get_out_gain(i); 00474 docaeangle_chisq[i] = test -> get_out_chi(i); 00475 docaeangle_entries[i] = test -> get_out_hits(i); 00476 int Id_Doca_temp = test -> get_id_doca(i); 00477 int Ip_Eangle_temp = test -> get_ip_eangle(i); 00478 m_docaeangle[Id_Doca_temp][Ip_Eangle_temp] = docaeangle_gain[i]; 00479 if(m_debug && (Id_Doca_temp==m_debug_i) && (Ip_Eangle_temp==m_debug_j)) std::cout<<"docaeangle_gain["<<Id_Doca_temp<<"]["<<Ip_Eangle_temp<<"]="<<m_docaeangle[m_debug_i][m_debug_j] << std::endl; 00480 //cout<<i<<" "<<Id_Doca_temp<<" "<<Ip_Eangle_temp<<" "<<docaeangle_gain[i]<<endl; 00481 } 00482 } 00483 00484 00485 //get 1d entrance angle constants 00486 int onedsize=test->get_enanglesize(); 00487 m_venangle.clear(); 00488 for(int i=0; i< onedsize; i++){ 00489 m_venangle.push_back(test->get_enangle(i)); 00490 } 00491 00492 00493 //temporary way to get hadron saturation constants 00494 //for Psai hadron saturation 00495 00496 //only valide for jpsi data now !!!!! 00497 //have to find ways pass constans for different data 00498 /* m_alpha= 1.35630e-02; 00499 m_gamma= -6.78907e-04; 00500 m_delta= 1.18037e-02; 00501 m_power= 1.66268e+00; 00502 m_ratio= 9.94775e-01;*/ 00503 00504 const int hadronNo=test -> get_hadronNo(); 00505 // cout<<"@@@hadronNO===="<<hadronNo<<endl; 00506 m_alpha=test -> get_hadron(0); 00507 // cout<<"@@@@m_alpha===="<<m_alpha<<endl; 00508 m_gamma=test -> get_hadron(1); 00509 // cout<<"@@@@m_gamma===="<<m_gamma<<endl; 00510 m_delta=test -> get_hadron(2); 00511 // cout<<"@@@@m_delta====="<<m_delta<<endl; 00512 m_power=test -> get_hadron(3); 00513 // cout<<"@@@@m_power====="<<m_power<<endl; 00514 m_ratio=test -> get_hadron(4); 00515 // cout<<"@@@m_ratio======"<<m_ratio<<endl; 00516 00517 00518 00519 /* 00520 m_delta=0.1; 00521 m_alpha=0.0282; 00522 m_gamma=-0.030; 00523 m_power=1.0; 00524 m_ratio=1.0; 00525 //m_delta=0.1; 00526 //m_alpha=0.0382; 00527 //m_gamma=-0.0438; 00528 */ 00529 00530 //m_initConstFlg =true; 00531 }
StatusCode DedxCorrecSvc::initialize | ( | ) | [virtual] |
Definition at line 64 of file DedxCorrecSvc.cxx.
References calibUtil::ERROR, geosvc, Bes_Common::INFO, and m_pIMF.
Referenced by main().
00064 { 00065 // cout<<"DedxCorrecSvc::initialize"<<endl; 00066 MsgStream log(messageService(), name()); 00067 log << MSG::INFO << name() << "DedxCorrecSvc::initialize()" << endreq; 00068 00069 StatusCode sc = Service::initialize(); 00070 if( sc.isFailure() ) return sc; 00071 00072 IIncidentSvc* incsvc; 00073 sc = service("IncidentSvc", incsvc); 00074 int priority = 100; 00075 if( sc.isSuccess() ){ 00076 //incsvc -> addListener(this, "BeginEvent", priority); 00077 incsvc -> addListener(this, "NewRun", priority); 00078 } 00079 00080 StatusCode scgeo = service("MdcGeomSvc", geosvc); 00081 if(scgeo.isFailure() ) { 00082 log << MSG::ERROR << "GeoSvc failing!!!!!!!" << endreq; 00083 return scgeo; 00084 } 00085 00086 StatusCode scmgn = service ("MagneticFieldSvc",m_pIMF); 00087 if(scmgn!=StatusCode::SUCCESS) { 00088 log << MSG::ERROR << "Unable to open Magnetic field service"<<endreq; 00089 } 00090 00091 return StatusCode::SUCCESS; 00092 }
static const InterfaceID& IDedxCorrecSvc::interfaceID | ( | ) | [inline, static, inherited] |
Definition at line 15 of file IDedxCorrecSvc.h.
References IID_IDedxCorrecSvc().
00015 { return IID_IDedxCorrecSvc; }
double DedxCorrecSvc::LayerCorrec | ( | int | layer, | |
double | z, | |||
double | costheta, | |||
double | ex | |||
) | const [virtual] |
Implements IDedxCorrecSvc.
Definition at line 892 of file DedxCorrecSvc.cxx.
References m_ggs_flag, m_zdep_flag, SaturCorrec(), and ZdepCorrec().
00892 { 00893 //cout<<"DedxCorrecSvc::LayerCorrec"<<endl; 00894 00895 if( m_zdep_flag == 0 && m_ggs_flag == 0 ) return ex; 00896 00897 double calib_ex = ZdepCorrec( layer, z, ex ); 00898 if( m_ggs_flag != 0 ) calib_ex = SaturCorrec( layer, costheta, calib_ex ); 00899 return calib_ex; 00900 00901 }
double DedxCorrecSvc::LayerGainCorrec | ( | int | layid, | |
double | ex | |||
) | const [virtual] |
Implements IDedxCorrecSvc.
Definition at line 658 of file DedxCorrecSvc.cxx.
References m_layer_g.
Referenced by CellCorrec(), and StandardCorrec().
00658 { 00659 // cout<<"DedxCorrecSvc::LayerGainCorrec"<<endl; 00660 if( m_layer_g[layid] > 0 ){ 00661 double ch_dedx = dedx/m_layer_g[layid]; 00662 return ch_dedx; 00663 } 00664 else if( m_layer_g[layid] == 0 ){ 00665 return dedx; 00666 } 00667 else return 0; 00668 }
double DedxCorrecSvc::PathL | ( | int | ntpFlag, | |
const Dedx_Helix & | hel, | |||
int | layer, | |||
int | cellid, | |||
double | z | |||
) | const [virtual] |
Implements IDedxCorrecSvc.
Definition at line 1489 of file DedxCorrecSvc.cxx.
References Dedx_Helix::a(), MdcGeoWire::Backward(), MdcGeoWire::BWirePos(), cos(), Dedx_Helix::dr(), Dedx_Helix::dz(), MdcGeoWire::Forward(), MdcGeoWire::FWirePos(), MdcGeoLayer::Gen(), IMdcGeomSvc::GeneralLayer(), geosvc, IMagneticFieldSvc::getReferField(), genRecEmupikp::i, lambda, IMdcGeomSvc::Layer(), MdcGeoLayer::Length(), M_PI, m_pIMF, MdcGeoLayer::NCell(), MdcGeoLayer::Offset(), phi0, phi1, phi2, Dedx_Helix::pivot(), MdcGeoLayer::Radius(), MdcGeoLayer::RCSiz1(), MdcGeoLayer::RCSiz2(), MdcGeoLayer::Shift(), sign(), sin(), MdcGeoLayer::Slant(), MdcGeoLayer::Sup(), MdcGeoGeneral::SxEast(), MdcGeoGeneral::SxWest(), MdcGeoGeneral::SyEast(), MdcGeoGeneral::SyWest(), MdcGeoGeneral::SzEast(), MdcGeoGeneral::SzWest(), tan(), MdcGeoSuper::Type(), type, IMdcGeomSvc::Wire(), MdcGeoLayer::Wirst(), and Dedx_Helix::x().
01489 { 01490 01491 double length = geosvc->Layer(layer)->Length(); 01492 int genlay = geosvc->Layer(layer)->Gen(); 01493 double East_lay_X = geosvc->GeneralLayer(genlay)->SxEast(); 01494 double East_lay_Y = geosvc->GeneralLayer(genlay)->SyEast(); 01495 double East_lay_Z = geosvc->GeneralLayer(genlay)->SzEast(); 01496 double West_lay_X = geosvc->GeneralLayer(genlay)->SxWest(); 01497 double West_lay_Y = geosvc->GeneralLayer(genlay)->SyWest(); 01498 double West_lay_Z = geosvc->GeneralLayer(genlay)->SzWest(); 01499 01500 HepPoint3D East_origin(East_lay_X, East_lay_Y, East_lay_Z); 01501 HepPoint3D West_origin(West_lay_X, West_lay_Y, West_lay_Z); 01502 Hep3Vector wire = (CLHEP::Hep3Vector)East_origin - (CLHEP::Hep3Vector)West_origin; 01503 HepPoint3D piovt_z =(z*10+length/2 )/length * wire + West_origin; 01504 piovt_z = piovt_z*0.1; // conversion of the units(mm=>cm) 01505 01506 01507 //-------------------------------temp -------------------------------// 01508 HepPoint3D piv(hel.pivot()); 01509 //-------------------------------temp -------------------------------// 01510 01511 double dr0 = hel.a()[0]; 01512 double phi0 = hel.a()[1]; 01513 double kappa = hel.a()[2]; 01514 double dz0 = hel.a()[3]; 01515 double tanl = hel.a()[4]; 01516 01517 // Choose the local field !! 01518 double Bz = 1000*(m_pIMF->getReferField()); 01519 double ALPHA_loc = 1000/(2.99792458*Bz); 01520 01521 // Choose the local field !! 01522 //double Bz = 1.0; // will be obtained from magnetic field service 01523 //double ALPHA_loc = 1000/(2.99792458*Bz); 01524 //double ALPHA_loc = 333.564095; 01525 int charge = ( kappa >= 0 )? 1 : -1; 01526 double rho = ALPHA_loc/kappa; 01527 double pt = fabs( 1.0/kappa ); 01528 double lambda = atan( tanl ); 01529 double theta = M_PI_2- lambda; 01530 double sintheta = sin(M_PI_2-atan(tanl)); 01531 // theta = 2.0*M_PI*theta/360.; 01532 double phi = fmod(phi0 + M_PI*4, M_PI*2); 01533 double csf0 = cos(phi); 01534 double snf0 = (1. - csf0) * (1. + csf0); 01535 snf0 = sqrt((snf0 > 0.) ? snf0 : 0.); 01536 if(phi > M_PI) snf0 = - snf0; 01537 //if(ntpFlag>0) 01538 //cout<<"rho = "<<rho<<" hel.dr() + rho = "<<hel.dr() + rho<<endl; 01539 01540 //-------------------------------temp -------------------------------// 01541 double x_c = piv.x() + ( hel.dr() + rho )*csf0; 01542 double y_c = piv.y() + ( hel.dr() + rho )*snf0; 01543 double z_c = piv.z() + hel.dz(); 01544 HepPoint3D ccenter(x_c, y_c, 0.0); 01545 double m_c_perp(ccenter.perp()); 01546 Hep3Vector m_c_unit((HepPoint3D)ccenter.unit()); 01547 //-------------------------------temp -------------------------------// 01548 01550 double x_c_boost = x_c - piovt_z.x(); 01551 double y_c_boost = y_c - piovt_z.y(); 01552 double z_c_boost = z_c - piovt_z.z(); 01553 HepPoint3D ccenter_boost(x_c_boost, y_c_boost, 0.0); 01554 double m_c_perp_boost(ccenter_boost.perp()); 01555 //if(ntpFlag>0) 01556 //cout<<" ccenter = "<<ccenter<<" m_c_perp ="<<m_c_perp<<endl; 01557 Hep3Vector m_c_unit_boost((HepPoint3D)ccenter_boost.unit()); 01558 01559 //phi region estimation 01560 double phi_io[2]; 01561 HepPoint3D IO = (-1)*charge*m_c_unit; 01562 double dphi0 = fmod( IO.phi()+4*M_PI,2*M_PI ) - phi; 01563 double IO_phi = fmod( IO.phi()+4*M_PI,2*M_PI ); 01564 //double dphi0_bak = IO_phi - phi; 01565 //if(dphi0 != 0) 01566 //cout<<"dphi value is : "<<dphi0<<" phi:"<<phi<<" IO.phi:"<<IO_phi<<endl; 01567 if( dphi0 > M_PI ) dphi0 -= 2*M_PI; 01568 else if( dphi0 < -M_PI ) dphi0 += 2*M_PI; 01569 //cout<<"dphi value is : "<<dphi0<<" phi:"<<phi<<" IO.phi:"<<IO_phi<<endl; 01570 //cout<<"charge is = "<<charge<<endl; 01571 phi_io[0] = -(1+charge)*M_PI_2 - charge*dphi0; 01572 //phi_io[0] = -(1+charge)*M_PI_2 + charge*dphi0; 01573 phi_io[1] = phi_io[0]+1.5*M_PI; 01574 //cout<<"phi_io[0] is : "<<phi_io[0]<<" phi_io[1]:"<<phi_io[1]<<endl; 01575 double m_crio[2]; 01576 double m_zb, m_zf, Calpha; 01577 01578 // retrieve Mdc geometry information 01579 double rcsiz1= geosvc->Layer(layer)->RCSiz1(); 01580 double rcsiz2= geosvc->Layer(layer)->RCSiz2(); 01581 double rlay= geosvc->Layer(layer)->Radius(); 01582 int ncell= geosvc->Layer(layer)->NCell(); 01583 double phioffset= geosvc->Layer(layer)->Offset(); 01584 float shift= geosvc->Layer(layer)->Shift(); 01585 double slant= geosvc->Layer(layer)->Slant(); 01586 //double length = geosvc->Layer(layer)->Length(); 01587 int type = geosvc->Layer(layer)->Sup()->Type(); 01588 01590 //check the value if same // 01592 int w0id = geosvc->Layer(layer)->Wirst(); 01593 int wid = w0id + cellid; 01594 HepPoint3D backkward = geosvc->Wire(wid)->BWirePos(); 01595 HepPoint3D forward = geosvc->Wire(wid)->FWirePos(); 01596 double x_lay_backward = geosvc->Wire(layer, cellid)->Backward().x(); 01597 double y_lay_backward = geosvc->Wire(layer, cellid)->Backward().y(); 01598 double x_lay_forward = geosvc->Wire(layer, cellid)->Forward().x(); 01599 double y_lay_forward = geosvc->Wire(layer, cellid)->Forward().y(); 01600 double r_lay_backward = sqrt(x_lay_backward*x_lay_backward+y_lay_backward*y_lay_backward); 01601 double r_lay_forward = sqrt(x_lay_forward*x_lay_forward+y_lay_forward*y_lay_forward); 01602 double r_lay_use = ((z*10+length/2)/length)*(r_lay_backward-r_lay_forward) + r_lay_forward; 01603 /*for(int i=0; i<43; i++){ 01604 double r_up= geosvc->Layer(i)->RCSiz1(); 01605 double r_down= geosvc->Layer(i)->RCSiz2(); 01606 cout<<i<<" "<<r_up<<" "<<r_down<<endl; 01607 }*/ 01608 // shift = shift*type; 01609 // cout<< "type "<< type <<endl; 01610 r_lay_use = 0.1*r_lay_use; 01611 rcsiz1 = 0.1*rcsiz1; 01612 rcsiz2 = 0.1*rcsiz2; 01613 rlay = 0.1*rlay; 01614 length = 0.1*length; 01615 m_zb = 0.5*length; 01616 m_zf = -0.5*length; 01617 m_crio[0] = rlay - rcsiz1; 01618 m_crio[1] = rlay + rcsiz2; 01619 //conversion of the units(mm=>cm) 01620 int sign = -1; 01621 int epflag[2]; 01622 Hep3Vector iocand[2]; 01623 Hep3Vector cell_IO[2]; 01624 double dphi, downin; 01625 Hep3Vector zvector; 01626 //if (ntpFlag>0) cout<<"z = "<<z<<" , m_zb = "<<m_zb<<" , m_zf = "<<m_zf<<endl; 01627 if( type ) { 01628 downin = (z*z-m_zb*m_zb)*pow(tan(slant),2); 01629 m_crio[0] = sqrt(m_crio[0]*m_crio[0]+downin); 01630 m_crio[1] = sqrt(m_crio[1]*m_crio[1]+downin); 01631 } 01632 01633 //int stced[2]; 01634 01635 for( int i = 0; i < 2; i++ ) { 01636 double cos_alpha = m_c_perp_boost*m_c_perp_boost + m_crio[i]*m_crio[i] - rho*rho; 01637 cos_alpha = 0.5*cos_alpha/( m_c_perp_boost*m_crio[i] ); 01638 if(fabs(cos_alpha)>1&&i==0) return(-1.0); 01639 if(fabs(cos_alpha)>1&&i==1) { 01640 cos_alpha = m_c_perp_boost*m_c_perp_boost + m_crio[0]*m_crio[0] - rho*rho; 01641 cos_alpha = 0.5*cos_alpha/( m_c_perp_boost*m_crio[0] ); 01642 Calpha = 2.0*M_PI-acos( cos_alpha ); 01643 } else { 01644 Calpha = acos( cos_alpha ); 01645 } 01646 epflag[i] = 0; 01647 iocand[i] = m_c_unit_boost; 01648 iocand[i].rotateZ( charge*sign*Calpha ); 01649 iocand[i]*= m_crio[i]; 01650 //if (ntpFlag>0) cout<<"iocand corridate is : "<<iocand[i]<<endl; 01651 01653 //compare with standard coordinate system results // 01655 //-------------------------------temp-------------------------// 01656 iocand[i] = iocand[i]+ piovt_z; //change to standard coordinate system 01657 //iocand[i].y() = iocand[i].y() + piovt_z.y(); 01658 //if (ntpFlag>0) cout<<i<<setw(10)<<iocand[i].x()<<setw(10)<<iocand[i].y()<<endl; 01659 //------------------------------temp -------------------------// 01660 01661 double xx = iocand[i].x() - x_c; 01662 double yy = iocand[i].y() - y_c; 01663 //dphi = atan2(yy, xx) - phi0 - M_PI_2*(1+charge); 01664 dphi = atan2(yy, xx) - phi0 - M_PI_2*(1-charge); 01665 dphi = fmod( dphi + 8.0*M_PI, 2*M_PI ); 01666 01667 if( dphi < phi_io[0] ) { 01668 dphi += 2*M_PI; 01669 } 01670 else if( phi_io[1] < dphi ) { 01671 dphi -= 2*M_PI; 01672 } 01674 01675 //Hep3Vector zvector( 0., 0., z_c-rho*dphi*tanl); 01676 Hep3Vector zvector( 0., 0., z_c-rho*dphi*tanl-piovt_z.z()); 01677 //if (ntpFlag>0) cout<<"z_c-rho*dphi*tanl : "<<z_c-rho*dphi*tanl<<endl; 01678 cell_IO[i] = iocand[i]; 01679 cell_IO[i] += zvector; 01680 //---------------------------------temp ---------------------------------// 01681 //cell_IO[i] = hel.x(dphi);//compare with above results 01682 //---------------------------------temp ---------------------------------// 01683 01684 double xcio, ycio, phip; 01686 /* 01687 float delrin = 2.0; 01688 if( m_zf-delrin > zvector.z() ){ 01689 phip = z_c - m_zb + delrin; 01690 phip = phip/( rho*tanl ); 01691 phip = phip + phi0; 01692 xcio = x_c - rho*cos( phip ); 01693 ycio = y_c - rho*sin( phip ); 01694 cell_IO[i].setX( xcio ); 01695 cell_IO[i].setY( ycio ); 01696 cell_IO[i].setZ( m_zb+delrin ); 01697 epflag[i] = 1; 01698 } 01699 else if( m_zb+delrin < zvector.z() ){ 01700 phip = z_c - m_zf-delrin; 01701 phip = phip/( rho*tanl ); 01702 phip = phip + phi0; 01703 xcio = x_c - rho*cos( phip ); 01704 ycio = y_c - rho*sin( phip ); 01705 cell_IO[i].setX( xcio ); 01706 cell_IO[i].setY( ycio ); 01707 cell_IO[i].setZ( m_zf-delrin ); 01708 epflag[i] = 1; 01709 } 01710 else{ 01711 */ 01712 // cell_IO[i] = iocand; 01713 // cell_IO[i] += zvector; 01714 // } 01715 //dphi = dphi -M_PI; 01716 cell_IO[i] = hel.x(dphi); 01717 //if (ntpFlag>0) { cout<<"cell_IO corridate : "<<cell_IO[i]<<endl;} 01718 // if(i==0) cout<<"zhit value is = "<<z<<endl; 01719 } 01720 01721 // path length estimation 01722 // phi calculation 01723 Hep3Vector cl = cell_IO[1] - cell_IO[0]; 01724 01725 //float ch_tphi, ch_tdphi; 01726 double ch_theta; 01727 double ch_dphi; 01728 double ch_ltrk = 0; 01729 double ch_ltrk_rp = 0; 01730 ch_dphi = cl.perp()*0.5/(ALPHA_loc*pt); 01731 ch_dphi = 2.0 * asin( ch_dphi ); 01732 ch_ltrk_rp = ch_dphi*ALPHA_loc*pt; 01733 double rpi_path = sqrt(cl.x()*cl.x()+cl.y()*cl.y()); 01734 ch_ltrk = sqrt( ch_ltrk_rp*ch_ltrk_rp + cl.z()*cl.z() ); 01735 double path = ch_ltrk_rp/ sintheta; 01736 ch_theta = cl.theta(); 01737 /* if (ntpFlag>0) 01738 { 01739 // if((ch_ltrk_rp-rpi_path)>0.001 || (ch_ltrk-path)>0.001) 01740 cout<<"ch_ltrk_rp : "<<ch_ltrk_rp<<" rpi_path: "<<rpi_path<<endl; 01741 cout<<"ch_ltrk : "<<ch_ltrk<<" path:"<<path<<endl; 01742 } 01743 */ 01744 /* 01745 if( ch_theta < theta*0.85 || 1.15*theta < ch_theta) 01746 ch_ltrk *= -1; /// miss calculation 01747 01748 if( epflag[0] == 1 || epflag [1] == 1 ) 01749 ch_ltrk *= -1; /// invalid region for dE/dx or outside of Mdc 01750 */ 01751 // judge how many cells are traversed and deal with different situations 01752 double phibin, phi_in, phi_out, inlow, inup, outlow, outup, gap, phi1, phi2, phi_mid, phi_midin, phi_midout; 01753 int cid_in, cid_out; 01754 double inlow_z, inup_z, outlow_z, outup_z, gap_z, phi1_z, phi2_z, phi_mid_z, phi_midin_z, phi_midout_z; 01755 //cache sampl in each cell for this layer 01756 01757 std::vector<double> sampl; 01758 sampl.resize(ncell); 01759 for(int k=0; k<ncell; k++) { 01760 sampl[k] = -1.0; 01761 } 01762 01763 cid_in = cid_out = -1; 01764 phi_in = cell_IO[0].phi(); 01765 phi_out = cell_IO[1].phi(); 01766 //phi_in = iocand[0].phi(); 01767 //phi_out = iocand[1].phi(); 01768 phi_in = fmod( phi_in+4*M_PI,2*M_PI ); 01769 phi_out = fmod( phi_out+4*M_PI,2*M_PI ); 01770 phibin = 2.0*M_PI/ncell; 01771 // gap = fabs(phi_out-phi_in); 01772 01773 //determine the in/out cell id 01774 Hep3Vector cell_mid=0.5*(cell_IO[0]+cell_IO[1]); 01775 //Hep3Vector cell_mid=0.5*(iocand[0]+iocand[0]); 01776 //cout<<cell_mid<<endl; 01777 //double stereophi = shift*phibin*(0.5-cell_mid.z()/length); 01778 //phioffset = phioffset+stereophi; 01779 double stphi[2], phioff[2]; 01780 stphi[0] = shift*phibin*(0.5-cell_IO[0].z()/length); 01781 stphi[1] = shift*phibin*(0.5-cell_IO[1].z()/length); 01782 //stphi[0] = shift*phibin*(0.5-z/length); 01783 //stphi[1] = shift*phibin*(0.5-z/length); 01784 phioff[0] = phioffset+stphi[0]; 01785 phioff[1] = phioffset+stphi[1]; 01786 01787 for(int i=0; i<ncell; i++) { 01788 01789 double x_lay_backward_cell = geosvc->Wire(layer, i)->Backward().x()*0.1; 01790 double y_lay_backward_cell = geosvc->Wire(layer, i)->Backward().y()*0.1; 01791 double x_lay_forward_cell = geosvc->Wire(layer, i)->Forward().x()*0.1; 01792 double y_lay_forward_cell = geosvc->Wire(layer, i)->Forward().y()*0.1; 01793 //if(ntpFlag>0) cout<<layer<<setw(10)<<i<<setw(10)<<x_lay_forward<<setw(10)<<y_lay_forward<<setw(10)<<x_lay_backward<<setw(10)<<y_lay_backward<<setw(10)<<r_lay_forward<<setw(10)<<endl; 01794 //Hep3Vector lay_backward, lay_forward; 01795 Hep3Vector lay_backward(x_lay_backward_cell, y_lay_backward_cell, 0); 01796 Hep3Vector lay_forward(x_lay_forward_cell, y_lay_forward_cell, 0); 01797 Hep3Vector Cell_z[2]; 01798 Cell_z[0] = ((cell_IO[0].z()+length/2)/length)*(lay_backward - lay_forward) + lay_forward; 01799 Cell_z[1] = ((cell_IO[1].z()+length/2)/length)*(lay_backward - lay_forward) + lay_forward; 01800 double z_phi[2]; 01801 z_phi[0] = Cell_z[0].phi(); 01802 z_phi[1] = Cell_z[1].phi(); 01803 z_phi[0] = fmod( z_phi[0]+4*M_PI,2*M_PI ); 01804 z_phi[1] = fmod( z_phi[1]+4*M_PI,2*M_PI ); 01805 //double backward_phi = lay_backward.phi(); 01806 //double forward_phi = lay_forward.phi(); 01807 //backward_phi = fmod( backward_phi+4*M_PI,2*M_PI ); 01808 //forward_phi = fmod( forward_phi+4*M_PI,2*M_PI ); 01809 //if(ntpFlag>0) cout<<"backward_phi cal : "<<atan2(y_lay_backward,x_lay_backward)<<" forward_phi : "<<atan2(y_lay_forward,x_lay_forward)<<endl; 01810 //if(ntpFlag>0) cout<<layer<<" backward_phi : "<<backward_phi<<" forward_phi : "<<forward_phi<<endl; 01811 01812 //double z_phi[2]; 01813 //z_phi[0] = ((cell_IO[0].z()+length/2)/length)*(backward_phi - forward_phi) + forward_phi; 01814 //z_phi[1] = ((cell_IO[1].z()+length/2)/length)*(backward_phi - forward_phi) + forward_phi; 01815 //if(ntpFlag>0) cout<<"phi z : "<<z_phi[0]<<" "<<z_phi[1]<<endl; 01816 inlow_z = z_phi[0] - phibin*0.5; 01817 inup_z = z_phi[0] + phibin*0.5; 01818 outlow_z = z_phi[1] - phibin*0.5; 01819 outup_z = z_phi[1] + phibin*0.5; 01820 inlow_z = fmod( inlow_z+4*M_PI,2*M_PI ); 01821 inup_z = fmod( inup_z+4*M_PI,2*M_PI ); 01822 outlow_z = fmod( outlow_z+4*M_PI,2*M_PI ); 01823 outup_z = fmod( outup_z+4*M_PI,2*M_PI ); 01824 01825 01826 // for stereo layer 01827 inlow = phioff[0]+phibin*i-phibin*0.5; 01828 inup = phioff[0]+phibin*i+phibin*0.5; 01829 outlow = phioff[1]+phibin*i-phibin*0.5; 01830 outup = phioff[1]+phibin*i+phibin*0.5; 01831 inlow = fmod( inlow+4*M_PI,2*M_PI ); 01832 inup = fmod( inup+4*M_PI,2*M_PI ); 01833 outlow = fmod( outlow+4*M_PI,2*M_PI ); 01834 outup = fmod( outup+4*M_PI,2*M_PI ); 01835 01836 #ifdef YDEBUG 01837 if(ntpFlag > 0) cout << "shift " << shift 01838 <<" phi_in " << phi_in << " phi_out " << phi_out 01839 << " inup "<< inup << " inlow " << inlow 01840 << " outup "<< outup << " outlow " << outlow << endl; 01841 #endif 01842 01843 /*if(phi_in>=inlow&&phi_in<inup) cid_in = i; 01844 if(phi_out>=outlow&&phi_out<outup) cid_out = i; 01845 if ( inlow>inup) { 01846 if((phi_in>=inlow&&phi_in<2.0*M_PI)||(phi_in>=0.0&&phi_in<inup)) cid_in = i; 01847 } 01848 if ( outlow>outup) { 01849 if((phi_out>=outlow&&phi_out<2.0*M_PI)||(phi_out>=0.0&&phi_out<outup)) cid_out = i; 01850 }*/ 01851 01852 if(phi_in>=inlow_z&&phi_in<inup_z) cid_in = i; 01853 if(phi_out>=outlow_z&&phi_out<outup_z) cid_out = i; 01854 if ( inlow_z>inup_z) { 01855 if((phi_in>=inlow_z&&phi_in<2.0*M_PI)||(phi_in>=0.0&&phi_in<inup_z)) cid_in = i; 01856 } 01857 if ( outlow_z>outup_z) { 01858 if((phi_out>=outlow_z&&phi_out<2.0*M_PI)||(phi_out>=0.0&&phi_out<outup_z)) cid_out = i; 01859 } 01860 } 01861 01862 phi_midin = phi_midout = phi1 = phi2 = -999.0; 01863 gap = -999.0; 01864 //only one cell traversed 01865 //if(ntpFlag > 0) cout<<"cid_in = "<<cid_in<<" cid_out = "<<cid_out<<endl; 01866 if(cid_in == -1 || cid_out == -1) return -1; 01867 01868 if( cid_in == cid_out) { 01869 sampl[cid_in]= ch_ltrk; 01870 //return ch_ltrk; 01871 return sampl[cellid]; 01872 } else if(cid_in < cid_out) { 01873 //in cell id less than out cell id 01874 //deal with the special case crossing x axis 01875 if( cid_out-cid_in>ncell/2 ) { 01876 01877 // if(gap>=M_PI) gap = 2.0*M_PI-gap; 01878 double x_lay_backward_cin = geosvc->Wire(layer, cid_in)->Backward().x()*0.1; 01879 double y_lay_backward_cin = geosvc->Wire(layer, cid_in)->Backward().y()*0.1; 01880 double x_lay_forward_cin = geosvc->Wire(layer, cid_in)->Forward().x()*0.1; 01881 double y_lay_forward_cin = geosvc->Wire(layer, cid_in)->Forward().y()*0.1; 01882 Hep3Vector lay_backward_cin(x_lay_backward_cin, y_lay_backward_cin, 0); 01883 Hep3Vector lay_forward_cin(x_lay_forward_cin, y_lay_forward_cin, 0); 01884 Hep3Vector Cell_z[2]; 01885 Cell_z[0]=((cell_IO[0].z()+length/2)/length)*(lay_backward_cin-lay_forward_cin)+lay_forward_cin; 01886 double phi_cin_z = Cell_z[0].phi(); 01887 phi_cin_z = fmod( phi_cin_z+4*M_PI,2*M_PI ); 01888 double x_lay_backward_cout = geosvc->Wire(layer, cid_out)->Backward().x()*0.1; 01889 double y_lay_backward_cout = geosvc->Wire(layer, cid_out)->Backward().y()*0.1; 01890 double x_lay_forward_cout = geosvc->Wire(layer, cid_out)->Forward().x()*0.1; 01891 double y_lay_forward_cout = geosvc->Wire(layer, cid_out)->Forward().y()*0.1; 01892 Hep3Vector lay_backward_cout(x_lay_backward_cout, y_lay_backward_cout, 0); 01893 Hep3Vector lay_forward_cout(x_lay_forward_cout, y_lay_forward_cout, 0); 01894 Cell_z[1]=((cell_IO[1].z()+length/2)/length)*(lay_backward_cout-lay_forward_cout)+lay_forward_cout; 01895 double phi_cout_z = Cell_z[1].phi(); 01896 phi_cout_z = fmod( phi_cout_z+4*M_PI,2*M_PI ); 01897 01898 phi_midin_z = phi_cin_z-phibin*0.5; 01899 phi_midout_z = phi_cout_z+phibin*0.5; 01900 phi_midin_z = fmod( phi_midin_z+4*M_PI,2*M_PI ); 01901 phi_midout_z = fmod( phi_midout_z+4*M_PI,2*M_PI ); 01902 phi1_z = phi_midout_z-phi_out; 01903 phi2_z = phi_in-phi_midin_z; 01904 phi1_z = fmod(phi1_z+2.0*M_PI,2.0*M_PI); 01905 phi2_z = fmod(phi2_z+2.0*M_PI,2.0*M_PI); 01906 gap_z = phi1_z+phi2_z+(ncell-1-cid_out+cid_in)*phibin; 01907 gap_z = fmod(gap_z+2.0*M_PI,2.0*M_PI); 01908 sampl[cid_in]=phi2_z/gap_z*ch_ltrk; 01909 sampl[cid_out]=phi1_z/gap_z*ch_ltrk; 01910 for( int jj = cid_out+1; jj<ncell; jj++) { 01911 sampl[jj]=phibin/gap_z*ch_ltrk; 01912 } 01913 for( int jj = 0; jj<cid_in; jj++) { 01914 sampl[jj]=phibin/gap_z*ch_ltrk; 01915 } 01916 01917 /* 01918 // if(gap>=M_PI) gap = 2.0*M_PI-gap; 01919 phi_midin = phioff[0]+phibin*cid_in-phibin*0.5; 01920 phi_midout = phioff[1]+phibin*cid_out+phibin*0.5; 01921 phi_midin = fmod( phi_midin+4*M_PI,2*M_PI ); 01922 phi_midout = fmod( phi_midout+4*M_PI,2*M_PI ); 01923 phi1 = phi_midout-phi_out; 01924 phi2 = phi_in-phi_midin; 01925 phi1 = fmod(phi1+2.0*M_PI,2.0*M_PI); 01926 phi2 = fmod(phi2+2.0*M_PI,2.0*M_PI); 01927 gap = phi1+phi2+(ncell-1-cid_out+cid_in)*phibin; 01928 gap = fmod(gap+2.0*M_PI,2.0*M_PI); 01929 sampl[cid_in]=phi2/gap*ch_ltrk; 01930 sampl[cid_out]=phi1/gap*ch_ltrk; 01931 for( int jj = cid_out+1; jj<ncell; jj++) { 01932 sampl[jj]=phibin/gap*ch_ltrk; 01933 } 01934 for( int jj = 0; jj<cid_in; jj++) { 01935 sampl[jj]=phibin/gap*ch_ltrk; 01936 }*/ 01937 /* 01938 cout<<"LLLLLLLLLLLLL"<<endl; 01939 cout<< "layerId " << layer <<" cell id "<< cellid <<" shift " << shift 01940 << " cid_in " << cid_in << " cid_out " << cid_out << endl; 01941 cout <<" phi_in " << phi_in <<" phi_midin " << phi_midin << " phi_out " 01942 << phi_out << " phi_midout " << phi_midout <<endl; 01943 cout<<"total sampl " << ch_ltrk << " gap "<< gap << " phi1 " 01944 << phi1 << " phi2 " << phi2 << " phibin " << phibin << endl; 01945 */ 01946 } else { 01947 //normal case 01948 double x_lay_backward_cin = geosvc->Wire(layer, cid_in)->Backward().x()*0.1; 01949 double y_lay_backward_cin = geosvc->Wire(layer, cid_in)->Backward().y()*0.1; 01950 double x_lay_forward_cin = geosvc->Wire(layer, cid_in)->Forward().x()*0.1; 01951 double y_lay_forward_cin = geosvc->Wire(layer, cid_in)->Forward().y()*0.1; 01952 Hep3Vector lay_backward_cin(x_lay_backward_cin, y_lay_backward_cin, 0); 01953 Hep3Vector lay_forward_cin(x_lay_forward_cin, y_lay_forward_cin, 0); 01954 Hep3Vector Cell_z[2]; 01955 Cell_z[0]=((cell_IO[0].z()+length/2)/length)*(lay_backward_cin-lay_forward_cin)+lay_forward_cin; 01956 double phi_cin_z = Cell_z[0].phi(); 01957 phi_cin_z = fmod( phi_cin_z+4*M_PI,2*M_PI ); 01958 double x_lay_backward_cout = geosvc->Wire(layer, cid_out)->Backward().x()*0.1; 01959 double y_lay_backward_cout = geosvc->Wire(layer, cid_out)->Backward().y()*0.1; 01960 double x_lay_forward_cout = geosvc->Wire(layer, cid_out)->Forward().x()*0.1; 01961 double y_lay_forward_cout = geosvc->Wire(layer, cid_out)->Forward().y()*0.1; 01962 Hep3Vector lay_backward_cout(x_lay_backward_cout, y_lay_backward_cout, 0); 01963 Hep3Vector lay_forward_cout(x_lay_forward_cout, y_lay_forward_cout, 0); 01964 Cell_z[1]=((cell_IO[1].z()+length/2)/length)*(lay_backward_cout-lay_forward_cout)+lay_forward_cout; 01965 double phi_cout_z = Cell_z[1].phi(); 01966 phi_cout_z = fmod( phi_cout_z+4*M_PI,2*M_PI ); 01967 01968 phi_midin_z = phi_cin_z+phibin*0.5; 01969 phi_midout_z = phi_cout_z-phibin*0.5; 01970 phi_midin_z = fmod( phi_midin_z+4*M_PI,2*M_PI ); 01971 phi_midout_z = fmod( phi_midout_z+4*M_PI,2*M_PI ); 01972 phi1_z = phi_midin_z-phi_in; 01973 phi2_z = phi_out-phi_midout_z; 01974 phi1_z = fmod(phi1_z+2.0*M_PI,2.0*M_PI); 01975 phi2_z = fmod(phi2_z+2.0*M_PI,2.0*M_PI); 01976 gap_z = phi1_z+phi2_z+(cid_out-cid_in-1)*phibin; 01977 gap_z = fmod(gap_z+2.0*M_PI,2.0*M_PI); 01978 sampl[cid_in]=phi1_z/gap_z*ch_ltrk; 01979 sampl[cid_out]=phi2_z/gap_z*ch_ltrk; 01980 for( int jj = cid_in+1; jj<cid_out; jj++) { 01981 sampl[jj]=phibin/gap_z*ch_ltrk; 01982 } 01983 //normal case 01984 /*phi_midin = phioff[0]+phibin*cid_in+phibin*0.5; 01985 phi_midout = phioff[1]+phibin*cid_out-phibin*0.5; 01986 phi_midin = fmod( phi_midin+4*M_PI,2*M_PI ); 01987 phi_midout = fmod( phi_midout+4*M_PI,2*M_PI ); 01988 phi1 = phi_midin-phi_in; 01989 phi2 = phi_out-phi_midout; 01990 phi1 = fmod(phi1+2.0*M_PI,2.0*M_PI); 01991 phi2 = fmod(phi2+2.0*M_PI,2.0*M_PI); 01992 gap = phi1+phi2+(cid_out-cid_in-1)*phibin; 01993 gap = fmod(gap+2.0*M_PI,2.0*M_PI); 01994 sampl[cid_in]=phi1/gap*ch_ltrk; 01995 sampl[cid_out]=phi2/gap*ch_ltrk; 01996 for( int jj = cid_in+1; jj<cid_out; jj++) { 01997 sampl[jj]=phibin/gap*ch_ltrk; 01998 }*/ 01999 } 02000 02001 } else if(cid_in > cid_out) { 02002 //in cell id greater than out cell id 02003 //deal with the special case crossing x axis 02004 if( cid_in-cid_out>ncell/2 ) { 02005 double x_lay_backward_cin = geosvc->Wire(layer, cid_in)->Backward().x()*0.1; 02006 double y_lay_backward_cin = geosvc->Wire(layer, cid_in)->Backward().y()*0.1; 02007 double x_lay_forward_cin = geosvc->Wire(layer, cid_in)->Forward().x()*0.1; 02008 double y_lay_forward_cin = geosvc->Wire(layer, cid_in)->Forward().y()*0.1; 02009 Hep3Vector lay_backward_cin(x_lay_backward_cin, y_lay_backward_cin, 0); 02010 Hep3Vector lay_forward_cin(x_lay_forward_cin, y_lay_forward_cin, 0); 02011 Hep3Vector Cell_z[2]; 02012 Cell_z[0]=((cell_IO[0].z()+length/2)/length)*(lay_backward_cin-lay_forward_cin)+lay_forward_cin; 02013 double phi_cin_z = Cell_z[0].phi(); 02014 phi_cin_z = fmod( phi_cin_z+4*M_PI,2*M_PI ); 02015 double x_lay_backward_cout = geosvc->Wire(layer, cid_out)->Backward().x()*0.1; 02016 double y_lay_backward_cout = geosvc->Wire(layer, cid_out)->Backward().y()*0.1; 02017 double x_lay_forward_cout = geosvc->Wire(layer, cid_out)->Forward().x()*0.1; 02018 double y_lay_forward_cout = geosvc->Wire(layer, cid_out)->Forward().y()*0.1; 02019 Hep3Vector lay_backward_cout(x_lay_backward_cout, y_lay_backward_cout, 0); 02020 Hep3Vector lay_forward_cout(x_lay_forward_cout, y_lay_forward_cout, 0); 02021 Cell_z[1]=((cell_IO[1].z()+length/2)/length)*(lay_backward_cout-lay_forward_cout)+lay_forward_cout; 02022 double phi_cout_z = Cell_z[1].phi(); 02023 phi_cout_z = fmod( phi_cout_z+4*M_PI,2*M_PI ); 02024 02025 phi_midin_z = phi_cin_z+phibin*0.5; 02026 phi_midout_z = phi_cout_z-phibin*0.5; 02027 phi_midin_z = fmod( phi_midin_z+4*M_PI,2*M_PI ); 02028 phi_midout_z = fmod( phi_midout_z+4*M_PI,2*M_PI ); 02029 phi1_z = phi_midin_z-phi_in; 02030 phi2_z = phi_out-phi_midout_z; 02031 phi1_z = fmod(phi1_z+2.0*M_PI,2.0*M_PI); 02032 phi2_z = fmod(phi2_z+2.0*M_PI,2.0*M_PI); 02033 gap_z = phi1_z+phi2_z+(ncell-1-cid_in+cid_out)*phibin; 02034 gap_z = fmod(gap_z+2.0*M_PI,2.0*M_PI); 02035 sampl[cid_out]=phi2_z/gap_z*ch_ltrk; 02036 sampl[cid_in]=phi1_z/gap_z*ch_ltrk; 02037 for( int jj = cid_in+1; jj<ncell; jj++) { 02038 sampl[jj]=phibin/gap_z*ch_ltrk; 02039 } 02040 for( int jj = 0; jj<cid_out; jj++) { 02041 sampl[jj]=phibin/gap_z*ch_ltrk; 02042 } 02043 02044 // if(gap>=M_PI) gap = 2.0*M_PI-gap; 02045 /*phi_midin = phioff[0]+phibin*cid_in+phibin*0.5; 02046 phi_midout = phioff[1]+phibin*cid_out-phibin*0.5; 02047 phi_midin = fmod( phi_midin+4*M_PI,2*M_PI ); 02048 phi_midout = fmod( phi_midout+4*M_PI,2*M_PI ); 02049 phi1 = phi_midin-phi_in; 02050 phi2 = phi_out-phi_midout; 02051 phi1 = fmod(phi1+2.0*M_PI,2.0*M_PI); 02052 phi2 = fmod(phi2+2.0*M_PI,2.0*M_PI); 02053 gap = phi1+phi2+(ncell-1-cid_in+cid_out)*phibin; 02054 gap = fmod(gap+2.0*M_PI,2.0*M_PI); 02055 sampl[cid_out]=phi2/gap*ch_ltrk; 02056 sampl[cid_in]=phi1/gap*ch_ltrk; 02057 for( int jj = cid_in+1; jj<ncell; jj++) { 02058 sampl[jj]=phibin/gap*ch_ltrk; 02059 } 02060 for( int jj = 0; jj<cid_out; jj++) { 02061 sampl[jj]=phibin/gap*ch_ltrk; 02062 }*/ 02063 /* 02064 cout<<"LLLLLLLLLLLLL"<<endl; 02065 cout<< "layerId " << layer <<" cell id "<< cellid <<" shift " << shift 02066 << " cid_in " << cid_in << " cid_out " << cid_out << endl; 02067 cout <<" phi_in " << phi_in <<" phi_midin " << phi_midin << " phi_out " 02068 << phi_out << " phi_midout " << phi_midout <<endl; 02069 cout<<"total sampl " << ch_ltrk << " gap "<< gap << " phi1 " 02070 << phi1 << " phi2 " << phi2 << " phibin " << phibin << endl; 02071 */ 02072 } else { 02073 double x_lay_backward_cin = geosvc->Wire(layer, cid_in)->Backward().x()*0.1; 02074 double y_lay_backward_cin = geosvc->Wire(layer, cid_in)->Backward().y()*0.1; 02075 double x_lay_forward_cin = geosvc->Wire(layer, cid_in)->Forward().x()*0.1; 02076 double y_lay_forward_cin = geosvc->Wire(layer, cid_in)->Forward().y()*0.1; 02077 Hep3Vector lay_backward_cin(x_lay_backward_cin, y_lay_backward_cin, 0); 02078 Hep3Vector lay_forward_cin(x_lay_forward_cin, y_lay_forward_cin, 0); 02079 Hep3Vector Cell_z[2]; 02080 Cell_z[0]=((cell_IO[0].z()+length/2)/length)*(lay_backward_cin-lay_forward_cin)+lay_forward_cin; 02081 double phi_cin_z = Cell_z[0].phi(); 02082 phi_cin_z = fmod( phi_cin_z+4*M_PI,2*M_PI ); 02083 double x_lay_backward_cout = geosvc->Wire(layer, cid_out)->Backward().x()*0.1; 02084 double y_lay_backward_cout = geosvc->Wire(layer, cid_out)->Backward().y()*0.1; 02085 double x_lay_forward_cout = geosvc->Wire(layer, cid_out)->Forward().x()*0.1; 02086 double y_lay_forward_cout = geosvc->Wire(layer, cid_out)->Forward().y()*0.1; 02087 Hep3Vector lay_backward_cout(x_lay_backward_cout, y_lay_backward_cout, 0); 02088 Hep3Vector lay_forward_cout(x_lay_forward_cout, y_lay_forward_cout, 0); 02089 Cell_z[1]=((cell_IO[1].z()+length/2)/length)*(lay_backward_cout-lay_forward_cout)+lay_forward_cout; 02090 double phi_cout_z = Cell_z[1].phi(); 02091 phi_cout_z = fmod( phi_cout_z+4*M_PI,2*M_PI ); 02092 02093 phi_midin_z = phi_cin_z-phibin*0.5; 02094 phi_midout_z = phi_cout_z+phibin*0.5; 02095 phi_midin_z = fmod( phi_midin_z+4*M_PI,2*M_PI ); 02096 phi_midout_z = fmod( phi_midout_z+4*M_PI,2*M_PI ); 02097 phi1_z = phi_midout_z-phi_out; 02098 phi2_z = phi_in-phi_midin_z; 02099 phi1_z = fmod(phi1_z+2.0*M_PI,2.0*M_PI); 02100 phi2_z = fmod(phi2_z+2.0*M_PI,2.0*M_PI); 02101 gap_z = phi1_z+phi2_z+(cid_in-cid_out-1)*phibin; 02102 gap_z = fmod(gap_z+2.0*M_PI,2.0*M_PI); 02103 sampl[cid_in]=phi2_z/gap_z*ch_ltrk; 02104 sampl[cid_out]=phi1_z/gap_z*ch_ltrk; 02105 for( int jj = cid_out+1; jj<cid_in; jj++) { 02106 sampl[jj]=phibin/gap_z*ch_ltrk; 02107 } 02108 02109 //normal case 02110 /*phi_midin = phioff[0]+phibin*cid_in-phibin*0.5; 02111 phi_midout = phioff[1]+phibin*cid_out+phibin*0.5; 02112 phi_midin = fmod( phi_midin+4*M_PI,2*M_PI ); 02113 phi_midout = fmod( phi_midout+4*M_PI,2*M_PI ); 02114 phi1 = phi_midout-phi_out; 02115 phi2 = phi_in-phi_midin; 02116 phi1 = fmod(phi1+2.0*M_PI,2.0*M_PI); 02117 phi2 = fmod(phi2+2.0*M_PI,2.0*M_PI); 02118 gap = phi1+phi2+(cid_in-cid_out-1)*phibin; 02119 gap = fmod(gap+2.0*M_PI,2.0*M_PI); 02120 sampl[cid_in]=phi2/gap*ch_ltrk; 02121 sampl[cid_out]=phi1/gap*ch_ltrk; 02122 for( int jj = cid_out+1; jj<cid_in; jj++) { 02123 sampl[jj]=phibin/gap*ch_ltrk; 02124 }*/ 02125 } 02126 } 02127 02128 #ifdef YDEBUG 02129 if(sampl[cellid]<0.0) { 02130 if(cid_in!=cid_out) cout<<"?????????"<<endl; 02131 cout<< "layerId " << layer <<" cell id "<< cellid <<" shift " << shift 02132 << " cid_in " << cid_in << " cid_out " << cid_out << endl; 02133 02134 cout <<" phi_in " << phi_in <<" phi_midin " << phi_midin << " phi_out " 02135 << phi_out << " phi_midout " << phi_midout <<endl; 02136 cout<<"total sampl " << ch_ltrk << " gap "<< gap << " phi1 " 02137 << phi1 << " phi2 " << phi2 << " phibin " << phibin << endl; 02138 02139 02140 for(int l=0; l<ncell; l++) { 02141 if(sampl[l]>=0.0) 02142 cout<<"picked cellid " << l << " sampling length "<< sampl[l]<< endl; 02143 } 02144 } 02145 #endif 02146 return sampl[cellid]; 02147 }
StatusCode DedxCorrecSvc::queryInterface | ( | const InterfaceID & | riid, | |
void ** | ppvUnknown | |||
) | [virtual] |
Definition at line 54 of file DedxCorrecSvc.cxx.
References IID_IDedxCorrecSvc().
00054 { 00055 //cout<<"DedxCorrecSvc::queryInterface"<<endl; 00056 if( IID_IDedxCorrecSvc.versionMatch(riid) ){ 00057 *ppvInterface = static_cast<IDedxCorrecSvc*> (this); 00058 } else{ 00059 return Service::queryInterface(riid, ppvInterface); 00060 } 00061 return StatusCode::SUCCESS; 00062 }
double DedxCorrecSvc::RungCorrec | ( | int | runNO, | |
double | ex | |||
) | const [virtual] |
Implements IDedxCorrecSvc.
Definition at line 672 of file DedxCorrecSvc.cxx.
References ganga-rec::j, and m_rung.
Referenced by StandardCorrec(), StandardHitCorrec(), and StandardTrackCorrec().
00672 { 00673 // cout<<"DedxCorrecSvc::RungCorrec"<<endl; 00674 double dedx_rung; 00675 int run_ture =0; 00676 //cout<<"N_run : "<<N_run<<" runNO : "<<runNO<<endl; 00677 00678 for(int j=0;j<10000;j++) { 00679 if(runNO == m_rung[2][j]) { 00680 dedx_rung = dedx/m_rung[0][j]; 00681 run_ture =1; 00682 return dedx_rung; 00683 } 00684 } 00685 if(run_ture ==0) 00686 { 00687 cout<<"Warning!!! in DedxCorrecSvc::RungCorrec(): no rungain to "<<runNO<<endl; 00688 exit(1); 00689 } 00690 }
double DedxCorrecSvc::SaturCorrec | ( | int | layid, | |
double | costheta, | |||
double | ex | |||
) | const [virtual] |
Implements IDedxCorrecSvc.
Definition at line 545 of file DedxCorrecSvc.cxx.
References m_ggs, m_par_flag, T1(), T2(), and T3().
Referenced by CellCorrec(), LayerCorrec(), StandardCorrec(), and StandardHitCorrec().
00545 { 00546 //cout<<"DedxCorrecSvc::SaturCorrec"<<endl; 00547 double dedx_ggs; 00548 //cout<<"costheta vaule is = "<<costheta<<endl; 00549 costheta = fabs(costheta); 00550 if(m_par_flag == 1) { 00551 dedx_ggs = m_ggs[0][layer] + m_ggs[1][layer]*costheta + 00552 m_ggs[2][layer]*pow(costheta,2) + m_ggs[3][layer]*pow(costheta,3); 00553 } else if(m_par_flag == 0) { 00554 dedx_ggs = m_ggs[0][layer] + m_ggs[1][layer]*T1(costheta) + 00555 m_ggs[2][layer]*T2(costheta) + m_ggs[3][layer]*T3(costheta); 00556 } 00557 //cout<<"dedx_ggs is = "<<dedx_ggs<<endl; 00558 dedx_ggs = dedx/dedx_ggs; 00559 if(dedx_ggs>0.0) return dedx_ggs; 00560 else return dedx; 00561 }
void DedxCorrecSvc::set_flag | ( | int | calib_F | ) | [virtual] |
Implements IDedxCorrecSvc.
Definition at line 1131 of file DedxCorrecSvc.cxx.
References abs, m_dcasin_flag, m_ddg_flag, m_dip_flag, m_enta_flag, m_ggs_flag, m_layerg_flag, m_mdcg_flag, m_rung_flag, m_sat_flag, m_t0_flag, and m_wireg_flag.
01131 { 01132 // cout<<"DedxCorrecSvc::set_flag"<<endl; 01133 cout<<"calib_F is = "<<calib_F<<endl; 01134 if(calib_F<0){ m_enta_flag = 0; calib_F = abs(calib_F); } 01135 else m_enta_flag = 1; 01136 m_rung_flag = ( calib_F & 1 )? 1 : 0; 01137 m_wireg_flag = ( calib_F & 2 )? 1 : 0; 01138 m_dcasin_flag = ( calib_F & 4 )? 1 : 0; 01139 m_ggs_flag = ( calib_F & 8 )? 1 : 0; 01140 m_ddg_flag = 0; 01141 //m_ddg_flag = ( calib_F & 8 )? 1 : 0; 01142 m_t0_flag = ( calib_F & 16 )? 1 : 0; 01143 m_sat_flag = ( calib_F & 32 )? 1 : 0; 01144 m_layerg_flag = ( calib_F & 64 )? 1 : 0; 01145 //m_dcasin_flag = ( calib_F & 128 )? 1 : 0; 01146 m_dip_flag = ( calib_F & 256 )? 1 : 0; 01147 m_mdcg_flag = ( calib_F & 512 )? 1 : 0; 01148 }
double DedxCorrecSvc::sq | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::sq10 | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::sq11 | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::sq4 | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::sq5 | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::sq6 | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::sq7 | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::sq8 | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::sq9 | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::StandardCorrec | ( | int | runFlag, | |
int | ntpFlag, | |||
int | runNO, | |||
double | pathl, | |||
int | wid, | |||
int | layid, | |||
double | adc, | |||
double | dd, | |||
double | eangle, | |||
double | z, | |||
double | costheta | |||
) | const [virtual] |
Implements IDedxCorrecSvc.
Definition at line 919 of file DedxCorrecSvc.cxx.
References CosthetaCorrec(), DipAngCorrec(), DocaSinCorrec(), DriftDistCorrec(), EntaCorrec(), GlobalCorrec(), HadronCorrec(), LayerGainCorrec(), m_dcasin_flag, m_ddg_flag, m_dip_flag, m_enta_flag, m_ggs_flag, m_layerg_flag, m_mdcg_flag, m_rung_flag, m_sat_flag, m_wireg_flag, m_zdep_flag, RungCorrec(), SaturCorrec(), WireGainCorrec(), and ZdepCorrec().
00919 { 00920 // cout<<"DedxCorrecSvc::StandardCorrec"<<endl; 00921 //int layid = MdcID::layer(mdcid); 00922 //int localwid = MdcID::wire(mdcid); 00923 //int w0id = geosvc->Layer(layid)->Wirst(); 00924 //int wid = w0id + localwid; 00925 //double pathl = PathL(ntpFlag, hel, layid, localwid, z); 00927 double ex = adc; 00928 if( runNO<0 ) return ex; 00929 ex = ex*1.5/pathl; 00930 //double ex = adc/pathl; 00931 //if( runNO<0 ) return ex; 00932 if( ntpFlag ==0) return ex; 00933 //double ex = adc/pathl; 00934 if( m_rung_flag == 0 && m_wireg_flag == 0 && m_dcasin_flag==0 && m_ddg_flag == 0 00935 && m_layerg_flag == 0 && m_zdep_flag == 0 && 00936 m_ggs_flag == 0) return ex; 00937 00938 if(m_rung_flag) { 00939 ex = RungCorrec( runNO, ex ); 00940 } 00941 00942 if( m_wireg_flag) { 00943 ex = WireGainCorrec(wid, ex); 00944 } 00945 00946 if( m_dcasin_flag) { 00947 if(runFlag<3) { 00948 ex = DriftDistCorrec( layid, dd, ex ); 00949 } 00950 else{ ex = DocaSinCorrec(layid, dd, eangle, ex);} 00951 } 00952 00953 if(m_enta_flag && runFlag>=3){ 00954 ex = EntaCorrec(layid, eangle, ex); 00955 } 00956 00957 // ddg is not use anymore, it's replaced by DocaSin 00958 if(m_ddg_flag) { 00959 ex = DriftDistCorrec( layid, dd, ex ); 00960 } 00961 00962 if(m_ggs_flag) { 00963 if(runFlag <3 ){ 00964 ex = SaturCorrec( layid, costheta, ex ); 00965 } 00966 else{ ex = CosthetaCorrec( costheta, ex );} 00967 // Staur is OLD, Costheta is NEW. 00968 } 00969 00970 if( m_sat_flag) { 00971 ex = HadronCorrec( costheta, ex ); 00972 } 00973 00974 if( m_zdep_flag) { 00975 ex = ZdepCorrec( layid, z, ex ); 00976 } 00977 00978 if( m_layerg_flag) { 00979 ex = LayerGainCorrec( layid, ex ); 00980 } 00981 00982 if( m_dip_flag){ 00983 ex = DipAngCorrec(layid, costheta, ex); 00984 } 00985 00986 if( m_mdcg_flag) { 00987 ex = GlobalCorrec( ex ); 00988 } 00989 return ex; 00990 }
double DedxCorrecSvc::StandardHitCorrec | ( | int | calib_rec_Flag, | |
int | runFlag, | |||
int | ntpFlag, | |||
int | runNO, | |||
double | pathl, | |||
int | wid, | |||
int | layid, | |||
double | adc, | |||
double | dd, | |||
double | eangle, | |||
double | costheta | |||
) | const [virtual] |
Implements IDedxCorrecSvc.
Definition at line 993 of file DedxCorrecSvc.cxx.
References DocaSinCorrec(), DriftDistCorrec(), EntaCorrec(), m_dcasin_flag, m_ddg_flag, m_debug, m_enta_flag, m_ggs_flag, m_layerg_flag, m_rung_flag, m_wireg_flag, m_zdep_flag, RungCorrec(), SaturCorrec(), and WireGainCorrec().
00993 { 00994 if(m_debug) cout<<"DedxCorrecSvc::StandardHitCorrec"<<endl; 00995 //int layid = MdcID::layer(mdcid); 00996 //int localwid = MdcID::wire(mdcid); 00997 //int w0id = geosvc->Layer(layid)->Wirst(); 00998 //int wid = w0id + localwid; 00999 //double pathl = PathL(ntpFlag, hel, layid, localwid, z); 01000 //cout<<"DedxCorrecSvc::StandardHitCorrec pathl= "<<pathl<<endl; 01001 //pathl= PathLCosmic(hel, layid, localwid, z, sigmaz ); 01002 double ex = adc; 01003 if( runNO<0 ) return ex; 01004 ex = ex*1.5/pathl; 01005 //if( runNO<0 ) return ex; 01006 //double ex = adc/pathl; 01007 if( ntpFlag ==0) return ex; 01008 //if(ntpFlag>0) cout<<"dE/dx value after path correction: "<<ex<<endl; 01009 //double ex = adc/pathl; 01010 //cout<<m_rung_flag << " "<<m_wireg_flag<<" "<<m_ddg_flag<<" "<<m_ggs_flag<<endl; 01011 if( m_rung_flag == 0 && m_wireg_flag == 0 && m_ddg_flag == 0 01012 && m_layerg_flag == 0 && m_zdep_flag == 0 && m_dcasin_flag==0 01013 && m_ggs_flag == 0 && m_enta_flag==0) return ex; 01014 01015 if(m_rung_flag) { 01016 ex = RungCorrec( runNO, ex ); 01017 } 01018 //if(ntpFlag>0) cout<<"dE/dx value after run by run correction: "<<ex<<endl; 01019 01020 if( m_wireg_flag) { 01021 ex = WireGainCorrec(wid, ex); 01022 } 01023 //if(ntpFlag>0) cout<<"dE/dx value after wire gain correction: "<<ex<<endl; 01024 01025 if( m_dcasin_flag) { 01026 if(runFlag<3){ 01027 ex = DriftDistCorrec( layid, dd, ex ); 01028 } 01029 else{ 01030 //cout<<layid<<" "<<dd<<" "<<eangle<<" "<<ex<<endl; 01031 ex = DocaSinCorrec(layid, dd, eangle, ex); 01032 } 01033 } 01034 01035 // 1D entrance angle correction 01036 if(m_enta_flag && runFlag>=3){ 01037 ex = EntaCorrec(layid, eangle, ex); 01038 } 01039 01040 // ddg is not used anymore 01041 if( m_ddg_flag) { 01042 ex = DriftDistCorrec( layid, dd, ex ); 01043 } 01044 //if(ntpFlag>0) cout<<"dE/dx value after ddg correction: "<<ex<<endl; 01045 01046 if(m_ggs_flag) { 01047 if(runFlag <3 ){ 01048 ex = SaturCorrec( layid, costheta, ex ); 01049 } 01050 else{ ex = ex;} // do not do the cos(theta) correction at hit level 01051 } 01052 //if(ntpFlag>0) cout<<"dE/dx value after costheta correction: "<<ex<<endl; 01053 return ex; 01054 }
double DedxCorrecSvc::StandardTrackCorrec | ( | int | calib_rec_Flag, | |
int | typFlag, | |||
int | ntpFlag, | |||
int | runNO, | |||
double | ex, | |||
double | costheta, | |||
double | t0 | |||
) | const [virtual] |
Implements IDedxCorrecSvc.
Definition at line 1058 of file DedxCorrecSvc.cxx.
References CosthetaCorrec(), HadronCorrec(), m_debug, m_ggs_flag, m_rung_flag, m_sat_flag, m_t0_flag, RungCorrec(), and T0Correc().
01058 { 01059 if(m_debug) cout<<"DedxCorrecSvc::StandardTrackCorrec"<<endl; 01060 if( runNO<0 ) return ex; 01061 if( ntpFlag ==0) return ex; 01062 if( runFlag <3) return ex; 01063 if( calib_rec_Flag ==1){ 01064 ex = CosthetaCorrec( costheta, ex ); 01065 if(m_t0_flag) ex= T0Correc(t0, ex); 01066 return ex; 01067 } 01068 01069 //if(ntpFlag>0) cout<<"trcak value before costheta correction: "<<ex<<endl; 01070 if( m_ggs_flag) { 01071 ex = CosthetaCorrec( costheta, ex ); 01072 } 01073 //if(ntpFlag>0) cout<<"trcak value after costheta correction: "<<ex<<endl; 01074 if(m_t0_flag){ 01075 if(runFlag==3) {ex= T0Correc(t0, ex);} 01076 else if(runFlag>3) {ex=ex;} 01077 } 01078 //if(ntpFlag>0) cout<<"trcak value after all correction: "<<ex<<endl; 01079 if( m_sat_flag) { 01080 ex = HadronCorrec( costheta, ex ); 01081 } 01082 01083 if(m_rung_flag && calib_rec_Flag ==2){ 01084 double rungain_temp =RungCorrec( runNO, ex )/ex; 01085 ex = ex/rungain_temp; 01086 } 01087 01088 //if(ntpFlag>0) cout<<"trcak value no run gain correction: "<<ex<<endl; 01089 return ex; 01090 01091 }
double DedxCorrecSvc::T0 | ( | ) | [inline, private] |
double DedxCorrecSvc::T0Correc | ( | double | t0, | |
double | ex | |||
) | const |
Definition at line 619 of file DedxCorrecSvc.cxx.
Referenced by StandardTrackCorrec().
00619 { 00620 // cout<<"DedxCorrecSvc::T0Correc"<<endl; 00621 double dedx_t0; 00622 const int nbin=t0_k.size()+1; 00623 if(nbin!=35) 00624 cout<<"there should be 35 bins for t0 correction, check it!"<<endl; 00625 00626 int n=0; 00627 if(t0<575) 00628 n=0; 00629 else if(t0<610) 00630 n=1; 00631 else if(t0>=610 && t0<1190){ 00632 n=(int)( (t0-610.0)/20.0 ) + 2; 00633 } 00634 else if(t0>=1190 && t0<1225) 00635 n=31; 00636 else if(t0>=1225 && t0<1275) 00637 n=32; 00638 else if(t0>=1275) 00639 n=33; 00640 00641 dedx_t0=t0_k[n]*t0+t0_b[n]; 00642 00643 if(dedx_t0>0){ 00644 dedx_t0 = dedx/dedx_t0; 00645 return dedx_t0; 00646 } 00647 else return dedx; 00648 }
double DedxCorrecSvc::T1 | ( | double & | x | ) | const [inline, private] |
Definition at line 78 of file DedxCorrecSvc.h.
Referenced by DriftDistCorrec(), SaturCorrec(), and ZdepCorrec().
00078 {return x;}
double DedxCorrecSvc::T10 | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::T11 | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::T12 | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::T13 | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::T14 | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::T15 | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::T16 | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::T17 | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::T18 | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::T19 | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::T2 | ( | double & | x | ) | const [inline, private] |
Definition at line 79 of file DedxCorrecSvc.h.
References sq().
Referenced by DriftDistCorrec(), SaturCorrec(), and ZdepCorrec().
double DedxCorrecSvc::T20 | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::T3 | ( | double & | x | ) | const [inline, private] |
Definition at line 80 of file DedxCorrecSvc.h.
References cub().
Referenced by DriftDistCorrec(), SaturCorrec(), and ZdepCorrec().
double DedxCorrecSvc::T4 | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::T5 | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::T6 | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::T7 | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::T8 | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::T9 | ( | double & | x | ) | const [inline, private] |
double DedxCorrecSvc::TrkCorrec | ( | double | costheta, | |
double | dedx | |||
) | const [virtual] |
Implements IDedxCorrecSvc.
Definition at line 904 of file DedxCorrecSvc.cxx.
References m_dedx_gain, and m_mdcg_flag.
00904 { 00905 // cout<<"DedxCorrecSvc::TrkCorrec"<<endl; 00906 if( m_mdcg_flag == 0 ) return dedx; 00908 double calib_ex = dedx; 00909 00910 double run_const = m_dedx_gain; 00911 if( run_const > 0 && m_mdcg_flag != 0 ) calib_ex /= run_const; 00912 00913 return calib_ex; 00914 00915 }
double DedxCorrecSvc::WireGainCorrec | ( | int | wireid, | |
double | ex | |||
) | const [virtual] |
Implements IDedxCorrecSvc.
Definition at line 533 of file DedxCorrecSvc.cxx.
References m_valid, and m_wire_g.
Referenced by StandardCorrec(), and StandardHitCorrec().
00533 { 00534 if( m_wire_g[wireid] > 0 ){ 00535 double ch_dedx = (ex/m_wire_g[wireid])*m_valid[wireid]; 00536 return ch_dedx; 00537 } 00538 else if( m_wire_g[wireid] == 0 ){ 00539 return ex; 00540 } 00541 else return 0; 00542 }
double DedxCorrecSvc::ZdepCorrec | ( | int | layid, | |
double | zhit, | |||
double | ex | |||
) | const [virtual] |
Implements IDedxCorrecSvc.
Definition at line 766 of file DedxCorrecSvc.cxx.
References m_par_flag, m_zdep, T1(), T2(), and T3().
Referenced by CellCorrec(), LayerCorrec(), and StandardCorrec().
00766 { 00767 // cout<<"DedxCorrecSvc::ZdepCorrec"<<endl; 00768 double dedx_zdep; 00769 if(m_par_flag == 1) { 00770 dedx_zdep = m_zdep[0][layer] + m_zdep[1][layer]*z + 00771 m_zdep[2][layer]*z*z + m_zdep[3][layer]*pow(z,3); 00772 } else if(m_par_flag == 0) { 00773 dedx_zdep = m_zdep[0][layer] + m_zdep[1][layer]*T1(z) + 00774 m_zdep[2][layer]*T2(z) + m_zdep[3][layer]*T3(z); 00775 } 00776 dedx_zdep = dedx/dedx_zdep; 00777 if (dedx_zdep>0.0) return dedx_zdep; 00778 else return dedx; 00779 00780 //return dedx; 00781 }
vector<double> DedxCorrecSvc::cos_b [private] |
Definition at line 118 of file DedxCorrecSvc.h.
Referenced by CosthetaCorrec(), and init_param_svc().
vector<double> DedxCorrecSvc::cos_k [private] |
Definition at line 117 of file DedxCorrecSvc.h.
Referenced by CosthetaCorrec(), and init_param_svc().
double DedxCorrecSvc::curve_par[5] [private] |
Definition at line 114 of file DedxCorrecSvc.h.
IMdcGeomSvc* DedxCorrecSvc::geosvc [private] |
mdc geometry
Definition at line 173 of file DedxCorrecSvc.h.
Referenced by initialize(), and PathL().
double DedxCorrecSvc::Iner_Stepdoca [private] |
double DedxCorrecSvc::m_alpha [private] |
int DedxCorrecSvc::m_dcasin_flag [private] |
correction : doca and sinenta correction ( calib_F & 128 )? ON:OFF
Definition at line 164 of file DedxCorrecSvc.h.
Referenced by set_flag(), StandardCorrec(), and StandardHitCorrec().
double DedxCorrecSvc::m_ddg[4][43] [private] |
Definition at line 104 of file DedxCorrecSvc.h.
Referenced by DriftDistCorrec(), init_param(), and init_param_svc().
int DedxCorrecSvc::m_ddg_flag [private] |
calibration flag : drift distance ( calib_F & 8 ) ? ON : OFF
Definition at line 147 of file DedxCorrecSvc.h.
Referenced by CellCorrec(), set_flag(), StandardCorrec(), and StandardHitCorrec().
bool DedxCorrecSvc::m_debug [private] |
Definition at line 175 of file DedxCorrecSvc.h.
Referenced by DocaSinCorrec(), init_param_svc(), StandardHitCorrec(), and StandardTrackCorrec().
int DedxCorrecSvc::m_debug_i [private] |
Definition at line 176 of file DedxCorrecSvc.h.
Referenced by DocaSinCorrec(), and init_param_svc().
int DedxCorrecSvc::m_debug_j [private] |
Definition at line 176 of file DedxCorrecSvc.h.
Referenced by DocaSinCorrec(), and init_param_svc().
double DedxCorrecSvc::m_dedx_gain [private] |
Definition at line 111 of file DedxCorrecSvc.h.
Referenced by GlobalCorrec(), init_param(), init_param_svc(), and TrkCorrec().
double DedxCorrecSvc::m_dedx_resol [private] |
double DedxCorrecSvc::m_delta [private] |
int DedxCorrecSvc::m_dip_flag [private] |
correction : Qsaturation correction ( calib_F & 256 )? ON:OFF
Definition at line 166 of file DedxCorrecSvc.h.
Referenced by set_flag(), and StandardCorrec().
double DedxCorrecSvc::m_docaeangle[40][40] [private] |
Definition at line 105 of file DedxCorrecSvc.h.
Referenced by DocaSinCorrec(), and init_param_svc().
double DedxCorrecSvc::m_enta[4][43] [private] |
int DedxCorrecSvc::m_enta_flag [private] |
calibration flag : entrance angle depsndence ( calib_F & 16 )? ON : OFF
Definition at line 158 of file DedxCorrecSvc.h.
Referenced by CellCorrec(), set_flag(), StandardCorrec(), and StandardHitCorrec().
double DedxCorrecSvc::m_gamma [private] |
double DedxCorrecSvc::m_ggs[4][43] [private] |
Definition at line 107 of file DedxCorrecSvc.h.
Referenced by init_param(), init_param_svc(), and SaturCorrec().
int DedxCorrecSvc::m_ggs_flag [private] |
calibration flag : electron dip angle correction ( calib_F & 4 )? ON : OFF
Definition at line 144 of file DedxCorrecSvc.h.
Referenced by CellCorrec(), LayerCorrec(), set_flag(), StandardCorrec(), StandardHitCorrec(), and StandardTrackCorrec().
int DedxCorrecSvc::m_init [private] |
bool DedxCorrecSvc::m_initConstFlg [private] |
double DedxCorrecSvc::m_layer_g[43] [private] |
Definition at line 110 of file DedxCorrecSvc.h.
Referenced by init_param(), init_param_svc(), and LayerGainCorrec().
int DedxCorrecSvc::m_layerg_flag [private] |
correction : mdc layer gain ( calib_F & 64 )? ON:OFF
Definition at line 162 of file DedxCorrecSvc.h.
Referenced by CellCorrec(), set_flag(), StandardCorrec(), and StandardHitCorrec().
int DedxCorrecSvc::m_mdcg_flag [private] |
correction : mdc gain (run by run) ( calib_F & 512 )? ON:OFF
Definition at line 168 of file DedxCorrecSvc.h.
Referenced by GlobalCorrec(), set_flag(), StandardCorrec(), and TrkCorrec().
int DedxCorrecSvc::m_par_flag [private] |
Definition at line 171 of file DedxCorrecSvc.h.
Referenced by DriftDistCorrec(), SaturCorrec(), and ZdepCorrec().
IMagneticFieldSvc* DedxCorrecSvc::m_pIMF [private] |
double DedxCorrecSvc::m_power [private] |
double DedxCorrecSvc::m_ratio [private] |
IntegerProperty DedxCorrecSvc::m_run [private] |
Definition at line 100 of file DedxCorrecSvc.h.
double DedxCorrecSvc::m_rung[4][10000] [private] |
Definition at line 103 of file DedxCorrecSvc.h.
Referenced by init_param(), init_param_svc(), and RungCorrec().
int DedxCorrecSvc::m_rung_flag [private] |
calibration flag : run by run correction ( calib_F & 1 )? ON : OFF
Definition at line 138 of file DedxCorrecSvc.h.
Referenced by CellCorrec(), set_flag(), StandardCorrec(), StandardHitCorrec(), and StandardTrackCorrec().
int DedxCorrecSvc::m_sat_flag [private] |
calibration flag : hadron saturation correction ( calib_F & 32 ) ? ON : OFF
Definition at line 153 of file DedxCorrecSvc.h.
Referenced by set_flag(), StandardCorrec(), and StandardTrackCorrec().
int DedxCorrecSvc::m_t0_flag [private] |
calibration flag : t0 correction ( calib_F & 16 ) ? ON : OFF
Definition at line 150 of file DedxCorrecSvc.h.
Referenced by set_flag(), and StandardTrackCorrec().
double DedxCorrecSvc::m_valid[6796] [private] |
Definition at line 101 of file DedxCorrecSvc.h.
Referenced by CellCorrec(), init_param(), init_param_svc(), and WireGainCorrec().
vector<double> DedxCorrecSvc::m_venangle [private] |
double DedxCorrecSvc::m_wire_g[6796] [private] |
Definition at line 102 of file DedxCorrecSvc.h.
Referenced by CellCorrec(), init_param(), init_param_svc(), and WireGainCorrec().
int DedxCorrecSvc::m_wireg_flag [private] |
calibration flag : wire by wire correction ( calib_F & 2 )? ON : OFF
Definition at line 141 of file DedxCorrecSvc.h.
Referenced by CellCorrec(), set_flag(), StandardCorrec(), and StandardHitCorrec().
double DedxCorrecSvc::m_zdep[4][43] [private] |
Definition at line 109 of file DedxCorrecSvc.h.
Referenced by init_param(), init_param_svc(), and ZdepCorrec().
int DedxCorrecSvc::m_zdep_flag [private] |
calibration flag : z depsndence ( calib_F & 32 )? ON : OFF
Definition at line 160 of file DedxCorrecSvc.h.
Referenced by CellCorrec(), LayerCorrec(), StandardCorrec(), and StandardHitCorrec().
int DedxCorrecSvc::N_run [private] |
double DedxCorrecSvc::Out_Stepdoca [private] |
Definition at line 125 of file DedxCorrecSvc.h.
Referenced by DocaSinCorrec(), and init_param_svc().
double DedxCorrecSvc::sigma_par[6] [private] |
Definition at line 115 of file DedxCorrecSvc.h.
vector<double> DedxCorrecSvc::t0_b [private] |
vector<double> DedxCorrecSvc::t0_k [private] |