CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
LocalPionSelector.cxx
Go to the documentation of this file.
1
2#include "GaudiKernel/Bootstrap.h"
3#include "GaudiKernel/IJobOptionsSvc.h"
4#include "GaudiKernel/ISvcLocator.h"
5#include "GaudiKernel/PropertyMgr.h"
6
7#include "EventModel/EventModel.h"
8#include "EventModel/EventHeader.h"
9#include "EvtRecEvent/EvtRecEvent.h"
10#include "EvtRecEvent/EvtRecTrack.h"
11#include "ParticleID/ParticleID.h"
12#include "DTagAlg/LocalPionSelector.h"
13
14#include "VertexFit/IVertexDbSvc.h"
15#include "VertexFit/VertexFit.h"
16#include "VertexFit/Helix.h"
17
18#include "SimplePIDSvc/ISimplePIDSvc.h"
19
21{
22 m_pidtype=0;
23
24 IJobOptionsSvc* jobSvc;
25 Gaudi::svcLocator()->service("JobOptionsSvc", jobSvc);
26
27 PropertyMgr m_propMgr;
28
29 //Declare the properties
30 m_propMgr.declareProperty("RxyCut", m_VrCut = 1.0);
31 m_propMgr.declareProperty("Vz0Cut", m_VzCut = 10.0);
32 m_propMgr.declareProperty("CosThetaCut", m_CosThetaCut = 0.93);
33
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("RejectKaon", m_rejectKaon = 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("LocalPionSelector", &m_propMgr);
57}
58
60
61 aPion.setUserTag(1);
62 EvtRecTrack* recTrk = const_cast<EvtRecTrack*>( aPion.track() );
63
64
65 // MDC track selection
66
68 if ( !recTrk->isMdcKalTrackValid() ) return false;
69 RecMdcKalTrack* mdcKalTrk = recTrk->mdcKalTrack();
70 if ( mdcKalTrk->charge()==0 ) return false;
71
72 Hep3Vector xorigin(0,0,0);
73 IVertexDbSvc* vtxsvc;
74 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
75 if(vtxsvc->isVertexValid()){
76 double* dbv = vtxsvc->PrimaryVertex();
77 double* vv = vtxsvc->SigmaPrimaryVertex();
78 xorigin.setX(dbv[0]);
79 xorigin.setY(dbv[1]);
80 xorigin.setZ(dbv[2]);
81 }
82 HepVector a = mdcKalTrk->getZHelix();
83 HepSymMatrix Ea = mdcKalTrk->getZError();
84 HepPoint3D point0(0.,0.,0.);
85 HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
86 VFHelix helixip3(point0,a,Ea);
87 helixip3.pivot(IP);
88 HepVector vecipa = helixip3.a();
89
90 double dr=fabs(vecipa[0]);
91 double dz=fabs(vecipa[3]);
92 double costheta=cos(mdcKalTrk->theta());
93 if ( dr>= m_VrCut ) return false;
94 if ( dz>= m_VzCut ) return false;
95 if ( fabs(costheta) >= m_CosThetaCut ) return false;
96
97
98 if(m_useSimplePID){
99 // PID
100 ISimplePIDSvc* m_simplePIDSvc;
101 Gaudi::svcLocator()->service("SimplePIDSvc", m_simplePIDSvc);
102 m_simplePIDSvc->preparePID(recTrk);
103 if( !m_simplePIDSvc->ispion() ){
104 aPion.setUserTag(2);
105 }
106 }
107 else{
108 //particleID pacakge
110 pid->init();
111 pid->setMethod(pid->methodProbability());
112 pid->setChiMinCut(4);
113 pid->setRecTrack(recTrk);
114 pid->usePidSys(pid->useDedx() | pid->useTof1() | pid->useTof2() | pid->useTof() );
115 pid->identify(pid->onlyPion() | pid->onlyKaon());
116 pid->calculate();
117
118 if( !(pid->probPion()>0 && pid->probPion()>pid->probKaon()) )
119 aPion.setUserTag(2);
120
121 }
122
123 if(m_pidtype==0) return true;
124
125 if(aPion.userTag()==1)
126 return true;
127 else
128 return false;
129
130}
131
double cos(const BesAngle a)
LocalPionSelector pionSelector
void setUserTag(int tag)
Definition: CDCandidate.cxx:81
int userTag() const
virtual bool ispion()=0
virtual void preparePID(EvtRecTrack *track)=0
virtual bool isVertexValid()=0
virtual double * SigmaPrimaryVertex()=0
virtual double * PrimaryVertex()=0
bool operator()(CDChargedPion &aPion)
static ParticleID * instance()
Definition: ParticleID.cxx:22
void calculate()
Definition: ParticleID.cxx:101
void init()
Definition: ParticleID.cxx:27
const HepPoint3D & pivot(void) const
returns pivot position.
const HepVector & a(void) const
returns helix parameters.