Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #ifndef __HFFastSim_H__
0002 #define __HFFastSim_H__
0003 
0004 // --- need to check all these includes...
0005 #include <fun4all/SubsysReco.h>
0006 
0007 #include <TObject.h>
0008 #include <TString.h>
0009 
0010 #include <limits.h>
0011 #include <cmath>
0012 #include <string>
0013 #include <vector>
0014 #include <utility>
0015 
0016 class TTree;
0017 class TFile;
0018 class TH2D;
0019 class TH2F;
0020 class TH1D;
0021 
0022 class PHCompositeNode;
0023 class Jet;
0024 namespace HepMC
0025 {
0026 class GenParticle;
0027 class GenEvent;
0028 }  // namespace HepMC
0029 
0030 class HFFastSim : public SubsysReco
0031 {
0032  public:
0033   HFFastSim(std::string filename, int flavor = 5, int maxevent = INT_MAX);
0034 
0035   int Init(PHCompositeNode *);
0036   int process_event(PHCompositeNode *);
0037   int End(PHCompositeNode *);
0038 
0039   double
0040   get_eta_max() const
0041   {
0042     return _eta_max;
0043   }
0044 
0045   void
0046   set_eta_max(double etaMax)
0047   {
0048     _eta_max = etaMax;
0049   }
0050 
0051   double
0052   get_eta_min() const
0053   {
0054     return _eta_min;
0055   }
0056 
0057   void
0058   set_eta_min(double etaMin)
0059   {
0060     _eta_min = etaMin;
0061   }
0062 
0063   double
0064   get_pt_max() const
0065   {
0066     return _pt_max;
0067   }
0068 
0069   void
0070   set_pt_max(double ptMax)
0071   {
0072     _pt_max = ptMax;
0073   }
0074 
0075   double
0076   get_pt_min() const
0077   {
0078     return _pt_min;
0079   }
0080 
0081   void
0082   set_pt_min(double ptMin)
0083   {
0084     _pt_min = ptMin;
0085   }
0086 
0087   //! action to take if no jet fitting _flavor requirement found. Action defined in <fun4all/Fun4AllReturnCodes.h>
0088   //! Default action is DISCARDEVENT for DST level filtering, one can further choose ABORTEVENT to use it as processing level filtering
0089   void
0090   set_rejection_action(int action)
0091   {
0092     _rejection_action = action;
0093   }
0094 
0095   //! The embedding ID for the HepMC subevent to be analyzed.
0096   //! embedding ID for the event
0097   //! positive ID is the embedded event of interest, e.g. jetty event from pythia
0098   //! negative IDs are backgrounds, .e.g out of time pile up collisions
0099   //! Usually, ID = 0 means the primary Au+Au collision background
0100   int get_embedding_id() const { return _embedding_id; }
0101   //
0102   //! The embedding ID for the HepMC subevent to be analyzed.
0103   //! embedding ID for the event
0104   //! positive ID is the embedded event of interest, e.g. jetty event from pythia
0105   //! negative IDs are backgrounds, .e.g out of time pile up collisions
0106   //! Usually, ID = 0 means the primary Au+Au collision background
0107   void set_embedding_id(int id) { _embedding_id = id; }
0108 
0109   static std::pair<int, TString> quark_trace(const HepMC::GenParticle *p, HepMC::GenEvent *theEvent);
0110 
0111   bool process_D02PiK(HepMC::GenEvent *theEvent);
0112 
0113   class D02PiK : public TObject
0114   {
0115    public:
0116     D02PiK() { Clear(); }
0117 
0118     int pid;
0119     int hadron_origion_qpid;
0120     float y;
0121     float pt;
0122     float prodL;
0123     float decayL;
0124     TString decayChain;
0125 
0126     void Clear(Option_t * /*option*/ = "")
0127     {
0128       pid = 0;
0129       hadron_origion_qpid = 0;
0130       y = NAN;
0131       pt = NAN;
0132       prodL = NAN;
0133       decayL = NAN;
0134       decayChain = "";
0135     }
0136 
0137     ClassDef(HFFastSim::D02PiK, 1)  //Event structure
0138   };
0139 
0140   bool process_Lc2pPiK(HepMC::GenEvent *theEvent);
0141 
0142   class Lc2pPiK : public TObject
0143   {
0144    public:
0145     Lc2pPiK() { Clear(); }
0146 
0147     int pid;
0148     int hadron_origion_qpid;
0149     float y;
0150     float pt;
0151     float prodL;
0152     float decayL;
0153     TString decayChain;
0154 
0155     void Clear(Option_t * /*option*/ = "")
0156     {
0157       pid = 0;
0158       hadron_origion_qpid = 0;
0159       y = NAN;
0160       pt = NAN;
0161       prodL = NAN;
0162       decayL = NAN;
0163       decayChain = "";
0164     }
0165 
0166     ClassDef(HFFastSim::Lc2pPiK, 1)  //Event structure
0167   };
0168 
0169  private:
0170   bool _verbose;
0171 
0172   int _ievent;
0173   int _total_pass;
0174 
0175   TFile *_f;
0176 
0177   TH2D *_h2;
0178   TH2D *_h2all;
0179   TH2D *_h2_b;
0180   TH2D *_h2_c;
0181 
0182   TH1D *m_hNorm;
0183   TH2F *m_DRapidity;
0184 
0185   TTree *m_tSingleD;
0186   D02PiK *m_singleD;
0187 
0188   TTree *m_tSingleLc;
0189   Lc2pPiK *m_singleLc;
0190 
0191   std::string _foutname;
0192 
0193   int _flavor;
0194   int _maxevent;
0195 
0196   double _pt_min;
0197   double _pt_max;
0198 
0199   double _eta_min;
0200   double _eta_max;
0201 
0202   std::string _jet_name;
0203 
0204   //! action to take if no jet fitting _flavor requirement found. Action defined in <fun4all/Fun4AllReturnCodes.h>
0205   int _rejection_action;
0206 
0207   //! The embedding ID for the HepMC subevent to be analyzed.
0208   //! positive ID is the embedded event of interest, e.g. jetty event from pythia
0209   //! negative IDs are backgrounds, .e.g out of time pile up collisions
0210   //! Usually, ID = 0 means the primary Au+Au collision background
0211   int _embedding_id;
0212 };
0213 
0214 #endif  // __HFFastSim_H__