Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-04-04 08:11:57

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   dEdxFitter(const std::string &name="dEdxFitter");
0024 
0025   //Initialization, called for initialization
0026   int InitRun(PHCompositeNode *);
0027 
0028   //Process Event, called for each event
0029   int process_event(PHCompositeNode *);
0030 
0031   //End, write and close files
0032   int End(PHCompositeNode *);
0033 
0034   //Change output filename
0035   void set_filename(const char* file)
0036   { if(file) _outfile = file; }
0037 
0038   void set_nmaps_cut(int nmaps)
0039   { nmaps_cut = nmaps; }
0040 
0041   void set_nintt_cut(int nintt)
0042   { nintt_cut = nintt; }
0043 
0044   void set_ntpc_cut(int ntpc)
0045   { ntpc_cut = ntpc; }
0046 
0047   void set_eta_cut(float eta)
0048   { eta_cut = eta; }
0049 
0050   void set_dcaxy_cut(float dcaxy)
0051   { dcaxy_cut = dcaxy; }
0052 
0053   void set_ntracks_to_fit(size_t ntrk)
0054   { ntracks_to_fit = ntrk; }
0055 
0056  private:
0057   //output filename
0058   std::string _outfile = "dedx_outfile.root";
0059   size_t _event;
0060    
0061   SvtxTrackMap* _trackmap = nullptr;
0062   TrkrClusterContainer* _clustermap = nullptr;
0063   ActsGeometry* _geometry = nullptr;
0064   PHG4TpcGeomContainer* _tpcgeom = nullptr;
0065   SvtxVertexMap* _vertexmap = nullptr;
0066   
0067   //Get all the nodes
0068   void GetNodes(PHCompositeNode *);
0069 
0070   void process_tracks(PHCompositeNode *);
0071 
0072   int nmaps_cut = 1;
0073   int nintt_cut = 1;
0074   int ntpc_cut = 30;
0075   float eta_cut = 1.;
0076   float dcaxy_cut = 0.5;
0077 
0078   size_t ntracks_to_fit = 40000;
0079   std::vector<double> minima;
0080   std::unique_ptr<GlobaldEdxFitter> fitter;
0081 
0082   std::tuple<int,int,int> get_nclus(SvtxTrack* track);
0083   double get_dedx(SvtxTrack* track);
0084   double get_dcaxy(SvtxTrack* track);
0085 
0086 };
0087 
0088 #endif //* __DEDXFITTER_H__ *//