1 /**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * ALICE Experiment at CERN, All rights reserved. *
5 * Primary Authors: Svein Lindal <slindal@fys.uio.no > *
6 * for The ALICE HLT Project. *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
17 /// @file AliHLTEveBase.cxx
18 /// @author Svein Lindal <slindal@fys.uio.no>
19 /// @brief Base class for the HLT eve display detector elements
22 #include "AliHLTEveBase.h"
23 #include "AliHLTHOMERBlockDesc.h"
24 #include "TCollection.h"
25 #include "TObjArray.h"
26 #include "AliEveHLTEventManager.h"
28 #include "TEveWindow.h"
29 #include "TEveManager.h"
30 #include "TEveBrowser.h"
34 ClassImp(AliHLTEveBase);
36 AliHLTEveBase::AliHLTEveBase(const char * name) :
37 TEveElementList(name),
47 AliHLTEveBase::~AliHLTEveBase()
55 // fEventManager->DestroyElements();
56 //fEventManager = NULL;
62 TCanvas * AliHLTEveBase::CreateCanvas(TString tabTitle, TString canvasTitle ) {
63 //See header file for documentation
65 TEveWindowSlot *slot = TEveWindow::CreateWindowInTab(fEventManager->GetEveManager()->GetBrowser()->GetTabRight());
66 slot->StartEmbedding();
67 TCanvas * canvas = new TCanvas(canvasTitle.Data(),canvasTitle.Data(), 600, 400);
68 slot->StopEmbedding(tabTitle.Data());
74 void AliHLTEveBase::AddHistogramsToCanvas(AliHLTHOMERBlockDesc * block, TCanvas * canvas, Int_t &cdCount ) {
75 //See header file for documentation
79 if ( ! block->GetClassName().CompareTo("TObjArray")) {
81 // // TObjArray * blocks = dynamic_cast<TObjArray*>(block->GetTObject());
82 // // TIterator* next = block::MakeIterator();
84 TIter next((TObjArray*)(block->GetTObject()));
87 while (( object = (TObject*) next())) {
88 if (cdCount == fMaxHistos) {
89 cout << "Too many histograms from detector, increase division size!!!!!!!!!!!! Detector: " << GetDetector() << endl;
92 TH2F* histo = dynamic_cast<TH2F*>(object);
94 canvas->cd(++cdCount);
97 TH1F* hist = dynamic_cast<TH1F*>(object);
99 canvas->cd(++cdCount);
102 cout <<"AliHLTEveCaloBase::AddHistogramsTocCanvas: Histogram neither TH1F nor TH2F"<<endl;
108 else if ( ! block->GetClassName().CompareTo("TH1F")) {
110 TH1F* histo = reinterpret_cast<TH1F*>(block->GetTObject());
112 if(cdCount > fMaxHistos){
114 cout << "Too many histograms, divide canvas more or create additional. Or ask svein to fix it! Detector: "<< GetDetector()<<endl;
116 } canvas->cd(cdCount);
121 else if ( ! block->GetClassName().CompareTo("TH2F")) {
122 TH2F *histo = reinterpret_cast<TH2F*>(block->GetTObject());
126 if(cdCount > fMaxHistos){
128 cout << "Too many histograms, divide canvas more or create additional. Or ask svein to fix it! Detector :" << GetDetector()<<endl;