BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
LocalKsSelector Class Reference

#include <LocalKsSelector.h>

+ Inheritance diagram for LocalKsSelector:

Public Member Functions

 LocalKsSelector ()
 
bool operator() (CDKs &aKs)
 
- Public Member Functions inherited from DCSelectionFunction< CDKs >
 DCSelectionFunction ()
 
virtual ~DCSelectionFunction ()
 
bool operator() (CDKs &iArg) const
 

Detailed Description

Definition at line 7 of file LocalKsSelector.h.

Constructor & Destructor Documentation

◆ LocalKsSelector()

LocalKsSelector::LocalKsSelector ( )

Definition at line 14 of file LocalKsSelector.cxx.

15{
16 IJobOptionsSvc* jobSvc;
17 Gaudi::svcLocator()->service("JobOptionsSvc", jobSvc);
18
19 PropertyMgr m_propMgr;
20
21 m_propMgr.declareProperty("KsMinMassCut", m_minMass = 0.470 );
22 m_propMgr.declareProperty("KsMaxMassCut", m_maxMass = 0.528 );
23 m_propMgr.declareProperty("KsMaxChisq", m_maxChisq = 100 );
24
25 m_propMgr.declareProperty("DoSecondaryVFit", m_doSecondaryVFit = false );
26 m_propMgr.declareProperty("KsMaxVFitChisq", m_maxVFitChisq = 100 );
27 m_propMgr.declareProperty("KsMinFlightSig", m_minFlightSig = 2.0 );
28 m_propMgr.declareProperty("UseVFRefine", m_useVFrefine = true);
29
30 m_propMgr.declareProperty("UseBFieldCorr", m_useBFC = true);
31
32 jobSvc->setMyProperties("LocalKsSelector", &m_propMgr);
33}

Member Function Documentation

◆ operator()()

bool LocalKsSelector::operator() ( CDKs & aKs)
virtual

Implements DCSelectionFunction< CDKs >.

Definition at line 35 of file LocalKsSelector.cxx.

35 {
36
37 aKs.setUserTag(1);
38 EvtRecVeeVertex* ks = const_cast<EvtRecVeeVertex*>( aKs.navKshort() );
39
40 if ( ks->vertexId() != 310 ) return false;
41
42 if( !m_useBFC ){
43 double mass = ks->mass();
44 if ((mass <= m_minMass)||(mass >= m_maxMass)) return false;
45 if ( ks->chi2() >= m_maxChisq ) return false;
46
47 if( !m_doSecondaryVFit ) return true;
48 }
49
50 // --------------------------------------------------
51 // Do a secondary vertex fit and check the flight significance
52 // --------------------------------------------------
53
54 EvtRecTrack* veeTrack1 = ks->pairDaughters().first;
55 RecMdcKalTrack* veeKalTrack1 = veeTrack1->mdcKalTrack();
56 veeKalTrack1->setPidType(RecMdcKalTrack::pion);
57 WTrackParameter veeInitialWTrack1 = WTrackParameter(0.13957018, veeKalTrack1->getZHelix(), veeKalTrack1->getZError());
58
59 EvtRecTrack* veeTrack2 = ks->pairDaughters().second;
60 RecMdcKalTrack* veeKalTrack2 = veeTrack2->mdcKalTrack();
61 veeKalTrack2->setPidType(RecMdcKalTrack::pion);
62 WTrackParameter veeInitialWTrack2 = WTrackParameter(0.13957018, veeKalTrack2->getZHelix(), veeKalTrack2->getZError());
63
64 //VertexParameter wideVertex;
65 HepPoint3D vWideVertex(0., 0., 0.);
66 HepSymMatrix evWideVertex(3, 0);
67
68 evWideVertex[0][0] = 1.0e12;
69 evWideVertex[1][1] = 1.0e12;
70 evWideVertex[2][2] = 1.0e12;
71
72 // add the primary vertex
73 HepPoint3D vBeamSpot(0., 0., 0.);
74 HepSymMatrix evBeamSpot(3, 0);
75
76 IVertexDbSvc* vtxsvc;
77 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
78 if(vtxsvc->isVertexValid()){
79 double* dbv = vtxsvc->PrimaryVertex();
80 double* vv = vtxsvc->SigmaPrimaryVertex();
81 for (unsigned int ivx = 0; ivx < 3; ivx++){
82 vBeamSpot[ivx] = dbv[ivx];
83 evBeamSpot[ivx][ivx] = vv[ivx] * vv[ivx];
84 }
85 }
86 else{
87 cout << "KSSELECTOR ERROR: Could not find a vertex from VertexDbSvc" << endl;
88 return false;
89 }
90
91 if(m_useVFrefine){
92
93 VertexParameter wideVertex;
94
95 wideVertex.setVx(vWideVertex);
96 wideVertex.setEvx(evWideVertex);
97
98 // First, perform a vertex fit refine
100 vtxfitr->init();
101
102 vtxfitr->AddTrack(0, veeKalTrack1, RecMdcKalTrack::pion);
103 vtxfitr->AddTrack(1, veeKalTrack2, RecMdcKalTrack::pion);
104 vtxfitr->AddVertex(0, wideVertex, 0, 1);
105
106 bool fitok = vtxfitr->Fit();
107
108 HepLorentzVector ppi1 = vtxfitr->pfit(0);
109 HepLorentzVector ppi2 = vtxfitr->pfit(1);
110 HepLorentzVector pks = ppi1 + ppi2;
111
112 double mass = pks.m();
113 double chisqvtx = vtxfitr->chisq(0);
114
115 if( m_useBFC ){
116 if ((mass <= m_minMass)||(mass >= m_maxMass)) return false;
117 //if ( ks->chi2() >= m_maxChisq ) return false;
118 if ( chisqvtx >= m_maxChisq ) return false;
119
120 if( !m_doSecondaryVFit ) return true;
121 }
122
123 // Now perform the secondary vertex fit
125 svtxfit->init();
126
127 // add the primary vertex
128 VertexParameter beamSpot;
129
130 beamSpot.setVx(vBeamSpot);
131 beamSpot.setEvx(evBeamSpot);
132
133 VertexParameter primaryVertex(beamSpot);
134 svtxfit->setPrimaryVertex(primaryVertex);
135
136 // add the secondary vertex
137 svtxfit->setVpar(vtxfitr->vpar(0));
138
139 // add the Ks or lambda
140 svtxfit->AddTrack(0,vtxfitr->wVirtualTrack(0));
141
142 // do the second vertex fit
143 // if the fit fails, the default values will not be changed
144 if( !svtxfit->Fit() ) return false;
145
146 // save the new ks parameters
147 double vfitlength = svtxfit->decayLength();
148 double vfiterror = svtxfit->decayLengthError();
149 double vfitchi2 = svtxfit->chisq();
150 double flightsig = 0;
151 if( vfiterror != 0 )
152 flightsig = vfitlength/vfiterror;
153
154 // if the ks does not meet the criteria, the information from
155 // the secondary vertex fit will not be filled (default = -999)
156 if( vfitchi2 > m_maxVFitChisq ) return false;
157 if( flightsig < m_minFlightSig ) return false;
158
159 return true;
160
161 }else{
162 VertexParameter wideVertex;
163
164 wideVertex.setVx(vWideVertex);
165 wideVertex.setEvx(evWideVertex);
166
167 // First, perform a vertex fit
168 VertexFit* vtxfit = VertexFit::instance();
169 vtxfit->init();
170
171 // add the daughters
172 vtxfit->AddTrack(0,veeInitialWTrack1);
173 vtxfit->AddTrack(1,veeInitialWTrack2);
174 vtxfit->AddVertex(0,wideVertex,0,1);
175
176 // do the fit
177 vtxfit->Fit(0);
178 vtxfit->Swim(0);
179 vtxfit->BuildVirtualParticle(0);
180
181 WTrackParameter wks = vtxfit->wVirtualTrack(0);
182 WTrackParameter wkspi1 = vtxfit->wtrk(0);
183 WTrackParameter wkspi2 = vtxfit->wtrk(1);
184
185 HepLorentzVector pks = wks.p();
186
187 double mass = pks.m();
188 double chisqvtx = vtxfit->chisq(0);
189
190 if( m_useBFC ){
191 if ((mass <= m_minMass)||(mass >= m_maxMass)) return false;
192 //if ( ks->chi2() >= m_maxChisq ) return false;
193 if ( chisqvtx >= m_maxChisq ) return false;
194
195 if( !m_doSecondaryVFit ) return true;
196 }
197
198 // Now perform the secondary vertex fit
200 svtxfit->init();
201
202 // add the primary vertex
203 VertexParameter beamSpot;
204
205 beamSpot.setVx(vBeamSpot);
206 beamSpot.setEvx(evBeamSpot);
207
208 VertexParameter primaryVertex(beamSpot);
209 svtxfit->setPrimaryVertex(primaryVertex);
210
211 // add the secondary vertex
212 svtxfit->setVpar(vtxfit->vpar(0));
213
214 // add the Ks or lambda
215 svtxfit->AddTrack(0,vtxfit->wVirtualTrack(0));
216
217 // do the second vertex fit
218 // if the fit fails, the default values will not be changed
219 if( !svtxfit->Fit() ) return false;
220
221 // save the new ks parameters
222 double vfitlength = svtxfit->decayLength();
223 double vfiterror = svtxfit->decayLengthError();
224 double vfitchi2 = svtxfit->chisq();
225 double flightsig = 0;
226 if( vfiterror != 0 )
227 flightsig = vfitlength/vfiterror;
228
229 // if the ks does not meet the criteria, the information from
230 // the secondary vertex fit will not be filled (default = -999)
231 if( vfitchi2 > m_maxVFitChisq ) return false;
232 if( flightsig < m_minFlightSig ) return false;
233
234 return true;
235
236
237 }
238
239
240
241}
double mass
void setUserTag(int tag)
virtual const EvtRecVeeVertex * navKshort() const
Definition CDKs.cxx:100
static void setPidType(PidType pidType)
RecMdcKalTrack * mdcKalTrack()
Definition EvtRecTrack.h:54
std::pair< SmartRef< EvtRecTrack >, SmartRef< EvtRecTrack > > & pairDaughters()
int vertexId() const
double mass() const
double chi2() const
virtual bool isVertexValid()=0
virtual double * SigmaPrimaryVertex()=0
virtual double * PrimaryVertex()=0
const HepVector & getZHelix() const
const HepSymMatrix & getZError() const
void setPrimaryVertex(const VertexParameter vpar)
double decayLength() const
double decayLengthError() const
static SecondVertexFit * instance()
void setVpar(const VertexParameter vpar)
double chisq() const
void AddTrack(const int number, const double mass, const RecMdcTrack *trk)
Definition TrackPool.cxx:22
WTrackParameter wVirtualTrack(int n) const
HepLorentzVector pfit(int n) const
double chisq() const
void AddTrack(const int index, RecMdcKalTrack *p, const RecMdcKalTrack::PidType pid)
static VertexFitRefine * instance()
void AddVertex(int number, VertexParameter vpar, std::vector< int > lis)
VertexParameter vpar(int n) const
WTrackParameter wtrk(int n) const
Definition VertexFit.h:79
double chisq() const
Definition VertexFit.h:66
WTrackParameter wVirtualTrack(int n) const
Definition VertexFit.h:92
void init()
Definition VertexFit.cxx:29
void AddVertex(int number, VertexParameter vpar, std::vector< int > lis)
Definition VertexFit.cxx:89
static VertexFit * instance()
Definition VertexFit.cxx:15
VertexParameter vpar(int n) const
Definition VertexFit.h:89
void BuildVirtualParticle(int number)
void Swim(int n)
Definition VertexFit.h:59
bool Fit()
void setEvx(const HepSymMatrix &eVx)
void setVx(const HepPoint3D &vx)
HepLorentzVector p() const

The documentation for this class was generated from the following files: