#pragma link C++ class AliEveV0List+;
#pragma link C++ class AliEveV0Editor+;
#pragma link C++ class AliEveV0ListEditor+;
-
-// TEveJetCone
-#pragma link C++ class TEveJetCone+;
-#pragma link C++ class TEveJetConeEditor+;
-#pragma link C++ class TEveJetConeGL+;
+++ /dev/null
-// @(#)root/eve:$Id$
-// Author: Matevz Tadel 2007
-
-/*************************************************************************
- * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
- * All rights reserved. *
- * *
- * For the licensing terms see $ROOTSYS/LICENSE. *
- * For the list of contributors see $ROOTSYS/README/CREDITS. *
- *************************************************************************/
-
-#include "TEveJetCone.h"
-#include "TEveTrans.h"
-
-#include "TBuffer3D.h"
-#include "TBuffer3DTypes.h"
-#include "TVirtualPad.h"
-#include "TVirtualViewer3D.h"
-
-#include "TMath.h"
-
-//______________________________________________________________________________
-// Description of TEveJetCone
-//
-// Draw a jet cone with leading particle is specified in (eta,phi) and cone radius is given
-// If Apex is not set, default is (0.,0.,0.)
-// In case of cylinder was set, cone is cut at the cylinder edges
-// example :
-//
-// Float_t coneEta = r.Uniform(-0.9, 0.9);
-// Float_t conePhi = r.Uniform(0.0, TwoPi() );
-// Float_t coneRadius = 0.4;
-//
-// TEveJetCone* jetCone = new TEveJetCone("JetCone");
-// jetCone->SetCylinder( 250., 250. );
-// if ( (jetCone->AddCone( coneEta, conePhi, coneRadius ) ) != -1)
-// gEve->AddElement( jetCone );
-//
-
-ClassImp(TEveJetCone)
-
-//______________________________________________________________________________
-TEveJetCone::TEveJetCone(const Text_t* n, const Text_t* t) :
- TEveElementList(n, t, kTRUE),
- TAttBBox(),
- fApex( TEveVector(0.,0.,0.) ),
- fBasePoints(),
- fCylinderBorder( TEveVector(-1.,0.,-1.) ),
- fThetaC(0.)
-{
- // Constructor.
-
- fColor = kGreen;
-}
-
-
-/******************************************************************************/
-
-//______________________________________________________________________________
-void TEveJetCone::ComputeBBox()
-{
- // Compute bounding-box of the data.
-
- BBoxInit();
- BBoxCheckPoint(fApex);
- for (vTEveVector_ci i = fBasePoints.begin(); i != fBasePoints.end(); ++i)
- {
- BBoxCheckPoint(*i);
- }
-}
-
-//______________________________________________________________________________
-void TEveJetCone::Paint(Option_t*)
-{
- // Paint object.
- // This is for direct rendering (using TEveJetConeGL class).
-
- static const TEveException eh("TEveJetCone::Paint ");
-
- if (fRnrSelf == kFALSE) return;
-
- TBuffer3D buff(TBuffer3DTypes::kGeneric);
-
- // Section kCore
- buff.fID = this;
- buff.fColor = GetMainColor();
- buff.fTransparency = GetMainTransparency();
- if (HasMainTrans())
- RefMainTrans().SetBuffer3D(buff);
- buff.SetSectionsValid(TBuffer3D::kCore);
-
- Int_t reqSections = gPad->GetViewer3D()->AddObject(buff);
- if (reqSections != TBuffer3D::kNone)
- Error(eh, "only direct GL rendering supported.");
-}
-
-//______________________________________________________________________________
-Int_t TEveJetCone::AddCone( const Float_t& eta, const Float_t& phi, const Float_t& coneRadius, const Float_t& height )
-{
- // Add jet cone
- // parameters are :
- // * (eta,phi) : of the center/leading particle
- // * coneRadius : in eta-phi space
- // * height : height of the cone
- // * if cylinder is set and length is adapted to cylinder.
- // - if height is given, it will be used as scalar factor
- // * if cylinder is not set, height is used as height of the cone
- // Return 0 on sucess
-
- if ( fCylinderBorder.fZ == -1. && fCylinderBorder.fX == -1. && height == -1 )
- return -1;
-
- TEveVector coneAxis;
- FillTEveVectorFromEtaPhi( coneAxis, eta, phi );
-
- Float_t angleRad = 0.;
- for ( Float_t angle = 0.; angle < 360. ; angle+=5. , angleRad=angle*TMath::Pi()/180 ) {
-
- // -- Get Contour point
- TEveVector contourPoint;
- FillTEveVectorFromEtaPhi( contourPoint,
- eta + coneRadius * TMath::Cos(angleRad),
- phi + coneRadius * TMath::Sin(angleRad) );
-
- // -- Set length of the contourPoint
- if ( fCylinderBorder.fZ != -1. && fCylinderBorder.fX != -1. ) {
- if ( contourPoint.Theta() < fThetaC )
- contourPoint *= fCylinderBorder.fZ / TMath::Cos( contourPoint.Theta() ) ;
- else if ( contourPoint.Theta() > ( TMath::Pi() - fThetaC ) )
- contourPoint *= fCylinderBorder.fZ / TMath::Cos( contourPoint.Theta() - TMath::Pi() ) ;
- else
- contourPoint *= fCylinderBorder.fX / TMath::Sin( contourPoint.Theta() ) ;
-
- if ( height != -1 ) contourPoint *= height;
- }
- else {
- contourPoint *= height / GetArcCosConeOpeningAngle( coneAxis, contourPoint );
- }
-
- // -- Add contourPoint
- fBasePoints.push_back( contourPoint );
- }
-
- return 0;
-}
-
-//______________________________________________________________________________
-void TEveJetCone::FillTEveVectorFromEtaPhi( TEveVector &vec, const Float_t& eta, const Float_t& phi )
-{
- // Fill TEveVector with eta and phi, with magnitude 1.
-
- vec.Set( TMath::Cos(phi) / TMath::CosH(eta),
- TMath::Sin(phi) / TMath::CosH(eta),
- TMath::TanH(eta) );
- return;
-}
-
-//______________________________________________________________________________
-Float_t TEveJetCone::GetArcCosConeOpeningAngle( const TEveVector& axis, const TEveVector& contour ) {
- // Return the arccos of the opening angle between two eve vectors
-
- Float_t arcCos = 0.;
-
- Float_t tot2 = axis.Mag2() * contour.Mag2();
- if( tot2 > 0. ) {
- arcCos = axis.Dot( contour )/ TMath::Sqrt( tot2 );
- if (arcCos > 1.0) arcCos = 1.0;
- if (arcCos < -1.0) arcCos = -1.0;
- }
-
- return arcCos;
-}
+++ /dev/null
-// @(#)root/eve:$Id$
-// Author: Matevz Tadel 2007
-
-/*************************************************************************
- * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
- * All rights reserved. *
- * *
- * For the licensing terms see $ROOTSYS/LICENSE. *
- * For the list of contributors see $ROOTSYS/README/CREDITS. *
- *************************************************************************/
-
-#ifndef ROOT_TEveJetCone
-#define ROOT_TEveJetCone
-
-#include "TEveElement.h"
-#include "TEveVSDStructs.h"
-#include "TAttBBox.h"
-
-class TEveJetCone : public TEveElementList,
- public TAttBBox
-{
- friend class TEveJetConeGL;
-
-private:
- TEveJetCone(const TEveJetCone&); // Not implemented
- TEveJetCone& operator=(const TEveJetCone&); // Not implemented
-
- void FillTEveVectorFromEtaPhi( TEveVector &vec, const Float_t& eta, const Float_t& phi );
- Float_t GetArcCosConeOpeningAngle( const TEveVector& axis, const TEveVector& contour );
-
-protected:
- typedef std::vector<TEveVector> vTEveVector_t;
- typedef vTEveVector_t::iterator vTEveVector_i;
- typedef vTEveVector_t::const_iterator vTEveVector_ci;
-
- TEveVector fApex; // Apex of the cone, initialized to ( 0., 0., 0. )
- vTEveVector_t fBasePoints; // List of contour points
- TEveVector fCylinderBorder; // Border of Barrel/Cylinder to cut the cone
- Float_t fThetaC; // Angle between axis and the edge of top-side of cylinder
-
-public:
- TEveJetCone(const Text_t* n="TEveJetCone", const Text_t* t="");
- virtual ~TEveJetCone() {}
-
- void SetApex(const TEveVector& a) { fApex = a; } // Sets apex of cone
- void SetCylinder( const Float_t& r, const Float_t& z ) {
- fCylinderBorder.Set( r, 0.f, z ); fThetaC = fCylinderBorder.Theta(); } // Set border cylinder
-
- Int_t AddCone( const Float_t& eta, const Float_t& phi, const Float_t& coneRadius, const Float_t& height = -1. );
-
- virtual Bool_t CanEditMainTransparency() const { return kTRUE; }
-
- // For TAttBBox:
- virtual void ComputeBBox();
- // If painting is needed:
- virtual void Paint(Option_t* option="");
-
- ClassDef(TEveJetCone, 0); // Short description.
-};
-
-#endif
+++ /dev/null
-// @(#)root/eve:$Id$
-// Author: Matevz Tadel 2007
-
-/*************************************************************************
- * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
- * All rights reserved. *
- * *
- * For the licensing terms see $ROOTSYS/LICENSE. *
- * For the list of contributors see $ROOTSYS/README/CREDITS. *
- *************************************************************************/
-
-#include "TEveJetConeEditor.h"
-#include "TEveJetCone.h"
-
-#include "TVirtualPad.h"
-#include "TColor.h"
-
-// Cleanup these includes:
-#include "TGLabel.h"
-#include "TGButton.h"
-#include "TGNumberEntry.h"
-#include "TGColorSelect.h"
-#include "TGDoubleSlider.h"
-
-
-//______________________________________________________________________________
-// GUI editor for TEveJetCone.
-//
-
-ClassImp(TEveJetConeEditor)
-
-//______________________________________________________________________________
-TEveJetConeEditor::TEveJetConeEditor(const TGWindow *p, Int_t width, Int_t height,
- UInt_t options, Pixel_t back) :
- TGedFrame(p, width, height, options | kVerticalFrame, back),
- fM(0)
- // Initialize widget pointers to 0
-{
- // Constructor.
-
- MakeTitle("TEveJetCone");
-
- // Create widgets
- // fXYZZ = new TGSomeWidget(this, ...);
- // AddFrame(fXYZZ, new TGLayoutHints(...));
- // fXYZZ->Connect("SignalName()", "Reve::TEveJetConeEditor", this, "DoXYZZ()");
-}
-
-/******************************************************************************/
-
-//______________________________________________________________________________
-void TEveJetConeEditor::SetModel(TObject* obj)
-{
- // Set model object.
-
- fM = dynamic_cast<TEveJetCone*>(obj);
-
- // Set values of widgets
- // fXYZZ->SetValue(fM->GetXYZZ());
-}
-
-/******************************************************************************/
-
-// Implements callback/slot methods
-
-//______________________________________________________________________________
-// void TEveJetConeEditor::DoXYZZ()
-// {
-// // Slot for XYZZ.
-//
-// fM->SetXYZZ(fXYZZ->GetValue());
-// Update();
-// }
+++ /dev/null
-// @(#)root/eve:$Id$
-// Author: Matevz Tadel 2007
-
-/*************************************************************************
- * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
- * All rights reserved. *
- * *
- * For the licensing terms see $ROOTSYS/LICENSE. *
- * For the list of contributors see $ROOTSYS/README/CREDITS. *
- *************************************************************************/
-
-#ifndef ROOT_TEveJetConeEditor
-#define ROOT_TEveJetConeEditor
-
-#include "TGedFrame.h"
-
-class TGButton;
-class TGCheckButton;
-class TGNumberEntry;
-class TGColorSelect;
-
-class TEveJetCone;
-
-class TEveJetConeEditor : public TGedFrame
-{
-private:
- TEveJetConeEditor(const TEveJetConeEditor&); // Not implemented
- TEveJetConeEditor& operator=(const TEveJetConeEditor&); // Not implemented
-
-protected:
- TEveJetCone *fM; // Model object.
-
- // Declare widgets
- // TGSomeWidget* fXYZZ;
-
-public:
- TEveJetConeEditor(const TGWindow* p=0, Int_t width=170, Int_t height=30,
- UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground());
- virtual ~TEveJetConeEditor() {}
-
- virtual void SetModel(TObject* obj);
-
- // Declare callback/slot methods
- // void DoXYZZ();
-
- ClassDef(TEveJetConeEditor, 0); // GUI editor for TEveJetCone.
-};
-
-#endif
+++ /dev/null
-// @(#)root/eve:$Id$
-// Author: Matevz Tadel 2007
-
-/*************************************************************************
- * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
- * All rights reserved. *
- * *
- * For the licensing terms see $ROOTSYS/LICENSE. *
- * For the list of contributors see $ROOTSYS/README/CREDITS. *
- *************************************************************************/
-
-#include "TEveJetConeGL.h"
-#include "TEveJetCone.h"
-
-#include "TMath.h"
-
-#include "TGLRnrCtx.h"
-#include "TGLIncludes.h"
-
-//______________________________________________________________________________
-// OpenGL renderer class for TEveJetCone.
-//
-
-ClassImp(TEveJetConeGL)
-
-//______________________________________________________________________________
-TEveJetConeGL::TEveJetConeGL() :
- TGLObject(), fM(0)
-{
- // Constructor.
-
- // fDLCache = kFALSE; // Disable display list.
-}
-
-/******************************************************************************/
-
-//______________________________________________________________________________
-Bool_t TEveJetConeGL::SetModel(TObject* obj, const Option_t* /*opt*/)
-{
- // Set model object.
-
- if (SetModelCheckClass(obj, TEveJetCone::Class())) {
- fM = dynamic_cast<TEveJetCone*>(obj);
- return kTRUE;
- }
- return kFALSE;
-}
-
-//______________________________________________________________________________
-void TEveJetConeGL::SetBBox()
-{
- // Set bounding box.
-
- // !! This ok if master sub-classed from TAttBBox
- SetAxisAlignedBBox(((TEveJetCone*)fExternalObj)->AssertBBox());
-}
-
-/******************************************************************************/
-
-//______________________________________________________________________________
-void TEveJetConeGL::DirectDraw(TGLRnrCtx& /*rnrCtx*/) const
-{
- // Render with OpenGL.
-
- // printf("TEveJetConeGL::DirectDraw LOD %d\n", rnrCtx.CombiLOD());
-
- glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT);
-
- glDisable(GL_CULL_FACE);
- glEnable(GL_NORMALIZE);
-
- glBegin(GL_TRIANGLE_FAN);
- glVertex3fv(fM->fApex);
- if ( fM->fBasePoints.size() > 2)
- {
- TEveJetCone::vTEveVector_ci prev = fM->fBasePoints.end(); --prev;
- TEveJetCone::vTEveVector_ci i = fM->fBasePoints.begin();
- TEveJetCone::vTEveVector_ci next = i; ++next;
-
- TEveVector norm_buf;
- TEveVector beg_normal = TMath::Cross((*i - fM->fApex).Arr(), (*next - *prev).Arr(), norm_buf.Arr());
-
- glNormal3fv(beg_normal);
- glVertex3fv(fM->fBasePoints.front());
-
- prev = i; i = next; ++next;
-
- while (i != fM->fBasePoints.begin())
- {
- glNormal3fv(TMath::Cross((*i - fM->fApex).Arr(), (*next - *prev).Arr(), norm_buf.Arr()));
- glVertex3fv(*i);
-
- prev = i;
- i = next;
- ++next; if (next == fM->fBasePoints.end()) next = fM->fBasePoints.begin();
- }
-
- glNormal3fv(beg_normal);
- glVertex3fv(fM->fBasePoints.front());
- }
- glEnd();
-
- glPopAttrib();
-}
+++ /dev/null
-// @(#)root/eve:$Id$
-// Author: Matevz Tadel 2007
-
-/*************************************************************************
- * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
- * All rights reserved. *
- * *
- * For the licensing terms see $ROOTSYS/LICENSE. *
- * For the list of contributors see $ROOTSYS/README/CREDITS. *
- *************************************************************************/
-
-#ifndef ROOT_TEveJetConeGL
-#define ROOT_TEveJetConeGL
-
-#include "TGLObject.h"
-
-class TGLViewer;
-class TGLScene;
-
-class TEveJetCone;
-
-class TEveJetConeGL : public TGLObject
-{
-private:
- TEveJetConeGL(const TEveJetConeGL&); // Not implemented
- TEveJetConeGL& operator=(const TEveJetConeGL&); // Not implemented
-
-protected:
- TEveJetCone *fM; // Model object.
-
-public:
- TEveJetConeGL();
- virtual ~TEveJetConeGL() {}
-
- virtual Bool_t SetModel(TObject* obj, const Option_t* opt=0);
- virtual void SetBBox();
-
- virtual void DirectDraw(TGLRnrCtx & rnrCtx) const;
-
- // To support two-level selection
- // virtual Bool_t SupportsSecondarySelect() const { return kTRUE; }
- // virtual void ProcessSelection(TGLRnrCtx & rnrCtx, TGLSelectRecord & rec);
-
- ClassDef(TEveJetConeGL, 0); // GL renderer class for TEveJetCone.
-};
-
-#endif
+++ /dev/null
-// Demonstrates usage of TEveJetCone class.
-// Author: Jochen Thaeder
-
-void cone_test() {
-
- using namespace TMath;
-
- TRandom r(0);
-
- // -- Set Constants
- Int_t nCones = 10;
- Int_t nTracks = 200;
-
- Float_t coneRadius = 0.4;
- Float_t length = 300.;
-
- // -- Define palette
- gStyle->SetPalette(1, 0);
- TEveRGBAPalette* pal = new TEveRGBAPalette(0, 500);
-
- // -----------------------------------------------------------------------------------
- // -- Line sets
- // -----------------------------------------------------------------------------------
-
- // -- Define cone center
- TEveStraightLineSet* axis = new TEveStraightLineSet("Cone Axis");
- axis->SetLineColor(kGreen);
- axis->SetLineWidth(2);
-
- TEveStraightLineSet* tracksXYZ = new TEveStraightLineSet("StraightLinesXYZ");
- tracksXYZ->SetLineColor(kRed);
- tracksXYZ->SetLineWidth(2);
-
- TEveStraightLineSet* tracksEtaPhi = new TEveStraightLineSet("StraightLinesEtaPhi");
- tracksEtaPhi->SetLineColor(kYellow);
- tracksEtaPhi->SetLineWidth(2);
-
- TEveStraightLineSet* tracksSeedEtaPhi = new TEveStraightLineSet("StraightLinesEtaPhiSeed");
- tracksSeedEtaPhi->SetLineColor(kBlue);
- tracksSeedEtaPhi->SetLineWidth(2);
-
- // -----------------------------------------------------------------------------------
- // -- Draw track distribution in XYZ ( in TPC Volume ) ( +/-250, +/-250, +/-250 )
- // -----------------------------------------------------------------------------------
-
- for ( Int_t track=0; track < nTracks ; track++ ) {
-
- Float_t trackX = r.Uniform(-250.0, 250.0);
- Float_t trackY = r.Uniform(-250.0, 250.0);
- Float_t trackZ = r.Uniform(-250.0, 250.0);
- Float_t trackR = (Float_t) Sqrt ( trackX*trackX + trackY*trackY + trackZ*trackZ );
-
- /*
- Float_t trackEta = 0.5 * (Float_t) Log( (Double_t)(( trackR+trackZ )/( trackR-trackZ )) );
- Float_t trackPhi = (Float_t) ATan2( (Double_t) trackY, (Double_t) trackX );
- if ( trackPhi < 0. ) trackPhi += (Float_t) TwoPi();
- */
-
- TEveVector trackDir(trackX/trackR, trackY/trackR ,trackZ/trackR);
- TEveVector trackEnd = trackDir * length;
- tracksXYZ->AddLine(0., 0., 0., trackEnd.fX, trackEnd.fY, trackEnd.fZ );
- }
-
- // -----------------------------------------------------------------------------------
- // -- Draw track distribution in eta phi ( in TPC Volume ) ( +/-0.9, {0, 2Pi} )
- // -----------------------------------------------------------------------------------
-
- for ( Int_t track=0; track < nTracks ; track++ ) {
-
- Float_t trackEta = r.Uniform(-0.9, 0.9);
- Float_t trackPhi = r.Uniform(0.0, TwoPi());
-
- TEveVector trackDir( GetTEveVector(trackEta, trackPhi) );
- TEveVector trackEnd = trackDir * length;
-
- if ( trackEta > coneRadius || trackEta < -coneRadius )
- tracksEtaPhi->AddLine(0., 0., 0., trackEnd.fX, trackEnd.fY, trackEnd.fZ );
- else
- tracksSeedEtaPhi->AddLine(0., 0., 0., trackEnd.fX, trackEnd.fY, trackEnd.fZ );
- }
-
- // -----------------------------------------------------------------------------------
- // -- Draw cones
- // -----------------------------------------------------------------------------------
-
- for ( Int_t iter = 0; iter < nCones; ++iter ) {
-
- // -- Get Random ( eta ,phi )
- Float_t coneEta = r.Uniform(-0.9, 0.9);
- Float_t conePhi = r.Uniform(0.0, TwoPi() );
-
- // -- Primary vertx as origin
- TEveVector coneOrigin(0.0,0.0,0.0);
-
- // -- Get Cone Axis - axis line 10% longer than cone height
- TEveVector coneAxis ( GetTEveVector( coneEta, conePhi) );
- coneAxis *= length * 1.1;
-
- axis->AddLine( 0., 0., 0., coneAxis.fX, coneAxis.fY, coneAxis.fZ );
-
- // -- Draw jet cone
- TEveJetCone* jetCone = new TEveJetCone("JetCone");
- jetCone->SetCylinder( 250., 250. );
- if ( (jetCone->AddCone( coneEta, conePhi, coneRadius ) ) != -1)
- gEve->AddElement( jetCone );
- }
-
- // -----------------------------------------------------------------------------------
-
- // -- Add cone axis
- gEve->AddElement(axis);
-
- // -- Add lines
- // gEve->AddElement(tracksXYZ);
- gEve->AddElement(tracksSeedEtaPhi);
- gEve->AddElement(tracksEtaPhi);
-
- // -- Load TPC geometry
- geomGentleTPC();
-
- gEve->Redraw3D(kTRUE);
-
- return;
-}
-
-// ################################################################################
-// ################################################################################
-
-// ################################################################################
-TEveVector GetTEveVector( Float_t& eta, Float_t& phi ) {
-
- TEveVector vec( (Float_t) Cos ( (Double_t) phi)/ CosH( (Double_t) eta ),
- (Float_t) Sin ( (Double_t) phi)/ CosH( (Double_t) eta ),
- (Float_t) TanH( (Double_t) eta ) );
- return vec;
-}
-
-// ################################################################################
-void geomGentleTPC() {
-
- TFile f("$ALICE_ROOT/EVE/alice-data/gentle_geo.root");
- TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) f.Get("Gentle");
- TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse, 0);
- gEve->AddGlobalElement(gsre);
- f.Close();
-
- TEveElement* elTRD = gsre->FindChild("TRD+TOF");
- elTRD->SetRnrState(kFALSE);
-
- TEveElement* elPHOS = gsre->FindChild("PHOS");
- elPHOS->SetRnrState(kFALSE);
-
- TEveElement* elHMPID = gsre->FindChild("HMPID");
- elHMPID->SetRnrState(kFALSE);
-}