CGEM BOSS 6.6.5.g
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("useSimplePID", m_useSimplePID = true);
34
35 m_propMgr.declareProperty("PidUseDedx", m_useDedx = true);
36 m_propMgr.declareProperty("PidUseTof1", m_useTof1 = true);
37 m_propMgr.declareProperty("PidUseTof2", m_useTof2 = true);
38 m_propMgr.declareProperty("PidUseTofE", m_useTofE = false);
39 m_propMgr.declareProperty("PidUseTofQ", m_useTofQ = false);
40 m_propMgr.declareProperty("PidUseEmc", m_useEmc = false);
41 m_propMgr.declareProperty("PidUseMuc", m_useMuc = false);
42
43 m_propMgr.declareProperty("PidwithProbability", m_probability = true);
44 m_propMgr.declareProperty("PidProbCut", m_PidProbCut = 0.001);
45 m_propMgr.declareProperty("RejectPion", m_rejectPion = true);
46 m_propMgr.declareProperty("RejectProton", m_rejectProton = false);
47
48 m_propMgr.declareProperty("PidwithLikelihood", m_likelihood = false);
49 m_propMgr.declareProperty("PidwithNeuronNetwork", m_neuronNetwork = false);
50 m_neuronValCut.clear();
51 m_neuronValCut.push_back(1.5);
52 m_neuronValCut.push_back(2.5);
53 m_propMgr.declareProperty("NeuronValue", m_neuronValCut);
54
55 jobSvc->setMyProperties("LocalKaonSelector", &m_propMgr);
56}
57
59
60 aKaon.setUserTag(1);
61 EvtRecTrack* recTrk = const_cast<EvtRecTrack*>( aKaon.track() );
62
63 // MDC track selection
64
66 if ( !recTrk->isMdcKalTrackValid() ) return false;
67 RecMdcKalTrack* mdcKalTrk = recTrk->mdcKalTrack();
68 if ( mdcKalTrk->charge()==0 ) return false;
69
70 Hep3Vector xorigin(0,0,0);
71 IVertexDbSvc* vtxsvc;
72 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
73 if(vtxsvc->isVertexValid()){
74 double* dbv = vtxsvc->PrimaryVertex();
75 double* vv = vtxsvc->SigmaPrimaryVertex();
76 xorigin.setX(dbv[0]);
77 xorigin.setY(dbv[1]);
78 xorigin.setZ(dbv[2]);
79 }
80 HepVector a = mdcKalTrk->getZHelixK();
81 HepSymMatrix Ea = mdcKalTrk->getZErrorK();
82 HepPoint3D point0(0.,0.,0.);
83 HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
84 VFHelix helixip3(point0,a,Ea);
85 helixip3.pivot(IP);
86 HepVector vecipa = helixip3.a();
87
88 double dr=fabs(vecipa[0]);
89 double dz=fabs(vecipa[3]);
90 double costheta=cos(mdcKalTrk->theta());
91 if ( dr>= m_VrCut ) return false;
92 if ( dz>= m_VzCut ) return false;
93 if ( fabs(costheta) >= m_CosThetaCut ) return false;
94
95 // Simple PID
96 if(m_useSimplePID){
97 ISimplePIDSvc* m_simplePIDSvc;
98 Gaudi::svcLocator()->service("SimplePIDSvc", m_simplePIDSvc);
99
100 m_simplePIDSvc->preparePID(recTrk);
101 if( !m_simplePIDSvc->iskaon() ){
102 aKaon.setUserTag(2);
103 }
104 }
105 else{
106 //particleID pacakge
108 pid->init();
109 pid->setMethod(pid->methodProbability());
110 pid->setChiMinCut(4);
111 pid->setRecTrack(recTrk);
112 pid->usePidSys(pid->useDedx() | pid->useTof1() | pid->useTof2() | pid->useTof() );
113 pid->identify(pid->onlyPion() | pid->onlyKaon());
114 pid->calculate();
115
116 if( !(pid->probKaon()>0 && pid->probKaon()>pid->probPion()) )
117 aKaon.setUserTag(2);
118
119 }
120
121
122
123 if(m_pidtype==0) return true;
124
125 if(aKaon.userTag()==1)
126 return true;
127 else
128 return false;
129
130}
131
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:48
RecMdcKalTrack * mdcKalTrack()
Definition: EvtRecTrack.h:62
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 useTof2() const
int useTof() const
int methodProbability() const
int useDedx() const
int onlyKaon() const
int onlyPion() const
int useTof1() const
void setChiMinCut(const double chi=4)
void setRecTrack(EvtRecTrack *trk)
double probKaon() const
Definition: ParticleID.h:131
void setMethod(const int method)
Definition: ParticleID.h:101
void identify(const int pidcase)
Definition: ParticleID.h:110
void usePidSys(const int pidsys)
Definition: ParticleID.h:104
static ParticleID * instance()
Definition: ParticleID.cxx:22
double probPion() const
Definition: ParticleID.h:130
void calculate()
Definition: ParticleID.cxx:101
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.