Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:17:35

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 <limits>
0009 #include <string>
0010 #include <vector>
0011 
0012 class PHCompositeNode;
0013 class RawCluster;
0014 class TTree;
0015 class TFile;
0016 class TH1;
0017 
0018 class caloTreeGen : public SubsysReco
0019 {
0020  public:
0021   explicit caloTreeGen(const std::string &name = "caloTreeGen");
0022 
0023   ~caloTreeGen() override = default;
0024 
0025   /** Called during initialization.
0026       Typically this is where you can book histograms, and e.g.
0027       register them to Fun4AllServer (so they can be output to file
0028       using Fun4AllServer::dumpHistos() method).
0029   */
0030   int Init(PHCompositeNode *topNode) override;
0031 
0032   /** Called for each event.
0033       This is where you do the real work.
0034   */
0035   int process_event(PHCompositeNode *topNode) override;
0036 
0037   /// Clean up internals after each event.
0038   int ResetEvent(PHCompositeNode *topNode) override;
0039 
0040   /// Called at the end of all processing.
0041   int End(PHCompositeNode *topNode) override;
0042 
0043   void doClusters(int clusters, const std::string & clusterNode)
0044   {
0045     storeClusters = clusters;
0046     m_clusterNode = clusterNode;
0047   }
0048 
0049   void setClusterThresh(float thresh)
0050   {
0051     clusterThresh = thresh;
0052   }
0053 
0054   void doClusterDetails(int fineCluster) { storeClusterDetails = fineCluster; }
0055 
0056   void doEMCal(int emcalOn, const std::string & emcNode)
0057   {
0058     storeEMCal = emcalOn;
0059     m_emcTowerNode = emcNode;
0060   }
0061 
0062   void setEMCalThresh(float thresh)
0063   {
0064     emcalThresh = thresh;
0065   }
0066 
0067   void doHCals(int hcalsOn, const std::string & ohcNode, const std::string & ihcNode)
0068   {
0069     storeHCals = hcalsOn;
0070     m_ohcTowerNode = ohcNode;
0071     m_ihcTowerNode = ihcNode;
0072   }
0073 
0074   void setOHCalThresh(float thresh)
0075   {
0076     ohcalThresh = thresh;
0077   }
0078 
0079   void setIHCalThresh(float thresh)
0080   {
0081     ihcalThresh = thresh;
0082   }
0083 
0084   void doZDC(int zdcOn, const std::string & zdcNode)
0085   {
0086     storeZDC = zdcOn;
0087     m_zdcTowerNode = zdcNode;
0088   }
0089 
0090   void doTrig(int trigOn, const std::string & trigNode)
0091   {
0092     storeTrig = trigOn;
0093     m_trigNode = trigNode;
0094   }
0095 
0096  private:
0097   // private methods
0098   float getMaxTowerE(RawCluster *cluster);
0099   std::vector<float> returnClusterTowE(RawCluster *cluster);
0100   std::vector<int> returnClusterTowPhi(RawCluster *cluster);
0101   std::vector<int> returnClusterTowEta(RawCluster *cluster);
0102 
0103   // pointers
0104   TTree *T{nullptr};
0105 
0106   TFile *out{nullptr};
0107 
0108   TH1 *zVertex{nullptr};
0109 
0110   // simple variables
0111   float m_vertex{std::numeric_limits<float>::quiet_NaN()};
0112   float totalCaloEEMCal{std::numeric_limits<float>::quiet_NaN()};
0113   float totalCaloEOHCal{std::numeric_limits<float>::quiet_NaN()};
0114   float totalCaloEIHCal{std::numeric_limits<float>::quiet_NaN()};
0115   float totalCaloEZDC{std::numeric_limits<float>::quiet_NaN()};
0116   float clusterThresh{std::numeric_limits<float>::quiet_NaN()};
0117   float ohcalThresh{std::numeric_limits<float>::quiet_NaN()};
0118   float ihcalThresh{std::numeric_limits<float>::quiet_NaN()};
0119   float emcalThresh{std::numeric_limits<float>::quiet_NaN()};
0120 
0121   int storeClusters{1};
0122   int storeClusterDetails{1};
0123   int storeEMCal{1};
0124   int storeHCals{1};
0125   int storeZDC{1};
0126   int storeTrig{1};
0127   int eventNum{0};
0128   
0129   std::string m_clusterNode;
0130   std::string m_emcTowerNode;
0131   std::string m_ihcTowerNode;
0132   std::string m_ohcTowerNode;
0133   std::string m_trigNode;
0134   std::string m_zdcTowerNode;
0135 
0136   std::string Outfile{"commissioning.root"};
0137 
0138   // EMCal
0139   std::vector<float> m_emcTowE;
0140   std::vector<float> m_emciEta;
0141   std::vector<float> m_emciPhi;
0142   std::vector<int> m_emcTime;
0143   std::vector<float> m_emcChi2;
0144   std::vector<float> m_emcPed;
0145 
0146   // OHCal
0147   std::vector<float> m_ohciTowPhi;
0148   std::vector<float> m_ohciTowEta;
0149   std::vector<float> m_ohcTowE;
0150   std::vector<int> m_ohcTime;
0151   std::vector<float> m_ohcChi2;
0152   std::vector<float> m_ohcPed;
0153 
0154   // IHCal
0155   std::vector<float> m_ihciTowPhi;
0156   std::vector<float> m_ihciTowEta;
0157   std::vector<float> m_ihcTowE;
0158   std::vector<int> m_ihcTime;
0159   std::vector<float> m_ihcChi2;
0160   std::vector<float> m_ihcPed;
0161 
0162   // ZDC
0163   std::vector<float> m_zdcTowE;
0164   std::vector<int> m_zdcSide;
0165 
0166   // SMD
0167   std::vector<float> m_smdE;
0168   std::vector<int> m_smdSide;
0169 
0170   // Clusters
0171   std::vector<float> m_clusterE;
0172   std::vector<float> m_clusterPhi;
0173   std::vector<float> m_clusterEta;
0174   std::vector<float> m_clusterPt;
0175   std::vector<float> m_clusterChi;
0176   std::vector<float> m_clusterNtow;
0177   std::vector<float> m_clusterTowMaxE;
0178   std::vector<float> m_clusterECore;
0179 
0180   std::vector<std::vector<int> > m_clusTowEta;
0181   std::vector<std::vector<int> > m_clusTowPhi;
0182   std::vector<std::vector<float> > m_clusTowE;
0183 
0184   // GL1 information
0185   std::vector<bool> m_triggerVector;
0186 };
0187 
0188 #endif