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

#include <LocalLambdaSelector.h>

+ Inheritance diagram for LocalLambdaSelector:

Public Member Functions

 LocalLambdaSelector ()
 
bool operator() (CDLambda &aLambda)
 
bool IfProtonPID () const
 
- Public Member Functions inherited from DCSelectionFunction< CDLambda >
 DCSelectionFunction ()
 
virtual ~DCSelectionFunction ()
 
bool operator() (CDLambda &iArg) const
 

Detailed Description

Definition at line 7 of file LocalLambdaSelector.h.

Constructor & Destructor Documentation

◆ LocalLambdaSelector()

LocalLambdaSelector::LocalLambdaSelector ( )

Definition at line 15 of file LocalLambdaSelector.cxx.

16{
17 IJobOptionsSvc* jobSvc;
18 Gaudi::svcLocator()->service("JobOptionsSvc", jobSvc);
19
20 PropertyMgr m_propMgr;
21
22 m_propMgr.declareProperty("LambdaMinMassCut", m_minMass = 1.10 );
23 m_propMgr.declareProperty("LambdaMaxMassCut", m_maxMass = 1.13 );
24 m_propMgr.declareProperty("LambdaMaxChisq", m_maxChisq = 100 );
25 m_propMgr.declareProperty("UseProtonPID", m_UseProtonPID = true );
26 m_propMgr.declareProperty("ProtonPIDChiCut", m_ChiCut = 8);
27
28 m_propMgr.declareProperty("DoSecondaryVFit", m_doSecondaryVFit = false );
29 m_propMgr.declareProperty("LambdaMaxVFitChisq", m_maxVFitChisq = 100 );
30 m_propMgr.declareProperty("LambdaMinFlightSig", m_minFlightSig = 2.0 );
31 m_propMgr.declareProperty("UseVFRefine", m_useVFrefine = true);
32
33 jobSvc->setMyProperties("LocalLambdaSelector", &m_propMgr);
34}

Member Function Documentation

◆ IfProtonPID()

bool LocalLambdaSelector::IfProtonPID ( ) const
inline

Definition at line 14 of file LocalLambdaSelector.h.

14{return m_UseProtonPID;}

Referenced by utility::SecondaryVFit_Lambda(), and utility::SecondaryVFit_Lambdaref().

◆ operator()()

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

Implements DCSelectionFunction< CDLambda >.

Definition at line 36 of file LocalLambdaSelector.cxx.

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

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