Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:15:41

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 /*!
0004  *  \file               TrackToCalo.h
0005  *  \brief              Track To Calo matching, for TPC drift velocity calibration
0006  *  \author Xudong Yu <xyu3@bnl.gov>
0007  */
0008 
0009 #ifndef TRACKTOCALO_H
0010 #define TRACKTOCALO_H
0011 
0012 #include <fun4all/SubsysReco.h>
0013 
0014 #include <trackbase_historic/SvtxTrackMap.h>
0015 #include <calobase/RawClusterContainer.h>
0016 #include <trackbase/TrkrHitSetContainer.h>
0017 #include <trackbase/TrkrClusterContainer.h>
0018 #include <calobase/RawTowerGeomContainer.h>
0019 
0020 #include <string>
0021 #include <vector>
0022 
0023 class PHCompositeNode;
0024 class TH1;
0025 class TH2;
0026 class TFile;
0027 class TTree;
0028 
0029 class TrackToCalo : public SubsysReco
0030 {
0031  public:
0032 
0033   TrackToCalo(const std::string &name = "TrackToCalo", const std::string &file = "output.root");
0034 
0035   ~TrackToCalo() override;
0036 
0037   /** Called during initialization.
0038       Typically this is where you can book histograms, and e.g.
0039       register them to Fun4AllServer (so they can be output to file
0040       using Fun4AllServer::dumpHistos() method).
0041    */
0042   int Init(PHCompositeNode *topNode) override;
0043 
0044   /** Called for each event.
0045       This is where you do the real work.
0046    */
0047   int process_event(PHCompositeNode *topNode) override;
0048 
0049   /// Called at the end of all processing.
0050   int End(PHCompositeNode *topNode) override;
0051 
0052   void ResetTreeVectors();
0053 
0054   float PiRange(float deltaPhi);
0055 
0056   void EMcalRadiusUser(bool use) {m_use_emcal_radius = use;}
0057   void setEMcalRadius(float r) {m_emcal_radius_user = r;}
0058 
0059   void setRawClusContEMName(const std::string& name) {m_RawClusCont_EM_name = name;}
0060 
0061   void setTrackPtLowCut(float pt) {m_track_pt_low_cut = pt;}
0062   void setEmcalELowCut(float e) {m_emcal_e_low_cut = e;}
0063   void setnTpcClusters(int n) {m_ntpc_low_cut = n;}
0064 
0065  private:
0066    std::string _outfilename;
0067    TFile *_outfile = nullptr;
0068    TTree *_tree = nullptr;
0069 
0070    std::vector<float> _track_phi_emc;
0071    std::vector<float> _track_z_emc;
0072    std::vector<float> _emcal_phi;
0073    std::vector<float> _emcal_z;
0074 
0075    float m_dphi = 0.0;
0076    float m_dz = 0.0;
0077    float m_calo_z = 0.0;
0078    float m_calo_phi = 0.0;
0079    float m_track_z = 0.0;
0080    float m_track_phi = 0.0;
0081 
0082    std::string m_RawClusCont_EM_name = "TOPOCLUSTER_EMCAL";
0083 
0084    SvtxTrackMap *svtxTrackMap = nullptr;
0085    RawClusterContainer *rawClusterContainer = nullptr;
0086    TrkrClusterContainer *trkrClusterContainer = nullptr;
0087    RawTowerGeomContainer *rawTowerGeomContainer = nullptr;
0088    SvtxTrackState *thisState = nullptr;
0089    SvtxTrack *track = nullptr;
0090    TrackSeed *tpc_seed = nullptr;
0091    TrkrCluster *trkrCluster = nullptr;
0092    RawCluster *cluster = nullptr;
0093 
0094    int cnt = 0;
0095    bool m_use_emcal_radius = false;
0096    float m_emcal_radius_user = 93.5;
0097    float radius_scale = 1;
0098    float m_track_pt_low_cut = 0.5;
0099    float m_emcal_e_low_cut = 0.2;
0100    int m_ntpc_low_cut = 22;
0101 };
0102 
0103 #endif // TRACKTOCALO_H