Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:18:07

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef CALOHISTGEN_H
0004 #define CALOHISTGEN_H
0005 
0006 #include <fun4all/SubsysReco.h>
0007 
0008 #include <limits>
0009 #include <string>
0010 #include <cstring> 
0011 
0012 class PHCompositeNode;
0013 class RawCluster;
0014 class TFile;
0015 class TH1F;
0016 class TH2F;
0017 class TH3F;
0018 
0019 class caloHistGen : public SubsysReco
0020 {
0021  public:
0022   caloHistGen(const std::string &name = "caloHistGen");
0023 
0024   ~caloHistGen() override = default;
0025 
0026   /** Called during initialization.
0027       Typically this is where you can book histograms, and e.g.
0028       register them to Fun4AllServer (so they can be output to file
0029       using Fun4AllServer::dumpHistos() method).
0030   */
0031   int Init(PHCompositeNode *topNode) override;
0032 
0033   /** Called for each event.
0034       This is where you do the real work.
0035   */
0036   int process_event(PHCompositeNode *topNode) override;
0037 
0038   /// Clean up internals after each event.
0039   int ResetEvent(PHCompositeNode *topNode) override;
0040 
0041   /// Called at the end of all processing.
0042   int End(PHCompositeNode *topNode) override;
0043 
0044   void doClusters(int clusters, const std::string &clusterNode)
0045   {
0046     storeClusters = clusters;
0047     m_clusterNode = clusterNode;
0048   }
0049 
0050   void doEMCal(int emcalOn, const std::string &emcNode)
0051   {
0052     storeEMCal = emcalOn;
0053     m_emcTowerNode = emcNode;
0054   }
0055 
0056   void doHCals(int hcalsOn, const std::string &ohcNode, const std::string &ihcNode)
0057   {
0058     storeHCals = hcalsOn;
0059     m_ohcTowerNode = ohcNode;
0060     m_ihcTowerNode = ihcNode;
0061   }
0062 
0063   void doZDC(int zdcOn, const std::string &zdcNode)
0064   {
0065     storeZDC = zdcOn;
0066     m_zdcTowerNode = zdcNode;
0067   }
0068 
0069   void doTrig(int trigOn, const std::string &trigNode)
0070   {
0071     checkTrig = trigOn;
0072     m_trigNode = trigNode;
0073   }
0074 
0075   void setPi0Reco(int doPi0)
0076   {
0077     doPi0Reco = doPi0;
0078   }
0079   
0080   void setMaxAlpha(float alphaMax)
0081   {
0082     maxAlpha = alphaMax;
0083   }
0084   
0085   void setMinClusterE(float minClusE)
0086   {
0087     clusEMin = minClusE;
0088   }
0089   
0090   
0091   void setTrig(const char *selection)
0092   {
0093     if (!strcmp(selection, "minBias"))
0094       {
0095     trigRequired[10] = 1;
0096       }
0097     if (!strcmp(selection, "minBias10"))
0098       {
0099     trigRequired[12] = 1;
0100       }
0101     if (!strcmp(selection, "minBias30"))
0102       {
0103     trigRequired[13] = 1;
0104       }
0105     if (!strcmp(selection, "minBias60"))
0106       {
0107     trigRequired[14] = 1;
0108       }
0109     if (!strcmp(selection, "photon"))
0110       {
0111     trigRequired[28] = 1;
0112     trigRequired[29] = 1;
0113     trigRequired[30] = 1;
0114     trigRequired[31] = 1;
0115       }
0116     if (!strcmp(selection, "jet"))
0117       {
0118     trigRequired[20] = 1;
0119     trigRequired[21] = 1;
0120     trigRequired[22] = 1;
0121     trigRequired[23] = 1;
0122       }
0123     if (!strcmp(selection, "photonMBD"))
0124       {
0125     trigRequired[24] = 1;
0126     trigRequired[25] = 1;
0127     trigRequired[26] = 1;
0128     trigRequired[27] = 1;
0129       }
0130     if (!strcmp(selection, "jetMBD"))
0131       {
0132     trigRequired[16] = 1;
0133     trigRequired[17] = 1;
0134     trigRequired[18] = 1;
0135     trigRequired[19] = 1;
0136       }
0137   }
0138  
0139  private:
0140   // private methods
0141  
0142   // pointers
0143 
0144   TFile *out{nullptr};
0145 
0146 
0147   TH3F *h_emcTowE{nullptr};
0148   TH3F * h_OHCalTowE{nullptr};
0149   TH3F *h_IHCalTowE{nullptr};
0150 
0151   TH3F *h_emcTowChi2{nullptr};
0152   TH3F *h_OHCalTowChi2{nullptr};
0153   TH3F *h_IHCalTowChi2{nullptr};
0154 
0155   TH3F *h_emcTowTime{nullptr};
0156   TH3F *h_OHCalTowTime{nullptr};
0157   TH3F *h_IHCalTowTime {nullptr};
0158 
0159   TH3F *h_emcTowPed{nullptr};
0160   TH3F *h_OHCalTowPed{nullptr};
0161   TH3F *h_IHCalTowPed{nullptr};
0162 
0163   TH3F *h_clusInfo{nullptr};
0164   TH3F *h_diPhotonEtaPhiE{nullptr};
0165   TH2F *h_diPhotonMassE{nullptr};
0166   
0167   TH1F *h_clusPt{nullptr};
0168   TH1F *h_clusEcore{nullptr};
0169   
0170  TH1F * h_clusChi2{nullptr};
0171 
0172   TH1F *h_zVertex{nullptr};
0173   
0174   TH2F *h_zdcNSE{nullptr};
0175 
0176   TH2F *h_zdcChanTime{nullptr};
0177 
0178   
0179   
0180   // simple variables
0181   int storeClusters{1};
0182   int storeEMCal{1};
0183   int storeHCals{1};
0184   int storeZDC{1};
0185   int trigRequired[64]{0};
0186   int doPi0Reco{0};
0187   int checkTrig{1};
0188   float maxAlpha{0.7};
0189   float clusEMin{1.5};
0190 
0191   std::string m_clusterNode;
0192   std::string m_emcTowerNode;
0193   std::string m_ihcTowerNode;
0194   std::string m_ohcTowerNode;
0195   std::string m_trigNode;
0196   std::string m_zdcTowerNode;
0197   
0198   std::string Outfile{"commissioning.root"};
0199 
0200   
0201 
0202 };
0203 
0204 #endif