Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:13:10

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef TOWERID_H
0004 #define 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 const int nTowers = 24576;
0023 const int nIB = 384;
0024 const int nSectors = 64;
0025 const int nTowersIB = 64;
0026 const int nTowersSec = 384;
0027 
0028 class towerid : public SubsysReco
0029 {
0030  public:
0031 
0032   towerid(const std::string &name = "towerid.root", const std::string &cdbtreename = "test.root", float adccut_sg = 250,float adccut_k = 500, float sigmas_lo = 1, float sigmas_hi = 4.5, float SG_f = 0.55, float Kur_f = 0.55, float region_f = 0.55);
0033 
0034   ~towerid() override;
0035 
0036   /** Called during initialization.
0037       Typically this is where you can book histograms, and e.g.
0038       register them to Fun4AllServer (so they can be output to file
0039       using Fun4AllServer::dumpHistos() method).
0040   */
0041   int Init(PHCompositeNode *topNode) override;
0042 
0043   /** Called for first event when run number is known.
0044       Typically this is where you may want to fetch data from
0045       database, because you know the run number. A place
0046       to book histograms which have to know the run number.
0047   */
0048   int InitRun(PHCompositeNode *topNode) override;
0049 
0050   /** Called for each event.
0051       This is where you do the real work.
0052   */
0053   int process_event(PHCompositeNode *topNode) override;
0054 
0055   /// Clean up internals after each event.
0056   int ResetEvent(PHCompositeNode *topNode) override;
0057 
0058   /// Called at the end of each run.
0059   int EndRun(const int runnumber) override;
0060 
0061   /// Called at the end of all processing.
0062   int End(PHCompositeNode *topNode) override;
0063 
0064   /// Reset
0065   int Reset(PHCompositeNode * /*topNode*/) override;    
0066 
0067   void Print(const std::string &what = "ALL") const override;
0068   
0069   //histogram filler so we don't have to call the End function
0070   void FillHistograms(const int runnumber, const int segment);
0071 
0072   void CalculateCutOffs(const int runnumber);
0073 
0074   void WriteCDBTree(const int runnumber);
0075   
0076  private:
0077 
0078   TTree *T;
0079   TFile *out;
0080 
0081 //  CDBTTree *cdbttree;
0082  
0083   TFile*fchannels;
0084   TTree *channels;
0085 
0086   int fiber_type = 0;
0087  
0088   //Fun4AllHistoManager *hm = nullptr;
0089   std::string Outfile = "commissioning.root";
0090   
0091   TH1F* hEventCounter = NULL;
0092   
0093   TH2F* Fspec = NULL;
0094   TH2F* Fspec_SG = NULL;
0095   TH2F* Fspec_K = NULL;
0096   TH2F* Fspec_sector = NULL;
0097   TH2F* Fspec_IB = NULL;
0098  
0099   TH2F* Fspeci = NULL;
0100   TH2F* Fspeci_SG = NULL;
0101   TH2F* Fspeci_K = NULL;
0102   TH2F* Fspeci_sector = NULL;
0103   TH2F* Fspeci_IB = NULL;
0104 
0105   TH2F* Espec = NULL;
0106   TH2F* Espec_SG = NULL; 
0107   TH2F* Espec_K = NULL; 
0108   TH2F* Espec_sector = NULL;
0109   TH2F* Espec_IB = NULL;
0110 
0111   const std::string cdbtreename; 
0112   
0113   float adccut_sg;
0114   float adccut_k;
0115   float sigmas_lo;
0116   float sigmas_hi;
0117   float SG_f;
0118   float Kur_f;
0119   float region_f;
0120     
0121   int m_hot_channels;
0122   float towerF[nTowers] = {0};
0123   float sectorF[nSectors] = {0};
0124   float ibF[nIB] = {0};
0125 
0126   float towerE[nTowers] = {0};
0127   float sectorE[nSectors] = {0};
0128   float ibE[nIB] = {0};
0129 
0130   int hottowers[nTowers] = {0};
0131   int hotIB[nIB] = {0};
0132   int hotsectors[nSectors] = {0};
0133   int deadtowers[nTowers] = {0};
0134 
0135     
0136   int coldtowers[nTowers] = {0};
0137   int coldIB[nIB] = {0};
0138   int coldsectors[nSectors] = {0};
0139   int hot_regions = 0;
0140   int cold_regions = 0;  
0141 
0142 
0143   int goodevents = 0;
0144 };
0145 
0146 #endif