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