Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:15:32

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef CALOEMCNOISYTOWER_EMCNOISYTOWERFINDER_H
0004 #define CALOEMCNOISYTOWER_EMCNOISYTOWERFINDER_H
0005 
0006 #include <fun4all/SubsysReco.h>
0007 
0008 #include <string>
0009 #include <vector>
0010 
0011 class TFile;
0012 class TH2;
0013 class TProfile2D;
0014 class CDBTTree;
0015 
0016 class emcNoisyTowerFinder : public SubsysReco
0017 {
0018  public:
0019   explicit emcNoisyTowerFinder(const std::string& name = "emcNoisyTowerFinder", const std::string& outputName = "emcNoisyTowerFinder.root");
0020 
0021   ~emcNoisyTowerFinder() override = default;
0022   int InitRun(PHCompositeNode* topNode) override;
0023   int process_event(PHCompositeNode* topNode) override;
0024   int End(PHCompositeNode* topNode) override;
0025   void FillHistograms(const int runnumber, const int segment);
0026   void CalculateCutOffs(const int runnumber);
0027   void WriteCDBTree(const int runnumber);
0028   void FindHot(std::string& infilename, std::string& outfilename, const std::string& inHist = "h_hits_eta_phi_gev");
0029 
0030   void set_energy_threshold_adc(float val) { energy_threshold_adc = val; }
0031   void set_energy_threshold_gev(float val) { energy_threshold_gev = val; }
0032   void set_sigma_bad_thresh(float val) { sigma_bad_thresh = val; }
0033   void set_ihcal()
0034   {
0035     Nphi = 64;
0036     Neta = 24;
0037     m_caloName = "HCALIN";
0038     return;
0039   }
0040   void set_ohcal()
0041   {
0042     Nphi = 64;
0043     Neta = 24;
0044     m_caloName = "HCALOUT";
0045     return;
0046   }
0047   static float findMedian(const std::vector<float>& arr);
0048 
0049  private:
0050   TFile* out{nullptr};
0051   TFile* foutput{nullptr};
0052 
0053   CDBTTree* cdbttree{nullptr};
0054 
0055   TH2* h_hits_eta_phi_adc{nullptr};
0056   TProfile2D* pr_hits_eta_phi_adc{nullptr};
0057   TH2* h_hits_eta_phi_gev{nullptr};
0058   TProfile2D* pr_hits_eta_phi_gev{nullptr};
0059 
0060   int Neta{96};
0061   int Nphi{256};
0062 
0063   float energy_threshold_adc{200};
0064   float energy_threshold_gev{0.25};
0065   float percent_cold_thresh{0.1};
0066   float sigma_bad_thresh{5};
0067 
0068   std::string Outfile{"commissioning.root"};
0069 
0070   std::string m_fieldname{"Femc_datadriven_qm1_correction"};
0071   std::string m_caloName{"CEMC"};
0072 };
0073 
0074 #endif