Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

MoqChain Class Reference

#include <MoqChain.h>

List of all members.

Public Member Functions

 MoqChain (TChain *chainSR=0, TChain *chainMC=0, TChain *chainTH=0, TChain *chainEM=0)
 ~MoqChain ()
Int_t Get (Int_t entry)
void Init (TChain *chainSR, TChain *chainMC, TChain *chainTH, TChain *chainEM)
void Show (Int_t entry=-1)

Public Attributes

Bool_t isMC
Bool_t isTH
Bool_t isEM
Int_t Nentries
NtpSRRecordRecord
NtpMCRecordmcRecord
NtpTHRecordthRecord
NtpEMRecordemRecord

Protected Member Functions

void Zero ()

Protected Attributes

TChain * fChainSR
Int_t fCurrentSR
TChain * fChainMC
Int_t fCurrentMC
TChain * fChainTH
Int_t fCurrentTH
TChain * fChainEM
Int_t fCurrentEM


Constructor & Destructor Documentation

MoqChain::MoqChain TChain *  chainSR = 0,
TChain *  chainMC = 0,
TChain *  chainTH = 0,
TChain *  chainEM = 0
 

Definition at line 7 of file MoqChain.cxx.

References Init().

00009 {
00010   
00011   Init(chainSR,chainMC,chainTH,chainEM);
00012 
00013 }

MoqChain::~MoqChain  ) 
 

Definition at line 15 of file MoqChain.cxx.

References fChainEM, fChainMC, fChainSR, and fChainTH.

00016 {
00017   if(!fChainSR) return;
00018   delete fChainSR->GetCurrentFile();
00019   if(fChainEM) delete fChainEM->GetCurrentFile();
00020   if(!fChainMC) return;
00021   delete fChainMC->GetCurrentFile();
00022   if(!fChainTH) return;
00023   delete fChainTH->GetCurrentFile();  
00024 }


Member Function Documentation

Int_t MoqChain::Get Int_t  entry  ) 
 

Definition at line 26 of file MoqChain.cxx.

References emRecord, fChainEM, fChainMC, fChainSR, fChainTH, fCurrentEM, fCurrentMC, fCurrentSR, fCurrentTH, RecRecordImp< T >::GetHeader(), RecPhysicsHeader::GetSnarl(), mcRecord, Record, and thRecord.

Referenced by MoqBase::GetEntry().

00027 {
00028   
00029   //estimate MC,TH entry numbers
00030   if(entry<fCurrentSR||fCurrentSR==-1) {
00031     fCurrentMC=entry;
00032     fCurrentTH=entry;
00033     fCurrentEM=entry;
00034   }
00035   else if(entry>fCurrentSR) {
00036     fCurrentMC+=(entry-fCurrentSR);
00037     fCurrentTH+=(entry-fCurrentSR);
00038     fCurrentEM+=(entry-fCurrentSR);
00039   }
00040   
00041   // Read contents of entry.
00042   if (!fChainSR) return 0;
00043   Int_t status = fChainSR->GetEntry(entry);
00044   fCurrentSR = entry;
00045 
00046   if(isEM) {
00047     fChainEM->GetEntry(fCurrentEM);
00048     int xtra = 0;  //just in case tree entries are not correlated
00049     while(Record->GetHeader().GetSnarl()!=emRecord->GetHeader().GetSnarl()){
00050     xtra+=1;
00051     fChainEM->GetEntry(fCurrentEM+xtra);
00052     }
00053     fCurrentEM+=xtra;
00054   }
00055   
00056   if(isMC) {
00057     fChainMC->GetEntry(fCurrentMC);
00058     int xtra = 0;  //just in case tree entries are not correlated
00059     while(Record->GetHeader().GetSnarl()!=mcRecord->GetHeader().GetSnarl()){
00060     xtra+=1;
00061     fChainMC->GetEntry(fCurrentMC+xtra);     
00062     }
00063     fCurrentMC+=xtra;
00064   }
00065   
00066   if(isTH) {
00067     fChainTH->GetEntry(fCurrentTH);
00068     int xtra = 0;  //just in case tree entries are not correlated
00069     while(Record->GetHeader().GetSnarl()!=thRecord->GetHeader().GetSnarl()){
00070     xtra+=1;
00071     fChainTH->GetEntry(fCurrentTH+xtra);      
00072     }
00073     fCurrentTH+=xtra;
00074   }
00075   return status;
00076 }

void MoqChain::Init TChain *  chainSR,
TChain *  chainMC,
TChain *  chainTH,
TChain *  chainEM
 

Definition at line 78 of file MoqChain.cxx.

References emRecord, fChainEM, fChainMC, fChainSR, fChainTH, fCurrentEM, fCurrentMC, fCurrentSR, fCurrentTH, isEM, isMC, isTH, mcRecord, Nentries, Record, thRecord, and Zero().

Referenced by MoqChain().

00080 {
00081 
00082   Zero();
00083 
00084   if(chainSR==0) {
00085     std::cerr << "No file added" << std::endl;
00086     return;
00087   }
00088   fChainSR = chainSR;
00089   fChainSR->SetBranchAddress("NtpSRRecord",&Record);
00090   fCurrentSR = -1;  
00091   Nentries = Int_t(fChainSR->GetEntries());
00092 
00093   if(chainEM==0) {
00094     isEM = false;    
00095   }
00096   else {
00097     fChainEM = chainEM;
00098     fChainEM->SetBranchAddress("NtpEMRecord",&emRecord);
00099     fCurrentEM = -1;    
00100   }
00101 
00102   if(chainMC==0) {
00103     isMC = false;
00104     isTH = false;
00105     return;
00106   }
00107   fChainMC = chainMC;
00108   fChainMC->SetBranchAddress("NtpMCRecord",&mcRecord);
00109   fCurrentMC = -1;
00110 
00111   if(chainTH==0) {
00112     isTH = false;
00113     return;
00114   }
00115   fChainTH = chainTH;
00116   fChainTH->SetBranchAddress("NtpTHRecord",&thRecord);
00117   fCurrentTH = -1;
00118 
00119 }

void MoqChain::Show Int_t  entry = -1  ) 
 

Definition at line 121 of file MoqChain.cxx.

References fChainEM, fChainMC, fChainSR, and fChainTH.

00122 {
00123 // Print contents of entry.
00124 // If entry is not specified, print current entry
00125    if (!fChainSR) return;
00126    fChainSR->Show(entry);
00127    if (fChainEM) fChainEM->Show(entry);
00128    if (!fChainMC) return;
00129    fChainMC->Show(entry);
00130    if (!fChainTH) return;
00131    fChainTH->Show(entry);
00132 }

void MoqChain::Zero  )  [protected]
 

Definition at line 134 of file MoqChain.cxx.

References emRecord, fChainEM, fChainMC, fChainSR, fChainTH, fCurrentEM, fCurrentMC, fCurrentSR, fCurrentTH, isEM, isMC, isTH, mcRecord, Nentries, Record, and thRecord.

Referenced by Init().

00134                    {
00135     
00136   Record = 0;
00137   emRecord = 0;
00138   mcRecord = 0;
00139   thRecord = 0;
00140   
00141   isMC = true;
00142   isTH = true;
00143   isEM = true;
00144   Nentries = -1;
00145   
00146   fChainSR = 0;
00147   fChainMC = 0;
00148   fChainTH = 0;
00149   fChainEM = 0;
00150   
00151   fCurrentSR = 0;
00152   fCurrentMC = 0;
00153   fCurrentTH = 0;
00154   fCurrentEM = 0;
00155 
00156 }


Member Data Documentation

NtpEMRecord* MoqChain::emRecord
 

Definition at line 48 of file MoqChain.h.

Referenced by Get(), MoqBase::GetEntry(), Init(), and Zero().

TChain* MoqChain::fChainEM [protected]
 

Definition at line 26 of file MoqChain.h.

Referenced by Get(), Init(), Show(), Zero(), and ~MoqChain().

TChain* MoqChain::fChainMC [protected]
 

Definition at line 20 of file MoqChain.h.

Referenced by Get(), Init(), Show(), Zero(), and ~MoqChain().

TChain* MoqChain::fChainSR [protected]
 

Definition at line 17 of file MoqChain.h.

Referenced by Get(), Init(), Show(), Zero(), and ~MoqChain().

TChain* MoqChain::fChainTH [protected]
 

Definition at line 23 of file MoqChain.h.

Referenced by Get(), Init(), Show(), Zero(), and ~MoqChain().

Int_t MoqChain::fCurrentEM [protected]
 

Definition at line 27 of file MoqChain.h.

Referenced by Get(), Init(), and Zero().

Int_t MoqChain::fCurrentMC [protected]
 

Definition at line 21 of file MoqChain.h.

Referenced by Get(), Init(), and Zero().

Int_t MoqChain::fCurrentSR [protected]
 

Definition at line 18 of file MoqChain.h.

Referenced by Get(), Init(), and Zero().

Int_t MoqChain::fCurrentTH [protected]
 

Definition at line 24 of file MoqChain.h.

Referenced by Get(), Init(), and Zero().

Bool_t MoqChain::isEM
 

Definition at line 42 of file MoqChain.h.

Referenced by Init(), MoqBase::InitChain(), and Zero().

Bool_t MoqChain::isMC
 

Definition at line 40 of file MoqChain.h.

Referenced by Init(), MoqBase::InitChain(), and Zero().

Bool_t MoqChain::isTH
 

Definition at line 41 of file MoqChain.h.

Referenced by Init(), MoqBase::InitChain(), and Zero().

NtpMCRecord* MoqChain::mcRecord
 

Definition at line 46 of file MoqChain.h.

Referenced by Get(), MoqBase::GetEntry(), Init(), and Zero().

Int_t MoqChain::Nentries
 

Definition at line 43 of file MoqChain.h.

Referenced by Init(), MoqBase::InitChain(), and Zero().

NtpSRRecord* MoqChain::Record
 

Definition at line 45 of file MoqChain.h.

Referenced by Get(), MoqBase::GetEntry(), Init(), and Zero().

NtpTHRecord* MoqChain::thRecord
 

Definition at line 47 of file MoqChain.h.

Referenced by Get(), MoqBase::GetEntry(), Init(), and Zero().


The documentation for this class was generated from the following files:
Generated on Mon Feb 15 11:09:37 2010 for loon by  doxygen 1.3.9.1