Ejemplo n.º 1
0
//______________________________________________________________________________
void HighlightFragment()
{
  // TODO templates: what and how highlighing
  if (!gPad || !gr) return;

  // not correct
  TVirtualPad *ph = (TVirtualPad *)gPad->FindObject("ph");
  if (!ph) {
    ph = new TPad("ph", "ph", 0.0, 0.2, 1.0, 1.0);
    ph->SetFillColor(kBlue-10);
    ph->Draw();
  }

  Int_t ih = gr->GetHighlightPoint();
  if (ih == -1) return;
  TRsnFragment *frag = group->FragmentAt(ih);
  if (!frag) return;

  TVirtualPad *save = gPad;
  ph->cd();
  TObject *element = frag->FindElement(tagname);
  if (!element) ph->Clear();
  else element->Draw();
  save->cd();
}
Ejemplo n.º 2
0
//________________________________________________________
void GFHistManager::DrawLegend(Int_t layer, Int_t histNo)
{
  // histNo starting at '0'
  // We must already be in the correct pad, layer and histNo must exist

  if(fLegendArrays && layer <= fLegendArrays->GetLast() && fLegendArrays->At(layer)){
    TObjArray* legends = static_cast<TObjArray*>(fLegendArrays->At(layer));
    TObject* legend = (histNo <= legends->GetLast() ? legends->At(histNo) : NULL);
    if(legend) legend->Draw();
  }
}
Ejemplo n.º 3
0
void QUserPanel::DrawObjectOnCanvas(const char* itemname)
{
   RemoveLink("DrawItem");
   AddLink(itemname, "DrawItem");
   TObject* obj = GetLinked("DrawItem", 2);
   if (obj!=0) {
      fxDrawCanvas->getCanvas()->Clear();
      fxDrawCanvas->getCanvas()->cd();
      obj->Draw("");
      fxDrawCanvas->getCanvas()->Update();
   }
}
Ejemplo n.º 4
0
/**
 * Steering 
 * 
 * @param input Input file 
 */
void
ExtractGSE(const char* input)
{
  if (!gROOT->GetClass("GraphSysErr")) 
    gROOT->LoadMacro("$HOME/GraphSysErr/GraphSysErr.C+g");

  TString base = gSystem->BaseName(input); base.ReplaceAll(".root","");
  TFile*  file = TFile::Open(input, "READ");
  if (!file) return;

  TH1* cent = GetH1(file, "realCent");

  Bool_t first = true;
  TList* stack = new TList;
  for (Int_t i = 1; i <= cent->GetNbinsX(); i++) {
    Double_t c1 = cent->GetXaxis()->GetBinLowEdge(i);
    Double_t c2 = cent->GetXaxis()->GetBinUpEdge(i);
    TObject* g  = MakeGSE(file, c1, c2);
    if (!g) continue;
    stack->Add(g);    
    if (first) g->Draw("quad stat combine axis");
    else       g->Draw("quad stat combine");
    first = false;
  }

  TString obase(base); obase.Prepend("GSE_");
  
  std::ofstream out(Form("%s.input", obase.Data()));
  GraphSysErr::Export(stack, out, "HFC", 2);
  out << "*E" << std::endl;
  out.close();

  TFile* rout = TFile::Open(Form("%s.root", obase.Data()), "RECREATE");
  stack->Write("container", TObject::kSingleKey);
  rout->Write();
  
}
Ejemplo n.º 5
0
void
Enlarge(Int_t i)
{
  
  //  toolcanvas->cd();
  TObject *o;
  TList *ll = toolcanvas->GetListOfPrimitives();
  for (Int_t ii=ll->GetEntries()-1; ii>=0; ii--)
    {
      o = ll->At(ii);
      ll->Remove(o);
    }
  toolcanvas->SetWindowSize(toolw-28, toolh-8);
  toolcanvas->cd();
  bclose->Draw();

  //  canvas->cd();
  vp = (TPad*)canvas->GetListOfPrimitives()->At(i);
  if (!vp) return;
  // else
  //   cout << "selected pad name " << vp->GetName() << endl;

  TList *alist;
  if (vp->GetListOfPrimitives()->GetEntries() > 1)
    {
      graph0 = (TH1*) vp->GetListOfPrimitives()->At(1);
      //      graph1 = (TH1*) graph0->Clone("graph1");
      alist = vp->GetListOfPrimitives();
    }
  else
    return;
  
  Char_t opt[50];
  strcpy(opt,graph0->GetDrawOption());

  //  display->Draw();
  display = SafeConstructCanvas("display");
  display->Draw();
  display->cd();
  gROOT->SetSelectedPad(display);

  // std::cout << "______Drawing Pad______\n\t" 
  // 	  << gPad->GetName() << std::endl;

  TString option;
  TH1* anh, *anhh;
  TObject *oo;
  for (Int_t i=1; i<alist->GetEntries(); i++)
    {
      oo = alist->At(i);

      if (oo->InheritsFrom(TH1::Class()))
        {
	anh = static_cast<TH1*>(oo);
	option = anh->GetDrawOption();
	option += "HE";
	if (i>1)
	  option += "same";

	if (oo->InheritsFrom(TH2::Class()))
	  anhh = anh->DrawCopy("colz");
	else
	  anhh = anh->DrawCopy(option.Data());
	anhh->SetFillStyle(0);
	anhh->SetLineColor(anh->GetLineColor());
	cout << anhh->GetName() << " with option=\"" 
	     << option.Data() << "\"" 
	     << " lcolor=" << anhh->GetLineColor()
	     << " fcolor=" << anhh->GetFillColor()
	     << " fstyle=" << anhh->GetFillStyle()
	     << flush << endl;
	display->Modified();
	display->Update();
	//	gSystem->Sleep(5000);
	
	//	anhh->SetFillColor(anh->GetFillColor());
	//	anhh->SetFillStyle(anh->GetFillStyle());
        }
      else if (i<alist->GetEntries()-1)
        oo->Draw();
    }
  display->Modified();
  display->Update();

  
}
Ejemplo n.º 6
0
//////////////////////	drawhisto by name	//////////////////////////////////////////////////////////////////////
//void drawbyname(char* histname)
///////////////////////////////////////////////////////////////////
drawbyname(char* histname){

	TObject *obj;
	obj = gFile->FindKeyAny(histname)->ReadObj();
	obj->Draw();	
	}