Anp::HistTime Class Reference

#include <PlotTime.h>

Inheritance diagram for Anp::HistTime:
Anp::Base

List of all members.

Classes

struct  Spill

Public Member Functions

 HistTime ()
 HistTime (const VldTimeStamp &vts)
virtual ~HistTime ()
bool Fill (const Record &record, const VldTimeStamp &time)
bool Make (TDirectory *dir)
int GetDay () const
int GetMonth () const
int GetYear () const
int GetDate () const
int GetSecs () const
const std::pair< int, double > GetSpills (int hour=-1)
void FillSol (TH1 *h, const std::string &option)
void FillSid (TH1 *h, const std::string &option)

Private Member Functions

TH1 * GetTH1 (const std::string &key, const std::string &name="")

Private Attributes

bool fPlot
int fNMiss
unsigned int fDay
unsigned int fMonth
unsigned int fYear
int fDate
int fSecs
TDirectory * fDir
std::map< int, SpillfSpill

Friends

class PlotTime

Detailed Description

Definition at line 24 of file PlotTime.h.


Constructor & Destructor Documentation

Anp::HistTime::HistTime (  ) 

Definition at line 31 of file PlotTime.cxx.

00032    :fPlot(false),
00033     fNMiss(0),
00034     fDay(0),
00035     fMonth(0),
00036     fYear(0),
00037     fDate(0),
00038     fSecs(0),
00039     fDir(0)
00040 {
00041 }

Anp::HistTime::HistTime ( const VldTimeStamp vts  )  [explicit]

Definition at line 44 of file PlotTime.cxx.

References fDate, fDay, fMonth, fSecs, fYear, VldTimeStamp::GetDate(), and VldTimeStamp::GetSec().

00045    :fPlot(false),
00046     fNMiss(0),
00047     fDay(0),
00048     fMonth(0),
00049     fYear(0),
00050     fDate(0),
00051     fSecs(0),
00052     fDir(0)
00053 {
00054    fDate = time.GetDate(true, 0, &fYear, &fMonth, &fDay);
00055    
00056    const VldTimeStamp btime(fYear, fMonth, fDay, 0, 0, 0);
00057    fSecs = btime.GetSec();
00058 }

Anp::HistTime::~HistTime (  )  [virtual]

Definition at line 61 of file PlotTime.cxx.

00062 {
00063 }


Member Function Documentation

bool Anp::HistTime::Fill ( const Record record,
const VldTimeStamp time 
)

Definition at line 66 of file PlotTime.cxx.

References fPlot, fSpill, Anp::Record::GetHeader(), Anp::Record::GetNEvents(), VldTimeStamp::GetTime(), Munits::hour, Anp::HistTime::Spill::hour, min, Anp::HistTime::Spill::nevents, Anp::HistTime::Spill::protons, Anp::HistTime::Spill::seconds, Anp::Header::Tor101(), Anp::Header::TorTgt(), Anp::Header::Tr101D(), and Anp::Header::TrTgtD().

00067 {
00068    //
00069    // Fill histograms if they have been created
00070    //
00071    if(!fPlot) return false;
00072 
00073    unsigned int hour = 0, min = 0, sec = 0;
00074 
00075    const int time_ = time.GetTime(true, 0, &hour, &min, &sec);
00076 
00077    Spill spill;
00078    if     (record.GetHeader().TorTgt() > 0.0) spill.protons = record.GetHeader().TorTgt();
00079    else if(record.GetHeader().TrTgtD() > 0.0) spill.protons = record.GetHeader().TrTgtD();
00080    else if(record.GetHeader().Tr101D() > 0.0) spill.protons = record.GetHeader().Tr101D();
00081    else if(record.GetHeader().Tor101() > 0.0) spill.protons = record.GetHeader().Tor101();
00082    
00083    spill.nevents = record.GetNEvents();
00084    spill.hour    = hour;
00085    spill.seconds = 3600*hour + 60*min + sec;
00086 
00087    return fSpill.insert(map<int, Spill>::value_type(time_, spill)).second;
00088 }

void Anp::HistTime::FillSid ( TH1 *  h,
const std::string &  option 
)
void Anp::HistTime::FillSol ( TH1 *  h,
const std::string &  option 
)
int Anp::HistTime::GetDate (  )  const [inline]

Definition at line 139 of file PlotTime.h.

References fDate.

00139 { return fDate; }

int Anp::HistTime::GetDay (  )  const [inline]

Definition at line 136 of file PlotTime.h.

References fDay.

00136 { return fDay; }

int Anp::HistTime::GetMonth (  )  const [inline]

Definition at line 137 of file PlotTime.h.

References fMonth.

00137 { return fMonth; }

int Anp::HistTime::GetSecs (  )  const [inline]

Definition at line 140 of file PlotTime.h.

References fSecs.

00140 { return fSecs; }

const pair< int, double > Anp::HistTime::GetSpills ( int  hour = -1  ) 

Definition at line 128 of file PlotTime.cxx.

References fSpill, Anp::HistTime::Spill::hour, Anp::HistTime::Spill::nevents, Anp::HistTime::Spill::protons, and Munits::second.

00129 {
00130    pair<int, double> spill(0, 0.0);
00131 
00132    for(map<int, Spill>::const_iterator sit = fSpill.begin(); sit != fSpill.end(); ++sit)
00133    {
00134       const Spill &spill_ = sit -> second;
00135 
00136       if(hour < 0 || hour == spill_.hour)
00137       {
00138          spill.first  += spill_.nevents;
00139          spill.second += spill_.protons;
00140       }
00141    }
00142 
00143    return spill;
00144 }

TH1 * Anp::HistTime::GetTH1 ( const std::string &  key,
const std::string &  name = "" 
) [private]

Definition at line 112 of file PlotTime.cxx.

References Anp::HistMan::CreateTH1(), fDir, fNMiss, Anp::HistMan::Instance(), and Anp::SetDir().

00113 {
00114    TH1 *h = HistMan::Instance().CreateTH1(key, "kinem");
00115    if(h)
00116    {
00117       Anp::SetDir(h, fDir, name);
00118    }
00119    else
00120    {
00121       ++fNMiss;
00122    }
00123 
00124    return h;
00125 }

int Anp::HistTime::GetYear (  )  const [inline]

Definition at line 138 of file PlotTime.h.

References fYear.

00138 { return fYear; }

bool Anp::HistTime::Make ( TDirectory *  dir  ) 

Definition at line 91 of file PlotTime.cxx.

References fDir, fNMiss, and fPlot.

00092 {
00093    fPlot = false;
00094 
00095    if(!dir) return false;
00096 
00097    fDir = dir;
00098 
00099    if(fNMiss == 0)
00100    {
00101       fPlot = true;
00102    }
00103    else
00104    {
00105       cerr << "HistTime::Make - missed " << fNMiss << " histograms" << endl;
00106    }
00107 
00108    return fPlot;
00109 }


Friends And Related Function Documentation

friend class PlotTime [friend]

Definition at line 65 of file PlotTime.h.


Member Data Documentation

int Anp::HistTime::fDate [private]

Definition at line 74 of file PlotTime.h.

Referenced by GetDate(), and HistTime().

unsigned int Anp::HistTime::fDay [private]

Definition at line 70 of file PlotTime.h.

Referenced by GetDay(), and HistTime().

TDirectory* Anp::HistTime::fDir [private]

Definition at line 77 of file PlotTime.h.

Referenced by GetTH1(), and Make().

unsigned int Anp::HistTime::fMonth [private]

Definition at line 71 of file PlotTime.h.

Referenced by GetMonth(), and HistTime().

int Anp::HistTime::fNMiss [private]

Definition at line 68 of file PlotTime.h.

Referenced by GetTH1(), and Make().

bool Anp::HistTime::fPlot [private]

Definition at line 67 of file PlotTime.h.

Referenced by Fill(), and Make().

int Anp::HistTime::fSecs [private]

Definition at line 75 of file PlotTime.h.

Referenced by GetSecs(), and HistTime().

std::map<int, Spill> Anp::HistTime::fSpill [private]

Definition at line 79 of file PlotTime.h.

Referenced by Fill(), and GetSpills().

unsigned int Anp::HistTime::fYear [private]

Definition at line 72 of file PlotTime.h.

Referenced by GetYear(), and HistTime().


The documentation for this class was generated from the following files:

Generated on 19 Jan 2018 for loon by  doxygen 1.6.1