Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
hdview2/MyProcessor.h
Go to the documentation of this file.
1 // Author: David Lawrence June 25, 2004
2 //
3 //
4 // MyProcessor.h
5 //
6 /// Example program for a Hall-D analyzer which uses DANA
7 ///
8 
9 #ifndef _MYPROCESSOR_H_
10 #define _MYPROCESSOR_H_
11 
12 #include <JANA/JEventProcessor.h>
13 #include <JANA/JEventLoop.h>
14 #include <JANA/JEvent.h>
15 
16 #include <GlueX.h>
17 
19 #include <HDGEOMETRY/DRootGeom.h>
20 #include <HDGEOMETRY/DGeometry.h>
21 #include <PID/DNeutralParticle.h>
22 #include <PID/DKinematicData.h>
23 #include <DCoordinateSystem.h>
25 
26 class DQuickFit;
28 class DCDCTrackHit;
29 
30 #include "hdv_mainframe.h"
31 
32 class hdv_fulllistframe;
33 class hdv_debugerframe;
34 
35 #include <TPolyLine.h>
36 #include <TEllipse.h>
37 #include <TVector3.h>
38 #include <TMarker.h>
39 #include <TText.h>
40 #include <TFile.h>
41 #include <TH1.h>
42 #include <TH2F.h>
43 #include <TCanvas.h>
44 #define MAX_HIT_MARKERS 2000
45 #define MAX_LINES 100
46 #define MAX_CIRCLES 100
47 
48 class MyProcessor;
49 extern MyProcessor *gMYPROC;
50 
51 class MyProcessor:public JEventProcessor
52 {
53  public:
54  MyProcessor();
55  ~MyProcessor();
56 
57  jerror_t init(void); ///< Called once at program start.
58  jerror_t brun(JEventLoop *eventLoop, int32_t runnumber); ///< Called everytime a new run number is detected.
59  jerror_t evnt(JEventLoop *eventLoop, uint64_t eventnumber);///< Called every event.
60 
61  //void DrawXY(void);
62  //void DrawRPhi(void);
63 
64  //jerror_t DrawHelicalTrack(DQuickFit *qf, int color);
65  //jerror_t DrawStraightTrack(TVector3 p, TVector3 vertex, int color, int style);
66  //jerror_t DrawTrack(double q, TVector3 pos, TVector3 mom, int color);
67  //jerror_t DrawDetectors(void);
68 
70  uint64_t eventNo;
71 
72  enum poly_type{
73  kMarker =0,
74  kLine =1
75  };
76 
77  class DGraphicSet{
78  public:
79  DGraphicSet(Color_t c, poly_type t, double s):color(c),type(t),size(s),marker_style(8){}
80  vector<TVector3> points;
81  Color_t color;
82  poly_type type; // 0=markers, 1=lines
83  double size;
85  };
86  vector<DGraphicSet> graphics;
87  void FillGraphics(void);
88  void UpdateTrackLabels(void);
89  void UpdateBcalDisp(void);
90 
91  // Additional graphics that may be appropriate for only certain views
92  vector<TObject*> graphics_xyA;
93  vector<TObject*> graphics_xyB;
94  vector<TObject*> graphics_xz;
95  vector<TObject*> graphics_yz;
96  vector<TObject*> graphics_tof_hits;
97 
98  void GetFactoryNames(vector<string> &facnames);
99  void GetFactories(vector<JFactory_base*> &factories);
100  unsigned int GetNrows(const string &factory, string tag);
101  void GetDReferenceTrajectory(string dataname, string tag,
102  unsigned int index, DReferenceTrajectory* &rt, vector<const DCDCTrackHit*> &cdchits);
103  void GetAllWireHits(vector<pair<const DCoordinateSystem*,double> > &allhits);
104  void FormatHistogram(TH2*, int);
105 
106  private:
107 
111  JEventLoop *loop;
112  JEvent last_jevent;
116  double RMAX_INTERIOR; // Used to allow user to extend drawing range of charged tracks
117  double RMAX_EXTERIOR; // Used to allow user to extend drawing range of charged tracks
118 
119  uint32_t BCALVERBOSE;
120  TCanvas *BCALHitCanvas;
124  vector <TText*> BCALPLables;
127  std::vector<TH2F*> BCALClusterZphiHistos;
128  TLegend *LayerLegend;
129  TLegend *ClusterLegend;
130 
131 
132  map<string, double> photon_track_matching;
133  double DELTA_R_FCAL;
134 
135  void AddKinematicDataTrack(const DKinematicData* kd, int color, double size);
137 
138  //DTrackCandidate_factory* factory;
139  //void DrawTrackXY(const DKinematicData *, int color, float size);
140 };
141 
143 
144 #endif // _MYPROCESSOR_H_
hdv_fulllistframe * fulllistmf
std::vector< TH2F * > BCALClusterZphiHistos
hdv_mainframe * hdvmf
void UpdateBcalDisp(void)
jerror_t init(void)
TVector3 DVector3
Definition: DVector3.h:14
vector< TObject * > graphics_tof_hits
#define c
vector< TObject * > graphics_xz
TLegend * LayerLegend
vector< DGraphicSet > graphics
TH2F * BCALPointPhiTLayer[4]
void UpdateTrackLabels(void)
void FillGraphics(void)
DetectorSystem_t
Definition: GlueX.h:15
void AddKinematicDataTrack(const DKinematicData *kd, int color, double size)
static char index(char c)
Definition: base64.cpp:115
jerror_t brun(JEventLoop *eventLoop, int32_t runnumber)
Called once at program start.
MyProcessor * gMYPROC
TCanvas * BCALHitCanvas
void FormatHistogram(TH2 *, int)
void GetDReferenceTrajectory(string dataname, string tag, unsigned int index, DReferenceTrajectory *&rt, vector< const DCDCTrackHit * > &cdchits)
const DMagneticFieldMap * Bfield
map< string, double > photon_track_matching
void GetFactories(vector< JFactory_base * > &factories)
void GetAllWireHits(vector< pair< const DCoordinateSystem *, double > > &allhits)
vector< TObject * > graphics_yz
DRootGeom * RootGeom
DGraphicSet(Color_t c, poly_type t, double s)
void GetIntersectionWithCalorimeter(const DKinematicData *kd, DVector3 &pos, DetectorSystem_t &who)
vector< TText * > BCALPLables
vector< TObject * > graphics_xyB
DGeometry * geom
void GetFactoryNames(vector< string > &facnames)
hdv_debugerframe * debugermf
jerror_t evnt(JEventLoop *eventLoop, uint64_t eventnumber)
Called every event.
vector< TObject * > graphics_xyA
TH2F * BCALPointZphiLayer[4]
JEventLoop * loop
TLegend * ClusterLegend
unsigned int GetNrows(const string &factory, string tag)
&lt;A href=&quot;index.html#legend&quot;&gt; &lt;IMG src=&quot;CORE.png&quot; width=&quot;100&quot;&gt; &lt;/A&gt;