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 #include "KFPHistogramSet.h"
0023 #include "KFPartEfficiencies.h"
0024 
0025 KFPHistogramSet::KFPHistogramSet(int iPart)
0026 {
0027   /** Creates a set of histograms for the given particle specie. 
0028    ** \param[in] iPart - number of the particle specie in the KF Particle Finder scheme
0029    ** \see KFPartEfficiencies for the definition of "iPart". 
0030    **/
0031   KFPartEfficiencies fParteff;
0032   std::string parName[NHisto1D] = {"M","p","p_{t}","y","DecayL","c#tau","chi2ndf","prob","#theta","phi","X","Y","Z","R", "L", "l/dl","Multiplicity"};
0033 #ifdef CBM
0034   int nBins[NHisto1D] = {1000, // M
0035                           100, // p
0036                           100, // pt
0037                           100, // y
0038                           100, // DecayL
0039                           100, // ctau
0040                           100, // chi2/ndf
0041                           100, // prob
0042                           100, // theta
0043                           100, // phi
0044                           200, // X
0045                           200, // Y
0046                           360, // Z
0047                           200, // R
0048                           200, // L
0049                           200, // L/dL
0050                         fParteff.partMaxMult[iPart]+1};
0051   float xMin[NHisto1D] = { fParteff.partMHistoMin[iPart], // M
0052                             0.f, // p
0053                             0.f, // pt
0054                             0.f, // y
0055                             -5.f, // DecayL
0056                             0.f, // ctau
0057                             0.f, // chi2/ndf
0058                             0.f, // prob
0059                             -2.f, // theta
0060                             -2.f, // phi
0061                           -50.f, // X
0062                           -50.f, // Y
0063                           -10.f, // Z
0064                             0.f, // R
0065                             0.f, // L
0066                             -1.f, // L/dL
0067                             -0.5f };
0068   float xMax[NHisto1D] = { fParteff.partMHistoMax[iPart], // M
0069                             10.f, // p
0070                               3.f, // pt
0071                               6.f, // y
0072                             55.f, // DecayL
0073                             30.f, // ctau
0074                             20.f, // chi2/ndf
0075                               1.f, // prob
0076                               2.f, // theta
0077                               2.f, // phi
0078                             50.f, // X
0079                             50.f, // Y
0080                             80.f, // Z
0081                             50.f, // R
0082                             100.f, // L
0083                             35.f, // L/dL
0084                           float(fParteff.partMaxMult[iPart])+0.5f};
0085 #else
0086   int nBins[NHisto1D] = {1000, // M
0087                           100, // p
0088                           100, // pt
0089                           100, // y
0090                           100, // DecayL
0091                           100, // ctau
0092                           100, // chi2/ndf
0093                           100, // prob
0094                           100, // theta
0095                           100, // phi
0096                           100, // X
0097                         1000, // Y
0098                         1000, // Z
0099                         1000, // R
0100                         1000, // L
0101                         1000, // L/dL
0102                         fParteff.partMaxMult[iPart]+1};
0103   float xMin[NHisto1D] = { fParteff.partMHistoMin[iPart], // M
0104                             0.f, // p
0105                             0.f, // pt
0106                             -6.f, // y
0107                             -5.f, // DecayL
0108                             0.f, // ctau
0109                             0.f, // chi2/ndf
0110                             0.f, // prob
0111                             -2.f, // theta
0112                             -2.f, // phi
0113                           -200.f, // X
0114                           -200.f, // Y
0115                           -200.f, // Z
0116                             0.f, // R
0117                             0.f, // L
0118                             -1.f, // L/dL
0119                             -0.5f };
0120   float xMax[NHisto1D] = { fParteff.partMHistoMax[iPart], // M
0121                             10.f, // p
0122                               3.f, // pt
0123                               6.f, // y
0124                             55.f, // DecayL
0125                             30.f, // ctau
0126                             20.f, // chi2/ndf
0127                               1.f, // prob
0128                               2.f, // theta
0129                               2.f, // phi
0130                             200.f, // X
0131                             200.f, // Y
0132                             200.f, // Z
0133                             200.f, // R
0134                             400.f, // L
0135                             35.f, // L/dL
0136                           float(fParteff.partMaxMult[iPart])+0.5f};
0137 #endif
0138   for(int iHisto=0; iHisto<NHisto1D; iHisto++)
0139     fKFPHistogram1D[iHisto] = KFPHistogram1D(parName[iHisto], nBins[iHisto], xMin[iHisto], xMax[iHisto]);
0140 }
0141 
0142 void KFPHistogramSet::SetHistogramMemory(int* pointer)
0143 {
0144   /** Sets a pointer to the memory allocated externally for the current set of histograms.
0145    ** \param[in] pointer - pointer to the memory
0146    **/
0147   for(int i=0; i<NHisto1D; i++)
0148   {
0149     fKFPHistogram1D[i].SetHistogramMemory(pointer);
0150     pointer += fKFPHistogram1D[i].DataSize();
0151   }
0152 }
0153 
0154 void KFPHistogramSet::Fill(const KFParticle& particle)
0155 {
0156   /** Fill all possible histograms using parameters of the provided KFParticle object.
0157    ** \param[in] particle - KFParticle object
0158    **/  
0159   float mass = 0, p=0, pt=0, err = 0;
0160   particle.GetMass(mass, err);
0161   particle.GetMomentum(p, err);
0162   particle.GetPt(pt, err);
0163   float rapidity = particle.GetRapidity();
0164   float chi2ndf  = particle.GetChi2()/float(particle.GetNDF());
0165   float r        = sqrt(particle.X()*particle.X() + particle.Y()*particle.Y());
0166   float l        = sqrt(particle.X()*particle.X() + particle.Y()*particle.Y() + particle.Z()*particle.Z());
0167   
0168   fKFPHistogram1D[0].Fill(mass);
0169   fKFPHistogram1D[1].Fill(p);
0170   fKFPHistogram1D[2].Fill(pt);
0171   fKFPHistogram1D[3].Fill(rapidity);
0172   fKFPHistogram1D[6].Fill(chi2ndf);
0173   fKFPHistogram1D[10].Fill(particle.X());
0174   fKFPHistogram1D[11].Fill(particle.Y());
0175   fKFPHistogram1D[12].Fill(particle.Z());
0176   fKFPHistogram1D[13].Fill(r);
0177   fKFPHistogram1D[14].Fill(l);
0178 }