Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:14:23

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