Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:21:36

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 class TowerInfoContainer;
0019 
0020 class caloHistGen : public SubsysReco
0021 {
0022  public:
0023   caloHistGen(const std::string &name = "caloHistGen");
0024 
0025   ~caloHistGen() override = default;
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 each event.
0035       This is where you do the real work.
0036   */
0037   int process_event(PHCompositeNode *topNode) override;
0038 
0039   /// Clean up internals after each event.
0040   int ResetEvent(PHCompositeNode *topNode) override;
0041 
0042   /// Called at the end of all processing.
0043   int End(PHCompositeNode *topNode) override;
0044 
0045   void doClusters(int clusters, const std::string &clusterNode)
0046   {
0047     storeClusters = clusters;
0048     m_clusterNode = clusterNode;
0049   }
0050 
0051   void doEMCal(int emcalOn, const std::string &emcNode)
0052   {
0053     storeEMCal = emcalOn;
0054     m_emcTowerNode = emcNode;
0055   }
0056 
0057   void doHCals(int hcalsOn, const std::string &ohcNode, const std::string &ihcNode)
0058   {
0059     storeHCals = hcalsOn;
0060     m_ohcTowerNode = ohcNode;
0061     m_ihcTowerNode = ihcNode;
0062   }
0063 
0064   void doZDC(int zdcOn, const std::string &zdcNode)
0065   {
0066     storeZDC = zdcOn;
0067     m_zdcTowerNode = zdcNode;
0068   }
0069 
0070   void setCaloFrac(float frac)
0071   {
0072     caloFrac = frac;
0073   }
0074 
0075   void doTrig(int trigOn, const std::string &trigNode)
0076   {
0077     checkTrig = trigOn;
0078     m_trigNode = trigNode;
0079   }
0080 
0081   void setPi0Reco(int doPi0)
0082   {
0083     doPi0Reco = doPi0;
0084   }
0085   
0086   void setMaxAlpha(float alphaMax)
0087   {
0088     maxAlpha = alphaMax;
0089   }
0090   
0091   void setCluster1EMin(float minClusE)
0092   {
0093     clus1EMin = minClusE;
0094   }
0095 
0096   void setCluster2EMin(float minClusE)
0097   {
0098     clus2EMin = minClusE;
0099   }
0100 
0101   void setIsAuAu(bool isHI)
0102   {
0103     isAuAu = isHI;
0104   }
0105 
0106   float getTotalCaloEnergy(TowerInfoContainer *towerContainer);
0107   
0108   void peripheralOnlyPi0(bool doPeriphOnly)
0109   {
0110     peripheralOnly = doPeriphOnly;
0111   }
0112 
0113   void setTrig(const char *selection)
0114   {
0115     if (!strcmp(selection, "minBias"))
0116       {
0117     trigRequired[10] = 1;
0118       }
0119     if (!strcmp(selection, "minBias10"))
0120       {
0121     trigRequired[12] = 1;
0122       }
0123     if (!strcmp(selection, "minBias30"))
0124       {
0125     trigRequired[13] = 1;
0126       }
0127     if (!strcmp(selection, "minBias60"))
0128       {
0129     trigRequired[14] = 1;
0130       }
0131     if (!strcmp(selection, "photon"))
0132       {
0133     trigRequired[28] = 1;
0134     trigRequired[29] = 1;
0135     trigRequired[30] = 1;
0136     trigRequired[31] = 1;
0137       }
0138     if (!strcmp(selection, "jet"))
0139       {
0140     trigRequired[20] = 1;
0141     trigRequired[21] = 1;
0142     trigRequired[22] = 1;
0143     trigRequired[23] = 1;
0144       }
0145     if (!strcmp(selection, "photonMBD"))
0146       {
0147     trigRequired[24] = 1;
0148     trigRequired[25] = 1;
0149     trigRequired[26] = 1;
0150     trigRequired[27] = 1;
0151       }
0152     if (!strcmp(selection, "jetMBD"))
0153       {
0154     trigRequired[16] = 1;
0155     trigRequired[17] = 1;
0156     trigRequired[18] = 1;
0157     trigRequired[19] = 1;
0158       }
0159   }
0160  
0161  private:
0162   // private methods
0163  
0164   // pointers
0165 
0166   TFile *out{nullptr};
0167 
0168 
0169   TH3F *h_emcTowE{nullptr};
0170   TH3F * h_OHCalTowE{nullptr};
0171   TH3F *h_IHCalTowE{nullptr};
0172 
0173   TH3F *h_emcTowChi2{nullptr};
0174   TH3F *h_OHCalTowChi2{nullptr};
0175   TH3F *h_IHCalTowChi2{nullptr};
0176 
0177   TH3F *h_emcTowTime{nullptr};
0178   TH3F *h_OHCalTowTime{nullptr};
0179   TH3F *h_IHCalTowTime {nullptr};
0180 
0181   TH3F *h_emcTowPed{nullptr};
0182   TH3F *h_OHCalTowPed{nullptr};
0183   TH3F *h_IHCalTowPed{nullptr};
0184 
0185   TH3F *h_clusInfo{nullptr};
0186   TH3F *h_diPhotonEtaPhiE{nullptr};
0187   TH2F *h_diPhotonMassE{nullptr};
0188   
0189   TH1F *h_clusPt{nullptr};
0190   TH1F *h_clusEcore{nullptr};
0191   
0192   TH1F * h_clusChi2{nullptr};
0193 
0194   TH1F *h_zVertex{nullptr};
0195   
0196   TH2F *h_zdcNSE{nullptr};
0197 
0198   TH2F *h_zdcChanTime{nullptr};
0199 
0200   
0201   
0202   // simple variables
0203   bool peripheralOnly{false};
0204   bool isAuAu{false};
0205   int storeClusters{1};
0206   int storeEMCal{1};
0207   int storeHCals{1};
0208   int storeZDC{1};
0209   int trigRequired[64]{0};
0210   int doPi0Reco{0};
0211   int checkTrig{1};
0212   float maxAlpha{0.7};
0213   float clus1EMin{0.5};
0214   float clus2EMin{0.5};
0215   float emcaldownscale{1350000. / 800.};
0216   float caloFrac{0.05};
0217   std::string m_clusterNode;
0218   std::string m_emcTowerNode;
0219   std::string m_ihcTowerNode;
0220   std::string m_ohcTowerNode;
0221   std::string m_trigNode;
0222   std::string m_zdcTowerNode;
0223   
0224   std::string Outfile{"commissioning.root"};
0225 
0226   
0227 
0228 };
0229 
0230 #endif