// ESAF : Euso Simulation and Analysis Framework
// $Id: EShower.cc,v 1.6 2004/08/25 15:23:36 thea Exp $
// created May, 23 2004
#include "EShower.hh"
#include "Etypes.hh"
ClassImp(EShower)
EShower* EShower::fgCurrent = NULL;
TClonesArray* EShower::fgSteps = NULL;
//_____________________________________________________________________________
EShower::EShower() {
// ctor
if ( fgSteps == 0 )
fgSteps = new TClonesArray("EShowerStep",1000);
fSteps = fgSteps;
fCopy = kFALSE;
fNumSteps = 0;
fEnergy = -kHuge;
fTheta = -kHuge;
fPhi = -kHuge;
fX1 = -kHuge;
fElectrEthres = -kHuge;
fDirX = -kHuge;
fDirY = -kHuge;
fDirZ = -kHuge;
fInitPosX = -kHuge;
fInitPosY = -kHuge;
fInitPosZ = -kHuge;
fHitGround = kFALSE;
}
//_____________________________________________________________________________
EShower::EShower( const EShower& other ) : TObject() {
// copy ctor
other.Copy( *this);
}
//_____________________________________________________________________________
EShower::~EShower() {
// dtor
fSteps->Delete();
if ( IsCopy() )
ClearCopy();
if ( GetCurrent() == this ) SetCurrent( 0 );
}
//_____________________________________________________________________________
void EShower::Copy( TObject& other ) const {
// copy
EShower &o = (EShower&)other;
o.fCopy = kTRUE;
o.fEnergy = fEnergy;
o.fTheta = fTheta;
o.fPhi = fPhi;
o.fX1 = fX1;
o.fElectrEthres = fElectrEthres;
o.fDirX = fDirX;
o.fDirY = fDirY;
o.fDirZ = fDirZ;
o.fInitPosX = fInitPosX;
o.fInitPosY = fInitPosY;
o.fInitPosZ = fInitPosZ;
o.fHitGround = fHitGround;
o.fNumSteps = fNumSteps;
o.fSteps = (TClonesArray*)fSteps->Clone();
}
//_____________________________________________________________________________
void EShower::Clear( Option_t* ) {
// clear this
if( fSteps )
fSteps->Clear("C");
fNumSteps = 0;
fElectrEthres = -kHuge;
fDirX = -kHuge;
fDirY = -kHuge;
fDirZ = -kHuge;
fInitPosX = -kHuge;
fInitPosY = -kHuge;
fInitPosZ = -kHuge;
fHitGround = kFALSE;
}
//______________________________________________________________________________
void EShower::ClearCopy() {
// delete TClonesArray in case of copied events
delete fSteps; fSteps = 0;
}