#include <EventPreSelect.h>
Public Member Functions | |
EventPreSelect (const std::string &name, ISvcLocator *pSvcLocator) | |
EventPreSelect (const std::string &name, ISvcLocator *pSvcLocator) | |
StatusCode | execute () |
StatusCode | execute () |
StatusCode | finalize () |
StatusCode | finalize () |
StatusCode | initialize () |
StatusCode | initialize () |
bool | WhetherSector (double ph, double ph1, double ph2) |
bool | WhetherSector (double ph, double ph1, double ph2) |
Private Attributes | |
long int | m_barrelBhabhaNumber |
long int | m_barrelDimuNumber |
long int | m_barrelDiphotonNumber |
int | m_BarrelOrEndcap |
double | m_bhabhaDPhiCut1 |
double | m_bhabhaDPhiCut2 |
double | m_bhabhaDPhiCut3 |
double | m_bhabhaDPhiCut4 |
double | m_bhabhaDTheCut |
double | m_bhabhaEmcECut |
double | m_bhabhaMaxECut |
int | m_bhabhaMdcHitCutB |
int | m_bhabhaMdcHitCutE |
double | m_bhabhaSecECut |
NTuple::Item< double > | m_dang |
NTuple::Item< double > | m_dang |
DimuPreSelect * | m_dimuAlg |
DimuPreSelect * | m_dimuAlg |
double | m_dimuDPhiCut |
double | m_dimuDTheCut |
double | m_dimuEHighCut |
double | m_dimuELowCut |
double | m_diphotonDPhiCut1 |
double | m_diphotonDPhiCut2 |
double | m_diphotonDTheCut |
double | m_diphotonEmcECut |
double | m_diphotonSecECut |
NTuple::Item< double > | m_dphi |
NTuple::Item< double > | m_dPhi |
NTuple::Item< double > | m_dphi |
NTuple::Item< double > | m_dPhi |
NTuple::Item< double > | m_dthe |
NTuple::Item< double > | m_dThe |
NTuple::Item< double > | m_dthe |
NTuple::Item< double > | m_dThe |
double | m_ecm |
NTuple::Item< double > | m_eemc |
NTuple::Item< double > | m_eemc |
long int | m_endcapBhabhaNumber |
long int | m_endcapDimuNumber |
long int | m_endcapDiphotonNumber |
double | m_energyThreshold |
NTuple::Item< double > | m_eraw |
NTuple::Item< double > | m_eraw |
NTuple::Item< double > | m_esum |
NTuple::Item< double > | m_esum |
NTuple::Item< double > | m_etot |
NTuple::Item< double > | m_etot |
long int | m_events |
NTuple::Item< long > | m_evtnb |
NTuple::Item< long > | m_evtnb |
double | m_gammaPhiCut |
double | m_gammaThetaCut |
double | m_hadronChaECut |
double | m_hadronNeuECut |
long int | m_hadronNumber |
bool | m_isBarrelBhabha |
bool | m_isBarrelDimu |
bool | m_isBarrelDiphoton |
bool | m_isEndcapBhabha |
bool | m_isEndcapDimu |
bool | m_isEndcapDiphoton |
bool | m_isHadron |
NTuple::Item< double > | m_maxE |
NTuple::Item< double > | m_maxE |
NTuple::Item< long > | m_mdcHit1 |
NTuple::Item< long > | m_mdcHit1 |
NTuple::Item< long > | m_mdcHit2 |
NTuple::Item< long > | m_mdcHit2 |
NTuple::Item< double > | m_nCharge |
NTuple::Item< double > | m_nCharge |
NTuple::Item< double > | m_nGam |
NTuple::Item< double > | m_nGam |
NTuple::Item< double > | m_nGood |
NTuple::Item< double > | m_nGood |
bool | m_output |
NTuple::Item< double > | m_p0 |
NTuple::Item< double > | m_p0 |
NTuple::Item< double > | m_pm |
NTuple::Item< double > | m_pm |
NTuple::Item< double > | m_pp |
NTuple::Item< double > | m_pp |
NTuple::Item< double > | m_pt0 |
NTuple::Item< double > | m_pt0 |
double | m_pt0HighCut |
double | m_pt0LowCut |
NTuple::Item< double > | m_ptot |
NTuple::Item< double > | m_ptot |
NTuple::Item< long > | m_runnb |
NTuple::Item< long > | m_runnb |
NTuple::Item< double > | m_secE |
NTuple::Item< double > | m_secE |
bool | m_selectBhabha |
bool | m_selectDimu |
bool | m_selectDiphoton |
bool | m_selectHadron |
Algorithm * | m_subalg1 |
Algorithm * | m_subalg1 |
Algorithm * | m_subalg2 |
Algorithm * | m_subalg2 |
Algorithm * | m_subalg3 |
Algorithm * | m_subalg3 |
Algorithm * | m_subalg4 |
Algorithm * | m_subalg4 |
Algorithm * | m_subalg5 |
Algorithm * | m_subalg5 |
Algorithm * | m_subalg6 |
Algorithm * | m_subalg6 |
Algorithm * | m_subalg7 |
Algorithm * | m_subalg7 |
Algorithm * | m_subalg8 |
Algorithm * | m_subalg8 |
Algorithm * | m_subalg9 |
Algorithm * | m_subalg9 |
NTuple::Item< double > | m_theta0 |
NTuple::Item< double > | m_theta0 |
NTuple::Tuple * | m_tuple0 |
NTuple::Tuple * | m_tuple0 |
NTuple::Tuple * | m_tuple1 |
NTuple::Tuple * | m_tuple1 |
NTuple::Tuple * | m_tuple2 |
NTuple::Tuple * | m_tuple2 |
NTuple::Tuple * | m_tuple3 |
NTuple::Tuple * | m_tuple3 |
NTuple::Item< double > | m_vr0 |
NTuple::Item< double > | m_vr0 |
double | m_vr0cut |
NTuple::Item< double > | m_vx0 |
NTuple::Item< double > | m_vx0 |
NTuple::Item< double > | m_vy0 |
NTuple::Item< double > | m_vy0 |
NTuple::Item< double > | m_vz0 |
NTuple::Item< double > | m_vz0 |
double | m_vz0cut |
bool | m_writeDst |
bool | m_writeRec |
Static Private Attributes | |
int | idmax [43] |
|
00051 : 00052 Algorithm(name, pSvcLocator) { 00053 //Declare the properties 00054 00055 declareProperty("Output", m_output = false); 00056 declareProperty("Ecm", m_ecm=3.686); 00057 declareProperty("SelectBhabha", m_selectBhabha=false); 00058 declareProperty("SelectDimu", m_selectDimu=false); 00059 declareProperty("SelectHadron", m_selectHadron=false); 00060 declareProperty("SelectDiphoton", m_selectDiphoton=false); 00061 declareProperty("WriteDst", m_writeDst=false); 00062 declareProperty("WriteRec", m_writeRec=false); 00063 declareProperty("Vr0cut", m_vr0cut=1.0); 00064 declareProperty("Vz0cut", m_vz0cut=5.0); 00065 declareProperty("Pt0HighCut", m_pt0HighCut=5.0); 00066 declareProperty("Pt0LowCut", m_pt0LowCut=0.05); 00067 declareProperty("EnergyThreshold", m_energyThreshold=0.05); 00068 declareProperty("GammaPhiCut", m_gammaPhiCut=20.0); 00069 declareProperty("GammaThetaCut", m_gammaThetaCut=20.0); 00070 00071 declareProperty("BhabhaEmcECut", m_bhabhaEmcECut=0.7*m_ecm); 00072 declareProperty("BhabhaMaxECut", m_bhabhaMaxECut=0.3*m_ecm); 00073 declareProperty("BhabhaSecECut", m_bhabhaSecECut=0.1*m_ecm); 00074 declareProperty("BhabhaDTheCut", m_bhabhaDTheCut=3.); 00075 declareProperty("BhabhaDPhiCut1", m_bhabhaDPhiCut1=-25.); 00076 declareProperty("BhabhaDPhiCut2", m_bhabhaDPhiCut2=-4.); 00077 declareProperty("BhabhaDPhiCut3", m_bhabhaDPhiCut3=2.); 00078 declareProperty("BhabhaDPhiCut4", m_bhabhaDPhiCut4=20.); 00079 declareProperty("BhabhaMdcHitCutB", m_bhabhaMdcHitCutB=15); 00080 declareProperty("BhabhaMdcHitCutE", m_bhabhaMdcHitCutE=5); 00081 00082 declareProperty("DimuEHighCut", m_dimuEHighCut=0.27*m_ecm); 00083 declareProperty("DimuELowCut", m_dimuELowCut=0.027*m_ecm); 00084 declareProperty("DimuDTheCut", m_dimuDTheCut=3.); 00085 declareProperty("DimuDPhiCut", m_dimuDPhiCut=23.); 00086 00087 declareProperty("HadronChaECut", m_hadronChaECut=0.3*m_ecm); 00088 declareProperty("HadronNeuECut", m_hadronNeuECut=0.3*m_ecm); 00089 00090 declareProperty("DiphotonEmcECut", m_diphotonEmcECut=0.7*m_ecm); 00091 declareProperty("DiphotonSecECut", m_diphotonSecECut=0.3*m_ecm); 00092 declareProperty("DiphotonDTheCut", m_diphotonDTheCut=3.); 00093 declareProperty("DiphotonDPhiCut1", m_diphotonDPhiCut1=-4.); 00094 declareProperty("DiphotonDPhiCut2", m_diphotonDPhiCut2=2.); 00095 }
|
|
|
|
|
|
00289 { 00290 00291 //setFilterPassed(false); 00292 00293 MsgStream log(msgSvc(), name()); 00294 log << MSG::INFO << "in execute()" << endreq; 00295 00296 if( m_writeDst) m_subalg8->execute(); 00297 if( m_writeRec) m_subalg9->execute(); 00298 00299 m_isBarrelBhabha = false; 00300 m_isEndcapBhabha = false; 00301 m_isBarrelDimu = false; 00302 m_isEndcapDimu = false; 00303 m_isHadron = false; 00304 m_isBarrelDiphoton = false; 00305 m_isEndcapDiphoton = false; 00306 00307 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader"); 00308 if(!eventHeader) 00309 { 00310 cout<<" eventHeader "<<endl; 00311 return StatusCode::FAILURE; 00312 } 00313 00314 int run=eventHeader->runNumber(); 00315 int event=eventHeader->eventNumber(); 00316 00317 if(m_events%1000==0) cout<< m_events << " -------- run,event: "<<run<<","<<event<<endl; 00318 m_events++; 00319 00320 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(), EventModel::EvtRec::EvtRecEvent); 00321 if(!evtRecEvent ) { 00322 cout<<" evtRecEvent "<<endl; 00323 return StatusCode::FAILURE; 00324 } 00325 00326 log << MSG::DEBUG <<"ncharg, nneu, tottks = " 00327 << evtRecEvent->totalCharged() << " , " 00328 << evtRecEvent->totalNeutral() << " , " 00329 << evtRecEvent->totalTracks() <<endreq; 00330 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(), EventModel::EvtRec::EvtRecTrackCol); 00331 if(!evtRecTrkCol){ 00332 cout<<" evtRecTrkCol "<<endl; 00333 return StatusCode::FAILURE; 00334 } 00335 00336 if(evtRecEvent->totalTracks()!=evtRecTrkCol->size()) return StatusCode::SUCCESS; 00337 00338 // -------- Good Charged Track Selection 00339 Vint iGood; 00340 iGood.clear(); 00341 int nCharge = 0; 00342 for(int i = 0;i < evtRecEvent->totalCharged(); i++) 00343 { 00344 //if(i>=evtRecTrkCol->size()) break; 00345 EvtRecTrackIterator itTrk=evtRecTrkCol->begin() + i; 00346 if(!(*itTrk)->isMdcTrackValid()) continue; 00347 RecMdcTrack *mdcTrk =(*itTrk)->mdcTrack(); 00348 double vx0 = mdcTrk->x(); 00349 double vy0 = mdcTrk->y(); 00350 double vz0 = mdcTrk->z(); 00351 double vr0 = mdcTrk->r(); 00352 double theta0 = mdcTrk->theta(); 00353 double p0 = mdcTrk->p(); 00354 double pt0 = mdcTrk->pxy(); 00355 00356 if(m_output) { 00357 m_vx0 = vx0; 00358 m_vy0 = vy0; 00359 m_vz0 = vz0; 00360 m_vr0 = vr0; 00361 m_theta0 = theta0; 00362 m_p0 = p0; 00363 m_pt0 = pt0; 00364 m_tuple1->write(); 00365 } 00366 00367 if(fabs(vz0) >= m_vz0cut) continue; 00368 if(vr0 >= m_vr0cut) continue; 00369 if(pt0 >= m_pt0HighCut) continue; 00370 if(pt0 <= m_pt0LowCut) continue; 00371 00372 iGood.push_back((*itTrk)->trackId()); 00373 nCharge += mdcTrk->charge(); 00374 } 00375 int nGood = iGood.size(); 00376 00377 // -------- Good Photon Selection 00378 Vint iGam; 00379 iGam.clear(); 00380 for(int i = evtRecEvent->totalCharged(); i< evtRecEvent->totalTracks(); i++) { 00381 //if(i>=evtRecTrkCol->size()) break; 00382 EvtRecTrackIterator itTrk=evtRecTrkCol->begin() + i; 00383 if(!(*itTrk)->isEmcShowerValid()) continue; 00384 RecEmcShower *emcTrk = (*itTrk)->emcShower(); 00385 double eraw = emcTrk->energy(); 00386 if(m_output) { 00387 m_eraw = eraw; 00388 m_tuple2->write(); 00389 } 00390 if(eraw < m_energyThreshold) continue; 00391 iGam.push_back((*itTrk)->trackId()); 00392 } 00393 int nGam = iGam.size(); 00394 00395 // -------- Assign 4-momentum to each charged track 00396 Vint ipip, ipim; 00397 ipip.clear(); 00398 ipim.clear(); 00399 Vp4 ppip, ppim; 00400 ppip.clear(); 00401 ppim.clear(); 00402 00403 //cout<<"charged track:"<<endl; 00404 double echarge = 0.; //total energy of charged track 00405 double ptot = 0.; //total momentum of charged track 00406 double etot = 0.; //total energy in MDC and EMC 00407 double eemc = 0.; //total energy in EMC 00408 double pp = 0.; 00409 double pm = 0.; 00410 00411 for(int i = 0; i < nGood; i++) { 00412 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + iGood[i]; 00413 00414 if((*itTrk)->isMdcTrackValid()) { 00415 00416 //RecMdcKalTrack* mdcKalTrk = (*itTrk)->mdcKalTrack();//After ParticleID, use RecMdcKalTrack substitute RecMdcTrack 00417 //RecMdcKalTrack::setPidType(RecMdcKalTrack::pion);//PID can set to electron, muon, pion, kaon and proton;The default setting is pion 00418 //If use this algorithm in reconstruction job, mdcKalTrk->p()=0!!! I don't know why. 00419 00420 RecMdcTrack* mdcTrk = (*itTrk)->mdcTrack(); 00421 00422 ptot += mdcTrk->p(); 00423 00424 HepLorentzVector ptrk; 00425 ptrk.setPx(mdcTrk->px()); 00426 ptrk.setPy(mdcTrk->py()); 00427 ptrk.setPz(mdcTrk->pz()); 00428 double p3 = ptrk.mag(); 00429 ptrk.setE(sqrt(p3*p3+mpi*mpi)); 00430 ptrk = ptrk.boost(-0.011,0,0);//boost to cms 00431 00432 echarge += ptrk.e(); 00433 etot += ptrk.e(); 00434 00435 if(mdcTrk->charge() >0) { 00436 ppip.push_back(ptrk); 00437 pp = ptrk.rho(); 00438 } else { 00439 ppim.push_back(ptrk); 00440 pm = ptrk.rho(); 00441 } 00442 00443 } 00444 00445 if((*itTrk)->isEmcShowerValid()) { 00446 00447 RecEmcShower* emcTrk = (*itTrk)->emcShower(); 00448 double eraw = emcTrk->energy(); 00449 double phi = emcTrk->phi(); 00450 double the = emcTrk->theta(); 00451 00452 HepLorentzVector ptrk; 00453 ptrk.setPx(eraw*sin(the)*cos(phi)); 00454 ptrk.setPy(eraw*sin(the)*sin(phi)); 00455 ptrk.setPz(eraw*cos(the)); 00456 ptrk.setE(eraw); 00457 ptrk = ptrk.boost(-0.011,0,0);// boost to cms 00458 00459 eemc += ptrk.e(); 00460 etot += ptrk.e(); 00461 00462 } 00463 00464 } 00465 00466 00467 // -------- Assign 4-momentum to each photon 00468 //cout<<"neutral:"<<endl; 00469 Vp4 pGam; 00470 pGam.clear(); 00471 double eneu=0; //total energy of neutral track 00472 for(int i = 0; i < nGam; i++) { 00473 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + iGam[i]; 00474 RecEmcShower* emcTrk = (*itTrk)->emcShower(); 00475 double eraw = emcTrk->energy(); 00476 double phi = emcTrk->phi(); 00477 double the = emcTrk->theta(); 00478 HepLorentzVector ptrk; 00479 ptrk.setPx(eraw*sin(the)*cos(phi)); 00480 ptrk.setPy(eraw*sin(the)*sin(phi)); 00481 ptrk.setPz(eraw*cos(the)); 00482 ptrk.setE(eraw); 00483 ptrk = ptrk.boost(-0.011,0,0);// boost to cms 00484 pGam.push_back(ptrk); 00485 eneu += ptrk.e(); 00486 etot += ptrk.e(); 00487 eemc += ptrk.e(); 00488 } 00489 00490 double esum = echarge + eneu; 00491 00492 // -------- Use EMC shower information only 00493 double maxE = 0.; 00494 double secE = 0.; 00495 double maxThe = 999.; 00496 double maxPhi = 999.; 00497 double secThe = 999.; 00498 double secPhi = 999.; 00499 int npart = 999.; 00500 double dphi = 999.; 00501 double dthe = 999.; 00502 int mdcHit1 = 0.; 00503 int mdcHit2 = 0.; 00504 00505 SmartDataPtr<RecEmcShowerCol> aShowerCol(eventSvc(),"/Event/Recon/RecEmcShowerCol"); 00506 if (!aShowerCol) { 00507 log << MSG::WARNING << "Could not find RecEmcShowerCol" << endreq; 00508 return( StatusCode::SUCCESS); 00509 } 00510 00511 int ishower = 0; 00512 RecEmcShowerCol::iterator iShowerCol; 00513 for(iShowerCol=aShowerCol->begin(); 00514 iShowerCol!=aShowerCol->end(); 00515 iShowerCol++) { 00516 00517 if(ishower == 0) { 00518 maxE = (*iShowerCol)->e5x5(); 00519 maxThe = (*iShowerCol)->theta(); 00520 maxPhi = (*iShowerCol)->phi(); 00521 npart = (*iShowerCol)->module(); 00522 } else if(ishower == 1) { 00523 secE = (*iShowerCol)->e5x5(); 00524 secThe = (*iShowerCol)->theta(); 00525 secPhi = (*iShowerCol)->phi(); 00526 } else if(ishower == 2) { 00527 break; 00528 } 00529 00530 ishower++; 00531 00532 } 00533 00534 if(aShowerCol->size() >= 2) { 00535 00536 dphi = (fabs(maxPhi-secPhi)-CLHEP::pi)*180./CLHEP::pi; 00537 dthe = (fabs(maxThe+secThe)-CLHEP::pi)*180./CLHEP::pi; 00538 00539 double phi1 = maxPhi<0 ? maxPhi+CLHEP::twopi : maxPhi; 00540 double phi2 = secPhi<0 ? secPhi+CLHEP::twopi : secPhi; 00541 00542 //Define sector (phi11,phi12) and (phi21,phi22) 00543 double phi11=min(phi1,phi2); 00544 double phi22=max(phi1,phi2); 00545 double phi12=(phi11+phi22-CLHEP::pi)*0.5; 00546 double phi21=(phi11+phi22+CLHEP::pi)*0.5; 00547 if(phi12<0.) phi12 += CLHEP::twopi; 00548 if(phi21>CLHEP::twopi) phi21 -= CLHEP::twopi; 00549 00550 SmartDataPtr<MdcDigiCol> mdcDigiCol(evtSvc(), "/Event/Digi/MdcDigiCol"); 00551 if (!mdcDigiCol) { 00552 log << MSG::FATAL << "Could not find MdcDigiCol!" << endreq; 00553 return StatusCode::FAILURE; 00554 } 00555 int hitnum = mdcDigiCol->size(); 00556 for (int i = 0;i< hitnum;i++ ) { 00557 MdcDigi* digi= dynamic_cast<MdcDigi*>(mdcDigiCol->containedObject(i)); 00558 double time = digi->getTimeChannel(); 00559 double charge = digi->getChargeChannel(); 00560 if (time == 0x7FFFFFFF || charge == 0x7FFFFFFF) continue; 00561 Identifier id(digi->identify()); 00562 unsigned int iphi=MdcID::wire(id); 00563 unsigned int ilayer=MdcID::layer(id); 00564 if(ilayer>=43) 00565 log << MSG::ERROR << "MDC(" << ilayer <<","<<iphi <<")"<<endreq; 00566 double phi=CLHEP::twopi*iphi/idmax[ilayer]; 00567 if(WhetherSector(phi,phi11,phi12)) mdcHit1++; 00568 else if(WhetherSector(phi,phi21,phi22)) mdcHit2++; 00569 //cout<<"phi="<<phi<<",phi11="<<phi11<<",phi12="<<phi12 00570 //<<",phi21="<<phi21<<",phi22="<<phi22<<endl; 00571 } 00572 } 00573 00574 //If it's bhabha, return. 00575 //if(nGood==2 && pp+pm>3.4) return StatusCode::SUCCESS; 00576 00577 // -------- Select each event 00578 // Select bhabha 00579 if( eemc>m_bhabhaEmcECut && maxE>m_bhabhaMaxECut && secE>m_bhabhaSecECut 00580 && abs(dthe)<m_bhabhaDTheCut && 00581 ( (dphi>m_bhabhaDPhiCut1&&dphi<m_bhabhaDPhiCut2) || 00582 (dphi>m_bhabhaDPhiCut3&&dphi<m_bhabhaDPhiCut4) ) ) { 00583 if( npart==1 && mdcHit1>m_bhabhaMdcHitCutB && mdcHit2>m_bhabhaMdcHitCutB ) { 00584 m_isBarrelBhabha = true; 00585 m_barrelBhabhaNumber++; 00586 } else if( ( npart==0 || npart==2 ) 00587 && mdcHit1>m_bhabhaMdcHitCutE && mdcHit2>m_bhabhaMdcHitCutE ) { 00588 m_isEndcapBhabha = true; 00589 m_endcapBhabhaNumber++; 00590 } 00591 } 00592 00593 // Select dimu 00594 /*if( maxE<m_dimuEHighCut && maxE>m_dimuELowCut 00595 && secE<m_dimuEHighCut && secE>m_dimuELowCut 00596 && fabs(dthe)<m_dimuDTheCut && fabs(dphi)<m_dimuDPhiCut ) { 00597 if( npart==1 ) { 00598 m_isBarrelDimu = true; 00599 m_barrelDimuNumber++; 00600 } else if( npart==0 || npart==2 ) { 00601 m_isEndcapDimu = true; 00602 m_endcapDimuNumber++; 00603 } 00604 }*/ 00605 if(m_selectDimu) { 00606 if( m_dimuAlg->IsDimu() == 1 ) { 00607 m_isBarrelDimu = true; 00608 m_barrelDimuNumber++; 00609 } else if(m_dimuAlg->IsDimu() == 2 ) { 00610 m_isEndcapDimu = true; 00611 m_endcapDimuNumber++; 00612 } 00613 } 00614 00615 // Select hadron 00616 if( (nGood>=1 && esum>m_hadronChaECut) 00617 || (nGood==0 && esum>m_hadronNeuECut) ) { 00618 m_isHadron = true; 00619 m_hadronNumber++; 00620 } 00621 00622 // Select diphoton 00623 if( nGood==0 && eemc>m_diphotonEmcECut && secE>m_diphotonSecECut 00624 && fabs(dthe)<m_diphotonDTheCut 00625 && dphi>m_diphotonDPhiCut1 && dphi<m_diphotonDPhiCut2 ) { 00626 if( npart==1 ) { 00627 m_isBarrelDiphoton = true; 00628 m_barrelDiphotonNumber++; 00629 } else if( npart==0 || npart==2 ) { 00630 m_isEndcapDiphoton = true; 00631 m_endcapDiphotonNumber++; 00632 } 00633 } 00634 00635 // -------- Write to root file 00636 if( m_selectBhabha && m_isBarrelBhabha ) m_subalg1->execute(); 00637 if( m_selectBhabha && m_isEndcapBhabha ) m_subalg2->execute(); 00638 if( m_selectDimu && m_isBarrelDimu ) m_subalg3->execute(); 00639 if( m_selectDimu && m_isEndcapDimu ) m_subalg4->execute(); 00640 if( m_selectHadron && m_isHadron ) m_subalg5->execute(); 00641 if( m_selectDiphoton && m_isBarrelDiphoton ) m_subalg6->execute(); 00642 if( m_selectDiphoton && m_isEndcapDiphoton ) m_subalg7->execute(); 00643 00644 if(m_output) { 00645 m_runnb = run; 00646 m_evtnb = event; 00647 m_esum = esum; 00648 m_eemc = eemc; 00649 m_etot = etot; 00650 m_nCharge = nCharge; 00651 m_nGood = nGood; 00652 m_nGam = nGam; 00653 m_ptot = ptot; 00654 m_pp = pp; 00655 m_pm = pm; 00656 m_maxE = maxE; 00657 m_secE = secE; 00658 m_dThe = dthe; 00659 m_dPhi = dphi; 00660 m_mdcHit1 = mdcHit1; 00661 m_mdcHit2 = mdcHit2; 00662 m_tuple0->write(); 00663 } 00664 00665 return StatusCode::SUCCESS; 00666 00667 }
|
|
|
|
00670 { 00671 00672 MsgStream log(msgSvc(), name()); 00673 log << MSG::INFO << "in finalize()" << endmsg; 00674 00675 if(m_selectDimu&&m_output) { 00676 m_dimuAlg->Print(); 00677 } 00678 00679 cout<<"Total events: "<<m_events<<endl; 00680 00681 if(m_selectBhabha) { 00682 cout << "Selected barrel bhabha: " << m_barrelBhabhaNumber << endl; 00683 cout << "Selected endcap bhabha: " << m_endcapBhabhaNumber << endl; 00684 } 00685 00686 if(m_selectDimu) { 00687 delete m_dimuAlg; 00688 cout << "Selected barrel dimu: " << m_barrelDimuNumber << endl; 00689 cout << "Selected endcap dimu: " << m_endcapDimuNumber << endl; 00690 } 00691 00692 if(m_selectHadron) { 00693 cout << "Selected hadron: " << m_hadronNumber << endl; 00694 } 00695 00696 if(m_selectDiphoton) { 00697 cout << "Selected barrel diphoton: " << m_barrelDiphotonNumber << endl; 00698 cout << "Selected endcap diphoton: " << m_endcapDiphotonNumber << endl; 00699 } 00700 00701 return StatusCode::SUCCESS; 00702 }
|
|
|
|
00098 { 00099 MsgStream log(msgSvc(), name()); 00100 00101 log << MSG::INFO << "in initialize()" << endmsg; 00102 00103 StatusCode sc; 00104 00105 log << MSG::INFO << "creating sub-algorithms...." << endreq; 00106 00107 if(m_selectBhabha) { 00108 sc = createSubAlgorithm( "EventWriter", "SelectBarrelBhabha", m_subalg1); 00109 if( sc.isFailure() ) { 00110 log << MSG::ERROR << "Error creating Sub-Algorithm SelectBhabhaBarrel" <<endreq; 00111 return sc; 00112 } else { 00113 log << MSG::INFO << "Success creating Sub-Algorithm SelectBhabhaBarrel" <<endreq; 00114 } 00115 sc = createSubAlgorithm( "EventWriter", "SelectEndcapBhabha", m_subalg2); 00116 if( sc.isFailure() ) { 00117 log << MSG::ERROR << "Error creating Sub-Algorithm SelectBhabhaEndcap" <<endreq; 00118 return sc; 00119 } else { 00120 log << MSG::INFO << "Success creating Sub-Algorithm SelectBhabhaEndcap" <<endreq; 00121 } 00122 } 00123 00124 if(m_selectDimu) { 00125 m_dimuAlg = new DimuPreSelect; 00126 sc = createSubAlgorithm( "EventWriter", "SelectBarrelDimu", m_subalg3); 00127 if( sc.isFailure() ) { 00128 log << MSG::ERROR << "Error creating Sub-Algorithm SelectDimuBarrel" <<endreq; 00129 return sc; 00130 } else { 00131 log << MSG::INFO << "Success creating Sub-Algorithm SelectDimuBarrel" <<endreq; 00132 } 00133 sc = createSubAlgorithm( "EventWriter", "SelectEndcapDimu", m_subalg4); 00134 if( sc.isFailure() ) { 00135 log << MSG::ERROR << "Error creating Sub-Algorithm SelectDimuEndcap" <<endreq; 00136 return sc; 00137 } else { 00138 log << MSG::INFO << "Success creating Sub-Algorithm SelectDimuEndap" <<endreq; 00139 } 00140 } 00141 00142 if(m_selectHadron) { 00143 sc = createSubAlgorithm( "EventWriter", "SelectHadron", m_subalg5); 00144 if( sc.isFailure() ) { 00145 log << MSG::ERROR << "Error creating Sub-Algorithm SelectHadron" <<endreq; 00146 return sc; 00147 } else { 00148 log << MSG::INFO << "Success creating Sub-Algorithm SelectHadron" <<endreq; 00149 } 00150 } 00151 00152 if(m_selectDiphoton) { 00153 sc = createSubAlgorithm( "EventWriter", "SelectBarrelDiphoton", m_subalg6); 00154 if( sc.isFailure() ) { 00155 log << MSG::ERROR << "Error creating Sub-Algorithm SelectDiphotonBarrel" <<endreq; 00156 return sc; 00157 } else { 00158 log << MSG::INFO << "Success creating Sub-Algorithm SelectDiphotonBarrel" <<endreq; 00159 } 00160 sc = createSubAlgorithm( "EventWriter", "SelectEndcapDiphoton", m_subalg7); 00161 if( sc.isFailure() ) { 00162 log << MSG::ERROR << "Error creating Sub-Algorithm SelectDiphotonEndcap" <<endreq; 00163 return sc; 00164 } else { 00165 log << MSG::INFO << "Success creating Sub-Algorithm SelectDiphotonEndcap" <<endreq; 00166 } 00167 } 00168 00169 if(m_writeDst) { 00170 sc = createSubAlgorithm( "EventWriter", "WriteDst", m_subalg8); 00171 if( sc.isFailure() ) { 00172 log << MSG::ERROR << "Error creating Sub-Algorithm WriteDst" <<endreq; 00173 return sc; 00174 } else { 00175 log << MSG::INFO << "Success creating Sub-Algorithm WriteDst" <<endreq; 00176 } 00177 } 00178 00179 if(m_writeRec) { 00180 sc = createSubAlgorithm( "EventWriter", "WriteRec", m_subalg9); 00181 if( sc.isFailure() ) { 00182 log << MSG::ERROR << "Error creating Sub-Algorithm WriteRec" <<endreq; 00183 return sc; 00184 } else { 00185 log << MSG::INFO << "Success creating Sub-Algorithm WriteRec" <<endreq; 00186 } 00187 } 00188 00189 if(m_output) { 00190 StatusCode status; 00191 NTuplePtr nt0(ntupleSvc(), "FILE1/hadron"); 00192 if ( nt0 ) m_tuple0 = nt0; 00193 else { 00194 m_tuple0 = ntupleSvc()->book ("FILE1/hadron", CLID_ColumnWiseTuple, "N-Tuple example"); 00195 if ( m_tuple0 ) { 00196 status = m_tuple0->addItem ("esum", m_esum); 00197 status = m_tuple0->addItem ("eemc", m_eemc); 00198 status = m_tuple0->addItem ("etot", m_etot); 00199 status = m_tuple0->addItem ("nGood", m_nGood); 00200 status = m_tuple0->addItem ("nCharge", m_nCharge); 00201 status = m_tuple0->addItem ("nGam", m_nGam); 00202 status = m_tuple0->addItem ("ptot", m_ptot); 00203 status = m_tuple0->addItem ("pp", m_pp); 00204 status = m_tuple0->addItem ("pm", m_pm); 00205 status = m_tuple0->addItem ("run", m_runnb); 00206 status = m_tuple0->addItem ("event", m_evtnb); 00207 status = m_tuple0->addItem ("maxE", m_maxE); 00208 status = m_tuple0->addItem ("secE", m_secE); 00209 status = m_tuple0->addItem ("dthe", m_dThe); 00210 status = m_tuple0->addItem ("dphi", m_dPhi); 00211 status = m_tuple0->addItem ("mdcHit1", m_mdcHit1); 00212 status = m_tuple0->addItem ("mdcHit2", m_mdcHit2); 00213 } 00214 else { 00215 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple0) << endmsg; 00216 return StatusCode::FAILURE; 00217 } 00218 } 00219 00220 NTuplePtr nt1(ntupleSvc(), "FILE1/vxyz"); 00221 if ( nt1 ) m_tuple1 = nt1; 00222 else { 00223 m_tuple1 = ntupleSvc()->book ("FILE1/vxyz", CLID_ColumnWiseTuple, "ks N-Tuple example"); 00224 if ( m_tuple1 ) { 00225 status = m_tuple1->addItem ("vx0", m_vx0); 00226 status = m_tuple1->addItem ("vy0", m_vy0); 00227 status = m_tuple1->addItem ("vz0", m_vz0); 00228 status = m_tuple1->addItem ("vr0", m_vr0); 00229 status = m_tuple1->addItem ("theta0", m_theta0); 00230 status = m_tuple1->addItem ("p0", m_p0); 00231 status = m_tuple1->addItem ("pt0", m_pt0); 00232 } 00233 else { 00234 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple1) << endmsg; 00235 return StatusCode::FAILURE; 00236 } 00237 } 00238 00239 NTuplePtr nt2(ntupleSvc(), "FILE1/photon"); 00240 if ( nt2 ) m_tuple2 = nt2; 00241 else { 00242 m_tuple2 = ntupleSvc()->book ("FILE1/photon", CLID_ColumnWiseTuple, "ks N-Tuple example"); 00243 if ( m_tuple2 ) { 00244 status = m_tuple2->addItem ("dthe", m_dthe); 00245 status = m_tuple2->addItem ("dphi", m_dphi); 00246 status = m_tuple2->addItem ("dang", m_dang); 00247 status = m_tuple2->addItem ("eraw", m_eraw); 00248 } 00249 else { 00250 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple2) << endmsg; 00251 return StatusCode::FAILURE; 00252 } 00253 } 00254 00255 if(m_selectDimu) { 00256 NTuplePtr nt3(ntupleSvc(), "FILE1/dimu"); 00257 if ( nt3 ) m_tuple3 = nt3; 00258 else { 00259 m_tuple3 = ntupleSvc()->book ("FILE1/dimu", CLID_ColumnWiseTuple, "ks N-Tuple example"); 00260 if ( m_tuple3 ) { 00261 m_dimuAlg->BookNtuple(m_tuple3); 00262 } 00263 else { 00264 log << MSG::ERROR << " Cannot book N-tuple:" << long(m_tuple3) << endmsg; 00265 return StatusCode::FAILURE; 00266 } 00267 } 00268 } 00269 } 00270 // 00271 //--------end of book-------- 00272 // 00273 00274 m_events=0; 00275 m_barrelBhabhaNumber=0; 00276 m_endcapBhabhaNumber=0; 00277 m_barrelDimuNumber=0; 00278 m_endcapDimuNumber=0; 00279 m_hadronNumber=0; 00280 m_barrelDiphotonNumber=0; 00281 m_endcapDiphotonNumber=0; 00282 00283 log << MSG::INFO << "successfully return from initialize()" <<endmsg; 00284 return StatusCode::SUCCESS; 00285 00286 }
|
|
|
|
00704 { 00705 double phi1=min(ph1,ph2); 00706 double phi2=max(ph1,ph2); 00707 double delta=0.0610865; //3.5*3.1415926/180. 00708 if((phi2-phi1)<CLHEP::pi){ 00709 phi1 -=delta; 00710 phi2 +=delta; 00711 if(phi1<0.) phi1 += CLHEP::twopi; 00712 if(phi2>CLHEP::twopi) phi2 -= CLHEP::twopi; 00713 double tmp1=min(phi1,phi2); 00714 double tmp2=max(phi1,phi2); 00715 phi1=tmp1; 00716 phi2=tmp2; 00717 } 00718 else{ 00719 phi1 +=delta; 00720 phi2 -=delta; 00721 } 00722 if((phi2-phi1)<CLHEP::pi){ 00723 if(ph<=phi2&&ph>=phi1) return true; 00724 else return false; 00725 } 00726 else{ 00727 if(ph>=phi2||ph<=phi1) return true; 00728 else return false; 00729 } 00730 }
|
|
Initial value: {40,44,48,56,64,72,80,80,76,76, 88,88,100,100,112,112,128,128,140,140, 160,160,160,160,176,176,176,176,208,208, 208,208,240,240,240,240,256,256,256,256, 288,288,288} |
|
number of events selected |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
number of total events |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|