Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | 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 io::EmptyEventHandle 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.

Referenced by Load().

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 22 of file EventDataModel/EventHandle.cxx.

References fIsLoaded.

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

EventHandle::~EventHandle  )  [virtual]
 

Clear all data arrays and delete the event

Reimplemented in io::EventHandle.

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

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

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


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 135 of file EventDataModel/EventHandle.cxx.

References IsLoaded(), kCalID, kDAQID, kDetSimID, kMCID, kRawAuxID, kRawID, kRecoID, kSummaryID, kUserID, and Load().

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

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

DataBucket & EventHandle::Cal  ) 
 

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

References Bucket(), and kCalID.

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

const DataBucket & EventHandle::Cal  )  const
 

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

References Bucket(), and kCalID.

Referenced by clusterss::CompareClusters::Ana(), clusterss::ClusterCheck::Ana(), cellhitmerge::CellHitMerge::Ana(), subshower::RecoSubShower::FormStripList(), evd::RecoBaseDrawer::GetCellHits(), main(), spider::SpiderWeb::Reco(), clusterss::MakeClusterSS::Reco(), trk::DemoShell::Reco(), cluster::Clusterer::Reco(), clust::Clust2D::Reco(), trk::CirceFit::Reco(), cellhitmerge::CellHitMerge::Reco(), calhit::CalHit::Reco(), and calhit::CalHit::RoughReco().

00184                                          { 
00185   return this->Bucket(kCalID);
00186 }

void EventHandle::Clear  ) 
 

Mark all branches as unloaded and clear up the event

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

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

Referenced by io::ReadWriteModule::AddFile(), main(), evgen::SingleGen::Reco(), evgen::GENIEGen::Reco(), and evgen::CosmicsGen::Reco().

00061 {
00062   this->ClearLoadFlags();
00063   fEvent->Clear();
00064 }

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 73 of file EventDataModel/EventHandle.cxx.

References fIsLoaded, and fObjectCnt.

Referenced by Clear(), and io::ReadWriteModule::Reload().

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

DataBucket & EventHandle::DAQ  ) 
 

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

References Bucket(), and kDAQID.

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

const DataBucket & EventHandle::DAQ  )  const
 

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

References Bucket(), and kDAQID.

Referenced by clusterss::CompareClusters::Ana(), clusterss::ClusterCheck::Ana(), util::EDMUtils::Detector(), util::EDMUtils::GetGeometry(), main(), evgen::SingleGen::Reco(), clusterss::MakeClusterSS::Reco(), hdr::JobRecord::Reco(), evgen::GENIEGen::Reco(), evgen::CosmicsGen::Reco(), and cellhitmerge::CellHitMerge::Reco().

00175                                          { 
00176   return this->Bucket(kDAQID);
00177 }

DataBucket & EventHandle::DetSim  ) 
 

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

References Bucket(), and kDetSimID.

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

const DataBucket & EventHandle::DetSim  )  const
 

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

References Bucket(), and kDetSimID.

Referenced by mcchk::CosmicAna::Ana(), clusterss::ClusterCheck::Ana(), doFLSHits(), doStdHep(), evd::Display3D::DrawMCHits(), evd::DetectorView::DrawMCTruth(), sim::TruthFilter::GetFilteredHits(), vali::Validator::GetFLSHInfo(), evd::SimulationDrawer::GetFLSHits(), main(), sim::TruthFilter::Reco(), photrans::SimpleTransport::Reco(), and rsim::SimpleReadout::Reco().

00172                                             { 
00173   return this->Bucket(kDetSimID);
00174 }

EventHeader & EventHandle::Header  ) 
 

Return the event header, load if necesary.

Returns:
The event header in non-const form.

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

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

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

const EventHeader & EventHandle::Header  )  const
 

Return the event header, load if necesary

Returns:
The event header in const form.

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

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

Referenced by jobc::ResourceSummary::Ana(), mcchk::CosmicAna::Ana(), clusterss::CompareClusters::Ana(), clusterss::ClusterCheck::Ana(), jobc::Job::CheckStatus(), doHeader(), jobc::Sequence::Exec(), subshower::RecoSubShower::FitEM(), subshower::RecoSubShower::FormStripList(), util::EDMUtils::GetCalibrator(), util::EDMUtils::GetCMap(), GetEventNumbers(), util::EDMUtils::GetGeometry(), gsGetEventNumbers(), main(), evdb::PrintDialog::PrintDialog(), clusterss::MakeClusterSS::Reco(), and io::ReadWriteModule::UpdateEventNumbers().

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

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 203 of file EventDataModel/EventHandle.cxx.

References fIsLoaded.

Referenced by Bucket(), Header(), and Load().

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

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

Loads one branch if branchID < EDMEventHandle::kNBranch, or loads entire event if branchID == kNBranch

Implemented in io::EventHandle.

Definition at line 214 of file IoModules/EventHandle.cxx.

References BranchID_t, IsLoaded(), kNBranch, io::EventHandle::Load(), and SetLoaded().

Referenced by Bucket(), and Header().

00215 {
00216   // Do not load anything if a ROOT input file is not specified
00217   if (!fInputFile) return 0;
00218   assert ((branchID >= 0) && (branchID <= kNBranch));
00219 
00220   // If branchID is maxed out, load all the branches. Load one-by-one
00221   // to avoid over-writing branched already loaded.
00222   if (branchID == kNBranch) {
00223     for (int i=0; i<kNBranch; ++i) this->Load(i);
00224     return 1;
00225   }
00226   
00227   // Check if branch is already loaded
00228   if (this->IsLoaded((BranchID_t) branchID)) return 0;
00229   
00230   // Make sure that this branch exists before actually loading it
00231   if (fBranch[branchID]) {
00232     fBranch[branchID]->GetEntry(fIndex);
00233     this->SetLoaded(branchID);
00234     return 1;
00235   }
00236   else {
00237     // Do this in case event was written with split level 0, when
00238     // event is written to one branch
00239     std::cout << "IoEventHandle::Load() Warning: Branch " << branchID
00240               << " is missing. Loading entire event" << std::endl;
00241     fEventTree->GetEntry(fIndex);
00242     this->SetLoaded(kNBranch);
00243   }
00244 
00245   return 0;
00246 }

DataBucket & EventHandle::MC  ) 
 

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

References Bucket(), and kMCID.

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

const DataBucket & EventHandle::MC  )  const
 

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

References Bucket(), and kMCID.

Referenced by mcchk::NeutrinoAna::Ana(), fillntup::FillNtup::Ana(), clusterss::CompareClusters::Ana(), clusterss::ClusterCheck::Ana(), trk::CirceFit::Ana(), doNeuKin(), evd::DetectorView::DrawMCTruth(), evd::SimulationDrawer::GetMCTruth(), main(), sim::TruthFilter::Reco(), evgen::SingleGen::Reco(), novamc::NOVAMC::Reco(), evgen::GENIEGen::Reco(), and evgen::CosmicsGen::Reco().

00169                                         {
00170   return this->Bucket(kMCID); 
00171 }

DataBucket & EventHandle::Raw  ) 
 

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

References Bucket(), and kRawID.

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

const DataBucket & EventHandle::Raw  )  const
 

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

References Bucket(), and kRawID.

Referenced by mcchk::DetAna::Ana(), mcchk::CosmicAna::Ana(), evd::Display3D::DrawRawData(), vali::Validator::GetPTInfo(), evd::RawDataDrawer::GetRawDigits(), vali::Validator::GetRawInfo(), main(), rsim::SimpleReadout::Reco(), and calhit::CalHit::Reco().

00178                                          { 
00179   return this->Bucket(kRawID);
00180 }

DataBucket & EventHandle::RawAux  ) 
 

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

References Bucket(), and kRawAuxID.

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

const DataBucket & EventHandle::RawAux  )  const
 

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

References Bucket(), and kRawAuxID.

Referenced by main().

00181                                             { 
00182   return this->Bucket(kRawAuxID);
00183 }

DataBucket & EventHandle::Reco  ) 
 

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

References Bucket(), and kRecoID.

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

const DataBucket & EventHandle::Reco  )  const
 

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

References Bucket(), and kRecoID.

Referenced by subshower::RecoSubShower3D::Ana(), subshower::RecoSubShower2D::Ana(), demo::Module::Ana(), clusterss::MakeClusterSS::Ana(), fillntup::FillNtup::Ana(), clusterss::CompareClusters::Ana(), clusterss::ClusterCheck::Ana(), trk::CirceFit::Ana(), evd::Display3D::DrawProngs(), fillntup::FillNtup::FillEventInfo(), evd::RecoBaseDrawer::GetClusters(), vali::Validator::GetRecoInfo(), spider::SpiderWeb::IterPut(), main(), rpr::TrackReco::Reco(), subshower::RecoSubShower3D::Reco(), subshower::RecoSubShower2D::Reco(), demo::Module::Reco(), clusterss::MakeClusterSS::Reco(), rpr::FindTrackSeg::Reco(), trk::DemoShell::Reco(), ctrk::CosmicTrack::Reco(), cluster::Clusterer::Reco(), clust::Clust2D::Reco(), trk::CirceFit::Reco(), calhit::CalHit::RoughReco(), and subshower::RecoSubShower::WriteOutClusters().

00187                                           { 
00188   return this->Bucket(kRecoID);
00189 }

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 92 of file EventDataModel/EventHandle.cxx.

References fIsLoaded, and kNBranch.

Referenced by Load().

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

DataBucket & EventHandle::Summary  ) 
 

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

References Bucket(), and kSummaryID.

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

const DataBucket & EventHandle::Summary  )  const
 

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

References Bucket(), and kSummaryID.

Referenced by main().

00193                                              { 
00194   return this->Bucket(kSummaryID);
00195 }

DataBucket & EventHandle::User  ) 
 

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

References Bucket(), and kUserID.

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

const DataBucket & EventHandle::User  )  const
 

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

References Bucket(), and kUserID.

Referenced by main().

00190                                           { 
00191   return this->Bucket(kUserID);
00192 }


Member Data Documentation

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

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

Referenced by ~EventHandle().

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

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

Referenced by ~EventHandle().

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

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

Referenced by ~EventHandle().

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

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

Referenced by Clear(), and Header().

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 ~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 ~EventHandle().

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

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

Referenced by ~EventHandle().

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

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

Referenced by ~EventHandle().

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

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

Referenced by ~EventHandle().

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

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

Referenced by ~EventHandle().


The documentation for this class was generated from the following files:
Generated on Sat Nov 21 04:45:36 2009 for NOvA Offline by  doxygen 1.3.9.1