StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMuRpsCollection.cxx
1 #include "StMuRpsCollection.h"
2 #include "StEvent/StRpsCollection.h"
3 #include "StEvent/StRpsRomanPot.h"
4 #include "StEvent/StRpsPlane.h"
5 #include "StEvent/StRpsCluster.h"
6 #include <algorithm>
7 
8 
9 ClassImp(StMuRpsCollection)
10 
12 
13  mSiliconBunch = rps.siliconBunch();
14 
15  for(int i=0;i<mNumberOfRomanPot;i++){
16 
17  mNumberPlanesWithClusters[i] = rps.romanPot(i)->numberOfPlanesWithClusters();
18  mStatusRomanPot[i] = rps.romanPot(i)->status();
19  mADC[i][0] = rps.romanPot(i)->adc(0);
20  mADC[i][1] = rps.romanPot(i)->adc(1);
21  mTAC[i][0] = rps.romanPot(i)->tac(0);
22  mTAC[i][1] = rps.romanPot(i)->tac(1);
23 
24  for(int j=0;j<mNumberOfPlanes;j++){
25 
26  mOffsetPlane[i][j] = rps.romanPot(i)->plane(j)->offset();
27  mzPlane[i][j] = rps.romanPot(i)->plane(j)->z();
28  mAnglePlane[i][j] = rps.romanPot(i)->plane(j)->angle();
29  mOrientationPlane[i][j] = rps.romanPot(i)->plane(j)->orientation();
30  mStatusPlane[i][j] = rps.romanPot(i)->plane(j)->status();
31  mNumberOfClusters[i][j] = rps.romanPot(i)->plane(j)->numberOfClusters();
32 
33  for(int k=0;k<mNumberOfClusters[i][j];k++){
34 
35  mPositionCluster[i][j].push_back(rps.romanPot(i)->plane(j)->cluster(k)->position());
36  mPositionRMSCluster[i][j].push_back(rps.romanPot(i)->plane(j)->cluster(k)->positionRMS());
37  mLengthCluster[i][j].push_back(rps.romanPot(i)->plane(j)->cluster(k)->length());
38  mEnergyCluster[i][j].push_back(rps.romanPot(i)->plane(j)->cluster(k)->energy());
39  mXYCluster[i][j].push_back(rps.romanPot(i)->plane(j)->cluster(k)->xy());
40  mQualityCluster[i][j].push_back(rps.romanPot(i)->plane(j)->cluster(k)->quality());
41 
42  }
43  }
44  }
45 
46  // Add all of the track points
47  int nTrackPoints = rps.trackPoints().size();
48  for ( int i = 0; i < nTrackPoints; i++ ){
49  addTrackPoint( rps.trackPoints()[i] );
50  }
51 
52  // Need to mirror over the StRpsTracks
53  int nTracks = rps.tracks().size();
54  for ( int iTrack = 0; iTrack < nTracks; iTrack++ ){
55  StMuRpsTrack * muRpsTrack = new StMuRpsTrack();
56 
57  // Add the track points to the Tracks, if they are already in the collection (and they should be)
58  // then they wont be added again
59  for ( int iStation = 0; iStation < StMuRpsTrack::mNumberOfStationsInBranch; iStation++ ){
60  if ( rps.tracks()[iTrack] && rps.tracks()[iTrack]->trackPoint( iStation ) ){
61  StMuRpsTrackPoint * ptp = addTrackPoint( rps.tracks()[iTrack]->trackPoint( iStation ) );
62  muRpsTrack->setTrackPoint( ptp, iStation );
63  }
64  }
65  // Set the Track's attributes
66  muRpsTrack->setP( TVector3( rps.tracks()[iTrack]->pVec().x(), rps.tracks()[iTrack]->pVec().y(), rps.tracks()[iTrack]->pVec().z() ) );
67  muRpsTrack->setBranch( rps.tracks()[iTrack]->branch() );
68  muRpsTrack->setType( (StMuRpsTrack::StMuRpsTrackType)rps.tracks()[iTrack]->type() );
69 
70  // add it to collection
71  mTracks.push_back( muRpsTrack );
72  }
73 }
74 
75 
76 
77 StMuRpsTrackPoint* StMuRpsCollection::addTrackPoint( StRpsTrackPoint * rpsTP ){
78 
79  if ( mTrackPointsMap.count( rpsTP ) ){
80  return mTrackPointsMap[ rpsTP ];
81  }
82 
83  StMuRpsTrackPoint * muRpsTrackPoint = new StMuRpsTrackPoint();
84 
85  muRpsTrackPoint->setPosition( TVector3( rpsTP->x(), rpsTP->y(), rpsTP->z() ) );
86  muRpsTrackPoint->setQuality( (StMuRpsTrackPoint::StMuRpsTrackPointQuality)rpsTP->quality() );
87  muRpsTrackPoint->setRpId( rpsTP->rpId() );
88 
89  for ( int iPlane = 0; iPlane < StMuRpsTrackPoint::mNumberOfPlanesInRp; iPlane++ ){
90  muRpsTrackPoint->setClusterId( rpsTP->clusterId( iPlane ), iPlane );
91  }
92 
93  for ( int iPmt = 0; iPmt < StMuRpsTrackPoint::mNumberOfPmtsInRp; iPmt++ ){
94  muRpsTrackPoint->setTime( rpsTP->time( iPmt ), iPmt );
95  }
96 
97  mTrackPoints.push_back( muRpsTrackPoint );
98  mTrackPointsMap[ rpsTP ] = muRpsTrackPoint;
99  return muRpsTrackPoint;
100 }