Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:20:15

0001 /*
0002  * This file is part of KFParticle package
0003  * Copyright (C) 2007-2019 FIAS Frankfurt Institute for Advanced Studies
0004  *               2007-2019 Goethe University of Frankfurt
0005  *               2007-2019 Ivan Kisel <I.Kisel@compeng.uni-frankfurt.de>
0006  *               2007-2019 Maksym Zyzak
0007  *
0008  * KFParticle is free software: you can redistribute it and/or modify
0009  * it under the terms of the GNU General Public License as published by
0010  * the Free Software Foundation, either version 3 of the License, or
0011  * (at your option) any later version.
0012  *
0013  * KFParticle is distributed in the hope that it will be useful,
0014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0016  * GNU General Public License for more details.
0017  *
0018  * You should have received a copy of the GNU General Public License
0019  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
0020  */
0021 
0022 #include "KFPTrack.h"
0023 
0024 #ifdef __ROOT__
0025 ClassImp(KFPTrack);
0026 #endif
0027 
0028 void KFPTrack::RotateXY( float alpha )
0029 {
0030   /** Rotates the parameters of the track on an angle alpha in the XY plane.
0031    ** Can be used in case of the transforamtion of the coordinate system.
0032    ** The rotation matrix is:
0033    ** \verbatim
0034    {  cos(A), -sin(A),  0,        0,        0,   0 }
0035    {  sin(A),  cos(A),  0,        0,        0,   0 }
0036    {       0,       0,  1,        0,        0,   0 }
0037    {       0,       0,  0,   cos(A),  -sin(A),   0 }
0038    {       0,       0,  0,   sin(A),   cos(A),   0 }
0039    {       0,       0,  0,        0,        0,   1 } 
0040    \endverbatim
0041    ** \param[in] alpha - rotation angle
0042    **/
0043   const float cA = cos( alpha );
0044   const float sA = sin( alpha );
0045 
0046   //float J[6][6] = { {  cA, -sA,  0,    0,    0,   0 }, // X
0047   //                  {  sA,  cA,  0,    0,    0,   0 }, // Y
0048   //                  {  0,   0,   1,    0,    0,   0 }, // Z
0049   //                  {  0,   0,   0,   cA,  -sA,   0 }, // Px
0050   //                  {  0,   0,   0,   sA,   cA,   0 }, // Py
0051   //                  {  0,   0,   0,    0,    0,   1 } }; // Pz
0052 
0053   const float x  = GetX(),  y = GetY();
0054 
0055   SetX( -(x*sA +  y*cA) );
0056   SetY( x*cA -  y*sA );
0057 
0058   const float px  = GetPx(),  py = GetPy();
0059 
0060   SetPx( -(px*sA + py*cA)  );
0061   SetPy( px*cA - py*sA );
0062 
0063   float cov[21];
0064   for(int iC=0; iC<21; iC++)
0065     cov[iC] = fC[iC];
0066 
0067   fC[0] = cA*cA*  cov[2] + 2* cA* cov[1]* sA + cov[0]*sA* sA;
0068   
0069   fC[1] = -(cA*cA * cov[1]) + cA* (-cov[0] + cov[2])* sA + cov[1]*sA* sA;
0070   fC[2] = cA*cA*  cov[0] - 2* cA* cov[1]* sA + cov[2]*sA* sA; 
0071   
0072   fC[3] = -(cA* cov[4]) - cov[3]* sA;
0073   fC[4] = cA* cov[3] - cov[4]* sA;
0074   fC[5] = cov[5]; 
0075   
0076   fC[6] = cA*cA*  cov[11] + cA *(cov[10] + cov[7])* sA + cov[6]*sA* sA;
0077   fC[7] = -(cA*cA * cov[10]) + cA* (cov[11] - cov[6])* sA + cov[7] *sA*sA;
0078   fC[8] = -(cA *cov[12]) - cov[8] *sA;
0079   fC[9] = cA*cA*  cov[14] + 2 *cA* cov[13]* sA + cov[9]* sA*sA;
0080 
0081   fC[10] = -(cA*cA*  cov[7]) + cA* (cov[11] - cov[6])* sA + cov[10]*sA* sA; 
0082   fC[11] = cA*cA*  cov[6] - cA* (cov[10] + cov[7]) *sA + cov[11]*sA* sA;
0083   fC[12] = cA* cov[8] - cov[12]* sA; 
0084   fC[13] = -(cA*cA*  cov[13]) + cA* (cov[14] - cov[9])* sA + cov[13]* sA*sA;
0085   fC[14] = cA*cA*  cov[9] - 2* cA* cov[13]* sA + cov[14]* sA*sA;
0086   
0087   fC[15] = -(cA* cov[16]) - cov[15]* sA;
0088   fC[16] = cA* cov[15] - cov[16]* sA;
0089   fC[17] = cov[17]; 
0090   fC[18] = -(cA* cov[19]) - cov[18]* sA;
0091   fC[19] = cA* cov[18] - cov[19]* sA;
0092   fC[20] = cov[20];
0093 
0094 }