make loader more tolerant to missing files
[u/mrichter/AliRoot.git] / EVE / EveDet / AliEveTRDLoader.cxx
CommitLineData
d810d0de 1// $Id$
2// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4/**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
51346b82 7 * full copyright notice. *
d810d0de 8 **************************************************************************/
707b281a 9
d810d0de 10#include "AliEveTRDLoader.h"
11#include "AliEveTRDModuleImp.h"
6983e87a 12#include "EveBase/AliEveEventManager.h"
a282bf09 13
84aff7a4 14#include <TEveManager.h>
15#include <TEveGValuators.h>
a282bf09 16
6983e87a 17#include "TGeoManager.h"
edf0c4a0 18#include "TSystem.h"
19#include "TFile.h"
20#include "TTree.h"
edf0c4a0 21#include "TObjString.h"
22#include "TObjArray.h"
6983e87a 23#include "TClonesArray.h"
edf0c4a0 24
a282bf09 25#include <TGLabel.h>
26#include <TGButton.h>
27#include <TGTextEntry.h>
a282bf09 28#include <TGFileDialog.h>
a282bf09 29
edf0c4a0 30#include "AliLog.h"
a282bf09 31#include "AliCDBManager.h"
32
6983e87a 33#include "AliTRDhit.h"
a282bf09 34#include "AliTRDcluster.h"
a282bf09 35#include "AliTRDdigitsManager.h"
36#include "AliTRDgeometry.h"
37
d810d0de 38ClassImp(AliEveTRDLoader)
39ClassImp(AliEveTRDLoaderEditor)
a282bf09 40
41///////////////////////////////////////////////////////////
fd31e9de 42///////////// AliEveTRDLoader /////////////////////
a282bf09 43///////////////////////////////////////////////////////////
44
45
fd31e9de 46//______________________________________________________________________________
6983e87a 47AliEveTRDLoader::AliEveTRDLoader(const Text_t* n, const Text_t* t) : TEveElementList(n, t)
48 ,fDataType(0)
49 ,fSM(-1)
50 ,fStack(-1)
51 ,fLy(-1)
52 ,fEvent(-1)
53 ,fGeo(0x0)
54 ,fFilename("")
55 ,fDir(".")
51346b82 56{
a15e6d7d 57 // Constructor.
58
b642f9a5 59 AliEveEventManager::AssertGeometry();
6983e87a 60
61 fGeo = new AliTRDgeometry();
62 //fGeo->CreateClusterMatrixArray();
a15e6d7d 63}
fd31e9de 64
6983e87a 65//______________________________________________________________________________
fd31e9de 66void AliEveTRDLoader::AddChambers(int sm, int stk, int ly)
a282bf09 67{
a15e6d7d 68 // Add specified chambers.
69
6983e87a 70 fSM=sm; fStack=stk; fLy=ly;
a15e6d7d 71 Int_t ismStart = (sm == -1) ? 0 : sm;
72 Int_t ismStop = (sm == -1) ? 18 : sm+1;
73 Int_t istkStart= (stk == -1)? 0 : stk;
74 Int_t istkStop = (stk == -1)? 5 : stk+1;
75 Int_t ilyStart = (ly == -1) ? 0 : ly;
76 Int_t ilyStop = (ly == -1) ? 6 : ly+1;
fd31e9de 77
78 List_i ichmb;
79 ichmb = fChildren.begin();
80 while(ichmb != fChildren.end()){
81 (*ichmb)->SetRnrSelf(kFALSE);
82 ichmb++;
83 }
84
a15e6d7d 85 AliEveTRDNode *lSM=0x0, *lSTK=0x0;
86 AliEveTRDChamber *lCHMB = 0x0;
fd31e9de 87 int det;
a15e6d7d 88 for (int ism=ismStart; ism<ismStop; ism++){
6983e87a 89 if(!(lSM = (AliEveTRDNode*)FindChild(Form("SM%03d", ism)))){
a15e6d7d 90 AddElement(lSM = new AliEveTRDNode("SM", ism));
91 lSM->SetElementTitle(Form("Supermodule %2d", ism));
fd31e9de 92 }
6983e87a 93 lSM->SetRnrSelf(kTRUE);
94
a15e6d7d 95 for (int istk=istkStart; istk<istkStop; istk++) {
6983e87a 96 if(!(lSTK = (AliEveTRDNode*)lSM->FindChild("Stack%03d"))){
a15e6d7d 97 lSM->AddElement(lSTK = new AliEveTRDNode("Stack", istk));
98 lSTK->SetElementTitle(Form("SM %2d Stack %1d", ism, istk));
fd31e9de 99 }
6983e87a 100 lSTK->SetRnrSelf(kTRUE);
101
a15e6d7d 102 for (int ily=ilyStart; ily<ilyStop; ily++) {
fd31e9de 103 det = fGeo->GetDetector(ily, istk, ism);
6983e87a 104 if(!(lCHMB = (AliEveTRDChamber*)lSTK->FindChild(Form("Chmb%03d", det)))){
a15e6d7d 105 lSTK->AddElement(lCHMB = new AliEveTRDChamber(det));
106 lCHMB->SetGeometry(fGeo);
107 lCHMB->SetElementTitle(Form("SM %2d Stack %1d Layer %1d", ism, istk, ily));
fd31e9de 108 }
6983e87a 109 lCHMB->SetRnrSelf(kTRUE);
fd31e9de 110 }
111 }
112 }
113 gEve->Redraw3D();
a282bf09 114}
115
fd31e9de 116//______________________________________________________________________________
117AliEveTRDChamber* AliEveTRDLoader::GetChamber(int d)
a282bf09 118{
a15e6d7d 119 // Get given chamber.
120
6983e87a 121 Int_t ism = fGeo->GetSector(d),
7bc3159a 122 istk = fGeo->GetStack(d);
6983e87a 123
124 AliEveTRDNode *node = 0x0;
125 if(!(node = (AliEveTRDNode*)FindChild(Form("SM%03d", ism)))) return 0x0;
126 if(!(node = (AliEveTRDNode*)node->FindChild(Form("Stack%03d", istk)))) return 0x0;
127 return (AliEveTRDChamber*)node->FindChild(Form("Chmb%03d", d));
a282bf09 128}
129
fd31e9de 130//______________________________________________________________________________
131Bool_t AliEveTRDLoader::GoToEvent(int ev)
a282bf09 132{
a15e6d7d 133 // Go to given event.
134
fd31e9de 135 if(!fChildren.size()){
136 AliWarning("Please select first the chamber that you want to monitor from \"Chamber(s) selector\".");
137 return kFALSE;
138 }
139
140 fEvent = ev;
141
142 Unload();
143
09487f16 144 TTree *t(NULL); TFile *f(NULL);
145 if(!(f = TFile::Open(Form("%s/%s", fDir.Data(), fFilename.Data())))){
146 AliWarning(Form("File not found \"%s/%s\".", fDir.Data(), fFilename.Data()));
147 return kFALSE;
148 }
149 if(!f->cd(Form("Event%d", ev))){
150 AliError(Form("Event[%d] not found in file \"%s/%s\".", ev, fDir.Data(), fFilename.Data()));
6983e87a 151 f->Close(); //delete f;
fd31e9de 152 return kFALSE;
153 }
154
6983e87a 155 if(fDataType&kTRDHits){
09487f16 156 if(!(t = (TTree*)gDirectory->Get("TreeH"))){
157 AliError(Form("Tree[TreeH] not found for Event[%d].", ev));
158 return kFALSE;
159 }
6983e87a 160 if(!LoadHits(t)) return kFALSE;
09487f16 161 }
162 if(fDataType&kTRDDigits){
163 if(!(t = (TTree*)gDirectory->Get("TreeD"))){
164 AliError(Form("Tree[TreeD] not found for Event[%d].", ev));
165 return kFALSE;
166 }
fd31e9de 167 if(!LoadDigits(t)) return kFALSE;
09487f16 168 }
169 if(fDataType&kTRDClusters){
170 if(!(t = (TTree*)gDirectory->Get("TreeR"))){
171 AliError(Form("Tree[TreeR] not found for Event[%d].", ev));
172 return kFALSE;
173 }
fd31e9de 174 if(!LoadClusters(t)) return kFALSE;
09487f16 175 }
176 if(fDataType&kTRDTracklets){
177 if(!(t = (TTree*)gDirectory->Get("tracklets"))){
178 AliError(Form("Tree[tracklets] not found for Event[%d].", ev));
179 return kFALSE;
180 }
fd31e9de 181 if(!LoadTracklets(t)) return kFALSE;
09487f16 182 }// else AliWarning("Please select first the type of data that you want to monitor and then hit the \"Load\" button.");
fd31e9de 183
6983e87a 184 f->Close(); //delete f;
fd31e9de 185
186 gEve->Redraw3D();
187
188 return kTRUE;
a282bf09 189}
190
191
fd31e9de 192//______________________________________________________________________________
6983e87a 193Bool_t AliEveTRDLoader::LoadHits(TTree *tH)
194{
195 // Load hits.
196
197 AliInfo("Loading ...");
198 if(!fChildren.size()) return kFALSE;
199
200 AliEveTRDChamber *chmb = 0x0;
201 TClonesArray *hits = new TClonesArray("AliTRDhit", 100);
202 tH->SetBranchAddress("TRD", &hits);
203 Int_t idx, nhits;
204 for(int iTrack=0; iTrack<tH->GetEntries(); iTrack++){
205 if(!tH->GetEvent(iTrack)) continue;
206 if(!(nhits = hits->GetEntriesFast())) continue;
207
208 idx = 0;
209 while(idx < nhits){
210 Int_t det = ((AliTRDhit*)hits->UncheckedAt(idx))->GetDetector();
211 chmb = GetChamber(det);
212 if(chmb) chmb->LoadHits(hits, idx);
213 else{
214 AliTRDhit *hit = 0x0;
215 while(idx < nhits){
216 hit = (AliTRDhit*)hits->UncheckedAt(idx);
217 if(hit->GetDetector() != det) break;
218 idx++;
219 }
220 }
221 }
222 hits->Delete();
223 }
224 return kTRUE;
225}
226
227
228//______________________________________________________________________________
fd31e9de 229Bool_t AliEveTRDLoader::LoadClusters(TTree *tC)
a282bf09 230{
a15e6d7d 231 // Load clusters.
232
fd31e9de 233 AliInfo("Loading ...");
3f797131 234 if(!fChildren.size()) return kFALSE;
fd31e9de 235
236 TObjArray *clusters = new TObjArray();
237 tC->SetBranchAddress("TRDcluster", &clusters);
238
09487f16 239 AliEveTRDChamber *chmb(NULL);
240 AliTRDcluster *c(NULL);
241 for(int idet=0; idet<AliTRDgeometry::kNdet; idet++){
fd31e9de 242 tC->GetEntry(idet);
243 if(!clusters->GetEntriesFast()) continue;
09487f16 244 if(!(c = (AliTRDcluster*)clusters->UncheckedAt(0))) continue;
fd31e9de 245 if((chmb = GetChamber(c->GetDetector()))) chmb->LoadClusters(clusters);
246 }
247 return kTRUE;
a282bf09 248}
249
250
fd31e9de 251//______________________________________________________________________________
252Bool_t AliEveTRDLoader::LoadDigits(TTree *tD)
a282bf09 253{
a15e6d7d 254 // Load digits.
255
fd31e9de 256 AliInfo("Loading ...");
257
3f797131 258 if(!fChildren.size()) return kFALSE;
fd31e9de 259
260 AliEveTRDChamber *chmb;
261 AliTRDdigitsManager dm;
262 dm.ReadDigits(tD);
09487f16 263 for(int idet=0; idet<AliTRDgeometry::kNdet; idet++){
fd31e9de 264 if(!(chmb=GetChamber(idet))) continue;
265 // digits = dm.GetDigits(idet);
266 // if(!digits) continue;
267 // chmb->LoadDigits(digits);
268 chmb->LoadDigits(&dm);
269 }
270 return kTRUE;
a282bf09 271}
272
273
fd31e9de 274//______________________________________________________________________________
a879a24a 275Bool_t AliEveTRDLoader::LoadTracklets(TTree *trklTree)
a282bf09 276{
a15e6d7d 277 // Load tracklets.
278
fd31e9de 279 AliInfo("Loading ...");
3f797131 280 if(!fChildren.size()) return kFALSE;
a282bf09 281
51346b82 282
fd31e9de 283 AliEveTRDChamber *chmb = 0x0;
a879a24a 284
fd31e9de 285 for(int idet=0; idet<540; idet++){
a879a24a 286 if((chmb = GetChamber(idet)))
287 chmb->LoadTracklets(trklTree);
fd31e9de 288 }
51346b82 289
fd31e9de 290 return kTRUE;
a282bf09 291}
51346b82 292
edf0c4a0 293
fd31e9de 294//______________________________________________________________________________
295Bool_t AliEveTRDLoader::Open(const char *filename, const char *dir)
a282bf09 296{
a15e6d7d 297 // Open given file in given directory.
298
fd31e9de 299 fFilename = filename;
300 fDir = dir;
301 Int_t count = 0;
6983e87a 302 count += fDataType&kTRDHits;
303 count += fDataType&kTRDDigits;
304 count += fDataType&kTRDClusters;
305 count += fDataType&kTRDTracklets;
fd31e9de 306
307 TObjArray *so = fFilename.Tokenize(".");
308
309 if(((TObjString*)(*so)[0])->GetString().CompareTo("TRD") != 0){
6983e87a 310 AliError("Filename didn't fulfill naming conventions. No TRD data will be loaded.");
311 return kFALSE;
fd31e9de 312 }
6983e87a 313
314 if(((TObjString*)(*so)[1])->GetString().CompareTo("Hits") == 0){
4b628e88 315 if(count && !(fDataType&kTRDHits)){
6983e87a 316 AliWarning("Data type set to HITS according to file name. Previous settings will be overwritten.");
317 fDataType = 0;
318 }
319 fDataType|=kTRDHits;
320 } else if(((TObjString*)(*so)[1])->GetString().CompareTo("Digits") == 0){
4b628e88 321 if(count && !(fDataType&kTRDDigits)){
6983e87a 322 AliWarning("Data type set to DIGITS according to file name. Previous settings will be overwritten.");
323 fDataType = 0;
324 }
325 fDataType|=kTRDDigits;
fd31e9de 326 } else if(((TObjString*)(*so)[1])->GetString().CompareTo("RecPoints") == 0){
4b628e88 327 if(count && !(fDataType&kTRDClusters)){
6983e87a 328 AliWarning("Data type set to CLUSTERS according to file name. Previous settings will be overwritten.");
329 fDataType = 0;
330 }
331 fDataType|=kTRDClusters;
a879a24a 332 } else if(((TObjString*)(*so)[1])->GetString().CompareTo("Tracklets") == 0){
4b628e88 333 if(count && !(fDataType&kTRDTracklets)){
6983e87a 334 AliWarning("Data type set to TRACKLETS according to file name. Previous settings will be overwritten.");
335 fDataType = 0;
336 }
337 fDataType|=kTRDTracklets;
fd31e9de 338 } else {
339 AliError("Filename didn't fulfill naming conventions. No data will be loaded.");
340 return kFALSE;
341 }
342
6983e87a 343 SetDataLinked();
fd31e9de 344 return kTRUE;
a282bf09 345}
346
fd31e9de 347//______________________________________________________________________________
d810d0de 348void AliEveTRDLoader::Paint(Option_t *option)
edf0c4a0 349{
a15e6d7d 350 // Paint object.
351
90ae0503 352 AliEveTRDModule *module(NULL);
fd31e9de 353 List_i ichmb = fChildren.begin();
354 while(ichmb != fChildren.end()){
90ae0503 355 if((module = dynamic_cast<AliEveTRDModule*>(*ichmb))) module->Paint(option);
fd31e9de 356 ichmb++;
357 }
edf0c4a0 358}
359
edf0c4a0 360
fd31e9de 361//______________________________________________________________________________
d810d0de 362void AliEveTRDLoader::Unload()
a282bf09 363{
a15e6d7d 364 // Unload module data.
365
fd31e9de 366 List_i ichmb = fChildren.begin();
367 while(ichmb != fChildren.end()){
527ceac3 368 //(dynamic_cast<AliEveTRDModule*>(*ichmb))->Reset();
fd31e9de 369 ichmb++;
370 }
a282bf09 371}
372
373///////////////////////////////////////////////////////////
d810d0de 374///////////// AliEveTRDLoaderEditor /////////////////////
a282bf09 375///////////////////////////////////////////////////////////
376
fd31e9de 377//______________________________________________________________________________
378AliEveTRDLoaderEditor::AliEveTRDLoaderEditor(const TGWindow* p, Int_t width, Int_t height,
379 UInt_t options, Pixel_t back) :
380 TGedFrame(p, width, height, options | kVerticalFrame, back),
6983e87a 381 fM(0), fFile(0), fBrowse(0x0), fEvent(0),
fd31e9de 382 fSMNumber(0), fStackNumber(0), fPlaneNumber(0)
a282bf09 383{
a15e6d7d 384 // Constructor.
385
fd31e9de 386 MakeTitle("AliEveTRDLoader");
51346b82 387
6983e87a 388 // file browser frame
fd31e9de 389 Int_t labelW = 42;
fd31e9de 390 TGHorizontalFrame* f = new TGHorizontalFrame(this);
391 TGHorizontalFrame* g = new TGHorizontalFrame(f, labelW, 0, kFixedWidth);
392 TGLabel* l = new TGLabel(g, "File: ");
393 g->AddFrame(l, new TGLayoutHints(kLHintsLeft, 0,0,4,0));
394 f->AddFrame(g);
395 fFile = new TGTextEntry(f);
396 fFile->SetToolTipText("Select TRD data file or galice.root");
397 fFile->SetWidth(140);
398 fFile->Connect("DoubleClicked()", "AliEveTRDLoaderEditor", this, "FileOpen()");
399 f->AddFrame(fFile);
51346b82 400
6983e87a 401 fBrowse = new TGTextButton(f, "Browse");
402 f->AddFrame(fBrowse);
403 fBrowse->Connect("Clicked()", "AliEveTRDLoaderEditor", this, "FileOpen()");
404 AddFrame(f, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsCenterY | kLHintsExpandX,5,5,5,5));
a282bf09 405
406
fd31e9de 407 // "Chamber(s) selector" group frame
408 TGGroupFrame *fGroupFrame1974 = new TGGroupFrame(this,"Chamber(s) selector");
409 TGVerticalFrame *fVerticalFrame1974 = new TGVerticalFrame(fGroupFrame1974, 150, 50,kVerticalFrame);
51346b82 410
fd31e9de 411 fSMNumber = new TEveGValuator(fVerticalFrame1974, "SM:", 0, 0);
14217b5f 412 fSMNumber->SetShowSlider(kFALSE);
413 fSMNumber->SetLabelWidth(labelW);
414 fSMNumber->SetNELength(6);
415 fSMNumber->Build();
416 fSMNumber->SetLimits(-1, 17);
417 fSMNumber->SetToolTip("Supermodule id [-1 for all]");
fd31e9de 418 fVerticalFrame1974->AddFrame(fSMNumber, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsCenterX | kLHintsExpandY,2,2,2,2));
14217b5f 419
fd31e9de 420 fStackNumber = new TEveGValuator(fVerticalFrame1974, "Stack:", 0, 0);
14217b5f 421 fStackNumber->SetShowSlider(kFALSE);
422 fStackNumber->SetLabelWidth(labelW);
423 fStackNumber->SetNELength(6);
424 fStackNumber->Build();
425 fStackNumber->SetLimits(-1, 4);
426 fStackNumber->SetToolTip("Stack id [-1 for all in this SM]");
fd31e9de 427 fVerticalFrame1974->AddFrame(fStackNumber, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsCenterX | kLHintsExpandY,2,2,2,2));
14217b5f 428
fd31e9de 429 fPlaneNumber = new TEveGValuator(fVerticalFrame1974, "Plane:", 0, 0);
14217b5f 430 fPlaneNumber->SetShowSlider(kFALSE);
431 fPlaneNumber->SetLabelWidth(labelW);
432 fPlaneNumber->SetNELength(6);
433 fPlaneNumber->Build();
434 fPlaneNumber->SetLimits(-1, 5);
435 fPlaneNumber->SetToolTip("Plane id [-1 for all in this stack]");
436
fd31e9de 437 fVerticalFrame1974->AddFrame(fPlaneNumber, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsCenterX | kLHintsExpandY,2,2,2,2));
51346b82 438
fd31e9de 439 fGroupFrame1974->AddFrame(fVerticalFrame1974, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandY | kLHintsCenterX,2,2,2,2));
a282bf09 440
fd31e9de 441 TGTextButton *fTextButton2037 = new TGTextButton(fGroupFrame1974,"Select");
442 fTextButton2037->SetTextJustify(36);
443 fGroupFrame1974->AddFrame(fTextButton2037, new TGLayoutHints(kLHintsExpandY | kLHintsCenterX,2,2,2,2));
edf0c4a0 444 fTextButton2037->SetToolTipText("Apply selection", 400);
fd31e9de 445 fTextButton2037->Connect("Clicked()",
446 "AliEveTRDLoaderEditor", this, "AddChambers()");
a282bf09 447
fd31e9de 448 fGroupFrame1974->SetLayoutManager(new TGHorizontalLayout(fGroupFrame1974));
6983e87a 449 AddFrame(fGroupFrame1974, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsCenterY | kLHintsExpandX,5,5,5,5));
450
451
452 // Event steering frame
453 f = new TGHorizontalFrame(this);
454 TGTextButton *fGoTo = new TGTextButton(f, "GoTo");
455 fGoTo->SetTextJustify(36);
456 fGoTo->Resize(164,22);
457 f->AddFrame(fGoTo, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsCenterY | kLHintsExpandX,2,2,2,2));
458 fGoTo->SetToolTipText("Skip to event", 400);
459 fGoTo->Connect("Clicked()", "AliEveTRDLoaderEditor", this, "GoTo()");
460
461 fEvent = new TEveGValuator(f, "Event:", 110, 0);
462 fEvent->SetShowSlider(kFALSE);
463 fEvent->SetLabelWidth(labelW);
464 fEvent->SetNELength(6);
465 fEvent->Build();
466 fEvent->SetLimits(-1, 1000);
467 fEvent->SetToolTip("Set event number to be monitored");
468 fEvent->Connect("ValueSet(Double_t)",
469 "AliEveTRDLoaderEditor", this, "SetEvent(Double_t)");
470 f->AddFrame(fEvent, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2,2,2,2));
a282bf09 471
6983e87a 472 TGTextButton *fNext = new TGTextButton(f, "Next");
473 fNext->SetTextJustify(36);
474 fNext->Resize(164,22);
475 f->AddFrame(fNext, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsCenterY | kLHintsExpandX,2,2,2,2));
476 fNext->SetToolTipText("Next event", 400);
477 fNext->Connect("Clicked()", "AliEveTRDLoaderEditor", this, "Next()");
478
479 AddFrame(f,new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsCenterY | kLHintsExpandX,5,5,5,5));
a282bf09 480
a282bf09 481}
482
fd31e9de 483//______________________________________________________________________________
d810d0de 484void AliEveTRDLoaderEditor::SetModel(TObject* obj)
a282bf09 485{
a15e6d7d 486 // Set model object.
edf0c4a0 487
90ae0503 488 if(!(fM = dynamic_cast<AliEveTRDLoader*>(obj))) return;
14217b5f 489
6983e87a 490 fFile->SetEnabled(!fM->IsDataLinked());
fd31e9de 491 fFile->SetText(gSystem->BaseName(fM->fFilename.Data()));
6983e87a 492 fBrowse->SetEnabled(!fM->IsDataLinked());
14217b5f 493
6983e87a 494 fEvent->SetEnabled(fM->IsDataLinked());
fd31e9de 495 fEvent->GetEntry()->SetIntNumber(fM->fEvent);
51346b82 496
6983e87a 497 fSMNumber->SetEnabled(fM->IsDataLinked());
fd31e9de 498 fSMNumber->GetEntry()->SetIntNumber(fM->fSM);
edf0c4a0 499
500
6983e87a 501 fStackNumber->SetEnabled(fM->IsDataLinked());
fd31e9de 502 fStackNumber->GetEntry()->SetIntNumber(fM->fStack);
edf0c4a0 503
504
6983e87a 505 fPlaneNumber->SetEnabled(fM->IsDataLinked());
fd31e9de 506 fPlaneNumber->GetEntry()->SetIntNumber(fM->fLy);
a282bf09 507}
508
fd31e9de 509//______________________________________________________________________________
d810d0de 510void AliEveTRDLoaderEditor::AddChambers()
a282bf09 511{
a15e6d7d 512 // Slot to add chambers.
513
fd31e9de 514 fM->fSM = (int)fSMNumber->GetEntry()->GetNumber();
515 fM->fStack = (int)fStackNumber->GetEntry()->GetNumber();
516 fM->fLy = (int)fPlaneNumber->GetEntry()->GetNumber();
517 fM->AddChambers(fM->fSM, fM->fStack, fM->fLy);
a282bf09 518}
519
fd31e9de 520//______________________________________________________________________________
d810d0de 521void AliEveTRDLoaderEditor::FileOpen()
a282bf09 522{
a15e6d7d 523 // Slot for opening of file.
524
a282bf09 525 TGFileInfo fi;
14217b5f 526 fi.fIniDir = StrDup(gSystem->DirName (fM->fFilename.Data()));
527 fi.fFilename = StrDup(gSystem->BaseName(fM->fFilename.Data()));
fd31e9de 528 // fi.fFileTypes = tpcfiletypes;
14217b5f 529
84aff7a4 530 new TGFileDialog(fClient->GetRoot(), gEve->GetMainWindow(), kFDOpen, &fi);
a282bf09 531 if (!fi.fFilename) return;
532
6983e87a 533 if(fM->Open(gSystem->BaseName(fi.fFilename), gSystem->DirName (fi.fFilename))){
534 fFile->SetToolTipText(gSystem->DirName (fi.fFilename));
535 fFile->SetText (gSystem->BaseName(fi.fFilename));
536 } else fFile->Clear();
edf0c4a0 537
fd31e9de 538 this->SetModel(fM);
a282bf09 539}
540
6983e87a 541void AliEveTRDLoaderEditor::GoTo()
a282bf09 542{
a15e6d7d 543 // Slot for loading of event.
544
fd31e9de 545 fM->GoToEvent(fM->fEvent);
a282bf09 546}
6983e87a 547
548void AliEveTRDLoaderEditor::Next()
549{
550 // Slot for loading of event.
551
552 fM->NextEvent();
553}