Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef HCAL_TOWERID_H
0004 #define HCAL_TOWERID_H
0005 
0006 #include <fun4all/SubsysReco.h>
0007 //#include <cdbobjects/CDBTTree.h>
0008 
0009 #include <string>
0010 #include <vector>
0011 #include <TTree.h>
0012 #include <TH1F.h>
0013 #include <TH2F.h>
0014 
0015 class TTree;
0016 class PHCompositeNode;
0017 class Fun4AllHistoManager;
0018 class TFile;
0019 class RawCluster;
0020 class TowerInfoContainer;
0021 
0022 
0023 const int nTowers = 1536;
0024 
0025 class hcal_towerid : public SubsysReco
0026 {
0027  public:
0028 
0029   hcal_towerid(const std::string &name = "hcal_towerid",const std::string &Outfile = "towerid.root", const std::string &icdbtreename = "test.root", const std::string &ocdbtreename = "test2.root", float adccut_i = 250, float adccut_o = 250, float sigmas_lo = 1, float sigmas_hi = 4.5, float inner_f = 0.03, float outer_f = 0.03);
0030 
0031   ~hcal_towerid() override;
0032 
0033   /** Called during initialization.
0034       Typically this is where you can book histograms, and e.g.
0035       register them to Fun4AllServer (so they can be output to file
0036       using Fun4AllServer::dumpHistos() method).
0037   */
0038   int Init(PHCompositeNode *topNode) override;
0039 
0040   /** Called for first event when run number is known.
0041       Typically this is where you may want to fetch data from
0042       database, because you know the run number. A place
0043       to book histograms which have to know the run number.
0044   */
0045   int InitRun(PHCompositeNode *topNode) override;
0046 
0047   /** Called for each event.
0048       This is where you do the real work.
0049   */
0050   int process_event(PHCompositeNode *topNode) override;
0051 
0052   /// Clean up internals after each event.
0053   int ResetEvent(PHCompositeNode *topNode) override;
0054 
0055   /// Called at the end of each run.
0056   int EndRun(const int runnumber) override;
0057 
0058   /// Called at the end of all processing.
0059   int End(PHCompositeNode *topNode) override;
0060 
0061   /// Reset
0062   int Reset(PHCompositeNode * /*topNode*/) override;    
0063 
0064   void Print(const std::string &what = "ALL") const override;
0065   void FillHistograms(const int runnumber, const int segment);
0066 
0067   void CalculateCutOffs(const int runnumber);
0068 
0069   void WriteCDBTree(const int runnumber);
0070 
0071  private:
0072 
0073   TTree *Tinner;
0074   TTree *Touter;
0075   TFile *out;
0076 
0077   //CDBTTree *cdbttree;
0078  
0079   TFile*fchannels;
0080   TTree *channels;
0081 
0082   //Fun4AllHistoManager *hm = nullptr;
0083   std::string Outfile = "commissioning.root"; 
0084   TH1F* hEventCounter = NULL;
0085   
0086   //  TH2F* Fspec = NULL;
0087   TH2F* Fspec_i = NULL;
0088   TH2F* Fspec_o = NULL;
0089 
0090   //TH2F* Fspeci = NULL;
0091   TH2F* Fspeci_i = NULL;
0092   TH2F* Fspeci_o = NULL;
0093 
0094   //TH2F* Espec = NULL;
0095   TH2F* Espec_i = NULL; 
0096   TH2F* Espec_o = NULL; 
0097   
0098   TH1F *iHCal_hist = NULL;
0099   TH1F *oHCal_hist = NULL;
0100 
0101 
0102   const std::string icdbtreename;
0103   const std::string ocdbtreename;   
0104   float adccut_i;
0105   float adccut_o;
0106   float sigmas_lo;
0107   float sigmas_hi;
0108   float inner_f;
0109   float outer_f;
0110     
0111   int hot_channels_i;
0112   int hot_channels_o;
0113   float itowerF[nTowers] = {0};
0114   float otowerF[nTowers] = {0};
0115 
0116   float itowerE[nTowers] = {0};
0117   float otowerE[nTowers] = {0};
0118 
0119   int ihottowers[nTowers] = {0};
0120   int ohottowers[nTowers] = {0};
0121 
0122   int ideadtowers[nTowers] = {0};
0123   int odeadtowers[nTowers] = {0};
0124     
0125   int icoldtowers[nTowers] = {0};
0126   int ocoldtowers[nTowers] = {0};
0127 
0128   int hot_regions = 0;
0129   int cold_regions = 0; 
0130 
0131 int goodevents = 0;
0132 };
0133 
0134 #endif