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

MuonSIO Class Reference

#include <MuonSIO.h>

Inheritance diagram for MuonSIO:

Inheritance graph
[legend]
Collaboration diagram for MuonSIO:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MuonSIO (const char *i_name)
 MuonSIO (const char *i_name, std::vector< MuonHit > muonHits)
void clear ()
void addHit (MuonHit hit)
unsigned int version ()
unsigned int xfer (SIO_stream *, SIO_operation, unsigned int)

Private Attributes

std::vector< MuonHit_muonHits

Constructor & Destructor Documentation

MuonSIO::MuonSIO const char *  i_name  ) 
 

Definition at line 25 of file MuonSIO.cc.

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

00025                                      : SIO_block(i_name)
00026 {
00027   // SIO init --  join the event record.
00028   SIO_record* record;
00029   record = SIO_recordManager::get( "LCD_LCDG4_Event" );
00030   if (record != NULL)
00031     record->connect(this);
00032 }

MuonSIO::MuonSIO const char *  i_name,
std::vector< MuonHit muonHits
 

Definition at line 34 of file MuonSIO.cc.

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

00034                                                               : SIO_block(i_name), _muonHits(muonHits)
00035 {
00036   // SIO init -- join the event record
00037   SIO_record* record;
00038   record = SIO_recordManager::get("LCD_LCDG4_Event");
00039   if(record != NULL)
00040     record->connect(this);
00041 }


Member Function Documentation

void MuonSIO::addHit MuonHit  hit  ) 
 

Definition at line 50 of file MuonSIO.cc.

References _muonHits.

00051 {
00052   _muonHits.push_back(hit);
00053 }

void MuonSIO::clear  ) 
 

Definition at line 44 of file MuonSIO.cc.

References _muonHits.

00046 {
00047   _muonHits.erase(_muonHits.begin(),_muonHits.end());
00048 }

unsigned int MuonSIO::version  )  [virtual]
 

Implements SIO_block.

Definition at line 173 of file MuonSIO.cc.

References SIO_MUON_MAJOR, SIO_MUON_MINOR, and SIO_VERSION_ENCODE.

00174 { return( SIO_VERSION_ENCODE( SIO_MUON_MAJOR,
00175                               SIO_MUON_MINOR ) ); }

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

Implements SIO_block.

Definition at line 59 of file MuonSIO.cc.

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

00064 {
00065   if(op||version) ; // make compiler happy
00066   unsigned int status;
00067 
00068   // write out the number of calorimeter hits...
00069   int nHits = _muonHits.size();
00070   status = SIO_DATA( stream, &nHits, 1 );
00071 
00072   // loop over calorimeter hits and write them out...
00073 
00074   std::vector<MuonHit>::const_iterator it;
00075   for(it=_muonHits.begin(); it!=_muonHits.end(); ++it)
00076     {
00077       MuonHit hit = *it;
00078       // cell ID
00079       unsigned int id = hit.id();
00080       SIO_DATA(stream, &id,     1);
00081       // energy
00082       float energy = hit.energy() / GeV;
00083       SIO_DATA(stream, &energy, 1);
00084 
00085       // now loop over the individual contributions to this cell...
00086       MuonHit::McEnergyMap mcmap = hit.getMcEnergyMap();
00087       MuonHit::McEnergyMap::const_iterator mapit;
00088       int mapsize = mcmap.size();
00089       SIO_DATA(stream, &mapsize, 1)
00090         for(mapit = mcmap.begin(); mapit!=mcmap.end(); ++mapit)
00091           {
00092             //MCParticle*
00093             SIO_PNTR(stream, &((*mapit).first)                         );
00094             // energy
00095             float energy = mapit->second / GeV;
00096             SIO_DATA(stream, &energy, 1);
00097           }
00098     }
00099 
00100   // now for the strip hits
00101   // number of hits...
00102   SIO_DATA( stream, &nHits, 1 );
00103 
00104   //std::vector<MuonHit>::const_iterator it;
00105   for(it=_muonHits.begin(); it!=_muonHits.end(); ++it)
00106     {
00107       MuonHit hit = *it;
00108       // cell ID
00109       unsigned int id = hit.id();
00110       SIO_DATA(stream, &id,     1);
00111 
00112       // now loop over the individual contributions to this cell...
00113       MuonHit::McEnergyMap mcmap = hit.getMcEnergyMap();
00114       MuonHit::McEnergyMap::const_iterator mapit;
00115       int mapsize = mcmap.size();
00116       // number of strip hits...
00117       SIO_DATA(stream, &mapsize, 1)
00118         for(mapit = mcmap.begin(); mapit!=mcmap.end(); ++mapit)
00119           {
00120             //MCParticle*
00121             SIO_PNTR(stream, &((*mapit).first)                         );
00122           }
00123     }
00124 
00125 
00126   //
00127   // Strips.
00128   //
00129   /*
00130   // int mcCounter = m_strips.size();
00131   int mcCounter = 1;
00132   typedef std::vector<MUStripId> StripMap;
00133   StripMap m_strips;
00134 
00135   SIO_DATA( stream, &mcCounter, 1 );
00136 
00137   typedef std::vector<const MCParticleSIO*> MCStrips;
00138   for (StripMap::const_iterator sit  = m_strips.begin();
00139   sit != m_strips.end();
00140   sit++ )
00141   {
00142   mcCounter = sit->tag();
00143   SIO_DATA( stream, &mcCounter, 1 );
00144 
00145   mcCounter = const_cast<MUStripId*>(sit)->mc()->size();
00146   SIO_DATA( stream, &mcCounter, 1 );
00147 
00148   MCStrips::const_iterator
00149   sitmc;
00150 
00151   for  (sitmc  = const_cast<MUStripId*>(sit)->mc()->begin();
00152   sitmc != const_cast<MUStripId*>(sit)->mc()->end();
00153   sitmc++)
00154   {
00155   SIO_PNTR( stream, sitmc );
00156   }
00157   }
00158   */
00159 
00160   //
00161   // That's all folks!
00162   //
00163   return( SIO_BLOCK_SUCCESS );
00164 }


Member Data Documentation

std::vector<MuonHit> MuonSIO::_muonHits [private]
 

Definition at line 30 of file MuonSIO.h.

Referenced by addHit(), and clear().


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