CMS 3D CMS Logo

VisCuTkSelectionBar Class Reference

#include <VisReco/VisCustomTracker/interface/VisCuTkSelectionBar.h>

List of all members.

Public Member Functions

void drawSelectionBars ()
void setTracker (VisCuCmsTracker *tr)
void update ()
 VisCuTkSelectionBar (VisCuTkSlWindow *sw, QWidget *parent=0, const char *name=0)

Public Attributes

VisCuTkSlWindowgpp

Protected Member Functions

void mousePressEvent (QMouseEvent *e)
void paintEvent (QPaintEvent *)

Private Member Functions

QSizePolicy sizePolicy () const
int xpixel (double x)
int ypixel (double y)

Private Attributes

QString label
QString label1
VisCuTkLayerSlWindowlayerWindow
int nelem
int ntotlay
QRect rsqr [400]
VisCuTkStatestate [400]
VisCuCmsTrackertracker
double xmax
double xmin
double ymax
double ymin


Detailed Description

Definition at line 14 of file VisCuTkSelectionBar.h.


Constructor & Destructor Documentation

VisCuTkSelectionBar::VisCuTkSelectionBar ( VisCuTkSlWindow sw,
QWidget *  parent = 0,
const char *  name = 0 
)

Definition at line 14 of file VisCuTkSelectionBar.cc.

References gpp, xmax, xmin, ymax, and ymin.

00015         : QWidget( parent, name )
00016 {
00017    setPalette( QPalette( QColor( 250, 250, 250) ) );
00018    xmin = -3.0; xmax = 3.0; ymin = -0.1; ymax =1.0;
00019 
00020    gpp = sw;
00021 }


Member Function Documentation

void VisCuTkSelectionBar::drawSelectionBars (  ) 

Definition at line 29 of file VisCuTkSelectionBar.cc.

References a, VisCuTkCompositeDetector< T >::components(), VisCuTkCompositeDetector< T >::getComponent(), VisCuTkSubLayer::getId(), i, j, k, edm::es::l(), nelem, VisCuTracker::nlayer(), ntotlay, rsqr, state, tracker, xpixel(), and ypixel().

Referenced by setTracker().

00029                                            {
00030   
00031    float xsq[]={2.75,2.57,2.39,2.21,2.03,1.85,1.67,1.50,1.33,1.16,1.03,0.90,0.77,0.64,0.51,- 0.51,-0.64,-0.77,-0.90,-1.03,-1.16,-1.33,-1.50,-1.67,-1.85,-2.03,-2.21,-2.39,-2.57,-2.75,-2.85,-2.85,-2.85,-2.85,-2.85,-2.85,-2.85,-2.85,-2.85,-2.85,-2.85,-2.85,-2.85};
00032    float ysq[]={0.95,0.95,0.95,0.95,0.95,0.95,0.95,0.95,0.95,0.95,0.95,0.95,0.95,0.95,0.95,0.95,0.95,0.95,0.95,0.95,0.95,0.95,0.95,0.95,0.95,0.95,0.95,0.95,0.95,0.95,0.090,0.140,0.190,0.31,0.36,0.43,0.48,0.55,0.61,0.67,0.74,0.81,0.88};
00033 
00034    float rmedioS[]={0.387, 0.447, 0.507, 0.567, 0.657, 0.777, 0.887};
00035    float rmedioP[]={0.0155, 0.065, 0.105, 0.145, 0.185, 0.225, 0.265};
00036 
00037    float sizeF[]={0.08,0.08,0.08,0.08,0.11,0.14,0.14};
00038    float xp[]={-0.40,-0.29, -0.18,-0.06,0.06,0.18,0.29,0.40}; 
00039    float xsi[]={-0.60,-0.50,-0.40,-0.30,-0.20,-0.10,0.10,0.20,0.30,0.40,0.50,0.60};
00040    float xso[]={-1.13,-0.93,-0.74,-0.55,-0.36,-0.16,0.05,0.24,0.44,0.63,0.82,1.01};
00041    int nlay;
00042    ntotlay =0;
00043    nelem=0;
00044    //draw squares
00045    for(unsigned int i=0; i<tracker->components(); i++){
00046      VisCuTkSubDetector* subDetector = tracker->getComponent(i+1);       
00047      for(unsigned int j=0; j<subDetector->components(); j++ ){
00048        VisCuTkPartDetector* partDetector = subDetector->getComponent(j+1);
00049        for(unsigned int k=0; k<partDetector->components(); k++ ){
00050          ntotlay++;
00051          nlay=VisCuTracker::nlayer(i+1,j+1,k+1);
00052          //cout <<nlay << endl;
00053          VisCuTkLayer* layer = partDetector->getComponent(k+1);
00054          if(nlay<31){
00055            rsqr[nelem]=QRect(xpixel(xsq[(31-nlay)-1]),ypixel(ysq[nlay-1]),5,5); 
00056            state[nelem]=layer;
00057            nelem=nelem+1;
00058          }else {
00059            rsqr[nelem]=QRect(xpixel(xsq[nlay-1]-0.05),ypixel(ysq[nlay-1]),5,5);
00060            state[nelem]=layer;
00061            nelem=nelem+1;
00062          }
00063          if(nlay<31){
00064            rsqr[nelem]=QRect(xpixel(xsq[(31-nlay)-1]),ypixel(-0.03),5,5);
00065            state[nelem]=layer;
00066            nelem=nelem+1;
00067          }
00068          else{
00069            rsqr[nelem]=QRect(xpixel(2.90),ypixel(ysq[nlay-1]),5,5);
00070            state[nelem]=layer;
00071            nelem=nelem+1;
00072          }
00073        }           
00074      }    
00075    }
00076    //cout << " ntotlay1=" << ntotlay<<endl;
00077    //draw bars
00078    for(unsigned int i=0; i<tracker->components(); i++){
00079       VisCuTkSubDetector* subDetector = tracker->getComponent(i+1);
00080       for(unsigned int j=0; j<subDetector->components(); j++ ){
00081         VisCuTkPartDetector* partDetector = subDetector->getComponent(j+1);
00082         for(unsigned int k=0; k<partDetector->components(); k++ ){
00083           nlay=VisCuTracker::nlayer(i+1,j+1,k+1);
00084           VisCuTkLayer* layer = partDetector->getComponent(k+1);
00085           for(unsigned int l=0; l<layer->components(); l++ ){
00086             VisCuTkSubLayer* sublayer = layer->getComponent(l+1);
00087             int id = sublayer->getId();
00088             float a = 0;            
00089             if(nlay<13 || (nlay>18 && nlay<31)){//TEC+TID
00090               if(nlay<13 && id%2==0)a=0.05; 
00091               if(nlay<13 && id%2!=0)a=0.0;
00092               if((nlay>18 && nlay<31) && id%2==0)a=0.0;
00093               if((nlay>18 && nlay<31) && id%2!=0)a=0.05;
00094               int xendcap = xpixel(xsq[(31-nlay)-1]+ a);
00095               rsqr[nelem]=QRect(xendcap,ypixel(rmedioS[id-1]),3,ypixel(0)-ypixel(sizeF[id-1]));
00096               state[nelem]= sublayer;
00097               nelem=nelem+1;
00098             }
00099             if(nlay>12 && nlay<19 ){//Pixel EndCap
00100               if(nlay==16 || nlay==17 || nlay==18)a=0.03;
00101               int xpixel1 = xpixel(xsq[(31-nlay)-1]+a);
00102               rsqr[nelem]=QRect(xpixel1,ypixel(rmedioP[id-1]),3,6);
00103               state[nelem]= sublayer;
00104               nelem=nelem+1;          
00105             }
00106             if(nlay>30 && nlay<34){//Pixel Barrel
00107                rsqr[nelem]=QRect(xpixel(xp[id-1]),ypixel(ysq[nlay-1]),8,3);
00108                state[nelem]= sublayer;
00109                nelem=nelem+1;
00110             }
00111             if(nlay>33 && nlay<38){//inner barrel
00112               rsqr[nelem]=QRect(xpixel(xsi[id-1]),ypixel(ysq[nlay-1]),8,3);
00113               state[nelem]= sublayer;
00114               nelem=nelem+1;
00115             }
00116             if(nlay>37){//outer barrel
00117               if((id%2==0 && id<7) || (id>6 && id%2!=0))a = 0.01;     
00118               rsqr[nelem]=QRect(xpixel(xso[id-1]),ypixel(ysq[nlay-1]+a),17,3);
00119               state[nelem]= sublayer;
00120               nelem=nelem+1;
00121             }
00122           }
00123         }
00124       }
00125    }    
00126 }

void VisCuTkSelectionBar::mousePressEvent ( QMouseEvent *  e  )  [protected]

Definition at line 132 of file VisCuTkSelectionBar.cc.

References VisCuTkSlWindow::drawpart(), VisCuTkSubLayer::getId(), VisCuTkLayer::getId(), VisCuTkPartDetector::getName(), VisCuTkLayer::getOwner(), VisCuTkSubLayer::getOwner(), VisCuTkLayer::getSlWindow(), gpp, i, label, label1, VisCuTkSlWindow::labelinfop, layerWindow, nelem, ntotlay, rsqr, VisCuTkLayer::setSlWindow(), and state.

00133 {
00134   for(int i=0; i<nelem; i++){
00135     if(rsqr[i].contains(e->pos())){
00136       if((i%2==1 && i<(2*ntotlay)) || i>(2*ntotlay-1)){ //yellow or bars
00137         if(i%2==1 && i<(2*ntotlay)){ 
00138           VisCuTkLayer* lay = dynamic_cast<VisCuTkLayer*>(state[i]);     
00139           label.setNum(lay->getId());   
00140           gpp->labelinfop->setText(" Layer "+label+" of "+lay->getOwner()->getName()+" selected");  
00141         }            else{ 
00142           VisCuTkSubLayer* subly = dynamic_cast<VisCuTkSubLayer*>(state[i]); 
00143           label.setNum(subly->getId());  
00144           label1.setNum(subly->getOwner()->getId());   
00145           gpp->labelinfop->setText( "Ring "+label+ " layer "+label1+ " of "+subly->getOwner()->getOwner()->getName()+" selected" ); 
00146         }
00147         gpp->drawpart(state[i]);
00148         repaint();
00149       }
00150       if(i%2==0 && i<(2*ntotlay)){//green squares
00151         VisCuTkLayer* lay = dynamic_cast<VisCuTkLayer*>(state[i]);  
00152         if(lay->getSlWindow()==0 ||lay->getSlWindow()->close() ){
00153           layerWindow = new VisCuTkLayerSlWindow(0, "layerWindow",0,state[i], this);
00154           layerWindow->show();   
00155           lay->setSlWindow(layerWindow);
00156           repaint();
00157         } else {
00158           if(lay->getSlWindow()->isMinimized()){
00159             lay->getSlWindow()->showNormal();
00160             lay->getSlWindow()->setActiveWindow();
00161             lay->getSlWindow()->raise();
00162           }
00163         }
00164         repaint();
00165       }
00166       break;
00167     }
00168   }  
00169 }

void VisCuTkSelectionBar::paintEvent ( QPaintEvent *   )  [protected]

Definition at line 171 of file VisCuTkSelectionBar.cc.

References VisCuTkLayer::getSlWindow(), cmsRelvalreport::green(), i, VisCuTkSubLayer::isStereo(), nelem, ntotlay, p, cmsRelvalreport::red(), rsqr, state, and cmsRelvalreport::yellow().

00172 {
00173   QPainter p( this );
00174   p.setPen(black);
00175   
00176   for(int i=0; i<(2*ntotlay); i++){
00177     if((i%2)==1){
00178       p.setBrush(yellow);
00179       if(state[i]->isVisible()) p.setBrush(red);
00180     }   
00181     else {
00182       VisCuTkLayer* lay = dynamic_cast<VisCuTkLayer*>(state[i]);  
00183       if(lay->getSlWindow()!=0)p.setBrush(red);else p.setBrush(green);      
00184     }
00185     p.drawRect(rsqr[i]); 
00186   }
00187   for(int i=(2*ntotlay); i<nelem; i++){
00188     p.setBrush(black);
00189     VisCuTkSubLayer* sublay = dynamic_cast<VisCuTkSubLayer*>(state[i]); 
00190     if(sublay->isStereo()){
00191       p.setPen(blue);
00192       p.setBrush(blue);  
00193     }     
00194     if(state[i]->isVisible()) {
00195       p.setPen(red);
00196       p.setBrush(red);
00197     }     
00198     p.drawRect(rsqr[i]);
00199     p.setPen(black); 
00200   } 
00201 }

void VisCuTkSelectionBar::setTracker ( VisCuCmsTracker tr  ) 

Definition at line 23 of file VisCuTkSelectionBar.cc.

References drawSelectionBars(), and tracker.

Referenced by VisCuTkSlWindow::setTracker().

00024 {
00025   tracker=tr;
00026   drawSelectionBars();
00027 }

QSizePolicy VisCuTkSelectionBar::sizePolicy (  )  const [private]

Definition at line 202 of file VisCuTkSelectionBar.cc.

00203 {
00204    return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
00205 }

void VisCuTkSelectionBar::update ( void   ) 

Definition at line 128 of file VisCuTkSelectionBar.cc.

00128                                  {
00129   repaint();
00130 }

int VisCuTkSelectionBar::xpixel ( double  x  )  [inline, private]

Definition at line 36 of file VisCuTkSelectionBar.h.

References xmax, and xmin.

Referenced by drawSelectionBars().

00036                         {
00037       return(int)((x-xmin)/(xmax-xmin)*530);
00038     }

int VisCuTkSelectionBar::ypixel ( double  y  )  [inline, private]

Definition at line 39 of file VisCuTkSelectionBar.h.

References int, ymax, and ymin.

Referenced by drawSelectionBars().

00039                         {
00040       double y1;
00041       y1 = (y-ymin)/(ymax-ymin);
00042       return 250-(int)(y1*250);
00043     }


Member Data Documentation

VisCuTkSlWindow* VisCuTkSelectionBar::gpp

Definition at line 22 of file VisCuTkSelectionBar.h.

Referenced by VisCuTkLayerSelection::mousePressEvent(), mousePressEvent(), and VisCuTkSelectionBar().

QString VisCuTkSelectionBar::label [private]

Definition at line 29 of file VisCuTkSelectionBar.h.

Referenced by mousePressEvent().

QString VisCuTkSelectionBar::label1 [private]

Definition at line 29 of file VisCuTkSelectionBar.h.

Referenced by mousePressEvent().

VisCuTkLayerSlWindow* VisCuTkSelectionBar::layerWindow [private]

Definition at line 30 of file VisCuTkSelectionBar.h.

Referenced by mousePressEvent().

int VisCuTkSelectionBar::nelem [private]

Definition at line 33 of file VisCuTkSelectionBar.h.

Referenced by drawSelectionBars(), mousePressEvent(), and paintEvent().

int VisCuTkSelectionBar::ntotlay [private]

Definition at line 34 of file VisCuTkSelectionBar.h.

Referenced by drawSelectionBars(), mousePressEvent(), and paintEvent().

QRect VisCuTkSelectionBar::rsqr[400] [private]

Definition at line 31 of file VisCuTkSelectionBar.h.

Referenced by drawSelectionBars(), mousePressEvent(), and paintEvent().

VisCuTkState* VisCuTkSelectionBar::state[400] [private]

Definition at line 32 of file VisCuTkSelectionBar.h.

Referenced by drawSelectionBars(), mousePressEvent(), and paintEvent().

VisCuCmsTracker* VisCuTkSelectionBar::tracker [private]

Definition at line 28 of file VisCuTkSelectionBar.h.

Referenced by drawSelectionBars(), and setTracker().

double VisCuTkSelectionBar::xmax [private]

Definition at line 35 of file VisCuTkSelectionBar.h.

Referenced by VisCuTkSelectionBar(), and xpixel().

double VisCuTkSelectionBar::xmin [private]

Definition at line 35 of file VisCuTkSelectionBar.h.

Referenced by VisCuTkSelectionBar(), and xpixel().

double VisCuTkSelectionBar::ymax [private]

Definition at line 35 of file VisCuTkSelectionBar.h.

Referenced by VisCuTkSelectionBar(), and ypixel().

double VisCuTkSelectionBar::ymin [private]

Definition at line 35 of file VisCuTkSelectionBar.h.

Referenced by VisCuTkSelectionBar(), and ypixel().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:35:15 2009 for CMSSW by  doxygen 1.5.4