StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMuRpsCollection.h
1 #ifndef __StMuRpsCollection_hh__
2 #define __StMuRpsCollection_hh__
3 
4 #include "TObject.h"
5 #include <vector>
6 #include <map>
7 
8 #include "StMuRpsTrackPoint.h"
9 #include "StMuRpsTrack.h"
10 #include "TClonesArray.h"
11 
12 using namespace std;
13 
14 
15 
16 class StRpsCollection;
17 
18 class StMuRpsCollection : public TObject {
19 
20 public:
21 
22  StMuRpsCollection() {; }
24  ~StMuRpsCollection() {;}
25 
26 //Event level info
27 
28  unsigned char siliconBunch() const;
29 
30 //Roman pot Level Info
31 
32  unsigned int numberOfRomanPots() const { return mNumberOfRomanPot; }
33  unsigned int numberOfPlanesWithClusters(int romanPotId) const;
34  unsigned int adc(int romanPotId, unsigned int) const;
35  unsigned int tac(int romanPotId, unsigned int) const;
36  unsigned char status(int romanPotId) const;
37 
38 //Plane level Info
39 
40  unsigned int numberOfPlanes() const { return mNumberOfPlanes; }
41  double offsetPlane(int romanPotId, int planeId) const;
42  double zPlane(int romanPotId, int planeId) const;
43  double anglePlane(int romanPotId, int planeId) const;
44  short orientationPlane(int romanPotId, int planeId) const;
45  unsigned char statusPlane(int romanPotId, int planeId) const;
46 
47 //Cluster level Info
48 
49  int numberOfClusters(int romanPotId, int planeId) const;
50  double positionCluster(int romanPotId, int planeId, int cluster) const;
51  double positionRMSCluster(int romanPotId, int planeId, int cluster) const;
52  short lengthCluster(int romanPotId, int planeId, int cluster) const;
53  double energyCluster(int romanPotId, int planeId, int cluster) const;
54  double xyCluster(int romanPotId, int planeId, int cluster) const;
55  unsigned char qualityCluster(int romanPotId, int planeId, int cluster) const;
56 
57 // Tracks and Track Points
58  StMuRpsTrackPoint* trackPoint( unsigned int i ) { if ( i < mTrackPoints.size() ) return mTrackPoints[i]; return nullptr; }
59  StMuRpsTrack* track( unsigned int i ) { if ( i < mTracks.size() ) return mTracks[i]; return nullptr; }
60 
61  inline int numberOfTrackPoints() const { return mTrackPoints.size(); }
62  inline int numberOfTracks() const { return mTracks.size(); }
63 
64 private:
65 
66  enum {mNumberOfRomanPot = 8, mNumberOfPlanes = 4};
67 
68  unsigned char mSiliconBunch;
69 
70  int mNumberPlanes[mNumberOfRomanPot];
71  int mNumberPlanesWithClusters[mNumberOfRomanPot];
72  unsigned char mStatusRomanPot[mNumberOfRomanPot];
73  int mADC[mNumberOfRomanPot][2];
74  int mTAC[mNumberOfRomanPot][2];
75 
76  double mOffsetPlane[mNumberOfRomanPot][mNumberOfPlanes];
77  double mzPlane[mNumberOfRomanPot][mNumberOfPlanes];
78  double mAnglePlane[mNumberOfRomanPot][mNumberOfPlanes];
79  short mOrientationPlane[mNumberOfRomanPot][mNumberOfPlanes];
80  unsigned char mStatusPlane[mNumberOfRomanPot][mNumberOfPlanes];
81  int mNumberOfClusters[mNumberOfRomanPot][mNumberOfPlanes];
82 
83  vector<double> mPositionCluster[mNumberOfRomanPot][mNumberOfPlanes];
84  vector<double> mPositionRMSCluster[mNumberOfRomanPot][mNumberOfPlanes];
85  vector<short> mLengthCluster[mNumberOfRomanPot][mNumberOfPlanes];
86  vector<double> mEnergyCluster[mNumberOfRomanPot][mNumberOfPlanes];
87  vector<double> mXYCluster[mNumberOfRomanPot][mNumberOfPlanes];
88  vector<unsigned char> mQualityCluster[mNumberOfRomanPot][mNumberOfPlanes];
89 
90  vector<StMuRpsTrackPoint*> mTrackPoints;
91  vector<StMuRpsTrack*> mTracks;
92 
93  StMuRpsTrackPoint* addTrackPoint( StRpsTrackPoint* tp );
94 
95  // keeps an in-memory map of the StEvent TrackPoints to the
96  // StMuDst TrackPoints - for recovering the relationship in StMuRpsTracks
97  map<StRpsTrackPoint *, StMuRpsTrackPoint * > mTrackPointsMap;
98 
99 
100 ClassDef(StMuRpsCollection,3)
101 
102 };
103 inline unsigned char StMuRpsCollection::siliconBunch() const { return mSiliconBunch ; }
104 inline unsigned int StMuRpsCollection::numberOfPlanesWithClusters(int romanPotId) const { return romanPotId < mNumberOfRomanPot ? mNumberPlanesWithClusters[romanPotId] : 0; }
105 inline unsigned char StMuRpsCollection::status(int romanPotId) const {
106  if (romanPotId < mNumberOfRomanPot) return mStatusRomanPot[romanPotId];
107  else return 0;
108 }
109 
110 inline unsigned int StMuRpsCollection::adc(int romanPotId, unsigned int n) const { return romanPotId < mNumberOfRomanPot && n < 2 ? mADC[romanPotId][n] : 0;}
111 inline unsigned int StMuRpsCollection::tac(int romanPotId, unsigned int n) const { return romanPotId < mNumberOfRomanPot && n < 2 ? mTAC[romanPotId][n] : 0;}
112 inline double StMuRpsCollection::offsetPlane(int romanPotId, int planeId) const { return romanPotId < mNumberOfRomanPot && planeId < mNumberOfPlanes ? mOffsetPlane[romanPotId][planeId] : 0;}
113 inline double StMuRpsCollection::zPlane(int romanPotId, int planeId) const { return romanPotId < mNumberOfRomanPot && planeId < mNumberOfPlanes ? mzPlane[romanPotId][planeId] : 0;}
114 inline double StMuRpsCollection::anglePlane(int romanPotId, int planeId) const { return romanPotId < mNumberOfRomanPot && planeId < mNumberOfPlanes ? mAnglePlane[romanPotId][planeId] : 0;}
115 inline short StMuRpsCollection::orientationPlane(int romanPotId, int planeId) const { return romanPotId < mNumberOfRomanPot && planeId < mNumberOfPlanes ? mOrientationPlane[romanPotId][planeId] : 0;}
116 inline unsigned char StMuRpsCollection::statusPlane(int romanPotId, int planeId) const {
117  if(romanPotId < mNumberOfRomanPot && planeId < mNumberOfPlanes) return mStatusPlane[romanPotId][planeId];
118  else return 0;
119 }
120 inline int StMuRpsCollection::numberOfClusters(int romanPotId, int planeId) const { return romanPotId < mNumberOfRomanPot && planeId < mNumberOfPlanes ? mNumberOfClusters[romanPotId][planeId] : 0;}
121 inline double StMuRpsCollection::positionCluster(int romanPotId, int planeId, int cluster) const { return romanPotId < mNumberOfRomanPot && planeId < mNumberOfPlanes && cluster < mNumberOfClusters[romanPotId][planeId]? mPositionCluster[romanPotId][planeId][cluster] : 0;}
122 inline double StMuRpsCollection::positionRMSCluster(int romanPotId, int planeId, int cluster) const { return romanPotId < mNumberOfRomanPot && planeId < mNumberOfPlanes && cluster < mNumberOfClusters[romanPotId][planeId]? mPositionRMSCluster[romanPotId][planeId][cluster] : 0;}
123 inline short StMuRpsCollection::lengthCluster(int romanPotId, int planeId, int cluster) const { return romanPotId < mNumberOfRomanPot && planeId < mNumberOfPlanes && cluster < mNumberOfClusters[romanPotId][planeId]? mLengthCluster[romanPotId][planeId][cluster] : 0;}
124 inline double StMuRpsCollection::energyCluster(int romanPotId, int planeId, int cluster) const { return romanPotId < mNumberOfRomanPot && planeId < mNumberOfPlanes && cluster < mNumberOfClusters[romanPotId][planeId]? mEnergyCluster[romanPotId][planeId][cluster] : 0;}
125 inline double StMuRpsCollection::xyCluster(int romanPotId, int planeId, int cluster) const { return romanPotId < mNumberOfRomanPot && planeId < mNumberOfPlanes && cluster < mNumberOfClusters[romanPotId][planeId]? mXYCluster[romanPotId][planeId][cluster] : 0;}
126 inline unsigned char StMuRpsCollection::qualityCluster(int romanPotId, int planeId, int cluster) const { return romanPotId < mNumberOfRomanPot && planeId < mNumberOfPlanes && cluster < mNumberOfClusters[romanPotId][planeId]? mQualityCluster[romanPotId][planeId][cluster] : 0;}
127 
128 #endif