/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Analysis/ParticleID/ParticleID-00-04-61/src/TofCPID.cxx

Go to the documentation of this file.
00001 #include <fstream>
00002 #include <cmath>
00003 #include <cstdlib>
00004 
00005 #include "ParticleID/TofCPID.h"
00006 
00007 #ifndef BEAN
00008 #include "MdcRecEvent/RecMdcTrack.h"
00009 #include "TofRecEvent/RecTofTrack.h"
00010 #include "EvtRecEvent/EvtRecTrack.h"
00011 #include "DstEvent/TofHitStatus.h"
00012 #else
00013 #include "TofHitStatus.h"
00014 #endif
00015 
00016 
00017 TofCPID * TofCPID::m_pointer = 0;
00018 
00019 TofCPID * TofCPID::instance() {
00020    if(!m_pointer) m_pointer = new TofCPID();
00021    return m_pointer;
00022 }
00023 
00024 TofCPID::TofCPID():ParticleIDBase() {
00025    m_pars[0]= -0.208289;
00026    m_pars[1]=  1.63092;
00027    m_pars[2]= -0.0733139;
00028    m_pars[3]= 1.02385;
00029    m_pars[4]= 0.00145052;
00030    m_pars[5]= -1.72471e-06;
00031    m_pars[6]= 5.92726e-10;
00032    m_pars[7]= -0.0645428;
00033    m_pars[8]= -0.00143637;
00034    m_pars[9]= -0.133817;
00035    m_pars[10]= 0.0101188;
00036    m_pars[11]= -5.07622;
00037    m_pars[12]= 5.31472;
00038    m_pars[13]= -0.443142;
00039    m_pars[14]= -12.1083;
00040    m_readstate=0;
00041 }
00042 
00043 void TofCPID::init() {
00044    for(int i = 0; i < 5; i++) {
00045       m_chi[i] = 99.0;
00046       m_prob[i] = -1.0;
00047       m_offset[i] = 99.0;
00048       m_sigma[i] = 1.0;
00049    }
00050    m_chimin = 99.;
00051    m_pdfmin =99;
00052    m_ndof = 0;
00053 }
00054 
00055 void TofCPID::calculate() {
00056    int runtof = getRunNo();
00057    if(!m_readstate) {
00058       std::cout<<"read tofC"<<std::endl;
00059       std::string tofdata_mom_file = path + "/share/pidparatof/tofpdata.txt";
00060       ifstream inputmomdata(tofdata_mom_file.c_str(),std::ios_base::in);
00061       if ( !inputmomdata ) {
00062          cout << " can not open: " << tofdata_mom_file << endl;
00063          exit(1);
00064       }
00065 
00066       std::string tofdata_theta_file = path + "/share/pidparatof/tofthetadata.txt";
00067       ifstream inputthetadata(tofdata_theta_file.c_str(),std::ios_base::in);
00068       if ( !inputthetadata ) {
00069          cout << " can not open: " << tofdata_theta_file << endl;
00070          exit(1);
00071       }
00072 
00073       std::string tofdata_endcap_file = path + "/share/pidparatof/tofendcapdata.txt";
00074       ifstream inputendcapdata(tofdata_endcap_file.c_str(),std::ios_base::in);
00075       if ( !inputendcapdata ) {
00076          cout << " can not open: " << tofdata_endcap_file << endl;
00077          exit(1);
00078       }
00079 
00080 
00081       std::string tofmc_mom_file = path + "/share/pidparatof/tofpmc.txt";
00082       ifstream inputmommc(tofmc_mom_file.c_str(),std::ios_base::in);
00083       if ( !inputmommc ) {
00084          cout << " can not open: " << tofmc_mom_file << endl;
00085          exit(1);
00086       }
00087 
00088       std::string tofmc_theta_file = path + "/share/pidparatof/tofthetamc.txt";
00089       ifstream inputthetamc(tofmc_theta_file.c_str(),std::ios_base::in);
00090       if ( !inputthetamc ) {
00091          cout << " can not open: " << tofmc_theta_file << endl;
00092          exit(1);
00093       }
00094 
00095       std::string tofmc_endcap_file = path + "/share/pidparatof/tofendcapmc.txt";
00096       ifstream inputendcapmc(tofmc_endcap_file.c_str(),std::ios_base::in);
00097       if ( !inputendcapmc ) {
00098          cout << " can not open: " << tofmc_endcap_file << endl;
00099          exit(1);
00100       }
00101 
00102 
00103       if(runtof>0)
00104       {
00105          for(int i=0; i<5; i++)
00106          {
00107             for(int j=0; j<8; j++)
00108             {
00109                inputthetadata>>m_thetapara[i][j];
00110             }
00111          }
00112 
00113          for(int i=0; i<5; i++)
00114          {
00115             for(int j=0; j<12; j++)
00116             {
00117                inputmomdata>>m_momentpara[i][j];
00118             }
00119          }
00120 
00121          for(int i=0; i<5; i++)
00122          {
00123             for(int j=0; j<4; j++)
00124             {
00125                inputendcapdata>>m_endcappara[i][j];
00126             }
00127          }
00128 
00129       } else
00130       {
00131          for(int i=0; i<5; i++)
00132          {
00133             for(int j=0; j<8; j++)
00134             {
00135                inputthetamc>>m_thetapara[i][j];
00136             }
00137          }
00138 
00139          for(int i=0; i<5; i++)
00140          {
00141             for(int j=0; j<12; j++)
00142             {
00143                inputmommc>>m_momentpara[i][j];
00144             }
00145          }
00146 
00147          for(int i=0; i<5; i++)
00148          {
00149             for(int j=0; j<4; j++)
00150             {
00151                inputendcapmc>>m_endcappara[i][j];
00152             }
00153          }
00154 
00155       }
00156       m_readstate=1;
00157    }
00158    if(particleIDCalculation() == 0) m_ndof=1;
00159 }
00160 
00161 int TofCPID::particleIDCalculation() {
00162    /*
00163    cout<<"m_momentpara[2][2]="<<m_momentpara[2][2]<<endl;
00164    cout<<"m_momentpara[2][3]="<<m_momentpara[2][3]<<endl;
00165    cout<<"m_momentpara[3][2]="<<m_momentpara[3][2]<<endl;
00166    cout<<"m_momentpara[3][3]="<<m_momentpara[3][3]<<endl;
00167    cout<<"m_thetapara[2][2]="<<m_thetapara[2][2]<<endl;
00168    cout<<"m_thetapara[2][3]="<<m_thetapara[2][3]<<endl;
00169    cout<<"m_thetapara[3][2]="<<m_thetapara[3][2]<<endl;
00170    cout<<"m_thetapara[3][3]="<<m_thetapara[3][3]<<endl;
00171    cout<<"m_endcappara[2][2]="<<m_endcappara[2][2]<<endl;
00172    cout<<"m_endcappara[2][3]="<<m_endcappara[2][3]<<endl;
00173    cout<<"m_endcappara[3][2]="<<m_endcappara[3][2]<<endl;
00174    cout<<"m_endcappara[3][3]="<<m_endcappara[3][3]<<endl;
00175    */
00176    int irc = -1;
00177 
00178    EvtRecTrack* recTrk = PidTrk();
00179    if(!(recTrk->isMdcTrackValid())) return irc;
00180    RecMdcTrack* mdcTrk = recTrk->mdcTrack();
00181    double ptrk = mdcTrk->p();
00182    //    double charge = mdcTrk->charge();
00183    double cost = cos(mdcTrk->theta());
00184    if(!(recTrk->isTofTrackValid())) return irc;
00185 
00186 #ifndef BEAN
00187    SmartRefVector<RecTofTrack> tofTrk = recTrk->tofTrack();
00188    SmartRefVector<RecTofTrack>::iterator it;//=tofTrk.begin();
00189 #else
00190    const std::vector<TTofTrack* >& tofTrk = recTrk->tofTrack();
00191    std::vector<TTofTrack* >::const_iterator it;//=tofTrk.begin();
00192 #endif
00193 
00194    TofHitStatus *hitst = new TofHitStatus;
00195    std::vector<int> tofccount;
00196    int goodtofctrk=0;
00197    for(it = tofTrk.begin(); it!=tofTrk.end(); it++,goodtofctrk++) {
00198       unsigned int st = (*it)->status();
00199       hitst->setStatus(st);
00200       //     if( !(hitst->is_barrel()) ) continue;
00201       //     if( !(hitst->is_counter()) ) continue;
00202       //     if( hitst->layer()==1 )  tofccount.push_back(goodtofctrk);
00203       if(hitst->is_cluster())  tofccount.push_back(goodtofctrk);
00204    }
00205    delete hitst;
00206    if(tofccount.size()!=1) return irc;//not tof2 track or more than 1 tracks
00207    it = tofTrk.begin()+tofccount[0];
00208    double tof  = (*it)->tof();
00209    m_tofc = tof;
00210    //    int qual = (*it)->quality();
00211    //    int cntr = (*it)->tofID();
00212    double path  = ((*it)->path())*10.0;//the unit from mm to cm
00213    m_pathc = path;
00214    m_phc  = (*it)->ph(); //no change
00215    m_zhitc = ((*it)->zrhit())*10;//the unit from mm to cm
00216    double beta2 = path*path/velc()/velc()/tof/tof;
00217    m_mass2 = ptrk * ptrk * (1/beta2 -1);
00218    if ((m_mass2>20)||(m_mass2<-1)) return irc;
00219    if(tof <=0 ) return irc;
00220    double chitemp = 99.;
00221    double pdftemp = 0;
00222    //    double sigma_tmp= (*it)->sigma(0);
00223    double testchi[5];
00224    double testpdf[5];
00225    for(int i = 0; i < 5; i++) {
00226       /*
00227             m_offset[i] = tof - (*it)->texp(i);//- offsetTofC(i, cntr, ptrk, m_zhit1, m_ph1,charge);
00228             if(sigma_tmp!=0) m_sigma[i] = 1.1*sigma_tmp/1000.;
00229             else
00230             m_sigma[i]=sigmaTofC(i, cntr,ptrk,m_zhitc, m_phc,charge);
00231             m_chi[i] = m_offset[i]/m_sigma[i];
00232       */
00233       double sep = tof - (*it)->texp(i)-(*it)->toffset(i);
00234       m_chi[i] = (sep - offsetTofC(i, ptrk, cost))/sigmaTofC(i, ptrk, cost);
00235       m_offset[i] = offsetTofC(i, ptrk, cost);
00236       m_sigma[i] = sigmaTofC(i, ptrk, cost);
00237       testchi[i]=sep;
00238       if(fabs(m_chi[i]) < chitemp) chitemp = fabs(m_chi[i]);
00239       double ppp = pdfCalculate(m_chi[i],1);
00240       testpdf[i]=ppp;
00241       if(fabs(ppp) > pdftemp) pdftemp = fabs(ppp);
00242    }
00243    m_chimin = chitemp;
00244    m_pdfmin = pdftemp;
00245    if(pdftemp < pdfCalculate(pdfMinSigmaCut(),1)) return irc;
00246    if(fabs(m_chimin) > chiMinCut()) return irc;
00247    for(int i = 0; i < 5; i++) {
00248       m_prob[i] = probCalculate(m_chi[i]*m_chi[i], 1);
00249    }
00250 
00251    irc = 0;
00252    return irc;
00253 
00254 
00255 
00256 }
00257 
00258 //
00259 //  dE/dx Correction routines
00260 //
00261 
00262 double TofCPID::offsetTofC(int n, double ptrk, double cost) {
00263    int rundedx2 = getRunNo();
00264    double offset = 0.0;
00265    double offsetp = 0.0;
00266    double offsetc = 0.0;
00267    double sigcos = 0.0;
00268    double sigp = 0.0;
00269    //    double gb = ptrk/xmass(n);
00270 
00271    switch(n) {
00272    case 0: { // Electron
00273       double  ptemp = ptrk;
00274       double  costm = cost;
00275 
00276       if(rundedx2>0)
00277       {  if(ptrk < 0.3) ptemp = 0.3;
00278          if(ptrk > 1.3) ptemp = 1.3;
00279       }
00280       else
00281       {  if(ptrk < 0.3) ptemp = 0.3;
00282          if(ptrk > 1.3) ptemp = 1.3;
00283       }
00284 
00285       double plog = log(ptemp);
00286       double costcos = cos(costm);
00287       offsetp= mypol5(plog,m_momentpara[0][0],m_momentpara[0][1],m_momentpara[0][2],m_momentpara[0][3],m_momentpara[0][4],m_momentpara[0][5]);
00288       sigp=mypol5(plog,m_momentpara[0][6],m_momentpara[0][7],m_momentpara[0][8],m_momentpara[0][9],m_momentpara[0][10],m_momentpara[0][11]);
00289 
00290       if(costm<-0.83) {
00291          offsetc=m_endcappara[0][0];
00292          sigcos=m_endcappara[0][2];
00293       }
00294       if(costm>0.83) {
00295          offsetc=m_endcappara[0][1];
00296          sigcos=m_endcappara[0][3];
00297       }
00298       if(fabs(costm)<=0.83)
00299       {
00300          offsetc=mypol3(costcos,m_thetapara[0][0],m_thetapara[0][1],m_thetapara[0][2],m_thetapara[0][3]);
00301          sigcos=mypol3(costcos,m_thetapara[0][4],m_thetapara[0][5],m_thetapara[0][6],m_thetapara[0][7]);
00302       }
00303 
00304 
00305       offset=offsetc+sigcos*offsetp;
00306       //offset=offsetc;
00307       offset=offsetp+sigp*offsetc;
00308       break;
00309    }
00310 
00311    case 1: {// Muon
00312       double  ptemp = ptrk;
00313       double  costm = cost;
00314       if(rundedx2>0)
00315       {  if(ptrk < 0.3) ptemp = 0.3;
00316          if(ptrk > 1.3) ptemp = 1.3;
00317       }
00318       else
00319       {  if(ptrk < 0.3) ptemp = 0.3;
00320          if(ptrk > 1.3) ptemp = 1.3;
00321       }
00322 
00323       double plog = log(ptemp);
00324       double costcos = cos(costm);
00325       offsetp= mypol5(plog,m_momentpara[1][0],m_momentpara[1][1],m_momentpara[1][2],m_momentpara[1][3],m_momentpara[1][4],m_momentpara[1][5]);
00326       sigp=mypol5(plog,m_momentpara[1][6],m_momentpara[1][7],m_momentpara[1][8],m_momentpara[1][9],m_momentpara[1][10],m_momentpara[1][11]);
00327 
00328       if(costm<-0.83) {
00329          offsetc=m_endcappara[1][0];
00330          sigcos=m_endcappara[1][2];
00331       }
00332       if(costm>0.83) {
00333          offsetc=m_endcappara[1][1];
00334          sigcos=m_endcappara[1][3];
00335       }
00336       if(fabs(costm)<=0.83)
00337       {
00338          offsetc=mypol3(costcos,m_thetapara[1][0],m_thetapara[1][1],m_thetapara[1][2],m_thetapara[1][3]);
00339          sigcos=mypol3(costcos,m_thetapara[1][4],m_thetapara[1][5],m_thetapara[1][6],m_thetapara[1][7]);
00340       }
00341 
00342 
00343       offset=offsetc+sigcos*offsetp;
00344       //offset=offsetc;
00345       offset=offsetp+sigp*offsetc;
00346       break;
00347    }
00348 
00349    case 2: {// Pion
00350       double  ptemp = ptrk;
00351       double  costm = cost;
00352       if(rundedx2>0)
00353       {  if(ptrk < 0.3) ptemp = 0.3;
00354          if(ptrk > 1.6) ptemp = 1.6;
00355       }
00356       else
00357       {  if(ptrk < 0.3) ptemp = 0.3;
00358          if(ptrk > 1.6) ptemp = 1.6;
00359       }
00360 
00361       double plog = log(ptemp);
00362       double costcos = cos(costm);
00363       offsetp= mypol5(plog,m_momentpara[2][0],m_momentpara[2][1],m_momentpara[2][2],m_momentpara[2][3],m_momentpara[2][4],m_momentpara[2][5]);
00364       sigp=mypol5(plog,m_momentpara[2][6],m_momentpara[2][7],m_momentpara[2][8],m_momentpara[2][9],m_momentpara[2][10],m_momentpara[2][11]);
00365 
00366       if(costm<-0.83) {
00367          offsetc=m_endcappara[2][0];
00368          sigcos=m_endcappara[2][2];
00369       }
00370       if(costm>0.83) {
00371          offsetc=m_endcappara[2][1];
00372          sigcos=m_endcappara[2][3];
00373       }
00374       if(fabs(costm)<=0.83)
00375       {
00376          offsetc=mypol3(costcos,m_thetapara[2][0],m_thetapara[2][1],m_thetapara[2][2],m_thetapara[2][3]);
00377          sigcos=mypol3(costcos,m_thetapara[2][4],m_thetapara[2][5],m_thetapara[2][6],m_thetapara[2][7]);
00378       }
00379 
00380 
00381       offset=offsetc+sigcos*offsetp;
00382       //offset=offsetc;
00383       offset=offsetp+sigp*offsetc;
00384       break;
00385    }
00386 
00387    case 3: {// Kaon
00388       double  ptemp = ptrk;
00389       double  costm = cost;
00390       if(rundedx2>0)
00391       {  if(ptrk < 0.4) ptemp = 0.4;
00392          if(ptrk > 1.3) ptemp = 1.3;
00393       }
00394       else
00395       {  if(ptrk < 0.4) ptemp = 0.4;
00396          if(ptrk > 1.3) ptemp = 1.3;
00397       }
00398       double plog = log(ptemp);
00399       double costcos = cos(costm);
00400       offsetp= mypol5(plog,m_momentpara[3][0],m_momentpara[3][1],m_momentpara[3][2],m_momentpara[3][3],m_momentpara[3][4],m_momentpara[3][5]);
00401       sigp=mypol5(plog,m_momentpara[3][6],m_momentpara[3][7],m_momentpara[3][8],m_momentpara[3][9],m_momentpara[3][10],m_momentpara[3][11]);
00402 
00403       if(costm<-0.83) {
00404          offsetc=m_endcappara[3][0];
00405          sigcos=m_endcappara[3][2];
00406       }
00407       if(costm>0.83) {
00408          offsetc=m_endcappara[3][1];
00409          sigcos=m_endcappara[3][3];
00410       }
00411       if(fabs(costm)<=0.83)
00412       {
00413          offsetc=mypol3(costcos,m_thetapara[3][0],m_thetapara[3][1],m_thetapara[3][2],m_thetapara[3][3]);
00414          sigcos=mypol3(costcos,m_thetapara[3][4],m_thetapara[3][5],m_thetapara[3][6],m_thetapara[3][7]);
00415       }
00416 
00417 
00418       offset=offsetc+sigcos*offsetp;
00419       //offset=offsetc;
00420       offset=offsetp+sigp*offsetc;
00421       break;
00422    }
00423 
00424    case 4 : { // Proton
00425       double  ptemp = ptrk;
00426       double  costm = cost;
00427       if(rundedx2>0)
00428       {  if(ptrk < 0.5) ptemp = 0.5;
00429          if(ptrk > 1.3) ptemp = 1.3;
00430       }
00431       else
00432       {  if(ptrk < 0.5) ptemp = 0.5;
00433          if(ptrk > 1.3) ptemp = 1.3;
00434       }
00435       double plog = log(ptemp);
00436       double costcos = cos(costm);
00437       offsetp= mypol5(plog,m_momentpara[4][0],m_momentpara[4][1],m_momentpara[4][2],m_momentpara[4][3],m_momentpara[4][4],m_momentpara[4][5]);
00438       sigp=mypol5(plog,m_momentpara[4][6],m_momentpara[4][7],m_momentpara[4][8],m_momentpara[4][9],m_momentpara[4][10],m_momentpara[4][11]);
00439 
00440       if(costm<-0.83) {
00441          offsetc=m_endcappara[4][0];
00442          sigcos=m_endcappara[4][2];
00443       }
00444       if(costm>0.83) {
00445          offsetc=m_endcappara[4][1];
00446          sigcos=m_endcappara[4][3];
00447       }
00448       if(fabs(costm)<=0.83)
00449       {
00450          offsetc=mypol3(costcos,m_thetapara[4][0],m_thetapara[4][1],m_thetapara[4][2],m_thetapara[4][3]);
00451          sigcos=mypol3(costcos,m_thetapara[4][4],m_thetapara[4][5],m_thetapara[4][6],m_thetapara[4][7]);
00452       }
00453 
00454       offset=offsetc+sigcos*offsetp;
00455       //offset=offsetc;
00456       offset=offsetp+sigp*offsetc;
00457       break;
00458    }
00459 
00460    default:
00461       offset = 0.0;
00462       break;
00463    }
00464    //  offset = 0.0;
00465    return offset;
00466 }
00467 
00468 
00469 
00470 double TofCPID::sigmaTofC(int n, double ptrk, double cost) {
00471    int rundedx3 = getRunNo();
00472    double sigma = 1.0;
00473    double sigmap = 1.0;
00474    double sigmac = 1.0;
00475    //    double gb = ptrk/xmass(n);
00476    switch(n) {
00477 
00478    case 0: {// Electron
00479       double  ptemp = ptrk;
00480       double  costm = cost;
00481       if(rundedx3>0)
00482       {  if(ptrk < 0.3) ptemp = 0.3;
00483          if(ptrk > 1.3) ptemp = 1.3;
00484       }
00485       else
00486       {  if(ptrk < 0.3) ptemp = 0.3;
00487          if(ptrk > 1.3) ptemp = 1.3;
00488       }
00489 
00490       double plog = log(ptemp);
00491       double costcos = cos(costm);
00492 
00493       sigmap=mypol5(plog,m_momentpara[0][6],m_momentpara[0][7],m_momentpara[0][8],m_momentpara[0][9],m_momentpara[0][10],m_momentpara[0][11]);
00494 
00495       if(costm<-0.83) {
00496          sigmac=m_endcappara[0][2];
00497       }
00498       if(costm>0.83) {
00499          sigmac=m_endcappara[0][3];
00500       }
00501       if(fabs(costm)<0.83)
00502       {
00503          sigmac=mypol3(costcos,m_thetapara[0][4],m_thetapara[0][5],m_thetapara[0][6],m_thetapara[0][7]);
00504       }
00505 
00506       sigma=sigmap*sigmac;
00507       //sigma=sigmac;
00508       break;
00509    }
00510 
00511    case 1: {// Muon
00512       double  ptemp = ptrk;
00513       double  costm = cost;
00514       if(rundedx3>0)
00515       {  if(ptrk < 0.3) ptemp = 0.3;
00516          if(ptrk > 1.3) ptemp = 1.3;
00517       }
00518       else
00519       {  if(ptrk < 0.3) ptemp = 0.3;
00520          if(ptrk > 1.3) ptemp = 1.3;
00521       }
00522 
00523       double plog = log(ptemp);
00524       double costcos = cos(costm);
00525 
00526       sigmap=mypol5(plog,m_momentpara[1][6],m_momentpara[1][7],m_momentpara[1][8],m_momentpara[1][9],m_momentpara[1][10],m_momentpara[1][11]);
00527 
00528       if(costm<-0.83) {
00529          sigmac=m_endcappara[1][2];
00530       }
00531       if(costm>0.83) {
00532          sigmac=m_endcappara[1][3];
00533       }
00534       if(fabs(costm)<0.83)
00535       {
00536          sigmac=mypol3(costcos,m_thetapara[1][4],m_thetapara[1][5],m_thetapara[1][6],m_thetapara[1][7]);
00537       }
00538 
00539 
00540       sigma=sigmap*sigmac;
00541       //sigma=sigmac;
00542       break;
00543    }
00544 
00545    case 2: {// Pion
00546       double  ptemp = ptrk;
00547       double  costm = cost;
00548       if(rundedx3>0)
00549       {  if(ptrk < 0.3) ptemp = 0.3;
00550          if(ptrk > 1.6) ptemp = 1.6;
00551       }
00552       else
00553       {  if(ptrk < 0.3) ptemp = 0.3;
00554          if(ptrk > 1.6) ptemp = 1.6;
00555       }
00556 
00557       double plog = log(ptemp);
00558       double costcos = cos(costm);
00559       sigmap=mypol5(plog,m_momentpara[2][6],m_momentpara[2][7],m_momentpara[2][8],m_momentpara[2][9],m_momentpara[2][10],m_momentpara[2][11]);
00560 
00561       if(costm<-0.83) {
00562          sigmac=m_endcappara[2][2];
00563       }
00564       if(costm>0.83) {
00565          sigmac=m_endcappara[2][3];
00566       }
00567       if(fabs(costm)<0.83)
00568       {
00569          sigmac=mypol3(costcos,m_thetapara[2][4],m_thetapara[2][5],m_thetapara[2][6],m_thetapara[2][7]);
00570       }
00571 
00572       sigma=sigmap*sigmac;
00573       //sigma=sigmac;
00574 
00575       break;
00576    }
00577 
00578    case 3: { // Kaon
00579       double  ptemp = ptrk;
00580       double  costm = cost;
00581 
00582       if(rundedx3>0)
00583       {  if(ptrk < 0.4) ptemp = 0.4;
00584          if(ptrk > 1.3) ptemp = 1.3;
00585       }
00586       else
00587       {  if(ptrk < 0.4) ptemp = 0.4;
00588          if(ptrk > 1.3) ptemp = 1.3;
00589       }
00590       double plog = log(ptemp);
00591       double costcos = cos(costm);
00592       sigmap=mypol5(plog,m_momentpara[3][6],m_momentpara[3][7],m_momentpara[3][8],m_momentpara[3][9],m_momentpara[3][10],m_momentpara[3][11]);
00593 
00594       if(costm<-0.83) {
00595          sigmac=m_endcappara[3][2];
00596       }
00597       if(costm>0.83) {
00598          sigmac=m_endcappara[3][3];
00599       }
00600       if(fabs(costm)<0.83)
00601       {
00602          sigmac=mypol3(costcos,m_thetapara[3][4],m_thetapara[3][5],m_thetapara[3][6],m_thetapara[3][7]);
00603       }
00604 
00605       sigma=sigmap*sigmac;
00606       //sigma=sigmac;
00607       break;
00608    }
00609 
00610 
00611    case 4: {// Proton
00612       double  ptemp = ptrk;
00613       double  costm = cost;
00614       if(rundedx3>0)
00615       {  if(ptrk < 0.5) ptemp = 0.5;
00616          if(ptrk > 1.3) ptemp = 1.3;
00617       }
00618       else
00619       {  if(ptrk < 0.5) ptemp = 0.5;
00620          if(ptrk > 1.3) ptemp = 1.3;
00621       }
00622       double plog = log(ptemp);
00623       double costcos = cos(costm);
00624       sigmap=mypol5(plog,m_momentpara[4][6],m_momentpara[4][7],m_momentpara[4][8],m_momentpara[4][9],m_momentpara[4][10],m_momentpara[4][11]);
00625 
00626       if(costm<-0.83) {
00627          sigmac=m_endcappara[4][2];
00628       }
00629       if(costm>0.83) {
00630          sigmac=m_endcappara[4][3];
00631       }
00632       if(fabs(costm)<0.83)
00633       {
00634          sigmac=mypol3(costcos,m_thetapara[4][4],m_thetapara[4][5],m_thetapara[4][6],m_thetapara[4][7]);
00635       }
00636 
00637       sigma=sigmap*sigmac;
00638       //sigma=sigmac;
00639       break;
00640    }
00641 
00642    default:
00643       sigma = 1.0;
00644       break;
00645    }
00646 
00647    //  sigma =1.0;
00648    return sigma;
00649 }
00650 
00651 double TofCPID::mypol3(double x, double par0, double par1, double par2, double par3)
00652 {
00653    double y = x;
00654    return par0 + (par1 * y) +(par2 * y * y) + (par3 * y * y * y);
00655 
00656 }
00657 
00658 double TofCPID::mypol5(double x, double par0, double par1, double par2, double par3, double par4, double par5)
00659 {
00660    double y = x;
00661    return par0 + (par1 * y) +(par2 * y * y) + (par3 * y * y * y) + (par4 * y * y * y *y)+ (par5 * y * y * y * y * y);
00662 
00663 }
00664 
00665 
00666 

Generated on Tue Nov 29 22:57:34 2016 for BOSS_7.0.2 by  doxygen 1.4.7