Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 = "http://root.cern/files/cms_calo_hist.root";
14
15const Double_t kR_min = 128;
16const Double_t kR_max = 129;
17const Double_t kZ_d = 268.39;
18
19using namespace ROOT::Experimental;
20
21void makeCalo2D(REveCalo3D *calo3d, const char *pname, REveProjection::EPType_e t)
22{
24
25 auto geomScene = eveMng->SpawnNewScene(Form("%s Geometry", pname), pname);
26 auto eventScene = eveMng->SpawnNewScene(Form("%s Event Data", pname), pname);
27
28 auto mng = new REveProjectionManager();
29 mng->SetProjection(t);
30
31 // project Calo3D
32 REveCalo2D *calo2d = (REveCalo2D *)mng->ImportElements(calo3d, eventScene);
33
34 // project reference geometry
35 REveElement *geo2d = mng->ImportElements(eveMng->GetGlobalScene()->FirstChild(), geomScene);
36
37 auto view = eveMng->SpawnNewViewer("RPhi View", "");
38 view->SetCameraType(REveViewer::kCameraOrthoXOY);
39 view->AddScene(geomScene);
40 view->AddScene(eventScene);
41}
42
43void add_jet(REveElement *parent, const char *name, Float_t eta, Float_t phi, Float_t deta, Float_t dphi)
44{
45 auto jet = new REveJetCone(name, name);
46 jet->SetMainTransparency(60);
47 jet->SetLineColor(kRed);
48 jet->SetCylinder(kR_min - 10, kZ_d - 10);
49 jet->AddEllipticCone(eta, phi, deta, dphi);
50 jet->SetPickable(kTRUE);
51 jet->SetHighlightFrame(kFALSE);
52 parent->AddElement(jet);
53}
54
56{
57 auto eveMng = REveManager::Create();
58
60 auto hf = TFile::Open(histFile, "CACHEREAD");
61 auto ecalHist = (TH2F *)hf->Get("ecalLego");
62 auto hcalHist = (TH2F *)hf->Get("hcalLego");
63 auto data = new REveCaloDataHist();
64 data->AddHistogram(ecalHist);
65 data->RefSliceInfo(0).Setup("ECAL", 0.f, kBlue);
66 data->AddHistogram(hcalHist);
67 data->RefSliceInfo(1).Setup("HCAL", 0.1, kRed);
69
70 auto b1 = new REveGeoShape("Barrel 1");
71 b1->SetShape(new TGeoTube(kR_min, kR_max, kZ_d));
72 b1->SetMainColor(kCyan);
73 b1->SetMainTransparency(90);
74 b1->SetNSegments(80);
76
77 auto calo3d = new REveCalo3D(data);
78 calo3d->SetBarrelRadius(kR_max + 1);
79 calo3d->SetEndCapPos(kZ_d + 1);
80 calo3d->SetMaxTowerH(300);
82
83 add_jet(calo3d, "JetCone Lojz", 1.4, 1.0, 0.4, 0.2);
84 add_jet(calo3d, "JetCone Mici", -2.0, -2.1, 0.2, 0.4);
85
86 makeCalo2D(calo3d, "RPhi", REveProjection::kPT_RPhi);
87 makeCalo2D(calo3d, "RhoZ", REveProjection::kPT_RhoZ);
88
89 eveMng->Show();
90}
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
@ kRed
Definition Rtypes.h:66
@ kCyan
Definition Rtypes.h:66
@ kBlue
Definition Rtypes.h:66
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
char name[80]
Definition TGX11.cxx:110
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2489
const char * histFile
void add_jet(REveElement *parent, const char *name, Float_t eta, Float_t phi, Float_t deta, Float_t dphi)
const Double_t kR_max
void makeCalo2D(REveCalo3D *calo3d, const char *pname, REveProjection::EPType_e t)
const Double_t kZ_d
void calorimeters()
const Double_t kR_min
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)
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:4086
static Bool_t SetCacheFileDir(std::string_view cacheDir, Bool_t operateDisconnected=kTRUE, Bool_t forceCacheread=kFALSE)
Sets the directory where to locally stage/cache remote files.
Definition TFile.cxx:4623
2-D histogram with a float per channel (see TH1 documentation)
Definition TH2.h:308
ROOT::Experimental::REveManager * eveMng
R__EXTERN REveManager * gEve