StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEmcOfflineCalibrationEvent.h
1 /*
2  * StEmcOfflineCalibrationEvent.h
3  * J. Kevin Adkins, University of Kentucky
4  * June 15, 2014
5  */
6 
7 
8 #ifndef STAR_StEmcOfflineCalibrationEvent
9 #define STAR_StEmcOfflineCalibrationEvent
10 
11 #include "TObject.h"
12 #include "TClonesArray.h"
13 #include "TVector3.h"
14 #include "StThreeVectorF.hh"
15 #include "TRefArray.h"
16 
17 #include <vector>
18 #include <algorithm>
19 #include <map>
20 
24 
25 using namespace std;
26 //----------------------------------------------------------------------
27 class StEmcOfflineCalibrationTrack : public TObject
28 {
29 public:
32  void Clear(Option_t* option="");
33 
34  // 0 < id <= 8. 0 is central tower in 3x3 cluster, 1-8 are surrounding towers
35  Int_t towerId(Int_t id) const { return mTowerId[id]; }
36  Int_t towerAdc(Int_t id) const { return mTowerAdc[id]; }
37  Int_t towerStatus(Int_t id) const { return mTowerStatus[id]; }
38  Float_t towerPedestal(Int_t id) const { return mTowerPed[id]; }
39  Float_t towerPedestalRms(Int_t id) const { return mTowerPedRms[id]; }
40  Int_t preshowerAdc(Int_t id) const { return mPreshowerAdc[id]; }
41  Int_t preshowerStatus(Int_t id) const { return mPreshowerStatus[id]; }
42  Float_t preshowerPedestal(Int_t id) const{ return mPreshowerPed[id]; }
43  Float_t preshowerPedestalRms(Int_t id) const{ return mPreshowerPedRms[id]; }
44  UChar_t preshowerCap(Int_t id) const{ return mPreshowerCap[id]; }
45 
46  // 0 << id <= 10 for SMD
47  Int_t smdeId(Int_t id) const { return mSmdeId[id]; }
48  Int_t smdeAdc(Int_t id) const { return mSmdeAdc[id]; }
49  Int_t smdeStatus(Int_t id) const { return mSmdeStatus[id]; }
50  Float_t smdePedestal(Int_t id) const { return mSmdePed[id]; }
51  Float_t smdePedestalRms(Int_t id) const { return mSmdePedRms[id]; }
52 
53  Int_t smdpId(Int_t id) const { return mSmdpId[id]; }
54  Int_t smdpAdc(Int_t id) const { return mSmdpAdc[id]; }
55  Int_t smdpStatus(Int_t id) const { return mSmdpStatus[id]; }
56  Float_t smdpPedestal(Int_t id) const { return mSmdpPed[id]; }
57  Float_t smdpPedestalRms(Int_t id) const { return mSmdpPedRms[id]; }
58 
59  Int_t towerExitId() const { return mTowerExitId; }
60  Int_t vertexIndex() const { return mVertexIndex; }
61  Int_t flag() const { return mFlag; }
62  Int_t bad() const { return mBad; }
63  Int_t nHits() const { return mNHits; }
64  Int_t nFitPoints() const { return mNFitPoints; }
65  Int_t nDedxPoints() const { return mNDedxPoints; }
66  Int_t nHitsPossible() const { return mNHitsPossible; }
67  Int_t charge() const { return mCharge; }
68 
69  Double_t p() const { return mP; }
70  Double_t eta() const { return mEta; }
71  Double_t phi() const { return mPhi; }
72  Double_t dEdx() const { return mDeDx; }
73  Double_t nSigmaElectron() const { return mNSigmaElectron; }
74  Double_t nSigmaKaon() const { return mNSigmaKaon; }
75  Double_t nSigmaPion() const { return mNSigmaPion; }
76  Double_t nSigmaProton() const { return mNSigmaProton; }
77  Float_t highestNeighbor() const { return mHighestNeighbor; }
78  Float_t deta() const { return mDeta; }
79  Float_t dphi() const { return mDphi; }
80  StThreeVectorF momentum() const { return mMomentum; }
81 
82  // information from TOF
83  Int_t tofMatchedFlag() const { return mTofMatchedFlag; }
84  Float_t vpdVz() const { return mVpdVz; }
85  Float_t dcaGlobal() const { return mDcaGlobal; }
86  Float_t tofTime() const { return mTofTime; }
87  Float_t tofBeta() const { return mTofBeta; }
88  Float_t tofPathlength() const { return mTofPathLength; }
89  Float_t tofSigmaElectron() const { return mTofSigmaElectron; }
90  Float_t tofProbElectron() const { return mTofProbElectron; }
91 
92  void setTowerId(Int_t,Int_t);
93  void setTowerAdc(Int_t,Int_t);
94  void setTowerStatus(Int_t,Int_t);
95  void setTowerPedestal(Int_t, Float_t);
96  void setTowerPedestalRms(Int_t, Float_t);
97  void setPreshowerAdc(Int_t, Int_t);
98  void setPreshowerStatus(Int_t, Int_t);
99  void setPreshowerPedestal(Int_t, Float_t);
100  void setPreshowerPedestalRms(Int_t, Float_t);
101  void setPreshowerCap(Int_t, UChar_t);
102  void setSmdeId(Int_t, Int_t);
103  void setSmdeAdc(Int_t, Int_t);
104  void setSmdeStatus(Int_t, Int_t);
105  void setSmdePedestal(Int_t, Float_t);
106  void setSmdePedestalRms(Int_t, Float_t);
107  void setSmdpId(Int_t, Int_t);
108  void setSmdpAdc(Int_t, Int_t);
109  void setSmdpStatus(Int_t, Int_t);
110  void setSmdpPedestal(Int_t, Float_t);
111  void setSmdpPedestalRms(Int_t, Float_t);
112  void setTowerExitId(Int_t);
113  void setVertexIndex(Int_t);
114  void setFlag(Int_t);
115  void setBad(Int_t);
116  void setNHits(Int_t);
117  void setNFitPoints(Int_t);
118  void setNDedxPoints(Int_t);
119  void setNHitsPossible(Int_t);
120  void setCharge(Int_t);
121  void setP(Double_t);
122  void setEta(Double_t);
123  void setPhi(Double_t);
124  void setDeDx(Double_t);
125  void setNSigmaElectron(Double_t);
126  void setNSigmaPion(Double_t);
127  void setNSigmaKaon(Double_t);
128  void setNSigmaProton(Double_t);
129  void setHighestNeighbor(Float_t);
130  void setDeta(Float_t);
131  void setDphi(Float_t);
132  void setMomentum(StThreeVectorF);
133  void setTofMatchedFlag(Int_t);
134  void setVpdVz(Float_t);
135  void setDcaGlobal(Float_t);
136  void setTofTime(Float_t);
137  void setTofBeta(Float_t);
138  void setTofPathlength(Float_t);
139  void setTofSigmaElectron(Float_t);
140  void setTofProbElectron(Float_t);
141 
142  private:
143  Int_t mTowerId[9];
144  Int_t mTowerAdc[9];
145  Int_t mTowerStatus[9];
146  Float_t mTowerPed[9];
147  Float_t mTowerPedRms[9];
148 
149  Int_t mPreshowerAdc[9];
150  Int_t mPreshowerStatus[9];
151  Float_t mPreshowerPed[9];
152  Float_t mPreshowerPedRms[9];
153  UChar_t mPreshowerCap[9];
154 
155  Int_t mSmdeId[11];
156  Int_t mSmdeAdc[11];
157  Int_t mSmdeStatus[11];
158  Float_t mSmdePed[11];
159  Float_t mSmdePedRms[11];
160 
161  Int_t mSmdpId[11];
162  Int_t mSmdpAdc[11];
163  Int_t mSmdpStatus[11];
164  Float_t mSmdpPed[11];
165  Float_t mSmdpPedRms[11];
166 
167  Int_t mTowerExitId;
168  Int_t mVertexIndex;
169  Int_t mFlag;
170  Int_t mBad;
171  Int_t mNHits;
172  Int_t mNFitPoints;
173  Int_t mNDedxPoints;
174  Int_t mNHitsPossible;
175  Int_t mCharge;
176 
177  Double_t mP;
178  Double_t mEta;
179  Double_t mPhi;
180  Double_t mDeDx;
181  Double_t mNSigmaElectron;
182  Double_t mNSigmaPion;
183  Double_t mNSigmaKaon;
184  Double_t mNSigmaProton;
185  Float_t mHighestNeighbor;
186  Float_t mDeta;
187  Float_t mDphi;
188  StThreeVectorF mMomentum;
189 
190  Int_t mTofMatchedFlag;
191  Float_t mVpdVz;
192  Float_t mDcaGlobal;
193  Float_t mTofTime;
194  Float_t mTofBeta;
195  Float_t mTofPathLength;
196  Float_t mTofSigmaElectron;
197  Float_t mTofProbElectron;
198 
199  ClassDef(StEmcOfflineCalibrationTrack, 9);
200 };
201 //----------------------------------------------------------------------
202 class StEmcOfflineCalibrationEvent : public TObject
203 {
204  public:
207 
208  void Clear(Option_t* option="");
209 
210  //event info
211  Int_t fillNum() const { return mFillNum; }
212  Int_t runNum() const { return mRunNum; }
213  Int_t eventId() const { return mEventId; }
214  Int_t date() const { return mDate; }
215  Int_t time() const { return mTime; }
216 
217  // Tracks
218  TClonesArray *tracks() const { return mTracks; }
219  Int_t nTracks() const;
220  StEmcOfflineCalibrationTrack *track(Int_t) const;
221 
222  // Triggers
223  TClonesArray *triggers() const { return mTriggers; }
224  Int_t nTriggers() const;
225  StEmcOfflineCalibrationTrigger *trigger(Int_t) const;
226 
227  //Vertices
228  TClonesArray *vertices() const { return mVertices; }
229  Int_t nVertices() const;
231 
232  Int_t highTowerTh(Int_t th) const { return mHighTowerTh[th]; }
233  Int_t highTowerAdc(Int_t softId) const { return mHighTowerAdc[softId-1]; }
234 
235  map<Int_t,Int_t> towersAboveHighTowerTh(Int_t) const;
236 
237  // Adding functions
238  StEmcOfflineCalibrationTrack* addTrack();
239  StEmcOfflineCalibrationVertex* addVertex();
240  StEmcOfflineCalibrationTrigger* addTrigger();
241 
242  // Setting functions
243  void setFill(Int_t aFill);
244  void setRunNum(Int_t aRunNum);
245  void setEventId(Int_t aEventId);
246  void setDate(Int_t aDate);
247  void setTime(Int_t aTime);
248  void setHighTowerTh(Int_t,Int_t);
249  void setHighTowerAdc(Int_t,Int_t);
250 
251  private:
252  Int_t mFillNum;
253  Int_t mRunNum;
254  Int_t mEventId;
255  Int_t mDate;
256  Int_t mTime;
257 
258  Int_t mHighTowerAdc[4800];
259  Int_t mHighTowerTh[4];
260 
261  TClonesArray *mTracks;
262  TClonesArray *mTriggers;
263  TClonesArray *mVertices;
264 
265  ClassDef(StEmcOfflineCalibrationEvent,6);
266 };
267 //----------------------------------------------------------------------
268 class StEmcOfflineCalibrationTrigger : public TObject {
269  public:
272 
273  void InitTrigValues();
274  void ClearTrigValues();
275 
276  Int_t trigId() const { return mTrigId; }
277  Bool_t shouldFire() const { return mShouldFire; }
278  Bool_t didFire() const { return mDidFire; }
279 
280  // Setters
281  void setTrigId (Int_t aTrigId);
282  void setDidFire (Bool_t aDidFire);
283  void setShouldFire( Bool_t aShouldFire);
284 
285  private:
286  Int_t mTrigId;
287  Bool_t mShouldFire;
288  Bool_t mDidFire;
289 
290  ClassDef(StEmcOfflineCalibrationTrigger,1);
291 };
292 //----------------------------------------------------------------------
293 class StEmcOfflineCalibrationVertex : public TObject {
294  public:
297 
298  Double_t x() const { return mX; }
299  Double_t y() const { return mY; }
300  Double_t z() const { return mZ; }
301  Double_t ranking() const { return mRanking; }
302 
303  // Tracks for this vertex
304  const TRefArray& tracks() const { return mTracks; }
305  Int_t nTracks() const { return mTracks.GetEntriesFast(); }
306  StEmcOfflineCalibrationTrack *track(Int_t i) const { return (StEmcOfflineCalibrationTrack*)mTracks.At(i); }
307  StEmcOfflineCalibrationTrack* addTrack(StEmcOfflineCalibrationTrack *trk) { mTracks.Add((TObject*)trk); return (StEmcOfflineCalibrationTrack*)mTracks.Last(); }
308 
309  void setRanking(Double_t aRanking);
310  void setX(Double_t aX);
311  void setY(Double_t aY);
312  void setZ(Double_t aZ);
313 
314  private:
315  Double_t mRanking;
316  Double_t mX;
317  Double_t mY;
318  Double_t mZ;
319  TRefArray mTracks;
320 
321  ClassDef(StEmcOfflineCalibrationVertex,1);
322 };
323 //----------------------------------------------------------------------
324 class StEmcOfflineCalibrationCluster : public TObject
325 {
326  public:
329  void Clear(Option_t *option="");
330 
331  const TRefArray& tracks() const { return mNeighborTracks; }
332  Int_t numberOfNeighborTracks() const { return mNeighborTracks.GetEntriesFast(); }
333  StEmcOfflineCalibrationTrack* neighborTrack(Int_t i) const { return (StEmcOfflineCalibrationTrack*)mNeighborTracks.At(i); }
334  StEmcOfflineCalibrationTrack* centralTrack() const { return mCentralTrack; }
335  StEmcOfflineCalibrationTrack* addNeighborTrack(StEmcOfflineCalibrationTrack* trk) { mNeighborTracks.Add((TObject*)trk); return (StEmcOfflineCalibrationTrack*)mNeighborTracks.Last(); }
336 
337  void setCentralTrack(StEmcOfflineCalibrationTrack*);
338 
339  private:
340  TRefArray mNeighborTracks;
341  StEmcOfflineCalibrationTrack *mCentralTrack;
342 
343  ClassDef(StEmcOfflineCalibrationCluster,4);
344 };
345 #endif