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

CalorimeterSIO Class Reference

#include <CalorimeterSIO.h>

Inheritance diagram for CalorimeterSIO:

Inheritance graph
[legend]
Collaboration diagram for CalorimeterSIO:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 CalorimeterSIO (const char *i_name, std::vector< CalorimeterHit > calHits)
void clear ()
void addHit (CalorimeterHit hit)
unsigned int version ()
unsigned int xfer (SIO_stream *, SIO_operation, unsigned int)

Private Attributes

std::vector< CalorimeterHit_calHits

Constructor & Destructor Documentation

CalorimeterSIO::CalorimeterSIO const char *  i_name,
std::vector< CalorimeterHit calHits
 

Definition at line 22 of file CalorimeterSIO.cc.

References SIO_record::connect(), and SIO_recordManager::get().

00022                                                                                    : SIO_block(i_name), _calHits(calHits)
00023 {
00024   // SIO init --  join the event record.
00025   SIO_record* record;
00026   record = SIO_recordManager::get( "LCD_LCDG4_Event" );
00027   if (record != NULL)
00028     record->connect(this);
00029 }


Member Function Documentation

void CalorimeterSIO::addHit CalorimeterHit  hit  ) 
 

Definition at line 38 of file CalorimeterSIO.cc.

References _calHits.

00039 {
00040   _calHits.push_back(hit);
00041 }

void CalorimeterSIO::clear  ) 
 

Definition at line 32 of file CalorimeterSIO.cc.

References _calHits.

00034 {
00035   _calHits.erase(_calHits.begin(),_calHits.end());
00036 }

unsigned int CalorimeterSIO::version  )  [virtual]
 

Implements SIO_block.

Definition at line 107 of file CalorimeterSIO.cc.

References SIO_CALORIMETER_MAJOR, SIO_CALORIMETER_MINOR, and SIO_VERSION_ENCODE.

00108 { return( SIO_VERSION_ENCODE( SIO_CALORIMETER_MAJOR,
00109                               SIO_CALORIMETER_MINOR ) ); }

unsigned int CalorimeterSIO::xfer SIO_stream ,
SIO_operation  ,
unsigned  int
[virtual]
 

Implements SIO_block.

Definition at line 47 of file CalorimeterSIO.cc.

References CalorimeterHit::energy(), CalorimeterHit::getMcEnergyMap(), GeV, CalorimeterHit::id(), CalorimeterHit::McEnergyMap, SIO_BLOCK_SUCCESS, SIO_DATA, SIO_operation, and SIO_PNTR.

00052 {
00053   // Make compiler happy about unused vars
00054   if(op || version) ;
00055 
00056   unsigned int status;
00057 
00058   // write out the number of calorimeter hits...
00059   int nHits = _calHits.size();
00060   status = SIO_DATA( stream, &nHits, 1 );
00061 
00062   // loop over calorimeter hits and write them out...
00063 
00064   std::vector<CalorimeterHit>::const_iterator it;
00065   for(it=_calHits.begin(); it!=_calHits.end(); ++it)
00066     {
00067       CalorimeterHit hit = *it;
00068       // cell ID
00069       unsigned int id = hit.id();
00070       SIO_DATA(stream, &id,     1);
00071       // energy
00072       float energy = hit.energy()/GeV;
00073       SIO_DATA(stream, &energy, 1);
00074 
00075       // For debugging
00076       //printf("CalorimeterSIO::hit.energy()=%f\n",hit.energy());
00077 
00078       // now loop over the individual contributions to this cell...
00079       CalorimeterHit::McEnergyMap mcmap = hit.getMcEnergyMap();
00080       CalorimeterHit::McEnergyMap::const_iterator mapit;
00081       int mapsize = mcmap.size();
00082       SIO_DATA(stream, &mapsize, 1)
00083         for(mapit = mcmap.begin(); mapit!=mcmap.end(); ++mapit)
00084           {
00085             //MCParticle*
00086             SIO_PNTR(stream, &((*mapit).first)                         );
00087             // energy
00088             float energy = mapit->second / GeV;
00089             SIO_DATA(stream, &energy, 1);
00090 //          SIO_DATA(stream, const_cast<float *>(&((*mapit).second)), 1);
00091           }
00092     }
00093 
00094   //
00095   // That's all folks!
00096   //
00097   return( SIO_BLOCK_SUCCESS );
00098 }


Member Data Documentation

std::vector<CalorimeterHit> CalorimeterSIO::_calHits [private]
 

Definition at line 31 of file CalorimeterSIO.h.

Referenced by addHit(), and clear().


The documentation for this class was generated from the following files:
Generated on Thu Oct 7 18:45:03 2004 for LCDG4 by doxygen 1.3.4