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


C++ TDirectory::GetNkeys方法代码示例

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


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

示例1: dumpStg6Results

void dumpStg6Results(string inFile,string outFile, int nEvents = 0,bool useRBM = 1,double theta2Cut = 0.03, bool NoFromStg5 = true,string Stg5Path = "/data/veritas/bzitzer/bootes_1/data/root/")
{
  gROOT->SetBatch(true);
  TH1D* hSigRF = new TH1D("SigDistRF","Significance Distrbution RF",50,-5,5);
  TH1D* hSigCBG = new TH1D("SigDistCBG","Significance Distrbution CBG",50,-5,5);
  
  // Opening files and getting VEGAS objects:
  TFile* f = new TFile(inFile.c_str(),"READ");
  if(!f->IsOpen() )
    {
      cerr << "Problem opening ROOT file!" << endl;
      return;
    }
  TTree* EventTree = (TTree*)gDirectory->Get("EventStatsTree");
  if( EventTree == NULL )
    {
      cout << "No Event Tree!" << endl;
      return;
    }
  TTree* RunTree = (TTree*)gDirectory->Get("RunStatsTree");
  if( RunTree == NULL )
    {
      cout << "No Run Tree!" << endl;
      return;
    }
  VASkyMap* vaMapOn = (VASkyMap*)gDirectory->Get("RingBackgroundModelAnalysis/SkyMapOn");
  VASkyMap* vaMapAlpha = (VASkyMap*)gDirectory->Get("RingBackgroundModelAnalysis/fAlphaMap");
  VACoordinatePair onCenter = vaMapOn->GetCenter();
  VACoordinatePair eventCoord;
  VACoordinatePair trackCoord;
  VACoordinatePair fRootCoord;
  VACoordinatePair sourceCoord;

  // --------------------
  //  Exclusion regions:
  // --------------------
    
  TDirectory* RBMExclusion = (TDirectory*)gDirectory->Get("RingBackgroundModelAnalysis/ExclusionRegions");

  if( RBMExclusion == NULL )
    {
      cerr << "Problem loading the RBM exclusion directory!" << endl;
      return;
    }
  int nRegions = RBMExclusion->GetNkeys();
  VASkyMapExclusionRegion* hSourceExclusion;
  const int tmp = nRegions;
  VASkyMapExclusionRegion* exclList[tmp];
  vector<VASkyMapExclusionRegion*> vaSourceExcl;

  TIter next(RBMExclusion->GetListOfKeys());
  TKey *key;
  int i=0;
  while(key=(TKey*)next())
    {
      hSourceExclusion = (VASkyMapExclusionRegion*)RBMExclusion->FindObjectAny(key->GetName())->Clone();
      if( hSourceExclusion != NULL)
	{
	  if( hSourceExclusion->wasUsed() )
	    {
	      cout << i << endl;
	      exclList[i] = hSourceExclusion;
	      vaSourceExcl.push_back(hSourceExclusion);
	      cout << hSourceExclusion->GetName() << endl;
	      //cout << "Exclusion Center RA: " << hSourceExclusion->center().getRA_J2000_Deg() << endl;
	      cout << "Exclusion Center RA: " << exclList[i]->center().getRA_J2000_Deg() << endl;
	      
	      cout << "Exclusion Center Dec: " << hSourceExclusion->center().getDec_J2000_Deg() << endl;	  
	      cout << "Exclusion Radius: " << hSourceExclusion->radius_Deg() << endl;
	      i++;
	    }
	}
    }
  nRegions = i;
  dumpExcl(exclList,nRegions,outFile);


  double TelLatRad = 5.52828386357865242e-01;
  double TelLongRad = -1.93649167430676461e+00;
  Float_t EffArea,EnergyGeV,El,Az;
  double RA,Dec;
  double RATrack,DecTrack;
  double DayNS;
  UInt_t MJD;
  UInt_t RunID;
  Float_t El_track,Az_track;
  Float_t El_check,Az_check;
  double MJDDbl;
  Double_t W;
  Double_t liveTime;
  Double_t PsiEventTree;

  int NumRuns = RunTree->GetEntries(); 
  Bool_t IsOn,IsOff;
  double Noise;
  Float_t RA_fRoot,Dec_fRoot;

  EventTree->SetBranchAddress("RunNum",&RunID);
  EventTree->SetBranchAddress("Azimuth",&Az);
  EventTree->SetBranchAddress("Elevation",&El);
//.........这里部分代码省略.........
开发者ID:mbuchove,项目名称:analysis-tools-m,代码行数:101,代码来源:dumpStg6Results.C


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