StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StSvtDaqPed.cc
1 /***************************************************************************
2  *
3  * $Id: StSvtDaqPed.cc,v 1.2 2003/09/02 17:59:08 perev Exp $
4  *
5  * Author: Marcelo Munhoz
6  ***************************************************************************
7  *
8  * Description: SVT Data BASE class
9  *
10  ***************************************************************************
11  *
12  * $Log: StSvtDaqPed.cc,v $
13  * Revision 1.2 2003/09/02 17:59:08 perev
14  * gcc 3.2 updates + WarnOff
15  *
16  * Revision 1.1 2001/07/11 23:29:48 munhoz
17  * adding capability for zero suppressed and pedestal reading
18  *
19  *
20  **************************************************************************/
22 // //
23 // It is a collection of StSvtHybridData objects. //
24 // It represents the entire SVT data. //
25 // //
27 
28 #include <Stiostream.h>
29 #include "StSvtHybridDaqPed.hh"
30 #include "StSvtDaqPed.hh"
31 #include "StDAQMaker/StSVTReader.h"
32 
33 ClassImp(StSvtDaqPed)
34 
37 {}
38 
39 StSvtDaqPed::StSvtDaqPed(const char* config, StSVTReader* reader, int run) :
40  StSvtHybridCollection(config)
41 {
42  // The Same as StSvtHybridCollection, with two additional parameters:
43  // event number and trigger type
44 
45  mRunNumber = run;
46 
47  if (reader)
48  setPed(reader);
49 }
50 
51 StSvtDaqPed::StSvtDaqPed(StSvtConfig* config, StSVTReader* reader, int run) :
52  StSvtHybridCollection(config)
53 {
54  // The Same as StSvtHybridCollection, with two additional parameters:
55  // event number and trigger type
56 
57  mRunNumber = run;
58 
59  if (reader)
60  setPed(reader);
61 }
62 
63 int StSvtDaqPed::setPed(StSVTReader* reader, const char* type)
64 {
65  int status=-1;
66 
67  for (int barrel = 1;barrel <= getNumberOfBarrels();barrel++) {
68  for (int ladder = 1;ladder <= getNumberOfLadders(barrel);ladder++) {
69  for (int wafer = 1;wafer <= getNumberOfWafers(barrel);wafer++) {
70  for (int hybrid = 1;hybrid <= getNumberOfHybrids();hybrid++) {
71 
72  if (getHybridIndex(barrel,ladder,wafer,hybrid) < 0) continue;
73 
74  //printf("StSvtDaqMaker::barrel = %d, ladder = %d, wafer = %d, hybrid = %d\n",barrel,ladder,wafer,hybrid);
75 
76  // have to swap the hybrids in collection due to hardware swapping for Y1
77  if ( !strncmp(getConfiguration(), "Y1L", strlen("Y1L")) ) {
78  if (hybrid == 1)
79  mPed = (StSvtHybridDaqPed*)at(getHybridIndex(barrel, ladder, wafer, 2));
80  else if (hybrid == 2)
81  mPed = (StSvtHybridDaqPed*)at(getHybridIndex(barrel, ladder, wafer, 1));
82  }
83  else
84  mPed = (StSvtHybridDaqPed*)at(getHybridIndex(barrel, ladder, wafer, hybrid));
85 
86  //if (mPed)
87  // delete mPed;
88 
89  //cout << "mPed = " << mPed << endl;
90 
91  //if (mPed) {
92  // delete mPed;
93  // put_at(NULL, getHybridIndex(barrel,ladder,wafer,hybrid));
94  //}
95 
96  if (!mPed)
97  mPed = new StSvtHybridDaqPed(barrel, ladder, wafer, hybrid);
98 
99  if ( !strncmp(type, "PED", strlen("PED")) )
100  status = mPed->setHybridPed(reader);
101  else if ( !strncmp(type, "RMS", strlen("RMS")) )
102  status = mPed->setHybridRMSPed(reader);
103 
104  if (status < 0)
105  mPed->reset();
106 
107  // have to swap the hybrids in collection due to hardware swapping for Y1
108  if ( !strncmp(getConfiguration(), "Y1L", strlen("Y1L")) ) {
109  if (hybrid == 1 || hybrid == 2 )
110  put_at(mPed, getHybridIndex(barrel,ladder,wafer,3-hybrid));
111  }
112  else
113  put_at(mPed, getHybridIndex(barrel,ladder,wafer,hybrid));
114  }
115  }
116  }
117  }
118  return 0;
119 }
120 
121