Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-17 09:21:20

0001 /// ===========================================================================
0002 /*! \file   TrksInJetQAClustManager.cc
0003  *  \author Derek Anderson
0004  *  \date   03.25.2024
0005  *
0006  *  A submodule for the TrksInJetQA module to generate
0007  *  QA plots for track clusters
0008  */
0009 /// ============================================================================
0010 
0011 
0012 // submodule definition
0013 #include "TrksInJetQAClustManager.h"
0014 
0015 // public methods =============================================================
0016 
0017 // ----------------------------------------------------------------------------
0018 //! Grab information from a tracker cluster
0019 // ----------------------------------------------------------------------------
0020 void TrksInJetQAClustManager::GetInfo(TrkrCluster* cluster,
0021                                       TrkrDefs::cluskey& clustKey,
0022                                       ActsGeometry* actsGeom)
0023 {
0024   // check which subsystem cluster is in
0025   const uint16_t layer = TrkrDefs::getLayer(clustKey);
0026   const bool isMvtx = IsInMvtx(layer);
0027   const bool isIntt = IsInIntt(layer);
0028   const bool isTpc = IsInTpc(layer);
0029 
0030   // get cluster position
0031   Acts::Vector3 actsPos = actsGeom->getGlobalPosition(clustKey, cluster);
0032 
0033   // collect cluster info
0034   ClustQAContent content{
0035       .x = actsPos(0),
0036       .y = actsPos(1),
0037       .z = actsPos(2),
0038       .r = std::hypot(actsPos(0), actsPos(1))};
0039 
0040   // fill histograms
0041   FillHistograms(Type::All, content);
0042   if (m_config.doSubsysHist)
0043   {
0044     if (isMvtx)
0045     {
0046       FillHistograms(Type::Mvtx, content);
0047     }
0048     else if (isIntt)
0049     {
0050       FillHistograms(Type::Intt, content);
0051     }
0052     else if (isTpc)
0053     {
0054       FillHistograms(Type::Tpc, content);
0055     }
0056   }
0057 }  // end GetInfo(TrkrCluster*, TrkrDefs::cluskey&, ActsGeometry*)'
0058 
0059 // private methods ============================================================
0060 
0061 // ----------------------------------------------------------------------------
0062 //! Fill tracker cluster histograms
0063 // ----------------------------------------------------------------------------
0064 void TrksInJetQAClustManager::FillHistograms(const int type, ClustQAContent& content)
0065 {
0066   // fill 1d histograms
0067   m_mapHist1D[Index(type, H1D::PosX)]->Fill(content.x);
0068   m_mapHist1D[Index(type, H1D::PosY)]->Fill(content.y);
0069   m_mapHist1D[Index(type, H1D::PosZ)]->Fill(content.z);
0070   m_mapHist1D[Index(type, H1D::PosR)]->Fill(content.r);
0071 
0072   // fill 2d histograms
0073   m_mapHist2D[Index(type, H2D::PosYvsX)]->Fill(content.x, content.y);
0074   m_mapHist2D[Index(type, H2D::PosRvsZ)]->Fill(content.z, content.r);
0075 }  //  end 'FillHistograms(int, ClustQAContent&)'
0076 
0077 // ----------------------------------------------------------------------------
0078 //! Define tracker cluster histograms
0079 // ----------------------------------------------------------------------------
0080 void TrksInJetQAClustManager::DefineHistograms()
0081 {
0082   // grab binning schemes
0083   std::vector<TrksInJetQADefs::BinDef> vecBins = m_hist.GetVecHistBins();
0084 
0085   // set histogram types
0086   m_mapHistTypes[Type::All] = "All";
0087   if (m_config.doSubsysHist)
0088   {
0089     m_mapHistTypes[Type::Mvtx] = "Mvtx";
0090     m_mapHistTypes[Type::Intt] = "Intt";
0091     m_mapHistTypes[Type::Tpc] = "Tpc";
0092   }
0093 
0094   // define 1d histograms
0095   m_mapHistDef1D[H1D::PosX] = std::tuple("ClustPosX", vecBins.at(TrksInJetQAHist::Var::PosXY));
0096   m_mapHistDef1D[H1D::PosY] = std::tuple("ClustPosY", vecBins.at(TrksInJetQAHist::Var::PosXY));
0097   m_mapHistDef1D[H1D::PosZ] = std::tuple("ClustPosZ", vecBins.at(TrksInJetQAHist::Var::PosZ));
0098   m_mapHistDef1D[H1D::PosR] = std::tuple("ClustPosR", vecBins.at(TrksInJetQAHist::Var::PosR));
0099 
0100   // define 2d histograms
0101   m_mapHistDef2D[H2D::PosYvsX] = std::tuple("ClustPosYvsX",
0102                                             vecBins.at(TrksInJetQAHist::Var::PosXY),
0103                                             vecBins.at(TrksInJetQAHist::Var::PosXY));
0104   m_mapHistDef2D[H2D::PosRvsZ] = std::tuple("ClustPosRvsZ",
0105                                             vecBins.at(TrksInJetQAHist::Var::PosZ),
0106                                             vecBins.at(TrksInJetQAHist::Var::PosR));
0107 }  // end 'BuildHistograms()'
0108 
0109 // end ========================================================================