//###################################################
//#
//#       
//#                      FRAMEWORK
//#
//#       Authors:                           W.Koenig
//#       adoption to framework & ROOT       W.Schoen
//#    
//#       last mod. W.Schoen 19.1.98
// ###################################################

#pragma implementation
#include "hshowerraw.h"
ClassImp(HShowerRaw)
ClassImp(HShowerRawMatr)

//_HADES_CLASS_DESCRIPTION 
///////////////////////////////////////////////////////////////////////
//
//HShowerRaw contains unpacked raw data of the pre-SHOWER
//HShowerRawMatr is the same as HShowerRaw; It is used
//to store data after digitalisation.
//HShowerRawMatr could contain additional data for simulations
//
//////////////////////////////////////////////////////////////////////

Int_t HShowerRaw::clear()
{
   m_fCharge = 0.0F;

   m_nSector = -1;
   m_nModule = -1;
   m_nRow = -1;
   m_nCol = -1;
   m_nErrorCode = 0;
//   m_nAddress = -1;
 
   return 1;
}

Float_t HShowerRaw::addCharge(Float_t q) {
//add charge q to cumulated charge
//it's used in during digitalistion of charge of the pad
  m_fCharge += q;
//  if (m_fCharge > 255.0)	// MJ Mon Jul 30 16:37:35 CEST 2001
//      m_fCharge = 255.0;

  return m_fCharge;
}

Int_t HShowerRaw::calcAddress() {
//calculation of address
  Int_t nAddress;
  Char_t s = (m_nSector) ? m_nSector : 6;
  nAddress = 100000 * s;
  nAddress += 10000 * m_nModule;
  nAddress += 100 * m_nRow;
  nAddress += m_nCol;

  return nAddress;
}


Int_t HShowerRaw::getNLocationIndex(void) {
  return 4;
}

Int_t HShowerRaw::getLocationIndex(Int_t i) {
  switch (i) {
  case 0 : return getSector(); break;
  case 1 : return getModule(); break;
  case 2 : return getRow(); break;
  case 3 : return getCol(); break;
  }
  return -1;
}

void HShowerRaw::getLocation(HLocation& loc) {
  loc.setNIndex(getNLocationIndex());
  for(Int_t i = 0; i < getNLocationIndex(); i++)
    loc.setIndex(i, getLocationIndex(i));  
}

//______________________________________________________________________________

void HShowerRaw::Streamer(TBuffer &R__b)
{
   if (R__b.IsReading()) {
      Version_t R__v = R__b.ReadVersion();
      HLocatedDataObject::Streamer(R__b);
      R__b >> m_nEventType;
	  if(R__v >2){
		R__b >>m_nErrorCode;
	  }
      R__b >> m_nSector;
      R__b >> m_nModule;
      R__b >> m_nRow;
      R__b >> m_nCol;
      R__b >> m_fCharge;
      if (R__v == 1) 
      {
      Int_t m_lEventNr;
         R__b >> m_lEventNr;
      }
   } else {
      R__b.WriteVersion(HShowerRaw::IsA());
      HLocatedDataObject::Streamer(R__b);
      R__b << m_nEventType;
      R__b << m_nErrorCode;
      R__b << m_nSector;
      R__b << m_nModule;
      R__b << m_nRow;
      R__b << m_nCol;
      R__b << m_fCharge;
   }
}


Last change: Sat May 22 13:14:05 2010
Last generated: 2010-05-22 13:14

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.