Back to home page

sPhenix code displayed by LXR

 
 

    


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

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