//----------------------------------------------------------- // File and Version Information: // $Id$ // // Description: // a cluster in the tpc // // // Environment: // Software developed for the PANDA Detector at FAIR. // // Author List: // Sebastian Neubert TUM (original author) // // //----------------------------------------------------------- #ifndef TPCCLUSTER_HH #define TPCCLUSTER_HH // Base Class Headers ---------------- // Collaborating Class Headers ------- #include // remove if you do not need streaming op #include #include #include #include "TVector3.h" #include "McIdCollection.h" #include "TMatrixD.h" #include "TMatrixDSym.h" #include "TVectorD.h" #include "TpcDigi.h" #include "TpcDigiAge.h" #include "GFDetPlane.h" // Collaborating Class Declarations -- class TpcCluster : public TObject { friend class TpcLaserCorrectionTask; public: // Constructors/Destructors --------- TpcCluster(); TpcCluster(const TpcCluster&); TpcCluster(const TVector3& Pos, double Amp, unsigned int Index); TpcCluster(const TVector3& Pos, const TVector3& Sig, double Amp, unsigned int Index); virtual ~TpcCluster(); friend std::ostream& operator<< (std::ostream& s, const TpcCluster& me); // Accessors ----------------------- const TVector3& pos() const {return fpos;} const TVector3& cogpos() const {return fcogpos;} const TVector3& sig(int mode=0) const; //mode=0: standard xyz error, 1: along and perp in yz plane and z error, 2: xyz from covmatrix, 3: cov eigenwert const TVector3& sigT() const {return fsigT;} const TVector3& eigenValOnPlane() const {return feigenValOnPlane;} const TVector3& minSigma() const {return fminSigma;} const TVector3& fieldCorr() const {return fFieldCorr;} //const TMatrixDSym& covSym() const {return fcovSym;} //const TMatrixDSym& cov() const {return fcov;} const TMatrixD& cov() const {return fcov;} const TMatrixD& covOnPlane() const{return fcovOnPlane;} const TMatrixD& eigenVect() const {return feigenVect;} const GFDetPlane& midPlane() const {return fmidPlane;} TVector3 axis(unsigned int i=0, Bool_t norm=kTRUE) const {return calcAxis(i,norm);} double amp() const {return famp;} double phi() const {return fphi;} unsigned int size() const {return digis.size();} unsigned int size2D() const {return padids.size();} unsigned int nPad() const {return fnPad;} unsigned int nPadX() const {return fnPadX;} unsigned int nPadY() const {return fnPadY;} unsigned int index() const {return findex;} unsigned int get2DSize(); double getUnsharedSize(); const McIdCollection& mcId() const {return fmcid;} unsigned int nMcIds() const {return fmcid.nIDs();} double maxMcWeight() const {return fmcid.MaxRelWeight();} unsigned int sector() const {return fsector;} bool isSaturated() const {return fsaturated;} bool hasSigA() const {return fhasSigA;} bool hasSigC() const {return fhasSigC;} bool hasCov() const {return fhasCov;} TVector3 isGeom() const {return fisGeomErr;} bool hasGeomErr() const; bool fitGood(){return ffitGood;} double minNll(){return fminNll;} TVector3 RMS(){return fRMS;} TVector3 RMSUV(){return fRMSUV;} const TMatrixD& shapeCov() {return fshapeCov;} const TMatrixD& unwShapeCov() {return funwShapeCov;} const TMatrixD& shapeCovPlane() {return fshapeCovPlane;} const TMatrixD& unwShapeCovPlane() {return funwShapeCovPlane;} std::vector prfWeights(){return fprfWeights;} // Modifiers ----------------------- void SetSig(const TVector3& Sig){fsig=Sig;} void setSaturation(bool saturation=true){fsaturated=saturation;} void SetMcId(const McIdCollection& m){fmcid=m;} void SetIndex(unsigned int id){findex=id;} void SetCov(const TMatrixD& m){fcov=TMatrixD(3,3,m.GetMatrixArray());fhasCov=true,calcSigCA();} void SetCovOnPlane(const TMatrixD& m){fcovOnPlane=TMatrixD(2,2,m.GetMatrixArray());} void SetMidPlane(const GFDetPlane& p){fmidPlane=p;} void SetSigA(const TVector3 v){fsigA=TVector3(v);fhasSigA=true;} void SetEigenVect(const TMatrixD& m){feigenVect=TMatrixD(3,3,m.GetMatrixArray());fhasaxis=true;} void SetPos(const TVector3& p) {fpos = p;} //allows for position correction. void SetCogPos(const TVector3& p) {fcogpos=p;} void SetSector(unsigned int id){fsector=id;} void SetIndexInTrack(int indexInTrack ) {findexInTrack=indexInTrack; }//for spatial sorting void SetSigT(const TVector3& p){fsigT = p; fhasSigT=kTRUE;} void SetFieldCorr(TVector3 vec){fFieldCorr=vec;} void SetPhi(const double p){fphi=p;} void SetIsGeomErr(bool Gerr0, bool Gerr1, bool Gerr2){fisGeomErr[0]=Gerr0,fisGeomErr[1]=Gerr1,fisGeomErr[2]=Gerr2;} void SetIsGeomErr(TVector3 vec){fisGeomErr[0]=vec[0];fisGeomErr[1]=vec[1];fisGeomErr[2]=vec[2];} int GetIndexInTrack() const {return findexInTrack; } //for spatial sorting void SetFitGood(bool f){ffitGood=f;} void SetEigenValOnPlane(TVector3 vec){feigenValOnPlane=vec;} void SetMinSigma(TVector3 vec){fminSigma=vec;} void SetMinNll(double val){fminNll=val;} void SetRMS(TVector3 vec){fRMS=vec;} void SetRMSUV(TVector3 vec){fRMSUV=vec;} void SetShapeCov(const TMatrixD& m){fshapeCov=TMatrixD(3,3,m.GetMatrixArray());} void SetUnwShapeCov(const TMatrixD& m){funwShapeCov=TMatrixD(3,3,m.GetMatrixArray());} void SetShapeCovPlane(const TMatrixD& m){fshapeCovPlane=TMatrixD(2,2,m.GetMatrixArray());} void SetUnwShapeCovPlane(const TMatrixD& m){funwShapeCovPlane=TMatrixD(2,2,m.GetMatrixArray());} void SetPrfWeights(std::vector Weights){fprfWeights=Weights;} void nPad(unsigned int i) {fnPad=i;} void nPadX(unsigned int i) {fnPadX=i;} void nPadY(unsigned int i) {fnPadY=i;} // Operations ---------------------- void ClearDigis(){digis.clear();} //TRANSIENT FUNCTIONALITY: ------------------------------------------------------ unsigned int nDigi() const { return digis.size(); } void addDigi(const TpcDigi* digi, double share=1); //map: digi array index -> digi weight (for shared digis) const std::map* getDigiMap() const {return &digis;} std::vector getDigiIDs() const; //-------------------------------------------------------------------------------- TVector3 calcAxis(unsigned int i=0, Bool_t norm=kTRUE) const; // calculate major axis from cluster shape private: // Private Data Members ------------ TVector3 fpos; TVector3 fcogpos; TVector3 fsig; // errors TVector3 fsigT; TVector3 fsigC; TVector3 fsigA; TVector3 fsigWrong; TVector3 feigenValOnPlane; TVector3 fminSigma; TVector3 fRMS; TVector3 fRMSUV; TVector3 fFieldCorr; TMatrixD fcov; // 2nd moment of cluster shape TMatrixD fcovOnPlane; TMatrixD fshapeCov; TMatrixD fshapeCovPlane; TMatrixD funwShapeCov; TMatrixD funwShapeCovPlane; TMatrixD feigenVect; GFDetPlane fmidPlane; TVector3 faxis; // main axis of the cluster EXPERIMENTAL bool fhasaxis; bool fhasSigT; bool fhasSigC; bool fhasSigA; bool fhasCov; TVector3 fisGeomErr; bool ffitGood; double fminNll; double famp; double fphi; unsigned int fnPad; unsigned int fnPadX; unsigned int fnPadY; unsigned int findex; McIdCollection fmcid; unsigned int fsector; // sector on tpc where cluster was produced bool fsaturated; //flag that this cluster contains one or more saturated digis int findexInTrack; //index in track for spatial sorting //for optional saving of raw info that went into the cluster std::map digis; std::set padids; //needed to calculate 2d cluster size std::vector fprfWeights; // Private Methods ----------------- void calcSigCA(); public: ClassDef(TpcCluster,7) }; class PndTpcCluster : public TpcCluster { public: ClassDef(PndTpcCluster,8) }; #endif //-------------------------------------------------------------- // $Log$ //--------------------------------------------------------------