#ifndef STNTUPLE_TCesCluster #define STNTUPLE_TCesCluster #include #include "TMath.h" #include "TObject.h" class TStnDataBlock; class AbsEvent; class CesCluster; class TCesCluster : public TObject { friend Int_t StntupleInitClusterBlock(TStnDataBlock* block, AbsEvent* event, int mode); protected: //-------+-----+----------------------------------------------------------------- // bits | nb | comment //-------+-----+----------------------------------------------------------------- // 0- 0 | 1 | view - 0:wire 1:strip (unfortunate offline convention) // 1- 1 | 1 | side 0:west 1:east // 2- 6 | 5 | wedge (0-23) // 7-13 | 7 | first channel (strip/wire) associated with the cluster) // 14-14 | 1 | matched bit: 1 if a cluster has pair on the opposite view // 15-22 | 8 | cluster size - n(strips/wires) associated with it // 23 | 1 | bad channel flag // 24-30 | 7 | "seed" - channel with the max charge (reserved, not defined) // 31 | 1 | merged flag //----------------------------------------------------------------------------- Int_t fCode; // packed module, wire numbering see accessors Float_t fEnergy; // GeV Float_t fCoord; // local x or z witin the module Float_t fSigma; // width in cm Float_t fChiSq; // Chi squared const CesCluster* fCesp; //! for internal use, finding links //------------------------------------------------------------------------------ // functions //------------------------------------------------------------------------------ public: // ****** constructors and destructor TCesCluster(); virtual ~TCesCluster(); //----------------------------------------------------------------------------- // accessors //----------------------------------------------------------------------------- Int_t Code () const { return fCode ; } // 0 = wire (phi measurement), 1= strip= z measurement Int_t View () const { return (fCode ) & 0x1; } // 0 = z<0 (west), 1 = z>0 (east) Int_t Side () const { return (fCode >> 1) & 0x1; } // wedge 0-23 Int_t Wedge () const { return (fCode >> 2) & 0x1f; } Int_t DetCode () const { return (fCode ) & 0x7f; } // first hit wire or strip Int_t FirstHit () const { return (fCode >> 7) & 0x7f; } // 1 if after matching cluster didn't get // a pair from another view Int_t Matched () const { return (fCode >> 14) & 0x01; } //number of strips in cluster Int_t NHit () const { return (fCode >> 15) & 0xff; } Int_t Bad () const { return (fCode >> 23) & 0x01; } Int_t Seed () const { return (fCode >> 24) & 0x7f; } Int_t Merged () const { return (fCode >> 31) & 0x01; } Float_t Energy () const { return fEnergy; } // local x or CDF z within module Float_t LocalCoord () const { return fCoord; } // global CDF phi or CDF z Float_t Coord () const { if(View()==0) { float phi = (Wedge()+0.5)*(TMath::Pi()/12.0); return phi + TMath::ATan2(-fCoord,184.15); } // these return the z in CDF cordinates if(Side()==0) return -fCoord; return fCoord; } // cluster width in cm Float_t Sigma () const { return fSigma; } // cluster chi**2 Float_t ChiSq () const { return fChiSq; } const CesCluster* GetCesCluster() { return fCesp; } //----------------------------------------------------------------------------- // modifiers, assume Bad/Merged/Unpaired are 0 or 1 //----------------------------------------------------------------------------- void SetCode (Int_t I) { fCode = I; } void SetBad (Int_t I) { fCode = (fCode & 0xff7fffff) | (I << 23); } void SetSeed (Int_t I) { fCode = (fCode & 0x80ffffff) | (I << 24); } void SetMerged (Int_t I) { fCode = (fCode & 0x7fffffff) | (I << 31); } void SetMatched (Int_t I) { fCode = (fCode & 0xffffbfff) | (I << 14); } void SetEnergy (Float_t x) { fEnergy = x; } void SetCoord (Float_t x) { fCoord = x; } void SetSigma (Float_t x) { fSigma = x; } void SetChiSq (Float_t x) { fChiSq = x; } void SetCesCluster(const CesCluster* c) { fCesp = c; } //----------------------------------------------------------------------------- // overloaded methods of TObject //----------------------------------------------------------------------------- void Print(const char* Option="") const; ClassDef(TCesCluster,1) }; #endif