Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:18:44

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