BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
LocalKaonSelector.cxx
Go to the documentation of this file.
1#include "GaudiKernel/Bootstrap.h"
2#include "GaudiKernel/IJobOptionsSvc.h"
3#include "GaudiKernel/ISvcLocator.h"
4#include "GaudiKernel/PropertyMgr.h"
5
12
14#include "VertexFit/VertexFit.h"
15#include "VertexFit/Helix.h"
16
18
20{
21 m_pidtype=0;
22
23 IJobOptionsSvc* jobSvc;
24 Gaudi::svcLocator()->service("JobOptionsSvc", jobSvc);
25
26 PropertyMgr m_propMgr;
27
28 //Declare the properties
29 m_propMgr.declareProperty("RxyCut", m_VrCut = 1.0);
30 m_propMgr.declareProperty("Vz0Cut", m_VzCut = 10.0);
31 m_propMgr.declareProperty("CosThetaCut", m_CosThetaCut = 0.93);
32
33 m_propMgr.declareProperty("PID", m_PID = true);
34 m_propMgr.declareProperty("useSimplePID", m_useSimplePID = true);
35
36 m_propMgr.declareProperty("PidUseDedx", m_useDedx = true);
37 m_propMgr.declareProperty("PidUseTof1", m_useTof1 = true);
38 m_propMgr.declareProperty("PidUseTof2", m_useTof2 = true);
39 m_propMgr.declareProperty("PidUseTofE", m_useTofE = false);
40 m_propMgr.declareProperty("PidUseTofQ", m_useTofQ = false);
41 m_propMgr.declareProperty("PidUseEmc", m_useEmc = false);
42 m_propMgr.declareProperty("PidUseMuc", m_useMuc = false);
43
44 m_propMgr.declareProperty("PidwithProbability", m_probability = true);
45 m_propMgr.declareProperty("PidProbCut", m_PidProbCut = 0.001);
46 m_propMgr.declareProperty("RejectPion", m_rejectPion = true);
47 m_propMgr.declareProperty("RejectProton", m_rejectProton = false);
48
49 m_propMgr.declareProperty("PidwithLikelihood", m_likelihood = false);
50 m_propMgr.declareProperty("PidwithNeuronNetwork", m_neuronNetwork = false);
51 m_neuronValCut.clear();
52 m_neuronValCut.push_back(1.5);
53 m_neuronValCut.push_back(2.5);
54 m_propMgr.declareProperty("NeuronValue", m_neuronValCut);
55
56 jobSvc->setMyProperties("LocalKaonSelector", &m_propMgr);
57}
58
60
61 aKaon.setUserTag(1);
62 EvtRecTrack* recTrk = const_cast<EvtRecTrack*>( aKaon.track() );
63
64 // MDC track selection
65
67 if ( !recTrk->isMdcKalTrackValid() ) return false;
68 RecMdcKalTrack* mdcKalTrk = recTrk->mdcKalTrack();
69 if ( mdcKalTrk->charge()==0 ) return false;
70
71 Hep3Vector xorigin(0,0,0);
72 IVertexDbSvc* vtxsvc;
73 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
74 if(vtxsvc->isVertexValid()){
75 double* dbv = vtxsvc->PrimaryVertex();
76 double* vv = vtxsvc->SigmaPrimaryVertex();
77 xorigin.setX(dbv[0]);
78 xorigin.setY(dbv[1]);
79 xorigin.setZ(dbv[2]);
80 }
81 HepVector a = mdcKalTrk->getZHelixK();
82 HepSymMatrix Ea = mdcKalTrk->getZErrorK();
83 HepPoint3D point0(0.,0.,0.);
84 HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
85 VFHelix helixip3(point0,a,Ea);
86 helixip3.pivot(IP);
87 HepVector vecipa = helixip3.a();
88
89 double dr=fabs(vecipa[0]);
90 double dz=fabs(vecipa[3]);
91 double costheta=cos(mdcKalTrk->theta());
92 if ( dr>= m_VrCut ) return false;
93 if ( dz>= m_VzCut ) return false;
94 if ( fabs(costheta) >= m_CosThetaCut ) return false;
95
96 if(!m_PID) return true;
97
98 // Simple PID
99 if(m_useSimplePID){
100 ISimplePIDSvc* m_simplePIDSvc;
101 Gaudi::svcLocator()->service("SimplePIDSvc", m_simplePIDSvc);
102
103 m_simplePIDSvc->preparePID(recTrk);
104 if( !m_simplePIDSvc->iskaon() ){
105 aKaon.setUserTag(2);
106 }
107 }
108 else{
109 //particleID pacakge
111 pid->init();
112 pid->setMethod(pid->methodProbability());
113 pid->setChiMinCut(4);
114 pid->setRecTrack(recTrk);
115 pid->usePidSys(pid->useDedx() | pid->useTofCorr() );
116 pid->identify(pid->onlyPion() | pid->onlyKaon());
117 pid->calculate();
118
119 if( !(pid->probKaon()>0 && pid->probKaon()>pid->probPion()) )
120 aKaon.setUserTag(2);
121
122 }
123
124
125
126 if(m_pidtype==0) return true;
127
128 if(aKaon.userTag()==1)
129 return true;
130 else
131 return false;
132
133}
134
double cos(const BesAngle a)
Definition: BesAngle.h:213
LocalKaonSelector kaonSelector
void setUserTag(int tag)
Definition: CDCandidate.cxx:81
int userTag() const
virtual const EvtRecTrack * track() const
const double theta() const
static void setPidType(PidType pidType)
const int charge() const
bool isMdcKalTrackValid()
Definition: EvtRecTrack.h:44
RecMdcKalTrack * mdcKalTrack()
Definition: EvtRecTrack.h:54
virtual void preparePID(EvtRecTrack *track)=0
virtual bool iskaon()=0
virtual bool isVertexValid()=0
virtual double * SigmaPrimaryVertex()=0
virtual double * PrimaryVertex()=0
bool operator()(CDChargedKaon &aKaon)
int useTofCorr() const
int methodProbability() const
int useDedx() const
int onlyKaon() const
int onlyPion() const
void setChiMinCut(const double chi=4)
void setRecTrack(EvtRecTrack *trk)
double probKaon() const
Definition: ParticleID.h:124
void setMethod(const int method)
Definition: ParticleID.h:94
void identify(const int pidcase)
Definition: ParticleID.h:103
void usePidSys(const int pidsys)
Definition: ParticleID.h:97
static ParticleID * instance()
Definition: ParticleID.cxx:22
double probPion() const
Definition: ParticleID.h:123
void calculate()
Definition: ParticleID.cxx:97
void init()
Definition: ParticleID.cxx:27
HepVector & getZHelixK()
HepSymMatrix & getZErrorK()
const HepPoint3D & pivot(void) const
returns pivot position.
const HepVector & a(void) const
returns helix parameters.
float costheta