#include <VisReco/VisCustomTracker/interface/VisCuTkLayerSelection.h>
Public Member Functions | |
void | update () |
VisCuTkLayerSelection (QWidget *parent=0, const char *name=0, VisCuTkState *state=0) | |
Public Attributes | |
VisCuTkLayerSlWindow * | gp |
Protected Member Functions | |
void | closeEvent (QCloseEvent *) |
void | mousePressEvent (QMouseEvent *e) |
void | paintEvent (QPaintEvent *) |
Private Member Functions | |
void | defwindow (int nlay) |
void | drawmodule (VisCuTkModule *mod, int nlay, QPointArray &q) |
void | drawModules () |
QSizePolicy | sizePolicy () const |
int | xpixel (double x) |
int | ypixel (double y) |
Private Attributes | |
bool | horizontal_view |
VisCuTkLayer * | lay |
int | nelem |
int | nlay |
bool | posrel |
QPointArray | rg [2000] |
VisCuTkState * | state [2000] |
int | x_win |
double | xmax |
double | xmin |
double | ymax |
double | ymin |
Definition at line 18 of file VisCuTkLayerSelection.h.
VisCuTkLayerSelection::VisCuTkLayerSelection | ( | QWidget * | parent = 0 , |
|
const char * | name = 0 , |
|||
VisCuTkState * | state = 0 | |||
) |
Definition at line 19 of file VisCuTkLayerSelection.cc.
References GenMuonPlsPt100GeV_cfg::cout, drawModules(), lat::endl(), VisCuTkPartDetector::getId(), VisCuTkSubDetector::getId(), VisCuTkLayer::getId(), VisCuTkPartDetector::getOwner(), VisCuTkLayer::getOwner(), gp, horizontal_view, lay, nlay, VisCuTracker::nlayer(), posrel, x_win, xmax, xmin, ymax, and ymin.
00020 : QWidget( parent, name) 00021 { 00022 setPalette( QPalette( QColor( 250, 250, 250) ) ); 00023 xmin = -2.0; xmax = 2.0; ymin = -2.0; ymax =2.0; x_win = 380; 00024 gp = dynamic_cast<VisCuTkLayerSlWindow *>(parent); 00025 lay = dynamic_cast<VisCuTkLayer*>(layer); 00026 posrel = true; 00027 horizontal_view = true; 00028 int part = lay->getOwner()->getId(); 00029 int det = lay->getOwner()->getOwner()->getId(); 00030 if(lay==0) cout <<"error lay " <<endl; 00031 else { 00032 nlay =VisCuTracker::nlayer(det,part,lay->getId()); 00033 drawModules(); 00034 } 00035 }
void VisCuTkLayerSelection::closeEvent | ( | QCloseEvent * | ce | ) | [protected] |
Definition at line 218 of file VisCuTkLayerSelection.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), lay, and VisCuTkLayer::setSlWindow().
00219 { 00220 lay->setSlWindow(0); 00221 cout << "window closed"<< endl; 00222 ce->accept(); 00223 return; 00224 }
Definition at line 189 of file VisCuTkLayerSelection.cc.
References posrel, xmax, xmin, ymax, and ymin.
Referenced by drawModules().
00189 { 00190 if(posrel){ //separated modules 00191 xmin=-2.;ymin=-2.;xmax=2.;ymax=2.; 00192 if(nlay >12 && nlay < 19){//endcap pixel 00193 xmin=-.40;xmax=.40;ymin=-.40;ymax=.40; 00194 } 00195 if(nlay>30){//barrel 00196 xmin=-0.1;xmax=3.0;ymin=-0.1;ymax=8.5; 00197 if(nlay<34){xmin=-0.3;xmax=1.0;ymax=9.5;}//pixel 00198 if(nlay>33&&nlay<38){xmax=2.0;}//inner 00199 if(nlay>37){ymax=8.0;}//outer 00200 } 00201 }else{ //overlayed modules 00202 xmin=-1.3;ymin=-1.3;xmax=1.3;ymax=1.3; 00203 if(nlay >12 && nlay < 19){ 00204 xmin=-.20;xmax=.20;ymin=-.20;ymax=.20; 00205 } 00206 if(nlay>30){ 00207 xmin=-1.5;xmax=1.5;ymin=-1.;ymax=28.; 00208 if(nlay<32){xmin=-0.5;xmax=0.5;} 00209 if(nlay>33&&nlay<38){xmin=-1.;xmax=1.;} 00210 } 00211 } 00212 }
void VisCuTkLayerSelection::drawmodule | ( | VisCuTkModule * | mod, | |
int | nlay, | |||
QPointArray & | q | |||
) | [private] |
Definition at line 91 of file VisCuTkLayerSelection.cc.
References funct::cos(), VisCuTkSubLayer::getId(), VisCuTkModule::getId(), VisCuTkModule::getOwner(), horizontal_view, VisCuTkSubLayer::isStereo(), j, VisCuTkModule::length, phi, VisCuTkMap2D::phival(), posrel, VisCuTkModule::posx, VisCuTkModule::posy, VisCuTkModule::posz, r, funct::sin(), sl, funct::sqrt(), VisCuTkModule::width, VisCuTkModule::widthAtHalfLength, x, x_win, xpixel(), y, and ypixel().
Referenced by drawModules().
00092 { 00093 int x,y; 00094 double phi,r,dx,dy,dy1; 00095 double xp[4],yp[4],xp1,yp1; 00096 double vhbot,vhtop,vhapo; 00097 double rmedio[]={0.041,0.0701,0.0988,0.255,0.340,0.430,0.520,0.610,0.696,0.782,0.868,0.965,1.080}; 00098 double xt1,yt1,xs1=0.,ys1=0.,xt2,yt2,xs2,ys2; 00099 00100 phi = VisCuTkMap2D::phival(mod->posx,mod->posy); 00101 r = sqrt(mod->posx*mod->posx+mod->posy*mod->posy); 00102 vhbot = mod->width; 00103 vhtop=mod->width; 00104 vhapo=mod->length; 00105 00106 if(nlay < 31){ //endcap 00107 vhbot = mod->widthAtHalfLength/2.-(mod->width/2.-mod->widthAtHalfLength/2.); 00108 vhtop=mod->width/2.; 00109 vhapo=mod->length/2.; 00110 if(nlay >12 && nlay <19){//pix endcap 00111 if(posrel)r = r+r; 00112 xp[0]=r-vhtop;yp[0]=-vhapo; 00113 xp[1]=r+vhtop;yp[1]=-vhapo; 00114 xp[2]=r+vhtop;yp[2]=vhapo; 00115 xp[3]=r-vhtop;yp[3]=vhapo; 00116 }else{ 00117 if(posrel)r = r + r/3.; 00118 xp[0]=r-vhapo;yp[0]=-vhbot; 00119 xp[1]=r+vhapo;yp[1]=-vhtop; 00120 xp[2]=r+vhapo;yp[2]=vhtop; 00121 xp[3]=r-vhapo;yp[3]=vhbot; 00122 } 00123 for(int j=0;j<4;j++){ 00124 xp1 = xp[j]*cos(phi)-yp[j]*sin(phi); 00125 yp1 = xp[j]*sin(phi)+yp[j]*cos(phi); 00126 xp[j] = xp1;yp[j]=yp1; 00127 } 00128 } else { //barrel 00129 if(posrel){ 00130 int numod; 00131 numod=mod->getId();if(numod>100)numod=numod-100; 00132 int vane = mod->getOwner()->getId(); 00133 dx = vhapo; 00134 phi=M_PI; 00135 xt1=rmedio[nlay-31]; yt1=-vhtop/2.; 00136 xs1 = xt1*cos(phi)-yt1*sin(phi); 00137 ys1 = xt1*sin(phi)+yt1*cos(phi); 00138 xt2=rmedio[nlay-31]; yt2=vhtop/2.; 00139 xs2 = xt2*cos(phi)-yt2*sin(phi); 00140 ys2 = xt2*sin(phi)+yt2*cos(phi); 00141 dy=VisCuTkMap2D::phival(xs2,ys2)-VisCuTkMap2D::phival(xs1,ys1); 00142 dy1 = dy; 00143 if(nlay==31)dy1=0.39; 00144 if(nlay==32)dy1=0.23; 00145 if(nlay==33)dy1=0.16; 00146 xp[0]=vane*(dx+dx/6.);yp[0]=numod*(dy1+dy1/6.); 00147 xp[1]=vane*(dx+dx/6.)+dx;yp[1]=numod*(dy1+dy1/6.); 00148 xp[2]=vane*(dx+dx/6.)+dx;yp[2]=numod*(dy1+dy1/6.)+dy; 00149 xp[3]=vane*(dx+dx/6.);yp[3]=numod*(dy1+dy1/6.)+dy; 00150 }else{ 00151 xt1=r; yt1=-vhtop/2.; 00152 xs1 = xt1*cos(phi)-yt1*sin(phi); 00153 ys1 = xt1*sin(phi)+yt1*cos(phi); 00154 xt2=r; yt2=vhtop/2.; 00155 xs2 = xt2*cos(phi)-yt2*sin(phi); 00156 ys2 = xt2*sin(phi)+yt2*cos(phi); 00157 xp[0]=mod->posz-vhapo/2.;yp[0]=4.2*VisCuTkMap2D::phival(xs1,ys1); 00158 xp[1]=mod->posz+vhapo/2.;yp[1]=4.2*VisCuTkMap2D::phival(xs1,ys1); 00159 xp[2]=mod->posz+vhapo/2.;yp[2]=4.2*VisCuTkMap2D::phival(xs2,ys2); 00160 xp[3]=mod->posz-vhapo/2.;yp[3]=4.2*VisCuTkMap2D::phival(xs2,ys2); 00161 } 00162 } 00163 VisCuTkSubLayer* sl = mod->getOwner(); 00164 if(sl->isStereo()) 00165 { 00166 if(mod->getId()>100 ){ 00167 for(int j=0;j<3;j++){ 00168 x=xpixel(xp[j]);y=ypixel(yp[j]); 00169 if(!horizontal_view)a.setPoint(j,x,y);else a.setPoint(j,y,x_win-x); 00170 } 00171 if(!horizontal_view)a.setPoint(3,x,y);else a.setPoint(3,y,x_win-x); 00172 }else { 00173 x=xpixel(xp[2]);y=ypixel(yp[2]); 00174 if(!horizontal_view)a.setPoint(0,x,y);else a.setPoint(0,y,x_win-x); 00175 x=xpixel(xp[3]);y=ypixel(yp[3]); 00176 if(!horizontal_view)a.setPoint(1,x,y);else a.setPoint(1,y,x_win-x); 00177 x=xpixel(xp[0]);y=ypixel(yp[0]); 00178 if(!horizontal_view)a.setPoint(2,x,y);else a.setPoint(2,y,x_win-x); 00179 if(!horizontal_view)a.setPoint(3,x,y);else a.setPoint(3,y,x_win-x); 00180 } 00181 } else { 00182 for(int j=0;j<4;j++){ 00183 x=xpixel(xp[j]);y=ypixel(yp[j]); 00184 if(!horizontal_view)a.setPoint(j,x,y);else a.setPoint(j,y,x_win-x); 00185 } 00186 } 00187 }
void VisCuTkLayerSelection::drawModules | ( | ) | [private] |
Definition at line 56 of file VisCuTkLayerSelection.cc.
References a, VisCuTkCompositeDetector< T >::components(), defwindow(), drawmodule(), VisCuTkCompositeDetector< T >::getComponent(), edm::es::l(), lay, m, nelem, nlay, VisCuTkModule::notInUse(), rg, and state.
Referenced by VisCuTkLayerSelection().
00057 { 00058 nelem = 0; 00059 defwindow(nlay); 00060 for(unsigned int l=0; l<lay->components(); l++ ){ 00061 VisCuTkSubLayer* sublayer = lay->getComponent(l+1); 00062 for(unsigned int m=0; m<sublayer->components(); m++ ){ 00063 VisCuTkModule* module = sublayer->getComponent(m+1); 00064 if(!module->notInUse()){ 00065 QPointArray a = QPointArray(4); 00066 drawmodule(module,nlay,a); 00067 rg[nelem]=a; 00068 rg[nelem].detach(); 00069 state[nelem]=module; 00070 nelem++; 00071 } 00072 } 00073 } 00074 }
void VisCuTkLayerSelection::mousePressEvent | ( | QMouseEvent * | e | ) | [protected] |
Definition at line 42 of file VisCuTkLayerSelection.cc.
References VisCuTkSlWindow::drawpart(), VisCuTkModule::getName(), gp, VisCuTkSelectionBar::gpp, i, VisCuTkLayerSlWindow::labelinfo, nelem, VisCuTkLayerSlWindow::qw, rg, and state.
00043 { 00044 for(int i=0; i<nelem; i++){ 00045 QRegion q(rg[i],false); 00046 if(q.contains(e->pos())){ 00047 VisCuTkModule* module = dynamic_cast<VisCuTkModule*>(state[i]) ; 00048 gp->labelinfo->setText(module->getName()); 00049 gp->qw->gpp->drawpart(state[i]); 00050 repaint(); 00051 break; 00052 } 00053 } 00054 }
void VisCuTkLayerSelection::paintEvent | ( | QPaintEvent * | ) | [protected] |
Definition at line 76 of file VisCuTkLayerSelection.cc.
References getId(), i, nelem, p, cmsRelvalreport::red(), rg, state, and cmsRelvalreport::yellow().
00077 { 00078 QPainter p( this ); 00079 p.setPen(black); 00080 for(int i=0; i<nelem; i++){ 00081 p.setBrush(yellow); 00082 if(state[i]->getId()>100) p.setBrush(blue); 00083 if(state[i]->isVisible()) 00084 { 00085 p.setBrush(red); 00086 } 00087 p.drawPolygon(rg[i]); 00088 } 00089 }
QSizePolicy VisCuTkLayerSelection::sizePolicy | ( | ) | const [private] |
int VisCuTkLayerSelection::xpixel | ( | double | x | ) | [inline, private] |
int VisCuTkLayerSelection::ypixel | ( | double | y | ) | [inline, private] |
Definition at line 24 of file VisCuTkLayerSelection.h.
Referenced by mousePressEvent(), and VisCuTkLayerSelection().
bool VisCuTkLayerSelection::horizontal_view [private] |
Definition at line 45 of file VisCuTkLayerSelection.h.
Referenced by drawmodule(), and VisCuTkLayerSelection().
VisCuTkLayer* VisCuTkLayerSelection::lay [private] |
Definition at line 31 of file VisCuTkLayerSelection.h.
Referenced by closeEvent(), drawModules(), and VisCuTkLayerSelection().
int VisCuTkLayerSelection::nelem [private] |
Definition at line 33 of file VisCuTkLayerSelection.h.
Referenced by drawModules(), mousePressEvent(), and paintEvent().
int VisCuTkLayerSelection::nlay [private] |
Definition at line 32 of file VisCuTkLayerSelection.h.
Referenced by drawModules(), and VisCuTkLayerSelection().
bool VisCuTkLayerSelection::posrel [private] |
Definition at line 45 of file VisCuTkLayerSelection.h.
Referenced by defwindow(), drawmodule(), and VisCuTkLayerSelection().
QPointArray VisCuTkLayerSelection::rg[2000] [private] |
Definition at line 34 of file VisCuTkLayerSelection.h.
Referenced by drawModules(), mousePressEvent(), and paintEvent().
VisCuTkState* VisCuTkLayerSelection::state[2000] [private] |
Definition at line 35 of file VisCuTkLayerSelection.h.
Referenced by drawModules(), mousePressEvent(), and paintEvent().
int VisCuTkLayerSelection::x_win [private] |
Definition at line 32 of file VisCuTkLayerSelection.h.
Referenced by drawmodule(), VisCuTkLayerSelection(), xpixel(), and ypixel().
double VisCuTkLayerSelection::xmax [private] |
Definition at line 36 of file VisCuTkLayerSelection.h.
Referenced by defwindow(), VisCuTkLayerSelection(), and xpixel().
double VisCuTkLayerSelection::xmin [private] |
Definition at line 36 of file VisCuTkLayerSelection.h.
Referenced by defwindow(), VisCuTkLayerSelection(), and xpixel().
double VisCuTkLayerSelection::ymax [private] |
Definition at line 36 of file VisCuTkLayerSelection.h.
Referenced by defwindow(), VisCuTkLayerSelection(), and ypixel().
double VisCuTkLayerSelection::ymin [private] |
Definition at line 36 of file VisCuTkLayerSelection.h.
Referenced by defwindow(), VisCuTkLayerSelection(), and ypixel().