Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 /*!
0002  *  \file       BDiJetModule.h
0003  *  \brief      Gether information from Truth Jet and Tracks, DST -> NTuple
0004  *  \details    Gether information from Truth Jet and Tracks, DST -> NTuple
0005  *  \author     Dennis V. Perepelitsa
0006  */
0007 
0008 #ifndef __BDiJetModule_H__
0009 #define __BDiJetModule_H__
0010 
0011 // --- need to check all these includes...
0012 #include <fun4all/SubsysReco.h>
0013 // #include <GenFit/GFRaveVertex.h>
0014 // #include <GenFit/Track.h>
0015 #include <string>
0016 #include <vector>
0017 
0018 #include "TMath.h"
0019 
0020 
0021 namespace PHGenFit {
0022   class Track;
0023 } /* namespace PHGenFit */
0024 
0025 namespace genfit {
0026   class GFRaveVertexFactory;
0027   class Track;
0028   class GFRaveVertex;
0029 } /* namespace genfit */
0030 
0031 namespace PHGenFit {
0032   class Fitter;
0033 } /* namespace PHGenFit */
0034 
0035 class SvtxTrack;
0036 class SvtxTrackMap;
0037 class SvtxVertexMap;
0038 class SvtxVertex;
0039 class PHCompositeNode;
0040 class PHG4TruthInfoContainer;
0041 class SvtxClusterMap;
0042 class SvtxEvalStack;
0043 class JetMap;
0044 
0045 class TFile;
0046 class TTree;
0047 
0048 class BDiJetModule: public SubsysReco {
0049 
0050 public:
0051 
0052     BDiJetModule(const std::string &name = "BDiJetModule",
0053                const std::string &ofName = "out.root");
0054 
0055   int Init(PHCompositeNode*);
0056     int InitRun(PHCompositeNode*);
0057     int process_event(PHCompositeNode*);
0058     int End(PHCompositeNode*);
0059 
0060 private:
0061 
0062   //-- Functions
0063   void ResetVariables();             //! Reset TTree variables
0064   int GetNodes(PHCompositeNode *);   //! Get all nodes
0065   void InitTree();                   //! Initialize the TTree
0066 
0067   PHGenFit::Track* MakeGenFitTrack(PHCompositeNode *, 
0068                                    const SvtxTrack* intrack, 
0069                                    const SvtxVertex* vertex);
0070 
0071   //! Fill SvtxVertexMap from GFRaveVertexes and Tracks
0072   void FillVertexMap(
0073       const std::vector<genfit::GFRaveVertex*> & rave_vertices,
0074       const std::vector<genfit::Track*> & gf_tracks);
0075 
0076   int GetSVMass_mom(
0077       const genfit::GFRaveVertex* rave_vtx,
0078       float & vtx_mass,
0079       float & vtx_px,
0080       float & vtx_py,
0081       float & vtx_pz);
0082 
0083 
0084   //-- Nodes
0085   JetMap* _jetmap_truth;             //! Truth jet information  
0086   SvtxClusterMap* _clustermap;
0087   SvtxTrackMap* _trackmap;
0088   SvtxVertexMap* _vertexmap;
0089 
0090   //-- Flags
0091   // TODO: Make setters & getters
0092   bool _verbose;                     //! Verbose printing
0093   bool _write_tree;
0094   bool _ana_truth;                   //! Analyze truth info
0095   bool _ana_reco;                    //! Analyze reconstructed info
0096   bool _do_evt_display;              //! Event display for GenFit
0097   bool _use_ladder_geom;
0098   bool _cut_jet;
0099   bool _cut_Ncluster;
0100 
0101   //-- Output
0102   std::string _foutname;    
0103   TFile *_f;
0104     TTree *_tree;
0105 
0106   //-- Tree Variables
0107     int _b_event;                      //! Event counter
0108 
0109     int _truthjet_n;                   //! Number of truth jets
0110     int _truthjet_parton_flavor[10];   //! Truth jet parton flavor
0111     int _truthjet_hadron_flavor[10];   //! Truth jet hadron flavor
0112     float _truthjet_pt[10];            //! Truth jet pT
0113     float _truthjet_eta[10];           //! Truth jet eta
0114     float _truthjet_phi[10];           //! Truth jet phi
0115 
0116   float gf_prim_vtx[3];
0117   float gf_prim_vtx_err[3];
0118   int gf_prim_vtx_ntrk;
0119   float rv_prim_vtx[3];
0120   float rv_prim_vtx_err[3];
0121   int rv_prim_vtx_ntrk;
0122 
0123   int rv_sv_njets;
0124   int rv_sv_jet_id[10];
0125   int rv_sv_jet_prop[10][2];
0126   float rv_sv_jet_pT[10];
0127   float rv_sv_jet_phi[10];
0128 
0129   int rv_sv_pT00_nvtx[10];
0130   float rv_sv_pT00_vtx_x[10][30];
0131   float rv_sv_pT00_vtx_y[10][30];
0132   float rv_sv_pT00_vtx_z[10][30];
0133   float rv_sv_pT00_vtx_ex[10][30];
0134   float rv_sv_pT00_vtx_ey[10][30];
0135   float rv_sv_pT00_vtx_ez[10][30];
0136   int rv_sv_pT00_vtx_ntrk[10][30];
0137   int rv_sv_pT00_vtx_ntrk_good[10][30];
0138   float rv_sv_pT00_vtx_mass[10][30];
0139   float rv_sv_pT00_vtx_mass_corr[10][30];
0140   float rv_sv_pT00_vtx_pT[10][30];
0141 
0142 
0143   //-- internal variables
0144   int _ievent;
0145 
0146   int _primary_pid_guess;            //! Particle ID guess for GenFit
0147 
0148   double _cut_min_pT;                //! Cut on min track pT
0149   double _cut_chi2_ndf;              //! Cut on max track chi2
0150   double _cut_jet_pT;                //! Cut on min jet pT
0151   double _cut_jet_eta;               //! Cut on jet eta
0152   double _cut_jet_R;                 //! Cut on jet R
0153 
0154   std::string _track_fitting_alg_name;
0155   PHGenFit::Fitter* _fitter;
0156 
0157   //! https://rave.hepforge.org/trac/wiki/RaveMethods
0158   std::string _vertexing_method;
0159   genfit::GFRaveVertexFactory* _vertex_finder;
0160 
0161 };
0162 
0163 #endif // __BDiJetModule_H__