Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-04-05 08:12:17

0001 #ifndef DEDXFITTER_H_
0002 #define DEDXFITTER_H_
0003 
0004 #include <fun4all/SubsysReco.h>
0005 #include <string>
0006 #include <trackbase_historic/SvtxTrackMap.h>
0007 #include <trackbase/TrkrClusterContainer.h>
0008 #include <trackbase/ActsGeometry.h>
0009 #include <g4detectors/PHG4TpcGeomContainer.h>
0010 #include <globalvertex/SvtxVertexMap.h>
0011 
0012 #include "GlobaldEdxFitter.h"
0013 
0014 //Forward declerations
0015 class PHCompositeNode;
0016 class TFile;
0017 
0018 // dEdx fit analysis module
0019 class dEdxFitter: public SubsysReco
0020 {
0021  public: 
0022   //Default constructor
0023   explicit dEdxFitter(const std::string &name="dEdxFitter");
0024 
0025   //Initialization, called for initialization
0026   int InitRun(PHCompositeNode * /*topNode*/) override;
0027 
0028   //Process Event, called for each event
0029   int process_event(PHCompositeNode *topNode) override;
0030 
0031   //End, write and close files
0032   int End(PHCompositeNode * /*topNode*/) override;
0033 
0034   //Change output filename
0035   void set_filename(const char* file)
0036   {
0037     if(file)
0038     {
0039       _outfile = file;
0040     }
0041   }
0042 
0043   void set_nmaps_cut(int nmaps)
0044   { nmaps_cut = nmaps; }
0045 
0046   void set_nintt_cut(int nintt)
0047   { nintt_cut = nintt; }
0048 
0049   void set_ntpc_cut(int ntpc)
0050   { ntpc_cut = ntpc; }
0051 
0052   void set_eta_cut(float eta)
0053   { eta_cut = eta; }
0054 
0055   void set_dcaxy_cut(float dcaxy)
0056   { dcaxy_cut = dcaxy; }
0057 
0058   void set_ntracks_to_fit(size_t ntrk)
0059   { ntracks_to_fit = ntrk; }
0060 
0061  private:
0062   //output filename
0063   std::string _outfile = "dedx_outfile.root";
0064   TFile* outf = nullptr;
0065   size_t _event = 0;
0066    
0067   SvtxTrackMap* _trackmap = nullptr;
0068   TrkrClusterContainer* _clustermap = nullptr;
0069   ActsGeometry* _geometry = nullptr;
0070   PHG4TpcGeomContainer* _tpcgeom = nullptr;
0071   SvtxVertexMap* _vertexmap = nullptr;
0072   
0073   //Get all the nodes
0074   void GetNodes(PHCompositeNode * /*topNode*/);
0075 
0076   void process_tracks();
0077 
0078   int nmaps_cut = 1;
0079   int nintt_cut = 1;
0080   int ntpc_cut = 30;
0081   float eta_cut = 1.;
0082   float dcaxy_cut = 0.5;
0083 
0084   size_t ntracks_to_fit = 40000;
0085   std::vector<double> minima;
0086   std::unique_ptr<GlobaldEdxFitter> fitter;
0087 
0088   std::tuple<int,int,int> get_nclus(SvtxTrack* track);
0089   double get_dedx(SvtxTrack* track);
0090   double get_dcaxy(SvtxTrack* track);
0091 
0092 };
0093 
0094 #endif //* DEDXFITTER_H_ *//