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"
13#include "EventModel/Event.h"
14#include "EvtRecEvent/EvtRecEvent.h"
15#include "EvtRecEvent/EvtRecTrack.h"
16#include "EvtRecEvent/EvtRecVeeVertex.h"
17#include "EventModel/EventHeader.h"
18#include "EventModel/Event.h"
19#include "EventModel/EventModel.h"
20#include "McTruth/McParticle.h"
21#include "ParticleID/ParticleID.h"
22#include "VertexFit/VertexFit.h"
23#include "VertexFit/SecondVertexFit.h"
24#include "VeeVertexAlg/LambdaReconstruction.h"
27typedef std::vector<int>
Vint;
28const double mpi = 0.13957;
29const double mp = 0.938272;
32Algorithm(name, pSvcLocator) {
35 declareProperty(
"Vz0Cut", m_vzCut = 20.0);
36 declareProperty(
"CosThetaCut", m_cosThetaCut=0.93);
37 declareProperty(
"ChisqCut", m_chisqCut = 100.0);
53 MsgStream log(
msgSvc(), name());
54 log << MSG::INFO <<
"in initialize()" <<endreq;
56 return StatusCode::SUCCESS;
61 MsgStream log(
msgSvc(), name());
62 log << MSG::INFO <<
"in finalize()" << endreq;
64 return StatusCode::SUCCESS;
67StatusCode LambdaReconstruction::registerEvtRecVeeVertexCol(
69 StatusCode sc = eventSvc()->registerObject(
"/Event/EvtRec/EvtRecVeeVertexCol",
70 aNewEvtRecVeeVertexCol);
71 if (sc != StatusCode::SUCCESS) {
72 log << MSG::FATAL <<
"Could not register EvtRecVeeVertexCol in TDS!" << endreq;
79 MsgStream log(
msgSvc(), name());
80 log << MSG::INFO <<
"in execute()" << endreq;
87 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
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();
101 SmartDataPtr<EvtRecVeeVertexCol> veeVertexCol(eventSvc(),
105 sc = registerEvtRecVeeVertexCol(veeVertexCol, log);
106 if (sc != StatusCode::SUCCESS) {
114 Vint icp, icm, iGood;
115 for (
unsigned int i = 0; i < recEvent->totalCharged(); i++) {
117 if(!(*itTrk)->isMdcTrackValid())
continue;
118 if(!(*itTrk)->isMdcKalTrackValid())
continue;
120 if (fabs(
cos(mdcTrk->
theta())) >= m_cosThetaCut)
continue;
121 if (fabs(mdcTrk->
z()) >= m_vzCut)
continue;
123 if (mdcTrk->
charge() > 0) icp.push_back(i);
124 if (mdcTrk->
charge() < 0) icm.push_back(i);
128 if (icp.size() < 1 || icm.size() < 1)
return StatusCode::SUCCESS;
134 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();
164 if(!(vtxfit0->
Fit(0)))
continue;
166 if(vtxfit0->
chisq(0) > m_chisqCut)
continue;
168 std::pair<int, int> pair;
172 EvtRecTrack* track0 = *(recTrackCol->begin() + ip1);
173 EvtRecTrack* track1 = *(recTrackCol->begin() + ip2);
180 LambdaVertex->
setMass(wLamb.
p().m());
181 LambdaVertex->
setW(wLamb.
w());
182 LambdaVertex->
setEw(wLamb.
Ew());
188 veeVertexCol->push_back(LambdaVertex);
202 for(
unsigned int i1 = 0; i1 < icp.size(); i1++) {
204 RecMdcKalTrack *pipKalTrk = (*(recTrackCol->begin()+ip1))->mdcKalTrack();
208 for(
unsigned int i2 = 0; i2 < icm.size(); i2++) {
210 RecMdcKalTrack *pmKalTrk = (*(recTrackCol->begin()+ip2))->mdcKalTrack();
218 if(!(vtxfit0->
Fit(0)))
continue;
220 if(vtxfit0->
chisq(0) > m_chisqCut)
continue;
222 std::pair<int, int> pair;
226 EvtRecTrack* track0 = *(recTrackCol->begin() + ip1);
227 EvtRecTrack* track1 = *(recTrackCol->begin() + ip2);
234 ALambdaVertex->
setMass(wALamb.
p().m());
235 ALambdaVertex->
setW(wALamb.
w());
236 ALambdaVertex->
setEw(wALamb.
Ew());
242 veeVertexCol->push_back(ALambdaVertex);
257 return StatusCode::SUCCESS;
EvtRecTrackCol::iterator EvtRecTrackIterator
ObjectVector< EvtRecVeeVertex > EvtRecVeeVertexCol
double cos(const BesAngle a)
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)
LambdaReconstruction(const std::string &name, ISvcLocator *pSvcLocator)
void AddTrack(const int number, const double mass, const RecMdcTrack *trk)
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