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

edm::EventHandle Class Reference

Interface to the event store. Allows for partial I/O of various event components and enforcess const-correctness. More...

#include <EventHandle.h>

Inheritance diagram for edm::EventHandle:

io::EventHandle List of all members.

Public Member Functions

 EventHandle ()
virtual ~EventHandle ()
void Clear ()
int ClearLoadFlags ()
void SetLoaded (int branchId) const
const EventHeaderHeader () const
const DataBucketMC () const
const DataBucketDAQ () const
const DataBucketDetSim () const
const DataBucketRaw () const
const DataBucketRawAux () const
const DataBucketCal () const
const DataBucketReco () const
const DataBucketUser () const
const DataBucketSummary () const
EventHeaderHeader ()
DataBucketMC ()
DataBucketDetSim ()
DataBucketDAQ ()
DataBucketRaw ()
DataBucketRawAux ()
DataBucketCal ()
DataBucketReco ()
DataBucketUser ()
DataBucketSummary ()

Protected Types

enum  BranchID_t {
  kHeaderID, kMCID, kDetSimID, kDAQID,
  kRawID, kRawAuxID, kCalID, kRecoID,
  kUserID, kSummaryID, kNBranch
}

Protected Member Functions

DataBucketBucket (BranchID_t branchID) const
bool IsLoaded (BranchID_t branchID) const
virtual int Load (int branchID) const=0

Protected Attributes

int fObjectCnt
bool fIsLoaded [kNBranch]
EventfEvent
DataBucket fMC
DataBucket fDetSim
DataBucket fDAQ
DataBucket fRaw
DataBucket fRawAux
DataBucket fCal
DataBucket fReco
DataBucket fUser
DataBucket fSummary

Detailed Description

Interface to the event store. Allows for partial I/O of various event components and enforcess const-correctness.

Definition at line 16 of file EventDataModel/EventHandle.h.


Member Enumeration Documentation

enum edm::EventHandle::BranchID_t [protected]
 

Enumeration values:
kHeaderID 
kMCID 
kDetSimID 
kDAQID 
kRawID 
kRawAuxID 
kCalID 
kRecoID 
kUserID 
kSummaryID 
kNBranch 

Definition at line 49 of file EventDataModel/EventHandle.h.

00049                  {
00050       kHeaderID,
00051       kMCID,
00052       kDetSimID,
00053       kDAQID,
00054       kRawID,
00055       kRawAuxID,
00056       kCalID,
00057       kRecoID,
00058       kUserID,
00059       kSummaryID,
00060       kNBranch
00061     } BranchID_t;


Constructor & Destructor Documentation

EventHandle::EventHandle  ) 
 

Construct an empty event handle

Reimplemented in io::EventHandle.

Definition at line 20 of file EventDataModel/EventHandle.cxx.

References fIsLoaded, and kNBranch.

00020                          : 
00021   fObjectCnt(TProcessID::GetObjectCount()),
00022   fEvent  (new Event ),
00023   fMC     (fEvent->fMC    ),
00024   fDetSim (fEvent->fDetSim),
00025   fDAQ    (fEvent->fDAQ   ),
00026   fRaw    (fEvent->fRaw   ),
00027   fRawAux (fEvent->fRawAux),
00028   fCal    (fEvent->fCal   ),
00029   fReco   (fEvent->fReco  ),
00030   fUser   (fEvent->fUser  ),
00031   fSummary(fEvent->fSummary)
00032 {
00033   for (int i = 0; i<kNBranch; ++i) fIsLoaded[i] = false;
00034 }

EventHandle::~EventHandle  )  [virtual]
 

Clear all data arrays and delete the event

Reimplemented in io::EventHandle.

Definition at line 40 of file EventDataModel/EventHandle.cxx.

References edm::DataBucket::ClearArrays(), fCal, fDAQ, fDetSim, fEvent, fMC, fRaw, fRawAux, fReco, fSummary, and fUser.

00041 {
00042   fMC.     ClearArrays();
00043   fDetSim. ClearArrays();
00044   fDAQ.    ClearArrays();
00045   fRaw.    ClearArrays();
00046   fRawAux. ClearArrays();
00047   fCal.    ClearArrays();
00048   fReco.   ClearArrays();
00049   fUser.   ClearArrays();
00050   fSummary.ClearArrays();
00051   delete fEvent;
00052 }


Member Function Documentation

DataBucket & EventHandle::Bucket BranchID_t  branchID  )  const [protected]
 

Return the data bucket identified by branchID

Parameters:
branchId : ID code of branch.
See also:
BranchID_t
Returns:
The DataBucket corresponding to the branch ID

Definition at line 133 of file EventDataModel/EventHandle.cxx.

References fCal, fDAQ, fDetSim, fMC, fRaw, fRawAux, fReco, fSummary, fUser, IsLoaded(), kCalID, kDAQID, kDetSimID, kMCID, kRawAuxID, kRawID, kRecoID, kSummaryID, kUserID, and Load().

Referenced by Cal(), DAQ(), DetSim(), MC(), Raw(), RawAux(), Reco(), Summary(), and User().

00134 {
00135   if (this->IsLoaded(branchID)==false) this->Load(branchID);
00136 
00137   switch (branchID) {
00138   case kMCID:      return fMC;
00139   case kDetSimID:  return fDetSim;
00140   case kDAQID:     return fDAQ;
00141   case kRawID:     return fRaw;
00142   case kRawAuxID:  return fRawAux;
00143   case kCalID:     return fCal;
00144   case kRecoID:    return fReco;
00145   case kUserID:    return fUser;
00146   case kSummaryID: return fSummary;
00147   default:         abort();
00148   } 
00149 
00150   // Provide return code to quiet compilers
00151   static DataBucket empty(0);
00152   return empty;
00153 }

DataBucket & EventHandle::Cal  ) 
 

Definition at line 162 of file EventDataModel/EventHandle.cxx.

References Bucket(), and kCalID.

00162 { return this->Bucket(kCalID);    }

const DataBucket & EventHandle::Cal  )  const
 

Definition at line 182 of file EventDataModel/EventHandle.cxx.

References Bucket(), and kCalID.

Referenced by main().

00182                                          { 
00183   return this->Bucket(kCalID);
00184 }

void EventHandle::Clear  ) 
 

Mark all branches as unloaded and clear up the event

Definition at line 58 of file EventDataModel/EventHandle.cxx.

References edm::Event::Clear(), ClearLoadFlags(), and fEvent.

Referenced by io::ReadWriteModule::AddFile(), and main().

00059 {
00060   this->ClearLoadFlags();
00061   fEvent->Clear();
00062 }

int EventHandle::ClearLoadFlags  ) 
 

Mark all branches as unloaded. Next read attempt will have to go back to disk.

Returns:
The set of load flags prior to the clear.

Definition at line 71 of file EventDataModel/EventHandle.cxx.

References fIsLoaded, fObjectCnt, and kNBranch.

Referenced by io::EventHandle::Advance(), Clear(), io::EventHandle::EventHandle(), io::ReadWriteModule::Reload(), io::EventHandle::Rewind(), and io::EventHandle::SetupInputFile().

00072 {
00073   int isave=0;
00074   TProcessID::SetObjectCount(fObjectCnt);
00075 
00076   for (int i=0; i<kNBranch; ++i) { // Mark all branches as unloaded
00077     if (fIsLoaded[i] == true) isave |= (1 << i);
00078     fIsLoaded[i] = false;     
00079   }
00080   return isave;
00081 }

DataBucket & EventHandle::DAQ  ) 
 

Definition at line 159 of file EventDataModel/EventHandle.cxx.

References Bucket(), and kDAQID.

00159 { return this->Bucket(kDAQID);    }

const DataBucket & EventHandle::DAQ  )  const
 

Definition at line 173 of file EventDataModel/EventHandle.cxx.

References Bucket(), and kDAQID.

Referenced by main().

00173                                          { 
00174   return this->Bucket(kDAQID);
00175 }

DataBucket & EventHandle::DetSim  ) 
 

Definition at line 158 of file EventDataModel/EventHandle.cxx.

References Bucket(), and kDetSimID.

00158 { return this->Bucket(kDetSimID); }

const DataBucket & EventHandle::DetSim  )  const
 

Definition at line 170 of file EventDataModel/EventHandle.cxx.

References Bucket(), and kDetSimID.

Referenced by doFLSHits(), doStdHep(), evd::PlaneView::DrawMC(), evd::PlaneView::DrawMCHits(), evd::DetectorView::DrawMCTruth(), main(), photrans::SimpleTransport::Reco(), and novamc::NOVAMC::Reco().

00170                                             { 
00171   return this->Bucket(kDetSimID);
00172 }

EventHeader & EventHandle::Header  ) 
 

Return the event header, load if necesary.

Returns:
The event header in non-const form.

Definition at line 107 of file EventDataModel/EventHandle.cxx.

References fEvent, edm::Event::fHeader, IsLoaded(), kHeaderID, and Load().

00108 {
00109   if (this->IsLoaded(kHeaderID) == false) this->Load(kHeaderID);
00110 
00111   return *(fEvent->fHeader);
00112 }

const EventHeader & EventHandle::Header  )  const
 

Return the event header, load if necesary

Returns:
The event header in const form.

Definition at line 119 of file EventDataModel/EventHandle.cxx.

References fEvent, edm::Event::fHeader, IsLoaded(), kHeaderID, and Load().

Referenced by jobc::Job::CheckStatus(), doHeader(), evd::DetectorView::Draw(), evd::PlaneView::DrawMCHits(), evd::PlaneView::DrawPlaneClusters(), evd::PlaneView::DrawRawDigit(), evd::PlaneView::DrawTracks(), jobc::Sequence::Exec(), GetEventNumbers(), gsGetEventNumbers(), main(), rpr::TrackReco::Reco(), spider::SpiderWeb::Reco(), photrans::SimpleTransport::Reco(), rsim::ReadoutSim::Reco(), rpr::FindTrackSeg::Reco(), cluster::Clusterer::Reco(), photrans::PhotonTransporter::SeedOnEvent(), and io::ReadWriteModule::UpdateEventNumbers().

00120 {
00121   if (this->IsLoaded(kHeaderID) == false) this->Load(kHeaderID);
00122   
00123   return *(fEvent->fHeader);
00124 }

bool EventHandle::IsLoaded BranchID_t  id  )  const [protected]
 

Is a particular branch loaded

Parameters:
id : The id code for the branch in question
See also:
BranchID_t

Definition at line 201 of file EventDataModel/EventHandle.cxx.

References fIsLoaded.

Referenced by Bucket(), Header(), and io::EventHandle::Load().

00202 {
00203   if (id < kNBranch && id >= 0) return fIsLoaded[id];
00204   abort();
00205   return false;
00206 }

virtual int edm::EventHandle::Load int  branchID  )  const [protected, pure virtual]
 

Implemented in io::EventHandle.

Referenced by Bucket(), and Header().

DataBucket & EventHandle::MC  ) 
 

Definition at line 157 of file EventDataModel/EventHandle.cxx.

References Bucket(), and kMCID.

00157 { return this->Bucket(kMCID);     }

const DataBucket & EventHandle::MC  )  const
 

Definition at line 167 of file EventDataModel/EventHandle.cxx.

References Bucket(), and kMCID.

Referenced by mcchk::GenCheck::Ana(), doNeuKin(), evd::PlaneView::DrawMC(), evd::DetectorView::DrawMCTruth(), main(), and novamc::NOVAMC::Reco().

00167                                         {
00168   return this->Bucket(kMCID); 
00169 }

DataBucket & EventHandle::Raw  ) 
 

Definition at line 160 of file EventDataModel/EventHandle.cxx.

References Bucket(), and kRawID.

00160 { return this->Bucket(kRawID);    }

const DataBucket & EventHandle::Raw  )  const
 

Definition at line 176 of file EventDataModel/EventHandle.cxx.

References Bucket(), and kRawID.

Referenced by evd::PlaneView::DrawRawDigit(), main(), calhit::CalHit::Raw(), photrans::SimpleTransport::Reco(), and rsim::ReadoutSim::Reco().

00176                                          { 
00177   return this->Bucket(kRawID);
00178 }

DataBucket & EventHandle::RawAux  ) 
 

Definition at line 161 of file EventDataModel/EventHandle.cxx.

References Bucket(), and kRawAuxID.

00161 { return this->Bucket(kRawAuxID); }

const DataBucket & EventHandle::RawAux  )  const
 

Definition at line 179 of file EventDataModel/EventHandle.cxx.

References Bucket(), and kRawAuxID.

Referenced by main().

00179                                             { 
00180   return this->Bucket(kRawAuxID);
00181 }

DataBucket & EventHandle::Reco  ) 
 

Definition at line 163 of file EventDataModel/EventHandle.cxx.

References Bucket(), and kRecoID.

00163 { return this->Bucket(kRecoID);   }

const DataBucket & EventHandle::Reco  )  const
 

Definition at line 185 of file EventDataModel/EventHandle.cxx.

References Bucket(), and kRecoID.

Referenced by subshower::RecoSubShower3D::Ana(), subshower::RecoSubShower2D::Ana(), demo::Module::Ana(), evd::PlaneView::DrawFilament(), evd::PlaneView::DrawPlaneClusters(), evd::PlaneView::DrawTracks(), spider::SpiderWeb::IterPut(), main(), calhit::CalHit::Read(), rpr::TrackReco::Reco(), spider::SpiderWeb::Reco(), subshower::RecoSubShower3D::Reco(), subshower::RecoSubShower2D::Reco(), demo::Module::Reco(), rpr::FindTrackSeg::Reco(), cluster::Clusterer::Reco(), and calhit::CalHit::SaveData().

00185                                           { 
00186   return this->Bucket(kRecoID);
00187 }

void EventHandle::SetLoaded int  branchId  )  const
 

Mark a particular branch as loaded

Parameters:
branchId : The ID of the branch to mark.
See also:
BranchID_t

Definition at line 90 of file EventDataModel/EventHandle.cxx.

References fIsLoaded, and kNBranch.

Referenced by io::EventHandle::Load().

00091 {
00092   assert(branchId>=0 && branchId<=kNBranch);
00093   // Use kNBranch to mark that all branches are loaded
00094   if (branchId==kNBranch) {
00095     for (int i=0; i<kNBranch; ++i) fIsLoaded[i] = true;
00096     return;
00097   }
00098   // Use others to mark branches one-by-one
00099   fIsLoaded[branchId] = true;
00100 }

DataBucket & EventHandle::Summary  ) 
 

Definition at line 165 of file EventDataModel/EventHandle.cxx.

References Bucket(), and kSummaryID.

00165 { return this->Bucket(kSummaryID);}

const DataBucket & EventHandle::Summary  )  const
 

Definition at line 191 of file EventDataModel/EventHandle.cxx.

References Bucket(), and kSummaryID.

Referenced by main().

00191                                              { 
00192   return this->Bucket(kSummaryID);
00193 }

DataBucket & EventHandle::User  ) 
 

Definition at line 164 of file EventDataModel/EventHandle.cxx.

References Bucket(), and kUserID.

00164 { return this->Bucket(kUserID);   }

const DataBucket & EventHandle::User  )  const
 

Definition at line 188 of file EventDataModel/EventHandle.cxx.

References Bucket(), and kUserID.

Referenced by main().

00188                                           { 
00189   return this->Bucket(kUserID);
00190 }


Member Data Documentation

DataBucket edm::EventHandle::fCal [mutable, protected]
 

Definition at line 77 of file EventDataModel/EventHandle.h.

Referenced by Bucket(), and ~EventHandle().

DataBucket edm::EventHandle::fDAQ [mutable, protected]
 

Definition at line 74 of file EventDataModel/EventHandle.h.

Referenced by Bucket(), and ~EventHandle().

DataBucket edm::EventHandle::fDetSim [mutable, protected]
 

Definition at line 73 of file EventDataModel/EventHandle.h.

Referenced by Bucket(), and ~EventHandle().

Event* edm::EventHandle::fEvent [protected]
 

Definition at line 71 of file EventDataModel/EventHandle.h.

Referenced by Clear(), Header(), and ~EventHandle().

bool edm::EventHandle::fIsLoaded[kNBranch] [mutable, protected]
 

Which parts of the event are loaded?

Definition at line 69 of file EventDataModel/EventHandle.h.

Referenced by ClearLoadFlags(), EventHandle(), IsLoaded(), and SetLoaded().

DataBucket edm::EventHandle::fMC [mutable, protected]
 

Definition at line 72 of file EventDataModel/EventHandle.h.

Referenced by Bucket(), and ~EventHandle().

int edm::EventHandle::fObjectCnt [protected]
 

Definition at line 68 of file EventDataModel/EventHandle.h.

Referenced by ClearLoadFlags().

DataBucket edm::EventHandle::fRaw [mutable, protected]
 

Definition at line 75 of file EventDataModel/EventHandle.h.

Referenced by Bucket(), and ~EventHandle().

DataBucket edm::EventHandle::fRawAux [mutable, protected]
 

Definition at line 76 of file EventDataModel/EventHandle.h.

Referenced by Bucket(), and ~EventHandle().

DataBucket edm::EventHandle::fReco [mutable, protected]
 

Definition at line 78 of file EventDataModel/EventHandle.h.

Referenced by Bucket(), and ~EventHandle().

DataBucket edm::EventHandle::fSummary [mutable, protected]
 

Definition at line 80 of file EventDataModel/EventHandle.h.

Referenced by Bucket(), and ~EventHandle().

DataBucket edm::EventHandle::fUser [mutable, protected]
 

Definition at line 79 of file EventDataModel/EventHandle.h.

Referenced by Bucket(), and ~EventHandle().


The documentation for this class was generated from the following files:
Generated on Thu Jul 24 12:01:16 2008 for NOvA Offline by doxygen 1.3.5