7 #include "StRedoTracks.h"
8 #include "StDbUtilities/StMagUtilities.h"
9 #include "StEventTypes.h"
10 #include "StMessMgr.h"
11 #include "StTpcDb/StTpcDb.h"
12 #include "StTpcDb/StTpcDbMaker.h"
13 #include "St_db_Maker/St_db_Maker.h"
20 m_ExB(0), tpcDbMaker(mkr), redo(kTRUE) {
23 StRedoTracks::~StRedoTracks() {}
25 Int_t StRedoTracks::Init(){
30 while ((mkr = iter.NextMaker())) {
31 if (mkr->IsA() == StTpcDbMaker::Class()) {
36 if (!tpcDbMaker) gMessMgr->Warning(
"StRedoTracks: No StTpcDbMaker found.");
38 return StMaker::Init();
45 #ifdef __NEW_MagUtilities__
48 TDataSet *RunLog = GetDataBase(
"RunLog/MagFactor");
49 if (!RunLog) gMessMgr->Warning(
"StRedoTracks: No RunLog/MagFactor found.");
50 m_ExB =
new StMagUtilities(tpcDbMaker->tpcDbInterface(),RunLog,option);
56 gMessMgr->Warning(
"StRedoTracks: no StEvent; skipping event.");
61 float x[3],p[3],x_new[3],p_new[3];
68 if (!pvtx)
return kStOk;
69 ooo = pvtx->position();
70 StSPtrVecTrackNode& theNodes =
event->trackNodes();
74 UInt_t nPrims = pvtx->numberOfDaughters();
75 Float_t pv_err = TMath::Sqrt(0.0004 + (0.11/nPrims));
77 for (i=0; i<theNodes.size(); i++) {
78 typ = global; typ2 = IsGlobal;
79 Bool_t iterate = kTRUE;
81 for (j=0; j<theNodes[i]->entries(typ); j++) {
85 if (k) triGeom = tri->outerGeometry();
86 else triGeom = tri->geometry();
89 if (!(xvec.x() || xvec.y() || xvec.z()))
continue;
91 if (!(pvec.x() || pvec.y()))
continue;
93 float oldPt = pvec.perp();
94 if (oldPt < 0.0001)
continue;
104 typ2,x_new,p_new,map.data(0),map.data(1),pv_err);
108 float newPt = npvec.perp();
109 float inv_newPt = 1.0/newPt;
110 float psi = TMath::ACos(npvec.x()*inv_newPt);
111 if (npvec.y() < 0) psi = TMath::TwoPi() - psi;
113 triGeom->setMomentum(npvec);
114 triGeom->setOrigin(nxvec);
115 triGeom->setCurvature(triGeom->curvature()*pvec.perp()*inv_newPt);
116 triGeom->setDipAngle(TMath::ATan(npvec.z()*inv_newPt));
117 triGeom->setPsi(psi);
121 if (typ == global) { typ = primary; typ2 = IsPrimary; }
122 else iterate = kFALSE;
virtual void FixSpaceChargeDistortion(const Int_t Charge, const Float_t x[3], const Float_t p[3], const Prime PrimaryOrGlobal, Float_t x_new[3], Float_t p_new[3], const unsigned int RowMask1=0xFFFFFF00, const unsigned int RowMask2=0x1FFFFF, const Float_t VertexError=0.0200)
Convert from the old (Uniform) space charge correction to the new (1/R**2) space charge correction...