Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 /// ===========================================================================
0002 /*! \file   TrksInJetQAHitManager.cc
0003  *  \author Derek Anderson
0004  *  \date   03.25.2024
0005  *
0006  *  A submodule for the TrksInJetQA module
0007  *  to generate QA plots for track hits
0008  */
0009 /// ===========================================================================
0010 
0011 
0012 // submodule definition
0013 #include "TrksInJetQAHitManager.h"
0014 
0015 // public methods =============================================================
0016 
0017 // ----------------------------------------------------------------------------
0018 //! Get information from a tracker hit
0019 // ----------------------------------------------------------------------------
0020 void TrksInJetQAHitManager::GetInfo(TrkrHit* hit,
0021                                     TrkrDefs::hitsetkey& setKey,
0022                                     TrkrDefs::hitkey& hitKey)
0023 {
0024   // check which subsystem hit is in
0025   const uint16_t layer = TrkrDefs::getLayer(setKey);
0026   const bool isMvtx = IsInMvtx(layer);
0027   const bool isIntt = IsInIntt(layer);
0028   const bool isTpc = IsInTpc(layer);
0029 
0030   // get phi and z values
0031   //   - FIXME should be more explicit about
0032   //     row/column vs. z/phi...
0033   uint16_t phiBin = std::numeric_limits<uint16_t>::max();
0034   uint16_t zBin = std::numeric_limits<uint16_t>::max();
0035   if (isMvtx)
0036   {
0037     phiBin = MvtxDefs::getCol(hitKey);
0038     zBin = MvtxDefs::getRow(hitKey);
0039   }
0040   else if (isIntt)
0041   {
0042     phiBin = InttDefs::getCol(hitKey);
0043     zBin = InttDefs::getRow(hitKey);
0044   }
0045   else if (isTpc)
0046   {
0047     phiBin = TpcDefs::getPad(hitKey);
0048     /* TODO put in z calculation */
0049   }
0050 
0051   // collect hit info
0052   HitQAContent content{
0053       .ene = hit->getEnergy(),
0054       .adc = hit->getAdc(),
0055       .layer = layer,
0056       .phiBin = phiBin,
0057       .zBin = zBin};
0058 
0059   // fill histograms
0060   FillHistograms(Type::All, content);
0061   if (m_config.doSubsysHist)
0062   {
0063     if (isMvtx)
0064     {
0065       FillHistograms(Type::Mvtx, content);
0066     }
0067     else if (isIntt)
0068     {
0069       FillHistograms(Type::Intt, content);
0070     }
0071     else if (isTpc)
0072     {
0073       FillHistograms(Type::Tpc, content);
0074     }
0075   }
0076 }  // end 'GetInfo(TrkrHit*, TrkrDefs::hitsetkey&, TrkrDefs::hitkey&)'
0077 
0078 // private methods ============================================================
0079 
0080 // ----------------------------------------------------------------------------
0081 //! Fill tracker hit histograms
0082 // ----------------------------------------------------------------------------
0083 void TrksInJetQAHitManager::FillHistograms(const int type, HitQAContent& content)
0084 {
0085   // fill 1d histograms
0086   m_mapHist1D[Index(type, H1D::Ene)]->Fill(content.ene);
0087   m_mapHist1D[Index(type, H1D::ADC)]->Fill(content.adc);
0088   m_mapHist1D[Index(type, H1D::Layer)]->Fill(content.layer);
0089   m_mapHist1D[Index(type, H1D::PhiBin)]->Fill(content.phiBin);
0090   m_mapHist1D[Index(type, H1D::ZBin)]->Fill(content.zBin);
0091 
0092   // fill 2d histograms
0093   m_mapHist2D[Index(type, H2D::EneVsLayer)]->Fill(content.layer, content.ene);
0094   m_mapHist2D[Index(type, H2D::EneVsADC)]->Fill(content.adc, content.ene);
0095   m_mapHist2D[Index(type, H2D::PhiVsZBin)]->Fill(content.zBin, content.phiBin);
0096 }  //  end 'FillHistograms(Type, HitQAContent&)'
0097 
0098 // ----------------------------------------------------------------------------
0099 //! Define tracker hit histograms
0100 // ----------------------------------------------------------------------------
0101 void TrksInJetQAHitManager::DefineHistograms()
0102 {
0103   // grab binning schemes
0104   std::vector<TrksInJetQADefs::BinDef> vecBins = m_hist.GetVecHistBins();
0105 
0106   // set histogram types
0107   m_mapHistTypes[Type::All] = "All";
0108   if (m_config.doSubsysHist)
0109   {
0110     m_mapHistTypes[Type::Mvtx] = "Mvtx";
0111     m_mapHistTypes[Type::Intt] = "Intt";
0112     m_mapHistTypes[Type::Tpc] = "Tpc";
0113   }
0114 
0115   // define 1d histograms
0116   m_mapHistDef1D[H1D::Ene] = std::tuple("HitEne", vecBins.at(TrksInJetQAHist::Var::Ene));
0117   m_mapHistDef1D[H1D::ADC] = std::tuple("HitAdc", vecBins.at(TrksInJetQAHist::Var::Adc));
0118   m_mapHistDef1D[H1D::Layer] = std::tuple("HitLayer", vecBins.at(TrksInJetQAHist::Var::Layer));
0119   m_mapHistDef1D[H1D::PhiBin] = std::tuple("HitPhiBin", vecBins.at(TrksInJetQAHist::Var::PhiBin));
0120   m_mapHistDef1D[H1D::ZBin] = std::tuple("HitZBin", vecBins.at(TrksInJetQAHist::Var::ZBin));
0121 
0122   // define 2d histograms
0123   m_mapHistDef2D[H2D::EneVsLayer] = std::tuple("HitEneVsLayer",
0124                                                vecBins.at(TrksInJetQAHist::Var::Layer),
0125                                                vecBins.at(TrksInJetQAHist::Var::Ene));
0126   m_mapHistDef2D[H2D::EneVsADC] = std::tuple("HitEneVsADC",
0127                                              vecBins.at(TrksInJetQAHist::Var::Adc),
0128                                              vecBins.at(TrksInJetQAHist::Var::Ene));
0129   m_mapHistDef2D[H2D::PhiVsZBin] = std::tuple("HitPhiVsZBin",
0130                                               vecBins.at(TrksInJetQAHist::Var::ZBin),
0131                                               vecBins.at(TrksInJetQAHist::Var::PhiBin));
0132 }  // end 'DefineHistograms()'
0133 
0134 // end ========================================================================