00001 #ifndef VIS_CU_TK_Map_2D_H
00002 #define VIS_CU_TK_Map_2D_H
00003
00004 # include <qwidget.h>
00005 # include <cmath>
00006 # include "DataFormats/SiStripDigi/interface/SiStripDigi.h"
00007 # include "DataFormats/SiStripCluster/interface/SiStripCluster.h"
00008 # include "DataFormats/GeometryVector/interface/LocalPoint.h"
00009 # include "SimDataFormats/TrackingHit/interface/PSimHit.h"
00010 # include <vector>
00011
00012 namespace edm
00013 {
00014 class Event;
00015 class EventSetup;
00016 }
00017
00018 class SiStripDigi;
00019 class SiStripCluster;
00020
00021 class VisCuCmsTracker;
00022
00023 class QPainter;
00024 class QPrinter;
00025 class VisCuTkModule;
00026 class VisCuTrackerSimHit;
00027 class VisCuTrackerDigi;
00028 class VisCuTrackerCluster;
00029 class VisCuTrackerRecHit;
00030 class VisCuTkMapWindow;
00031 class QImage;
00032
00033 class VisCuTkMap2D: public QWidget
00034 {
00035 Q_OBJECT
00036
00037 public:
00038 VisCuTkMap2D(QWidget *parent=0, const char *name=0,VisCuTrackerSimHit *simhitdr=0, VisCuTrackerDigi *digidr=0, VisCuTrackerCluster *clusterdr=0, VisCuTrackerRecHit *rechitdr=0);
00039
00040 void update();
00041 void separateModules();
00042 void drawAllTracker();
00043 void drawSimHits();
00044 void drawDigi();
00045 void drawCluster();
00046 void drawRechit();
00047 void setTracker(VisCuCmsTracker * tr){tracker=tr;};
00048 void setEvent(const edm::Event& iEvent,const edm::EventSetup &eventSetup);
00049 void integratedSignal(bool acc1);
00050 void pan(QPoint pos , int dx, int dy);
00051 void setParent(VisCuTkMapWindow * pw);
00052
00053 static double phival(double x, double y){
00054 double phi;
00055 double phi1=atan(y/x);
00056 phi = phi1;
00057 if(y<0. && x>0) phi = phi1+2.*M_PI;
00058 if(x<0.)phi=phi1+M_PI;
00059 if(fabs(y)<0.000001 && x>0)phi=0;
00060 if(fabs(y)<0.000001&&x<0)phi=M_PI;
00061 if(fabs(x)<0.000001&&y>0)phi=M_PI/2.;
00062 if(fabs(x)<0.000001&&y<0)phi=3.*M_PI/2.;
00063 return phi;
00064 }
00065 int xpixel(double x);
00066 int ypixel(double y);
00067 int getLayer(int x, int y);
00068 bool separated;
00069 bool acc;
00070 QImage* image;
00071 QPixmap* pm;
00072 int ximg,yimg, x_win;
00073 VisCuTkMapWindow *gp;
00074
00075 public slots:
00076
00077 void print();
00078 void save();
00079 void zoomIn();
00080 void zoomOut();
00081
00082 protected:
00083 void paintEvent(QPaintEvent* );
00084
00085 private:
00086
00087 std::vector<SiStripDigi> sdigi;
00088 std::vector<SiStripCluster> cdigi;
00089 std::vector<LocalPoint> rdigi;
00090
00091 QSizePolicy sizePolicy() const;
00092 QPrinter *printer;
00093 VisCuCmsTracker * tracker;
00094 VisCuTrackerSimHit * simhitdraw;
00095 VisCuTrackerDigi * digidraw;
00096 VisCuTrackerCluster * clusterdraw;
00097 VisCuTrackerRecHit * rechitdraw;
00098
00099 double xmin,xmax,ymin,ymax,zoom;
00100 int deltax,deltay;
00101 int xsize,ysize,ix,iy;
00102 void defwindow(int nlay);
00103 void drawmodule(VisCuTkModule * mod,int nlay,QPainter *p);
00104 void computemodule(VisCuTkModule * mod,int nlay,QPointArray &a);
00105 void drawrechit(VisCuTkModule * mod,int nlay,QPainter *p);
00106 void drawpalette(QPainter *p);
00107 void reset_val();
00108 void switch_val();
00109
00110 bool drawall, horizontal_view;
00111 bool drawsimhits,drawdigis,drawclusters,drawrechits;
00112 bool printing;
00113 bool firsteventloaded;
00114 bool zoom_in_out;
00115 bool startintegrate,stopintegrate;
00116 int nlay;
00117 std::vector<PSimHit> theTrackerHits;
00118 int nev,nevToIntegrate;
00119
00120 };
00121 #endif