BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
LocalLambdaSelector Class Reference

#include <LocalLambdaSelector.h>

Inheritance diagram for LocalLambdaSelector:

Public Member Functions

 LocalLambdaSelector (const std::string &type, const std::string &name, const IInterface *parent)
bool operator() (CDLambda &aLambda) override
bool IfProtonPID () const override

Detailed Description

Definition at line 7 of file LocalLambdaSelector.h.

Constructor & Destructor Documentation

◆ LocalLambdaSelector()

LocalLambdaSelector::LocalLambdaSelector ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 13 of file LocalLambdaSelector.cxx.

15 : base_class( type, name, parent ) {
16 declareProperty( "LambdaMinMassCut", m_minMass = 1.10 );
17 declareProperty( "LambdaMaxMassCut", m_maxMass = 1.13 );
18 declareProperty( "LambdaMaxChisq", m_maxChisq = 100 );
19 declareProperty( "UseProtonPID", m_UseProtonPID = true );
20 declareProperty( "ProtonPIDChiCut", m_ChiCut = 8 );
21
22 declareProperty( "DoSecondaryVFit", m_doSecondaryVFit = false );
23 declareProperty( "LambdaMaxVFitChisq", m_maxVFitChisq = 100 );
24 declareProperty( "LambdaMinFlightSig", m_minFlightSig = 2.0 );
25 declareProperty( "UseVFRefine", m_useVFrefine = true );
26
27 declareProperty( "UseBFieldCorr", m_useBFC = true );
28}

Referenced by LocalLambdaSelector().

Member Function Documentation

◆ IfProtonPID()

bool LocalLambdaSelector::IfProtonPID ( ) const
inlineoverride

Definition at line 13 of file LocalLambdaSelector.h.

13{ return m_UseProtonPID; }

◆ operator()()

bool LocalLambdaSelector::operator() ( CDLambda & aLambda)
override

Definition at line 30 of file LocalLambdaSelector.cxx.

30 {
31
32 aLambda.setUserTag( 1 );
33 EvtRecVeeVertex* lambda = const_cast<EvtRecVeeVertex*>( aLambda.navLambda() );
34
35 if ( fabs( lambda->vertexId() ) != 3122 ) return false;
36
37 if ( !m_useBFC )
38 {
39 double mass = lambda->mass();
40 if ( ( mass <= m_minMass ) || ( mass >= m_maxMass ) ) return false;
41 if ( lambda->chi2() >= m_maxChisq ) return false;
42 }
43
44 // PID
45 int index[2] = { 0, 1 };
46 if ( lambda->vertexId() < 0 )
47 {
48 index[0] = 1;
49 index[1] = 0;
50 }
51
52 EvtRecTrack* recTrk_proton = lambda->daughter( index[0] );
53 EvtRecTrack* recTrk_pion = lambda->daughter( index[1] );
54
55 if ( m_UseProtonPID )
56 {
57 ParticleID* pid = ParticleID::instance();
58 pid->init();
59 pid->setMethod( pid->methodProbability() );
60 pid->setChiMinCut( m_ChiCut );
61 pid->setRecTrack( recTrk_proton );
62 // pid->usePidSys(pid->useDedx() | pid->useTof1() | pid->useTof2() | pid->useTof());
63 pid->usePidSys( pid->useDedx() | pid->useTofCorr() );
64 pid->identify( pid->onlyPion() | pid->onlyKaon() | pid->onlyProton() );
65 pid->calculate();
66 if ( !( pid->probProton() > 0. && pid->probProton() > pid->probPion() &&
67 pid->probProton() > pid->probKaon() ) )
68 return false;
69 }
70
71 if ( !m_useBFC )
72 {
73 if ( !m_doSecondaryVFit ) return true;
74 }
75 // --------------------------------------------------
76 // Do a secondary vertex fit and check the flight significance
77 // --------------------------------------------------
78
79 RecMdcKalTrack* mdcKalTrk_proton = recTrk_proton->mdcKalTrack();
80 mdcKalTrk_proton->setPidType( RecMdcKalTrack::proton );
81 WTrackParameter WTrk_proton;
82 WTrk_proton = WTrackParameter( 0.9314940054, mdcKalTrk_proton->getZHelixP(),
83 mdcKalTrk_proton->getZErrorP() );
84
85 RecMdcKalTrack* mdcKalTrk_pion = recTrk_pion->mdcKalTrack();
86 mdcKalTrk_pion->setPidType( RecMdcKalTrack::pion );
87 WTrackParameter WTrk_pion =
88 WTrackParameter( 0.13957018, mdcKalTrk_pion->getZHelix(), mdcKalTrk_pion->getZError() );
89
90 // VertexParameter wideVertex;
91 HepPoint3D vWideVertex( 0., 0., 0. );
92 HepSymMatrix evWideVertex( 3, 0 );
93
94 evWideVertex[0][0] = 1.0e12;
95 evWideVertex[1][1] = 1.0e12;
96 evWideVertex[2][2] = 1.0e12;
97
98 // add the primary vertex
99 HepPoint3D vBeamSpot( 0., 0., 0. );
100 HepSymMatrix evBeamSpot( 3, 0 );
101
102 IVertexDbSvc* vtxsvc;
103 StatusCode sc = serviceLocator()->service( "VertexDbSvc", vtxsvc );
104 if ( vtxsvc->isVertexValid() )
105 {
106 double* dbv = vtxsvc->PrimaryVertex();
107 double* vv = vtxsvc->SigmaPrimaryVertex();
108 for ( unsigned int ivx = 0; ivx < 3; ivx++ )
109 {
110 vBeamSpot[ivx] = dbv[ivx];
111 evBeamSpot[ivx][ivx] = vv[ivx] * vv[ivx];
112 }
113 }
114 else
115 {
116 cout << "LambdaSELECTOR ERROR: Could not find a vertex from VertexDbSvc" << endl;
117 return false;
118 }
119
120 if ( m_useVFrefine )
121 {
122
123 VertexParameter wideVertex;
124
125 wideVertex.setVx( vWideVertex );
126 wideVertex.setEvx( evWideVertex );
127
128 // First, perform a vertex fit refine
129 VertexFitRefine* vtxfitr = VertexFitRefine::instance();
130 vtxfitr->init();
131
132 vtxfitr->AddTrack( 0, mdcKalTrk_proton, RecMdcKalTrack::proton );
133 vtxfitr->AddTrack( 1, mdcKalTrk_pion, RecMdcKalTrack::pion );
134 vtxfitr->AddVertex( 0, wideVertex, 0, 1 );
135
136 bool fitok = vtxfitr->Fit();
137
138 HepLorentzVector ppr = vtxfitr->pfit( 0 );
139 HepLorentzVector ppi = vtxfitr->pfit( 1 );
140 HepLorentzVector plambda = ppr + ppi;
141
142 double mass = plambda.m();
143 double chisqvtx = vtxfitr->chisq( 0 );
144
145 if ( m_useBFC )
146 {
147 if ( ( mass <= m_minMass ) || ( mass >= m_maxMass ) ) return false;
148 // if ( lambda->chi2() >= m_maxChisq ) return false;
149 if ( chisqvtx >= m_maxChisq ) return false;
150
151 if ( !m_doSecondaryVFit ) return true;
152 }
153
154 // Now perform the secondary vertex fit
155 SecondVertexFit* svtxfit = SecondVertexFit::instance();
156 svtxfit->init();
157
158 // add the primary vertex
159 VertexParameter beamSpot;
160
161 beamSpot.setVx( vBeamSpot );
162 beamSpot.setEvx( evBeamSpot );
163
164 VertexParameter primaryVertex( beamSpot );
165 svtxfit->setPrimaryVertex( primaryVertex );
166
167 // add the secondary vertex
168 svtxfit->setVpar( vtxfitr->vpar( 0 ) );
169
170 // add the Ks or lambda
171 svtxfit->AddTrack( 0, vtxfitr->wVirtualTrack( 0 ) );
172
173 // do the second vertex fit
174 // if the fit fails, the default values will not be changed
175 if ( !svtxfit->Fit() ) return false;
176
177 // save the new ks parameters
178 double vfitlength = svtxfit->decayLength();
179 double vfiterror = svtxfit->decayLengthError();
180 double vfitchi2 = svtxfit->chisq();
181 double flightsig = 0;
182 if ( vfiterror != 0 ) flightsig = vfitlength / vfiterror;
183
184 // if the ks does not meet the criteria, the information from
185 // the secondary vertex fit will not be filled (default = -999)
186 if ( vfitchi2 > m_maxVFitChisq ) return false;
187 if ( flightsig < m_minFlightSig ) return false;
188
189 return true;
190 }
191 else
192 {
193 VertexParameter wideVertex;
194
195 wideVertex.setVx( vWideVertex );
196 wideVertex.setEvx( evWideVertex );
197
198 // First, perform a vertex fit
199 VertexFit* vtxfit = VertexFit::instance();
200 vtxfit->init();
201
202 // add the daughters
203 vtxfit->AddTrack( 0, WTrk_proton );
204 vtxfit->AddTrack( 1, WTrk_pion );
205 vtxfit->AddVertex( 0, wideVertex, 0, 1 );
206
207 // do the fit
208 vtxfit->Fit( 0 );
209 vtxfit->Swim( 0 );
210 vtxfit->BuildVirtualParticle( 0 );
211
212 WTrackParameter wlambda = vtxfit->wVirtualTrack( 0 );
213
214 HepLorentzVector plambda = wlambda.p();
215
216 double mass = plambda.m();
217 double chisqvtx = vtxfit->chisq( 0 );
218
219 if ( m_useBFC )
220 {
221 if ( ( mass <= m_minMass ) || ( mass >= m_maxMass ) ) return false;
222 // if ( lambda->chi2() >= m_maxChisq ) return false;
223 if ( chisqvtx >= m_maxChisq ) return false;
224
225 if ( !m_doSecondaryVFit ) return true;
226 }
227
228 // Now perform the secondary vertex fit
229 SecondVertexFit* svtxfit = SecondVertexFit::instance();
230 svtxfit->init();
231
232 // add the primary vertex
233 VertexParameter beamSpot;
234 beamSpot.setVx( vBeamSpot );
235 beamSpot.setEvx( evBeamSpot );
236
237 VertexParameter primaryVertex( beamSpot );
238 svtxfit->setPrimaryVertex( primaryVertex );
239
240 // add the secondary vertex
241 svtxfit->setVpar( vtxfit->vpar( 0 ) );
242
243 // add the Ks or lambda
244 svtxfit->AddTrack( 0, vtxfit->wVirtualTrack( 0 ) );
245
246 // do the second vertex fit
247 // if the fit fails, the default values will not be changed
248 if ( !svtxfit->Fit() ) return false;
249
250 // save the new ks parameters
251 double vfitlength = svtxfit->decayLength();
252 double vfiterror = svtxfit->decayLengthError();
253 double vfitchi2 = svtxfit->chisq();
254 double flightsig = 0;
255 if ( vfiterror != 0 ) flightsig = vfitlength / vfiterror;
256
257 // if the ks does not meet the criteria, the information from
258 // the secondary vertex fit will not be filled (default = -999)
259 if ( vfitchi2 > m_maxVFitChisq ) return false;
260 if ( flightsig < m_minFlightSig ) return false;
261
262 return true;
263 }
264}
double mass
HepGeom::Point3D< double > HepPoint3D
void setUserTag(int tag)
virtual const EvtRecVeeVertex * navLambda() const
Definition CDLambda.cxx:106
virtual bool isVertexValid()=0
virtual double * SigmaPrimaryVertex()=0
virtual double * PrimaryVertex()=0
static ParticleID * instance()
void calculate()
void init()
void setPrimaryVertex(const VertexParameter vpar)
static SecondVertexFit * instance()
void AddTrack(const int number, const double mass, const RecMdcTrack *trk)
Definition TrackPool.cxx:21
void AddTrack(const int index, RecMdcKalTrack *p, const RecMdcKalTrack::PidType pid)
static VertexFitRefine * instance()
void AddVertex(int number, VertexParameter vpar, std::vector< int > lis)
WTrackParameter wVirtualTrack(int n) const
void init()
Definition VertexFit.cxx:27
void AddVertex(int number, VertexParameter vpar, std::vector< int > lis)
Definition VertexFit.cxx:85
static VertexFit * instance()
Definition VertexFit.cxx:15
void BuildVirtualParticle(int number)
bool Fit()

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