Skip to content

Commit

Permalink
Solved some issues with the data structures
Browse files Browse the repository at this point in the history
clang-format

Minor change

Revert changes
  • Loading branch information
jose-luis-rs authored and hapol committed Feb 27, 2023
1 parent 73feb4e commit b67f31f
Show file tree
Hide file tree
Showing 22 changed files with 66 additions and 158 deletions.
1 change: 0 additions & 1 deletion r3bdata/R3BMCTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

class R3BMCTrack : public TObject
{

public:
/** Default constructor **/
R3BMCTrack();
Expand Down
14 changes: 7 additions & 7 deletions r3bdata/califaData/R3BCalifaClusterData.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ R3BCalifaClusterData::R3BCalifaClusterData()
}

R3BCalifaClusterData::R3BCalifaClusterData(std::vector<Int_t> crystalList,
Double_t ene,
Double_t nf,
Double_t ns,
Double_t theta,
Double_t phi,
ULong64_t time,
Int_t clusterType)
Double_t ene,
Double_t nf,
Double_t ns,
Double_t theta,
Double_t phi,
ULong64_t time,
Int_t clusterType)
: FairMultiLinkedData()
, fCrystalList(crystalList)
, fEnergy(ene)
Expand Down
33 changes: 19 additions & 14 deletions r3bdata/califaData/R3BCalifaClusterData.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,18 @@ class R3BCalifaClusterData : public FairMultiLinkedData
*@param fTheta Reconstructed theta
*@param fPhi Reconstructed phi
**/
R3BCalifaClusterData(std::vector<Int_t> crystalList, Double_t ene, Double_t nf, Double_t ns, Double_t theta, Double_t phi, ULong64_t time,Int_t clusterType);
R3BCalifaClusterData(std::vector<Int_t> crystalList,
Double_t ene,
Double_t nf,
Double_t ns,
Double_t theta,
Double_t phi,
ULong64_t time,
Int_t clusterType);

/** Copy constructor **/
R3BCalifaClusterData(const R3BCalifaClusterData&);


R3BCalifaClusterData& operator=(const R3BCalifaClusterData&) { return *this; }

/** Destructor **/
Expand All @@ -50,11 +56,10 @@ class R3BCalifaClusterData : public FairMultiLinkedData
Double_t GetPhi() const { return fPhi; }
ULong64_t GetTime() const { return fTime; }
uint32_t GetClusterType() const { return fClusterType; }
Int_t GetNbOfCrystalHits() const { return fCrystalList.size(); }

std::vector<Int_t> GetCrystalList() const {return fCrystalList; }
Int_t GetMotherCrystal() const {return fCrystalList.at(0); }
Int_t GetNbOfCrystalHits() const { return fCrystalList.size(); }

std::vector<Int_t> GetCrystalList() const { return fCrystalList; }
Int_t GetMotherCrystal() const { return fCrystalList.at(0); }

/** Modifiers **/
void SetEnergy(Double_t ene) { fEnergy = ene; }
Expand All @@ -64,15 +69,15 @@ class R3BCalifaClusterData : public FairMultiLinkedData
void SetPhi(Double_t phi) { fPhi = phi; }
void SetTime(ULong64_t time) { fTime = time; }
void SetClusterType(uint32_t id) { fClusterType = id; }
void SetCrystalList(std::vector<Int_t> list) {fCrystalList = std::move(list);}
protected:
void SetCrystalList(std::vector<Int_t> list) { fCrystalList = std::move(list); }

Double_t fEnergy; // total energy deposited
Double_t fNf; // total Nf deposited
Double_t fNs; // total Ns deposited
Double_t fTheta; // reconstructed theta
Double_t fPhi; // reconstructed phi
ULong64_t fTime; // WR time stamp
protected:
Double_t fEnergy; // total energy deposited
Double_t fNf; // total Nf deposited
Double_t fNs; // total Ns deposited
Double_t fTheta; // reconstructed theta
Double_t fPhi; // reconstructed phi
ULong64_t fTime; // WR time stamp
uint32_t fClusterType;
std::vector<Int_t> fCrystalList; // List with crystals inside the cluster. First one is the mother crystal

Expand Down
16 changes: 1 addition & 15 deletions r3bdata/califaData/R3BCalifaPoint.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@

#include <iostream>

using std::cout;
using std::endl;
using std::flush;

R3BCalifaPoint::R3BCalifaPoint()
: FairMCPoint()
, fCrystalId(-1)
Expand All @@ -41,7 +37,7 @@ R3BCalifaPoint::R3BCalifaPoint(Int_t trackID,
: FairMCPoint(trackID, detID, posIn, momIn, tof, length, eLoss, EventId)
, fCrystalId(ident)
, fNf(Nf)
, fNs(Nf)
, fNs(Ns)
{
}

Expand All @@ -55,14 +51,4 @@ R3BCalifaPoint::R3BCalifaPoint(const R3BCalifaPoint& right)

R3BCalifaPoint::~R3BCalifaPoint() {}

void R3BCalifaPoint::Print(const Option_t* opt) const
{
cout << "R3BCalifaPoint: CALIFA Point for track " << fTrackID << " in crystal " << fCrystalId << endl;
cout << " Position (" << fX << ", " << fY << ", " << fZ << ") cm" << endl;
cout << " Momentum (" << fPx << ", " << fPy << ", " << fPz << ") GeV" << endl;
cout << " Time " << fTime << " ns, Length " << fLength << " cm, Energy loss " << fELoss * 1.0e06 << " keV"
<< endl;
cout << "Nf " << fNf << ", Ns " << fNs << endl;
}

ClassImp(R3BCalifaPoint);
4 changes: 0 additions & 4 deletions r3bdata/califaData/R3BCalifaPoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

class R3BCalifaPoint : public FairMCPoint
{

public:
/** Default constructor **/
R3BCalifaPoint();
Expand Down Expand Up @@ -68,9 +67,6 @@ class R3BCalifaPoint : public FairMCPoint
Double_t GetNs() const { return fNs; }
void PositionIn(TVector3& pos) { pos.SetXYZ(fX, fY, fZ); }

/** Output to screen **/
virtual void Print(const Option_t* opt) const;

protected:
Int_t fCrystalId; ///< crystal index
Double32_t fNf, fNs; ///< nf, ns components
Expand Down
34 changes: 0 additions & 34 deletions r3bdata/dchData/R3BDchFullPoint.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@

#include <iostream>

using std::cout;
using std::endl;
using std::flush;

// ----- Default constructor -------------------------------------------
R3BDchFullPoint::R3BDchFullPoint()
: FairMCPoint()
Expand Down Expand Up @@ -63,39 +59,9 @@ R3BDchFullPoint::R3BDchFullPoint(Int_t trackId,
, fCell(cell)
{
}
// -------------------------------------------------------------------------

R3BDchFullPoint::R3BDchFullPoint(const R3BDchFullPoint& right)
: FairMCPoint(right)
, fLocalX(right.fLocalX)
, fLocalY(right.fLocalY)
, fLocalZ(right.fLocalZ)
, fLocalPx(right.fLocalPx)
, fLocalPy(right.fLocalPy)
, fLocalPz(right.fLocalPz)
, fModule(right.fModule)
, fLayer(right.fLayer)
, fCell(right.fCell)
{
}

// ----- Destructor ----------------------------------------------------
R3BDchFullPoint::~R3BDchFullPoint() {}
// -------------------------------------------------------------------------

// ----- Public method Print -------------------------------------------
void R3BDchFullPoint::Print(const Option_t* opt) const
{
cout << "-I- R3BDchFullPoint: STS Point for track " << fTrackID << " in detector " << fDetectorID << endl;
cout << " Position (" << fX << ", " << fY << ", " << fZ << ") cm" << endl;
cout << " Momentum (" << fPx << ", " << fPy << ", " << fPz << ") GeV" << endl;
cout << " Time " << fTime << " ns, Length " << fLength << " cm, Energy loss " << fELoss * 1.0e06 << " keV"
<< endl;
}
// -------------------------------------------------------------------------

// ----- Public method IsUsable ----------------------------------------
Bool_t R3BDchFullPoint::IsUsable() const { return kTRUE; }
// -------------------------------------------------------------------------

ClassImp(R3BDchFullPoint)
12 changes: 0 additions & 12 deletions r3bdata/dchData/R3BDchFullPoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

class R3BDchFullPoint : public FairMCPoint
{

public:
/** Default constructor **/
R3BDchFullPoint();
Expand Down Expand Up @@ -57,11 +56,6 @@ class R3BDchFullPoint : public FairMCPoint
Double_t length,
Double_t eLoss);

/** Copy constructor **/
R3BDchFullPoint(const R3BDchFullPoint&);

R3BDchFullPoint& operator=(const R3BDchFullPoint&) { return *this; }

/** Destructor **/
virtual ~R3BDchFullPoint();

Expand All @@ -74,12 +68,6 @@ class R3BDchFullPoint : public FairMCPoint
Double_t GetLocalPy() const { return fLocalPy; }
Double_t GetLocalPz() const { return fLocalPz; }

/** Check for distance between in and out **/
Bool_t IsUsable() const;

/** Output to screen **/
virtual void Print(const Option_t* opt) const;

protected:
Double32_t fLocalX, fLocalY, fLocalZ;
Double32_t fLocalPx, fLocalPy, fLocalPz;
Expand Down
2 changes: 1 addition & 1 deletion r3bdata/mtofData/R3BmTofDigi.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ R3BmTofDigi::R3BmTofDigi(Int_t ntmul,
R3BmTofDigi::~R3BmTofDigi() {}

// ----- Public method Print -------------------------------------------
void R3BmTofDigi::Print(const Option_t* opt) const {}
void R3BmTofDigi::Print(const Option_t*) const {}
// -------------------------------------------------------------------------

ClassImp(R3BmTofDigi)
5 changes: 1 addition & 4 deletions r3bdata/mtofData/R3BmTofDigi.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,11 @@ class R3BmTofDigi : public TObject
Double_t ntfpz,
Double_t ntfe);

/** Copy constructor **/
R3BmTofDigi(const R3BmTofDigi& point) { *this = point; };

/** Destructor **/
virtual ~R3BmTofDigi();

/** Output to screen **/
virtual void Print(const Option_t* opt) const;
virtual void Print(const Option_t* opt = "") const;

void Setntmul(Int_t mul) { Ntmul = mul; }
Double_t Getntmul() { return Ntmul; }
Expand Down
2 changes: 0 additions & 2 deletions r3bdata/mwpcData/R3BMwpcHitData.h
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ class R3BMwpcHitData : public TObject
inline const Double_t& GetY() const { return fY; }
inline const Int_t& GetPlane() const { return fPlane; }



/** Modifiers **/
void SetX(Double_t x) { fX = x; };
void SetY(Double_t y) { fY = y; };
Expand Down
42 changes: 23 additions & 19 deletions r3bdata/neulandData/R3BNeulandCluster.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@

R3BNeulandHit R3BNeulandCluster::GetForemostHit() const
{
auto min = std::min_element(fHits.cbegin(), fHits.cend(), [](const R3BNeulandHit& a, const R3BNeulandHit& b) {
return a.GetPosition().Z() < b.GetPosition().Z();
});
auto min = std::min_element(fHits.cbegin(),
fHits.cend(),
[](const R3BNeulandHit& a, const R3BNeulandHit& b)
{ return a.GetPosition().Z() < b.GetPosition().Z(); });
if (min == fHits.end())
{
throw std::logic_error("R3BNeulandCluster::GetFirstHit(): Cluster has no Hits!");
Expand All @@ -30,9 +31,9 @@ R3BNeulandHit R3BNeulandCluster::GetForemostHit() const

R3BNeulandHit R3BNeulandCluster::GetFirstHit() const
{
auto min = std::min_element(fHits.cbegin(), fHits.cend(), [](const R3BNeulandHit& a, const R3BNeulandHit& b) {
return a.GetT() < b.GetT();
});
auto min = std::min_element(fHits.cbegin(),
fHits.cend(),
[](const R3BNeulandHit& a, const R3BNeulandHit& b) { return a.GetT() < b.GetT(); });
if (min == fHits.end())
{
throw std::logic_error("R3BNeulandCluster::GetFirstHit(): Cluster has no Hits!");
Expand All @@ -42,9 +43,9 @@ R3BNeulandHit R3BNeulandCluster::GetFirstHit() const

R3BNeulandHit R3BNeulandCluster::GetLastHit() const
{
auto max = std::max_element(fHits.cbegin(), fHits.cend(), [](const R3BNeulandHit& a, const R3BNeulandHit& b) {
return a.GetT() < b.GetT();
});
auto max = std::max_element(fHits.cbegin(),
fHits.cend(),
[](const R3BNeulandHit& a, const R3BNeulandHit& b) { return a.GetT() < b.GetT(); });
if (max == fHits.end())
{
throw std::logic_error("R3BNeulandCluster::GetLastHit(): Cluster has no Hits!");
Expand All @@ -54,9 +55,9 @@ R3BNeulandHit R3BNeulandCluster::GetLastHit() const

R3BNeulandHit R3BNeulandCluster::GetMaxEnergyHit() const
{
auto max = std::max_element(fHits.cbegin(), fHits.cend(), [](const R3BNeulandHit& a, const R3BNeulandHit& b) {
return a.GetE() < b.GetE();
});
auto max = std::max_element(fHits.cbegin(),
fHits.cend(),
[](const R3BNeulandHit& a, const R3BNeulandHit& b) { return a.GetE() < b.GetE(); });
if (max == fHits.end())
{
throw std::logic_error("R3BNeulandCluster::GetLastHit(): Cluster has no Hits!");
Expand All @@ -77,19 +78,22 @@ TVector3 R3BNeulandCluster::GetPosition() const { return GetFirstHit().GetPositi
TVector3 R3BNeulandCluster::GetEnergyCentroid() const
{
// analog to Geometrical Centroid \vec{c} = \frac{\sum_i (\vec{r}_{i} \cdot V_i)}{\sum_i V_i}
TVector3 centroid =
std::accumulate(fHits.cbegin(), fHits.cend(), TVector3(), [](const TVector3& c, const R3BNeulandHit& hit) {
return c + (hit.GetPosition() * hit.GetE());
});
TVector3 centroid = std::accumulate(fHits.cbegin(),
fHits.cend(),
TVector3(),
[](const TVector3& c, const R3BNeulandHit& hit)
{ return c + (hit.GetPosition() * hit.GetE()); });
return centroid * (1. / GetE());
}

Double_t R3BNeulandCluster::GetEnergyMoment() const
{
const TVector3 centroid = GetEnergyCentroid();
Double_t mom = std::accumulate(fHits.cbegin(), fHits.cend(), 0., [&](const Double_t c, const R3BNeulandHit& hit) {
return c + (hit.GetPosition() - centroid).Mag() * hit.GetE();
});
Double_t mom = std::accumulate(fHits.cbegin(),
fHits.cend(),
0.,
[&](const Double_t c, const R3BNeulandHit& hit)
{ return c + (hit.GetPosition() - centroid).Mag() * hit.GetE(); });
return mom / GetE();
}

Expand Down
6 changes: 3 additions & 3 deletions r3bdata/pdcData/R3BPdcCalData.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class R3BPdcCalData : public TObject
Double_t GetTime_ns() const;

private:
UInt_t fPlane; // 1..n
UInt_t fWire; // 1..n
UInt_t fEdge; // 1 = leading, 2 = trailing
UInt_t fPlane; // 1..n
UInt_t fWire; // 1..n
UInt_t fEdge; // 1 = leading, 2 = trailing
Double_t fTime_ns;

public:
Expand Down
2 changes: 1 addition & 1 deletion r3bdata/pdcData/R3BPdcHitData.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class R3BPdcHitData : public R3BHit
virtual ~R3BPdcHitData() {}
Int_t GetWireId() const;

private:
private:
Int_t fWireId;

ClassDef(R3BPdcHitData, 2)
Expand Down
6 changes: 3 additions & 3 deletions r3bdata/pdcData/R3BPdcMappedData.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class R3BPdcMappedData : public TObject
UInt_t GetTimeFine() const;

private:
UInt_t fPlane; // 1..n
UInt_t fWire; // 1..n
UInt_t fEdge; // 1 = leading, 2 = trailing
UInt_t fPlane; // 1..n
UInt_t fWire; // 1..n
UInt_t fEdge; // 1 = leading, 2 = trailing
UInt_t fTimeCoarse;
UInt_t fTimeFine;

Expand Down
Loading

0 comments on commit b67f31f

Please sign in to comment.