Anp::Header Class Reference

#include <Header.h>

List of all members.

Public Member Functions

 Header ()
 ~Header ()
int Run () const
int SubRun () const
int Snarl () const
int TimeFrame () const
int Sec () const
int NSec () const
int Trigger () const
int SpillType () const
int Detector () const
int SimFlag () const
int RunPeriod () const
int Release () const
int SpillSec () const
int SpillNSec () const
int GPSTime () const
int GPSError () const
int LITime () const
int CrateMask () const
int BeamDSec () const
int BeamDNSec () const
float Tor101 () const
float Tr101D () const
float TorTgt () const
float TrTgtD () const
float CoilCur () const
double Time2Spill () const
bool CoilRevs () const
bool GoodBeam () const
bool GoodCoil () const
bool GoodDetc () const
bool GoodHV () const
bool IsValid () const
bool IsData () const
bool IsNear () const
bool IsFar () const
long double BeamDTime () const
long double SpillTime () const
long double TriggTime () const
const std::string GetBEAMTYPE () const
const std::string GetDATATYPE () const
const std::string GetDETECTOR () const
const std::string GetMCRLTYPE () const
const std::string GetRECOTYPE () const
const std::string GetRUNCYCLE () const
void Clear ()
void Print (std::ostream &o=std::cout) const

Private Member Functions

int SetBeamType (const std::string &value)

Private Attributes

Int_t run
Int_t subrun
Int_t snarl
Int_t timeframe
Int_t sec
Int_t nsec
Int_t trigger
Int_t spilltype
Int_t detector
Int_t simflag
Int_t runperiod
Int_t relitype
Int_t spillsec
Int_t spillnsec
Int_t gpstime
Int_t gpserror
Int_t litime
Int_t cratemask
Int_t beamdsec
Int_t beamdnsec
Float_t tor101
Float_t tr101d
Float_t tortgt
Float_t trtgtd
Float_t coilcur
Double_t time2spill
Bool_t coilrevs
Bool_t goodbeam
Bool_t goodcoil
Bool_t gooddetc
Bool_t goodhv
Bool_t valid
char beamtype [9]

Friends

class FillHeader

Detailed Description

Definition at line 24 of file Header.h.


Constructor & Destructor Documentation

Header::Header (  ) 

Definition at line 18 of file Header.cxx.

References SetBeamType().

00019    :run(-1),
00020     subrun(-1),
00021     snarl(-1),
00022     timeframe(-1),
00023     sec(-1),
00024     nsec(-1),
00025     trigger(-1),
00026     spilltype(-1),
00027     detector(-1),
00028     simflag(-1),
00029     runperiod(-1),
00030     relitype(-1),
00031     spillsec(-1),
00032     spillnsec(-1),
00033     gpstime(-1),
00034     gpserror(-1),
00035     litime(-1),
00036     cratemask(-1),
00037     beamdsec(-1),
00038     beamdnsec(-1),
00039     tor101(-1.0e6),
00040     tr101d(-1.0e6),
00041     tortgt(-1.0e6),
00042     trtgtd(-1.0e6),
00043     coilcur(-1.0e6),
00044     time2spill(-1.0e6),
00045     coilrevs(false),
00046     goodbeam(false),
00047     goodcoil(false),
00048     gooddetc(false),
00049     valid(false)
00050 {
00051    Header::SetBeamType("Unknown");
00052 }

Header::~Header (  ) 

Definition at line 55 of file Header.cxx.

00056 {
00057 }


Member Function Documentation

int Header::BeamDNSec (  )  const [inline]

Definition at line 161 of file Header.h.

References beamdnsec.

00161 { return beamdnsec; }

int Header::BeamDSec (  )  const [inline]

Definition at line 160 of file Header.h.

References beamdsec.

00160 { return beamdsec; }

long double Header::BeamDTime (  )  const

Definition at line 132 of file Header.cxx.

References beamdnsec, beamdsec, and MuELoss::e.

Referenced by Anp::FillHeader::Run().

00133 {
00134    //
00135    // Return beam spill time in seconds
00136    //
00137    return static_cast<long double>(beamdsec) + 1.0e-9*static_cast<long double>(beamdnsec);
00138 }

void Header::Clear ( void   ) 

Definition at line 60 of file Header.cxx.

References beamdnsec, beamdsec, coilcur, coilrevs, cratemask, detector, goodbeam, goodcoil, gooddetc, goodhv, gpserror, gpstime, litime, nsec, relitype, run, runperiod, sec, SetBeamType(), simflag, snarl, spillnsec, spillsec, spilltype, subrun, time2spill, timeframe, tor101, tortgt, tr101d, trigger, trtgtd, and valid.

Referenced by Anp::Record::Clear().

00061 {
00062    run        = -1;
00063    subrun     = -1;
00064    snarl      = -1;
00065    timeframe  = -1;
00066    sec        = -1;
00067    nsec       = -1;
00068    trigger    = -1;
00069    spilltype  = -1;
00070    detector   = -1;
00071    simflag    = -1;
00072    runperiod  = -1;
00073    relitype   = -1;
00074    spillsec   = -1;
00075    spillnsec  = -1;
00076    gpstime    = -1;
00077    gpserror   = -1;
00078    litime     = -1;
00079    cratemask  = -1;
00080    beamdsec   = -1;
00081    beamdnsec  = -1;
00082    tor101     = -1.0e6;
00083    tr101d     = -1.0e6;
00084    tortgt     = -1.0e6;
00085    trtgtd     = -1.0e6;
00086    coilcur    = -1.0e6;
00087    time2spill = -1.0e6;
00088    coilrevs   = false;
00089    goodbeam   = false;
00090    goodcoil   = false;
00091    gooddetc   = false;
00092    goodhv     = false;
00093    valid      = false;
00094 
00095    Header::SetBeamType("Unknown");
00096 }

float Header::CoilCur (  )  const [inline]

Definition at line 167 of file Header.h.

References coilcur.

Referenced by Anp::SelectSpill::PassCoil().

00167 { return coilcur; }

bool Header::CoilRevs (  )  const [inline]

Definition at line 170 of file Header.h.

References coilrevs.

Referenced by Anp::SelectSpill::PassCoil().

00170 { return coilrevs; }

int Header::CrateMask (  )  const [inline]

Definition at line 159 of file Header.h.

References cratemask.

00159 { return cratemask; }

int Header::Detector ( void   )  const [inline]

Definition at line 150 of file Header.h.

References detector.

00150 { return detector; }

const std::string Header::GetBEAMTYPE (  )  const

Definition at line 195 of file Header.cxx.

References beamtype, and IsValid().

Referenced by Anp::RunModule::Init(), Anp::SelectSpill::PassBeam(), Anp::FillMadId::Reset(), Anp::FillFlux::Run(), Anp::FillMadId::Run(), and Anp::RunkNN::SaveParts().

00196 {  
00197    //
00198    // Return beam type type as std::string
00199    //
00200 
00201    if(!IsValid())
00202    {
00203       cerr << "Header::GetBEAMTYPE - invalid Header" << endl;
00204       return "unknown";
00205    }
00206 
00207    string value;
00208    for(unsigned int i = 0; i < 9; ++i)
00209    {
00210       if(beamtype[i] != ' ') value.push_back(beamtype[i]);
00211    }
00212    
00213    return value;
00214 }

const std::string Header::GetDATATYPE (  )  const

Definition at line 217 of file Header.cxx.

References GetMCRLTYPE(), IsData(), and IsValid().

Referenced by Anp::RunModule::Init().

00218 {  
00219    //
00220    // Return data type type as std::string
00221    //    for data return run period: run-1, run-2, run-3, etc
00222    //    for simulation return Monte-Carlo release type
00223 
00224    if(!IsValid())
00225    {
00226       cerr << "Header::GetDATATYPE - invalid Header" << endl;
00227       return "unknown";
00228    }
00229 
00230    if(IsData())
00231    {
00232       return std::string("data");
00233    }
00234    else
00235    {
00236       return Anp::Header::GetMCRLTYPE();
00237    }
00238    
00239    return std::string("unknown");
00240 }

const std::string Header::GetDETECTOR (  )  const

Definition at line 243 of file Header.cxx.

References IsFar(), IsNear(), and IsValid().

Referenced by Anp::RunModule::Init(), and Anp::RunkNN::SaveParts().

00244 {
00245    if(!IsValid())
00246    {
00247       cerr << "Header::GetDETECTOR - invalid Header" << endl;
00248       return "unknown";
00249    }
00250 
00251    if(IsNear())
00252    {
00253       return std::string("near");
00254    }
00255    else if(IsFar())
00256    {
00257       return std::string("far");
00258    }
00259 
00260    cerr << "Header::GetDETECTOR - unknown detector type" << endl;
00261 
00262    return std::string("unknown");
00263 }

const std::string Header::GetMCRLTYPE (  )  const

Definition at line 266 of file Header.cxx.

References ReleaseType::GetMCSubVersion(), ReleaseType::IsDaikon(), IsData(), IsValid(), and Release().

Referenced by GetDATATYPE(), and Anp::RunkNN::SaveParts().

00267 {  
00268    //
00269    // Return Monte-Carlo release type as string formatted for batch processing.
00270    //
00271 
00272    if(!IsValid())
00273    {
00274       cerr << "Header::GetMCRLTYPE - invalid Header" << endl;
00275       return "unknown";
00276    }
00277 
00278    if(IsData())
00279    {
00280       return "unknown";
00281    }
00282 
00283    const int rtype = Release();
00284 
00285    const int mcver = ReleaseType::GetMCSubVersion(rtype);
00286    if(ReleaseType::IsDaikon(rtype) && mcver >= 0 && mcver <= 99)
00287    {
00288       stringstream mctype;
00289       mctype << "daikon_" << setw(2) << setfill('0') << mcver;
00290       return std::string(mctype.str());
00291    }
00292 
00293    cerr << "Header::GetMCRLTYPE - unknown Monte-Carlo release" << endl;
00294 
00295    return std::string("unknown");
00296 }

const std::string Header::GetRECOTYPE (  )  const

Definition at line 299 of file Header.cxx.

References ReleaseType::GetRecoSubVersion(), ReleaseType::IsCedar(), ReleaseType::IsDogwood(), IsValid(), and Release().

Referenced by Anp::RunModule::Init(), and Anp::RunkNN::SaveParts().

00300 {
00301    //
00302    // Return reconstruction release type as string formatted for batch processing.
00303    //
00304   cout<<" INSIDE get RECOTYPE "<<endl;
00305    if(!IsValid())
00306    {
00307       cerr << "Header::GetRECOTYPE - invalid Header" << endl;
00308       return "unknown";
00309    }
00310    
00311    const int rtype = Release();
00312    
00313    if(ReleaseType::IsCedar(rtype))
00314    {
00315       if(ReleaseType::GetRecoSubVersion(rtype) == 0 ||
00316          ReleaseType::GetRecoSubVersion(rtype) == 1)
00317       {
00318          return std::string("cedar");
00319       }
00320       else if(ReleaseType::GetRecoSubVersion(rtype) == 2)
00321       {
00322          return std::string("cedar_phy");
00323       }
00324       else if(ReleaseType::GetRecoSubVersion(rtype) == 3)
00325       {
00326          return std::string("cedar_phy_bhcurv");
00327       }
00328    }
00329    else if (ReleaseType::IsDogwood(rtype))
00330    {
00331      if(ReleaseType::GetRecoSubVersion(rtype) == 0)
00332        {
00333          return std::string("dogwood0");
00334        }
00335      if(ReleaseType::GetRecoSubVersion(rtype) == 1)
00336        {
00337          return std::string("dogwood1");
00338        }
00339      if(ReleaseType::GetRecoSubVersion(rtype) == 3)
00340        {
00341          return std::string("dogwood3");
00342        }
00343 
00344      else{
00345        cerr<<" Header::GetRECOTYPE -- Dogwood with subReco Version "<<
00346          ReleaseType::GetRecoSubVersion(rtype);
00347        return std::string("dogwood1");  
00348      }
00349 
00350    }
00351    
00352    cerr << "Header::GetRECOTYPE - unknown reconstruction release --" << rtype<<"--- "<<endl;
00353    
00354    return "dogwood1";
00355 }

const std::string Header::GetRUNCYCLE (  )  const

Definition at line 358 of file Header.cxx.

References IsData(), IsValid(), and RunPeriod().

Referenced by Anp::RunModule::Init().

00359 {
00360    //
00361    // Return reconstruction release type as string formatted for batch processing.
00362    //
00363 
00364    if(!IsValid())
00365    {
00366       cerr << "Header::GetRUNCYCLE - invalid Header" << endl;
00367       return "unknown";
00368    }
00369    
00370    if(IsData())
00371    {
00372       if(RunPeriod() > 0)
00373       {
00374          stringstream rcycle;
00375          rcycle << "run-" << std::setw(1) << RunPeriod();
00376          return std::string(rcycle.str());
00377       }
00378    }
00379    else
00380    {
00381       return std::string("run-0");
00382    }
00383 
00384    cerr << "Header::GetRUNCYCLE - unknown runperiod" << endl;
00385    
00386    return "unknown";
00387 }

bool Header::GoodBeam (  )  const [inline]

Definition at line 171 of file Header.h.

References goodbeam.

Referenced by Anp::SelectSpill::PassBeam().

00171 { return goodbeam; }

bool Header::GoodCoil (  )  const [inline]

Definition at line 172 of file Header.h.

References goodcoil.

Referenced by Anp::SelectSpill::PassCoil().

00172 { return goodcoil; }

bool Header::GoodDetc (  )  const [inline]

Definition at line 173 of file Header.h.

References gooddetc.

00173 { return gooddetc; }

bool Header::GoodHV (  )  const [inline]

Definition at line 174 of file Header.h.

References goodhv.

00174 { return goodhv; }

int Header::GPSError (  )  const [inline]

Definition at line 156 of file Header.h.

References gpstime.

00156 { return gpstime; }

int Header::GPSTime (  )  const [inline]

Definition at line 157 of file Header.h.

References gpserror.

00157 { return gpserror; }

bool Header::IsData (  )  const
bool Header::IsFar (  )  const
bool Header::IsNear (  )  const
bool Header::IsValid (  )  const [inline]
int Header::LITime (  )  const [inline]

Definition at line 158 of file Header.h.

References litime.

00158 { return litime; }

int Header::NSec (  )  const [inline]
void Anp::Header::Print ( std::ostream &  o = std::cout  )  const
int Header::Release (  )  const [inline]

Definition at line 153 of file Header.h.

References relitype.

Referenced by GetMCRLTYPE(), GetRECOTYPE(), Anp::FillHeader::Run(), Anp::FillEnergy::Run(), and Anp::FillMadId::Run().

00153 { return relitype; }

int Header::Run (  )  const [inline]
int Header::RunPeriod (  )  const [inline]

Definition at line 152 of file Header.h.

References runperiod.

Referenced by GetRUNCYCLE().

00152 { return runperiod; }

int Header::Sec (  )  const [inline]
int Header::SetBeamType ( const std::string &  value  )  [private]

Definition at line 390 of file Header.cxx.

References beamtype.

Referenced by Clear(), Header(), and Anp::FillHeader::Run().

00391 {
00392    if(value.size() > 9)
00393    {
00394      static Int_t msgCounter = 0;
00395      if (msgCounter < 10){
00396        cerr << "Header::SetBeamType - truncating input string to first 9 characters: " << value << endl;
00397        ++msgCounter;
00398      }
00399    }
00400 
00401    for(unsigned int i = 0; i < 9; ++i)
00402    {
00403       if(i < value.size())
00404       {
00405          beamtype[i] =  value[i];
00406       }
00407       else
00408       {
00409          beamtype[i] = ' ';
00410       }
00411    }
00412 
00413    return 9 - int(value.size());
00414 }

int Header::SimFlag (  )  const [inline]

Definition at line 151 of file Header.h.

References simflag.

00151 { return simflag; }

int Header::Snarl (  )  const [inline]
int Header::SpillNSec (  )  const [inline]

Definition at line 155 of file Header.h.

References spillnsec.

00155 { return spillnsec; }

int Header::SpillSec (  )  const [inline]

Definition at line 154 of file Header.h.

References spillsec.

00154 { return spillsec; }

long double Header::SpillTime (  )  const

Definition at line 141 of file Header.cxx.

References MuELoss::e, spillnsec, and spillsec.

Referenced by Anp::FillHeader::Run().

00142 {
00143    //
00144    // Return beam spill time in seconds
00145    //
00146    return static_cast<long double>(spillsec) + 1.0e-9*static_cast<long double>(spillnsec);
00147 }

int Header::SpillType (  )  const [inline]

Definition at line 149 of file Header.h.

References spilltype.

00149 { return spilltype; }

int Header::SubRun (  )  const [inline]

Definition at line 143 of file Header.h.

References subrun.

Referenced by Anp::operator==(), Anp::SelectSpill::PassList(), and Anp::SelectSpill::Run().

00143 { return subrun; }

double Header::Time2Spill (  )  const [inline]

Definition at line 168 of file Header.h.

References time2spill.

00168 { return time2spill; }

int Header::TimeFrame (  )  const [inline]

Definition at line 145 of file Header.h.

References timeframe.

00145 { return timeframe; }

float Header::Tor101 (  )  const [inline]

Definition at line 163 of file Header.h.

References tor101.

Referenced by Anp::SelectSpill::Count(), Anp::HistTime::Fill(), Anp::PlotShower::Run(), and Anp::PlotSnarl::Run().

00163 { return tor101; }

float Header::TorTgt (  )  const [inline]

Definition at line 165 of file Header.h.

References tortgt.

Referenced by Anp::SelectSpill::Count(), Anp::HistTime::Fill(), Anp::PlotShower::Run(), and Anp::PlotSnarl::Run().

00165 { return tortgt; }

float Header::Tr101D (  )  const [inline]

Definition at line 164 of file Header.h.

References tr101d.

Referenced by Anp::SelectSpill::Count(), Anp::HistTime::Fill(), and Anp::PlotShower::Run().

00164 { return tr101d; }

int Header::Trigger (  )  const [inline]

Definition at line 148 of file Header.h.

References trigger.

00148 { return trigger; }

long double Header::TriggTime (  )  const

Definition at line 150 of file Header.cxx.

References MuELoss::e, nsec, and sec.

00151 {
00152    //
00153    // Return trigger time in seconds
00154    //
00155    return static_cast<long double>(sec) + 1.0e-9*static_cast<long double>(nsec);
00156 }

float Header::TrTgtD (  )  const [inline]

Definition at line 166 of file Header.h.

References trtgtd.

Referenced by Anp::SelectSpill::Count(), Anp::HistTime::Fill(), and Anp::PlotShower::Run().

00166 { return trtgtd; }


Friends And Related Function Documentation

friend class FillHeader [friend]

Definition at line 92 of file Header.h.


Member Data Documentation

Int_t Anp::Header::beamdnsec [private]

Definition at line 113 of file Header.h.

Referenced by BeamDNSec(), BeamDTime(), Clear(), and Anp::FillHeader::Run().

Int_t Anp::Header::beamdsec [private]

Definition at line 112 of file Header.h.

Referenced by BeamDSec(), BeamDTime(), Clear(), and Anp::FillHeader::Run().

char Anp::Header::beamtype[9] [private]

Definition at line 128 of file Header.h.

Referenced by GetBEAMTYPE(), and SetBeamType().

Float_t Anp::Header::coilcur [private]

Definition at line 118 of file Header.h.

Referenced by Clear(), CoilCur(), and Anp::FillHeader::Run().

Bool_t Anp::Header::coilrevs [private]

Definition at line 121 of file Header.h.

Referenced by Clear(), CoilRevs(), and Anp::FillHeader::Run().

Int_t Anp::Header::cratemask [private]

Definition at line 111 of file Header.h.

Referenced by Clear(), CrateMask(), and Anp::FillHeader::Run().

Int_t Anp::Header::detector [private]

Definition at line 102 of file Header.h.

Referenced by Clear(), Detector(), IsFar(), IsNear(), and Anp::FillHeader::Run().

Bool_t Anp::Header::goodbeam [private]

Definition at line 122 of file Header.h.

Referenced by Clear(), GoodBeam(), and Anp::FillHeader::Run().

Bool_t Anp::Header::goodcoil [private]

Definition at line 123 of file Header.h.

Referenced by Clear(), GoodCoil(), and Anp::FillHeader::Run().

Bool_t Anp::Header::gooddetc [private]

Definition at line 124 of file Header.h.

Referenced by Clear(), GoodDetc(), and Anp::FillHeader::Run().

Bool_t Anp::Header::goodhv [private]

Definition at line 125 of file Header.h.

Referenced by Clear(), GoodHV(), and Anp::FillHeader::Run().

Int_t Anp::Header::gpserror [private]

Definition at line 109 of file Header.h.

Referenced by Clear(), GPSTime(), and Anp::FillHeader::Run().

Int_t Anp::Header::gpstime [private]

Definition at line 108 of file Header.h.

Referenced by Clear(), GPSError(), and Anp::FillHeader::Run().

Int_t Anp::Header::litime [private]

Definition at line 110 of file Header.h.

Referenced by Clear(), LITime(), and Anp::FillHeader::Run().

Int_t Anp::Header::nsec [private]

Definition at line 99 of file Header.h.

Referenced by Clear(), NSec(), Anp::FillHeader::Run(), and TriggTime().

Int_t Anp::Header::relitype [private]

Definition at line 105 of file Header.h.

Referenced by Clear(), Release(), and Anp::FillHeader::Run().

Int_t Anp::Header::run [private]

Definition at line 94 of file Header.h.

Referenced by Clear(), Anp::FillHeader::Run(), and Run().

Int_t Anp::Header::runperiod [private]

Definition at line 104 of file Header.h.

Referenced by Clear(), Anp::FillHeader::Run(), and RunPeriod().

Int_t Anp::Header::sec [private]

Definition at line 98 of file Header.h.

Referenced by Clear(), Anp::FillHeader::Run(), Sec(), and TriggTime().

Int_t Anp::Header::simflag [private]

Definition at line 103 of file Header.h.

Referenced by Clear(), IsData(), Anp::FillHeader::Run(), and SimFlag().

Int_t Anp::Header::snarl [private]

Definition at line 96 of file Header.h.

Referenced by Clear(), Anp::FillHeader::Run(), and Snarl().

Int_t Anp::Header::spillnsec [private]

Definition at line 107 of file Header.h.

Referenced by Clear(), Anp::FillHeader::Run(), SpillNSec(), and SpillTime().

Int_t Anp::Header::spillsec [private]

Definition at line 106 of file Header.h.

Referenced by Clear(), Anp::FillHeader::Run(), SpillSec(), and SpillTime().

Int_t Anp::Header::spilltype [private]

Definition at line 101 of file Header.h.

Referenced by Clear(), Anp::FillHeader::Run(), and SpillType().

Int_t Anp::Header::subrun [private]

Definition at line 95 of file Header.h.

Referenced by Clear(), Anp::FillHeader::Run(), and SubRun().

Double_t Anp::Header::time2spill [private]

Definition at line 119 of file Header.h.

Referenced by Clear(), Anp::FillHeader::Run(), and Time2Spill().

Int_t Anp::Header::timeframe [private]

Definition at line 97 of file Header.h.

Referenced by Clear(), Anp::FillHeader::Run(), and TimeFrame().

Float_t Anp::Header::tor101 [private]

Definition at line 114 of file Header.h.

Referenced by Clear(), Anp::FillHeader::Run(), and Tor101().

Float_t Anp::Header::tortgt [private]

Definition at line 116 of file Header.h.

Referenced by Clear(), Anp::FillHeader::Run(), and TorTgt().

Float_t Anp::Header::tr101d [private]

Definition at line 115 of file Header.h.

Referenced by Clear(), Anp::FillHeader::Run(), and Tr101D().

Int_t Anp::Header::trigger [private]

Definition at line 100 of file Header.h.

Referenced by Clear(), Anp::FillHeader::Run(), and Trigger().

Float_t Anp::Header::trtgtd [private]

Definition at line 117 of file Header.h.

Referenced by Clear(), Anp::FillHeader::Run(), and TrTgtD().

Bool_t Anp::Header::valid [private]

Definition at line 126 of file Header.h.

Referenced by Clear(), IsValid(), and Anp::FillHeader::Run().


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

Generated on 3 Oct 2018 for loon by  doxygen 1.6.1