From edee5e635ec64ba67fb40363dd4e860f759fb666 Mon Sep 17 00:00:00 2001 From: ivana Date: Mon, 19 Sep 2005 18:10:56 +0000 Subject: [PATCH] From Laurent: Modified to be able to switch easily from Factory to FactoryV3 (driven by the Config.C) --- MUON/AliMUON.cxx | 12 +++---- MUON/AliMUON.h | 2 -- MUON/AliMUONv1.cxx | 85 +++++++++++++++++++++++++++------------------- MUON/AliMUONv1.h | 4 ++- 4 files changed, 58 insertions(+), 45 deletions(-) diff --git a/MUON/AliMUON.cxx b/MUON/AliMUON.cxx index b8b617d5b6f..2e4883c54bd 100644 --- a/MUON/AliMUON.cxx +++ b/MUON/AliMUON.cxx @@ -103,11 +103,11 @@ AliMUON::AliMUON() fMaxDestepGas(0.), fMaxDestepAlu(0.), fMaxIterPad(0), - fCurIterPad(0), - fFactory(0) + fCurIterPad(0) { // Default Constructor // + AliDebug(1,Form("default (empty) ctor this=%p",this)); fIshunt = 0; } @@ -130,10 +130,9 @@ AliMUON::AliMUON(const char *name, const char *title) fMaxDestepGas(-1), // Negatives values are ignored by geant3 CONS200 fMaxDestepAlu(-1), // in the calculation of the tracking parameters fMaxIterPad(0), - fCurIterPad(0), - fFactory(0) + fCurIterPad(0) { - + AliDebug(1,Form("ctor this=%p",this)); fIshunt = 0; SetMarkerColor(kRed);// @@ -207,7 +206,7 @@ AliMUON::AliMUON(const AliMUON& rMUON) AliMUON::~AliMUON() { // Destructor - AliDebug(1,"Calling AliMUON destructor"); + AliDebug(1,Form("dtor this=%p",this)); fIshunt = 0; if (fChambers){ @@ -221,7 +220,6 @@ AliMUON::~AliMUON() delete fMUONData; delete fGeometryBuilder; delete fDEIndexing; - delete fFactory; } //________________________________________________________________________ diff --git a/MUON/AliMUON.h b/MUON/AliMUON.h index add1fcf2b2f..de3695d433f 100644 --- a/MUON/AliMUON.h +++ b/MUON/AliMUON.h @@ -30,7 +30,6 @@ class AliMUONRawCluster; class AliMUONGeometryBuilder; class AliMUONVGeometryBuilder; class AliMUONGeometryDEIndexing; -class AliMUONFactoryV2; class AliESD; class AliMUON : public AliDetector @@ -138,7 +137,6 @@ class AliMUON : public AliDetector Int_t fMaxIterPad; // Maximum pad index Int_t fCurIterPad; // Current pad index // Background eent for event mixing - AliMUONFactoryV2* fFactory; // ! MUON factory ClassDef(AliMUON,9) // MUON Detector base class }; diff --git a/MUON/AliMUONv1.cxx b/MUON/AliMUONv1.cxx index 870d7bcb066..b959caadef5 100644 --- a/MUON/AliMUONv1.cxx +++ b/MUON/AliMUONv1.cxx @@ -30,6 +30,7 @@ #include "AliConst.h" #include "AliMUONChamber.h" #include "AliMUONConstants.h" +#include "AliMUONFactoryV3.h" #include "AliMUONFactoryV2.h" #include "AliMUONHit.h" #include "AliMUONTriggerCircuit.h" @@ -42,6 +43,8 @@ #include "AliMC.h" #include "AliLog.h" +#include + ClassImp(AliMUONv1) //___________________________________________ @@ -57,9 +60,11 @@ AliMUONv1::AliMUONv1() fTrackPosition(), fElossRatio(0x0), fAngleEffect10(0x0), - fAngleEffectNorma(0x0) + fAngleEffectNorma(0x0), + fFactory(0x0) { // Default constructor + AliDebug(1,Form("default (empty) ctor this=%p",this)); } //___________________________________________ @@ -75,10 +80,13 @@ AliMUONv1::AliMUONv1(const char *name, const char *title) fTrackPosition(), fElossRatio(0x0), fAngleEffect10(0x0), - fAngleEffectNorma(0x0) + fAngleEffectNorma(0x0), + fFactory(0x0) { // Standard onstructor + AliDebug(1,Form("ctor this=%p",this)); + // By default include all stations fStepSum = new Float_t [AliMUONConstants::NCh()]; @@ -122,12 +130,13 @@ AliMUONv1::AliMUONv1(const AliMUONv1& right) AliMUONv1::~AliMUONv1() { // Destructor - + AliDebug(1,Form("dtor this=%p",this)); delete [] fStepSum; delete [] fDestepSum; delete fElossRatio; delete fAngleEffect10; delete fAngleEffectNorma; + delete fFactory; } //_____________________________________________________________________________ @@ -166,39 +175,45 @@ void AliMUONv1::CreateMaterials() //___________________________________________ void AliMUONv1::Init() { - AliDebug(1,"Start Init for version 1 - CPC chamber type"); - Int_t i; - - - // - // Initialize geometry - // - fGeometryBuilder->InitGeometry(); - AliDebug(1,"Finished Init for version 1 - CPC chamber type"); - - fFactory = new AliMUONFactoryV2("New MUON Factory"); - AliInfo("New Segmentation"); - - - fFactory->Build(this, "default"); - - // - // Initialize segmentation - // - - for (i=0; iInit(2);// new segmentation - - - // trigger circuit - // cp - for (i=0; iInit(i); + AliDebug(1,"Start Init for version 1 - CPC chamber type"); + Int_t i; - - - - + // + // Initialize geometry + // + fGeometryBuilder->InitGeometry(); + AliDebug(1,"Finished Init for version 1 - CPC chamber type"); + + std::string ftype(GetTitle()); + + if ( ftype == "default" || ftype == "AliMUONFactoryV2") + { + fFactory = new AliMUONFactoryV2("New MUON Factory"); + (static_cast(fFactory))->Build(this,"default"); + } + else if ( ftype == "AliMUONFactoryV3" ) + { + fFactory = new AliMUONFactoryV3("New MUON Factory"); + (static_cast(fFactory))->Build(this,"default"); + } + else + { + AliFatal(Form("Wrong factory type : %s",ftype.c_str())); + } + + // + // Initialize segmentation + // + + for (i=0; iInit(2);// new segmentation + + + // trigger circuit + // cp + for (i=0; iInit(i); + } //__________________________________________________________________ diff --git a/MUON/AliMUONv1.h b/MUON/AliMUONv1.h index 4d881f9f71d..ba1ca6cb917 100644 --- a/MUON/AliMUONv1.h +++ b/MUON/AliMUONv1.h @@ -64,7 +64,9 @@ class AliMUONv1 : public AliMUON TF1 * fAngleEffect10; // Angle effect in tracking chambers at theta =10 degres as a function of ElossRatio (Khalil BOUDJEMLINE sep 2003 Ph.D Thesis) (in micrometers) TF1 * fAngleEffectNorma;// Angle effect: Normalisation form theta=10 degres to theta between 0 and 10 (Khalil BOUDJEMLINE sep 2003 Ph.D Thesis) - ClassDef(AliMUONv1,3) // MUON Detector class Version 1 + TObject* fFactory; //! to build segmentation (temporary, should not be needed with new segmentation scheme and its manager) + + ClassDef(AliMUONv1,4) // MUON Detector class Version 1 }; #endif -- 2.39.3