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


C++ TDatime::Convert方法代码示例

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


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

示例1: SlaveTerminate

void mySelector::SlaveTerminate()
{
   // The SlaveTerminate() function is called after all entries or objects
   // have been processed. When running with PROOF SlaveTerminate() is called
   // on each slave server.
  cout<<"-------------End of Slave Job----------------"<<endl;
  tNow.Set();tNow.Print();
  cout<<"Number of Event: "<<fNumberOfEvents<<", elapsed time: "<<tNow.Convert()-tBegin.Convert()<<"seconds,rate: "<<float(fNumberOfEvents)/(tNow.Convert()-tBegin.Convert())<<endl;
}
开发者ID:heavyflavor,项目名称:script,代码行数:9,代码来源:UseTDirectoryFile.C

示例2: SlaveTerminate

void MySelector::SlaveTerminate()
{
   // The SlaveTerminate() function is called after all entries or
   // objects have been processed. When running with PROOF
   // SlaveTerminate() is called on each slave server.

  // some statistics at end of job
  printf("\n *==* ---------- End of Slave Job ----------   ");
  tNow.Set(); tNow.Print();
  printf(
  "Number of Events: %i, elapsed time: %i sec, rate: %g evts/sec\n"
  ,fNumberOfEvents,
  tNow.Convert()-tBegin.Convert(),
   float(fNumberOfEvents)/(tNow.Convert()-tBegin.Convert()) );
}
开发者ID:0x0all,项目名称:ROOT,代码行数:15,代码来源:MySelector.C

示例3: CheckCacheStatus

Bool_t KVDataSetManager::CheckCacheStatus()
{
   //We check the status of the available datasets cache file.
   //We return kTRUE if the file exists & was last modified
   //less than fMaxCacheTime seconds ago.
   
   TString fullpath;
   Info("KVDataSetManager::CheckCacheStatus", "Checking for available datasets cache file...");
   if( KVBase::SearchKVFile( KVBase::GetWORKDIRFilePath(fCacheFileName), fullpath ) ){
      
      // file exists - how old is it ?
      FileStat_t file_info;
      gSystem->GetPathInfo( fullpath.Data(), file_info );
      TDatime file_date( file_info.fMtime );
      TDatime now;
      UInt_t file_age = now.Convert() - file_date.Convert();
      Info("KVDataSetManager::CheckCacheStatus", "...file found. It is %u seconds old", file_age);
      if( file_age < fMaxCacheTime ) {
         Info("KVDataSetManager::CheckCacheStatus", "Using cached file");
         return kTRUE;
      }
      else
         Info("KVDataSetManager::CheckCacheStatus", "File is too old (max time=%u). Update will be performed.", fMaxCacheTime);         
   }
   else
      Info("KVDataSetManager::CheckCacheStatus", "...no file found");
   return kFALSE;
}
开发者ID:pwigg,项目名称:kaliveda,代码行数:28,代码来源:KVDataSetManager.cpp

示例4: seism

void seism() {

   TStopwatch sw; sw.Start();
   //set time offset
   TDatime dtime;
   gStyle->SetTimeOffset(dtime.Convert());

   TCanvas *c1 = new TCanvas("c1","Time on axis",10,10,1000,500);
   c1->SetFillColor(42);
   c1->SetFrameFillColor(33);
   c1->SetGrid();

   Float_t bintime = 1; //one bin = 1 second. change it to set the time scale
   TH1F *ht = new TH1F("ht","The ROOT seism",10,0,10*bintime);
   Float_t signal = 1000;
   ht->SetMaximum( signal);
   ht->SetMinimum(-signal);
   ht->SetStats(0);
   ht->SetLineColor(2);
   ht->GetXaxis()->SetTimeDisplay(1);
   ht->GetYaxis()->SetNdivisions(520);
   ht->Draw();

   for (Int_t i=1;i<2300;i++) {
      //======= Build a signal : noisy damped sine ======
      Float_t noise  = gRandom->Gaus(0,120);
      if (i > 700) noise += signal*sin((i-700.)*6.28/30)*exp((700.-i)/300.);
      ht->SetBinContent(i,noise);
      c1->Modified();
      c1->Update();
      gSystem->ProcessEvents(); //canvas can be edited during the loop
   }
   printf("Real Time = %8.3fs, Cpu Time = %8.3fs\n",sw.RealTime(),sw.CpuTime());
}
开发者ID:ancapopescu13,项目名称:root,代码行数:34,代码来源:seism.C

示例5: PrintControlRate

void KVINDRAOnlineDataAnalyser::PrintControlRate()
{
   TDatime nowtime;
   int time_passed = nowtime.Convert() - fStart.Convert();
   if (time_passed < 1.0) {
      fEventsRefresh *= 2;
      return;
   }
   // check time - we aim for a 5 second refresh
   fEventsRefresh *= 5. / time_passed;
   // minimum 5 events
   fEventsRefresh = TMath::Max(fEventsRefresh, 5);
   Float_t acq_rate = (1.0 * (events - last_events)) / (1.0 * time_passed);
   printf("Events read = %d  <=>  Control rate = %f /sec.\n", events, acq_rate);
   last_events = events;

   fStart.Set();

   if (fDumpEvents) fRunFile->GetFiredDataParameters()->ls();
}
开发者ID:GiuseppePast,项目名称:kaliveda,代码行数:20,代码来源:KVINDRAOnlineDataAnalyser.cpp

示例6: candleplot

void candleplot() {

   gStyle->SetTimeOffset(0);
   TRandom *rand = new TRandom();
   TDatime *dateBegin = new TDatime(2010,1,1,0,0,0);
   TDatime *dateEnd = new TDatime(2011,1,1,0,0,0);

   TH2I *h1 = new TH2I("h1","Machine A + B",12,dateBegin->Convert(),dateEnd->Convert(),1000,0,1000);
   TH2I *h2 = new TH2I("h2","Machine B",12,dateBegin->Convert(),dateEnd->Convert(),1000,0,1000);

   h1->GetXaxis()->SetTimeDisplay(1);
   h1->GetXaxis()->SetTimeFormat("%m/%y");
   h1->GetXaxis()->SetTitle("Date [month/year]");

   float Rand;
   for (int i = dateBegin->Convert(); i < dateEnd->Convert(); i+=86400*30) {
      for (int j = 0; j < 1000; j++) {
         Rand = rand->Gaus(500+sin(i/10000000.)*100,50); h1->Fill(i,Rand);
         Rand = rand->Gaus(500+sin(i/11000000.)*100,70); h2->Fill(i,Rand);
      }
   }

   h1->SetBarWidth(0.4);
   h1->SetBarOffset(-0.25);
   h1->SetFillColor(kYellow);
   h1->SetFillStyle(1001);

   h2->SetBarWidth(0.4);
   h2->SetBarOffset(0.25);
   h2->SetLineColor(kRed);
   h2->SetFillColor(kGreen);

   TCanvas *c1 = new TCanvas();

   h1->Draw("candle2");
   h2->Draw("candle3 same");

   gPad->BuildLegend(0.78,0.695,0.980,0.935,"","f");
}
开发者ID:davidlt,项目名称:root,代码行数:39,代码来源:candleplot.C

示例7: da

{
  
  gROOT->Reset();
  
  TDatime da(2011,01,01,12,00,00);
  gStyle->SetTimeOffset(da.Convert());
  
  ct = new TCanvas("ct","Time on axis");
  
  ht2 = new TH1F("ht2","ht2",365,0.,365.*86400);
  for (Int_t i=1;i<365;i++) {
    ht2->SetBinContent(i,i);
  }
  
  ct->cd(2);
  ht2->GetXaxis()->SetLabelSize(0.04);
  ht2->GetXaxis()->SetTimeDisplay(1);
  ht2->GetXaxis()->SetNdivisions(12);
  ht2->GetXaxis()->SetTimeFormat("%d\/%m\/%y");
  ht2->Draw();

}
开发者ID:12345ieee,项目名称:cmg-cmssw,代码行数:22,代码来源:time.C

示例8: main

	int main(Int_t argc,char **argv) {
	TApplication *TheApp = new TApplication("theApp",&argc,argv);  // problem with the two commandline args getting in conflict


	// this programs plots a signal over time
	//


	// Create time stamp



	// Let's see what we get a starting point
    TDatime dtime;
    gStyle->SetTimeOffset(dtime.Convert());
	TCanvas *c1 = new TCanvas("c1","Time on axis",10,10,1000,500);
	c1->SetFillColor(42);
	c1->SetFrameFillColor(33);
	c1->SetGrid();
	c1->cd();

	Float_t bintime = 1;
	//one bin = 1 second. change it to set the time scale
	TH1F *ht = new TH1F("ht","The Noisy Signal",10,0,10*bintime);
	Float_t signal = 1000;
	ht->SetMaximum(signal);
	ht->SetMinimum(-signal);
	ht->SetStats(0);
	ht->SetLineColor(2);
	ht->GetXaxis()->SetTimeDisplay(1);
	ht->GetYaxis()->SetNdivisions(520);
	ht->Draw();
	TF1 *f1 = new TF1("f1","gaus",-5,5);
	TCanvas *c2 = new TCanvas();
			c2->cd();
	f1->Draw();

	for (Int_t i=1;i<20000;i++) {
	// wait for 1 second
	//sleep(1);
	//cout<<"tick \n";
	//======= Build a signal : noisy damped sine ======
	//Float_t noise = f1->GetRandom();
		Float_t noise = i/10;
	cout<<noise<<"\n";
	if (i > 700)
	noise += signal*sin((i-700.)*6.28/30)*exp((700.-i)/300.);
	ht->SetBinContent(i,noise);
	ht->GetXaxis()->SetRange(i-50,i+50);
/*	if(i==50){
	c1->Clear();
	ht->Draw();
	c1->Update();
	}
	else{ */
	c1->Modified();
	c1->Update();
	//}
	gSystem->ProcessEvents();
	//canvas can be edited during the loop
	}




TheApp->Run();
TheApp->Terminate();


return 1;
}
开发者ID:pabloemma,项目名称:strichart,代码行数:71,代码来源:stripchart.cpp

示例9: Begin

void adcAnalyzer::Begin(TTree * /*tree*/)
{
    TString option = GetOption();
    triggerTime = 0;
    nEvent      = 0;

    // Tool initializations
    //spectralAnalyzer = new TSpectrum();

    // Output file
    outFile = new TFile("adcHistograms.root", "RECREATE");
    for (int i = 0; i < 8; ++i) outFile->mkdir(Form("ADC_CH%i", i), Form("ADC_CH%i", i));

    // Histogram initializations
    TH1::SetDefaultSumw2(kTRUE);
    h1_ADCSpectrumCombined	= new TH1D("h1_ADCSpectrumCombined", "ADC spectrum (all channels);ADC counts;N_{events}", 255, 0., 255.);
    h1_TriggerTime          = new TH1D("h1_TriggerTime", "Turn clock time", 100, 0., 100.);

    for (unsigned i = 0; i < 8; ++i) {
        outFile->cd(Form("ADC_CH%i", i));
        p1_RateVsTime[i]            = new TProfile(Form("p1_RateVsTime_%i", i), Form("Rate vs time (channel %i);time;rate", i), (time_f.Convert() - time_i.Convert())/2, time_i.Convert(), time_f.Convert());

        h1_ADCSpectrum[i]           = new TH1D(Form("h1_ADCSpectrum_%i", i), Form("ADC spectrum (channel %i);ADC counts;N_{events}", i), 130, -40.5, 90.5);
        h1_Baseline[i]              = new TH1D(Form("h1_Baseline_%i", i), Form("ADC baseline (channel %i);ADC counts;N_{events}", i), 255, 0.5, 255.5);
        h1_PeakValue[i]             = new TH1D(Form("h1_PeakValue_%i", i), Form("Signal peak (channel %i);ADC counts;N_{events}", i), 100, 0.5, 100.5);

        h1_TimeOverShoot[i]         = new TH1D(Form("h1_TimeOverShoot_%i", i), Form("Time in overshoot (channel %i);time (ns);N_{events}", i), 500, 0.5, 4000.5);
        h1_TimeOverShootPO[i]       = new TH1D(Form("h1_TimeOverShootPO_%i", i), Form("Time in overshoot per orbit (channel %i);time (ns);N_{events}", i), 750, 0.5, 12000.5);

        h1_TimeOverThresh[i]        = new TH1D(Form("h1_TimeOverThresh_%i", i), Form("Time over threshold (channel %i);time (ns); nEvents", i), 250, 0.5, 2000.5);
        h1_TimeOverThreshPO[i]      = new TH1D(Form("h1_TimeOverThreshPO_%i", i), Form("Time over threshold per orbit (channel %i);time (ns); nEvents", i), 625, 0.5, 10000.5);

        h1_HitsVsTime[i]            = new TH1D(Form("h1_HitsVsTime_%i", i), Form("ADC Channel %i;time (ns);N_{hits}", i), 11250, 0., 89000);
        h1_HitsPerOrbit[i]          = new TH1D(Form("h1_HitsPerOrbit_%i", i), Form("ADC Channel %i;N_{hits};N_{orbits}", i), 800, -0.5, 799.5);
        h1_EffectiveDeadtime[i]     = new TH1D(Form("h1_EffectiveDeadtime_%i", i), Form("ADC Channel %i;t_{OT+OS};N_{hits}", i), 600, 0.5, 6000.5);

        h2_PulseHeightVsTOT[i]      = new TH2D(Form("h2_PulseHeightVsTOT_%i", i), Form("pulse height vs. TOT (channel %i);time (ns); h_{pulse} (ADC counts)", i), 250, 0.5, 2000.5, 80, 0.5, 80.5);
        h2_OSHeightVsTOT[i]         = new TH2D(Form("h2_OSHeightVsTOT_%i", i), Form("overshoot height vs. TOT (channel %i);time (ns); h_{pulse} (ADC counts)", i), 250, 0.5, 2000.5, 40, 0.5, 40.5);
        h2_TOSVsTOT[i]              = new TH2D(Form("h2_TOSVsTOT_%i", i), Form("TOS vs. TOT (channel %i);TOT (ns); TOS", i), 250, 0.5, 2000.5, 500, 0.5, 4000.5);

        outFile->GetDirectory(Form("ADC_CH%i", i))->mkdir("Orbit scans", "Orbit Scans");

        for (unsigned j = 0; j < 20; ++j) {
            outFile->cd(Form("ADC_CH%i/Orbit scans", i));
            p1_ADCVsTime[i][j]      = new TProfile(Form("p1_ADCVsTime_%i_%i", i, j), Form("ADC Channel %i (acquisition %i);time (ns);ADC counts", i, 50*j), 22500, 0., 90000, 0., 255.);
        }
    }
}
开发者ID:naodell,项目名称:lumiTools,代码行数:48,代码来源:adcAnalyzer.C

示例10: makeStripCharts

void makeStripCharts(const Char_t* ratefn,
                     const Char_t* voltfn,
                     const Char_t* outtag,
                     const Char_t* statfn=0, // def 0 for backwards compatibility
                     const Float_t zoomDays=7.0,
                     const Bool_t  finFromData=kFALSE) {
   // finFromData = true => max of time axis determined by last data point
   //             = false => determined by time at which the script is run
   
   gSystem->Setenv("TZ","UTC");
   gStyle->SetTimeOffset(0);
   gStyle->SetOptStat(0);

   ratef = TFile::Open(ratefn);
   if ( (ratef==0) || (ratef->IsZombie()) ) {
      Error("makeStripCharts","Could not open [%s]",ratefn);
   } else {
      gERvsT = dynamic_cast<TGraph*>(ratef->Get("gERvsT"));
   }
   voltf = TFile::Open(voltfn);
   if ( (voltf==0) || (voltf->IsZombie()) ) {
      Error("makeStripCharts","Could not open [%s]",voltfn);
   } else {
      gVolt  = dynamic_cast<TGraph*>(voltf->Get("gVolt"));
      gCurr  = dynamic_cast<TGraph*>(voltf->Get("gCurr"));
   }
   
   if (statfn!=0) {
      statf = TFile::Open(statfn);
      if ( (statf!=0) && (statf->IsZombie()==kFALSE) ) {
         gStERvsT = dynamic_cast<TGraph*>(statf->Get("gStERvsT"));
         gStVvsT  = dynamic_cast<TGraph*>(statf->Get("gStVvsT"));
         gStCvsT  = dynamic_cast<TGraph*>(statf->Get("gStCvsT"));
      }
      if (gERvsT==0) {
         gERvsT = gStERvsT;
      }
      if (gVolt==0) {
         gVolt = gStVvsT;
      }
      if (gCurr==0) {
         gCurr = gStCvsT;
      }
   }
   
   if ( (gERvsT!=0) && (gVolt!=0) && (gCurr!=0) ) {
   
      setStyle(gERvsT, kRate);
      setStyle(gVolt, kVolt);
      setStyle(gCurr, kCurr);

      if (gStVvsT!=0) {
         setStyle(gStVvsT, kStVolt);
      }
      if (gStCvsT!=0) {
         setStyle(gStCvsT, kStCurr);
      }
      
      // assume gERvsT is ordered
      Double_t start = (gERvsT->GetX())[0];
      Double_t fin   = (gERvsT->GetX())[(gERvsT->GetN())-1];
      if (gStERvsT!=0) {
         setStyle(gStERvsT, kStRate);
         // gStERvsT not ordered
         Double_t sst, sfn;
         getStartFinFrom(*gStERvsT, sst, sfn);
         if (sst<start) {
            start = sst;
         }
         if (sfn>fin) {
            fin = sfn;
         }
      }
      if (finFromData==kFALSE) {
         const TDatime now;
         fin = now.Convert();
      }
      Int_t tbins(100);
      Double_t tmin(0), tmax(1);
      TSnMath::GetNiceDateAxisFor(start, fin, tbins, tmin, tmax);
      TH2F* hrd = new TH2F("hrd",
                           gERvsT->GetTitle(),
                           tbins, tmin, tmax,
                           rbins, rmin, rmax);
      TH2F* hvd = new TH2F("hvd",
                           gVolt->GetTitle(),
                           tbins, tmin, tmax,
                           vbins, vmin, vmax);
      TH2F* hzd = new TH2F("hzd",
                           gVolt->GetTitle(),
                           tbins, tmin, tmax,
                           zbins, zmin, zmax);
      TH2F* hcd = new TH2F("hcd",
                           gCurr->GetTitle(),
                           tbins, tmin, tmax,
                           cbins, cmin, cmax);
      setTimeDisp(*hrd);
      setTimeDisp(*hvd);
      setTimeDisp(*hzd);
      setTimeDisp(*hcd);
//.........这里部分代码省略.........
开发者ID:jetatar,项目名称:snowShovel,代码行数:101,代码来源:makeStripCharts.C

示例11: makeSBWcharts

void makeSBWcharts(const Char_t* sbgfn,
                   const Char_t* outtag,
                   const Float_t zoomDays=7.0,
                   const Bool_t  drawMinMax=kFALSE,
                   const Bool_t  finFromData=kFALSE) {
   // finFromData = true => max of time axis determined by last data point
   //             = false => determined by time at which the script is run
   
   gROOT->Reset();
   
   gSystem->Setenv("TZ","UTC");
   gStyle->SetTimeOffset(0);
   gStyle->SetOptStat(0);

   TH1::AddDirectory(kTRUE);

   sbgf = TFile::Open(sbgfn);
   if ( (sbgf==0) || (sbgf->IsZombie()) ) {
      Error("makeSBWcharts","Could not open [%s]",sbgfn);
   }
   
   gMaxTemp = dynamic_cast<TGraph*>(sbgf->Get("gMaxTemp"));
   gMinTemp = dynamic_cast<TGraph*>(sbgf->Get("gMinTemp"));
   gMaxGust = dynamic_cast<TGraph*>(sbgf->Get("gMaxGust"));
   gCTemp   = dynamic_cast<TGraph*>(sbgf->Get("gCTemp"));
   gAveWind = dynamic_cast<TGraph*>(sbgf->Get("gAveWind"));
   
   const TDatime dnow;
   const UInt_t  now = dnow.Convert();
   Double_t start(0), fin(0);
   Int_t tbins(100);
   Double_t tmin(0), tmax(1);
   
   c1 = new TCanvas("c1","c1",cwid,static_cast<Int_t>(chit/2.0));
   c1->Divide(1,2);

   TLegend* mleg=0, * wleg=0;
   TLine* tzline=0;
   
   if (drawMinMax) {
      mleg = new TLegend(.258,.742,.410,.993);
      mleg->SetFillColor(0);
      mleg->SetBorderSize(1);
      
      wleg = new TLegend(.244,.794,.444,.993);
      wleg->SetFillColor(0);
      wleg->SetBorderSize(1);
   }
   
   if (gCTemp!=0) {
      setStyle(gCTemp, kCTemp);
      
      // get time scale from CTemp (only)
      getStartFinFrom(*gCTemp, start, fin);
      if (finFromData==kFALSE) {
         fin = now;
      }
      TSnMath::GetNiceDateAxisFor(start, fin, tbins, tmin, tmax);
      TH2F* htd = new TH2F("htd",
                           gCTemp->GetTitle(),
                           tbins, tmin, tmax,
                           mbins, mmin, mmax);
      setTimeDisp(*htd);

      tzline = new TLine(tmin, 0, tmax, 0);
      tzline->SetLineColor(kBlack);
      tzline->SetLineWidth(1);
      tzline->SetLineStyle(2);
      
      c1->cd(1);
      htd->Draw("axis");
      tzline->Draw();
      gCTemp->Draw(grphDrawOpt);
      c1->GetPad(1)->SetGridx();
      c1->GetPad(1)->SetGridy();
      if (drawMinMax) {
         mleg->AddEntry(newDumHistForLegend(gCTemp), "Temp", "fp");
         if (gMaxTemp!=0) {
            setStyle(gMaxTemp, kMaxTemp);
            gMaxTemp->Draw(grphDrawOpt);
            mleg->AddEntry(newDumHistForLegend(gMaxTemp), "Max Temp", "fp");
         }
         if (gMinTemp!=0) {
            setStyle(gMinTemp, kMinTemp);
            gMinTemp->Draw(grphDrawOpt);
            mleg->AddEntry(newDumHistForLegend(gMinTemp), "Min Temp", "fp");
         }
         mleg->Draw();
      }
      
      // use time scale from temp
      if (gAveWind!=0) {
         setStyle(gAveWind, kAveWind);
         TH2F* hwd = new TH2F("hwd",
                              gAveWind->GetTitle(),
                              tbins, tmin, tmax,
                              wbins, wmin, wmax);
         setTimeDisp(*hwd);
         
         c1->cd(2);
//.........这里部分代码省略.........
开发者ID:jetatar,项目名称:snowShovel,代码行数:101,代码来源:makeStripCharts.C


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