/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/DTagAlg/DTagAlg-00-01-04/src/LocalKaonSelector.cxx

Go to the documentation of this file.
00001 #include "GaudiKernel/Bootstrap.h"
00002 #include "GaudiKernel/IJobOptionsSvc.h"
00003 #include "GaudiKernel/ISvcLocator.h"
00004 #include "GaudiKernel/PropertyMgr.h"
00005 
00006 #include "EventModel/EventModel.h"
00007 #include "EventModel/EventHeader.h"
00008 #include "EvtRecEvent/EvtRecEvent.h"
00009 #include "EvtRecEvent/EvtRecTrack.h"
00010 #include "ParticleID/ParticleID.h"
00011 #include "DTagAlg/LocalKaonSelector.h"
00012 
00013 #include "VertexFit/IVertexDbSvc.h"
00014 #include "VertexFit/VertexFit.h"
00015 #include "VertexFit/Helix.h"
00016 
00017 #include "SimplePIDSvc/ISimplePIDSvc.h"
00018 
00019 LocalKaonSelector::LocalKaonSelector()
00020 {
00021   m_pidtype=0;
00022   
00023   IJobOptionsSvc* jobSvc;
00024   Gaudi::svcLocator()->service("JobOptionsSvc", jobSvc);
00025   
00026   PropertyMgr m_propMgr;
00027   
00028   //Declare the properties
00029   m_propMgr.declareProperty("RxyCut",               m_VrCut           = 1.0);
00030   m_propMgr.declareProperty("Vz0Cut",               m_VzCut           = 10.0);
00031   m_propMgr.declareProperty("CosThetaCut",          m_CosThetaCut     = 0.93);
00032   
00033   m_propMgr.declareProperty("useSimplePID",         m_useSimplePID    = true);
00034 
00035   m_propMgr.declareProperty("PidUseDedx",           m_useDedx         = true);
00036   m_propMgr.declareProperty("PidUseTof1",           m_useTof1         = true);
00037   m_propMgr.declareProperty("PidUseTof2",           m_useTof2         = true);
00038   m_propMgr.declareProperty("PidUseTofE",           m_useTofE         = false);
00039   m_propMgr.declareProperty("PidUseTofQ",           m_useTofQ         = false);
00040   m_propMgr.declareProperty("PidUseEmc",            m_useEmc          = false);
00041   m_propMgr.declareProperty("PidUseMuc",            m_useMuc          = false);
00042   
00043   m_propMgr.declareProperty("PidwithProbability",   m_probability     = true);
00044   m_propMgr.declareProperty("PidProbCut",           m_PidProbCut      = 0.001);
00045   m_propMgr.declareProperty("RejectPion",           m_rejectPion      = true);
00046   m_propMgr.declareProperty("RejectProton",         m_rejectProton    = false);
00047   
00048   m_propMgr.declareProperty("PidwithLikelihood",    m_likelihood      = false);
00049   m_propMgr.declareProperty("PidwithNeuronNetwork", m_neuronNetwork   = false);
00050   m_neuronValCut.clear();
00051   m_neuronValCut.push_back(1.5);
00052   m_neuronValCut.push_back(2.5);
00053   m_propMgr.declareProperty("NeuronValue",      m_neuronValCut);
00054   
00055   jobSvc->setMyProperties("LocalKaonSelector", &m_propMgr);
00056 }
00057 
00058 bool LocalKaonSelector::operator() (CDChargedKaon& aKaon) {
00059   
00060   aKaon.setUserTag(1);
00061   EvtRecTrack* recTrk = const_cast<EvtRecTrack*>( aKaon.track() );
00062   
00063   // MDC track selection
00064 
00065   RecMdcKalTrack::setPidType(RecMdcKalTrack::kaon);
00066   if ( !recTrk->isMdcKalTrackValid() ) return false;
00067   RecMdcKalTrack* mdcKalTrk = recTrk->mdcKalTrack();
00068   if ( mdcKalTrk->charge()==0 ) return false;
00069   
00070   Hep3Vector xorigin(0,0,0);
00071   IVertexDbSvc*  vtxsvc;
00072   Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
00073   if(vtxsvc->isVertexValid()){
00074     double* dbv = vtxsvc->PrimaryVertex();
00075     double*  vv = vtxsvc->SigmaPrimaryVertex();
00076     xorigin.setX(dbv[0]);
00077     xorigin.setY(dbv[1]);
00078     xorigin.setZ(dbv[2]);
00079   }
00080   HepVector a = mdcKalTrk->getZHelixK();
00081   HepSymMatrix Ea = mdcKalTrk->getZErrorK();
00082   HepPoint3D point0(0.,0.,0.);
00083   HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
00084   VFHelix helixip3(point0,a,Ea);
00085   helixip3.pivot(IP);
00086   HepVector  vecipa = helixip3.a();
00087   
00088   double dr=fabs(vecipa[0]);
00089   double dz=fabs(vecipa[3]);
00090   double costheta=cos(mdcKalTrk->theta());
00091   if (  dr>= m_VrCut ) return false;
00092   if (  dz>= m_VzCut ) return false;
00093   if ( fabs(costheta) >= m_CosThetaCut ) return false;
00094 
00095   // Simple PID
00096   if(m_useSimplePID){
00097     ISimplePIDSvc* m_simplePIDSvc;
00098     Gaudi::svcLocator()->service("SimplePIDSvc", m_simplePIDSvc);
00099     
00100     m_simplePIDSvc->preparePID(recTrk);
00101     if( !m_simplePIDSvc->iskaon() ){
00102       aKaon.setUserTag(2);
00103     }  
00104   }
00105   else{
00106     //particleID pacakge
00107     ParticleID *pid = ParticleID::instance();
00108     pid->init();
00109     pid->setMethod(pid->methodProbability());
00110     pid->setChiMinCut(4);
00111     pid->setRecTrack(recTrk);
00112     pid->usePidSys(pid->useDedx() | pid->useTof1() | pid->useTof2() | pid->useTof() );
00113     pid->identify(pid->onlyPion() | pid->onlyKaon());
00114     pid->calculate();
00115     
00116     if( !(pid->probKaon()>0 && pid->probKaon()>pid->probPion()) )
00117       aKaon.setUserTag(2);
00118     
00119   }
00120   
00121 
00122   
00123   if(m_pidtype==0) return true;
00124   
00125   if(aKaon.userTag()==1)
00126     return true;
00127   else
00128     return false;
00129   
00130 }
00131 
00132 LocalKaonSelector kaonSelector;

Generated on Tue Nov 29 23:13:08 2016 for BOSS_7.0.2 by  doxygen 1.4.7