StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StSsdLadder.cc
1 // $Id: StSsdLadder.cc,v 1.5 2014/10/18 19:31:56 smirnovd Exp $
2 //
3 // $Log: StSsdLadder.cc,v $
4 // Revision 1.5 2014/10/18 19:31:56 smirnovd
5 // Revert "1st commit" asked by Jonathan
6 //
7 // Revision 1.3 2008/01/11 10:40:38 bouchet
8 // Use of the wafer configuration table
9 //
10 // Revision 1.2 2007/03/21 17:20:41 fisyak
11 // use TGeoHMatrix for coordinate transformation
12 //
13 // Revision 1.1 2006/10/16 16:43:29 bouchet
14 // StSsdUtil regroups now methods for the classes StSsdStrip, StSsdCluster and StSsdPoint
15 //
16 // Revision 1.7 2006/01/18 22:49:22 jeromel
17 // Removed latest change (no time to check new method)
18 //
19 // Revision 1.5 2005/03/18 14:06:30 lmartin
20 // missing CVS header added
21 //
22 
23 #include "StSsdUtil/StSsdLadder.hh"
24 #include <Stiostream.h>
25 
26 #include "tables/St_ssdWaferConfiguration_Table.h"
27 
28 StSsdLadder::StSsdLadder(Int_t rLadderNumb,Int_t rSsdLayer,Int_t rNWaferPerLadder,Int_t rNStripPerSide) : mDebug(0)
29 {
30  // Note iWaf = 0->15 whereas iW = 1->16 !
31  // mLadderNumb = iLad = 0->19 whereas iL = 1->20 !
32  memset (first, 0, last-first);
33  mLadderNumb = rLadderNumb;
34  mSsdLayer = rSsdLayer;
35  mNWaferPerLadder = rNWaferPerLadder;
36  mNStripPerSide = rNStripPerSide;
37 
38  Int_t nWafer = mNWaferPerLadder;
39  Int_t idWaf = 0;
40 
41  mWafers = new StSsdWafer*[nWafer];
42  for (Int_t iWaf=0; iWaf < nWafer; iWaf++)
43  {
44  idWaf = waferNumbToIdWafer(iWaf);
45  mWafers[iWaf] = new StSsdWafer(idWaf);
46  if (Debug()) mWafers[iWaf]->SetDebug(Debug());
47  }
48 }
49 
50 StSsdLadder::~StSsdLadder()
51 {
52  for (Int_t iWaf = 0 ; iWaf < mNWaferPerLadder ; iWaf++)
53  delete mWafers[iWaf];
54 }
55 
56 void StSsdLadder::initWafers(St_ssdWafersPosition *Position)
57 {
58  Int_t idWafer = 0;
59  Int_t iWaf = 0;
60  ssdWafersPosition_st *position = Position->GetTable();
61  Int_t N = Position->GetNRows();
62  for (Int_t i = 0; i < N; i++) // loop over the full table now.
63  {
64  idWafer = position[i].id;
65  iWaf = idWaferToWafer(idWafer);
66  if ((idWafer > mSsdLayer*1000)&&
67  (mLadderNumb == idWafer%100-1)){
68  mWafers[iWaf]->init(idWafer, position[i].driftDirection, position[i].transverseDirection, position[i].normalDirection, position[i].centerPosition);}
69  }
70 }
71 
72 void StSsdLadder::initWafers(St_ssdWafersPosition *Position,Int_t WafStatus[20][16])
73 {
74  Int_t idWafer = 0;
75  Int_t iWaf = 0;
76  ssdWafersPosition_st *position = Position->GetTable();
77  Int_t N = Position->GetNRows();
78  for (Int_t i = 0; i < N; i++) // loop over the full table now.
79  {
80  idWafer = position[i].id;
81  iWaf = idWaferToWafer(idWafer);
82  if ((idWafer > mSsdLayer*1000)&&
83  (mLadderNumb == idWafer%100-1)){
84  if(WafStatus[mLadderNumb][iWaf]!=0){
85  printf("Ladder %d Wafer %d status %d\n",mLadderNumb,iWaf,WafStatus[mLadderNumb][iWaf]);
86  mWafers[iWaf]->init(idWafer, position[i].driftDirection, position[i].transverseDirection, position[i].normalDirection, position[i].centerPosition);
87  }
88  }
89  }
90 }
91 
92 void StSsdLadder::Reset(){
93  for (Int_t iWaf = 0; iWaf < mNWaferPerLadder; iWaf++)mWafers[iWaf]->Reset();
94 }
95 
96 
97 Int_t StSsdLadder::idWaferToWaferNumb(Int_t idWafer)
98 {
99  Int_t iW = (int)((idWafer - mSsdLayer*1000)/100);
100  return (iW-1);
101 }
102 
103 Int_t StSsdLadder::waferNumbToIdWafer(Int_t waferNumb)
104 {
105  Int_t iL = mLadderNumb+1; // iL:1->20
106  Int_t iW = waferNumb+1; // iW:1->16
107  return mSsdLayer*1000 + iW*100 + iL;
108 }
109 
110 void StSsdLadder::debugUnPeu(Int_t monwafer)
111 {
112  for (Int_t j=0;j<this->getWaferPerLadder();j++)
113  {
114  if (this->mWafers[j]->getIdWafer()==this->waferNumbToIdWafer(monwafer))
115  {
116  cout<<" Wafer "<<monwafer<<" found with id :"<<this->mWafers[j]->getIdWafer()<<endl;
117  this->mWafers[j]->debugStrips();
118  this->mWafers[j]->debugClusters();
119  }
120  }
121 
122 }
void init(Int_t rId, Double_t *rD, Double_t *rT, Double_t *rN, Double_t *rX)
Definition: StSsdWafer.cc:126