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 CALOTREEGEN_H
0004 #define CALOTREEGEN_H
0005 
0006 #include <fun4all/SubsysReco.h>
0007 
0008 #include <string>
0009 #include <vector>
0010 #include <TTree.h>
0011 
0012 class TTree;
0013 class PHCompositeNode;
0014 class Fun4AllHistoManager;
0015 class TFile;
0016 class RawCluster;
0017 class TowerInfoContainer;
0018 
0019 class caloTreeGen : public SubsysReco
0020 {
0021  public:
0022 
0023   caloTreeGen(const std::string &name = "caloTreeGen");
0024 
0025   ~caloTreeGen() override;
0026 
0027   /** Called during initialization.
0028       Typically this is where you can book histograms, and e.g.
0029       register them to Fun4AllServer (so they can be output to file
0030       using Fun4AllServer::dumpHistos() method).
0031   */
0032   int Init(PHCompositeNode *topNode) override;
0033 
0034   /** Called for first event when run number is known.
0035       Typically this is where you may want to fetch data from
0036       database, because you know the run number. A place
0037       to book histograms which have to know the run number.
0038   */
0039   int InitRun(PHCompositeNode *topNode) override;
0040 
0041   /** Called for each event.
0042       This is where you do the real work.
0043   */
0044   int process_event(PHCompositeNode *topNode) override;
0045 
0046   /// Clean up internals after each event.
0047   int ResetEvent(PHCompositeNode *topNode) override;
0048 
0049   /// Called at the end of each run.
0050   int EndRun(const int runnumber) override;
0051 
0052   /// Called at the end of all processing.
0053   int End(PHCompositeNode *topNode) override;
0054 
0055   /// Reset
0056   int Reset(PHCompositeNode * /*topNode*/) override;
0057 
0058   void Print(const std::string &what = "ALL") const override;
0059 
0060   void setClusters(int clusters)  {doClusters = clusters;}
0061 
0062   void setFineClusters(int fineCluster) {doFineCluster = fineCluster;}
0063   
0064  private:
0065 
0066   TTree *T;
0067   
0068   std::vector<float> m_emcTowPhi;
0069   std::vector<float> m_emcTowEta;
0070   std::vector<float> m_emcTowE;
0071   std::vector<float> m_emcTiming;
0072   std::vector<float> m_emciEta;
0073   std::vector<float> m_emciPhi;
0074 
0075   std::vector<float> m_clusterE;
0076   std::vector<float> m_clusterPhi;
0077   std::vector<float> m_clusterEta;
0078   std::vector<float> m_clusterPt;
0079   std::vector<float> m_clusterChi;
0080   std::vector<float> m_clusterNtow;
0081   std::vector<float> m_clusterTowMax;
0082   std::vector<float> m_clusterECore;
0083   
0084   std::vector<std::vector<int> > m_clusTowEta;
0085   std::vector<std::vector<int> > m_clusTowPhi;
0086   std::vector<std::vector<float> > m_clusTowE;
0087   
0088     
0089   TFile *out;
0090   //Fun4AllHistoManager *hm = nullptr;
0091   std::string Outfile = "commissioning.root";
0092 
0093   unsigned int getCaloTowerPhiBin(const unsigned int key);
0094   unsigned int getCaloTowerEtaBin(const unsigned int key);
0095   float getMaxTowerE(RawCluster *cluster, TowerInfoContainer *towerContainer);
0096   std::vector<float> returnClusterTowE(RawCluster *cluster, TowerInfoContainer *towerContainer);
0097   std::vector<int> returnClusterTowPhi(RawCluster *cluster, TowerInfoContainer *towerContainer);
0098   std::vector<int> returnClusterTowEta(RawCluster *cluster, TowerInfoContainer *towerContainer);
0099 
0100 ;
0101   int doClusters;
0102   float totalCaloE;
0103   int doFineCluster;
0104 
0105 };
0106 
0107 #endif