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 **************************************************************************/
9 #include "AliEveTOFStrip.h"
11 #include <TEveManager.h>
13 #include <AliTOFdigit.h>
14 #include <AliTOFGeometry.h>
20 Bool_t AliEveTOFStrip::fgStaticInitDone = kFALSE;
21 TEveFrameBox* AliEveTOFStrip::fgTOFstripFrameBox = 0;
22 TEveRGBAPalette* AliEveTOFStrip::fgTOFstripPalette = 0;
24 //_______________________________________________________
25 ClassImp(AliEveTOFStrip)
27 /* ************************************************************************ */
29 AliEveTOFStrip::AliEveTOFStrip(const Text_t* n, const Text_t* t) :
31 fTOFgeometry(new AliTOFGeometry()),
33 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)
46 TEveQuadSet(Form("Strip%i",nStrip)),
47 fTOFgeometry(new AliTOFGeometry()),
49 fSector(nSector), fPlate(nPlate), fStrip(nStrip),
51 fGeoManager(localGeoManager)
54 //if (!fGeoManager) printf("ERROR: no TGeo\n");
59 /* ************************************************************************ */
61 AliEveTOFStrip::AliEveTOFStrip(TGeoManager *localGeoManager,
62 Int_t nSector, Int_t nPlate, Int_t nStrip,
63 TClonesArray *tofArray)
65 TEveQuadSet(Form("Strip%i",nStrip)),
66 fTOFgeometry(new AliTOFGeometry()),
68 fSector(nSector), fPlate(nPlate), fStrip(nStrip),
70 fGeoManager(localGeoManager)
76 /* ************************************************************************ */
78 AliEveTOFStrip::~AliEveTOFStrip()
89 /* ************************************************************************ */
91 void AliEveTOFStrip::SetDigitsInfo(AliEveTOFDigitsInfo* info)
93 if(fInfo) fInfo->DecRefCount();
95 if(fInfo) fInfo->IncRefCount();
99 /* ************************************************************************ */
100 void AliEveTOFStrip::InitStatics()
102 if (fgStaticInitDone) return;
106 fgTOFstripFrameBox = new TEveFrameBox();
108 fgTOFstripFrameBox->SetAAQuadXZ(-dx*0.5, 0, -dz*0.5, dx, dz);
109 fgTOFstripFrameBox->SetFrameColor((Color_t) 32);//31);
111 //fgTOFstripPalette = new TEveRGBAPalette(0, 2048); // TOT
112 fgTOFstripPalette = new TEveRGBAPalette(0, 8192); // TDC
114 fgStaticInitDone = kTRUE;
117 /* ************************************************************************ */
118 void AliEveTOFStrip::InitModule()
121 fDx = fTOFgeometry->XPad()*fTOFgeometry->NpadX();
122 fDz = fTOFgeometry->ZPad()*fTOFgeometry->NpadZ();
124 if (!fgStaticInitDone) InitStatics();
126 SetFrame(fgTOFstripFrameBox);
127 SetPalette(fgTOFstripPalette);
128 //fFrame = fgTOFstripFrameBox;
129 //fPalette = fgTOFstripPalette;
137 /* ************************************************************************ */
138 void AliEveTOFStrip::LoadQuads()
141 //Int_t n_col = gStyle->GetNumberOfColors();
150 Reset(kQT_RectangleXZFixedY, kFALSE, 32);
152 AliTOFdigit *tofDigit;
154 //printf(" fTOFarray->GetEntries() = %4i \n",fTOFarray->GetEntries());
156 for (Int_t ii=0; ii<fTOFarray->GetEntries(); ii++) {
158 tofDigit = (AliTOFdigit*)fTOFarray->UncheckedAt(ii);
160 iPadX = tofDigit->GetPadx();
161 iPadZ = tofDigit->GetPadz();
163 tot = tofDigit->GetToT();
164 tdc = tofDigit->GetTdc();
166 //if (fSector==4 && fPlate==2 && fStrip==0) printf(" %2i %1i\n", iPadX, iPadZ);
167 //if (iPadX==23 || iPadX==24) printf(" %2i %1i %2i \n", fSector, fPlate, fStrip);
169 fTOFgeometry->DetToStripRF(iPadX, iPadZ, x, z);
171 AddQuad(x, z, 2.5, 3.5);
172 //AddQuad(-2.5*0.5, -3.5*0.5, 2.5, 3.5);
174 // In principle could have color based on number of neigbours. We
175 // can insert the time-of-flight value for each pad
176 //QuadValue((Int_t)tot);
177 QuadValue((Int_t)tdc);
179 //if (fSector==4 && fPlate==2 && fStrip==0) printf(" %1i %2i %f %f \n", iPadZ, iPadX, x, z);
187 /* ************************************************************ */
188 void AliEveTOFStrip::SetTrans()
191 fHMTrans.UnitTrans();
193 //Int_t det[5] = {fSector, fPlate, fStrip, -1, -1};
195 //fTOFgeometry->GetVolumePath(det,path);
196 fTOFgeometry->GetVolumePath(fSector, fPlate, fStrip, path);
198 fGeoManager->cd(path);
199 TGeoHMatrix global = *fGeoManager->GetCurrentMatrix();
200 Double_t *rotMat = global.GetRotationMatrix();
203 // ok till 19 April 2007
204 fHMTrans.SetBaseVec(1, rotMat[0], rotMat[1], rotMat[2]);
205 fHMTrans.SetBaseVec(2, rotMat[3], rotMat[4], rotMat[5]);
206 fHMTrans.SetBaseVec(3, rotMat[6], rotMat[7], rotMat[8]);
209 fHMTrans.SetBaseVec(1, rotMat[0], rotMat[3], rotMat[6]);
210 fHMTrans.SetBaseVec(2, rotMat[1], rotMat[4], rotMat[7]);
211 fHMTrans.SetBaseVec(3, rotMat[2], rotMat[5], rotMat[8]);
213 Double_t *tr = global.GetTranslation();
214 fHMTrans.SetBaseVec(4, tr);