DataBlock Class Reference

#include <DataBlock.h>

List of all members.

Public Member Functions

 DataBlock ()
virtual ~DataBlock ()
void Add (const DataBlock &block)
void Add (const Anp::Record &record)
void SetInput (const DataBlock &rhs)
void SetProtons (double protons)
void ScaleOut (double factor)
Double_t GetProtonsOut () const
Double_t GetProtonsIn () const
UInt_t GetNSnarlsOut () const
UInt_t GetNSnarlsIn () const
UInt_t GetNEventsOut () const
UInt_t GetNEventsIn () const
Double_t GetProtonsPerSnarl () const
void print (std::ostream &o=std::cout) const

Private Member Functions

Double_t Ratio (Double_t nom, Double_t den) const
Float_t Ratio (Float_t nom, Float_t den) const
Float_t Ratio (UInt_t nom, UInt_t den) const

Private Attributes

UInt_t nSnarlIn
UInt_t nEventIn
UInt_t nSnarlOut
UInt_t nEventOut
Double_t ProtonsIn
Double_t ProtonsOut


Detailed Description

Definition at line 20 of file DataBlock.h.


Constructor & Destructor Documentation

DataBlock::DataBlock (  ) 

Definition at line 22 of file DataBlock.cxx.

00023    :nSnarlIn(0),
00024     nEventIn(0),
00025     nSnarlOut(0),
00026     nEventOut(0),
00027     ProtonsIn(0.0),
00028     ProtonsOut(0.0)
00029 {
00030 }

DataBlock::~DataBlock (  )  [virtual]

Definition at line 33 of file DataBlock.cxx.

00034 {
00035 }


Member Function Documentation

void DataBlock::Add ( const Anp::Record record  ) 

Definition at line 78 of file DataBlock.cxx.

References Anp::Record::GetHeader(), Anp::Record::GetNEvents(), nEventOut, nSnarlOut, and ProtonsOut.

00079 {
00080    ++nSnarlOut;
00081 
00082    nEventOut += record.GetNEvents();
00083 
00084    if     (record.GetHeader().TorTgt() > 0.01) ProtonsOut += record.GetHeader().TorTgt();
00085    else if(record.GetHeader().TrTgtD() > 0.01) ProtonsOut += record.GetHeader().TrTgtD();
00086    else if(record.GetHeader().Tr101D() > 0.01) ProtonsOut += record.GetHeader().Tr101D();
00087    else if(record.GetHeader().Tor101() > 0.01) ProtonsOut += record.GetHeader().Tor101();
00088 }

void DataBlock::Add ( const DataBlock block  ) 

Definition at line 38 of file DataBlock.cxx.

References nEventIn, nEventOut, nSnarlIn, nSnarlOut, ProtonsIn, and ProtonsOut.

Referenced by Anp::RunModule::Run(), and Anp::PlotSnarl::Run().

00039 {
00040    nSnarlIn   += block.nSnarlIn;
00041    nEventIn   += block.nEventIn;
00042    nSnarlOut  += block.nSnarlOut;
00043    nEventOut  += block.nEventOut;
00044    ProtonsIn  += block.ProtonsIn;
00045    ProtonsOut += block.ProtonsOut;
00046 }

UInt_t DataBlock::GetNEventsIn (  )  const [inline]

Definition at line 82 of file DataBlock.h.

References nEventIn.

00082 { return nEventIn; }

UInt_t DataBlock::GetNEventsOut (  )  const [inline]

Definition at line 81 of file DataBlock.h.

References nEventOut.

00081 { return nEventOut; }

UInt_t DataBlock::GetNSnarlsIn (  )  const [inline]

Definition at line 79 of file DataBlock.h.

References nSnarlIn.

00079 { return nSnarlIn; }

UInt_t DataBlock::GetNSnarlsOut (  )  const [inline]

Definition at line 78 of file DataBlock.h.

References nSnarlOut.

00078 { return nSnarlOut; }

Double_t DataBlock::GetProtonsIn (  )  const [inline]

Definition at line 76 of file DataBlock.h.

References ProtonsIn.

00076 { return ProtonsIn; }

Double_t DataBlock::GetProtonsOut (  )  const [inline]

Definition at line 75 of file DataBlock.h.

References ProtonsOut.

Referenced by Plot::Hist::GetProtons().

00075 { return ProtonsOut; }

Double_t DataBlock::GetProtonsPerSnarl (  )  const

Definition at line 91 of file DataBlock.cxx.

References nSnarlOut, and ProtonsOut.

00092 {
00093    if(nSnarlOut > 0 && ProtonsOut > 0.0)
00094    {
00095       return ProtonsOut/double(nSnarlOut);
00096    }
00097    
00098    return 0.0;
00099 }

void DataBlock::print ( std::ostream &  o = std::cout  )  const

Float_t DataBlock::Ratio ( UInt_t  nom,
UInt_t  den 
) const [private]

Definition at line 118 of file DataBlock.cxx.

00119 {
00120    if(den > 0) return float(nom)/float(den);
00121 
00122    return 0.0;
00123 }

Float_t DataBlock::Ratio ( Float_t  nom,
Float_t  den 
) const [private]

Definition at line 102 of file DataBlock.cxx.

00103 {
00104    if(den > 0.0) return nom/den;
00105 
00106    return 0.0;
00107 }

Double_t DataBlock::Ratio ( Double_t  nom,
Double_t  den 
) const [private]

Definition at line 110 of file DataBlock.cxx.

00111 {
00112    if(den > 0.0) return nom/den;
00113 
00114    return 0.0;
00115 }

void DataBlock::ScaleOut ( double  factor  ) 

Definition at line 63 of file DataBlock.cxx.

References nEventOut, nSnarlOut, and ProtonsOut.

00064 {
00065    if(factor > 0.0)
00066    {
00067       nSnarlOut = static_cast<UInt_t>(factor*nSnarlOut);
00068       nEventOut = static_cast<UInt_t>(factor*nEventOut);
00069       ProtonsOut *= factor; 
00070    }
00071    else
00072    {
00073       cerr << "DataBlock::ScaleOut - scale factor "<< factor << " is not positive" << endl;
00074    }
00075 }

void DataBlock::SetInput ( const DataBlock rhs  ) 

Definition at line 49 of file DataBlock.cxx.

References nEventIn, nEventOut, nSnarlIn, nSnarlOut, ProtonsIn, and ProtonsOut.

Referenced by Anp::PlotSnarl::End().

00050 {
00051    nSnarlIn  = block.nSnarlOut;
00052    nEventIn  = block.nEventOut;
00053    ProtonsIn = block.ProtonsOut;
00054 }

void DataBlock::SetProtons ( double  protons  ) 

Definition at line 57 of file DataBlock.cxx.

References ProtonsOut.

Referenced by Plot::Hist::SetProtons().

00058 {
00059    ProtonsOut = protons;
00060 }


Member Data Documentation

UInt_t DataBlock::nEventIn [private]

Definition at line 57 of file DataBlock.h.

Referenced by Add(), GetNEventsIn(), and SetInput().

UInt_t DataBlock::nEventOut [private]

Definition at line 60 of file DataBlock.h.

Referenced by Add(), GetNEventsOut(), ScaleOut(), and SetInput().

UInt_t DataBlock::nSnarlIn [private]

Definition at line 56 of file DataBlock.h.

Referenced by Add(), GetNSnarlsIn(), and SetInput().

UInt_t DataBlock::nSnarlOut [private]

Definition at line 59 of file DataBlock.h.

Referenced by Add(), GetNSnarlsOut(), GetProtonsPerSnarl(), ScaleOut(), and SetInput().

Double_t DataBlock::ProtonsIn [private]

Definition at line 62 of file DataBlock.h.

Referenced by Add(), GetProtonsIn(), and SetInput().

Double_t DataBlock::ProtonsOut [private]

Definition at line 63 of file DataBlock.h.

Referenced by Add(), GetProtonsOut(), GetProtonsPerSnarl(), ScaleOut(), SetInput(), and SetProtons().


The documentation for this class was generated from the following files:
Generated on Wed Dec 10 22:49:24 2014 for loon by  doxygen 1.4.7