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 KFMCVERTEX_H
0023 #define KFMCVERTEX_H
0024 
0025 #include <iostream>
0026 #include <vector>
0027 
0028 /** @class KFMCVertex
0029  ** @brief A class to store information about simulated Monte Carlo primary vertices.
0030  ** @author  M.Zyzak, I.Kisel
0031  ** @date 05.02.2019
0032  ** @version 1.0
0033  **
0034  ** The class contains coordinates of the vertex, indices of the Monte Carlo tracks produced
0035  ** at this vertex, classification flags, number of the reconstructed Monte Carlo tracks.
0036  **/
0037 
0038 class KFMCVertex
0039 {
0040  public:
0041   KFMCVertex();
0042 
0043   float Par( int i )  const { return fPar[i]; } ///< Returns parameter with index "i" from KFMCVertex::fPar
0044 
0045   float X()           const { return fPar[0]; } ///< Returns X coordinate of the vertex.
0046   float Y()           const { return fPar[1]; } ///< Returns Y coordinate of the vertex.
0047   float Z()           const { return fPar[2]; } ///< Returns Z coordinate of the vertex.
0048   
0049   const float* GetPar()      const { return fPar; } ///< Returns pointer to the parameters of the vertex KFMCVertex::fPar
0050   
0051   void SetPar( int i, float v )   { fPar[i] = v; } ///< Sets a value "v" to parameter "i".
0052   
0053   void SetX( float v )            { fPar[0] = v; } ///< Sets value "v" to the X coordinate.
0054   void SetY( float v )            { fPar[1] = v; } ///< Sets value "v" to the Y coordinate.
0055   void SetZ( float v )            { fPar[2] = v; } ///< Sets value "v" to the Z coordinate.
0056 
0057   int NDaughterTracks() const { return fDaughterTracks.size(); } ///< Returns number of Monte Carlo tracks produced at the current vertex.
0058   int NReconstructedDaughterTracks() const { return fNReconstructedDaughters; } ///< Returns number of reconstructed tracks from this vertex.
0059   void AddDaughterTrack( int iTr ) { fDaughterTracks.push_back(iTr); } ///< Adds unique id of the Monte Carlo track produced at the current vertex.
0060   int DaughterTrack( int iTr ) const 
0061   { 
0062     /** Returns unique id of the Monte Carlo track from this vertex with index "iTr".
0063      ** \param[in] iTr - index of the track.
0064      **/
0065     if(iTr >= NDaughterTracks())
0066     {
0067       std::cout << "ERROR!!!! MC PV contains only " << NDaughterTracks() << " tracks" << std::endl; 
0068       return -1;
0069     }
0070     return fDaughterTracks[iTr];
0071   }
0072 
0073   bool IsMCReconstructable() const { return fIsMCReconstructable; } ///< Returns flag showing if the vertex can be found (definition is based on the MC tracks)
0074   bool IsReconstructable() const { return fIsReconstructable; }     ///< Returns flag showing if the vertex can be found (definition is based on the reconstructed tracks)
0075   bool IsReconstructed()  const { return fIsReconstructed;   }      ///< Returns flag showing if the vertex was reconstructed
0076   
0077   void SetReconstructable() { fIsReconstructable = 1; }        ///< Defines the current vertex as such that can be reconstructed (based on the reconstructed tracks)
0078   void SetUnReconstructable() { fIsReconstructable = 0; }      ///< Defines the current vertex as such that can not be reconstructed (based on the reconstructed tracks)     
0079   
0080   void SetMCReconstructable() { fIsMCReconstructable = 1; }    ///< Defines the current vertex as such that can be reconstructed (based on the MC tracks)
0081   void SetMCUnReconstructable() { fIsMCReconstructable = 0; }  ///< Defines the current vertex as such that can not be reconstructed (based on the MC tracks)
0082   
0083   void SetReconstructed() { fIsReconstructed = 1; }   ///< Defines the current vertex as such that was reconstructed
0084   void SetUnReconstructed() { fIsReconstructed = 0; } ///< Defines the current vertex as such that was not reconstructed
0085 
0086   void SetNReconstructedDaughters(int n) { fNReconstructedDaughters = n; } ///< Defines number of the reconstructed tracks produced at the current vertex.
0087   
0088   bool IsTriggerPV() const { return fIsTriggerPV; } ///< Returns flag showing if the vertex is considerred as tigger.
0089   void SetTriggerPV() { fIsTriggerPV = 1; }         ///< Defines the current vertex as the trigger primary vertex.
0090   
0091   friend std::ostream& operator<<(std::ostream& out, const KFMCVertex &a);
0092   friend std::istream& operator>>(std::istream& in, KFMCVertex &a);
0093 
0094  protected:
0095 
0096   float fPar[3];                    ///< Cartesian coordinates of the vertex: { X, Y, Z }.
0097   std::vector<int> fDaughterTracks; ///< Vector with unique ids of the Monte Carlo tracks produced at this vertex.
0098   bool fIsReconstructable;          ///< Flag showing if the vertex considered as reconstructable based on the reconstructed tracks.
0099   bool fIsMCReconstructable;        ///< Flag showing if the vertex considered as reconstructable based on the Monte Carlo tracks.
0100   bool fIsReconstructed;            ///< Flag showing if vertex was reconstructed.
0101   int fNReconstructedDaughters;     ///< Number of found tracks, produced at the current vertex.
0102   bool fIsTriggerPV;                ///< Flag showing if the vertex was a trigger primary vertex.
0103 };
0104 
0105 #endif