3#include "GaudiKernel/MsgStream.h"
4#include "GaudiKernel/AlgFactory.h"
5#include "GaudiKernel/ISvcLocator.h"
6#include "GaudiKernel/SmartDataPtr.h"
7#include "GaudiKernel/IDataProviderSvc.h"
8#include "GaudiKernel/PropertyMgr.h"
10#include "GaudiKernel/Bootstrap.h"
11#include "GaudiKernel/ISvcLocator.h"
22#include "GaudiKernel/INTupleSvc.h"
23#include "GaudiKernel/NTuple.h"
24#include "GaudiKernel/Bootstrap.h"
25#include "GaudiKernel/IHistogramSvc.h"
26#include "CLHEP/Vector/ThreeVector.h"
27#include "CLHEP/Vector/LorentzVector.h"
28#include "CLHEP/Vector/TwoVector.h"
30using CLHEP::Hep3Vector;
31using CLHEP::Hep2Vector;
32using CLHEP::HepLorentzVector;
33#include "CLHEP/Geometry/Point3D.h"
44#ifndef ENABLE_BACKWARDS_COMPATIBILITY
47using CLHEP::HepLorentzVector;
49const double mpi = 0.13957;
50const double mk = 0.493677;
51const double xmass[5] = {0.000511, 0.105658, 0.139570,0.493677, 0.938272};
52const double velc = 299.792458;
53typedef std::vector<int>
Vint;
54typedef std::vector<HepLorentzVector>
Vp4;
56static int counter[10]={0,0,0,0,0,0,0,0,0,0};
66 Algorithm(name, pSvcLocator) {
69 declareProperty(
"writentuple",m_writentuple =
false);
70 declareProperty(
"ecms",m_ecms = 3.097);
71 declareProperty(
"beamangle",m_beamangle = 0.022);
72 declareProperty(
"Vr0cut", m_vr0cut=1.0);
73 declareProperty(
"Vz0cut", m_vz0cut=10.0);
74 declareProperty(
"Coscut", m_coscut=0.93);
76 declareProperty(
"EnergyThreshold", m_energyThreshold=0.04);
77 declareProperty(
"GammaPhiCut", m_gammaPhiCut=20.0);
78 declareProperty(
"GammaThetaCut", m_gammaThetaCut=20.0);
79 declareProperty(
"GammaTrkCut", m_gammaTrkCut=20.0);
80 declareProperty(
"GammaTLCut", m_gammatlCut=0);
81 declareProperty(
"GammaTHCut", m_gammathCut=60);
85 declareProperty (
"acoll_h_cut", m_acoll_h_cut=10.);
86 declareProperty (
"poeb_h_cut", m_poeb_h_cut=0.2);
87 declareProperty (
"dtof_h_cut", m_dtof_h_cut=6.);
88 declareProperty (
"eop_h_cut", m_eop_h_cut=0.2);
89 declareProperty (
"etotal_h_cut", m_etotal_h_cut=0.2);
90 declareProperty (
"ngam_h_cut", m_ngam_h_cut=2);
91 declareProperty (
"br_h_cut", m_br_h_cut=0.65);
92 declareProperty (
"bz_h_cut", m_bz_h_cut=0.7);
93 declareProperty (
"thr_h_cut", m_thr_h_cut=0.5);
96 declareProperty (
"m_useEMConly", m_useEMConly=
false);
97 declareProperty (
"m_usePID", m_usePID=
false);
98 declareProperty (
"m_useMDC", m_useMDC=
true);
99 declareProperty (
"m_useDEDX", m_useDEDX=
false);
100 declareProperty (
"m_useTOF", m_useTOF=
false);
101 declareProperty (
"m_useEMC", m_useEMC=
true);
102 declareProperty (
"m_useMUC", m_useMUC=
false);
110 MsgStream log(
msgSvc(), name());
112 log << MSG::INFO <<
"in initialize()" << endmsg;
114 status = service(
"THistSvc", m_thistsvc);
115 if(status.isFailure() ){
116 log << MSG::INFO <<
"Unable to retrieve pointer to THistSvc" << endreq;
121 m_ha_costheta =
new TH1F(
"PHY_HAD_SUM_costheta",
"PHY_HAD_SUM_costheta", 100, -1, 1 );
122 status = m_thistsvc->regHist(
"/DQAHist/Hadron/ha_costheta", m_ha_costheta);
123 m_ha_phi =
new TH1F(
"PHY_HAD_SUM_phi",
"PHY_HAD_SUM_phi", 128, -3.2, 3.2 );
124 status = m_thistsvc->regHist(
"/DQAHist/Hadron/ha_phi", m_ha_phi);
125 m_ha_pmax =
new TH1F(
"PHY_HAD_SUM_pmax",
"PHY_HAD_SUM_pmax", 100, 0, 2 );
126 status = m_thistsvc->regHist(
"/DQAHist/Hadron/ha_pmax", m_ha_pmax);
127 m_ha_emax =
new TH1F(
"PHY_HAD_SUM_emax",
"PHY_HAD_SUM_emax", 100, 0, 2 );
128 status = m_thistsvc->regHist(
"/DQAHist/Hadron/ha_emax", m_ha_emax);
129 m_ha_etot =
new TH1F(
"PHY_HAD_SUM_etot",
"PHY_HAD_SUM_etot", 100, 0, 4 );
130 status = m_thistsvc->regHist(
"/DQAHist/Hadron/ha_etot", m_ha_etot);
131 m_ha_br =
new TH1F(
"PHY_HAD_SUM_br",
"PHY_HAD_SUM_br", 100, 0, 2 );
132 status = m_thistsvc->regHist(
"/DQAHist/Hadron/ha_br", m_ha_br);
133 m_ha_bz =
new TH1F(
"PHY_HAD_SUM_bz",
"PHY_HAD_SUM_bz", 100, 0, 2 );
134 status = m_thistsvc->regHist(
"/DQAHist/Hadron/ha_bz", m_ha_bz);
135 m_ha_nneu =
new TH1I(
"PHY_HAD_SUM_nneu",
"PHY_HAD_SUM_nneu", 20, 0, 20 );
136 status = m_thistsvc->regHist(
"/DQAHist/Hadron/ha_nneu", m_ha_nneu);
137 m_ha_nchg =
new TH1I(
"PHY_HAD_SUM_nchg",
"PHY_HAD_SUM_nchg", 20, 0, 20 );
138 status = m_thistsvc->regHist(
"/DQAHist/Hadron/ha_nchg", m_ha_nchg);
140 m_ha_vx =
new TH1F(
"PHY_HAD_FLS_vx",
"PHY_HAD_FLS_vx", 100, -1., 1.);
141 status = m_thistsvc->regHist(
"/DQAHist/Hadron/ha_vx", m_ha_vx);
142 m_ha_vy =
new TH1F(
"PHY_HAD_FLS_vy",
"PHY_HAD_FLS_vy", 100, -1., 1.);
143 status = m_thistsvc->regHist(
"/DQAHist/Hadron/ha_vy", m_ha_vy);
144 m_ha_vz =
new TH1F(
"PHY_HAD_FLS_vz",
"PHY_HAD_FLS_vz", 100, -10.0, 10.);
145 status = m_thistsvc->regHist(
"/DQAHist/Hadron/ha_vz", m_ha_vz);
152NTuplePtr nt1(
ntupleSvc(),
"DQAFILE/Hadron");
153if ( nt1 ) m_tuple1 = nt1;
155 m_tuple1 =
ntupleSvc()->book (
"DQAFILE/Hadron", CLID_ColumnWiseTuple,
"N-Tuple");
157 status = m_tuple1->addItem (
"run", m_run);
158 status = m_tuple1->addItem (
"rec", m_rec);
159 status = m_tuple1->addItem (
"Nchrg", m_ncharg);
160 status = m_tuple1->addItem (
"Nneu", m_nneu,0,40);
161 status = m_tuple1->addItem (
"NGch", m_ngch, 0, 40);
162 status = m_tuple1->addItem (
"NGam", m_nGam);
165 status = m_tuple1->addItem (
"hadrontag", m_hadrontag);
167 status = m_tuple1->addItem (
"br", m_br);
168 status = m_tuple1->addItem (
"bz", m_bz);
169 status = m_tuple1->addItem (
"evis", m_evis);
170 status = m_tuple1->addItem (
"thr", m_thr);
172 status = m_tuple1->addItem (
"acoll", m_acoll);
173 status = m_tuple1->addItem (
"acopl", m_acopl);
174 status = m_tuple1->addItem (
"deltatof", m_deltatof);
175 status = m_tuple1->addItem (
"eop1", m_eop1);
176 status = m_tuple1->addItem (
"eop2", m_eop2);
177 status = m_tuple1->addItem (
"eoeb1", m_eoeb1);
178 status = m_tuple1->addItem (
"eoeb2", m_eoeb2);
179 status = m_tuple1->addItem (
"poeb1", m_poeb1);
180 status = m_tuple1->addItem (
"poeb2", m_poeb2);
181 status = m_tuple1->addItem (
"etoeb1", m_etoeb1);
182 status = m_tuple1->addItem (
"etoeb2", m_etoeb2);
183 status = m_tuple1->addItem (
"mucinfo1", m_mucinfo1);
184 status = m_tuple1->addItem (
"mucinfo2", m_mucinfo2);
186 status = m_tuple1->addIndexedItem (
"delang",m_nneu, m_delang);
187 status = m_tuple1->addIndexedItem (
"delphi",m_nneu, m_delphi);
188 status = m_tuple1->addIndexedItem (
"delthe",m_nneu, m_delthe);
189 status = m_tuple1->addIndexedItem (
"npart",m_nneu, m_npart);
190 status = m_tuple1->addIndexedItem (
"nemchits",m_nneu, m_nemchits);
191 status = m_tuple1->addIndexedItem (
"module",m_nneu, m_module);
192 status = m_tuple1->addIndexedItem (
"x",m_nneu, m_x);
193 status = m_tuple1->addIndexedItem (
"y",m_nneu, m_y);
194 status = m_tuple1->addIndexedItem (
"z",m_nneu, m_z);
195 status = m_tuple1->addIndexedItem (
"px",m_nneu, m_px);
196 status = m_tuple1->addIndexedItem (
"py",m_nneu, m_py);
197 status = m_tuple1->addIndexedItem (
"pz",m_nneu, m_pz);
198 status = m_tuple1->addIndexedItem (
"theta",m_nneu, m_theta);
199 status = m_tuple1->addIndexedItem (
"phi",m_nneu, m_phi);
200 status = m_tuple1->addIndexedItem (
"dx",m_nneu, m_dx);
201 status = m_tuple1->addIndexedItem (
"dy",m_nneu, m_dy);
202 status = m_tuple1->addIndexedItem (
"dz",m_nneu, m_dz);
203 status = m_tuple1->addIndexedItem (
"dtheta",m_nneu, m_dtheta);
204 status = m_tuple1->addIndexedItem (
"dphi",m_nneu, m_dphi);
205 status = m_tuple1->addIndexedItem (
"energy",m_nneu, m_energy);
206 status = m_tuple1->addIndexedItem (
"dE",m_nneu, m_dE);
207 status = m_tuple1->addIndexedItem (
"eSeed",m_nneu, m_eSeed);
208 status = m_tuple1->addIndexedItem (
"nSeed",m_nneu, m_nSeed);
209 status = m_tuple1->addIndexedItem (
"e3x3",m_nneu, m_e3x3);
210 status = m_tuple1->addIndexedItem (
"e5x5",m_nneu, m_e5x5);
211 status = m_tuple1->addIndexedItem (
"secondMoment",m_nneu, m_secondMoment);
212 status = m_tuple1->addIndexedItem (
"latMoment",m_nneu, m_latMoment);
213 status = m_tuple1->addIndexedItem (
"a20Moment",m_nneu, m_a20Moment);
214 status = m_tuple1->addIndexedItem (
"a42Moment",m_nneu, m_a42Moment);
215 status = m_tuple1->addIndexedItem (
"getTime",m_nneu, m_getTime);
216 status = m_tuple1->addIndexedItem (
"getEAll",m_nneu, m_getEAll);
220 status = m_tuple1->addIndexedItem(
"charge", m_ngch, m_charge);
221 status = m_tuple1->addIndexedItem (
"vx", m_ngch, m_vx0);
222 status = m_tuple1->addIndexedItem (
"vy", m_ngch, m_vy0);
223 status = m_tuple1->addIndexedItem (
"vz", m_ngch, m_vz0);
226 status = m_tuple1->addIndexedItem (
"px", m_ngch, m_px) ;
227 status = m_tuple1->addIndexedItem (
"py", m_ngch, m_py) ;
228 status = m_tuple1->addIndexedItem (
"pz", m_ngch, m_pz) ;
229 status = m_tuple1->addIndexedItem (
"p", m_ngch, m_p) ;
233 status = m_tuple1->addIndexedItem (
"kal_vx", m_ngch, m_kal_vx0);
234 status = m_tuple1->addIndexedItem (
"kal_vy", m_ngch, m_kal_vy0);
235 status = m_tuple1->addIndexedItem (
"kal_vz", m_ngch, m_kal_vz0);
238 status = m_tuple1->addIndexedItem (
"kal_px", m_ngch, m_kal_px) ;
239 status = m_tuple1->addIndexedItem (
"kal_py", m_ngch, m_kal_py) ;
240 status = m_tuple1->addIndexedItem (
"kal_pz", m_ngch, m_kal_pz) ;
241 status = m_tuple1->addIndexedItem (
"kal_p", m_ngch, m_kal_p) ;
244 status = m_tuple1->addIndexedItem (
"probPH" , m_ngch, m_probPH) ;
245 status = m_tuple1->addIndexedItem (
"normPH" , m_ngch, m_normPH) ;
246 status = m_tuple1->addIndexedItem (
"chie" , m_ngch, m_chie) ;
247 status = m_tuple1->addIndexedItem (
"chimu" , m_ngch, m_chimu) ;
248 status = m_tuple1->addIndexedItem (
"chipi" , m_ngch, m_chipi) ;
249 status = m_tuple1->addIndexedItem (
"chik" , m_ngch, m_chik) ;
250 status = m_tuple1->addIndexedItem (
"chip" , m_ngch, m_chip) ;
251 status = m_tuple1->addIndexedItem (
"ghit" , m_ngch, m_ghit) ;
252 status = m_tuple1->addIndexedItem (
"thit" , m_ngch, m_thit) ;
254 status = m_tuple1->addIndexedItem (
"e_emc" , m_ngch, m_e_emc) ;
255 status = m_tuple1->addIndexedItem (
"phi_emc" , m_ngch, m_phi_emc) ;
256 status = m_tuple1->addIndexedItem (
"theta_emc" , m_ngch, m_theta_emc) ;
258 status = m_tuple1->addIndexedItem (
"nhit_muc" , m_ngch, m_nhit_muc) ;
259 status = m_tuple1->addIndexedItem (
"nlay_muc" , m_ngch, m_nlay_muc) ;
260 status = m_tuple1->addIndexedItem (
"t_btof" , m_ngch, m_t_btof );
261 status = m_tuple1->addIndexedItem (
"t_etof" , m_ngch, m_t_etof );
262 status = m_tuple1->addIndexedItem (
"qual_etof" , m_ngch, m_qual_etof );
263 status = m_tuple1->addIndexedItem (
"tof_etof" , m_ngch, m_tof_etof );
264 status = m_tuple1->addIndexedItem (
"te_etof" , m_ngch, m_te_etof );
265 status = m_tuple1->addIndexedItem (
"tmu_etof" , m_ngch, m_tmu_etof );
266 status = m_tuple1->addIndexedItem (
"tpi_etof" , m_ngch, m_tpi_etof );
267 status = m_tuple1->addIndexedItem (
"tk_etof" , m_ngch, m_tk_etof );
268 status = m_tuple1->addIndexedItem (
"tp_etof" , m_ngch, m_tp_etof );
270 status = m_tuple1->addIndexedItem (
"qual_btof1", m_ngch, m_qual_btof1 );
271 status = m_tuple1->addIndexedItem (
"tof_btof1" , m_ngch, m_tof_btof1 );
272 status = m_tuple1->addIndexedItem (
"te_btof1" , m_ngch, m_te_btof1 );
273 status = m_tuple1->addIndexedItem (
"tmu_btof1" , m_ngch, m_tmu_btof1 );
274 status = m_tuple1->addIndexedItem (
"tpi_btof1" , m_ngch, m_tpi_btof1 );
275 status = m_tuple1->addIndexedItem (
"tk_btof1" , m_ngch, m_tk_btof1 );
276 status = m_tuple1->addIndexedItem (
"tp_btof1" , m_ngch, m_tp_btof1 );
278 status = m_tuple1->addIndexedItem (
"qual_btof2", m_ngch, m_qual_btof2 );
279 status = m_tuple1->addIndexedItem (
"tof_btof2" , m_ngch, m_tof_btof2 );
280 status = m_tuple1->addIndexedItem (
"te_btof2" , m_ngch, m_te_btof2 );
281 status = m_tuple1->addIndexedItem (
"tmu_btof2" , m_ngch, m_tmu_btof2 );
282 status = m_tuple1->addIndexedItem (
"tpi_btof2" , m_ngch, m_tpi_btof2 );
283 status = m_tuple1->addIndexedItem (
"tk_btof2" , m_ngch, m_tk_btof2 );
284 status = m_tuple1->addIndexedItem (
"tp_btof2" , m_ngch, m_tp_btof2 );
285 status = m_tuple1->addIndexedItem (
"pidcode" , m_ngch, m_pidcode);
286 status = m_tuple1->addIndexedItem (
"pidprob" , m_ngch, m_pidprob);
287 status = m_tuple1->addIndexedItem (
"pidchiDedx" , m_ngch, m_pidchiDedx);
288 status = m_tuple1->addIndexedItem (
"pidchiTof1" , m_ngch, m_pidchiTof1);
289 status = m_tuple1->addIndexedItem (
"pidchiTof2" , m_ngch, m_pidchiTof2);
291 status = m_tuple1->addItem (
"px_cms_ep", m_px_cms_ep);
292 status = m_tuple1->addItem (
"py_cms_ep", m_py_cms_ep);
293 status = m_tuple1->addItem (
"pz_cms_ep", m_pz_cms_ep);
294 status = m_tuple1->addItem (
"e_cms_ep", m_e_cms_ep);
295 status = m_tuple1->addItem (
"cos_ep", m_cos_ep);
296 status = m_tuple1->addItem (
"px_cms_em", m_px_cms_em);
297 status = m_tuple1->addItem (
"py_cms_em", m_py_cms_em);
298 status = m_tuple1->addItem (
"pz_cms_em", m_pz_cms_em);
299 status = m_tuple1->addItem (
"e_cms_em", m_e_cms_em);
300 status = m_tuple1->addItem (
"cos_em", m_cos_em);
301 status = m_tuple1->addItem (
"mass_ee", m_mass_ee);
302 status = m_tuple1->addItem (
"emax", m_emax);
303 status = m_tuple1->addItem (
"esum", m_esum);
304 status = m_tuple1->addItem (
"npip", m_npip );
305 status = m_tuple1->addItem (
"npim", m_npim );
306 status = m_tuple1->addItem (
"nkp", m_nkp );
307 status = m_tuple1->addItem (
"nkm", m_nkm );
308 status = m_tuple1->addItem (
"np", m_np );
309 status = m_tuple1->addItem (
"npb", m_npb );
311 status = m_tuple1->addItem (
"nep", m_nep );
312 status = m_tuple1->addItem (
"nem", m_nem );
313 status = m_tuple1->addItem (
"nmup", m_nmup );
314 status = m_tuple1->addItem (
"nmum", m_nmum );
318 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple1) << endmsg;
319 return StatusCode::FAILURE;
327log << MSG::INFO <<
"successfully return from initialize()" <<endmsg;
328return StatusCode::SUCCESS;
337 setFilterPassed(
false);
338 const double beamEnergy = m_ecms/2.;
339 const HepLorentzVector
p_cms(m_ecms*
sin(m_beamangle*0.5),0.0,0.0,m_ecms);
340 const Hep3Vector
u_cms = -
p_cms.boostVector();
341 MsgStream log(
msgSvc(), name());
342 log << MSG::INFO <<
"in execute()" << endreq;
345 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
348 log << MSG::FATAL <<
"Could not find Event Header" << endreq;
349 return StatusCode::SUCCESS;
352 m_run = eventHeader->runNumber();
353 m_rec = eventHeader->eventNumber();
361 log << MSG::FATAL <<
"Could not find EvtRecEvent" << endreq;
362 return StatusCode::SUCCESS;
364 log << MSG::INFO <<
"ncharg, nneu, tottks = "
365 << evtRecEvent->totalCharged() <<
" , "
366 << evtRecEvent->totalNeutral() <<
" , "
367 << evtRecEvent->totalTracks() <<endreq;
369 m_ncharg = evtRecEvent->totalCharged();
371 m_nneu = evtRecEvent->totalNeutral();
376 HepSymMatrix Evx(3, 0);
378 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc);
388 Evx[0][0]=vv[0]*vv[0];
389 Evx[0][1]=vv[0]*vv[1];
390 Evx[1][1]=vv[1]*vv[1];
391 Evx[1][2]=vv[1]*vv[2];
392 Evx[2][2]=vv[2]*vv[2];
398 log << MSG::FATAL <<
"Could not find EvtRecTrackCol" << endreq;
399 return StatusCode::SUCCESS;
406 for(
int i = 0; i < evtRecEvent->totalCharged(); i++){
408 if(!(*itTrk)->isMdcTrackValid())
continue;
409 if(!(*itTrk)->isMdcKalTrackValid())
continue;
412 double pch=mdcTrk->
p();
413 double x0=mdcTrk->
x();
414 double y0=mdcTrk->
y();
415 double z0=mdcTrk->
z();
433 HepVector a = mdcTrk->
helix();
434 HepSymMatrix Ea = mdcTrk->
err();
439 HepVector vecipa = helixip.
a();
440 double Rvxy0=fabs(vecipa[0]);
441 double Rvz0=vecipa[3];
442 double Rvphi0=vecipa[1];
443 if(fabs(Rvz0) >= m_vr0cut)
continue;
444 if(fabs(Rvxy0) >= m_vr0cut)
continue;
451 nCharge += mdcTrk->
charge();
462 int nGood = iGood.size();
464 log << MSG::DEBUG <<
"ngood, totcharge = " << nGood <<
" , " << nCharge << endreq;
467 if(m_ngch<2 ||m_ngch>20||(nCharge >4) ) {
return StatusCode::SUCCESS; }
473 Vint ipip, ipim, iep,iem,imup,imum;
483 for(
int i = 0; i < m_ngch; i++) {
503 HepLorentzVector ptrk;
504 ptrk.setPx(mdcTrk->
px()) ;
505 ptrk.setPy(mdcTrk->
py()) ;
506 ptrk.setPz(mdcTrk->
pz()) ;
507 double p3 = ptrk.mag() ;
512 m_pidprob[i]=pid->
prob(1);
513 m_pidchiDedx[i]=pid->
chiDedx(1);
514 m_pidchiTof1[i]=pid->
chiTof1(1);
515 m_pidchiTof2[i]=pid->
chiTof2(1);
516 if(mdcTrk->
charge() > 0) {
517 imup.push_back(iGood[i]);
520 if (mdcTrk->
charge() < 0) {
521 imum.push_back(iGood[i]);
530 m_nmup = imup.size() ;
531 m_nmum = imum.size() ;
541 for(
int i = evtRecEvent->totalCharged(); i< evtRecEvent->totalTracks(); i++) {
542 if(i>=evtRecTrkCol->size())
break;
544 if(!(*itTrk)->isEmcShowerValid())
continue;
546 Hep3Vector emcpos(emcTrk->
x(), emcTrk->
y(), emcTrk->
z());
551 int module=emcTrk->
module();
552 double x = emcTrk->
x();
553 double y = emcTrk->
y();
554 double z = emcTrk->
z();
555 double dx = emcTrk->
dx();
556 double dy = emcTrk->
dy();
557 double dth = emcTrk->
dtheta();
558 double dph = emcTrk->
dphi();
559 double dz = emcTrk->
dz();
561 double dE = emcTrk->
dE();
562 double eSeed = emcTrk->
eSeed();
563 double e3x3 = emcTrk->
e3x3();
564 double e5x5 = emcTrk->
e5x5();
567 double getTime = emcTrk->
time();
568 double getEAll = emcTrk->
getEAll();
578 m_nemchits[iphoton]=
n;
579 m_npart[iphoton]=npart;
580 m_module[iphoton]=module;
581 m_theta[iphoton]=EmcPos.theta();
582 m_phi[iphoton]=EmcPos.phi();
589 m_dtheta[iphoton]=dth;
593 m_eSeed[iphoton]=eSeed;
594 m_nSeed[iphoton]=nseed;
595 m_e3x3[iphoton]=e3x3;
596 m_e5x5[iphoton]=e5x5;
597 m_secondMoment[iphoton]=secondMoment;
598 m_latMoment[iphoton]=latMoment;
599 m_getTime[iphoton]=getTime;
600 m_getEAll[iphoton]=getEAll;
601 m_a20Moment[iphoton]=a20Moment;
602 m_a42Moment[iphoton]=a42Moment;
614 for(
int j = 0; j < nGood; j++) {
618 if (!(*jtTrk)->isMdcTrackValid())
continue;
620 double jtcharge = jtmdcTrk->
charge();
621 if(!(*jtTrk)->isExtTrackValid())
continue;
626 double angd = extpos.angle(emcpos);
627 double thed = extpos.theta() - emcpos.theta();
628 double phid = extpos.deltaPhi(emcpos);
629 thed = fmod(thed+CLHEP::twopi+CLHEP::twopi+
pi, CLHEP::twopi) - CLHEP::pi;
630 phid = fmod(phid+CLHEP::twopi+CLHEP::twopi+
pi, CLHEP::twopi) - CLHEP::pi;
632 if(fabs(thed) < fabs(dthe)) dthe = thed;
633 if(fabs(phid) < fabs(dphi)) dphi = phid;
634 if(angd < dang) dang = angd;
644 dthe = dthe * 180 / (CLHEP::pi);
645 dphi = dphi * 180 / (CLHEP::pi);
646 dang = dang * 180 / (CLHEP::pi);
647 double eraw = emcTrk->
energy();
648 double phi = emcTrk->
phi();
649 double the = emcTrk->
theta();
651 m_delphi[iphoton]=dphi;
652 m_delthe[iphoton]=dthe;
653 m_delang[iphoton]=dang;
654 if(
energy < m_energyThreshold)
continue;
655 if(getTime>m_gammathCut||getTime<m_gammatlCut)
continue;
657 if(dang< m_gammaTrkCut)
continue;
660 if(iphoton>=40)
return StatusCode::SUCCESS;
663 int nGam = iGam.size();
675 for(
int i = 0; i < m_nGam; i++) {
677 if(!(*itTrk)->isEmcShowerValid())
continue;
679 double eraw = emcTrk->
energy();
680 double phi = emcTrk->
phi();
681 double the = emcTrk->
theta();
682 HepLorentzVector ptrk;
683 ex_gam+=eraw*
sin(the)*
cos(phi);
684 ey_gam+=eraw*
sin(the)*
sin(phi);
685 ez_gam+=eraw*
cos(the);
686 et_gam+=eraw*
sin(the);
713 for(
int i = 0; i < m_ngch; i++ ){
717 if(!(*itTrk)->isMdcTrackValid())
continue;
718 if(!(*itTrk)->isMdcKalTrackValid())
continue;
726 m_charge[i] = mdcTrk->
charge();
727 m_vx0[i] = mdcTrk->
x();
728 m_vy0[i] = mdcTrk->
y();
729 m_vz0[i] = mdcTrk->
z();
730 m_px[i] = mdcTrk->
px();
731 m_py[i] = mdcTrk->
py();
732 m_pz[i] = mdcTrk->
pz();
733 m_p[i] = mdcTrk->
p();
734 m_theta[i]=mdcTrk->
theta();
735 m_phi[i]=mdcTrk->
phi();
737 double ptrk = mdcKalTrk->
p() ;
738 m_kal_vx0[i] = mdcKalTrk->
x();
739 m_kal_vy0[i] = mdcKalTrk->
y();
740 m_kal_vz0[i] = mdcKalTrk->
z();
743 m_kal_px[i] = mdcKalTrk->
px();
744 m_kal_py[i] = mdcKalTrk->
py();
745 m_kal_pz[i] = mdcKalTrk->
pz();
746 m_kal_p[i] = mdcKalTrk->
p();
747 px_had+=mdcKalTrk->
px();
748 py_had+=mdcKalTrk->
py();
749 pz_had+=mdcKalTrk->
pz();
750 pt_had+=mdcKalTrk->
pxy();
751 p_had+=mdcKalTrk->
p();
752 e_had+=sqrt(mdcKalTrk->
p()*mdcKalTrk->
p()+
xmass[2]*
xmass[2]);
753 if(m_useDEDX&&(*itTrk)->isMdcDedxValid()) {
756 m_probPH[i]= dedxTrk->
probPH();
757 m_normPH[i]= dedxTrk->
normPH();
759 m_chie[i] = dedxTrk->
chiE();
760 m_chimu[i] = dedxTrk->
chiMu();
761 m_chipi[i] = dedxTrk->
chiPi();
762 m_chik[i] = dedxTrk->
chiK();
763 m_chip[i] = dedxTrk->
chiP();
768 if((*itTrk)->isEmcShowerValid()) {
771 m_e_emc[i] = emcTrk->
energy();
772 m_phi_emc[i] = emcTrk->
phi();
773 m_theta_emc[i] = emcTrk->
theta();
774 if(m_e_emc[i]>e_max){
782 if(m_useMUC&&(*itTrk)->isMucTrackValid()){
785 m_nhit_muc[i] = mucTrk->
numHits() ;
791 if(m_useTOF&&(*itTrk)->isTofTrackValid()) {
793 SmartRefVector<RecTofTrack> tofTrkCol = (*itTrk)->tofTrack();
795 SmartRefVector<RecTofTrack>::iterator iter_tof = tofTrkCol.begin();
797 for(;iter_tof != tofTrkCol.end(); iter_tof++ ) {
799 status->
setStatus((*iter_tof)->status());
802 if( (status->
is_cluster()) ) m_t_etof[i] = (*iter_tof)->tof();
803 if( !(status->
is_counter()) ){
if(status)
delete status;
continue;}
804 if( status->
layer()!=0 ){
if(status)
delete status;
continue;}
805 double path=(*iter_tof)->path();
806 double tof = (*iter_tof)->tof();
807 double ph = (*iter_tof)->ph();
808 double rhit = (*iter_tof)->zrhit();
809 double qual = 0.0 + (*iter_tof)->quality();
810 double cntr = 0.0 + (*iter_tof)->tofID();
812 for(
int j = 0; j < 5; j++) {
813 double gb = ptrk/
xmass[j];
814 double beta = gb/sqrt(1+gb*gb);
815 texp[j] = path /beta/
velc;
818 m_qual_etof[i] = qual;
819 m_tof_etof[i] = tof ;
822 if( (status->
is_cluster()) ) m_t_btof[i] = (*iter_tof)->tof();
823 if( !(status->
is_counter()) ){
if(status)
delete status;
continue;}
824 if(status->
layer()==1){
825 double path=(*iter_tof)->path();
826 double tof = (*iter_tof)->tof();
827 double ph = (*iter_tof)->ph();
828 double rhit = (*iter_tof)->zrhit();
829 double qual = 0.0 + (*iter_tof)->quality();
830 double cntr = 0.0 + (*iter_tof)->tofID();
832 for(
int j = 0; j < 5; j++) {
833 double gb = ptrk/
xmass[j];
834 double beta = gb/sqrt(1+gb*gb);
835 texp[j] = path /beta/
velc;
838 m_qual_btof1[i] = qual;
839 m_tof_btof1[i] = tof ;
842 if(status->
layer()==2){
843 double path=(*iter_tof)->path();
844 double tof = (*iter_tof)->tof();
845 double ph = (*iter_tof)->ph();
846 double rhit = (*iter_tof)->zrhit();
847 double qual = 0.0 + (*iter_tof)->quality();
848 double cntr = 0.0 + (*iter_tof)->tofID();
850 for(
int j = 0; j < 5; j++) {
851 double gb = ptrk/
xmass[j];
852 double beta = gb/sqrt(1+gb*gb);
853 texp[j] = path /beta/
velc;
856 m_qual_btof2[i] = qual;
857 m_tof_btof2[i] = tof ;
860 if(status)
delete status;
874 if(m_ngch != 2 )m_hadrontag=11111;
875 else if(m_ngch == 2 &&nCharge==0) {
884 HepLorentzVector p41e,p42e,p4le;
885 Hep3Vector p31e,p32e,p3le;
886 HepLorentzVector p41m,p42m,p4lm;
887 Hep3Vector p31m,p32m,p3lm;
888 HepLorentzVector p41h,p42h,p4lh;
889 Hep3Vector p31h,p32h,p3lh;
894 for(
int i = 0; i < m_ngch; i++ ){
895 if(m_charge[i]>0)itTrk1= evtRecTrkCol->begin() + iGood[i];
896 if(m_charge[i]<0) itTrk2= evtRecTrkCol->begin() + iGood[i];
897 if(m_charge[i]>0) mdcKalTrk1 = (*itTrk1)->mdcKalTrack();
898 if(m_charge[i]<0) mdcKalTrk2 = (*itTrk2)->mdcKalTrack();
899 if(m_charge[i]>0)iip=i;
900 if(m_charge[i]<0)iim=i;
906 if(m_charge[i]>0) p41h =w1_ini.
p();
907 if(m_charge[i]<0) p42h =w2_ini.
p();
908 if(m_charge[i]>0) p41h.boost(
u_cms);
909 if(m_charge[i]<0) p42h.boost(
u_cms);
910 if(m_charge[i]>0) p31h = p41h.vect();
911 if(m_charge[i]<0) p32h = p42h.vect();
913 if(m_charge[i]>0) p41e =w1_ini.
p();
914 if(m_charge[i]<0) p42e =w2_ini.
p();
915 if(m_charge[i]>0) p41e.boost(
u_cms);
916 if(m_charge[i]<0) p42e.boost(
u_cms);
917 if(m_charge[i]>0) p31e = p41e.vect();
918 if(m_charge[i]<0) p32e = p42e.vect();
924 m_px_cms_ep=p41h.px();
925 m_py_cms_ep=p41h.py();
926 m_pz_cms_ep=p41h.pz();
930 m_px_cms_em=p42h.px();
931 m_py_cms_em=p42h.py();
932 m_pz_cms_em=p42h.pz();
937 double e01=m_e_emc[iip];
938 double e02=m_e_emc[iim];
940 int ilarge=( e01 > e02 ) ?iip:iim;
942 p4lh=( e01 > e02 ) ?p41h:p42h;
944 p3lh=( e01 > e02 ) ?p31h:p32h;
946 double acollh= 180.-p31h.angle(p32h)* 180.0 / CLHEP::pi;
947 double acoplh= 180.- (p31h.perpPart()).angle(p32h.perpPart ())* 180.0 / CLHEP::pi;
948 double poeb1h=p41h.rho()/beamEnergy;
949 double poeb2h=p42h.rho()/beamEnergy;
950 double poeblh=p4lh.rho()/beamEnergy;
952 double eoeb1=m_e_emc[iip]/beamEnergy;
953 double eoeb2=m_e_emc[iim]/beamEnergy;
955 if(p41h.rho()>0)eop1=m_e_emc[iip]/p41h.rho();
957 if(p42h.rho()>0)eop2=m_e_emc[iim]/p42h.rho();
960 if(p41e.rho()>0)eope1=m_e_emc[iip]/p41e.rho();
962 if(p42e.rho()>0)eope2=m_e_emc[iim]/p42e.rho();
964 if(p41m.rho()>0)eopm1=m_e_emc[iip]/p41m.rho();
966 if(p42m.rho()>0)eopm2=m_e_emc[iim]/p42m.rho();
968 double exoeb1= m_e_emc[iip]*
sin(m_theta_emc[iip])*
cos(m_phi_emc[iip])/beamEnergy;
969 double eyoeb1= m_e_emc[iip]*
sin(m_theta_emc[iip])*
sin(m_phi_emc[iip])/beamEnergy;
970 double ezoeb1=m_e_emc[iip]*
cos(m_theta_emc[iip])/beamEnergy;
971 double etoeb1=m_e_emc[iip]*
sin(m_theta_emc[iip])/beamEnergy;
973 double exoeb2= m_e_emc[iim]*
sin(m_theta_emc[iim])*
cos(m_phi_emc[iim])/beamEnergy;
974 double eyoeb2= m_e_emc[iim]*
sin(m_theta_emc[iim])*
sin(m_phi_emc[iim])/beamEnergy;
975 double ezoeb2=m_e_emc[iim]*
cos(m_theta_emc[iim])/beamEnergy;
976 double etoeb2=m_e_emc[iim]*
sin(m_theta_emc[iim])/beamEnergy;
978 double eoebl=m_e_emc[ilarge]/beamEnergy;
981 if(p4lh.rho()>0)eopl=m_e_emc[ilarge]/p4lh.rho();
983 double exoebl= m_e_emc[ilarge]*
sin(m_theta_emc[ilarge])*
cos(m_phi_emc[ilarge])/beamEnergy;
984 double eyoebl= m_e_emc[ilarge]*
sin(m_theta_emc[ilarge])*
sin(m_phi_emc[ilarge])/beamEnergy;
985 double ezoebl=m_e_emc[ilarge]*
cos(m_theta_emc[ilarge])/beamEnergy;
986 double etoebl=m_e_emc[ilarge]*
sin(m_theta_emc[ilarge])/beamEnergy;
988 int mucinfo1=(m_nhit_muc[iip]>=2&&m_nlay_muc[iip]>=2 ) ? 1 : 0;
989 int mucinfo2=(m_nhit_muc[iim]>=2&&m_nlay_muc[iim]>=2) ? 1 : 0;
990 int mucinfol=(m_nhit_muc[ilarge]>=2&&m_nlay_muc[ilarge]>=2) ? 1 : 0;
991 int pidel=( e01 > e02 ) ? m_nep : m_nem;
992 int pidmul=( e01 > e02 ) ? m_nmup : m_nmum;
1001 if(m_t_btof[iip]*m_t_btof[iim]!=0) deltatof=fabs(m_t_btof[iip]-m_t_btof[iim]);
1013 if ((acollh>m_acoll_h_cut)||(!m_useEMC||m_nGam>=m_ngam_h_cut))m_hadrontag+=11;
1014 if (!m_useTOF||(deltatof<m_dtof_h_cut))m_hadrontag+=100;
1015 if (!m_useMUC||(mucinfo1==0||mucinfo2==0))m_hadrontag+=1000;
1016 if (!m_useEMC||(fabs(eope1-1)>m_eop_h_cut&&fabs(eope2-1)>m_eop_h_cut))m_hadrontag+=10000;
1020 m_deltatof=deltatof;
1028 m_mucinfo1=mucinfo1;
1029 m_mucinfo2=mucinfo2;
1039 m_cos_ep=p41h.cosTheta ();
1040 m_cos_em=p42h.cosTheta ();
1041 m_mass_ee=(p41h+p42h).m();
1054 br=sqrt((px_had+ex_gam)*(px_had+ex_gam)+
1055 (py_had+ey_gam)*(py_had+ey_gam))/(pt_had+et_gam);
1056 bz= fabs(pz_had+ez_gam)/(p_had+e_gam);
1059 if(!m_useEMC||((br<m_br_h_cut)&&(bz<m_bz_h_cut)))m_hadrontag+=100000;
1060 if(!m_useEMC||thr/beamEnergy>m_thr_h_cut) m_hadrontag+=1000000;
1067 log << MSG::INFO <<
"m_hadrontag= "<<m_hadrontag << endreq;
1071 if(m_hadrontag==1111111){
1073 if(m_writentuple)m_tuple1 -> write();
1074 for(
int i = 0; i < m_ngch; i++ ){
1075 m_ha_costheta->Fill(
cos(m_theta[i]));
1076 m_ha_phi->Fill(m_phi[i]);
1079 RecMdcKalTrack *ktrk0 = (*(evtRecTrkCol->begin() + iGood[0]))->mdcKalTrack();
1080 RecMdcKalTrack *ktrk1 = (*(evtRecTrkCol->begin() + iGood[1]))->mdcKalTrack();
1081 RecMdcKalTrack *ktrk2 = (*(evtRecTrkCol->begin() + iGood[2]))->mdcKalTrack();
1103 if(fvtxfit->
Fit()) {
1104 m_ha_vx->Fill((fvtxfit->
Vx())[0]);
1105 m_ha_vy->Fill((fvtxfit->
Vx())[1]);
1106 m_ha_vz->Fill((fvtxfit->
Vx())[2]);
1114 m_ha_pmax->Fill(p_max);
1115 m_ha_emax->Fill(e_max);
1116 m_ha_etot->Fill(evis);
1117 m_ha_nneu->Fill(nGam);
1118 m_ha_nchg->Fill(m_ngch);
1119 setFilterPassed(
true);
1124 if(m_ngch==2&&nCharge == 0){
1128 if(m_ngch==4&&nCharge == 0){
1154 return StatusCode::SUCCESS;
1166 MsgStream log(
msgSvc(), name());
1167 log << MSG::INFO <<
"in finalize()" << endmsg;
1168 return StatusCode::SUCCESS;
double sin(const BesAngle a)
double cos(const BesAngle a)
const HepLorentzVector p_cms(0.034067, 0.0, 0.0, 3.097)
HepGeom::Point3D< double > HepPoint3D
std::vector< HepLorentzVector > Vp4
EvtRecTrackCol::iterator EvtRecTrackIterator
************Class m_ypar INTEGER m_KeyWgt INTEGER m_nphot INTEGER m_KeyGPS INTEGER m_IsBeamPolarized INTEGER m_EvtGenInterface DOUBLE PRECISION m_Emin DOUBLE PRECISION m_sphot DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_q2 DOUBLE PRECISION m_PolBeam2 DOUBLE PRECISION m_xErrPb *COMMON c_KK2f $ !CMS energy average $ !Spin Polarization vector first beam $ !Spin Polarization vector second beam $ !Beam energy spread[GeV] $ !minimum hadronization energy[GeV] $ !input READ never touch them !$ !debug facility $ !maximum weight $ !inverse alfaQED $ !minimum real photon energy
DQASelHadron(const std::string &name, ISvcLocator *pSvcLocator)
double secondMoment() const
const Hep3Vector emcPosition() const
const int emcVolumeNumber() const
const HepVector & helix() const
static void setPidType(PidType pidType)
const HepSymMatrix & err() const
const double theta() const
const HepSymMatrix err() const
const HepVector helix() const
......
static unsigned int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)
static FastVertexFit * instance()
void addTrack(const int number, const HepVector helix, const HepSymMatrix err)
virtual bool isVertexValid()=0
virtual double * SigmaPrimaryVertex()=0
virtual double * PrimaryVertex()=0
int methodProbability() const
void setChiMinCut(const double chi=4)
void setRecTrack(EvtRecTrack *trk)
void setMethod(const int method)
double chiTof2(int n) const
void identify(const int pidcase)
double probElectron() const
void usePidSys(const int pidsys)
static ParticleID * instance()
bool IsPidInfoValid() const
double chiTof1(int n) const
double probProton() const
double chiDedx(int n) const
RecEmcID getShowerId() const
RecEmcEnergy getEAll() const
unsigned int layer() const
void setStatus(unsigned int status)
const HepPoint3D & pivot(void) const
returns pivot position.
const HepVector & a(void) const
returns helix parameters.
HepLorentzVector p() const
_EXTERN_ std::string EvtRecEvent
_EXTERN_ std::string EvtRecTrackCol