5#include "MdcDedxAlg/MdcDedxTrk.h"
6#include "MdcDedxAlg/MdcDedxCorrection.h"
8#include "TGraphErrors.h"
30 for(
unsigned a = 0; a < 5 ; a++ )
39 std::cout<<
"MdcDedxTrk(1) constructed!"<<std::endl;
61 std::cout<<
"MdcDedxTrk(2) constructed!"<<std::endl;
83 std::cout<<
"MdcDedxTrk(2) kal constructed!"<<std::endl;
90 std::cout<<
"MdcDedxTrk destructed!!!"<<std::endl;
96 for(
unsigned a = 0; a < 5 ; a++ )
106 m_quality = trk.
stat();
108 m_charge = ( trk.
helix(2) > 0 )? 1 : -1;
109 float m_Pt = 1.0/fabs( trk.
helix(2) );
110 m_P = m_Pt*sqrt(1 + trk.
helix(4)*trk.
helix(4));
111 m_theta = M_PI_2 - atan( trk.
helix(4) );
112 m_phi = ( trk.
helix(1) < 3*M_PI_2 )? trk.
helix(1)+M_PI_2 : trk.
helix(1)-3*M_PI_2;
118 std::cout<<
"MdcDedxTrk::set_ExTrk(&trk)!!!"<<std::endl;
125 for(
unsigned a = 0; a < 5 ; a++ )
132 if(pid<0 || pid>4) pid = 2;
134 m_trk_kal = &trk_kal;
136 m_quality = dstTrk->
getStat(pid);
138 HepVector kal_helix = dstTrk->
getFHelix(pid);
139 m_charge = ( kal_helix[2] > 0 )? 1 : -1;
140 float m_Pt = 1.0/fabs( kal_helix[2] );
141 m_P = m_Pt*sqrt(1 + kal_helix[4]*kal_helix[4]);
142 m_theta = M_PI_2 - atan( kal_helix[4] );
143 m_phi = ( kal_helix[1] < 3*M_PI_2 )? kal_helix[1]+M_PI_2 : kal_helix[1]-3*M_PI_2;
148 std::cout<<
"MdcDedxTrk::set_ExTrk_Kal(&trk_kal)!!!"<<std::endl;
155 m_truncate = truncate;
156 sort(m_phlist.begin(),m_phlist.end());
157 int nsampl = (int)( m_phlist.size()*truncate );
160 for(vector<double>::iterator ql= m_phlist.begin();ql!=m_phlist.end();ql++)
163 if(i<= nsampl) qSum += (*ql);
166 float trunc=qSum/nsampl;
168 std::cout<<
"MdcDedxTrk::cal_dedx()!!!"<<std::endl;
173 m_truncate = truncate;
174 sort(m_phlist.begin(),m_phlist.end());
175 int nsampl = (int)( m_phlist.size()*truncate );
176 int smpl = (int)(m_phlist.size()*(truncate+0.05));
177 int min_cut = (int)( m_phlist.size()*0.05 + 0.5 );
180 for(vector<double>::iterator ql= m_phlist.begin();ql!=m_phlist.end();ql++)
183 if(i<= smpl && i>=min_cut ) qSum += (*ql);
186 usedhit = smpl-min_cut+1;
187 if(usedhit>0) trunc=qSum/usedhit;
190 std::cout<<
"MdcDedxTrk::cal_dedx()!!!"<<std::endl;
195 sort(m_phlist.begin(),m_phlist.end());
199 if( fmod(
double(
nsample),2.0) ) {
200 median = m_phlist[(
nsample-1)/2];
209 sort(m_phlist.begin(),m_phlist.end());
211 int nsampl = m_phlist.size();
213 for(vector<double>::iterator ql= m_phlist.begin();ql!=m_phlist.end();ql++){
217 double trunc = pow(qSum,1/
double(nsampl));
219 std::cout<<
"MdcDedxTrk::cal_dedx()!!!"<<std::endl;
224 m_truncate = truncate;
225 sort(m_phlist.begin(),m_phlist.end());
226 int nsampl = (int)( m_phlist.size()*truncate );
229 for(vector<double>::iterator ql= m_phlist.begin();ql!=m_phlist.end();ql++){
235 double trunc = pow(qSum,1/
double(nsampl));
238 std::cout<<
"MdcDedxTrk::cal_dedx()!!!"<<std::endl;
243 sort(m_phlist.begin(),m_phlist.end());
245 int nsampl = m_phlist.size();
247 for(vector<double>::iterator ql= m_phlist.begin();ql!=m_phlist.end();ql++){
251 float trunc=nsampl/qSum;
253 std::cout<<
"MdcDedxTrk::cal_dedx()!!!"<<std::endl;
258 m_truncate = truncate;
259 sort(m_phlist.begin(),m_phlist.end());
260 int nsampl = (int)( m_phlist.size()*truncate );
263 for(vector<double>::iterator ql= m_phlist.begin();ql!=m_phlist.end();ql++){
269 float trunc= nsampl/qSum;
271 std::cout<<
"MdcDedxTrk::cal_dedx()!!!"<<std::endl;
276 sort(m_phlist.begin(),m_phlist.end());
278 int nsampl = m_phlist.size();
280 for(vector<double>::iterator ql= m_phlist.begin();ql!=m_phlist.end();ql++){
287 std::cout<<
"MdcDedxTrk::cal_dedx()!!!"<<std::endl;
295 for(vector<double>::iterator ql= m_phlist.begin();ql!=m_phlist.end();ql++){
300 float trunc=qSum/m_phlist.size();
302 std::cout<<
"MdcDedxTrk::cal_dedx_log()!!!"<<std::endl;
310 cout<<
"in MdcDedxTrk::set_dEdx() landau: "<<landau<<
" dedx: "<<dEdx<<
" nsample(): "<<
nsample()<<
" ph size: "<<m_phlist.size()<<
" m_P: "<<m_P<<
" theta: "<<m_theta<<
" pl-rp: "<<m_pl_rp<<endl;
314 int dedxhit_use = (int)(m_phlist.size()*m_truncate);
317 if(runflag ==1 || runflag ==2 )
319 (
float)m_P, (float)m_theta, (
float)t0,(float)m_pl_rp,
320 dedx_exp, ex_sigma, pid_prob, chi_ex);
324 (
float)m_P, (float)m_theta, (
float)t0,(float)m_pl_rp,
325 dedx_exp, ex_sigma, pid_prob, chi_ex, DedxCurve_Parameter, DedxSigma_Parameter);
328 std::cout<<
"MdcDedxTrk::set_dEdx()!!!"<<std::endl;
335 const int par_cand( 5 );
336 const float Charge_Mass[par_cand] = {0.00051100, 0.10566, 0.13957, 0.4937, 0.93827 };
338 double e_Par[5] = {143.349, 1.7315, 0.192616, 2.90437, 1.08248};
339 double Beta_Gamma[22] ={0.373026, 0.479605, 0.586184, 0.692763, 0.799342, 782.779, 1565.56,
340 2348.34, 17.2727, 18.1245, 1.43297, 2.14946, 12.1803, 13.6132, 6.62515, 10.4109,
341 14.1967, 17.9825, 21.7683, 26.0274, 30.7596, 35.4919 };
342 double K_par[22] ={4.64411e-05, 5.86544e-05, 8.05289e-05, 8.46981e-05, 8.92014e-05, 4.74517e-05,
343 4.51684e-05, 5.32732e-05, 6.12803e-05, 6.14592e-05, 8.08608e-05, 6.73184e-05, 5.46448e-05,
344 6.1377e-05, 6.57385e-05, 7.03053e-05, 6.61171e-05, 6.86824e-05, 6.246e-05, 7.25988e-05,
345 7.11034e-05, 6.24924e-05 };
346 double D_par[22] ={0.0871504, 0.0956379, 0.117193, 0.118647, 0.127203, 0.0566449, 0.0529198,
347 0.0642525, 0.0764562, 0.081341, 0.0952263, 0.0987536, 0.0639901, 0.0845994,0.0777062,
348 0.0823206, 0.0783874, 0.079537, 0.0815792, 0.0849875, 0.0824751,0.0776296 };
349 double DSqr_par[22] = {0.00759519, 0.0091466, 0.0137341, 0.0140772, 0.0161807, 0.00320864,
350 0.00280051, 0.00412839, 0.00584555, 0.00661636, 0.00906805, 0.00975227, 0.00409473,
351 0.00715706, 0.00603826, 0.00677668, 0.00614458, 0.00632613, 0.00665516, 0.00722288,
352 0.00680214, 0.00602635};
355 if(beta_G <0.3) beta_G =0.3;
356 double bet=beta_G/TMath::Sqrt(beta_G*beta_G+1);
357 double fterm=TMath::Log(e_Par[2]+1/pow(beta_G,e_Par[4]));
358 double fitval=e_Par[0]/pow(bet,e_Par[3])*(e_Par[1]-pow(bet,e_Par[3])-fterm);
359 TGraphErrors *gr1 =
new TGraphErrors(22,Beta_Gamma, K_par,0,0);
360 TGraphErrors *gr2 =
new TGraphErrors(22,Beta_Gamma, DSqr_par,0,0);
364 par[1] = gr1->Eval(m_theta);
365 par[2] = gr2->Eval(m_theta);
366 Double_t
y = fabs(
cos(m_theta));
367 double electron_par[3] ={334.032, 6.20658e-05, 0.00525673};
368 double arg= TMath::Sqrt(
y*
y+ par[2]);
370 double cal_factor =TMath::Exp(-(par[1]* par[0])/
arg);
371 double arg_electron = TMath::Sqrt(
y*
y + electron_par[2]);
373 double electron_factor = TMath::Exp(-(electron_par[1]* electron_par[0])/arg_electron);
375 double dedx_cal = dEdx/(cal_factor/electron_factor);
double arg(const EvtComplex &c)
HepMC::GenParticle Particle
double cos(const BesAngle a)
int vflag[3]
Curve parameter vars.
const int getStat(const int pid) const
const int trackId() const
const HepVector & getFHelix(const int pid) const
const int trackId() const
const HepVector helix() const
......
void dedx_pid_exp_old(int landau, int runflag, float dedx, int Nhit, float mom, float theta, float t0, float lsamp, double dedx_ex[5], double ex_sigma[5], double pid_prob[5], double chi_dedx[5]) const
void dedx_pid_exp(int vflag[3], float dedx, int trkalg, int Nhit, float mom, float theta, float t0, float lsamp, double dedx_ex[5], double ex_sigma[5], double pid_prob[5], double chi_dedx[5], std::vector< double > &DedxCurve_Parameter, std::vector< double > &DedxSigma_Parameter) const
double cal_dedx_geometric_trunc(float)
double cal_dedx_bitrunc(float, int, int &)
void set_dEdx(int l, float dEdx_meas, int trkalg, int runflag, int vflag[3], double t0, vector< double > &DedxCurve_Parameter, vector< double > &DedxSigma_Parameter, MdcDedxCorrection *)
double cal_dedx_harmonic_trunc(float)
void set_ExTrk_Kal(RecMdcKalTrack &trk_kal, int pid)
void set_ExTrk(RecMdcTrack &trk)
double cal_dedx_harmonic(float)
double cal_dedx_log(float, int)
double SpaceChargeCorrec(double, double, int, double)
double cal_dedx_median(float)
double cal_dedx_geometric(float)
double cal_dedx_transform(int)
int getNhits(int pid) const
const int getNhits() const