Exemplo n.º 1
0
void Stack::draw2D(){
    if( debug > 0 ) std::cout << "Stack::draw2D()" << std::endl;
    int N = vec.size();

    if(debug > 0) std::cout << "N : " << N << std::endl;
    if( N  == 0 ) return;

    can -> cd();
    if( frame == NULL){
        frame = (TH2*) vec[0] -> Clone("frame");
        frame -> Reset();
        frame -> GetXaxis() -> SetTitle( titleX.c_str() );
        frame -> GetYaxis() -> SetTitle( titleY.c_str() );
        if(strcmp(frame -> GetTitle(), "htemp") == 0 && strcmp(frame -> GetTitle(), "Default") == 0) frame -> SetTitle( title.c_str() );
    }

    frame -> Draw();

    for(int i = 0; i<N;i++){
        vec[i] -> SetMarkerColor( getColor(i) );
        vec[i] -> SetLineColor( vec[i] -> GetMarkerColor() );

        drawingOption[ vec[i] ] += "same";
        if(N == 1){
            std::size_t pos = drawingOption[ vec[i] ].find("black");
            if( pos == std::string::npos ) drawingOption[ vec[i] ] += "colz";
        }
        vec[i] -> Draw( drawingOption[ vec[i] ].c_str() );
    }

    int Ngraph = vecGraph.size();
    for(int i = N;i<Ngraph+N;i++){
        if(debug > 9) std::cout << "drawing graph # : " << i-N << " with # : " << vecGraph[i-N] -> GetN() << " points in Stack : " << name << std::endl;
        drawGraph( vecGraph[i-N], i );
    }

    int Nlines = vecLine.size();
    for(int i = N + Ngraph;i<Ngraph+N+Nlines;i++){
        drawLine( vecLine[i-(N+Ngraph)] );
    }
}
Exemplo n.º 2
0
SCTPGraphDialog::SCTPGraphDialog(QWidget *parent, sctp_assoc_info_t *assoc, capture_file *cf, int dir) :
    QDialog(parent),
    ui(new Ui::SCTPGraphDialog),
    selected_assoc(assoc),
    cap_file_(cf),
    direction(dir)
{
    ui->setupUi(this);
    if (!selected_assoc) {
        selected_assoc = SCTPAssocAnalyseDialog::findAssocForPacket(cap_file_);
    }
    this->setWindowTitle(QString(tr("SCTP TSNs and SACKs over Time: %1 Port1 %2 Port2 %3")).arg(cf_get_display_name(cap_file_)).arg(selected_assoc->port1).arg(selected_assoc->port2));
    if ((direction == 1 && selected_assoc->n_array_tsn1 == 0) || (direction == 2 && selected_assoc->n_array_tsn2 == 0)) {
        QMessageBox msgBox;
        msgBox.setText(tr("No Data Chunks sent"));
        msgBox.exec();
        return;
    } else {
        drawGraph(3);
    }
}
Exemplo n.º 3
0
void TrayToolTip::redraw()
{
	QPixmap pixmap(WIDTH, HEIGHT);
	QPainter painter(&pixmap);
	
	int downt = QueueMgr::instance()->totalDown();
	int upt = QueueMgr::instance()->totalUp();
	
	pixmap.fill(Qt::white);
	
	QString text = QString("%1 down | %2 up").arg(formatSize(downt,true)).arg(formatSize(upt,true));
	painter.setPen(Qt::black);
	painter.drawText(0, 0, WIDTH, OFFSET, Qt::AlignTop|Qt::AlignHCenter, text, 0);
	
	painter.setPen(Qt::gray);
	painter.setFont( QFont(QString(), 25) );
	painter.drawText(0, 0, WIDTH, HEIGHT, Qt::AlignCenter, "FatRat", 0);
	
	drawGraph(&painter);
	
	setPixmap(pixmap);
}
Exemplo n.º 4
0
void NodeGraphDisplay::draw(GlInterface &gl)
{
	if(visible && isolateViewport(gl))
	{
		//Draw background
		drawBackground(gl);
		//Draw graph behind nodes
		drawGraph(gl);

		//Draw nodes
		drawChildren(gl);

		transformGl(gl);

		//Draw selection rect
		if(selectionRect.space != TSpace::INVALID)
		{
			std::vector<TVertex> points;
			points.reserve(5);

			Color col(0.0f, 1.0f, 1.0f, 1.0f);

			APoint	p1 = selectionRect.pos,
					p2 = p1 + selectionRect.size;

			points.push_back(TVertex(p1, col));
			points.push_back(TVertex(APoint(p1.x, p2.y), col));
			points.push_back(TVertex(p2, col));
			points.push_back(TVertex(APoint(p2.x, p1.y), col));
			points.push_back(TVertex(p1, col));

			//Draw rect
			gl.drawShape(GL_LINE_STRIP, points);
		}

		untransformGl(gl);
		restoreViewport(gl);
	}
}
Exemplo n.º 5
0
void AdaptiveGridTest::draw(GeoDrawer * dr)
{
#define SHO_CELL 0
#define SHO_CELL_NODE 0
#define SHO_GRAPH 0
#define SHO_CUT 0
#define SHO_FRONT 1
#define SHO_FRONT_WIRE 1

#if SHO_CELL
	drawGridCell<AdaptiveBccGrid3>(m_msh.grid(), dr);
#endif

#if SHO_CELL_NODE
	drawGridNode<AdaptiveBccGrid3, BccCell3>(m_msh.grid(), dr);
#endif

#if SHO_GRAPH
	drawGraph(dr);
#endif

#if SHO_CUT
	drawCut(dr);
#endif

#if SHO_FRONT	
	dr->m_surfaceProfile.apply();
	dr->setColor(0.f, .4f, .5f);
	drawFront<FieldTriangulation >(&m_msh);
		
#if SHO_FRONT_WIRE	
	dr->m_wireProfile.apply();
	dr->setColor(0.1f, .1f, .1f);
	drawFrontWire<FieldTriangulation >(&m_msh);
#endif
#endif

}
Exemplo n.º 6
0
//--------------------------------------------------------------
void  BYBGui::drawGraphs(){
    for (int i = 0; i < NUM_GRAPHS; i++) {
        drawGraph(i);
    }
}
Exemplo n.º 7
0
 void TopologicalMapper::drawPointGraph(cv::Mat &image,
     uint32_t orig_x, uint32_t orig_y) {
   drawGraph(image, point_graph_, orig_x, orig_y);
 }
Exemplo n.º 8
0
void CrowdToolState::handleRenderOverlay(double* proj, double* model, int* view)
{
	GLdouble x, y, z;
	
	// Draw start and end point labels
	if (m_targetRef && gluProject((GLdouble)m_targetPos[0], (GLdouble)m_targetPos[1], (GLdouble)m_targetPos[2],
								  model, proj, view, &x, &y, &z))
	{
		imguiDrawText((int)x, (int)(y+25), IMGUI_ALIGN_CENTER, "TARGET", imguiRGBA(0,0,0,220));
	}
	
	char label[32];
	
	if (m_toolParams.m_showLabels)
	{
		dtCrowd* crowd = m_sample->getCrowd();
		if (crowd)
		{
			for (int i = 0; i < crowd->getAgentCount(); ++i)
			{
				const dtCrowdAgent* ag = crowd->getAgent(i);
				if (!ag->active) continue;
				const float* pos = ag->npos;
				const float h = ag->params.height;
				if (gluProject((GLdouble)pos[0], (GLdouble)pos[1]+h, (GLdouble)pos[2],
							   model, proj, view, &x, &y, &z))
				{
					snprintf(label, 32, "%d", i);
					imguiDrawText((int)x, (int)y+15, IMGUI_ALIGN_CENTER, label, imguiRGBA(0,0,0,220));
				}
			}			
		}
	}
	if (m_agentDebug.idx != -1)
	{
		dtCrowd* crowd = m_sample->getCrowd();
		if (crowd) 
		{
			const dtCrowdAgent* ag = crowd->getAgent(m_agentDebug.idx);
			if (ag->active)
			{
				const float radius = ag->params.radius;
				
				if (m_toolParams.m_showNeis)
				{
					for (int j = 0; j < ag->nneis; ++j)
					{
						const dtCrowdAgent* nei = crowd->getAgent(ag->neis[j].idx);
						if (!nei->active) continue;
						
						if (gluProject((GLdouble)nei->npos[0], (GLdouble)nei->npos[1]+radius, (GLdouble)nei->npos[2],
									   model, proj, view, &x, &y, &z))
						{
							snprintf(label, 32, "%.3f", ag->neis[j].dist);
							imguiDrawText((int)x, (int)y+15, IMGUI_ALIGN_CENTER, label, imguiRGBA(255,255,255,220));
						}
					}
				}
			}
		}
	}
	
	
	if (m_toolParams.m_showPerfGraph)
	{
		GraphParams gp;
		gp.setRect(300, 10, 500, 200, 8);
		gp.setValueRange(0.0f, 2.0f, 4, "ms");
		
		drawGraphBackground(&gp);
		drawGraph(&gp, &m_crowdTotalTime, 1, "Total", duRGBA(255,128,0,255));
		
		gp.setRect(300, 10, 500, 50, 8);
		gp.setValueRange(0.0f, 2000.0f, 1, "");
		drawGraph(&gp, &m_crowdSampleCount, 0, "Sample Count", duRGBA(96,96,96,128));
	}
	
}
Exemplo n.º 9
0
void ovenGraphScreen::runTouch (void) {
    if(drawn == true) {
        int8_t result;
    
        result = myBui.btns.checkBtn();
        switch (result) {
            case STOP_BTN:
                oven.turnOvenOff ();
                updateButtons ();
                break;
            case START_BTN:
                if (oven.temp < 50.0f) {
                    oven.turnOvenOn ();
                    drawGraph ();
                    updateButtons ();
                }
                break;
            case ACK_BTN:
                oven.soundOff ();
                hideInfo ();
                break;
            case PREHEAT_H_BOX:
                myBui.numInput.initNumberInput  (&(tBoxStrings[PREHEAT_T_BOX][0]), 
                                                _NUM_TYPE_FLOAT,
                                                (void*)&(oven.reflowVars.preheatRamp),
                                                0.5f,
                                                6.0f);
                break;
            case SOAK_TEMP_H_BOX:
                myBui.numInput.initNumberInput  (&(tBoxStrings[SOAK_TEMP_T_BOX][0]), 
                                                _NUM_TYPE_FLOAT,
                                                (void*)&(oven.reflowVars.soakTemp),
                                                100.0f,
                                                oven.reflowVars.peakTemp - 10);
                break;
            case SOAK_TIME_H_BOX:
                myBui.numInput.initNumberInput  (&(tBoxStrings[SOAK_TIME_T_BOX][0]), 
                                                _NUM_TYPE_UINT16_T,
                                                (void*)&(oven.reflowVars.soakTime),
                                                5,
                                                600);
                break;
            case RAMP_H_BOX:
                myBui.numInput.initNumberInput  (&(tBoxStrings[RAMP_T_BOX][0]), 
                                                _NUM_TYPE_FLOAT,
                                                (void*)&(oven.reflowVars.ramp),
                                                0.5f,
                                                6.0f);
                break;
            case PEAK_TEMP_H_BOX:
                myBui.numInput.initNumberInput  (&(tBoxStrings[PEAK_TEMP_T_BOX][0]), 
                                                _NUM_TYPE_FLOAT,
                                                (void*)&(oven.reflowVars.peakTemp),
                                                oven.reflowVars.soakTemp + 10,
                                                300.0f);
                break;
            case PEAK_TIME_H_BOX:
                myBui.numInput.initNumberInput  (&(tBoxStrings[PEAK_TIME_T_BOX][0]), 
                                                _NUM_TYPE_UINT16_T,
                                                (void*)&(oven.reflowVars.peakTime),
                                                5,
                                                60);
            default:
                break;
        }
    }
}
Exemplo n.º 10
0
bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
   
  QClipboard * clipboard = QApplication::clipboard();		//added by AiO 
  if ( obj == canvas->viewport() )
  {
    // paint
    if ( event->type() == QEvent::Paint )
    {
      set_drawing_rectangle(canvas->viewport()->size().width(), canvas->viewport()->size().height());
      QPainter p(canvas->viewport());
      p.setPen(Qt::black);
      p.setBrush(Qt::green);
      PaintStruct ps;
      ps.p = &p;
      ps.border = 2;
      drawGraph(&ps);
    }

    // mouse
    else if ( event->type() == QEvent::MouseMove )
    {
      QMouseEvent *mevent = (QMouseEvent *) event;
      if ( qApp->overrideCursor() )
      {
        //cursor is overridden, we are panning
        if ( mevent->x() != ox || mevent->y() != oy )
        {
          move_focus(ox - mevent->x(), oy - mevent->y());
          ox = mevent->x();
          oy = mevent->y();
          canvas->viewport()->update();
          //update();
        }
      }
    }
    else if ( event->type() == QEvent::MouseButtonPress )
    {
      QMouseEvent *mevent = (QMouseEvent *) event;
      if ( mevent->button() == Qt::LeftButton )
      {
        Qt::KeyboardModifiers mods = mevent->modifiers();
        if (mods & Qt::ShiftModifier) zoomIn();
        else if (mods & Qt::ControlModifier) zoomOut();
        if ( !sticky )
        {
          qApp->setOverrideCursor(*MOVING_CURSOR);
        }
        else
        {
          if ( qApp->overrideCursor() )
          {
            //cursor is already overridden, release it
            qApp->restoreOverrideCursor();
            canvas->setMouseTracking(false);
          }
          else
          {
            qApp->setOverrideCursor(*MOVING_CURSOR);
            canvas->setMouseTracking(true);
          }
        }
        ox = mevent->x();
        oy = mevent->y();
      }
	  else if(mevent->button() == Qt::RightButton )		//Added by AiO
	  {
		  //query the cordinates of the mouse for node
		  char curNodeTitle[1024];
		  char * curNode;
		  char *index;	//used for search
		  QMessageBox msgBox;
		  curNode = node_xy_title(mevent->x(),mevent->y());
		  if(curNode == 0) return true;
		  strncpy(curNodeTitle, curNode, 1024-1);
		  curNodeTitle[1024-1] = 0;
		  //label ends with ':'
		  //test for color characters format sym num num TEXT sym :
		  
		  // replace : -1 with 0 and use &curNodeTitle[3]
		  
		  
		  //test with popup
		  if(curNodeTitle[0] == 0x0c)
		  {
			index = strchr(curNodeTitle, ':');
			if(index == 0) goto nocolon; //test for no label but color
			--index;
			--index;
			--index;
			*index = 0;
			msgBox.setText(&curNodeTitle[3]);
			clipboard->setText(&curNodeTitle[3]);
		  }
		  else
		  {
			  nocolon:
			msgBox.setText(curNodeTitle);
		    clipboard->setText(curNodeTitle);
		  }
		  msgBox.exec();
	  }
    }
    else if ( event->type() == QEvent::MouseButtonRelease )
    {
      if ( !sticky )
        qApp->restoreOverrideCursor();
    }

    // wheel
    else if ( event->type() == QEvent::Wheel )
    {
      QWheelEvent *wevent = (QWheelEvent *) event;
      if ( (qApp->keyboardModifiers() & Qt::ControlModifier) != 0 )
      {
        wevent->accept();
        int numDegrees = wevent->delta() / 8;
        int numSteps = numDegrees / 15;
        if ( numSteps < 0)
        {
          numSteps = -numSteps;
          for ( int x = 0; x < numSteps; x++ )
            zoomOut();
        }
        else
        {
          for ( int x = 0; x < numSteps; x++ )
            zoomIn();
        }
        return true;
      }
      else
      {
        bool ret = QMainWindow::eventFilter(obj, event);
        QAbstractSlider *slider = (QAbstractSlider *) (wevent->orientation() == Qt::Vertical?
                                                       canvas->verticalScrollBar() :
                                                       canvas->horizontalScrollBar());
        int ScrollPos = slider->sliderPosition();
        bool reset_slider;
        calc_scroll(QAbstractSlider::SliderMove + 100, ScrollPos, reset_slider);
        slider->setSliderPosition(ScrollPos);
        return ret;
      }
    }

    // keyboard
    else if ( event->type() == QEvent::KeyPress )
    {
      QKeyEvent *kevent = (QKeyEvent *) event;
      int key = kevent->key();
      KeyDown(key, kevent->modifiers());
      if ( key == 0 )
      {
        event->accept();
        return true;
      }
    }
  }

  return QMainWindow::eventFilter(obj, event);
}
Exemplo n.º 11
0
void SCTPGraphDialog::on_pushButton_3_clicked()
{
    drawGraph(3);
}
Exemplo n.º 12
0
//--------------------------------------------------------------
void testApp::draw(){
    
    quadWarp.begin();
    
    ofSetColor(255);
    
    
    image.setAnchorPoint(scale*ofGetWidth()/2, scale*ofGetHeight()/2);
    image.draw(ofGetWidth()/2, ofGetHeight()/2, scale*ofGetWidth(), scale*ofGetHeight());
    
    
    ofFill();
    
    
    
    for (vector<star>::iterator iter=stars.begin(); iter!=stars.end(); iter++) {
        
        float k=128/iter->pos.z;
        
        float x = iter->pos.x*k+ofGetWidth()/2;
        float y = iter->pos.y*k+ofGetHeight()/2;
        float size = (1-iter->pos.z/MAX_DEPTH) * 5;
        //float color = 
        
        ofColor color;
        //float dist = iter->chan ? lEnv[(bufferCounter-1)%lEnv.size()] : rEnv[(bufferCounter-1)%rEnv.size()];
        //float hue = iter->chan ? 0 : 160;
        //float sat = ofMap(dist, -50, 0, 0, 255,true);
        float brt = (1-iter->pos.z/MAX_DEPTH)*255;
        
        float b = sin((ofGetElapsedTimeMillis()-iter->startTime)*iter->frequency*PI*2/1000+iter->phase);
        
        color.setHsb(130+ofRandom(60),ofRandom(50),brt*ofMap(b, -1, 1, 0.75, 1),255); // 
        //color.setBrightness(brt);
        ofSetColor(color.r,color.g,color.b);
        
        
        ofCircle(x, y, size/2);
                        
        
    }
    
    ofNoFill();
    
    if (bDebug) {
        
        for (vector<channel>::iterator iter=channels.begin();iter!=channels.end();iter++) {
            
            ofPushMatrix();
            ofTranslate(10+(VECTOR_SIZE+10)*distance(channels.begin(),iter), 0,0);
    
            ofPushMatrix();
            ofTranslate(0, 10, 0);
            drawGraph(iter->peakVec, bufferCounter, iter->thresholds, true);
            ofPopMatrix();
           
            ofPushMatrix();
            ofTranslate(0, RECT_HEIGHT+20, 0);
            drawGraph(iter->peakVec, bufferCounter, iter->thresholds, false);
            ofPopMatrix();
            
            ofPushMatrix();
            ofTranslate(0, 2*RECT_HEIGHT+30, 0);
            drawGraph(iter->envelopeVec, bufferCounter, iter->thresholds, false);
            ofPopMatrix();
                       
            ofPushMatrix();
            ofTranslate(0, 3*RECT_HEIGHT+40, 0);
            drawGraph(iter->limiterVec, bufferCounter, iter->thresholds, false);
            ofPopMatrix();
        
            ofPopMatrix();
        
            
            //ofSetColor(255*((d+1) & 0x4), 255*((d+1) & 0x2), 255*((d+1) & 0x1));
            
        }
            
        
        drawCounter++;
        
        ofSetColor(225);
        string reportString = "buffers received: "+ofToString(bufferCounter)+"\ndraw routines called: "+ofToString(drawCounter)+"\nticks: " + ofToString(soundStream.getTickCount());
        ofDrawBitmapString(reportString, 32, 589);
    }
    
    quadWarp.end();
    quadWarp.draw();
    
}
Exemplo n.º 13
0
void CrowdToolState::handleRenderOverlay(double* proj, double* model, int* view)
{
	GLdouble x, y, z;
	
	// Draw start and end point labels
	if (m_targetRef && gluProject((GLdouble)m_targetPos[0], (GLdouble)m_targetPos[1], (GLdouble)m_targetPos[2],
								  model, proj, view, &x, &y, &z))
	{
		imguiDrawText((int)x, (int)(y+25), IMGUI_ALIGN_CENTER, "TARGET", imguiRGBA(0,0,0,220));
	}
	
	char label[32];
	
	if (m_toolParams.m_showNodes)
	{
		dtCrowd* crowd = m_sample->getCrowd();
		if (crowd && crowd->getPathQueue())
		{
			const dtNavMeshQuery* navquery = crowd->getPathQueue()->getNavQuery();
			const dtNodePool* pool = navquery->getNodePool();
			if (pool)
			{
				const float off = 0.5f;
				for (int i = 0; i < pool->getHashSize(); ++i)
				{
					for (dtNodeIndex j = pool->getFirst(i); j != DT_NULL_IDX; j = pool->getNext(j))
					{
						const dtNode* node = pool->getNodeAtIdx(j+1);
						if (!node) continue;

						if (gluProject((GLdouble)node->pos[0],(GLdouble)node->pos[1]+off,(GLdouble)node->pos[2],
									   model, proj, view, &x, &y, &z))
						{
							const float heuristic = node->total;// - node->cost;
							snprintf(label, 32, "%.2f", heuristic);
							imguiDrawText((int)x, (int)y+15, IMGUI_ALIGN_CENTER, label, imguiRGBA(0,0,0,220));
						}
					}
				}
			}
		}
	}
	
	if (m_toolParams.m_showLabels)
	{
		dtCrowd* crowd = m_sample->getCrowd();
		if (crowd)
		{
			for (int i = 0; i < crowd->getAgentCount(); ++i)
			{
				const dtCrowdAgent* ag = crowd->getAgent(i);
				if (!ag->active) continue;
				const float* pos = ag->npos;
				const float h = ag->params.height;
				if (gluProject((GLdouble)pos[0], (GLdouble)pos[1]+h, (GLdouble)pos[2],
							   model, proj, view, &x, &y, &z))
				{
					snprintf(label, 32, "%d", i);
					imguiDrawText((int)x, (int)y+15, IMGUI_ALIGN_CENTER, label, imguiRGBA(0,0,0,220));
				}
			}			
		}
	}
	if (m_agentDebug.idx != -1)
	{
		dtCrowd* crowd = m_sample->getCrowd();
		if (crowd) 
		{
			for (int i = 0; i < crowd->getAgentCount(); i++)
			{
				if (m_toolParams.m_showDetailAll == false && i != m_agentDebug.idx)
					continue;
				const dtCrowdAgent* ag =crowd->getAgent(i);
				if (!ag->active)
					continue;
				const float radius = ag->params.radius;
				if (m_toolParams.m_showNeis)
				{
					for (int j = 0; j < ag->nneis; ++j)
					{
						const dtCrowdAgent* nei = crowd->getAgent(ag->neis[j].idx);
						if (!nei->active) continue;
						
						if (gluProject((GLdouble)nei->npos[0], (GLdouble)nei->npos[1]+radius, (GLdouble)nei->npos[2],
									   model, proj, view, &x, &y, &z))
						{
							snprintf(label, 32, "%.3f", ag->neis[j].dist);
							imguiDrawText((int)x, (int)y+15, IMGUI_ALIGN_CENTER, label, imguiRGBA(255,255,255,220));
						}
					}
				}
			}
		}
	}
	
	
	if (m_toolParams.m_showPerfGraph)
	{
		GraphParams gp;
		gp.setRect(300, 10, 500, 200, 8);
		gp.setValueRange(0.0f, 2.0f, 4, "ms");
		
		drawGraphBackground(&gp);
		drawGraph(&gp, &m_crowdTotalTime, 1, "Total", duRGBA(255,128,0,255));
		
		gp.setRect(300, 10, 500, 50, 8);
		gp.setValueRange(0.0f, 2000.0f, 1, "");
		drawGraph(&gp, &m_crowdSampleCount, 0, "Sample Count", duRGBA(96,96,96,128));
	}
	
}
Exemplo n.º 14
0
//================================================
void All(const int compCount = 1, const int compEff = 1, const int compRef = 1, const int savePlot = 1)
{
  const char* dataType[2] = {"New","Old"};
  // Jpsi efficiency vs. pT
  const int nPtBins         = nPtBins_pt;
  const double* ptBins_low  = ptBins_low_pt;
  const double* ptBins_high = ptBins_high_pt;
  const char** ptName       = pt_Name_pt;
  const int nCentBins       = nCentBins_pt; 
  const int* centBins_low   = centBins_low_pt;
  const int* centBins_high  = centBins_high_pt;
  const char** cent_Name    = cent_Name_pt;
  const char** cent_Title   = cent_Title_pt;
  const int kNCent = nCentBins_npart[0];

  const int nbins = nPtBins -1;
  double xbins[nbins+1];
  for(int i=0; i<nbins; i++)
    xbins[i] = ptBins_low[i+1];
  xbins[nbins] = ptBins_high[nbins];

  TList *list = new TList;

  if(compCount)
    {
      TFile *fSig[2];
      fSig[0] = TFile::Open(Form("Rootfiles/%s.JpsiYield.pt%1.1f.pt%1.1f.root",run_type,pt1_cut,pt2_cut),"read");
      fSig[1] = TFile::Open(Form("Rootfiles/old.%s.JpsiYield.pt%1.1f.pt%1.1f.root",run_type,pt1_cut,pt2_cut),"read");
      TH1F *hJpsiCounts[2][7];
      TCanvas *c = new TCanvas("comp_JpsiCounts", "comp_JpsiCounts", 1100, 500);
      c->Divide(4,2);
      TLegend *leg = new TLegend(0.3,0.3,0.6,0.6);
      leg->SetBorderSize(0);
      leg->SetFillColor(0);
      leg->SetTextFont(62);
      leg->SetTextSize(0.08);
      for(int k=0; k<7; k++)
	{
	  for(int j=0; j<2; j++)
	    {
	      if(k<5) hJpsiCounts[j][k] = (TH1F*)fSig[j]->Get(Form("Jpsi_FitYield_cent%s_weight",cent_Title[k]));
	      else    hJpsiCounts[j][k] = (TH1F*)fSig[j]->Get(Form("Jpsi_FitYield_pt%s_weight",pt_Name_npart[k-5]));
	      hJpsiCounts[j][k]->SetName(Form("%s_%d",hJpsiCounts[j][k]->GetName(),j));
	      hJpsiCounts[j][k]->SetMarkerStyle(21+j*4);
	      hJpsiCounts[j][k]->SetMarkerColor(j+1);
	      hJpsiCounts[j][k]->SetLineColor(j+1);

	      c->cd(k+1);
	      gPad->SetLogy();
	      if(k==2 || k==3) hJpsiCounts[j][k]->GetXaxis()->SetRangeUser(0.5,10);
	      if(k==4) hJpsiCounts[j][k]->GetXaxis()->SetRangeUser(0.5,6);
	      hJpsiCounts[j][k]->SetTitle(";;Counts");
	      if(k<5) hJpsiCounts[j][k]->SetXTitle("p_{T} [GeV/c]");
	      if(j==0) hJpsiCounts[j][k]->Draw();
	      else     hJpsiCounts[j][k]->Draw("sames");
	      if(k==0) leg->AddEntry(hJpsiCounts[j][k], dataType[j], "P");
	    }
	  if(k<5) TPaveText *t1 = GetTitleText(Form("%s: %s%%",run_type,cent_Name[k]),0.06);
	  else    TPaveText *t1 = GetTitleText(Form("%s: %s",run_type,pt_Title_npart[k-5]),0.06);
	  t1->Draw();
	}
      c->cd(8);
      leg->Draw();
      if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_CompAll/Compare_JpsiCounts.pdf",run_type));
    }
  if(compEff)
    {
      const char *trkEffType[6] = {"MC","Tpc","MtdMth","MuonPid","MtdTrig","TrigUnit"};
      TFile *fEff[2];
      fEff[0] = TFile::Open(Form("Rootfiles/%s.EmbJpsiEff.pt%1.1f.pt%1.1f.root",run_type,pt1_cut,pt2_cut),"read");
      fEff[1] = TFile::Open(Form("Rootfiles/old.%s.EmbJpsiEff.pt%1.1f.pt%1.1f.root",run_type,pt1_cut,pt2_cut),"read");

      const int nHistos = 6;
      TH1F *hJpsiPt[2][nHistos][nCentBins];
      TH1F *hJpsiPtEffs[2][nHistos][nCentBins];
      for(int j=0; j<2; j++)
	{
	  for(int i=0; i<nHistos; i++)
	    {
	      for(int k=0; k<nCentBins; k++)
		{
		  hJpsiPt[j][i][k] = (TH1F*)fEff[j]->Get(Form("hJpsiPt_%s_cent%s",trkEffType[i],cent_Title[k]));
		  hJpsiPt[j][i][k]->SetName(Form("%s_file%d",hJpsiPt[j][i][k]->GetName(),j));
		  hJpsiPt[j][i][k]->Rebin(4);
		  int index = i-1;
		  if(i==0) index = 0;
		  hJpsiPtEffs[j][i][k] = DivideTH1ForEff(hJpsiPt[j][i][k],hJpsiPt[j][index][k],Form("hJpsiPtEff_%s_cent%s_file%d",trkEffType[i],cent_Title[k],j));
		}
	    }
	}

      // various efficiency
      const int kcent = 0;
      for(int i=1; i<nHistos; i++)
	{
	  hJpsiPtEffs[0][i][kcent]->Divide(hJpsiPtEffs[1][i][kcent]);
	  list->Add(hJpsiPtEffs[0][i][kcent]);
	}
      TString legName2[5] = {"TPC tracking + p_{T,#mu} cut","MTD acceptance & response","Muon PID","MTD triggering","Trigger unit"};
      c = drawHistos(list,"JpsiEff_AllEffs",Form("%s: efficiencies for J/#psi ;p_{T} (GeV/c);New/Old",run_type),true,0,15,true,0.8,1.2,false,kTRUE,legName2,true,Form("%s%%",cent_Name[kcent]),0.2,0.4,0.63,0.88,kTRUE,0.04,0.035);
      if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_CompAll/Compare_JpsiEff_AllTypes.pdf",run_type));
      list->Clear();
    }

  if(compRef)
    {
      TFile *fpp[2];
      fpp[0] = TFile::Open(Form("Rootfiles/Paper.%s.Jpsi.root",run_type),"read");
      fpp[1] = TFile::Open(Form("Rootfiles/Comb2.Paper.%s.Jpsi.root",run_type),"read");
      TGraphAsymmErrors	*hppJpsiVsPt[2];
      TGraphAsymmErrors	*hppJpsiVsCent[2];
      double x, y, x1, y1;
      for(int j=0; j<2; j++)
	{
	  hppJpsiVsPt[j]   = (TGraphAsymmErrors*)fpp[j]->Get("hpp200JpsiVsPtFinalSys");
	  hppJpsiVsPt[j]->SetName(Form("%s_%d",hppJpsiVsPt[j]->GetName(),j));
	  hppJpsiVsPt[j]->SetMarkerStyle(21+j*4);
	  hppJpsiVsPt[j]->SetMarkerColor(j+1);
	  hppJpsiVsPt[j]->SetLineColor(j+1);
	  offset_x(hppJpsiVsPt[j], 0.1*j);
	  hppJpsiVsCent[j] = (TGraphAsymmErrors*)fpp[j]->Get("hpp200JpsiVsCentFinalSys");
	  hppJpsiVsCent[j]->SetName(Form("%s_%d",hppJpsiVsCent[j]->GetName(),j));
	  hppJpsiVsCent[j]->SetMarkerStyle(21+j*4);
	  hppJpsiVsCent[j]->SetMarkerColor(j+1);
	  hppJpsiVsCent[j]->SetLineColor(j+1);
	  offset_x(hppJpsiVsCent[j], 0.1*j);
	}

      for(int j=0; j<2; j++)
	{
	  for(int ipoint=0; ipoint<hppJpsiVsPt[j]->GetN(); ipoint++)
	    {
	      hppJpsiVsPt[1]->GetPoint(ipoint, x, y);
	      hppJpsiVsPt[j]->GetPoint(ipoint, x1, y1);
	      hppJpsiVsPt[j]->SetPoint(ipoint, x1, y1/y);
	      hppJpsiVsPt[j]->SetPointError(ipoint, hppJpsiVsPt[j]->GetErrorXlow(ipoint), hppJpsiVsPt[j]->GetErrorXhigh(ipoint),
					    hppJpsiVsPt[j]->GetErrorYlow(ipoint)/y, hppJpsiVsPt[j]->GetErrorYhigh(ipoint)/y);
	    }

	  for(int ipoint=0; ipoint<hppJpsiVsCent[j]->GetN(); ipoint++)
	    {
	      hppJpsiVsCent[1]->GetPoint(ipoint, x, y);
	      hppJpsiVsCent[j]->GetPoint(ipoint, x1, y1);
	      hppJpsiVsCent[j]->SetPoint(ipoint, x1, y1/y);
	      hppJpsiVsCent[j]->SetPointError(ipoint, hppJpsiVsCent[j]->GetErrorXlow(ipoint), hppJpsiVsCent[j]->GetErrorXhigh(ipoint),
					    hppJpsiVsCent[j]->GetErrorYlow(ipoint)/y, hppJpsiVsCent[j]->GetErrorYhigh(ipoint)/y);
	    }
	}
      hppJpsiVsPt[1]->GetYaxis()->SetRangeUser(0.5,1.5);
      c = drawGraph(hppJpsiVsPt[1],"Ratio of pp reference;p_{T} [GeV/c];Ratio");
      hppJpsiVsPt[0]->Draw("samesPEZ");
      TLegend *leg = new TLegend(0.6,0.7,0.8,0.85);
      leg->SetBorderSize(0);
      leg->SetFillColor(0);
      leg->SetTextFont(62);
      leg->SetTextSize(0.035);
      leg->AddEntry(hppJpsiVsPt[0], "(STAR+PHENIX)/STAR", "P");
      leg->AddEntry(hppJpsiVsPt[1], "STAR/STAR", "P");
      leg->Draw();
      if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_CompAll/Compare_ppRefVsPt.pdf",run_type));

      hppJpsiVsCent[1]->GetXaxis()->SetRangeUser(-0.5,6.5);
      hppJpsiVsCent[1]->GetYaxis()->SetRangeUser(0.5,1.5);
      c = drawGraph(hppJpsiVsCent[1],"Ratio of pp reference;;Ratio");
      hppJpsiVsCent[0]->Draw("samesPEZ");
      leg->Draw();
      if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_CompAll/Compare_ppRefVsCent.pdf",run_type));
    }
}
Exemplo n.º 15
0
void jdrawHkPlots( const Char_t* infn, const Char_t* outfn,
					std::string skipEvts, const Int_t cwid=1400, 
					const Int_t chit=1000 ) 
{
	std::string sfin;
	std::string evtNum;
	size_t loc;
	sfin = infn;

	loc = sfin.find_last_of( "/" );

	if( loc >= 0 )
	{
		sfin.erase( sfin.begin(), sfin.begin() + loc + 1 );

		for( int i = 0; i < sfin.size(); i++ )
			if( isdigit(sfin[i]) )
				 evtNum += sfin[i];
	}
	else
	{
		evtNum = "1";
	}

	gSystem->Setenv("TZ","UTC");
	gStyle->SetOptStat( 1101 );
	gStyle->SetTimeOffset( 0 );   
	gStyle->SetPadTickY( 1 );
	gStyle->SetPadTickX( 1 );
	gStyle->SetPadLeftMargin( 0.11 );
	gStyle->SetPadRightMargin( 0.03 );
//	gStyle->SetPadBottomMargin( 0.2 );

   inf = TFile::Open(infn);
   if ((inf==0) || (inf->IsZombie())) {
      Printf("Could not open [%s]",infn);
      return;
   }
   

   		getGraph( gWind,     	"gWind" );
   		getGraph( gSol,      	"gSol" );
   		getGraph( gWindSol,		"gWindSol" );
   		getGraph( gStation,   	"gStation" );
   		getGraph( gTemp1,    	"gTemp1" );
   		getGraph( gTemp2,    	"gTemp2" );

		getGraph( gWindV,     	"gWindV" );
		getGraph( gSolV,       	"gSolV" );
		getGraph( gWindSolV,  	"gWindSolV" );
		getGraph( gStationVp,  	"gStationVp" );

		getGraph( gWindSolGND,	"gWindSolGND" );
		getGraph( gStationVn,  	"gStationVn" );

		getGraph( gWinddV,     	"gWinddV" );
		getGraph( gSoldV,       "gSoldV" );
		getGraph( gWindSoldV,  	"gWindSoldV" );
		getGraph( gStationdV,  	"gStationdV" );

		getGraph( gAnem, "gAnem" );
	

   	c1 = new TCanvas("c1","c1 - currents",cwid,chit);
   	c1->Divide(1,3);
   	c1->cd( 1 );
   	drawGraph(gSol,  "Solar Current (A)");
   	c1->cd( 2 );
	drawGraph( gSoldV, "Solar Voltage Divider Drop (V)" ); 
   	c1->cd( 3 );
	drawGraph( gSolV, "Solar Voltage High (V)" );
   	c1->Update();

   	c2 = new TCanvas("c2","c2 - others",cwid,chit);
   	c2->Divide(1,4);
   	c2->cd( 1 );
   	drawGraph(gWindSol, "Wind & Solar Current (A)");
   	c2->cd( 2 );
   	drawGraph(gWindSoldV, "Wind & Solar Voltage Drop (V)");
	c2->cd( 3 );
   	drawGraph(gWindSolV, "Wind & Solar Voltage High (V)");
	c2->cd( 4 );
	drawGraph( gWindSolGND, "Voltage Divider Common Ground (V)" );
   	c2->Update();

	c3 = new TCanvas( "c3", "c3", cwid, chit );
	c3->Divide( 1, 3 );
	c3->cd( 1 );
	drawGraph(gWind, "Wind Current (A)");
	c3->cd( 2 );
	drawGraph( gWinddV, "Wind Voltage Divider Drop (V)" );
	c3->cd( 3 );
	drawGraph( gWindV, "Wind Voltage High (V)" );
   	c3->Update();

	c4 = new TCanvas( "c4", "c4", cwid, chit );
	c4->Divide( 1, 3 );
	c4->cd( 1 );
   	drawGraph( gStation, "Station Current (A)" );
	c4->cd( 2 );
   	drawGraph( gStationVn, "Station Voltage / 2 (V)" );
	c4->cd( 3 );
   	drawGraph( gStationdV, "Station Voltage Drop (V)" );		
   	c4->Update();

	c5 = new TCanvas( "c5", "c5", cwid, chit );
	c5->Divide( 1, 3 );
	c5->cd( 1 );
   	drawGraph(gTemp1, "Temp 1 - Solar (C)");
	c5->cd( 2 );
   	drawGraph(gTemp2, "Temp 2 - Battery (C)");
	c5->cd( 3 );
	drawGraph( gAnem, "Wind Speed in Knots" );
   	c5->Update();

//	c6 = new TCanvas( "c6", "c6", cwid, chit );
		

    TFile* fCommon = new TFile( outfn, "UPDATE" );

	fCommon->cd( );

	gWind->Write( "", TObject::kOverwrite );
	gWindV->Write( "", TObject::kOverwrite );
	gWinddV->Write( "", TObject::kOverwrite );
	gSol->Write( "", TObject::kOverwrite );
	gSolV->Write( "", TObject::kOverwrite );
	gSoldV->Write( "", TObject::kOverwrite );
	gWindSol->Write( "", TObject::kOverwrite );	
	gWindSolV->Write( "", TObject::kOverwrite );	
	gWindSoldV->Write( "", TObject::kOverwrite );	
	gWindSolGND->Write( "", TObject::kOverwrite );	
	gStation->Write( "", TObject::kOverwrite );
	gStationVn->Write( "", TObject::kOverwrite );
	gStationdV->Write( "", TObject::kOverwrite );
	gTemp1->Write( "", TObject::kOverwrite );
	gTemp2->Write( "", TObject::kOverwrite );
	gAnem->Write( "", TObject::kOverwrite );

	fCommon->Write( );
	fCommon->Close( );

	Char_t* dir = "CPU+AFAR+MBED+ATWD+AMPS";
	c1->SaveAs( Form("~/%s/c1.pdf", dir) );
	c2->SaveAs( Form("~/%s/c2.pdf", dir) );
	c3->SaveAs( Form("~/%s/c3.pdf", dir) );
	c4->SaveAs( Form("~/%s/c4.pdf", dir) );
	c5->SaveAs( Form("~/%s/c5.pdf", dir) );
//	c6->SaveAs( Form("~/%s/c6.pdf", dir) );

/*
	if( evtNum.size() != 0 )
	{
		c2->SaveAs( Form("voltage_%s.pdf", evtNum.c_str()) );
	}
*/
}
Exemplo n.º 16
0
void ImplemGraphviz::update()
{
    drawGraph();
}
void draw_clouds_profiles()
{
    //        gROOT->ProcessLine(".L ../utils.C");
    //        gROOT->ProcessLine(".L AliLRCFit.cxx");
    TFile *f[8];

    //    f[0] = new TFile( "output_classesByV0M_LHC10h.root" );
    //    f[0] = new TFile( "output_classesByV0M_LHC10h_c10_5_1.root" );
        f[0] = new TFile( "output_classesByV0M_LHC10h_c10_5_25_1_05.root" );
//    f[0] = new TFile( "output_classesByV0M_LHC11h_FemtoPlus_c10_5_CUT_OUTLIERS.root" );

//    f[0] = new TFile( "output_classesByV0M_LHC15o_fieldMM_c10_5_CUT_OUTLIERS.root" );
//    f[0] = new TFile( "output_classesByV0M_LHC15o_fieldPP_c10_5_CUT_OUTLIERS.root" );

//    const int nCW = 2; //nCentrWidths
//    const double cWidths[nCW] = { 10, 5 }; //width of the centrality bins
//    const double cStep[nCW] = { 5, 2.5 }; //centrality bins step
//    const int nCentrBins[nCW] = { 17, 35 }; //n centrality bins

    //    const int nCW = 3; //nCentrWidths
    //    const double cWidths[nCW] = { 10, 5, 1.0 }; //width of the centrality bins
    //    const double cStep[nCW] = { 5, 2.5, 1.0 }; //centrality bins step
    //    const int nCentrBins[nCW] = { 17, 35, 90 }; //n centrality bins

    //    const int nCW = 4; //nCentrWidths
    //    const double cWidths[nCW] = { 10, 5, 1.0, 0.5 }; //width of the centrality bins
    //    const double cStep[nCW] = { 5, 2.5, 1.0, 1.0 }; //centrality bins step
    //    const int nCentrBins[nCW] = { 17, 35, 90, 90 }; //n centrality bins

        const int nCW = 5; //nCentrWidths
        const double cWidths[nCW] = { 10, 5, 2.5, 1.0, 0.5 }; //width of the centrality bins
        const double cStep[nCW] = { 5, 2.5,  2.5, 1.0, 1.0 }; //centrality bins step
        const int nCentrBins[nCW] = { 17, 35, 36,  90, 90 }; //n centrality bins


    TH2D *hist2D;//[200][3];
    TProfile *profile;//[200][3];
    int cW = 2;
    int etaW = 1;
    int phiW = 0;

    const int kCorrType = 1; //0-NN, 1-PtPt, 2-PtN

    TCanvas *canv_tmp_for_fit = new TCanvas("canv_tmp_for_fit","canv_tmp_for_fit",50,50,300,300 );
    TCanvas *canv_2D_clouds = new TCanvas("canv_2D_clouds","canv_2D_clouds",150,250,1400,600 );
    tuneCanvas(canv_2D_clouds);
    canv_2D_clouds->Divide(2,1);

    gStyle->SetOptStat( kFALSE );

    TGraph *grFromFit2D = new TGraph;

    bool firstDraw = true;
    //    for ( int cBin = 0; cBin < nCentrBins[cW]; cBin++ )
    for ( int cBin = nCentrBins[cW]-1; cBin >= 0; cBin-- )
    {
                if (cBin%2!=0)
                    continue;

        //        cout << "cBin=" << cBin << endl;

        float cBinMin = cStep[cW] * cBin;
        float cBinMax = cWidths[cW] + cStep[cW] * cBin;

        // ##### pad 1 - clouds
        tunePad( canv_2D_clouds->cd(1) );
        if ( kCorrType == 0 )
        {
            hist2D = (TH2D*)f[0]->Get( Form("hist2D_NN_c%.1f-%.1f_etaW_%d_phiW_%d", cBinMin, cBinMax, etaW, phiW) );
            hist2D->SetTitle( "");
            hist2D->GetXaxis()->SetTitle( "N_{ch} Forward");
            hist2D->GetYaxis()->SetTitle( "N_{ch} Backward");
            hist2D->GetXaxis()->SetRangeUser(0,650);
            hist2D->GetYaxis()->SetRangeUser(0,650);
        }
        else if ( kCorrType == 1 )
        {
            hist2D = (TH2D*)f[0]->Get( Form("hist2D_PtPt_c%.1f-%.1f_etaW_%d_phiW_%d", cBinMin, cBinMax, etaW, phiW) );
            hist2D->SetTitle( "");
            hist2D->GetXaxis()->SetTitle( "#LTp_{T}#GT Forward");
            hist2D->GetYaxis()->SetTitle( "#LTp_{T}#GT Backward");
        }     hist2D->SetMarkerColor(kOrange-9+cBin);
        tuneHist2D_onPad(hist2D);
        hist2D->GetXaxis()->CenterTitle();
        hist2D->GetYaxis()->CenterTitle();

        //        removeBinsWithFewEntries(hist2D);

        hist2D->DrawCopy( firstDraw ? "" : "same" );

        // ##### pad 2 - profiles
        tunePad( canv_2D_clouds->cd(2) );
        profile = hist2D->ProfileX();    //(TProfile*)f[0]->Get( Form("hist2D_c%.1f-%.1f_etaW_%d_phiW_%d_pfx", cBinMin, cBinMax, etaW, phiW) );
        if ( kCorrType == 0 )
        {
            profile->SetTitle( "");
            profile->GetYaxis()->SetTitle( "#LTN_{ch}#GT Backward");
            profile->GetXaxis()->SetRangeUser(0,650);
            profile->GetYaxis()->SetRangeUser(0,650);
        }
        else if ( kCorrType == 1 )
        {
            profile->SetTitle( "");
            profile->GetYaxis()->SetTitle( "#LT#LTp_{T}#GT#GT Backward");
        }
        profile->SetLineColor(kOrange-9+cBin);
        profile->SetMarkerStyle(7);
        tuneProfile_onPad( profile );
        profile->GetYaxis()->CenterTitle();

        deleteProfileEmptyBinErrors(profile);


        canv_tmp_for_fit->cd();
        profile->Fit("pol1","Q");//,"",0.25,1.2);//,"N");
        canv_2D_clouds->cd(2);

        TF1 *fit = profile->GetFunction("pol1");
        Double_t p0 = fit->GetParameter(0);
        Double_t p1 = fit->GetParameter(1);
        grFromFit2D->SetPoint(grFromFit2D->GetN(), (cBinMax+cBinMin)/2, p1);

        double meanX = hist2D->ProjectionX()->GetMean();
        double rmsX = hist2D->ProjectionX()->GetRMS();
        fit->SetRange( meanX-3*rmsX, meanX+3*rmsX );
        fit->SetLineColorAlpha( kRed, 0.6 );

        fit->Draw("same");

        profile->DrawCopy( firstDraw ? "" : "same" );



        firstDraw = false;
    }

    TGraphErrors *grByFormula; /*[cW][etaW]*/
    if ( kCorrType == 0 )
    {
        grByFormula = (TGraphErrors*)f[0]->Get( Form( "grNN_c%d_eta%d", cW, etaW ) );
    }
    else if ( kCorrType == 1 )
    {
        grByFormula = (TGraphErrors*)f[0]->Get( Form( "grPtPt_c%d_eta%d", cW, etaW ) );
    }



    TCanvas *canv_GrCoeff = new TCanvas("canv_GrCoeff","canv_GrCoeff",20,150,900,700 );
    grByFormula->Draw("APL");

    grFromFit2D->SetLineColor(kRed);
    grFromFit2D->DrawClone("PL");



    return;

    TGraphErrors *gr[10][10];
    for ( int cW = 0; cW < 2; cW++ )
        for ( int etaW = 0; etaW < 3; etaW++ )
            gr[cW][etaW] = (TGraphErrors*)f[0]->Get( Form( "grPtPt_c%d_eta%d", cW, etaW ) );



    drawGraph( gr[1][0], 24, kBlack, "APL" );
    drawGraph( gr[0][0], 20, kBlack, "PL" );

    //    drawGraph( gr[1][1], 24, kBlue, "PL" );
    //    drawGraph( gr[0][1], 20, kBlue, "PL" );

    //    drawGraph( gr[1][2], 24, kGreen, "PL" );
    //    drawGraph( gr[0][2], 20, kGreen, "PL" );

    ////    drawGraph( gr[6], 24, kRed, "PL" );
    //    drawGraph( gr[7], 20, kRed, "PL" );



    f[1] = new TFile( "output_histos_graphs_LHC15o_fieldMM.root" );
    TGraphErrors *grMM[10][10];
    for ( int cW = 0; cW < 2; cW++ )
        for ( int etaW = 0; etaW < 3; etaW++ )
            grMM[cW][etaW] = (TGraphErrors*)f[1]->Get( Form( "grPtPt_c%d_eta%d", cW, etaW ) );

    drawGraph( grMM[1][0], 24, kGreen, "PL" );
    drawGraph( grMM[0][0], 20, kGreen, "PL" );

    //    drawGraph( grMM[1][1], 24, kRed, "PL" );
    //    drawGraph( grMM[0][1], 20, kRed, "PL" );

    //    drawGraph( grMM[1][2], 24, kGreen, "PL" );
    //    drawGraph( grMM[0][2], 20, kGreen, "PL" );




    //    gROOT->ProcessLine( ".q");
}
Exemplo n.º 18
0
void Canvas::resizeEvent(QResizeEvent *event)
{
    pixmap = QPixmap(event->size());
    drawGraph(_pointsNumber);
}
void draw_graphs_ptpt_LHC10h_V0M_ZDCZEM_CL1()
{
    gROOT->ProcessLine(".L ../utils.C");

    TFile *f[8];

    f[0] = new TFile( "output_classesByV0M_LHC10h_c10_5_25_1_05_CUT_OUTLIERS.root" );

    f[1] = new TFile( "output_classesByZDCZEM_LHC10h_c10_5_25_1_05.root" );
    f[2] = new TFile( "output_classesByCL1_LHC10h_c10_5_25_1_05.root" );


    TGraphErrors *gr[10][10][10];
    for ( int cW = 0; cW < 2; cW++ )
        for ( int etaW = 0; etaW < 3; etaW++ )
        {
            gr[0][cW][etaW] = (TGraphErrors*)f[0]->Get( Form( "grPtPt_c%d_eta%d", cW, etaW ) );

            gr[1][cW][etaW] = (TGraphErrors*)f[1]->Get( Form( "grPtPt_c%d_eta%d", cW, etaW ) );
            gr[2][cW][etaW] = (TGraphErrors*)f[2]->Get( Form( "grPtPt_c%d_eta%d", cW, etaW ) );

        }


    int etaId = 0;

    TCanvas *canv_graphs = new TCanvas("canv_graphs","canv_graphs",150,250,700,600 );
    tuneCanvas(canv_graphs);

    tuneGraphAxisLabels(gr[0][0][etaId]);

    //LHC10h
    drawGraph( gr[0][0][etaId], 20, kBlack, "APL" );
//        drawGraph( gr[0][1][etaId], 24, kBlack, "PL" );


    drawGraph( gr[1][0][etaId], 20, kBlue, "PL" );
//        drawGraph( gr[1][1][etaId], 24, kBlue, "PL" );

    drawGraph( gr[2][0][etaId], 20, kOrange+9, "PL" );
//        drawGraph( gr[2][1][etaId], 24, kOrange+9, "PL" );


    TLegend *leg = new TLegend(0.65,0.65,0.999,0.95);
    leg->SetFillColor(kWhite);
    leg->SetFillStyle(0);
    leg->SetBorderSize(0);

    leg->AddEntry(gr[0][0][etaId], "V0M", "p");
    leg->AddEntry(gr[1][0][etaId], "ZDCvsZEM", "p");
    leg->AddEntry(gr[2][0][etaId], "CL1", "p");

    leg->Draw();

    //    graphCorr[0][etaId]->GetYaxis()->SetRangeUser( 0, 0.92 );

    //    TLatex *tex = new TLatex(0.4,0.89, "#eta_{gap}=0.8, #delta#eta=0.4");
    TLatex *tex = new TLatex(0.5,0.3, "#eta_{gap}=0.8, #delta#eta=0.4");
    drawTex(tex, 0.045);



    //    gROOT->ProcessLine( ".q");
}
Exemplo n.º 20
0
void Canvas::setPointsNumber(int newValue)
{
    _pointsNumber = newValue;
    drawGraph(_pointsNumber);
}
Exemplo n.º 21
0
void drawDataTask(void const * argument)
{
	uint16_t cntr = 0;
	bool point = true;
	while (true)
	{
		if (systemMode == ACTIVE && display.IsSleep())
		{
			display.sleepMode(false);
		}
		else if (systemMode == SLEEP && !display.IsSleep())
		{
			display.sleepMode(true);
		}
		if (sensorOk && !display.IsSleep())
		{
			uint16_t co2level = co2sensor.GetCurrentCO2Level();
			if (co2level >= 2500 && (co2level != 5000))
			{
				switchSystemMode(ACTIVE);	
			}
			display.clearScreen();
			if (co2level > 0)
			{ 
				if (graphMode == STATISTICS)
				{
					display.printf(20, 56, "MAX CO2 LEVELS");
					display.printf(0, 43, "TOTAL: %d ppm", co2sensor.GetMaxCO2Level());
					display.printf(0, 33, "PER DAY: %d ppm", co2sensor.GetMaxPerDayCO2Level());
					display.printf(0, 23, "PER HOUR: %d ppm", co2sensor.GetMaxPerHourCO2Level());
					display.printf(0, 13, "UPTIME: %d s.", co2sensor.GetUptime());
				}
				else
				{
					drawGraph(12);
				}

				if (isUsbSerialActive)
				{
					display.printf(100, 0, "U");	
				}
				display.printf(0, 0, "CO2:%d  T:%d%cC", co2level, co2sensor.GetCurrentTemperature(), 248);
				if (graphMode == SECONDS)
				{
					display.printf(109, 0, "SEC");	
				}
				else if (graphMode == MINUTES)
				{
					display.printf(109, 0, "MIN");
				}
				else if (graphMode == HOURS)
				{
					display.printf(109, 0, "HRS");
				}
				else if (graphMode == STATISTICS)
				{
					display.printf(109, 0, "STA");
				}
				if (cntr)
				{
					cntr = 0;
				}
			}
			else
			{
				display.printf(12, 50, logoStr);
				display.drawLine(0, 44, 127, 44);
				display.printf(12, 30, "SENSOR PREHEATING ");
				display.printf(12, 5, "C: %ds.", cntr / 2);
				display.printf(80, 5, "E: %d", co2sensor.GetErrorsCount());
				cntr++;
			}
			display.drawPixel(0, 63, point);
			display.drawPixel(1, 63, point);
			display.drawPixel(0, 62, point);
			display.drawPixel(1, 62, point);
			point = !point;
			display.drawFramebuffer();
		}

		osDelay(500);
	}
}
Exemplo n.º 22
0
void CFrmSettings::okSlot()
{
    saveContent();
    this->done(drawGraph());
}
Exemplo n.º 23
0
void renderDemo(struct NVGcontext* vg, float mx, float my, float width, float height, float t, int blowup, struct DemoData* data)
{
	float x,y,popx,popy;

	drawEyes(vg, width-800, height-240, 150, 100, mx, my, t);
	drawParagraph(vg, width - 550, 35, 150, 100, mx, my);
	drawGraph(vg, 0, height/2, width, height/2, t);

	drawColorwheel(vg, width-350, 35, 250.0f, 250.0f, t);

	// Line joints
	drawLines(vg, 50, height-50, 600, 35, t);

	nvgSave(vg);
	if (blowup)
	{
		nvgRotate(vg, sinf(t*0.3f)*5.0f/180.0f*NVG_PI);
		nvgScale(vg, 2.0f, 2.0f);
	}

	// Line width.
	drawWidths(vg, width-50, 35, 30);

	// Widgets.
	x = width-520; y = height-420;
	drawWindow(vg, "Widgets `n Stuff", x, y, 300, 400);
	x += 10;
	y += 45;
	drawSearchBox(vg, "Search", x,y,280,25);
	y += 40;
	drawDropDown(vg, "Effects", x,y,280,28);
	popx = x + 300;
	popy = y + 14;
	y += 45;

	// Form
	drawLabel(vg, "Login", x,y, 280,20);
	y += 25;
	drawEditBox(vg, "Email",  x,y, 280,28);
	y += 35;
	drawEditBox(vg, "Password", x,y, 280,28);
	y += 38;
	drawCheckBox(vg, "Remember me", x,y, 140,28);
	drawButton(vg, ICON_LOGIN, "Sign in", x+138, y, 140, 28, nvgRGBA(0,96,128,255) );
	y += 45;

	// Slider
	drawLabel(vg, "Diameter", x,y, 280,20);
	y += 25;
	drawEditBoxNum(vg, "123.00", "px", x+180,y, 100,28);
	drawSlider(vg, 0.4f, x,y, 170,28);
	y += 55;

	drawButton(vg, ICON_TRASH, "Delete", x, y, 160, 28, nvgRGBA(128,16,8,255) );
	drawButton(vg, 0, "Cancel", x+170, y, 110, 28, nvgRGBA(0,0,0,0) );

	// Thumbnails box
	drawThumbnails(vg, popx, popy-30, 160, 300, data->images, 12, t);

	// Blendish
	drawBlendish(vg, 10, 62, 600.0f, 420.0f, t);

	nvgRestore(vg);
}
Exemplo n.º 24
0
void ovenGraphScreen::drawScreen (void) {
    myBui.clearAndPrintHeader ("Skyler's Reflow Oven");

    drawGraph ();
    
    x2 = _LEFT + 1;
    y2 = _TOP + _HEIGHT - 1;
    
    updateButtons ();
    
    myBui.btns.drawAllBtns ();
    
    myBui.myLCD.setColor (VGA_WHITE);
    myBui.myLCD.setBackColor (VGA_BLACK);
    myBui.printCenter ("Time (seconds)", _LEFT + (_WIDTH / 2), _TOP + _HEIGHT + 4 + myBui.myLCD.getFontYsize ());
    
    myBui.myLCD.setColor (VGA_RED);
    myBui.myLCD.setBackColor (VGA_BLACK);
    myBui.myLCD.print ("Temperature (C)", _LEFT - 4 - myBui.myLCD.getFontYsize (), _TOP + (_HEIGHT / 2) - (7 * myBui.myLCD.getFontXsize ()), 90);
    
    myBui.myLCD.setColor (VGA_WHITE);
    myBui.myLCD.setBackColor (VGA_BLACK);
    myBui.myLCD.print (&(tBoxStrings[TEMPERATURE_T_BOX][0]), _LEFT, 412);
    myBui.textBox.printTextBox (TEMPERATURE_T_BOX, (float)oven.temp, 2);
    
    myBui.myLCD.setColor (VGA_WHITE);
    myBui.myLCD.setBackColor (VGA_BLACK);
    myBui.myLCD.print (&(tBoxStrings[RUNTIME_T_BOX][0]), _LEFT, 452);
    myBui.textBox.printTextBox (RUNTIME_T_BOX, (int32_t)oven.runtime);
    
    myBui.myLCD.setColor (VGA_WHITE);
    myBui.myLCD.setBackColor (VGA_BLACK);
    myBui.myLCD.print (&(tBoxStrings[SETPOINT_T_BOX][0]), _LEFT + 110, 412);
    myBui.textBox.printTextBox (SETPOINT_T_BOX, (float)oven.temp, 2);
    
    myBui.myLCD.setColor (VGA_WHITE);
    myBui.myLCD.setBackColor (VGA_BLACK);
    myBui.myLCD.print (&(tBoxStrings[STAGE_T_BOX][0]), _LEFT + 110, 452);
    myBui.textBox.printTextBox (STAGE_T_BOX, "Off");
    
    myBui.myLCD.setColor (VGA_WHITE);
    myBui.myLCD.setBackColor (VGA_BLACK);
    myBui.myLCD.print (&(tBoxStrings[PREHEAT_T_BOX][0]), _BOX_LEFT, 30);
    myBui.myLCD.print (&(units[SLOPE_UNITS][0]), _BOX_LEFT, 45);
    myBui.textBox.printTextBox (PREHEAT_T_BOX, oven.reflowVars.preheatRamp, 1);
    
    myBui.myLCD.setColor (VGA_WHITE);
    myBui.myLCD.setBackColor (VGA_BLACK);
    myBui.myLCD.print (&(tBoxStrings[SOAK_TEMP_T_BOX][0]), _BOX_LEFT, 95);
    myBui.myLCD.print (&(units[TEMP_UNITS][0]), _BOX_LEFT, 110);
    myBui.textBox.printTextBox (SOAK_TEMP_T_BOX, oven.reflowVars.soakTemp, 1);
    
    myBui.myLCD.setColor (VGA_WHITE);
    myBui.myLCD.setBackColor (VGA_BLACK);
    myBui.myLCD.print (&(tBoxStrings[SOAK_TIME_T_BOX][0]), _BOX_LEFT, 160);
    myBui.myLCD.print (&(units[TIME_UNITS][0]), _BOX_LEFT, 175);
    myBui.textBox.printTextBox (SOAK_TIME_T_BOX, (int32_t)oven.reflowVars.soakTime);
    
    myBui.myLCD.setColor (VGA_WHITE);
    myBui.myLCD.setBackColor (VGA_BLACK);
    myBui.myLCD.print (&(tBoxStrings[RAMP_T_BOX][0]), _BOX_LEFT, 225);
    myBui.myLCD.print (&(units[SLOPE_UNITS][0]), _BOX_LEFT, 240);
    myBui.textBox.printTextBox (RAMP_T_BOX, oven.reflowVars.ramp, 1);
    
    myBui.myLCD.setColor (VGA_WHITE);
    myBui.myLCD.setBackColor (VGA_BLACK);
    myBui.myLCD.print (&(tBoxStrings[PEAK_TEMP_T_BOX][0]), _BOX_LEFT, 290);
    myBui.myLCD.print (&(units[TEMP_UNITS][0]), _BOX_LEFT, 305);
    myBui.textBox.printTextBox (PEAK_TEMP_T_BOX, oven.reflowVars.peakTemp, 1);
    
    myBui.myLCD.setColor (VGA_WHITE);
    myBui.myLCD.setBackColor (VGA_BLACK);
    myBui.myLCD.print (&(tBoxStrings[PEAK_TIME_T_BOX][0]), _BOX_LEFT, 355);
    myBui.myLCD.print (&(units[TIME_UNITS][0]), _BOX_LEFT, 370);
    myBui.textBox.printTextBox (PEAK_TIME_T_BOX, (int32_t)oven.reflowVars.peakTime);
    
    myBui.myLCD.setColor (VGA_GRAY);
    myBui.myLCD.drawLine (145, 0, 145, 480);
}
Exemplo n.º 25
0
 void TopologicalMapper::drawRegionGraph(cv::Mat &image,
     uint32_t orig_x, uint32_t orig_y) {
   drawGraph(image, region_graph_, orig_x, orig_y);
 }
Exemplo n.º 26
0
void SOINN::learn(vector<Node> inputs)
{
    input_nodes = inputs;

    initialize();

    // 入力パターンを学習
    for(int i = 0; i < (int)input_nodes.size(); ++i)
    {
        Node input = input_nodes.at(i);

        // 勝者ノードを探す
        vector<Node> winner_nodes = getWinnerNodes(input);

        Node first_winner = winner_nodes.at(0);         // 勝者ノード
        Node second_winner = winner_nodes.at(1);        // 第二勝者ノード

        double first_simular = getSimularThreshold(first_winner);
        double second_simular = getSimularThreshold(second_winner);

        double input_first_dist = getNodeDistance(input, first_winner);
        double input_second_dist = getNodeDistance(input, second_winner);

        // 勝者ノードもしくは第二勝者ノードの類似度閾値の外側なら
        if(input_first_dist > first_simular ||
           input_second_dist > second_simular)
        {
            // 新規ノードとして追加
            soinn.addNode(input.position);
        }

        // 勝者・第二勝者ノードいずれかの類似度閾値の内側の場合
        if(input_first_dist <= first_simular &&
           input_second_dist <= second_simular)
        {
            // 勝者ノードと第二勝者ノードの間にエッジが無いなら
            if(!soinn.hasEdge(first_winner.id, second_winner.id))
            {
                // エッジを追加
                soinn.addEdge(first_winner.id, second_winner.id);
            }

            // エッジの年齢を0にリセット
            setEdgeAge(first_winner.id, second_winner.id, 0);

            // 勝者ノードにつながる全エッジの年齢をインクリメント
            incAllEdgeAge(first_winner.id);

            // 位置ベクトルの更新
            updatePosition(first_winner, input, 1.0, first_winner.win_times);

            // 勝者ノードの関連ノードの位置ベクトルの更新
            updatePositionRelated(first_winner, input, 1.0 / 100.0);

            // 年老いたエッジを削除
            eraseOldEdges();

            // 消されたエッジでつながれていたノードを調べる
            for(int j = 0; j < (int)erased_edges.size(); ++j)
            {
                Edge e = erased_edges.at(j);

                // 関連ノードがなければ削除
                eraseIndependentNode(e.node_ids.first);
                eraseIndependentNode(e.node_ids.second);
            }
        }

        // 入力パターン数がnode_erase_ageの倍数
        if((i + 1) % node_erase_age == 0 ||
           (i + 1) == (int)input_nodes.size())
        {
            eraseNoizyNode();
        }
    }
    drawGraph();
}
Exemplo n.º 27
0
int main()
{
	int notRST	= TRUE;
	int LDCK	= FALSE;
	int Dbus [4]= {FALSE, FALSE, FALSE, FALSE};
	/*почему в массиве Dbus 4 элементов? Да потому что если сделать их три, то notEMPTY тоже меняет значение
	я абсолютно не понимаю причину этого. Можете конечно поэксперементировать, но не думаю что у вас что-то выйдет.*/
	int UNCK	= FALSE;
	int Qbus [4]= {FALSE, FALSE, FALSE, FALSE};
	//почему снова 4 элементов? Да на всякий случай! см. комментарий выше
	int notEMPTY= TRUE;
	int notFULL = TRUE;

	//массив, который указывает на расположение переменных с очередью
	int queue [16] [3];

	//две переменные, в которых будет храниться номер, на котором остановилась очередь вывода и ввода
	int loadNum = 0;
	int unloadNum = 0;
	


	int notRSTgraph	[30];
	int LDCKgraph	[30];
	int Dgraph  [4] [30];
	int UNCKgraph	[30];
	int Qgraph  [4] [30];
	int notEMPTYgraph[30];
	int notFULLgraph[30];



	



	/********************************************
	*****         рисование графиков         ****
	********************************************/
	
	for (int period = 0; TRUE; period++) {

	system (cleanScreen);

		//выполняется главная функция
		fifo (&Dbus, LDCK, &Qbus, UNCK, &queue, &loadNum, &unloadNum);


	printf("%s%i", "     notRST ", notRST);	drawGraph(notRST, period, &notRSTgraph);
	printf("%s%i", "       LDCK ", LDCK);	drawGraph(LDCK, period, &LDCKgraph);
	printf("%s%i", "         D0 ", Dbus[0]);	drawGraph(Dbus[0], period, &Dgraph[0]);
	printf("%s%i", "         D1 ", Dbus[1]);	drawGraph(Dbus[1], period, &Dgraph[1]);
	printf("%s%i", "         D2 ", Dbus[2]);	drawGraph(Dbus[2], period, &Dgraph[2]);
	printf("%s%i", "         D3 ", Dbus[3]);	drawGraph(Dbus[3], period, &Dgraph[3]);
	printf("%s%i", "       UNCK ", UNCK);	drawGraph(UNCK, period, &UNCKgraph);
	printf("%s%i", "         Q0 ", Qbus[0]);	drawGraph(Qbus[0], period, &Qgraph[0]);
	printf("%s%i", "         Q1 ", Qbus[1]);	drawGraph(Qbus[1], period, &Qgraph[1]);
	printf("%s%i", "         Q2 ", Qbus[2]);	drawGraph(Qbus[2], period, &Qgraph[2]);
	printf("%s%i", "         Q3 ", Qbus[3]);	drawGraph(Qbus[3], period, &Qgraph[3]);
	printf("%s%i", "   notEMPTY ", notEMPTY);	drawGraph(notEMPTY, period, &notEMPTYgraph);
	printf("%s%i", "    notFULL ", notFULL);	drawGraph(notFULL, period, &notFULLgraph);
	//если хочется посмотреть состояние счетчиков, то раскомметируйте строчку ниже.
	//printf("%s%i%s%i\n", "loadNum = ", loadNum, "unloadNum = ", unloadNum);
	printf("\n%s\n", "for next period- enter \"-\"");
	

		char inpt [10];
		scanf ("%s", inpt);
		if ( inpt [0] == 'q') break;

		for (int c = 0; inpt[c] != '\0'; c++) {
			if ( inpt [c] == '-') ;
			if ( inpt [c] == '0') Dbus[0] = !Dbus[0];
			if ( inpt [c] == '1') Dbus[1] = !Dbus[1];
			if ( inpt [c] == '2') Dbus[2] = !Dbus[2];
			if ( inpt [c] == '3') Dbus[3] = !Dbus[3];
			if ( inpt [c] == 'l') LDCK = !LDCK;
			if ( inpt [c] == 'u') UNCK = !UNCK;
			if ( inpt [c] == 'r') {
					notRST = !notRST;
					loadNum = 1;
					unloadNum = 0;
					notEMPTY = FALSE;
					notFULL = TRUE;
			}
		}
	}

	return 0;
}