当前位置: 首页>>代码示例>>C++>>正文


C++ TMarker::SetMarkerColor方法代码示例

本文整理汇总了C++中TMarker::SetMarkerColor方法的典型用法代码示例。如果您正苦于以下问题:C++ TMarker::SetMarkerColor方法的具体用法?C++ TMarker::SetMarkerColor怎么用?C++ TMarker::SetMarkerColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TMarker的用法示例。


在下文中一共展示了TMarker::SetMarkerColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: drawEventRPhi

void drawEventRPhi(double vxlb, double vylb, double vxl0, double vyl0, double pmu1, double phimu1, double pmu2, double phimu2, double ppr, double phipr, double ppi, double phipi, int colors = 0)
{
    Color_t colMu1(1), colMu2(1), colPr(1), colPi(1), colL0(1), colLb(1);
    switch(colors)
    {
	case 0:
	    colLb=1; colL0=2; colMu1=2; colMu2=2; colPr=3; colPi=4; break;
	case 1:
	    colLb=11; colL0=50; colMu1=50; colMu2=50; colPr=8; colPi=9; break;
    }
    // draw the vertices
    TMarker *m;
    const double xlb = vxlb;
    const double ylb = vylb;
    m = new TMarker(xlb,ylb,7);
    m->SetMarkerColor(colLb);
    m->Draw();
    const double xl0 = vxl0;
    const double yl0 = vyl0;
    m = new TMarker(xl0,yl0,7);
    m->SetMarkerColor(colL0);
    m->Draw();
    // draw the l0 flight line
    TLine *l;
    l = new TLine(vxlb,vylb,vxl0,vyl0);
    l->SetLineColor(colL0);
    l->SetLineStyle(2);
    l->Draw();
    // draw the muons
    TArrow *a;
    const double xmu1 = xlb + scalemu * pmu1 * TMath::Cos(phimu1);
    const double ymu1 = ylb + scalemu * pmu1 * TMath::Sin(phimu1);
    a = new TArrow(xlb,ylb,xmu1,ymu1,.01,">");
    a->SetLineColor(colMu1);
    a->Draw();
    const double xmu2 = xlb + scalemu * pmu2 * TMath::Cos(phimu2);
    const double ymu2 = ylb + scalemu * pmu2 * TMath::Sin(phimu2);
    a = new TArrow(xlb,ylb,xmu2,ymu2,.01,">");
    a->SetLineColor(colMu2);
    a->Draw();
    // draw the p and pi
    const double xpr = xl0 + scalepr * ppr * TMath::Cos(phipr);
    const double ypr = yl0 + scalepr * ppr * TMath::Sin(phipr);
    a = new TArrow(xl0,yl0,xpr,ypr,.01,">");
    a->SetLineColor(colPr);
    a->Draw();
    const double xpi = xl0 + scalepi * ppi * TMath::Cos(phipi);
    const double ypi = yl0 + scalepi * ppi * TMath::Sin(phipi);
    a = new TArrow(xl0,yl0,xpi,ypi,.01,">");
    a->SetLineColor(colPi);
    a->Draw();
}
开发者ID:frmeier,项目名称:usercode,代码行数:52,代码来源:genDisplay01.C

示例2: gtime2

void gtime2(Int_t nsteps = 200, Int_t np=5000) {
   if (np > 5000) np = 5000;
   Int_t color[5000];
   Double_t cosphi[5000], sinphi[5000], speed[5000];
   TRandom3 r;
   Double_t xmin = 0, xmax = 10, ymin = -10, ymax = 10;
   TGraphTime *g = new TGraphTime(nsteps,xmin,ymin,xmax,ymax);
   g->SetTitle("TGraphTime demo 2;X;Y");
   Int_t i,s;
   Double_t phi,fact = xmax/Double_t(nsteps);
   for (i=0;i<np;i++) { //calculate some object parameters
      speed[i]  = r.Uniform(0.5,1);
      phi       = r.Gaus(0,TMath::Pi()/6.);
      cosphi[i] = fact*speed[i]*TMath::Cos(phi);
      sinphi[i] = fact*speed[i]*TMath::Sin(phi);
      Double_t rc = r.Rndm();
      color[i] = kRed;
      if (rc > 0.3) color[i] = kBlue;
      if (rc > 0.7) color[i] = kYellow;
   }
   for (s=0;s<nsteps;s++) { //fill the TGraphTime step by step
      for (i=0;i<np;i++) {
         Double_t xx = s*cosphi[i];
         if (xx < xmin) continue;
         Double_t yy = s*sinphi[i];
         TMarker *m = new TMarker(xx,yy,25);
         m->SetMarkerColor(color[i]);
         m->SetMarkerSize(1.5 -s/(speed[i]*nsteps));
         g->Add(m,s);
      }
      g->Add(new TPaveLabel(.70,.92,.98,.99,Form("shower at %5.3f nsec",3.*s/nsteps),"brNDC"),s);
   }
   g->Draw();
}
开发者ID:digideskio,项目名称:root,代码行数:34,代码来源:gtime2.C

示例3: DrawLabel

void DrawLabel(TString txt, double x, double y, int mstyle, int col, double msize) {
  TMarker *m = new TMarker(x,y,mstyle);
  m->SetNDC();
  m->SetMarkerSize(msize); m->SetMarkerColor(col);
  TLine *l = new TLine();
  l->SetLineWidth(2); l->SetLineColor(col);
  m->Draw();
  tex->SetTextSize(0.04);
  tex->SetTextAlign(12); tex->SetTextColor(col);
  tex->DrawLatex(x+0.025,y,txt);
  tex->SetTextColor(kBlack);
}
开发者ID:affablelochan,项目名称:2013codev2,代码行数:12,代码来源:DrawJES.C

示例4: myMarkerText

void myMarkerText(Double_t x,Double_t y,Int_t color,Int_t mstyle, const char *text,Float_t msize)
{
  Double_t tsize=0.06;
  TMarker *marker = new TMarker(x-(0.4*tsize),y,8);
  marker->SetMarkerColor(color);  marker->SetNDC();
  marker->SetMarkerStyle(mstyle);
  marker->SetMarkerSize(msize);
  marker->Draw();

  TLatex l; l.SetTextAlign(12); //l.SetTextSize(tsize);
  l.SetNDC();
  l.DrawLatex(x,y,text);
}
开发者ID:lawrenceleejr,项目名称:ZeroLeptonAnalysis,代码行数:13,代码来源:AtlasUtils.C

示例5: myMarkerText

void myMarkerText(Double_t x,Double_t y,Int_t color,Int_t mstyle,char *text) 
{
  //  printf("**myMarker: text= %s\ m ",text);

  Double_t tsize=0.06;
  TMarker *marker = new TMarker(x-(0.4*tsize),y,8);
  marker->SetMarkerColor(color);  marker->SetNDC();
  marker->SetMarkerStyle(mstyle);
  marker->SetMarkerSize(2.0);
  marker->Draw();

  TLatex l; l.SetTextAlign(12); //l.SetTextSize(tsize); 
  l.SetNDC();
  l.DrawLatex(x,y,text);
}
开发者ID:tongbaojia,项目名称:MakePlot,代码行数:15,代码来源:AtlasLabels.C

示例6: overlayWorkingPoints

// Draw on a given canvas the full set of working points
void   overlayWorkingPoints(TCanvas *c1, 
			    TTree *signalTree, TTree *backgroundTree, 
			    const TString *cutFileNames,
			    int markerColor, int markerStyle, 
			    TLegend *leg, const TString legendText){


  // Now loop over working points
  for(int iwp = 0; iwp<nWP; iwp++){
    
    // Load the working point from a ROOT file
    TFile *cutFile = new TFile(cutFileNames[iwp]);
    if( !cutFile )
      assert(0);
    VarCut *cutObject = (VarCut*)cutFile->Get("cuts");
    if( !cutObject )
      assert(0);
    
    // Compute the efficiencies
    float effSignal, effBackground;
    findEfficiencies(signalTree, backgroundTree, effSignal, effBackground,
		     cutObject);
    printf("Computed eff for cut from %s, effS= %.3f effB= %.3f\n",
	   cutFileNames[iwp].Data(), effSignal, effBackground);
    
    // Make a marker and draw it.
    TMarker *marker = new TMarker(effSignal, 1.0-effBackground, 20);
    marker->SetMarkerSize(2);
    marker->SetMarkerColor(markerColor);
    marker->SetMarkerStyle(markerStyle);
    marker->Draw("same");

    // Add marker to the legend only once. Do not draw the legend here,
    // it is drawn in the main function later
    if( iwp == 0 ){
      if( !leg )
	assert(0);
      leg->AddEntry(marker, legendText, "p");
    }

    c1->Update();
    
    cutFile->Close();
  }

  
}
开发者ID:yangyuchul,项目名称:ElePhoNTU,代码行数:48,代码来源:drawROCandWPv4.C

示例7: showHistogram1d

void showHistogram1d(TH1* histogram, 
		     const std::string& xAxisTitle,
		     Float_t* genX, 
		     const std::string& outputFileName)
{
  TCanvas* canvas = new TCanvas("canvas", "canvas", 800, 600);
  canvas->SetFillColor(10);
  canvas->SetBorderSize(2);

  canvas->SetTopMargin(0.10);
  canvas->SetLeftMargin(0.16);
  canvas->SetRightMargin(0.14);
  canvas->SetBottomMargin(0.12);

  TAxis* xAxis = histogram->GetXaxis();
  xAxis->SetTitle(xAxisTitle.data());
  xAxis->SetTitleOffset(1.15);

  TAxis* yAxis = histogram->GetYaxis();
  yAxis->SetTitle("Sampling Points");
  yAxis->SetTitleOffset(1.60);

  histogram->SetLineColor(1);
  histogram->SetLineWidth(2);
  histogram->SetMarkerColor(1);
  histogram->SetMarkerStyle(20);
  histogram->Draw("e1p");

  TMarker* genMarker = 0;
  if ( genX ) {
    genMarker = new TMarker(*genX, 0.10, 34);
    genMarker->SetMarkerColor(1);
    genMarker->SetMarkerSize(2);
    genMarker->Draw();
  }

  canvas->Update();
  size_t idx = outputFileName.find_last_of('.');
  std::string outputFileName_plot = std::string(outputFileName, 0, idx);
  if ( idx != std::string::npos ) canvas->Print(std::string(outputFileName_plot).append(std::string(outputFileName, idx)).data());
  canvas->Print(std::string(outputFileName_plot).append(".png").data());
  canvas->Print(std::string(outputFileName_plot).append(".pdf").data());
  canvas->Print(std::string(outputFileName_plot).append(".root").data());

  delete genMarker;
  delete canvas;  
}
开发者ID:veelken,项目名称:SVfitDevelopment,代码行数:47,代码来源:plotMarkovChainMonitorTree.C

示例8: TMarker

vector<TObject *> * mark_overflows(TH1F * histogram) {
  Double_t maximum_value = histogram->GetMaximum();
  Double_t minimum_value = histogram->GetMinimum();

  vector<TObject *> * overflow_markers = new vector<TObject *>();

  Float_t * bins = histogram->GetArray();
  Int_t number_of_bins = histogram->GetNbinsX();

  // note that the bins array has the following structure:
  // bins[0] is the underflow bin
  // bins[1] through bins[number_of_bins] are the actual bins
  // bins[number_of_bins + 1] is the overflow bin
  for(int j = 1; j <= number_of_bins; j++) {
    if (bins[j] > maximum_value || bins[j] < minimum_value) {
      Double_t x1 = histogram->GetXaxis()->GetBinLowEdge(j);
      Double_t x2 = histogram->GetXaxis()->GetBinUpEdge(j);

      TMarker * m = new TMarker();
      m->SetX((x2 + x1) / 2.0);
      m->SetMarkerColor(kRed);
      m->SetMarkerSize(MARKER_SIZE * 2);

      if(bins[j] > maximum_value) {
        m->SetY(maximum_value - MARKER_Y_SHIFT);
        m->SetMarkerStyle(22); // up arrow
      } else {
        m->SetY(minimum_value + MARKER_Y_SHIFT);
        m->SetMarkerStyle(23); // down arrow
      }

      overflow_markers->push_back(m);
    }
  }

  return overflow_markers;
}
开发者ID:slava77,项目名称:emulibSVN,代码行数:37,代码来源:one-page-plot.cpp

示例9: TCanvas

void /home/users/m/k/mkomm/Diff13/analysis/unfolding/result/nominal/multi_top_y_nol()
{
//=========Macro generated from canvas: cvMulti0.984295447508/
//=========  (Mon May 15 15:02:17 2017) by ROOT version6.02/05
   TCanvas *cvMulti0.984295447508 = new TCanvas("cvMulti0.984295447508", "",0,0,800,650);
   gStyle->SetOptFit(1);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   cvMulti0.984295447508->SetHighLightColor(2);
   cvMulti0.984295447508->Range(-0.5419355,-0.2962025,3.329032,1.982278);
   cvMulti0.984295447508->SetFillColor(0);
   cvMulti0.984295447508->SetBorderMode(0);
   cvMulti0.984295447508->SetBorderSize(2);
   cvMulti0.984295447508->SetTickx(1);
   cvMulti0.984295447508->SetTicky(1);
   cvMulti0.984295447508->SetLeftMargin(0.14);
   cvMulti0.984295447508->SetRightMargin(0.24);
   cvMulti0.984295447508->SetTopMargin(0.08);
   cvMulti0.984295447508->SetBottomMargin(0.13);
   cvMulti0.984295447508->SetFrameFillStyle(0);
   cvMulti0.984295447508->SetFrameLineWidth(0);
   cvMulti0.984295447508->SetFrameBorderMode(0);
   cvMulti0.984295447508->SetFrameBorderSize(0);
   cvMulti0.984295447508->SetFrameFillStyle(0);
   cvMulti0.984295447508->SetFrameLineWidth(0);
   cvMulti0.984295447508->SetFrameBorderMode(0);
   cvMulti0.984295447508->SetFrameBorderSize(0);
   
   TH2F *axis0.09336527505115 = new TH2F("axis0.09336527505115","",50,0,2.4,50,0,1.8);
   axis0.09336527505115->SetLineStyle(0);
   axis0.09336527505115->SetMarkerStyle(20);
   axis0.09336527505115->SetMarkerSize(0.16);
   axis0.09336527505115->GetXaxis()->SetTitle("top quark |y|");
   axis0.09336527505115->GetXaxis()->SetNdivisions(1005);
   axis0.09336527505115->GetXaxis()->SetLabelFont(43);
   axis0.09336527505115->GetXaxis()->SetLabelOffset(0.0077);
   axis0.09336527505115->GetXaxis()->SetLabelSize(32);
   axis0.09336527505115->GetXaxis()->SetTitleSize(35);
   axis0.09336527505115->GetXaxis()->SetTickLength(0.04032258);
   axis0.09336527505115->GetXaxis()->SetTitleOffset(1.15);
   axis0.09336527505115->GetXaxis()->SetTitleFont(43);
   axis0.09336527505115->GetYaxis()->SetTitle(" Scale factor");
   axis0.09336527505115->GetYaxis()->SetNdivisions(512);
   axis0.09336527505115->GetYaxis()->SetLabelFont(43);
   axis0.09336527505115->GetYaxis()->SetLabelOffset(0.0077);
   axis0.09336527505115->GetYaxis()->SetLabelSize(32);
   axis0.09336527505115->GetYaxis()->SetTitleSize(35);
   axis0.09336527505115->GetYaxis()->SetTickLength(0.03164557);
   axis0.09336527505115->GetYaxis()->SetTitleOffset(1.3);
   axis0.09336527505115->GetYaxis()->SetTitleFont(43);
   axis0.09336527505115->GetZaxis()->SetLabelFont(43);
   axis0.09336527505115->GetZaxis()->SetLabelOffset(0.0077);
   axis0.09336527505115->GetZaxis()->SetLabelSize(32);
   axis0.09336527505115->GetZaxis()->SetTitleSize(34);
   axis0.09336527505115->GetZaxis()->SetTitleOffset(1.3);
   axis0.09336527505115->GetZaxis()->SetTitleFont(43);
   axis0.09336527505115->Draw("AXIS");
   
   TF1 *tf13 = new TF1("tf1","1",0,2.4);
   tf13->SetFillColor(19);
   tf13->SetFillStyle(0);
   tf13->SetMarkerStyle(20);
   tf13->SetMarkerSize(0.16);
   tf13->SetLineWidth(1);
   tf13->GetXaxis()->SetNdivisions(505);
   tf13->GetXaxis()->SetLabelFont(43);
   tf13->GetXaxis()->SetLabelOffset(0.0077);
   tf13->GetXaxis()->SetLabelSize(32);
   tf13->GetXaxis()->SetTitleSize(34);
   tf13->GetXaxis()->SetTickLength(0.05);
   tf13->GetXaxis()->SetTitleOffset(1.15);
   tf13->GetXaxis()->SetTitleFont(43);
   tf13->GetYaxis()->SetNdivisions(512);
   tf13->GetYaxis()->SetLabelFont(43);
   tf13->GetYaxis()->SetLabelOffset(0.0077);
   tf13->GetYaxis()->SetLabelSize(32);
   tf13->GetYaxis()->SetTitleSize(34);
   tf13->GetYaxis()->SetTitleOffset(1.3);
   tf13->GetYaxis()->SetTitleFont(43);
   tf13->Draw("LSame");
   TMarker *marker = new TMarker(0.0892,0.9606917,20);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#f9910c");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   TLine *line = new TLine(0.0892,0.9359605,0.0892,0.9854228);

   ci = TColor::GetColor("#f9910c");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(0.2,0,0.2,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(0.0892,0.9606917,0.3142,0.9554859);

//.........这里部分代码省略.........
开发者ID:matt-komm,项目名称:PhD-thesis,代码行数:101,代码来源:multi_top_y_nol.C

示例10: plotAnitaEventMap

void plotAnitaEventMap(Adu5Pat *patPtr,double phi,double theta){

  double sourceLon,sourceLat,headLon,headLat,phi10Lon,phi10Lat,phi6Lon,phi6Lat,phi14Lon,phi14Lat,actualLat,actualLon,actual2Lat,actual2Lon;
  float xEvent,yEvent,xAnita,yAnita,anitaLat,anitaLon,anitaAlt,xHead,yHead,x10,y10,x6,y6,x14,y14,yActual,xActual,yActual2,xActual2;

  anitaLat = patPtr->latitude;
  anitaLon = patPtr->longitude;
  anitaAlt = patPtr->altitude;

  UsefulAdu5Pat usefulPat(patPtr);
  std::cout << "source " << std::endl;
  //int sourceLoc = usefulPat.getSourceLonAndLatAltZero((180-phi)/180.*PI,(theta)/180.*PI,sourceLon,sourceLat);
  int sourceLoc = usefulPat.getSourceLonAndLatAltZero((phi)/180.*PI,(theta)/180.*PI,sourceLon,sourceLat);
  std::cout << std::endl << "heading " << std::endl;
  int headLoc = usefulPat.getSourceLonAndLatAltZero(0./180.*PI,10./180.*PI,headLon,headLat);
  std::cout << std::endl << "phi 10 " << std::endl;
  int headLoc10 = usefulPat.getSourceLonAndLatAltZero(180./180.*PI,10./180.*PI,phi10Lon,phi10Lat);
  std::cout << std::endl << "phi 14 " << std::endl;
  int headLoc14 = usefulPat.getSourceLonAndLatAltZero(270./180.*PI,10./180.*PI,phi14Lon,phi14Lat);
  std::cout << std::endl << "phi 6 " << std::endl;
  int headLoc6 = usefulPat.getSourceLonAndLatAltZero(90./180.*PI,10./180.*PI,phi6Lon,phi6Lat);
  std::cout << std::endl << "actual 14.5 " << std::endl;
  int actualLoc = usefulPat.getSourceLonAndLatAltZero(phi/180.*PI,12.5/180.*PI,actualLon,actualLat);
  std::cout << std::endl << "actual 4.5 " << std::endl;
  int actualLoc2 = usefulPat.getSourceLonAndLatAltZero(phi/180.*PI,7.5/180.*PI,actual2Lon,actual2Lat);
  //int sourceLoc = usefulPat.getSourceLonAndLatAltZero((phi)/180.*PI,(TMath::PiOver2()-theta)/180.*PI,sourceLon,sourceLat);
  TImage *map = TImage::Open("/home/mottram/work/eventCorrelator/macros/antarcticaIceMap.png");

  std::cout << "sourceLoc " << sourceLoc << " phi " << phi << " theta " << theta << " lon " << sourceLon << " lat " << sourceLat << std::endl;
  gStyle->SetMarkerColor(kBlack);
  //gStyle->SetMarkerSize(2);
  gStyle->SetTextSize(0.02);
  TMarker *anitaPos = new TMarker(xAnita,yAnita,23);

  getRelXYFromLatLong(anitaLat,anitaLon,xAnita,yAnita);
  getRelXYFromLatLong(static_cast<float>(sourceLat),static_cast<float>(sourceLon),xEvent,yEvent);
  getRelXYFromLatLong(static_cast<float>(headLat),static_cast<float>(headLon),xHead,yHead);
  getRelXYFromLatLong(static_cast<float>(phi10Lat),static_cast<float>(phi10Lon),x10,y10);
  getRelXYFromLatLong(static_cast<float>(phi14Lat),static_cast<float>(phi14Lon),x14,y14);
  getRelXYFromLatLong(static_cast<float>(phi6Lat),static_cast<float>(phi6Lon),x6,y6);
  getRelXYFromLatLong(static_cast<float>(actualLat),static_cast<float>(actualLon),xActual,yActual);
  getRelXYFromLatLong(static_cast<float>(actual2Lat),static_cast<float>(actual2Lon),xActual2,yActual2);

  TCanvas *canMap=(TCanvas*)gROOT->FindObject("canMap");
  if(!canMap)
     canMap = new TCanvas("canMap","canMap",(int)xSize,(int)ySize);
  canMap->Clear();
  canMap->SetLogz();
  canMap->SetTopMargin(0);
  canMap->SetBottomMargin(0);
  canMap->SetLeftMargin(0);
  canMap->SetRightMargin(0);

  map->Draw("");

  TMarker *headingPos = new TMarker(xHead,yHead,29);
  TMarker *heading14Pos = new TMarker(x14,y14,29);
  TMarker *heading10Pos = new TMarker(x10,y10,29);
  TMarker *heading6Pos = new TMarker(x6,y6,29);
  TMarker *actualPos = new TMarker(xActual,yActual,29);
  TMarker *actual2Pos = new TMarker(xActual2,yActual2,29);
  headingPos->SetMarkerColor(kRed);
  heading14Pos->SetMarkerColor(kGray);
  heading10Pos->SetMarkerColor(kGray+2);
  heading6Pos->SetMarkerColor(kViolet);
  actualPos->SetMarkerColor(kRed+2);//12.5 theta
  actual2Pos->SetMarkerColor(kBlue+2);//7.5 theta

  headingPos->Draw("");
  heading14Pos->Draw("");
  heading10Pos->Draw("");
  heading6Pos->Draw("");
  actualPos->Draw("");
  actual2Pos->Draw("");
  anitaPos->DrawMarker(xAnita,yAnita);
  

  TLatex *positionLabel=0;
  char label[FILENAME_MAX];

  if(sourceLoc==0){
    if(anitaAlt<0){
      sprintf(label,"Could not get event position, ANITA below 0 altitude!");
    }
    else if(theta>0){
      sprintf(label,"Pointing upwards!  Cannot locate source at ground position");
    }
    else{
      sprintf(label,"Unkown error, cannot position source at 0 altitude");
    }
    positionLabel = new TLatex();
    positionLabel->DrawLatex(0.05,0.95,label);
    return;
  }

  TMarker *eventPos = new TMarker(xEvent,yEvent,29);
  eventPos->SetMarkerColor(kBlack);
  eventPos->Draw("");

  sprintf(label,"ANITA location: lat %f; long %f; alt %f, x %f, y %f",anitaLat,anitaLon,anitaAlt,xAnita,yAnita);
//.........这里部分代码省略.........
开发者ID:anitaNeutrino,项目名称:anitaEventCorrelator,代码行数:101,代码来源:crossCorrelation.C

示例11: drawMeasurement

void drawMeasurement(int i, double m[5], char label[2][100], int aux[5],
		     double vstep, TH2F* histo, TCanvas* canvas) {

 
    double lowY = (i+1)*vstep;
    double uppY = (i+2)*vstep;

  //double lowX = histo->GetBinLowEdge(1);
  //double uppX = histo->GetBinLowEdge(histo->GetNbinsX()) +
  //              histo->GetBinWidth(histo->GetNbinsX());
    double lowX = 0.25;
    double uppX = 2.80;
    double widthX = uppX - lowX;

 
  // y-range of the histogram is [0...1]

  double startX = lowX + 0.04*widthX;
  
  TPaveText* text = new TPaveText(startX, lowY,
				  startX, uppY, "BR");
  text->SetTextAlign(12);
  text->SetFillColor(aux[1]);
  text->SetTextColor(aux[0]);
  text->SetLineColor(1);
  text->SetBorderSize(0);
  TText* t0 = text->AddText("    ");
  t0->SetTextSize(0.08);
  t0->SetTextFont(aux[2]);
  TText* t1 = text->AddText(label[0]);
  t1->SetTextSize(0.08);
  t1->SetTextFont(aux[2]);
  TText* t2 = text->AddText(label[1]);
  t2->SetTextSize(0.08);
  t2->SetTextFont(aux[2]);
  text->Draw();


  double ypos = 0.5*(lowY+uppY);
  double mean = m[0];
  double nErr1 = m[1];
  double pErr1 = m[2];
  double nErr2 = sqrt(m[1]*m[1]+m[3]*m[3]);
  double pErr2 = sqrt(m[2]*m[2]+m[4]*m[4]);

  // draw TGraphAsymmErrors 1 (stat only) |---*---|
  TMarker* measurement = new TMarker(mean, ypos, aux[4]);
  measurement->SetMarkerColor(aux[0]);
  measurement->SetMarkerStyle(aux[4]);

  measurement->SetMarkerSize(1.5);
  //measurement->SetMarkerSize(1.75);
  measurement->Draw();

  double vsizeErr1 = 0.09*vstep;
  TLine* l1 = new TLine(mean, ypos, mean-nErr1, ypos);
  l1->SetLineWidth(aux[3]);
  l1->SetLineColor(aux[0]);
  l1->Draw();
  TLine* l2 = new TLine(mean, ypos, mean+pErr1, ypos);
  l2->SetLineWidth(aux[3]);
  l2->SetLineColor(aux[0]);
  l2->Draw();
  TLine* l3 = new TLine(mean-nErr1, ypos-vsizeErr1,
			mean-nErr1, ypos+vsizeErr1);
  l3->SetLineWidth(aux[3]);
  l3->SetLineColor(aux[0]);
  l3->Draw();
  TLine* l4 = new TLine(mean+pErr1, ypos-vsizeErr1,
			mean+pErr1, ypos+vsizeErr1);
  l4->SetLineWidth(aux[3]);
  l4->SetLineColor(aux[0]);
  l4->Draw();

  // overlay TGraphAsymmErrors 2 (stat+syst) |----*-----|
  double vsizeErr2 = 0.12*vstep; 
  TLine* l5 = new TLine(mean, ypos, mean-nErr2, ypos);
  l5->SetLineWidth(aux[3]);
  l5->SetLineColor(aux[0]);
  l5->Draw();
  TLine* l6 = new TLine(mean, ypos, mean+pErr2, ypos);
  l6->SetLineWidth(aux[3]);
  l6->SetLineColor(aux[0]);
  l6->Draw();
  TLine* l7 = new TLine(mean-nErr2, ypos-vsizeErr2,
			mean-nErr2, ypos+vsizeErr2);
  l7->SetLineWidth(aux[3]);
  l7->SetLineColor(aux[0]);
  l7->Draw();
  TLine* l8 = new TLine(mean+pErr2, ypos-vsizeErr2,
			mean+pErr2, ypos+vsizeErr2);
  l8->SetLineWidth(aux[3]);
  l8->SetLineColor(aux[0]);
  l8->Draw();

  // draw measurement label "XXX+/-YY+/-ZZ"
  TPaveText* num = new TPaveText(uppX-0.32*widthX,
				 lowY, uppX-0.02*widthX, uppY, "BR");
  num->SetTextAlign(12);
  num->SetFillColor(aux[1]);
//.........这里部分代码省略.........
开发者ID:cranelli,项目名称:WGamGam,代码行数:101,代码来源:ratio.C

示例12: drawEventZR

void drawEventZR(double vrlb, double vzlb, double vrl0, double vzl0, double pmu1, double etamu1, double pmu2, double etamu2, double ppr, double etapr, double ppi, double etapi, int colors = 0)
{
    Color_t colMu1(1), colMu2(1), colPr(1), colPi(1), colL0(1), colLb(1);
    switch(colors)
    {
	case 0:
	    colLb=1; colL0=2; colMu1=2; colMu2=2; colPr=3; colPi=4; break;
	case 1:
	    colLb=11; colL0=50; colMu1=50; colMu2=50; colPr=8; colPi=9; break;
    }
    cout << etamu1 << " " << etamu2 << " " << etapr << " " << etapi << endl;
    const double thetamu1 = 2*TMath::ATan(TMath::Exp(-etamu1));
    const double thetamu2 = 2*TMath::ATan(TMath::Exp(-etamu2));
    const double thetapr = 2*TMath::ATan(TMath::Exp(-etapr));
    const double thetapi = 2*TMath::ATan(TMath::Exp(-etapi));
    //const double thetamu1 = 2*TMath::ATan(TMath::Exp(-TMath::Abs(etamu1)))*sign(etamu1);
    //const double thetamu2 = 2*TMath::ATan(TMath::Exp(-TMath::Abs(etamu2)))*sign(etamu2);
    //const double thetapr = 2*TMath::ATan(TMath::Exp(-TMath::Abs(etapr)))*sign(etapr);
    //const double thetapi = 2*TMath::ATan(TMath::Exp(-TMath::Abs(etapi)))*sign(etapi);
    // draw the vertices
    TMarker *m;
    const double xlb = vzlb;
    const double ylb = vrlb;
    m = new TMarker(xlb,ylb,7);
    m->SetMarkerColor(colLb);
    m->Draw();
    const double xl0 = vzl0;
    const double yl0 = vrl0;
    m = new TMarker(xl0,yl0,7);
    m->SetMarkerColor(colL0);
    m->Draw();
    // draw the l0 flight line
    TLine *l;
    l = new TLine(vzlb,vrlb,vzl0,vrl0);
    l->SetLineColor(colL0);
    l->SetLineStyle(2);
    l->Draw();
    // draw the muons
    TArrow *a;
    const double xmu1 = xlb + scalemu * pmu1 * TMath::Cos(thetamu1);
    const double ymu1 = ylb + scalemu * pmu1 * TMath::Sin(thetamu1);
    a = new TArrow(xlb,ylb,xmu1,ymu1,.01,">");
    a->SetLineColor(colMu1);
    a->Draw();
    const double xmu2 = xlb + scalemu * pmu2 * TMath::Cos(thetamu2);
    const double ymu2 = ylb + scalemu * pmu2 * TMath::Sin(thetamu2);
    a = new TArrow(xlb,ylb,xmu2,ymu2,.01,">");
    a->SetLineColor(colMu2);
    a->Draw();
    // draw the p and pi
    const double xpr = xl0 + scalepr * ppr * TMath::Cos(thetapr);
    const double ypr = yl0 + scalepr * ppr * TMath::Sin(thetapr);
    a = new TArrow(xl0,yl0,xpr,ypr,.01,">");
    a->SetLineColor(colPr);
    a->Draw();
    const double xpi = xl0 + scalepi * ppi * TMath::Cos(thetapi);
    const double ypi = yl0 + scalepi * ppi * TMath::Sin(thetapi);
    a = new TArrow(xl0,yl0,xpi,ypi,.01,">");
    a->SetLineColor(colPi);
    a->Draw();
}
开发者ID:frmeier,项目名称:usercode,代码行数:61,代码来源:genDisplay01.C

示例13: showHistogram2d

void showHistogram2d(TH2* histogram, 
		     const std::string& xAxisTitle, const std::string& yAxisTitle,
		     int zAxisNormOption, double zMin, double zMax, 
		     Float_t* genX, Float_t* genY, 
		     const std::string& outputFileName)
{
  TCanvas* canvas = new TCanvas("canvas", "canvas", 900, 800);
  canvas->SetFillColor(10);
  canvas->SetBorderSize(2);

  canvas->SetTopMargin(0.10);
  canvas->SetLeftMargin(0.12);
  canvas->SetRightMargin(0.14);
  canvas->SetBottomMargin(0.12);

  histogram->SetTitle("");
  histogram->SetStats(false);
  int numBinsX = histogram->GetNbinsX();
  int numBinsY = histogram->GetNbinsY();
  if ( zAxisNormOption == kNormByQuantiles ) {
    std::vector<double> binContents;
    for ( int iBinX = 1; iBinX <= numBinsX; ++iBinX ) {
      for ( int iBinY = 1; iBinY <= numBinsY; ++iBinY ) {
	binContents.push_back(histogram->GetBinContent(iBinX, iBinY));
      }
    }
    std::sort(binContents.begin(), binContents.end());
    histogram->SetMinimum(binContents[TMath::Nint(0.05*binContents.size())]);
    histogram->SetMaximum(binContents[TMath::Nint(0.95*binContents.size())]);
  } else if ( zAxisNormOption == kNormByNegLogMax ) {
    double maxBinContent = 0.;
    for ( int iBinX = 1; iBinX <= numBinsX; ++iBinX ) {
      for ( int iBinY = 1; iBinY <= numBinsY; ++iBinY ) {
	double binContent = histogram->GetBinContent(iBinX, iBinY);
	if ( binContent > maxBinContent ) {
	  std::cout << "binX = " << iBinX << " (x = " << histogram->GetXaxis()->GetBinCenter(iBinX) << ")," 
		    << " binY = " << iBinY << " (y = " << histogram->GetYaxis()->GetBinCenter(iBinY) << "): maxBinContent = " << maxBinContent << std::endl;
	  maxBinContent = binContent;
	}
      }
    }
    double logMaxBinContent = TMath::Log(maxBinContent);
    for ( int iBinX = 1; iBinX <= numBinsX; ++iBinX ) {
      for ( int iBinY = 1; iBinY <= numBinsY; ++iBinY ) {
	double binContent = histogram->GetBinContent(iBinX, iBinY);
	if ( binContent > 0. ) {
	  histogram->SetBinContent(iBinX, iBinY, -TMath::Log(binContent) + logMaxBinContent);
	} else {
	  histogram->SetBinContent(iBinX, iBinY, -1.);
	}
      }
    }
    histogram->SetMinimum(0.);
    histogram->SetMaximum(zMax);
  } else if ( zAxisNormOption == kNormByValue ) {
    histogram->SetMinimum(zMin);
    histogram->SetMaximum(zMax);
  } else assert(0);

  TAxis* xAxis = histogram->GetXaxis();
  xAxis->SetTitle(xAxisTitle.data());
  xAxis->SetTitleOffset(1.15);

  TAxis* yAxis = histogram->GetYaxis();
  yAxis->SetTitle(yAxisTitle.data());
  yAxis->SetTitleOffset(1.30);

  gStyle->SetPalette(1,0);
  histogram->Draw("COLZ");

  TMarker* genMarker = 0;
  if ( genX && genY ) {
    genMarker = new TMarker(*genX, *genY, 34);
    genMarker->SetMarkerColor(1);
    genMarker->SetMarkerSize(2);
    genMarker->Draw();
  }

  canvas->Update();
  size_t idx = outputFileName.find_last_of('.');
  std::string outputFileName_plot = std::string(outputFileName, 0, idx);
  if ( idx != std::string::npos ) canvas->Print(std::string(outputFileName_plot).append(std::string(outputFileName, idx)).data());
  canvas->Print(std::string(outputFileName_plot).append(".png").data());
  canvas->Print(std::string(outputFileName_plot).append(".pdf").data());
  canvas->Print(std::string(outputFileName_plot).append(".root").data());

  delete genMarker;
  delete canvas;  
}
开发者ID:veelken,项目名称:SVfitDevelopment,代码行数:89,代码来源:plotMarkovChainMonitorTree.C

示例14: genPlots02


//.........这里部分代码省略.........
    if(fVerbose>0)
	cout << "Succesfully opened file " << fullPath << endl;
    // Get TTree
    TTree* t = (TTree*) f->Get("events");
    if(fVerbose>0) cout << "Got TTree with " << t->GetEntries() << " entries" << endl;
    // Do a cut, if needed
    //t->Draw(">>lst","chi2lb>.1&&mlb>5.61&&mlb<5.63");
    //t->Draw(">>lst","chi2lb>.1&&isSig==1");
    t->Draw(">>lst","(rid1m&4)==4&&(rid2m&4)==4&&mjp>2.895&&mjp<3.295&&prob1m>0.1&&prob2m>0.1&&ptjp>2&&probjp>0.005&&ml0>1.101&&ml0<1.129&&probpr>0.02&&probpi>0.02&&rptpr>rptpi&&ptl0>3&&rptpr>1&&rptpi>0.5&&probl0>0.02&&alphal0<0.3&&d3l0>1&&d3l0/d3El0>10&&problb>0.001&&alphalb<0.3");
    TEventList *lst;
    lst = (TEventList*)gDirectory->Get("lst");
    t->SetEventList(lst);
    if(fVerbose>0) cout << "Got TTree with " << t->GetEntries() << " entries" << endl;

    // Do plots
    c->cd(1);
    //doPlot2d(t,"hrzL0vtx", "vrl0:TMath::Abs(vzl0)",30,0,300,30,0,120,"Tit","|z|","r","cm","cm");
    if (custBinning)
    {
	double newbinsX[]={0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50};
	const int newbinsX_size = sizeof(newbinsX)/sizeof(double);
	std::vector<double> binvecX(newbinsX,newbinsX+newbinsX_size);
	//double newbinsY[]={0,1,2,3,4,5,6,7,8,9,10};
	double newbinsY[]={0,0.5,1,2,4,8,16,32};
	const int newbinsY_size = sizeof(newbinsY)/sizeof(double);
	std::vector<double> binvecY(newbinsY,newbinsY+newbinsY_size);
	doPlot2d(t,"hrzL0vtxreco", "vrl0:TMath::Abs(vzl0)",binvecX, binvecY,"#Lambda vertices","|z|","r","cm","cm");
    }
    else
    {
	doPlot2d(t,"hrzL0vtxreco", "vrl0:TMath::Abs(vzl0)",30,0,50,30,0,30,"#Lambda vertices","|z|","r","cm","cm");
    }

    // add tracker
    TPad* pad;
    pad = (TPad*)c->cd(1);
    pad->Modified();
    pad->Update();
    repositionPalette("hrzL0vtxreco");
    pad->Update();
    pad->SetLogz();
    drawTracker(pad);

    if (nOverlay<=0) return;
    int maxN = nOverlay;
    if (maxN > t->GetEntries()) maxN = t->GetEntries();
    double vrl0,vzl0,ppr,ppi,etapr,etapi;
    t->SetBranchAddress("vrl0",&vrl0);
    t->SetBranchAddress("vzl0",&vzl0);
    t->SetBranchAddress("ppr",&ppr);
    t->SetBranchAddress("etapr",&etapr);
    t->SetBranchAddress("ppi",&ppi);
    t->SetBranchAddress("etapi",&etapi);
    double scalepr = 4;
    double scalepi = 8;

    { // reference indicator
	const double x1pr = 0; const double y1pr = -3;
	const double x2pr = scalepr; const double y2pr = y1pr;
	const double versatz = 14;
	const double x1pi = x1pr+versatz; const double y1pi = -3;
	const double x2pi = x2pr+versatz+scalepi; const double y2pi = y1pi;
	TArrow *a;
	a = new TArrow(x1pr,y1pr,x2pr,y2pr,.01,">");
	a->SetLineColor(24);
	a->Draw();
	TLatex tl;
	tl.SetTextSize(20);
	tl.SetTextFont(4);
	tl.DrawLatex(x1pr,y2pr-1.2,"p(p) / 1 GeV");
	a = new TArrow(x1pi,y1pi,x2pi,y2pi,.01,">");
	a->SetLineColor(20);
	a->Draw();
	tl.SetTextSize(20);
	tl.SetTextFont(4);
	tl.DrawLatex(x1pi,y2pi-1.2,"p(#pi) / 1 GeV");
    }
    for (int i = 0; i!=maxN; i++)
    {
	t->GetEntry(i);
	const double thetapr = 2*TMath::ATan(TMath::Exp(-TMath::Abs(etapr)));
	const double thetapi = 2*TMath::ATan(TMath::Exp(-TMath::Abs(etapi)));
	const double x1=TMath::Abs(vzl0);
	const double y1=vrl0;
	const double x2pr=x1+scalepr*ppr*TMath::Cos(thetapr);
	const double y2pr=y1+scalepr*ppr*TMath::Sin(thetapr);
	const double x2pi=x1+scalepi*ppi*TMath::Cos(thetapi);
	const double y2pi=y1+scalepi*ppi*TMath::Sin(thetapi);
	TArrow *a;
        a = new TArrow(x1,y1,x2pr,y2pr,.01,">");
	a->SetLineColor(24);
	a->Draw();
        a = new TArrow(x1,y1,x2pi,y2pi,.01,">");
	a->SetLineColor(20);
	a->Draw();
	TMarker *m = new TMarker(x1,y1,7);
	m->SetMarkerColor(28);
	m->Draw();
    }
}
开发者ID:frmeier,项目名称:usercode,代码行数:101,代码来源:genPlots02.C

示例15: plotFit


//.........这里部分代码省略.........
      TGraph *tphplots[s2bSteps-30];

//    for(s2bStep=0; s2bStep<s2bSteps; s2bStep++) {
      for(s2bStep=0; s2bStep<s2bSteps-30; s2bStep++) {

         Float_t tphArray[tphSteps], fitxArray[tphSteps];

         tphStep = 0;

         for(point=0; point<Npoints; point++) {
      
            tree->GetEntry(point);
      
            if(fits2b == s2bValues[s2bStep]) {

//             tphArray[tphStep]  = fittph;
               tphArray[tphStep]  = sqrt(1.0/(1.0+fittph));

               if (fittph < tphMin) tphMin = fittph;

               if (fittph > tphMax) tphMax = fittph;

               fitxArray[tphStep] = fitx;

               if (fitx < fitxMin) fitxMin = fitx;

               if (fitx > fitxMax) fitxMax = fitx;

               tphStep++;


              TMarker *m = new TMarker(fitxArray[tphStep],tphArray[tphStep],20);
              m->SetMarkerSize(2);
              m->SetMarkerColor(31+tphStep);
              m->Draw();



            }
         }

         if (s2bStep == 0) {

            TH1F* frame = MyC->DrawFrame(0.0,0.0,1.1*fitxMax,1.1);
//          TH1F* frame = MyC->DrawFrame(0.7*fitxMin,0.7*tphMin,1.1*fitxMax,1.1*tphMax);

            TAxis *xaxis = frame->GetXaxis();
            TAxis *yaxis = frame->GetYaxis();
   
            xaxis->SetTitle("x = u^{2}/v^{2}");
            xaxis->CenterTitle();
            xaxis->SetTitleOffset(1.);
            xaxis->SetDecimals();
            xaxis->SetLabelSize(0.03);
            xaxis->SetLabelOffset(0.01);
        
            yaxis->SetTitle("tan^{2}(#phi)");
            yaxis->CenterTitle();
            yaxis->SetTitleOffset(1.);
            yaxis->SetDecimals();
            yaxis->SetLabelSize(0.03);
            yaxis->SetLabelOffset(0.01);

            frame->SetTitle(plottitle.c_str());

         }
开发者ID:jxi24,项目名称:GAPP,代码行数:67,代码来源:plotFit.C


注:本文中的TMarker::SetMarkerColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。