AliRoot Core  a565103 (a565103)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMUONPainterDataSourceFrame.cxx
Go to the documentation of this file.
1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15 
16 // $Id$
17 
19 
20 #include "AliCDBEntry.h"
21 #include "AliCDBManager.h"
22 #include "AliCDBStorage.h"
23 #include "AliLog.h"
24 #include "AliMUONChamberPainter.h"
28 #include "AliMUONPainterEnv.h"
29 #include "AliMUONPainterHelper.h"
30 #include "AliMUONPainterMatrix.h"
31 #include "AliMUONPainterRegistry.h"
32 #include "AliMUONRecoParam.h"
36 #include "AliMUONVTrackerData.h"
37 #include "AliRawReader.h"
38 #include "Riostream.h"
39 #include <cstdlib>
40 #include <TCanvas.h>
41 #include <TGButton.h>
42 #include <TGComboBox.h>
43 #include <TGFileDialog.h>
44 #include <TGNumberEntry.h>
45 #include <TGrid.h>
46 #include <TGTextEntry.h>
47 #include <TMath.h>
48 #include <TObjArray.h>
49 #include <TObjString.h>
50 #include <TRegexp.h>
51 #include <TString.h>
52 #include <TSystem.h>
53 
61 
65 
66 //_____________________________________________________________________________
67 AliMUONPainterDataSourceFrame::AliMUONPainterDataSourceFrame(const TGWindow* p, UInt_t w, UInt_t h)
68 : TGCompositeFrame(p,w,h,kVerticalFrame),
69  fRecentSourceSelector(new TGGroupFrame(this,"Recent sources",kHorizontalFrame)),
70  fRawSelector(new TGGroupFrame(this,"Raw file URI",kHorizontalFrame)),
71  fRawSelector2(new TGCompositeFrame(fRawSelector,w,h,kVerticalFrame)),
72  fRawSelector21(new TGCompositeFrame(fRawSelector2,w,h,kHorizontalFrame)),
73  fRawSelector22(new TGCompositeFrame(fRawSelector2,w,h,kHorizontalFrame)),
74  fRawSelector24(new TGCompositeFrame(fRawSelector2,w,h,kHorizontalFrame)),
75  fRawSelector23(new TGCompositeFrame(fRawSelector2,w,h,kHorizontalFrame)),
76  fCalibrateNoGain(new TGCheckButton(fRawSelector22,"Ped sub")),
77  fHistogramButton(new TGCheckButton(fRawSelector23,"Histogram")),
78  fHistoMin(new TGNumberEntry(fRawSelector23,0)),
79  fHistoMax(new TGNumberEntry(fRawSelector23,4096)),
80  fEventRangeButton(new TGCheckButton(fRawSelector23,"Event range")),
81  fEventMin(new TGNumberEntry(fRawSelector23,-1,10)),
82  fEventMax(new TGNumberEntry(fRawSelector23,-1,10)),
83  fRawOCDBPath(0x0),
84  fOCDBSelector(new TGGroupFrame(this,"OCDB Path",kHorizontalFrame)),
85  fDataReaders(new TGGroupFrame(this,"Data sources")),
86  fFilePath(new TGTextEntry(fRawSelector21,"")),
87  fOCDBPath(0x0),
88  fRunSelector(new TGNumberEntry(fOCDBSelector,0,10)),
89  fOCDBTypes(new TGComboBox(fOCDBSelector)),
90  fRecentSources(new TGComboBox(fRecentSourceSelector)),
91  fCreateRecentButton(new TGTextButton(fRecentSourceSelector,"Create data source")),
92  fItems(new TObjArray),
93  fACFSelector(new TGGroupFrame(this,"ASCII Calib File",kHorizontalFrame)),
94  fACFPath(new TGTextEntry(fACFSelector,"")),
95  fACFTypes(new TGComboBox(fACFSelector))
96 {
98 
99  AliCDBStorage* storage = AliCDBManager::Instance()->GetDefaultStorage();
100  TString uri = storage->GetURI();
101 
102  fRawOCDBPath = new TGTextEntry(fRawSelector24,uri.Data());
103  fOCDBPath = new TGTextEntry(fOCDBSelector,uri.Data());
104 
106 
107  reg->Connect("DataMakerWasRegistered(AliMUONVTrackerDataMaker*)",
108  "AliMUONPainterDataSourceFrame",
109  this,
110  "DataMakerWasRegistered(AliMUONVTrackerDataMaker*)");
111 
112  reg->Connect("DataMakerWasUnregistered(AliMUONVTrackerDataMaker*)",
113  "AliMUONPainterDataSourceFrame",
114  this,
115  "DataMakerWasUnregistered(AliMUONVTrackerDataMaker*)");
116 
117  fItems->SetOwner(kFALSE);
118 
120 
121  fCreateRecentButton->Connect("Clicked()",
122  "AliMUONPainterDataSourceFrame",
123  this,
124  "OpenRecentSource()");
125 
126  fRecentSourceSelector->AddFrame(fRecentSources,new TGLayoutHints(kLHintsExpandX | kLHintsTop,5,5,5,5));
127  fRecentSourceSelector->AddFrame(fCreateRecentButton,new TGLayoutHints(kLHintsTop,5,5,5,5));
128 
129  fRecentSources->SetEnabled(kFALSE);
130  fCreateRecentButton->SetEnabled(kFALSE);
131 
132  for ( Int_t i = 0; i < Env()->NumberOfDataSources(); ++i )
133  {
134  AddRecentSource(Env()->DataSourceDescriptor(i));
135  }
136 
137  fRecentSources->Resize(100,20);
138 
140 
141  TGButton* openButton = new TGPictureButton(fRawSelector21,
142  gClient->GetPicture("fileopen.xpm"));
143  openButton->SetToolTipText("Click to open file dialog");
144 
145  fRawSelector2->AddFrame(fRawSelector21, new TGLayoutHints(kLHintsExpandX,5,5,5,5));
146  fRawSelector2->AddFrame(fRawSelector22, new TGLayoutHints(kLHintsExpandX,5,5,5,5));
147  fRawSelector2->AddFrame(fRawSelector24, new TGLayoutHints(kLHintsTop,5,5,5,5));
148  fRawSelector2->AddFrame(fRawSelector23, new TGLayoutHints(kLHintsExpandX,5,5,5,5));
149 
150  fRawSelector21->AddFrame(openButton,new TGLayoutHints(kLHintsTop,5,5,5,5));
151  fRawSelector21->AddFrame(fFilePath, new TGLayoutHints(kLHintsExpandX | kLHintsTop,5,5,5,5));
152 
153  fRawSelector22->AddFrame(fCalibrateNoGain, new TGLayoutHints(kLHintsTop,5,5,5,5));
154 
155  fRawSelector24->AddFrame(fRawOCDBPath, new TGLayoutHints(kLHintsExpandX | kLHintsTop,5,5,5,5));
156  fRawOCDBPath->SetEnabled(kFALSE);
157 
158  fRawSelector23->AddFrame(fHistogramButton,new TGLayoutHints(kLHintsTop,5,5,5,5));
159  fHistogramButton->Connect("Clicked()","AliMUONPainterDataSourceFrame",this,"HistogramButtonClicked()");
160  fHistoMin->SetState(kFALSE);
161  fHistoMax->SetState(kFALSE);
162  fRawSelector23->AddFrame(fHistoMin,new TGLayoutHints(kLHintsTop,5,5,5,5));
163  fRawSelector23->AddFrame(fHistoMax,new TGLayoutHints(kLHintsTop,5,5,5,5));
164 
165 
166  fRawSelector23->AddFrame(fEventRangeButton,new TGLayoutHints(kLHintsTop,5,5,5,5));
167  fEventRangeButton->Connect("Clicked()","AliMUONPainterDataSourceFrame",this,"EventRangeButtonClicked()");
168  fEventMin->SetState(kFALSE);
169  fEventMax->SetState(kFALSE);
170 
171  fEventMin->SetFormat(TGNumberFormat::kNESInteger);
172  fEventMax->SetFormat(TGNumberFormat::kNESInteger);
173 
174  fRawSelector23->AddFrame(fEventMin,new TGLayoutHints(kLHintsTop,5,5,5,5));
175  fRawSelector23->AddFrame(fEventMax,new TGLayoutHints(kLHintsTop,5,5,5,5));
176 
177  TGButton* createRawButton = new TGTextButton(fRawSelector,"Create data source");
178 
179  fRawSelector->AddFrame(fRawSelector2, new TGLayoutHints(kLHintsExpandX | kLHintsTop,5,5,5,5));
180  fRawSelector->AddFrame(createRawButton, new TGLayoutHints(kLHintsCenterY,5,5,5,5));
181 
182  fCalibrateNoGain->Connect("Clicked()","AliMUONPainterDataSourceFrame",this,"CalibrateButtonClicked()");
183 
184  openButton->Connect("Clicked()",
185  "AliMUONPainterDataSourceFrame",
186  this,
187  "OpenFileDialog()");
188 
189  createRawButton->Connect("Clicked()",
190  "AliMUONPainterDataSourceFrame",
191  this,
192  "CreateRawDataSource()");
193 
195 
196  fOCDBTypes->AddEntry(AliMUONTrackerDataSourceTypes::ShortNameForConfig(),7);
198  fOCDBTypes->AddEntry(AliMUONTrackerDataSourceTypes::ShortNameForHV(),3);
200  fOCDBTypes->AddEntry(AliMUONTrackerDataSourceTypes::ShortNameForStatus(),5);
203  fOCDBTypes->AddEntry(AliMUONTrackerDataSourceTypes::ShortNameForLV(),9);
204  fOCDBTypes->Select(0);
205  fOCDBTypes->Resize(80,20);
206 
207  TGButton* createOCDBButton = new TGTextButton(fOCDBSelector,"Create data source");
208  createOCDBButton->Connect("Clicked()",
209  "AliMUONPainterDataSourceFrame",
210  this,
211  "CreateOCDBDataSource()");
212 
213  const char* ocdbToolTip = "Use URL style for either alien or local OCDB (foo://bar). For example :\n"
214  "alien://folder=/alice/data.../OCDB\n"
215  "or\nlocal:///home/user/aliroot (mind the 3 slashes there !)";
216 
217  fRawOCDBPath->SetToolTipText(ocdbToolTip);
218  fOCDBPath->SetToolTipText(ocdbToolTip);
219 
220  fOCDBSelector->AddFrame(fOCDBPath,new TGLayoutHints(kLHintsExpandX | kLHintsTop,5,5,5,5));
221  fOCDBSelector->AddFrame(fRunSelector,new TGLayoutHints(kLHintsTop,5,5,5,5));
222  fOCDBSelector->AddFrame(fOCDBTypes,new TGLayoutHints(kLHintsExpandX | kLHintsTop,5,5,5,5));
223  fOCDBSelector->AddFrame(createOCDBButton,new TGLayoutHints(kLHintsTop,5,5,5,5));
224 
225 
227 
228  TGButton* openButtonACF = new TGPictureButton(fACFSelector,
229  gClient->GetPicture("fileopen.xpm"));
230  openButtonACF->SetToolTipText("Click to open file dialog");
231 
232  fACFTypes->AddEntry(AliMUONTrackerDataSourceTypes::ShortNameForConfig(),7);
235  fACFTypes->Select(0);
236  fACFTypes->Resize(100,20);
237 
238  fACFSelector->AddFrame(openButtonACF,new TGLayoutHints(kLHintsTop,5,5,5,5));
239  fACFSelector->AddFrame(fACFPath, new TGLayoutHints(kLHintsExpandX | kLHintsTop,5,5,5,5));
240  fACFSelector->AddFrame(fACFTypes,new TGLayoutHints(kLHintsExpandX | kLHintsTop,5,5,5,5));
241 
242  TGButton* createACFButton = new TGTextButton(fACFSelector,"Create data source");
243  createACFButton->Connect("Clicked()",
244  "AliMUONPainterDataSourceFrame",
245  this,
246  "CreateACFDataSource()");
247 
248  openButtonACF->Connect("Clicked()",
249  "AliMUONPainterDataSourceFrame",
250  this,
251  "OpenFileDialogACF()");
252 
253  fACFSelector->AddFrame(createACFButton,new TGLayoutHints(kLHintsTop,5,5,5,5));
254 
255  AddFrame(fRecentSourceSelector,new TGLayoutHints(kLHintsExpandX,10,10,10,10));
256 
257  AddFrame(fRawSelector,new TGLayoutHints(kLHintsExpandX,10,10,10,10));
258 
259  AddFrame(fOCDBSelector,new TGLayoutHints(kLHintsExpandX,10,10,10,10));
260 
261  AddFrame(fACFSelector,new TGLayoutHints(kLHintsExpandX,10,10,10,10));
262 
263  AddFrame(fDataReaders, new TGLayoutHints(kLHintsExpandX,10,10,10,10));
264 
265 }
266 
267 //_____________________________________________________________________________
269 {
271 
272  delete fItems;
273 }
274 
275 //_____________________________________________________________________________
276 void
278 {
280 
281  TGListBox* lb = fRecentSources->GetListBox();
282 
283  for ( Int_t i = 0; i < lb->GetNumberOfEntries(); ++i )
284  {
285  TGTextLBEntry* t = (TGTextLBEntry*)lb->GetEntry(i);
286  TString s(t->GetText()->GetString());
287  if ( s == name )
288  {
289  return;
290  }
291  }
292 
293  fRecentSources->SetEnabled(kTRUE);
294  fCreateRecentButton->SetEnabled(kTRUE);
295 
296  fRecentSources->AddEntry(name,lb->GetNumberOfEntries());
297  fRecentSources->MapSubwindows();
298  fRecentSources->Layout();
299 }
300 
301 //_____________________________________________________________________________
302 void
304 {
306 
307  if ( fCalibrateNoGain->IsOn() )
308  {
309  fRawOCDBPath->SetEnabled(kTRUE);
310  fRawOCDBPath->SetFocus();
311  }
312  else
313  {
314  fRawOCDBPath->SetEnabled(kFALSE);
315  }
316 }
317 
318 //_____________________________________________________________________________
319 void
321 {
323 
324  TString acfPath = fACFPath->GetText();
325  TGTextLBEntry* t = static_cast<TGTextLBEntry*>(fACFTypes->GetSelectedEntry());
326  TString type = t->GetText()->GetString();
327 
328  CreateACFDataSource(acfPath,type);
329 
330  fACFPath->SetText("");
331 }
332 
333 //_____________________________________________________________________________
334 void
335 AliMUONPainterDataSourceFrame::CreateACFDataSource(const TString& acfPath, const TString& type)
336 {
338 
339  AliMUONVTrackerDataMaker* reader = new AliMUONTrackerConditionDataMaker(acfPath.Data(),
340  type.Data());
341 
342  RegisterDataSource(reader,Form("FILE;%s;%s",acfPath.Data(),type.Data()));
343 }
344 
345 //_____________________________________________________________________________
346 void
348 {
350 
351  TObjArray* a = uri.Tokenize(";");
352  TString acfPath = static_cast<TObjString*>(a->At(1))->String();
353  TString type = static_cast<TObjString*>(a->At(2))->String();
354 
355  CreateACFDataSource(acfPath,type);
356 
357  delete a;
358 }
359 
360 //_____________________________________________________________________________
363  Int_t dim,
364  Double_t xmin, Double_t xmax,
365  const AliMUONAttPainter& att)
366 {
369 
370  AliMUONPainterMatrix* matrix = new AliMUONPainterMatrix("Tracker",5,2);
371 
372  for ( Int_t ichamber = 0; ichamber < 10; ++ichamber )
373  {
374  AliMUONVPainter* painter = new AliMUONChamberPainter(att,ichamber);
375 
376  painter->SetResponder("BUSPATCH");
377 
378  painter->SetOutlined("*",kFALSE);
379 
380  matrix->Adopt(painter);
381  }
382 
383  matrix->SetData("MANU",data,dim);
384  matrix->SetDataRange(xmin,xmax);
385 
387 
388  return matrix;
389 }
390 
391 //_____________________________________________________________________________
392 void
394 {
396 
397  TString cdbPath = fOCDBPath->GetText();
398  Int_t runNumber = fRunSelector->GetIntNumber();
399  TGTextLBEntry* t = static_cast<TGTextLBEntry*>(fOCDBTypes->GetSelectedEntry());
400  TString type = t->GetText()->GetString();
401 
402  CreateOCDBDataSource(cdbPath,runNumber,type,"");
403 }
404 
405 //_____________________________________________________________________________
406 void
407 AliMUONPainterDataSourceFrame::CreateOCDBDataSource(const TString& dataSourceDescriptor)
408 {
410 
411  TString sid = Env()->Descriptor2ID(dataSourceDescriptor);
412 
413  TString ranges = Env()->Descriptor2Ranges(dataSourceDescriptor);
414 
415  TString uri = Env()->ID2URI(sid);
416 
417  TString cdbPath = Env()->TupleFirst(uri,Env()->SeparatorWithinPart());
418 
419  TString type = Env()->ID2Type(sid);
420 
421  TString srun = Env()->TupleMiddle(uri,Env()->SeparatorWithinPart());
422 
423  CreateOCDBDataSource(cdbPath,atoi(srun.Data()),type,ranges);
424 }
425 
426 //_____________________________________________________________________________
427 void
429  Int_t runNumber,
430  const TString& type,
431  const TString& ranges)
432 {
434 
436  cdbPath.Data(),
437  type.Data());
438  if ( reader->Data() )
439  {
440  TString sourceID="OCDB";
441 
442  sourceID += Env()->SeparatorWithinPart();
443  sourceID += cdbPath;
444  sourceID += Env()->SeparatorWithinPart();
445  sourceID += Form("%d",runNumber);
446  sourceID += Env()->SeparatorWithinPart();
447  sourceID += type;
448 
449  RegisterDataSource(reader,Form("%s%s%s%s%s",sourceID.Data(),
451  reader->Data()->GetName(),
453  ranges.Data()));
454  }
455  else
456  {
457  AliError(Form("Could not create OCDB data source OCDB %s %d %s",cdbPath.Data(),runNumber,type.Data()));
458  }
459 }
460 
461 //_____________________________________________________________________________
462 void
464  Double_t pedMin, Double_t pedMax,
465  Double_t sigmaMin, Double_t sigmaMax)
466 {
469 
470  TList matrices;
471 
472  AliMUONAttPainter att[2];
473 
474  att[0].SetViewPoint(kTRUE,kFALSE);
475  att[0].SetCathode(kFALSE,kFALSE);
476  att[0].SetPlane(kTRUE,kFALSE);
477 
478  att[1].SetViewPoint(kTRUE,kFALSE);
479  att[1].SetCathode(kFALSE,kFALSE);
480  att[1].SetPlane(kFALSE,kTRUE);
481 
482  for ( Int_t iatt = 0; iatt < 2; ++iatt )
483  {
484  matrices.Add(CreateFullTracker(data,0,pedMin,pedMax,att[iatt]));
485  matrices.Add(CreateFullTracker(data,1,sigmaMin,sigmaMax,att[iatt]));
486  }
487 
488  TIter next(&matrices);
489  AliMUONPainterMatrix* matrix;
490 
491  Int_t w = TMath::Nint(gClient->GetDisplayWidth()*0.9);
492  Int_t h = TMath::Nint(gClient->GetDisplayHeight()*0.9);
493 
494  Int_t x[] = { 0, 0, 20 + w/2, 20 + w/2 };
495  Int_t y[] = { 0, h/2+30, 0, h/2+30 };
496 
497  Int_t i(0);
498 
499  while ( ( matrix = static_cast<AliMUONPainterMatrix*>(next())) )
500  {
501  TCanvas* c = matrix->CreateCanvas(x[i],y[i],w/2,h/2);
502  c->Draw();
503  c->SaveAs(Form("%s.png",c->GetName()));
504  ++i;
505  }
506 }
507 
508 //_____________________________________________________________________________
509 void
511 {
513 
514  TString uri(gSystem->ExpandPathName(fFilePath->GetText()));
515 
516  TString name("RAW");
517  Bool_t fromMemory(kFALSE);
518 
519  if ( uri.Contains(TRegexp("^mem")) )
520  {
521  fromMemory = kTRUE;
522  }
523  else
524  {
525  if ( gSystem->AccessPathName(uri.Data()) && !uri.BeginsWith("collection://") )
526  {
527  AliError(Form("File %s does not exist",uri.Data()));
528  fFilePath->SetText("");
529  return;
530  }
531  }
532 
533  TString calibMode("");
534 
535  if ( fCalibrateNoGain->IsOn() )
536  {
537  calibMode = "NOGAIN";
538  name = "CALZ";
539  }
540 
541  uri = Form("%s%s%s;%s;%s;%s;%s;%s;%s;%s",
542  ( fHistogramButton->IsOn() ? "H":""),
543  ( fromMemory ? "M" : ""),
544  name.Data(),uri.Data(),
545  ( strlen(fRawOCDBPath->GetText()) > 0 ? fRawOCDBPath->GetText() : " "),
546  ( calibMode.Length() > 0 ? calibMode.Data() : " "),
547  Form("%e",fHistoMin->GetNumber()),
548  Form("%e",fHistoMax->GetNumber()),
549  Form("%d",(Int_t)(fEventMin->GetIntNumber())),
550  Form("%d",(Int_t)(fEventMax->GetIntNumber())));
551 
552  if ( CreateRawDataSource(uri) )
553  {
554  fFilePath->SetText("");
555  fRawOCDBPath->SetText("");
556  }
557 }
558 
559 //_____________________________________________________________________________
560 Bool_t
562 {
564 
565  TString filename;
566  TString ocdbPath;
567  TString calibMode;
568  TString sxmin("0.0");
569  TString sxmax("4096.0");
570  TString emin("-1");
571  TString emax("-1");
572 
573  TObjArray* a = uri.Tokenize(";");
574 
575  filename = static_cast<TObjString*>(a->At(1))->String();
576 
577  if ( a->GetLast() > 1 )
578  {
579  ocdbPath = static_cast<TObjString*>(a->At(2))->String();
580  if ( ocdbPath == " " ) ocdbPath = "";
581  }
582 
583  if ( a->GetLast() > 2 )
584  {
585  calibMode = static_cast<TObjString*>(a->At(3))->String();
586  if ( calibMode == " " ) calibMode = "";
587  }
588 
589  if ( a->GetLast() > 3 )
590  {
591  sxmin = static_cast<TObjString*>(a->At(4))->String();
592  }
593 
594  if ( a->GetLast() > 4 )
595  {
596  sxmax = static_cast<TObjString*>(a->At(5))->String();
597  }
598 
599  if ( a->GetLast() > 5 )
600  {
601  emin = static_cast<TObjString*>(a->At(6))->String();
602  }
603 
604  if ( a->GetLast() > 6 )
605  {
606  emax = static_cast<TObjString*>(a->At(7))->String();
607  }
608 
609  delete a;
610 
611  AliRawReader* rawReader = 0x0;
612 
613  if ( filename.Contains(TRegexp("^alien")) )
614  {
615  // insure we've initialized the grid...
616  if (!gGrid)
617  {
618  TGrid::Connect("alien://");
619  }
620  }
621 
622  rawReader = AliRawReader::Create(filename.Data());
623 
624  if (!rawReader)
625  {
626  AliError(Form("Could not open file %s",filename.Data()));
627  fFilePath->SetText("");
628  return kFALSE;
629  }
630 
633  Int_t runNumber(-1);
634  Bool_t ok = rawReader->NextEvent();
635  if (!ok)
636  {
637  AliError(Form("File %s does not seem to be a raw data file",filename.Data()));
638  fFilePath->SetText("");
639  return kFALSE;
640  }
641  else
642  {
643  runNumber = rawReader->GetRunNumber();
644  }
645 
646  rawReader->RewindEvents();
647 
648  AliMUONVTrackerDataMaker* reader(0x0);
649  Bool_t histogram(kFALSE);
650 
651  if ( uri.Contains(TRegexp("^H")) ) histogram = kTRUE;
652 
653  if ( ocdbPath.Length() > 0 )
654  {
655 
656  AliMUONRecoParam* recoParam(0x0);
657 
658  AliCDBEntry* e = AliCDBManager::Instance()->Get("MUON/Calib/RecoParam",runNumber);
659  if (e)
660  {
661  TObject* o = e->GetObject();
662  if ( o->IsA() == TObjArray::Class() )
663  {
664  TIter next(static_cast<TObjArray*>(o));
665  AliMUONRecoParam* p;
666  while ( ( p = static_cast<AliMUONRecoParam*>(next()) ))
667  {
668  if ( p->IsDefault()) recoParam = p;
669  }
670  }
671  else
672  {
673  recoParam = static_cast<AliMUONRecoParam*>(o);
674  }
675  }
676 
677  reader = new AliMUONTrackerDataMaker(recoParam,
678  rawReader,
679  ocdbPath.Data(),
680  calibMode.Data(),
681  histogram,
682  sxmin.Atof(),
683  sxmax.Atof());
684  }
685  else
686  {
687  reader = new AliMUONTrackerDataMaker(rawReader,histogram);
688  }
689 
690  reader->SetEventRange(emin.Atoi(),emax.Atoi());
691 
692  reader->SetSource(filename.Data());
693 
694  TString dsName(uri);
695 
696  if ( emin.Atoi() <= emax.Atoi() )
697  {
698  // we have an event range
699  if ( emin.Atoi() == emax.Atoi())
700  {
701  dsName += Form("[%d]",emin.Atoi());
702  }
703  else
704  {
705  dsName += Form("[%d,%d]",emin.Atoi(),emax.Atoi());
706  }
707  }
708 
709  RegisterDataSource(reader,dsName.Data());
710 
711  return kTRUE;
712 }
713 
714 //_____________________________________________________________________________
715 void
717 {
719 
721 
722  item->Connect("StartRunning()",
723  "AliMUONPainterDataSourceFrame",
724  this,
725  "StartRunning()");
726 
727  item->Connect("StopRunning()",
728  "AliMUONPainterDataSourceFrame",
729  this,
730  "StopRunning()");
731 
732  fDataReaders->AddFrame(item);
733 
734  fItems->Add(item);
735 
736  fDataReaders->MapSubwindows();
737  fDataReaders->Resize();
738 }
739 
740 //_____________________________________________________________________________
741 void
743 {
745 
746  AliMUONPainterDataSourceItem* theItem(0x0);
747 
748  TIter next(fItems);
750 
751  while ( ( item = static_cast<AliMUONPainterDataSourceItem*>(next()) ) && !theItem )
752  {
753  if ( item->DataMaker() == maker )
754  {
755  theItem = item;
756  }
757  }
758 
759  if (!theItem) return;
760 
761  fDataReaders->RemoveFrame(theItem);
762  fItems->Remove(theItem);
763  theItem->DestroyWindow();
764  delete theItem;
765 
766  fDataReaders->MapSubwindows();
767  fDataReaders->Resize();
768 
769 }
770 
771 //_____________________________________________________________________________
774 {
776 }
777 
778 //_____________________________________________________________________________
779 void
781 {
783 
784  if ( fEventRangeButton->IsOn() )
785  {
786  fEventMin->SetState(kTRUE);
787  fEventMax->SetState(kTRUE);
788  }
789  else
790  {
791  fEventMin->SetIntNumber(-1);
792  fEventMax->SetIntNumber(-1);
793  fEventMin->SetState(kFALSE);
794  fEventMax->SetState(kFALSE);
795  }
796 }
797 
798 //_____________________________________________________________________________
799 void
801 {
803 
804  if ( fHistogramButton->IsOn() )
805  {
806  fHistoMin->SetState(kTRUE);
807  fHistoMax->SetState(kTRUE);
808  }
809  else
810  {
811  fHistoMin->SetState(kFALSE);
812  fHistoMax->SetState(kFALSE);
813  }
814 }
815 
816 //_____________________________________________________________________________
817 void
819 {
821 
822  TGFileInfo fileInfo;
823 
824  const char* fileTypes[] = {
825  "ROOT files","*.root",
826  "DATE files","*.raw",
827  "All files","*",
828  0,0 };
829 
830  fileInfo.fFileTypes = fileTypes;
831  delete[] fileInfo.fIniDir;
832 
833  fileInfo.fIniDir = StrDup(Env()->String("LastOpenDir","."));
834 
835  new TGFileDialog(gClient->GetRoot(),gClient->GetRoot(),
836  kFDOpen,&fileInfo);
837 
838  fFilePath->SetText(gSystem->ExpandPathName(Form("%s",fileInfo.fFilename)));
839 
840  Env()->Set("LastOpenDir",fileInfo.fIniDir);
841  Env()->Save();
842 }
843 
844 
845 //_____________________________________________________________________________
846 void
848 {
850 
851  TGFileInfo fileInfo;
852 
853  const char* fileTypes[] = {
854  "All files","*",
855  0,0 };
856 
857  fileInfo.fFileTypes = fileTypes;
858  delete[] fileInfo.fIniDir;
859 
860  fileInfo.fIniDir = StrDup(Env()->String("LastOpenDirACF","."));
861 
862  new TGFileDialog(gClient->GetRoot(),gClient->GetRoot(),
863  kFDOpen,&fileInfo);
864 
865  fACFPath->SetText(gSystem->ExpandPathName(Form("%s",fileInfo.fFilename)));
866 
867  Env()->Set("LastOpenDirACF",fileInfo.fIniDir);
868  Env()->Save();
869 }
870 
871 
872 //_____________________________________________________________________________
873 void
875 {
877 
878  TGTextLBEntry* t = (TGTextLBEntry*)fRecentSources->GetSelectedEntry();
879 
880  TString dataSourceDescriptor(t->GetText()->GetString());
881 
882  TString name = Env()->Descriptor2Name(dataSourceDescriptor);
883 
884  if (AliMUONPainterDataRegistry::Instance()->DataSource(name))
885  {
886  // source already registered.
887  return;
888  }
889 
890  TString sid = Env()->Descriptor2ID(dataSourceDescriptor);
891 
892  TString origin = Env()->ID2Origin(sid);
893 
894  if ( origin == "OCDB" )
895  {
896  CreateOCDBDataSource(dataSourceDescriptor);
897  }
898  else if ( origin == "RAW" )
899  {
900  CreateRawDataSource(dataSourceDescriptor);
901  }
902  else if ( origin == "ACF" )
903  {
904  CreateACFDataSource(dataSourceDescriptor);
905  }
906 
907  fRecentSources->Select(-1);
908 }
909 
910 //_____________________________________________________________________________
911 void
913  const char* dataSourceDescriptor)
914 {
916 
917  if ( reader && reader->IsValid() )
918  {
919  AliMUONMchViewApplication* app = dynamic_cast<AliMUONMchViewApplication*>(gApplication);
920  if (!app)
921  {
922  AliError("Could not cast application to the expected type ! CHECK THAT !");
923  }
924 
926 
927  TString desc = Env()->AddDataSource(dataSourceDescriptor);
928 
929  AddRecentSource(desc.Data());
930 
931  if ( app )
932  {
933  TString sid = Env()->Descriptor2ID(desc.Data());
934  TString type = Env()->ID2Type(sid);
935 
937  {
938  if ( Env()->Integer("disableAutoPedCanvas",0)==0)
939  {
940  CreatePedestalCanvases(reader->Data());
941  }
942  }
943  }
944  }
945 }
946 
947 //_____________________________________________________________________________
948 void
950 {
952 
953  AliMUONPainterDataSourceItem* item = reinterpret_cast<AliMUONPainterDataSourceItem*> (gTQSender);
954 
955  AliInfo("");
956 
957  TIter next(fItems);
959  while ( ( o = static_cast<AliMUONPainterDataSourceItem*>(next()) ) )
960  {
961  if ( o != item )
962  {
963  o->DisableRun();
964  }
965  }
966 }
967 
968 //_____________________________________________________________________________
969 void
971 {
973 
974  TIter next(fItems);
976  while ( ( o = static_cast<AliMUONPainterDataSourceItem*>(next()) ) )
977  {
978  o->EnableRun();
979  }
980 }
static TString TupleMiddle(const TString &tuple, const char *sep)
static AliMUONPainterHelper * Instance()
TGTextEntry * fRawOCDBPath
OCDB path for raw data calibration.
void SetOutlined(const char *pattern, Bool_t flag)
static TString ID2Type(const char *dataSourceID)
#define TObjArray
TGComboBox * fACFTypes
types of ASCII calibration files
Main class for the mchview program.
static Bool_t IsPedestals(const char *type)
Whether type is of Pedestals flavour.
virtual void SetResponder(const char *pattern)
Producer of some AliMUONVTrackerData.
TGNumberEntry * fHistoMin
xmin of histo to make
TString AddDataSource(const char *dataSourceDescriptor)
void SetViewPoint(Bool_t front, Bool_t back)
Int_t Register(AliMUONPainterMatrix *group)
Class with MUON reconstruction parameters.
void SetCathode(Bool_t cath0, Bool_t cath1)
TGNumberEntry * fRunSelector
OCDB run number entry widget.
TGNumberEntry * fEventMin
min event number to consider
Resource file handling.
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
static AliMUONPainterRegistry * Instance()
virtual void SetEventRange(Int_t, Int_t)
Set event range (if not event by event)
A widget describing a single data source.
void Register(AliMUONVTrackerDataMaker *reader)
static const char * SeparatorWithinPart()
static AliMUONPainterDataRegistry * Instance()
static TString Descriptor2Ranges(const char *dataSourceDescriptor)
TCanvas * CreateCanvas(Int_t x=0, Int_t y=0, Int_t w=-1, Int_t h=-1)
void RegisterDataSource(AliMUONVTrackerDataMaker *reader, const char *dsName)
static TString TupleFirst(const TString &tuple, const char *sep)
Base class for a graphical object representing some part of the MUON tracking system.
TObjArray * fItems
list of data readers we handle
void DataMakerWasUnregistered(const AliMUONVTrackerDataMaker *reader)
Registry for painter data sources.
static TString ID2Origin(const char *dataSourceID)
TGGroupFrame * fDataReaders
to display currently active data sources
TGCheckButton * fEventRangeButton
to trig limitation of event range
void SetData(const char *pattern, AliMUONVTrackerData *d, Int_t indexInData)
TGCheckButton * fCalibrateNoGain
to trig calibration of raw data (only 0 suppression)
static AliMUONPainterMatrix * CreateFullTracker(AliMUONVTrackerData *data, Int_t dim, Double_t xmin, Double_t xmax, const AliMUONAttPainter &att)
Float_t range[5]
TGCheckButton * fHistogramButton
to trig histogramming of raw data
TGTextEntry * fFilePath
raw data file path text entry widget
TGNumberEntry * fHistoMax
xmax of histo to make
virtual Bool_t IsValid() const =0
Whether we are valid or not.
static TString Descriptor2Name(const char *dataSourceDescriptor)
TGComboBox * fRecentSources
recent sources combo box
virtual void SetSource(const char *source)=0
Set our source URI.
Implementation of VTrackerDataMaker to read raw data.
void Adopt(AliMUONVPainter *painter)
Adopt a painter in this matrix.
static TString ID2URI(const char *dataSourceID)
TGTextButton * fCreateRecentButton
button to create a recent data source
virtual AliMUONVTrackerData * Data() const =0
Our data.
AliMUONPainterEnv * Env()
Return the environment.
TGComboBox * fOCDBTypes
OCDB type combo box entry widget.
void SetDataRange(Double_t min, Double_t max)
Force a given data range for all painter groups belonging to this matrix.
Basic attributes shared by all painters.
TGTextEntry * fOCDBPath
OCDB path text entry widget.
TGNumberEntry * fEventMax
max event number to consider
static PprRun_t srun
Definition: ConfigCosmic.C:124
AliMUONVTrackerDataMaker * DataMaker() const
Return data source reader.
static void CreatePedestalCanvases(AliMUONVTrackerData *data, Double_t pedMin=0, Double_t pedMax=500, Double_t sigmaMin=0, Double_t sigmaMax=5)
void DataMakerWasRegistered(AliMUONVTrackerDataMaker *reader)
void SetPlane(Bool_t bending, Bool_t nonBending)
TGTextEntry * fACFPath
path to ASCII calibration file
Base class for MUON data that can be presented at different levels in the hierarchy of the MUON syste...
A matrix of AliMUONVPainter.
void Set(const char *resourceName, Int_t value)
static TString Descriptor2ID(const char *dataSourceDescriptor)
Frame to select input data source(s) to be displayed.
static const char * SeparatorBetweenDescriptorParts()
Producer of AliMUONVTrackerData from OCDB or ASCII condition files.
Painter for one (plane of one) chamber.