Logo ROOT  
Reference Guide
calorimeters.C
Go to the documentation of this file.
2#include <ROOT/REveScene.hxx>
3#include <ROOT/REveViewer.hxx>
6#include <ROOT/REveCalo.hxx>
9
10#include "TFile.h"
11#include "TGeoTube.h"
12
13const char* histFile =
14 "http://amraktad.web.cern.ch/amraktad/cms_calo_hist.root";
15
16
17const Double_t kR_min = 128;
18const Double_t kR_max = 129;
19const Double_t kZ_d = 268.39;
20
21using namespace ROOT::Experimental;
22
23
24void makeCalo2D(REveCalo3D* calo3d, const char* pname, REveProjection::EPType_e t)
25{
27
28 auto geomScene = eveMng->SpawnNewScene(Form("%s Geometry", pname), pname);
29 auto eventScene = eveMng->SpawnNewScene(Form("%s Event Data", pname), pname);
30
31 auto mng = new REveProjectionManager();
32 mng->SetProjection(t);
33
34 // project Calo3D
35 REveCalo2D* calo2d = (REveCalo2D*) mng->ImportElements(calo3d, eventScene);
36
37 // project reference geometry
38 REveElement* geo2d = mng->ImportElements(eveMng->GetGlobalScene()->FirstChild(), geomScene);
39
40 auto view = eveMng->SpawnNewViewer("RPhi View", "");
41 view->SetCameraType(REveViewer::kCameraOrthoXOY);
42 view->AddScene(geomScene);
43 view->AddScene(eventScene);
44}
45
46void add_jet(REveElement* parent, const char* name,
47 Float_t eta, Float_t phi,
48 Float_t deta, Float_t dphi)
49{
50 auto jet = new REveJetCone(name, name);
51 jet->SetMainTransparency(60);
52 jet->SetLineColor(kRed);
53 jet->SetCylinder(129 - 10, 268.36 - 10);
54 jet->AddEllipticCone(eta, phi, deta, dphi);
55 jet->SetPickable(kTRUE);
56 jet->SetHighlightFrame(kFALSE);
57 parent->AddElement(jet);
58}
59
61{
62 auto eveMng = REveManager::Create();
63
65 auto hf = TFile::Open(histFile, "CACHEREAD");
66 auto ecalHist = (TH2F*)hf->Get("ecalLego");
67 auto hcalHist = (TH2F*)hf->Get("hcalLego");
68 auto data = new REveCaloDataHist();
69 data->AddHistogram(ecalHist);
70 data->RefSliceInfo(0).Setup("ECAL", 0.f, kBlue);
71 data->AddHistogram(hcalHist);
72 data->RefSliceInfo(1).Setup("HCAL", 0.1, kRed);
74
75 auto b1 = new REveGeoShape("Barrel 1");
76 b1->SetShape(new TGeoTube(kR_min, kR_max, kZ_d));
77 b1->SetMainColor(kCyan);
79
80 auto calo3d = new REveCalo3D(data);
81 calo3d->SetBarrelRadius(kR_max);
82 calo3d->SetEndCapPos(kZ_d);
83 calo3d->SetMaxTowerH(300);
85
86 add_jet(calo3d, "JetCone Lojz", 1.4, 1.0, 0.4, 0.2);
87 add_jet(calo3d, "JetCone Mici", -2.0, -2.1, 0.2, 0.4);
88
89 makeCalo2D(calo3d, "RPhi", REveProjection::kPT_RPhi);
90 makeCalo2D(calo3d, "RhoZ", REveProjection::kPT_RhoZ);
91
92 eveMng->Show();
93}
94
95
const Bool_t kFALSE
Definition: RtypesCore.h:101
double Double_t
Definition: RtypesCore.h:59
float Float_t
Definition: RtypesCore.h:57
const Bool_t kTRUE
Definition: RtypesCore.h:100
@ kRed
Definition: Rtypes.h:66
@ kCyan
Definition: Rtypes.h:66
@ kBlue
Definition: Rtypes.h:66
char name[80]
Definition: TGX11.cxx:110
char * Form(const char *fmt,...)
virtual void AddElement(REveElement *el)
Add el to the list of children.
REveElement * FirstChild() const
Returns the first child element or 0 if the list is empty.
REveScene * GetEventScene() const
REveScene * GetGlobalScene() const
REveScene * SpawnNewScene(const char *name, const char *title="")
Create a new scene.
REveViewer * SpawnNewViewer(const char *name, const char *title="")
Create a new GL viewer.
void Show(const RWebDisplayArgs &args="")
Show eve manager in specified browser.
REveProjectionManager Manager class for steering of projections and managing projected objects.
void SetCameraType(ECameraType t)
Definition: REveViewer.hxx:47
static Bool_t SetCacheFileDir(ROOT::Internal::TStringView cacheDir, Bool_t operateDisconnected=kTRUE, Bool_t forceCacheread=kFALSE)
Definition: TFile.h:324
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
Definition: TFile.cxx:4011
Cylindrical tube class.
Definition: TGeoTube.h:18
2-D histogram with a float per channel (see TH1 documentation)}
Definition: TH2.h:251
ROOT::Experimental::REveManager * eveMng
const char * histFile
Definition: calorimeters.C:13
void add_jet(REveElement *parent, const char *name, Float_t eta, Float_t phi, Float_t deta, Float_t dphi)
Definition: calorimeters.C:46
const Double_t kR_max
Definition: calorimeters.C:18
void makeCalo2D(REveCalo3D *calo3d, const char *pname, REveProjection::EPType_e t)
Definition: calorimeters.C:24
const Double_t kZ_d
Definition: calorimeters.C:19
void calorimeters()
Definition: calorimeters.C:60
const Double_t kR_min
Definition: calorimeters.C:17
R__EXTERN REveManager * gEve