Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:19:38

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 KFPHISTOGRAMSET
0023 #define KFPHISTOGRAMSET
0024 
0025 #include "KFPHistogram1D.h"
0026 #include "KFParticle.h"
0027 
0028 /** @class KFPHistogramSet
0029  ** @brief A set of histograms collected at the external devise.
0030  ** @author  M.Zyzak, I.Kisel
0031  ** @date 05.02.2019
0032  ** @version 1.0
0033  **
0034  ** The class defines a set of histograms to be collect in the environment,
0035  ** where ROOT is not available, for example at Intel Xeon Phi cards.
0036  ** It contains a set of one-dimensional histograms.
0037  ** Also,Calculates the needed amount of memory to be allocated
0038  **/
0039 
0040 class KFPHistogramSet
0041 {
0042  public:
0043   KFPHistogramSet(int iPart=0);
0044   ~KFPHistogramSet() {}
0045   
0046   void Fill(const KFParticle& particle);
0047   
0048   inline int GetNHisto1D() const { return NHisto1D; } ///< Returns a number of one dimensional histograms in the set.
0049   inline int DataSize() const 
0050   {
0051     int dataSize = 0;
0052     for(int i=0; i<NHisto1D; i++)
0053       dataSize += fKFPHistogram1D[i].DataSize();
0054     return dataSize;
0055   } ///< Returns the size of the memory in blocks of integer (or 4 bytes, or 32 bits) to be allocated for the histogram set. \see KFPHistogram, where memory is allocated.
0056   KFPHistogram1D GetHistogram1D(int iHistogram) const { return fKFPHistogram1D[iHistogram]; } ///< Returns one dimensional histogram with index "iHistogram".
0057   
0058   /**Sets bin content of the histogram "iHisto" to a given value.
0059    ** \param[in] iHisto - index of the histogram in the set
0060    ** \param[in] iBin - number of the bin
0061    ** \param[in] value - value to be set
0062    **/
0063   inline void SetHisto1DBinContent(int iHisto, int iBin, int value)   { fKFPHistogram1D[iHisto].SetBinContent(iBin,value); }
0064   
0065   inline void operator += ( const KFPHistogramSet &h )
0066   {
0067     for(int i=0; i<NHisto1D; i++)
0068       fKFPHistogram1D[i] += h.fKFPHistogram1D[i];
0069   } ///< Adds all histograms bin-by-bin from the histogram set "h" to the current set.
0070   
0071   void SetHistogramMemory(int* pointer);
0072   
0073  private:
0074   static const int NHisto1D = 17; ///< Number of histogram per each particle specie.
0075   KFPHistogram1D fKFPHistogram1D[NHisto1D]; ///< A set of the one dimensional histograms.
0076 };
0077 
0078 #endif