Skip to content
414 changes: 401 additions & 13 deletions DataModel/RecoCluster.cpp

Large diffs are not rendered by default.

91 changes: 88 additions & 3 deletions DataModel/RecoCluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
#ifndef RECOCLUSTER_H
#define RECOCLUSTER_H
#include "RecoDigit.h"
#include "Position.h"
#include<SerialisableObject.h>
#include "TVector3.h"
#include "TMatrixDSym.h"
#include "TMatrixDSymEigen.h"
#include "TVectorD.h"
#include "TMath.h"
#include "TF1.h"
#include "Math/IFunction.h"

class RecoCluster : public SerialisableObject {

Expand All @@ -16,19 +24,96 @@ class RecoCluster : public SerialisableObject {
void Reset();
void SortCluster();

void AddDigit(RecoDigit* digit);
void AddDigit(RecoDigit digit);
inline void SetDigits(vector<RecoDigit>* indigits){fDigitList=indigits;}

RecoDigit* GetDigit(int n);
RecoDigit GetDigit(int n);

void SetClusterMode(int cmode);

int GetClusterMode();

std::vector<RecoDigit>* GetDigitList() {return this->fDigitList;}

int GetNDigits();

bool Print() {
cout<<"Number of digits in this cluster : "<<GetNDigits()<<endl;
cout<<"Clustering mode : "<<GetNDigits()<<endl;
return true;
}

inline double GetTime() { return clusterTime; }
inline double GetCharge() { return clusterCharge; }

void CalcTime();
void CalcCharge();

inline double GetCB() { return clusterCB; }
inline Position GetCV() {return ChargeVector; }

void CalcCB();
void CalcAS();
void CalcCV();
void CalcAMD();
void CalcSA();
void CalcAW();
void CalcPlanaritySphericity();
double CalcBeta(int order);
void CalcTR();
void CalcParameters();
int calcBestParent();
double GetAS(int mode);
inline double GetASC(){return ASC;}
inline double GetAMD(){return AMD;}
inline Position GetSA(){return SpatialAverage;}
inline double GetAW(){return AngularWidth;}
inline double GetPlanarity(){return Planarity;}
inline double GetSphericity(){return Sphericity;}
double GetBeta(int order);
inline double GetTimeRangeT() {return TRTotal;}
inline double GetTimeRangeQ() {return TRQ;}
inline double GetTimeRangeC() {return TRCluster;}
inline double GetTRRTQ(){return TRRatioTQ;}
inline double GetTRRTC() { return TRRatioTC; }
inline double GetTRRQC() { return TRRatioQC; }

void SetParticle(int pID,int pPDG, double eff, double pur);
inline int GetBestParent(){return bestParticleID;}
inline void SetPDG(int pPDG) {bestParticlePDG=pPDG;}
inline int GetPDG(){return bestParticlePDG;}
inline double Efficiency(){return efficiency;}
inline double Purity(){return purity;}

bool CheckFilter();
inline bool GetFilterStatus(){return fIsFiltered;}
//void CleanDigits();

private:
double clusterTime;
double clusterCharge;
double clusterCB;
double AS0, AS1, ASC;
double AMD;
Position ChargeVector;
Position SpatialAverage;
double AngularWidth;
double Planarity=-999;
double Sphericity=-999;
std::map<int,double> BetaParameters;
double TRTotal, TRQ, TRCluster;
double TRRatioTQ, TRRatioTC,TRRatioQC;
int bestParticleID;
int bestParticlePDG;
double efficiency;
double purity;
bool fIsFiltered=0;


int fClusterMode = -999;
std::vector<RecoDigit>* fDigitList;
Position TwoDCenter;

std::vector<RecoDigit*> fDigitList;

protected:
template<class Archive> void serialize(Archive & ar, const unsigned int version){
Expand Down
22 changes: 22 additions & 0 deletions DataModel/RecoDigit.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,32 @@ class RecoDigit : public SerialisableObject{
fIsFiltered = 1;
ANNIERecoObjectTable::Instance()->NewDigit();
}
RecoDigit(RecoDigit* origin) {
serialise=true;
fRegion=origin->GetRegion();
fPosition = origin->GetPosition();
fCalTime = origin->GetCalTime();
fCalCharge=origin->GetCalCharge();
fDigitType=origin->GetDigitType();
fDetectorID=origin->GetDetectorID();
fIsFiltered=origin->GetFilterStatus();

}
~RecoDigit() {/*ANNIERecoObjectTable::Instance()->DeleteDigit();*/}

bool operator<(const RecoDigit other) const {
return (fPosition.X() == other.GetPosition().X()) ? fPosition.Y() < other.GetPosition().Y() : fPosition.X() < other.GetPosition().X();
}

inline int GetRegion() const {return fRegion;}
inline Position GetPosition() const {return fPosition;}
inline double GetCalTime() const {return fCalTime;}
inline double GetCalCharge() const {return fCalCharge;}
inline bool GetFilterStatus() const {return fIsFiltered;}
inline vector<int> GetClusteredModes() { return fClusterMode; }
inline int GetDigitType() const {return fDigitType;}
inline int GetDetectorID() const {return fDetectorID;}
inline std::vector<int> GetParents() const {return Parents;}

inline void SetRegion(int reg) {fRegion = reg;}
inline void SetPosition(Position pos){fPosition = pos;}
Expand All @@ -52,6 +69,9 @@ class RecoDigit : public SerialisableObject{
inline void SetFilter(bool pass = 1) { fIsFiltered = pass;}
inline void ResetFilter() {SetFilter(0);}
inline void PassFilter() {SetFilter(1);}
inline void AddCluster(int InClusterMode) {fClusterMode.push_back(InClusterMode); }
inline void UnCluster(){fClusterMode.pop_back(); }
inline void SetParents(std::vector<int> parentsin) { Parents = parentsin; }

bool Print() {
cout<<"Region : "<<fRegion<<endl;
Expand All @@ -70,8 +90,10 @@ class RecoDigit : public SerialisableObject{
double fCalTime;
double fCalCharge;
bool fIsFiltered;
vector<int> fClusterMode;
int fDigitType;
int fDetectorID;
std::vector<int> Parents;

template<class Archive> void serialize(Archive & ar, const unsigned int version){
if(serialise){
Expand Down
Loading