]>
Commit | Line | Data |
---|---|---|
33791895 | 1 | /************************************************************************** |
2 | * This file is property of and copyright by the ALICE HLT Project * | |
3 | * ALICE Experiment at CERN, All rights reserved. * | |
4 | * * | |
5 | * Primary Authors: Svein Lindal <slindal@fys.uio.no > * | |
6 | * for The ALICE HLT Project. * | |
7 | * * | |
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 | **************************************************************************/ | |
16 | ||
17 | /// @file AliHLTEveBase.cxx | |
18 | /// @author Svein Lindal <slindal@fys.uio.no> | |
19 | /// @brief Base class for the HLT eve display detector elements | |
20 | ||
21 | ||
22 | #include "AliHLTEveBase.h" | |
23 | #include "AliHLTHOMERBlockDesc.h" | |
24 | //#include "TCollection.h" | |
25 | #include "AliEveHOMERManager.h" | |
26 | #include "TCanvas.h" | |
27 | #include "TEveWindow.h" | |
28 | #include "TEveManager.h" | |
29 | #include "TEveBrowser.h" | |
30 | #include "TH1F.h" | |
31 | #include "TH2F.h" | |
32 | ||
33 | ClassImp(AliHLTEveBase); | |
34 | ||
35 | AliHLTEveBase::AliHLTEveBase() : | |
36 | fEventManager(NULL), | |
37 | fCanvas(NULL), | |
3d600a8b | 38 | fHistoCount(0), |
39 | fMaxHistos(0), | |
40 | fDetector("") | |
33791895 | 41 | { |
42 | // Constructor. | |
43 | } | |
44 | ||
45 | AliHLTEveBase::~AliHLTEveBase() | |
46 | { | |
47 | //Destructor | |
48 | ||
49 | if(fCanvas) | |
50 | delete fCanvas; | |
51 | fCanvas = NULL; | |
52 | ||
bc1a13f1 | 53 | // fEventManager->DestroyElements(); |
54 | //fEventManager = NULL; | |
55 | ||
33791895 | 56 | } |
57 | ||
58 | ||
59 | ||
60 | TCanvas * AliHLTEveBase::CreateCanvas(TString tabTitle, TString canvasTitle ) { | |
61 | //See header file for documentation | |
62 | ||
63 | TEveWindowSlot *slot = TEveWindow::CreateWindowInTab(fEventManager->GetEveManager()->GetBrowser()->GetTabRight()); | |
64 | slot->StartEmbedding(); | |
65 | TCanvas * canvas = new TCanvas(canvasTitle.Data(),canvasTitle.Data(), 600, 400); | |
66 | slot->StopEmbedding(tabTitle.Data()); | |
67 | ||
68 | return canvas; | |
69 | } | |
70 | ||
3d600a8b | 71 | |
33791895 | 72 | void AliHLTEveBase::AddHistogramsToCanvas(AliHLTHOMERBlockDesc * block, TCanvas * canvas, Int_t &cdCount ) { |
73 | //See header file for documentation | |
3d600a8b | 74 | |
33791895 | 75 | |
76 | if ( ! block->GetClassName().CompareTo("TObjArray")) { | |
77 | TIter next((TObjArray*)(block->GetTObject())); | |
78 | TObject *object; | |
3d600a8b | 79 | |
33791895 | 80 | while (( object = (TObject*) next())) { |
3d600a8b | 81 | if (cdCount == fMaxHistos) { |
82 | cout << "Too many histograms from detector, increase division size!!!!!!!!!!!! Detector: " << GetDetector() << endl; | |
83 | break; | |
84 | } | |
33791895 | 85 | TH2F* histo = dynamic_cast<TH2F*>(object); |
86 | if(histo){ | |
87 | canvas->cd(++cdCount); | |
88 | histo->Draw("COLZ"); | |
89 | } else { | |
90 | TH1F* hist = dynamic_cast<TH1F*>(object); | |
91 | if (hist) { | |
92 | canvas->cd(++cdCount); | |
93 | hist->Draw(); | |
94 | } else { | |
95 | cout <<"AliHLTEveCaloBase::AddHistogramsTocCanvas: Histogram neither TH1F nor TH2F"<<endl; | |
96 | } | |
97 | } | |
98 | } | |
99 | } | |
100 | ||
101 | else if ( ! block->GetClassName().CompareTo("TH1F")) { | |
102 | ||
103 | TH1F* histo = reinterpret_cast<TH1F*>(block->GetTObject()); | |
104 | ++cdCount; | |
3d600a8b | 105 | if(cdCount > fMaxHistos){ |
106 | ||
107 | cout << "Too many histograms, divide canvas more or create additional. Or ask svein to fix it! Detector: "<< GetDetector()<<endl; | |
108 | cdCount = 1; | |
109 | } canvas->cd(cdCount); | |
33791895 | 110 | histo->Draw(); |
111 | ||
112 | } | |
113 | ||
114 | else if ( ! block->GetClassName().CompareTo("TH2F")) { | |
115 | TH2F *histo = reinterpret_cast<TH2F*>(block->GetTObject()); | |
116 | if (histo) { | |
117 | ++cdCount; | |
3d600a8b | 118 | |
119 | if(cdCount > fMaxHistos){ | |
120 | cdCount = 1; | |
121 | cout << "Too many histograms, divide canvas more or create additional. Or ask svein to fix it! Detector :" << GetDetector()<<endl; | |
122 | } | |
123 | ||
33791895 | 124 | canvas->cd(cdCount); |
125 | histo->Draw("COLZ"); | |
126 | } | |
127 | } | |
128 | ||
129 | canvas->cd(); | |
130 | } | |
131 | ||
132 |