00001
00002
00003
00004
00005
00006
00007
00008
00009 #include <StEventTypes.h>
00010 #include <StEnumerations.h>
00011 #include <StMessMgr.h>
00012
00013
00014 #include "StFixedVertexFinder.h"
00015 #include "StMcEvent.hh"
00016 #include "StMcVertex.hh"
00017 #include "StMaker.h"
00018
00019
00020 StFixedVertexFinder::StFixedVertexFinder(){
00021 mFixedX=mFixedY=mFixedZ=0.0;
00022 mMode=0;
00023 }
00024
00025 int StFixedVertexFinder::fit(StEvent* event)
00026 {
00027 StPrimaryVertex prim;
00028 StVertexFinderId VFId;
00029 Float_t cov[6] = {0.0,0.0,0.0,0.0,0.0,0.0};
00030
00031 if (mMode == 0){
00032
00033 LOG_DEBUG << "StFixedVertexFinder::fit() fixing a vertex" << endm;
00034 StThreeVectorD pos(mFixedX,mFixedY,mFixedZ);
00035 prim.setPosition(pos);
00036 VFId = undefinedVertexFinder;
00037
00038 } else {
00039
00040 LOG_DEBUG << "StFixedVertexFinder::fit() reading a vertex from StMcEvent" << endm;
00041 StMcEvent* mcEvent= (StMcEvent*) StMaker::GetChain()->GetDataSet("StMcEvent");
00042
00043 if ( ! mcEvent){
00044
00045
00046 LOG_ERROR << "StFixedVertexFinder::fit() no StMcEvent" << endm;
00047 return 0;
00048
00049 } else {
00050 StMcVertex *pv = mcEvent->primaryVertex();
00051 StThreeVectorD pos(pv->position().x(),
00052 pv->position().y(),
00053 pv->position().z());
00054
00055 prim.setPosition(pos);
00056 }
00057 VFId = mcEventVertexFFinder;
00058 }
00059
00060 prim.setCovariantMatrix(cov);
00061 prim.setFlag(1);
00062 prim.setRanking(-5);
00063 prim.setVertexFinderId(VFId);
00064 addVertex(&prim);
00065
00066 return size();
00067 }
00068
00069 void StFixedVertexFinder::printInfo(ostream& os)const{
00070 os << "StFixedVertexFinder - fixed vertex" << endl;
00071 os << "Fixed position: x=" << mFixedX << " y=" << mFixedY << " z=" << mFixedZ << endl;
00072 }
00073
00074 void StFixedVertexFinder::UseVertexConstraint(double x0, double y0, double dxdz, double dydz, double weight){
00075 LOG_WARN << "StFixedVertexFinder::UseVertexConstraint() - vertex beam constraint NOT implemented in context of fixed vertex finder" << endm;
00076
00077 }
00078
00079 void StFixedVertexFinder::SetVertexPosition(double x, double y, double z){
00080 mFixedX=x;
00081 mFixedY=y;
00082 mFixedZ=z;
00083 }
00084
00085
00086
00087
00088
00089
00090