// ESAF : Euso Simulation and Analysis Framework
// $Id: ParentBunch.cc,v 1.18 2005/05/02 17:21:52 moreggia Exp $
// Author: Anne Stutz Aug, 23 2004
#include "ParentBunch.hh"
#include "BunchOfPhotons.hh"
#include <stdexcept>
ClassImp(ParentBunch)
//_____________________________________________________________________________
ParentBunch::ParentBunch(const ParentBunch& pb):
fLateralDist(0), fAngularDist(0), fHistoLateral(0), fHistoAngular(0) {
//
// Copy Constructor
//
pb.Copy(*this);
}
//_____________________________________________________________________________
ParentBunch::ParentBunch(const Double_t weight,const Double_t yield,
const EarthVector& showerposi,const EarthVector& showerposf,
const Double_t datei,const Double_t datef, const EsafSpectrum& spectrum,
const EarthVector& axis) :
fLateralDist(0), fAngularDist(0), fHistoLateral(0), fHistoAngular(0) {
//
// Constructor useful when there is no longitudinal extension
//
fWeight = weight; // bunch weight
fYield = yield; // bunch yield
fShowerPosi = showerposi; // 3D coordinates of the first point of the bunch
fShowerPosf = showerposf; // 3D coordinates of the last point of the bunch
fAxis = axis;
fDatei = datei; // time of passage at fShowerPosi
fDatef = datef; // time of passage at fShowerPosf
spectrum.Copy(fWlSpectrum);
}
//______________________________________________________________________________
void ParentBunch::Copy(ParentBunch& o) const {
//
// Copy this to
//
o.fWeight = fWeight;
o.fYield = fYield;
o.fShowerPosi = fShowerPosi;
o.fShowerPosf = fShowerPosf;
o.fAxis = fAxis;
o.fDatei = fDatei;
o.fDatef = fDatef;
SafeDelete(o.fLateralDist);
SafeDelete(o.fAngularDist);
SafeDelete(o.fHistoLateral);
SafeDelete(o.fHistoAngular);
if ( fLateralDist ) o.fLateralDist = new TF12(*fLateralDist);
if ( fAngularDist ) o.fAngularDist = new TF12(*fAngularDist);
if ( fHistoLateral ) o.fHistoLateral = new TH1F(*fHistoLateral);
if ( fHistoAngular ) o.fHistoAngular = new TH1F(*fHistoAngular);
fWlSpectrum.Copy(o.fWlSpectrum);
}
//_____________________________________________________________________________
ParentBunch::~ParentBunch() {
//
// Destructor
//
SafeDelete(fLateralDist);
SafeDelete(fAngularDist);
SafeDelete(fHistoLateral);
SafeDelete(fHistoAngular);
}
//_____________________________________________________________________________
void ParentBunch::SetHistoLateral( const TH1F& ld) {
if ( fHistoLateral ) delete fHistoLateral;
fHistoLateral = new TH1F(ld);
}
//_____________________________________________________________________________
void ParentBunch::SetHistoAngular( const TH1F& ad) {
if ( fHistoAngular ) delete fHistoAngular;
fHistoAngular = new TH1F(ad);
}