StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StSvtWaferCollection.cc
1 /***************************************************************************
2  *
3  * $Id: StSvtWaferCollection.cc,v 1.3 2004/01/27 02:29:29 perev Exp $
4  *
5  * Author: Marcelo Munhoz
6  ***************************************************************************
7  *
8  * Description: SVT Wafer Array BASE class
9  *
10  ***************************************************************************
11  *
12  * $Log: StSvtWaferCollection.cc,v $
13  * Revision 1.3 2004/01/27 02:29:29 perev
14  * LeakOff
15  *
16  * Revision 1.2 2003/09/02 17:59:06 perev
17  * gcc 3.2 updates + WarnOff
18  *
19  * Revision 1.1 2001/08/16 21:02:04 munhoz
20  * changing StObjArray to StStrArray. StSvtConfig reestructured. New classes for geometry DB
21  *
22  *
23  **************************************************************************/
25 // //
26 // This class corresponds to a collection of hybrid objects(for instance, StSvtHybridObject). //
27 // Basically, it represents the entire SVT, since the detector is a "collection" of hybrids (basic unit).//
28 // This should be the base class for any "SVT object". //
29 // For instance, the SVT pedestals (that inherits from StSvtHybridCollection) //
30 // is a collection of hybrid pedestals (that inherits from StSvtHybridObject). //
31 // //
33 
34 
35 #include <Stiostream.h>
36 #include "StObject.h"
37 #include "StSvtWaferCollection.hh"
38 #include "StSvtConfig.hh"
39 #include "StMessMgr.h"
40 
41 #include "TString.h"
42 
43 ClassImp(StSvtWaferCollection)
44 
46 {
47  // As the SVT can present various configurations,
48  // the constructor of this class has one parameter that corresponds to the configuration name.
49  // So far, there are three configurations defined:
50  // "FULL": corresponds to the full detector (216 wafers or 432 hybrids);
51  // "Y1L": corresponds to the year 1 ladder (7 wafers or 14 hybrids).
52  // They are located in barrel 3 ladder 1. The index goes from 1 to 14;
53  // "SYST": corresponds to the system test configuration.
54  // The configuration of the system test correspond to 9 wafers (or 18 hybrids)
55  // that corresponds to the maximum number of detectors that a Receiver board can read.
56  // There is no meaningful barrel, ladder, wafer or hybrid number information.
57  // The hybrid index depends on the order of the read out in the RB.
58 
59  mConfig = TString();
60  mSvtConfig = NULL;
61 }
62 
63 StSvtWaferCollection::StSvtWaferCollection(const char* config)
64 {
65  setConfiguration(config);
66 }
67 
68 StSvtWaferCollection::StSvtWaferCollection(StSvtConfig* config)
69 {
70  setConfiguration(config);
71 }
72 
73 StSvtWaferCollection::~StSvtWaferCollection()
74 {
75  //delete mSvtConfig;
76 }
77 
78 void StSvtWaferCollection::setConfiguration(const char* config)
79 {
80  // set the Collection configuration
81 
82  mConfig = TString(config);
83  mSvtConfig = new StSvtConfig();
84  mSvtConfig->setConfiguration(config);
85 
86  clear();
87  resize(mSvtConfig->getTotalNumberOfHybrids()/2);
88 }
89 
90 void StSvtWaferCollection::setConfiguration(StSvtConfig* config)
91 {
92  // set the Collection configuration
93 
94  mSvtConfig = config;
95  mConfig = TString(mSvtConfig->getConfiguration());
96 
97  clear();
98  resize(mSvtConfig->getTotalNumberOfHybrids()/2);
99 }
100 
101 int StSvtWaferCollection::getWaferIndex(int barrelID, int ladderID, int waferID)
102 {
103  // returns an internal index for the specified wafer.
104  // This index should be used to store/retrieve a specific wafer in/from the collection.
105  // Or one can use the getObject method which parameters are the barrel, ladder, wafer and hybrid numbers.
106 
107  int index;
108 
109  if (mSvtConfig) {
110  index = (int)mSvtConfig->getHybridIndex(barrelID, ladderID, waferID, 1)/2;
111  return index;
112  }
113 
114  return -1;
115 }
116 
117 /*
118 StSvtHybridObject* StSvtWaferCollection::At(int index)
119 {
120  return (StSvtHybridObject*)at(index);
121 }
122 
123 void StSvtWaferCollection::AddAt(StSvtHybridObject* object, int index)
124 {
125  put_at((TObject*)object,index);
126 }
127 */
128 
129 StSvtHybridObject* StSvtWaferCollection::getObject(int barrelID, int ladderID, int waferID)
130 {
131  // Method to retrieve an object (StSvtHybridObject) of the collection using the barrel, ladder, wafer numbers.
132 
133  int index = getWaferIndex(barrelID, ladderID, waferID);
134 
135  if (index<0) return 0;
136 
137  //return (StSvtHybridObject*)At(index);
138  return (StSvtHybridObject*)at(index);
139 }
140 
141 int StSvtWaferCollection::getNumberOfBarrels() {return mSvtConfig->getNumberOfBarrels();}
142 int StSvtWaferCollection::getNumberOfLadders(int barrel) {return mSvtConfig->getNumberOfLadders(barrel);}
143 int StSvtWaferCollection::getNumberOfWafers(int barrel) {return mSvtConfig->getNumberOfWafers(barrel);}
144 int StSvtWaferCollection::getTotalNumberOfWafers() {return (int)mSvtConfig->getTotalNumberOfHybrids()/2;}
145 const char* StSvtWaferCollection::getConfiguration(){return mConfig.Data();}
146 
TString mConfig
SVT Configuration.