]>
Commit | Line | Data |
---|---|---|
6e994a7b | 1 | // $Id$ |
2 | // Author: Stefano Carrazza 2010 | |
3 | ||
4 | /************************************************************************** | |
5 | * Copyright(c) 1998-2009, ALICE Experiment at CERN, all rights reserved. * | |
6 | * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * | |
7 | * full copyright notice. * | |
8 | **************************************************************************/ | |
9 | ||
10 | #include "AliEveBeamsInfo.h" | |
11 | #include "AliPhysicsSelection.h" | |
12 | #include "AliESDEvent.h" | |
13 | #include "AliEveEventManager.h" | |
14 | #include "AliEveEventSelector.h" | |
15 | #include "AliEveMultiView.h" | |
16 | ||
17 | #include "TEveWindow.h" | |
18 | #include "TEveManager.h" | |
19 | #include "TEveBrowser.h" | |
20 | #include "TEveViewer.h" | |
21 | #include "TEveScene.h" | |
22 | #include "TGLOverlayButton.h" | |
23 | ||
24 | ||
25 | //______________________________________________________________________________ | |
26 | // This class provides the triggers information about beams. | |
27 | // | |
28 | ||
29 | ClassImp(AliEveBeamsInfo) | |
30 | ||
31 | //______________________________________________________________________________ | |
32 | AliEveBeamsInfo::AliEveBeamsInfo(const char* name) : | |
33 | TEveElementList(name), | |
34 | fEsd(0), | |
35 | fShowEventsInfo(kTRUE), | |
36 | fPhysicsSelection(0), | |
37 | fCollisionCandidate(0), | |
38 | fBeam1(0), | |
39 | fBeam2(0), | |
40 | fAl(0), | |
41 | fHisto2dv(0), | |
42 | fEventSelector(0) | |
43 | { | |
44 | // Constructor. | |
45 | gEve->AddToListTree(this,0); | |
46 | ||
47 | // get current ESD event | |
48 | fEsd = AliEveEventManager::AssertESD(); | |
49 | fAl = AliEveMultiView::Instance(); | |
50 | fEventSelector = AliEveEventManager::GetMaster()->GetEventSelector(); | |
51 | ||
52 | // AliPhysicsSelection | |
53 | fPhysicsSelection = new AliPhysicsSelection(); | |
54 | fPhysicsSelection->SetAnalyzeMC(kFALSE); | |
55 | fPhysicsSelection->Initialize(fEsd->GetRunNumber()); | |
56 | ||
57 | // loading physics selection and triggers buttons | |
58 | fCollisionCandidate = new TGLOverlayButton(0, "", 10.0, -10.0, 190.0, 20.0); | |
59 | fCollisionCandidate->SetAlphaValues(1.5,1.5); | |
60 | fBeam1 = new TGLOverlayButton(0, "", 10.0, -30.0, 190.0, 20.0); | |
61 | fBeam1->SetAlphaValues(1.5,1.5); | |
62 | fBeam2 = new TGLOverlayButton(0, "", 10.0, -50.0, 190.0, 20.0); | |
63 | fBeam2->SetAlphaValues(1.5,1.5); | |
64 | ||
65 | // show beams info | |
66 | ShowBeamsInfo(fShowEventsInfo, kFALSE); | |
67 | ||
68 | } | |
69 | ||
70 | //______________________________________________________________________________ | |
71 | AliEveBeamsInfo::~AliEveBeamsInfo() | |
72 | { | |
73 | // deleting variables | |
74 | delete fEsd; | |
75 | delete fPhysicsSelection; | |
76 | delete fCollisionCandidate; | |
77 | delete fBeam1; | |
78 | delete fBeam2; | |
79 | delete fAl; | |
80 | delete fHisto2dv; | |
81 | ||
82 | } | |
83 | ||
84 | void AliEveBeamsInfo::ShowBeamsInfo(Bool_t show, Bool_t updateonly) | |
85 | { | |
86 | // Collision candidate | |
87 | fHisto2dv = (TEveViewer*) gEve->GetViewers()->FindChild("2D Lego Viewer"); | |
88 | ||
89 | if (show == 0) | |
90 | { | |
91 | ||
92 | gEve->GetDefaultGLViewer()->RemoveOverlayElement(fCollisionCandidate); | |
93 | fAl->Get3DView()->GetGLViewer()->RemoveOverlayElement(fCollisionCandidate); | |
94 | if(fHisto2dv) | |
95 | fHisto2dv->GetGLViewer()->RemoveOverlayElement(fCollisionCandidate); | |
96 | ||
97 | gEve->GetDefaultGLViewer()->RemoveOverlayElement(fBeam1); | |
98 | fAl->Get3DView()->GetGLViewer()->RemoveOverlayElement(fBeam1); | |
99 | if(fHisto2dv) | |
100 | fHisto2dv->GetGLViewer()->RemoveOverlayElement(fBeam1); | |
101 | ||
102 | gEve->GetDefaultGLViewer()->RemoveOverlayElement(fBeam2); | |
103 | fAl->Get3DView()->GetGLViewer()->RemoveOverlayElement(fBeam2); | |
104 | if(fHisto2dv) | |
105 | fHisto2dv->GetGLViewer()->RemoveOverlayElement(fBeam2); | |
106 | ||
107 | } else { | |
108 | ||
109 | if (updateonly == kFALSE) { | |
110 | gEve->GetDefaultGLViewer()->AddOverlayElement(fCollisionCandidate); | |
111 | fAl->Get3DView()->GetGLViewer()->AddOverlayElement(fCollisionCandidate); | |
112 | if(fHisto2dv) | |
113 | fHisto2dv->GetGLViewer()->AddOverlayElement(fCollisionCandidate); | |
114 | } | |
115 | ||
116 | Bool_t ev = fPhysicsSelection->IsCollisionCandidate(fEsd); | |
117 | ||
118 | if (ev == 1) | |
119 | { | |
120 | fCollisionCandidate->SetText("Collision candidate: YES"); | |
121 | } else { | |
122 | fCollisionCandidate->SetText("Collision candidate: NO "); | |
123 | } | |
124 | ||
125 | // Beam 1 & 2 setup: method 1 | |
126 | if (updateonly == kFALSE) { | |
127 | gEve->GetDefaultGLViewer()->AddOverlayElement(fBeam1); | |
128 | fAl->Get3DView()->GetGLViewer()->AddOverlayElement(fBeam1); | |
129 | if(fHisto2dv) | |
130 | fHisto2dv->GetGLViewer()->AddOverlayElement(fBeam1); | |
131 | ||
132 | gEve->GetDefaultGLViewer()->AddOverlayElement(fBeam2); | |
133 | fAl->Get3DView()->GetGLViewer()->AddOverlayElement(fBeam2); | |
134 | if(fHisto2dv) | |
135 | fHisto2dv->GetGLViewer()->AddOverlayElement(fBeam2); | |
136 | } | |
137 | ||
138 | Bool_t b1 = fEsd->IsTriggerClassFired("CINT1A-ABCE-NOPF-ALL"); | |
139 | Bool_t b2 = fEsd->IsTriggerClassFired("CINT1C-ABCE-NOPF-ALL"); | |
140 | Bool_t b12 = fEsd->IsTriggerClassFired("CINT1B-ABCE-NOPF-ALL"); | |
141 | ||
142 | if (b1 == 1 || b12 == 1) | |
143 | { | |
144 | fBeam1->SetText("Beam 1: YES"); | |
145 | fBeam1->SetBackColor(0x00ff00); | |
146 | } else { | |
147 | fBeam1->SetText("Beam 1: NO"); | |
148 | fBeam1->SetBackColor(0xff0000); | |
149 | } | |
150 | ||
151 | if (b2 == 1 || b12 == 1) | |
152 | { | |
153 | fBeam2->SetText("Beam 2: YES"); | |
154 | fBeam2->SetBackColor(0x00ff00); | |
155 | } else { | |
156 | fBeam2->SetText("Beam 2: NO"); | |
157 | fBeam2->SetBackColor(0xff0000); | |
158 | } | |
159 | } | |
160 | ||
161 | gEve->Redraw3D(kTRUE); | |
162 | ||
163 | } | |
164 | ||
165 | //______________________________________________________________________________ | |
166 | void AliEveBeamsInfo::Update() | |
167 | { | |
168 | // update beams information for current event | |
169 | ShowBeamsInfo(fShowEventsInfo, kTRUE); | |
170 | } | |
171 | ||
172 | //______________________________________________________________________________ | |
173 | void AliEveBeamsInfo::ShowEventSelection() | |
174 | { | |
175 | // activate/deactivate info box | |
176 | if (fShowEventsInfo == 0) | |
177 | { | |
178 | fShowEventsInfo = 1; | |
179 | } else { | |
180 | fShowEventsInfo = 0; | |
181 | } | |
182 | ||
183 | ShowBeamsInfo(fShowEventsInfo); | |
184 | } | |
185 | ||
186 | //______________________________________________________________________________ | |
187 | void AliEveBeamsInfo::SelectEventSelection(Int_t id) | |
188 | { | |
189 | // show trigger information | |
190 | if (id == 0) | |
191 | { | |
192 | fEventSelector->SetSelectOnTriggerType(kFALSE); | |
193 | } else { | |
194 | if (id == 1) fEventSelector->SetTriggerType("CINT1A-ABCE-NOPF-ALL"); | |
195 | if (id == 2) fEventSelector->SetTriggerType("CINT1C-ABCE-NOPF-ALL"); | |
196 | if (id == 3) fEventSelector->SetTriggerType("CINT1B-ABCE-NOPF-ALL"); | |
197 | fEventSelector->SetSelectOnTriggerType(kTRUE); | |
198 | } | |
199 | } | |
200 | ||
201 | //______________________________________________________________________________ | |
202 | void AliEveBeamsInfo::ShowPrevEvent() | |
203 | { | |
204 | // go to the previous event | |
205 | AliEveEventManager::GetMaster()->PrevEvent(); | |
206 | } | |
207 | ||
208 | //______________________________________________________________________________ | |
209 | void AliEveBeamsInfo::ShowNextEvent() | |
210 | { | |
211 | AliEveEventManager::GetMaster()->NextEvent(); | |
212 | } | |
213 | ||
214 | /******************************************************************************/ |