49 -5.191, -4.889, -4.716, -4.538, -4.363, -4.191, -4.013, -3.839, -3.664, -3.489, -3.314, -3.139, -2.964, -2.853,
50 -2.650, -2.500, -2.322, -2.172, -2.043, -1.930, -1.830, -1.740, -1.653, -1.566, -1.479, -1.392, -1.305, -1.218,
51 -1.131, -1.044, -0.957, -0.870, -0.783, -0.696, -0.609, -0.522, -0.435, -0.348, -0.261, -0.174, -0.087, 0.000,
52 0.087, 0.174, 0.261, 0.348, 0.435, 0.522, 0.609, 0.696, 0.783, 0.870, 0.957, 1.044, 1.131, 1.218,
53 1.305, 1.392, 1.479, 1.566, 1.653, 1.740, 1.830, 1.930, 2.043, 2.172, 2.322, 2.500, 2.650, 2.853,
54 2.964, 3.139, 3.314, 3.489, 3.664, 3.839, 4.013, 4.191, 4.363, 4.538, 4.716, 4.889, 5.191};
74 float GetEtaSize()
const {
return fEtaSize; }
75 float GetPhiSize()
const {
return fPhiSize; }
76 void SetEtaSize(
float iEtaSize) { fEtaSize = iEtaSize; }
77 void SetPhiSize(
float iPhiSize) { fPhiSize = iPhiSize; }
81 TParticle(pdg, status, mother1, mother2, daughter1, daughter2, px, py, pz, etot, 0, 0, 0, 0)
95 RecHit(
float pt,
float x,
float y,
float z): fPt(
pt), fX(
x), fY(
y), fZ(z) {}
99class RCaloTower :
public TObject
106 RCaloTower(
float eta,
float phi,
float et): fEta(eta), fPhi(phi), fEt(et) {}
122 std::set<int> item_set;
124 for (
auto &cellId : sel_cells)
126 fCaloData->GetCellData(cellId, cd);
129 for (
int t = 0; t < fCollection->GetNItems(); ++t)
131 RCaloTower* tower = (RCaloTower*) fCollection->GetDataPtr(t);
138 sel->
NewElementPicked(fCollection->GetItemList()->GetElementId(), multi,
true, item_set);
147 for(
auto &i : idcs ) {
148 RCaloTower* tower = (RCaloTower*)fCollection->GetDataPtr(i);
149 int bin = hist->
FindBin(tower->fEta, tower->fPhi);
152 for (
size_t ci = 0; ci < out.size(); ++ci)
154 if (out[ci].fTower == bin && out[ci].fSlice ==
GetSliceIndex())
156 float oldv = out[ci].fFraction;
157 out[ci].fFraction = oldv + frac;
175 std::vector<TList*> fListData;
183 fCaloData->AddHistogram(baseHist);
186 fCaloData->SetSelector(selector);
197 for (
int i = 1; i <=
N; ++i)
199 double pt =
r.Uniform(0.5, 10);
200 double eta =
r.Uniform(-2.55, 2.55);
203 double px =
pt * std::cos(phi);
204 double py =
pt * std::sin(phi);
205 double pz =
pt * (1. / (std::tan(2*std::atan(std::exp(-eta)))));
207 auto jet =
new Jet(0, 0, 0, 0, 0, 0, px, py, pz, std::sqrt(px*px + py*py + pz*pz + 80*80));
208 jet->SetEtaSize(
r.Uniform(0.02, 0.2));
209 jet->SetPhiSize(
r.Uniform(0.01, 0.3));
212 fListData.push_back(list);
215 void MakeParticles(
int N)
221 for (
int i = 1; i <=
N; ++i)
223 double pt =
r.Uniform(0.5, 10);
224 double eta =
r.Uniform(-2.55, 2.55);
227 double px =
pt * std::cos(phi);
228 double py =
pt * std::sin(phi);
229 double pz =
pt * (1. / (std::tan(2*std::atan(std::exp(-eta)))));
232 auto particle =
new TParticle(0, 0, 0, 0, 0, 0,
233 px, py, pz, std::sqrt(px*px + py*py + pz*pz + 80*80),
236 int pdg = 11 * (
r.Integer(2) > 0 ? 1 : -1);
237 particle->SetPdgCode(pdg);
241 fListData.push_back(list);
244 void MakeRecHits(
int N)
251 for (
int i = 1; i <=
N; ++i)
253 float pt =
r.Uniform(0.5, 10);
254 float x =
r.Uniform(-200, 200);
255 float y =
r.Uniform(-200, 200);
256 float z =
r.Uniform(-500, 500);
257 auto rechit =
new RecHit(
pt,
x,
y, z);
260 fListData.push_back(list);
265 for (
auto &
l : fListData)
278 TList* jlist = fListData[0];
281 fListData.push_back(elist);
284 fListData.push_back(hlist);
285 for (
int i = 0; i <= jlist->
GetLast(); ++i) {
286 const Jet* j = (Jet*)jlist->
At(i);
287 float offX = j->Eta();
289 for (
int k=0; k<20; ++k) {
300 fCaloData->DataChanged();
321 jet->AddEllipticCone(dj.Eta(), dj.Phi(), dj.GetEtaSize(), dj.GetPhiSize());
323 jet->SetLineColor(jet->GetMainColor());
325 float size = 50.f * dj.Pt();
326 double theta = dj.Theta();
328 double phi = dj.Phi();
331 if (viewType ==
"Projected" )
333 static const float_t offr = 6;
334 float r_ecal = context->
GetMaxR() + offr;
335 float z_ecal = context->
GetMaxZ() + offr;
337 float transAngle = abs(
atan(r_ecal/z_ecal));
340 if (theta < transAngle || 3.14-theta < transAngle)
342 z_ecal = context->
GetMaxZ() + offr/transAngle;
348 r = r_ecal/
sin(theta);
355 marker->SetScaleCenter(p1.
fX, p1.
fY, p1.
fZ);
356 marker->AddLine(p1, p2);
357 marker->SetLineWidth(4);
359 marker->AddMarker(0, 0.9);
362 marker->SetName(
Form(
"line %s %d",
Collection()->GetCName(), idx));
397 boxset->
Reset(REveBoxSet::kBT_FreeBox,
true, collection->GetNItems());
399#define RND_BOX(x) (Float_t)r.Uniform(-(x), (x))
400 for (
int h = 0;
h < collection->GetNItems(); ++
h)
402 RecHit* hit = (RecHit*)collection->GetDataPtr(
h);
447 impSet.insert(p->m_elements->FirstChild());
455 buildBoxSet((
REveBoxSet*)product->m_elements->FirstChild());
464 TH2F* fHist {
nullptr};
465 int fSliceIndex {-1};
474 fSliceIndex = fCaloData->AddHistogram(fHist);
476 fCaloData->RefSliceInfo(fSliceIndex)
482 fCaloData->GetSelector()->AddSliceSelector(std::unique_ptr<REveCaloDataSliceSelector>
483 (
new REveCaloTowerSliceSelector(fSliceIndex,
Collection(), fCaloData)));
497 fCaloData->RefSliceInfo(fSliceIndex)
506 RCaloTower* tower = (RCaloTower*)collection->
GetDataPtr(
h);
511 fHist->Fill(tower->fEta, tower->fPhi, tower->fEt);
514 fCaloData->DataChanged();
520 fCaloData->GetSelector()->SetActiveSlice(fSliceIndex);
521 impSet.insert(fCaloData);
522 fCaloData->FillImpliedSelectedSet(impSet);
537class CollectionManager
540 Event *fEvent{
nullptr};
542 std::vector<REveScene *> m_scenes;
545 std::vector<REveDataProxyBuilderBase *> m_builders;
548 bool m_inEventLoading {
false};
551 CollectionManager(Event* event) : fEvent(event)
564 m_viewContext->SetBarrel(
r, z);
565 m_viewContext->SetTrackPropagator(prop);
570 tableInfo->table(
"TParticle").
571 column(
"pt", 1,
"i.Pt()").
572 column(
"eta", 3,
"i.Eta()").
573 column(
"phi", 3,
"i.Phi()");
575 tableInfo->table(
"Jet").
576 column(
"eta", 1,
"i.Eta()").
577 column(
"phi", 1,
"i.Phi()").
578 column(
"etasize", 2,
"i.GetEtaSize()").
579 column(
"phisize", 2,
"i.GetPhiSize()");
581 tableInfo->table(
"RecHit").
582 column(
"pt", 1,
"i.fPt");
584 tableInfo->table(
"RCaloTower").
585 column(
"eta", 3,
"i.fEta").
586 column(
"phi", 3,
"i.fPhi").
587 column(
"Et", 3,
"i.fEt");
589 m_viewContext->SetTableViewInfo(tableInfo);
591 for (
auto &
c :
eveMng->GetScenes()->RefChildren()) {
596 if (!strncmp(
c->GetCName(),
"Table", 5))
597 c->AddElement(m_viewContext->GetTableViewInfo());
606 for (
auto &
l : fEvent->fListData) {
608 if (collection->
GetName() == std::string(
l->GetName()))
612 for (
int i = 0; i <=
l->GetLast(); ++i)
614 std::string cname = collection->
GetName();
615 auto len = cname.size();
616 char end = cname[len-1];
618 cname = cname.substr(0, len-1);
621 collection->
AddItem(
l->At(i), pname.Data(),
"");
630 m_inEventLoading =
true;
632 for (
auto &el: m_collections->RefChildren())
635 SetDataItemsFromEvent(
c);
638 for (
auto proxy : m_builders)
643 fEvent->fCaloData->DataChanged();
644 m_inEventLoading =
false;
649 m_collections->AddElement(collection);
652 SetDataItemsFromEvent(collection);
655 for (
auto scene : m_scenes)
659 if (strncmp(scene->GetCName(),
"Tables", 5) == 0)
continue;
661 if (!strncmp(scene->GetCTitle(),
"Projected", 8))
670 m_builders.push_back(glBuilder);
675 tableBuilder->SetHaveAWindow(
true);
676 tableBuilder->SetCollection(collection);
677 REveElement* tablep = tableBuilder->CreateProduct(
"table-type", m_viewContext);
678 auto tableMng = m_viewContext->GetTableViewInfo();
681 tableMng->SetDisplayedCollection(collection->
GetElementId());
684 for (
auto s : m_scenes)
686 if (strncmp(s->GetCTitle(),
"Table", 5) == 0)
689 tableBuilder->Build(collection, tablep, m_viewContext );
692 tableMng->AddDelegate([=]() { tableBuilder->ConfigChanged(); });
693 m_builders.push_back(tableBuilder);
699 for (
int t = 0; t <
N; t++) {
700 auto te = tableEntries[t];
706 this->ModelChanged( collection, ids );
710 this->FillImpliedSelected( collection, impSelSet);
714 void finishViewCreate()
716 auto mngTable = m_viewContext->GetTableViewInfo();
719 for (
auto &el : m_collections->RefChildren())
730 if (m_inEventLoading)
return;
732 for (
auto proxy : m_builders)
734 if (proxy->Collection()->GetItemList() == itemList)
737 proxy->ModelChanges(ids);
744 if (m_inEventLoading)
return;
746 for (
auto proxy : m_builders)
748 if (proxy->Collection()->GetItemList() == itemList)
750 proxy->FillImpliedSelected(impSelSet);
766 CollectionManager* fCMng;
769 EventManager(Event*
e, CollectionManager*
m): fEvent(
e), fCMng(
m) {}
771 virtual ~EventManager() {}
773 virtual void NextEvent()
791 eveMng = REveManager::Create();
792 auto event =
new Event();
800 b1->SetMainColor(
kCyan);
818 auto collectionMng =
new CollectionManager(event);
823 trackCollection->
SetFilterExpr(
"i.Pt() > 4.1 && std::abs(i.Eta()) < 1");
824 collectionMng->addCollection(trackCollection,
new TParticleProxyBuilder(),
true);
829 collectionMng->addCollection(jetCollection,
new JetProxyBuilder());
835 collectionMng->addCollection(hitCollection,
new RecHitProxyBuilder());
838 auto calo3d =
new REveCalo3D(event->fCaloData);
839 calo3d->SetBarrelRadius(
kR_max);
840 calo3d->SetEndCapPos(
kZ_d);
841 calo3d->SetMaxTowerH(300);
848 collectionMng->addCollection(ecalCollection,
new CaloTowerProxyBuilder(event->fCaloData));
853 collectionMng->addCollection(hcalCollection,
new CaloTowerProxyBuilder(event->fCaloData));
856 auto eventMng =
new EventManager(event, collectionMng);
857 eventMng->SetName(
"EventManager");
#define ClassDef(name, id)
static unsigned int total
R__EXTERN TRandom * gRandom
char * Form(const char *fmt,...)
void AddBox(const Float_t *verts)
Create a new box from a set of 8 vertices.
void Reset(EBoxType_e boxType, Bool_t valIsCol, Int_t chunkSize)
virtual void ProcessSelection(REveCaloData::vCellId_t &sel_cells, UInt_t selectionId, bool multi)=0
virtual void GetCellsFromSecondaryIndices(const std::set< int > &idcs, REveCaloData::vCellId_t &out)=0
std::vector< CellId_t > vCellId_t
void Refit()
Refit the container so that all current data fits into a single chunk.
REveDataItemList * GetItemList()
void SetFilterExpr(const TString &filter)
TClass * GetItemClass() const
void * GetDataPtr(Int_t i) const
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.
const REveDataItem * GetDataItem(Int_t i) const
void AddTooltipExpression(const std::string &title, const std::string &expr)
void SetItemsChangeDelegate(ItemsChangeFunc_t)
void SetFillImpliedSelectedDelegate(FillImpliedSelectedFunc_t)
Bool_t GetVisible() const
void SetHaveAWindow(bool)
virtual void SetCollection(REveDataCollection *)
void FillImpliedSelected(REveElement::Set_t &impSet)
virtual void LocalModelChanges(int idx, REveElement *el, const REveViewContext *ctx)
REveElement * CreateProduct(const std::string &viewType, const REveViewContext *)
void ModelChanges(const REveDataCollection::Ids_t &)
REveDataCollection * Collection() const
virtual bool HaveSingleProduct() const
void SetupAddElement(REveElement *el, REveElement *parent, bool set_color=true)
void BuildViewType(const void *iData, int index, REveElement *itemHolder, const std::string &viewType, const REveViewContext *context) override
virtual void SetMainColor(Color_t color) override
Override from REveElement, forward to Frame.
void DigitId(Int_t n)
Set external id for the last added digit.
void DigitColor(Color_t ci)
Set color for the last digit added.
REveChunkManager * GetPlex()
void SetDetIdsAsSecondaryIndices(Bool_t o)
const std::string & GetName() const
const char * GetCName() const
virtual void AddElement(REveElement *el)
Add el to the list of children.
virtual Bool_t GetRnrSelf() const
REveElement * FirstChild() const
Returns the first child element or 0 if the list is empty.
void SetSelectionMaster(REveElement *el)
std::set< REveElement * > Set_t
ElementId_t GetElementId() const
virtual Color_t GetMainColor() const
void SetName(const std::string &name)
Set name of an element.
REveMagFieldDuo Interface to magnetic field with two different values depending on radius.
REveScene * GetEventScene() const
REveSelection * GetHighlight() const
REveSelection * GetSelection() const
REveElement * FindElementById(ElementId_t id) const
Lookup ElementId in element map and return corresponding REveElement*.
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.
virtual REveElement * ImportElements(REveElement *el, REveElement *ext_list=nullptr)
Recursively import elements and apply projection to the newly imported objects.
void SetImportEmpty(Bool_t ie)
void AddCommand(const std::string &name, const std::string &icon, const REveElement *element, const std::string &action)
void SetAlwaysSecSelect(Bool_t f)
REveSelection Container for selected and highlighted elements.
void NewElementPicked(ElementId_t id, bool multi, bool secondary, const std::set< int > &secondary_idcs={})
void ClearSelection()
Clear selection if not empty.
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.
void SetName(const char *name)
static void AddDirectory(Bool_t add=kTRUE)
Sets the flag controlling the automatic add of histograms in memory.
virtual Int_t FindBin(Double_t x, Double_t y=0, Double_t z=0)
Return Global bin number corresponding to x,y,z.
static Bool_t AddDirectoryStatus()
Static function: cannot be inlined on Windows/NT.
2-D histogram with a float per channel (see TH1 documentation)}
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual void Add(TObject *obj)
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
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.
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
virtual Int_t GetLast() const
Returns index of last object in collection.
ROOT::Experimental::REveProjectionManager * g_projMng
ROOT::Experimental::REveManager * eveMng
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)
Short_t Min(Short_t a, Short_t b)
constexpr Double_t TwoPi()
const double xbins[xbins_n]