Skip to content

Commit 610aaf2

Browse files
committed
Simplify hits: Cut inheritance from TObject/FairMultiLink_Interface
Major milestone in memory footprint reduction: Hits are now lean, non-virtual data objects * accompanying removal of FairLink references * renaming o2::TPC::LinkableHitGroup -> o2::TPC::HitGroup since the name "Linkable" referred to FairLinks * adding missing header for FairRootManager which was implicitely available through removed FairMultiLink_Interface * disabling one broken ROOT macro which needs major revision (is was broken before but the compilation complained now)
1 parent b8f85e5 commit 610aaf2

20 files changed

Lines changed: 35 additions & 63 deletions

File tree

DataFormats/simulation/include/SimulationDataFormat/BaseHits.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#ifndef ALICEO2_BASE_HIT_H
1212
#define ALICEO2_BASE_HIT_H
13-
#include "FairMultiLinkedData_Interface.h"
1413
#include "MathUtils/Cartesian3D.h"
1514

1615
namespace o2
@@ -22,7 +21,7 @@ namespace o2
2221
// at the moment ony GetTrackID() used by Stack.h
2322
// eventually we could add some interfaces to retrieve
2423
// the coordinates as floats or something
25-
class BaseHit : public FairMultiLinkedData_Interface
24+
class BaseHit
2625
{
2726
public:
2827
BaseHit() = default;
@@ -32,7 +31,7 @@ class BaseHit : public FairMultiLinkedData_Interface
3231

3332
private:
3433
int mTrackID = 0; // track_id
35-
ClassDefOverride(BaseHit, 1);
34+
ClassDefNV(BaseHit, 1);
3635
};
3736

3837
// a set of configurable classes to define basic hit types
@@ -84,7 +83,7 @@ class BasicXYZEHit : public BaseHit
8483
}
8584
void SetPos(Point3D<T> const &p) { mPos = p; }
8685

87-
ClassDefOverride(BasicXYZEHit, 1);
86+
ClassDefNV(BasicXYZEHit, 1);
8887
};
8988

9089
} // end namespace AliceO2

DataFormats/simulation/src/Stack.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "FairLogger.h" // for MESSAGE_ORIGIN, FairLogger
2121
#include "SimulationDataFormat/BaseHits.h"
2222
#include "FairGenericRootManager.h" // for FairGenericRootManager
23+
#include "FairRootManager.h"
2324

2425
#include "TClonesArray.h" // for TClonesArray
2526
#include "TIterator.h" // for TIterator
@@ -333,7 +334,6 @@ void Stack::UpdateTrackIndex(TRefArray *detList)
333334
Fatal("Stack::UpdateTrackIndex", "Track index not found in map");
334335
}
335336
point->SetTrackID((*mIndexIterator).second);
336-
point->SetLink(FairLink("MCTrack", (*mIndexIterator).second));
337337
}
338338

339339
} // Collections of this detector

DataFormats/simulation/test/testBasicHits.cxx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,14 @@ BOOST_AUTO_TEST_CASE(BasicXYZHit_ROOTIO)
5151
// try writing hit to a TBuffer
5252
{
5353
TFile fout("HitsIO.root", "RECREATE");
54-
fout.WriteTObject(&hit, "TestObject");
54+
fout.WriteObject(&hit, "TestObject");
5555
fout.Close();
5656
}
5757

5858
{
5959
TFile fin("HitsIO.root");
60-
TObject* obj = (TObject*)fin.Get("TestObject");
60+
HitType* obj = nullptr;
61+
fin.GetObject("TestObject", obj);
6162

6263
BOOST_CHECK(obj != nullptr);
6364
fin.Close();
@@ -70,13 +71,14 @@ BOOST_AUTO_TEST_CASE(BasicXYZHit_ROOTIO)
7071
// try writing hit to a TBuffer
7172
{
7273
TFile fout("HitsIO.root", "RECREATE");
73-
fout.WriteTObject(&hitD, "TestObject");
74+
fout.WriteObject(&hitD, "TestObject");
7475
fout.Close();
7576
}
7677

7778
{
7879
TFile fin("HitsIO.root");
79-
TObject* obj = (TObject*)fin.Get("TestObject");
80+
HitTypeD* obj = nullptr;
81+
fin.GetObject("TestObject", obj);
8082

8183
BOOST_CHECK(obj != nullptr);
8284
fin.Close();

Detectors/Base/include/DetectorsBase/Detector.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <memory>
2020

2121
#include "FairDetector.h" // for FairDetector
22+
#include "FairRootManager.h"
2223
#include "Rtypes.h" // for Float_t, Int_t, Double_t, Detector::Class, etc
2324
#include <cxxabi.h>
2425
#include <typeinfo>

Detectors/EMCAL/base/include/EMCALBase/Hit.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class Hit : public o2::BasicXYZEHit<float>
6868
Hit operator+(const Hit& rhs) const;
6969

7070
/// \brief Destructor
71-
~Hit() override = default;
71+
~Hit() = default;
7272

7373
/// \brief Get the initial energy of the primary particle entering EMCAL
7474
/// \return Energy of the primary particle entering EMCAL
@@ -104,7 +104,7 @@ class Hit : public o2::BasicXYZEHit<float>
104104
Int_t mParent; ///< Parent particle that entered the EMCAL
105105
Double32_t mInitialEnergy; ///< Energy of the parent particle that entered the EMCAL
106106

107-
ClassDefOverride(Hit, 1);
107+
ClassDefNV(Hit, 1);
108108
};
109109

110110
std::ostream& operator<<(std::ostream& stream, const Hit& point);

Detectors/EMCAL/testsimulation/run_sim_emcal.C

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ void run_sim_emcal(Int_t nEvents = 10, TString mcEngine = "TGeant3")
5858

5959
// Create simulation run
6060
FairRunSim* run = new FairRunSim();
61-
// enable usage of the fair link mechanism
62-
run->SetUseFairLinks(kTRUE);
6361

6462
run->SetName(mcEngine); // Transport engine
6563
run->SetOutputFile(outFile); // Output file

Detectors/ITSMFT/common/simulation/include/ITSMFTSimulation/Hit.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class Hit : public o2::BasicXYZEHit<Float_t,Float_t>
9494
Bool_t IsAliveStart() const { return mTrackStatusStart & kTrackAlive; }
9595

9696
/// Output to screen
97-
void Print(const Option_t *opt) const override;
97+
void Print(const Option_t *opt) const;
9898
friend std::ostream &operator<<(std::ostream &of, const Hit &point)
9999
{
100100
of << "-I- Hit: O2its point for track " << point.GetTrackID() << " in detector " << point.GetDetectorID() << std::endl;
@@ -131,7 +131,7 @@ class Hit : public o2::BasicXYZEHit<Float_t,Float_t>
131131
UChar_t mTrackStatusEnd; ///< MC status flag at exit
132132
UChar_t mTrackStatusStart; ///< MC status at starting point
133133

134-
ClassDefOverride(Hit, 3)
134+
ClassDefNV(Hit, 3)
135135
};
136136

137137
Hit::Hit(int trackID, unsigned short detID, const TVector3& startPos, const TVector3& endPos, const TVector3& startMom,

Detectors/TPC/simulation/include/TPCSimulation/Detector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class Detector: public o2::Base::Detector {
127127
void DefineSensitiveVolumes();
128128

129129
/** container for produced hits */
130-
std::vector<LinkableHitGroup>* mHitsPerSectorCollection[Sector::MAXSECTOR]; //! container that keeps track-grouped hits per sector
130+
std::vector<HitGroup>* mHitsPerSectorCollection[Sector::MAXSECTOR]; //! container that keeps track-grouped hits per sector
131131

132132
TString mGeoFileName; ///< Name of the file containing the TPC geometry
133133
size_t mEventNr; //!< current event number

Detectors/TPC/simulation/include/TPCSimulation/Digitizer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class Digitizer {
7171
/// Steer conversion of points to digits
7272
/// \param points Container with TPC points
7373
/// \return digits container
74-
DigitContainer* Process(const std::vector<o2::TPC::LinkableHitGroup>& hits);
74+
DigitContainer* Process(const std::vector<o2::TPC::HitGroup>& hits);
7575

7676
DigitContainer *getDigitContainer() const { return mDigitContainer; }
7777

Detectors/TPC/simulation/include/TPCSimulation/DigitizerTask.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class DigitizerTask : public FairTask{
7979
bool mDigitDebugOutput; ///< Switch for the debug output of the DigitMC
8080
int mHitSector=-1; ///< which sector to treat
8181

82-
const std::vector<o2::TPC::LinkableHitGroup> *mSectorHitsArray[Sector::MAXSECTOR];
82+
const std::vector<o2::TPC::HitGroup> *mSectorHitsArray[Sector::MAXSECTOR];
8383

8484
ClassDefOverride(DigitizerTask, 1);
8585
};

0 commit comments

Comments
 (0)