StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StSvtGeantHits.cc
1 /***************************************************************************
2  *
3  * $Id: StSvtGeantHits.cc,v 1.7 2005/07/23 03:37:34 perev Exp $
4  *
5  * Author: Selemon Bekele
6  ***************************************************************************
7  *
8  * Description: keep geant hits for evaluation in hit maker
9  *
10  ***************************************************************************
11  *
12  * $Log: StSvtGeantHits.cc,v $
13  * Revision 1.7 2005/07/23 03:37:34 perev
14  * IdTruth + Cleanup
15  *
16  * Revision 1.6 2004/03/30 21:27:12 caines
17  * Remove asserts from code so doesnt crash if doesnt get parameters it just quits with kStErr
18  *
19  * Revision 1.4 2003/07/31 19:18:09 caines
20  * Petrs improved simulation code
21  *
22  * Revision 1.3 2001/08/13 15:34:18 bekele
23  * Debugging tools added
24  *
25  * Revision 1.2 2001/03/19 22:25:52 caines
26  * Catch wrong wafer ids more elegantly
27  *
28  * Revision 1.1 2000/11/30 20:47:48 caines
29  * First version of Slow Simulator - S. Bekele
30  *
31  **************************************************************************/
32 
33 #include <string.h>
34 #include "StSvtGeantHits.hh"
35 #include "StDbUtilities/StGlobalCoordinate.hh"
36 #include "StDbUtilities/StSvtWaferCoordinate.hh"
37 #include "StDbUtilities/StSvtLocalCoordinate.hh"
38 
39 ClassImp(StSvtGeantHits)
40 
41 StSvtGeantHits::StSvtGeantHits(int barrel, int ladder, int wafer, int hybrid):StSvtHybridObject(barrel,ladder,wafer,hybrid)
42 {
43  mNumOfHits = 0;
44  mPeak = new float[MAX_HITS];
45  mWaferCoord = new StSvtWaferCoordinate[MAX_HITS];
46  mGlobalCoord = new StGlobalCoordinate[MAX_HITS];
47  mLocalCoord = new StSvtLocalCoordinate[MAX_HITS];
48  mIdTrack = new int[MAX_HITS];
49 
50  memset(mPeak ,0,sizeof(mPeak [0])*MAX_HITS);
51  memset(mIdTrack,0,sizeof(mIdTrack[0])*MAX_HITS);
52 
53 }
54 
55 StSvtGeantHits::~StSvtGeantHits()
56 {
57  delete [] mWaferCoord;
58  delete [] mGlobalCoord;
59  delete [] mLocalCoord;
60  delete [] mIdTrack;
61 }
62 
63 void StSvtGeantHits::setNumOfHits(int nhits)
64 {
65  mNumOfHits = nhits;
66 }
67 
68 void StSvtGeantHits::setPeak(int index ,float peak)
69 {
70  mPeak[index] = peak;
71 }
72 
73 void StSvtGeantHits::setGeantHit(int index ,int* svtAtt, float* AnTime)
74 {
75  if (index > MAX_HITS)
76  return;
77 
78  mWaferCoord[index].setLayer(svtAtt[1]);
79  mWaferCoord[index].setLadder(svtAtt[2]);
80  mWaferCoord[index].setWafer(svtAtt[3]);
81  mWaferCoord[index].setHybrid(svtAtt[4]);
82  mWaferCoord[index].setAnode(AnTime[0]);
83  mWaferCoord[index].setTimeBucket(AnTime[1]);
84 }
85 
86 void StSvtGeantHits::setGeantHit(int index ,StSvtWaferCoordinate* waferCoord)
87 {
88  if (index > MAX_HITS)
89  return;
90 
91  mWaferCoord[index].setLayer(waferCoord->layer());
92  mWaferCoord[index].setLadder(waferCoord->ladder());
93  mWaferCoord[index].setWafer(waferCoord->wafer());
94  mWaferCoord[index].setHybrid(waferCoord->hybrid());
95  mWaferCoord[index].setAnode(waferCoord->anode());
96  mWaferCoord[index].setTimeBucket(waferCoord->timebucket());
97 }
98 void StSvtGeantHits::setTrackId(int index ,int idtrk)
99 {
100  mIdTrack[index] = idtrk;
101 }
102 
103 int StSvtGeantHits::getTrackId(int index)
104 {
105  return mIdTrack[index];
106 }
107 
108 void StSvtGeantHits::setGlobalCoord( int index, StThreeVector<double>* x ){
109 
110  mGlobalCoord[index].setPosition(*x);
111 }
112 
113 void StSvtGeantHits::setLocalCoord( int index, StThreeVector<double>* x ){
114 
115  mLocalCoord[index].setPosition(*x);
116 }