46const double xmass[5] = {0.000511, 0.105658, 0.139570,0.493677, 0.938272};
77 MsgStream log(
msgSvc(), name());
79 log << MSG::INFO <<
"in initialize()" << endmsg;
83 if(service(
"THistSvc", m_thsvc).isFailure()) {
84 log << MSG::ERROR <<
"Couldn't get THistSvc" << endreq;
85 return StatusCode::FAILURE;
88 TH1F* inclkstar_mass =
new TH1F(
"InclKstar_mass",
"INCLUSIVE_Kstar_MASS",65,0.65,1.3);
89 inclkstar_mass->GetXaxis()->SetTitle(
"M_{K#pi} (GeV)");
90 inclkstar_mass->GetYaxis()->SetTitle(
"Nentries/10MeV/c^{2}");
92 if(m_thsvc->regHist(
"/DQAHist/InclKstar/InclKstar_mass", inclkstar_mass).isFailure()) {
93 log << MSG::ERROR <<
"Couldn't register InclKstar_mass" << endreq;
97 NTuplePtr nt2(
ntupleSvc(),
"DQAFILE/InclKstar");
98 if ( nt2 ) m_tuple2 = nt2;
100 m_tuple2 =
ntupleSvc()->book (
"DQAFILE/InclKstar", CLID_ColumnWiseTuple,
"inclkstar Ntuple");
102 status = m_tuple2->addItem (
"nkaonm", m_nkm);
103 status = m_tuple2->addItem (
"nkaonp", m_nkp);
104 status = m_tuple2->addItem (
"npionp", m_npip);
105 status = m_tuple2->addItem (
"npionm", m_npim);
106 status = m_tuple2->addItem (
"ncharge", m_ncharge);
107 status = m_tuple2->addItem (
"difchikp", m_difchikp);
108 status = m_tuple2->addItem (
"difchikm", m_difchikm);
109 status = m_tuple2->addItem (
"mkstarkp", m_kstarkp);
110 status = m_tuple2->addItem (
"mkstarkm", m_kstarkm);
111 status = m_tuple2->addItem (
"mkstar", m_mkstar);
112 status = m_tuple2->addItem (
"pkstar", m_pkstar);
115 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple2) << endmsg;
116 return StatusCode::FAILURE;
123 log << MSG::INFO <<
"successfully return from initialize()" <<endmsg;
124 return StatusCode::SUCCESS;
130 StatusCode sc = StatusCode::SUCCESS;
132 MsgStream log(
msgSvc(), name());
133 log << MSG::INFO <<
"in execute()" << endreq;
138 setFilterPassed(
false);
142 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
146 Vint iGood, ikm, ikp, ipip, ipim, iGam;
154 Vp4 ppip, ppim, pkm, pkp;
161 for(
int i = 0; i < evtRecEvent->totalCharged(); i++){
163 if(!(*itTrk)->isMdcTrackValid())
continue;
165 if(fabs(mdcTrk->
z()) >= m_vz0cut)
continue;
166 if(mdcTrk->
r() >= m_vr0cut)
continue;
168 TotCharge += mdcTrk->
charge();
173 int nGood = iGood.size();
179 if((nGood < 2) || (TotCharge!=0))
return sc;
187 for(
int i = 0; i < nGood; i++) {
201 if(!(*itTrk)->isMdcKalTrackValid()) continue ;
205 HepLorentzVector
ptrk;
206 ptrk.setPx(mdcKalTrk->
px());
207 ptrk.setPy(mdcKalTrk->
py());
208 ptrk.setPz(mdcKalTrk->
pz());
211 if(mdcKalTrk->
charge() >0) {
212 ikp.push_back(iGood[i]);
215 ikm.push_back(iGood[i]);
222 HepLorentzVector
ptrk;
223 ptrk.setPx(mdcKalTrk->
px());
224 ptrk.setPy(mdcKalTrk->
py());
225 ptrk.setPz(mdcKalTrk->
pz());
228 if(mdcKalTrk->
charge() >0) {
229 ipip.push_back(iGood[i]);
230 ppip.push_back(
ptrk);
232 ipim.push_back(iGood[i]);
233 ppim.push_back(
ptrk);
237 int npip = ipip.size();
238 int npim = ipim.size();
239 int nkm = ikm.size();
240 int nkp = ikp.size();
249 if(npip < 1 && npim < 1)
return sc;
250 if(nkp < 1 && nkm < 1)
return sc;
258 HepLorentzVector pkstar, pkstar1, ppi1, ppi2, pTot;
262 double difchi0=99999.0;
266 for (
int i = 0; i < npim; i++) {
267 for (
int j = 0; j < nkp; j++) {
268 pkstar = ppim[i] + pkp[j];
269 double difchi =fabs(pkstar.m()-
mkstar0);
270 if(difchi < difchi0){
278 m_difchikp = difchi0;
280 if(ixpim != -1) m_kstarkp=(ppim[ixpim] + pkp[ixkp]).m();
282 double difchi1=99999.0;
286 for (
int ii = 0; ii < npip; ii++) {
287 for (
int jj = 0; jj < nkm; jj++) {
288 pkstar1 = ppip[ii] + pkm[jj];
289 double difchi2 =fabs(pkstar1.m()-
mkstar0);
290 if(difchi2 < difchi1){
298 m_difchikm = difchi1;
300 if(ixpip != -1) m_kstarkm=(ppip[ixpip] + pkm[ixkm]).m();
303 if(ixpip == -1 && ixpim == -1)
return sc;
305 if(difchi0 < difchi1){
306 pTot = ppim[ixpim] + pkp[ixkp];
309 pTot = ppip[ixpip] + pkm[ixkm];
313 m_pkstar = pTot.rho();
317 if (m_thsvc->getHist(
"/DQAHist/InclKstar/InclKstar_mass", h).isSuccess()) {
320 log << MSG::ERROR <<
"Couldn't retrieve InclKstar_mass" << endreq;
330 (*(evtRecTrkCol->begin()+ipim[ixpim]))->tagPion();
331 (*(evtRecTrkCol->begin()+ikp[ixkp]))->tagKaon();
332 (*(evtRecTrkCol->begin()+ipim[ixpim]))->setQuality(3);
333 (*(evtRecTrkCol->begin()+ikp[ixkp]))->setQuality(3);
337 (*(evtRecTrkCol->begin()+ipip[ixpip]))->tagPion();
338 (*(evtRecTrkCol->begin()+ikm[ixkm]))->tagKaon();
339 (*(evtRecTrkCol->begin()+ipip[ixpip]))->setQuality(3);
340 (*(evtRecTrkCol->begin()+ikm[ixkm]))->setQuality(3);
345 setFilterPassed(
true);
348 return StatusCode::SUCCESS;
int methodProbability() const
void setChiMinCut(const double chi=4)
void setRecTrack(EvtRecTrack *trk)
void setMethod(const int method)
void identify(const int pidcase)
void usePidSys(const int pidsys)
static ParticleID * instance()
bool IsPidInfoValid() const