StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMuFcsHit.h
1 /***************************************************************************
2  *
3  * $Id: StMuFcsHit.h,v 1.0 2021/11/17 16:07:31 jdb Exp $
4  *
5  * Author: Daniel Brandenburg, 2021
6  ***************************************************************************
7  *
8  * Description: StMuFcsHit is data for individual cell
9  *
10  ***************************************************************************/
11 
12 #ifndef StMuFcsHit_hh
13 #define StMuFcsHit_hh
14 
15 #include <TObject.h>
16 #include "TArrayS.h"
17 #include "Stiostream.h"
18 #include <TRef.h>
19 
20 class StMuFcsCluster;
21 
22 class StMuFcsHit : public TObject {
23 public:
24  StMuFcsHit();
25  StMuFcsHit(unsigned short zs, unsigned short det, unsigned short id,
26  unsigned short ns, unsigned short ehp, unsigned short dep, unsigned short ch,
27  int ntimebin, unsigned short* data);
28  StMuFcsHit(unsigned short zs, unsigned short det, unsigned short id,
29  unsigned short ns, unsigned short ehp, unsigned short dep, unsigned short ch,
30  float e);
31  ~StMuFcsHit();
32 
33  virtual void Clear (Option_t * opt=""){
34  mData.Set(0);
35  }
36 
37  unsigned short zs() const;
38  unsigned short detectorId() const;
39  unsigned short id() const;
40  unsigned short ns() const; //from DEP
41  unsigned short ehp() const; //from DEP
42  unsigned short dep() const; //from DEP
43  unsigned short channel() const; //from DEP
44  unsigned int nTimeBin() const;
45  unsigned short timebin(int i) const;
46  unsigned short data(int i) const;
47  unsigned short * data() const { return (unsigned short*)mData.GetArray();}
48  unsigned int nData() const { return mData.GetSize(); };
49  unsigned short adc(int i) const;
50  unsigned short flag(int i) const;
51  int adcSum() const;
52  float fitPeak() const;
53  float fitSigma() const;
54  float fitChi2() const;
55  int nPeak() const;
56  float energy() const;
57 
58  void setDepCh(unsigned short ns, unsigned short ehp, unsigned short dep, unsigned short ch);
59  void setNS(unsigned short val);
60  void setEHP(unsigned short val);
61  void setDep(unsigned short val);
62  void setChannel(unsigned short val);
63 
64  void setDetId(unsigned short zs, unsigned short det, unsigned short id);
65  void setZS(unsigned short val);
66  void setDetId(unsigned short val);
67  void setDetectorId(unsigned short val);
68  void setId(unsigned short val);
69 
70  void setData(int ndata, const unsigned short* d);
71  void setDataAt(int tb, unsigned short val);
72  void setAdcFlag(int tb, unsigned short adc, unsigned short flag);
73  void setAdc(int tb, unsigned short val);
74  void setFlag(int tb, unsigned short val);
75 
76  void setAdcSum(int v);
77  void setFitPeak(float v);
78  void setFitSigma(float v);
79  void setFitChi2(float v);
80  void setNPeak(int v);
81  void setEnergy(float v);
82 
83  void setFcsHit(unsigned short zs, unsigned short det, unsigned short id,
84  unsigned short ns, unsigned short ehp, unsigned short dep, unsigned short ch,
85  int ntimebin, unsigned short* data);
86  void setFcsHit(unsigned short zs, unsigned short det, unsigned short id,
87  unsigned short ns, unsigned short ehp, unsigned short dep, unsigned short ch,
88  float e);
89 
90  void setCluster(StMuFcsCluster* clu);
91  const StMuFcsCluster *cluster() const;
92  StMuFcsCluster *cluster();
93 
94  void print(Option_t *option="") const;
95 
96 protected:
97  UShort_t mDetId=0; // 1 bit ZS, 3 bits DetectorId, 12 bits id
98  UShort_t mDepCh=0; // 1 bit for NS, 2 bits for EHP, 5 bits for DEP, 8 bits for channal
99  UInt_t mAdcSum=0; // ADC sum
100  Float_t mFitPeak=0.0; // fit peak position
101  Float_t mFitSigma=0.0; // fit sigma
102  Float_t mFitChi2=0.0; // fit chi2
103  UInt_t mNPeak=0; // number of peaks found
104  Float_t mEnergy=0.0; // corrected energy
105  // StMuFcsCluster* mCluster=0; // pointer to cluster this hit belongs
106  TRef mCluster;
107  TArrayS mData=0; // 12bit ADC values + flag at highest 4 bits, array of timebin
108 
109  ClassDef(StMuFcsHit,2)
110 };
111 
112 ostream& operator<<(ostream&, const StMuFcsHit&);
113 #endif