rest-for-physics / rest-for-physics/framework
Data structures are difficult to handle
@juanangp is already working on this.
Since Jan 27, 2022.
- Dominant language
- C++
- Stars
- 19
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
Current code design makes difficult to handle data structures, e.g. in TRestHits.h
class TRestHits : public TObject {
public:
Int_t fNHits; ///< Number of punctual energy depositions, it is the length
///< for all the array
Double_t fTotEnergy; ///< Event total energy
std::vector<Float_t> fX; // [fNHits] Position on X axis for each punctual
// deposition (units mm)
std::vector<Float_t> fY; // [fNHits] Position on Y axis for each punctual
// deposition (units mm)
std::vector<Float_t> fZ; // [fNHits] Position on Z axis for each punctual
// deposition (units mm)
std::vector<Float_t> fT; // [fNHits] Absolute time information for each punctual deposition
// (units us, 0 is time of decay)
std::vector<Float_t> fEnergy; // [fNHits] Energy deposited at each
// 3-coordinate position (units keV)
std::vector<REST_HitType> fType; //
Y would suggest to move to a different data structure e.g.
class TRestHit : public TObject {
Float_t fX;
Float_t fY;
Float_t fZ;
Float_t fT;
Float_t fEnergy;
REST_HitType fType;
enum REST_HitType { unknown = -1, X = 2, Y = 3, Z = 5, XY = 6, XZ = 10, YZ = 15, XYZ = 30 };
};
class TRestHits : public TObject {
public:
//fNHits is not needed anymore, it is just hitArray.size( );
Double_t fTotEnergy; ///< Event total energy
std::vector<TRestHit> hitArray; // Array of hits
This would simplify the handling of TRestHits using standard std iterators, for instance this part of the code mimic std iterators:
class TRestHits_Iterator : public std::iterator<std::random_access_iterator_tag, TRestHits_Iterator> {
The implementatio of this proposal would imply a lot of changes in the code and perhaps the root files might loose the backward compatibility, but it will be a big improvement that would simplify the code.
Let me know what do you think, I can help with the migration.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.