Back to home page

sPhenix code displayed by LXR

 
 

    


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

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 KFPartMatch_H
0023 #define KFPartMatch_H
0024 
0025 #include <vector>
0026 
0027 
0028 /** @class KFPartMatch
0029  ** @brief A structure to store matching information between simulated Monte Carlo and reconstructed particles.
0030  ** @author  M.Zyzak, I.Kisel
0031  ** @date 05.02.2019
0032  ** @version 1.0
0033  **
0034  ** The class is used in both directions: to store links from Monte Carlo to reconstructed particles and vise versa.
0035  ** It contains two kind of links: 1) PDG hypothesis of the reconstructed and Monte Carlo particles should be the same;
0036  ** 2) PDG code differs. 
0037  **/
0038 
0039 struct KFPartMatch // used for Reco to MC match as well as for MC to Reco
0040 {
0041   KFPartMatch():ids(),idsMI() {}
0042   
0043   bool IsMatched() const { return ids.size() != 0 || idsMI.size() != 0; } ///< Returns true if at least one link exists independently of the PDG hypothesis.
0044   bool IsMatchedWithPdg() const { return ids.size() != 0; }               ///< Returns true is at least one link with the correct PDG exists.
0045   int  GetBestMatch() const { 
0046     if      (ids.size()   != 0) return ids[0];
0047     else if (idsMI.size() != 0) return idsMI[0];
0048     else return -1;
0049   } ///< Returns first link with correct PDG if exists, otherwise first link with incorrect PDG. If no link exists returns "-1".
0050   int  GetBestMatchWithPdg() const { 
0051     if      (ids.size()   != 0) return ids[0];
0052     else return -1;
0053   } ///< Returns first link with correct PDG if exists, otherwise returns "-1".
0054   std::vector<int> ids;   ///< Vector of links, PDG hypothesis of the reconstructed particle is required to be the same as the PDG code of the Monte Carlo particle.
0055   std::vector<int> idsMI; ///< Vector of links, PDG hypothesis of the reconstructed particle differs from the Monte Carlo particle.
0056 };
0057 
0058 #endif