NtpFile Class Reference

#include <NtpFile.h>

List of all members.

Public Member Functions

 NtpFile ()
 NtpFile (bool icMC, bool isMRCC=false)
virtual ~NtpFile ()
int AddFiles (const char *filenames)
bool Init ()
virtual bool GetNextRecord ()
virtual bool ReloadRecord ()
const NtpStRecordGetCCRecord () const
const NtpBDLiteRecordGetBDRecord () const
const NtpMRRecordGetMRRecord () const
const NtpStRecordGetOldRecord () const

Private Attributes

bool fIsMC
bool fIsMRCC
TChain * fCCChain
NtpStRecordfCCRecord
TChain * fBDChain
NtpBDLiteRecordfBDRecord
TChain * fMRChain
NtpMRRecordfMRRecord
TChain * fOldChain
NtpStRecordfOldRecord
long iCCEvent

Detailed Description

Definition at line 9 of file NtpFile.h.


Constructor & Destructor Documentation

NtpFile::NtpFile (  ) 

Definition at line 18 of file NtpFile.cxx.

References fBDChain, fBDRecord, fCCChain, fCCRecord, fIsMC, fMRChain, fMRRecord, iCCEvent, Msg::kWarning, and MSG.

00018                 {
00019   MSG("NtpAna", Msg::kWarning) << "Assuming DATA" <<endl;
00020   fIsMC = false;
00021   fCCChain = new TChain("NtpSt");
00022   fBDChain = new TChain("NtpBDLite");
00023   fMRChain = new TChain("NtpMR");
00024   fCCRecord = new NtpStRecord();
00025   fBDRecord = new NtpBDLiteRecord();
00026   fMRRecord = new NtpMRRecord();
00027 
00028   iCCEvent = -1;
00029 }

NtpFile::NtpFile ( bool  icMC,
bool  isMRCC = false 
)

Definition at line 31 of file NtpFile.cxx.

References fBDChain, fBDRecord, fCCChain, fCCRecord, fIsMC, fIsMRCC, fMRChain, fMRRecord, fOldChain, fOldRecord, and iCCEvent.

00031                                       {
00032   fIsMC = isMC;
00033   fIsMRCC = isMRCC;
00034   fCCChain = new TChain("NtpSt");
00035   fBDChain = new TChain("NtpBDLite");
00036   fMRChain = new TChain("NtpMR");
00037   fOldChain = new TChain("NtpOld");
00038   fCCRecord = new NtpStRecord();
00039   fBDRecord = new NtpBDLiteRecord();
00040   fMRRecord = new NtpMRRecord();
00041   fOldRecord = new NtpStRecord();
00042 
00043   iCCEvent = -1;
00044 }

NtpFile::~NtpFile (  )  [virtual]

Definition at line 46 of file NtpFile.cxx.

References NtpStRecord::Clear(), NtpMRRecord::Clear(), fBDChain, fBDRecord, fCCChain, fCCRecord, fMRChain, fMRRecord, fOldChain, and fOldRecord.

00046                  {
00047   fCCRecord->Clear();
00048   fBDRecord->Clear();  
00049   fMRRecord->Clear();
00050   fOldRecord->Clear();
00051   delete fCCChain;
00052   delete fCCRecord;
00053   delete fBDRecord;
00054   delete fBDChain;
00055   delete fMRRecord;
00056   delete fMRChain;
00057   delete fOldRecord;
00058   delete fOldChain;
00059 }


Member Function Documentation

int NtpFile::AddFiles ( const char *  filenames  ) 

Definition at line 75 of file NtpFile.cxx.

References fBDChain, fCCChain, fMRChain, and fOldChain.

00075                                            {
00076   return (fCCChain->Add(filesnames) + fBDChain->Add(filesnames) + fMRChain->Add(filesnames) +  fOldChain->Add(filesnames) );
00077 }

const NtpBDLiteRecord* NtpFile::GetBDRecord (  )  const [inline]

Definition at line 20 of file NtpFile.h.

References fBDRecord.

00020 {return fBDRecord;}

const NtpStRecord* NtpFile::GetCCRecord (  )  const [inline]

Definition at line 19 of file NtpFile.h.

References fCCRecord.

00019 {return fCCRecord;}

const NtpMRRecord* NtpFile::GetMRRecord (  )  const [inline]

Definition at line 21 of file NtpFile.h.

References fMRRecord.

00021 {return fMRRecord;}

bool NtpFile::GetNextRecord (  )  [virtual]

Definition at line 79 of file NtpFile.cxx.

References NtpStRecord::Clear(), NtpMRRecord::Clear(), fBDChain, fBDRecord, fCCChain, fCCRecord, fIsMC, fIsMRCC, fMRChain, fMRRecord, fOldChain, fOldRecord, iCCEvent, Init(), Msg::kWarning, and MSG.

00079                            {
00080   if(iCCEvent<0){
00081     MSG("NtpAna", Msg::kWarning) << "The files have not been inited... doning it now" <<endl;
00082     this->Init();
00083   }
00084   fCCRecord->Clear();
00085   fBDRecord->Clear();
00086   fMRRecord->Clear();
00087   fOldRecord->Clear();
00088   const int rc1 = fCCChain->GetEntry(iCCEvent); 
00089   if(rc1<0){
00090     cout << "*** Failed to get next record " <<endl;
00091     return 0;
00092   }else if(rc1==0){
00093     cout << "End of Records  " <<endl;
00094     return 0;    
00095   }
00096   const int rc2 = ((fIsMC==false)? fBDChain->GetEntry(iCCEvent) : 1 );
00097   if(rc2<=0){
00098     cout << "*** Failed to get beam record " <<endl;
00099     return 0;
00100   }
00101   const int rc3 = ((fIsMRCC==true)? fMRChain->GetEntry(iCCEvent) : 1 );
00102   if(rc3<=0){
00103     cout << "*** Failed to get mr record " <<endl;
00104     return 0;
00105   }
00106   const int rc4 = ((fIsMRCC==true)? fOldChain->GetEntry(iCCEvent) : 1 );
00107   if(rc4<=0){
00108     cout << "*** Failed to get mrold record " <<endl;
00109     return 0;
00110   }
00111   
00112   iCCEvent++;
00113   return true;
00114 }

const NtpStRecord* NtpFile::GetOldRecord (  )  const [inline]

Definition at line 22 of file NtpFile.h.

References fOldRecord.

00022 {return fOldRecord;}

bool NtpFile::Init ( void   ) 

Definition at line 62 of file NtpFile.cxx.

References fBDChain, fBDRecord, fCCChain, fCCRecord, fIsMC, fIsMRCC, fMRChain, fMRRecord, fOldChain, fOldRecord, and iCCEvent.

Referenced by GetNextRecord(), and ReloadRecord().

00062                   {
00063   iCCEvent = 0;
00064   fCCChain->SetBranchAddress("NtpStRecord", &fCCRecord);
00065   if(!fIsMC)
00066     fBDChain->SetBranchAddress("NtpBDLiteRecord", &fBDRecord);
00067   if(fIsMRCC){
00068     fMRChain->SetBranchAddress("NtpMRRecord", &fMRRecord);
00069     fOldChain->SetBranchAddress("NtpStRecord", &fOldRecord);
00070     fOldChain->SetBranchStatus("stp.*", false);
00071   }
00072   return true;
00073 }

bool NtpFile::ReloadRecord (  )  [virtual]

Definition at line 117 of file NtpFile.cxx.

References NtpStRecord::Clear(), fBDChain, fBDRecord, fCCChain, fCCRecord, fIsMC, fIsMRCC, fMRChain, iCCEvent, Init(), Msg::kWarning, and MSG.

00117                           {
00118   if(iCCEvent<0){
00119     MSG("NtpAna", Msg::kWarning) << "The files have not been inited... doning it now" <<endl;
00120     this->Init();
00121   }
00122   fCCRecord->Clear();
00123   fBDRecord->Clear();
00124   const int rc1 = fCCChain->GetEntry(iCCEvent-1); 
00125   if(rc1<0){
00126     cout << "*** Failed to get next record " <<endl;
00127     return 0;
00128   }else if(rc1==0){
00129     cout << "End of Records  " <<endl;
00130     return 0;    
00131   }
00132   const int rc2 = ((fIsMC==false)? fBDChain->GetEntry(iCCEvent-1) : 1 );
00133   if(rc2<=0){
00134     cout << "*** Failed to get beam record " <<endl;
00135     return 0;
00136   }
00137   const int rc3 = ((fIsMRCC==true)? fMRChain->GetEntry(iCCEvent-1) : 1 );
00138   if(rc3<=0){
00139     cout << "*** Failed to get mr record " <<endl;
00140     return 0;
00141   }
00142 
00143 
00144   return true;
00145 }


Member Data Documentation

TChain* NtpFile::fBDChain [private]

Definition at line 29 of file NtpFile.h.

Referenced by AddFiles(), GetNextRecord(), Init(), NtpFile(), ReloadRecord(), and ~NtpFile().

Definition at line 30 of file NtpFile.h.

Referenced by GetBDRecord(), GetNextRecord(), Init(), NtpFile(), ReloadRecord(), and ~NtpFile().

TChain* NtpFile::fCCChain [private]

Definition at line 27 of file NtpFile.h.

Referenced by AddFiles(), GetNextRecord(), Init(), NtpFile(), ReloadRecord(), and ~NtpFile().

Definition at line 28 of file NtpFile.h.

Referenced by GetCCRecord(), GetNextRecord(), Init(), NtpFile(), ReloadRecord(), and ~NtpFile().

bool NtpFile::fIsMC [private]

Definition at line 24 of file NtpFile.h.

Referenced by GetNextRecord(), Init(), NtpFile(), and ReloadRecord().

bool NtpFile::fIsMRCC [private]

Definition at line 25 of file NtpFile.h.

Referenced by GetNextRecord(), Init(), NtpFile(), and ReloadRecord().

TChain* NtpFile::fMRChain [private]

Definition at line 32 of file NtpFile.h.

Referenced by AddFiles(), GetNextRecord(), Init(), NtpFile(), ReloadRecord(), and ~NtpFile().

Definition at line 33 of file NtpFile.h.

Referenced by GetMRRecord(), GetNextRecord(), Init(), NtpFile(), and ~NtpFile().

TChain* NtpFile::fOldChain [private]

Definition at line 34 of file NtpFile.h.

Referenced by AddFiles(), GetNextRecord(), Init(), NtpFile(), and ~NtpFile().

Definition at line 35 of file NtpFile.h.

Referenced by GetNextRecord(), GetOldRecord(), Init(), NtpFile(), and ~NtpFile().

long NtpFile::iCCEvent [private]

Definition at line 38 of file NtpFile.h.

Referenced by GetNextRecord(), Init(), NtpFile(), and ReloadRecord().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1