diff --git a/Base/BaseLinkDef.h b/Base/BaseLinkDef.h index 827695264dc82..7f38cd8d2cf00 100644 --- a/Base/BaseLinkDef.h +++ b/Base/BaseLinkDef.h @@ -5,7 +5,6 @@ #pragma link off all classes; #pragma link off all functions; -#pragma link C++ class AliceO2::Base::Module+; #pragma link C++ class AliceO2::Base::Detector+; #pragma link C++ class AliceO2::Base::TrackReference+; diff --git a/Base/CMakeLists.txt b/Base/CMakeLists.txt index 4008d662dea69..2af1e88b01d24 100644 --- a/Base/CMakeLists.txt +++ b/Base/CMakeLists.txt @@ -17,7 +17,6 @@ ${ROOT_LIBRARY_DIR} link_directories( ${LINK_DIRECTORIES}) set(SRCS -Module.cxx Detector.cxx TrackReference.cxx ) diff --git a/Base/Detector.cxx b/Base/Detector.cxx index 1bace70db8eaf..317810c51df68 100644 --- a/Base/Detector.cxx +++ b/Base/Detector.cxx @@ -27,10 +27,24 @@ Detector::Detector(const char* name, Bool_t Active, Int_t DetId) { } +Detector::Detector(const Detector& rhs) + : FairDetector(rhs) {} + Detector::~Detector() { } +Detector& Detector::operator=(const Detector& rhs) +{ + // check assignment to self + if (this == &rhs) return *this; + + // base class assignment + FairDetector::operator=(rhs); + + return *this; +} + void Detector::Material(Int_t imat, const char* name, Float_t a, Float_t z, Float_t dens, Float_t radl, Float_t absl, Float_t* buf, Int_t nwbuf) const { diff --git a/Base/Detector.h b/Base/Detector.h index 543346b450215..b1a1507c490e9 100644 --- a/Base/Detector.h +++ b/Base/Detector.h @@ -67,11 +67,10 @@ class Detector : public FairDetector { UInt_t detType = 0, Int_t buildFlag = 0); protected: + Detector(const Detector& origin); + Detector& operator=(const Detector&); static Float_t mDensityFactor; //! factor that is multiplied to all material densities (ONLY for // systematic studies) -private: - Detector(const Detector&); - Detector& operator=(const Detector&); ClassDef(Detector, 1) // Base class for ALICE Modules }; diff --git a/Base/Module.cxx b/Base/Module.cxx deleted file mode 100644 index 4627e44aacd3e..0000000000000 --- a/Base/Module.cxx +++ /dev/null @@ -1,72 +0,0 @@ -/// \file Module.cxx -/// \brief Implementation of the Module class - -#include "Module.h" -#include -#include - -using std::endl; -using std::cout; -using std::fstream; -using std::ios; -using std::ostream; -using namespace AliceO2::Base; - -ClassImp(AliceO2::Base::Module) - -Float_t Module::mDensityFactor = 1.0; - -Module::Module() - : FairModule() -{ -} - -Module::Module(const char* name, const char* title, Bool_t Active) - : FairModule(name, title, Active) -{ -} - -Module::~Module() -{ -} - -void Module::Material(Int_t imat, const char* name, Float_t a, Float_t z, Float_t dens, - Float_t radl, Float_t absl, Float_t* buf, Int_t nwbuf) const -{ - TString uniquename = GetName(); - uniquename.Append("_"); - uniquename.Append(name); - - // Check this!!! - gMC->Material(imat, uniquename.Data(), a, z, dens * mDensityFactor, radl, absl, buf, nwbuf); -} - -void Module::Mixture(Int_t imat, const char* name, Float_t* a, Float_t* z, Float_t dens, - Int_t nlmat, Float_t* wmat) const -{ - TString uniquename = GetName(); - uniquename.Append("_"); - uniquename.Append(name); - - // Check this!!! - gMC->Mixture(imat, uniquename.Data(), a, z, dens * mDensityFactor, nlmat, wmat); -} - -void Module::Medium(Int_t numed, const char* name, Int_t nmat, Int_t isvol, Int_t ifield, - Float_t fieldm, Float_t tmaxfd, Float_t stemax, Float_t deemax, Float_t epsil, - Float_t stmin, Float_t* ubuf, Int_t nbuf) const -{ - TString uniquename = GetName(); - uniquename.Append("_"); - uniquename.Append(name); - - // Check this!!! - gMC->Medium(numed, uniquename.Data(), nmat, isvol, ifield, fieldm, tmaxfd, stemax, deemax, epsil, - stmin, ubuf, nbuf); -} - -void Module::Matrix(Int_t& nmat, Float_t theta1, Float_t phi1, Float_t theta2, Float_t phi2, - Float_t theta3, Float_t phi3) const -{ - gMC->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3); -} diff --git a/Base/Module.h b/Base/Module.h deleted file mode 100644 index fe5bc3b039fe3..0000000000000 --- a/Base/Module.h +++ /dev/null @@ -1,70 +0,0 @@ -/// \file Module.h -/// \brief Definition of the Module class - -#ifndef ALICEO2_BASE_MODULE_H_ -#define ALICEO2_BASE_MODULE_H_ - -#include "FairModule.h" - -namespace AliceO2 { -namespace Base { - -/// This is the basic class for any AliceO2 detector module, whether it is -/// sensitive or not. Detector classes depend on this. -class Module : public FairModule { - -public: - Module(const char* name, const char* title, Bool_t Active = kFALSE); - - /// Default Constructor - Module(); - - /// Default Destructor - virtual ~Module(); - - // Module composition - virtual void Material(Int_t imat, const char* name, Float_t a, Float_t z, Float_t dens, Float_t radl, Float_t absl, - Float_t* buf = 0, Int_t nwbuf = 0) const; - - virtual void Mixture(Int_t imat, const char* name, Float_t* a, Float_t* z, Float_t dens, Int_t nlmat, - Float_t* wmat) const; - - virtual void Medium(Int_t numed, const char* name, Int_t nmat, Int_t isvol, Int_t ifield, Float_t fieldm, - Float_t tmaxfd, Float_t stemax, Float_t deemax, Float_t epsil, Float_t stmin, Float_t* ubuf = 0, - Int_t nbuf = 0) const; - - /// Define a rotation matrix. angles are in degrees. - /// \param nmat on output contains the number assigned to the rotation matrix - /// \param theta1 polar angle for axis I - /// \param phi1 azimuthal angle for axis I - /// \param theta2 polar angle for axis II - /// \param phi2 azimuthal angle for axis II - /// \param theta3 polar angle for axis III - /// \param phi3 azimuthal angle for axis III - virtual void Matrix(Int_t& nmat, Float_t theta1, Float_t phi1, Float_t theta2, Float_t phi2, Float_t theta3, - Float_t phi3) const; - - static void setDensityFactor(Float_t density) - { - mDensityFactor = density; - } - - static Float_t getDensityFactor() - { - return mDensityFactor; - } - -protected: - static Float_t mDensityFactor; ///< factor that is multiplied to all material densities (ONLY for - ///< systematic studies) - -private: - Module(const Module&); - Module& operator=(const Module&); - - ClassDef(Module, 1) // Base class for ALICE Modules -}; -} -} - -#endif diff --git a/Data/Stack.cxx b/Data/Stack.cxx index 5b7714ab1c6aa..88904aac48bee 100644 --- a/Data/Stack.cxx +++ b/Data/Stack.cxx @@ -41,14 +41,39 @@ Stack::Stack(Int_t size) mNumberOfEntriesInParticles(0), mNumberOfEntriesInTracks(0), mIndex(0), + mStoreMothers(kTRUE), mStoreSecondaries(kTRUE), mMinPoints(1), mEnergyCut(0.), - mStoreMothers(kTRUE), mLogger(FairLogger::GetLogger()) { } +Stack::Stack(const Stack& rhs) + : FairGenericStack(rhs), + mStack(), + mParticles(0), + mTracks(0), + mStoreMap(), + mStoreIterator(), + mIndexMap(), + mIndexIterator(), + mPointsMap(), + mIndexOfCurrentTrack(-1), + mNumberOfPrimaryParticles(0), + mNumberOfEntriesInParticles(0), + mNumberOfEntriesInTracks(0), + mIndex(0), + mStoreMothers(rhs.mStoreMothers), + mStoreSecondaries(rhs.mStoreSecondaries), + mMinPoints(rhs.mMinPoints), + mEnergyCut(rhs.mEnergyCut), + mLogger(0) +{ + mParticles = new TClonesArray("TParticle", rhs.mParticles->GetSize()); + mTracks = new TClonesArray("MCTrack", rhs.mTracks->GetSize()); +} + Stack::~Stack() { if (mParticles) { @@ -61,6 +86,31 @@ Stack::~Stack() } } +Stack& Stack::operator=(const Stack& rhs) +{ + // check assignment to self + if (this == &rhs) return *this; + + // base class assignment + FairGenericStack::operator=(rhs); + + // assignment operator + mParticles = new TClonesArray("TParticle", rhs.mParticles->GetSize()); + mTracks = new TClonesArray("MCTrack", rhs.mTracks->GetSize()); + mIndexOfCurrentTrack = -1; + mNumberOfPrimaryParticles = 0; + mNumberOfEntriesInParticles = 0; + mNumberOfEntriesInTracks = 0; + mIndex = 0; + mStoreMothers = rhs.mStoreMothers; + mStoreSecondaries = rhs.mStoreSecondaries; + mMinPoints = rhs.mMinPoints; + mEnergyCut = rhs.mEnergyCut; + mLogger = 0; + + return *this; +} + void Stack::PushTrack(Int_t toBeDone, Int_t parentId, Int_t pdgCode, Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vx, Double_t vy, Double_t vz, Double_t time, Double_t polx, Double_t poly, Double_t polz, TMCProcess proc, Int_t& ntr, Double_t weight, Int_t is) @@ -134,7 +184,9 @@ TParticle* Stack::PopPrimaryForTracking(Int_t iPrim) // Test for index if (iPrim < 0 || iPrim >= mNumberOfPrimaryParticles) { - mLogger->Fatal(MESSAGE_ORIGIN, "Stack: Primary index out of range! %i ", iPrim); + if (mLogger) { + mLogger->Fatal(MESSAGE_ORIGIN, "Stack: Primary index out of range! %i ", iPrim); + } Fatal("Stack::PopPrimaryForTracking", "Index out of range"); } @@ -142,7 +194,9 @@ TParticle* Stack::PopPrimaryForTracking(Int_t iPrim) // a primary. TParticle* part = (TParticle*)mParticles->At(iPrim); if (!(part->GetMother(0) < 0)) { - mLogger->Fatal(MESSAGE_ORIGIN, "Stack:: Not a primary track! %i ", iPrim); + if (mLogger) { + mLogger->Fatal(MESSAGE_ORIGIN, "Stack:: Not a primary track! %i ", iPrim); + } Fatal("Stack::PopPrimaryForTracking", "Not a primary track"); } @@ -153,7 +207,9 @@ TParticle* Stack::GetCurrentTrack() const { TParticle* currentPart = GetParticle(mIndexOfCurrentTrack); if (!currentPart) { - mLogger->Warning(MESSAGE_ORIGIN, "Stack: Current track not found in stack!"); + if (mLogger) { + mLogger->Warning(MESSAGE_ORIGIN, "Stack: Current track not found in stack!"); + } Warning("Stack::GetCurrentTrack", "Track not found in stack"); } return currentPart; @@ -170,8 +226,11 @@ void Stack::AddParticle(TParticle* oldPart) void Stack::FillTrackArray() { - - mLogger->Debug(MESSAGE_ORIGIN, "Stack: Filling MCTrack array..."); + if (mLogger) { + mLogger->Debug(MESSAGE_ORIGIN, "Stack: Filling MCTrack array..."); + } else { + cout << "Stack: Filling MCTrack array..." << endl; + } // Reset index map and number of output tracks mIndexMap.clear(); @@ -185,7 +244,9 @@ void Stack::FillTrackArray() mStoreIterator = mStoreMap.find(iPart); if (mStoreIterator == mStoreMap.end()) { - mLogger->Fatal(MESSAGE_ORIGIN, "Stack: Particle %i not found in storage map! ", iPart); + if (mLogger) { + mLogger->Fatal(MESSAGE_ORIGIN, "Stack: Particle %i not found in storage map! ", iPart); + } Fatal("Stack::FillTrackArray", "Particle not found in storage map."); } Bool_t store = (*mStoreIterator).second; @@ -213,8 +274,11 @@ void Stack::FillTrackArray() void Stack::UpdateTrackIndex(TRefArray* detList) { - - mLogger->Debug(MESSAGE_ORIGIN, "Stack: Updating track indizes..."); + if (mLogger) { + mLogger->Debug(MESSAGE_ORIGIN, "Stack: Updating track indices..."); + } else { + cout << "Stack: Updating track indices..." << endl; + } Int_t nColl = 0; // First update mother ID in MCTracks @@ -223,7 +287,9 @@ void Stack::UpdateTrackIndex(TRefArray* detList) Int_t iMotherOld = track->getMotherTrackId(); mIndexIterator = mIndexMap.find(iMotherOld); if (mIndexIterator == mIndexMap.end()) { - mLogger->Fatal(MESSAGE_ORIGIN, "Stack: Particle index %i not found in dex map! ", iMotherOld); + if (mLogger) { + mLogger->Fatal(MESSAGE_ORIGIN, "Stack: Particle index %i not found in dex map! ", iMotherOld); + } Fatal("Stack::UpdateTrackIndex", "Particle index not found in map"); } track->SetMotherTrackId((*mIndexIterator).second); @@ -254,7 +320,9 @@ void Stack::UpdateTrackIndex(TRefArray* detList) mIndexIterator = mIndexMap.find(iTrack); if (mIndexIterator == mIndexMap.end()) { - mLogger->Fatal(MESSAGE_ORIGIN, "Stack: Particle index %i not found in index map! ", iTrack); + if (mLogger) { + mLogger->Fatal(MESSAGE_ORIGIN, "Stack: Particle index %i not found in index map! ", iTrack); + } Fatal("Stack::UpdateTrackIndex", "Particle index not found in map"); } point->SetTrackID((*mIndexIterator).second); @@ -263,7 +331,11 @@ void Stack::UpdateTrackIndex(TRefArray* detList) } // Collections of this detector } // List of active detectors - mLogger->Debug(MESSAGE_ORIGIN, "...stack and %i collections updated.", nColl); + if (mLogger) { + mLogger->Debug(MESSAGE_ORIGIN, "...stack and %i collections updated.", nColl); + } else { + cout << "...stack and " << nColl << " collections updated." << endl; + } } void Stack::Reset() @@ -335,7 +407,9 @@ Int_t Stack::GetCurrentParentTrackNumber() const TParticle* Stack::GetParticle(Int_t trackID) const { if (trackID < 0 || trackID >= mNumberOfEntriesInParticles) { - mLogger->Debug(MESSAGE_ORIGIN, "Stack: Particle index %i out of range.", trackID); + if (mLogger) { + mLogger->Debug(MESSAGE_ORIGIN, "Stack: Particle index %i out of range.", trackID); + } Fatal("Stack::GetParticle", "Index out of range"); } return (TParticle*)mParticles->At(trackID); @@ -404,4 +478,9 @@ void Stack::SelectTracks() } } +FairGenericStack* Stack::CloneStack() const +{ + return new AliceO2::Data::Stack(*this); +} + ClassImp(AliceO2::Data::Stack) diff --git a/Data/Stack.h b/Data/Stack.h index 811290a41f585..dcc7677ee21cc 100644 --- a/Data/Stack.h +++ b/Data/Stack.h @@ -174,6 +174,9 @@ class Stack : public FairGenericStack { return mParticles; } + /// Clone for worker (used in MT mode only) + virtual FairGenericStack* CloneStack() const; + private: FairLogger* mLogger; diff --git a/devices/aliceHLTwrapper/CMakeLists.txt b/devices/aliceHLTwrapper/CMakeLists.txt index a89f6716355fc..5e82197d591df 100644 --- a/devices/aliceHLTwrapper/CMakeLists.txt +++ b/devices/aliceHLTwrapper/CMakeLists.txt @@ -2,6 +2,8 @@ set(INCLUDE_DIRECTORIES ${BASE_INCLUDE_DIRECTORIES} ${ZMQ_INCLUDE_DIR} ${Boost_INCLUDE_DIR} + ${FAIRROOT_INCLUDE_DIR} + ${AlFa_DIR}/include ${CMAKE_SOURCE_DIR}/devices/aliceHLTwrapper ${FAIRROOT_INCLUDE_DIR} ${AlFa_DIR}/include diff --git a/gconfig/g4Config.C b/gconfig/g4Config.C index fb76be0eeefd7..e58428d69ee44 100755 --- a/gconfig/g4Config.C +++ b/gconfig/g4Config.C @@ -36,9 +36,16 @@ void Config() /// When more than one options are selected, they should be separated with '+' /// character: eg. stepLimit+specialCuts. +// Geant4 VMC 2.x TG4RunConfiguration* runConfiguration = new TG4RunConfiguration("geomRoot", "QGSP_FTFP_BERT", "stepLimiter+specialCuts+specialControls+stackPopper"); +// Geant4 VMC 3.0 +//Bool_t mtMode = true; +//TG4RunConfiguration* runConfiguration +// = new TG4RunConfiguration("geomRoot", "QGSP_FTFP_BERT", "stepLimiter+specialCuts", +// false, mtMode); + /// Create the G4 VMC TGeant4* geant4 = new TGeant4("TGeant4", "The Geant4 Monte Carlo", runConfiguration); cout << "Geant4 has been created." << endl; diff --git a/its/Detector.cxx b/its/Detector.cxx index 5f0929d4bb5c6..d8a8a184ee6f5 100644 --- a/its/Detector.cxx +++ b/its/Detector.cxx @@ -166,6 +166,85 @@ Detector::Detector(const char* name, Bool_t active, const Int_t nlay) } } +Detector::Detector(const Detector& rhs) + : AliceO2::Base::Detector(rhs), + mLayerID(0), + mNumberLayers(rhs.mNumberLayers), + mStatus(rhs.mStatus), + mModule(rhs.mModule), + mParticlePx(rhs.mParticlePx), + mParticlePy(rhs.mParticlePy), + mParticlePz(rhs.mParticlePz), + mEnergyDepositionStep(rhs.mEnergyDepositionStep), + mTof(rhs.mTof), + mStatus0(rhs.mStatus0), + mStartingStepX(rhs.mStartingStepX), + mStartingStepY(rhs.mStartingStepY), + mStartingStepZ(rhs.mStartingStepZ), + mStartingStepT(rhs.mStartingStepT), + mTrackNumber(rhs.mTrackNumber), + mPositionX(rhs.mPositionX), + mPositionY(rhs.mPositionY), + mPositionZ(rhs.mPositionZ), + mLayerName(0), + mTrackNumberID(rhs.mTrackNumberID), + mVolumeID(rhs.mVolumeID), + mShunt(rhs.mShunt), + mPosition(rhs.mPosition), + mEntrancePosition(rhs.mEntrancePosition), + mMomentum(rhs.mMomentum), + mEntranceTime(rhs.mEntranceTime), + mTime(rhs.mTime), + mLength(rhs.mLength), + mEnergyLoss(rhs.mEnergyLoss), + + mNumberOfDetectors(rhs.mNumberOfDetectors), + mShiftX(), + mShiftY(), + mShiftZ(), + mRotX(), + mRotY(), + mRotZ(), + + mModifyGeometry(rhs.mModifyGeometry), + + mNumberOfWrapperVolumes(rhs.mNumberOfWrapperVolumes), + // the following parameters may be shared with master if needed + // let's try not to set them and keep dtor simple + mWrapperMinRadius(0), + mWrapperMaxRadius(0), + mWrapperZSpan(0), + mWrapperLayerId(0), + mTurboLayer(0), + mLayerPhi0(0), + mLayerRadii(0), + mLayerZLength(0), + mStavePerLayer(0), + mUnitPerStave(0), + mStaveThickness(0), + mStaveWidth(0), + mStaveTilt(0), + mDetectorThickness(0), + mChipTypeID(0), + mBuildLevel(0), + + /// Container for data points + mPointCollection(0), + + mGeometryHandler(0), + mMisalignmentParameter(0), + + mUpgradeGeometry(0), + mStaveModelInnerBarrel(rhs.mStaveModelInnerBarrel), + mStaveModelOuterBarrel(rhs.mStaveModelInnerBarrel) +{ + mLayerName = new TString[mNumberLayers]; + + for (Int_t j = 0; j < mNumberLayers; j++) { + mLayerName[j].Form("%s%d", UpgradeGeometryTGeo::getITSSensorPattern(), j); // See UpgradeV1Layer + } +} + Detector::~Detector() { delete[] mTurboLayer; @@ -194,7 +273,7 @@ Detector::~Detector() delete[] mLayerID; } -Detector& Detector::operator=(const Detector& h) +Detector& Detector::operator=(const Detector& rhs) { // The standard = operator // Inputs: @@ -204,21 +283,82 @@ Detector& Detector::operator=(const Detector& h) // Return: // A copy of the sourse hit h - if (this == &h) { + if (this == &rhs) { return *this; } - this->mStatus = h.mStatus; - this->mModule = h.mModule; - this->mParticlePx = h.mParticlePx; - this->mParticlePy = h.mParticlePy; - this->mParticlePz = h.mParticlePz; - this->mEnergyDepositionStep = h.mEnergyDepositionStep; - this->mTof = h.mTof; - this->mStatus0 = h.mStatus0; - this->mStartingStepX = h.mStartingStepX; - this->mStartingStepY = h.mStartingStepY; - this->mStartingStepZ = h.mStartingStepZ; - this->mStartingStepT = h.mStartingStepT; + + // base class assignment + Base::Detector::operator=(rhs); + + mLayerID = 0; + mNumberLayers = rhs.mNumberLayers; + mStatus = rhs.mStatus; + mModule = rhs.mModule; + mParticlePx = rhs.mParticlePx; + mParticlePy = rhs.mParticlePy; + mParticlePz = rhs.mParticlePz; + mEnergyDepositionStep = rhs.mEnergyDepositionStep; + mTof = rhs.mTof; + mStatus0 = rhs.mStatus0; + mStartingStepX = rhs.mStartingStepX; + mStartingStepY = rhs.mStartingStepY; + mStartingStepZ = rhs.mStartingStepZ; + mStartingStepT = rhs.mStartingStepT; + mTrackNumber = rhs.mTrackNumber; + mPositionX = rhs.mPositionX; + mPositionY = rhs.mPositionY; + mPositionZ = rhs.mPositionZ; + mLayerName = 0; + mTrackNumberID = rhs.mTrackNumberID; + mVolumeID = rhs.mVolumeID; + mShunt = rhs.mShunt; + mPosition = rhs.mPosition; + mEntrancePosition = rhs.mEntrancePosition; + mMomentum = rhs.mMomentum; + mEntranceTime = rhs.mEntranceTime; + mTime = rhs.mTime; + mLength = rhs.mLength; + mEnergyLoss = rhs.mEnergyLoss; + + mNumberOfDetectors = rhs.mNumberOfDetectors; + + mModifyGeometry = rhs.mModifyGeometry; + + mNumberOfWrapperVolumes = rhs.mNumberOfWrapperVolumes; + // the following parameters may be shared with master if needed + // let's try not to set them and keep dtor simple + mWrapperMinRadius = 0; + mWrapperMaxRadius = 0; + mWrapperZSpan = 0; + mWrapperLayerId = 0; + mTurboLayer = 0; + mLayerPhi0 = 0; + mLayerRadii = 0; + mLayerZLength = 0; + mStavePerLayer = 0; + mUnitPerStave = 0; + mStaveThickness = 0; + mStaveWidth = 0; + mStaveTilt = 0; + mDetectorThickness = 0; + mChipTypeID = 0; + mBuildLevel = 0; + + /// Container for data points + mPointCollection = 0; + + mGeometryHandler = 0; + mMisalignmentParameter = 0; + + mUpgradeGeometry = 0; + mStaveModelInnerBarrel = rhs.mStaveModelInnerBarrel; + mStaveModelOuterBarrel = rhs.mStaveModelInnerBarrel; + + mLayerName = new TString[mNumberLayers]; + for (Int_t j = 0; j < mNumberLayers; j++) { + mLayerName[j].Form("%s%d", UpgradeGeometryTGeo::getITSSensorPattern(), j); // See UpgradeV1Layer + } + return *this; } @@ -467,7 +607,7 @@ void Detector::createMaterials() void Detector::EndOfEvent() { - mPointCollection->Clear(); + if (mPointCollection) mPointCollection->Clear(); } void Detector::Register() @@ -476,7 +616,9 @@ void Detector::Register() // parameter to kFALSE means that this collection will not be written to the file, // it will exist only during the simulation - FairRootManager::Instance()->Register("Point", "ITS", mPointCollection, kTRUE); + if (FairRootManager::Instance()) { + FairRootManager::Instance()->Register("Point", "ITS", mPointCollection, kTRUE); + } } TClonesArray* Detector::GetCollection(Int_t iColl) const @@ -971,6 +1113,11 @@ void Detector::Read(istream* is) return; } +FairModule* Detector::CloneModule() const +{ + return new Detector(*this); +} + ostream& operator<<(ostream& os, Detector& p) { // Standard output streaming function. diff --git a/its/Detector.h b/its/Detector.h index 08981ea27c9da..883b346ca8570 100644 --- a/its/Detector.h +++ b/its/Detector.h @@ -222,6 +222,9 @@ class Detector : public AliceO2::Base::Detector { return mStaveModelOuterBarrel; } + /// Clone this object (used in MT mode only) + virtual FairModule* CloneModule() const; + UpgradeGeometryTGeo* mGeometryTGeo; //! access to geometry details protected: diff --git a/passive/Cave.cxx b/passive/Cave.cxx index 5a07e164ec77d..548a822c3ea9a 100644 --- a/passive/Cave.cxx +++ b/passive/Cave.cxx @@ -56,7 +56,36 @@ Cave::~Cave() Cave::Cave(const char* name, const char* Title) : FairModule(name ,Title) { - world[0] = 0; - world[1] = 0; - world[2] = 0; + mWorld[0] = 0; + mWorld[1] = 0; + mWorld[2] = 0; +} + +Cave::Cave(const Cave& rhs) + : FairModule(rhs) +{ + mWorld[0] = rhs.mWorld[0]; + mWorld[1] = rhs.mWorld[1]; + mWorld[2] = rhs.mWorld[2]; +} + +Cave& Cave::operator=(const Cave& rhs) +{ + // self assignment + if (this == &rhs) return *this; + + // base class assignment + FairModule::operator=(rhs); + + // assignment operator + mWorld[0] = rhs.mWorld[0]; + mWorld[1] = rhs.mWorld[1]; + mWorld[2] = rhs.mWorld[2]; + + return *this; +} + +FairModule* Cave::CloneModule() const +{ + return new Cave(*this); } diff --git a/passive/Cave.h b/passive/Cave.h index 0b357b430c721..925d44398e6db 100644 --- a/passive/Cave.h +++ b/passive/Cave.h @@ -28,9 +28,14 @@ class Cave : public FairModule virtual ~Cave(); virtual void ConstructGeometry(); + /// Clone this object (used in MT mode only) + virtual FairModule* CloneModule() const; private: - Double_t world[3]; + Cave(const Cave& orig); + Cave& operator=(const Cave&); + + Double_t mWorld[3]; ClassDef(AliceO2::Passive::Cave,1) // }; } diff --git a/passive/Magnet.cxx b/passive/Magnet.cxx index 364ffb78d747d..fe04982ad4e00 100644 --- a/passive/Magnet.cxx +++ b/passive/Magnet.cxx @@ -45,6 +45,22 @@ Magnet::Magnet(const char* name, const char* Title) { } +Magnet::Magnet(const Magnet& rhs) + : FairModule(rhs) +{ +} + +Magnet& Magnet::operator=(const Magnet& rhs) +{ + // self assignment + if (this == &rhs) return *this; + + // base class assignment + FairModule::operator=(rhs); + + return *this; +} + void Magnet::ConstructGeometry() { @@ -96,6 +112,10 @@ void Magnet::ConstructGeometry() } +FairModule* Magnet::CloneModule() const +{ + return new Magnet(*this); +} ClassImp(AliceO2::Passive::Magnet) diff --git a/passive/Magnet.h b/passive/Magnet.h index 62a1b96d15647..92b45435ca63b 100644 --- a/passive/Magnet.h +++ b/passive/Magnet.h @@ -28,6 +28,14 @@ class Magnet : public FairModule Magnet(); virtual ~Magnet(); void ConstructGeometry(); + + /// Clone this object (used in MT mode only) + virtual FairModule* CloneModule() const; + + private: + Magnet(const Magnet& orig); + Magnet& operator=(const Magnet&); + ClassDef(AliceO2::Passive::Magnet,1) }; diff --git a/passive/Pipe.cxx b/passive/Pipe.cxx index b24b08b659153..561bd45fe4b77 100644 --- a/passive/Pipe.cxx +++ b/passive/Pipe.cxx @@ -36,6 +36,21 @@ Pipe::Pipe(const char * name, const char * title) { } +Pipe::Pipe(const Pipe& rhs) + : FairModule(rhs) +{ +} + +Pipe& Pipe::operator=(const Pipe& rhs) +{ + // self assignment + if (this == &rhs) return *this; + + // base class assignment + FairModule::operator=(rhs); + + return *this; +} // ----- ConstructGeometry -------------------------------------------------- void Pipe::ConstructGeometry() @@ -77,9 +92,12 @@ void Pipe::ConstructGeometry() } -// ---------------------------------------------------------------------------- - +// ---------------------------------------------------------------------------- +FairModule* Pipe::CloneModule() const +{ + return new Pipe(*this); +} ClassImp(AliceO2::Passive::Pipe) diff --git a/passive/Pipe.h b/passive/Pipe.h index d5f48685f4c45..094abebe639a0 100644 --- a/passive/Pipe.h +++ b/passive/Pipe.h @@ -26,6 +26,13 @@ class Pipe : public FairModule { virtual ~Pipe(); virtual void ConstructGeometry(); + + /// Clone this object (used in MT mode only) + virtual FairModule* CloneModule() const; + + private: + Pipe(const Pipe& orig); + Pipe& operator=(const Pipe&); ClassDef(Pipe,1) //PIPE