Back to home page

sPhenix code displayed by LXR

 
 

    


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

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 #ifndef KFMCTRACK_H
0023 #define KFMCTRACK_H
0024 
0025 #include <cmath>
0026 
0027 /** @class KFMCTrack
0028  ** @brief A class for storage of the Monte Carlo simulated track in the cartesian parametrisation.
0029  ** @author  M.Zyzak, I.Kisel
0030  ** @date 05.02.2019
0031  ** @version 1.0
0032  **
0033  ** A track is described with the parameters { X, Y, Z, Px, Py, Pz, q/P }. Parameters are stored at
0034  ** the origin position. Class also contains Id of the mother track, PDG code for the current track,
0035  ** number of Monte Carlo points produced by the simulation engine at the detector stations,
0036  ** number of Monte Carlo points produced at the precise detectors (like MVD in CBM, HFT in STAR, 
0037  ** ITS in ALICE, etc.). It also has a flag showing if track was found by the reconstruction procedure
0038  ** for efficiency calculation, and a flag showing if track was out of acceptance.
0039  **/
0040 
0041 class KFMCTrack
0042 {
0043  public:
0044   KFMCTrack():fMotherId(-1),fPDG(0),fNMCPoints(0), fNMCPixelPoints(0), fIsReconstructed(0),fIsOutOfDetector(0) {};
0045 
0046   int   MotherId()        const { return fMotherId; } ///< Returns a uniqueue Id of the mother track or primary vertex KFMCTrack::fMotherId.
0047   int   PDG()             const { return fPDG;}       ///< Returns PDG code of the track KFMCTrack::fPDG.
0048   float Par( int i )      const { return fPar[i]; }   ///< Returns value of the parameter KFMCTrack::fPar with index "i".
0049   float X()               const { return fPar[0]; }   ///< Returns X coordinate of the track at the origin position.
0050   float Y()               const { return fPar[1]; }   ///< Returns Y coordinate of the track at the origin position.
0051   float Z()               const { return fPar[2]; }   ///< Returns Y coordinate of the track at the origin position.
0052   float L()               const { return sqrt(X()*X() + Y()*Y() + Z()*Z()); } ///< Returns distance from the origin of the track to a point {0,0,0}.
0053   float Px()              const { return fPar[3]; }   ///< Returns Px momentum component of the track at the origin position.
0054   float Py()              const { return fPar[4]; }   ///< Returns Py momentum component of the track at the origin position.
0055   float Pz()              const { return fPar[5]; }   ///< Returns Pz momentum component of the track at the origin position.
0056   float P()               const { return sqrt(fPar[3]*fPar[3] + fPar[4]*fPar[4] + fPar[5]*fPar[5]); } ///< Returns momentum of the track.
0057   float Pt()              const { return sqrt(fPar[3]*fPar[3] + fPar[4]*fPar[4]); } ///< Returns transverse momentum of the track.
0058   const float *Par()      const { return fPar; }             ///< Returns a pointer to the array with track parameters KFMCTrack::fPar.
0059   int   NMCPoints()       const { return fNMCPoints; }       ///< Returns number of MC points KFMCTrack::fNMCPoints.
0060   int   NMCPixelPoints()  const { return fNMCPixelPoints; }  ///< Returns number of MC points at the precise detectors KFMCTrack::fNMCPixelPoints.
0061   bool  IsReconstructed() const { return fIsReconstructed; } ///< Returns a flag showing if track was found by the reconstruction procedure.
0062   bool  IsOutOfDetector() const { return fIsOutOfDetector; } ///< Returns a flag showing if track was out of acceptance.
0063   
0064   void SetPar( int i, float v )  { fPar[i] = v; }          ///< Sets a value "v" to the parameter with index "i".
0065   void SetX( float v )           { fPar[0] = v; }          ///< Sets X coordinate at the origin position of the track.
0066   void SetY( float v )           { fPar[1] = v; }          ///< Sets Y coordinate at the origin position of the track.
0067   void SetZ( float v )           { fPar[2] = v; }          ///< Sets Z coordinate at the origin position of the track.
0068   void SetPx( float v )          { fPar[3] = v; }          ///< Sets Px momentum component at the origin position of the track.
0069   void SetPy( float v )          { fPar[4] = v; }          ///< Sets Py momentum component at the origin position of the track.
0070   void SetPz( float v )          { fPar[5] = v; }          ///< Sets Pz momentum component at the origin position of the track.
0071   void SetQP( float v )          { fPar[6] = v; }          ///< Sets q/P at the origin position of the track.
0072   void SetMotherId( int v )      { fMotherId = v; }        ///< Sets a unique id of the mother track if track is secondary or primary vertex with a negative sign if it is primary.
0073   void SetPDG( int v )           { fPDG = v; }             ///< Sets PDG code of the current track.
0074   void SetNMCPoints( int v )     { fNMCPoints = v; }       ///< Sets number of MC points produced at the detector planes.
0075   void SetNMCPixelPoints( int v ){ fNMCPixelPoints = v; }  ///< Sets number of the MC points produced at the precise detectors.
0076   void SetReconstructed()        { fIsReconstructed = 1; } ///< Defines the track as reconstructed.
0077   void SetNotReconstructed()     { fIsReconstructed = 0; } ///< Defines the track as not reconstructed.
0078   void SetOutOfDetector()        { fIsOutOfDetector = 1; } ///< Defines the track out of acceptance.
0079   
0080  protected:
0081 
0082   int   fMotherId;       ///< Index of the mother track in tracks array. If track is produced at the primary vertex (PV) negative value with the PV Id is assigned.
0083   int   fPDG;            ///< The PDG code of the current Monte Carlo track.
0084   float fPar[7];         ///< Parameters of the track: { X, Y, Z, Px, Py, Pz, q/P }, where "q" is its charge.
0085   int   fNMCPoints;      ///< Total number of Monte Carlo points produced by the simulation engine at the detector stations.
0086   int   fNMCPixelPoints; ///< Number of Monte Carlo points produced at the precise detectors (like MVD in CBM, HFT in STAR, ITS in ALICE, etc.).
0087   
0088   bool fIsReconstructed; ///< A flag showing if track was found by the reconstruction procedure. Is required for correct efficiency calculation.
0089   bool fIsOutOfDetector; ///< A flag showing if track was out of acceptance. Is required for correct calculation of the acceptance.
0090 };
0091 
0092 #endif