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 _KFMCParticle_h_
0023 #define _KFMCParticle_h_
0024 
0025 #include <vector>
0026 
0027 #ifdef HLTCA_STANDALONE
0028 #include "RootTypesDef.h"
0029 #else
0030 #include "TObject.h"
0031 #endif
0032 
0033 /** @class KFMCParticle
0034  ** @brief A class to store relations between mother and daughter Monte Carlo simulated particles.
0035  ** @author  M.Zyzak, I.Kisel
0036  ** @date 05.02.2019
0037  ** @version 1.0
0038  **
0039  ** The class is used to calculate reconstruction efficiency of all Monte Carlo particles. It is
0040  ** simplifies the procedure for short-lived particles. Contains a vector with unique Ids of all
0041  ** MC daughters, a unique Id of the corresponding MC track, a unique Id of the MC mother particle,
0042  ** the PDG code of the MC particle, flags showing if particle can be reconstructed according
0043  ** to several different definitions, flags showing if particle creates a secondary vertex with
0044  ** two or more daughters, an index of the initial particle Id in case of the K->mu+nu and pi-> mu+nu
0045  ** decays, since GEANT engines do not store neutrinos. 
0046  **/
0047 
0048 class KFMCParticle :public TObject
0049 {
0050  public:
0051   KFMCParticle();
0052   ~KFMCParticle();
0053 
0054   void AddDaughter( int i ); ///< Adds an Id of the new particle to the list with Ids of daughter particles.
0055   int  NDaughters() const { return fDaughterIds.size(); } ///< Returns number of daughter particles.
0056   const std::vector<int>&  GetDaughterIds() const { return fDaughterIds; } ///< Returns a reference to the vector with Id of daughter particle KFMCParticle::fDaughterIds.
0057   void CleanDaughters() { fDaughterIds.resize(0); } ///< Remove Ids of all daughter particles from the current object.
0058 
0059   void SetPDG(int pdg) {fPDG = pdg;} ///< Set the PDG code of the current particle KFMCParticle::fPDG.
0060   void SetMCTrackID(int id) {fMCTrackID = id;} ///< Sets the Id of the corresponding Monte Carlo track KFMCParticle::fMCTrackID.
0061   void SetMotherId(int id) {fMotherId = id;} ///< Sets the Id of the mother particle or primary vertex KFMCParticle::fMotherId.
0062   
0063   int  GetMCTrackID()      const {return fMCTrackID;} ///< Returns Id of the corresponding MC track KFMCParticle::fMCTrackID.
0064   int  GetMotherId()       const {return fMotherId;}  ///< Returns Id of the mother particle or primary vertex KFMCParticle::fMotherId.
0065   int  GetPDG()            const {return fPDG;}       ///< Returns PDG code of the current particle KFMCParticle::fPDG.
0066   
0067   bool IsReconstructable(int i) const {return fIsReconstructable[i];} ///< Returns a flag showing if particle can be reconstructed with KFMCParticle::fIsReconstructable index "i".
0068   void SetAsReconstructable(int i) { fIsReconstructable[i] = 1;} ///< Defines the particle as those which should be reconstructed for the efficiency set "i".
0069     
0070   bool IsReconstructableV0(int i) const {return fIsV0[i];} ///< Returns a flag showing if particle is a reconstructable V0.
0071   void SetAsReconstructableV0(int i) { fIsV0[i] = 1;}      ///< Defines the particle as V0 which should be reconstructed for the efficiency set "i".
0072   
0073   void SetInitialParticleId(int i) {fInitialParticleId = i;} ///< Sets Id of the Monte Carlo particle, from which the current particle was copied.
0074   int InitialParticleId() const {return fInitialParticleId;} ///< Returns the Id of the Monte Carlo particle, from which the current particle was copied.
0075  private: //data
0076   std::vector<int> fDaughterIds; ///< A vector with Ids of the daughter Monte Carlo particles.
0077   int fMCTrackID; ///< A unique Id of the corresponding Monte Carlo track.
0078   int fMotherId;  ///< A unique Id of the mother particle. If the current particle is primary the Id of the primary vertex with a negative sigh is stored.
0079   int fPDG;       ///< A PDG code of the current particle.
0080   
0081   /** Flags for calculation of the efficiency, define the denominator in each set of efficiency. 
0082    ** Flags 0-2 are used for particles reconstructed by the conventional method, 3 and 4 are used
0083    ** for particles found by the missing mass method: \n
0084    ** [0] - true for all particles, is used for calculation of the efficiency in 4pi;\n
0085    ** [1] - true if the particle is long-lived and can be reconstructed in the detector or
0086    ** if the particle is short-lived and all its daughter particles can be reconstructed; detector-dependent;\n
0087    ** [2] - true if the particle is long-lived and is reconstructed in the detector or
0088    ** if the particle is short-lived and all its daughter particles are reconstructed, 
0089    ** is used in calculation of efficiency of the KF Particle Finder method;\n
0090    ** [3] - true if the particle is long-lived and is reconstructed in the detector or
0091    ** if the particle is short-lived, can be reconstructed by the missing mass method
0092    ** and all its daughter particles are reconstructed; \n
0093    ** [4] - true for all particles, which can be found by the missing mass method,
0094    ** is used for calculation of the efficiency in 4pi.
0095    **/
0096   bool fIsReconstructable[5];
0097   /** Flags to calculate efficiency of short-lived particles producing a secondary vertex with 
0098    ** two or more daughters; similar to KFMCParticle::fIsReconstructable[0-2].
0099    **/
0100   bool fIsV0[3]; 
0101 
0102   /** For calculation of missing mass method efficiency a copy of the mother particle
0103    ** is created. fInitialParticleId is an Id of the initial mother particle.
0104    **/
0105   int fInitialParticleId;
0106 #ifndef KFParticleStandalone
0107   ClassDef( KFMCParticle, 1 )
0108 #endif
0109 };
0110 
0111 #endif
0112