5#include "GaudiKernel/MsgStream.h"
6#include "GaudiKernel/AlgFactory.h"
7#include "GaudiKernel/ISvcLocator.h"
8#include "GaudiKernel/SmartDataPtr.h"
9#include "GaudiKernel/IDataProviderSvc.h"
10#include "GaudiKernel/PropertyMgr.h"
12#include "EventModel/Event.h"
13#include "EvtRecEvent/EvtRecEvent.h"
14#include "EvtRecEvent/EvtRecTrack.h"
15#include "EvtRecEvent/EvtRecVeeVertex.h"
16#include "EventModel/EventHeader.h"
17#include "EventModel/Event.h"
18#include "EventModel/EventModel.h"
19#include "McTruth/McParticle.h"
20#include "ParticleID/ParticleID.h"
21#include "VertexFit/VertexFit.h"
22#include "VertexFit/SecondVertexFit.h"
23#include "VeeVertexAlg/KShortReconstruction.h"
26typedef std::vector<int>
Vint;
27const double mpi = 0.13957;
30Algorithm(name, pSvcLocator) {
33 declareProperty(
"Vz0Cut", m_vzCut = 20.0);
34 declareProperty(
"CosThetaCut", m_cosThetaCut=0.93);
35 declareProperty(
"ChisqCut", m_chisqCut = 100.0);
51 MsgStream log(
msgSvc(), name());
52 log << MSG::INFO <<
"in initialize()" <<endreq;
54 return StatusCode::SUCCESS;
59 MsgStream log(
msgSvc(), name());
60 log << MSG::INFO <<
"in finalize()" << endreq;
62 return StatusCode::SUCCESS;
65StatusCode KShortReconstruction::registerEvtRecVeeVertexCol(
67 StatusCode sc = eventSvc()->registerObject(
"/Event/EvtRec/EvtRecVeeVertexCol",
68 aNewEvtRecVeeVertexCol);
69 if (sc != StatusCode::SUCCESS) {
70 log << MSG::FATAL <<
"Could not register EvtRecVeeVertexCol in TDS!" << endreq;
77 MsgStream log(
msgSvc(), name());
78 log << MSG::INFO <<
"in execute()" << endreq;
85 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
88 log << MSG::DEBUG <<
"run and event = " << eventHeader->runNumber()
89 <<
" " << eventHeader->eventNumber() << endreq;
90 log << MSG::DEBUG <<
"ncharg, nneu, tottks = "
91 << recEvent->totalCharged() <<
" , "
92 << recEvent->totalNeutral() <<
" , "
93 << recEvent->totalTracks() <<endreq;
94 int evtNo = eventHeader->eventNumber();
99 SmartDataPtr<EvtRecVeeVertexCol> veeVertexCol(eventSvc(),
103 sc = registerEvtRecVeeVertexCol(veeVertexCol, log);
104 if (sc != StatusCode::SUCCESS) {
112 Vint ipip, ipim, iGood;
113 for (
unsigned int i = 0; i < recEvent->totalCharged(); i++) {
116 if(!(*itTrk)->isMdcTrackValid())
continue;
117 if(!(*itTrk)->isMdcKalTrackValid())
continue;
119 if (fabs(
cos(mdcTrk->
theta())) >= m_cosThetaCut)
continue;
120 if (fabs(mdcTrk->
z()) >= m_vzCut)
continue;
122 if (mdcTrk->
charge() > 0) ipip.push_back(i);
123 if (mdcTrk->
charge() < 0) ipim.push_back(i);
127 if (ipip.size() < 1 || ipim.size() < 1)
return StatusCode::SUCCESS;
133 HepSymMatrix Evx(3, 0);
146 for(
unsigned int i1 = 0; i1 < ipip.size(); i1++) {
148 RecMdcKalTrack *pipKalTrk = (*(recTrackCol->begin()+ip1))->mdcKalTrack();
152 for(
unsigned int i2 = 0; i2 < ipim.size(); i2++) {
154 RecMdcKalTrack *pimKalTrk = (*(recTrackCol->begin()+ip2))->mdcKalTrack();
162 if(!(vtxfit0->
Fit(0)))
continue;
164 if(vtxfit0->
chisq(0) > m_chisqCut)
continue;
166 std::pair<int, int> pair;
170 EvtRecTrack* track0 = *(recTrackCol->begin() + ip1);
171 EvtRecTrack* track1 = *(recTrackCol->begin() + ip2);
179 KsVertex->
setW(wKshort.
w());
186 veeVertexCol->push_back(KsVertex);
199 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)
KShortReconstruction(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