From 780fda6d420f76a13619a6c0b55d912093bd970e Mon Sep 17 00:00:00 2001 From: schutz Date: Thu, 18 Dec 2003 17:31:47 +0000 Subject: [PATCH] Added Copy method --- PHOS/AliPHOS.cxx | 8 ++++++++ PHOS/AliPHOS.h | 7 +++---- PHOS/AliPHOSv0.cxx | 7 +++++++ PHOS/AliPHOSv0.h | 5 +++-- PHOS/AliPHOSv1.cxx | 15 +++++++++++++++ PHOS/AliPHOSv1.h | 7 +++---- PHOS/AliPHOSv2.cxx | 7 +++++++ PHOS/AliPHOSv2.h | 4 ++++ PHOS/AliPHOSvFast.cxx | 23 +++++++++++++++++++++++ PHOS/AliPHOSvFast.h | 5 +++-- PHOS/AliPHOSvImpacts.cxx | 8 ++++++++ PHOS/AliPHOSvImpacts.h | 7 +++---- 12 files changed, 87 insertions(+), 16 deletions(-) diff --git a/PHOS/AliPHOS.cxx b/PHOS/AliPHOS.cxx index bf731239b82..bce8af301f7 100644 --- a/PHOS/AliPHOS.cxx +++ b/PHOS/AliPHOS.cxx @@ -68,6 +68,14 @@ AliPHOS::~AliPHOS() } +//____________________________________________________________________________ +void AliPHOS::Copy(AliPHOS & phos) +{ + TObject::Copy(phos) ; + // fQATask = AliPHOSQAChecker::Copy(*(phos.fQATask)) ; + phos.fTreeQA = fTreeQA->CloneTree() ; +} + //____________________________________________________________________________ void AliPHOS::CreateMaterials() { diff --git a/PHOS/AliPHOS.h b/PHOS/AliPHOS.h index d28e5e5ebe6..13d83ee3a4e 100644 --- a/PHOS/AliPHOS.h +++ b/PHOS/AliPHOS.h @@ -27,12 +27,11 @@ class AliPHOS : public AliDetector { AliPHOS() ; AliPHOS(const char* name, const char* title="") ; - AliPHOS(const AliPHOS & phos) : AliDetector(phos) { - // cpy ctor: no implementation yet - // requested by the Coding Convention - Fatal("cpy ctor", "not implemented") ; + AliPHOS(AliPHOS & phos) : AliDetector(phos) { + Copy(*this) ; } virtual ~AliPHOS() ; + virtual void Copy(AliPHOS & phos) ; virtual void AddHit(Int_t, Int_t*, Float_t *) { // do not use this definition but the one below Fatal("AddHit(Int_t, Int_t*, Float_t *)", "do not use") ; diff --git a/PHOS/AliPHOSv0.cxx b/PHOS/AliPHOSv0.cxx index 3ab2ce4693d..b2ad372cabc 100644 --- a/PHOS/AliPHOSv0.cxx +++ b/PHOS/AliPHOSv0.cxx @@ -57,6 +57,13 @@ AliPHOSv0::AliPHOSv0(const char *name, const char *title): GetGeometry() ; } +//____________________________________________________________________________ +void AliPHOSv0::Copy(AliPHOSv0 & phos) +{ + TObject::Copy(phos) ; + AliPHOS::Copy(phos) ; +} + //____________________________________________________________________________ void AliPHOSv0::BuildGeometry() { diff --git a/PHOS/AliPHOSv0.h b/PHOS/AliPHOSv0.h index c948ab25aeb..7bce39f721f 100644 --- a/PHOS/AliPHOSv0.h +++ b/PHOS/AliPHOSv0.h @@ -23,12 +23,13 @@ class AliPHOSv0 : public AliPHOS { AliPHOSv0() {} AliPHOSv0(const char *name, const char *title="") ; - AliPHOSv0(const AliPHOSv0 & phos) : AliPHOS(phos) { - Fatal("cpy ctor", "not implemented") ; + AliPHOSv0(AliPHOSv0 & phos) : AliPHOS(phos) { + phos.Copy(*this) ; } virtual ~AliPHOSv0(void){ // dtor } + virtual void Copy(AliPHOSv0 & phos) ; // virtual void AddHit( Int_t shunt, Int_t primary, Int_t track, Int_t id, Float_t *hits ) { virtual void AddHit( Int_t, Int_t, Int_t, Int_t, Float_t*) { diff --git a/PHOS/AliPHOSv1.cxx b/PHOS/AliPHOSv1.cxx index 96f09195b02..ac1cc9f6a4d 100644 --- a/PHOS/AliPHOSv1.cxx +++ b/PHOS/AliPHOSv1.cxx @@ -168,6 +168,21 @@ AliPHOSv1::~AliPHOSv1() } +//____________________________________________________________________________ +void AliPHOSv1::Copy(AliPHOSv1 & phos) +{ + TObject::Copy(phos) ; + AliPHOSv0::Copy(phos) ; + phos.fLightYieldMean = fLightYieldMean ; + phos.fIntrinsicPINEfficiency = fIntrinsicPINEfficiency ; + phos.fLightYieldAttenuation = fLightYieldAttenuation ; + phos.fRecalibrationFactor = fRecalibrationFactor ; + phos.fElectronsPerGeV = fElectronsPerGeV ; + phos.fAPDGain = fAPDGain ; + phos.fLightFactor = fLightFactor ; + phos.fAPDFactor = fAPDFactor ; +} + //____________________________________________________________________________ void AliPHOSv1::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t Id, Float_t * hits) { diff --git a/PHOS/AliPHOSv1.h b/PHOS/AliPHOSv1.h index db7e7fac3ab..6ce64a8b90c 100644 --- a/PHOS/AliPHOSv1.h +++ b/PHOS/AliPHOSv1.h @@ -25,13 +25,12 @@ public: AliPHOSv1(void) ; AliPHOSv1(const char *name, const char *title="") ; - AliPHOSv1(const AliPHOSv1 & phos) : AliPHOSv0(phos) { - // cpy ctor: no implementation yet - // requested by the Coding Convention - Fatal("cpy ctor", "not implemented") ; + AliPHOSv1(AliPHOSv1 & phos) : AliPHOSv0(phos) { + phos.Copy(*this) ; } virtual ~AliPHOSv1(void) ; + virtual void Copy(AliPHOSv1 & phos) ; virtual void AddHit( Int_t shunt, Int_t primary, Int_t track, Int_t id, Float_t *hits) ; virtual void FinishEvent() ; virtual void FinishPrimary() ; diff --git a/PHOS/AliPHOSv2.cxx b/PHOS/AliPHOSv2.cxx index 5f20589e0a6..88d21829573 100644 --- a/PHOS/AliPHOSv2.cxx +++ b/PHOS/AliPHOSv2.cxx @@ -56,6 +56,13 @@ AliPHOSv2::~AliPHOSv2() // dtor } +//____________________________________________________________________________ +void AliPHOSv2::Copy(AliPHOSv2 & phos) +{ + TObject::Copy(phos) ; + AliPHOSv1::Copy(phos) ; +} + //____________________________________________________________________________ void AliPHOSv2::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t Id, Float_t * hits) { diff --git a/PHOS/AliPHOSv2.h b/PHOS/AliPHOSv2.h index 6fc61ec49c2..16236c87c42 100644 --- a/PHOS/AliPHOSv2.h +++ b/PHOS/AliPHOSv2.h @@ -20,8 +20,12 @@ public: AliPHOSv2(void) ; AliPHOSv2(const char *name, const char *title="") ; + AliPHOSv2(AliPHOSv2 & phos) : AliPHOSv1(phos){ + phos.Copy(*this) ; + } virtual ~AliPHOSv2(void) ; + virtual void Copy(AliPHOSv2 & phos) ; virtual void AddHit( Int_t shunt, Int_t primary, Int_t track, Int_t id, Float_t *hits); virtual Int_t IsVersion(void) const { // Gives the version number diff --git a/PHOS/AliPHOSvFast.cxx b/PHOS/AliPHOSvFast.cxx index a2b59cddd75..895e4cab0f5 100644 --- a/PHOS/AliPHOSvFast.cxx +++ b/PHOS/AliPHOSvFast.cxx @@ -103,6 +103,29 @@ AliPHOSvFast::~AliPHOSvFast() } +//____________________________________________________________________________ +void AliPHOSvFast::Copy(AliPHOSvFast & fast) +{ + TObject::Copy(fast) ; + AliPHOS::Copy(fast) ; + fast.fBigBoxX = fBigBoxX ; + fast.fBigBoxY = fBigBoxY ; + fast.fBigBoxZ = fBigBoxZ ; + fast.fNRecParticles = fNRecParticles ; + fast.fRan = fRan ; + fast.fResPara1 = fResPara1 ; + fast.fResPara2 = fResPara2 ; + fast.fResPara3 = fResPara3 ; + fast.fPosParaA0 = fPosParaA0 ; + fast.fPosParaA1 = fPosParaA1 ; + fast.fPosParaB0 = fPosParaB0 ; + fast.fPosParaB1 = fPosParaB1 ; + fast.fFastRecParticles = new TClonesArray(fFastRecParticles->GetClass()->GetName(), 100) ; + Int_t index ; + for (index = 0 ; index < fFastRecParticles->GetEntries(); index++) + (fast.fFastRecParticles)->AddAt(fFastRecParticles->At(index), index) ; +} + //____________________________________________________________________________ void AliPHOSvFast::AddRecParticle(const AliPHOSFastRecParticle & rp) { diff --git a/PHOS/AliPHOSvFast.h b/PHOS/AliPHOSvFast.h index aef4a86259b..5293f7cd7b6 100644 --- a/PHOS/AliPHOSvFast.h +++ b/PHOS/AliPHOSvFast.h @@ -32,11 +32,12 @@ public: AliPHOSvFast() ; AliPHOSvFast(const char *name, const char *title="") ; - AliPHOSvFast(const AliPHOSvFast & fast) : AliPHOS(fast) { - Fatal("cpy ctor", "not implemented") ; + AliPHOSvFast(AliPHOSvFast & fast) : AliPHOS(fast) { + fast.Copy(*this) ; } virtual ~AliPHOSvFast(void) ; + virtual void Copy(AliPHOSvFast & fast) ; void AddRecParticle(const AliPHOSFastRecParticle & rp) ; // adds primary particle to the RecParticles list virtual void BuildGeometry(void) ; // creates the geometry for the ROOT display virtual void CreateGeometry(void) ; // creates the geometry for GEANT diff --git a/PHOS/AliPHOSvImpacts.cxx b/PHOS/AliPHOSvImpacts.cxx index 75c2985d52b..a3de7d24d1d 100644 --- a/PHOS/AliPHOSvImpacts.cxx +++ b/PHOS/AliPHOSvImpacts.cxx @@ -116,6 +116,14 @@ AliPHOSvImpacts::~AliPHOSvImpacts() } } +//____________________________________________________________________________ +void AliPHOSvImpacts::Copy(AliPHOSvImpacts & phos) +{ + TObject::Copy(phos) ; + AliPHOS::Copy(phos) ; +} + + //____________________________________________________________________________ void AliPHOSvImpacts::AddImpact( char* det, Int_t shunt, Int_t primary, Int_t track, Int_t module, Int_t pid, TLorentzVector p, Float_t *xyz) diff --git a/PHOS/AliPHOSvImpacts.h b/PHOS/AliPHOSvImpacts.h index 889905dbbe0..ea775acf244 100644 --- a/PHOS/AliPHOSvImpacts.h +++ b/PHOS/AliPHOSvImpacts.h @@ -27,13 +27,12 @@ public: AliPHOSvImpacts(void) ; AliPHOSvImpacts(const char *name, const char *title="") ; - AliPHOSvImpacts(const AliPHOSvImpacts & phos) : AliPHOSv1(phos) { - // cpy ctor: no implementation yet - // requested by the Coding Convention - Fatal("cpy ctor", "not implemented") ; + AliPHOSvImpacts(AliPHOSvImpacts & phos) : AliPHOSv1(phos) { + phos.Copy(*this) ; } virtual ~AliPHOSvImpacts(void) ; + virtual void Copy(AliPHOSvImpacts & phos) ; virtual void AddImpact(char* detector, Int_t shunt, Int_t primary, Int_t track, Int_t module, Int_t pid, TLorentzVector p, Float_t *xyz) ; virtual void MakeBranch(Option_t *opt=" "); -- 2.43.0