StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StSvtHybridPixels.cc
1  /***************************************************************************
2  *
3  * $Id: StSvtHybridPixels.cc,v 1.4 2003/09/02 17:59:06 perev Exp $
4  *
5  * Author: Marcelo Munhoz
6  ***************************************************************************
7  *
8  * Description: SVT Hybrid Pixels class
9  *
10  ***************************************************************************
11  *
12  * $Log: StSvtHybridPixels.cc,v $
13  * Revision 1.4 2003/09/02 17:59:06 perev
14  * gcc 3.2 updates + WarnOff
15  *
16  * Revision 1.3 2000/11/30 20:39:12 caines
17  * Changed to allow us of database
18  *
19  * Revision 1.1.1.1 2000/03/10 14:26:21 munhoz
20  * SVT Class Library
21  *
22  **************************************************************************/
24 // //
25 // It is an array of 240 X 128 floats. //
26 // It can be used to store any pixel data from one hybrid. //
27 // For instance, the pedestals can be defined as a StSvtHybridPixels. //
28 // //
30 
31 #include <Stiostream.h>
32 #include "StSvtHybridPixels.hh"
33 
34 ClassImp(StSvtHybridPixels)
35 
37  StSvtHybridObject(), TArrayF()
38 {
39  // Default Constructor
40 
41  mNumberOfAnodes = 0;
42  mNumberOfTimeBins = 0;
43 
44  mTotalNumberOfPixels = 0;
45 }
46 
47 StSvtHybridPixels::StSvtHybridPixels(int barrel, int ladder, int wafer, int hybrid, int size, float* x) :
48  StSvtHybridObject(barrel, ladder, wafer, hybrid)
49 {
50  // The same as StSvtHybridObject.
51 
52  mNumberOfAnodes = 240;
53  mNumberOfTimeBins = 128;
54 
55  mTotalNumberOfPixels = mNumberOfAnodes*mNumberOfTimeBins;
56 
57  if (size)
58  if (x)
59  Set(mTotalNumberOfPixels,x);
60  else
61  Set(size);
62  else
63  Set(mTotalNumberOfPixels);
64 }
65 
66 StSvtHybridPixels::~StSvtHybridPixels()
67 {}
68 
69 StSvtHybridPixels& StSvtHybridPixels::operator = (StSvtHybridPixels& h)
70 {
71  float x;
72 
73  for (int i=0;i<mTotalNumberOfPixels;i++) {
74  x = h.At(i);
75  AddAt(x,i);
76  }
77  return *this;
78 }
79 
80 StSvtHybridPixels& StSvtHybridPixels::operator + (StSvtHybridPixels& h)
81 {
82  float x1, x2;
83 
84  for (int i=0;i<mTotalNumberOfPixels;i++) {
85  x1 = At(i);
86  x2 = h.At(i);
87  AddAt(x1+x2,i);
88  }
89  return *this;
90 }
91 
92 Float_t StSvtHybridPixels::getPixelContent(int anode, int time)
93 {
94  // Returns the pixel content based on the anode and time bin numbers
95  int index = getPixelIndex(anode, time);
96 
97  return At(index);
98 }
99 
100 void StSvtHybridPixels::addToPixel(int anode, int time, float x)
101 {
102  float x1;
103  int index = getPixelIndex(anode, time);
104 
105  x1 = At(index);
106  AddAt(x+x1,index);
107 }
108 
109 void StSvtHybridPixels::addToPixel(int index, float x)
110 {
111  float x1;
112 
113  x1 = At(index);
114  AddAt(x+x1,index);
115 }
116 
117 int StSvtHybridPixels::getPixelIndex(int anode, int time)
118 {
119  // Returns an internal index for pixel (anode,time).
120  // It should be used to store or retrieve a pixel value from this object.
121 
122  int index;
123 
124  index = mNumberOfTimeBins*(anode-1) + time;
125 
126  return index;
127 }
128 
129 void StSvtHybridPixels::reset()
130 {
131  for (int i=0;i<mTotalNumberOfPixels;i++)
132  AddAt(0,i);
133 }