3 #include <TEveManager.h>
5 #include <AliTOFdigit.h>
6 #include <AliTOFGeometry.h>
9 using namespace Alieve;
12 Bool_t TOFStrip::fgStaticInitDone = kFALSE;
13 TEveFrameBox* TOFStrip::fgTOFstripFrameBox = 0;
14 TEveRGBAPalette* TOFStrip::fgTOFstripPalette = 0;
16 //_______________________________________________________
19 /* ************************************************************************ */
21 TOFStrip::TOFStrip(const Text_t* n, const Text_t* t) :
23 fTOFgeometry(new AliTOFGeometry()),
25 fSector(-1), fPlate(-1), fStrip(-1),
29 fGeoManager = (TGeoManager*)gEve->GetGeometry("$REVESYS/alice-data/alice_fullgeo.root");
30 if (!fGeoManager) printf("ERROR: no TGeo\n");
33 /* ************************************************************************ */
35 TOFStrip::TOFStrip(TGeoManager *localGeoManager,
36 Int_t nSector, Int_t nPlate, Int_t nStrip)
38 TEveQuadSet(Form("Strip%i",nStrip)),
39 fTOFgeometry(new AliTOFGeometry()),
41 fSector(nSector), fPlate(nPlate), fStrip(nStrip),
43 fGeoManager(localGeoManager)
46 //if (!fGeoManager) printf("ERROR: no TGeo\n");
51 /* ************************************************************************ */
53 TOFStrip::TOFStrip(TGeoManager *localGeoManager,
54 Int_t nSector, Int_t nPlate, Int_t nStrip,
55 TClonesArray *tofArray)
57 TEveQuadSet(Form("Strip%i",nStrip)),
58 fTOFgeometry(new AliTOFGeometry()),
60 fSector(nSector), fPlate(nPlate), fStrip(nStrip),
62 fGeoManager(localGeoManager)
68 /* ************************************************************************ */
81 /* ************************************************************************ */
83 void TOFStrip::SetDigitsInfo(TOFDigitsInfo* info)
85 if(fInfo) fInfo->DecRefCount();
87 if(fInfo) fInfo->IncRefCount();
91 /* ************************************************************************ */
92 void TOFStrip::InitStatics()
94 if (fgStaticInitDone) return;
98 fgTOFstripFrameBox = new TEveFrameBox();
100 fgTOFstripFrameBox->SetAAQuadXZ(-dx*0.5, 0, -dz*0.5, dx, dz);
101 fgTOFstripFrameBox->SetFrameColor((Color_t) 32);//31);
103 //fgTOFstripPalette = new TEveRGBAPalette(0, 2048); // TOT
104 fgTOFstripPalette = new TEveRGBAPalette(0, 8192); // TDC
106 fgStaticInitDone = kTRUE;
109 /* ************************************************************************ */
110 void TOFStrip::InitModule()
113 fDx = fTOFgeometry->XPad()*fTOFgeometry->NpadX();
114 fDz = fTOFgeometry->ZPad()*fTOFgeometry->NpadZ();
116 if (!fgStaticInitDone) InitStatics();
118 SetFrame(fgTOFstripFrameBox);
119 SetPalette(fgTOFstripPalette);
120 //fFrame = fgTOFstripFrameBox;
121 //fPalette = fgTOFstripPalette;
129 /* ************************************************************************ */
130 void TOFStrip::LoadQuads()
133 //Int_t n_col = gStyle->GetNumberOfColors();
142 Reset(kQT_RectangleXZFixedY, kFALSE, 32);
144 AliTOFdigit *tofDigit;
146 //printf(" fTOFarray->GetEntries() = %4i \n",fTOFarray->GetEntries());
148 for (Int_t ii=0; ii<fTOFarray->GetEntries(); ii++) {
150 tofDigit = (AliTOFdigit*)fTOFarray->UncheckedAt(ii);
152 iPadX = tofDigit->GetPadx();
153 iPadZ = tofDigit->GetPadz();
155 tot = tofDigit->GetToT();
156 tdc = tofDigit->GetTdc();
158 //if (fSector==4 && fPlate==2 && fStrip==0) printf(" %2i %1i\n", iPadX, iPadZ);
159 //if (iPadX==23 || iPadX==24) printf(" %2i %1i %2i \n", fSector, fPlate, fStrip);
161 fTOFgeometry->DetToStripRF(iPadX, iPadZ, x, z);
163 AddQuad(x, z, 2.5, 3.5);
164 //AddQuad(-2.5*0.5, -3.5*0.5, 2.5, 3.5);
166 // In principle could have color based on number of neigbours. We
167 // can insert the time-of-flight value for each pad
168 //QuadValue((Int_t)tot);
169 QuadValue((Int_t)tdc);
171 //if (fSector==4 && fPlate==2 && fStrip==0) printf(" %1i %2i %f %f \n", iPadZ, iPadX, x, z);
179 /* ************************************************************ */
180 void TOFStrip::SetTrans()
183 fHMTrans.UnitTrans();
185 //Int_t det[5] = {fSector, fPlate, fStrip, -1, -1};
187 //fTOFgeometry->GetVolumePath(det,path);
188 fTOFgeometry->GetVolumePath(fSector, fPlate, fStrip, path);
190 fGeoManager->cd(path);
191 TGeoHMatrix global = *fGeoManager->GetCurrentMatrix();
192 Double_t *rotMat = global.GetRotationMatrix();
195 // ok till 19 April 2007
196 fHMTrans.SetBaseVec(1, rotMat[0], rotMat[1], rotMat[2]);
197 fHMTrans.SetBaseVec(2, rotMat[3], rotMat[4], rotMat[5]);
198 fHMTrans.SetBaseVec(3, rotMat[6], rotMat[7], rotMat[8]);
201 fHMTrans.SetBaseVec(1, rotMat[0], rotMat[3], rotMat[6]);
202 fHMTrans.SetBaseVec(2, rotMat[1], rotMat[4], rotMat[7]);
203 fHMTrans.SetBaseVec(3, rotMat[2], rotMat[5], rotMat[8]);
205 Double_t *tr = global.GetTranslation();
206 fHMTrans.SetBaseVec(4, tr);