BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
LambdaReconstruction Class Reference

#include <LambdaReconstruction.h>

+ Inheritance diagram for LambdaReconstruction:

Public Member Functions

 LambdaReconstruction (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 

Detailed Description

Definition at line 10 of file LambdaReconstruction.h.

Constructor & Destructor Documentation

◆ LambdaReconstruction()

LambdaReconstruction::LambdaReconstruction ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 31 of file LambdaReconstruction.cxx.

31 :
32Algorithm(name, pSvcLocator) {
33 //Declare the properties
34
35 declareProperty("Vz0Cut", m_vzCut = 20.0);
36 declareProperty("CosThetaCut", m_cosThetaCut=0.93);
37 declareProperty("ChisqCut", m_chisqCut = 100.0);
38 /*
39 declareProperty("PidUseDedx", m_useDedx = true);
40 declareProperty("PidUseTof1", m_useTof1 = true);
41 declareProperty("PidUseTof2", m_useTof2 = true);
42 declareProperty("PidUseTofE", m_useTofE = false);
43 declareProperty("PidUseTofQ", m_useTofQ = false);
44 declareProperty("PidUseEmc", m_useEmc = false);
45 declareProperty("PidProbCut", m_PidProbCut= 0.001);
46 declareProperty("MassRangeLower", m_massRangeLower = 0.45);
47 declareProperty("MassRangeHigher", m_massRangeHigher = 0.55);
48 */
49}

Member Function Documentation

◆ execute()

StatusCode LambdaReconstruction::execute ( )

Definition at line 78 of file LambdaReconstruction.cxx.

78 {
79 MsgStream log(msgSvc(), name());
80 log << MSG::INFO << "in execute()" << endreq;
81
82 StatusCode sc;
83
84 //////////////////
85 // Read REC data
86 /////////////////
87 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
88 SmartDataPtr<EvtRecEvent> recEvent(eventSvc(), EventModel::EvtRec::EvtRecEvent);
89 SmartDataPtr<EvtRecTrackCol> recTrackCol(eventSvc(), EventModel::EvtRec::EvtRecTrackCol);
90 log << MSG::DEBUG << "run and event = " << eventHeader->runNumber()
91 << " " << eventHeader->eventNumber() << endreq;
92 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
93 << recEvent->totalCharged() << " , "
94 << recEvent->totalNeutral() << " , "
95 << recEvent->totalTracks() <<endreq;
96 int evtNo = eventHeader->eventNumber();
97 //if (eventHeader->eventNumber() % 1000 == 0) {
98 // cout << "Event number = " << evtNo << endl;
99 //}
100
101 SmartDataPtr<EvtRecVeeVertexCol> veeVertexCol(eventSvc(),
103 if (!veeVertexCol) {
104 veeVertexCol = new EvtRecVeeVertexCol;
105 sc = registerEvtRecVeeVertexCol(veeVertexCol, log);
106 if (sc != StatusCode::SUCCESS) {
107 return sc;
108 }
109 }
110
111 //////////////////////////////////////////////
112 // No PID : identify positive and negative
113 ///////////////////////////////////////////////
114 Vint icp, icm, iGood;
115 for (unsigned int i = 0; i < recEvent->totalCharged(); i++) {
116 EvtRecTrackIterator itTrk = recTrackCol->begin() + i;
117 if(!(*itTrk)->isMdcTrackValid()) continue;
118 if(!(*itTrk)->isMdcKalTrackValid()) continue;
119 RecMdcTrack* mdcTrk = (*itTrk)->mdcTrack();
120 if (fabs(cos(mdcTrk->theta())) >= m_cosThetaCut) continue;
121 if (fabs(mdcTrk->z()) >= m_vzCut) continue;
122 iGood.push_back(i);
123 if (mdcTrk->charge() > 0) icp.push_back(i);
124 if (mdcTrk->charge() < 0) icm.push_back(i);
125 }
126 // Cut on good charged tracks
127 //if (iGood.size() < 2) return StatusCode::SUCCESS;
128 if (icp.size() < 1 || icm.size() < 1) return StatusCode::SUCCESS;
129
130 ///////////////////////////////////
131 // Vertex Fit
132 //////////////////////////////////
133 HepPoint3D vx(0., 0., 0.);
134 HepSymMatrix Evx(3, 0);
135 double bx = 1E+6;
136 double by = 1E+6;
137 double bz = 1E+6;
138 Evx[0][0] = bx*bx;
139 Evx[1][1] = by*by;
140 Evx[2][2] = bz*bz;
141 VertexParameter vxpar;
142 vxpar.setVx(vx);
143 vxpar.setEvx(Evx);
144
145 VertexFit *vtxfit0 = VertexFit::instance();
146
147 // For Lambda reconstruction
148 for(unsigned int i1 = 0; i1 < icp.size(); i1++) {
149 int ip1 = icp[i1];
150 RecMdcKalTrack *ppKalTrk = (*(recTrackCol->begin()+ip1))->mdcKalTrack();
152 WTrackParameter wpptrk(mp, ppKalTrk->helix(), ppKalTrk->err());
153
154 for(unsigned int i2 = 0; i2 < icm.size(); i2++) {
155 int ip2 = icm[i2];
156 RecMdcKalTrack *pimKalTrk = (*(recTrackCol->begin()+ip2))->mdcKalTrack();
158 WTrackParameter wpimtrk(mpi, pimKalTrk->helix(), pimKalTrk->err());
159
160 vtxfit0->init();
161 vtxfit0->AddTrack(0, wpptrk);
162 vtxfit0->AddTrack(1, wpimtrk);
163 vtxfit0->AddVertex(0, vxpar, 0, 1);
164 if(!(vtxfit0->Fit(0))) continue;
165 vtxfit0->BuildVirtualParticle(0);
166 if(vtxfit0->chisq(0) > m_chisqCut) continue;
167 WTrackParameter wLamb = vtxfit0->wVirtualTrack(0); //FIXME
168 std::pair<int, int> pair;
169 pair.first = 5;
170 pair.second = 3;
171
172 EvtRecTrack* track0 = *(recTrackCol->begin() + ip1);
173 EvtRecTrack* track1 = *(recTrackCol->begin() + ip2);
174
175 EvtRecVeeVertex* LambdaVertex = new EvtRecVeeVertex;
176 LambdaVertex->setVertexId(3122);
177 LambdaVertex->setVertexType(1);
178 LambdaVertex->setChi2(vtxfit0->chisq(0));
179 LambdaVertex->setNdof(1);
180 LambdaVertex->setMass(wLamb.p().m());
181 LambdaVertex->setW(wLamb.w());
182 LambdaVertex->setEw(wLamb.Ew());
183 LambdaVertex->setPair(pair);
184 LambdaVertex->setNCharge(0);
185 LambdaVertex->setNTracks(2);
186 LambdaVertex->addDaughter(track0, 0);
187 LambdaVertex->addDaughter(track1, 1);
188 veeVertexCol->push_back(LambdaVertex);
189 /*
190 cout << "============= After Vertex fitting ===========" << endl;
191 cout << "Event number = " << evtNo << endl;
192 cout << "chi2 = " << vtxfit0->chisq(0) << endl;
193 cout << "mass = " << wLamb.p().m() << endl;
194 cout << "w = " << wLamb.w() << endl;
195 cout << "Ew = " << wLamb.Ew() << endl;
196 cout << "track 0 : Z : " << track0->mdcTrack()->z() << endl;
197 cout << "track 1 : Z : " << track1->mdcTrack()->z() << endl; */
198 }
199 }
200
201 // For Anti-Lambda reconstruction
202 for(unsigned int i1 = 0; i1 < icp.size(); i1++) {
203 int ip1 = icp[i1];
204 RecMdcKalTrack *pipKalTrk = (*(recTrackCol->begin()+ip1))->mdcKalTrack();
206 WTrackParameter wpiptrk(mpi, pipKalTrk->helix(), pipKalTrk->err());
207
208 for(unsigned int i2 = 0; i2 < icm.size(); i2++) {
209 int ip2 = icm[i2];
210 RecMdcKalTrack *pmKalTrk = (*(recTrackCol->begin()+ip2))->mdcKalTrack();
212 WTrackParameter wpmtrk(mp, pmKalTrk->helix(), pmKalTrk->err());
213
214 vtxfit0->init();
215 vtxfit0->AddTrack(0, wpiptrk);
216 vtxfit0->AddTrack(1, wpmtrk);
217 vtxfit0->AddVertex(0, vxpar, 0, 1);
218 if(!(vtxfit0->Fit(0))) continue;
219 vtxfit0->BuildVirtualParticle(0);
220 if(vtxfit0->chisq(0) > m_chisqCut) continue;
221 WTrackParameter wALamb = vtxfit0->wVirtualTrack(0); //FIXME
222 std::pair<int, int> pair;
223 pair.first = 3;
224 pair.second = 5;
225
226 EvtRecTrack* track0 = *(recTrackCol->begin() + ip1);
227 EvtRecTrack* track1 = *(recTrackCol->begin() + ip2);
228
229 EvtRecVeeVertex* ALambdaVertex = new EvtRecVeeVertex;
230 ALambdaVertex->setVertexId(-3122);
231 ALambdaVertex->setVertexType(1);
232 ALambdaVertex->setChi2(vtxfit0->chisq(0));
233 ALambdaVertex->setNdof(1);
234 ALambdaVertex->setMass(wALamb.p().m());
235 ALambdaVertex->setW(wALamb.w());
236 ALambdaVertex->setEw(wALamb.Ew());
237 ALambdaVertex->setPair(pair);
238 ALambdaVertex->setNCharge(0);
239 ALambdaVertex->setNTracks(2);
240 ALambdaVertex->addDaughter(track0, 0);
241 ALambdaVertex->addDaughter(track1, 1);
242 veeVertexCol->push_back(ALambdaVertex);
243 /*
244 cout << "============= After Vertex fitting ===========" << endl;
245 cout << "Event number = " << evtNo << endl;
246 cout << "chi2 = " << vtxfit0->chisq(0) << endl;
247 cout << "mass = " << wALamb.p().m() << endl;
248 cout << "w = " << wALamb.w() << endl;
249 cout << "Ew = " << wALamb.Ew() << endl;
250 cout << "track 0 : Z : " << track0->mdcTrack()->z() << endl;
251 cout << "track 1 : Z : " << track1->mdcTrack()->z() << endl; */
252 }
253 }
254
255
256
257 return StatusCode::SUCCESS;
258}
double cos(const BesAngle a)
Definition: BesAngle.h:213
EvtRecTrackCol::iterator EvtRecTrackIterator
Definition: EvtRecTrack.h:111
ObjectVector< EvtRecVeeVertex > EvtRecVeeVertexCol
const double mpi
Definition: Gam4pikp.cxx:47
std::vector< int > Vint
Definition: Gam4pikp.cxx:52
IMessageSvc * msgSvc()
const HepVector & helix() const
static void setPidType(PidType pidType)
const HepSymMatrix & err() const
const double theta() const
Definition: DstMdcTrack.h:59
const int charge() const
Definition: DstMdcTrack.h:53
const double z() const
Definition: DstMdcTrack.h:63
void setVertexType(int vtxType)
void setChi2(double chi2)
void addDaughter(const SmartRef< EvtRecTrack > &track, int i)
void setEw(const HepSymMatrix &Ew)
void setMass(double mass)
void setNdof(int ndof)
void setNTracks(int nTracks)
void setVertexId(int vtxId)
void setPair(const std::pair< int, int > &pair)
void setW(const HepVector &w)
void setNCharge(int nCharge)
void AddTrack(const int number, const double mass, const RecMdcTrack *trk)
Definition: TrackPool.cxx:22
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
void BuildVirtualParticle(int number)
Definition: VertexFit.cxx:619
bool Fit()
Definition: VertexFit.cxx:301
void setEvx(const HepSymMatrix &eVx)
void setVx(const HepPoint3D &vx)
HepLorentzVector p() const
HepVector w() const
HepSymMatrix Ew() const
const double mp
Definition: incllambda.cxx:45
_EXTERN_ std::string EvtRecEvent
Definition: EventModel.h:116
_EXTERN_ std::string EvtRecVeeVertexCol
Definition: EventModel.h:121
_EXTERN_ std::string EvtRecTrackCol
Definition: EventModel.h:117

◆ finalize()

StatusCode LambdaReconstruction::finalize ( )

Definition at line 60 of file LambdaReconstruction.cxx.

60 {
61 MsgStream log(msgSvc(), name());
62 log << MSG::INFO << "in finalize()" << endreq;
63
64 return StatusCode::SUCCESS;
65}

◆ initialize()

StatusCode LambdaReconstruction::initialize ( )

Definition at line 52 of file LambdaReconstruction.cxx.

52 {
53 MsgStream log(msgSvc(), name());
54 log << MSG::INFO << "in initialize()" <<endreq;
55
56 return StatusCode::SUCCESS;
57}

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