Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Base/BaseLinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -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+;

Expand Down
1 change: 0 additions & 1 deletion Base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ ${ROOT_LIBRARY_DIR}
link_directories( ${LINK_DIRECTORIES})

set(SRCS
Module.cxx
Detector.cxx
TrackReference.cxx
)
Expand Down
14 changes: 14 additions & 0 deletions Base/Detector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
5 changes: 2 additions & 3 deletions Base/Detector.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
72 changes: 0 additions & 72 deletions Base/Module.cxx

This file was deleted.

70 changes: 0 additions & 70 deletions Base/Module.h

This file was deleted.

105 changes: 92 additions & 13 deletions Data/Stack.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
Expand Down Expand Up @@ -134,15 +184,19 @@ 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");
}

// Return the iPrim-th TParticle from the fParticle array. This should be
// 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");
}

Expand All @@ -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;
Expand All @@ -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();
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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()
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -404,4 +478,9 @@ void Stack::SelectTracks()
}
}

FairGenericStack* Stack::CloneStack() const
{
return new AliceO2::Data::Stack(*this);
}

ClassImp(AliceO2::Data::Stack)
Loading