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


C++ TObject::ClassName方法代码示例

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


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

示例1: Modified

//______________________________________________________________________________
void ArgusHistoDisplay::Modified(Bool_t processEvents)
{
   if (!fCanvas) {
      return;
   }

   Int_t i, j;
   double x1, x2, y1, y2;
   TObject *ptr;

   fStyle->cd();

   for (i = 0; i < fNumberOfPads; i++) {
      fPad[i]->GetRangeAxis(x1, y1, x2, y2);
      for (j = 0; j < fNumberOfCurrentDisplayTypes; j++) {
         ptr = static_cast<TObjArray*>(fObjects->At(fCurrentDisplayType->At(j)))->At(i);
         if (x1 != 0 && TMath::Abs((1.1 - x2) / 1.1) > 1e-6 && y1 !=0 && TMath::Abs((1.1 - y2)/1.1) > 1e-6) {
            if (!strcmp(ptr->ClassName(), "ROMETGraph") ||
                !strcmp(ptr->ClassName(), "ROMETCutG")) {
               static_cast<ROMETGraph*>(ptr)->GetXaxis()->SetRangeUser(x1, x2);
               static_cast<ROMETGraph*>(ptr)->GetYaxis()->SetRangeUser(y1, y2);
            } else {
               static_cast<TH1*>(ptr)->GetXaxis()->SetRangeUser(x1, x2);
               static_cast<TH1*>(ptr)->GetYaxis()->SetRangeUser(y1, y2);
            }
         }
         if (!strcmp(ptr->ClassName(), "ROMETGraph") ||
             !strcmp(ptr->ClassName(), "ROMETCutG")) {
            SetStatisticBox(true);
            // this allows changing X range
            fPad[i]->cd();
            SetLimits(static_cast<TGraph*>(ptr));
         }
      }
      fPad[i]->Modified();
   }

   fCanvas->GetCanvas()->cd(1);
   fCanvas->GetCanvas()->Modified();
   fCanvas->GetCanvas()->Update();

   if (processEvents) {
      gROME->GetApplication()->DisableFPETrap();
      gSystem->ProcessEvents();
      gROME->GetApplication()->EnableFPETrap();
      gSystem->Sleep(10);
   }
}
开发者ID:cjpl,项目名称:rome,代码行数:49,代码来源:ArgusHistoDisplay.cpp

示例2: extractObjectFromPad

TList* extractObjectFromPad(TPad* pad, const char* name)
{
  TList* objects = new TList();
  TList* primitivesList = pad->GetListOfPrimitives();
  assert(primitivesList);
  for (int i = 0; i < primitivesList->GetSize(); ++i) {
    TObject* object = primitivesList->At(i);
    std::cout << object->ClassName() << ' ' << object->GetName() << std::endl;
    if (object->InheritsFrom("TPad")) {
      TList* objectsFromPad = extractObjectFromPad(static_cast<TPad*>(object), name);
      for (int j = 0; j < objectsFromPad->GetSize(); ++j)
        objects->Add(objectsFromPad->At(j));
    } else if (object->InheritsFrom("THStack")) {
      TList* hList = (static_cast<THStack*>(object))->GetHists();
      for (int j = 0; j < hList->GetSize(); ++j)
        if (!strcmp(hList->At(j)->GetName(), name)) {
          objects->Add(hList->At(j));
        }
    } else if (!strcmp(object->GetName(), name)) {
      std::cout << "--->" << name << std::endl;
      objects->Add(object);
    }
  }
  return objects;
}
开发者ID:Dominik-Mitzel,项目名称:radiatedModule,代码行数:25,代码来源:dominik.C

示例3: Terminate

void rdphi::Terminate()
{
//cout << "total event: " << NevtAll << "rejected: " << rejected_events << endl; 

  TFile *f = new TFile("output.root","RECREATE");

  //Write output Histograms
  TList *tl = GetOutputList();
  int l = tl->GetEntries();
  for ( int i = 0 ; i < l ; i++ )
  {
    TObject *o = tl->At(i);

    if ( o->InheritsFrom("TH1") )
    {
      cout << "TresChorros: Saving Histogram: "
          << "  Class: " << o->ClassName()  
          << "  Name: "<< o->GetName() 
          << "  Title: " << o->GetTitle()
          << " " 
          << endl << flush;
      o->Write();
    }
    }
  f->Flush();
  f->Close();  

}
开发者ID:affablelochan,项目名称:DataAnalysis,代码行数:28,代码来源:rdphi_v1.C

示例4: getHisto

TH1F * getHisto(TFile * file, const char * name, double fMin, double fMax, unsigned int rebin) {
  TObject * h = file->Get(name);
  if(h == 0)
    cout  << "Can't find object " << name << "\n";
  TH1F * histo = dynamic_cast<TH1F*>(h);
  if(histo == 0)
    cout << "Object " << name << " is of type " << h->ClassName() << ", not TH1\n";
  TH1F * new_histo = new TH1F(name, name, (int) (fMax-fMin), fMin, fMax);
  int bin_num=0;
  for (int i = (int)fMin; i <= (int)fMax; ++i ) {
    bin_num= (i - (int)fMin + 1);  
    new_histo->SetBinContent( bin_num, histo->GetBinContent(i) );				    
  } 
  delete histo;
  new_histo->Sumw2();
  new_histo->Rebin(rebin);
  for(int i = 1; i <= new_histo->GetNbinsX(); ++i) {
    if(new_histo->GetBinContent(i) == 0.00) {
      cout<< " WARNING: histo " << name << " has 0 enter in bin number " << i << endl;   
        }
    if(new_histo->GetBinContent(i) < 0.1) {
      new_histo->SetBinContent(i, 0.0);
      new_histo->SetBinError(i, 0.0);
       cout<< " WARNING: setting value 0.0 to histo " << name << " for bin number " << i << endl;   
    }  
  }
  
  return new_histo;
}
开发者ID:12345ieee,项目名称:cmg-cmssw,代码行数:29,代码来源:zMuMuRooFit.cpp

示例5: OpenContextMenu

void KVLVContainer::OpenContextMenu(TGFrame* f, Int_t but, Int_t x, Int_t y)
{
    // Open context menu when user right-clicks an object in the list.
    // Calling AllowContextMenu(kFALSE) will disable this.
    // We also fill the list fPickOrderedObjects with the selected objects
    // in the order of clicking
    //
    // if fUseObjLabelAsRealClass=kTRUE (and if objects inherit from KVBase)
    // then the context menu opened will be that of the class given by
    // KVBase::GetLabel. The object's KVBase::GetObject() method must
    // return the real object to use.

    if (but == kButton1) {
        TGLVEntry* el = (TGLVEntry*)f;
        TObject* ob = (TObject*)el->GetUserData();
        if (!fControlClick || !GetMultipleSelection()) fPickOrderedObjects->Clear();
        if (ob) {
            Bool_t in_list = fPickOrderedObjects->FindObject(ob);
            if (in_list) fPickOrderedObjects->Remove(ob);
            else fPickOrderedObjects->AddLast(ob);
        }
        return;
    }

    // context menus globally disabled and no exceptions defined
    if (!fAllowContextMenu && !fContextMenuClassExceptions) return;

    if (but == kButton3) {
        //        Error("OpenContextMenu","x=%d y=%d",x,y);
        //        fContextMenu->Popup(x,y,this); return;

        TGLVEntry* el = (TGLVEntry*)f;
        TObject* ob = (TObject*)el->GetUserData();
        if (ob) {

            TObject* CMob = ob;
            TString CMobClass = ob->ClassName();

            if (fUseObjLabelAsRealClass && ob->TestBit(KVBase::kIsKaliVedaObject)) {
                KVBase* bob = dynamic_cast<KVBase*>(ob);
                CMobClass = bob->GetLabel();
                CMob = bob->GetObject();
            }
            // check class context menu status
            if (fContextMenuClassExceptions) {
                if ((!fAllowContextMenu && fContextMenuClassExceptions->FindObject(CMobClass))
                        || (fAllowContextMenu && !fContextMenuClassExceptions->FindObject(CMobClass)))
                    fContextMenu->Popup(x, y, CMob);
            } else if (fAllowContextMenu)  fContextMenu->Popup(x, y, CMob);
        }
    }
}
开发者ID:jdfrankland,项目名称:kaliveda,代码行数:52,代码来源:KVLVContainer.cpp

示例6: findObjectFromCanvas

//------------------------------------------------------------------------------
TObject* PlotAlignmentValidation::findObjectFromCanvas(TCanvas* canv, const char* className, Int_t n) {
  // Finds the n-th instance of the given class from the canvas
  TIter next(canv->GetListOfPrimitives());
  TObject* obj = 0;
  Int_t found = 0;
  while ((obj = next())) {
    if(strncmp(obj->ClassName(), className, 10) == 0) {
      if (++found == n)
        return obj;
    }
  }

  return 0;
}
开发者ID:gouskos,项目名称:cmssw,代码行数:15,代码来源:PlotAlignmentValidation.C

示例7: saveSummaryLoop

void RootWImage::saveSummaryLoop(TPad* basePad, std::string baseName, TFile* myTargetFile) {
  TList* aList;
  TObject* anObject;
  TPad* myPad;
  std::string myClass;
  std::string myName;

  TNamed* aNamed;

  // TSystemFile* aFile;
  // string aFileName;
  // string aFileNameTail;
  // TFile* myRootFile;

  aList = basePad->GetListOfPrimitives();
  for (int i=0; i<aList->GetEntries(); ++i) {
    anObject = aList->At(i);
    myClass = anObject->ClassName();
    if (myClass=="TPad") { // Go one step inside
      myPad = (TPad*) anObject;
      saveSummaryLoop(myPad, baseName, myTargetFile);
    } else if (
	       (myClass=="TProfile") ||
	       (myClass=="TGraph") ||
	       (myClass=="TH1D") ||
	       (myClass=="TH2C") ||
	       (myClass=="TH2D") ||
	       (myClass=="THStack") 
	       ) {
      aNamed = (TNamed*) anObject;
      myTargetFile->cd();
      myName = Form("%s.%s", baseName.c_str(), aNamed->GetName());
      myName = RootWeb::cleanUpObjectName(myName);
      aNamed->SetName(myName.c_str());
      aNamed->Write();
    } else if (
	       (myClass=="TEllipse") ||
	       (myClass=="TFrame") ||
	       (myClass=="TLatex") ||
	       (myClass=="TLegend") ||
	       (myClass=="TLine") ||
	       (myClass=="TPaveText") ||
	       (myClass=="TPolyLine") ||
	       (myClass=="TText") 
	       ) {
    } else {
      std::cerr << Form("Unhandled class %s", myClass.c_str()) << std::endl;
    }
  }
}
开发者ID:Deepali-Garg,项目名称:Ph2_ACF,代码行数:50,代码来源:rootweb.cpp

示例8: GetObject

  /** 
   * Get an object from a collection 
   * 
   * @param c    Collection
   * @param name Name of object
   * @param cl   Possible class to check against
   * @param verbose  Be verbose
   * 
   * @return Pointer to object or null
   */
  static TObject* GetObject(TCollection* c, const TString& name, 
			    TClass* cl, Bool_t verbose=true)
  {
    TObject* o = c->FindObject(name);
    if (!o) { 
      if (verbose)
	Warning("GetObject", "%s not found in %s", name.Data(), c->GetName());
      return 0;
    }
    if (cl && !o->IsA()->InheritsFrom(cl)) {
      if (verbose) 
	Warning("GetCollection", "%s is not a %s but a %s", 
		name.Data(), cl->GetName(), o->ClassName());
      return 0;
    }
    return o;
  }
开发者ID:ktf,项目名称:AliPhysics,代码行数:27,代码来源:UnfoldMultDists.C

示例9: Exception

// A function that get histogram and sets contents to 0 
// if entries are too small
TH1 * getHisto(TFile * file, const char * name, unsigned int rebin) {
  TObject * h = file->Get(name);
  if(h == 0)
    throw edm::Exception(edm::errors::Configuration) 
      << "Can't find object " << name << "\n";
  TH1 * histo = dynamic_cast<TH1*>(h);
  if(histo == 0)
    throw edm::Exception(edm::errors::Configuration) 
      << "Object " << name << " is of type " << h->ClassName() << ", not TH1\n";
  histo->Rebin(rebin);  
  for(int i = 1; i <= histo->GetNbinsX(); ++i) {
    if(histo->GetBinContent(i) < 0.1) {
      histo->SetBinContent(i, 0.0);
      histo->SetBinError(i, 0.0);
    }
  }
  return histo;
}
开发者ID:CMSRA2Tau,项目名称:PATConfig,代码行数:20,代码来源:zFitToyMc.cpp

示例10: GetO

  //____________________________________________________________________
  static TObject* GetO(TDirectory* dir, const char* name, TClass* cls=0)
  {
    if (!dir) {
      Warning("GetO", "No directory passed");
      return 0;
    }

    TObject* o = dir->Get(name);
    if (!o) {
      Warning("GetO", "object %s not found in %s",
	      name, dir->GetPath());
      return 0;
    }
    if (!cls) return o;
    if (!o->IsA()->InheritsFrom(cls)) {
      Warning("GetO", "Object %s in %s is not a %s, but a %s",
	      name, dir->GetPath(), cls->GetName(), o->ClassName());
      return 0;
    }
    return o;
  }
开发者ID:ktf,项目名称:AliPhysics,代码行数:22,代码来源:CompareResults.C

示例11: fitsHere

Bool_t fitsHere(TLegend *l,Double_t x1, Double_t y1, Double_t x2, Double_t y2)
{
    Bool_t fits = true;
    TList *list = l->GetListOfPrimitives();
    for (Int_t k = 0; list->At(k) != 0 && fits; k++)
    {
        TObject *obj = ((TLegendEntry*)(list->At(k)))->GetObject();
        if (obj == 0) continue;
        TClass *cl = obj->IsA();

        //Histogram, drawn as a histogram
        if (cl->InheritsFrom("TH1") && !cl->InheritsFrom("TH2") && !cl->InheritsFrom("TH3")
         && cl != TProfile::Class() && ((TH1*)obj)->GetMarkerColor() == kWhite)
        {
            Int_t where = 0;
            TH1 *h = (TH1*)obj;
            for (Int_t i = 1; i <= h->GetNbinsX() && fits; i++)
            {
                if (h->GetBinLowEdge(i) + h->GetBinWidth(i) < x1) continue;   //to the left of the legend
                if (h->GetBinLowEdge(i)                     > x2) continue;   //to the right of the legend
                if (h->GetBinContent(i) > y1 && h->GetBinContent(i) < y2) fits = false;   //inside the legend
                if (h->GetBinContent(i) < y1)
                {
                    if (where == 0) where = -1;             //below the legend
                    if (where == 1) fits = false;           //a previous bin was above it so there's a vertical line through it
                }
                if (h->GetBinContent(i) > y2)
                {
                    if (where == 0) where = 1;              //above the legend
                    if (where == -1) fits = false;          //a previous bin was below it so there's a vertical line through it
                }
            }
            continue;
        }
        //Histogram, drawn with Draw("P")
        else if (cl->InheritsFrom("TH1") && !cl->InheritsFrom("TH2") && !cl->InheritsFrom("TH3")
              && cl != TProfile::Class())
        //Probably TProfile would be the same but I haven't tested it
        {
            TH1 *h = (TH1*)obj;
            for (Int_t i = 1; i <= h->GetNbinsX() && fits; i++)
            {
                if (h->GetBinLowEdge(i) + h->GetBinWidth(i)/2 < x1) continue;
                if (h->GetBinLowEdge(i)                       > x2) continue;
                if (h->GetBinContent(i) > y1 && h->GetBinContent(i) < y2) fits = false;
                if (h->GetBinContent(i) + h->GetBinError(i) > y2 && h->GetBinContent(i) - h->GetBinError(i) < y2) fits = false;
                if (h->GetBinContent(i) + h->GetBinError(i) > y1 && h->GetBinContent(i) - h->GetBinError(i) < y1) fits = false;
            }
        }
        else if (cl->InheritsFrom("TF1") && !cl->InheritsFrom("TF2"))
        {
            //TF1 *f = (TF1*)obj;
            //Double_t max = f->GetMaximum(x1,x2);
            //Double_t min = f->GetMinimum(x1,x2);
            //if (min < y2 && max > y1) fits = false;
        }
        // else if (cl->InheritsFrom(...... add more objects here
        else
        {
            cout << "Don't know how to place the legend around objects of type " << obj->ClassName() << "." << endl
                 << "Add this class into placeLegend.C if you want it to work properly." << endl
                 << "The legend will still be placed around any other objects." << endl;
        }
    }
    return fits;
}
开发者ID:hroskes,项目名称:HiggsPlot,代码行数:66,代码来源:placeLegend.C

示例12: addn2

void addn2() {

  // open existing f1:

  char* fn[99];
  int ni;

  // SR90 maps, mod D003

  ni = -1;
  ni++; fn[ni] = "SR90-map-00a.root";
  ni++; fn[ni] = "SR90-map-00b.root";
  ni++; fn[ni] = "SR90-map-01a.root";
  ni++; fn[ni] = "SR90-map-01b.root";
  ni++; fn[ni] = "SR90-map-02.root";
  ni++; fn[ni] = "SR90-map-03.root";
  ni++; fn[ni] = "SR90-map-05a.root";
  ni++; fn[ni] = "SR90-map-05b.root";
  ni++; fn[ni] = "SR90-map-07a.root";
  ni++; fn[ni] = "SR90-map-07b.root";
  ni++; fn[ni] = "SR90-map-07c.root";
  ni++; fn[ni] = "SR90-map-07d.root";

  // direct X-rays 9.4.2014 module D0003

  ni = -1;
  ni++; fn[ni] = "X-ray-20-modtd40000.root";
  ni++; fn[ni] = "X-ray-20-vthr60-modtd1000.root";
  ni++; fn[ni] = "X-ray-27-vthr60-modtd1000.root";
  ni++; fn[ni] = "X-ray-35-modtd40000.root";
  ni++; fn[ni] = "X-ray-35-vthr60-close-modtd65000.root";
  ni++; fn[ni] = "X-ray-35-vthr60-midpos-0p1mA-modtd10000.root";
  ni++; fn[ni] = "X-ray-35-vthr60-midpos-halfcur-modtd40000.root";
  ni++; fn[ni] = "X-ray-35-vthr60-modtd40000.root";

  int nmax = ni;

  TFile f1(fn[0]);

  if( f1.IsZombie() ) {
    cout << "Error opening " << fn[0] << endl;
    return;
  }
  cout << "opened " << fn[0] << endl;

  //--------------------------------------------------------------------
  // create f0:

  TFile f0("fileA.root", "RECREATE");
  cout << "created ";
  gDirectory->pwd();

  /*
  TFile options:  
  NEW or CREATE   create a new file and open it for writing,
                  if the file already exists the file is
                  not opened.
  RECREATE        create a new file, if the file already
                  exists it will be overwritten.
  UPDATE          open an existing file for writing.
                  if no file exists, it is created.
  READ            open an existing file for reading (default).
  NET             used by derived remote file access
                  classes, not a user callable option
  WEB             used by derived remote http access
                  class, not a user callable option
  "" (default), READ is assumed.
  */

  //--------------------------------------------------------------------
  // copy f1 to f0:

  f1.cd();

  cout << "keys:\n";
  f1.GetListOfKeys()->Print();

  cout << "pwd: ";
  f1.pwd();

  cout << "ls: \n";
  f1.ls();

  // f1 has sub-dir:

  cout << "First: " << f1.GetListOfKeys()->First()->GetName() << endl;
  cout << "First: " << f1.GetListOfKeys()->First()->ClassName() << endl;
  char* dir1 = f1.GetListOfKeys()->First()->GetName();
  cout << "cd to " << dir1 << endl;
  f1.cd( dir1 );
  cout << "we are in ";
  gDirectory->pwd();

  gDirectory->ReadAll(); // load histos

  TList * lst = gDirectory->GetList();
  cout << lst->GetName() << endl;
  cout << lst->GetTitle() << endl;
  cout << "size    " << lst->GetSize() << endl;
  cout << "entries " << lst->GetEntries() << endl;
//.........这里部分代码省略.........
开发者ID:andreavargas,项目名称:Psi46testDesy,代码行数:101,代码来源:addn2.C

示例13: DrawStatUncertainty

void DrawStatUncertainty()
{
  TFile *f;
  TString ss("ExpStat_PYTHIA_canvasOutFile.root");
  f = new TFile(ss);
  TCanvas *c
  c = (TCanvas*)f->Get("_R92777");
  TString algoTitle;
  algoTitle = "k_{T} D = 0.6";
  TList *li = (TList*)gPad->GetListOfPrimitives();
  TObject *obj;
  
  TIter next(li);
  TH1D *histList[100], *htmp;
  int i,j,N;
  

  while ((obj = (TObject*)next()))
    {
      TString cname = obj->ClassName();
      TString name = obj->GetName();
      
      cout << cname <<" "<<name<<endl;    
      if (cname=="TH1D")
        {
          
          histList[N] = (TH1D*)gPad->FindObject(obj);
          histList[N]->SetFillColor(0);
          histList[N]->SetFillStyle(0);
          N++;
        } 
    }
  
  TCanvas *c = new TCanvas("c","c");
  gPad->SetLogx();
  gPad->SetLogy();
  //histList[0]->SetMaximum(1e+10);
  histList[0]->SetTitle("");
  histList[0]->GetXaxis()->SetTitle("jet p_{T} (GeV)");
  histList[0]->GetXaxis()->SetTitleFont(42);
  histList[0]->GetXaxis()->SetLabelFont(42);
  histList[0]->GetXaxis()->SetTitleSize(0.05);
  histList[0]->GetXaxis()->SetLabelSize(0.05);
  histList[0]->GetYaxis()->SetTitle("Relative Statistical Uncertainty");
  histList[0]->GetYaxis()->SetTitleFont(42);
  histList[0]->GetYaxis()->SetLabelFont(42);
  histList[0]->GetYaxis()->SetTitleSize(0.05);
  histList[0]->GetYaxis()->SetLabelSize(0.05);
  histList[0]->GetYaxis()->SetNdivisions(505);

  histList[0]->SetLineWidth(1);
  histList[0]->SetLineStyle(1);
  histList[0]->SetLineColor(1);
  histList[0]->SetMarkerColor(1);
  histList[0]->SetMarkerStyle(20);
  histList[0]->SetMarkerSize(1.2); 

  histList[1]->SetLineColor(2);
  histList[1]->SetMarkerColor(2);
  histList[1]->SetLineWidth(1);
  histList[1]->SetMarkerStyle(25);
  histList[1]->SetLineStyle(1);
  histList[1]->SetMarkerSize(1.2); 

  histList[2]->SetLineWidth(1);
  histList[2]->SetLineStyle(1);
  histList[2]->SetLineColor(4);
  histList[2]->SetMarkerColor(4);
  histList[2]->SetMarkerStyle(22);
  histList[2]->SetMarkerSize(1.2); 

  histList[0]->Draw("P");
  histList[1]->Draw("sameP");
  histList[2]->Draw("sameP");

  TLegend *leg = new TLegend(0.47,0.2,0.92,0.35);
  leg->SetTextFont(42);
  leg->AddEntry(histList[0],"|y| < 0.55","P");
  leg->AddEntry(histList[1],"1.10 < |y| < 1.70","P");
  leg->AddEntry(histList[2],"1.70 < |y| < 2.50","P");
  leg->SetFillColor(0);
  leg->SetBorderSize(0);
  leg->Draw();

  TPaveText *pave3 = new TPaveText(0.2,0.65,0.45,0.9,"NDC");
  pave3->SetTextFont(42);
  pave3->AddText("CMS preliminary");
  pave3->AddText(algoTitle);
  pave3->AddText("#sqrt{s} = 10 TeV");
  pave3->AddText("");
  pave3->AddText("#int L dt = 10 pb^{-1}");
  pave3->SetFillColor(0);
  pave3->SetBorderSize(0);
  pave3->Draw();

  c->Print("KT6_StatUncertainty.eps");
  
}
开发者ID:ajaykumar649,项目名称:scripts,代码行数:98,代码来源:DrawStatUncertainty.C

示例14: ojtable

void ojtable(const char *className)
{
    static int fTableOffset = 0;
    if (!fTableOffset) fTableOffset = gObjectTable->IsA()->GetDataMemberOffset("fTable");
//  gObjectTable->Print();
    TClass *kl;
    if (className && !*className) className=0;

    const char *qwe = ".*";
    if (className) qwe = className;
    TRegexp regexp(qwe);
    int regexpLen=0;

    int sz = gObjectTable->GetSize();
    int *ptr = new int[sz];
    int *idx = new int[sz];

    TObject **tab = *((TObject ***)((char*)gObjectTable+fTableOffset));
    TObject *to;
    printf ("tab %p[%d]\n",tab,sz);
    int i,num=0;
    double hSize=0;
    int    hNumb=0;
    const char *info_name = 0;
    for (i=0; i<sz; i++)
    {
        to = tab[i];
        if (!to) 						continue;
        if (!to->TestBit(TObject::kNotDeleted))  		continue;
        int hs = SizeOfH(to);
        if (hs) {
            hSize+=hs;
            hNumb++;
        }
        if (className && regexp.Index(to->ClassName(),&regexpLen)<0)	continue;
        const char *mk = StMkDeb::GetUser(to);
        if(mk && *mk) printf("%s(%p) in %s\n",to->ClassName(),to,mk);
        ptr[num++]=int(to);
    }
    printf("TH1 N=%d, Size = %g\n",hNumb,hSize);

    TMath::Sort(num,ptr,idx,0);
    int last = 0;
    printf("Selected %d objects\n",num);
    for (i=0; i<num; i++) {
        int ix = idx[i];
        to = (TObject*)ptr[ix];
        int dist = 0;
        if (i) dist = ptr[ix]-last;
        last = ptr[ix];

//    if ((int)to == 0xc94ff34) {
//       printf("Skipped %p\n",to); continue; }

        info_name = "??";
        info_name=typeid(*to).name();
        kl = to->IsA();
        printf ("%4d +%6d : obj = %p(%3d) %s::%s \tinfo=%s\n",i,dist,to,kl->Size(),kl->GetName(),to->GetName(),info_name);

        if (strcmp("TClonesArray",kl->GetName())) continue;
        TClonesArray *tcl = ((TClonesArray*)to);
        printf(" Sizes = %d %d\n",tcl->GetLast()+1,tcl->Capacity());
        tcl->ls("");




    }
    delete [] ptr;
    delete [] idx;
}
开发者ID:star-bnl,项目名称:star-macros,代码行数:71,代码来源:ojtable.C

示例15: DrawLogInclusivePlots

void DrawLogInclusivePlots(TString ALGO)
{
  TFile *f;
  TString ss(ALGO+"canvasOutFile.root");
  f = new TFile(ss);
  TCanvas *c
  c = (TCanvas*)f->Get("_R80570");
  TString algoTitle;
  if (ALGO=="KT6")
    algoTitle = "k_{T} D = 0.6";
  else
    algoTitle = "SISCone R = 0.7";
  TList *li = (TList*)gPad->GetListOfPrimitives();
  TObject *obj;
  
  TIter next(li);
  TH1D *histList[100], *htmp;
  int i,j,N;
  

  while ((obj = (TObject*)next()))
    {
      TString cname = obj->ClassName();
      TString name = obj->GetName();
      
      cout << cname <<" "<<name<<endl;    
      if (cname=="TH1D")
        {
          
          histList[N] = (TH1D*)gPad->FindObject(obj);
          histList[N]->SetFillColor(0);
          histList[N]->SetFillStyle(0);
          N++;
        } 
    }
  
  TCanvas *c = new TCanvas("c","c");
  gPad->SetLogx();
  gPad->SetLogy();
  histList[0]->SetMaximum(1e+10);
  histList[0]->SetTitle("");
  histList[0]->GetXaxis()->SetTitle("jet p_{T} (GeV)");
  histList[0]->GetXaxis()->SetTitleFont(42);
  histList[0]->GetXaxis()->SetLabelFont(42);
  histList[0]->GetXaxis()->SetTitleSize(0.05);
  histList[0]->GetXaxis()->SetLabelSize(0.05);
  histList[0]->GetXaxis()->SetMoreLogLabels();
  histList[0]->GetXaxis()->SetNoExponent();
  histList[0]->GetYaxis()->SetTitle("d^{2}#sigma/dp_{T}dy (fb/GeV)");
  histList[0]->GetYaxis()->SetTitleFont(42);
  histList[0]->GetYaxis()->SetLabelFont(42);
  histList[0]->GetYaxis()->SetTitleSize(0.05);
  histList[0]->GetYaxis()->SetLabelSize(0.05);
  histList[0]->GetYaxis()->SetNdivisions(505);

  histList[0]->SetLineWidth(2);
  histList[0]->SetLineStyle(1);
  histList[0]->SetLineColor(2);
  histList[1]->SetLineColor(1);
  histList[1]->SetMarkerColor(1);
  histList[1]->SetLineWidth(1);
  histList[1]->SetMarkerStyle(20);
  histList[1]->SetLineStyle(1);

  histList[2]->SetLineWidth(2);
  histList[2]->SetLineStyle(1);
  histList[2]->SetLineColor(2);
  histList[3]->SetLineColor(1);
  histList[3]->SetMarkerColor(1);
  histList[3]->SetLineWidth(1);
  histList[3]->SetMarkerStyle(24);
  histList[3]->SetLineStyle(1);

  histList[4]->SetLineWidth(2);
  histList[4]->SetLineStyle(1);
  histList[4]->SetLineColor(2);
  histList[5]->SetLineColor(1);
  histList[5]->SetMarkerColor(1);
  histList[5]->SetLineWidth(1);
  histList[5]->SetMarkerStyle(21);
  histList[5]->SetLineStyle(1);

  histList[0]->Draw("C");
  histList[1]->Draw("same");
  histList[2]->Draw("sameC");
  histList[3]->Draw("same");
  histList[4]->Draw("sameC");
  histList[5]->Draw("same");

  TLegend *leg = new TLegend(0.47,0.75,0.92,0.9);
  leg->SetTextFont(42);
  leg->AddEntry(histList[1],"0.00 #leq |y| < 0.55 ( #times 32 )","P");
  leg->AddEntry(histList[3],"1.10 < |y| < 1.70 ( #times 16 )","P");
  leg->AddEntry(histList[5],"1.70 < |y| < 2.50 ( #times 8 )","P");
  leg->AddEntry(histList[0],"Theory","L");
  leg->SetFillColor(0);
  leg->SetBorderSize(0);
  leg->Draw();

  TPaveText *pave3 = new TPaveText(0.2,0.2,0.45,0.45,"NDC");
//.........这里部分代码省略.........
开发者ID:ajaykumar649,项目名称:scripts,代码行数:101,代码来源:DrawLogInclusivePlots.C


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