Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-08-31 08:21:41

0001 #ifndef TPC_ASSEMBLEDTRACKDISPLAY_H
0002 #define TPC_ASSEMBLEDTRACKDISPLAY_H
0003 
0004 #include <fun4all/SubsysReco.h>
0005 #include <trackbase/TrkrDefs.h>
0006 
0007 #include <string>
0008 
0009 class PHCompositeNode;
0010 class TFile;
0011 class Tpc_AssembledTrackContainer;
0012 class TrkrHitSetContainer;
0013 class IdealPadMap;
0014 
0015 class Tpc_AssembledTrackDisplay : public SubsysReco
0016 {
0017  public:
0018   Tpc_AssembledTrackDisplay(const std::string& name = "Tpc_AssembledTrackDisplay",
0019                             const std::string& outfilename = "tpc_assembledtrack_display.root",
0020                             const std::string& trackNodeName = "TPC_ASSEMBLEDTRACKS",
0021                             unsigned int maxEventDisplays = 5);
0022   ~Tpc_AssembledTrackDisplay() override;
0023 
0024   int Init(PHCompositeNode* topNode) override;
0025   int process_event(PHCompositeNode* topNode) override;
0026   int End(PHCompositeNode* topNode) override;
0027 
0028   struct HitPoint
0029   {
0030     HitPoint();
0031 
0032     bool ok;
0033     TrkrDefs::hitsetkey hitsetkey;
0034     TrkrDefs::hitkey hitkey;
0035 
0036     unsigned int layer;
0037     unsigned int region;
0038     unsigned int sector;
0039     int side;
0040 
0041     unsigned int pad;
0042     unsigned int tbin;
0043     unsigned short adc;
0044 
0045     double global_phi;
0046     double radius;
0047   };
0048 
0049   // Display-only fit mode. Use Tpc_FittingTools::FIT_SAGITTA for field-on curvature
0050   // or Tpc_FittingTools::FIT_LINEAR for straight-line fits. Default is sagitta.
0051   void setFitMode(int mode) { m_fitMode = mode; }
0052   void setFitWithSagitta(bool v) { m_fitMode = v ? 1 : 0; }
0053 
0054   void setFitWeightPower(double v) { m_fitWeightPower = v; }
0055   void setFitWeightFloorFrac(double v) { m_fitWeightFloorFrac = v; }
0056   void setFitWeights(double power, double floor_frac)
0057   {
0058     m_fitWeightPower = power;
0059     m_fitWeightFloorFrac = floor_frac;
0060   }
0061 
0062   // Plot filters. Defaults accept all tracks.
0063   // nmodules is Tpc_AssembledTrack::get_nsegments(), i.e. the number of connected
0064   // Tpc_ModuleTrack pieces/modules in the assembled-track candidate.
0065   void setPlotNModulesRange(unsigned int min_modules, unsigned int max_modules)
0066   {
0067     m_plotMinModules = min_modules;
0068     m_plotMaxModules = max_modules;
0069   }
0070   void setPlotModuleRange(unsigned int min_modules, unsigned int max_modules)
0071   {
0072     setPlotNModulesRange(min_modules, max_modules);
0073   }
0074   void setPlotDirectionRange(double min_direction, double max_direction)
0075   {
0076     m_plotMinDirection = min_direction;
0077     m_plotMaxDirection = max_direction;
0078   }
0079   void setPlotThetaRange(double min_theta, double max_theta)
0080   {
0081     m_plotMinTheta = min_theta;
0082     m_plotMaxTheta = max_theta;
0083   }
0084   void setPlotCurvatureRange(double min_curvature, double max_curvature)
0085   {
0086     m_plotMinCurvature = min_curvature;
0087     m_plotMaxCurvature = max_curvature;
0088   }
0089   void setPlotAllTracks()
0090   {
0091     m_plotMinModules = 0;
0092     m_plotMaxModules = 999999;
0093     m_plotMinDirection = -1.0e30;
0094     m_plotMaxDirection = 1.0e30;
0095     m_plotMinTheta = -1.0e30;
0096     m_plotMaxTheta = 1.0e30;
0097     m_plotMinCurvature = -1.0e30;
0098     m_plotMaxCurvature = 1.0e30;
0099   }
0100 
0101  private:
0102   bool get_nodes(PHCompositeNode* topNode);
0103   HitPoint make_hit_point(TrkrDefs::hitsetkey hsk,
0104                           TrkrDefs::hitkey hk) const;
0105 
0106   std::string m_outfilename;
0107   std::string m_trackNodeName;
0108   unsigned int m_maxEventDisplays;
0109   unsigned int m_evt;
0110   unsigned int m_eventsSaved;
0111 
0112   TFile* m_outfile;
0113   Tpc_AssembledTrackContainer* m_tracks;
0114   TrkrHitSetContainer* m_hits;
0115   IdealPadMap* m_idealPadMap;
0116   int m_fitMode;
0117   double m_fitWeightPower;
0118   double m_fitWeightFloorFrac;
0119   unsigned int m_plotMinModules;
0120   unsigned int m_plotMaxModules;
0121   double m_plotMinDirection;
0122   double m_plotMaxDirection;
0123   double m_plotMinTheta;
0124   double m_plotMaxTheta;
0125   double m_plotMinCurvature;
0126   double m_plotMaxCurvature;
0127 };
0128 
0129 #endif