2 // Author: Stefano Carrazza 2010
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 **************************************************************************/
10 #include "AliEveBeamsInfo.h"
11 #include "AliPhysicsSelection.h"
12 #include "AliESDEvent.h"
13 #include "AliEveEventManager.h"
14 #include "AliEveEventSelector.h"
15 #include "AliEveMultiView.h"
17 #include "TEveWindow.h"
18 #include "TEveManager.h"
19 #include "TEveBrowser.h"
20 #include "TEveViewer.h"
21 #include "TEveScene.h"
22 #include "TGLOverlayButton.h"
25 //______________________________________________________________________________
26 // This class provides the triggers information about beams.
29 ClassImp(AliEveBeamsInfo)
31 //______________________________________________________________________________
32 AliEveBeamsInfo::AliEveBeamsInfo(const char* name) :
33 TEveElementList(name),
35 fShowEventsInfo(kTRUE),
37 fCollisionCandidate(0),
45 gEve->AddToListTree(this,0);
47 // get current ESD event
48 fEsd = AliEveEventManager::AssertESD();
49 fAl = AliEveMultiView::Instance();
50 fEventSelector = AliEveEventManager::GetMaster()->GetEventSelector();
52 // AliPhysicsSelection
53 fPhysicsSelection = new AliPhysicsSelection();
54 fPhysicsSelection->SetAnalyzeMC(kFALSE);
55 fPhysicsSelection->Initialize(fEsd->GetRunNumber());
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);
66 ShowBeamsInfo(fShowEventsInfo, kFALSE);
70 //______________________________________________________________________________
71 AliEveBeamsInfo::~AliEveBeamsInfo()
75 delete fPhysicsSelection;
76 delete fCollisionCandidate;
84 void AliEveBeamsInfo::ShowBeamsInfo(Bool_t show, Bool_t updateonly)
86 // Collision candidate
87 fHisto2dv = (TEveViewer*) gEve->GetViewers()->FindChild("2D Lego Viewer");
92 gEve->GetDefaultGLViewer()->RemoveOverlayElement(fCollisionCandidate);
93 fAl->Get3DView()->GetGLViewer()->RemoveOverlayElement(fCollisionCandidate);
95 fHisto2dv->GetGLViewer()->RemoveOverlayElement(fCollisionCandidate);
97 gEve->GetDefaultGLViewer()->RemoveOverlayElement(fBeam1);
98 fAl->Get3DView()->GetGLViewer()->RemoveOverlayElement(fBeam1);
100 fHisto2dv->GetGLViewer()->RemoveOverlayElement(fBeam1);
102 gEve->GetDefaultGLViewer()->RemoveOverlayElement(fBeam2);
103 fAl->Get3DView()->GetGLViewer()->RemoveOverlayElement(fBeam2);
105 fHisto2dv->GetGLViewer()->RemoveOverlayElement(fBeam2);
109 if (updateonly == kFALSE) {
110 gEve->GetDefaultGLViewer()->AddOverlayElement(fCollisionCandidate);
111 fAl->Get3DView()->GetGLViewer()->AddOverlayElement(fCollisionCandidate);
113 fHisto2dv->GetGLViewer()->AddOverlayElement(fCollisionCandidate);
116 Bool_t ev = fPhysicsSelection->IsCollisionCandidate(fEsd);
120 fCollisionCandidate->SetText("Collision candidate: YES");
122 fCollisionCandidate->SetText("Collision candidate: NO ");
125 // Beam 1 & 2 setup: method 1
126 if (updateonly == kFALSE) {
127 gEve->GetDefaultGLViewer()->AddOverlayElement(fBeam1);
128 fAl->Get3DView()->GetGLViewer()->AddOverlayElement(fBeam1);
130 fHisto2dv->GetGLViewer()->AddOverlayElement(fBeam1);
132 gEve->GetDefaultGLViewer()->AddOverlayElement(fBeam2);
133 fAl->Get3DView()->GetGLViewer()->AddOverlayElement(fBeam2);
135 fHisto2dv->GetGLViewer()->AddOverlayElement(fBeam2);
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");
142 if (b1 == 1 || b12 == 1)
144 fBeam1->SetText("Beam 1: YES");
145 fBeam1->SetBackColor(0x00ff00);
147 fBeam1->SetText("Beam 1: NO");
148 fBeam1->SetBackColor(0xff0000);
151 if (b2 == 1 || b12 == 1)
153 fBeam2->SetText("Beam 2: YES");
154 fBeam2->SetBackColor(0x00ff00);
156 fBeam2->SetText("Beam 2: NO");
157 fBeam2->SetBackColor(0xff0000);
161 gEve->Redraw3D(kTRUE);
165 //______________________________________________________________________________
166 void AliEveBeamsInfo::Update()
168 // update beams information for current event
169 ShowBeamsInfo(fShowEventsInfo, kTRUE);
172 //______________________________________________________________________________
173 void AliEveBeamsInfo::ShowEventSelection()
175 // activate/deactivate info box
176 if (fShowEventsInfo == 0)
183 ShowBeamsInfo(fShowEventsInfo);
186 //______________________________________________________________________________
187 void AliEveBeamsInfo::SelectEventSelection(Int_t id)
189 // show trigger information
192 fEventSelector->SetSelectOnTriggerType(kFALSE);
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);
201 //______________________________________________________________________________
202 void AliEveBeamsInfo::ShowPrevEvent()
204 // go to the previous event
205 AliEveEventManager::GetMaster()->PrevEvent();
208 //______________________________________________________________________________
209 void AliEveBeamsInfo::ShowNextEvent()
211 AliEveEventManager::GetMaster()->NextEvent();
214 /******************************************************************************/