7#include "TMultiLayerPerceptron.h"
8#include "TMLPAnalyzer.h"
18void CALG(
double Px,
double& e2);
20MucPID * MucPID::m_pointer = 0;
24 if(!m_pointer) m_pointer =
new MucPID();
35 std::string pi_muc_file =
path +
"/share/pion_muc_hist.txt";
37 ifstream input1(pi_muc_file.c_str(),std::ios_base::in);
39 cout <<
" can not open: " << pi_muc_file << endl;
42 for(
int i=0; i<13; i++) {
43 for(
int j=0; j<300; j++) {
48 std::string mu_muc_file =
path +
"/share/muon_muc_hist.txt";
51 ifstream input2(mu_muc_file.c_str(),std::ios_base::in);
53 cout <<
" can not open: " << mu_muc_file << endl;
56 for(
int i=0; i<13; i++) {
57 for(
int j=0; j<300; j++) {
68 for(
int i = 0; i < 5; i++) {
78 std::string neural =
path +
"/share/neural.root";
79 std::string muc =
path +
"/share/muc.txt";
82 if(!m_trainTree_muc) {
83 m_trainTree_muc =
new TTree(
"m_trainTree_muc",
"m_trainTree_muc");
84 m_trainTree_muc->Branch(
"ptrk",&
ptrk,
"ptrk/D");
85 m_trainTree_muc->Branch(
"phi",&phi,
"phi/D");
86 m_trainTree_muc->Branch(
"theta",&theta,
"theta/D");
87 m_trainTree_muc->Branch(
"depth",&
depth,
"depth/D");
88 m_trainTree_muc->Branch(
"hits",&
hits,
"hits/D");
89 m_trainTree_muc->Branch(
"chi2",&
chi2,
"chi2/D");
90 m_trainTree_muc->Branch(
"distance",&
distance,
"distance/D");
91 m_trainTree_muc->Branch(
"muc_delta_phi",&muc_delta_phi,
"muc_delta_phi/D");
92 m_trainTree_muc->Branch(
"type",&type,
"type/I");
95 m_mlp_muc =
new TMultiLayerPerceptron(
"@ptrk,@phi,@theta,@depth,@hits,@chi2,@distance,@muc_delta_phi:16:type",m_trainTree_muc);
96 m_mlp_muc->LoadWeights(muc.c_str());
115 m_muc_delta_phi =-99;
117 double ptrk = mdcTrk->
p();
118 double m_ptrk =
ptrk;
120 double phi = mdcTrk->
phi();
121 double theta = mdcTrk->
theta();
123 if(
ptrk<0.5)
return irc;
124 if(fabs(cost)>0.83)
return irc;
132 if(mucTrk->
depth()>100000)
return irc;
135 m_depth = mucTrk->
depth();
137 m_chi2 = mucTrk->
chi2();
144 m_muc_delta_phi= mucTrk->
deltaPhi();
145 m_muc_delta_phi=3.14159-m_muc_delta_phi;
147 params_muc1[0] = m_ptrk;
148 params_muc1[1] = phi;
149 params_muc1[2] = theta;
150 params_muc1[3] = m_depth;
151 params_muc1[4] = m_hits;
152 params_muc1[5] = m_chi2;
153 params_muc1[6] = m_distance;
154 params_muc1[7] = m_muc_delta_phi;
156 m_val_muc = m_mlp_muc->Evaluate(0,params_muc1);
158 int pindex = int((m_ptrk-0.5)/0.1);
159 int bindex = int((m_val_muc-0.5)/0.01);
160 if(bindex>300||bindex<0)
return irc;
161 if(pindex>11) pindex=11;
162 if(pindex<0) pindex=0;
163 m_prob[0] = m_p_h[pindex][bindex];;
164 m_prob[1] = m_m_h[pindex][bindex];
165 m_prob[2] = m_p_h[pindex][bindex];
166 m_prob[3] = m_p_h[pindex][bindex];
167 m_prob[4] = m_p_h[pindex][bindex];
168 for(
int i =0; i<5; i++) {
169 if(m_prob[i]==0) m_prob[i] = 0.001;
172 for(
int i =0; i<5; i++) {
176 for(
int j=0; j<bindex; j++) {
177 ppp[1]+= m_m_h[pindex][j]*0.01;
178 ppp[2]+= m_p_h[pindex][j]*0.01;
180 if(ppp[1]>0&&ppp[1]<1)
181 CALG(ppp[1],m_chi[1]);
182 if(ppp[2]>0&&ppp[2]<1)
183 CALG(ppp[2],m_chi[2]);
184 if(ppp[1]<=0||ppp[1]>=1)
186 if(ppp[2]<=0||ppp[2]>=1)
double cos(const BesAngle a)
double Px(RecMdcKalTrack *trk)
NTuple::Item< double > m_pt
void CALG(double Px, double &e2)
void CALG(double Px, double &e2)
const int mucVolumeNumber() const
const double theta() const
int maxHitsInLayer() const
int particleIDCalculation()
static MucPID * instance()
EvtRecTrack * PidTrk() const