Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hmpi dclusters #7965

Merged
merged 14 commits into from
Feb 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 92 additions & 28 deletions DataFormats/Detectors/HMPID/include/DataFormatsHMP/Cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
#ifndef DETECTORS_HMPID_BASE_INCLUDE_HMPIDDATAFORMAT_CLUSTER_H_
#define DETECTORS_HMPID_BASE_INCLUDE_HMPIDDATAFORMAT_CLUSTER_H_

#include "CommonDataFormat/InteractionRecord.h"
#include "CommonDataFormat/RangeReference.h"
#include "DataFormatsHMP/Digit.h"
#include "HMPIDBase/Param.h"

namespace o2
{
namespace hmpid
Expand All @@ -21,39 +26,98 @@ namespace hmpid
class Cluster
{
public:
Cluster() = default;

Cluster(int chamber, int size, int NlocMax, float QRaw, float Q, float X, float Y);
~Cluster() = default;

int getCh() const { return mChamber; }
void setCh(int chamber) { mChamber = chamber; }

int getSize() const { return mSize; }
void setSize(int size) { mSize = size; }
enum EClusterStatus { kFrm,
kCoG,
kLo1,
kUnf,
kMax,
kNot,
kEdg,
kSi1,
kNoLoc,
kAbn,
kBig,
kEmp = -1 }; // status flags

int getQRaw() const { return mQRaw; }
void setQRaw(int QRaw) { mQRaw = QRaw; }
public:
Cluster() : mCh(-1), mSi(-1), mSt(kEmp), mBox(-1), mNlocMax(-1), mMaxQpad(-1), mMaxQ(-1), mQRaw(0), mQ(0), mErrQ(-1), mXX(0), mErrX(-1), mYY(0), mErrY(-1), mChi2(-1), mParam(o2::hmpid::Param::instanceNoGeo()) { mDigs.clear(); };
// Cluster(int chamber, int size, int NlocMax, float QRaw, float Q, float X, float Y)
// : mCh(chamber), mSi(size), mNlocMax(NlocMax), mQRaw(QRaw), mQ(Q), mXX(X), mYY(Y) { };

int getQ() const { return mQ; }
void setQ(int Q) { mQ = Q; }
// Methods
// void draw(Option_t *opt=""); //overloaded TObject::Print() to draw cluster in current canvas
void print(Option_t* opt = "") const; // overloaded TObject::Print() to print cluster info
static void fitFunc(int& iNpars, double* deriv, double& chi2, double* par, int iflag); // fit function to be used by MINUIT
void coG(); // calculates center of gravity
void corrSin(); // sinoidal correction
void digAdd(o2::hmpid::Digit* pDig); // add new digit to the cluster
o2::hmpid::Digit* dig(int i) { return mDigs.at(i); } // pointer to i-th digi
inline bool isInPc(); // check if is in the current PC
void reset(); // cleans the cluster
// void setClusterParams(float xL, float yL, int iCh); //Set AliCluster3D part
int solve(std::vector<o2::hmpid::Cluster>* pCluLst, float* pSigmaCut, bool isUnfold); // solve cluster: MINUIT fit or CoG
// Getters
int box() { return mBox; } // Dimension of the cluster
int ch() { return mCh; } // chamber number
int size() { return mSi; } // returns number of pads in formed cluster
int status() { return mSt; } // Status of cluster
float qRaw() { return mQRaw; } // raw cluster charge in QDC channels
float q() { return mQ; } // given cluster charge in QDC channels
float qe() { return mErrQ; } // Error in cluster charge in QDC channels
float x() { return mXX; } // cluster x position in LRS
float xe() { return mErrX; } // cluster charge in QDC channels
float y() { return mYY; } // cluster y position in LRS
float ye() { return mErrY; } // cluster charge in QDC channels
float chi2() { return mChi2; } // chi2 of the fit
// Setters
void doCorrSin(bool doCorrSin) { fgDoCorrSin = doCorrSin; } // Set sinoidal correction
void setX(float x) { mXX = x; }
void setY(float y) { mYY = y; }
void setQ(float q)
{
mQ = q;
if (mQ > 4095) {
mQ = 4095;
}
}
void setQRaw(float qRaw)
{
mQRaw = qRaw;
if (mQRaw > 4095) {
mQRaw = 4095;
}
}
void setSize(int size) { mSi = size; }
void setCh(int chamber) { mCh = chamber; }
void setChi2(float chi2) { mChi2 = chi2; }
void setStatus(int status) { mSt = status; }
void findClusterSize(int i, float* pSigmaCut); // Find the clusterSize of deconvoluted clusters
virtual void clear(const Option_t*) { delete[] & mDigs; } // ===> delete [] fParam; fParam=0; }

int getX() const { return mX; }
void setX(int X) { mX = X; }
// public:
protected:
int mCh; // chamber number
int mSi; // size of the formed cluster from which this cluster deduced
int mSt; // flag to mark the quality of the cluster
int mBox; // box contaning this cluster
int mNlocMax; // number of local maxima in formed cluster
int mMaxQpad; // abs pad number of a pad with the highest charge
double mMaxQ; // that max charge value
double mQRaw; // QDC value of the raw cluster
double mQ; // QDC value of the actual cluster
double mErrQ; // error on Q
double mXX; // local x postion, [cm]
double mErrX; // error on x postion, [cm]
double mYY; // local y postion, [cm]
double mErrY; // error on y postion, [cm]
double mChi2; // some estimator of the fit quality
std::vector<o2::hmpid::Digit*> mDigs; //! list of digits forming this cluster

int getY() const { return mY; }
void setY(int Y) { mY = Y; }
public:
static bool fgDoCorrSin; // flag to switch on/off correction for Sinusoidal to cluster reco
Param* mParam; //! Pointer to AliHMPIDParam

protected:
int mChamber; /// chamber number
int mSize; /// size of the formed cluster from which this cluster deduced
int mNlocMax; /// number of local maxima in formed cluster
float mQRaw; /// QDC value of the raw cluster
float mQ; /// QDC value of the actual cluster
float mX; /// local x postion, [cm]
float mY; /// local y postion, [cm]

ClassDefNV(Cluster, 1);
ClassDefNV(Cluster, 2);
};

} // namespace hmpid
Expand Down
29 changes: 16 additions & 13 deletions DataFormats/Detectors/HMPID/include/DataFormatsHMP/Digit.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

// History
// 10/03/2021 Complete review
// 05/11/2021 Add and review for the Cluster class

#ifndef DETECTORS_HMPID_BASE_INCLUDE_HMPIDDATAFORMAT_DIGIT_H_
#define DETECTORS_HMPID_BASE_INCLUDE_HMPIDDATAFORMAT_DIGIT_H_
Expand All @@ -37,11 +38,11 @@ class Digit
public:
// Coordinates Conversion Functions
static inline uint32_t abs(int ch, int pc, int x, int y) { return ch << 24 | pc << 16 | x << 8 | y; }
static inline int ddl2C(int ddl) { return ddl >> 1; } //ddl -> chamber
static inline int a2C(uint32_t pad) { return (pad & 0xFF000000) >> 24; } //abs pad -> chamber
static inline int a2P(uint32_t pad) { return (pad & 0x00FF0000) >> 16; } //abs pad -> pc
static inline int a2X(uint32_t pad) { return (pad & 0x0000FF00) >> 8; } //abs pad -> pad X
static inline int a2Y(uint32_t pad) { return (pad & 0x000000FF); } //abs pad -> pad Y
static inline int ddl2C(int ddl) { return ddl >> 1; } // ddl -> chamber
static inline int a2C(uint32_t pad) { return (pad & 0xFF000000) >> 24; } // abs pad -> chamber
static inline int a2P(uint32_t pad) { return (pad & 0x00FF0000) >> 16; } // abs pad -> pc
static inline int a2X(uint32_t pad) { return (pad & 0x0000FF00) >> 8; } // abs pad -> pad X
static inline int a2Y(uint32_t pad) { return (pad & 0x000000FF); } // abs pad -> pad Y
static inline uint32_t photo2Pad(int ch, int pc, int x, int y) { return abs(ch, pc, x, y); }
static uint32_t equipment2Pad(int Equi, int Colu, int Dilo, int Chan);
static uint32_t absolute2Pad(int Module, int x, int y);
Expand Down Expand Up @@ -135,18 +136,20 @@ class Digit
// pppp := photo cathode [0..5]
// xxxx.xxxx := horizontal displacement [0..79]
// yyyy.yyyy := vertical displacement [0..47]
//uint32_t mPad = 0; // 0xFFFFFFFF indicates invalid digit
// uint32_t mPad = 0; // 0xFFFFFFFF indicates invalid digit

// Get the Geometric center of the pad
static float lorsX(int pad) { return Param::lorsX(a2P(pad), a2X(pad)); } //center of the pad x, [cm]
static float lorsY(int pad) { return Param::lorsY(a2P(pad), a2Y(pad)); } //center of the pad y, [cm]
static float lorsX(int pad) { return Param::lorsX(a2P(pad), a2X(pad)); } // center of the pad x, [cm]
static float lorsY(int pad) { return Param::lorsY(a2P(pad), a2Y(pad)); } // center of the pad y, [cm]

// determines the total charge created by a hit
// might modify the localX, localY coordiates associated to the hit
static Double_t qdcTot(Double_t e, Double_t time, Int_t pc, Int_t px, Int_t py, Double_t& localX, Double_t& localY);
static Double_t intPartMathiX(Double_t x, Int_t pad);
static Double_t intPartMathiY(Double_t y, Int_t pad);
static Double_t inMathieson(Double_t localX, Double_t localY, int pad);
// might modify the localX, localY coordinates associated to the hit
static double qdcTot(double e, double time, int pc, int px, int py, double& localX, double& localY);
static double intPartMathiX(double x, int pad);
static double intPartMathiY(double y, int pad);
static double intMathieson(double localX, double localY, int pad);
static double mathiesonX(double x); // Mathieson distribution along wires X
static double mathiesonY(double x); // Mathieson distribution perp to wires Y

ClassDefNV(Digit, 2);
};
Expand Down
Loading