26 #include <boost/algorithm/string/case_conv.hpp> 28 #include "TEveManager.h" 29 #include "TEveTrack.h" 30 #include "TEveTrackPropagator.h" 32 #include "TGeoManager.h" 33 #include "TGeoMatrix.h" 34 #include "TEveGeoNode.h" 35 #include "TEveTrans.h" 36 #include "TEveScene.h" 37 #include "TEveViewer.h" 39 #include "TGLScenePad.h" 40 #include "TGLRnrCtx.h" 41 #include "TEvePointSet.h" 45 #include "TEveQuadSet.h" 46 #include "TEveStraightLineSet.h" 47 #include "TEveRGBAPalette.h" 61 TEveGeoTopNode*
make_node(
const TString&
path, Int_t vis_level, Bool_t global_cs);
100 m_level(iConfig.getUntrackedParameter<
int>(
"level")),
101 m_nodes(iConfig.getUntrackedParameter<
vstring>(
"nodes")),
106 boost::algorithm::to_upper(component);
108 if (component ==
"NONE") {
110 }
else if (component ==
"ABSBZ") {
112 }
else if (component ==
"ABSBR") {
114 }
else if (component ==
"ABSBPHI") {
116 }
else if (component ==
"BR") {
118 }
else if (component ==
"BPHI") {
148 if (!gGeoManager->cd(
path)) {
149 Warning(
"make_node",
"Path '%s' not found.",
path.Data());
153 TEveGeoTopNode* tn =
new TEveGeoTopNode(gGeoManager, gGeoManager->GetCurrentNode());
154 tn->SetVisLevel(vis_level);
156 tn->RefMainTrans().SetFrom(*gGeoManager->GetCurrentMatrix());
159 gEve->AddToListTree(tn,
true);
175 gStyle->SetPalette(1,
nullptr);
180 minval = 0, maxval = 4000;
182 minval = 0, maxval = 4000;
184 minval = 0, maxval = 1000;
186 minval = -4000, maxval = 4000;
188 minval = -200, maxval = 200;
191 TEveRGBAPalette* pal =
new TEveRGBAPalette(minval, maxval);
193 TEveStraightLineSet*
ls =
nullptr;
195 ls =
new TEveStraightLineSet(
"MF_line_direction");
196 ls->SetPickable(
false);
197 ls->SetLineColor(kGreen);
198 ls->SetMarkerColor(kGreen);
199 ls->SetMarkerStyle(1);
202 TEveQuadSet*
q =
new TEveQuadSet(
"MF_quad_values");
203 q->Reset(TEveQuadSet::kQT_RectangleXY, kFALSE, 32);
205 q->SetAlwaysSecSelect(
true);
213 TEveVectorD b01 = (v01 -
v0);
214 TEveVectorD b02 = (v02 -
v0);
215 TEveVectorD b03 = b01.Cross(b02);
218 trans.SetBaseVec(1, b01.fX, b01.fY, b01.fZ);
219 trans.SetBaseVec(2, b02.fX, b02.fY, b02.fZ);
220 trans.SetBaseVec(3, b03.fX, b03.fY, b03.fZ);
221 trans.SetPos(
v0.Arr());
223 q->SetTransMatrix(trans.Array());
228 q->SetDefWidth(w_step);
229 q->SetDefHeight(h_step);
231 trans.GetBaseVec(1).GetXYZ(
d1);
234 trans.GetBaseVec(2).GetXYZ(d2);
239 double line_step_size =
TMath::Min(w_step, h_step);
243 TEveVectorD
p =
d1 * Double_t(
i) + d2 * Double_t(
j) +
v0;
261 q->AddQuad(w_step *
i, h_step *
j);
264 q->QuadId(
new TNamed(Form(
"Mag (%f, %f, %f) val = %f",
b.x(),
b.y(),
b.z(),
b.mag()),
"Dong!"));
267 if (
b.mag() > 1
e-6) {
270 ls->AddLine(
p.fX,
p.fY,
p.fZ,
p.fX +
b.x(),
p.fY +
b.y(),
p.fZ +
b.z());
272 ls->AddLine(
p.fX,
p.fY,
p.fZ,
p.fX +
b.x(),
p.fY +
b.y(),
p.fZ +
b.z());
275 ls->AddMarker(
ls->GetLinePlex().Size() - 1, 0);
281 TEveScene*
eps = gEve->SpawnNewScene(
"MF Map");
282 gEve->GetDefaultViewer()->AddScene(
eps);
283 eps->GetGLScene()->SetStyle(TGLRnrCtx::kFill);
315 m_geomList =
new TEveElementList(
"Display Geom");
337 desc.addUntracked<
vstring>(
"nodes",
vstring{
"tracker:Tracker_1",
"muonBase:MUON_1",
"caloBase:CALO_1"})
338 ->setComment(
"List of nodes to visualize");
340 desc.addUntracked<
int>(
"level", 4)->setComment(
"Levels into the geometry hierarchy visualized at startup");
342 ->setComment(
"Component of the MF to show: 'None', 'B', 'AbsBZ', 'AbsBR', 'AbsBphi', 'BR', 'Bphi'");
343 desc.addUntracked<std::vector<double> >(
"MF_plane_d0", std::vector<double>{0., -900., -2400.})
344 ->setComment(
"1st corner of MF map");
345 desc.addUntracked<std::vector<double> >(
"MF_plane_d1", std::vector<double>{0., -900., 2400.})
346 ->setComment(
"2nd corner of MF map");
347 desc.addUntracked<std::vector<double> >(
"MF_plane_d2", std::vector<double>{0., 900., -2400.})
348 ->setComment(
"3rd corner of MF map");
349 desc.addUntracked<
int>(
"MF_plane_N", 200)->setComment(
"Number of bins for the MF map in 1st coord");
350 desc.addUntracked<
int>(
"MF_plane_N2", -1)->setComment(
"Number of bins for the MF map in 2nd coord");
351 desc.addUntracked<
int>(
"MF_plane_draw_dir",
true)->setComment(
"Draw MF direction arrows (slow)");
352 desc.addUntracked<
bool>(
"MF_pickable",
false)->setComment(
"MF values are pickable (slow)");
std::vector< std::string > vstring
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
void remakeGeometry(const DisplayGeomRecord &dgRec)
DisplayGeom(const edm::ParameterSet &)
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
Sin< T >::type sin(const T &t)
std::vector< double > m_MF_plane_d1
edm::Service< EveService > m_eve
T getUntrackedParameter(std::string const &, T const &) const
TEveGeoTopNode * make_node(const TString &path, Int_t vis_level, Bool_t global_cs)
std::vector< double > m_MF_plane_d2
Cos< T >::type cos(const T &t)
#define DEFINE_FWK_MODULE(type)
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_magFieldToken
std::vector< double > m_MF_plane_d0
TEveManager * getManager()
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool check(const edm::EventSetup &iSetup)
void AddElement(TEveElement *el)
edm::ESWatcher< DisplayGeomRecord > m_geomWatcher
static constexpr float d1
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
void analyze(const edm::Event &, const edm::EventSetup &) override
static void fillDescriptions(edm::ConfigurationDescriptions &)
void AddGlobalElement(TEveElement *el)
const edm::ESGetToken< TGeoManager, DisplayGeomRecord > m_displayGeomToken