57 float GetEtaSize()
const {
return m_etaSize; }
58 float GetPhiSize()
const {
return m_phiSize; }
59 void SetEtaSize(
float iEtaSize) { m_etaSize = iEtaSize; }
60 void SetPhiSize(
float iPhiSize) { m_phiSize = iPhiSize; }
64 TParticle(pdg, status, mother1, mother2, daughter1, daughter2, px, py, pz, etot, 0, 0, 0, 0)
85 for (
int i = 1; i <=
N; ++i)
87 double pt =
r.Uniform(0.5, 10);
88 double eta =
r.Uniform(-2.55, 2.55);
95 auto jet =
new XYJet(0, 0, 0, 0, 0, 0, px, py, pz,
std::sqrt(px*px + py*py + pz*pz + 80*80));
96 jet->SetEtaSize(
r.Uniform(0.02, 0.2));
97 jet->SetPhiSize(
r.Uniform(0.01, 0.3));
100 m_data.push_back(list);
103 void MakeParticles(
int N)
109 for (
int i = 1; i <=
N; ++i)
111 double pt =
r.Uniform(0.5, 10);
112 double eta =
r.Uniform(-2.55, 2.55);
121 auto particle =
new TParticle(0, 0, 0, 0, 0, 0,
122 px, py, pz,
std::sqrt(px*px + py*py + pz*pz + 80*80),
125 int pdg = 11 * (
r.Integer(2) > 0 ? 1 : -1);
126 particle->SetPdgCode(pdg);
130 m_data.push_back(list);
133 std::vector<TList*> m_data;
137 for (
auto &
l : m_data)
167 jet->AddEllipticCone(dj.Eta(), dj.Phi(), dj.GetEtaSize(), dj.GetPhiSize());
169 jet->SetLineColor(jet->GetMainColor());
171 float size = 50.f * dj.Pt();
172 double theta = dj.Theta();
174 double phi = dj.Phi();
177 if (viewType ==
"Projected" )
179 static const float_t offr = 6;
180 float r_ecal = context->
GetMaxR() + offr;
181 float z_ecal = context->
GetMaxZ() + offr;
183 float transAngle = abs(
atan(r_ecal/z_ecal));
186 if (theta < transAngle || 3.14-theta < transAngle)
188 z_ecal = context->
GetMaxZ() + offr/transAngle;
194 r = r_ecal/
sin(theta);
201 marker->SetScaleCenter(p1.fX, p1.fY, p1.fZ);
202 marker->AddLine(p1, p2);
203 marker->SetLineWidth(4);
205 marker->AddMarker(0, 0.9);
208 marker->SetName(
Form(
"line %s %d",
Collection()->GetCName(), idx));
245 Event *m_event{
nullptr};
247 std::vector<REveScene *> m_scenes;
251 std::vector<REveDataProxyBuilderBase *> m_builders;
254 bool m_inEventLoading {
false};
257 XYManager(Event* event) : m_event(event)
270 m_viewContext->SetBarrel(
r, z);
271 m_viewContext->SetTrackPropagator(prop);
276 tableInfo->table(
"TParticle").
277 column(
"pt", 1,
"i.Pt()").
278 column(
"eta", 3,
"i.Eta()").
279 column(
"phi", 3,
"i.Phi()");
281 tableInfo->table(
"XYJet").
282 column(
"eta", 1,
"i.Eta()").
283 column(
"phi", 1,
"i.Phi()").
284 column(
"etasize", 2,
"i.GetEtaSize()").
285 column(
"phisize", 2,
"i.GetPhiSize()");
287 m_viewContext->SetTableViewInfo(tableInfo);
289 createScenesAndViews();
292 void createScenesAndViews()
303 b1->SetShape(
new TGeoTube(m_viewContext->GetMaxR() , m_viewContext->GetMaxR() + dr, m_viewContext->GetMaxZ()));
304 b1->SetMainColor(
kCyan);
312 m_mngRhoZ->SetImportEmpty(
true);
318 m_mngRhoZ->ImportElements(b1,pgeoScene );
328 tableScene->AddElement(m_viewContext->GetTableViewInfo());
329 m_scenes.push_back(tableScene);
336 std::string cn =
c->GetName();
338 return new XYJetProxyBuilder();
342 return new TrackProxyBuilder();
348 for (
auto &
l : m_event->m_data) {
350 if (collection->
GetName() == std::string(
l->GetName()))
355 for (
int i = 0; i <=
l->GetLast(); ++i)
357 std::string cname = collection->
GetName();
358 auto len = cname.size();
359 char end = cname[len-1];
361 cname = cname.substr(0, len-1);
364 collection->
AddItem(
l->At(i), pname.Data(),
"");
373 m_inEventLoading =
true;
375 for (
auto &el: m_collections->RefChildren())
381 for (
auto proxy : m_builders)
386 m_inEventLoading =
false;
391 m_collections->AddElement(collection);
394 LoadCurrentEvent(collection);
397 auto glBuilder = makeGLBuilderForType(collection->
GetItemClass());
398 glBuilder->SetCollection(collection);
399 glBuilder->SetHaveAWindow(
true);
400 for (
auto scene : m_scenes)
402 REveElement *product = glBuilder->CreateProduct(scene->GetTitle(), m_viewContext);
404 if (strncmp(scene->GetCTitle(),
"Table", 5) == 0)
continue;
406 if (!strncmp(scene->GetCTitle(),
"Projected", 8))
408 m_mngRhoZ->ImportElements(product, scene);
415 m_builders.push_back(glBuilder);
420 tableBuilder->SetHaveAWindow(
true);
421 tableBuilder->SetCollection(collection);
422 REveElement* tablep = tableBuilder->CreateProduct(
"table-type", m_viewContext);
423 auto tableMng = m_viewContext->GetTableViewInfo();
426 tableMng->SetDisplayedCollection(collection->
GetElementId());
428 tableMng->AddDelegate([=]() { tableBuilder->ConfigChanged(); });
431 if (strncmp(scene->GetCTitle(),
"Table", 5) == 0)
434 tableBuilder->Build(collection, tablep, m_viewContext );
437 m_builders.push_back(tableBuilder);
441 this->CollectionChanged( collection );
446 this->ModelChanged( collection, ids );
450 void finishViewCreate()
452 auto mngTable = m_viewContext->GetTableViewInfo();
455 for (
auto &el : m_collections->RefChildren())
457 if (el->
GetName() ==
"XYTracks")
465 printf(
"collection changes not implemented %s!\n", collection->
GetCName());
470 if (m_inEventLoading)
return;
472 for (
auto proxy : m_builders)
474 if (proxy->Collection() == collection)
477 proxy->ModelChanges(ids);
495 EventManager(Event*
e, XYManager*
m): m_event(
e), m_xymng(
m) {}
497 virtual ~EventManager() {}
499 virtual void NextEvent()
502 m_xymng->NextEvent();
505 virtual void QuitRoot()
507 printf(
"Quit ROOT\n");
519 eveMng = REveManager::Create();
521 auto event =
new Event();
527 auto xyManager =
new XYManager(event);
534 trackCollection->
SetFilterExpr(
"i.Pt() > 4.1 && std::abs(i.Eta()) < 1");
535 xyManager->addCollection(trackCollection,
true);
543 xyManager->addCollection(jetCollection,
false);
546 auto eventMng =
new EventManager(event, xyManager);
547 eventMng->SetName(
"EventManager");
#define ClassDef(name, id)
R__EXTERN TApplication * gApplication
R__EXTERN TRandom * gRandom
char * Form(const char *fmt,...)
void SetFilterExpr(const TString &filter)
TClass * GetItemClass() const
void SetHandlerFuncIds(std::function< void(REveDataCollection *, const Ids_t &)> handler_func)
void AddItem(void *data_ptr, const std::string &n, const std::string &t)
void SetItemClass(TClass *cls)
void SetMainColor(Color_t) override
Set main color of the element.
void SetHandlerFunc(std::function< void(REveDataCollection *)> handler_func)
virtual void LocalModelChanges(int idx, REveElement *el, const REveViewContext *ctx)
void SetupAddElement(REveElement *el, REveElement *parent, bool set_color=true) const
virtual bool HaveSingleProduct() const
const REveDataCollection * Collection() const
void BuildViewType(const void *iData, int index, REveElement *itemHolder, std::string viewType, const REveViewContext *context) override
const std::string & GetName() const
const char * GetCName() const
virtual void AddElement(REveElement *el)
Add el to the list of children.
virtual void DestroyElements()
Destroy all children of this element.
REveElement * FirstChild() const
Returns the first child element or 0 if the list is empty.
ElementId_t GetElementId() const
virtual Color_t GetMainColor() const
REveMagFieldDuo Interface to magnetic field with two different values depending on radius.
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.
REveScene * GetWorld() const
void Show(const RWebDisplayArgs &args="")
Show eve manager in specified browser.
REveProjectionManager Manager class for steering of projections and managing projected objects.
void AddCommand(const std::string &name, const std::string &icon, const REveElement *element, const std::string &action)
virtual void SetLineColor(Color_t c)
REveTrackPropagator Calculates path of a particle taking into account special path-marks and imposed ...
REveTrack Track with given vertex, momentum and optional referece-points (path-marks) along its path.
REveTrackPropagator * GetPropagator() const
virtual void AddScene(REveScene *scene)
Add 'scene' to the list of scenes.
virtual void Terminate(Int_t status=0)
Terminate the application by call TSystem::Exit() unless application has been told to return from Run...
TClass instances represent classes, structs and namespaces in the ROOT type system.
void SetName(const char *name)
virtual void Add(TObject *obj)
Description of the dynamic properties of a particle.
TParticle()
reference to the particle record in PDG database
This is the base class for the ROOT Random number generators.
void collection_proxies(bool proj=true)
REX::REveManager * eveMng
REX::REveViewer * rhoZView
REX::REveScene * rhoZEventScene
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
constexpr Double_t TwoPi()