105 MsgStream log(
msgSvc(), name() );
107 log << MSG::INFO <<
"in initialize()" << endmsg;
109 status = service(
"THistSvc", m_thistsvc );
110 if ( status.isFailure() )
112 log << MSG::INFO <<
"Unable to retrieve pointer to THistSvc" << endmsg;
116 m_ha_costheta =
new TH1F(
"PHY_HAD_SUM_costheta",
"PHY_HAD_SUM_costheta", 100, -1, 1 );
117 status = m_thistsvc->regHist(
"/DQAHist/Hadron/ha_costheta", m_ha_costheta );
118 m_ha_phi =
new TH1F(
"PHY_HAD_SUM_phi",
"PHY_HAD_SUM_phi", 128, -3.2, 3.2 );
119 status = m_thistsvc->regHist(
"/DQAHist/Hadron/ha_phi", m_ha_phi );
120 m_ha_pmax =
new TH1F(
"PHY_HAD_SUM_pmax",
"PHY_HAD_SUM_pmax", 100, 0, 2 );
121 status = m_thistsvc->regHist(
"/DQAHist/Hadron/ha_pmax", m_ha_pmax );
122 m_ha_emax =
new TH1F(
"PHY_HAD_SUM_emax",
"PHY_HAD_SUM_emax", 100, 0, 2 );
123 status = m_thistsvc->regHist(
"/DQAHist/Hadron/ha_emax", m_ha_emax );
124 m_ha_etot =
new TH1F(
"PHY_HAD_SUM_etot",
"PHY_HAD_SUM_etot", 100, 0, 4 );
125 status = m_thistsvc->regHist(
"/DQAHist/Hadron/ha_etot", m_ha_etot );
126 m_ha_br =
new TH1F(
"PHY_HAD_SUM_br",
"PHY_HAD_SUM_br", 100, 0, 2 );
127 status = m_thistsvc->regHist(
"/DQAHist/Hadron/ha_br", m_ha_br );
128 m_ha_bz =
new TH1F(
"PHY_HAD_SUM_bz",
"PHY_HAD_SUM_bz", 100, 0, 2 );
129 status = m_thistsvc->regHist(
"/DQAHist/Hadron/ha_bz", m_ha_bz );
130 m_ha_nneu =
new TH1I(
"PHY_HAD_SUM_nneu",
"PHY_HAD_SUM_nneu", 20, 0, 20 );
131 status = m_thistsvc->regHist(
"/DQAHist/Hadron/ha_nneu", m_ha_nneu );
132 m_ha_nchg =
new TH1I(
"PHY_HAD_SUM_nchg",
"PHY_HAD_SUM_nchg", 20, 0, 20 );
133 status = m_thistsvc->regHist(
"/DQAHist/Hadron/ha_nchg", m_ha_nchg );
135 m_ha_vx =
new TH1F(
"PHY_HAD_FLS_vx",
"PHY_HAD_FLS_vx", 100, -1., 1. );
136 status = m_thistsvc->regHist(
"/DQAHist/Hadron/ha_vx", m_ha_vx );
137 m_ha_vy =
new TH1F(
"PHY_HAD_FLS_vy",
"PHY_HAD_FLS_vy", 100, -1., 1. );
138 status = m_thistsvc->regHist(
"/DQAHist/Hadron/ha_vy", m_ha_vy );
139 m_ha_vz =
new TH1F(
"PHY_HAD_FLS_vz",
"PHY_HAD_FLS_vz", 100, -10.0, 10. );
140 status = m_thistsvc->regHist(
"/DQAHist/Hadron/ha_vz", m_ha_vz );
142 NTuplePtr nt1(
ntupleSvc(),
"DQAFILE/Hadron" );
143 if ( nt1 ) m_tuple1 = nt1;
146 m_tuple1 =
ntupleSvc()->book(
"DQAFILE/Hadron", CLID_ColumnWiseTuple,
"N-Tuple" );
149 status = m_tuple1->addItem(
"run", m_run );
150 status = m_tuple1->addItem(
"rec", m_rec );
151 status = m_tuple1->addItem(
"Nchrg", m_ncharg );
152 status = m_tuple1->addItem(
"Nneu", m_nneu, 0, 40 );
153 status = m_tuple1->addItem(
"NGch", m_ngch, 0, 40 );
154 status = m_tuple1->addItem(
"NGam", m_nGam );
156 status = m_tuple1->addItem(
"hadrontag", m_hadrontag );
158 status = m_tuple1->addItem(
"br", m_br );
159 status = m_tuple1->addItem(
"bz", m_bz );
160 status = m_tuple1->addItem(
"evis", m_evis );
161 status = m_tuple1->addItem(
"thr", m_thr );
163 status = m_tuple1->addItem(
"acoll", m_acoll );
164 status = m_tuple1->addItem(
"acopl", m_acopl );
165 status = m_tuple1->addItem(
"deltatof", m_deltatof );
166 status = m_tuple1->addItem(
"eop1", m_eop1 );
167 status = m_tuple1->addItem(
"eop2", m_eop2 );
168 status = m_tuple1->addItem(
"eoeb1", m_eoeb1 );
169 status = m_tuple1->addItem(
"eoeb2", m_eoeb2 );
170 status = m_tuple1->addItem(
"poeb1", m_poeb1 );
171 status = m_tuple1->addItem(
"poeb2", m_poeb2 );
172 status = m_tuple1->addItem(
"etoeb1", m_etoeb1 );
173 status = m_tuple1->addItem(
"etoeb2", m_etoeb2 );
174 status = m_tuple1->addItem(
"mucinfo1", m_mucinfo1 );
175 status = m_tuple1->addItem(
"mucinfo2", m_mucinfo2 );
177 status = m_tuple1->addIndexedItem(
"delang", m_nneu, m_delang );
178 status = m_tuple1->addIndexedItem(
"delphi", m_nneu, m_delphi );
179 status = m_tuple1->addIndexedItem(
"delthe", m_nneu, m_delthe );
180 status = m_tuple1->addIndexedItem(
"npart", m_nneu, m_npart );
181 status = m_tuple1->addIndexedItem(
"nemchits", m_nneu, m_nemchits );
182 status = m_tuple1->addIndexedItem(
"module", m_nneu, m_module );
183 status = m_tuple1->addIndexedItem(
"x", m_nneu, m_x );
184 status = m_tuple1->addIndexedItem(
"y", m_nneu, m_y );
185 status = m_tuple1->addIndexedItem(
"z", m_nneu, m_z );
189 status = m_tuple1->addIndexedItem(
"theta", m_nneu, m_theta );
190 status = m_tuple1->addIndexedItem(
"phi", m_nneu, m_phi );
191 status = m_tuple1->addIndexedItem(
"dx", m_nneu, m_dx );
192 status = m_tuple1->addIndexedItem(
"dy", m_nneu, m_dy );
193 status = m_tuple1->addIndexedItem(
"dz", m_nneu, m_dz );
194 status = m_tuple1->addIndexedItem(
"dtheta", m_nneu, m_dtheta );
195 status = m_tuple1->addIndexedItem(
"dphi", m_nneu, m_dphi );
196 status = m_tuple1->addIndexedItem(
"energy", m_nneu, m_energy );
197 status = m_tuple1->addIndexedItem(
"dE", m_nneu, m_dE );
198 status = m_tuple1->addIndexedItem(
"eSeed", m_nneu, m_eSeed );
199 status = m_tuple1->addIndexedItem(
"nSeed", m_nneu, m_nSeed );
200 status = m_tuple1->addIndexedItem(
"e3x3", m_nneu, m_e3x3 );
201 status = m_tuple1->addIndexedItem(
"e5x5", m_nneu, m_e5x5 );
202 status = m_tuple1->addIndexedItem(
"secondMoment", m_nneu, m_secondMoment );
203 status = m_tuple1->addIndexedItem(
"latMoment", m_nneu, m_latMoment );
204 status = m_tuple1->addIndexedItem(
"a20Moment", m_nneu, m_a20Moment );
205 status = m_tuple1->addIndexedItem(
"a42Moment", m_nneu, m_a42Moment );
206 status = m_tuple1->addIndexedItem(
"getTime", m_nneu, m_getTime );
207 status = m_tuple1->addIndexedItem(
"getEAll", m_nneu, m_getEAll );
209 status = m_tuple1->addIndexedItem(
"charge", m_ngch, m_charge );
210 status = m_tuple1->addIndexedItem(
"vx", m_ngch, m_vx0 );
211 status = m_tuple1->addIndexedItem(
"vy", m_ngch, m_vy0 );
212 status = m_tuple1->addIndexedItem(
"vz", m_ngch, m_vz0 );
214 status = m_tuple1->addIndexedItem(
"px", m_ngch, m_px );
215 status = m_tuple1->addIndexedItem(
"py", m_ngch, m_py );
216 status = m_tuple1->addIndexedItem(
"pz", m_ngch, m_pz );
217 status = m_tuple1->addIndexedItem(
"p", m_ngch, m_p );
219 status = m_tuple1->addIndexedItem(
"kal_vx", m_ngch, m_kal_vx0 );
220 status = m_tuple1->addIndexedItem(
"kal_vy", m_ngch, m_kal_vy0 );
221 status = m_tuple1->addIndexedItem(
"kal_vz", m_ngch, m_kal_vz0 );
223 status = m_tuple1->addIndexedItem(
"kal_px", m_ngch, m_kal_px );
224 status = m_tuple1->addIndexedItem(
"kal_py", m_ngch, m_kal_py );
225 status = m_tuple1->addIndexedItem(
"kal_pz", m_ngch, m_kal_pz );
226 status = m_tuple1->addIndexedItem(
"kal_p", m_ngch, m_kal_p );
228 status = m_tuple1->addIndexedItem(
"probPH", m_ngch, m_probPH );
229 status = m_tuple1->addIndexedItem(
"normPH", m_ngch, m_normPH );
230 status = m_tuple1->addIndexedItem(
"chie", m_ngch, m_chie );
231 status = m_tuple1->addIndexedItem(
"chimu", m_ngch, m_chimu );
232 status = m_tuple1->addIndexedItem(
"chipi", m_ngch, m_chipi );
233 status = m_tuple1->addIndexedItem(
"chik", m_ngch, m_chik );
234 status = m_tuple1->addIndexedItem(
"chip", m_ngch, m_chip );
235 status = m_tuple1->addIndexedItem(
"ghit", m_ngch, m_ghit );
236 status = m_tuple1->addIndexedItem(
"thit", m_ngch, m_thit );
238 status = m_tuple1->addIndexedItem(
"e_emc", m_ngch, m_e_emc );
239 status = m_tuple1->addIndexedItem(
"phi_emc", m_ngch, m_phi_emc );
240 status = m_tuple1->addIndexedItem(
"theta_emc", m_ngch, m_theta_emc );
242 status = m_tuple1->addIndexedItem(
"nhit_muc", m_ngch, m_nhit_muc );
243 status = m_tuple1->addIndexedItem(
"nlay_muc", m_ngch, m_nlay_muc );
244 status = m_tuple1->addIndexedItem(
"t_btof", m_ngch, m_t_btof );
245 status = m_tuple1->addIndexedItem(
"t_etof", m_ngch, m_t_etof );
246 status = m_tuple1->addIndexedItem(
"qual_etof", m_ngch, m_qual_etof );
247 status = m_tuple1->addIndexedItem(
"tof_etof", m_ngch, m_tof_etof );
248 status = m_tuple1->addIndexedItem(
"te_etof", m_ngch, m_te_etof );
249 status = m_tuple1->addIndexedItem(
"tmu_etof", m_ngch, m_tmu_etof );
250 status = m_tuple1->addIndexedItem(
"tpi_etof", m_ngch, m_tpi_etof );
251 status = m_tuple1->addIndexedItem(
"tk_etof", m_ngch, m_tk_etof );
252 status = m_tuple1->addIndexedItem(
"tp_etof", m_ngch, m_tp_etof );
254 status = m_tuple1->addIndexedItem(
"qual_btof1", m_ngch, m_qual_btof1 );
255 status = m_tuple1->addIndexedItem(
"tof_btof1", m_ngch, m_tof_btof1 );
256 status = m_tuple1->addIndexedItem(
"te_btof1", m_ngch, m_te_btof1 );
257 status = m_tuple1->addIndexedItem(
"tmu_btof1", m_ngch, m_tmu_btof1 );
258 status = m_tuple1->addIndexedItem(
"tpi_btof1", m_ngch, m_tpi_btof1 );
259 status = m_tuple1->addIndexedItem(
"tk_btof1", m_ngch, m_tk_btof1 );
260 status = m_tuple1->addIndexedItem(
"tp_btof1", m_ngch, m_tp_btof1 );
262 status = m_tuple1->addIndexedItem(
"qual_btof2", m_ngch, m_qual_btof2 );
263 status = m_tuple1->addIndexedItem(
"tof_btof2", m_ngch, m_tof_btof2 );
264 status = m_tuple1->addIndexedItem(
"te_btof2", m_ngch, m_te_btof2 );
265 status = m_tuple1->addIndexedItem(
"tmu_btof2", m_ngch, m_tmu_btof2 );
266 status = m_tuple1->addIndexedItem(
"tpi_btof2", m_ngch, m_tpi_btof2 );
267 status = m_tuple1->addIndexedItem(
"tk_btof2", m_ngch, m_tk_btof2 );
268 status = m_tuple1->addIndexedItem(
"tp_btof2", m_ngch, m_tp_btof2 );
269 status = m_tuple1->addIndexedItem(
"pidcode", m_ngch, m_pidcode );
270 status = m_tuple1->addIndexedItem(
"pidprob", m_ngch, m_pidprob );
271 status = m_tuple1->addIndexedItem(
"pidchiDedx", m_ngch, m_pidchiDedx );
272 status = m_tuple1->addIndexedItem(
"pidchiTof1", m_ngch, m_pidchiTof1 );
273 status = m_tuple1->addIndexedItem(
"pidchiTof2", m_ngch, m_pidchiTof2 );
275 status = m_tuple1->addItem(
"px_cms_ep", m_px_cms_ep );
276 status = m_tuple1->addItem(
"py_cms_ep", m_py_cms_ep );
277 status = m_tuple1->addItem(
"pz_cms_ep", m_pz_cms_ep );
278 status = m_tuple1->addItem(
"e_cms_ep", m_e_cms_ep );
279 status = m_tuple1->addItem(
"cos_ep", m_cos_ep );
280 status = m_tuple1->addItem(
"px_cms_em", m_px_cms_em );
281 status = m_tuple1->addItem(
"py_cms_em", m_py_cms_em );
282 status = m_tuple1->addItem(
"pz_cms_em", m_pz_cms_em );
283 status = m_tuple1->addItem(
"e_cms_em", m_e_cms_em );
284 status = m_tuple1->addItem(
"cos_em", m_cos_em );
285 status = m_tuple1->addItem(
"mass_ee", m_mass_ee );
286 status = m_tuple1->addItem(
"emax", m_emax );
287 status = m_tuple1->addItem(
"esum", m_esum );
288 status = m_tuple1->addItem(
"npip", m_npip );
289 status = m_tuple1->addItem(
"npim", m_npim );
290 status = m_tuple1->addItem(
"nkp", m_nkp );
291 status = m_tuple1->addItem(
"nkm", m_nkm );
292 status = m_tuple1->addItem(
"np", m_np );
293 status = m_tuple1->addItem(
"npb", m_npb );
295 status = m_tuple1->addItem(
"nep", m_nep );
296 status = m_tuple1->addItem(
"nem", m_nem );
297 status = m_tuple1->addItem(
"nmup", m_nmup );
298 status = m_tuple1->addItem(
"nmum", m_nmum );
302 log << MSG::ERROR <<
" Cannot book N-tuple:" << long( m_tuple1 ) << endmsg;
303 return StatusCode::FAILURE;
311 log << MSG::INFO <<
"successfully return from initialize()" << endmsg;
312 return StatusCode::SUCCESS;
317 setFilterPassed(
false );
318 const double beamEnergy = m_ecms / 2.;
319 const HepLorentzVector
p_cms( m_ecms *
sin( m_beamangle * 0.5 ), 0.0, 0.0, m_ecms );
320 const Hep3Vector
u_cms = -
p_cms.boostVector();
321 MsgStream log(
msgSvc(), name() );
322 log << MSG::INFO <<
"in execute()" << endmsg;
324 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc(),
"/Event/EventHeader" );
327 log << MSG::FATAL <<
"Could not find Event Header" << endmsg;
328 return StatusCode::SUCCESS;
331 m_run = eventHeader->runNumber();
332 m_rec = eventHeader->eventNumber();
337 log << MSG::FATAL <<
"Could not find EvtRecEvent" << endmsg;
338 return StatusCode::SUCCESS;
340 log << MSG::INFO <<
"ncharg, nneu, tottks = " << evtRecEvent->totalCharged() <<
" , "
341 << evtRecEvent->totalNeutral() <<
" , " << evtRecEvent->totalTracks() << endmsg;
343 m_ncharg = evtRecEvent->totalCharged();
345 m_nneu = evtRecEvent->totalNeutral();
348 HepSymMatrix Evx( 3, 0 );
352 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc ).ignore();
363 Evx[0][0] = vv[0] * vv[0];
364 Evx[0][1] = vv[0] * vv[1];
365 Evx[1][1] = vv[1] * vv[1];
366 Evx[1][2] = vv[1] * vv[2];
367 Evx[2][2] = vv[2] * vv[2];
374 log << MSG::FATAL <<
"Could not find EvtRecTrackCol" << endmsg;
375 return StatusCode::SUCCESS;
382 for (
int i = 0; i < evtRecEvent->totalCharged(); i++ )
385 if ( !( *itTrk )->isMdcTrackValid() )
continue;
386 if ( !( *itTrk )->isMdcKalTrackValid() )
continue;
389 double pch = mdcTrk->
p();
390 double x0 = mdcTrk->
x();
391 double y0 = mdcTrk->
y();
392 double z0 = mdcTrk->
z();
408 HepVector a = mdcTrk->
helix();
409 HepSymMatrix Ea = mdcTrk->
err();
412 VFHelix helixip( point0, a, Ea );
414 HepVector vecipa = helixip.
a();
415 double Rvxy0 = fabs( vecipa[0] );
416 double Rvz0 = vecipa[3];
417 double Rvphi0 = vecipa[1];
418 if ( fabs( Rvz0 ) >= m_vz0cut )
continue;
419 if ( fabs( Rvxy0 ) >= m_vr0cut )
continue;
424 iGood.push_back( i );
425 nCharge += mdcTrk->
charge();
431 int nGood = iGood.size();
433 log << MSG::DEBUG <<
"ngood, totcharge = " << nGood <<
" , " << nCharge << endmsg;
435 if ( m_ngch < 2 || m_ngch > 20 || ( nCharge > 4 ) ) {
return StatusCode::SUCCESS; }
441 Vint ipip, ipim, iep, iem, imup, imum;
452 for (
int i = 0; i < m_ngch; i++ )
475 HepLorentzVector ptrk;
476 ptrk.setPx( mdcTrk->
px() );
477 ptrk.setPy( mdcTrk->
py() );
478 ptrk.setPz( mdcTrk->
pz() );
479 double p3 = ptrk.mag();
482 m_pidprob[i] = pid->
prob( 1 );
483 m_pidchiDedx[i] = pid->
chiDedx( 1 );
484 m_pidchiTof1[i] = pid->
chiTof1( 1 );
485 m_pidchiTof2[i] = pid->
chiTof2( 1 );
486 if ( mdcTrk->
charge() > 0 ) { imup.push_back( iGood[i] ); }
487 if ( mdcTrk->
charge() < 0 ) { imum.push_back( iGood[i] ); }
492 m_nmup = imup.size();
493 m_nmum = imum.size();
503 for (
int i = evtRecEvent->totalCharged(); i < evtRecEvent->totalTracks(); i++ )
505 if ( i >= evtRecTrkCol->size() )
break;
507 if ( !( *itTrk )->isEmcShowerValid() )
continue;
509 Hep3Vector emcpos( emcTrk->
x(), emcTrk->
y(), emcTrk->
z() );
514 int module = emcTrk->
module();
515 double x = emcTrk->
x();
516 double y = emcTrk->
y();
517 double z = emcTrk->
z();
518 double dx = emcTrk->
dx();
519 double dy = emcTrk->
dy();
520 double dth = emcTrk->
dtheta();
521 double dph = emcTrk->
dphi();
522 double dz = emcTrk->
dz();
524 double dE = emcTrk->
dE();
525 double eSeed = emcTrk->
eSeed();
526 double e3x3 = emcTrk->
e3x3();
527 double e5x5 = emcTrk->
e5x5();
530 double getTime = emcTrk->
time();
531 double getEAll = emcTrk->
getEAll();
541 m_nemchits[iphoton] =
n;
542 m_npart[iphoton] = npart;
543 m_module[iphoton] =
module;
544 m_theta[iphoton] = EmcPos.theta();
545 m_phi[iphoton] = EmcPos.phi();
552 m_dtheta[iphoton] = dth;
553 m_dphi[iphoton] = dph;
554 m_energy[iphoton] =
energy;
556 m_eSeed[iphoton] = eSeed;
557 m_nSeed[iphoton] = nseed;
558 m_e3x3[iphoton] = e3x3;
559 m_e5x5[iphoton] = e5x5;
560 m_secondMoment[iphoton] = secondMoment;
561 m_latMoment[iphoton] = latMoment;
562 m_getTime[iphoton] = getTime;
563 m_getEAll[iphoton] = getEAll;
564 m_a20Moment[iphoton] = a20Moment;
565 m_a42Moment[iphoton] = a42Moment;
577 for (
int j = 0; j < nGood; j++ )
581 if ( !( *jtTrk )->isMdcTrackValid() )
continue;
583 double jtcharge = jtmdcTrk->
charge();
584 if ( !( *jtTrk )->isExtTrackValid() )
continue;
589 double angd = extpos.angle( emcpos );
590 double thed = extpos.theta() - emcpos.theta();
591 double phid = extpos.deltaPhi( emcpos );
592 thed = fmod( thed + CLHEP::twopi + CLHEP::twopi +
pi, CLHEP::twopi ) - CLHEP::pi;
593 phid = fmod( phid + CLHEP::twopi + CLHEP::twopi +
pi, CLHEP::twopi ) - CLHEP::pi;
595 if ( fabs( thed ) < fabs( dthe ) ) dthe = thed;
596 if ( fabs( phid ) < fabs( dphi ) ) dphi = phid;
597 if ( angd < dang ) dang = angd;
604 dthe = dthe * 180 / ( CLHEP::pi );
605 dphi = dphi * 180 / ( CLHEP::pi );
606 dang = dang * 180 / ( CLHEP::pi );
607 double eraw = emcTrk->
energy();
608 double phi = emcTrk->
phi();
609 double the = emcTrk->
theta();
611 m_delphi[iphoton] = dphi;
612 m_delthe[iphoton] = dthe;
613 m_delang[iphoton] = dang;
614 if (
energy < m_energyThreshold )
continue;
615 if ( getTime > m_gammathCut || getTime < m_gammatlCut )
continue;
617 if ( dang < m_gammaTrkCut )
continue;
620 if ( iphoton >= 40 )
return StatusCode::SUCCESS;
623 int nGam = iGam.size();
636 for (
int i = 0; i < m_nGam; i++ )
639 if ( !( *itTrk )->isEmcShowerValid() )
continue;
641 double eraw = emcTrk->
energy();
642 double phi = emcTrk->
phi();
643 double the = emcTrk->
theta();
644 HepLorentzVector ptrk;
645 ex_gam += eraw *
sin( the ) *
cos( phi );
646 ey_gam += eraw *
sin( the ) *
sin( phi );
647 ez_gam += eraw *
cos( the );
648 et_gam += eraw *
sin( the );
650 if ( eraw >= egam_ext ) { egam_ext = eraw; }
666 double ctrk_theta = -10;
667 double ctrk_phi = -10;
668 for (
int i = 0; i < m_ngch; i++ )
673 if ( !( *itTrk )->isMdcTrackValid() )
continue;
674 if ( !( *itTrk )->isMdcKalTrackValid() )
continue;
681 m_charge[i] = mdcTrk->
charge();
682 m_vx0[i] = mdcTrk->
x();
683 m_vy0[i] = mdcTrk->
y();
684 m_vz0[i] = mdcTrk->
z();
685 m_px[i] = mdcTrk->
px();
686 m_py[i] = mdcTrk->
py();
687 m_pz[i] = mdcTrk->
pz();
688 m_p[i] = mdcTrk->
p();
689 ctrk_theta = mdcTrk->
theta();
690 ctrk_phi = mdcTrk->
phi();
693 m_kal_vx0[i] = mdcKalTrk->
x();
694 m_kal_vy0[i] = mdcKalTrk->
y();
695 m_kal_vz0[i] = mdcKalTrk->
z();
697 m_kal_px[i] = mdcKalTrk->
px();
698 m_kal_py[i] = mdcKalTrk->
py();
699 m_kal_pz[i] = mdcKalTrk->
pz();
702 t_pxy2 = m_kal_px[i] * m_kal_px[i] + m_kal_py[i] * m_kal_py[i];
703 m_kal_p[i] = sqrt( t_pxy2 + m_kal_pz[i] * m_kal_pz[i] );
704 double ptrk = m_kal_p[i];
705 px_had += m_kal_px[i];
706 py_had += m_kal_py[i];
707 pz_had += m_kal_pz[i];
708 pt_had += sqrt( t_pxy2 );
710 e_had += sqrt( m_kal_p[i] * m_kal_p[i] +
xmass[2] *
xmass[2] );
711 if ( m_useDEDX && ( *itTrk )->isMdcDedxValid() )
715 m_probPH[i] = dedxTrk->
probPH();
716 m_normPH[i] = dedxTrk->
normPH();
718 m_chie[i] = dedxTrk->
chiE();
719 m_chimu[i] = dedxTrk->
chiMu();
720 m_chipi[i] = dedxTrk->
chiPi();
721 m_chik[i] = dedxTrk->
chiK();
722 m_chip[i] = dedxTrk->
chiP();
727 if ( ( *itTrk )->isEmcShowerValid() )
731 m_e_emc[i] = emcTrk->
energy();
732 m_phi_emc[i] = emcTrk->
phi();
733 m_theta_emc[i] = emcTrk->
theta();
734 if ( m_e_emc[i] > e_max )
744 m_theta_emc[i] = -10;
747 if ( m_useMUC && ( *itTrk )->isMucTrackValid() )
751 m_nhit_muc[i] = mucTrk->
numHits();
755 if ( m_useTOF && ( *itTrk )->isTofTrackValid() )
758 SmartRefVector<RecTofTrack> tofTrkCol = ( *itTrk )->tofTrack();
760 SmartRefVector<RecTofTrack>::iterator iter_tof = tofTrkCol.begin();
762 for ( ; iter_tof != tofTrkCol.end(); iter_tof++ )
765 status->
setStatus( ( *iter_tof )->status() );
769 if ( ( status->
is_cluster() ) ) m_t_etof[i] = ( *iter_tof )->tof();
772 if ( status )
delete status;
775 if ( status->
layer() != 0 )
777 if ( status )
delete status;
780 double path = ( *iter_tof )->path();
781 double tof = ( *iter_tof )->tof();
782 double ph = ( *iter_tof )->ph();
783 double rhit = ( *iter_tof )->zrhit();
784 double qual = 0.0 + ( *iter_tof )->quality();
785 double cntr = 0.0 + ( *iter_tof )->tofID();
787 for (
int j = 0; j < 5; j++ )
789 double gb = ptrk /
xmass[j];
790 double beta = gb / sqrt( 1 + gb * gb );
791 texp[j] = path / beta /
velc;
794 m_qual_etof[i] = qual;
799 if ( ( status->
is_cluster() ) ) m_t_btof[i] = ( *iter_tof )->tof();
802 if ( status )
delete status;
805 if ( status->
layer() == 1 )
807 double path = ( *iter_tof )->path();
808 double tof = ( *iter_tof )->tof();
809 double ph = ( *iter_tof )->ph();
810 double rhit = ( *iter_tof )->zrhit();
811 double qual = 0.0 + ( *iter_tof )->quality();
812 double cntr = 0.0 + ( *iter_tof )->tofID();
814 for (
int j = 0; j < 5; j++ )
816 double gb = ptrk /
xmass[j];
817 double beta = gb / sqrt( 1 + gb * gb );
818 texp[j] = path / beta /
velc;
821 m_qual_btof1[i] = qual;
822 m_tof_btof1[i] = tof;
825 if ( status->
layer() == 2 )
827 double path = ( *iter_tof )->path();
828 double tof = ( *iter_tof )->tof();
829 double ph = ( *iter_tof )->ph();
830 double rhit = ( *iter_tof )->zrhit();
831 double qual = 0.0 + ( *iter_tof )->quality();
832 double cntr = 0.0 + ( *iter_tof )->tofID();
834 for (
int j = 0; j < 5; j++ )
836 double gb = ptrk /
xmass[j];
837 double beta = gb / sqrt( 1 + gb * gb );
838 texp[j] = path / beta /
velc;
841 m_qual_btof2[i] = qual;
842 m_tof_btof2[i] = tof;
845 if ( status )
delete status;
854 if ( m_ngch != 2 ) m_hadrontag = 11111;
855 else if ( m_ngch == 2 && nCharge == 0 )
865 HepLorentzVector p41e, p42e, p4le;
866 Hep3Vector p31e, p32e, p3le;
867 HepLorentzVector p41m, p42m, p4lm;
868 Hep3Vector p31m, p32m, p3lm;
869 HepLorentzVector p41h, p42h, p4lh;
870 Hep3Vector p31h, p32h, p3lh;
875 for (
int i = 0; i < m_ngch; i++ )
877 if ( m_charge[i] > 0 ) itTrk1 = evtRecTrkCol->begin() + iGood[i];
878 if ( m_charge[i] < 0 ) itTrk2 = evtRecTrkCol->begin() + iGood[i];
879 if ( m_charge[i] > 0 ) mdcKalTrk1 = ( *itTrk1 )->mdcKalTrack();
880 if ( m_charge[i] < 0 ) mdcKalTrk2 = ( *itTrk2 )->mdcKalTrack();
881 if ( m_charge[i] > 0 ) iip = i;
882 if ( m_charge[i] < 0 ) iim = i;
884 if ( m_charge[i] > 0 )
886 if ( m_charge[i] < 0 )
888 if ( m_charge[i] > 0 ) p41h = w1_ini.
p();
889 if ( m_charge[i] < 0 ) p42h = w2_ini.
p();
890 if ( m_charge[i] > 0 ) p41h.boost(
u_cms );
891 if ( m_charge[i] < 0 ) p42h.boost(
u_cms );
892 if ( m_charge[i] > 0 ) p31h = p41h.vect();
893 if ( m_charge[i] < 0 ) p32h = p42h.vect();
895 if ( m_charge[i] > 0 ) p41e = w1_ini.
p();
896 if ( m_charge[i] < 0 ) p42e = w2_ini.
p();
897 if ( m_charge[i] > 0 ) p41e.boost(
u_cms );
898 if ( m_charge[i] < 0 ) p42e.boost(
u_cms );
899 if ( m_charge[i] > 0 ) p31e = p41e.vect();
900 if ( m_charge[i] < 0 ) p32e = p42e.vect();
902 if ( m_charge[i] > 0 )
904 m_px_cms_ep = p41h.px();
905 m_py_cms_ep = p41h.py();
906 m_pz_cms_ep = p41h.pz();
907 m_e_cms_ep = p41h.e();
909 if ( m_charge[i] < 0 )
911 m_px_cms_em = p42h.px();
912 m_py_cms_em = p42h.py();
913 m_pz_cms_em = p42h.pz();
914 m_e_cms_em = p42h.e();
917 double e01 = m_e_emc[iip];
918 double e02 = m_e_emc[iim];
920 int ilarge = ( e01 > e02 ) ? iip : iim;
922 p4lh = ( e01 > e02 ) ? p41h : p42h;
924 p3lh = ( e01 > e02 ) ? p31h : p32h;
926 double acollh = 180. - p31h.angle( p32h ) * 180.0 / CLHEP::pi;
927 double acoplh = 180. - ( p31h.perpPart() ).angle( p32h.perpPart() ) * 180.0 / CLHEP::pi;
928 double poeb1h = p41h.rho() / beamEnergy;
929 double poeb2h = p42h.rho() / beamEnergy;
930 double poeblh = p4lh.rho() / beamEnergy;
932 double eoeb1 = m_e_emc[iip] / beamEnergy;
933 double eoeb2 = m_e_emc[iim] / beamEnergy;
935 if ( p41h.rho() > 0 ) eop1 = m_e_emc[iip] / p41h.rho();
937 if ( p42h.rho() > 0 ) eop2 = m_e_emc[iim] / p42h.rho();
940 if ( p41e.rho() > 0 ) eope1 = m_e_emc[iip] / p41e.rho();
942 if ( p42e.rho() > 0 ) eope2 = m_e_emc[iim] / p42e.rho();
944 if ( p41m.rho() > 0 ) eopm1 = m_e_emc[iip] / p41m.rho();
946 if ( p42m.rho() > 0 ) eopm2 = m_e_emc[iim] / p42m.rho();
949 m_e_emc[iip] *
sin( m_theta_emc[iip] ) *
cos( m_phi_emc[iip] ) / beamEnergy;
951 m_e_emc[iip] *
sin( m_theta_emc[iip] ) *
sin( m_phi_emc[iip] ) / beamEnergy;
952 double ezoeb1 = m_e_emc[iip] *
cos( m_theta_emc[iip] ) / beamEnergy;
953 double etoeb1 = m_e_emc[iip] *
sin( m_theta_emc[iip] ) / beamEnergy;
956 m_e_emc[iim] *
sin( m_theta_emc[iim] ) *
cos( m_phi_emc[iim] ) / beamEnergy;
958 m_e_emc[iim] *
sin( m_theta_emc[iim] ) *
sin( m_phi_emc[iim] ) / beamEnergy;
959 double ezoeb2 = m_e_emc[iim] *
cos( m_theta_emc[iim] ) / beamEnergy;
960 double etoeb2 = m_e_emc[iim] *
sin( m_theta_emc[iim] ) / beamEnergy;
962 double eoebl = m_e_emc[ilarge] / beamEnergy;
965 if ( p4lh.rho() > 0 ) eopl = m_e_emc[ilarge] / p4lh.rho();
968 m_e_emc[ilarge] *
sin( m_theta_emc[ilarge] ) *
cos( m_phi_emc[ilarge] ) / beamEnergy;
970 m_e_emc[ilarge] *
sin( m_theta_emc[ilarge] ) *
sin( m_phi_emc[ilarge] ) / beamEnergy;
971 double ezoebl = m_e_emc[ilarge] *
cos( m_theta_emc[ilarge] ) / beamEnergy;
972 double etoebl = m_e_emc[ilarge] *
sin( m_theta_emc[ilarge] ) / beamEnergy;
974 int mucinfo1 = ( m_nhit_muc[iip] >= 2 && m_nlay_muc[iip] >= 2 ) ? 1 : 0;
975 int mucinfo2 = ( m_nhit_muc[iim] >= 2 && m_nlay_muc[iim] >= 2 ) ? 1 : 0;
976 int mucinfol = ( m_nhit_muc[ilarge] >= 2 && m_nlay_muc[ilarge] >= 2 ) ? 1 : 0;
977 int pidel = ( e01 > e02 ) ? m_nep : m_nem;
978 int pidmul = ( e01 > e02 ) ? m_nmup : m_nmum;
979 double deltatof = 0.0;
987 if ( m_t_btof[iip] * m_t_btof[iim] != 0 ) deltatof = fabs( m_t_btof[iip] - m_t_btof[iim] );
994 if ( ( acollh > m_acoll_h_cut ) || ( !m_useEMC || m_nGam >= m_ngam_h_cut ) )
996 if ( !m_useTOF || ( deltatof < m_dtof_h_cut ) ) m_hadrontag += 100;
997 if ( !m_useMUC || ( mucinfo1 == 0 || mucinfo2 == 0 ) ) m_hadrontag += 1000;
998 if ( !m_useEMC || ( fabs( eope1 - 1 ) > m_eop_h_cut && fabs( eope2 - 1 ) > m_eop_h_cut ) )
999 m_hadrontag += 10000;
1001 m_deltatof = deltatof;
1009 m_mucinfo1 = mucinfo1;
1010 m_mucinfo2 = mucinfo2;
1016 m_cos_ep = p41h.cosTheta();
1017 m_cos_em = p42h.cosTheta();
1018 m_mass_ee = ( p41h + p42h ).m();
1026 br = sqrt( ( px_had + ex_gam ) * ( px_had + ex_gam ) +
1027 ( py_had + ey_gam ) * ( py_had + ey_gam ) ) /
1028 ( pt_had + et_gam );
1029 bz = fabs( pz_had + ez_gam ) / ( p_had + e_gam );
1030 thr = p_had + e_gam;
1031 evis = e_had + e_gam;
1032 log << MSG::DEBUG <<
"hadron " << px_had <<
" " << py_had <<
" " << pz_had <<
" " << pt_had
1033 <<
" " << p_had <<
" " << br <<
" " << bz << endmsg;
1034 log << MSG::DEBUG <<
"Gamma " << ex_gam <<
" " << ey_gam <<
" " << ez_gam <<
" " << e_gam
1035 <<
" " << thr / beamEnergy << endmsg;
1036 if ( !m_useEMC || ( ( br < m_br_h_cut ) && ( bz < m_bz_h_cut ) ) ) m_hadrontag += 100000;
1037 if ( !m_useEMC || thr / beamEnergy > m_thr_h_cut ) m_hadrontag += 1000000;
1044 log << MSG::INFO <<
"m_hadrontag= " << m_hadrontag << endmsg;
1048 if ( m_hadrontag == 1111111 )
1051 for (
int i = 0; i < m_ngch; i++ )
1055 m_ha_costheta->Fill( ctrk_theta );
1056 m_ha_phi->Fill( ctrk_phi );
1060 RecMdcKalTrack* ktrk0 = ( *( evtRecTrkCol->begin() + iGood[0] ) )->mdcKalTrack();
1061 RecMdcKalTrack* ktrk1 = ( *( evtRecTrkCol->begin() + iGood[1] ) )->mdcKalTrack();
1062 RecMdcKalTrack* ktrk2 = ( *( evtRecTrkCol->begin() + iGood[2] ) )->mdcKalTrack();
1084 if ( fvtxfit->
Fit() )
1086 m_ha_vx->Fill( ( fvtxfit->
Vx() )[0] );
1087 m_ha_vy->Fill( ( fvtxfit->
Vx() )[1] );
1088 m_ha_vz->Fill( ( fvtxfit->
Vx() )[2] );
1092 m_ha_br->Fill( br );
1093 m_ha_bz->Fill( bz );
1094 m_ha_pmax->Fill( p_max );
1095 m_ha_emax->Fill( e_max );
1096 m_ha_etot->Fill( evis );
1097 m_ha_nneu->Fill( nGam );
1098 m_ha_nchg->Fill( m_ngch );
1099 if ( m_ngch == 0 ) { n0prong++; }
1100 if ( m_ngch == 2 && nCharge == 0 ) { n2prong++; }
1101 if ( m_ngch == 4 && nCharge == 0 ) { n4prong++; }
1103 if ( m_ngch > 4 ) { ng4prong++; }
1104 if ( m_writentuple ) m_tuple1->write().ignore();
1105 setFilterPassed(
true );
1108 return StatusCode::SUCCESS;