Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:12:49

0001 #ifndef __HFJetTruthTrigger_H__
0002 #define __HFJetTruthTrigger_H__
0003 
0004 // --- need to check all these includes...
0005 #include <fun4all/SubsysReco.h>
0006 #include <vector>
0007 #include <cmath>
0008 #include <string>
0009 #include <limits.h>
0010 
0011 class TTree;
0012 class TFile;
0013 class TH2D;
0014 
0015 class PHCompositeNode;
0016 class Jet;
0017 namespace HepMC
0018 {
0019   class GenEvent;
0020 }
0021 
0022 class HFJetTruthTrigger : public SubsysReco
0023 {
0024 
0025 public:
0026 
0027   HFJetTruthTrigger(std::string filename, int flavor = 5, std::string jet_node = "AntiKt_Truth_r04", int maxevent = INT_MAX);
0028 
0029   int
0030   Init(PHCompositeNode*);
0031   int
0032   process_event(PHCompositeNode*);
0033   int
0034   End(PHCompositeNode*);
0035 
0036   float
0037   deltaR(float eta1, float eta2, float phi1, float phi2)
0038   {
0039 
0040     float deta = eta1 - eta2;
0041     float dphi = phi1 - phi2;
0042     if (dphi > +3.14159)
0043       dphi -= 2 * 3.14159;
0044     if (dphi < -3.14159)
0045       dphi += 2 * 3.14159;
0046 
0047     return sqrt(pow(deta, 2) + pow(dphi, 2));
0048 
0049   }
0050 
0051   double
0052   get_eta_max() const
0053   {
0054     return _eta_max;
0055   }
0056 
0057   void
0058   set_eta_max(double etaMax)
0059   {
0060     _eta_max = etaMax;
0061   }
0062 
0063   double
0064   get_eta_min() const
0065   {
0066     return _eta_min;
0067   }
0068 
0069   void
0070   set_eta_min(double etaMin)
0071   {
0072     _eta_min = etaMin;
0073   }
0074 
0075   double
0076   get_pt_max() const
0077   {
0078     return _pt_max;
0079   }
0080 
0081   void
0082   set_pt_max(double ptMax)
0083   {
0084     _pt_max = ptMax;
0085   }
0086 
0087   double
0088   get_pt_min() const
0089   {
0090     return _pt_min;
0091   }
0092 
0093   void
0094   set_pt_min(double ptMin)
0095   {
0096     _pt_min = ptMin;
0097   }
0098 
0099   //! action to take if no jet fitting _flavor requirement found. Action defined in <fun4all/Fun4AllReturnCodes.h>
0100   //! Default action is DISCARDEVENT for DST level filtering, one can further choose ABORTEVENT to use it as processing level filtering
0101   void
0102   set_rejection_action(int action)
0103   {
0104     _rejection_action = action;
0105   }
0106 
0107   //! The embedding ID for the HepMC subevent to be analyzed.
0108   //! embedding ID for the event
0109   //! positive ID is the embedded event of interest, e.g. jetty event from pythia
0110   //! negative IDs are backgrounds, .e.g out of time pile up collisions
0111   //! Usually, ID = 0 means the primary Au+Au collision background
0112   int get_embedding_id() const { return _embedding_id; }
0113   //
0114   //! The embedding ID for the HepMC subevent to be analyzed.
0115   //! embedding ID for the event
0116   //! positive ID is the embedded event of interest, e.g. jetty event from pythia
0117   //! negative IDs are backgrounds, .e.g out of time pile up collisions
0118   //! Usually, ID = 0 means the primary Au+Au collision background
0119   void set_embedding_id(int id) { _embedding_id = id; }
0120 private:
0121 
0122   //! tag jet flavor by parton matching, like PRL 113, 132301 (2014)
0123   int
0124   parton_tagging(Jet * jet, HepMC::GenEvent*, const double match_radius);
0125 
0126   //! tag jet flavor by hadron matching, like MIE proposal
0127   int
0128   hadron_tagging(Jet * jet, HepMC::GenEvent*, const double match_radius);
0129 
0130   bool _verbose;
0131 
0132   int _ievent;
0133   int _total_pass;
0134 
0135   TFile *_f;
0136 
0137   TH2D *_h2;
0138   TH2D *_h2all;
0139   TH2D *_h2_b;
0140   TH2D *_h2_c;
0141 
0142   std::string _foutname;
0143 
0144   int _flavor;
0145   int _maxevent;
0146 
0147   double _pt_min;
0148   double _pt_max;
0149 
0150   double _eta_min;
0151   double _eta_max;
0152 
0153   std::string _jet_name;
0154 
0155   //! action to take if no jet fitting _flavor requirement found. Action defined in <fun4all/Fun4AllReturnCodes.h>
0156   int _rejection_action;
0157 
0158   //! The embedding ID for the HepMC subevent to be analyzed.
0159   //! positive ID is the embedded event of interest, e.g. jetty event from pythia
0160   //! negative IDs are backgrounds, .e.g out of time pile up collisions
0161   //! Usually, ID = 0 means the primary Au+Au collision background
0162   int _embedding_id;
0163 
0164 };
0165 
0166 #endif // __HFJetTruthTrigger_H__