Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 /*!
0002  *  \file       PHTruthClustering.h
0003  *  \brief      Clustering using truth info
0004  *  \author     Tony Frawley <afrawley@fsu.edu>
0005  */
0006 
0007 #ifndef TRACKRECO_PHTRUTHCLUSTERING_H
0008 #define TRACKRECO_PHTRUTHCLUSTERING_H
0009 
0010 #include <fun4all/SubsysReco.h>
0011 
0012 // rootcint barfs with this header so we need to hide it
0013 #include <gsl/gsl_rng.h>
0014 
0015 
0016 #include <string>             // for string
0017 #include <vector>
0018 #include <map>
0019 #include <set>
0020 #include <memory>
0021 
0022 #include <TFile.h>
0023 #include <TNtuple.h>
0024 #include "TMVA/Tools.h"
0025 #include "TMVA/Reader.h"
0026 #include <TMVA/MethodCuts.h>
0027 
0028 // forward declarations
0029 class PHCompositeNode;
0030 class SvtxTrackMap;
0031 class SvtxTrack;
0032 class TrackPidAssoc;
0033 class PHG4TruthInfoContainer;
0034 class PHG4Particle;
0035 
0036 class SvtxTrack;
0037 
0038 class ElectronID  : public SubsysReco
0039 {
0040 public:
0041   ElectronID(const std::string &name = "ElectronID", const std::string &filename = "_ElectronID.root");
0042   virtual ~ElectronID();
0043 
0044   int Init(PHCompositeNode *topNode);
0045   int InitRun(PHCompositeNode *topNode);
0046   int process_event(PHCompositeNode *topNode);
0047   int End(PHCompositeNode *topNode);
0048 
0049   /// Set the cemce3x3/p cut limits for electrons; default: 0.7<cemce3x3/p<100.0, means without cuts
0050   void setEMOPcutlimits(float EMOPlowerlimit, float EMOPhigherlimit) { EMOP_lowerlimit = EMOPlowerlimit; EMOP_higherlimit = EMOPhigherlimit; }
0051 
0052   /// Set the hcaline3x3/cemce3x3 cut limit for electrons; default: hcaline3x3/cemce3x3<100.0, means without cut
0053   void setHinOEMcutlimit(float HinOEMhigherlimit) { HinOEM_higherlimit = HinOEMhigherlimit; }
0054 
0055   /// Set the pt cut limit for Upsilon decay electrons; default: 0.0<pt<100.0 GeV, means without cut
0056   void setPtcutlimit(float Ptlowerlimit, float Pthigherlimit) { Pt_lowerlimit = Ptlowerlimit; Pt_higherlimit = Pthigherlimit; }
0057 
0058   /// Set the (hcaline3x3+hcaloute3x3)/p cut lower limit for hadrons; default: 0.0<(hcaline3x3+hcaloute3x3)/p, means without cut
0059   void setHOPcutlimit(float HOPlowerlimit) { HOP_lowerlimit = HOPlowerlimit; }
0060 
0061   /// Set the track cut limits; default: nmvtx>=2, nintt>=0, ntpc>=20; quality<5.
0062   void setTrackcutlimits(int Nmvtxlowerlimit, int Ninttlowerlimit, int Ntpclowerlimit, float Nqualityhigherlimit) { 
0063      Nmvtx_lowerlimit = Nmvtxlowerlimit; 
0064      Nintt_lowerlimit = Ninttlowerlimit; 
0065      Ntpc_lowerlimit = Ntpclowerlimit;
0066      Nquality_higherlimit = Nqualityhigherlimit;
0067   }
0068 
0069   /// set "prob" variable cut
0070   void setPROBcut(float tmp) {PROB_cut = tmp;}
0071 
0072   void set_output_ntuple(bool outputntuple) {output_ntuple = outputntuple;}
0073 
0074   /// set MVA cut
0075   void setBDTcut(int isuseBDT_p, int isuseBDT_n, float bdtcut_p, float bdtcut_n) {ISUSE_BDT_p= isuseBDT_p; ISUSE_BDT_n= isuseBDT_n; BDT_cut_p = bdtcut_p; BDT_cut_n = bdtcut_n;}
0076 
0077 
0078 protected:
0079   bool output_ntuple;
0080 
0081   TFile* OutputNtupleFile;
0082   std::string OutputFileName;
0083   TNtuple* ntpBDTresponse; //write ntuple for BDTresponse
0084   TNtuple* ntpbeforecut; //write ntuple before any cuts
0085   TNtuple* ntpcutEMOP; //write ntuple with only EMOP cut
0086   TNtuple* ntpcutEMOP_HinOEM; //write ntuple with EMOP & HinOEM cuts
0087   TNtuple* ntpcutEMOP_HinOEM_Pt; //write ntuple with EMOP & HinOEM & Pt cuts
0088   TNtuple* ntpcutEMOP_HinOEM_Pt_read; //write ntuple with EMOP & HinOEM & Pt cuts in the situation of reading back the association map.
0089   TNtuple* ntpcutBDT_read; //write ntuple with BDT & Pt cuts in the situation of reading back the association map.
0090 
0091   TNtuple* ntpcutHOP; //write ntuple with only HOP cut
0092 
0093   int EventNumber;
0094 
0095 private:
0096 /// fetch node pointers
0097 int GetNodes(PHCompositeNode *topNode);
0098 
0099 PHG4Particle* findMCmatch(SvtxTrack* track, PHG4TruthInfoContainer* truth_container);
0100 
0101  TrackPidAssoc *_track_pid_assoc;
0102  SvtxTrackMap *_track_map;
0103 
0104 /// A float lower limit for cutting on cemce3x3/p
0105   float EMOP_lowerlimit;
0106 /// A float higher limit for cutting on cemce3x3/p
0107   float EMOP_higherlimit;
0108 
0109 /// "prob" variable cut
0110   float PROB_cut;
0111 
0112 /// A float higher limit for cutting on hcaline3x3/cemce3x3
0113   float HinOEM_higherlimit;
0114 
0115 /// A float lower limit for cutting on pt
0116   float Pt_lowerlimit;
0117 /// A float higher limit for cutting on pt
0118   float Pt_higherlimit;
0119 
0120 /// A float lower limit for cutting on (hcaline3x3+hcaloute3x3)/p
0121   float HOP_lowerlimit;
0122 
0123 /// A float lower limit for cutting on nmvtx
0124   int Nmvtx_lowerlimit;
0125 
0126 /// A float lower limit for cutting on nintt
0127   int Nintt_lowerlimit;
0128 
0129 /// A float lower limit for cutting on ntpc
0130   int Ntpc_lowerlimit;
0131 
0132 /// A float higher limit for cutting on quality
0133   float Nquality_higherlimit;
0134 
0135 /// MVA cut 
0136   float BDT_cut_p, BDT_cut_n;
0137   int ISUSE_BDT_p, ISUSE_BDT_n;//0 for no; 1 for yes
0138 
0139   unsigned int _nlayers_maps = 3;
0140   unsigned int _nlayers_intt = 4;
0141   unsigned int _nlayers_tpc = 48;
0142 
0143 
0144 };
0145 
0146 #endif