6 #include "StTpcDb/StTpcDb.h"
7 #include "St_db_Maker/St_db_Maker.h"
9 #include "tables/St_Survey_Table.h"
10 #include "tables/St_fstPedNoise_Table.h"
11 #include "tables/St_fstGain_Table.h"
12 #include "tables/St_fstMapping_Table.h"
13 #include "tables/St_fstControl_Table.h"
14 #include "tables/St_fstChipConfig_Table.h"
16 THashList *StFstDb::mgRotList = 0;
27 mGeoHMatrixTpcOnGlobal = NULL;
32 mFstChipStatus = NULL;
35 Int_t StFstDb::setGeoHMatrices(Survey_st **tables)
39 SafeDelete(mgRotList);
40 mgRotList =
new THashList(kFstNumWedges * kFstNumSensorsPerWedge, 0);
41 mgRotList->SetOwner(kFALSE);
45 mGeoHMatrixTpcOnGlobal = (TGeoHMatrix *)&gStTpcDb->Tpc2GlobalMatrix();
48 if (mGeoHMatrixTpcOnGlobal)
delete mGeoHMatrixTpcOnGlobal;
50 mGeoHMatrixTpcOnGlobal =
new TGeoHMatrix(
"tpcOnGlobal");
51 LOG_WARN <<
"No gStTpcDb, use null transformation for tpc on global" << endm;
55 Survey_st *fstOnTpc = tables[0];
56 Survey_st *hssOnFst = tables[1];
57 Survey_st *wedgeOnHss = tables[2];
58 Survey_st *sensorsOnWedges = tables[3];
60 mGeoHMatrixFstOnTpc.SetName(
"fstOnTpc");
61 mGeoHMatrixFstOnTpc.SetRotation(&fstOnTpc->r00);
62 mGeoHMatrixFstOnTpc.SetTranslation(&fstOnTpc->t0);
64 mGeoHMatrixHssOnFst.SetName(
"hssOnFst");
65 mGeoHMatrixHssOnFst.SetRotation(&hssOnFst->r00);
66 mGeoHMatrixHssOnFst.SetTranslation(&hssOnFst->t0);
68 mGeoHMatrixWedgeOnHss.SetName(
"wedgeOnHss");
69 mGeoHMatrixWedgeOnHss.SetRotation(&wedgeOnHss->r00);
70 mGeoHMatrixWedgeOnHss.SetTranslation(&wedgeOnHss->t0);
71 for (
int i = 0; i < kFstNumSensors; i++, sensorsOnWedges++) {
72 int id = sensorsOnWedges->Id;
73 TGeoHMatrix *comb = (TGeoHMatrix *) mgRotList->FindObject(Form(
"R%04i",
id));
77 comb =
new TGeoHMatrix(Form(
"R%04i",
id));
78 int wedge = (
id - 1000) / kFstNumSensorsPerWedge + 1;
79 int sensor = (
id - 1000) % kFstNumSensorsPerWedge;
80 cout<<
"id"<<
id<<
" "<<
"wedge"<<wedge<<
"sensor"<<sensor<<endl;
82 if (wedge <= 0 || wedge > kFstNumWedges) {
83 LOG_WARN <<
"Wedge ID is out of range (1 - 36)!" << endm;
87 if (sensor < 0 || sensor >= kFstNumSensorsPerWedge) {
88 LOG_WARN <<
"Sensor ID is out of range (0 - 2)!" << endm;
93 mGeoHMatrixSensorOnWedge[wedge - 1][sensor].SetName(Form(
"sensorOnWedge%4i%4i", wedge, sensor));
94 mGeoHMatrixSensorOnWedge[wedge - 1][sensor].SetRotation(&sensorsOnWedges->r00);
95 mGeoHMatrixSensorOnWedge[wedge - 1][sensor].SetTranslation(&sensorsOnWedges->t0);
97 TGeoHMatrix *sensorLocal = (TGeoHMatrix *) mgRotList->FindObject(Form(
"sensorLocal%04i",
id));
100 sensorLocal =
new TGeoHMatrix(Form(
"sensorLocal%04i",
id));
101 sensorLocal->SetRotation(mGeoHMatrixSensorOnWedge[wedge - 1][sensor].GetRotationMatrix());
102 sensorLocal->SetTranslation(mGeoHMatrixSensorOnWedge[wedge - 1][sensor].GetTranslation());
103 mgRotList->Add(sensorLocal);
107 TGeoHMatrix sensorGlobal = (*mGeoHMatrixTpcOnGlobal) * mGeoHMatrixFstOnTpc * mGeoHMatrixHssOnFst * mGeoHMatrixWedgeOnHss * mGeoHMatrixSensorOnWedge[wedge - 1][sensor];
109 comb->SetRotation(sensorGlobal.GetRotationMatrix());
110 comb->SetTranslation(sensorGlobal.GetTranslation());
111 mgRotList->Add(comb);
125 if (wedge < 1 || wedge > kFstNumWedges || sensor < 0 || sensor >= kFstNumSensorsPerWedge)
128 int id = 1000 + (wedge - 1) * kFstNumSensorsPerWedge + sensor;
129 return mgRotList ? (
const TGeoHMatrix *) mgRotList->FindObject(Form(
"R%04i",
id)) : 0;
133 void StFstDb::Print(Option_t *opt)
const
135 mGeoHMatrixTpcOnGlobal->Print();
136 mGeoHMatrixFstOnTpc.Print();
137 mGeoHMatrixHssOnFst.Print();
138 mGeoHMatrixWedgeOnHss.Print();
140 for (Int_t iL = 0; iL < kFstNumWedges; iL++) {
141 for (Int_t iS = 0; iS < kFstNumSensorsPerWedge; iS++) {
142 mGeoHMatrixSensorOnWedge[iL][iS].Print();
146 for (Int_t iS = 0; iS < kFstNumSensors; iS++) {
147 TGeoHMatrix *sensorOnGlobal = (TGeoHMatrix *) mgRotList->FindObject(Form(
"R%04i", iS + 1000));
148 sensorOnGlobal->Print();
static const TGeoHMatrix * getHMatrixSensorOnGlobal(int wedge, int sensor)