71 MsgStream log(
msgSvc(), name() );
73 log << MSG::INFO <<
"in initialize()" << endmsg;
75 Ncut0 = Ncut1 = Ncut2 = Ncut3 = Ncut4 = Ncut5 = Ncut6 = Ncut7 = Ncut8 = Ncut9 = Ncut10 = 0;
79 NTuplePtr nt4(
ntupleSvc(),
"DQAFILE/Rhopi" );
80 if ( nt4 ) m_tuple4 = nt4;
84 ntupleSvc()->book(
"DQAFILE/Rhopi", CLID_ColumnWiseTuple,
"ks N-Tuple example" );
87 status = m_tuple4->addItem(
"run", m_run );
88 status = m_tuple4->addItem(
"rec", m_rec );
89 status = m_tuple4->addItem(
"nch", m_nch );
90 status = m_tuple4->addItem(
"nneu", m_nneu );
91 status = m_tuple4->addItem(
"chi1", m_chi1 );
92 status = m_tuple4->addItem(
"mpi0", m_mpi0 );
93 status = m_tuple4->addItem(
"mprho0", m_prho0 );
94 status = m_tuple4->addItem(
"mprhop", m_prhop );
95 status = m_tuple4->addItem(
"mprhom", m_prhom );
96 status = m_tuple4->addItem(
"mgood", m_good );
97 status = m_tuple4->addItem(
"mgam", m_gam );
98 status = m_tuple4->addItem(
"mpip", m_pip );
99 status = m_tuple4->addItem(
"mpim", m_pim );
100 status = m_tuple4->addItem(
"m2gam", m_2gam );
101 status = m_tuple4->addItem(
"ngch", m_ngch, 0, 10 );
102 status = m_tuple4->addItem(
"nggneu", m_nggneu, 0, 10 );
103 status = m_tuple4->addItem(
"moutpi0", m_outpi0 );
104 status = m_tuple4->addItem(
"cosang", m_cosang );
105 status = m_tuple4->addItem(
"moutpip", m_outpip );
106 status = m_tuple4->addItem(
"moutpim", m_outpim );
107 status = m_tuple4->addItem(
"menpip", m_enpip );
108 status = m_tuple4->addItem(
"mdcpip", m_dcpip );
109 status = m_tuple4->addItem(
"menpim", m_enpim );
110 status = m_tuple4->addItem(
"mdcpim", m_dcpim );
111 status = m_tuple4->addItem(
"mpipf", m_pipf );
112 status = m_tuple4->addItem(
"mpimf", m_pimf );
113 status = m_tuple4->addItem(
"mpi0f", m_pi0f );
115 status = m_tuple4->addItem(
"mpmax", m_pmax );
116 status = m_tuple4->addItem(
"mppx", m_ppx );
117 status = m_tuple4->addItem(
"mppy", m_ppy );
118 status = m_tuple4->addItem(
"mppz", m_ppz );
119 status = m_tuple4->addItem(
"mcosthep", m_costhep );
120 status = m_tuple4->addItem(
"mppxkal", m_ppxkal );
121 status = m_tuple4->addItem(
"mppykal", m_ppykal );
122 status = m_tuple4->addItem(
"mppzkal", m_ppzkal );
123 status = m_tuple4->addItem(
"mmpx", m_mpx );
124 status = m_tuple4->addItem(
"mmpy", m_mpy );
125 status = m_tuple4->addItem(
"mmpz", m_mpz );
126 status = m_tuple4->addItem(
"mcosthem", m_costhem );
127 status = m_tuple4->addItem(
"mmpxkal", m_mpxkal );
128 status = m_tuple4->addItem(
"mmpykal", m_mpykal );
129 status = m_tuple4->addItem(
"mmpzkal", m_mpzkal );
131 status = m_tuple4->addItem(
"mvxpin", m_vxpin );
132 status = m_tuple4->addItem(
"mvypin", m_vypin );
133 status = m_tuple4->addItem(
"mvzpin", m_vzpin );
134 status = m_tuple4->addItem(
"mvrpin", m_vrpin );
135 status = m_tuple4->addItem(
"mcosthepin", m_costhepin );
136 status = m_tuple4->addItem(
"mvxmin", m_vxmin );
137 status = m_tuple4->addItem(
"mvymin", m_vymin );
138 status = m_tuple4->addItem(
"mvzmin", m_vzmin );
139 status = m_tuple4->addItem(
"mvrmin", m_vrmin );
140 status = m_tuple4->addItem(
"mcosthemin", m_costhemin );
141 status = m_tuple4->addItem(
"mvxp", m_vxp );
142 status = m_tuple4->addItem(
"mvyp", m_vyp );
143 status = m_tuple4->addItem(
"mvzp", m_vzp );
144 status = m_tuple4->addItem(
"mvrp", m_vrp );
145 status = m_tuple4->addItem(
"mvxm", m_vxm );
146 status = m_tuple4->addItem(
"mvym", m_vym );
147 status = m_tuple4->addItem(
"mvzm", m_vzm );
148 status = m_tuple4->addItem(
"mvrm", m_vrm );
149 status = m_tuple4->addItem(
"nangecc", m_nangecc, 0, 10 );
150 status = m_tuple4->addIndexedItem(
"mdthec", m_nangecc, m_dthec );
151 status = m_tuple4->addIndexedItem(
"mdphic", m_nangecc, m_dphic );
152 status = m_tuple4->addIndexedItem(
"mdangc", m_nangecc, m_dangc );
153 status = m_tuple4->addIndexedItem(
"mspippim", m_nangecc, m_mspippim );
155 status = m_tuple4->addItem(
"angsg", dangsg );
156 status = m_tuple4->addItem(
"thesg", dthesg );
157 status = m_tuple4->addItem(
"phisg", dphisg );
158 status = m_tuple4->addItem(
"cosgth1", cosgth1 );
159 status = m_tuple4->addItem(
"cosgth2", cosgth2 );
161 status = m_tuple4->addItem(
"mchi5", m_chi5 );
162 status = m_tuple4->addItem(
"mkpi0", m_kpi0 );
163 status = m_tuple4->addItem(
"mkpkm", m_kpkm );
164 status = m_tuple4->addItem(
"mkpp0", m_kpp0 );
165 status = m_tuple4->addItem(
"mkmp0", m_kmp0 );
166 status = m_tuple4->addItem(
"mpgam2pi1", m_pgam2pi1 );
167 status = m_tuple4->addItem(
"mpgam2pi2", m_pgam2pi2 );
168 status = m_tuple4->addItem(
"cosva1", cosva1 );
169 status = m_tuple4->addItem(
"cosva2", cosva2 );
170 status = m_tuple4->addItem(
"laypi1", m_laypi1 );
171 status = m_tuple4->addItem(
"hit1", m_hit1 );
172 status = m_tuple4->addItem(
"laypi2", m_laypi2 );
173 status = m_tuple4->addItem(
"hit2", m_hit2 );
174 status = m_tuple4->addItem(
"anglepm", m_anglepm );
176 status = m_tuple4->addIndexedItem(
"mptrk", m_ngch, m_ptrk );
177 status = m_tuple4->addIndexedItem(
"chie", m_ngch, m_chie );
178 status = m_tuple4->addIndexedItem(
"chimu", m_ngch, m_chimu );
179 status = m_tuple4->addIndexedItem(
"chipi", m_ngch, m_chipi );
180 status = m_tuple4->addIndexedItem(
"chik", m_ngch, m_chik );
181 status = m_tuple4->addIndexedItem(
"chip", m_ngch, m_chip );
182 status = m_tuple4->addIndexedItem(
"probPH", m_ngch, m_probPH );
183 status = m_tuple4->addIndexedItem(
"normPH", m_ngch, m_normPH );
184 status = m_tuple4->addIndexedItem(
"ghit", m_ngch, m_ghit );
185 status = m_tuple4->addIndexedItem(
"thit", m_ngch, m_thit );
187 status = m_tuple4->addIndexedItem(
"ptot_etof", m_ngch, m_ptot_etof );
188 status = m_tuple4->addIndexedItem(
"cntr_etof", m_ngch, m_cntr_etof );
189 status = m_tuple4->addIndexedItem(
"te_etof", m_ngch, m_te_etof );
190 status = m_tuple4->addIndexedItem(
"tmu_etof", m_ngch, m_tmu_etof );
191 status = m_tuple4->addIndexedItem(
"tpi_etof", m_ngch, m_tpi_etof );
192 status = m_tuple4->addIndexedItem(
"tk_etof", m_ngch, m_tk_etof );
193 status = m_tuple4->addIndexedItem(
"tp_etof", m_ngch, m_tp_etof );
194 status = m_tuple4->addIndexedItem(
"ph_etof", m_ngch, m_ph_etof );
195 status = m_tuple4->addIndexedItem(
"rhit_etof", m_ngch, m_rhit_etof );
196 status = m_tuple4->addIndexedItem(
"qual_etof", m_ngch, m_qual_etof );
197 status = m_tuple4->addIndexedItem(
"ec_toff_e", m_ngch, m_ec_toff_e );
198 status = m_tuple4->addIndexedItem(
"ec_toff_mu", m_ngch, m_ec_toff_mu );
199 status = m_tuple4->addIndexedItem(
"ec_toff_pi", m_ngch, m_ec_toff_pi );
200 status = m_tuple4->addIndexedItem(
"ec_toff_k", m_ngch, m_ec_toff_k );
201 status = m_tuple4->addIndexedItem(
"ec_toff_p", m_ngch, m_ec_toff_p );
202 status = m_tuple4->addIndexedItem(
"ec_tsig_e", m_ngch, m_ec_tsig_e );
203 status = m_tuple4->addIndexedItem(
"ec_tsig_mu", m_ngch, m_ec_tsig_mu );
204 status = m_tuple4->addIndexedItem(
"ec_tsig_pi", m_ngch, m_ec_tsig_pi );
205 status = m_tuple4->addIndexedItem(
"ec_tsig_k", m_ngch, m_ec_tsig_k );
206 status = m_tuple4->addIndexedItem(
"ec_tsig_p", m_ngch, m_ec_tsig_p );
207 status = m_tuple4->addIndexedItem(
"ec_tof", m_ngch, m_ec_tof );
208 status = m_tuple4->addIndexedItem(
"ptot_btof1", m_ngch, m_ptot_btof1 );
209 status = m_tuple4->addIndexedItem(
"cntr_btof1", m_ngch, m_cntr_btof1 );
210 status = m_tuple4->addIndexedItem(
"te_btof1", m_ngch, m_te_btof1 );
211 status = m_tuple4->addIndexedItem(
"tmu_btof1", m_ngch, m_tmu_btof1 );
212 status = m_tuple4->addIndexedItem(
"tpi_btof1", m_ngch, m_tpi_btof1 );
213 status = m_tuple4->addIndexedItem(
"tk_btof1", m_ngch, m_tk_btof1 );
214 status = m_tuple4->addIndexedItem(
"tp_btof1", m_ngch, m_tp_btof1 );
215 status = m_tuple4->addIndexedItem(
"ph_btof1", m_ngch, m_ph_btof1 );
216 status = m_tuple4->addIndexedItem(
"zhit_btof1", m_ngch, m_zhit_btof1 );
217 status = m_tuple4->addIndexedItem(
"qual_btof1", m_ngch, m_qual_btof1 );
218 status = m_tuple4->addIndexedItem(
"b1_toff_e", m_ngch, m_b1_toff_e );
219 status = m_tuple4->addIndexedItem(
"b1_toff_mu", m_ngch, m_b1_toff_mu );
220 status = m_tuple4->addIndexedItem(
"b1_toff_pi", m_ngch, m_b1_toff_pi );
221 status = m_tuple4->addIndexedItem(
"b1_toff_k", m_ngch, m_b1_toff_k );
222 status = m_tuple4->addIndexedItem(
"b1_toff_p", m_ngch, m_b1_toff_p );
223 status = m_tuple4->addIndexedItem(
"b1_tsig_e", m_ngch, m_b1_tsig_e );
224 status = m_tuple4->addIndexedItem(
"b1_tsig_mu", m_ngch, m_b1_tsig_mu );
225 status = m_tuple4->addIndexedItem(
"b1_tsig_pi", m_ngch, m_b1_tsig_pi );
226 status = m_tuple4->addIndexedItem(
"b1_tsig_k", m_ngch, m_b1_tsig_k );
227 status = m_tuple4->addIndexedItem(
"b1_tsig_p", m_ngch, m_b1_tsig_p );
228 status = m_tuple4->addIndexedItem(
"b1_tof", m_ngch, m_b1_tof );
230 status = m_tuple4->addIndexedItem(
"mdedx_pid", m_ngch, m_dedx_pid );
231 status = m_tuple4->addIndexedItem(
"mtof1_pid", m_ngch, m_tof1_pid );
232 status = m_tuple4->addIndexedItem(
"mtof2_pid", m_ngch, m_tof2_pid );
233 status = m_tuple4->addIndexedItem(
"mprob_pid", m_ngch, m_prob_pid );
234 status = m_tuple4->addIndexedItem(
"mptrk_pid", m_ngch, m_ptrk_pid );
235 status = m_tuple4->addIndexedItem(
"mcost_pid", m_ngch, m_cost_pid );
236 status = m_tuple4->addItem(
"mpnp", m_pnp );
237 status = m_tuple4->addItem(
"mpnm", m_pnm );
240 m_tuple4->addIndexedItem(
"numHits", m_nggneu, m_numHits );
241 status = m_tuple4->addIndexedItem(
"secondmoment", m_nggneu, m_secondmoment );
243 m_tuple4->addIndexedItem(
"mx", m_nggneu, m_x );
244 status = m_tuple4->addIndexedItem(
"my", m_nggneu, m_y );
245 status = m_tuple4->addIndexedItem(
"mz", m_nggneu, m_z );
246 status = m_tuple4->addIndexedItem(
"cosemc", m_nggneu,
248 status = m_tuple4->addIndexedItem(
"phiemc", m_nggneu, m_phiemc );
249 status = m_tuple4->addIndexedItem(
"energy", m_nggneu,
251 status = m_tuple4->addIndexedItem(
"eseed", m_nggneu, m_eSeed );
252 status = m_tuple4->addIndexedItem(
"me9", m_nggneu, m_e3x3 );
253 status = m_tuple4->addIndexedItem(
"me25", m_nggneu, m_e5x5 );
254 status = m_tuple4->addIndexedItem(
"mlat", m_nggneu, m_lat );
255 status = m_tuple4->addIndexedItem(
"ma20", m_nggneu, m_a20 );
256 status = m_tuple4->addIndexedItem(
"ma42", m_nggneu, m_a42 );
260 log << MSG::ERROR <<
" Cannot book N-tuple:" << long( m_tuple4 ) << endmsg;
261 return StatusCode::FAILURE;
265 if ( service(
"THistSvc", m_thsvc ).isFailure() )
267 log << MSG::ERROR <<
"Couldn't get THistSvc" << endmsg;
268 return StatusCode::FAILURE;
274 TH1F* mrho0 =
new TH1F(
"mrho0",
"mass for #rho^{0}->#pi^{+}#pi^{-}", 160, 0.0, 3.2 );
275 if ( m_thsvc->regHist(
"/DQAHist/Rhopi/mrho0", mrho0 ).isFailure() )
276 { log << MSG::ERROR <<
"Couldn't register mrho0" << endmsg; }
278 TH1F* mrhop =
new TH1F(
"mrhop",
"mass for #rho^{+}->#pi^{+}#pi^{0}", 160, 0.0, 3.2 );
279 if ( m_thsvc->regHist(
"/DQAHist/Rhopi/mrhop", mrhop ).isFailure() )
280 { log << MSG::ERROR <<
"Couldn't register mrhop" << endmsg; }
282 TH1F* mrhom =
new TH1F(
"mrhom",
"mass for #rho^{-}->#pi^{-}#pi^{0}", 160, 0.0, 3.2 );
283 if ( m_thsvc->regHist(
"/DQAHist/Rhopi/mrhom", mrhom ).isFailure() )
284 { log << MSG::ERROR <<
"Couldn't register mrhom" << endmsg; }
286 TH1F*
mpi0 =
new TH1F(
"mpi0",
"mass for #pi^{0}->#gamma #gamma", 50, 0.08, 0.18 );
287 if ( m_thsvc->regHist(
"/DQAHist/Rhopi/mpi0",
mpi0 ).isFailure() )
288 { log << MSG::ERROR <<
"Couldn't register mpi0" << endmsg; }
294 log << MSG::INFO <<
"successfully return from initialize()" << endmsg;
295 return StatusCode::SUCCESS;
303 MsgStream log(
msgSvc(), name() );
304 log << MSG::INFO <<
"in execute()" << endmsg;
306 setFilterPassed(
false );
308 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc(),
"/Event/EventHeader" );
309 int run = eventHeader->runNumber();
310 int event = eventHeader->eventNumber();
311 log << MSG::DEBUG <<
"run, evtnum = " << run <<
" , " <<
event << endmsg;
313 m_run = eventHeader->runNumber();
314 m_rec = eventHeader->eventNumber();
319 log << MSG::INFO <<
"get event tag OK" << endmsg;
320 log << MSG::DEBUG <<
"ncharg, nneu, tottks = " << evtRecEvent->totalCharged() <<
" , "
321 << evtRecEvent->totalNeutral() <<
" , " << evtRecEvent->totalTracks() << endmsg;
323 m_nch = evtRecEvent->totalCharged();
324 m_nneu = evtRecEvent->totalNeutral();
332 Vint iGood, ipip, ipim, ipnp, ipnm;
338 Vp4 ppip, ppim, ppnp, ppnm;
344 Hep3Vector xorigin( 0, 0, 0 );
348 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc ).ignore();
353 xorigin.setX( dbv[0] );
354 xorigin.setY( dbv[1] );
355 xorigin.setZ( dbv[2] );
359 for (
int i = 0; i < evtRecEvent->totalCharged(); i++ )
362 if ( !( *itTrk )->isMdcTrackValid() )
continue;
363 if ( !( *itTrk )->isMdcKalTrackValid() )
continue;
367 double pch = mdcTrk->
p();
368 double x0 = mdcTrk->
x();
369 double y0 = mdcTrk->
y();
370 double z0 = mdcTrk->
z();
371 double phi0 = mdcTrk->
helix( 1 );
372 double xv = xorigin.x();
373 double yv = xorigin.y();
374 double Rxy = fabs( ( x0 - xv ) *
cos( phi0 ) + ( y0 - yv ) *
sin( phi0 ) );
377 double m_vz0 = z0 - xorigin.z();
379 double m_Vct =
cos( mdcTrk->
theta() );
381 if ( fabs( m_vz0 ) >= m_vz0cut )
continue;
382 if ( m_vr0 >= m_vr0cut )
continue;
383 if ( fabs( m_Vct ) >= m_cthcut )
continue;
385 iGood.push_back( ( *itTrk )->trackId() );
386 nCharge += mdcTrk->
charge();
392 int nGood = iGood.size();
393 log << MSG::DEBUG <<
"ngood, totcharge = " << nGood <<
" , " << nCharge << endmsg;
394 if ( ( nGood != 2 ) || ( nCharge != 0 ) ) {
return StatusCode::SUCCESS; }
399 for (
int i = evtRecEvent->totalCharged(); i < evtRecEvent->totalTracks(); i++ )
402 if ( !( *itTrk )->isEmcShowerValid() )
continue;
404 Hep3Vector emcpos( emcTrk->
x(), emcTrk->
y(), emcTrk->
z() );
409 for (
int j = 0; j < evtRecEvent->totalCharged(); j++ )
412 if ( !( *jtTrk )->isExtTrackValid() )
continue;
417 double angd = extpos.angle( emcpos );
418 double thed = extpos.theta() - emcpos.theta();
419 double phid = extpos.deltaPhi( emcpos );
420 thed = fmod( thed + CLHEP::twopi + CLHEP::twopi +
pi, CLHEP::twopi ) - CLHEP::pi;
421 phid = fmod( phid + CLHEP::twopi + CLHEP::twopi +
pi, CLHEP::twopi ) - CLHEP::pi;
423 if ( fabs( thed ) < fabs( dthe ) ) dthe = thed;
424 if ( fabs( phid ) < fabs( dphi ) ) dphi = phid;
425 if ( angd < dang ) dang = angd;
427 if ( dang >= 200 )
continue;
428 double eraw = emcTrk->
energy();
431 dthe = dthe * 180 / ( CLHEP::pi );
432 dphi = dphi * 180 / ( CLHEP::pi );
433 dang = dang * 180 / ( CLHEP::pi );
434 double m_dthe = dthe;
435 double m_dphi = dphi;
436 double m_dang = dang;
437 double m_eraw = eraw;
440 if ( fc_theta < 0.80 )
442 if ( eraw <= m_energyThreshold / 2 )
continue;
444 else if ( fc_theta > 0.86 && fc_theta < 0.92 )
446 if ( eraw <= m_energyThreshold )
continue;
451 if ( dang < m_gammaAngCut )
continue;
455 iGam.push_back( ( *itTrk )->trackId() );
461 int nGam = iGam.size();
463 log << MSG::DEBUG <<
"num Good Photon " << nGam <<
" , " << evtRecEvent->totalNeutral()
465 if ( nGam < 2 ) {
return StatusCode::SUCCESS; }
474 for (
int i = 0; i < nGam; i++ )
478 double eraw = emcTrk->
energy();
479 double phi = emcTrk->
phi();
480 double the = emcTrk->
theta();
481 HepLorentzVector ptrk;
482 ptrk.setPx( eraw *
sin( the ) *
cos( phi ) );
483 ptrk.setPy( eraw *
sin( the ) *
sin( phi ) );
484 ptrk.setPz( eraw *
cos( the ) );
489 pGam.push_back( ptrk );
492 log << MSG::DEBUG <<
"liuf1 Good Photon " << endmsg;
494 for (
int i = 0; i < nGood; i++ )
497 if ( !( *itTrk )->isMdcTrackValid() )
continue;
498 if ( !( *itTrk )->isMdcKalTrackValid() )
continue;
503 if ( mdcTrk->
charge() > 0 )
505 ipip.push_back( iGood[i] );
506 HepLorentzVector ptrk;
507 ptrk.setPx( mdcKalTrk->
px() );
508 ptrk.setPy( mdcKalTrk->
py() );
509 ptrk.setPz( mdcKalTrk->
pz() );
510 double p3 = ptrk.mag();
511 ptrk.setE( sqrt( p3 * p3 +
mpi *
mpi ) );
512 ppip.push_back( ptrk );
516 ipim.push_back( iGood[i] );
517 HepLorentzVector ptrk;
518 ptrk.setPx( mdcKalTrk->
px() );
519 ptrk.setPy( mdcKalTrk->
py() );
520 ptrk.setPz( mdcKalTrk->
pz() );
521 double p3 = ptrk.mag();
522 ptrk.setE( sqrt( p3 * p3 +
mpi *
mpi ) );
523 ppim.push_back( ptrk );
527 int npip = ipip.size();
528 int npim = ipim.size();
529 log << MSG::DEBUG <<
"num of pion " << ipip.size() <<
"," << ipim.size() << endmsg;
540 for (
int i = 0; i < npip; i++ )
545 Hep3Vector emcpos( ppip[i].px(), ppip[i].py(), ppip[i].pz() );
547 for (
int j = 0; j < npim; j++ )
553 HepLorentzVector pippim = ppip[i] + ppim[j];
555 Hep3Vector extpos( ppim[j].px(), ppim[j].py(), ppim[j].pz() );
557 double angd = extpos.angle( emcpos );
558 double thed = extpos.theta() - emcpos.theta();
559 double phid = extpos.deltaPhi( emcpos );
560 thed = fmod( thed + CLHEP::twopi + CLHEP::twopi +
pi, CLHEP::twopi ) - CLHEP::pi;
561 phid = fmod( phid + CLHEP::twopi + CLHEP::twopi +
pi, CLHEP::twopi ) - CLHEP::pi;
563 m_dthec[langcc] = thed * 180 / ( CLHEP::pi );
564 m_dphic[langcc] = phid * 180 / ( CLHEP::pi );
565 m_dangc[langcc] = angd * 180 / ( CLHEP::pi );
566 m_mspippim[langcc] = pippim.m();
576 double m_m2gg, m_momentpi0;
577 HepLorentzVector pTot, p2g;
579 log << MSG::DEBUG <<
"liuf2 Good Photon " << langcc << endmsg;
584 double m_momentpip, m_momentpim, extmot1, extmot2;
597 double phi01 = mdcTrk11->
helix( 1 );
604 double phi02 = mdcTrk12->
helix( 1 );
606 m_vxpin = mdcTrk11->
x();
607 m_vypin = mdcTrk11->
y();
608 m_vzpin = mdcTrk11->
z() - xorigin.z();
609 m_vrpin = fabs( ( mdcTrk11->
x() - xorigin.x() ) *
cos( phi01 ) +
610 ( mdcTrk11->
y() - xorigin.y() ) *
sin( phi01 ) );
611 m_costhepin =
cos( mdcTrk11->
theta() );
613 m_momentpip = mdcTrk11->
p();
614 m_ppx = mdcTrk11->
px();
615 m_ppy = mdcTrk11->
py();
616 m_ppz = mdcTrk11->
pz();
618 m_vxp = mdcKalTrk11->
x();
619 m_vyp = mdcKalTrk11->
y();
620 m_vzp = mdcKalTrk11->
z() - xorigin.z();
621 m_vrp = fabs( ( mdcKalTrk11->
x() - xorigin.x() ) *
cos( phi01 ) +
622 ( mdcKalTrk11->
y() - xorigin.y() ) *
sin( phi01 ) );
623 m_costhep =
cos( mdcKalTrk11->
theta() );
626 m_ppxkal = mdcKalTrk11->
px();
627 m_ppykal = mdcKalTrk11->
py();
628 m_ppzkal = mdcKalTrk11->
pz();
629 extmot1 = sqrt( m_ppxkal * m_ppxkal + m_ppykal * m_ppykal + m_ppzkal * m_ppzkal );
631 m_vxmin = mdcTrk12->
x();
632 m_vymin = mdcTrk12->
y();
633 m_vzmin = mdcTrk12->
z();
634 m_vrmin = fabs( ( mdcTrk12->
x() - xorigin.x() ) *
cos( phi02 ) +
635 ( mdcTrk12->
y() - xorigin.y() ) *
sin( phi02 ) );
636 m_costhemin =
cos( mdcTrk12->
theta() );
638 m_momentpim = mdcTrk12->
p();
639 m_mpx = mdcTrk12->
px();
640 m_mpy = mdcTrk12->
py();
641 m_mpz = mdcTrk12->
pz();
643 m_vxm = mdcKalTrk12->
x();
644 m_vym = mdcKalTrk12->
y();
645 m_vzm = mdcKalTrk12->
z();
646 m_vrm = fabs( ( mdcKalTrk12->
x() - xorigin.x() ) *
cos( phi02 ) +
647 ( mdcKalTrk12->
y() - xorigin.y() ) *
sin( phi02 ) );
648 m_costhem =
cos( mdcKalTrk12->
theta() );
651 m_mpxkal = mdcKalTrk12->
px();
652 m_mpykal = mdcKalTrk12->
py();
653 m_mpzkal = mdcKalTrk12->
pz();
654 extmot2 = sqrt( m_mpxkal * m_mpxkal + m_mpykal * m_mpykal + m_mpzkal * m_mpzkal );
656 if ( ( *itTrk11 )->isEmcShowerValid() ) { emcTg1 = emcTrk11->
energy(); }
657 if ( ( *itTrk12 )->isEmcShowerValid() ) { emcTg2 = emcTrk12->
energy(); }
658 if ( ( *itTrk11 )->isMucTrackValid() )
663 if ( ( *itTrk12 )->isMucTrackValid() )
674 log << MSG::DEBUG <<
"liuf3 Good Photon " << ipim[0] << endmsg;
676 RecMdcKalTrack* pipTrk = ( *( evtRecTrkCol->begin() + ipip[0] ) )->mdcKalTrack();
677 RecMdcKalTrack* pimTrk = ( *( evtRecTrkCol->begin() + ipim[0] ) )->mdcKalTrack();
679 log << MSG::DEBUG <<
"liuf4 Good Photon " << endmsg;
698 HepPoint3D vx( 0., 0., 0. );
699 HepSymMatrix Evx( 3, 0 );
720 double chi5 = 9999.0;
729 if ( vtxfit->
Fit( 0 ) )
741 double chisq = 9999.;
742 for (
int i = 0; i < nGam - 1; i++ )
744 RecEmcShower* g1Trk = ( *( evtRecTrkCol->begin() + iGam[i] ) )->emcShower();
745 for (
int j = i + 1; j < nGam; j++ )
747 RecEmcShower* g2Trk = ( *( evtRecTrkCol->begin() + iGam[j] ) )->emcShower();
755 bool oksq = kmfit->
Fit();
759 double chi2 = kmfit->
chisq();
762 HepLorentzVector kpi0 = kmfit->
pfit( 2 ) + kmfit->
pfit( 3 );
763 HepLorentzVector kpkm = kmfit->
pfit( 0 ) + kmfit->
pfit( 1 );
764 HepLorentzVector kpp0 = kmfit->
pfit( 0 ) + kpi0;
765 HepLorentzVector kmp0 = kmfit->
pfit( 1 ) + kpi0;
766 chi5 = kmfit->
chisq();
785 if ( !vtxfit->
Fit( 0 ) )
return StatusCode::SUCCESS;
791 log << MSG::DEBUG <<
"liuf5 Good Photon " << endmsg;
799 double chisq = 9999.;
802 HepLorentzVector gg1, gg2;
803 for (
int i = 0; i < nGam - 1; i++ )
805 RecEmcShower* g1Trk = ( *( evtRecTrkCol->begin() + iGam[i] ) )->emcShower();
806 for (
int j = i + 1; j < nGam; j++ )
808 RecEmcShower* g2Trk = ( *( evtRecTrkCol->begin() + iGam[j] ) )->emcShower();
816 bool oksq = kmfit->
Fit();
819 double chi2 = kmfit->
chisq();
833 m_pmax = gg1.e() > gg2.e() ? gg1.e() : gg2.e();
835 m_cosang = ( gg1.e() - gg2.e() ) / p2g.rho();
836 m_momentpi0 = sqrt( p2g.px() * p2g.px() + p2g.py() * p2g.py() + p2g.pz() * p2g.pz() );
837 log << MSG::DEBUG <<
" chisq for 4c " << chisq << endmsg;
838 if ( chisq > 200 ) {
return StatusCode::SUCCESS; }
843 jGood.push_back( ipip[0] );
844 jGood.push_back( ipim[0] );
845 m_ngch = jGood.size();
849 jGgam.push_back( ig1 );
850 jGgam.push_back( ig2 );
851 m_nggneu = jGgam.size();
853 HepLorentzVector ppip1 = ppip[0];
854 HepLorentzVector ppim1 = ppim[0];
856 HepLorentzVector Ppipboost = ppip1.boost(
u_cms );
857 HepLorentzVector Ppimboost = ppim1.boost(
u_cms );
858 Hep3Vector p3pi1 = Ppipboost.vect();
859 Hep3Vector p3pi2 = Ppimboost.vect();
860 m_anglepm = ( p3pi1.angle( p3pi2 ) ) * 180 / ( CLHEP::pi );
864 RecEmcShower* g1Trk = ( *( evtRecTrkCol->begin() + ig1 ) )->emcShower();
865 RecEmcShower* g2Trk = ( *( evtRecTrkCol->begin() + ig2 ) )->emcShower();
873 bool oksq = kmfit->
Fit();
874 if ( !oksq )
return StatusCode::SUCCESS;
876 HepLorentzVector ppi0 = kmfit->
pfit( 2 ) + kmfit->
pfit( 3 );
877 HepLorentzVector prho0 = kmfit->
pfit( 0 ) + kmfit->
pfit( 1 );
878 HepLorentzVector prhop = kmfit->
pfit( 0 ) + ppi0;
879 HepLorentzVector prhom = kmfit->
pfit( 1 ) + ppi0;
880 HepLorentzVector pgam2pi1 = prho0 + kmfit->
pfit( 2 );
881 HepLorentzVector pgam2pi2 = prho0 + kmfit->
pfit( 3 );
882 HepLorentzVector pgam11 = kmfit->
pfit( 2 );
883 HepLorentzVector pgam12 = kmfit->
pfit( 3 );
894 m_chi1 = kmfit->
chisq();
905 m_outpi0 = m_momentpi0;
906 m_outpip = m_momentpip;
907 m_outpim = m_momentpim;
912 m_pipf = kmfit->
pfit( 0 ).rho();
913 m_pimf = kmfit->
pfit( 1 ).rho();
921 m_pgam2pi1 = pgam2pi1.m();
922 m_pgam2pi2 = pgam2pi2.m();
923 cosva1 = kmfit->
pfit( 2 ).rho();
924 cosva2 = kmfit->
pfit( 3 ).rho();
936 for (
int ii = 0; ii < m_ngch; ii++ )
941 m_chimu[ii] = 9999.0;
942 m_chipi[ii] = 9999.0;
947 m_probPH[ii] = 9999.0;
948 m_normPH[ii] = 9999.0;
951 m_cntr_etof[ii] = 9999.0;
952 m_ptot_etof[ii] = 9999.0;
953 m_ph_etof[ii] = 9999.0;
954 m_rhit_etof[ii] = 9999.0;
955 m_qual_etof[ii] = 9999.0;
956 m_te_etof[ii] = 9999.0;
957 m_tmu_etof[ii] = 9999.0;
958 m_tpi_etof[ii] = 9999.0;
959 m_tk_etof[ii] = 9999.0;
960 m_tp_etof[ii] = 9999.0;
961 m_ec_tof[ii] = 9999.0;
962 m_ec_toff_e[ii] = 9999.0;
963 m_ec_toff_mu[ii] = 9999.0;
964 m_ec_toff_pi[ii] = 9999.0;
965 m_ec_toff_k[ii] = 9999.0;
966 m_ec_toff_p[ii] = 9999.0;
967 m_ec_tsig_e[ii] = 9999.0;
968 m_ec_tsig_mu[ii] = 9999.0;
969 m_ec_tsig_pi[ii] = 9999.0;
970 m_ec_tsig_k[ii] = 9999.0;
971 m_ec_tsig_p[ii] = 9999.0;
974 m_cntr_btof1[ii] = 9999.0;
975 m_ptot_btof1[ii] = 9999.0;
976 m_ph_btof1[ii] = 9999.0;
977 m_zhit_btof1[ii] = 9999.0;
978 m_qual_btof1[ii] = 9999.0;
979 m_te_btof1[ii] = 9999.0;
980 m_tmu_btof1[ii] = 9999.0;
981 m_tpi_btof1[ii] = 9999.0;
982 m_tk_btof1[ii] = 9999.0;
983 m_tp_btof1[ii] = 9999.0;
984 m_b1_tof[ii] = 9999.0;
985 m_b1_toff_e[ii] = 9999.0;
986 m_b1_toff_mu[ii] = 9999.0;
987 m_b1_toff_pi[ii] = 9999.0;
988 m_b1_toff_k[ii] = 9999.0;
989 m_b1_toff_p[ii] = 9999.0;
990 m_b1_tsig_e[ii] = 9999.0;
991 m_b1_tsig_mu[ii] = 9999.0;
992 m_b1_tsig_pi[ii] = 9999.0;
993 m_b1_tsig_k[ii] = 9999.0;
994 m_b1_tsig_p[ii] = 9999.0;
996 m_dedx_pid[ii] = 9999.0;
997 m_tof1_pid[ii] = 9999.0;
998 m_tof2_pid[ii] = 9999.0;
999 m_prob_pid[ii] = 9999.0;
1000 m_ptrk_pid[ii] = 9999.0;
1001 m_cost_pid[ii] = 9999.0;
1005 for (
int i = 0; i < m_ngch; i++ )
1008 if ( !( *itTrk )->isMdcTrackValid() )
continue;
1009 if ( !( *itTrk )->isMdcDedxValid() )
continue;
1012 m_ptrk[indx0] = mdcTrk->
p();
1014 m_chie[indx0] = dedxTrk->
chiE();
1015 m_chimu[indx0] = dedxTrk->
chiMu();
1016 m_chipi[indx0] = dedxTrk->
chiPi();
1017 m_chik[indx0] = dedxTrk->
chiK();
1018 m_chip[indx0] = dedxTrk->
chiP();
1021 m_probPH[indx0] = dedxTrk->
probPH();
1022 m_normPH[indx0] = dedxTrk->
normPH();
1031 for (
int i = 0; i < m_ngch; i++ )
1034 if ( !( *itTrk )->isMdcTrackValid() )
continue;
1035 if ( !( *itTrk )->isTofTrackValid() )
continue;
1038 SmartRefVector<RecTofTrack> tofTrkCol = ( *itTrk )->tofTrack();
1040 double ptrk = mdcTrk->
p();
1041 SmartRefVector<RecTofTrack>::iterator iter_tof = tofTrkCol.begin();
1042 for ( ; iter_tof != tofTrkCol.end(); iter_tof++ )
1045 status->
setStatus( ( *iter_tof )->status() );
1049 if ( status->
layer() != 1 )
continue;
1050 double path = ( *iter_tof )->path();
1051 double tof = ( *iter_tof )->tof();
1052 double ph = ( *iter_tof )->ph();
1053 double rhit = ( *iter_tof )->zrhit();
1054 double qual = 0.0 + ( *iter_tof )->quality();
1055 double cntr = 0.0 + ( *iter_tof )->tofID();
1058 for (
int j = 0; j < 5; j++ )
1060 texp[j] = ( *iter_tof )->texp( j );
1064 m_cntr_etof[indx1] = cntr;
1065 m_ptot_etof[indx1] = ptrk;
1066 m_ph_etof[indx1] = ph;
1067 m_rhit_etof[indx1] = rhit;
1068 m_qual_etof[indx1] = qual;
1069 m_te_etof[indx1] = tof - texp[0];
1070 m_tmu_etof[indx1] = tof - texp[1];
1071 m_tpi_etof[indx1] = tof - texp[2];
1072 m_tk_etof[indx1] = tof - texp[3];
1073 m_tp_etof[indx1] = tof - texp[4];
1075 m_ec_tof[indx1] = tof;
1077 m_ec_toff_e[indx1] = ( *iter_tof )->toffset( 0 );
1078 m_ec_toff_mu[indx1] = ( *iter_tof )->toffset( 1 );
1079 m_ec_toff_pi[indx1] = ( *iter_tof )->toffset( 2 );
1080 m_ec_toff_k[indx1] = ( *iter_tof )->toffset( 3 );
1081 m_ec_toff_p[indx1] = ( *iter_tof )->toffset( 4 );
1083 m_ec_tsig_e[indx1] = ( *iter_tof )->sigma( 0 );
1084 m_ec_tsig_mu[indx1] = ( *iter_tof )->sigma( 1 );
1085 m_ec_tsig_pi[indx1] = ( *iter_tof )->sigma( 2 );
1086 m_ec_tsig_k[indx1] = ( *iter_tof )->sigma( 3 );
1087 m_ec_tsig_p[indx1] = ( *iter_tof )->sigma( 4 );
1092 double path = ( *iter_tof )->path();
1093 double tof = ( *iter_tof )->tof();
1094 double ph = ( *iter_tof )->ph();
1095 double rhit = ( *iter_tof )->zrhit();
1096 double qual = 0.0 + ( *iter_tof )->quality();
1097 double cntr = 0.0 + ( *iter_tof )->tofID();
1099 for (
int j = 0; j < 5; j++ ) { texp[j] = ( *iter_tof )->texp( j ); }
1100 m_cntr_btof1[indx1] = cntr;
1101 m_ptot_btof1[indx1] = ptrk;
1102 m_ph_btof1[indx1] = ph;
1103 m_zhit_btof1[indx1] = rhit;
1104 m_qual_btof1[indx1] = qual;
1105 m_te_btof1[indx1] = tof - texp[0];
1106 m_tmu_btof1[indx1] = tof - texp[1];
1107 m_tpi_btof1[indx1] = tof - texp[2];
1108 m_tk_btof1[indx1] = tof - texp[3];
1109 m_tp_btof1[indx1] = tof - texp[4];
1111 m_b1_tof[indx1] = tof;
1113 m_b1_toff_e[indx1] = ( *iter_tof )->toffset( 0 );
1114 m_b1_toff_mu[indx1] = ( *iter_tof )->toffset( 1 );
1115 m_b1_toff_pi[indx1] = ( *iter_tof )->toffset( 2 );
1116 m_b1_toff_k[indx1] = ( *iter_tof )->toffset( 3 );
1117 m_b1_toff_p[indx1] = ( *iter_tof )->toffset( 4 );
1119 m_b1_tsig_e[indx1] = ( *iter_tof )->sigma( 0 );
1120 m_b1_tsig_mu[indx1] = ( *iter_tof )->sigma( 1 );
1121 m_b1_tsig_pi[indx1] = ( *iter_tof )->sigma( 2 );
1122 m_b1_tsig_k[indx1] = ( *iter_tof )->sigma( 3 );
1123 m_b1_tsig_p[indx1] = ( *iter_tof )->sigma( 4 );
1135 for (
int i = 0; i < m_ngch; i++ )
1153 m_dedx_pid[indx2] = pid->
chiDedx( 2 );
1154 m_tof1_pid[indx2] = pid->
chiTof1( 2 );
1155 m_tof2_pid[indx2] = pid->
chiTof2( 2 );
1156 m_prob_pid[indx2] = pid->
probPion();
1164 ( *itTrk )->mdcKalTrack();
1171 m_cost_pid[indx2] =
cos( mdcTrk->
theta() );
1173 HepLorentzVector ptrk;
1174 ptrk.setPx( mdcKalTrk->
px() );
1175 ptrk.setPy( mdcKalTrk->
py() );
1176 ptrk.setPz( mdcKalTrk->
pz() );
1177 double p3 = ptrk.mag();
1178 ptrk.setE( sqrt( p3 * p3 +
mpi *
mpi ) );
1180 m_ptrk_pid[indx2] = p3;
1184 ipnp.push_back( jGood[i] );
1185 ppnp.push_back( ptrk );
1189 ipnm.push_back( jGood[i] );
1190 ppnm.push_back( ptrk );
1193 int npnp = ipnp.size();
1194 int npnm = ipnm.size();
1200 for (
int i = 0; i < m_nggneu; i++ )
1203 if ( !( *itTrk )->isEmcShowerValid() )
continue;
1205 m_numHits[iphoton] = emcTrk->
numHits();
1207 m_x[iphoton] = emcTrk->
x();
1208 m_y[iphoton] = emcTrk->
y();
1209 m_z[iphoton] = emcTrk->
z();
1210 m_cosemc[iphoton] =
cos( emcTrk->
theta() );
1211 m_phiemc[iphoton] = emcTrk->
phi();
1212 m_energy[iphoton] = emcTrk->
energy();
1213 m_eSeed[iphoton] = emcTrk->
eSeed();
1214 m_e3x3[iphoton] = emcTrk->
e3x3();
1215 m_e5x5[iphoton] = emcTrk->
e5x5();
1221 m_tuple4->write().ignore();
1224 if ( kmfit->
chisq() >= chi5 )
return StatusCode::SUCCESS;
1225 if ( pgam2pi2.m() <= 1.0 )
return StatusCode::SUCCESS;
1226 if ( pgam2pi1.m() <= 1.0 )
return StatusCode::SUCCESS;
1227 if ( nGam != 2 )
return StatusCode::SUCCESS;
1228 if ( emcTg1 / extmot1 >= 0.8 )
return StatusCode::SUCCESS;
1229 if ( emcTg2 / extmot2 >= 0.8 )
return StatusCode::SUCCESS;
1234 if ( m_thsvc->getHist(
"/DQAHist/Rhopi/mpi0", h ).isSuccess() ) { h->Fill( ppi0.m() ); }
1235 else { log << MSG::ERROR <<
"Couldn't retrieve mpi0" << endmsg; }
1237 if ( fabs( ppi0.m() - 0.135 ) >= 0.015 )
return StatusCode::SUCCESS;
1240 if ( m_thsvc->getHist(
"/DQAHist/Rhopi/mrho0", h ).isSuccess() ) { h->Fill( prho0.m() ); }
1241 else { log << MSG::ERROR <<
"Couldn't retrieve mrho0" << endmsg; }
1243 if ( m_thsvc->getHist(
"/DQAHist/Rhopi/mrhop", h ).isSuccess() ) { h->Fill( prhop.m() ); }
1244 else { log << MSG::ERROR <<
"Couldn't retrieve mrhop" << endmsg; }
1246 if ( m_thsvc->getHist(
"/DQAHist/Rhopi/mrhom", h ).isSuccess() ) { h->Fill( prhom.m() ); }
1247 else { log << MSG::ERROR <<
"Couldn't retrieve mrhom" << endmsg; }
1251 ( *( evtRecTrkCol->begin() + ipip[0] ) )->setPartId( 3 );
1252 ( *( evtRecTrkCol->begin() + ipim[0] ) )->setPartId( 3 );
1260 ( *( evtRecTrkCol->begin() + ipip[0] ) )->setQuality( 0 );
1261 ( *( evtRecTrkCol->begin() + ipim[0] ) )->setQuality( 0 );
1263 setFilterPassed(
true );
1265 return StatusCode::SUCCESS;