Esempio n. 1
0
/**
 * Destructor of GuiEdge class
 */
GuiEdge::~GuiEdge()
{
	out( "last nitems:%d, deletenig: ", addGui ( getGraph())->items().count());
	debugPrint();
	addGui( getGraph())->removeItem( addGui( this));
	out( "current nitems%d", addGui( getGraph())->items().count());
}
Esempio n. 2
0
 /**
  * \brief - generates x and y coordinates of each vertex
  * 
  * @param Rect bounds - Parameter, contains the x and y coordinates of the boundary of the drawing area
  * **/
 virtual void generate(Rect bounds)
 {
     Point center = {(bounds.max.x+bounds.min.x)/2, (bounds.max.y+bounds.min.y)/2};
     float xspan = center.x - bounds.min.x;
     float yspan = center.y - bounds.min.y;
     int vcount = getGraph().order()/n;
     int start = 0, end;
     float rinc = std::min(xspan,yspan)/n;
     float radius = rinc;
     
     auto vlist = graph::VertexList(getGraph());
     for(int i=1;i<=n;++i)
     {
         float deg = 0;
         end = (i==n) ? getGraph().order():start+vcount;
         float deginc = 2*3.142/(end-start);
         for(int j=start;j<end;++j)
         {
             float xp = center.x+radius*cos(deg);
             float yp = center.y+radius*sin(deg);
             deg += deginc;
             points.value(vlist[j]) = Point({xp,yp});
         }
         start += vcount;
         radius += rinc;
     }
 }
static int getGraph(Node n, double* array, int nbPlacedPoints){
  *(array + nbPlacedPoints) = getNodeValue(n);
  nbPlacedPoints++;

  if (hasChild(n)){
    nbPlacedPoints = getGraph(getChild(n), array, nbPlacedPoints);
  }

  if (hasBrother(n)){
    nbPlacedPoints = getGraph(getBrother(n), array, nbPlacedPoints);
  }

  return nbPlacedPoints;
}
Esempio n. 4
0
Autolayout::Graph  * Autolayout::AutolayouterAdapter::setGraph( UMLView * view )
  {
  if (! view) return 0;
  Autolayout::Graph * g=getGraph();
  if (g&&g->empty())
    {
    UMLWidgetList list = view->getWidgetList();
    UMLWidget* widget;
    for ( widget = list.first(); widget; widget= list.next() )
      {
      if (widget->getBaseType() == Uml::wt_Class)
        {


        g->addNode(widget->getID().c_str(),widget->getWidth(),
                   widget->getHeight());
        }
      }
    AssociationWidgetList as_list=view->getAssociationList();
    AssociationWidget* assoc;
    AssociationWidgetListIt it(as_list);
    while ( (assoc = it.current()) != 0 )
      {
      ++it;
      addRelationship(assoc);
      }
    }
  return g;
  }
Esempio n. 5
0
void MGraph<T>::Kruskal(vector<EdgeType<T> > &tree)
{
	int i;
	vector<EdgeType<T> > graph;
	getGraph(graph);
	tree.resize(vexnum-1);
	int* components = new int[edgenum];
	for(i = 0; i < vexnum; i++)
		components[i] = i;
	int k = 0;
	int j = 0;
	while(k < vexnum-1)
	{
		int h1 = getVexValueNum(graph[j].head);
		int t1 = getVexValueNum(graph[j].tail);
		int h2 = components[h1];
		int t2 = components[t1];
		if(h2 != t2)
		{
			tree[k].head = getVexValue(h1);
			tree[k].tail = getVexValue(t1);
			tree[k].cost = graph[j].cost;
			k++;
			for(i = 0;i < vexnum;i++)
				if(components[i] == t2)
					components[i] = h2;
		}
		j++;
	}
	delete []components;
}
Esempio n. 6
0
void company() { // function to print the company login menu
    int p=1;
    do {
        printf("\nWelcome to the company management console!\n\n");
        printf("1. View current stock price of a company\n");
        printf("2. View past stock history of the company\n");
        printf("3. Create a new stock for a company\n");
        printf("4. Go Back\n\n");
        printf("Enter choice:");
        scanf("%d",&c);
        switch(c) {
        case 1:
            getQuote();
            break;
        case 2:
            getGraph();
            break;
        case 3:
            createStock();
            break;
        case 4:
            p=0;
            break;
        default:
            printf("Invalid Choice. Enter again!\n");
        }
    } while(p);
}
void FunctionTree::calculateError(){
	error = 0;
	if (referenceDataSet.size()>0) {
		vector<pair<double, double> > graph = getGraph();
		for (int i = 0; i < referenceDataSet.size(); i++) {
			error += (graph[i].second-referenceDataSet[i].second)*(graph[i].second-referenceDataSet[i].second);
		}
		error = error * (referenceDataSet.size()-1)/((double)fragmentNumber+1)/ (double)referenceDataSet.size();
		double deriveError=0;
		for (int i = 0; i < referenceDataSet.size()-1; i++) {
			double m,n;
			if (i==0) {
				m = referenceDataSet[i+1].second-referenceDataSet[i].second;
				n = graph[i+1].second-graph[i].second;
			} else if(i == referenceDataSet.size()-1){
				m = (referenceDataSet[i].second-referenceDataSet[i-1].second);
				n = (graph[i].second-graph[i-1].second);
			} else {
				m = 0.5*(referenceDataSet[i+1].second-referenceDataSet[i-1].second);
				n = 0.5*(graph[i+1].second-graph[i-1].second);
			}
			deriveError += (m-n)*(m-n);
		}
		error = sqrt(error*error+deriveError*deriveError);
		if (error!=error) {
			error = INFINITY;
		}		
	}
}
Esempio n. 8
0
void MultilevelGraph::moveToZero()
{
	// move Graph to zero
	double avg_x = 0.0;
	double avg_y = 0.0;
	for(node v : getGraph().nodes) {
		avg_x += x(v);
		avg_y += y(v);
	}
	avg_x /= getGraph().numberOfNodes();
	avg_y /= getGraph().numberOfNodes();
	for(node v : getGraph().nodes) {
		x(v, x(v) - avg_x);
		y(v, y(v) - avg_y);
	}
}
ExecStreamResult ExternalSortExecStreamImpl::execute(
    ExecStreamQuantum const &quantum)
{
    for (;;) {
        if (!resultsReady) {
            if (pInAccessor->getState() != EXECBUF_EOS) {
                ExecStreamResult rc = precheckConduitBuffers();
                if (rc == EXECRC_BUF_UNDERFLOW) {
                    rc = handleUnderflow();
                }
                if (rc != EXECRC_YIELD) {
                    return rc;
                }
                if (nParallel > 1) {
                    // FIXME
                    computeFirstResultParallel();
                } else {
                    rc = computeFirstResult();
                    if (rc != EXECRC_YIELD) {
                        return rc;
                    }
                }
            } else {
                ExternalSortRunLoader &runLoader = *(runLoaders[0]);
                if (runLoader.isStarted()) {
                    sortRun(runLoader);
                    if (storedRuns.size() || storeFinalRun) {
                        // store last run
                        storeRun(runLoader);
                    }
                }
            }
            mergeFirstResult();

            // close the producers now that we've read all input
            if (earlyClose) {
                ExecStreamGraphImpl &graphImpl =
                    dynamic_cast<ExecStreamGraphImpl&>(getGraph());
                graphImpl.closeProducers(getStreamId());
            }

            resultsReady = true;
        }

        ExecStreamResult rc2 = pOutputWriter->fetch(*pOutAccessor);
        if (rc2 == EXECRC_EOS) {
            if (sortInfo.partitionKeyCount > 0
                && pInAccessor->getState() != EXECBUF_EOS)
            {
                // results have already been produced. Continue loading rows
                // for the next "partition".
                reallocateResources();
                continue;
            }
            pOutAccessor->markEOS();
        }
        return rc2;
    }
}
int main(void) {
	scanf("%d %d", &N, &E);
	assert(N > 0 && N <= SIZE);
	getGraph();
	init();
	int dist = path(INIT, FINAL);
	printf("MINIMUM DISTANCE BETWEEN %d and %d is %d\n", INIT, FINAL, dist);
	return 0;
}
Esempio n. 11
0
AudioProcessorGraph::NodeID FilterIOConfigurationWindow::getNodeID() const
{
    if (auto* graph = getGraph())
        for (auto* node : graph->getNodes())
            if (node->getProcessor() == getAudioProcessor())
                return node->nodeID;

    return {};
}
Esempio n. 12
0
int main(int argc, char *argv[]) {
    
    List l = newList();
    FILE *f = fopen("collection.txt", "r");
    getCollection(l, f);
    showList(l);
    
    getGraph(l, ListLength(l));
    
    return 0;
}
Esempio n. 13
0
int main()
{
    Graph *graph = getGraph("input.txt");
    if (graph == NULL)
    {
        printf("Ошибка открытия файла\n");
        return 0;
    }
    int connectedComponents = countConnectedComponents(graph);
    printf("Количество компонент связности: %d\n", connectedComponents);
    deleteGraph(graph);
}
Esempio n. 14
0
void FilterIOConfigurationWindow::update()
{
    auto nodeID = getNodeID();

    if (auto* graph = getGraph())
        if (nodeID != AudioProcessorGraph::NodeID())
            graph->disconnectNode (nodeID);

    if (auto* graphEditor = getGraphEditor())
        if (auto* panel = graphEditor->graphPanel.get())
            panel->updateComponents();
}
Esempio n. 15
0
void Node::mouseDrag (const MouseEvent& e)
{
    dragger.dragComponent (this, e, nullptr);

    auto node = graph.getNodeForID (id);

    node->setPosition (
        std::make_tuple<float, float> (
            (getX () + getWidth () / 2.0f) / (float)getParentWidth (), 
            (getY () + getHeight () / 2.0f) / (float)getParentHeight ())
        );

    getGraph ()->updateGraph ();
}
Esempio n. 16
0
void Autolayout::AutolayouterAdapter::addRelationship( AssociationWidget * a )
  {
  int weight;
  switch (a->getAssocType())
    {
      case Uml::at_Generalization:;
      case Uml::at_Realization:
        {
        if (genralizationAsEdges)weight=generalizationWeight;
        else return;
        break;
        }
      case Uml::at_Dependency:
        {
        if (dependenciesAsEdges) weight=dependenciesWeight;
        else return;
        break;
        }
      case Uml::at_Anchor:
        {
        if (anchorsAsEdges) weight=anchorsWeight;
        else return;
        break;
        }
      case Uml::at_Aggregation:;
      case Uml::at_Association:;
      case Uml::at_Containment:;
      case Uml::at_Composition:;
      default: return;
      /*case Uml::at_Association_Self:;
      case Uml::at_Activity:;
      case Uml::at_Relationship:;
      case Uml::at_Coll_Message:;
      case Uml::at_Seq_Message:;
      case Uml::at_Coll_Message_Self:;
      case Uml::at_Seq_Message_Self:;
      case Uml::at_Containment:;
      case Uml::at_Composition:;
      case Uml::at_Realization:;
      case Uml::at_UniAssociation:;

      case Uml::at_State:;
      case Uml::at_Unknown:;
      */
    };
  getGraph()->addEdge(a->getWidgetID(Uml::A).c_str(),a->getWidgetID(Uml::B).c_str(),weight);
  }
Esempio n. 17
0
File: UCK.C Progetto: PierFio/ball
	void UCK::makeUCK(const Molecule& m)
	{
		vector<String> v, pairs, lambda_map;
		PairVector e; // edge set
		SizeVector sp;
		
		getGraph(v, e, m);
		
		for(Size i=0; i!=v.size(); ++i)
		{
			lambda_map.push_back(lambda("", e, v, i, depth_));
		}
		
		makePathMatrix(e, sp, v.size());
		makePairs(lambda_map, pairs, sp);
		createFinalString(pairs);
		return;
	}
Esempio n. 18
0
void loggedin() {
    int p=1;
    do {
        printf("1. Buy Stocks\n2. Sell stocks\n3. Get Stock Quotes\n4. Get previous stocks history\n5. View available stocks\n6. My Portfolio\n7. Logout\n\n");

        printf("Enter your choice: ");
        scanf("%d",&c);

        switch(c)
        {
        case 1:
            buyStocks();
            break;

        case 2:
            sellStocks();
            break;

        case 3:
            getQuote();
            break;

        case 4:
            getGraph();
            break;

        case 5:
            availablestocks();
            break;

        case 6:
            myPortfolio();
            break;

        case 7:
            logout();
            p=0;
            break;

        default:
            printf("\nWrong choice. Enter again.\n");
        }
    } while(p);
}
Esempio n. 19
0
void Bfs::breadthFirstSearch(int n){
	map <int, list<Edge> > graph = getGraph();
	map <int, Node * > map_node = getMapNode();

	map<int, Node* >::iterator it = map_node.find(n);
	if (it != map_node.end())
	{
		bfsQueue.push(it->second);
		bfsQueue.front()->setLevel(0);

		while (! bfsQueue.empty()) {
			Node *temp = bfsQueue.front();
			bfsQueue.pop();
			int level = temp->getLevel() + 1;
			map <int, list<Edge> >::iterator it_graph = graph.find(temp->getLabel());
			if (it_graph != graph.end()){
				for (Edge var : it_graph->second)
				{
					map<int, Node* >::iterator it_node = map_node.find(var.getNode2()->getLabel());
					if (it_node != map_node.end())
					{
						if(it_node->second->getLevel() == -1 || level < it_node->second->getLevel()){
							it_node->second->setLevel(level);
							bfsQueue.push(it_node->second);
						}
					}
				}
			}
		}

		cout << "\nDistance of other nodes from " << n <<endl;
		for (pair<int, Node*> var : map_node)
		{
			if (it->second != var.second)
				cout<<var.second->getLabel()<<": "<<var.second->getLevel()<<endl;
		}
	}
	else
	{
		std::cout << "Input node " << n << " not present" << endl;
		exit(0);
	}
}
Esempio n. 20
0
FilterIOConfigurationWindow::~FilterIOConfigurationWindow()
{
    if (auto* graph = getGraph())
    {
        if (auto* p = getAudioProcessor())
        {
            ScopedLock renderLock (graph->getCallbackLock());

            graph->suspendProcessing (true);
            graph->releaseResources();

            p->prepareToPlay (graph->getSampleRate(), graph->getBlockSize());
            p->suspendProcessing (false);

            graph->prepareToPlay (graph->getSampleRate(), graph->getBlockSize());
            graph->suspendProcessing (false);
        }
    }
}
Esempio n. 21
0
void TableA()
{
  
  // Input file
  TFile* file = new TFile("test.root");
  
  // Z positions
  vector<int> zpts;
  zpts.push_back(100);
  zpts.push_back(200);
  zpts.push_back(300);
  zpts.push_back(400);
  zpts.push_back(500);
  zpts.push_back(600);
  zpts.push_back(700);
  zpts.push_back(800);
  zpts.push_back(900);
  zpts.push_back(1000);

  // Calculate R distance
  double angle = (55.8 - 0.3)/57.2957795; // convert to radians

  // string stream
  stringstream ss;

  // Loop 
  TGraph* gr = NULL;
  for(unsigned int i=0; i<zpts.size(); ++i){

    // Get graph maximum
    ss.str("");
    ss << "gr_" << zpts.at(i);
    gr = getGraph(file,TString(ss.str().c_str()),"","",kBlack);
    double maximum = getMax(gr);
		  
    double R = (zpts.at(i)+10) * cos(angle);
    
    cout<<"R = "<<R<<" max: "<<maximum<<" "<<maximum*R<<endl;

  }

}
Esempio n. 22
0
// Computes combinatorial embedding of dual graph
// Precondition: CE must be combinatorial embedding of connected planar graph
DualGraph::DualGraph(CombinatorialEmbedding &CE)
{
    m_primalEmbedding = &CE;
    Graph &primalGraph = CE.getGraph();
    init(*(new Graph));
    Graph &dualGraph = getGraph();
    
    m_dualNode.init(CE);
    m_dualEdge.init(primalGraph);
    m_dualFace.init(primalGraph);
    m_primalNode.init(*this);
    m_primalFace.init(dualGraph);
    m_primalEdge.init(dualGraph);
    
    // create dual nodes
    face f;
    forall_faces(f, CE)
    {
		node vDual = dualGraph.newNode();
		m_dualNode[f] = vDual;
		m_primalFace[vDual] = f;
    }
Esempio n. 23
0
ExecStreamResult JavaSinkExecStream::execute(ExecStreamQuantum const &)
{
    ExecStreamBufAccessor &inAccessor = *pInAccessor;
    switch (inAccessor.getState()) {
    case EXECBUF_EMPTY:
        // Nothing to read, so don't send anything to Java. FennelPipeTupleIter
        // would interpret a 0-length buffer as end-of-stream, which is not the
        // case.
        FENNEL_TRACE(TRACE_FINE, "no input");
        return (lastResult = EXECRC_BUF_UNDERFLOW);
    case EXECBUF_EOS:
        // Need to signal end-of-stream to Java. Do this by sending a buffer of
        // length 0. There should be 0 bytes available, so the code below
        // should do this naturally.
        FENNEL_TRACE(TRACE_FINE, "input EOS");
        assert(inAccessor.getConsumptionAvailable() == 0);
        break;
    default:
        FENNEL_TRACE(TRACE_FINER, "input rows:");
        getGraph().getScheduler()
            ->traceStreamBufferContents(*this, inAccessor, TRACE_FINER);
        break;
    }

    PConstBuffer pInBufStart = inAccessor.getConsumptionStart();
    PConstBuffer pInBufEnd = inAccessor.getConsumptionEnd();
    uint nbytes = pInBufEnd - pInBufStart;
    bool success = sendData(pInBufStart, nbytes);
    if (success) {
        if (nbytes > 0) {
            inAccessor.consumeData(pInBufEnd);
            return (lastResult = EXECRC_BUF_UNDERFLOW);
        } else {
            return (lastResult = EXECRC_EOS);
        }
    } else {
        return EXECRC_QUANTUM_EXPIRED;
    }
}
Esempio n. 24
0
int main(int argc, char* argv[])
{
  if (argc != 4)
    die(1);

  printf("going to get graph\n");
  myGraph* graph = getGraph(argv[1]);
  printf("got graph\n");

  int v1, v2 = -1;
  sscanf(argv[2], "%d", &v1);
  sscanf(argv[3], "%d", &v2);
  
  // check that we were given an actual edge
  if (!isEdge(graph, v1, v2))
    die(1);
  
  checkWts(graph);

  int lastNNZ = -1;
  while(graph->nnz > 2)   // note each edge is counted twice (forwards/backwards)
    {
      printf("graph->nnz: %d\n", graph->nnz);     
      reduceGraph(&graph, v1, v2);
      if (lastNNZ == graph->nnz)
	{
	  fprintf(stderr, "ERROR: reduceGraph failed to do anything!\n");
	  exit(2);
	}
      lastNNZ = graph->nnz;
    }
  
  printf("The effective resistence is: %lf\n", graph->wts[v1][0]); // assume all other edges gone, so it has to be first listing!

  freeGraph(graph);
  
  return 0;
}
Esempio n. 25
0
void Autolayout::AutolayouterAdapter::updateView( UMLView* view )
  {
if (! view) return ;
UMLWidgetList list = view->getWidgetList();
  UMLWidget* widget;
  Graph *g=getGraph();
  if (! view||!g)  return ;
  for ( widget = list.first(); widget; widget= list.next() )
    if (widget->getBaseType() == Uml::wt_Class)
      {
      Node* n =g->getNode(widget->getID().c_str());
      //printf("old values widgets %s x,y:%d,%d\n",widget->getID().c_str(),widget->getX(),widget->getY());
      //int x_old=widget->getX();
      //int x_calc=n.getX();
      //int x_calc2=30 +n.getX()-widget->getWidth()/2;
      widget->setX(getCanvas()->getBaseX() +n->getX()-widget->getWidth()/2);
      //int x=widget->getX();
      widget->setY(getCanvas()->getMaxY()/2-(n->getY()+(widget->getHeight()/2)));

      widget->updateWidget();

      }
  }
Esempio n. 26
0
double* edgeArrayToDoubleArray(Edge* e, int size){
  double* res = malloc(sizeof(double)*size);

  Node n = transformEdgeArrayToGraph(e, size, 0);

  showGraph(n);

  getGraph(n, res, 0);

  /**res[0] = (double)e[0]->start;
  for (int i=1; i<size -1; i++)
    if (res[i-1] != e[i]->start)
      res[i] = (double)e[i]->start;
    else 
      res[i] = (double)e[i]->end;

  if (res[size-2] != e[size-3]->start)
      res[size-1] = (double)e[size-2]->end;
    else 
      res[size-1] = (double)e[size-2]->end;*/

  return res;
}
Esempio n. 27
0
void JavaSinkExecStream::stuffByteBuffer(
    jobject byteBuffer,
    PConstBuffer src,
    uint size)
{
    // TODO: lookup methods in constructor.
    // TODO: ByteBuffer with a longer life, permanently pinned.
    JniEnvAutoRef pEnv;

    // pin the byte array
    jbyteArray bufBacking =
        static_cast<jbyteArray>(
            pEnv->CallObjectMethod(byteBuffer, methByteBuffer_array));
    jboolean copied;
    jbyte* dst = pEnv->GetByteArrayElements(bufBacking, &copied);

    // copy the data
    memcpy(dst, src, size);

    // trace the copy
    if (isTracingLevel(TRACE_FINER)) {
        // wrap the output buffer with a buf accessor
        ExecStreamBufAccessor ba;
        ba.setProvision(BUFPROV_PRODUCER);
        ba.setTupleShape(
            pInAccessor->getTupleDesc(), pInAccessor->getTupleFormat());
        ba.clear();
        PBuffer buf = (PBuffer) dst;
        ba.provideBufferForConsumption(buf, buf + size);
        FENNEL_TRACE(TRACE_FINER, "output rows:");
        getGraph().getScheduler()
            ->traceStreamBufferContents(*this, ba, TRACE_FINER);
    }

    // unpin
    pEnv->ReleaseByteArrayElements(bufBacking, dst, 0);
}
Esempio n. 28
0
void plotPerCategory(){
  gStyle->SetOptStat(0);
  gStyle->SetOptTitle(0);
  //   setTDRStyle();
   gStyle->SetPadTopMargin   (0.04);
   gStyle->SetPadBottomMargin(0.12);
   gStyle->SetPadRightMargin (0.05);
   gStyle->SetPadLeftMargin  (0.12);
   gStyle->SetTitleSize(0.04, "XYZ");
   gStyle->SetTitleXOffset(1.1);
   gStyle->SetTitleYOffset(1.45);
   gStyle->SetPalette(1);
   gStyle->SetNdivisions(505);

   TCanvas* c1;
   TH1F* framework;
   TH2F* framework2d;
   TLegend* LEG, *LEGTH;
   TGraph* Ref;

   string Directories[]={"cards_SB13TeV_cp1.00_brn0.00", "cards_SB13TeV_GGF_cp1.00_brn0.00", "cards_SB13TeV_VBF_cp1.00_brn0.00"};
   for(unsigned int D=0;D<sizeof(Directories)/sizeof(string);D++){
      string Dir = Directories[D];

     string prod = "pp";
     if(Dir.find("GGF")!=std::string::npos)prod="gg";
     if(Dir.find("VBF")!=std::string::npos)prod="qq";
     bool strengthLimit = false;
     if(prod=="pp")strengthLimit=true;

      c1 = new TCanvas("c", "c",600,600);
      c1->SetLogy(true);
      framework = new TH1F("Graph","Graph",1,190,1510);
      framework->SetStats(false);
      framework->SetTitle("");
      framework->GetXaxis()->SetTitle("Higgs boson mass [GeV]");
      if(strengthLimit){
         framework->GetYaxis()->SetTitle("#mu = #sigma_{95%} / #sigma_{th}");
         framework->GetYaxis()->SetRangeUser(1E-2,1E3);
      }else{
         framework->GetYaxis()->SetTitle((string("#sigma_{95%} (") + prod + " #rightarrow H #rightarrow ZZ) (fb)").c_str());        
         framework->GetYaxis()->SetRangeUser(1E1,1E5);
      }
      framework->GetYaxis()->SetTitleOffset(1.40);
      framework->Draw();

      LEG = new TLegend(0.70,0.70,0.95,0.94);
      LEG->SetFillStyle(0);
      LEG->SetBorderSize(0);
      LEG->SetHeader("Observed:");

      TLegend* LEGExp = NULL;
      LEGExp = new TLegend(0.45,0.70,0.70,0.94);
      LEGExp->SetFillStyle(0);
      LEGExp->SetBorderSize(0);
      LEGExp->SetHeader("Expected:");


      getGraph("=0 Jet"                       , 2, 2, 1, LEG  , NULL, 2, Dir+ "_eq0jets/Stength_LimitSummary")->Draw("C same");
      getGraph("#geq1 Jets"                   , 4, 2, 1, LEG  , NULL, 2, Dir+"_geq1jets/Stength_LimitSummary")->Draw("C same");
      getGraph("VBF"                          , 6, 2, 1, LEG  , NULL, 2, Dir+     "_vbf/Stength_LimitSummary")->Draw("C same");
      getGraph("Combined"                     , 1, 2, 1, LEG  , NULL, 2, Dir+         "/Stength_LimitSummary")->Draw("C same");

      getGraph("=0 Jet"                       , 2, 2, 2, LEGExp  , NULL, 1, Dir+ "_eq0jets/Stength_LimitSummary")->Draw("C same");
      getGraph("#geq1 Jets"                   , 4, 2, 2, LEGExp  , NULL, 1, Dir+"_geq1jets/Stength_LimitSummary")->Draw("C same");
      getGraph("VBF"                          , 6, 2, 2, LEGExp  , NULL, 1, Dir+     "_vbf/Stength_LimitSummary")->Draw("C same");
      getGraph("Combined"                     , 1, 2, 2, LEGExp  , NULL, 1, Dir+         "/Stength_LimitSummary")->Draw("C same");


   //   LEGTH->Draw("same");
      LEGExp  ->Draw("same");
      LEG  ->Draw("same");


      /*
      char LumiLabel[1024];
      sprintf(LumiLabel,"CMS preliminary,  #sqrt{s}=%.0f TeV #scale[0.5]{#int} L=%6.1ffb^{-1}",13.0,2.3);
      TPaveText *pave = new TPaveText(0.1,0.96,0.94,0.99,"NDC");
      pave->SetBorderSize(0);
      pave->SetFillStyle(0);
      pave->SetTextAlign(32);
      pave->SetTextFont(42);
      pave->AddText(LumiLabel);
      pave->Draw("same");*/

      utils::root::DrawPreliminary(2268.759, 13, gPad->GetLeftMargin(),gPad->GetBottomMargin(),gPad->GetRightMargin(),gPad->GetTopMargin()+0.025);     
      if(strengthLimit){
         TLine* SMLine = new TLine(framework->GetXaxis()->GetXmin(),1.0,framework->GetXaxis()->GetXmax(),1.0);
         SMLine->SetLineWidth(2); SMLine->SetLineStyle(1); SMLine->SetLineColor(4);      
         SMLine->Draw("same C");
      }else{
         TGraph* THXSec   = Hxswg::utils::getXSec(Dir); 
         THXSec->SetLineWidth(2); THXSec->SetLineStyle(1); THXSec->SetLineColor(4);
         scaleGraph(THXSec, 1000);  //convert cross-section to fb
         THXSec->Draw("same C");
      }

      c1->SaveAs((Dir+"/perCat_FinalPlot.png").c_str());
      c1->SaveAs((Dir+"/perCat_FinalPlot.pdf").c_str());
      c1->SaveAs((Dir+"/perCat_FinalPlot.C"  ).c_str());
   }



/*
   for(unsigned int D=0;D<sizeof(Directories)/sizeof(string);D++){
      string Dir = Directories[D];

      c1 = new TCanvas("c", "c",600,600);
      c1->SetLogy(true);
      framework = new TH1F("Graph","Graph",1,150,1050);
      framework->SetStats(false);
      framework->SetTitle("");
      framework->GetXaxis()->SetTitle("Higgs boson mass [GeV]");
//      framework->GetYaxis()->SetTitle("#mu = #sigma_{95%} / #sigma_{th}");
//      framework->GetYaxis()->SetTitle("#sigma_{95%} (fb)");
      framework->GetYaxis()->SetTitle("#sigma_{95%} (pp #rightarrow H #rightarrow ZZ) (fb)");        
      framework->GetYaxis()->SetTitleOffset(1.40);
      framework->GetYaxis()->SetRangeUser(1E1,1E4);
      framework->Draw();

      LEG = new TLegend(0.70,0.70,0.95,0.94);
      LEG->SetFillStyle(0);
      LEG->SetBorderSize(0);
//      LEG->SetHeader("Expected @95% C.L.");

      LEGTH = new TLegend(0.45,0.70,0.70,0.94);
      LEGTH->SetFillStyle(0);
      LEGTH->SetBorderSize(0);
      LEGTH->SetHeader("Theoretical");

//      getGraph("SM-like"                     , 1, 2, 1, LEG  , NULL, 1, Dir+               "/Stength_LimitSummary")->Draw("C same");
      getGraph("C'=1.0"                      , 2, 2, 2, LEG  , NULL, 1, Dir+"_cp1.00_brn0.00/Stength_LimitSummary")->Draw("C same");
      getGraph("C'=0.8"                      , 4, 2, 2, LEG  , NULL, 1, Dir+"_cp0.80_brn0.00/Stength_LimitSummary")->Draw("C same");
      getGraph("C'=0.6"                      , 6, 2, 2, LEG  , NULL, 1, Dir+"_cp0.60_brn0.00/Stength_LimitSummary")->Draw("C same");
      getGraph("C'=0.4"                      , 7, 2, 2, LEG  , NULL, 1, Dir+"_cp0.40_brn0.00/Stength_LimitSummary")->Draw("C same");
      getGraph("C'=0.2"                      , 8, 2, 2, LEG  , NULL, 1, Dir+"_cp0.20_brn0.00/Stength_LimitSummary")->Draw("C same");

   //   LEGTH->Draw("same");
      LEG  ->Draw("same");

      char LumiLabel[1024];
      sprintf(LumiLabel,"CMS preliminary,  #sqrt{s}=%.0f TeV #scale[0.5]{#int} L=%6.1ffb^{-1}",13.0,2.2);
      TPaveText *pave = new TPaveText(0.1,0.96,0.94,0.99,"NDC");
      pave->SetBorderSize(0);
      pave->SetFillStyle(0);
      pave->SetTextAlign(32);
      pave->SetTextFont(42);
      pave->AddText(LumiLabel);
      pave->Draw("same");

      TLine* SMLine = new TLine(framework->GetXaxis()->GetXmin(),1.0,framework->GetXaxis()->GetXmax(),1.0);
      SMLine->SetLineWidth(2); SMLine->SetLineStyle(1); SMLine->SetLineColor(4);      
//      SMLine->Draw("same C");


      c1->SaveAs((Dir+"/perC_FinalPlot.png").c_str());
      c1->SaveAs((Dir+"/perC_FinalPlot.pdf").c_str());
      c1->SaveAs((Dir+"/perC_FinalPlot.C"  ).c_str());
   }
*/
}
Esempio n. 29
0
void TOutlineViewer::handleEvent(TEvent &event) {
   const int mouseAutoToSkip = 3;

   TPoint mouse;
   TNode *cur;
   int newFocus;
   int count;
   char *graph;
   uchar dragged;

   TScroller::handleEvent(event);
   switch (event.what) {
   case evMouseDown:
      count = 0;
      dragged = 0;
      do {
         if (dragged < 2)
            dragged++;
         mouse = makeLocal(event.mouse.where);
         if (mouseInView(event.mouse.where))
            newFocus = delta.y + mouse.y;
         else {
            if (event.what == evMouseAuto)
               count++;
            if (count == mouseAutoToSkip) {
               count = 0;
               if (mouse.y < 0)
                  newFocus--;
               if (mouse.y >= size.y)
                  newFocus++;
            }
         }
         if (foc != newFocus) {
            adjustFocus(newFocus);
            drawView();
         }
      } while (!(event.mouse.eventFlags & meDoubleClick) &&
               mouseEvent(event, evMouseMove + evMouseAuto));

      if (event.mouse.eventFlags & meDoubleClick)
         selected(foc);
      else {
         if (dragged < 2) {
            cur = firstThat(isFocused);
            graph = getGraph(focLevel, focLines, focFlags);
            if (mouse.x < strlen(graph)) {
               adjust(cur, ! isExpanded(cur) ? True : False);
               update();
               drawView();
            }
            delete graph;
         }
      }

      break;

   case evKeyboard:

      newFocus = foc;
      switch (ctrlToArrow(event.keyDown.keyCode)) {
      case kbUp:
      case kbLeft:
         newFocus--;
         break;
      case kbDown:
      case kbRight:
         newFocus++;
         break;
      case kbPgDn:
         newFocus += size.y - 1;
         break;
      case kbPgUp:
         newFocus -= size.y - 1;
         break;
      case kbHome:
         newFocus = delta.y;
         break;
      case kbEnd:
         newFocus = delta.y + size.y - 1;
         break;
      case kbCtrlPgUp:
         newFocus = 0;
         break;
      case kbCtrlPgDn:
         newFocus = limit.y - 1;
         break;
      case kbCtrlEnter:
      case kbEnter:
         selected(newFocus);
         break;
      default:
         uchar code = event.keyDown.charScan.charCode;
         switch (code) {
         case '-':
         case '+':
            adjust(getNode(newFocus), code == '+' ? True : False);
            break;
         case '*':
            expandAll(getNode(newFocus));
            break;
         default:
            return;
         }
         update();
      }
      clearEvent(event);
      adjustFocus(newFocus);
      drawView();
   };
};
Esempio n. 30
0
bool
CSRMat::operator==(const CSRMat& rhs) const
{
  if (getGraph() != rhs.getGraph()) return false;
  return getPackedCoefs() == rhs.getPackedCoefs();
}