Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:12:30

0001 #ifndef __DISKinematicsReco_H__
0002 #define __DISKinematicsReco_H__
0003 
0004 #include "PidCandidate.h"
0005 #include "TrackProjectorPlaneECAL.h"
0006 /* Fun4All includes */
0007 #include <fun4all/SubsysReco.h>
0008 #include <calobase/RawTowerDefs.h>
0009 
0010 /* STL includes */
0011 #include <math.h>
0012 #include <map>
0013 
0014 /*HepMC include */
0015 #include <phhepmc/PHHepMCGenEvent.h>
0016 #include <phhepmc/PHHepMCGenEventMap.h>
0017 #include <HepMC/GenEvent.h>
0018 class TTree;
0019 class TFile;
0020 
0021 class PHCompositeNode;
0022 class CaloEvalStack;
0023 class CaloRawTowerEval;
0024 class RawCluster;
0025 class RawTowerContainer;
0026 class RawTowerGeomContainer;
0027 //class JetMap;
0028 class SvtxTrack;
0029 class SvtxTrackMap;
0030 class PHHepMCGenEventMap;
0031 
0032 
0033 class PidCandidate;
0034 
0035 typedef std::map<float, PidCandidate*> type_map_tcan;
0036 typedef std::map< RawTowerDefs::CalorimeterId , std::pair< RawTowerContainer*, RawTowerGeomContainer* > > type_map_cdata;
0037 
0038 class DISKinematicsReco : public SubsysReco
0039 {
0040 
0041 public:
0042 
0043   DISKinematicsReco(std::string filename);
0044 
0045   int
0046   Init(PHCompositeNode*);
0047   int
0048   InitRun(PHCompositeNode*);
0049   int
0050   process_event(PHCompositeNode*);
0051   int
0052   End(PHCompositeNode*);
0053 
0054   void
0055   set_beam_energies( float beam_electron , float beam_proton )
0056   {
0057     _beam_electron_ptotal = fabs( beam_electron );
0058     _beam_hadron_ptotal = fabs( beam_proton );
0059   }
0060 
0061   void
0062   set_do_process_geant4_cluster( bool select )
0063   {
0064     _do_process_geant4_cluster = select;
0065   }
0066 
0067   void
0068   set_do_process_truth( bool select )
0069   {
0070     _do_process_truth = select;
0071   }
0072   
0073 
0074 private:
0075 
0076   /* proton rest mass */
0077   const float _mproton;
0078 
0079   bool _verbose;
0080   bool _save_towers;
0081   bool _save_tracks;
0082   bool _do_process_geant4_cluster;
0083   bool _do_process_truth;
0084 
0085   int _ievent;
0086   int _total_pass;
0087 
0088   std::string _filename;
0089   TFile *_tfile;
0090 
0091   /* output tree and variables */
0092   TTree* _tree_event_cluster;
0093 
0094   /* output tree and variables from TRUTH particles */
0095   TTree* _tree_event_truth;
0096 
0097   /* beam energies electron and proton */
0098   float _beam_electron_ptotal;
0099   float _beam_hadron_ptotal;
0100 
0101   /** CaloRawTowerEvaluators to access tru particle info for
0102    * given towers */
0103   std::map< std::string, CaloRawTowerEval* > _map_towereval;
0104   
0105   /* Track Projector object */
0106   TrackProjectorPlaneECAL* _trackproj;
0107   //  /** Map of PidCandidate properties that will be written to
0108   //   * output ROOT Tree */
0109   //  std::map< PidCandidate::PROPERTY , float > _map_treebranches;
0110 
0111   /** Map of EM Candidates that will be written to
0112    * output ROOT Tree */
0113   std::map< PidCandidate::PROPERTY , std::vector< float > > _map_em_candidate_branches;
0114 
0115   /** Map of Event properties that will be written to
0116    * output ROOT Tree */
0117   std::map< std::string , float > _map_event_branches;
0118 
0119   /** helper pointer to topNode */
0120   PHCompositeNode *_topNode;
0121 
0122   int CollectEmCandidatesFromCluster( type_map_tcan& );
0123 
0124   int CollectEmCandidatesFromTruth( type_map_tcan& );
0125 
0126   int InsertCandidateFromCluster( type_map_tcan& , RawCluster* , CaloEvalStack* , SvtxTrackMap*);
0127 
0128   int AddGlobalCalorimeterInformation();
0129 
0130   int AddReconstructedKinematics( type_map_tcan& , std::string );
0131 
0132   int WriteCandidatesToTree( type_map_tcan& );
0133 
0134   int AddTruthEventInformation();
0135 
0136   /** Find tau candidate in map that is closest to given eta, phi angle */
0137   PidCandidate* FindMinDeltaRCandidate( type_map_tcan*, const float, const float );
0138 
0139   /** Calculate Delta R ("distance in eta-phi space") between two sets of eta, phi angles */
0140   float CalculateDeltaR( float, float, float, float );
0141 
0142   /** Reset branch maps for each event */
0143   void ResetBranchMap();
0144 
0145   
0146 };
0147 
0148 #endif // __DISKinematicsReco_H__