Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:20:02

0001 #ifndef JETBACKGROUNDCUT_H
0002 #define JETBACKGROUNDCUT_H
0003 
0004 #include <fun4all/SubsysReco.h>
0005 #include <globalvertex/GlobalVertex.h>
0006 #include <phparameter/PHParameters.h>
0007 #include <cmath>
0008 #include <string>
0009 class PHCompositeNode;
0010 
0011 class JetBackgroundCut : public SubsysReco
0012 {
0013  public:
0014   explicit JetBackgroundCut(const std::string &jetNodeName, const std::string &name = "JetBackgroundCutModule", int debug = 0, bool doAbort = false, GlobalVertex::VTXTYPE vtxtype = GlobalVertex::MBD, int sysvar = 0);
0015 
0016   ~JetBackgroundCut() override = default;
0017 
0018   bool failsLoEmFracETCut(float emFrac, float ET, bool dPhiCut, bool isDijet) const
0019   {
0020     float widen = 0;
0021     float shift = 0;
0022     if (_sysvar > 0)
0023     {
0024       widen = 0.05;
0025       shift = -1;
0026     }
0027     else if (_sysvar < 0)
0028     {
0029       widen = -0.05;
0030       shift = 1;
0031     }
0032     return (emFrac < (0.1 + widen) && ET > (50 * emFrac + 20 + shift)) && (dPhiCut || !isDijet);
0033   }
0034 
0035   bool failsHiEmFracETCut(float emFrac, float ET, bool dPhiCut, bool isDijet) const
0036   {
0037     float widen = 0;
0038     float shift = 0;
0039     if (_sysvar > 0)
0040     {
0041       widen = -0.05;
0042       shift = -1;
0043     }
0044     else if (_sysvar < 0)
0045     {
0046       widen = 0.05;
0047       shift = 1;
0048     }
0049     return (emFrac > (0.9 + widen) && ET > (-50 * emFrac + 70 + shift)) && (dPhiCut || !isDijet);
0050   }
0051 
0052   bool failsIhFracCut(float emFrac, float ohFrac) const
0053   {
0054     float shift = 0;
0055     if (_sysvar > 0)
0056     {
0057       shift = 0.05;
0058     }
0059     else if (_sysvar < 0)
0060     {
0061       shift = -0.05;
0062     }
0063     return emFrac + ohFrac < 0.65 + shift;
0064   }
0065 
0066   bool failsdPhiCut(float dPhi, bool isDijet)
0067   {
0068     return dPhi < 3 * M_PI / 4 && isDijet;
0069   }
0070 
0071   int Init(PHCompositeNode *topNode) override;
0072 
0073   int process_event(PHCompositeNode *topNode) override;
0074 
0075   int ResetEvent(PHCompositeNode *topNode) override;
0076 
0077   int End(PHCompositeNode *topNode) override;
0078 
0079   int Reset(PHCompositeNode * /*topNode*/) override;
0080 
0081   void Print(const std::string &what = "ALL") const override;
0082 
0083   void CreateNodeTree(PHCompositeNode *topNode);
0084 
0085   void SetDefaultParams()
0086   {
0087     _cutParams.set_int_param("failsLoEmJetCut", 0);
0088     _cutParams.set_int_param("failsHiEmJetCut", 0);
0089     _cutParams.set_int_param("failsIhJetCut", 0);
0090     _cutParams.set_int_param("failsAnyJetCut", 0);
0091   }
0092 
0093   void set_input_cemc_tower_node(const std::string &input_cemc_tower_node)
0094   {
0095     m_input_cemc_tower_node = input_cemc_tower_node;
0096   }
0097 
0098   void set_input_ohcal_tower_node(const std::string &input_ohcal_tower_node)
0099   {
0100     m_input_ohcal_tower_node = input_ohcal_tower_node;
0101   }
0102 
0103  private:
0104   bool _doAbort;
0105   std::string _name;
0106   int _debug;
0107   bool _missingInfoWarningPrinted = false;
0108   std::string _jetNodeName;
0109   GlobalVertex::VTXTYPE _vtxtype;
0110   int _sysvar;
0111   PHParameters _cutParams;
0112 
0113   std::string m_input_cemc_tower_node{"TOWERINFO_CALIB_CEMC_RETOWER"};
0114   std::string m_input_ohcal_tower_node{"TOWERINFO_CALIB_HCALOUT"};
0115 };
0116 
0117 #endif