Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 /// ===========================================================================
0002 /*! \file    NullFilter.cc
0003  *  \authors Derek Anderson
0004  *  \date    11.20.2024
0005  *
0006  *  Part of the BeamBackgroundFilterAndQA module, this
0007  *  filter does nothing, but provides a template for
0008  *  others to copy and fill in.
0009  */
0010 /// ===========================================================================
0011 
0012 // module components
0013 #include "NullFilter.h"
0014 
0015 #include "BeamBackgroundFilterAndQADefs.h"
0016 
0017 // root includes
0018 #include <TH1.h>
0019 
0020 // c++ includes
0021 #include <iostream>
0022 #include <map>
0023 #include <memory>
0024 #include <vector>
0025 
0026 // ctor/dtor ==================================================================
0027 
0028 // ----------------------------------------------------------------------------
0029 //! Default ctor
0030 // ----------------------------------------------------------------------------
0031 NullFilter::NullFilter(const std::string& name)
0032   : BaseBeamBackgroundFilter(name)
0033 {
0034 }  // end ctor()
0035 
0036 // ----------------------------------------------------------------------------
0037 //! ctor accepting config struct
0038 // ----------------------------------------------------------------------------
0039 NullFilter::NullFilter(const Config& config, const std::string& name)
0040   : BaseBeamBackgroundFilter(name)
0041   , m_config(config)
0042 {
0043 }  // end ctor(Config&)
0044 
0045 // public methods =============================================================
0046 
0047 // ----------------------------------------------------------------------------
0048 // Apply filter to check for beam background or not
0049 // ----------------------------------------------------------------------------
0050 bool NullFilter::ApplyFilter(PHCompositeNode* topNode)
0051 {
0052   // print debug message
0053   if (m_config.debug && (m_config.verbosity > 2))
0054   {
0055     std::cout << "NullFilter::ApplyFilter() Checking if streak found in OHCal via their sidebands" << std::endl;
0056   }
0057 
0058   // grab input node(s)
0059   GrabNodes(topNode);
0060 
0061   //... actual filter algorithm goes here ...//
0062 
0063   // other histograms filled similarly
0064   m_hists["test"]->Fill(1);
0065 
0066   // should return
0067   //   true,  if found beam background
0068   //   false, if no beam background found
0069   return false;
0070 
0071 }  // end 'ApplyFilter()'
0072 
0073 // ----------------------------------------------------------------------------
0074 //! Construct histograms
0075 // ----------------------------------------------------------------------------
0076 void NullFilter::BuildHistograms(const std::string& module, const std::string& tag)
0077 {
0078   // print debug message
0079   if (m_config.debug && (m_config.verbosity > 2))
0080   {
0081     std::cout << "NullFilter::BuildHistograms(std::string) Constructing histograms" << std::endl;
0082   }
0083 
0084   // make sure module name is lower case
0085   std::string moduleAndFilterName = module + "_" + m_name;
0086 
0087   // names of variables to be histogramed
0088   const std::vector<std::string> varNames = {
0089       "test"
0090       //... variable names like NStreakTwr should go here ...//
0091   };
0092 
0093   // make qa-compliant hist names
0094   std::vector<std::string> histNames = BeamBackgroundFilterAndQADefs::MakeQAHistNames(varNames, moduleAndFilterName, tag);
0095 
0096   // construct histograms
0097   m_hists[varNames[0]] = new TH1D(histNames[0].data(), "", 2, -0.5, 1.5);
0098   return;
0099 
0100 }  // end 'BuildHistograms(std::string&, std::string&)'
0101 
0102 // private methods ============================================================
0103 
0104 // ----------------------------------------------------------------------------
0105 //! Grab input nodes
0106 // ----------------------------------------------------------------------------
0107 void NullFilter::GrabNodes(PHCompositeNode* /*topNode*/)
0108 {
0109   // print debug message
0110   if (m_config.debug && (m_config.verbosity > 2))
0111   {
0112     std::cout << "NullFilter::GrabNodes(PHCompositeNode*) Grabbing input nodes" << std::endl;
0113   }
0114 
0115   //... grab input nodes off the node tree here ...//
0116   return;
0117 
0118 }  // end 'GrabNodes(PHCompositeNode*)'
0119 
0120 // end ========================================================================