Back to home page

sPhenix code displayed by LXR

 
 

    


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

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