本文整理汇总了C++中TimeStamp::GetDate方法的典型用法代码示例。如果您正苦于以下问题:C++ TimeStamp::GetDate方法的具体用法?C++ TimeStamp::GetDate怎么用?C++ TimeStamp::GetDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeStamp
的用法示例。
在下文中一共展示了TimeStamp::GetDate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Get
NProton ProtonNumber::Get( TimeStamp Time, int AdNo )
{
unsigned int year, month, day;
Time.GetDate( true, 0, &year, &month, &day );
TimeStamp ClosestDate = TimeStamp( year, month, day, 0, 0, 0 );
return m_NProtonData[AdNo][ClosestDate];
}
示例2: DailyPlot
void DailyPlot()
{
cout<<" [ Measured and predicted rate ] "<<endl;
/* Predicted daily rate */
IGetFluxXsec* GetFluxXsec;
if( Basic::DailyFlux == true ) {
/// Daily flux blinded.
} else {
GetFluxXsec = gGetFluxXsec;
}
/* Daily rate */
TimeStamp BeginTime(2011,12,24,0,0,0);
TimeStamp EndTime (2012,02,11,0,0,0);
TimeStamp Week(7*24*60*60);
TimeStamp Day(24*60*60);
map< TimeStamp, double > Rate[ Basic::NoAd ];
for( TimeStamp Time = BeginTime; Time <= EndTime; Time.Add( Week ) ) {
for( unsigned int m_AdNo = 1; m_AdNo<=Basic::NoAd; m_AdNo++ ) {
double Sum=0;
for( unsigned int BinIdx = 1; BinIdx <= Binning::NHistoBin; BinIdx++ ) {
for( unsigned int RctIdx = 1; RctIdx <= Basic::NoRct; RctIdx++ ) {
Sum +=
GetFluxXsec->Get( Time, RctIdx, BinIdx )
* (Binning::EndEnergy-Binning::BeginEnergy)/Binning::NHistoBin
* pow( Baseline(RctIdx, m_AdNo), -2 ) / 4 /3.1415926
* gProtonNumber->Get( Time, m_AdNo ).NPGdLs
* Day.GetSeconds()*CLHEP::second;
}
}
Rate[m_AdNo-1][Time] = Sum;
}
}
/// Sum over all live time
double Sum8[Basic::NoAd];
const std::vector< RunBrief* > Runs = gAnalyzeData->GetRuns();
/* ============================================== */
for( unsigned int m_AdNo=1; m_AdNo<=Basic::NoAd; m_AdNo++ ) {
Sum8[m_AdNo-1] = 0;
int Site = ToSite(m_AdNo);
int LocalAdNo = ToLocalAdNo(m_AdNo);
for( std::vector< RunBrief* >::const_iterator iRun = Runs.begin();
iRun!=Runs.end(); iRun++ ) {
const RunBrief* const Brief = (*iRun);
if( Dataset::GdCap != Brief->Dataset ) continue;
/* Must be from the same site */
if( Site != Brief->Site ) continue;
/* Cache run info */
double fulltime = Brief->Fulltime;
double livefraction = Brief->Livetime[ LocalAdNo-1 ] / fulltime;
/* split it into days */
for( TimeStamp Time = Brief->StartTime; Time < Brief->StopTime; /* Complex increment */) {
/* Through this, runs span over a day are split into days at exactly 00:00:00 */
unsigned int StartDate,StartYY,StartMM,StartDD;
unsigned int StopDate, StopYY, StopMM, StopDD;
StartDate = Time.GetDate( true, 0, &StartYY, &StartMM, &StartDD );
StopDate = Brief->StopTime.GetDate( true, 0, &StopYY, &StopMM, &StopDD );
TimeStamp Step(0,0); /* Alway init a TimeStamp, otherwise it will be inited to sys time and too slow. */
if( StartDate == StopDate ) {
/* The same day */
Step = Brief->StopTime - Time;
} else {
/* The closest day's end */
TimeStamp DaysEnd( StartYY,StartMM,StartDD+1, 0, 0, 0, 0);
Step = DaysEnd - Time;
}
for( unsigned int BinIdx = 1; BinIdx <= Binning::NHistoBin; BinIdx++ ) {
for( unsigned int RctIdx = 1; RctIdx <= Basic::NoRct; RctIdx++ ) {
Sum8[m_AdNo-1] +=
GetFluxXsec->Get( Time, RctIdx, BinIdx )
* (Binning::EndEnergy-Binning::BeginEnergy)/Binning::NHistoBin
* pow( Baseline(RctIdx, m_AdNo), -2 ) / 4 /3.1415926
* gProtonNumber->Get( Time, m_AdNo ).NPGdLs
* Step.GetSeconds()*CLHEP::second;
}
}
/* After all calculation, calculate the addtion for Time */
Time.Add( Step );
}
//.........这里部分代码省略.........
示例3: SetupTruth
int Truth::SetupTruth()
{
if( RepeatPRL ) {
return 1;
}
/// Reset all bin contents
Reset();
IGetFluxXsec* GetFluxXsec;
if( Basic::DailyFlux == true ) {
/// Daily flux blinded.
} else {
GetFluxXsec = gGetFluxXsec;
}
const std::vector< RunBrief* > Runs = gAnalyzeData->GetRuns();
/* ============================================== */
for( std::vector< RunBrief* >::const_iterator iRun = Runs.begin();
iRun!=Runs.end(); iRun++ ) {
const RunBrief* const Brief = (*iRun);
int Dataset = Brief->Dataset;
if( m_dataset != Dataset ) continue;
int Site = ToSite(m_AdNo);
int LocalAdNo = ToLocalAdNo(m_AdNo);
/* Must be from the same site */
if( Site != Brief->Site ) continue;
/* Cache run info */
double fulltime = Brief->Fulltime;
double livefraction = Brief->Livetime[ LocalAdNo-1 ] / fulltime;
double OstwEff = Brief->OstwEff[ LocalAdNo-1 ];
/* split it into days */
for( TimeStamp Time = Brief->StartTime; Time < Brief->StopTime; /* Complex increment */) {
/* Through this, runs span over a day are split into days at exactly 00:00:00 */
unsigned int StartDate,StartYY,StartMM,StartDD;
unsigned int StopDate, StopYY, StopMM, StopDD;
StartDate = Time.GetDate( true, 0, &StartYY, &StartMM, &StartDD );
StopDate = Brief->StopTime.GetDate( true, 0, &StopYY, &StopMM, &StopDD );
TimeStamp Step(0,0); /* Alway init a TimeStamp, otherwise it will be inited to sys time and too slow. */
if( StartDate == StopDate ) {
/* The same day */
Step = Brief->StopTime - Time;
} else {
/* The closest day's end */
TimeStamp DaysEnd( StartYY,StartMM,StartDD+1, 0, 0, 0, 0);
Step = DaysEnd - Time;
}
/* live time in this step */
double thislivetime = Step.GetSeconds()*CLHEP::second * livefraction;
for( unsigned int BinIdx = 1; BinIdx <= Binning::NHistoBin; BinIdx++ ) {
for( unsigned int RctIdx = 1; RctIdx <= Basic::NoRct; RctIdx++ ) {
double NTruth = GetBinContent( BinIdx );
double Increment = 0;
double Incre8 = 0, Incre22 = 0;
double Evis = Binning::BeginEnergy + (BinIdx-1) * (Binning::EndEnergy-Binning::BeginEnergy)/Binning::NHistoBin;
double Enu = Evis + Phys::EnuToEprompt;
if( m_dataset == Dataset::GdCap ) {
Incre8 +=
GetFluxXsec->Get( Time, RctIdx, BinIdx )
* (Binning::EndEnergy-Binning::BeginEnergy)/Binning::NHistoBin
* pow( Baseline(RctIdx, m_AdNo), -2 ) / 4 /3.1415926
* gProtonNumber->Get( Time, m_AdNo ).NPGdLs
* thislivetime
* OstwEff
* SurvProb( s_2_2_13, Baseline(RctIdx, m_AdNo), Enu)
* Phys::Gd_Cap_Pmpt_eff
* Phys::Gd_Cap_Dlyd_eff
* Phys::GdLS_Gd_Cap_Frac
* Phys::GdLS_Distance_8_eff /* 100% */
* Eff::Flasher_8_eff
* Eff::Time_8_eff
* Eff::Spill_in_8_eff;
}
if( m_dataset == Dataset::HCap ) {
/// GdLS part
Incre22 +=
GetFluxXsec->Get( Time, RctIdx, BinIdx )
* (Binning::EndEnergy-Binning::BeginEnergy)/Binning::NHistoBin
* pow( Baseline(RctIdx, m_AdNo), -2 ) / 4 /3.1415926
* gProtonNumber->Get( Time, m_AdNo ).NPGdLs
* thislivetime
* OstwEff
//.........这里部分代码省略.........