3 #include <Reve/RGTopFrame.h>
5 #include <AliTOFdigit.h>
6 #include <AliTOFGeometry.h>
11 using namespace Alieve;
14 Bool_t TOFStrip::fgStaticInitDone = kFALSE;
15 FrameBox* TOFStrip::fgTOFstripFrameBox = 0;
16 RGBAPalette* TOFStrip::fgTOFstripPalette = 0;
18 //_______________________________________________________
21 /* ************************************************************************ */
23 TOFStrip::TOFStrip(const Text_t* n, const Text_t* t) :
25 fTOFgeometry(new AliTOFGeometry()),
27 fSector(-1), fPlate(-1), fStrip(-1),
31 fGeoManager = (TGeoManager*)gReve->GetGeometry("$REVESYS/alice-data/alice_fullgeo.root");
32 if (!fGeoManager) printf("ERROR: no TGeo\n");
35 /* ************************************************************************ */
37 TOFStrip::TOFStrip(TGeoManager *localGeoManager,
38 Int_t nSector, Int_t nPlate, Int_t nStrip)
40 QuadSet(Form("Strip%i",nStrip)),
41 fTOFgeometry(new AliTOFGeometry()),
43 fSector(nSector), fPlate(nPlate), fStrip(nStrip),
45 fGeoManager(localGeoManager)
48 //if (!fGeoManager) printf("ERROR: no TGeo\n");
53 /* ************************************************************************ */
55 TOFStrip::TOFStrip(TGeoManager *localGeoManager,
56 Int_t nSector, Int_t nPlate, Int_t nStrip,
57 TClonesArray *tofArray)
59 QuadSet(Form("Strip%i",nStrip)),
60 fTOFgeometry(new AliTOFGeometry()),
62 fSector(nSector), fPlate(nPlate), fStrip(nStrip),
64 fGeoManager(localGeoManager)
70 /* ************************************************************************ */
83 /* ************************************************************************ */
85 void TOFStrip::SetDigitsInfo(TOFDigitsInfo* info)
87 if(fInfo) fInfo->DecRefCount();
89 if(fInfo) fInfo->IncRefCount();
93 /* ************************************************************************ */
94 void TOFStrip::InitStatics()
96 if (fgStaticInitDone) return;
100 fgTOFstripFrameBox = new FrameBox();
102 fgTOFstripFrameBox->SetAAQuadXZ(-dx*0.5, 0, -dz*0.5, dx, dz);
103 fgTOFstripFrameBox->SetFrameColor((Color_t) 32);//31);
105 //fgTOFstripPalette = new RGBAPalette(0, 2048); // TOT
106 fgTOFstripPalette = new RGBAPalette(0, 8192); // TDC
108 fgStaticInitDone = kTRUE;
111 /* ************************************************************************ */
112 void TOFStrip::InitModule()
115 fDx = fTOFgeometry->XPad()*fTOFgeometry->NpadX();
116 fDz = fTOFgeometry->ZPad()*fTOFgeometry->NpadZ();
118 if (!fgStaticInitDone) InitStatics();
120 SetFrame(fgTOFstripFrameBox);
121 SetPalette(fgTOFstripPalette);
122 //fFrame = fgTOFstripFrameBox;
123 //fPalette = fgTOFstripPalette;
131 /* ************************************************************************ */
132 void TOFStrip::LoadQuads()
135 //Int_t n_col = gStyle->GetNumberOfColors();
144 Reset(QT_RectangleXZFixedY, kFALSE, 32);
146 AliTOFdigit *tofDigit;
148 //printf(" fTOFarray->GetEntries() = %4i \n",fTOFarray->GetEntries());
150 for (Int_t ii=0; ii<fTOFarray->GetEntries(); ii++) {
152 tofDigit = (AliTOFdigit*)fTOFarray->UncheckedAt(ii);
154 iPadX = tofDigit->GetPadx();
155 iPadZ = tofDigit->GetPadz();
157 tot = tofDigit->GetToT();
158 tdc = tofDigit->GetTdc();
160 //if (fSector==4 && fPlate==2 && fStrip==0) printf(" %2i %1i\n", iPadX, iPadZ);
161 //if (iPadX==23 || iPadX==24) printf(" %2i %1i %2i \n", fSector, fPlate, fStrip);
163 fTOFgeometry->DetToStripRF(iPadX, iPadZ, x, z);
165 AddQuad(x, z, 2.5, 3.5);
166 //AddQuad(-2.5*0.5, -3.5*0.5, 2.5, 3.5);
168 // In principle could have color based on number of neigbours. We
169 // can insert the time-of-flight value for each pad
170 //QuadValue((Int_t)tot);
171 QuadValue((Int_t)tdc);
173 //if (fSector==4 && fPlate==2 && fStrip==0) printf(" %1i %2i %f %f \n", iPadZ, iPadX, x, z);
181 /* ************************************************************ */
182 void TOFStrip::SetTrans()
185 fHMTrans.UnitTrans();
187 //Int_t det[5] = {fSector, fPlate, fStrip, -1, -1};
189 //fTOFgeometry->GetVolumePath(det,path);
190 fTOFgeometry->GetVolumePath(fSector, fPlate, fStrip, path);
192 fGeoManager->cd(path);
193 TGeoHMatrix global = *fGeoManager->GetCurrentMatrix();
194 Double_t *rotMat = global.GetRotationMatrix();
197 // ok till 19 April 2007
198 fHMTrans.SetBaseVec(1, rotMat[0], rotMat[1], rotMat[2]);
199 fHMTrans.SetBaseVec(2, rotMat[3], rotMat[4], rotMat[5]);
200 fHMTrans.SetBaseVec(3, rotMat[6], rotMat[7], rotMat[8]);
203 fHMTrans.SetBaseVec(1, rotMat[0], rotMat[3], rotMat[6]);
204 fHMTrans.SetBaseVec(2, rotMat[1], rotMat[4], rotMat[7]);
205 fHMTrans.SetBaseVec(3, rotMat[2], rotMat[5], rotMat[8]);
207 Double_t *tr = global.GetTranslation();
208 fHMTrans.SetBaseVec(4, tr);