Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-04-05 08:12:21

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef HEPMCPARTICLETRIGGER_H
0004 #define HEPMCPARTICLETRIGGER_H
0005 
0006 #include <fun4all/SubsysReco.h>
0007 
0008 #include <fastjet/PseudoJet.hh>
0009 
0010 #include <cmath>
0011 #include <map>
0012 #include <string>
0013 #include <vector>
0014 
0015 class PHCompositeNode;
0016 namespace HepMC
0017 {
0018   class GenEvent;
0019   class GenParticle;
0020 }
0021 
0022 class HepMCParticleTrigger : public SubsysReco
0023 {
0024  public:
0025   HepMCParticleTrigger(float trigger_thresh = 10., int n_incom = 1000, bool up_lim = false, const std::string& name = "HepMCParticleTrigger");
0026 
0027   ~HepMCParticleTrigger() override = default;
0028 
0029   /** Called for each event.
0030       This is where you do the real work.
0031    */
0032   int process_event(PHCompositeNode* topNode) override;
0033 
0034   /// Clean up internals after each event.
0035 
0036   /// Called at the end of each run.
0037 
0038   /// Called at the end of all processing.
0039 
0040   /// Reset
0041   void AddParticles(const std::vector<int>&); //exclusively take input in the form of a pdg_ids (22 for photon, primary use case)
0042   void AddParticle(int);
0043 
0044   /*  void AddParents(const std::string &parents);
0045     void AddParents(int parent);
0046     void AddParents(std::vector<int> parents);
0047     void AddParentspID(std::vector<int> parents);
0048   */
0049   void SetPtHigh(double);
0050   void SetPtLow(double);
0051   void SetPtHighLow(double, double);
0052 
0053   void SetPHigh(double);
0054   void SetPLow(double);
0055   void SetPHighLow(double, double);
0056 
0057   void SetEtaHigh(double);
0058   void SetEtaLow(double);
0059   void SetEtaHighLow(double, double);
0060 
0061   void SetAbsEtaHigh(double);
0062   void SetAbsEtaLow(double);
0063   void SetAbsEtaHighLow(double, double);
0064 
0065   void SetPzHigh(double);
0066   void SetPzLow(double);
0067   void SetPzHighLow(double, double);
0068 
0069   void SetRejectFromHadronDecay(bool b) {m_rejectFromHadronDecay = b;}
0070   void SetStableParticleOnly(bool b) { m_doStableParticleOnly = b; }
0071 
0072   int getNevts(){return this->n_evts;}
0073   int getNgood(){return this->n_good;}
0074 
0075   bool IsFromHadronDecay(const HepMC::GenParticle* gp);
0076   bool IsIonPDG(int _pdg) { return (std::abs(_pdg) >= 1000000000); }
0077 
0078  private:
0079   bool isGoodEvent(HepMC::GenEvent* e1);
0080   std::vector<int> getParticles(HepMC::GenEvent* e1);
0081   int particleAboveThreshold(const std::map<int, int>& n_particles, int particle);
0082   //  std::vector<int> _theParentsi {};
0083   std::vector<int> _theParticles{};
0084   bool m_doStableParticleOnly{true};
0085   bool m_rejectFromHadronDecay{true};
0086   float threshold{0.};
0087   int goal_event_number{1000};
0088   bool set_event_limit{false};
0089   int n_evts{0};
0090   int n_good{0};
0091 
0092   float _theEtaHigh{2.0};
0093   float _theEtaLow{-2.0};
0094   float _thePtHigh{999.9};
0095   float _thePtLow{-999.9};
0096   float _thePHigh{999.9};
0097   float _thePLow{-999.9};
0098   float _thePzHigh{999.9};
0099   float _thePzLow{-999.9};
0100 
0101   bool _doEtaHighCut{true};
0102   bool _doEtaLowCut{true};
0103   bool _doBothEtaCut{true};
0104 
0105   bool _doAbsEtaHighCut{false};
0106   bool _doAbsEtaLowCut{false};
0107   bool _doBothAbsEtaCut{false};
0108 
0109   bool _doPtHighCut{false};
0110   bool _doPtLowCut{false};
0111   bool _doBothPtCut{false};
0112 
0113   bool _doPHighCut{false};
0114   bool _doPLowCut{false};
0115   bool _doBothPCut{false};
0116 
0117   bool _doPzHighCut{false};
0118   bool _doPzLowCut{false};
0119   bool _doBothPzCut{false};
0120   
0121   bool IsHadronPDG(int _pdg);
0122 };
0123 
0124 #endif  // HEPMCPARTICLETRIGGER_H