#include <inclphi.h>
Public Member Functions | |
inclphi (const std::string &name, ISvcLocator *pSvcLocator) | |
StatusCode | initialize () |
StatusCode | execute () |
StatusCode | finalize () |
Private Attributes | |
int | m_pass [10] |
double | m_vr0cut |
double | m_vz0cut |
int | m_checkDedx |
int | m_checkTof |
NTuple::Tuple * | m_tuple1 |
NTuple::Item< double > | m_mphiall |
NTuple::Item< double > | m_pphiall |
NTuple::Tuple * | m_tuple2 |
NTuple::Item< double > | m_nkp |
NTuple::Item< double > | m_nkm |
NTuple::Item< double > | m_ncharge |
NTuple::Item< double > | m_difchi |
NTuple::Item< double > | m_mphi |
NTuple::Item< double > | m_pphi |
NTuple::Item< double > | m_pk1 |
ITHistSvc * | m_thsvc |
Definition at line 15 of file inclphi.h.
inclphi::inclphi | ( | const std::string & | name, | |
ISvcLocator * | pSvcLocator | |||
) |
Definition at line 59 of file inclphi.cxx.
References genRecEmupikp::i, m_checkDedx, m_checkTof, m_pass, m_tuple1, m_tuple2, m_vr0cut, and m_vz0cut.
00059 : 00060 Algorithm(name, pSvcLocator) { 00061 00062 m_tuple1 = 0; 00063 m_tuple2 = 0; 00064 for(int i = 0; i < 10; i++) m_pass[i] = 0; 00065 00066 //Declare the properties 00067 declareProperty("Vr0cut", m_vr0cut=5.0); 00068 declareProperty("Vz0cut", m_vz0cut=10.0); 00069 declareProperty("CheckDedx", m_checkDedx = 1); 00070 declareProperty("CheckTof", m_checkTof = 1); 00071 }
StatusCode inclphi::execute | ( | ) |
Definition at line 136 of file inclphi.cxx.
References DstMdcKalTrack::charge(), DstMdcTrack::charge(), calibUtil::ERROR, EventModel::EvtRec::EvtRecEvent, EventModel::EvtRec::EvtRecTrackCol, genRecEmupikp::i, Bes_Common::INFO, ParticleID::instance(), ganga-rec::j, DstMdcKalTrack::kaon, m_difchi, m_mphi, m_mphiall, m_ncharge, m_nkm, m_nkp, m_pass, m_pk1, m_pphi, m_pphiall, m_thsvc, m_tuple1, m_tuple2, m_vr0cut, m_vz0cut, mk, mphi, msgSvc(), pid, DstMdcKalTrack::px(), DstMdcKalTrack::py(), DstMdcKalTrack::pz(), DstMdcTrack::r(), DstMdcKalTrack::setPidType(), and DstMdcTrack::z().
00136 { 00137 StatusCode sc = StatusCode::SUCCESS; 00138 00139 MsgStream log(msgSvc(), name()); 00140 log << MSG::INFO << "in execute()" << endreq; 00141 00142 // DQA 00143 // Add the line below at the beginning of execute() 00144 // 00145 setFilterPassed(false); 00146 00147 m_pass[0] += 1; 00148 00149 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader"); 00150 int run=eventHeader->runNumber(); 00151 int event=eventHeader->eventNumber(); 00152 00153 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(), EventModel::EvtRec::EvtRecEvent); 00154 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(), EventModel::EvtRec::EvtRecTrackCol); 00155 00156 m_pass[1] += 1; 00157 00158 Vint ikp, ikm, iGood; 00159 iGood.clear(); 00160 ikp.clear(); 00161 ikm.clear(); 00162 00163 Vp4 pkp, pkm; 00164 pkp.clear(); 00165 pkm.clear(); 00166 00167 int TotCharge = 0; 00168 for(int i = 0; i < evtRecEvent->totalCharged(); i++){ 00169 EvtRecTrackIterator itTrk=evtRecTrkCol->begin() + i; 00170 if(!(*itTrk)->isMdcTrackValid()) continue; 00171 RecMdcTrack *mdcTrk = (*itTrk)->mdcTrack(); 00172 if(fabs(mdcTrk->z()) >= m_vz0cut) continue; 00173 if(mdcTrk->r() >= m_vr0cut) continue; 00174 iGood.push_back(i); 00175 TotCharge += mdcTrk->charge(); 00176 } 00177 // 00178 // Finish Good Charged Track Selection 00179 // 00180 int nGood = iGood.size(); 00181 00182 // 00183 // Charge track number cut 00184 // 00185 00186 if((nGood < 2) || (TotCharge!=0)) return sc; 00187 00188 m_pass[2] += 1; 00189 00190 // 00191 // Assign 4-momentum to each charged track 00192 // 00193 ParticleID *pid = ParticleID::instance(); 00194 for(int i = 0; i < nGood; i++) { 00195 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + iGood[i]; 00196 // if(pid) delete pid; 00197 pid->init(); 00198 pid->setMethod(pid->methodProbability()); 00199 pid->setChiMinCut(4); 00200 pid->setRecTrack(*itTrk); 00201 pid->usePidSys(pid->useDedx() | pid->useTof1() | pid->useTof2()); // use PID sub-system 00202 pid->identify(pid->onlyPion() | pid->onlyKaon()); // seperater Pion/Kaon 00203 pid->calculate(); 00204 if(!(pid->IsPidInfoValid())) continue; 00205 if(!(*itTrk)->isMdcKalTrackValid()) continue ; 00206 RecMdcKalTrack* mdcKalTrk = (*itTrk)->mdcKalTrack(); 00207 // RecMdcTrack* mdcTrk = (*itTrk)->mdcTrack(); 00208 00209 if(pid->probKaon() < 0.001 || (pid->probKaon() < pid->probPion())) continue; 00210 // if(pid->probPion() < 0.001) continue; 00211 mdcKalTrk->setPidType(RecMdcKalTrack::kaon); 00212 HepLorentzVector ptrk; 00213 ptrk.setPx(mdcKalTrk->px()); 00214 ptrk.setPy(mdcKalTrk->py()); 00215 ptrk.setPz(mdcKalTrk->pz()); 00216 double p3 = ptrk.mag(); 00217 ptrk.setE(sqrt(p3*p3+mk*mk)); 00218 if(mdcKalTrk->charge() >0) { 00219 ikp.push_back(iGood[i]); 00220 pkp.push_back(ptrk); 00221 } else { 00222 ikm.push_back(iGood[i]); 00223 pkm.push_back(ptrk); 00224 } 00225 } 00226 00227 m_pass[4] += 1; 00228 int nkp = ikp.size(); 00229 int nkm = ikm.size(); 00230 00231 m_nkp=nkp; 00232 m_nkm=nkm; 00233 m_ncharge=nGood; 00234 00235 00236 if(nkp < 1 || nkm <1) return sc; 00237 00238 m_pass[5] += 1; 00239 00240 // 00241 //**************** Phi Finding ************ 00242 // 00243 // 00244 00245 HepLorentzVector pphi, pTot; 00246 Vint iphi; 00247 iphi.clear(); 00248 00249 double difchi0=99999.0; 00250 int ixk1 = -1; 00251 int ixk2 = -1; 00252 00253 for (int i = 0; i < nkm; i++) { 00254 for (int j = 0; j < nkp; j++) { 00255 00256 pphi = pkm[i] + pkp[j]; 00257 m_mphiall = pphi.m(); 00258 m_pphiall = pphi.rho(); 00259 m_tuple1->write(); 00260 00261 double difchi =fabs(pphi.m()-mphi); 00262 if(difchi < difchi0){ 00263 difchi0 = difchi; 00264 ixk1 = i; 00265 ixk2 = j; 00266 } //good phi 00267 } //K+ 00268 } //K- 00269 00270 m_difchi = difchi0; 00271 00272 if (ixk1 == -1) return sc; 00273 00274 m_pass[6] += 1; 00275 00276 pTot = pkm[ixk1] + pkp[ixk2]; 00277 00278 m_pk1 = pkm[ixk1].m(); 00279 m_mphi = pTot.m(); 00280 m_pphi = pTot.rho(); 00281 00282 TH1 *h(0); 00283 if (m_thsvc->getHist("/DQAHist/InclPhi/InclPhi_mass", h).isSuccess()) { 00284 h->Fill(pTot.m()); 00285 } else { 00286 log << MSG::ERROR << "Couldn't retrieve inclphi_mass" << endreq; 00287 } 00288 m_tuple2->write(); 00290 //DQA 00291 // set tag and quality 00292 // Pid: 1 - electron, 2 - muon, 3 - pion, 4 - kaon, 5 - proton 00293 // (*(evtRecTrkCol->begin()+ikm[ixk1]))->setPartId(4); 00294 // (*(evtRecTrkCol->begin()+ikp[ixk2]))->setPartId(4); 00295 (*(evtRecTrkCol->begin()+ikm[ixk1]))->tagKaon(); 00296 (*(evtRecTrkCol->begin()+ikp[ixk2]))->tagKaon(); 00297 // Quality: defined by whether dE/dx or TOF is used to identify particle 00298 // 0 - no dE/dx, no TOF (can be used for dE/dx and TOF calibration) 00299 // 1 - only dE/dx (can be used for TOF calibration) 00300 // 2 - only TOF (can be used for dE/dx calibration) 00301 // 3 - Both dE/dx and TOF 00302 (*(evtRecTrkCol->begin()+ikm[ixk1]))->setQuality(3); 00303 (*(evtRecTrkCol->begin()+ikp[ixk2]))->setQuality(3); 00304 //-------------------------------------------------- 00305 // Add the line below at the end of execute(), (before return) 00306 // 00307 setFilterPassed(true); 00308 00309 return StatusCode::SUCCESS; 00310 }
StatusCode inclphi::finalize | ( | ) |
Definition at line 313 of file inclphi.cxx.
References Bes_Common::INFO, m_pass, and msgSvc().
00313 { 00314 00315 MsgStream log(msgSvc(), name()); 00316 log << MSG::INFO << "in finalize()" << endmsg; 00317 log << MSG::INFO << "Total Entries : " << m_pass[0] << endreq; 00318 log << MSG::INFO << "dstCol, trkCol: " << m_pass[1] << endreq; 00319 log << MSG::INFO << "Ncharge Cut : " << m_pass[2] << endreq; 00320 log << MSG::INFO << "TOF dEdx : " << m_pass[3] << endreq; 00321 log << MSG::INFO << "PID : " << m_pass[4] << endreq; 00322 log << MSG::INFO << "NK Cut : " << m_pass[5] << endreq; 00323 log << MSG::INFO << "Nphi select : " << m_pass[6] << endreq; 00324 return StatusCode::SUCCESS; 00325 }
StatusCode inclphi::initialize | ( | ) |
Definition at line 74 of file inclphi.cxx.
References calibUtil::ERROR, Bes_Common::INFO, m_difchi, m_mphi, m_mphiall, m_ncharge, m_nkm, m_nkp, m_pk1, m_pphi, m_pphiall, m_thsvc, m_tuple1, m_tuple2, msgSvc(), and ntupleSvc().
00074 { 00075 MsgStream log(msgSvc(), name()); 00076 00077 log << MSG::INFO << "in initialize()" << endmsg; 00078 00079 StatusCode status; 00080 00081 if(service("THistSvc", m_thsvc).isFailure()) { 00082 log << MSG::ERROR << "Couldn't get THistSvc" << endreq; 00083 return StatusCode::FAILURE; 00084 } 00085 // "DQAHist" is fixed 00086 TH1F* inclphi_mass = new TH1F("InclPhi_mass","INCLUSIVE_PHI_MASS",80,1.01,1.05); 00087 inclphi_mass->GetXaxis()->SetTitle("M_{KK} (GeV)"); 00088 inclphi_mass->GetYaxis()->SetTitle("Nentries/0.5MeV/c^{2}"); 00089 if(m_thsvc->regHist("/DQAHist/InclPhi/InclPhi_mass", inclphi_mass).isFailure()) { 00090 log << MSG::ERROR << "Couldn't register inclphi_mass" << endreq; 00091 } 00092 00093 //***************************************** 00094 00095 NTuplePtr nt1(ntupleSvc(), "DQAFILE/InclPhi"); 00096 if ( nt1 ) m_tuple1 = nt1; 00097 else { 00098 m_tuple1 = ntupleSvc()->book ("DQAFILE/InclPhi1", CLID_ColumnWiseTuple, "inclphi Ntuple"); 00099 if ( m_tuple1 ) { 00100 status = m_tuple1->addItem ("mphiall", m_mphiall); 00101 status = m_tuple1->addItem ("mpphiall", m_pphiall); 00102 } 00103 else { 00104 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple1) << endmsg; 00105 return StatusCode::FAILURE; 00106 } 00107 } 00108 NTuplePtr nt2(ntupleSvc(), "DQAFILE/InclPhi2"); 00109 if ( nt2 ) m_tuple2 = nt2; 00110 else { 00111 m_tuple2 = ntupleSvc()->book ("DQAFILE/InclPhi2", CLID_ColumnWiseTuple, "inclphi Ntuple"); 00112 if ( m_tuple2 ) { 00113 status = m_tuple2->addItem ("nkp", m_nkp); 00114 status = m_tuple2->addItem ("nkm", m_nkm); 00115 status = m_tuple2->addItem ("ncharge", m_ncharge); 00116 status = m_tuple2->addItem ("difchi0", m_difchi); 00117 status = m_tuple2->addItem ("mmphi", m_mphi); 00118 status = m_tuple2->addItem ("pphi", m_pphi); 00119 status = m_tuple2->addItem ("pk1", m_pk1); 00120 } 00121 else { 00122 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple2) << endmsg; 00123 return StatusCode::FAILURE; 00124 } 00125 } 00126 // 00127 //--------end of book-------- 00128 // 00129 00130 log << MSG::INFO << "successfully return from initialize()" <<endmsg; 00131 return StatusCode::SUCCESS; 00132 00133 }
int inclphi::m_checkDedx [private] |
int inclphi::m_checkTof [private] |
NTuple::Item<double> inclphi::m_difchi [private] |
NTuple::Item<double> inclphi::m_mphi [private] |
NTuple::Item<double> inclphi::m_mphiall [private] |
NTuple::Item<double> inclphi::m_ncharge [private] |
NTuple::Item<double> inclphi::m_nkm [private] |
NTuple::Item<double> inclphi::m_nkp [private] |
int inclphi::m_pass[10] [private] |
NTuple::Item<double> inclphi::m_pk1 [private] |
NTuple::Item<double> inclphi::m_pphi [private] |
NTuple::Item<double> inclphi::m_pphiall [private] |
ITHistSvc* inclphi::m_thsvc [private] |
NTuple::Tuple* inclphi::m_tuple1 [private] |
NTuple::Tuple* inclphi::m_tuple2 [private] |
double inclphi::m_vr0cut [private] |
double inclphi::m_vz0cut [private] |