StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMuEmcCollection.h
1 
14 #ifndef StMuEmcCollection__h
15 #define StMuEmcCollection__h
16 
17 #include "TObject.h"
18 #include "TClonesArray.h"
19 #include "StMuEmcHit.h"
20 #include "StMuEmcCluster.h"
21 #include "StMuEmcPoint.h"
22 #include "StMuEmcTowerData.h"
23 #include "StEnumerations.h"
24 #include "Stiostream.h"
25 
26 //enum {bemc=1, bprs=2, bsmde=3, bsmdp=4, eemc=5, eprs=6, esmdu=7, esmdv=8};
27 
28 class StMuEmcCollection: public TObject
29 {
30  public:
33  virtual ~StMuEmcCollection();
34  void clear(Option_t *option="");
35  virtual void Clear(Option_t */* option="" */){clear();}
36  void DeleteThis();
37 
38  int getTowerADC(int id, int detector = bemc) const;
39  StEmcCrateStatus getCrateStatus(int crate, int detector = bemc) const { if (mTowerData) return mTowerData->crateStatus(crate,detector); else return crateUnknown; }
40  int getNSmdHits(int detector) const;
41  StMuEmcHit* getSmdHit(int hitId, int detector = bsmde);
42  const StMuEmcHit* getSmdHit(int hitId, int detector = bsmde) const;
43  TClonesArray* getPrsHits(int detector = bprs) { if (detector==bprs) return mPrsHits; else if (detector==eprs) return mEndcapPrsHits; else return 0; }
44  const TClonesArray* getPrsHits(int detector = bprs) const { if (detector==bprs) return mPrsHits; else if (detector==eprs) return mEndcapPrsHits; else return 0; }
45  int getNPrsHits(int detector = bprs) const;
46  StMuEmcHit* getPrsHit(int hitId, int detector = bprs);
47  const StMuEmcHit* getPrsHit(int hitId, int detector = bprs) const;
48  int getNClusters(int detector) const;
49  StMuEmcCluster* getCluster(int clusterId,int detector);
50  const StMuEmcCluster* getCluster(int clusterId,int detector) const;
51  int getNPoints() const;
52  StMuEmcPoint* getPoint(int);
53  const StMuEmcPoint* getPoint(int) const;
54  int getNEndcapPoints() const;
55  StMuEmcPoint* getEndcapPoint(int);
56  const StMuEmcPoint* getEndcapPoint(int) const;
57 
58  // EEMC utility methods
59  int getNEndcapTowerADC() const { return 720;}
60  void getEndcapTowerADC(int ihit, int &adc, int &sec, int &sub, int & eta) const ;
61 
62  int getNEndcapPrsHits() const { return getNPrsHits(eprs);}
63  StMuEmcHit *getEndcapPrsHit(int ihit, int &sec, int &sub, int & eta, int &pre);
64  const StMuEmcHit *getEndcapPrsHit(int ihit, int &sec, int &sub, int & eta, int &pre) const;
65 
66  int getNEndcapSmdHits(char uv) const; // set 'U' or 'V'
67  StMuEmcHit * getEndcapSmdHit(char uv, int ihit, int &sec, int &strip);
68  const StMuEmcHit * getEndcapSmdHit(char uv, int ihit, int &sec, int &strip) const;
69 
70  void setTowerADC(int,int, int detector = bemc);
71  void addSmdHit(int detector);
72  void addPrsHit(int detector = bprs);
73  void addCluster(int detector);
74  void addPoint();
75  void addEndcapPoint();
76  void setPrsArray(int detector, TClonesArray *cla);
77  void setSmdArray(int detector, TClonesArray *cla);
78  void setTowerData(StMuEmcTowerData *tow_dat) {mTowerData=tow_dat;}
79  void setCrateStatus(StEmcCrateStatus status, int crate, int detector = bemc) { if (mTowerData) mTowerData->setCrateStatus(status,crate,detector);}
80 
81  protected:
82  void init();
83  void packbits(unsigned char*, unsigned int, unsigned int, unsigned int);
84  unsigned int unpackbits(const unsigned char*, unsigned int, unsigned int) const ;
85 
86  // The char arrays are obsolete, but needed for backward compatibility
87  unsigned char mTowerADC[7200];
88  unsigned char mEndcapTowerADC[1080];
89  StMuEmcTowerData* mTowerData; // This replaces the above arrays
90 
91  TClonesArray* mPrsHits;
92  TClonesArray* mSmdHits[2];
93  TClonesArray* mEmcClusters[4];
94  TClonesArray* mEmcPoints;
95 
96  TClonesArray* mEndcapPrsHits;
97  TClonesArray* mEndcapSmdHits[2];
98  TClonesArray* mEndcapEmcClusters[4];
99  TClonesArray* mEndcapEmcPoints;
100 
101  ClassDef(StMuEmcCollection,3)
102 };
103 
104 
105 
106 #endif
107