6#include "GaudiKernel/MsgStream.h"
7#include "GaudiKernel/AlgFactory.h"
8#include "GaudiKernel/ISvcLocator.h"
9#include "GaudiKernel/SmartDataPtr.h"
10#include "GaudiKernel/IDataProviderSvc.h"
11#include "GaudiKernel/PropertyMgr.h"
28typedef std::vector<int>
Vint;
29const double mpi = 0.13957;
30const double mp = 0.938272;
34Algorithm(name, pSvcLocator) {
37 declareProperty(
"Vz0Cut", m_vzCut = 20.0);
38 declareProperty(
"CosThetaCut", m_cosThetaCut=0.93);
39 declareProperty(
"ChisqCut", m_chisqCut = 100.0);
40 declareProperty(
"UseVFRefine", m_useVFrefine =
false);
56 MsgStream log(
msgSvc(), name());
57 log << MSG::INFO <<
"in initialize()" <<endreq;
59 return StatusCode::SUCCESS;
64 MsgStream log(
msgSvc(), name());
65 log << MSG::INFO <<
"in finalize()" << endreq;
67 return StatusCode::SUCCESS;
70StatusCode LambdaReconstruction::registerEvtRecVeeVertexCol(
72 StatusCode sc = eventSvc()->registerObject(
"/Event/EvtRec/EvtRecVeeVertexCol",
73 aNewEvtRecVeeVertexCol);
74 if (sc != StatusCode::SUCCESS) {
75 log << MSG::FATAL <<
"Could not register EvtRecVeeVertexCol in TDS!" << endreq;
82 MsgStream log(
msgSvc(), name());
83 log << MSG::INFO <<
"in execute()" << endreq;
90 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
93 log << MSG::DEBUG <<
"run and event = " << eventHeader->runNumber()
94 <<
" " << eventHeader->eventNumber() << endreq;
95 log << MSG::DEBUG <<
"ncharg, nneu, tottks = "
96 << recEvent->totalCharged() <<
" , "
97 << recEvent->totalNeutral() <<
" , "
98 << recEvent->totalTracks() <<endreq;
99 int evtNo = eventHeader->eventNumber();
104 SmartDataPtr<EvtRecVeeVertexCol> veeVertexCol(eventSvc(),
108 sc = registerEvtRecVeeVertexCol(veeVertexCol, log);
109 if (sc != StatusCode::SUCCESS) {
117 Vint icp, icm, iGood;
118 for (
unsigned int i = 0; i < recEvent->totalCharged(); i++) {
120 if(!(*itTrk)->isMdcTrackValid())
continue;
121 if(!(*itTrk)->isMdcKalTrackValid())
continue;
123 if (fabs(
cos(mdcTrk->
theta())) >= m_cosThetaCut)
continue;
124 if (fabs(mdcTrk->
z()) >= m_vzCut)
continue;
126 if (mdcTrk->
charge() > 0) icp.push_back(i);
127 if (mdcTrk->
charge() < 0) icm.push_back(i);
131 if (icp.size() < 1 || icm.size() < 1)
return StatusCode::SUCCESS;
137 HepSymMatrix Evx(3, 0);
148 for(
unsigned int i1 = 0; i1 < icp.size(); i1++) {
150 RecMdcKalTrack *ppKalTrk = (*(recTrackCol->begin()+ip1))->mdcKalTrack();
154 for(
unsigned int i2 = 0; i2 < icm.size(); i2++) {
156 RecMdcKalTrack *pimKalTrk = (*(recTrackCol->begin()+ip2))->mdcKalTrack();
173 bool fitok = vtxfit0->
Fit();
178 if(vtxfit0->
chisq(0) > m_chisqCut)
continue;
180 std::pair<int, int> pair;
184 EvtRecTrack* track0 = *(recTrackCol->begin() + ip1);
185 EvtRecTrack* track1 = *(recTrackCol->begin() + ip2);
192 LambdaVertex->
setMass(wLamb.
p().m());
193 LambdaVertex->
setW(wLamb.
w());
194 LambdaVertex->
setEw(wLamb.
Ew());
200 veeVertexCol->push_back(LambdaVertex);
222 if(!(vtxfit0->
Fit(0)))
continue;
224 if(vtxfit0->
chisq(0) > m_chisqCut)
continue;
226 std::pair<int, int> pair;
230 EvtRecTrack* track0 = *(recTrackCol->begin() + ip1);
231 EvtRecTrack* track1 = *(recTrackCol->begin() + ip2);
238 LambdaVertex->
setMass(wLamb.
p().m());
239 LambdaVertex->
setW(wLamb.
w());
240 LambdaVertex->
setEw(wLamb.
Ew());
246 veeVertexCol->push_back(LambdaVertex);
264 for(
unsigned int i1 = 0; i1 < icp.size(); i1++) {
266 RecMdcKalTrack *pipKalTrk = (*(recTrackCol->begin()+ip1))->mdcKalTrack();
270 for(
unsigned int i2 = 0; i2 < icm.size(); i2++) {
272 RecMdcKalTrack *pmKalTrk = (*(recTrackCol->begin()+ip2))->mdcKalTrack();
289 bool fitok = vtxfit0->
Fit();
294 if(vtxfit0->
chisq(0) > m_chisqCut)
continue;
296 std::pair<int, int> pair;
300 EvtRecTrack* track0 = *(recTrackCol->begin() + ip1);
301 EvtRecTrack* track1 = *(recTrackCol->begin() + ip2);
308 ALambdaVertex->
setMass(wALamb.
p().m());
309 ALambdaVertex->
setW(wALamb.
w());
310 ALambdaVertex->
setEw(wALamb.
Ew());
316 veeVertexCol->push_back(ALambdaVertex);
338 if(!(vtxfit0->
Fit(0)))
continue;
340 if(vtxfit0->
chisq(0) > m_chisqCut)
continue;
342 std::pair<int, int> pair;
346 EvtRecTrack* track0 = *(recTrackCol->begin() + ip1);
347 EvtRecTrack* track1 = *(recTrackCol->begin() + ip2);
354 ALambdaVertex->
setMass(wALamb.
p().m());
355 ALambdaVertex->
setW(wALamb.
w());
356 ALambdaVertex->
setEw(wALamb.
Ew());
362 veeVertexCol->push_back(ALambdaVertex);
381 return StatusCode::SUCCESS;
double cos(const BesAngle a)
EvtRecTrackCol::iterator EvtRecTrackIterator
ObjectVector< EvtRecVeeVertex > EvtRecVeeVertexCol
const HepVector & helix() const
static void setPidType(PidType pidType)
const HepSymMatrix & err() const
const double theta() const
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 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)
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)
WTrackParameter wVirtualTrack(int n) const
void AddVertex(int number, VertexParameter vpar, std::vector< int > lis)
static VertexFit * instance()
void BuildVirtualParticle(int number)
void setEvx(const HepSymMatrix &eVx)
void setVx(const HepPoint3D &vx)
HepLorentzVector p() const
_EXTERN_ std::string EvtRecEvent
_EXTERN_ std::string EvtRecVeeVertexCol
_EXTERN_ std::string EvtRecTrackCol