Functions
TEventChangeManager.cxx File Reference
#include "TEventChangeManager.hxx"
#include "TVEventChangeHandler.hxx"
#include "TGUIManager.hxx"
#include "TEventDisplay.hxx"
#include "TEventManager.hxx"
#include "TRecurseGeoManager.hxx"
#include "TG4Event.h"
#include <TQObject.h>
#include <TGButton.h>
#include <TGeoManager.h>
#include <TGeoNode.h>
#include <TGeoVolume.h>
#include <TEveGeoShape.h>
#include <TEveGeoNode.h>
#include <TEveManager.h>
#include <iostream>

Go to the source code of this file.

Functions

 ClassImp (EDep::TEventChangeManager) namespace
 

Function Documentation

ClassImp ( EDep::TEventChangeManager  )

This takes a geometry id and "clones" it into the Eve display.

Definition at line 21 of file TEventChangeManager.cxx.

23  {
24 
25  /// This takes a geometry id and "clones" it into the Eve display.
26  TEveGeoShape* GeometryClone(TGeoVolume* currVolume) {
27 
28  TGeoShape* currShape = currVolume->GetShape();
29  TEveGeoShape *fakeShape = new TEveGeoShape(currShape->GetName());
30 
31  TGeoMatrix* currMat = gGeoManager->GetCurrentMatrix();
32  TGeoMatrix* mat = currMat->MakeClone();
33  fakeShape->SetTransMatrix(*mat);
34 
35  // Clone the shape so that it can be displayed. This has to play some
36  // fancy footsie to get the gGeoManager memory management right. It
37  // first saves the current manager, then gets an internal geometry
38  // manager used by TEveGeoShape, and then resets the old manager once
39  // the shape is created.
40  TGeoManager* saveGeom = gGeoManager;
41  gGeoManager = fakeShape->GetGeoMangeur();
42  TGeoShape* clonedShape
43  = dynamic_cast<TGeoShape*> (currShape->Clone("fakeShape"));
44  fakeShape->SetShape(clonedShape);
45  gGeoManager = saveGeom;
46 
47  return fakeShape;
48  }
49 
50  struct PickVolumes: TRecurseGeoManager {
51  std::vector<std::string> fVolumesToShow;
52  TEveElementList* fEveList;
53  PickVolumes(TEveElementList* eveList) : fEveList(eveList) {}
54  bool Action(int) {
55  if (!fEveList) return true;
56  TGeoNode* node = gGeoManager->GetCurrentNode();
57  std::string name(node->GetName());
58  for (std::vector<std::string>::iterator v = fVolumesToShow.begin();
59  v != fVolumesToShow.end(); ++v) {
60  if (name.find(*v) == std::string::npos) continue;
61  std::cout << "Show volume " << node->GetName() << std::endl;
62  TEveGeoShape *shape = GeometryClone(node->GetVolume());
63  shape->SetMainColor(node->GetVolume()->GetLineColor());
64  shape->SetMainTransparency(90);
65  fEveList->AddElement(shape);
66  break;
67  }
68  return true;
69  }
70  };
71 }
static QCString name
Definition: declinfo.cpp:673
intermediate_table::iterator iterator
std::string string
Definition: nybbler.cc:12
int find(char c, int index=0, bool cs=TRUE) const
Definition: qcstring.cpp:41
virtual bool Action(int depth)
QTextStream & endl(QTextStream &s)