2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
4 /**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
7 * full copyright notice. *
8 **************************************************************************/
10 #include "AliEveTOFStrip.h"
12 #include <TEveManager.h>
14 #include <AliTOFdigit.h>
15 #include <AliTOFGeometry.h>
19 Bool_t AliEveTOFStrip::fgStaticInitDone = kFALSE;
20 TEveFrameBox* AliEveTOFStrip::fgTOFstripFrameBox = 0;
21 TEveRGBAPalette* AliEveTOFStrip::fgTOFstripPalette = 0;
23 //_______________________________________________________
24 ClassImp(AliEveTOFStrip)
26 /* ************************************************************************ */
28 AliEveTOFStrip::AliEveTOFStrip(const Text_t* n, const Text_t* t) :
30 fTOFgeometry(new AliTOFGeometry()),
32 fSector(-1), fPlate(-1), fStrip(-1),
37 fGeoManager = (TGeoManager*)gEve->GetGeometry("$REVESYS/alice-data/alice_fullgeo.root");
38 if (!fGeoManager) printf("ERROR: no TGeo\n");
41 /* ************************************************************************ */
43 AliEveTOFStrip::AliEveTOFStrip(TGeoManager *localGeoManager,
44 Int_t nSector, Int_t nPlate, Int_t nStrip) :
45 TEveQuadSet(Form("Strip%i", nStrip)),
46 fTOFgeometry(new AliTOFGeometry()),
48 fSector(nSector), fPlate(nPlate), fStrip(nStrip),
50 fGeoManager(localGeoManager)
53 //if (!fGeoManager) printf("ERROR: no TGeo\n");
58 /* ************************************************************************ */
60 AliEveTOFStrip::AliEveTOFStrip(TGeoManager *localGeoManager,
61 Int_t nSector, Int_t nPlate, Int_t nStrip,
62 TClonesArray *tofArray) :
63 TEveQuadSet(Form("Strip%i", nStrip)),
64 fTOFgeometry(new AliTOFGeometry()),
66 fSector(nSector), fPlate(nPlate), fStrip(nStrip),
68 fGeoManager(localGeoManager)
74 /* ************************************************************************ */
76 AliEveTOFStrip::~AliEveTOFStrip()
87 /* ************************************************************************ */
89 void AliEveTOFStrip::SetDigitsInfo(AliEveTOFDigitsInfo* info)
91 if(fInfo) fInfo->DecRefCount();
93 if(fInfo) fInfo->IncRefCount();
97 /* ************************************************************************ */
98 void AliEveTOFStrip::InitStatics()
100 if (fgStaticInitDone) return;
104 fgTOFstripFrameBox = new TEveFrameBox();
106 fgTOFstripFrameBox->SetAAQuadXZ(-dx*0.5, 0, -dz*0.5, dx, dz);
107 fgTOFstripFrameBox->SetFrameColor((Color_t) 32);//31);
109 //fgTOFstripPalette = new TEveRGBAPalette(0, 2048); // TOT
110 fgTOFstripPalette = new TEveRGBAPalette(0, 8192); // TDC
112 fgStaticInitDone = kTRUE;
115 /* ************************************************************************ */
116 void AliEveTOFStrip::InitModule()
119 fDx = fTOFgeometry->XPad()*fTOFgeometry->NpadX();
120 fDz = fTOFgeometry->ZPad()*fTOFgeometry->NpadZ();
122 if (!fgStaticInitDone) InitStatics();
124 SetFrame(fgTOFstripFrameBox);
125 SetPalette(fgTOFstripPalette);
126 //fFrame = fgTOFstripFrameBox;
127 //fPalette = fgTOFstripPalette;
135 /* ************************************************************************ */
136 void AliEveTOFStrip::LoadQuads()
139 //Int_t n_col = gStyle->GetNumberOfColors();
148 Reset(kQT_RectangleXZFixedY, kFALSE, 32);
150 AliTOFdigit *tofDigit;
152 //printf(" fTOFarray->GetEntries() = %4i \n",fTOFarray->GetEntries());
154 for (Int_t ii=0; ii<fTOFarray->GetEntries(); ii++) {
156 tofDigit = (AliTOFdigit*)fTOFarray->UncheckedAt(ii);
158 iPadX = tofDigit->GetPadx();
159 iPadZ = tofDigit->GetPadz();
161 tot = tofDigit->GetToT();
162 tdc = tofDigit->GetTdc();
164 //if (fSector==4 && fPlate==2 && fStrip==0) printf(" %2i %1i\n", iPadX, iPadZ);
165 //if (iPadX==23 || iPadX==24) printf(" %2i %1i %2i \n", fSector, fPlate, fStrip);
167 fTOFgeometry->DetToStripRF(iPadX, iPadZ, x, z);
169 AddQuad(x, z, 2.5, 3.5);
170 //AddQuad(-2.5*0.5, -3.5*0.5, 2.5, 3.5);
172 // In principle could have color based on number of neigbours. We
173 // can insert the time-of-flight value for each pad
174 //QuadValue((Int_t)tot);
175 QuadValue((Int_t)tdc);
177 //if (fSector==4 && fPlate==2 && fStrip==0) printf(" %1i %2i %f %f \n", iPadZ, iPadX, x, z);
185 /* ************************************************************ */
186 void AliEveTOFStrip::SetTrans()
189 fHMTrans.UnitTrans();
191 //Int_t det[5] = {fSector, fPlate, fStrip, -1, -1};
193 //fTOFgeometry->GetVolumePath(det,path);
194 fTOFgeometry->GetVolumePath(fSector, fPlate, fStrip, path);
196 fGeoManager->cd(path);
197 TGeoHMatrix global = *fGeoManager->GetCurrentMatrix();
198 Double_t *rotMat = global.GetRotationMatrix();
201 // ok till 19 April 2007
202 fHMTrans.SetBaseVec(1, rotMat[0], rotMat[1], rotMat[2]);
203 fHMTrans.SetBaseVec(2, rotMat[3], rotMat[4], rotMat[5]);
204 fHMTrans.SetBaseVec(3, rotMat[6], rotMat[7], rotMat[8]);
207 fHMTrans.SetBaseVec(1, rotMat[0], rotMat[3], rotMat[6]);
208 fHMTrans.SetBaseVec(2, rotMat[1], rotMat[4], rotMat[7]);
209 fHMTrans.SetBaseVec(3, rotMat[2], rotMat[5], rotMat[8]);
211 Double_t *tr = global.GetTranslation();
212 fHMTrans.SetBaseVec(4, tr);