Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-04-06 08:09:42

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef HERWIGPRODUCTIONQAMODULE_H
0004 #define HERWIGPRODUCTIONQAMODULE_H
0005 
0006 #pragma GCC diagnostic push
0007 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
0008 
0009 #include <fun4all/SubsysReco.h>
0010 #include <phool/getClass.h>
0011 #include <phool/PHCompositeNode.h>
0012 #include <phool/PHObject.h>
0013 
0014 #include <phhepmc/PHHepMCGenEvent.h>
0015 #include <phhepmc/PHHepMCGenEventMap.h>
0016 #include <HepMC/GenEvent.h>
0017 #include <HepMC/GenParticle.h>
0018 
0019 #include <fastjet/JetDefinition.hh>
0020 #include <fastjet/PseudoJet.hh>
0021 #include <fastjet/ClusterSequence.hh>
0022 
0023 #include <jetbase/Jetv1.h>
0024 #include <jetbase/JetContainerv1.h>
0025 
0026 #include <string>
0027 #include <math.h>
0028 #include <array>
0029 #include <vector>
0030 #include <format> 
0031 
0032 #include <TH1.h>
0033 #include <TH2.h>
0034 #include <TFile.h>
0035 #include <TDirectory.h>
0036 
0037 class PHCompositeNode;
0038 
0039 class HerwigProductionQAModule : public SubsysReco
0040 {
0041  public:
0042 
0043      HerwigProductionQAModule(const std::string data_type_label="Herwig none", const std::string outfile="none", float trigger=0., int verb=0, const std::string &name = "HerwigProductionQAModule");
0044 
0045      ~HerwigProductionQAModule() override;
0046 
0047       /** Called during initialization.
0048          Typically this is where you can book histograms, and e.g.
0049          register them to Fun4AllServer (so they can be output to file
0050          using Fun4AllServer::dumpHistos() method).
0051       */
0052      int Init(PHCompositeNode *topNode) override;
0053 
0054       /** Called for first event when run number is known.
0055          Typically this is where you may want to fetch data from
0056          database, because you know the run number. A place
0057          to book histograms which have to know the run number.
0058       */
0059      int InitRun(PHCompositeNode *topNode) override;
0060 
0061      /** Called for each event.
0062          This is where you do the real work.
0063       */
0064      int process_event(PHCompositeNode *topNode) override;
0065 
0066      /// Clean up internals after each event.
0067      int ResetEvent(PHCompositeNode *topNode) override;
0068 
0069      /// Called at the end of each run.
0070      int EndRun(const int runnumber) override;
0071 
0072      /// Called at the end of all processing.
0073      int End(PHCompositeNode *topNode) override;
0074 
0075      /// Reset
0076      int Reset(PHCompositeNode * /*topNode*/) override;
0077 
0078     void Print(const std::string &what = "ALL") const override;
0079     
0080     //prepare herwig to hepMC data for the analysis 
0081     int process_herwig_event(PHCompositeNode * );
0082     //prepare pythia DST data for analysis
0083     int process_pythia_event(PHCompositeNode * );
0084     //run fastJet for herwig with r=0.2-0.6
0085     void findJets(std::vector<HepMC::GenParticle*>, std::vector<std::vector<Jet*>*>*);
0086     //returns lead jet set
0087     std::vector<std::array<float, 4>> runAnalysisJets(std::vector<std::vector<Jet*>*>);
0088     //technically can just do photons
0089     int runAnalysisPhotonJets(std::vector<std::vector<Jet*>*>, std::vector<HepMC::GenParticle*>);
0090     //bulk properties
0091     int runAnalysisEvent(std::vector<HepMC::GenParticle*>);
0092 
0093  private:
0094     bool jet = false;
0095     bool photon = false;
0096     bool herwig = false;
0097     bool pythia = false;
0098     bool no_gen = false;
0099     std::string output_file="";
0100     int verbosity = 0;
0101     float trigger_val = 0.;
0102     int n_evt = 0;
0103     
0104     //jet specific QA plots
0105     std::vector<TH1F*> h_all_jets_pt {};
0106     std::vector<TH1F*> h_all_jets_eta {};
0107     std::vector<TH1F*> h_all_jets_phi {};
0108     std::vector<TH1F*> h_all_jets_e {};
0109     std::vector<TH1I*> h_all_jets_n_comp {};
0110     std::vector<TH1I*> h_n_jets {};
0111 
0112     std::vector<TH1F*> h_lead_jets_pt {};
0113     std::vector<TH1F*> h_lead_jets_eta {};
0114     std::vector<TH1F*> h_lead_jets_phi {};
0115     std::vector<TH1F*> h_lead_jets_e {};
0116     std::vector<TH1I*> h_lead_jets_n_comp {};
0117 
0118     //photon specific QA plots 
0119     TH1F* h_all_photons_pt; 
0120     TH1F* h_all_photons_eta;    
0121     TH1F* h_all_photons_phi;    
0122     TH1F* h_all_photons_e;
0123 
0124     TH1F* h_lead_photons_pt;    
0125     TH1F* h_lead_photons_eta;   
0126     TH1F* h_lead_photons_phi;   
0127     TH1F* h_lead_photons_e;
0128         
0129     TH1F* h_direct_photons_pt;  
0130     TH1F* h_direct_photons_eta; 
0131     TH1F* h_direct_photons_phi; 
0132     TH1F* h_direct_photons_e;
0133 
0134     TH1F* h_frag_photons_pt;    
0135     TH1F* h_frag_photons_eta;   
0136     TH1F* h_frag_photons_phi;   
0137     TH1F* h_frag_photons_e;
0138 
0139     TH1I* h_n_photons;
0140     TH1I* h_n_frag;
0141     TH1I* h_n_direct;
0142     
0143     //Photon-Jet comparisons
0144     std::vector<TH2F*> h_photon_jet_pt {};
0145     std::vector<TH2F*> h_photon_jet_eta {};
0146     std::vector<TH2F*> h_photon_jet_phi {};
0147     std::vector<TH2F*> h_photon_jet_e {};
0148     std::vector<TH1F*> h_photon_jet_dphi {};
0149 
0150     //Event categorization in final states
0151     TH1F* h_particle_eta;
0152     TH1F* h_particle_phi;
0153     TH1F* h_particle_e;
0154     TH1F* h_particle_pt;
0155     TH1F* h_particle_et;
0156 
0157     TH2F* h_particle_et_eta;
0158     TH2F* h_particle_et_phi;
0159     TH2F* h_particle_pt_eta;
0160     TH2F* h_particle_pt_phi;
0161     TH2F* h_particle_e_phi;
0162     TH2F* h_particle_e_eta;
0163     TH2F* h_particle_phi_eta;
0164 
0165     TH2F* h_electron_phi_eta;
0166     TH1F* h_electron_pt;
0167         
0168     TH2F* h_proton_phi_eta;
0169     TH1F* h_proton_pt;
0170 
0171     TH2F* h_neutron_phi_eta;
0172     TH1F* h_neutron_pt;
0173 
0174     TH2F* h_pion_phi_eta;
0175     TH1F* h_pion_pt;
0176     
0177     TH2F* h_photon_phi_eta;
0178     TH1F* h_photon_pt;
0179 
0180     TH1I* h_particle_n;
0181     TH1I* h_electron_n;
0182     TH1I* h_proton_n;
0183     TH1I* h_neutron_n;
0184     TH1I* h_pion_n;
0185     TH1I* h_photon_n;
0186     TH1F* h_total_E;
0187 
0188 
0189 };
0190 
0191 #endif // HERWIGPRODUCTIONQAMODULE_H