StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StSvtDaqData.cc
1 /***************************************************************************
2  *
3  * $Id: StSvtDaqData.cc,v 1.9 2004/01/27 02:36:02 perev Exp $
4  *
5  * Author: Marcelo Munhoz
6  ***************************************************************************
7  *
8  * Description: SVT Data BASE class
9  *
10  ***************************************************************************
11  *
12  * $Log: StSvtDaqData.cc,v $
13  * Revision 1.9 2004/01/27 02:36:02 perev
14  * LeakOff
15  *
16  * Revision 1.8 2003/09/02 17:59:08 perev
17  * gcc 3.2 updates + WarnOff
18  *
19  * Revision 1.7 2002/05/10 21:12:36 caines
20  * Dont swap ladders 15 and 16 for pp sort this out properly late
21  *
22  * Revision 1.6 2002/05/06 00:35:31 munhoz
23  * correct hybrid swapping
24  *
25  * Revision 1.5 2001/10/24 16:49:42 munhoz
26  * adding capability to retrieve t0 and first SCA
27  *
28  * Revision 1.4 2001/07/11 23:29:47 munhoz
29  * adding capability for zero suppressed and pedestal reading
30  *
31  * Revision 1.2 2000/07/03 02:07:55 perev
32  * StEvent: vector<TObject*>
33  *
34  * Revision 1.1 2000/06/13 20:42:05 caines
35  * StRoot/StSvtDaqMaker
36  *
37  **************************************************************************/
39 // //
40 // It is a collection of StSvtHybridData objects. //
41 // It represents the entire SVT data. //
42 // //
44 
45 #include <Stiostream.h>
46 #include "StSvtHybridDaqData.hh"
47 #include "StSvtDaqData.hh"
48 
49 ClassImp(StSvtDaqData)
50 
52  StSvtData()
53 {}
54 
55 StSvtDaqData::StSvtDaqData(const char* config, StSVTReader* reader, const char* option, int run, int event, int trigger) :
56  StSvtData(config, run, event, trigger)
57 {
58  // The Same as StSvtHybridCollection, with two additional parameters:
59  // event number and trigger type
60 
61  mRunNumber = run;
62  mEventNumber = event;
63  mTriggerWord = trigger;
64 
65  if (reader)
66  setData(reader,option);
67 }
68 
69 StSvtDaqData::StSvtDaqData(StSvtConfig* config, StSVTReader* reader, const char* option, int run, int event, int trigger) :
70  StSvtData(config, run, event, trigger)
71 {
72  // The Same as StSvtHybridCollection, with two additional parameters:
73  // event number and trigger type
74 
75  mRunNumber = run;
76  mEventNumber = event;
77  mTriggerWord = trigger;
78 
79  if (reader)
80  setData(reader,option);
81 }
82 
83 int StSvtDaqData::setData(StSVTReader* reader, const char* option)
84 {
85  int status, index;
86 
87  for (int barrel = 1;barrel <= getNumberOfBarrels();barrel++) {
88  for (int ladder = 1;ladder <= getNumberOfLadders(barrel);ladder++) {
89  for (int wafer = 1;wafer <= getNumberOfWafers(barrel);wafer++) {
90  for (int hybrid = 1;hybrid <= getNumberOfHybrids();hybrid++) {
91 
92  index = getHybridIndex(barrel,ladder,wafer,hybrid);
93  if (index < 0) continue;
94 
95  //printf("StSvtDaqMaker::barrel = %d, ladder = %d, wafer = %d, hybrid = %d\n",barrel,ladder,wafer,hybrid);
96 
97  // have to swap the hybrids in collection due to hardware swapping for Y1
98  if ( !strncmp(getConfiguration(), "Y1L", strlen("Y1L")) ) {
99  if (hybrid == 1)
100  index = getHybridIndex(barrel, ladder, wafer, 2);
101  else if (hybrid == 2)
102  index = getHybridIndex(barrel, ladder, wafer, 1);
103  }
104  else {
105  if( (barrel == 2) && (ladder == 1) && (wafer > 3)){
106  if( hybrid ==1) index++;
107  if( hybrid ==2) index --;
108  }
109  else if( (barrel == 2) && (ladder == 8) && (wafer < 4)){
110  if( hybrid ==1) index++;
111  if( hybrid ==2) index --;
112  }
113  else if( (barrel == 3) && (ladder == 16) && (wafer > 4)){
114  //index -= 14;
115  }
116  else if( (barrel == 3) && (ladder == 15) && (wafer > 4)){
117  //index += 14;
118  }
119  }
120 
121  StSvtHybridDaqData* mData = (StSvtHybridDaqData*)at(index);
122 
123  if (mData) {
124  delete mData;
125  put_at(0,index);
126  }
127 
128  //if (mData)
129  // mData->reset();
130  //else
131  mData = new StSvtHybridDaqData(barrel, ladder, wafer, hybrid);
132 
133  status = ((StSvtHybridDaqData*)mData)->setHybridData(reader, option);
134 
135  if ((barrel == 1) && (ladder == 1) && (wafer == 2)) {
136  ((StSvtHybridDaqData*)at(getHybridIndex(1, 1, 1, 1)))->setSCAZero(((StSvtHybridDaqData*)mData)->getSCAZero());
137  ((StSvtHybridDaqData*)at(getHybridIndex(1, 1, 1, 2)))->setSCAZero(((StSvtHybridDaqData*)mData)->getSCAZero());
138  ((StSvtHybridDaqData*)at(getHybridIndex(1, 1, 1, 1)))->setTimeZero(((StSvtHybridDaqData*)mData)->getTimeZero());
139  ((StSvtHybridDaqData*)at(getHybridIndex(1, 1, 1, 2)))->setTimeZero(((StSvtHybridDaqData*)mData)->getTimeZero());
140  }
141 
142  if (status >= 0) {
143  put_at(mData, index);
144  }
145  else
146  delete mData;
147  }
148  }
149  }
150  }
151  return 0;
152 }
153 
154