/****************************************************************************** * TCtvmft class header file * * * * * * Author: Craig Blocker, Brandeis CDF Group * * Phone 781-736-2920 * * * * Description: Does secondary vertex fitting (wrapper of CTVMFT) * * * More documentation can be found in the file TCtvmft.txt * in the /doc area of Sin2BetaMods. * * The tracks to be fit are defined via * addTrack(CdfTrack* trk, float mass, int jv), where * trk is a pointer to a CdfTrack object, mass is the mass, and jv * is the jv number. Vertices are numbered from 1 starting with the * first vertex after the primary vertex. The primary vertex is * vertex 0. * Mass contraints are defined via massConstraint(). This * function has four forms for its argument: (1) two track pointers * and a mass, (2) three track pointers and a mass, (3) four track * pointers and a mass, or (4) number of tracks, list of track pointers, * and a mass. [Note, mass constraints are currently not * properly implemented]. * Vertex pointing constraints are defined by * vertexPoint(int jv1, int jv2, int type), where vertex jv1 points * to vertex jv2. Type = 1 for 2d constraint, type = 2 for 3d constraint, * and type = 3 if jv2 is a single track vertex. * Routine conversion_2d(int jv) makes vertex jv a 2-dimensional * conversion vertex. Routine conversion_3d(int jv) makes vertex jv * a 3-dimensional conversion vertex. * Routine fit() actually does the fit. Routine print() will * print the results of the fit to std::cout. Routines status(), chisq(), * ndof(), prob(), getTrack(int jtrk, float* trkP6), * getMass(int& ntrk, int* tracks, float& mass, float& dmass), * getDecayLength(int& nv, int& mv, float* dxyz,float& dr, * float& dz, float* dl), and getVertex(int nv, float* xyz) * can be used to access information about the fit. * [NOTE: getMass is not properly implemented yet.] * The following code will fit the tracks with * pointers trk1, trk2, trk3, and trk4 to the * decays B_d -> psi Ks -> mu+ mu- pi+ pi-. * * TCtvmft myfit; * // Add mu+ and mu- * myfit.addTrack(trk1,.105,1); * myfit.addTrack(trk2,.105,1); * // Constrain muons to Psi mass * myfit.massConstrain(trk1,trk2,3.097); * // Add pi+ pi- * myfit.addTrack(trk3,.139,2); * myfit.addTrack(trk4,.139,2); * // Constrain pions to Ks mass * myfit.massConstrain(trk3,trk4,.498); * // Point the Ks vertex at the Psi vertex * myfit.vertexPoint(2,1,2); * // Do the fit. * myfit.fit(); * // Print the results * myfit.print(); * // Get the psi vertex position. * float xyz[3]; * myfit.getVertex(1,xyz); * float dr=sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]); * std::cout << " dr = " << dr << std::endl; * * * Revision History: * * May 27, 1999 Craig Blocker Creation * * Apr 21 2001 P.Murat: ROOT port * *****************************************************************************/ #ifndef TCtvmft_hh #define TCtvmft_hh #include "TObject.h" #include "Stntuple/obj/TStnTrack.hh" // Fortran routines to get address of // the /ctvmq/ and /ctvmfr/ common // blocks extern "C" { int ctvmq_address_ (void); int ctvmfr_address_ (void); int fiddle_address_ (void); int trkprm_address_ (void); int print_level_address_(void); } // Declare the class class TCtvmft: public TObject { public: enum { _maxvtx = 3, // Maximum number of vertices _maxmcn = 4, // Maximum number of mass constraints _maxtrk = 10, // Maximum number of tracks _maxitr = 10, // Maximum number of iteration steps _maxdim = 5*(_maxvtx+1)+3*_maxtrk+_maxmcn }; // yes, this is intentional public: int stat; // status returned from fit. struct CTVMQ { int runnum; int trgnum; int iter; int ntscut; int nvertx; int nmassc; int ntrack; int trkvtx[_maxvtx][_maxtrk]; // This is actually a logical // variable in FORTRAN, but is // integer here to get the size // right. int trkmcn[_maxmcn][_maxtrk]; // This is actually a logical // variable in FORTRAN, but is // integer here to get the size // right. int vtxpnt[2][_maxvtx]; float cmass[_maxmcn]; int cvtx[_maxvtx]; int vtxvtx[_maxvtx][_maxvtx]; // This is actually a logical // variable in FORTRAN, but is // integer here to get the size // right. int list[_maxtrk]; float tmass[_maxtrk]; int matdim; int tkerr[_maxtrk]; int ndof; float chisqr[_maxitr+1]; float chit[_maxtrk]; float chiv[_maxvtx+1]; float chim[_maxmcn]; float xyzpv0[3]; float exyzpv[3][3]; float xyzvrt[_maxvtx+1][3]; float dxyzpv[3]; float par[_maxtrk][5]; float g[_maxtrk][5][5]; float trkp4[6][_maxtrk]; float vtxp4[_maxvtx][4]; float mcnp4[_maxmcn][4]; float dda[8][_maxtrk]; int voff[_maxvtx]; int toff[_maxtrk]; int poff[_maxvtx]; int coff[_maxvtx]; int moff; float par0[_maxtrk][5]; float pardif[_maxtrk][5]; float fmcdif[_maxmcn]; float pcon[2][_maxvtx]; float sang[2][_maxvtx]; float drmax; float rvmax; float dzmax; float trnmax; float dsmin; int ijkerr[3]; float pscale; }; struct CTVMFR{ double vmat[_maxdim+1][_maxdim]; }; struct FIDDLE{ int excuse; }; struct TRKPRM{ float trhelix[_maxtrk][5]; float trem[_maxtrk][5][5]; }; struct PRINT_LEVEL{ int print_level; }; CTVMQ* _ctvmq; CTVMFR* _ctvmfr; FIDDLE* _fiddle; TRKPRM* _trkprm; PRINT_LEVEL* _print_level; //----------------------------------------------------------------------------- // function members //----------------------------------------------------------------------------- public: // ****** constructors and destructor TCtvmft(); ~TCtvmft(); // ****** initialization methods void Init(); // ****** accessors // return status of fit int GetStatus() const { return stat; } // return chi-square of fit float GetChisq() const { return _ctvmq->chisqr[0]; } // number of degrees of freedom int GetNDOF() const { return _ctvmq->ndof; } // return probability of chi-square float GetProb() const; // return fit track 4-momentum Int_t GetTrackP4(Int_t jtrk, TLorentzVector& p); Int_t GetTrackP4(TStnTrack* Trk , TLorentzVector& p); // return fit mass and get error. float GetMass(int ntrk, const TStnTrack* tracks[], float& dmass); float GetMass(const TStnTrack* trk1, const TStnTrack* trk2, float& dmass); float GetMass(const TStnTrack* trk1, const TStnTrack* trk2, const TStnTrack* trk3, float& dmass); float GetMass(const TStnTrack* trk1, const TStnTrack* trk2, const TStnTrack* trk3, const TStnTrack* trk4, float& dmass); // return decay length float GetDecayLength(int nv, int mv, const TVector3& dir, float& dlerr); float GetDr(int nv, int mv, float& drerr); float GetDz(int nv, int mv, float& dzerr); // location of vertex `nv' int GetVertex(int nv, TVector3& v); // return error matrix element. double GetErrorMatrix(int j, int k); // ****** other methods bool AddTrack(const TStnTrack* trk, float mass, int jv); bool VertexPoint(int jv1, int jv2, int type); bool Conversion2D(int jv); bool Conversion3D(int jv); bool MassConstrain(const TStnTrack* trk1, const TStnTrack* trk2, float mass); bool MassConstrain(const TStnTrack* trk1, const TStnTrack* trk2, const TStnTrack* trk3, float mass); bool MassConstrain(const TStnTrack* trk1, const TStnTrack* trk2, const TStnTrack* trk3, const TStnTrack* trk4, float mass); bool MassConstrain(int ntrk, const TStnTrack* trks[], float mass); // ****** modifiers void SetDzMax (Float_t dz) { _ctvmq->dzmax = dz; } void SetDrMax (Float_t dr) { _ctvmq->drmax = dr; } void SetTrnMax(Float_t trn) { _ctvmq->trnmax = trn; } void SetPrimaryVertex (float xv, float yv, float zv); void SetPrimaryVertex (const TVector3* pv); void SetPrimaryVertexError(const float* xverr); // ****** other methods bool Fit(); // ****** overloaded methods of TObject // put 2 functions as signature has // changed from 2.2 to 3.0 void PrintAll(Option_t* opt = "") const; void Print (Option_t* opt = "") const { PrintAll(opt); } void Print (Option_t* opt = "") { PrintAll(opt); } void PrintErr() const; ClassDef(TCtvmft,0) }; #endif /* TCtvmft_hh */