JeffersonLab / hcana

Hall C++ Analyzer
7 stars 118 forks source link

Source code file directories and names #417

Open whit2333 opened 5 years ago

whit2333 commented 5 years ago

It would be good to structure the source code better.

Suggestions: 1) Put the interface headers in an include directory. This nearly all the header files I think. 2) Put (and install) the header files in their own directory. For example include/hcana/HEADER.h. 3) This leads to use cases like:

#include "hcana/THcParmList.h"

(note this doesn't have to happen in the current source code include directories can be added to compiler flags).

4) This header name space then leads to clearer class names. (Using class name prefixes is old fashioned and ignores the namespace feature of C++).

#include "hcana/ParameterList.h"

5) Clearer header file and class names leads us finally to functional separation. Perhaps by detector type: (note this is just a suggestion)

#include "hcana/cer/Cherenkov.h"
#include "hcana/cer/CherenkovHit.h"

Here is how it could look:

hcana/include
├── beam
│   ├── BCMCurrent.h
│   ├── RasteredBeam.h
│   ├── Raster.h
│   └── RasterRawHit.h
├── cer
│   ├── Aerogel.h
│   ├── AerogelHit.h
│   ├── Cherenkov.h
│   └── CherenkovHit.h
├── core
│   ├── Analyzer.h
│   ├── ConfigEvtHandler.h
│   ├── DetectorMap.h
│   ├── DummySpectrometer.h
│   ├── Formula.h
│   ├── Globals.h
│   ├── HallCSpectrometer.h
│   ├── HitList.h
│   ├── Interface.h
│   ├── ParmList.h
│   ├── PeriodicReport.h
│   ├── Run.h
│   ├── RunParameters.h
│   └── SignalHit.h
├── dc
│   ├── DC.h
│   ├── DCHit.h
│   ├── DCLookupTTDConv.h
│   ├── DCTimeToDistConv.h
│   ├── DCTrack.h
│   ├── DCWire.h
│   ├── DriftChamber.h
│   └── DriftChamberPlane.h
├── hodo
│   ├── HodoEff.h
│   ├── HodoHit.h
│   ├── Hodoscope.h
│   └── ScintillatorPlane.h
├── phys
├── raw
│   ├── RawAdcHit.h
│   ├── RawDCHit.h
│   ├── RawHit.h
│   ├── RawHodoHit.h
│   ├── RawShowerHit.h
│   └── RawTdcHit.h
├── recon
│   ├── CoinTime.h
│   ├── ExtTarCor.h
│   ├── PrimaryKine.h
│   ├── ReactionPoint.h
│   ├── SecondaryKine.h
│   └── SpacePoint.h
├── scaler
│   ├── Scaler9001.h
│   ├── Scaler9250.h
│   └── ScalerEvtHandler.h
├── shower
│   ├── ShowerArray.h
│   ├── Shower.h
│   ├── ShowerHit.h
│   └── ShowerPlane.h
└── trig
    ├── TimeSyncEvtHandler.h
    ├── TrigApp.h
    ├── TrigDet.h
    ├── TrigRawHit.h
    └── TIBlobModule.h

Again, this is just a suggestion to help others understand the code, and is common practice in C++ projects.