BRAT 2.4.5
Class index
Full class index
brahmlib
BRAHMS
ROOT page
//________________________________________________________________
//
// BrEvent is a BRAHMS data class providing storage and 
// access function for event data information. The data
// is stored in BrDataObject objects that are kept inside
// a THashList.
// This allows modification of the BrEvent content by the 
// user, with the BrDataObject providing a standard interface
// for information retrieval, bookkeeping and I/O selection.
//
//________________________________________________________________

//
// $Id: BrEvent.cxx,v 1.6 2001/08/21 16:39:39 cholm Exp $
// $Author: cholm $
// $Date: 2001/08/21 16:39:39 $
//

#include "BrEvent.h"
#include <iostream.h>
#include <iomanip.h>
//
// Root classes
//
#include "TBuffer.h"

//________________________________________________________________
ClassImp(BrEvent);

//________________________________________________________________
 BrEvent::BrEvent()
{
  // Constructor. Set counter and list data members to zero.
  // Don't use this constructor unless you have to and know
  // what you are doing
  // Use BrEvent(Int_t run, Int_t event) instead

  fEventHeader = 0;
}

//________________________________________________________________
 BrEvent::BrEvent(Char_t* Name, Int_t run, Int_t event) 
  : BrEventNode(Name)
{
  // Constructor. Create the event header and the hash table
  // for storing the data objects for this event. Set the 
  // event name.

   //fEventHeader = new BrEventHeader(run, event);
   fEventHeader = 0; //Will Create on demand
   Char_t txt[512];
   sprintf(txt,"event_%d_%d",run,event);

   SetName(txt);
   sprintf(txt," run %d, event %d",run,event);
   SetTitle(txt);

   // Two following non persistent variables set for when event header
   // created 
   fRunNumber = run;
   fEventNumber = event;
}

//________________________________________________________________
 BrEvent::~BrEvent()
{
  // Destructor. Delete BrEvent and all the data objects
  // currently owned by BrEvent

  if(fEventHeader)
    delete fEventHeader;
}

//________________________________________________________________
 void BrEvent::Browse(TBrowser* b)  
{ 
  if (fEventHeader) 
    b->Add(fEventHeader,fEventHeader->GetName());
  BrEventNode::Browse(b);
}

//________________________________________________________________
 void BrEvent::CheckHeader() const 
{
  // Check if header exists.  If not, create it. 
  if (!fEventHeader) {
    fEventHeader = new BrEventHeader(fRunNumber, fEventNumber);
  }
}

//________________________________________________________________
 void BrEvent::Print(Option_t* option) const 
{ 
  // Print event information 
  // Options: 
  //    R       Recursive listing of nodes
  // See also BrEventNode::Print and BrDataObject::Print
  cout << "*************************************************" << endl
       << endl
       << "  Run:      " << setw(5) << GetRunNumber() 
       << "  Event:    " << setw(5) << GetEventNumber() << endl
       << "  Date:     " << setw(12) << GetDate() << endl
       << "  Triggers: " << setw(12) << GetTriggerMask() << endl
       << "  Time:     " << setw(12) << GetTime() << endl
       << endl
       << "*************************************************" << endl;
  
  TString opt(option);
  opt.ToLower();
  if (opt.Contains("r"))
    BrEventNode::Print(option);
}

//________________________________________________________________
 void BrEvent::Copy(BrEvent &event) 
{
  BrEventNode::Copy(event);
  if(fEventHeader) {
    BrEventHeader *eventheader = event.GetEventHeader();
    if(eventheader) *eventheader = *fEventHeader;
  }
}

//
//	$Log: BrEvent.cxx,v $
//	Revision 1.6  2001/08/21 16:39:39  cholm
//	small changes
//	
//	Revision 1.5  2001/08/21 16:10:03  cholm
//	Introduced the method CheckHeader for the dynamic allocation of
//	BrEventHeader.
//	
//	Revision 1.4  2001/08/08 21:52:08  hagel
//	Eliminate memory leak by creating on demand fObjectList and fEventHeader
//	
//	Revision 1.3  2001/06/25 14:23:57  cholm
//	packages/
//	
//	Revision 1.2  2001/06/25 07:38:17  cholm
//	Removed Eun-Joo's previous erroneous change
//	
//	Revision 1.1.1.1  2001/06/21 14:54:58  hagel
//	Initial revision of brat2
//	
//	Revision 1.10  2001/06/01 15:46:49  cholm
//	Fixed creation id class to be more clean.  Now sets the user name
//	(if avaliable) has a Print method.
//	PRint method in BrDataObject.
//	Print method in BrDataTable
//	Print method in BrEvent
//	Print method in BrEventNode
//	
//	Revision 1.9  2000/10/03 19:29:57  cholm
//	Made IsFolder() const (since it is in TObject) which was needed for the
//	objects to be browsable. Aslo, as of ROOT version 2.25.02 there's a list
//	of special objects, which BrEventIO now is added to. Some doc to
//	BrEventNode::Clear() added! Added method BrEventNode::SetOwner().
//							Christian Holm
//	
//	Revision 1.8  2000/04/13 00:02:28  cholm
//	Added methods for browsing BrEvents, either directly or via
//	a BrEventIO. Also added method GetROOTFile to BrEventIO.
//	
//	Revision 1.7  1999/07/27 22:41:07  hagel
//	Added ylog capability to BrMonitorPicture
//	
//	Revision 1.6  1998/08/27 21:25:10  hagel
//	Change Copy to copy from this to object
//
//	Revision 1.5  1998/08/20 14:34:44  hagel
//	Add Copy method
//
//	Revision 1.4  1998/08/14 21:26:24  videbaek
//	Some cleanup mods
//
//	Revision 1.3  1998/03/09 20:53:50  videbaek
//	Ensure that pointers are non-NULL before deleting
//
//	Revision 1.2  1998/03/06 22:09:58  videbaek
//	Working update
//
//	Revision 1.1.1.1  1998/03/04 21:32:48  brahmlib
//	Brat base
//
//

/*
//______________________________________________________________________________
  void BrEvent::Streamer(TBuffer &R__b)
{
   // Stream an object of class BrEvent.


   if (R__b.IsReading()) {
      Version_t R__v = R__b.ReadVersion();
      BrDataObject::Streamer(R__b);
      R__b >> fVerbose;
      R__b >> fEventHeader;
      R__b >> fObjectList;
   } else {
      R__b.WriteVersion(BrEvent::IsA());
      BrDataObject::Streamer(R__b);
      R__b << fVerbose;
      R__b << fEventHeader;

// make a temporary hashtable for the objects marked 
// as persistent and store only those in the output 
// buffer

      THashTable *temp = new THashTable();  
      TIter NextObject(fObjectList);
      TObject *obj;
      while(obj = NextObject())
      {
          temp->Add(obj);
      }
      R__b << temp;
      temp->Clear();
      delete temp;

   }
}

*/

This page automatically generated by script docBrat by Christian Holm

Copyright ; 2002 BRAHMS Collaboration <brahmlib@rcf.rhic.bnl.gov>
Last Update on by

Validate HTML
Validate CSS