13 #include "TwistPatch.h"
15 #include "StMessMgr.h"
32 TwistPatch::~TwistPatch() {}
38 if (TMath::Abs(TMath::Abs(mag/4.98) - 1) > 0.1) {
39 gMessMgr->Error() <<
"TwistPatch: Invalid magnetic field: " << mag
40 <<
"\n Need +/- 4.98 (+/- 10%)" << endm;
44 magf = (int) (0.5 + TMath::Sign(0.5,mag));
49 void TwistPatch::SetVtxPars() {
50 Double_t* arr = vtxparsFull.GetArray();
51 int offset = magf*3*2;
52 vtxpars = &(arr[offset]);
55 void TwistPatch::SetEtaPars() {
56 Double_t* arr = etaparsFull.GetArray();
58 etapars = &(arr[offset]);
61 void TwistPatch::SetPtPars(
int ew,
int ch) {
62 Double_t* arr = ptparsFull.GetArray();
63 int offset = ((magf*2 + ew)*2 + ch)*4*2;
64 ptpars = &(arr[offset]);
67 void TwistPatch::SetPhiPars(
int ew,
int ch) {
68 Double_t* arr = phiparsFull.GetArray();
69 int offset = ((magf*2 + ew)*2 + ch)*5*2;
70 phipars = &(arr[offset]);
76 double vx = vtx.x();
double vy = vtx.y();
double vz = vtx.z();
77 PrimaryVertex(vx,vy,vz,mag);
78 vtx.setX(vx); vtx.setY(vy); vtx.setZ(vz);
81 void TwistPatch::PrimaryVertex(
double& vx,
double& vy,
double& vz,
double mag) {
84 gMessMgr->Error() <<
"TwistPatch: unassigned magnetic field." << endm;
87 if (TMath::Abs(vz)>40.) {
88 gMessMgr->Warning() <<
"TwistPatch: corrections invalid outsize |vz|<40cm." << endm;
89 vx = -999.; vy = -999.; vz = -999.;
92 vx += vtxpars[0] + vtxpars[1]*vz;
93 vy += vtxpars[2] + vtxpars[3]*vz;
94 vz += vtxpars[4] + vtxpars[5]*vz;
98 int ch,
double vz,
double mag) {
101 gMessMgr->Error() <<
"TwistPatch: unassigned magnetic field." << endm;
104 if (TMath::Abs(vz)>40.) {
105 gMessMgr->Warning() <<
"TwistPatch: corrections invalid outsize |vz|<40cm."
107 pt = -999.; phi = 0.; eta = -999.;
112 if (pt < 0.5)
return;
115 double seta = TMath::SinH(eta);
116 if (seta < TMath::Min(-vz/60.0,-vz/200.0)) {
118 }
else if (seta > TMath::Max(-vz/60.0,-vz/200.0)) {
122 pt = -999.; phi = 0.; eta = -999.;
125 int chi = ( (ch>0) ? 1 : 0 );
133 eta += Amp*sin(phi-Phase);
135 Amp = ptpars[0] + ptpars[1]*eta + ptpars[2]*vz + ptpars[3]*eta*vz;
136 Phase = ptpars[4] + ptpars[5]*eta + ptpars[6]*vz + ptpars[7]*eta*vz;
137 pt += pt*pt*Amp*sin(phi-Phase);
139 Amp = phipars[0] + phipars[1]*eta + phipars[2]*vz +
140 phipars[3]*eta*vz + phipars[4]*eta*eta;
141 Phase = phipars[5] + phipars[6]*eta + phipars[7]*vz +
142 phipars[8]*eta*vz + phipars[9]*eta*eta;
143 phi += Amp*sin(phi-Phase);
150 double vtxparsP05ia[12] = {
173 vtxparsFull.Set(12,vtxparsP05ia);
175 double etaparsP05ia[4] = {
184 etaparsFull.Set(4,etaparsP05ia);
186 double ptparsP05ia[64] ={
264 ptparsFull.Set(64,ptparsP05ia);
266 double phiparsP05ia[80] ={
360 phiparsFull.Set(80,phiparsP05ia);
void CorrectP05ia()
Turn on corrections for P05ia (on by default)
virtual void SetMagF(double mag)
Enter magnetic field manually (if you leave it blank in patch functions)
virtual void PrimaryTrack(double &pt, double &phi, double &eta, int ch, double vz, double mag=-999.)
Patch primary tracks.