// ----------------------------------------------------------------------------
// $Id: LCDEvent.cxx,v 1.4 2001/06/22 19:42:36 toshi Exp $
// ----------------------------------------------------------------------------
//
// $Log: LCDEvent.cxx,v $
// Revision 1.4  2001/06/22 19:42:36  toshi
// A bag fix about Clear().
//
// Revision 1.3  2001/06/22 17:34:36  toshi
// Add Clear() function.
//
// Revision 1.2  2001/06/19 03:17:59  toshi
// Changed according to the change of LCDEvent.h.
// Now the following variables in LCDEvent.h are not pointers.
// LCDEventHeader* Event_Header;->  LCDEventHeader  Event_Header;
// LCDBeam*         BEAM_params;->  LCDBeam         BEAM_params;
//
// Revision 1.1  2001/05/10 17:25:01  toshi
// Rename *.C to *.cxx.
//
// Revision 1.3  2001/05/04 23:07:31  masako
// Add LCDEventHeader
//
// Revision 1.2  2001/04/28 23:41:52  toshi
// Start to use CVS.
//
//
///////////////////////////////////////////////////////////////////////////
//                                                                       
// LCDEvent                                                                 
//                                                                       
// The LCDEvent class is the top level class for the ASCII to ROOT          
// conversion. It contains all the information about a single event.     
// It contains TObjArrays (typically one per detector component) of
// information about hit detector elements, as well as functions to 
// access these arrays.        The "real" objects in these arrays are
// as follows:
//
/*
  MCParticles:  LCDMcPart
  MUSTRIP_Hits: LCDStripHit 
  CAL_Digi:   LCDCalHit 
  VXD_Hit_List: LCDVXD_Hit
  Tracker_Hit_List:LCDTracker_Hit
  Tracks_List:  LCDTrack
  Cluster_List:LCDCluster
  */
//

///////////////////////////////////////////////////////////////////////////

#include "LCDEvent.h"

ClassImp(LCDEvent)
//__________________________________________________________________________
 LCDEvent::LCDEvent(){
  // This is the default constructor.
  // Event_Header     = 0;
  // BEAM_params      = 0;
  MUSTRIP_Hits     = 0;
  CAL_Digi         = 0;
  VXD_Hit_List     = 0;
  Tracker_Hit_List = 0;
  Tracks_List      = 0;
  Cluster_List     = 0;
  MCParticles      = 0;

  Create();
}

//_________________________________________________________________________
 LCDEvent::~LCDEvent(){
  // Destructor, calls LCDEvent::Clean() to remove the maps and arrays
  // if (Event_Header) {
  //  delete Event_Header;
  //  Event_Header = 0;
  //}

  //if (BEAM_params) {
  //  delete BEAM_params;
  //  BEAM_params = 0;
  //}

  if (MCParticles) {
    MCParticles->Delete();
    delete MCParticles;
    MCParticles = 0;  
  }

  if (MUSTRIP_Hits) {
    MUSTRIP_Hits->Delete();
    delete MUSTRIP_Hits;
    MUSTRIP_Hits = 0;
  }

  if (CAL_Digi) {
    CAL_Digi->Delete();
    delete CAL_Digi;
    CAL_Digi = 0;
  }

  if (VXD_Hit_List) {
    VXD_Hit_List->Delete();
    delete VXD_Hit_List;
    VXD_Hit_List = 0;
  }

  if(Tracker_Hit_List) {
    Tracker_Hit_List->Delete();
    delete Tracker_Hit_List;
    Tracker_Hit_List = 0;
  }

  if (Tracks_List) {
    Tracks_List->Delete();
    delete Tracks_List;
    Tracks_List = 0;
  }

  if (Cluster_List) {
    Cluster_List->Delete();
    delete Cluster_List;
    Cluster_List = 0;
  }

}
//__________________________________________________________________________
 void LCDEvent::Create(){
  // This is the default constructor.
  // if(!Event_Header)
  //   Event_Header     = new LCDEventHeader();
  // if(!BEAM_params)
  //   BEAM_params      = new LCDBeam();
  if(!MCParticles)      
    MCParticles      = new TClonesArray("LCDMcPart"     ,100);
  if(!MUSTRIP_Hits)
    MUSTRIP_Hits     = new TClonesArray("LCDStripHit"   ,100);
  if(!CAL_Digi)
    CAL_Digi         = new TClonesArray("LCDCalHit"     ,100);
  if(!VXD_Hit_List)     
    VXD_Hit_List     = new TClonesArray("LCDVXD_Hit"    ,100);
  if(!Tracker_Hit_List) 
    Tracker_Hit_List = new TClonesArray("LCDTracker_Hit",100);
  if(!Tracks_List)      
    Tracks_List      = new TClonesArray("LCDTrack"      , 50);
  if(!Cluster_List)     
    Cluster_List     = new TClonesArray("LCDCluster"    ,100);
}

//_________________________________________________________________________
 void LCDEvent::Clean(){
  // This function clears all TClonesArrays contained in the Event object.

  if (MCParticles)      MCParticles->Delete();

  if (MUSTRIP_Hits)     MUSTRIP_Hits->Delete();

  if (CAL_Digi)         CAL_Digi->Delete();

  if (VXD_Hit_List)     VXD_Hit_List->Delete();

  if (Tracker_Hit_List) Tracker_Hit_List->Delete();

  if (Tracks_List)      Tracks_List->Delete();

  if (Cluster_List)     Cluster_List->Delete();

}
//_________________________________________________________________________

//_________________________________________________________________________
 void LCDEvent::Clear(Option_t *option){
  // This function clears all TClonesArrays contained in the Event object.

  if (MCParticles)      MCParticles->Clear(option);

  if (MUSTRIP_Hits)     MUSTRIP_Hits->Clear(option);

  if (CAL_Digi)         CAL_Digi->Clear(option);

  if (VXD_Hit_List)     VXD_Hit_List->Clear(option);

  if (Tracker_Hit_List) Tracker_Hit_List->Clear(option);

  if (Tracks_List)      Tracks_List->Clear(option);

  if (Cluster_List)     Cluster_List->Clear(option);

}


ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.